clanka 0.9.0 → 0.10.0
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/Acp.d.ts +6 -1
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +25 -0
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +109 -4
- package/dist/Acp.test.js.map +1 -1
- package/dist/AcpImage.test.js +6 -1
- package/dist/AcpImage.test.js.map +1 -1
- package/dist/Agent.d.ts +17 -0
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +90 -15
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +9 -1
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentCallerConfig.test.js +9 -1
- package/dist/AgentCallerConfig.test.js.map +1 -1
- package/dist/AgentEnvironment.d.ts +76 -0
- package/dist/AgentEnvironment.d.ts.map +1 -0
- package/dist/AgentEnvironment.js +119 -0
- package/dist/AgentEnvironment.js.map +1 -0
- package/dist/AgentEnvironment.test.d.ts +2 -0
- package/dist/AgentEnvironment.test.d.ts.map +1 -0
- package/dist/AgentEnvironment.test.js +304 -0
- package/dist/AgentEnvironment.test.js.map +1 -0
- package/dist/AgentExecutor.d.ts +146 -187
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +212 -49
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +94 -8
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentExecutorImage.test.js +3 -0
- package/dist/AgentExecutorImage.test.js.map +1 -1
- package/dist/AgentImage.test.js +11 -2
- package/dist/AgentImage.test.js.map +1 -1
- package/dist/AgentOutput.d.ts +17 -4
- package/dist/AgentOutput.d.ts.map +1 -1
- package/dist/AgentOutput.js +13 -0
- package/dist/AgentOutput.js.map +1 -1
- package/dist/AgentSkills.d.ts +15 -0
- package/dist/AgentSkills.d.ts.map +1 -1
- package/dist/AgentSkills.js +60 -32
- package/dist/AgentSkills.js.map +1 -1
- package/dist/AgentSkills.test.js +12 -2
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentSubagents.test.js +42 -0
- package/dist/AgentSubagents.test.js.map +1 -1
- package/dist/AgentTools.js +1 -1
- package/dist/AgentTools.js.map +1 -1
- package/dist/OutputFormatter.d.ts.map +1 -1
- package/dist/OutputFormatter.js +3 -0
- package/dist/OutputFormatter.js.map +1 -1
- package/dist/bin/{OutputFormatter-DXXKo4E8.mjs → OutputFormatter-BFAv48k9.mjs} +2 -1
- package/dist/bin/{OutputFormatter-DXXKo4E8.mjs.map → OutputFormatter-BFAv48k9.mjs.map} +1 -1
- package/dist/bin/cli.mjs +13316 -13094
- package/dist/bin/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Acp.test.ts +162 -5
- package/src/Acp.ts +24 -1
- package/src/AcpImage.test.ts +6 -1
- package/src/Agent.test.ts +9 -1
- package/src/Agent.ts +136 -12
- package/src/AgentCallerConfig.test.ts +9 -1
- package/src/AgentEnvironment.test.ts +504 -0
- package/src/AgentEnvironment.ts +161 -0
- package/src/AgentExecutor.test.ts +121 -4
- package/src/AgentExecutor.ts +388 -99
- package/src/AgentExecutorImage.test.ts +3 -0
- package/src/AgentImage.test.ts +11 -2
- package/src/AgentOutput.ts +17 -0
- package/src/AgentSkills.test.ts +12 -2
- package/src/AgentSkills.ts +74 -34
- package/src/AgentSubagents.test.ts +66 -0
- package/src/AgentTools.ts +1 -1
- package/src/OutputFormatter.ts +3 -0
package/dist/AgentExecutor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentTools, CurrentDirectory, DirectoryChanger, type ExcludableTool, ImageAttacher, type ImageAttachment, SubagentExecutor, type Subagents, TaskCompleter } from "./AgentTools.ts";
|
|
1
|
+
import { type DelegateResult, AgentTools, AgentToolsWithSearch, CurrentDirectory, DirectoryChanger, type ExcludableTool, ImageAttacher, type ImageAttachment, SubagentExecutor, type Subagents, TaskCompleter } from "./AgentTools.ts";
|
|
2
2
|
import { ToolkitRenderer } from "./ToolkitRenderer.ts";
|
|
3
3
|
import * as AgentSkills from "./AgentSkills.ts";
|
|
4
4
|
import type * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
|
|
@@ -18,14 +18,34 @@ import * as RpcServer from "effect/rpc/RpcServer";
|
|
|
18
18
|
import * as Schema from "effect/Schema";
|
|
19
19
|
import * as RpcGroup from "effect/rpc/RpcGroup";
|
|
20
20
|
import * as Rpc from "effect/rpc/Rpc";
|
|
21
|
-
import { SemanticSearch } from "./SemanticSearch/Service.ts";
|
|
22
21
|
declare const AgentExecutor_base: Context.ServiceClass<AgentExecutor, "clanka/AgentExecutor", {
|
|
23
22
|
readonly capabilities: Effect.Effect<Capabilities>;
|
|
24
23
|
execute(options: ExecuteOptions): Stream.Stream<string>;
|
|
25
24
|
executeUnsafe<Tool extends keyof typeof AgentTools.tools>(options: {
|
|
26
25
|
readonly tool: Tool;
|
|
27
26
|
readonly params: (typeof AgentTools.tools)[Tool]["parametersSchema"]["Encoded"];
|
|
27
|
+
/**
|
|
28
|
+
* The environment the tool runs in. Defaults to the startup
|
|
29
|
+
* environment. Changes made by the tool are not returned.
|
|
30
|
+
*/
|
|
31
|
+
readonly environment?: ExecutionEnvironment | undefined;
|
|
28
32
|
}): Effect.Effect<Schema.Json>;
|
|
33
|
+
/**
|
|
34
|
+
* Render the AGENTS.md files and skills that apply to the environment's
|
|
35
|
+
* directory and that the model has not seen yet. The agent calls it once
|
|
36
|
+
* after the scripts of a model response, so one update covers all of
|
|
37
|
+
* them; `execute` itself never renders one.
|
|
38
|
+
*
|
|
39
|
+
* With `reset`, everything sent since the system prompt is forgotten and
|
|
40
|
+
* rendered again. Any operation that rewrites the history, such as
|
|
41
|
+
* compaction, must do this, so the environment's record of what the
|
|
42
|
+
* model has seen matches the history.
|
|
43
|
+
*
|
|
44
|
+
* Optional: without it the agent sends no updates.
|
|
45
|
+
*/
|
|
46
|
+
readonly renderEnvironment?: ((environment: ExecutionEnvironment, options?: {
|
|
47
|
+
readonly reset?: boolean | undefined;
|
|
48
|
+
} | undefined) => Effect.Effect<EnvironmentUpdate>) | undefined;
|
|
29
49
|
}>;
|
|
30
50
|
/**
|
|
31
51
|
* @since 1.0.0
|
|
@@ -39,6 +59,18 @@ export declare class AgentExecutor extends AgentExecutor_base {
|
|
|
39
59
|
*/
|
|
40
60
|
export interface ExecuteOptions {
|
|
41
61
|
readonly script: string;
|
|
62
|
+
/**
|
|
63
|
+
* The environment the script starts in: the `environment` of the last
|
|
64
|
+
* `onEnvironment` call for this agent, or `Capabilities.environment` for
|
|
65
|
+
* its first script.
|
|
66
|
+
*/
|
|
67
|
+
readonly environment: ExecutionEnvironment;
|
|
68
|
+
/**
|
|
69
|
+
* Receives the environment the script left behind, once, when the script
|
|
70
|
+
* ends. It is also called when the script fails, times out or is
|
|
71
|
+
* interrupted. Pass it to the next `execute` of the same agent.
|
|
72
|
+
*/
|
|
73
|
+
readonly onEnvironment: (environment: ExecutionEnvironment) => Effect.Effect<void>;
|
|
42
74
|
/**
|
|
43
75
|
* Fails with a message for the script when the task cannot be completed
|
|
44
76
|
* yet, for example while sub-agents are still running.
|
|
@@ -47,7 +79,7 @@ export interface ExecuteOptions {
|
|
|
47
79
|
/**
|
|
48
80
|
* The sub-agents of the agent running the script.
|
|
49
81
|
*/
|
|
50
|
-
readonly subagents:
|
|
82
|
+
readonly subagents: ExecuteSubagents;
|
|
51
83
|
/**
|
|
52
84
|
* Receives every image `readFile` attached while the script ran.
|
|
53
85
|
*/
|
|
@@ -58,6 +90,62 @@ export interface ExecuteOptions {
|
|
|
58
90
|
*/
|
|
59
91
|
readonly loopTools?: LoopToolHandlers | undefined;
|
|
60
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* The sub-agents of the agent running a script. `delegate` also receives the
|
|
95
|
+
* environment the new agent starts in: the script's directory at the moment
|
|
96
|
+
* `delegate` was called, with an update holding everything that applies to
|
|
97
|
+
* it beyond the system prompt.
|
|
98
|
+
*
|
|
99
|
+
* @since 1.0.0
|
|
100
|
+
* @category Models
|
|
101
|
+
*/
|
|
102
|
+
export interface ExecuteSubagents extends Omit<Subagents, "delegate"> {
|
|
103
|
+
readonly delegate: (options: {
|
|
104
|
+
readonly prompt: string;
|
|
105
|
+
readonly background: boolean;
|
|
106
|
+
readonly environment: EnvironmentUpdate;
|
|
107
|
+
}) => Effect.Effect<DelegateResult>;
|
|
108
|
+
}
|
|
109
|
+
declare const ExecutionEnvironment_base: Schema.Class<ExecutionEnvironment, Schema.Struct<{
|
|
110
|
+
readonly cwd: Schema.String;
|
|
111
|
+
/**
|
|
112
|
+
* Ids of the context items already in the system prompt.
|
|
113
|
+
*/
|
|
114
|
+
readonly baseline: Schema.$Array<Schema.String>;
|
|
115
|
+
/**
|
|
116
|
+
* Ids of the context items sent to the model in the history since.
|
|
117
|
+
*/
|
|
118
|
+
readonly seen: Schema.$Array<Schema.String>;
|
|
119
|
+
}>, {}>;
|
|
120
|
+
/**
|
|
121
|
+
* The state the executor keeps for one agent, such as its working directory.
|
|
122
|
+
* Only the executor reads its fields. The agent stores the value it last
|
|
123
|
+
* received from `onEnvironment` and passes it to its next `execute`, so every
|
|
124
|
+
* agent has its own working directory.
|
|
125
|
+
*
|
|
126
|
+
* @since 1.0.0
|
|
127
|
+
* @category Models
|
|
128
|
+
*/
|
|
129
|
+
export declare class ExecutionEnvironment extends ExecutionEnvironment_base {
|
|
130
|
+
}
|
|
131
|
+
declare const EnvironmentUpdate_base: Schema.Class<EnvironmentUpdate, Schema.Struct<{
|
|
132
|
+
/**
|
|
133
|
+
* The environment once `update` is in the history: what it describes
|
|
134
|
+
* counts as seen. Store it only together with the update.
|
|
135
|
+
*/
|
|
136
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
137
|
+
/**
|
|
138
|
+
* AGENTS.md files and skills the model has not seen yet, or `None` when
|
|
139
|
+
* nothing is new. The agent wraps it in an `<environment-update>` message.
|
|
140
|
+
*/
|
|
141
|
+
readonly update: Schema.Option<Schema.String>;
|
|
142
|
+
}>, {}>;
|
|
143
|
+
/**
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @category Models
|
|
146
|
+
*/
|
|
147
|
+
export declare class EnvironmentUpdate extends EnvironmentUpdate_base {
|
|
148
|
+
}
|
|
61
149
|
/**
|
|
62
150
|
* Loop-side tool handlers by function name. A handler receives the script's
|
|
63
151
|
* argument undecoded; a failure rejects the script's call with the string as
|
|
@@ -69,8 +157,15 @@ export interface ExecuteOptions {
|
|
|
69
157
|
export type LoopToolHandlers = Readonly<Record<string, (params: unknown) => Effect.Effect<unknown, string>>>;
|
|
70
158
|
declare const Capabilities_base: Schema.Class<Capabilities, Schema.Struct<{
|
|
71
159
|
readonly toolsDts: Schema.String;
|
|
72
|
-
|
|
160
|
+
/**
|
|
161
|
+
* The startup AGENTS.md as rendered for the system prompt, with its path.
|
|
162
|
+
*/
|
|
163
|
+
readonly instructions: Schema.Option<Schema.String>;
|
|
73
164
|
readonly supportsSearch: Schema.Boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The environment of an agent's first script.
|
|
167
|
+
*/
|
|
168
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
74
169
|
/**
|
|
75
170
|
* The names of the script functions the executor offers.
|
|
76
171
|
*/
|
|
@@ -136,192 +231,12 @@ export interface LocalOptions<Toolkit extends Toolkit.Any = never> {
|
|
|
136
231
|
*/
|
|
137
232
|
readonly excludeTools?: ReadonlyArray<ExcludableTool> | undefined;
|
|
138
233
|
}
|
|
234
|
+
type LocalServices<Toolkit> = ToolkitRenderer | FileSystem.FileSystem | Path.Path | Tool.HandlersFor<typeof AgentToolsWithSearch.tools> | Exclude<Toolkit extends Toolkit.Toolkit<infer T> ? Tool.HandlersFor<T> | Tool.HandlerServices<T[keyof T]> : never, CurrentDirectory | DirectoryChanger | SubagentExecutor | TaskCompleter | ImageAttacher>;
|
|
139
235
|
/**
|
|
140
236
|
* @since 1.0.0
|
|
141
237
|
* @category Constructors
|
|
142
238
|
*/
|
|
143
|
-
export declare const makeLocal: <Toolkit extends Toolkit.Any = never>(options: LocalOptions<Toolkit>) => Effect.Effect<
|
|
144
|
-
readonly capabilities: Effect.Effect<Capabilities>;
|
|
145
|
-
execute(options: ExecuteOptions): Stream.Stream<string>;
|
|
146
|
-
executeUnsafe<Tool extends keyof typeof AgentTools.tools>(options: {
|
|
147
|
-
readonly tool: Tool;
|
|
148
|
-
readonly params: (typeof AgentTools.tools)[Tool]["parametersSchema"]["Encoded"];
|
|
149
|
-
}): Effect.Effect<Schema.Json>;
|
|
150
|
-
}, never, FileSystem.FileSystem | Path.Path | ToolkitRenderer | Exclude<Toolkit extends Toolkit.Toolkit<infer T extends Record<string, Tool.Any>> ? Tool.HandlersFor<T> | Tool.HandlerServices<T[keyof T]> : never, CurrentDirectory | DirectoryChanger | ImageAttacher | SubagentExecutor | TaskCompleter> | Tool.HandlersFor<{
|
|
151
|
-
readonly applyPatch: Tool.Tool<"applyPatch", {
|
|
152
|
-
readonly parameters: Schema.String;
|
|
153
|
-
readonly success: Schema.String;
|
|
154
|
-
readonly failure: Schema.Never;
|
|
155
|
-
readonly failureMode: "error";
|
|
156
|
-
}, CurrentDirectory>;
|
|
157
|
-
readonly bash: Tool.Tool<"bash", {
|
|
158
|
-
readonly parameters: Schema.Struct<{
|
|
159
|
-
readonly command: Schema.String;
|
|
160
|
-
readonly timeoutMs: Schema.optional<Schema.Finite>;
|
|
161
|
-
}>;
|
|
162
|
-
readonly success: Schema.String;
|
|
163
|
-
readonly failure: Schema.Never;
|
|
164
|
-
readonly failureMode: "error";
|
|
165
|
-
}, CurrentDirectory>;
|
|
166
|
-
readonly changeDirectory: Tool.Tool<"changeDirectory", {
|
|
167
|
-
readonly parameters: Schema.String;
|
|
168
|
-
readonly success: Schema.String;
|
|
169
|
-
readonly failure: Schema.Never;
|
|
170
|
-
readonly failureMode: "error";
|
|
171
|
-
}, DirectoryChanger>;
|
|
172
|
-
readonly delegate: Tool.Tool<"delegate", {
|
|
173
|
-
readonly parameters: Schema.Struct<{
|
|
174
|
-
readonly prompt: Schema.String;
|
|
175
|
-
readonly background: Schema.optional<Schema.Boolean>;
|
|
176
|
-
}>;
|
|
177
|
-
readonly success: Schema.Struct<{
|
|
178
|
-
readonly id: Schema.String;
|
|
179
|
-
readonly output: Schema.optional<Schema.String>;
|
|
180
|
-
readonly status: Schema.Literals<readonly ["completed", "running"]>;
|
|
181
|
-
}>;
|
|
182
|
-
readonly failure: Schema.String;
|
|
183
|
-
readonly failureMode: "error";
|
|
184
|
-
}, SubagentExecutor>;
|
|
185
|
-
readonly fetchMarkdown: Tool.Tool<"fetchMarkdown", {
|
|
186
|
-
readonly parameters: Schema.String;
|
|
187
|
-
readonly success: Schema.String;
|
|
188
|
-
readonly failure: Schema.Never;
|
|
189
|
-
readonly failureMode: "error";
|
|
190
|
-
}, never>;
|
|
191
|
-
readonly gh: Tool.Tool<"gh", {
|
|
192
|
-
readonly parameters: Schema.$Array<Schema.String>;
|
|
193
|
-
readonly success: Schema.String;
|
|
194
|
-
readonly failure: Schema.Never;
|
|
195
|
-
readonly failureMode: "error";
|
|
196
|
-
}, CurrentDirectory>;
|
|
197
|
-
readonly glob: Tool.Tool<"glob", {
|
|
198
|
-
readonly parameters: Schema.String;
|
|
199
|
-
readonly success: Schema.$Array<Schema.String>;
|
|
200
|
-
readonly failure: Schema.Never;
|
|
201
|
-
readonly failureMode: "error";
|
|
202
|
-
}, CurrentDirectory>;
|
|
203
|
-
readonly listAgents: Tool.Tool<"listAgents", {
|
|
204
|
-
readonly parameters: Schema.Void;
|
|
205
|
-
readonly success: Schema.$Array<Schema.Struct<{
|
|
206
|
-
readonly id: Schema.String;
|
|
207
|
-
readonly status: Schema.Literals<readonly ["completed", "running", "failed", "cancelled"]>;
|
|
208
|
-
readonly prompt: Schema.String;
|
|
209
|
-
}>>;
|
|
210
|
-
readonly failure: Schema.Never;
|
|
211
|
-
readonly failureMode: "error";
|
|
212
|
-
}, SubagentExecutor>;
|
|
213
|
-
readonly ls: Tool.Tool<"ls", {
|
|
214
|
-
readonly parameters: Schema.String;
|
|
215
|
-
readonly success: Schema.$Array<Schema.String>;
|
|
216
|
-
readonly failure: Schema.Never;
|
|
217
|
-
readonly failureMode: "error";
|
|
218
|
-
}, CurrentDirectory>;
|
|
219
|
-
readonly messageAgent: Tool.Tool<"messageAgent", {
|
|
220
|
-
readonly parameters: Schema.Struct<{
|
|
221
|
-
readonly id: Schema.String;
|
|
222
|
-
readonly message: Schema.String;
|
|
223
|
-
}>;
|
|
224
|
-
readonly success: Schema.Struct<{
|
|
225
|
-
readonly id: Schema.String;
|
|
226
|
-
readonly status: Schema.Literals<readonly ["completed", "running", "failed", "cancelled"]>;
|
|
227
|
-
readonly output: Schema.optional<Schema.String>;
|
|
228
|
-
}>;
|
|
229
|
-
readonly failure: Schema.String;
|
|
230
|
-
readonly failureMode: "error";
|
|
231
|
-
}, SubagentExecutor>;
|
|
232
|
-
readonly readFile: Tool.Tool<"readFile", {
|
|
233
|
-
readonly parameters: Schema.Struct<{
|
|
234
|
-
readonly path: Schema.String;
|
|
235
|
-
readonly startLine: Schema.optional<Schema.Number>;
|
|
236
|
-
readonly endLine: Schema.optional<Schema.Number>;
|
|
237
|
-
}>;
|
|
238
|
-
readonly success: Schema.NullOr<Schema.String>;
|
|
239
|
-
readonly failure: Schema.Never;
|
|
240
|
-
readonly failureMode: "error";
|
|
241
|
-
}, CurrentDirectory | ImageAttacher>;
|
|
242
|
-
readonly removeFile: Tool.Tool<"removeFile", {
|
|
243
|
-
readonly parameters: Schema.String;
|
|
244
|
-
readonly success: Schema.Void;
|
|
245
|
-
readonly failure: Schema.Never;
|
|
246
|
-
readonly failureMode: "error";
|
|
247
|
-
}, CurrentDirectory>;
|
|
248
|
-
readonly renameFile: Tool.Tool<"renameFile", {
|
|
249
|
-
readonly parameters: Schema.Struct<{
|
|
250
|
-
readonly from: Schema.String;
|
|
251
|
-
readonly to: Schema.String;
|
|
252
|
-
}>;
|
|
253
|
-
readonly success: Schema.Void;
|
|
254
|
-
readonly failure: Schema.Never;
|
|
255
|
-
readonly failureMode: "error";
|
|
256
|
-
}, CurrentDirectory>;
|
|
257
|
-
readonly rg: Tool.Tool<"rg", {
|
|
258
|
-
readonly parameters: Schema.Struct<{
|
|
259
|
-
readonly pattern: Schema.String;
|
|
260
|
-
readonly glob: Schema.optional<Schema.String>;
|
|
261
|
-
readonly filesOnly: Schema.optional<Schema.Boolean>;
|
|
262
|
-
readonly maxLines: Schema.optional<Schema.Finite>;
|
|
263
|
-
}>;
|
|
264
|
-
readonly success: Schema.String;
|
|
265
|
-
readonly failure: Schema.Never;
|
|
266
|
-
readonly failureMode: "error";
|
|
267
|
-
}, CurrentDirectory>;
|
|
268
|
-
readonly search: Tool.Tool<"search", {
|
|
269
|
-
readonly parameters: Schema.String;
|
|
270
|
-
readonly success: Schema.String;
|
|
271
|
-
readonly failure: Schema.Never;
|
|
272
|
-
readonly failureMode: "error";
|
|
273
|
-
}, SemanticSearch>;
|
|
274
|
-
readonly sleep: Tool.Tool<"sleep", {
|
|
275
|
-
readonly parameters: Schema.Finite;
|
|
276
|
-
readonly success: Schema.Void;
|
|
277
|
-
readonly failure: Schema.Never;
|
|
278
|
-
readonly failureMode: "error";
|
|
279
|
-
}, never>;
|
|
280
|
-
readonly stopAgent: Tool.Tool<"stopAgent", {
|
|
281
|
-
readonly parameters: Schema.String;
|
|
282
|
-
readonly success: Schema.Struct<{
|
|
283
|
-
readonly id: Schema.String;
|
|
284
|
-
readonly status: Schema.Literals<readonly ["completed", "running", "failed", "cancelled"]>;
|
|
285
|
-
readonly output: Schema.optional<Schema.String>;
|
|
286
|
-
}>;
|
|
287
|
-
readonly failure: Schema.String;
|
|
288
|
-
readonly failureMode: "error";
|
|
289
|
-
}, SubagentExecutor>;
|
|
290
|
-
readonly taskComplete: Tool.Tool<"taskComplete", {
|
|
291
|
-
readonly parameters: Schema.String;
|
|
292
|
-
readonly success: Schema.Void;
|
|
293
|
-
readonly failure: Schema.String;
|
|
294
|
-
readonly failureMode: "error";
|
|
295
|
-
}, TaskCompleter>;
|
|
296
|
-
readonly waitAgents: Tool.Tool<"waitAgents", {
|
|
297
|
-
readonly parameters: Schema.UndefinedOr<Schema.$Array<Schema.String>>;
|
|
298
|
-
readonly success: Schema.$Array<Schema.Struct<{
|
|
299
|
-
readonly id: Schema.String;
|
|
300
|
-
readonly status: Schema.Literals<readonly ["completed", "running", "failed", "cancelled"]>;
|
|
301
|
-
readonly output: Schema.optional<Schema.String>;
|
|
302
|
-
}>>;
|
|
303
|
-
readonly failure: Schema.String;
|
|
304
|
-
readonly failureMode: "error";
|
|
305
|
-
}, SubagentExecutor>;
|
|
306
|
-
readonly webSearch: Tool.Tool<"webSearch", {
|
|
307
|
-
readonly parameters: Schema.Struct<{
|
|
308
|
-
readonly query: Schema.String;
|
|
309
|
-
readonly numResults: Schema.optional<Schema.Number>;
|
|
310
|
-
}>;
|
|
311
|
-
readonly success: Schema.String;
|
|
312
|
-
readonly failure: Schema.Never;
|
|
313
|
-
readonly failureMode: "error";
|
|
314
|
-
}, never>;
|
|
315
|
-
readonly writeFile: Tool.Tool<"writeFile", {
|
|
316
|
-
readonly parameters: Schema.Struct<{
|
|
317
|
-
readonly path: Schema.String;
|
|
318
|
-
readonly content: Schema.String;
|
|
319
|
-
}>;
|
|
320
|
-
readonly success: Schema.Void;
|
|
321
|
-
readonly failure: Schema.Never;
|
|
322
|
-
readonly failureMode: "error";
|
|
323
|
-
}, CurrentDirectory>;
|
|
324
|
-
}>>;
|
|
239
|
+
export declare const makeLocal: <Toolkit extends Toolkit.Any = never>(options: LocalOptions<Toolkit>) => Effect.Effect<AgentExecutor["Service"], never, LocalServices<Toolkit>>;
|
|
325
240
|
/**
|
|
326
241
|
* @since 1.0.0
|
|
327
242
|
* @category Constructors
|
|
@@ -332,7 +247,28 @@ export declare const makeRpc: Effect.Effect<{
|
|
|
332
247
|
executeUnsafe<Tool extends keyof typeof AgentTools.tools>(options: {
|
|
333
248
|
readonly tool: Tool;
|
|
334
249
|
readonly params: (typeof AgentTools.tools)[Tool]["parametersSchema"]["Encoded"];
|
|
250
|
+
/**
|
|
251
|
+
* The environment the tool runs in. Defaults to the startup
|
|
252
|
+
* environment. Changes made by the tool are not returned.
|
|
253
|
+
*/
|
|
254
|
+
readonly environment?: ExecutionEnvironment | undefined;
|
|
335
255
|
}): Effect.Effect<Schema.Json>;
|
|
256
|
+
/**
|
|
257
|
+
* Render the AGENTS.md files and skills that apply to the environment's
|
|
258
|
+
* directory and that the model has not seen yet. The agent calls it once
|
|
259
|
+
* after the scripts of a model response, so one update covers all of
|
|
260
|
+
* them; `execute` itself never renders one.
|
|
261
|
+
*
|
|
262
|
+
* With `reset`, everything sent since the system prompt is forgotten and
|
|
263
|
+
* rendered again. Any operation that rewrites the history, such as
|
|
264
|
+
* compaction, must do this, so the environment's record of what the
|
|
265
|
+
* model has seen matches the history.
|
|
266
|
+
*
|
|
267
|
+
* Optional: without it the agent sends no updates.
|
|
268
|
+
*/
|
|
269
|
+
readonly renderEnvironment?: ((environment: ExecutionEnvironment, options?: {
|
|
270
|
+
readonly reset?: boolean | undefined;
|
|
271
|
+
} | undefined) => Effect.Effect<EnvironmentUpdate>) | undefined;
|
|
336
272
|
}, never, RpcClient.Protocol | Scope.Scope>;
|
|
337
273
|
/**
|
|
338
274
|
* @since 1.0.0
|
|
@@ -364,6 +300,10 @@ export declare const AgentRequest: Schema.TaggedUnion<{
|
|
|
364
300
|
readonly Delegate: Schema.TaggedStruct<"Delegate", {
|
|
365
301
|
readonly prompt: Schema.String;
|
|
366
302
|
readonly background: Schema.Boolean;
|
|
303
|
+
readonly environment: typeof EnvironmentUpdate;
|
|
304
|
+
}>;
|
|
305
|
+
readonly EnvironmentChanged: Schema.TaggedStruct<"EnvironmentChanged", {
|
|
306
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
367
307
|
}>;
|
|
368
308
|
readonly ListAgents: Schema.TaggedStruct<"ListAgents", {}>;
|
|
369
309
|
readonly LoopTool: Schema.TaggedStruct<"LoopTool", {
|
|
@@ -404,6 +344,9 @@ export declare const AgentResponse: Schema.TaggedUnion<{
|
|
|
404
344
|
* @category Rpcs
|
|
405
345
|
*/
|
|
406
346
|
export declare const ExecuteOutput: Schema.TaggedUnion<{
|
|
347
|
+
readonly Environment: Schema.TaggedStruct<"Environment", {
|
|
348
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
349
|
+
}>;
|
|
407
350
|
readonly Image: Schema.TaggedStruct<"Image", {
|
|
408
351
|
readonly fileName: Schema.String;
|
|
409
352
|
readonly mediaType: Schema.Literals<readonly ["image/png", "image/jpeg", "image/gif", "image/webp"]>;
|
|
@@ -415,6 +358,10 @@ export declare const ExecuteOutput: Schema.TaggedUnion<{
|
|
|
415
358
|
readonly Delegate: Schema.TaggedStruct<"Delegate", {
|
|
416
359
|
readonly prompt: Schema.String;
|
|
417
360
|
readonly background: Schema.Boolean;
|
|
361
|
+
readonly environment: typeof EnvironmentUpdate;
|
|
362
|
+
}>;
|
|
363
|
+
readonly EnvironmentChanged: Schema.TaggedStruct<"EnvironmentChanged", {
|
|
364
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
418
365
|
}>;
|
|
419
366
|
readonly ListAgents: Schema.TaggedStruct<"ListAgents", {}>;
|
|
420
367
|
readonly LoopTool: Schema.TaggedStruct<"LoopTool", {
|
|
@@ -442,11 +389,15 @@ export declare const ExecuteOutput: Schema.TaggedUnion<{
|
|
|
442
389
|
}>;
|
|
443
390
|
declare const Rpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"capabilities", Schema.Void, typeof Capabilities, Schema.Never, never, never> | Rpc.Rpc<"execute", Schema.Struct<{
|
|
444
391
|
readonly script: Schema.String;
|
|
392
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
445
393
|
/**
|
|
446
394
|
* The loop-side tools to add to the script sandbox.
|
|
447
395
|
*/
|
|
448
396
|
readonly loopTools: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
449
397
|
}>, import("effect/rpc/RpcSchema").Stream<Schema.TaggedUnion<{
|
|
398
|
+
readonly Environment: Schema.TaggedStruct<"Environment", {
|
|
399
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
400
|
+
}>;
|
|
450
401
|
readonly Image: Schema.TaggedStruct<"Image", {
|
|
451
402
|
readonly fileName: Schema.String;
|
|
452
403
|
readonly mediaType: Schema.Literals<readonly ["image/png", "image/jpeg", "image/gif", "image/webp"]>;
|
|
@@ -458,6 +409,10 @@ declare const Rpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"capabilities", Schema.Void,
|
|
|
458
409
|
readonly Delegate: Schema.TaggedStruct<"Delegate", {
|
|
459
410
|
readonly prompt: Schema.String;
|
|
460
411
|
readonly background: Schema.Boolean;
|
|
412
|
+
readonly environment: typeof EnvironmentUpdate;
|
|
413
|
+
}>;
|
|
414
|
+
readonly EnvironmentChanged: Schema.TaggedStruct<"EnvironmentChanged", {
|
|
415
|
+
readonly environment: typeof ExecutionEnvironment;
|
|
461
416
|
}>;
|
|
462
417
|
readonly ListAgents: Schema.TaggedStruct<"ListAgents", {}>;
|
|
463
418
|
readonly LoopTool: Schema.TaggedStruct<"LoopTool", {
|
|
@@ -485,7 +440,11 @@ declare const Rpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"capabilities", Schema.Void,
|
|
|
485
440
|
}>, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"executeUnsafe", Schema.Struct<{
|
|
486
441
|
readonly tool: Schema.String;
|
|
487
442
|
readonly params: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
488
|
-
|
|
443
|
+
readonly environment: Schema.optionalKey<typeof ExecutionEnvironment>;
|
|
444
|
+
}>, Schema.Codec<Schema.Json, Schema.Json, never, never>, Schema.Never, never, never> | Rpc.Rpc<"renderEnvironment", Schema.Struct<{
|
|
445
|
+
environment: typeof ExecutionEnvironment;
|
|
446
|
+
reset: Schema.Boolean;
|
|
447
|
+
}>, typeof EnvironmentUpdate, Schema.Never, never, never> | Rpc.Rpc<"respond", Schema.Struct<{
|
|
489
448
|
id: Schema.Finite;
|
|
490
449
|
response: Schema.TaggedUnion<{
|
|
491
450
|
readonly Failure: Schema.TaggedStruct<"Failure", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentExecutor.d.ts","sourceRoot":"","sources":["../src/AgentExecutor.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentExecutor.d.ts","sourceRoot":"","sources":["../src/AgentExecutor.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,cAAc,EAGnB,UAAU,EACV,oBAAoB,EAEpB,gBAAgB,EAEhB,gBAAgB,EAChB,KAAK,cAAc,EACnB,aAAa,EACb,KAAK,eAAe,EAEpB,gBAAgB,EAChB,KAAK,SAAS,EAEd,aAAa,EACd,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,KAAK,mBAAmB,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,KAAK,IAAI,MAAM,gBAAgB,CAAA;AAG3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,OAAO,KAAK,SAAS,MAAM,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