agency-lang 0.0.71 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/agents/agency-agent/agent.agency +7 -12
- package/dist/lib/agents/agency-agent/agent.js +934 -0
- package/dist/lib/agents/agency-agent/run.js +9 -4
- package/dist/lib/agents/agency-agent/subagents/code.js +261 -0
- package/dist/lib/agents/agency-agent/subagents/plan.js +353 -0
- package/dist/lib/agents/agency-agent/subagents/task.js +250 -0
- package/dist/lib/backends/agencyGenerator.d.ts +1 -1
- package/dist/lib/backends/agencyGenerator.js +9 -5
- package/dist/lib/backends/baseGenerator.d.ts +2 -2
- package/dist/lib/backends/baseGenerator.js +7 -2
- package/dist/lib/backends/typescriptGenerator/typeToString.js +7 -1
- package/dist/lib/backends/typescriptGenerator.d.ts +1 -1
- package/dist/lib/backends/typescriptGenerator.js +23 -14
- package/dist/lib/config.d.ts +5 -0
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/parsers/typeHints.js +3 -3
- package/dist/lib/preprocessors/typescriptPreprocessor.js +38 -8
- package/dist/lib/runtime/hooks.d.ts +3 -3
- package/dist/lib/runtime/prompt.js +4 -4
- package/dist/lib/statelogClient.d.ts +3 -3
- package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +3 -1
- package/dist/lib/templates/backends/typescriptGenerator/imports.js +8 -1
- package/dist/lib/types.d.ts +4 -1
- package/dist/lib/utils.js +3 -3
- package/package.json +4 -4
|
@@ -43,11 +43,6 @@ config = {
|
|
|
43
43
|
strict: true,
|
|
44
44
|
numRetries: 2,
|
|
45
45
|
allowExtraKeys: true
|
|
46
|
-
},
|
|
47
|
-
statelog: {
|
|
48
|
-
host: "http://localhost:1065",
|
|
49
|
-
projectId: "smoltalk",
|
|
50
|
-
apiKey: ""
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
/* config = {
|
|
@@ -91,11 +86,11 @@ node main() {
|
|
|
91
86
|
print(color.cyan("Would you like to create a new agent or modify an existing one?"))
|
|
92
87
|
userinput = input("(create/modify) ")
|
|
93
88
|
thread {
|
|
94
|
-
mode: Mode = llm("
|
|
89
|
+
mode: Mode = llm("categorize this user response as 'create' or 'modify': ${userinput}", config)
|
|
95
90
|
}
|
|
96
91
|
print(color.cyan("Great! Let's ${mode} an agent."))
|
|
97
92
|
match(mode) {
|
|
98
|
-
"create" => return plan("create", "")
|
|
93
|
+
"create" => return plan("create", "", null)
|
|
99
94
|
"modify" => return readExisting()
|
|
100
95
|
}
|
|
101
96
|
}
|
|
@@ -105,7 +100,7 @@ node readExisting() {
|
|
|
105
100
|
existingCode = read(filepath)
|
|
106
101
|
print(color.cyan("Here's the existing code:"))
|
|
107
102
|
printCode(existingCode)
|
|
108
|
-
return plan("modify", existingCode)
|
|
103
|
+
return plan("modify", existingCode, filepath)
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
node printSample() {
|
|
@@ -114,7 +109,7 @@ node printSample() {
|
|
|
114
109
|
printCode(codeSample)
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
node plan(mode, existingCode) {
|
|
112
|
+
node plan(mode, existingCode, existingFilename: string | null) {
|
|
118
113
|
print(color.cyan("Let's start by coming up with a plan for what you want to accomplish."))
|
|
119
114
|
modeContext = ""
|
|
120
115
|
if (mode == "modify") {
|
|
@@ -146,7 +141,7 @@ node plan(mode, existingCode) {
|
|
|
146
141
|
print(color.cyan("Here's the plan we've come up with"))
|
|
147
142
|
printJSON(plan)
|
|
148
143
|
}
|
|
149
|
-
return design(plan, mode, existingCode)
|
|
144
|
+
return design(plan, mode, existingCode, existingFilename)
|
|
150
145
|
}
|
|
151
146
|
|
|
152
147
|
type Plan = {
|
|
@@ -156,7 +151,7 @@ type Plan = {
|
|
|
156
151
|
|
|
157
152
|
type DesignAction = { type: "askUser"; question: string } | { type: "done"; finalCode: string; filename: string } | { type: "start" }
|
|
158
153
|
|
|
159
|
-
node design(plan, mode, existingCode) {
|
|
154
|
+
node design(plan, mode, existingCode, existingFilename: string | null) {
|
|
160
155
|
designPrompt = read("./prompts/design.md")
|
|
161
156
|
prompt = ""
|
|
162
157
|
if (mode == "modify") {
|
|
@@ -200,5 +195,5 @@ node design(plan, mode, existingCode) {
|
|
|
200
195
|
print(color.green("Great! We've designed the agent. Now let's write the code for it."))
|
|
201
196
|
printJSON(color.magenta(nextAction))
|
|
202
197
|
nextAction.filename = nextAction.filename || "agent.agency"
|
|
203
|
-
writeCodeWithConfirm(nextAction.filename, nextAction.finalCode)
|
|
198
|
+
writeCodeWithConfirm(existingFilename || nextAction.filename, nextAction.finalCode)
|
|
204
199
|
}
|