clanka 0.21.0 → 0.22.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.test.js +19 -7
- package/dist/Acp.test.js.map +1 -1
- package/dist/Agent.d.ts +4 -4
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +140 -99
- package/dist/Agent.js.map +1 -1
- package/dist/Agent.test.js +5 -4
- package/dist/Agent.test.js.map +1 -1
- package/dist/AgentBashJobs.test.js +47 -32
- package/dist/AgentBashJobs.test.js.map +1 -1
- package/dist/AgentCallerConfig.test.js +26 -7
- package/dist/AgentCallerConfig.test.js.map +1 -1
- package/dist/AgentExecutor.d.ts +71 -41
- package/dist/AgentExecutor.d.ts.map +1 -1
- package/dist/AgentExecutor.js +86 -79
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +108 -83
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentExecutorImage.test.js +2 -2
- package/dist/AgentExecutorImage.test.js.map +1 -1
- package/dist/AgentImage.test.js +3 -2
- package/dist/AgentImage.test.js.map +1 -1
- package/dist/AgentSubagents.test.js +218 -29
- package/dist/AgentSubagents.test.js.map +1 -1
- package/dist/AgentTools.d.ts +318 -290
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +218 -199
- package/dist/AgentTools.js.map +1 -1
- package/dist/AgentTools.test.js +2 -2
- package/dist/AgentTools.test.js.map +1 -1
- package/dist/bin/cli.mjs +308 -289
- package/dist/bin/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Acp.test.ts +31 -10
- package/src/Agent.test.ts +5 -4
- package/src/Agent.ts +175 -140
- package/src/AgentBashJobs.test.ts +70 -38
- package/src/AgentCallerConfig.test.ts +39 -7
- package/src/AgentExecutor.test.ts +132 -91
- package/src/AgentExecutor.ts +120 -105
- package/src/AgentExecutorImage.test.ts +2 -2
- package/src/AgentImage.test.ts +4 -3
- package/src/AgentSubagents.test.ts +825 -562
- package/src/AgentTools.test.ts +2 -2
- package/src/AgentTools.ts +331 -288
package/package.json
CHANGED
package/src/Acp.test.ts
CHANGED
|
@@ -536,13 +536,16 @@ describe("Acp", () => {
|
|
|
536
536
|
Effect.gen(function* () {
|
|
537
537
|
const server = yield* makeServer(runsScript("bash()"), {
|
|
538
538
|
...executor,
|
|
539
|
-
execute: ({
|
|
539
|
+
execute: ({ onTask }) =>
|
|
540
540
|
Stream.fromEffect(
|
|
541
|
-
|
|
541
|
+
onTask!({
|
|
542
542
|
id: "7",
|
|
543
|
+
kind: "bash",
|
|
543
544
|
await: Effect.succeed({
|
|
544
545
|
id: "7",
|
|
546
|
+
kind: "bash",
|
|
545
547
|
status: "failed",
|
|
548
|
+
description: "make",
|
|
546
549
|
exitCode: 3,
|
|
547
550
|
output: "boom\n",
|
|
548
551
|
}),
|
|
@@ -591,14 +594,17 @@ describe("Acp", () => {
|
|
|
591
594
|
const ended = yield* Deferred.make<void>()
|
|
592
595
|
const server = yield* makeServer(runsScript("bash()"), {
|
|
593
596
|
...executor,
|
|
594
|
-
execute: ({
|
|
597
|
+
execute: ({ onTask }) =>
|
|
595
598
|
Stream.fromEffect(
|
|
596
|
-
|
|
599
|
+
onTask!({
|
|
597
600
|
id: "7",
|
|
601
|
+
kind: "bash",
|
|
598
602
|
await: Deferred.await(ended).pipe(
|
|
599
603
|
Effect.as({
|
|
600
604
|
id: "7",
|
|
605
|
+
kind: "bash" as const,
|
|
601
606
|
status: "completed" as const,
|
|
607
|
+
description: "make",
|
|
602
608
|
exitCode: 0,
|
|
603
609
|
output: "built\n",
|
|
604
610
|
}),
|
|
@@ -660,9 +666,10 @@ describe("Acp", () => {
|
|
|
660
666
|
: assistantSays(summary),
|
|
661
667
|
{
|
|
662
668
|
...executor,
|
|
663
|
-
execute: ({
|
|
669
|
+
execute: ({ agentTasks, environment }) =>
|
|
664
670
|
Stream.fromEffect(
|
|
665
|
-
|
|
671
|
+
agentTasks.delegate({
|
|
672
|
+
id: "1",
|
|
666
673
|
prompt,
|
|
667
674
|
background: false,
|
|
668
675
|
environment: new AgentExecutor.EnvironmentUpdate({
|
|
@@ -671,7 +678,7 @@ describe("Acp", () => {
|
|
|
671
678
|
}),
|
|
672
679
|
}),
|
|
673
680
|
).pipe(
|
|
674
|
-
Stream.map((
|
|
681
|
+
Stream.map((task) => task.output),
|
|
675
682
|
Stream.orDie,
|
|
676
683
|
),
|
|
677
684
|
},
|
|
@@ -752,11 +759,12 @@ describe("Acp", () => {
|
|
|
752
759
|
...executor,
|
|
753
760
|
// The first script starts a background child; the second
|
|
754
761
|
// resumes it once its first result has been delivered.
|
|
755
|
-
execute: ({
|
|
762
|
+
execute: ({ agentTasks, environment }) =>
|
|
756
763
|
Stream.fromEffect(
|
|
757
764
|
executions++ === 0
|
|
758
|
-
?
|
|
765
|
+
? agentTasks
|
|
759
766
|
.delegate({
|
|
767
|
+
id: "1",
|
|
760
768
|
prompt: "TASK-CHILD",
|
|
761
769
|
background: true,
|
|
762
770
|
environment: new AgentExecutor.EnvironmentUpdate({
|
|
@@ -770,7 +778,7 @@ describe("Acp", () => {
|
|
|
770
778
|
return "started"
|
|
771
779
|
}),
|
|
772
780
|
)
|
|
773
|
-
:
|
|
781
|
+
: agentTasks
|
|
774
782
|
.messageAgent({ id: childId!, message: "FOLLOW-UP" })
|
|
775
783
|
.pipe(Effect.as("resumed")),
|
|
776
784
|
).pipe(Stream.orDie),
|
|
@@ -1084,10 +1092,23 @@ await changeDirectory("sub")`),
|
|
|
1084
1092
|
"user",
|
|
1085
1093
|
"<environment-update>\nPKG-RULES\n</environment-update>",
|
|
1086
1094
|
),
|
|
1095
|
+
message(
|
|
1096
|
+
"user",
|
|
1097
|
+
'<task id="2" kind="agent" status="completed">\nCHILD-RESULT\n</task>',
|
|
1098
|
+
),
|
|
1099
|
+
message(
|
|
1100
|
+
"user",
|
|
1101
|
+
'<task id="3" kind="bash" status="completed" exitCode="0">\nBUILT\n</task>',
|
|
1102
|
+
),
|
|
1103
|
+
// Stored by versions before tasks.
|
|
1087
1104
|
message(
|
|
1088
1105
|
"user",
|
|
1089
1106
|
'<subagent id="1" status="completed">\nCHILD-RESULT\n</subagent>',
|
|
1090
1107
|
),
|
|
1108
|
+
message(
|
|
1109
|
+
"user",
|
|
1110
|
+
'<job id="1" status="completed" exitCode="0">\nBUILT\n</job>',
|
|
1111
|
+
),
|
|
1091
1112
|
message("assistant", "Reply"),
|
|
1092
1113
|
]),
|
|
1093
1114
|
}),
|
package/src/Agent.test.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type * as Response from "effect/ai/Response"
|
|
|
18
18
|
import * as ResponseIdTracker from "effect/ai/ResponseIdTracker"
|
|
19
19
|
import * as Agent from "./Agent.ts"
|
|
20
20
|
import * as AgentExecutor from "./AgentExecutor.ts"
|
|
21
|
-
import {
|
|
21
|
+
import { agentTasksUnavailable } from "./AgentTools.ts"
|
|
22
22
|
import * as AgentOutput from "./AgentOutput.ts"
|
|
23
23
|
import * as Compaction from "./Compaction.ts"
|
|
24
24
|
|
|
@@ -175,11 +175,12 @@ describe("Agent", () => {
|
|
|
175
175
|
)
|
|
176
176
|
// The root delegates once in the foreground, then every agent finishes.
|
|
177
177
|
const executor = makeExecutor(
|
|
178
|
-
({ script, environment,
|
|
178
|
+
({ script, environment, agentTasks, onTaskComplete }) =>
|
|
179
179
|
Stream.fromEffect(
|
|
180
180
|
(script === "done"
|
|
181
181
|
? onTaskComplete("done")
|
|
182
|
-
:
|
|
182
|
+
: agentTasks.delegate({
|
|
183
|
+
id: "1",
|
|
183
184
|
prompt: "TASK-CHILD",
|
|
184
185
|
background: false,
|
|
185
186
|
environment: new AgentExecutor.EnvironmentUpdate({
|
|
@@ -560,7 +561,7 @@ it.layer(localExecutorLayer, { excludeTestServices: true })(
|
|
|
560
561
|
Effect.sync(() => {
|
|
561
562
|
summaries.push(summary)
|
|
562
563
|
}),
|
|
563
|
-
|
|
564
|
+
agentTasks: agentTasksUnavailable,
|
|
564
565
|
onImage: () => Effect.void,
|
|
565
566
|
})
|
|
566
567
|
.pipe(Stream.mkString)
|