-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from autonomys/ref/agent-frame-types
Ref/agent frame types
- Loading branch information
Showing
11 changed files
with
180 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
characters/ | ||
!characters/character.example.ts | ||
.cookies/ | ||
dsn-kol-schemas.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
auto-agents-framework/src/agents/workflows/kol/cli/extractDsnSchemas.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { z } from 'zod'; | ||
import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
import { DsnDataType } from '../types.js'; | ||
import { engagementSchema, responseSchema, skippedEngagementSchema, dsnTweet } from '../schemas.js'; | ||
import { writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
|
||
const dsnCommonFields = z.object({ | ||
previousCid: z.string().optional(), | ||
signature: z.string(), | ||
timestamp: z.string(), | ||
agentVersion: z.string(), | ||
}); | ||
|
||
const extractDsnResponseSchema = () => { | ||
const schema = z | ||
.object({ | ||
type: z.literal(DsnDataType.RESPONSE), | ||
tweet: dsnTweet, | ||
decision: engagementSchema, | ||
}) | ||
.merge(responseSchema) | ||
.merge(dsnCommonFields); | ||
|
||
return zodToJsonSchema(schema); | ||
}; | ||
|
||
const extractDsnSkippedEngagementSchema = () => { | ||
const schema = z | ||
.object({ | ||
type: z.literal(DsnDataType.SKIPPED_ENGAGEMENT), | ||
tweet: dsnTweet, | ||
}) | ||
.merge(skippedEngagementSchema) | ||
.merge(dsnCommonFields); | ||
|
||
return zodToJsonSchema(schema); | ||
}; | ||
|
||
const extractDsnGeneratedTweetSchema = () => { | ||
const schema = z | ||
.object({ | ||
type: z.literal(DsnDataType.GENERATED_TWEET), | ||
content: z.string(), | ||
tweetId: z.string().nullable(), | ||
}) | ||
.merge(dsnCommonFields); | ||
|
||
return zodToJsonSchema(schema); | ||
}; | ||
|
||
const main = () => { | ||
const schemas = { | ||
response: extractDsnResponseSchema(), | ||
skipped_engagement: extractDsnSkippedEngagementSchema(), | ||
generated_tweet: extractDsnGeneratedTweetSchema(), | ||
}; | ||
|
||
const outputPath = join(process.cwd(), 'dsn-kol-schemas.json'); | ||
writeFileSync(outputPath, JSON.stringify(schemas, null, 2)); | ||
console.log(`Schemas written to ${outputPath}`); | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 15 additions & 11 deletions
26
auto-agents-framework/src/agents/workflows/kol/schemas.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters