@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native payload decoders shared by provider event adaptation. Every adapter
|
|
3
|
+
* reads the same untrusted native shapes; these are the only places that decide
|
|
4
|
+
* what a present value means, so each keeps one exact predicate and return.
|
|
5
|
+
*/
|
|
6
|
+
export function isRecord(value) {
|
|
7
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
export function object(value) {
|
|
10
|
+
return isRecord(value) ? value : undefined;
|
|
11
|
+
}
|
|
12
|
+
/** A string with non-blank trim, returned as supplied. */
|
|
13
|
+
export function nonblank(value) {
|
|
14
|
+
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
15
|
+
}
|
|
16
|
+
/** A string with non-blank trim, returned trimmed. */
|
|
17
|
+
export function trimmed(value) {
|
|
18
|
+
const text = nonblank(value);
|
|
19
|
+
return text === undefined ? undefined : text.trim();
|
|
20
|
+
}
|
|
21
|
+
/** A nonempty string, returned as supplied; internal whitespace stays content. */
|
|
22
|
+
export function text(value) {
|
|
23
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Any string, including the empty one; absence stays absence. */
|
|
26
|
+
export function stringValue(value) {
|
|
27
|
+
return typeof value === "string" ? value : undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The observed text of one native result value: a plain string, or its text
|
|
31
|
+
* blocks joined in native order. A value carrying no text block observed no
|
|
32
|
+
* text, while a present empty string is observed and empty.
|
|
33
|
+
*/
|
|
34
|
+
export function observedTextContent(content) {
|
|
35
|
+
const single = stringValue(content);
|
|
36
|
+
if (single !== undefined)
|
|
37
|
+
return single;
|
|
38
|
+
if (!Array.isArray(content))
|
|
39
|
+
return undefined;
|
|
40
|
+
const blocks = content.flatMap((block) => {
|
|
41
|
+
const value = object(block);
|
|
42
|
+
return value?.type === "text" && typeof value.text === "string" ? [value.text] : [];
|
|
43
|
+
});
|
|
44
|
+
return blocks.length === 0 ? undefined : blocks.join("");
|
|
45
|
+
}
|
|
46
|
+
/** A one-based line number. */
|
|
47
|
+
export function positiveLine(value) {
|
|
48
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : undefined;
|
|
49
|
+
}
|
|
50
|
+
export function nonnegativeCount(value) {
|
|
51
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : undefined;
|
|
52
|
+
}
|
|
53
|
+
export function finiteNumber(value) {
|
|
54
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
55
|
+
}
|
|
56
|
+
/** One neutral search call carrying only the bounds the native input supplied. */
|
|
57
|
+
export function searchToolCall(query, scope, bounds = {}) {
|
|
58
|
+
return {
|
|
59
|
+
kind: "search",
|
|
60
|
+
query,
|
|
61
|
+
...(scope === undefined ? {} : { scope }),
|
|
62
|
+
...(bounds.path === undefined ? {} : { path: bounds.path }),
|
|
63
|
+
...(bounds.glob === undefined ? {} : { glob: bounds.glob }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const AKUMA_REQUESTS_ENV = "AKUMA_REQUESTS";
|
|
2
|
-
declare const
|
|
2
|
+
export declare const AKUMA_REQUESTS_ENTRY_ENV = "AKUMA_REQUESTS_ENTRY";
|
|
3
|
+
declare const PARENT_HARNESS_IDENTITY_KEYS: readonly ["CLAUDE_CODE_SESSION_ID", "CLAUDE_CODE_CHILD_SESSION", "CLAUDECODE", "CODEX_THREAD_ID", "OPENCODE_SESSION_ID", "PI_SESSION_ID", "PI_SESSION_FILE", "PASEO_AGENT_ID", "SQUARE_PARTICIPANT_NAME", "KEIYAKU_EXTERNAL_CALLER"];
|
|
3
4
|
type Environment = Readonly<Record<string, string | undefined>>;
|
|
4
5
|
/** Construct the environment for one isolated Akuma execution or native child. */
|
|
5
6
|
export declare function akumaExecutionEnvironment(inherited: Environment, overrides?: Environment, requests?: string, nativeIdentity?: readonly (typeof PARENT_HARNESS_IDENTITY_KEYS)[number][]): Record<string, string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const AKUMA_REQUESTS_ENV = "AKUMA_REQUESTS";
|
|
2
|
+
export const AKUMA_REQUESTS_ENTRY_ENV = "AKUMA_REQUESTS_ENTRY";
|
|
2
3
|
const PARENT_HARNESS_IDENTITY_KEYS = [
|
|
3
4
|
"CLAUDE_CODE_SESSION_ID",
|
|
4
5
|
"CLAUDE_CODE_CHILD_SESSION",
|
|
@@ -9,6 +10,7 @@ const PARENT_HARNESS_IDENTITY_KEYS = [
|
|
|
9
10
|
"PI_SESSION_FILE",
|
|
10
11
|
"PASEO_AGENT_ID",
|
|
11
12
|
"SQUARE_PARTICIPANT_NAME",
|
|
13
|
+
"KEIYAKU_EXTERNAL_CALLER",
|
|
12
14
|
];
|
|
13
15
|
/** Construct the environment for one isolated Akuma execution or native child. */
|
|
14
16
|
export function akumaExecutionEnvironment(inherited, overrides = {}, requests, nativeIdentity = []) {
|
|
@@ -18,6 +20,7 @@ export function akumaExecutionEnvironment(inherited, overrides = {}, requests, n
|
|
|
18
20
|
delete environment[key];
|
|
19
21
|
Object.assign(environment, preserved);
|
|
20
22
|
delete environment[AKUMA_REQUESTS_ENV];
|
|
23
|
+
delete environment[AKUMA_REQUESTS_ENTRY_ENV];
|
|
21
24
|
if (requests !== undefined)
|
|
22
25
|
environment[AKUMA_REQUESTS_ENV] = requests;
|
|
23
26
|
return environment;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tellRegistry } from "../../provider.js";
|
|
2
|
+
import { nonblank, object, searchToolCall } from "../decode.js";
|
|
3
|
+
import { providerLifecycle } from "../lifecycle.js";
|
|
2
4
|
import { startAcpSession, } from "../acp/core.js";
|
|
3
5
|
const INTERJECT_METHOD = "_x.ai/interject";
|
|
4
6
|
const INTERJECTION_METHOD = "_x.ai/session/interjection";
|
|
5
|
-
function nonblank(value) {
|
|
6
|
-
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
7
|
-
}
|
|
8
|
-
function object(value) {
|
|
9
|
-
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
10
|
-
? value
|
|
11
|
-
: undefined;
|
|
12
|
-
}
|
|
13
7
|
function nativeName(update) {
|
|
14
8
|
const wire = update;
|
|
15
9
|
return nonblank(update.name) ?? nonblank(update.title) ?? nonblank(wire.toolName);
|
|
@@ -26,17 +20,9 @@ function contentSearchCall(name, input) {
|
|
|
26
20
|
if (name !== "grep" && name !== "hashline_grep")
|
|
27
21
|
return undefined;
|
|
28
22
|
const query = nonblank(input.pattern);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const glob = nonblank(input.glob);
|
|
33
|
-
return {
|
|
34
|
-
kind: "search",
|
|
35
|
-
query,
|
|
36
|
-
scope: "content",
|
|
37
|
-
...(path === undefined ? {} : { path }),
|
|
38
|
-
...(glob === undefined ? {} : { glob }),
|
|
39
|
-
};
|
|
23
|
+
return query === undefined
|
|
24
|
+
? undefined
|
|
25
|
+
: searchToolCall(query, "content", { path: nonblank(input.path), glob: nonblank(input.glob) });
|
|
40
26
|
}
|
|
41
27
|
function runCall(name, input) {
|
|
42
28
|
if (name !== "run_terminal_cmd")
|
|
@@ -109,18 +95,13 @@ function argv(execution, options) {
|
|
|
109
95
|
values.push("stdio");
|
|
110
96
|
return values;
|
|
111
97
|
}
|
|
112
|
-
function withInterject(live,
|
|
98
|
+
function withInterject(live, tells) {
|
|
113
99
|
return {
|
|
114
100
|
...live.session,
|
|
115
101
|
tell: (tell) => {
|
|
116
102
|
if (!live.open())
|
|
117
103
|
return Promise.resolve({ kind: "turn-ended" });
|
|
118
|
-
const
|
|
119
|
-
if (existing !== undefined)
|
|
120
|
-
throw new Error("Grok Build duplicate pending interjection id");
|
|
121
|
-
const receipt = new Promise((resolve, reject) => {
|
|
122
|
-
pending.set(tell.id, { resolve, reject });
|
|
123
|
-
});
|
|
104
|
+
const receipt = tells.register(tell.id, tell.id);
|
|
124
105
|
void live.agent
|
|
125
106
|
.request(INTERJECT_METHOD, {
|
|
126
107
|
sessionId: live.sessionId,
|
|
@@ -128,14 +109,10 @@ function withInterject(live, pending) {
|
|
|
128
109
|
interjectionId: tell.id,
|
|
129
110
|
})
|
|
130
111
|
.then((response) => {
|
|
131
|
-
if (response?.status !== "queued"
|
|
132
|
-
|
|
133
|
-
pending.delete(tell.id);
|
|
112
|
+
if (response?.status !== "queued") {
|
|
113
|
+
tells.fail(tell.id, new Error("Grok Build interject did not return queued"));
|
|
134
114
|
}
|
|
135
|
-
}, (error) =>
|
|
136
|
-
pending.get(tell.id)?.reject(error);
|
|
137
|
-
pending.delete(tell.id);
|
|
138
|
-
});
|
|
115
|
+
}, (error) => tells.fail(tell.id, error));
|
|
139
116
|
return receipt;
|
|
140
117
|
},
|
|
141
118
|
};
|
|
@@ -144,7 +121,7 @@ export function createGrokBuildProvider(execution, dependencies = {}) {
|
|
|
144
121
|
if (execution.executable === undefined)
|
|
145
122
|
throw new TypeError("Grok Build provider execution requires executable");
|
|
146
123
|
const drive = async (input, custody) => {
|
|
147
|
-
const
|
|
124
|
+
const tells = tellRegistry();
|
|
148
125
|
let live;
|
|
149
126
|
const launch = {
|
|
150
127
|
argv: argv(execution, input.options),
|
|
@@ -157,27 +134,18 @@ export function createGrokBuildProvider(execution, dependencies = {}) {
|
|
|
157
134
|
client.onNotification(INTERJECTION_METHOD, (value) => value, ({ params }) => {
|
|
158
135
|
if (params.sessionId !== live?.sessionId)
|
|
159
136
|
return;
|
|
160
|
-
|
|
161
|
-
if (waiter === undefined)
|
|
162
|
-
return;
|
|
163
|
-
pending.delete(params.interjectionId);
|
|
164
|
-
waiter.resolve({ kind: "accepted", fence: params.interjectionId });
|
|
137
|
+
tells.accept(params.interjectionId);
|
|
165
138
|
});
|
|
166
139
|
},
|
|
167
|
-
onTerminal: () =>
|
|
168
|
-
for (const waiter of pending.values())
|
|
169
|
-
waiter.resolve({ kind: "turn-ended" });
|
|
170
|
-
pending.clear();
|
|
171
|
-
},
|
|
140
|
+
onTerminal: () => tells.end(),
|
|
172
141
|
interpretTool: interpretGrokTool,
|
|
173
142
|
freshSessionMeta: { ...(dependencies.freshSessionMeta ?? {}), ...(sessionMeta.freshSessionMeta ?? {}) },
|
|
174
143
|
loadSessionMeta: { ...(dependencies.loadSessionMeta ?? {}), ...(sessionMeta.loadSessionMeta ?? {}) },
|
|
175
144
|
}, custody);
|
|
176
|
-
return withInterject(live,
|
|
145
|
+
return withInterject(live, tells);
|
|
177
146
|
};
|
|
178
147
|
return {
|
|
179
148
|
admitOptions: optionAdmission,
|
|
180
|
-
|
|
181
|
-
resume: (input) => createProviderAttempt(input.signal, async (custody) => await drive({ ...input, signal: custody.signal }, custody)),
|
|
149
|
+
...providerLifecycle(drive),
|
|
182
150
|
};
|
|
183
151
|
}
|
|
@@ -14,6 +14,8 @@ async function adapterFor(execution) {
|
|
|
14
14
|
return (await import("./grok-build/index.js")).createGrokBuildProvider(execution);
|
|
15
15
|
if (execution.kind === "opencode-sdk")
|
|
16
16
|
return (await import("./opencode-sdk/index.js")).createOpencodeProvider(execution);
|
|
17
|
+
if (execution.kind === "paseo")
|
|
18
|
+
return (await import("./paseo/index.js")).createPaseoProvider(execution);
|
|
17
19
|
if (execution.kind === "pi")
|
|
18
20
|
return (await import("./pi/index.js")).createPiProvider(execution);
|
|
19
21
|
throw new TypeError(`unknown Akuma provider kind ${execution.kind}`);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AttemptCustody, type ProviderAdapter, type Session } from "../provider.js";
|
|
2
|
+
type DriveInput = Parameters<ProviderAdapter["start"]>[0] | Parameters<NonNullable<ProviderAdapter["resume"]>>[0];
|
|
3
|
+
/**
|
|
4
|
+
* Start and resume share one custody descriptor: each creates one attempt whose
|
|
5
|
+
* own controller signal reaches the adapter, and the caller's signal stays a
|
|
6
|
+
* cancellation notification.
|
|
7
|
+
*/
|
|
8
|
+
export declare function providerLifecycle(drive: (input: DriveInput, custody: AttemptCustody) => Promise<Session>): Pick<ProviderAdapter, "start" | "resume">;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createProviderAttempt } from "../provider.js";
|
|
2
|
+
/**
|
|
3
|
+
* Start and resume share one custody descriptor: each creates one attempt whose
|
|
4
|
+
* own controller signal reaches the adapter, and the caller's signal stays a
|
|
5
|
+
* cancellation notification.
|
|
6
|
+
*/
|
|
7
|
+
export function providerLifecycle(drive) {
|
|
8
|
+
const attempt = (input) => createProviderAttempt(input.signal, async (custody) => await drive({ ...input, signal: custody.signal }, custody));
|
|
9
|
+
return { start: attempt, resume: attempt };
|
|
10
|
+
}
|
|
@@ -2,8 +2,8 @@ import type { AttemptCustody } from "../../provider.js";
|
|
|
2
2
|
import type { OpencodeEventSubscriptionRequest } from "./session.js";
|
|
3
3
|
/**
|
|
4
4
|
* One adapter-private owner for every resource an OpenCode event subscription
|
|
5
|
-
* creates: the native subscription, its fetch and reader, the pending read
|
|
6
|
-
*
|
|
5
|
+
* creates: the native subscription, its fetch and reader, and the pending read.
|
|
6
|
+
* `closed` resolves only after those resources really
|
|
7
7
|
* retired; a teardown rejection escapes through it, and an unprovable
|
|
8
8
|
* retirement leaves it pending so existing custody reports the attempt hung.
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ export type OwnedEventStream = Readonly<{
|
|
|
14
14
|
next(): Promise<IteratorResult<unknown>>;
|
|
15
15
|
/** Aborts the owned signal, settles any pending read, then awaits real iterator retirement. */
|
|
16
16
|
retire(): Promise<void>;
|
|
17
|
-
/** Resolves only when subscription
|
|
17
|
+
/** Resolves only when subscription and reader actually ended. */
|
|
18
18
|
closed: Promise<void>;
|
|
19
19
|
}>;
|
|
20
20
|
export declare function ownEventStream(input: Readonly<{
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A backoff sleep that resolves when the owned signal aborts and always clears
|
|
3
|
-
* its timer. Cancellation before the sleep starts completes immediately, and a
|
|
4
|
-
* simultaneous timeout and abort still settles once and drops the listener.
|
|
5
|
-
*/
|
|
6
|
-
function cancellableSleep(signal) {
|
|
7
|
-
return (milliseconds) => new Promise((resolve) => {
|
|
8
|
-
if (signal.aborted) {
|
|
9
|
-
resolve();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
let timer;
|
|
13
|
-
const finish = () => {
|
|
14
|
-
if (timer !== undefined)
|
|
15
|
-
clearTimeout(timer);
|
|
16
|
-
signal.removeEventListener("abort", finish);
|
|
17
|
-
resolve();
|
|
18
|
-
};
|
|
19
|
-
timer = setTimeout(finish, milliseconds);
|
|
20
|
-
signal.addEventListener("abort", finish, { once: true });
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
1
|
export function ownEventStream(input) {
|
|
24
2
|
const controller = new AbortController();
|
|
25
3
|
const follow = () => {
|
|
@@ -49,8 +27,8 @@ export function ownEventStream(input) {
|
|
|
49
27
|
if (settling !== undefined)
|
|
50
28
|
return settling;
|
|
51
29
|
settling = (async () => {
|
|
52
|
-
// Abort first: it interrupts the SDK's fetch
|
|
53
|
-
//
|
|
30
|
+
// Abort first: it interrupts the SDK's fetch and reader and settles a
|
|
31
|
+
// pending read before iterator return can be waited on.
|
|
54
32
|
if (!controller.signal.aborted)
|
|
55
33
|
controller.abort(new Error("OpenCode event stream retired"));
|
|
56
34
|
input.signal.removeEventListener("abort", follow);
|
|
@@ -72,7 +50,6 @@ export function ownEventStream(input) {
|
|
|
72
50
|
const subscription = await input.subscribe({
|
|
73
51
|
directory: input.directory,
|
|
74
52
|
signal: controller.signal,
|
|
75
|
-
sleep: cancellableSleep(controller.signal),
|
|
76
53
|
});
|
|
77
54
|
iterator = subscription.stream[Symbol.asyncIterator]();
|
|
78
55
|
})();
|
|
@@ -2,52 +2,16 @@ import { type AgentEvent, type ToolCall } from "../../provider.js";
|
|
|
2
2
|
type Emitter = {
|
|
3
3
|
emit(event: AgentEvent): void;
|
|
4
4
|
};
|
|
5
|
-
type ObservedTool = Readonly<{
|
|
6
|
-
name: string;
|
|
7
|
-
call: ToolCall;
|
|
8
|
-
}>;
|
|
9
5
|
type State = {
|
|
10
6
|
sessionId?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export declare const OPENCODE_EVENT_DISPOSITIONS: {
|
|
18
|
-
readonly "server.instance.disposed": "dropped";
|
|
19
|
-
readonly "installation.updated": "dropped";
|
|
20
|
-
readonly "installation.update-available": "dropped";
|
|
21
|
-
readonly "lsp.client.diagnostics": "dropped";
|
|
22
|
-
readonly "lsp.updated": "dropped";
|
|
23
|
-
readonly "message.updated": "mapped";
|
|
24
|
-
readonly "message.removed": "dropped";
|
|
25
|
-
readonly "message.part.updated": "mapped";
|
|
26
|
-
readonly "message.part.removed": "dropped";
|
|
27
|
-
readonly "permission.updated": "dropped";
|
|
28
|
-
readonly "permission.replied": "dropped";
|
|
29
|
-
readonly "session.status": "dropped";
|
|
30
|
-
readonly "session.idle": "dropped";
|
|
31
|
-
readonly "session.compacted": "note";
|
|
32
|
-
readonly "file.edited": "dropped";
|
|
33
|
-
readonly "todo.updated": "mapped";
|
|
34
|
-
readonly "command.executed": "dropped";
|
|
35
|
-
readonly "session.created": "dropped";
|
|
36
|
-
readonly "session.updated": "dropped";
|
|
37
|
-
readonly "session.deleted": "dropped";
|
|
38
|
-
readonly "session.diff": "dropped";
|
|
39
|
-
readonly "session.error": "mapped";
|
|
40
|
-
readonly "file.watcher.updated": "dropped";
|
|
41
|
-
readonly "vcs.branch.updated": "dropped";
|
|
42
|
-
readonly "tui.prompt.append": "dropped";
|
|
43
|
-
readonly "tui.command.execute": "dropped";
|
|
44
|
-
readonly "tui.toast.show": "dropped";
|
|
45
|
-
readonly "pty.created": "dropped";
|
|
46
|
-
readonly "pty.updated": "dropped";
|
|
47
|
-
readonly "pty.exited": "dropped";
|
|
48
|
-
readonly "pty.deleted": "dropped";
|
|
49
|
-
readonly "server.connected": "dropped";
|
|
7
|
+
tools: Map<string, {
|
|
8
|
+
name: string;
|
|
9
|
+
call?: ToolCall;
|
|
10
|
+
}>;
|
|
11
|
+
completed: Set<string>;
|
|
50
12
|
};
|
|
13
|
+
export declare function diagnostic(value: unknown): string;
|
|
14
|
+
/** Only complete native values enter narration. The caller enforces submission/step correlation. */
|
|
51
15
|
export declare function mapEvent(value: unknown, events: Emitter, state: State): void;
|
|
52
16
|
export declare function createEventState(sessionId?: string): State;
|
|
53
17
|
export {};
|