@astrosheep/keiyaku 4.6.7 → 4.6.9
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/README.md +46 -16
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/opencode/index.js +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/pi/keiyaku.ts +0 -5
- package/build/skills/keiyaku/SKILL.md +5 -6
- package/build/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/src/akuma/akuma-call.d.ts +2 -0
- package/build/src/akuma/akuma-call.js +8 -2
- package/build/src/akuma/akuma-instance.d.ts +14 -1
- package/build/src/akuma/akuma-instance.js +37 -7
- package/build/src/akuma/akuma-observe.d.ts +33 -8
- package/build/src/akuma/akuma-observe.js +89 -63
- package/build/src/akuma/akuma-owner.d.ts +14 -2
- package/build/src/akuma/akuma-owner.js +49 -35
- package/build/src/akuma/akuma-selection-execution.js +9 -1
- package/build/src/akuma/akuma-stream.d.ts +22 -0
- package/build/src/akuma/akuma-stream.js +116 -0
- package/build/src/akuma/akuma-wait.d.ts +1 -40
- package/build/src/akuma/akuma-wait.js +23 -84
- package/build/src/akuma/akuma.d.ts +52 -16
- package/build/src/akuma/akuma.js +10 -10
- package/build/src/akuma/allowed.d.ts +7 -12
- package/build/src/akuma/allowed.js +13 -4
- package/build/src/akuma/archetype.d.ts +7 -15
- package/build/src/akuma/archetype.js +36 -35
- package/build/src/akuma/body-supervisor.d.ts +5 -5
- package/build/src/akuma/body-supervisor.js +22 -20
- package/build/src/akuma/body.d.ts +5 -3
- package/build/src/akuma/body.js +57 -8
- package/build/src/akuma/call-request.d.ts +30 -32
- package/build/src/akuma/call-request.js +10 -3
- package/build/src/akuma/caller.d.ts +39 -0
- package/build/src/akuma/caller.js +36 -0
- package/build/src/akuma/dispatch-association.d.ts +0 -1
- package/build/src/akuma/dispatch-association.js +0 -3
- package/build/src/akuma/heart/activity-schema.d.ts +12 -0
- package/build/src/akuma/heart/activity-schema.js +6 -0
- package/build/src/akuma/heart/facts.d.ts +16 -12
- package/build/src/akuma/heart/facts.js +8 -0
- package/build/src/akuma/heart/index.d.ts +61 -9
- package/build/src/akuma/heart/index.js +89 -24
- package/build/src/akuma/heart/rows.d.ts +3 -3
- package/build/src/akuma/heart/rows.js +5 -3
- package/build/src/akuma/heart/soul.d.ts +10 -1
- package/build/src/akuma/heart/soul.js +34 -24
- package/build/src/akuma/heart/storage.d.ts +20 -0
- package/build/src/akuma/heart/storage.js +62 -3
- package/build/src/akuma/heart/timeline.d.ts +7 -0
- package/build/src/akuma/heart/timeline.js +10 -0
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +2 -5
- package/build/src/akuma/index.d.ts +6 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/nuke.js +6 -28
- package/build/src/akuma/projection.d.ts +25 -11
- package/build/src/akuma/projection.js +24 -7
- package/build/src/akuma/provider-recipe.d.ts +18 -6
- package/build/src/akuma/provider-recipe.js +24 -1
- package/build/src/akuma/provider.d.ts +31 -10
- package/build/src/akuma/provider.js +105 -14
- package/build/src/akuma/providers/acp/events.js +29 -19
- package/build/src/akuma/providers/acp/index.js +2 -3
- package/build/src/akuma/providers/claude/events.js +110 -69
- package/build/src/akuma/providers/claude/index.d.ts +2 -2
- package/build/src/akuma/providers/claude/index.js +4 -8
- package/build/src/akuma/providers/codex-app-server/events.js +17 -2
- package/build/src/akuma/providers/codex-app-server/index.js +17 -11
- package/build/src/akuma/providers/decode.d.ts +33 -0
- package/build/src/akuma/providers/decode.js +65 -0
- package/build/src/akuma/providers/execution-environment.d.ts +2 -1
- package/build/src/akuma/providers/execution-environment.js +3 -0
- package/build/src/akuma/providers/grok-build/index.js +16 -48
- package/build/src/akuma/providers/index.js +2 -0
- package/build/src/akuma/providers/lifecycle.d.ts +9 -0
- package/build/src/akuma/providers/lifecycle.js +10 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
- package/build/src/akuma/providers/opencode-sdk/events.js +146 -296
- package/build/src/akuma/providers/opencode-sdk/index.js +270 -431
- package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
- package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
- package/build/src/akuma/providers/opencode-sdk/session.js +75 -84
- package/build/src/akuma/providers/paseo/events.d.ts +33 -0
- package/build/src/akuma/providers/paseo/events.js +204 -0
- package/build/src/akuma/providers/paseo/index.d.ts +9 -0
- package/build/src/akuma/providers/paseo/index.js +357 -0
- package/build/src/akuma/providers/pi/events.d.ts +2 -0
- package/build/src/akuma/providers/pi/events.js +36 -38
- package/build/src/akuma/providers/pi/index.js +21 -35
- package/build/src/akuma/publication.d.ts +2 -0
- package/build/src/akuma/publication.js +5 -0
- package/build/src/akuma/request-lifecycle.d.ts +4 -2
- package/build/src/akuma/request-lifecycle.js +27 -12
- package/build/src/akuma/request-rendezvous.js +38 -55
- package/build/src/akuma/request-serve.d.ts +1 -1
- package/build/src/akuma/request-serve.js +77 -113
- package/build/src/akuma/requests.d.ts +3 -1
- package/build/src/akuma/requests.js +32 -0
- package/build/src/akuma/selection-observation.d.ts +129 -53
- package/build/src/akuma/selection-observation.js +3 -9
- package/build/src/akuma/turn-drive.d.ts +3 -0
- package/build/src/akuma/turn-drive.js +28 -10
- package/build/src/akuma-body.js +12 -22
- package/build/src/cli/akuma-caller.d.ts +3 -0
- package/build/src/cli/akuma-caller.js +31 -0
- package/build/src/cli/commands/akuma-grammar.js +10 -16
- package/build/src/cli/commands/akuma.js +25 -55
- package/build/src/cli/commands/contract-grammar.d.ts +9 -7
- package/build/src/cli/commands/contract-grammar.js +40 -47
- package/build/src/cli/commands/contract-help.d.ts +17 -7
- package/build/src/cli/commands/contract-help.js +50 -11
- package/build/src/cli/commands/contract.js +34 -63
- package/build/src/cli/commands/debt-grammar.d.ts +19 -0
- package/build/src/cli/commands/debt-grammar.js +323 -0
- package/build/src/cli/commands/debt-query.d.ts +5 -0
- package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
- package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
- package/build/src/cli/commands/{task.js → debt.js} +87 -164
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/parse.d.ts +5 -5
- package/build/src/cli/parse.js +17 -16
- package/build/src/cli/render/akuma-activity.d.ts +11 -83
- package/build/src/cli/render/akuma-activity.js +20 -382
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +5 -5
- package/build/src/cli/render/contract-history.js +3 -6
- package/build/src/cli/render/contract.js +17 -52
- package/build/src/cli/render/debt.d.ts +28 -0
- package/build/src/cli/render/{task.js → debt.js} +55 -133
- package/build/src/cli/render/kanshi.js +28 -28
- package/build/src/cli/render/marks.d.ts +5 -5
- package/build/src/cli/render/marks.js +4 -10
- package/build/src/cli/render/nuke.js +1 -1
- package/build/src/cli/render/receipt.js +3 -10
- package/build/src/cli/runtime.d.ts +1 -1
- package/build/src/cli/runtime.js +14 -20
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/selectors.d.ts +3 -6
- package/build/src/cli/selectors.js +22 -53
- package/build/src/cli/usage.d.ts +1 -1
- package/build/src/cli/usage.js +4 -4
- package/build/src/contract-worktree.js +3 -3
- package/build/src/debt/board.d.ts +160 -0
- package/build/src/{task → debt}/board.js +89 -89
- package/build/src/debt/catalog.d.ts +11 -0
- package/build/src/debt/catalog.js +59 -0
- package/build/src/{task → debt}/context.d.ts +1 -1
- package/build/src/{task → debt}/context.js +1 -1
- package/build/src/{task → debt}/created-observation.d.ts +6 -10
- package/build/src/{task → debt}/created-observation.js +7 -7
- package/build/src/debt/document.d.ts +37 -0
- package/build/src/{task → debt}/document.js +37 -37
- package/build/src/debt/identity.d.ts +21 -0
- package/build/src/{task → debt}/identity.js +35 -35
- package/build/src/debt/index.d.ts +111 -0
- package/build/src/debt/index.js +203 -0
- package/build/src/{task → debt}/input.d.ts +8 -8
- package/build/src/{task → debt}/input.js +21 -21
- package/build/src/debt/lifecycle-operations.d.ts +6 -0
- package/build/src/{task → debt}/lifecycle-operations.js +27 -31
- package/build/src/debt/mutation-result.d.ts +981 -0
- package/build/src/debt/mutation-result.js +109 -0
- package/build/src/debt/mutation.d.ts +424 -0
- package/build/src/debt/mutation.js +223 -0
- package/build/src/debt/operation-types.d.ts +71 -0
- package/build/src/debt/operations.d.ts +28 -0
- package/build/src/{task → debt}/operations.js +59 -60
- package/build/src/debt/query.d.ts +76 -0
- package/build/src/{task → debt}/query.js +55 -55
- package/build/src/{task → debt}/store.d.ts +13 -13
- package/build/src/{task → debt}/store.js +58 -49
- package/build/src/debt/view.d.ts +4 -0
- package/build/src/debt/view.js +7 -0
- package/build/src/dispatch/index.d.ts +3 -3
- package/build/src/dispatch/index.js +1 -2
- package/build/src/git/observe.d.ts +6 -2
- package/build/src/git/observe.js +6 -2
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/index.d.ts +17 -17
- package/build/src/index.js +11 -11
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/read.js +54 -39
- package/build/src/kanshi/report.d.ts +7 -7
- package/build/src/kanshi/select.js +4 -4
- package/build/src/library/address.js +2 -4
- package/build/src/library/akuma-creation.d.ts +5 -1
- package/build/src/library/akuma-creation.js +27 -47
- package/build/src/library/akumas.d.ts +7 -7
- package/build/src/library/akumas.js +13 -9
- package/build/src/library/bind.d.ts +17 -17
- package/build/src/library/bind.js +16 -12
- package/build/src/library/contract-address.d.ts +9 -0
- package/build/src/library/contract-address.js +71 -0
- package/build/src/library/contract-composition.d.ts +4 -7
- package/build/src/library/contract-composition.js +6 -18
- package/build/src/library/contract-creation.d.ts +3 -5
- package/build/src/library/contract-creation.js +24 -22
- package/build/src/library/contract-execution.js +21 -26
- package/build/src/library/contract-outcomes.d.ts +2 -14
- package/build/src/library/contract-outcomes.js +2 -13
- package/build/src/library/contract-types.d.ts +38 -4
- package/build/src/library/delivery.d.ts +0 -2
- package/build/src/library/delivery.js +2 -5
- package/build/src/library/input.d.ts +2 -2
- package/build/src/library/input.js +5 -5
- package/build/src/library/invocation.js +2 -2
- package/build/src/library/keiyaku.d.ts +0 -5
- package/build/src/library/keiyaku.js +6 -12
- package/build/src/library/nuke.js +3 -3
- package/build/src/library/outcome.d.ts +626 -625
- package/build/src/library/outcome.js +13 -3
- package/build/src/library/reconcile.js +8 -16
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/repo.d.ts +3 -2
- package/build/src/library/repo.js +10 -5
- package/build/src/library/selection.d.ts +5 -8
- package/build/src/library/selection.js +22 -73
- package/build/src/plugin/akuma-signals.d.ts +2 -0
- package/build/src/plugin/akuma-signals.js +4 -0
- package/build/src/plugin/public.d.ts +32 -2
- package/build/src/plugin/runtime.js +5 -3
- package/build/src/protocol/amend.js +3 -2
- package/build/src/protocol/attempt.js +3 -8
- package/build/src/protocol/bind.d.ts +2 -2
- package/build/src/protocol/bind.js +1 -1
- package/build/src/protocol/deliver.js +3 -3
- package/build/src/protocol/operations.d.ts +1 -3
- package/build/src/protocol/operations.js +0 -8
- package/build/src/protocol/outcome.d.ts +1 -2
- package/build/src/protocol/outcome.js +1 -13
- package/build/src/protocol/placement.js +3 -10
- package/build/src/protocol/read/status.js +31 -70
- package/build/src/protocol/reintegrate.js +3 -10
- package/build/src/protocol/review.js +3 -3
- package/build/src/protocol/run.d.ts +5 -1
- package/build/src/protocol/run.js +3 -3
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/fence.d.ts +3 -3
- package/build/src/settlement/fence.js +4 -4
- package/build/src/settlement/holder.d.ts +16 -16
- package/build/src/settlement/holder.js +69 -63
- package/build/src/settlement/settle.d.ts +5 -5
- package/build/src/settlement/settle.js +53 -53
- package/package.json +19 -9
- package/plugins/paseo/plugin/index.server.ts +17 -0
- package/plugins/paseo/plugin/paseo-plugin.json +4 -0
- package/plugins/paseo/plugin/server/attach.ts +52 -0
- package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
- package/plugins/paseo/plugin/server/message.ts +60 -0
- package/plugins/paseo/plugin/server/mirror.ts +193 -0
- package/plugins/paseo/plugin/server/model.ts +14 -0
- package/plugins/paseo/plugin/server/provider.ts +276 -0
- package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
- package/plugins/paseo/plugin/server/sdk.ts +289 -0
- package/plugins/paseo/plugin/server/stop.ts +26 -0
- package/plugins/paseo/plugin/server/transport.ts +35 -0
- package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
- package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
- package/plugins/paseo/plugin/tsconfig.json +6 -0
- package/plugins/pi/keiyaku.ts +57 -0
- package/skills/keiyaku/SKILL.md +43 -0
- package/skills/keiyaku-akuma/SKILL.md +130 -0
- package/skills/keiyaku-akuma/references/automation.md +269 -0
- package/skills/keiyaku-babysit/SKILL.md +65 -0
- package/skills/keiyaku-bind/SKILL.md +216 -0
- package/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/skills/keiyaku-debt/SKILL.md +91 -0
- package/skills/keiyaku-workflow/SKILL.md +129 -0
- package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
- package/build/skills/keiyaku-task/SKILL.md +0 -104
- package/build/src/cli/commands/amend.d.ts +0 -12
- package/build/src/cli/commands/amend.js +0 -10
- package/build/src/cli/commands/bind.d.ts +0 -11
- package/build/src/cli/commands/bind.js +0 -23
- package/build/src/cli/commands/task-grammar.d.ts +0 -19
- package/build/src/cli/commands/task-grammar.js +0 -384
- package/build/src/cli/commands/task-query.d.ts +0 -5
- package/build/src/cli/render/task.d.ts +0 -41
- package/build/src/dispatch/association.d.ts +0 -1
- package/build/src/dispatch/association.js +0 -1
- package/build/src/task/board.d.ts +0 -168
- package/build/src/task/catalog.d.ts +0 -11
- package/build/src/task/catalog.js +0 -59
- package/build/src/task/compose-language.d.ts +0 -57
- package/build/src/task/compose-language.js +0 -364
- package/build/src/task/compose-parser.d.ts +0 -32
- package/build/src/task/compose-parser.js +0 -180
- package/build/src/task/compose.d.ts +0 -16
- package/build/src/task/compose.js +0 -189
- package/build/src/task/document.d.ts +0 -39
- package/build/src/task/identity.d.ts +0 -21
- package/build/src/task/index.d.ts +0 -138
- package/build/src/task/index.js +0 -269
- package/build/src/task/lifecycle-operations.d.ts +0 -6
- package/build/src/task/mutation-result.d.ts +0 -1726
- package/build/src/task/mutation-result.js +0 -198
- package/build/src/task/mutation.d.ts +0 -590
- package/build/src/task/mutation.js +0 -262
- package/build/src/task/operation-types.d.ts +0 -71
- package/build/src/task/operations.d.ts +0 -28
- package/build/src/task/query.d.ts +0 -76
- package/build/src/task/view.d.ts +0 -4
- package/build/src/task/view.js +0 -7
- /package/build/src/{task → debt}/operation-types.js +0 -0
|
@@ -56,15 +56,6 @@ export declare const tellRowSchema: z.ZodObject<{
|
|
|
56
56
|
receipt?: "unavailable" | "required" | undefined;
|
|
57
57
|
}>>>>;
|
|
58
58
|
}, z.core.$strict>;
|
|
59
|
-
declare const outcomeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
60
|
-
kind: z.ZodLiteral<"answered">;
|
|
61
|
-
historyId: z.ZodString;
|
|
62
|
-
answer: z.ZodString;
|
|
63
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
64
|
-
kind: z.ZodLiteral<"failed">;
|
|
65
|
-
historyId: z.ZodString;
|
|
66
|
-
diagnostic: z.ZodString;
|
|
67
|
-
}, z.core.$strict>]>;
|
|
68
59
|
declare const outcomeRowSchema: z.ZodObject<{
|
|
69
60
|
kind: z.ZodLiteral<"outcome">;
|
|
70
61
|
sequence: z.ZodNumber;
|
|
@@ -74,6 +65,7 @@ declare const outcomeRowSchema: z.ZodObject<{
|
|
|
74
65
|
kind: z.ZodLiteral<"answered">;
|
|
75
66
|
historyId: z.ZodString;
|
|
76
67
|
answer: z.ZodString;
|
|
68
|
+
foldedSaidSequence: z.ZodOptional<z.ZodNumber>;
|
|
77
69
|
}, z.core.$strict>, z.ZodObject<{
|
|
78
70
|
kind: z.ZodLiteral<"failed">;
|
|
79
71
|
historyId: z.ZodString;
|
|
@@ -114,6 +106,7 @@ declare const activeToolRowSchema: z.ZodObject<{
|
|
|
114
106
|
unspecified: "unspecified";
|
|
115
107
|
}>;
|
|
116
108
|
path: z.ZodString;
|
|
109
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
117
110
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
118
111
|
added: z.ZodNumber;
|
|
119
112
|
removed: z.ZodNumber;
|
|
@@ -128,6 +121,7 @@ declare const activeToolRowSchema: z.ZodObject<{
|
|
|
128
121
|
}, z.core.$strict>>;
|
|
129
122
|
}, z.core.$strict>]>;
|
|
130
123
|
state: z.ZodLiteral<"active">;
|
|
124
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
131
125
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
132
126
|
}, z.core.$strict>;
|
|
133
127
|
declare const completedToolRowSchema: z.ZodObject<{
|
|
@@ -165,6 +159,7 @@ declare const completedToolRowSchema: z.ZodObject<{
|
|
|
165
159
|
unspecified: "unspecified";
|
|
166
160
|
}>;
|
|
167
161
|
path: z.ZodString;
|
|
162
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
168
163
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
169
164
|
added: z.ZodNumber;
|
|
170
165
|
removed: z.ZodNumber;
|
|
@@ -184,8 +179,10 @@ declare const completedToolRowSchema: z.ZodObject<{
|
|
|
184
179
|
ok: "ok";
|
|
185
180
|
}>;
|
|
186
181
|
message: z.ZodOptional<z.ZodString>;
|
|
182
|
+
output: z.ZodOptional<z.ZodString>;
|
|
187
183
|
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
188
184
|
}, z.core.$strict>;
|
|
185
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
189
186
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
190
187
|
}, z.core.$strict>;
|
|
191
188
|
declare const unsettledToolRowSchema: z.ZodObject<{
|
|
@@ -222,6 +219,7 @@ declare const unsettledToolRowSchema: z.ZodObject<{
|
|
|
222
219
|
unspecified: "unspecified";
|
|
223
220
|
}>;
|
|
224
221
|
path: z.ZodString;
|
|
222
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
225
223
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
226
224
|
added: z.ZodNumber;
|
|
227
225
|
removed: z.ZodNumber;
|
|
@@ -236,6 +234,7 @@ declare const unsettledToolRowSchema: z.ZodObject<{
|
|
|
236
234
|
}, z.core.$strict>>;
|
|
237
235
|
}, z.core.$strict>]>;
|
|
238
236
|
state: z.ZodLiteral<"unsettled">;
|
|
237
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
239
238
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
240
239
|
}, z.core.$strict>;
|
|
241
240
|
declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -331,6 +330,7 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
331
330
|
unspecified: "unspecified";
|
|
332
331
|
}>;
|
|
333
332
|
path: z.ZodString;
|
|
333
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
334
334
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
335
335
|
added: z.ZodNumber;
|
|
336
336
|
removed: z.ZodNumber;
|
|
@@ -345,6 +345,7 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
345
345
|
}, z.core.$strict>>;
|
|
346
346
|
}, z.core.$strict>]>;
|
|
347
347
|
state: z.ZodLiteral<"active">;
|
|
348
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
348
349
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
349
350
|
}, z.core.$strict>, z.ZodObject<{
|
|
350
351
|
kind: z.ZodLiteral<"tool">;
|
|
@@ -381,6 +382,7 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
381
382
|
unspecified: "unspecified";
|
|
382
383
|
}>;
|
|
383
384
|
path: z.ZodString;
|
|
385
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
384
386
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
385
387
|
added: z.ZodNumber;
|
|
386
388
|
removed: z.ZodNumber;
|
|
@@ -400,8 +402,10 @@ declare const openSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
400
402
|
ok: "ok";
|
|
401
403
|
}>;
|
|
402
404
|
message: z.ZodOptional<z.ZodString>;
|
|
405
|
+
output: z.ZodOptional<z.ZodString>;
|
|
403
406
|
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
404
407
|
}, z.core.$strict>;
|
|
408
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
405
409
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
406
410
|
}, z.core.$strict>]>;
|
|
407
411
|
declare const idleSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -498,6 +502,7 @@ declare const idleSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
498
502
|
unspecified: "unspecified";
|
|
499
503
|
}>;
|
|
500
504
|
path: z.ZodString;
|
|
505
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
501
506
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
502
507
|
added: z.ZodNumber;
|
|
503
508
|
removed: z.ZodNumber;
|
|
@@ -517,8 +522,10 @@ declare const idleSnapshotRowSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z
|
|
|
517
522
|
ok: "ok";
|
|
518
523
|
}>;
|
|
519
524
|
message: z.ZodOptional<z.ZodString>;
|
|
525
|
+
output: z.ZodOptional<z.ZodString>;
|
|
520
526
|
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
521
527
|
}, z.core.$strict>;
|
|
528
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
522
529
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
523
530
|
}, z.core.$strict>]>;
|
|
524
531
|
declare const snapshotEntrySchema: <Row extends z.ZodType>(row: Row) => z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -686,6 +693,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
686
693
|
unspecified: "unspecified";
|
|
687
694
|
}>;
|
|
688
695
|
path: z.ZodString;
|
|
696
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
689
697
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
690
698
|
added: z.ZodNumber;
|
|
691
699
|
removed: z.ZodNumber;
|
|
@@ -700,6 +708,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
700
708
|
}, z.core.$strict>>;
|
|
701
709
|
}, z.core.$strict>]>;
|
|
702
710
|
state: z.ZodLiteral<"active">;
|
|
711
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
703
712
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
704
713
|
}, z.core.$strict>, z.ZodObject<{
|
|
705
714
|
kind: z.ZodLiteral<"tool">;
|
|
@@ -736,6 +745,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
736
745
|
unspecified: "unspecified";
|
|
737
746
|
}>;
|
|
738
747
|
path: z.ZodString;
|
|
748
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
739
749
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
740
750
|
added: z.ZodNumber;
|
|
741
751
|
removed: z.ZodNumber;
|
|
@@ -755,8 +765,10 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
755
765
|
ok: "ok";
|
|
756
766
|
}>;
|
|
757
767
|
message: z.ZodOptional<z.ZodString>;
|
|
768
|
+
output: z.ZodOptional<z.ZodString>;
|
|
758
769
|
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
759
770
|
}, z.core.$strict>;
|
|
771
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
760
772
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
761
773
|
}, z.core.$strict>]>;
|
|
762
774
|
}, z.core.$strict>]>>>;
|
|
@@ -789,6 +801,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
789
801
|
kind: z.ZodLiteral<"answered">;
|
|
790
802
|
historyId: z.ZodString;
|
|
791
803
|
answer: z.ZodString;
|
|
804
|
+
foldedSaidSequence: z.ZodOptional<z.ZodNumber>;
|
|
792
805
|
}, z.core.$strict>, z.ZodObject<{
|
|
793
806
|
kind: z.ZodLiteral<"failed">;
|
|
794
807
|
historyId: z.ZodString;
|
|
@@ -894,6 +907,7 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
894
907
|
unspecified: "unspecified";
|
|
895
908
|
}>;
|
|
896
909
|
path: z.ZodString;
|
|
910
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
897
911
|
diffstat: z.ZodOptional<z.ZodObject<{
|
|
898
912
|
added: z.ZodNumber;
|
|
899
913
|
removed: z.ZodNumber;
|
|
@@ -913,14 +927,15 @@ export declare const activitySnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
913
927
|
ok: "ok";
|
|
914
928
|
}>;
|
|
915
929
|
message: z.ZodOptional<z.ZodString>;
|
|
930
|
+
output: z.ZodOptional<z.ZodString>;
|
|
916
931
|
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
917
932
|
}, z.core.$strict>;
|
|
933
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
918
934
|
truncated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
919
935
|
}, z.core.$strict>]>;
|
|
920
936
|
}, z.core.$strict>]>>>;
|
|
921
937
|
omitted: z.ZodNumber;
|
|
922
938
|
}, z.core.$strict>]>;
|
|
923
|
-
export type TurnOutcome = z.infer<typeof outcomeSchema>;
|
|
924
939
|
export type TurnStartRow = z.infer<typeof turnRowSchema>;
|
|
925
940
|
type CallRow = z.infer<typeof callRowSchema>;
|
|
926
941
|
type SaidRow = z.infer<ReturnType<typeof textRowSchema>>;
|
|
@@ -952,7 +967,6 @@ export type IdleSnapshotRow = z.infer<typeof idleSnapshotRowSchema>;
|
|
|
952
967
|
export type SnapshotRow = OpenSnapshotRow | IdleSnapshotRow;
|
|
953
968
|
export type ActivitySnapshotEntry<Row extends SnapshotRow = SnapshotRow> = z.infer<ReturnType<typeof snapshotEntrySchema<z.ZodType<Row>>>>;
|
|
954
969
|
export type ReportedFileChange = z.infer<typeof reportedFileChangeSchema>;
|
|
955
|
-
export type Snapshot = z.infer<typeof activitySnapshotSchema>;
|
|
956
970
|
export type ActivitySnapshot = z.infer<typeof activitySnapshotSchema>;
|
|
957
971
|
export type ActivityHistory = Readonly<{
|
|
958
972
|
rows: readonly ActivityRow[];
|
|
@@ -69,7 +69,14 @@ export const tellRowSchema = z
|
|
|
69
69
|
})
|
|
70
70
|
.strict();
|
|
71
71
|
const outcomeSchema = z.union([
|
|
72
|
-
z
|
|
72
|
+
z
|
|
73
|
+
.object({
|
|
74
|
+
kind: z.literal("answered"),
|
|
75
|
+
historyId: nonblankTextSchema,
|
|
76
|
+
answer: z.string(),
|
|
77
|
+
foldedSaidSequence: countSchema.optional(),
|
|
78
|
+
})
|
|
79
|
+
.strict(),
|
|
73
80
|
z.object({ kind: z.literal("failed"), historyId: nonblankTextSchema, diagnostic: z.string() }).strict(),
|
|
74
81
|
]);
|
|
75
82
|
const outcomeRowSchema = z
|
|
@@ -90,6 +97,7 @@ const activeToolRowSchema = z
|
|
|
90
97
|
name: nonblankTextSchema,
|
|
91
98
|
call: publicToolCallSchema,
|
|
92
99
|
state: z.literal("active"),
|
|
100
|
+
toolId: z.string().optional(),
|
|
93
101
|
truncated: z.literal(true).optional(),
|
|
94
102
|
})
|
|
95
103
|
.strict();
|
|
@@ -103,6 +111,7 @@ const completedToolRowSchema = z
|
|
|
103
111
|
name: nonblankTextSchema,
|
|
104
112
|
call: publicToolCallSchema,
|
|
105
113
|
state: publicToolResultSchema,
|
|
114
|
+
toolId: z.string().optional(),
|
|
106
115
|
truncated: z.literal(true).optional(),
|
|
107
116
|
})
|
|
108
117
|
.strict();
|
|
@@ -115,6 +124,7 @@ const unsettledToolRowSchema = z
|
|
|
115
124
|
name: nonblankTextSchema,
|
|
116
125
|
call: publicToolCallSchema,
|
|
117
126
|
state: z.literal("unsettled"),
|
|
127
|
+
toolId: z.string().optional(),
|
|
118
128
|
truncated: z.literal(true).optional(),
|
|
119
129
|
})
|
|
120
130
|
.strict();
|
|
@@ -239,6 +249,7 @@ function projectToolEvent(rows, running, fact, event, phase) {
|
|
|
239
249
|
turnSequence: fact.turnSequence,
|
|
240
250
|
at: fact.at,
|
|
241
251
|
name: event.name,
|
|
252
|
+
toolId: event.id,
|
|
242
253
|
call: event.call,
|
|
243
254
|
state: phase === "open" ? "active" : "unsettled",
|
|
244
255
|
...(event.truncated === true ? { truncated: true } : {}),
|
|
@@ -254,6 +265,7 @@ function projectToolEvent(rows, running, fact, event, phase) {
|
|
|
254
265
|
turnSequence: fact.turnSequence,
|
|
255
266
|
at: fact.at,
|
|
256
267
|
name: event.name,
|
|
268
|
+
toolId: event.id,
|
|
257
269
|
call: event.call,
|
|
258
270
|
state: event.result,
|
|
259
271
|
...(event.truncated === true ? { truncated: true } : {}),
|
|
@@ -268,6 +280,7 @@ function projectToolEvent(rows, running, fact, event, phase) {
|
|
|
268
280
|
at: fact.at,
|
|
269
281
|
...(durationMs === undefined ? {} : { durationMs }),
|
|
270
282
|
name: event.name,
|
|
283
|
+
toolId: event.id,
|
|
271
284
|
call: event.call,
|
|
272
285
|
state: event.result,
|
|
273
286
|
...(started.truncated === true || event.truncated === true ? { truncated: true } : {}),
|
|
@@ -300,16 +313,20 @@ function demoteActive(row) {
|
|
|
300
313
|
}
|
|
301
314
|
function foldOutcomeVoice(rows, outcome) {
|
|
302
315
|
if (outcome?.outcome.kind !== "answered")
|
|
303
|
-
return rows;
|
|
316
|
+
return { rows, outcome };
|
|
304
317
|
const finalVoice = rows.findLast((row) => row.kind === "said");
|
|
305
318
|
return finalVoice?.text === outcome.outcome.answer && finalVoice.truncated !== true
|
|
306
|
-
?
|
|
307
|
-
|
|
319
|
+
? {
|
|
320
|
+
rows: rows.filter((row) => row !== finalVoice),
|
|
321
|
+
outcome: { ...outcome, outcome: { ...outcome.outcome, foldedSaidSequence: finalVoice.sequence } },
|
|
322
|
+
}
|
|
323
|
+
: { rows, outcome };
|
|
308
324
|
}
|
|
309
325
|
function finishTurn(turn) {
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
326
|
+
const folded = foldOutcomeVoice(turn.rows, turn.outcome);
|
|
327
|
+
const rows = [...folded.rows].sort((left, right) => left.sequence - right.sequence);
|
|
328
|
+
if (turn.phase === "closed" && folded.outcome !== undefined) {
|
|
329
|
+
return { kind: "closed", turn: turn.turn, rows: rows.map(demoteActive), outcome: folded.outcome };
|
|
313
330
|
}
|
|
314
331
|
if (rows.some((row) => row.kind === "tool" && row.state === "unsettled")) {
|
|
315
332
|
throw new Error(`open Turn ${turn.turn.turnSequence} contains an unsettled tool`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
declare const systemPromptModeSchema: z.ZodEnum<{
|
|
3
|
-
append: "append";
|
|
4
3
|
replace: "replace";
|
|
4
|
+
append: "append";
|
|
5
5
|
}>;
|
|
6
6
|
export type SystemPromptMode = z.infer<typeof systemPromptModeSchema>;
|
|
7
7
|
export declare const providerOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
@@ -13,11 +13,11 @@ export declare const providerOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
13
13
|
}>>;
|
|
14
14
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
15
15
|
systemPromptMode: z.ZodOptional<z.ZodEnum<{
|
|
16
|
-
append: "append";
|
|
17
16
|
replace: "replace";
|
|
17
|
+
append: "append";
|
|
18
18
|
}>>;
|
|
19
19
|
}, z.core.$strip>, z.ZodTransform<Readonly<{
|
|
20
|
-
systemPromptMode?: "
|
|
20
|
+
systemPromptMode?: "replace" | "append";
|
|
21
21
|
systemPrompt?: string;
|
|
22
22
|
network?: "disabled" | "enabled";
|
|
23
23
|
effort?: string;
|
|
@@ -27,7 +27,7 @@ export declare const providerOptionsSchema: z.ZodPipe<z.ZodObject<{
|
|
|
27
27
|
effort?: string | undefined;
|
|
28
28
|
network?: "disabled" | "enabled" | undefined;
|
|
29
29
|
systemPrompt?: string | undefined;
|
|
30
|
-
systemPromptMode?: "
|
|
30
|
+
systemPromptMode?: "replace" | "append" | undefined;
|
|
31
31
|
}>>;
|
|
32
32
|
export type ProviderOptions = z.infer<typeof providerOptionsSchema>;
|
|
33
33
|
export declare const providerRecipeSchema: z.ZodPipe<z.ZodObject<{
|
|
@@ -38,6 +38,7 @@ export declare const providerRecipeSchema: z.ZodPipe<z.ZodObject<{
|
|
|
38
38
|
"codex-app-server": "codex-app-server";
|
|
39
39
|
"grok-build": "grok-build";
|
|
40
40
|
"opencode-sdk": "opencode-sdk";
|
|
41
|
+
paseo: "paseo";
|
|
41
42
|
pi: "pi";
|
|
42
43
|
}>;
|
|
43
44
|
executable: z.ZodOptional<z.ZodString>;
|
|
@@ -48,15 +49,26 @@ export declare const providerRecipeSchema: z.ZodPipe<z.ZodObject<{
|
|
|
48
49
|
config?: Readonly<Record<string, unknown>>;
|
|
49
50
|
executable?: string;
|
|
50
51
|
name: string;
|
|
51
|
-
kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "pi";
|
|
52
|
+
kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "paseo" | "pi";
|
|
52
53
|
}>, {
|
|
53
54
|
name: string;
|
|
54
|
-
kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "pi";
|
|
55
|
+
kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "paseo" | "pi";
|
|
55
56
|
executable?: string | undefined;
|
|
56
57
|
config?: Record<string, unknown> | undefined;
|
|
57
58
|
env?: Record<string, string> | undefined;
|
|
58
59
|
}>>;
|
|
59
60
|
export type ProviderExecution = z.infer<typeof providerRecipeSchema>;
|
|
61
|
+
/**
|
|
62
|
+
* One observed runtime model, admitted under the same identity rules a birth
|
|
63
|
+
* selection obeys: a nonblank native identifier, or an explicit unknown whose
|
|
64
|
+
* replacement the native surface did not name.
|
|
65
|
+
*/
|
|
66
|
+
export declare function decodeRuntimeModel(value: unknown): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Recipe members without the current-model member, which an otherwise frozen
|
|
69
|
+
* recipe does not own: it lives once, as the Soul's mutable current selection.
|
|
70
|
+
*/
|
|
71
|
+
export declare function withoutModel(options: ProviderOptions): ProviderOptions;
|
|
60
72
|
export declare function decodeProviderOptions(value: unknown): ProviderOptions;
|
|
61
73
|
export declare function decodeProviderRecipe(value: unknown): ProviderExecution;
|
|
62
74
|
export {};
|
|
@@ -35,7 +35,7 @@ function snapshot(value) {
|
|
|
35
35
|
export const providerRecipeSchema = z
|
|
36
36
|
.object({
|
|
37
37
|
name: z.string().refine((value) => value.trim() !== "", "provider execution name must be a nonblank string"),
|
|
38
|
-
kind: z.enum(["acp", "claude-agent-sdk", "codex-app-server", "grok-build", "opencode-sdk", "pi"], {
|
|
38
|
+
kind: z.enum(["acp", "claude-agent-sdk", "codex-app-server", "grok-build", "opencode-sdk", "paseo", "pi"], {
|
|
39
39
|
error: "provider execution has unknown kind",
|
|
40
40
|
}),
|
|
41
41
|
executable: z
|
|
@@ -52,6 +52,29 @@ export const providerRecipeSchema = z
|
|
|
52
52
|
...(config === undefined ? {} : { config: snapshot(config) }),
|
|
53
53
|
...(env === undefined ? {} : { env: Object.freeze(env) }),
|
|
54
54
|
}));
|
|
55
|
+
/**
|
|
56
|
+
* One observed runtime model, admitted under the same identity rules a birth
|
|
57
|
+
* selection obeys: a nonblank native identifier, or an explicit unknown whose
|
|
58
|
+
* replacement the native surface did not name.
|
|
59
|
+
*/
|
|
60
|
+
export function decodeRuntimeModel(value) {
|
|
61
|
+
if (value === undefined)
|
|
62
|
+
return undefined;
|
|
63
|
+
const parsed = modelText.safeParse(value);
|
|
64
|
+
if (!parsed.success)
|
|
65
|
+
throw new TypeError(parsed.error.issues[0]?.message ?? "provider option model must be a nonblank string", {
|
|
66
|
+
cause: parsed.error,
|
|
67
|
+
});
|
|
68
|
+
return parsed.data;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Recipe members without the current-model member, which an otherwise frozen
|
|
72
|
+
* recipe does not own: it lives once, as the Soul's mutable current selection.
|
|
73
|
+
*/
|
|
74
|
+
export function withoutModel(options) {
|
|
75
|
+
const { model: _current, ...rest } = options;
|
|
76
|
+
return rest;
|
|
77
|
+
}
|
|
55
78
|
export function decodeProviderOptions(value) {
|
|
56
79
|
const parsed = providerOptionsSchema.safeParse(value);
|
|
57
80
|
if (!parsed.success)
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { type ResumeCoordinate } from "./coordinate.js";
|
|
2
2
|
import type { ProviderOptions } from "./provider-recipe.js";
|
|
3
3
|
export type { ResumeCoordinate } from "./coordinate.js";
|
|
4
|
-
export {
|
|
5
|
-
export { AKUMA_REQUESTS_ENV } from "./providers/execution-environment.js";
|
|
6
|
-
export declare const AGENT_EVENT_TEXT_LIMIT = 16384;
|
|
7
|
-
export declare const AGENT_THOUGHT_TEXT_LIMIT = 4000;
|
|
4
|
+
export { AKUMA_REQUESTS_ENV, AKUMA_REQUESTS_ENTRY_ENV } from "./providers/execution-environment.js";
|
|
8
5
|
export declare const AGENT_EVENT_QUEUE_LIMIT = 256;
|
|
9
|
-
export {
|
|
10
|
-
export type { AgentEvent, SearchScope, ToolCall,
|
|
6
|
+
export { decodeAgentEvent } from "./heart/activity-schema.js";
|
|
7
|
+
export type { AgentEvent, SearchScope, ToolCall, ToolResult } from "./heart/activity-schema.js";
|
|
11
8
|
import type { AgentEvent, ToolCall, ToolInput } from "./heart/activity-schema.js";
|
|
12
9
|
export declare function encodeAgentEvent(event: AgentEvent): AgentEvent;
|
|
13
10
|
/**
|
|
@@ -19,8 +16,14 @@ export declare function boundedToolInput(input: unknown): ToolInput | undefined;
|
|
|
19
16
|
export declare function otherToolCall(display: string, input?: unknown): Extract<ToolCall, {
|
|
20
17
|
kind: "other";
|
|
21
18
|
}>;
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
/**
|
|
20
|
+
* One provider-neutral runtime-model observation. Adapters emit it only from
|
|
21
|
+
* native evidence that names an actual model; `undefined` reports a known
|
|
22
|
+
* model change whose replacement the native surface did not identify.
|
|
23
|
+
*/
|
|
24
|
+
export declare function modelEvent(model?: string): Extract<AgentEvent, {
|
|
25
|
+
type: "model";
|
|
26
|
+
}>;
|
|
24
27
|
export declare function noteEvent(note: string): Extract<AgentEvent, {
|
|
25
28
|
type: "note";
|
|
26
29
|
}>;
|
|
@@ -45,7 +48,7 @@ export type TurnResult = Readonly<{
|
|
|
45
48
|
kind: "failed";
|
|
46
49
|
diagnostic: string;
|
|
47
50
|
}>;
|
|
48
|
-
|
|
51
|
+
type ProviderFence = string;
|
|
49
52
|
export type TellReceipt = Readonly<{
|
|
50
53
|
evidence: "exact";
|
|
51
54
|
tellId: string;
|
|
@@ -61,6 +64,23 @@ export type TellSubmission = Readonly<{
|
|
|
61
64
|
}> | Readonly<{
|
|
62
65
|
kind: "turn-ended";
|
|
63
66
|
}>;
|
|
67
|
+
export type TellRegistry<Key> = Readonly<{
|
|
68
|
+
register(key: Key, id: string): Promise<TellSubmission>;
|
|
69
|
+
/** Native evidence naming the booked tell resolves its wait; false when none was booked. */
|
|
70
|
+
accept(key: Key): boolean;
|
|
71
|
+
fail(key: Key, error: unknown): void;
|
|
72
|
+
end(): void;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* One live-tell receipt book, keyed by whatever evidence proves acceptance: a
|
|
76
|
+
* native message identity or the tell id itself, with `fenceOf` naming the
|
|
77
|
+
* receipt. Register before the text reaches the native surface. Ending the
|
|
78
|
+
* turn ends every remaining wait, and every later registration too.
|
|
79
|
+
*/
|
|
80
|
+
export declare function tellRegistry<Key>(fenceOf?: (id: string) => string): TellRegistry<Key>;
|
|
81
|
+
export declare function launchPrompt(body: string, tells: readonly Readonly<{
|
|
82
|
+
text: string;
|
|
83
|
+
}>[], schema?: string): string;
|
|
64
84
|
export type Session = Readonly<{
|
|
65
85
|
admission: Readonly<{
|
|
66
86
|
fence: ProviderFence;
|
|
@@ -87,7 +107,7 @@ export type ProviderAttempt<Result> = Readonly<{
|
|
|
87
107
|
abort(): Promise<void>;
|
|
88
108
|
forceDispose(): Promise<void>;
|
|
89
109
|
}>;
|
|
90
|
-
|
|
110
|
+
type AttemptResource = Readonly<{
|
|
91
111
|
/** Resolves only when this physical resource has retired. */
|
|
92
112
|
closed: Promise<void>;
|
|
93
113
|
abort?(): Promise<void>;
|
|
@@ -115,6 +135,7 @@ export type DriveInput = Readonly<{
|
|
|
115
135
|
signal: AbortSignal;
|
|
116
136
|
requests: Readonly<{
|
|
117
137
|
dir: string;
|
|
138
|
+
entry?: string;
|
|
118
139
|
}>;
|
|
119
140
|
schemaJson?: string;
|
|
120
141
|
}>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { AKUMA_REQUESTS_ENV, AKUMA_REQUESTS_ENTRY_ENV } from "./providers/execution-environment.js";
|
|
2
|
+
const AGENT_EVENT_TEXT_LIMIT = 16_384;
|
|
3
|
+
const AGENT_THOUGHT_TEXT_LIMIT = 4_000;
|
|
4
|
+
const OBSERVED_TEXT_TRUNCATION_MARKER = "\n…[truncated]";
|
|
5
5
|
export const AGENT_EVENT_QUEUE_LIMIT = 256;
|
|
6
|
-
export {
|
|
6
|
+
export { decodeAgentEvent } from "./heart/activity-schema.js";
|
|
7
7
|
function boundedToolCall(call) {
|
|
8
8
|
switch (call.kind) {
|
|
9
9
|
case "run":
|
|
@@ -34,14 +34,24 @@ function boundedToolCall(call) {
|
|
|
34
34
|
(call.path !== undefined && call.path.length > AGENT_EVENT_TEXT_LIMIT) ||
|
|
35
35
|
(call.glob !== undefined && call.glob.length > AGENT_EVENT_TEXT_LIMIT),
|
|
36
36
|
};
|
|
37
|
-
case "fileChange":
|
|
37
|
+
case "fileChange": {
|
|
38
|
+
const bounded = call.changes.map((change) => {
|
|
39
|
+
const patch = change.patch === undefined ? undefined : boundedObservedText(change.patch);
|
|
40
|
+
return {
|
|
41
|
+
value: {
|
|
42
|
+
...change,
|
|
43
|
+
path: boundedEventText(change.path),
|
|
44
|
+
...(patch === undefined ? {} : { patch: patch.value }),
|
|
45
|
+
},
|
|
46
|
+
truncated: patch?.truncated === true,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
38
49
|
return {
|
|
39
|
-
value: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
truncated: call.changes.some((change) => change.path.length > AGENT_EVENT_TEXT_LIMIT),
|
|
50
|
+
value: { kind: call.kind, changes: bounded.map((change) => change.value) },
|
|
51
|
+
truncated: bounded.some((change) => change.truncated) ||
|
|
52
|
+
call.changes.some((change) => change.path.length > AGENT_EVENT_TEXT_LIMIT),
|
|
44
53
|
};
|
|
54
|
+
}
|
|
45
55
|
case "other": {
|
|
46
56
|
const input = call.input;
|
|
47
57
|
const display = boundedEventText(call.display);
|
|
@@ -63,13 +73,15 @@ function boundedToolCall(call) {
|
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
function boundedToolResult(result) {
|
|
76
|
+
const output = result.output === undefined ? undefined : boundedObservedText(result.output);
|
|
66
77
|
return {
|
|
67
78
|
value: {
|
|
68
79
|
status: result.status,
|
|
69
80
|
...(result.message === undefined ? {} : { message: boundedEventText(result.message) }),
|
|
81
|
+
...(output === undefined ? {} : { output: output.value }),
|
|
70
82
|
...(result.exitCode === undefined ? {} : { exitCode: result.exitCode }),
|
|
71
83
|
},
|
|
72
|
-
truncated: result.message !== undefined && result.message.length > AGENT_EVENT_TEXT_LIMIT,
|
|
84
|
+
truncated: (result.message !== undefined && result.message.length > AGENT_EVENT_TEXT_LIMIT) || output?.truncated === true,
|
|
73
85
|
};
|
|
74
86
|
}
|
|
75
87
|
export function encodeAgentEvent(event) {
|
|
@@ -83,6 +95,10 @@ export function encodeAgentEvent(event) {
|
|
|
83
95
|
: { sessionId: event.coordinate.sessionId };
|
|
84
96
|
return { type: event.type, coordinate };
|
|
85
97
|
}
|
|
98
|
+
case "model":
|
|
99
|
+
return event.model === undefined
|
|
100
|
+
? { type: event.type }
|
|
101
|
+
: { type: event.type, model: boundedEventText(event.model) };
|
|
86
102
|
case "assistant":
|
|
87
103
|
return marked({ type: event.type, text: boundedEventText(event.text) }, event.text.length > AGENT_EVENT_TEXT_LIMIT);
|
|
88
104
|
case "thought":
|
|
@@ -156,12 +172,40 @@ function boundedToolInputJson(value) {
|
|
|
156
172
|
}
|
|
157
173
|
return { value: prefix, truncated: true };
|
|
158
174
|
}
|
|
159
|
-
|
|
175
|
+
function boundedEventText(value) {
|
|
160
176
|
return value.slice(0, AGENT_EVENT_TEXT_LIMIT);
|
|
161
177
|
}
|
|
162
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Bound one observed result text or patch. Observed content carries its own
|
|
180
|
+
* visible truncation marker inside the same budget: a cut diff that still looks
|
|
181
|
+
* complete is worse than a marked one, and the marker is part of that bound so
|
|
182
|
+
* re-encoding an already bounded value changes nothing. The cut lands on a
|
|
183
|
+
* complete code point, never a UTF-16 surrogate half.
|
|
184
|
+
*/
|
|
185
|
+
function boundedObservedText(value) {
|
|
186
|
+
if (value.length <= AGENT_EVENT_TEXT_LIMIT)
|
|
187
|
+
return { value, truncated: false };
|
|
188
|
+
const budget = AGENT_EVENT_TEXT_LIMIT - OBSERVED_TEXT_TRUNCATION_MARKER.length;
|
|
189
|
+
return {
|
|
190
|
+
value: `${value.slice(0, cutBeforeSurrogate(value, budget))}${OBSERVED_TEXT_TRUNCATION_MARKER}`,
|
|
191
|
+
truncated: true,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function cutBeforeSurrogate(value, budget) {
|
|
195
|
+
const lastKept = value.charCodeAt(budget - 1);
|
|
196
|
+
return lastKept >= 0xd800 && lastKept <= 0xdbff ? budget - 1 : budget;
|
|
197
|
+
}
|
|
198
|
+
function boundedThoughtText(value) {
|
|
163
199
|
return value.slice(0, AGENT_THOUGHT_TEXT_LIMIT);
|
|
164
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* One provider-neutral runtime-model observation. Adapters emit it only from
|
|
203
|
+
* native evidence that names an actual model; `undefined` reports a known
|
|
204
|
+
* model change whose replacement the native surface did not identify.
|
|
205
|
+
*/
|
|
206
|
+
export function modelEvent(model) {
|
|
207
|
+
return model === undefined ? { type: "model" } : { type: "model", model: boundedEventText(model) };
|
|
208
|
+
}
|
|
165
209
|
export function noteEvent(note) {
|
|
166
210
|
return { type: "note", text: note.replace(/\s+/g, " ").trim() };
|
|
167
211
|
}
|
|
@@ -251,6 +295,53 @@ export class AgentEventChannel {
|
|
|
251
295
|
};
|
|
252
296
|
}
|
|
253
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* One live-tell receipt book, keyed by whatever evidence proves acceptance: a
|
|
300
|
+
* native message identity or the tell id itself, with `fenceOf` naming the
|
|
301
|
+
* receipt. Register before the text reaches the native surface. Ending the
|
|
302
|
+
* turn ends every remaining wait, and every later registration too.
|
|
303
|
+
*/
|
|
304
|
+
export function tellRegistry(fenceOf = (id) => id) {
|
|
305
|
+
const waiting = new Map();
|
|
306
|
+
let ended = false;
|
|
307
|
+
const take = (key) => {
|
|
308
|
+
const waiter = waiting.get(key);
|
|
309
|
+
if (waiter !== undefined)
|
|
310
|
+
waiting.delete(key);
|
|
311
|
+
return waiter;
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
register(key, id) {
|
|
315
|
+
if (ended)
|
|
316
|
+
return Promise.resolve({ kind: "turn-ended" });
|
|
317
|
+
if (waiting.has(key))
|
|
318
|
+
throw new Error("duplicate live tell");
|
|
319
|
+
return new Promise((resolve, reject) => waiting.set(key, { id, resolve, reject }));
|
|
320
|
+
},
|
|
321
|
+
accept(key) {
|
|
322
|
+
const waiter = take(key);
|
|
323
|
+
waiter?.resolve({ kind: "accepted", fence: fenceOf(waiter.id) });
|
|
324
|
+
return waiter !== undefined;
|
|
325
|
+
},
|
|
326
|
+
fail(key, error) {
|
|
327
|
+
take(key)?.reject(error);
|
|
328
|
+
},
|
|
329
|
+
end() {
|
|
330
|
+
ended = true;
|
|
331
|
+
for (const waiter of waiting.values())
|
|
332
|
+
waiter.resolve({ kind: "turn-ended" });
|
|
333
|
+
waiting.clear();
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/** The one launch text: the body, every launch tell, then any schema, blank-line separated. */
|
|
338
|
+
const JSON_SCHEMA_PROMPT = "Respond with JSON matching this JSON Schema and no other text:";
|
|
339
|
+
export function launchPrompt(body, tells, schema) {
|
|
340
|
+
const parts = [body, ...tells.map((tell) => tell.text)];
|
|
341
|
+
if (schema !== undefined)
|
|
342
|
+
parts.push(JSON_SCHEMA_PROMPT, schema);
|
|
343
|
+
return parts.filter((part) => part.length > 0).join("\n\n");
|
|
344
|
+
}
|
|
254
345
|
/**
|
|
255
346
|
* Starts provider work after its caller has received custody. The input signal
|
|
256
347
|
* remains a cancellation notification; this attempt owns its own controller
|