clanka 0.8.5 → 0.9.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.map +1 -1
- package/dist/Acp.js +9 -3
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +72 -1
- package/dist/Acp.test.js.map +1 -1
- package/dist/AcpImage.test.js +1 -0
- package/dist/AcpImage.test.js.map +1 -1
- package/dist/Agent.d.ts +65 -8
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +481 -113
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +77 -4
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentCallerConfig.test.d.ts +2 -0
- package/dist/AgentCallerConfig.test.d.ts.map +1 -0
- package/dist/AgentCallerConfig.test.js +327 -0
- package/dist/AgentCallerConfig.test.js.map +1 -0
- package/dist/AgentExecutor.d.ts +254 -54
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +416 -99
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +201 -31
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentExecutorImage.test.js +2 -1
- package/dist/AgentExecutorImage.test.js.map +1 -1
- package/dist/AgentImage.test.js +5 -1
- package/dist/AgentImage.test.js.map +1 -1
- package/dist/AgentOutput.d.ts +54 -2
- package/dist/AgentOutput.d.ts.map +1 -1
- package/dist/AgentOutput.js +52 -0
- package/dist/AgentOutput.js.map +1 -1
- package/dist/AgentSkills.d.ts +22 -0
- package/dist/AgentSkills.d.ts.map +1 -1
- package/dist/AgentSkills.js +36 -0
- package/dist/AgentSkills.js.map +1 -1
- package/dist/AgentSkills.test.js +2 -0
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentSubagents.test.d.ts +2 -0
- package/dist/AgentSubagents.test.d.ts.map +1 -0
- package/dist/AgentSubagents.test.js +452 -0
- package/dist/AgentSubagents.test.js.map +1 -0
- package/dist/AgentTools.d.ts +356 -14
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +213 -34
- package/dist/AgentTools.js.map +1 -1
- package/dist/CompactionTransport.test.js +1 -1
- package/dist/CompactionTransport.test.js.map +1 -1
- package/dist/OutputFormatter.d.ts.map +1 -1
- package/dist/OutputFormatter.js +16 -2
- package/dist/OutputFormatter.js.map +1 -1
- package/dist/ToolkitRenderer.d.ts.map +1 -1
- package/dist/ToolkitRenderer.js +6 -1
- package/dist/ToolkitRenderer.js.map +1 -1
- package/dist/bin/{Effect-BEUn4I5E.mjs → Effect-2jPlJ8eu.mjs} +399 -207
- package/dist/bin/Effect-2jPlJ8eu.mjs.map +1 -0
- package/dist/bin/{McpClient-C0FVuDj2.mjs → McpClient-1W508adc.mjs} +4 -4
- package/dist/bin/{McpClient-C0FVuDj2.mjs.map → McpClient-1W508adc.mjs.map} +1 -1
- package/dist/bin/{OutputFormatter-DffD5oxX.mjs → OutputFormatter-DXXKo4E8.mjs} +16 -5
- package/dist/bin/{OutputFormatter-DffD5oxX.mjs.map → OutputFormatter-DXXKo4E8.mjs.map} +1 -1
- package/dist/bin/{Schema-CjUGw2Xh.mjs → Schema-D-7VuCiC.mjs} +640 -87
- package/dist/bin/Schema-D-7VuCiC.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-CFB73IPb.mjs → SemanticSearch-Cb8aqvGv.mjs} +89 -56
- package/dist/bin/SemanticSearch-Cb8aqvGv.mjs.map +1 -0
- package/dist/bin/{Stream-Cu6P7ZHo.mjs → Stream-DEu2tfCV.mjs} +81 -51
- package/dist/bin/Stream-DEu2tfCV.mjs.map +1 -0
- package/dist/bin/cli.mjs +3632 -5538
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{turndown.cjs-usmCKZ4b.mjs → turndown.cjs-DK29wZw3.mjs} +2 -2
- package/dist/bin/{turndown.cjs-usmCKZ4b.mjs.map → turndown.cjs-DK29wZw3.mjs.map} +1 -1
- package/package.json +7 -7
- package/src/Acp.test.ts +121 -2
- package/src/Acp.ts +10 -3
- package/src/AcpImage.test.ts +1 -0
- package/src/Agent.test.ts +100 -3
- package/src/Agent.ts +752 -142
- package/src/AgentCallerConfig.test.ts +514 -0
- package/src/AgentExecutor.test.ts +297 -37
- package/src/AgentExecutor.ts +707 -159
- package/src/AgentExecutorImage.test.ts +2 -1
- package/src/AgentImage.test.ts +11 -2
- package/src/AgentOutput.ts +74 -1
- package/src/AgentSkills.test.ts +2 -0
- package/src/AgentSkills.ts +43 -0
- package/src/AgentSubagents.test.ts +758 -0
- package/src/AgentTools.ts +376 -52
- package/src/CompactionTransport.test.ts +1 -1
- package/src/OutputFormatter.ts +16 -2
- package/src/ToolkitRenderer.ts +7 -1
- package/dist/bin/Effect-BEUn4I5E.mjs.map +0 -1
- package/dist/bin/Schema-CjUGw2Xh.mjs.map +0 -1
- package/dist/bin/SemanticSearch-CFB73IPb.mjs.map +0 -1
- package/dist/bin/Stream-Cu6P7ZHo.mjs.map +0 -1
|
@@ -6,11 +6,17 @@ import * as Effect from "effect/Effect"
|
|
|
6
6
|
import * as FileSystem from "effect/FileSystem"
|
|
7
7
|
import * as Layer from "effect/Layer"
|
|
8
8
|
import * as Stream from "effect/Stream"
|
|
9
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient"
|
|
10
|
+
import * as HttpEffect from "effect/http/HttpEffect"
|
|
9
11
|
import * as HttpServer from "effect/http/HttpServer"
|
|
10
12
|
import * as RpcClient from "effect/rpc/RpcClient"
|
|
11
13
|
import * as RpcSerialization from "effect/rpc/RpcSerialization"
|
|
12
14
|
import * as RpcServer from "effect/rpc/RpcServer"
|
|
15
|
+
import * as NodeFs from "node:fs"
|
|
16
|
+
import * as NodeOs from "node:os"
|
|
17
|
+
import * as NodePath from "node:path"
|
|
13
18
|
import * as AgentExecutor from "./AgentExecutor.ts"
|
|
19
|
+
import { subagentsUnavailable } from "./AgentTools.ts"
|
|
14
20
|
|
|
15
21
|
const withRpc = <A, E, R>(
|
|
16
22
|
f: (
|
|
@@ -59,30 +65,46 @@ describe("RPC subagent executor", () => {
|
|
|
59
65
|
[
|
|
60
66
|
executor
|
|
61
67
|
.execute({
|
|
62
|
-
script:
|
|
68
|
+
script:
|
|
69
|
+
'console.log("first:" + (await delegate({ prompt: "first" })).output)',
|
|
63
70
|
onTaskComplete: () => Effect.void,
|
|
64
71
|
onImage: () => Effect.void,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
subagents: {
|
|
73
|
+
...subagentsUnavailable,
|
|
74
|
+
delegate: ({ prompt }) =>
|
|
75
|
+
Effect.gen(function* () {
|
|
76
|
+
assert.strictEqual(prompt, "first")
|
|
77
|
+
yield* Deferred.succeed(firstStarted, undefined)
|
|
78
|
+
yield* Deferred.await(secondStarted)
|
|
79
|
+
return {
|
|
80
|
+
id: "1",
|
|
81
|
+
status: "completed" as const,
|
|
82
|
+
output: "first-output",
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
72
86
|
})
|
|
73
87
|
.pipe(Stream.runCollect),
|
|
74
88
|
executor
|
|
75
89
|
.execute({
|
|
76
|
-
script:
|
|
90
|
+
script:
|
|
91
|
+
'console.log("second:" + (await delegate({ prompt: "second" })).output)',
|
|
77
92
|
onTaskComplete: () => Effect.void,
|
|
78
93
|
onImage: () => Effect.void,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
subagents: {
|
|
95
|
+
...subagentsUnavailable,
|
|
96
|
+
delegate: ({ prompt }) =>
|
|
97
|
+
Effect.gen(function* () {
|
|
98
|
+
assert.strictEqual(prompt, "second")
|
|
99
|
+
yield* Deferred.succeed(secondStarted, undefined)
|
|
100
|
+
yield* Deferred.await(firstStarted)
|
|
101
|
+
return {
|
|
102
|
+
id: "2",
|
|
103
|
+
status: "completed" as const,
|
|
104
|
+
output: "second-output",
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
86
108
|
})
|
|
87
109
|
.pipe(Stream.runCollect),
|
|
88
110
|
],
|
|
@@ -101,29 +123,45 @@ describe("RPC subagent executor", () => {
|
|
|
101
123
|
Effect.gen(function* () {
|
|
102
124
|
const output = yield* executor
|
|
103
125
|
.execute({
|
|
104
|
-
script:
|
|
126
|
+
script:
|
|
127
|
+
'console.log("parent:" + (await delegate({ prompt: "outer" })).output)',
|
|
105
128
|
onTaskComplete: () => Effect.void,
|
|
106
129
|
onImage: () => Effect.void,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
subagents: {
|
|
131
|
+
...subagentsUnavailable,
|
|
132
|
+
delegate: ({ prompt }) =>
|
|
133
|
+
Effect.gen(function* () {
|
|
134
|
+
assert.strictEqual(prompt, "outer")
|
|
135
|
+
const childOutput = yield* executor
|
|
136
|
+
.execute({
|
|
137
|
+
script:
|
|
138
|
+
'console.log("child:" + (await delegate({ prompt: "inner" })).output)',
|
|
139
|
+
onTaskComplete: () => Effect.void,
|
|
140
|
+
onImage: () => Effect.void,
|
|
141
|
+
subagents: {
|
|
142
|
+
...subagentsUnavailable,
|
|
143
|
+
delegate: ({ prompt: innerPrompt }) =>
|
|
144
|
+
Effect.sync(() => {
|
|
145
|
+
assert.strictEqual(innerPrompt, "inner")
|
|
146
|
+
return {
|
|
147
|
+
id: "2",
|
|
148
|
+
status: "completed" as const,
|
|
149
|
+
output: "inner-output",
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
153
|
+
})
|
|
154
|
+
.pipe(Stream.runCollect)
|
|
155
|
+
assert.isTrue(
|
|
156
|
+
childOutput.join("").endsWith("child:inner-output\n"),
|
|
157
|
+
)
|
|
158
|
+
return {
|
|
159
|
+
id: "1",
|
|
160
|
+
status: "completed" as const,
|
|
161
|
+
output: childOutput.join("").trim().split("\n").at(-1)!,
|
|
162
|
+
}
|
|
163
|
+
}),
|
|
164
|
+
},
|
|
127
165
|
})
|
|
128
166
|
.pipe(Stream.runCollect)
|
|
129
167
|
assert.isTrue(output.join("").endsWith("parent:child:inner-output\n"))
|
|
@@ -131,3 +169,225 @@ describe("RPC subagent executor", () => {
|
|
|
131
169
|
),
|
|
132
170
|
)
|
|
133
171
|
})
|
|
172
|
+
|
|
173
|
+
// Both executor modes with the same limits. The RPC mode serves
|
|
174
|
+
// `layerRpcServer` through an in-memory web handler, so requests go through
|
|
175
|
+
// the real serialization without opening a socket.
|
|
176
|
+
const executorModes = {
|
|
177
|
+
local: (limits: AgentExecutor.Limits) =>
|
|
178
|
+
Layer.unwrap(
|
|
179
|
+
Effect.gen(function* () {
|
|
180
|
+
const fs = yield* FileSystem.FileSystem
|
|
181
|
+
const directory = yield* fs.makeTempDirectoryScoped()
|
|
182
|
+
return AgentExecutor.layerLocal({ directory, limits })
|
|
183
|
+
}),
|
|
184
|
+
).pipe(
|
|
185
|
+
Layer.provide(Layer.mergeAll(NodeServices.layer, FetchHttpClient.layer)),
|
|
186
|
+
),
|
|
187
|
+
rpc: (limits: AgentExecutor.Limits) =>
|
|
188
|
+
Layer.unwrap(
|
|
189
|
+
Effect.gen(function* () {
|
|
190
|
+
const fs = yield* FileSystem.FileSystem
|
|
191
|
+
const directory = yield* fs.makeTempDirectoryScoped()
|
|
192
|
+
const { protocol, httpEffect } =
|
|
193
|
+
yield* RpcServer.makeProtocolWithHttpEffect()
|
|
194
|
+
yield* Layer.build(
|
|
195
|
+
AgentExecutor.layerRpcServer({ directory, limits }).pipe(
|
|
196
|
+
Layer.provide(Layer.succeed(RpcServer.Protocol, protocol)),
|
|
197
|
+
Layer.provide(FetchHttpClient.layer),
|
|
198
|
+
),
|
|
199
|
+
)
|
|
200
|
+
const handler = HttpEffect.toWebHandler(httpEffect)
|
|
201
|
+
return AgentExecutor.layerRpc.pipe(
|
|
202
|
+
Layer.provide(
|
|
203
|
+
RpcClient.layerProtocolHttp({ url: "http://executor.test/" }),
|
|
204
|
+
),
|
|
205
|
+
Layer.provide(FetchHttpClient.layer),
|
|
206
|
+
Layer.provide(
|
|
207
|
+
Layer.succeed(FetchHttpClient.Fetch, (input, init) =>
|
|
208
|
+
handler(new Request(input, init)),
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
}),
|
|
213
|
+
).pipe(
|
|
214
|
+
Layer.provide(
|
|
215
|
+
Layer.mergeAll(NodeServices.layer, RpcSerialization.layerNdjson),
|
|
216
|
+
),
|
|
217
|
+
),
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const runScript = (script: string) =>
|
|
221
|
+
AgentExecutor.AgentExecutor.use((executor) =>
|
|
222
|
+
executor
|
|
223
|
+
.execute({
|
|
224
|
+
script,
|
|
225
|
+
onTaskComplete: () => Effect.void,
|
|
226
|
+
subagents: subagentsUnavailable,
|
|
227
|
+
onImage: () => Effect.void,
|
|
228
|
+
})
|
|
229
|
+
.pipe(Stream.mkString),
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
// Puts a `gh` that only sleeps first on PATH, so the test needs neither the
|
|
233
|
+
// real CLI nor the network.
|
|
234
|
+
const withSlowGh = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
|
235
|
+
Effect.acquireUseRelease(
|
|
236
|
+
Effect.sync(() => {
|
|
237
|
+
const directory = NodeFs.mkdtempSync(
|
|
238
|
+
NodePath.join(NodeOs.tmpdir(), "slow-gh-"),
|
|
239
|
+
)
|
|
240
|
+
const gh = NodePath.join(directory, "gh")
|
|
241
|
+
NodeFs.writeFileSync(gh, "#!/bin/sh\nsleep 10\n")
|
|
242
|
+
NodeFs.chmodSync(gh, 0o755)
|
|
243
|
+
const path = process.env.PATH
|
|
244
|
+
process.env.PATH = `${directory}${NodePath.delimiter}${path}`
|
|
245
|
+
return { directory, path }
|
|
246
|
+
}),
|
|
247
|
+
() => effect,
|
|
248
|
+
({ directory, path }) =>
|
|
249
|
+
Effect.sync(() => {
|
|
250
|
+
process.env.PATH = path
|
|
251
|
+
NodeFs.rmSync(directory, { recursive: true, force: true })
|
|
252
|
+
}),
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
for (const [mode, executorLayer] of Object.entries(executorModes)) {
|
|
256
|
+
describe(`${mode} executor limits`, () => {
|
|
257
|
+
it.live("stops a bash command at the caller's command timeout", () =>
|
|
258
|
+
Effect.gen(function* () {
|
|
259
|
+
const output = yield* runScript(`
|
|
260
|
+
try {
|
|
261
|
+
await bash({ command: 'sleep 10 && echo fini""shed', timeoutMs: 60000 })
|
|
262
|
+
} catch (error) {
|
|
263
|
+
console.log("REJECTED:", String(error))
|
|
264
|
+
}`)
|
|
265
|
+
assert.include(output, "REJECTED:")
|
|
266
|
+
assert.match(output, /timed out/i)
|
|
267
|
+
assert.notInclude(output, "finished")
|
|
268
|
+
}).pipe(
|
|
269
|
+
Effect.timeout("3 seconds"),
|
|
270
|
+
Effect.provide(executorLayer({ commandTimeout: "300 millis" })),
|
|
271
|
+
),
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
it.live("stops a gh command at the caller's command timeout", () =>
|
|
275
|
+
Effect.gen(function* () {
|
|
276
|
+
const output = yield* runScript(`
|
|
277
|
+
try {
|
|
278
|
+
await gh(["api", "user"])
|
|
279
|
+
console.log("GH" + "_RETURNED")
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.log("REJECTED:", String(error))
|
|
282
|
+
}`)
|
|
283
|
+
assert.include(output, "REJECTED:")
|
|
284
|
+
assert.match(output, /timed out/i)
|
|
285
|
+
assert.notInclude(output, "GH_RETURNED")
|
|
286
|
+
}).pipe(
|
|
287
|
+
Effect.timeout("3 seconds"),
|
|
288
|
+
Effect.provide(executorLayer({ commandTimeout: "300 millis" })),
|
|
289
|
+
withSlowGh,
|
|
290
|
+
),
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
it.live("describes the caller's command timeout to the model", () =>
|
|
294
|
+
Effect.gen(function* () {
|
|
295
|
+
const executor = yield* AgentExecutor.AgentExecutor
|
|
296
|
+
const { toolsDts } = yield* executor.capabilities
|
|
297
|
+
assert.include(toolsDts, "180000")
|
|
298
|
+
assert.notInclude(toolsDts, "120000")
|
|
299
|
+
assert.notInclude(toolsDts, "4 minutes")
|
|
300
|
+
}).pipe(Effect.provide(executorLayer({ commandTimeout: "3 minutes" }))),
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
it.live("ends a script at the caller's script timeout", () =>
|
|
304
|
+
Effect.gen(function* () {
|
|
305
|
+
const output = yield* runScript(`
|
|
306
|
+
console.log("before")
|
|
307
|
+
await sleep(10000)
|
|
308
|
+
console.log("after")`)
|
|
309
|
+
assert.include(output, "before")
|
|
310
|
+
assert.notInclude(output, "after")
|
|
311
|
+
assert.match(output, /timed out/i)
|
|
312
|
+
}).pipe(
|
|
313
|
+
Effect.timeout("3 seconds"),
|
|
314
|
+
Effect.provide(executorLayer({ scriptTimeout: "300 millis" })),
|
|
315
|
+
),
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
// The busy loop is the watchdog: it gives up after 2 seconds, so a
|
|
319
|
+
// regression fails the assertions instead of hanging the test runner.
|
|
320
|
+
it.live(
|
|
321
|
+
"ends a script that is busy in JavaScript at the script timeout",
|
|
322
|
+
() =>
|
|
323
|
+
Effect.gen(function* () {
|
|
324
|
+
const output = yield* runScript(`
|
|
325
|
+
await sleep(1)
|
|
326
|
+
const giveUp = Date.now() + 2000
|
|
327
|
+
while (Date.now() < giveUp) {}
|
|
328
|
+
console.log("BUSY" + "_LOOP_FINISHED")`)
|
|
329
|
+
assert.notInclude(output, "BUSY_LOOP_FINISHED")
|
|
330
|
+
assert.match(output, /timed out/i)
|
|
331
|
+
}).pipe(
|
|
332
|
+
Effect.timeout("5 seconds"),
|
|
333
|
+
Effect.provide(executorLayer({ scriptTimeout: "300 millis" })),
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
it.live("runs tool calls chained after the script returns", () =>
|
|
338
|
+
Effect.gen(function* () {
|
|
339
|
+
const output = yield* runScript(`
|
|
340
|
+
sleep(100).then(() => {
|
|
341
|
+
console.log("FIRST" + "_CONTINUATION")
|
|
342
|
+
return sleep(100).then(() => console.log("SECOND" + "_CONTINUATION"))
|
|
343
|
+
})
|
|
344
|
+
console.log("MAIN" + "_DONE")`)
|
|
345
|
+
assert.include(output, "MAIN_DONE")
|
|
346
|
+
assert.include(output, "FIRST_CONTINUATION")
|
|
347
|
+
assert.include(output, "SECOND_CONTINUATION")
|
|
348
|
+
}).pipe(Effect.timeout("3 seconds"), Effect.provide(executorLayer({}))),
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
// The timeout is the watchdog: a script left waiting fails the test.
|
|
352
|
+
it.live(
|
|
353
|
+
"ends a script whose worker exits while a tool call is running",
|
|
354
|
+
() =>
|
|
355
|
+
Effect.gen(function* () {
|
|
356
|
+
const executor = yield* AgentExecutor.AgentExecutor
|
|
357
|
+
const output = yield* executor
|
|
358
|
+
.execute({
|
|
359
|
+
// `delegate` never finishes. The worker then exits through
|
|
360
|
+
// the host's `process`, the way a crashed worker would.
|
|
361
|
+
script: `
|
|
362
|
+
delegate({ prompt: "never finishes" })
|
|
363
|
+
sleep(100).then(() => console.constructor.constructor("return process")().exit(7))`,
|
|
364
|
+
onTaskComplete: () => Effect.void,
|
|
365
|
+
subagents: {
|
|
366
|
+
...subagentsUnavailable,
|
|
367
|
+
delegate: () => Effect.never,
|
|
368
|
+
},
|
|
369
|
+
onImage: () => Effect.void,
|
|
370
|
+
})
|
|
371
|
+
.pipe(Stream.mkString)
|
|
372
|
+
assert.include(output, "code 7")
|
|
373
|
+
}).pipe(Effect.timeout("3 seconds"), Effect.provide(executorLayer({}))),
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
it.live("keeps the start and end of long bash output", () =>
|
|
377
|
+
Effect.gen(function* () {
|
|
378
|
+
const executor = yield* AgentExecutor.AgentExecutor
|
|
379
|
+
const output = yield* executor.executeUnsafe({
|
|
380
|
+
tool: "bash",
|
|
381
|
+
params: { command: "seq 1 1000000" },
|
|
382
|
+
})
|
|
383
|
+
assert(typeof output === "string")
|
|
384
|
+
assert.isBelow(output.length, 10_000 + 500)
|
|
385
|
+
assert.isTrue(output.startsWith("1\n2\n3\n"), "start kept")
|
|
386
|
+
assert.isTrue(output.trimEnd().endsWith("999999\n1000000"), "end kept")
|
|
387
|
+
}).pipe(
|
|
388
|
+
Effect.timeout("10 seconds"),
|
|
389
|
+
Effect.provide(executorLayer({ commandOutputChars: 10_000 })),
|
|
390
|
+
),
|
|
391
|
+
)
|
|
392
|
+
})
|
|
393
|
+
}
|