@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
package/build/src/akuma-body.js
CHANGED
|
@@ -11,8 +11,8 @@ import { contractRequestCommands } from "./library/contract-operations.js";
|
|
|
11
11
|
import { createKeiyakuHandle } from "./library/keiyaku.js";
|
|
12
12
|
import { Repo } from "./library/repo.js";
|
|
13
13
|
import { settings } from "./settings.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { Debts } from "./debt/index.js";
|
|
15
|
+
import { debtMutationRequestCommands } from "./debt/mutation.js";
|
|
16
16
|
import { World } from "./world.js";
|
|
17
17
|
async function contractDependencies(repoRoot, processConfiguration) {
|
|
18
18
|
const repo = await Repo.at({
|
|
@@ -68,35 +68,25 @@ function contractUpstream(processConfiguration) {
|
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
start: async (handle, input) => await handle.start(input),
|
|
73
|
-
stop: async (handle, input) => await handle.stop(input),
|
|
74
|
-
hold: async (handle, input) => await handle.hold(input),
|
|
75
|
-
resume: async (handle, input) => await handle.resume(input),
|
|
71
|
+
const DEBT_LIFECYCLE = {
|
|
76
72
|
done: async (handle, input) => await handle.done(input),
|
|
77
73
|
drop: async (handle, input) => await handle.drop(input),
|
|
78
74
|
};
|
|
79
75
|
/**
|
|
80
|
-
* The upper Body edge composes the forced-local
|
|
76
|
+
* The upper Body edge composes the forced-local Debts SDK the descriptor
|
|
81
77
|
* execution entries consume. Each ability is one ordinary local product
|
|
82
|
-
* operation; no generic
|
|
78
|
+
* operation; no generic debt(request) dispatcher is introduced here.
|
|
83
79
|
*/
|
|
84
|
-
function
|
|
80
|
+
function debtMutationRequestPort() {
|
|
85
81
|
return {
|
|
86
|
-
add: async ({ world, options }) => await
|
|
87
|
-
addDocument: async ({ world, document }) => await
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
namespace: defaultNamespace,
|
|
91
|
-
actor,
|
|
92
|
-
...(signal === undefined ? {} : { signal }),
|
|
93
|
-
}),
|
|
94
|
-
update: async ({ world, id, options }) => await Tasks.of(world).task({ id }).update(options),
|
|
95
|
-
lifecycle: async ({ world, verb, id, note, signal }) => await TASK_LIFECYCLE[verb](Tasks.of(world).task({ id }), {
|
|
82
|
+
add: async ({ world, options }) => await Debts.of(world).add(options),
|
|
83
|
+
addDocument: async ({ world, document }) => await Debts.of(world).addDocument(document),
|
|
84
|
+
update: async ({ world, id, options }) => await Debts.of(world).debt({ id }).update(options),
|
|
85
|
+
lifecycle: async ({ world, verb, id, note, signal }) => await DEBT_LIFECYCLE[verb](Debts.of(world).debt({ id }), {
|
|
96
86
|
...(note === undefined ? {} : { note }),
|
|
97
87
|
...(signal === undefined ? {} : { signal }),
|
|
98
88
|
}),
|
|
99
|
-
batch: async ({ world, verb, ids, note, signal }) => await
|
|
89
|
+
batch: async ({ world, verb, ids, note, signal }) => await Debts.of(world).batch({
|
|
100
90
|
verb,
|
|
101
91
|
ids,
|
|
102
92
|
...(note === undefined ? {} : { note }),
|
|
@@ -110,7 +100,7 @@ export async function externalRequestCommandsFor(launch, processConfiguration) {
|
|
|
110
100
|
world,
|
|
111
101
|
commands: composeRequestCommands(selectionRequestCommands(selectionRequestPort(world, (message) => {
|
|
112
102
|
void recordPluginDiagnostic(launch.paths, "outcome observation", message);
|
|
113
|
-
})), contractRequestCommands(contractUpstream(processConfiguration)),
|
|
103
|
+
})), contractRequestCommands(contractUpstream(processConfiguration)), debtMutationRequestCommands(debtMutationRequestPort())),
|
|
114
104
|
};
|
|
115
105
|
}
|
|
116
106
|
function bodyProcessConfiguration() {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { decodeAkumaCaller } from "../akuma/caller.js";
|
|
2
|
+
import { World } from "../world.js";
|
|
3
|
+
/** Environment attribution belongs to the process edge, never SDK admission. */
|
|
4
|
+
export async function akumaCallerFromEnvironment(environment) {
|
|
5
|
+
const id = environment.KEIYAKU_ACTOR_ID;
|
|
6
|
+
const world = environment.KEIYAKU_ACTOR_WORLD;
|
|
7
|
+
if ((id === undefined) !== (world === undefined)) {
|
|
8
|
+
throw new TypeError("Akuma caller requires both KEIYAKU_ACTOR_ID and KEIYAKU_ACTOR_WORLD");
|
|
9
|
+
}
|
|
10
|
+
if (id !== undefined && world !== undefined) {
|
|
11
|
+
const resolved = await World.resolve({ cwd: world, repositoryRoot: world });
|
|
12
|
+
return decodeAkumaCaller({ kind: "akuma", akuId: id, world: resolved.candidate });
|
|
13
|
+
}
|
|
14
|
+
const hosts = [
|
|
15
|
+
{ integration: "codex", id: environment.CODEX_THREAD_ID },
|
|
16
|
+
{ integration: "pi", id: environment.PI_SESSION_ID },
|
|
17
|
+
{ integration: "claude", id: environment.CLAUDE_CODE_SESSION_ID },
|
|
18
|
+
].filter(({ id }) => id !== undefined && id !== "");
|
|
19
|
+
if (hosts.length > 1) {
|
|
20
|
+
throw new TypeError(`Ambiguous native host caller: ${hosts.map(({ integration }) => integration).join(", ")}`);
|
|
21
|
+
}
|
|
22
|
+
if (hosts[0])
|
|
23
|
+
return decodeAkumaCaller({ kind: "external", ...hosts[0] });
|
|
24
|
+
const external = environment.KEIYAKU_EXTERNAL_CALLER;
|
|
25
|
+
if (external === undefined)
|
|
26
|
+
return undefined;
|
|
27
|
+
const colon = external.indexOf(":");
|
|
28
|
+
if (colon < 0)
|
|
29
|
+
throw new TypeError("KEIYAKU_EXTERNAL_CALLER must be <integration>:<id>");
|
|
30
|
+
return decodeAkumaCaller({ kind: "external", integration: external.slice(0, colon), id: external.slice(colon + 1) });
|
|
31
|
+
}
|
|
@@ -48,10 +48,9 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
48
48
|
details: [
|
|
49
49
|
"The default mode is any; --all waits until every selected Akuma completes.",
|
|
50
50
|
"An already completed member counts immediately, so repeating a selection can return at once.",
|
|
51
|
-
"Akuma
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"With --json nothing streams and stdout carries the result document.",
|
|
51
|
+
"Text prints each selected Akuma's status snapshot, then one failure fact for any Akuma it could not read.",
|
|
52
|
+
"An answer is part of that snapshot; wait writes no separate copy of it to stdout.",
|
|
53
|
+
"With --json stdout carries the result document.",
|
|
55
54
|
].join("\n"),
|
|
56
55
|
},
|
|
57
56
|
tell: {
|
|
@@ -175,11 +174,6 @@ function positiveIndex(raw, option, fail) {
|
|
|
175
174
|
fail(`${option} exceeds the safe integer range`);
|
|
176
175
|
return value;
|
|
177
176
|
}
|
|
178
|
-
function validateDirect(value, _fail) {
|
|
179
|
-
// Address validation belongs to the operation boundary so callers receive
|
|
180
|
-
// the compact Akuma refusal instead of a generic usage page.
|
|
181
|
-
return value;
|
|
182
|
-
}
|
|
183
177
|
function validateSet(value, fail) {
|
|
184
178
|
if (value.startsWith("kei/"))
|
|
185
179
|
return value;
|
|
@@ -192,7 +186,7 @@ function validateSet(value, fail) {
|
|
|
192
186
|
}
|
|
193
187
|
return value;
|
|
194
188
|
}
|
|
195
|
-
return
|
|
189
|
+
return value;
|
|
196
190
|
}
|
|
197
191
|
function parseWait(rawSelectors, flags, output, fail) {
|
|
198
192
|
if (flags.any === true && flags.all === true)
|
|
@@ -236,7 +230,7 @@ function parseAkumaHistory(selector, flags, output, fail) {
|
|
|
236
230
|
fail("history --id requires turn/<positive safe integer>");
|
|
237
231
|
return {
|
|
238
232
|
command: "history",
|
|
239
|
-
akuma:
|
|
233
|
+
akuma: selector,
|
|
240
234
|
...(id === undefined ? {} : { id }),
|
|
241
235
|
last: flags.last === true,
|
|
242
236
|
...(flags.before === undefined ? {} : { before: positiveIndex(flags.before, "--before", fail) }),
|
|
@@ -256,7 +250,7 @@ function parseAddressed(action, rawSelectors, flags, output, fail) {
|
|
|
256
250
|
fail("history accepts one complete aku/..., @alias, or kei/... selector");
|
|
257
251
|
return parseHistory(selector, flags, output, fail);
|
|
258
252
|
}
|
|
259
|
-
const akuma =
|
|
253
|
+
const akuma = rawSelectors[0];
|
|
260
254
|
const at = stringFlag(flags.at, "fork requires --at <historyId>", fail);
|
|
261
255
|
return { command: action, akuma, at, output };
|
|
262
256
|
}
|
|
@@ -279,10 +273,10 @@ function parsePrompted(action, positionals, stdin, fail) {
|
|
|
279
273
|
: { prompt: { kind: "argument", value: argument } }),
|
|
280
274
|
};
|
|
281
275
|
}
|
|
282
|
-
function parseTell(flags, subject, prompt, output
|
|
276
|
+
function parseTell(flags, subject, prompt, output) {
|
|
283
277
|
return {
|
|
284
278
|
command: "tell",
|
|
285
|
-
akuma:
|
|
279
|
+
akuma: subject,
|
|
286
280
|
interrupt: flags.interrupt === true,
|
|
287
281
|
prompt,
|
|
288
282
|
output,
|
|
@@ -292,7 +286,7 @@ function parseAsk(flags, subject, prompt, output, fail) {
|
|
|
292
286
|
const schema = flags.schema === undefined ? undefined : stringFlag(flags.schema, "ask --schema requires a file", fail);
|
|
293
287
|
return {
|
|
294
288
|
command: "ask",
|
|
295
|
-
akuma:
|
|
289
|
+
akuma: subject,
|
|
296
290
|
interrupt: flags.interrupt === true,
|
|
297
291
|
...(schema === undefined ? {} : { schema }),
|
|
298
292
|
...(flags.wait === undefined ? {} : { timeoutMs: parseDuration(flags.wait, "--wait", fail) }),
|
|
@@ -361,7 +355,7 @@ export function parseAkumaCommand(argv) {
|
|
|
361
355
|
return action === "call"
|
|
362
356
|
? parseCall(flags, parsed.subject, parsed.prompt, output, fail)
|
|
363
357
|
: action === "tell"
|
|
364
|
-
? parseTell(flags, parsed.subject, parsed.prompt, output
|
|
358
|
+
? parseTell(flags, parsed.subject, parsed.prompt, output)
|
|
365
359
|
: parseAsk(flags, parsed.subject, parsed.prompt, output, fail);
|
|
366
360
|
}
|
|
367
361
|
if (spec.arity === "one-or-more" ? positionals.length === 0 : positionals.length !== spec.arity) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { akumaCallerFromEnvironment } from "../akuma-caller.js";
|
|
1
2
|
import { CliUsageError, isBlankInput } from "../usage.js";
|
|
2
3
|
import { readFile } from "node:fs/promises";
|
|
3
4
|
import { resolve } from "node:path";
|
|
@@ -13,8 +14,8 @@ import { World } from "../../world.js";
|
|
|
13
14
|
import { contractFromInput } from "../selectors.js";
|
|
14
15
|
import { ActivityDriver } from "../activity.js";
|
|
15
16
|
import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
|
|
16
|
-
import { callObservationStream, inputWaitStream
|
|
17
|
-
import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText,
|
|
17
|
+
import { callObservationStream, inputWaitStream } from "../render/akuma-activity.js";
|
|
18
|
+
import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitText, } from "../render/akuma-activity.js";
|
|
18
19
|
import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderKillText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
|
|
19
20
|
export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
|
|
20
21
|
// ---------------------------------------------------------------------------
|
|
@@ -27,7 +28,7 @@ async function settingsAt(root, home) {
|
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
function akumas(input) {
|
|
30
|
-
return akumasWithExecution(input.path, input.execution);
|
|
31
|
+
return akumasWithExecution(input.path, input.execution, { reportDiagnostic: writeStderr });
|
|
31
32
|
}
|
|
32
33
|
async function schemaFromFile(path) {
|
|
33
34
|
try {
|
|
@@ -49,17 +50,6 @@ async function promptBody(action, command, input) {
|
|
|
49
50
|
throw new CliUsageError(`${action} requires a nonblank prompt`);
|
|
50
51
|
return bytes;
|
|
51
52
|
}
|
|
52
|
-
function waitObserver(stream, driver, onSelected) {
|
|
53
|
-
return {
|
|
54
|
-
selected: (selected) => {
|
|
55
|
-
onSelected?.(selected);
|
|
56
|
-
stream.select(selected);
|
|
57
|
-
},
|
|
58
|
-
observe: (observed) => {
|
|
59
|
-
driver.settle(stream.observe(observed), stream.frame());
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
53
|
async function inputInitiator(input) {
|
|
64
54
|
let initiator;
|
|
65
55
|
try {
|
|
@@ -68,9 +58,7 @@ async function inputInitiator(input) {
|
|
|
68
58
|
catch { }
|
|
69
59
|
if (initiator === undefined)
|
|
70
60
|
return {};
|
|
71
|
-
//
|
|
72
|
-
// marker does not exist yet, and activating there would only fail noisily.
|
|
73
|
-
// The initiator still travels with the request either way.
|
|
61
|
+
// Identity preparation needs established plugin custody, not just a candidate.
|
|
74
62
|
if (!(await World.established(input.path)))
|
|
75
63
|
return { initiator };
|
|
76
64
|
await emitPluginSignal({
|
|
@@ -90,9 +78,15 @@ function emitAnswer(body, exact) {
|
|
|
90
78
|
async function runCall(command, input) {
|
|
91
79
|
const body = command.prompt === undefined ? undefined : await promptBody("call", { prompt: command.prompt }, input);
|
|
92
80
|
const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
|
|
81
|
+
const declaredCaller = executionChannel(input.execution).kind === "body-request"
|
|
82
|
+
? undefined
|
|
83
|
+
: await akumaCallerFromEnvironment(input.environment);
|
|
84
|
+
// Establish the selected World before preparing the submitting Square route.
|
|
85
|
+
await World.at(input.path);
|
|
93
86
|
const caller = akumas(input);
|
|
94
87
|
const request = {
|
|
95
88
|
...(await inputInitiator(input)),
|
|
89
|
+
...(declaredCaller === undefined ? {} : { caller: declaredCaller }),
|
|
96
90
|
archetype: command.archetype,
|
|
97
91
|
...(body === undefined ? {} : { body }),
|
|
98
92
|
...(input.home === undefined ? {} : { home: input.home }),
|
|
@@ -157,46 +151,19 @@ async function runCall(command, input) {
|
|
|
157
151
|
}
|
|
158
152
|
async function runWait(command, input) {
|
|
159
153
|
const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
?
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
try {
|
|
170
|
-
const result = await akumas(input).wait({
|
|
171
|
-
akuma: command.akuma,
|
|
172
|
-
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
173
|
-
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
174
|
-
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
175
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
176
|
-
...(observer === undefined ? {} : { observe: observer }),
|
|
177
|
-
});
|
|
178
|
-
const streamed = stream !== undefined && stream.streamed();
|
|
179
|
-
if (stream !== undefined && streamed)
|
|
180
|
-
driver.conclude(stream.conclude(result));
|
|
181
|
-
const presentation = {
|
|
182
|
-
...(alias === undefined ? {} : { alias }),
|
|
183
|
-
...(selection === undefined ? {} : { selection }),
|
|
184
|
-
startedAt,
|
|
185
|
-
};
|
|
186
|
-
if (command.output === "json") {
|
|
187
|
-
writeJson(result);
|
|
188
|
-
return 0;
|
|
189
|
-
}
|
|
190
|
-
const raw = waitRawAnswer(result, streamed);
|
|
191
|
-
if (raw === undefined)
|
|
192
|
-
emitAnswer(waitText(result, presentation, displayContext()), false);
|
|
193
|
-
else
|
|
194
|
-
emitAnswer(raw, true);
|
|
154
|
+
const result = await akumas(input).wait({
|
|
155
|
+
akuma: command.akuma,
|
|
156
|
+
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
157
|
+
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
158
|
+
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
159
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
160
|
+
});
|
|
161
|
+
if (command.output === "json") {
|
|
162
|
+
writeJson(result);
|
|
195
163
|
return 0;
|
|
196
164
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
165
|
+
emitAnswer(waitText(result, { ...(alias === undefined ? {} : { alias }) }, displayContext()), false);
|
|
166
|
+
return 0;
|
|
200
167
|
}
|
|
201
168
|
async function runTell(command, input) {
|
|
202
169
|
const body = await promptBody("tell", command, input);
|
|
@@ -287,7 +254,10 @@ async function runHistory(command, input) {
|
|
|
287
254
|
return historyExitCode(result, command.id);
|
|
288
255
|
}
|
|
289
256
|
async function runFork(command, input) {
|
|
257
|
+
const caller = await akumaCallerFromEnvironment(input.environment);
|
|
290
258
|
const receipt = await akumas(input).fork({
|
|
259
|
+
...(await inputInitiator(input)),
|
|
260
|
+
...(caller === undefined ? {} : { caller }),
|
|
291
261
|
akuma: command.akuma,
|
|
292
262
|
at: command.at,
|
|
293
263
|
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ContractCommand } from "./contract-help.js";
|
|
2
2
|
type CatalogQuery = Readonly<{
|
|
3
|
-
kind: "
|
|
3
|
+
kind: "debts";
|
|
4
4
|
namespace?: readonly string[];
|
|
5
5
|
limit?: number;
|
|
6
6
|
}> | Readonly<{
|
|
@@ -23,8 +23,9 @@ type Actor = Readonly<{
|
|
|
23
23
|
export type ParsedBind = Output & Actor & Readonly<{
|
|
24
24
|
command: "bind";
|
|
25
25
|
forkOf?: string;
|
|
26
|
-
|
|
27
|
-
target
|
|
26
|
+
debt?: string;
|
|
27
|
+
/** A literal target branch, or `null` for a deliberately targetless bind. */
|
|
28
|
+
target?: string | null;
|
|
28
29
|
after?: readonly string[];
|
|
29
30
|
gates?: readonly string[];
|
|
30
31
|
}>;
|
|
@@ -60,19 +61,21 @@ export type ParsedAbandon = Output & Actor & Readonly<{
|
|
|
60
61
|
contract?: string;
|
|
61
62
|
note?: string;
|
|
62
63
|
}>;
|
|
64
|
+
export type ParsedShow = Output & Readonly<{
|
|
65
|
+
command: "show";
|
|
66
|
+
contract?: string;
|
|
67
|
+
}>;
|
|
63
68
|
export type ParsedStatus = Output & (Readonly<{
|
|
64
69
|
command: "status";
|
|
65
70
|
contract?: string;
|
|
66
71
|
selectors?: readonly string[];
|
|
67
72
|
akuma?: never;
|
|
68
|
-
guidance?: true;
|
|
69
73
|
category?: never;
|
|
70
74
|
limit?: never;
|
|
71
75
|
}> | Readonly<{
|
|
72
76
|
command: "status";
|
|
73
77
|
contract: string;
|
|
74
78
|
akuma: true;
|
|
75
|
-
guidance?: never;
|
|
76
79
|
category?: never;
|
|
77
80
|
limit?: never;
|
|
78
81
|
}> | Readonly<{
|
|
@@ -82,7 +85,6 @@ export type ParsedStatus = Output & (Readonly<{
|
|
|
82
85
|
contract?: never;
|
|
83
86
|
selectors?: never;
|
|
84
87
|
akuma?: never;
|
|
85
|
-
guidance?: never;
|
|
86
88
|
}>);
|
|
87
89
|
export type ParsedLs = Output & Readonly<{
|
|
88
90
|
command: "ls";
|
|
@@ -119,7 +121,7 @@ export type ParsedContractParts = Readonly<{
|
|
|
119
121
|
output: "text" | "json";
|
|
120
122
|
actor?: string;
|
|
121
123
|
}>;
|
|
122
|
-
export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
|
|
124
|
+
export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
|
|
123
125
|
export type StatusCategory = "akuma" | "contract";
|
|
124
126
|
export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
|
|
125
127
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { validateAkumaName } from "../../identity/normalize.js";
|
|
2
|
+
import { parseDebtNamespaceSelector } from "../../debt/catalog.js";
|
|
3
3
|
import { CliUsageError, commandGuide } from "../usage.js";
|
|
4
4
|
import { CONTRACT_COMMAND_SPECS } from "./contract-help.js";
|
|
5
5
|
function parseAkumaCatalogPath(value) {
|
|
@@ -9,11 +9,11 @@ function parseAkumaCatalogPath(value) {
|
|
|
9
9
|
return { kind: "akuma" };
|
|
10
10
|
const scopedGlob = /^aku\/([^/]+)\/\*$/u.exec(value);
|
|
11
11
|
if (scopedGlob !== null)
|
|
12
|
-
return { kind: "akuma", archetype:
|
|
12
|
+
return { kind: "akuma", archetype: validateAkumaName(scopedGlob[1]) };
|
|
13
13
|
const match = /^aku\/([^/]+)\/?$/u.exec(value);
|
|
14
14
|
if (match === null)
|
|
15
15
|
return null;
|
|
16
|
-
return { kind: "akuma", archetype:
|
|
16
|
+
return { kind: "akuma", archetype: validateAkumaName(match[1]) };
|
|
17
17
|
}
|
|
18
18
|
function optionalFlag(flags, name) {
|
|
19
19
|
const value = flags[name];
|
|
@@ -41,16 +41,23 @@ function parseGateNames(parts, command) {
|
|
|
41
41
|
}
|
|
42
42
|
return names;
|
|
43
43
|
}
|
|
44
|
+
function parseBindTarget(parts) {
|
|
45
|
+
const target = optionalFlag(parts.flags, "target");
|
|
46
|
+
const noTarget = parts.flags["no-target"] === true;
|
|
47
|
+
if (target !== undefined && noTarget)
|
|
48
|
+
refuse("bind", "--target and --no-target are mutually exclusive");
|
|
49
|
+
return noTarget ? null : target;
|
|
50
|
+
}
|
|
44
51
|
function parseBind(parts) {
|
|
45
52
|
const forkOf = optionalFlag(parts.flags, "fork-of");
|
|
46
53
|
if (forkOf !== undefined) {
|
|
47
54
|
if (parts.stdin)
|
|
48
55
|
refuse("bind", "fork bind reads no stdin");
|
|
49
|
-
for (const option of ["
|
|
56
|
+
for (const option of ["debt", "after", "gates"]) {
|
|
50
57
|
if (parts.flags[option] !== undefined)
|
|
51
58
|
refuse("bind", `--${option} is not valid with --fork-of`);
|
|
52
59
|
}
|
|
53
|
-
const target =
|
|
60
|
+
const target = parseBindTarget(parts);
|
|
54
61
|
return {
|
|
55
62
|
command: "bind",
|
|
56
63
|
forkOf,
|
|
@@ -61,13 +68,13 @@ function parseBind(parts) {
|
|
|
61
68
|
}
|
|
62
69
|
if (!parts.stdin)
|
|
63
70
|
refuse("bind", "bind requires stdin");
|
|
64
|
-
const
|
|
65
|
-
const target =
|
|
71
|
+
const debt = optionalFlag(parts.flags, "debt");
|
|
72
|
+
const target = parseBindTarget(parts);
|
|
66
73
|
const after = parts.flags.after === undefined ? [] : Array.isArray(parts.flags.after) ? parts.flags.after : [parts.flags.after];
|
|
67
74
|
const gates = parseGateNames(parts, "bind");
|
|
68
75
|
return {
|
|
69
76
|
command: "bind",
|
|
70
|
-
...(
|
|
77
|
+
...(debt === undefined ? {} : { debt }),
|
|
71
78
|
...(target === undefined ? {} : { target }),
|
|
72
79
|
...(parts.flags.after === undefined ? {} : { after }),
|
|
73
80
|
...(gates === undefined ? {} : { gates }),
|
|
@@ -142,29 +149,20 @@ function rejectStatusGlobs(positionals) {
|
|
|
142
149
|
refuse("status", `unsupported status glob: ${selector}`);
|
|
143
150
|
}
|
|
144
151
|
}
|
|
145
|
-
function
|
|
146
|
-
if (limit !== undefined)
|
|
147
|
-
refuse("status", "--limit is not valid with --guidance");
|
|
152
|
+
function showSelector(parts) {
|
|
148
153
|
const selected = parts.positionals[0];
|
|
149
154
|
if (selected !== undefined && STATUS_CATEGORY_SELECTORS.has(selected))
|
|
150
|
-
refuse("
|
|
155
|
+
refuse("show", "show cannot select a category");
|
|
151
156
|
if (parts.positionals.length > 1)
|
|
152
|
-
refuse("
|
|
157
|
+
refuse("show", "show accepts at most one Contract selector");
|
|
153
158
|
if (selected?.startsWith("aku/") === true)
|
|
154
|
-
refuse("
|
|
159
|
+
refuse("show", "show cannot select an Akuma");
|
|
155
160
|
if (selected !== undefined && !selected.startsWith("@") && /[*?\[\]]/u.test(selected))
|
|
156
|
-
refuse("
|
|
157
|
-
return
|
|
158
|
-
command: "status",
|
|
159
|
-
...(selected === undefined ? {} : { contract: selected }),
|
|
160
|
-
guidance: true,
|
|
161
|
-
output: parts.output,
|
|
162
|
-
};
|
|
161
|
+
refuse("show", `unsupported show glob: ${selected}`);
|
|
162
|
+
return selected;
|
|
163
163
|
}
|
|
164
164
|
function parseStatus(parts) {
|
|
165
165
|
const limit = listLimit(parts, "status");
|
|
166
|
-
if (parts.flags.guidance === true)
|
|
167
|
-
return parseStatusGuidance(parts, limit);
|
|
168
166
|
rejectStatusGlobs(parts.positionals);
|
|
169
167
|
if (parts.positionals.length > 1) {
|
|
170
168
|
if (limit !== undefined)
|
|
@@ -196,38 +194,29 @@ function parseRegion(parts) {
|
|
|
196
194
|
output: parts.output,
|
|
197
195
|
};
|
|
198
196
|
}
|
|
199
|
-
function akumaCatalogQuery(query, parts) {
|
|
200
|
-
const limit = optionalFlag(parts.flags, "limit");
|
|
201
|
-
if (limit !== undefined && (!/^[1-9][0-9]*$/u.test(limit) || !Number.isSafeInteger(Number(limit))))
|
|
202
|
-
refuse("ls", "--limit requires a positive safe integer");
|
|
203
|
-
return {
|
|
204
|
-
...query,
|
|
205
|
-
...(limit === undefined ? {} : { limit: Number(limit) }),
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
197
|
function listLimit(parts, command = "ls") {
|
|
209
198
|
const limit = optionalFlag(parts.flags, "limit");
|
|
210
199
|
if (limit !== undefined && (!/^[1-9][0-9]*$/u.test(limit) || !Number.isSafeInteger(Number(limit))))
|
|
211
200
|
refuse(command, "--limit requires a positive safe integer");
|
|
212
201
|
return limit === undefined ? undefined : Number(limit);
|
|
213
202
|
}
|
|
214
|
-
function
|
|
215
|
-
if (path === "
|
|
216
|
-
return { kind: "
|
|
203
|
+
function debtCatalogQuery(path, limit) {
|
|
204
|
+
if (path === "debt" || path === "debt/") {
|
|
205
|
+
return { kind: "debts", namespace: [], ...(limit === undefined ? {} : { limit }) };
|
|
217
206
|
}
|
|
218
|
-
if (!path.startsWith("
|
|
207
|
+
if (!path.startsWith("debt/"))
|
|
219
208
|
return null;
|
|
220
209
|
if (!path.endsWith("/"))
|
|
221
|
-
refuse("ls", `invalid
|
|
222
|
-
const body = path.slice("
|
|
210
|
+
refuse("ls", `invalid Debt namespace selector: ${path}`);
|
|
211
|
+
const body = path.slice("debt/".length, -1);
|
|
223
212
|
if (body.length === 0 || body.split("/").some((segment) => segment.length === 0))
|
|
224
|
-
refuse("ls", `invalid
|
|
213
|
+
refuse("ls", `invalid Debt namespace selector: ${path}`);
|
|
225
214
|
try {
|
|
226
|
-
const namespace =
|
|
227
|
-
return { kind: "
|
|
215
|
+
const namespace = parseDebtNamespaceSelector(path);
|
|
216
|
+
return { kind: "debts", namespace, ...(limit === undefined ? {} : { limit }) };
|
|
228
217
|
}
|
|
229
218
|
catch (error) {
|
|
230
|
-
refuse("ls", error instanceof Error ? error.message : `invalid
|
|
219
|
+
refuse("ls", error instanceof Error ? error.message : `invalid Debt namespace selector: ${path}`);
|
|
231
220
|
}
|
|
232
221
|
}
|
|
233
222
|
function parseLs(parts) {
|
|
@@ -235,9 +224,9 @@ function parseLs(parts) {
|
|
|
235
224
|
if (path === undefined)
|
|
236
225
|
refuse("ls", "ls requires a selector");
|
|
237
226
|
const limit = listLimit(parts);
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
return { command: "ls", query:
|
|
227
|
+
const debtQuery = debtCatalogQuery(path, limit);
|
|
228
|
+
if (debtQuery !== null)
|
|
229
|
+
return { command: "ls", query: debtQuery, output: parts.output };
|
|
241
230
|
if (path === "kei" || path === "kei/") {
|
|
242
231
|
return {
|
|
243
232
|
command: "ls",
|
|
@@ -249,7 +238,7 @@ function parseLs(parts) {
|
|
|
249
238
|
const query = parseAkumaCatalogPath(path);
|
|
250
239
|
if (query === null)
|
|
251
240
|
refuse("ls", "ls requires a supported identity directory selector");
|
|
252
|
-
return { command: "ls", query:
|
|
241
|
+
return { command: "ls", query: { ...query, ...(limit === undefined ? {} : { limit }) }, output: parts.output };
|
|
253
242
|
}
|
|
254
243
|
catch (error) {
|
|
255
244
|
if (error instanceof CliUsageError)
|
|
@@ -287,6 +276,10 @@ export function parseContractCommand(parts) {
|
|
|
287
276
|
output: parts.output,
|
|
288
277
|
};
|
|
289
278
|
}
|
|
279
|
+
case "show": {
|
|
280
|
+
const contract = showSelector(parts);
|
|
281
|
+
return { command: "show", ...(contract === undefined ? {} : { contract }), output: parts.output };
|
|
282
|
+
}
|
|
290
283
|
case "status":
|
|
291
284
|
return parseStatus(parts);
|
|
292
285
|
case "ls":
|
|
@@ -13,14 +13,15 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
13
13
|
readonly stdin: "optional";
|
|
14
14
|
readonly flags: {
|
|
15
15
|
readonly actor: "value";
|
|
16
|
-
readonly
|
|
16
|
+
readonly debt: "value";
|
|
17
17
|
readonly target: "value";
|
|
18
|
+
readonly "no-target": "boolean";
|
|
18
19
|
readonly after: "repeat";
|
|
19
20
|
readonly gates: "raw-value";
|
|
20
21
|
readonly "fork-of": "value";
|
|
21
22
|
readonly json: "boolean";
|
|
22
23
|
};
|
|
23
|
-
readonly usage: "bind [--
|
|
24
|
+
readonly usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]";
|
|
24
25
|
readonly purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.";
|
|
25
26
|
readonly details: string;
|
|
26
27
|
};
|
|
@@ -88,15 +89,24 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
88
89
|
readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>]";
|
|
89
90
|
readonly purpose: "End work on a Contract without delivering it; optionally record why.";
|
|
90
91
|
};
|
|
92
|
+
readonly show: {
|
|
93
|
+
readonly positional: "optional";
|
|
94
|
+
readonly stdin: "none";
|
|
95
|
+
readonly flags: {
|
|
96
|
+
readonly json: "boolean";
|
|
97
|
+
};
|
|
98
|
+
readonly usage: "show [<contract>|@<contract>]";
|
|
99
|
+
readonly purpose: "Read one Contract's guidance.";
|
|
100
|
+
readonly details: string;
|
|
101
|
+
};
|
|
91
102
|
readonly status: {
|
|
92
103
|
readonly positional: "optional";
|
|
93
104
|
readonly stdin: "none";
|
|
94
105
|
readonly flags: {
|
|
95
|
-
readonly guidance: "boolean";
|
|
96
106
|
readonly limit: "value";
|
|
97
107
|
readonly json: "boolean";
|
|
98
108
|
};
|
|
99
|
-
readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]
|
|
109
|
+
readonly usage: "status [<contract>|@name|<aku/...>]...\nstatus (aku|aku/|aku/*) [--limit <count>]\nstatus (kei|kei/|kei/*) [--limit <count>]";
|
|
100
110
|
readonly purpose: "Show the world overview or selected Contract and Akuma status.";
|
|
101
111
|
readonly details: string;
|
|
102
112
|
};
|
|
@@ -107,8 +117,8 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
107
117
|
readonly limit: "value";
|
|
108
118
|
readonly json: "boolean";
|
|
109
119
|
};
|
|
110
|
-
readonly usage: "ls
|
|
111
|
-
readonly purpose: "List
|
|
120
|
+
readonly usage: "ls debt[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]";
|
|
121
|
+
readonly purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).";
|
|
112
122
|
readonly details: string;
|
|
113
123
|
};
|
|
114
124
|
readonly audit: {
|
|
@@ -143,7 +153,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
143
153
|
};
|
|
144
154
|
readonly usage: "nuke [--confirm <world-directory>]";
|
|
145
155
|
readonly purpose: "Remove Keiyaku-owned data from this World.";
|
|
146
|
-
readonly details: "Stops Akumas and removes this World's
|
|
156
|
+
readonly details: "Stops Akumas and removes this World's Debts and Keiyaku-created worktrees and Git references. --confirm must exactly match this World's directory; source files are not deleted.";
|
|
147
157
|
};
|
|
148
158
|
readonly settings: {
|
|
149
159
|
readonly positional: "none";
|