@astrosheep/keiyaku 4.5.7 → 4.5.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 +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/opencode.js +3 -2
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +12 -11
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +33 -12
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +35 -96
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +28 -49
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +21 -15
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +148 -89
- package/build/src/akuma/abort.d.ts +2 -1
- package/build/src/akuma/abort.js +6 -23
- package/build/src/akuma/akuma-handle.js +4 -2
- package/build/src/akuma/akuma-observe.d.ts +2 -0
- package/build/src/akuma/akuma-observe.js +1 -0
- package/build/src/akuma/akuma-product.js +9 -7
- package/build/src/akuma/akuma.d.ts +392 -9
- package/build/src/akuma/akuma.js +31 -1
- package/build/src/akuma/allowed.d.ts +1 -1
- package/build/src/akuma/allowed.js +1 -0
- package/build/src/akuma/archetype.js +1 -1
- package/build/src/akuma/body.d.ts +8 -5
- package/build/src/akuma/body.js +12 -5
- package/build/src/akuma/call-request.d.ts +80 -0
- package/build/src/akuma/call-request.js +211 -0
- package/build/src/akuma/heart/facts.d.ts +16 -78
- package/build/src/akuma/heart/facts.js +11 -0
- package/build/src/akuma/heart/index.d.ts +3 -2
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/request-authority.d.ts +5 -4
- package/build/src/akuma/heart/request-authority.js +20 -34
- package/build/src/akuma/heart/request-rows.js +12 -23
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +5 -13
- package/build/src/akuma/index.d.ts +1 -1
- package/build/src/akuma/index.js +1 -1
- package/build/src/akuma/projection-read.d.ts +1 -0
- package/build/src/akuma/projection-read.js +8 -1
- package/build/src/akuma/projection.d.ts +907 -137
- package/build/src/akuma/projection.js +193 -9
- package/build/src/akuma/provider.d.ts +30 -3
- package/build/src/akuma/provider.js +111 -0
- package/build/src/akuma/providers/acp/core.d.ts +2 -2
- package/build/src/akuma/providers/acp/core.js +13 -6
- package/build/src/akuma/providers/acp/index.js +5 -4
- package/build/src/akuma/providers/claude/events.d.ts +2 -2
- package/build/src/akuma/providers/claude/events.js +16 -3
- package/build/src/akuma/providers/claude/index.d.ts +3 -3
- package/build/src/akuma/providers/claude/index.js +16 -5
- package/build/src/akuma/providers/codex-app-server/events.d.ts +2 -2
- package/build/src/akuma/providers/codex-app-server/events.js +25 -4
- package/build/src/akuma/providers/codex-app-server/index.js +18 -6
- package/build/src/akuma/providers/grok-build/index.js +5 -4
- package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
- package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
- package/build/src/akuma/providers/pi/index.js +72 -58
- package/build/src/akuma/request-lifecycle.d.ts +4 -10
- package/build/src/akuma/request-lifecycle.js +7 -5
- package/build/src/akuma/request-rendezvous.d.ts +26 -0
- package/build/src/akuma/request-rendezvous.js +100 -0
- package/build/src/akuma/request-serve.d.ts +6 -66
- package/build/src/akuma/request-serve.js +83 -210
- package/build/src/akuma/request-wire.d.ts +109 -115
- package/build/src/akuma/request-wire.js +63 -318
- package/build/src/akuma/requests.d.ts +19 -47
- package/build/src/akuma/requests.js +51 -107
- package/build/src/akuma/turn-drive.d.ts +5 -3
- package/build/src/akuma/turn-drive.js +39 -11
- package/build/src/akuma-body.d.ts +7 -2
- package/build/src/akuma-body.js +68 -46
- package/build/src/body/amend.js +18 -19
- package/build/src/cli/accepted.d.ts +1 -1
- package/build/src/cli/accepted.js +2 -2
- package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
- package/build/src/cli/commands/akuma-invoke.js +17 -9
- package/build/src/cli/commands/akuma.js +8 -8
- package/build/src/cli/commands/contract-invoke.d.ts +3 -2
- package/build/src/cli/commands/contract-invoke.js +42 -30
- package/build/src/cli/commands/contract.d.ts +16 -20
- package/build/src/cli/commands/contract.js +58 -25
- package/build/src/cli/commands/install.d.ts +2 -1
- package/build/src/cli/commands/install.js +3 -2
- package/build/src/cli/commands/task-invoke.d.ts +3 -0
- package/build/src/cli/commands/task-invoke.js +23 -140
- package/build/src/cli/commands/task.js +54 -20
- package/build/src/cli/invoke.js +39 -25
- package/build/src/cli/main.js +2 -1
- package/build/src/cli/parse.d.ts +2 -2
- package/build/src/cli/parse.js +56 -27
- package/build/src/cli/render/akuma-activity.d.ts +3 -0
- package/build/src/cli/render/akuma-activity.js +45 -29
- package/build/src/cli/render/akuma-tool.d.ts +5 -1
- package/build/src/cli/render/akuma.js +4 -8
- package/build/src/cli/render/audit.js +1 -1
- package/build/src/cli/render/catalog.js +80 -21
- package/build/src/cli/render/contract-observation.d.ts +2 -0
- package/build/src/cli/render/contract-observation.js +11 -0
- package/build/src/cli/render/contract.js +35 -62
- package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
- package/build/src/cli/render/kanshi-akuma.js +132 -0
- package/build/src/cli/render/kanshi.js +131 -213
- package/build/src/cli/render/receipt.d.ts +1 -2
- package/build/src/cli/render/receipt.js +76 -26
- package/build/src/cli/render/refusal.js +2 -10
- package/build/src/cli/render/region.js +5 -2
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/settings.js +27 -8
- package/build/src/cli/render/task.js +22 -5
- package/build/src/cli/render/terminal.d.ts +32 -1
- package/build/src/cli/render/terminal.js +77 -1
- package/build/src/cli/result.d.ts +3 -3
- package/build/src/cli/runtime.js +4 -2
- package/build/src/cli/selectors.d.ts +2 -1
- package/build/src/cli/selectors.js +4 -3
- package/build/src/cli/square-edge.js +120 -36
- package/build/src/cli/usage.js +2 -1
- package/build/src/contract-guidance.d.ts +5 -0
- package/build/src/contract-guidance.js +121 -0
- package/build/src/contract-worktree.d.ts +0 -1
- package/build/src/contract-worktree.js +32 -83
- package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
- package/build/src/coordination/sqlite-transaction-lock.js +5 -0
- package/build/src/core/facts/codec.d.ts +2 -0
- package/build/src/core/facts/codec.js +4 -0
- package/build/src/core/verbs/placement.d.ts +6 -1
- package/build/src/core/verbs/placement.js +5 -3
- package/build/src/dispatch/index.d.ts +0 -2
- package/build/src/dispatch/index.js +54 -55
- package/build/src/git/admission.js +2 -2
- package/build/src/git/hooks.d.ts +9 -15
- package/build/src/git/hooks.js +23 -317
- package/build/src/git/nuke.d.ts +2 -1
- package/build/src/git/nuke.js +39 -21
- package/build/src/git/private-state-seat.d.ts +12 -0
- package/build/src/git/private-state-seat.js +39 -0
- package/build/src/git/process.d.ts +6 -0
- package/build/src/git/process.js +26 -11
- package/build/src/git/read-observation.js +29 -20
- package/build/src/git/reconcile.d.ts +13 -1
- package/build/src/git/reconcile.js +70 -11
- package/build/src/git/ref-migration.d.ts +22 -0
- package/build/src/git/ref-migration.js +55 -0
- package/build/src/git/repository.d.ts +10 -6
- package/build/src/git/repository.js +16 -8
- package/build/src/git/target-placement.d.ts +1 -0
- package/build/src/git/target-placement.js +5 -0
- package/build/src/git/tender.d.ts +1 -0
- package/build/src/git/terminal-reconcile.d.ts +1 -1
- package/build/src/git/terminal-reconcile.js +22 -20
- package/build/src/git/workspace.d.ts +14 -0
- package/build/src/git/workspace.js +44 -0
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/read.js +16 -16
- package/build/src/kanshi/report.d.ts +2 -2
- package/build/src/library/address.d.ts +9 -3
- package/build/src/library/address.js +3 -2
- package/build/src/library/akuma-creation.d.ts +4 -3
- package/build/src/library/akuma-creation.js +19 -13
- package/build/src/library/audit.d.ts +14 -6
- package/build/src/library/audit.js +13 -23
- package/build/src/library/catalog.d.ts +3 -1
- package/build/src/library/catalog.js +20 -6
- package/build/src/library/composition.d.ts +385 -0
- package/build/src/library/composition.js +28 -0
- package/build/src/library/configuration.js +8 -2
- package/build/src/library/continuation.js +66 -30
- package/build/src/library/contract-bind.js +10 -2
- package/build/src/library/contract-forwarding-reconciliation-result.d.ts +102 -0
- package/build/src/library/contract-forwarding-reconciliation-result.js +92 -0
- package/build/src/library/contract-forwarding-result.d.ts +4464 -0
- package/build/src/library/contract-forwarding-result.js +521 -0
- package/build/src/library/contract-forwarding.d.ts +71 -0
- package/build/src/library/contract-forwarding.js +114 -0
- package/build/src/library/contract-handle.d.ts +38 -0
- package/build/src/library/contract-handle.js +314 -0
- package/build/src/library/contract-operations.d.ts +214 -69
- package/build/src/library/contract-operations.js +189 -118
- package/build/src/library/contract-types.d.ts +7 -3
- package/build/src/library/contract.d.ts +21 -34
- package/build/src/library/contract.js +29 -287
- package/build/src/library/fleet-result.d.ts +1580 -0
- package/build/src/library/fleet-result.js +98 -0
- package/build/src/library/fleet.d.ts +112 -54
- package/build/src/library/fleet.js +211 -71
- package/build/src/library/input.d.ts +3 -1
- package/build/src/library/input.js +11 -1
- package/build/src/library/keiyaku.d.ts +388 -20
- package/build/src/library/keiyaku.js +13 -21
- package/build/src/library/mutation.d.ts +3 -3
- package/build/src/library/mutation.js +5 -9
- package/build/src/library/nuke.d.ts +1 -1
- package/build/src/library/nuke.js +4 -3
- package/build/src/library/reconcile.d.ts +4 -0
- package/build/src/library/reconcile.js +2 -0
- package/build/src/library/refusal.d.ts +0 -9
- package/build/src/library/refusal.js +0 -7
- package/build/src/protocol/amend.js +56 -50
- package/build/src/protocol/attempt.d.ts +2 -0
- package/build/src/protocol/attempt.js +8 -1
- package/build/src/protocol/completion.js +7 -0
- package/build/src/protocol/deliver.js +6 -2
- package/build/src/protocol/operations.d.ts +4 -1
- package/build/src/protocol/operations.js +5 -2
- package/build/src/protocol/placement.d.ts +1 -0
- package/build/src/protocol/placement.js +52 -38
- package/build/src/protocol/read/observation.d.ts +1 -4
- package/build/src/protocol/read/observation.js +2 -15
- package/build/src/protocol/reintegrate.js +62 -58
- package/build/src/protocol/review.js +5 -0
- package/build/src/protocol/run.js +17 -13
- package/build/src/runtime/proc/run.d.ts +9 -0
- package/build/src/runtime/proc/run.js +51 -4
- package/build/src/runtime/proc/termination.js +26 -22
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/holder.d.ts +2 -1
- package/build/src/settlement/holder.js +15 -4
- package/build/src/settlement/settle.js +99 -33
- package/build/src/task/board.d.ts +68 -27
- package/build/src/task/board.js +31 -1
- package/build/src/task/catalog.d.ts +4 -0
- package/build/src/task/catalog.js +23 -0
- package/build/src/task/compose-language.js +33 -7
- package/build/src/task/compose-parser.d.ts +1 -1
- package/build/src/task/compose-parser.js +1 -1
- package/build/src/task/compose.js +2 -0
- package/build/src/task/index.d.ts +12 -4
- package/build/src/task/index.js +97 -16
- package/build/src/task/mutation-result.d.ts +923 -0
- package/build/src/task/mutation-result.js +140 -0
- package/build/src/task/mutation.d.ts +552 -28
- package/build/src/task/mutation.js +304 -97
- package/build/src/task/operations.d.ts +1 -4
- package/build/src/task/operations.js +0 -6
- package/build/src/task/public.d.ts +2 -0
- package/build/src/task/public.js +1 -0
- package/build/src/workspace-place.d.ts +7 -2
- package/build/src/workspace-place.js +34 -24
- package/build/src/world.d.ts +1 -0
- package/build/src/world.js +11 -0
- package/package.json +8 -6
- package/build/src/akuma/request-execution.d.ts +0 -8
- package/build/src/akuma/request-execution.js +0 -98
|
@@ -17,8 +17,8 @@ function acceptedEnvelope(result, coordinate) {
|
|
|
17
17
|
contract,
|
|
18
18
|
head: result.head,
|
|
19
19
|
facts: acceptedFacts(result),
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
settlementLags: result.settlementLags,
|
|
21
|
+
...(result.recoverySnapshot === undefined ? {} : { recoverySnapshot: result.recoverySnapshot }),
|
|
22
22
|
...(result.lags.length === 0 || firstLag === undefined ? {} : { lag: [firstLag, ...result.lags.slice(1)] }),
|
|
23
23
|
};
|
|
24
24
|
}
|
|
@@ -4,6 +4,7 @@ import type { Settings } from "../../settings.js";
|
|
|
4
4
|
import type { WorldRoot } from "../../world.js";
|
|
5
5
|
import type { InvokedAkumaCommand } from "./akuma.js";
|
|
6
6
|
import { finishCall } from "../../library/akuma-creation.js";
|
|
7
|
+
import { type ExecutionContext } from "../../akuma/requests.js";
|
|
7
8
|
export type AkumaInvocationResult = Readonly<{
|
|
8
9
|
kind: "akuma";
|
|
9
10
|
action: "call";
|
|
@@ -83,6 +84,7 @@ type InvokeInput = Readonly<{
|
|
|
83
84
|
environment: NodeJS.ProcessEnv;
|
|
84
85
|
readStdin(): Promise<string>;
|
|
85
86
|
finishCall?: typeof finishCall;
|
|
87
|
+
execution?: ExecutionContext;
|
|
86
88
|
}>;
|
|
87
89
|
export declare function invokeAkuma(command: InvokedAkumaCommand, input: InvokeInput): Promise<AkumaInvocationResult>;
|
|
88
90
|
export declare function invokeAkumaStatus(path: WorldRoot, akuma: string, alias?: string, repo?: Repo): Promise<AkumaInvocationResult>;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Keiyaku, } from "../../index.js";
|
|
2
2
|
import { beginCall, finishCall } from "../../library/akuma-creation.js";
|
|
3
|
+
import { killAkuma, tellAkuma, waitAkuma } from "../../library/fleet.js";
|
|
4
|
+
import { localExecutionContext } from "../../akuma/requests.js";
|
|
3
5
|
import { recognizeAndListen } from "../square-edge.js";
|
|
6
|
+
function withRollbackDiagnostic(primary, rollback) {
|
|
7
|
+
const primaryText = primary instanceof Error ? primary.message : String(primary);
|
|
8
|
+
const rollbackText = rollback instanceof Error ? rollback.message : String(rollback);
|
|
9
|
+
const error = new Error(`${primaryText}; ${rollbackText}`, { cause: primary });
|
|
10
|
+
return error;
|
|
11
|
+
}
|
|
4
12
|
function inputAlias(selector) {
|
|
5
13
|
return selector.startsWith("@") ? selector : undefined;
|
|
6
14
|
}
|
|
@@ -12,13 +20,13 @@ async function invokeWait(command, input) {
|
|
|
12
20
|
return {
|
|
13
21
|
kind: "akuma",
|
|
14
22
|
action: "wait",
|
|
15
|
-
result: await
|
|
23
|
+
result: await waitAkuma({
|
|
16
24
|
path: input.path,
|
|
17
25
|
akuma: command.akuma,
|
|
18
26
|
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
19
27
|
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
20
28
|
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
21
|
-
}),
|
|
29
|
+
}, input.execution ?? localExecutionContext()),
|
|
22
30
|
...(alias === undefined ? {} : { alias }),
|
|
23
31
|
};
|
|
24
32
|
}
|
|
@@ -41,12 +49,12 @@ async function invokeTell(command, input) {
|
|
|
41
49
|
...(alias === undefined ? {} : { alias }),
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
|
-
const result = await
|
|
52
|
+
const result = await tellAkuma({
|
|
45
53
|
path: input.path,
|
|
46
54
|
akuma: command.akuma,
|
|
47
55
|
body,
|
|
48
56
|
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
49
|
-
});
|
|
57
|
+
}, input.execution ?? localExecutionContext());
|
|
50
58
|
const alias = inputAlias(command.akuma);
|
|
51
59
|
return { kind: "akuma", action: "tell", mode: "ordinary", result, body, ...(alias === undefined ? {} : { alias }) };
|
|
52
60
|
}
|
|
@@ -93,11 +101,11 @@ async function invokeKill(command, input) {
|
|
|
93
101
|
return {
|
|
94
102
|
kind: "akuma",
|
|
95
103
|
action: "kill",
|
|
96
|
-
result: await
|
|
104
|
+
result: await killAkuma({
|
|
97
105
|
path: input.path,
|
|
98
106
|
akuma: command.akuma,
|
|
99
107
|
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
100
|
-
}),
|
|
108
|
+
}, input.execution ?? localExecutionContext()),
|
|
101
109
|
...(alias === undefined ? {} : { alias }),
|
|
102
110
|
};
|
|
103
111
|
}
|
|
@@ -118,7 +126,7 @@ export async function invokeAkuma(command, input) {
|
|
|
118
126
|
...(input.contract === undefined ? {} : { contract: input.contract }),
|
|
119
127
|
...(command.alias === undefined ? {} : { alias: command.alias }),
|
|
120
128
|
...(command.allowed === undefined ? {} : { allowed: command.allowed }),
|
|
121
|
-
});
|
|
129
|
+
}, input.execution ?? localExecutionContext());
|
|
122
130
|
const listener = born.born.kind === "born"
|
|
123
131
|
? await recognizeAndListen(input.path, input.environment, born.born.allocated)
|
|
124
132
|
: undefined;
|
|
@@ -131,8 +139,8 @@ export async function invokeAkuma(command, input) {
|
|
|
131
139
|
try {
|
|
132
140
|
await listener.rollback();
|
|
133
141
|
}
|
|
134
|
-
catch {
|
|
135
|
-
|
|
142
|
+
catch (rollbackError) {
|
|
143
|
+
throw withRollbackDiagnostic(error, rollbackError);
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
throw error;
|
|
@@ -17,7 +17,7 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
17
17
|
allowed: "repeatable",
|
|
18
18
|
json: "boolean",
|
|
19
19
|
},
|
|
20
|
-
usage: "call <akuma-name> [--contract <kei/...>] [--alias @name] [--readonly] [--allowed <product.action>]... [--wait <duration> | -d | --detach] (<prompt> | -)",
|
|
20
|
+
usage: "call <akuma-name> [--contract <kei/...>] [--alias @name] [--readonly] [--allowed <product.action>]... [--wait <duration> | -d | --detach] [--json] (<prompt> | -)",
|
|
21
21
|
purpose: "Birth an Akuma from <akuma-name> with one prompt.",
|
|
22
22
|
details: [
|
|
23
23
|
"Give <prompt> as one argument, or use - to read stdin.",
|
|
@@ -25,7 +25,7 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
25
25
|
"--contract dispatches the born Akuma to that Contract.",
|
|
26
26
|
"--alias assigns the world-local @name selector to the born Akuma.",
|
|
27
27
|
"--readonly adds the one-way read-only birth restriction.",
|
|
28
|
-
"Repeated --allowed adds actions to the
|
|
28
|
+
"Repeated --allowed adds actions to the selected Akuma's defaults.",
|
|
29
29
|
"With --contract, Dispatch succeeds first. If @name exists, the alias then moves.",
|
|
30
30
|
].join("\n"),
|
|
31
31
|
},
|
|
@@ -33,14 +33,14 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
33
33
|
arity: "one-or-more",
|
|
34
34
|
stdin: false,
|
|
35
35
|
flags: { any: "boolean", all: "boolean", timeout: "value", json: "boolean" },
|
|
36
|
-
usage: "wait <akuma-selector>... [--any | --all] [--timeout <duration>]",
|
|
36
|
+
usage: "wait <akuma-selector>... [--any | --all] [--timeout <duration>] [--json]",
|
|
37
37
|
purpose: "Wait for one Akuma or an explicitly selected Akuma set.",
|
|
38
38
|
},
|
|
39
39
|
tell: {
|
|
40
40
|
arity: 1,
|
|
41
41
|
stdin: true,
|
|
42
42
|
flags: { interrupt: "boolean", json: "boolean" },
|
|
43
|
-
usage: "tell <aku/...|@alias> [--interrupt] (<prompt> | -)",
|
|
43
|
+
usage: "tell <aku/...|@alias> [--interrupt] [--json] (<prompt> | -)",
|
|
44
44
|
purpose: "Send one prompt to an existing Akuma and wake it.",
|
|
45
45
|
details: [
|
|
46
46
|
"Give <prompt> as one argument, or use - to read stdin.",
|
|
@@ -51,21 +51,21 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
51
51
|
arity: 1,
|
|
52
52
|
stdin: false,
|
|
53
53
|
flags: { id: "value", before: "value", since: "value", limit: "value", last: "boolean", json: "boolean" },
|
|
54
|
-
usage: "history <aku/...|@alias
|
|
54
|
+
usage: "history <aku/...|@alias> [--id <historyId> | --before <index> | --since <index>] [--limit <count>] [--last] [--json]\nhistory <kei/...> [--json]",
|
|
55
55
|
purpose: "Read Akuma execution history or one complete Contract journal and Dispatch timeline.",
|
|
56
56
|
},
|
|
57
57
|
fork: {
|
|
58
58
|
arity: 1,
|
|
59
59
|
stdin: false,
|
|
60
60
|
flags: { at: "value", json: "boolean" },
|
|
61
|
-
usage: "fork <aku
|
|
61
|
+
usage: "fork <aku/...|@alias> --at <historyId> [--json]",
|
|
62
62
|
purpose: "Fork one Akuma at a retained answered history point.",
|
|
63
63
|
},
|
|
64
64
|
kill: {
|
|
65
65
|
arity: "one-or-more",
|
|
66
66
|
stdin: false,
|
|
67
67
|
flags: { json: "boolean" },
|
|
68
|
-
usage: "kill <akuma-selector>...",
|
|
68
|
+
usage: "kill <akuma-selector>... [--json]",
|
|
69
69
|
purpose: "Put down the current Body of an Akuma selector snapshot.",
|
|
70
70
|
},
|
|
71
71
|
};
|
|
@@ -76,7 +76,7 @@ export function isParsedAkumaCommand(command) {
|
|
|
76
76
|
return isAkumaAction(command.command) && !("contract" in command && command.command === "history");
|
|
77
77
|
}
|
|
78
78
|
export function renderAkumaRootRows() {
|
|
79
|
-
return Object.
|
|
79
|
+
return Object.entries(AKUMA_COMMAND_SPECS).map(([action, spec]) => ` ${action.padEnd(10)} ${spec.purpose}`);
|
|
80
80
|
}
|
|
81
81
|
export function renderAkumaHelp(action) {
|
|
82
82
|
const spec = AKUMA_COMMAND_SPECS[action];
|
|
@@ -4,6 +4,7 @@ import type { WorktreeHooks } from "../../library/configuration.js";
|
|
|
4
4
|
import type { Repo } from "../../library/repo.js";
|
|
5
5
|
import type { Settings } from "../../settings.js";
|
|
6
6
|
import type { WorldRoot } from "../../world.js";
|
|
7
|
+
import type { ExecutionContext } from "../../akuma/requests.js";
|
|
7
8
|
type ContractMutation = Extract<ParsedCommand, {
|
|
8
9
|
command: "bind" | "amend" | "deliver" | "review" | "arc" | "abandon" | "audit";
|
|
9
10
|
}>;
|
|
@@ -17,9 +18,9 @@ export type ContractMutationInput = Readonly<{
|
|
|
17
18
|
edge: InvocationEdge;
|
|
18
19
|
scope: string;
|
|
19
20
|
configuration?: Settings;
|
|
20
|
-
hooks
|
|
21
|
+
hooks?: WorktreeHooks;
|
|
21
22
|
establishWorld: () => Promise<WorldRoot>;
|
|
22
|
-
|
|
23
|
+
execution: ExecutionContext;
|
|
23
24
|
}>;
|
|
24
25
|
export declare function invokeContractMutation(input: ContractMutationInput): Promise<InvocationResult>;
|
|
25
26
|
export {};
|
|
@@ -26,13 +26,12 @@ async function selectedGitPolicy(value) {
|
|
|
26
26
|
const { requireBranchesToBeUpToDateFrom, SettingsError } = await import("../../library/configuration.js");
|
|
27
27
|
return consumeSettings(() => requireBranchesToBeUpToDateFrom({ settings: value }), SettingsError);
|
|
28
28
|
}
|
|
29
|
-
async function selectContract(repo, selector, scope) {
|
|
29
|
+
async function selectContract(repo, selector, scope, library) {
|
|
30
30
|
const { contractFromInput, resolveContextualContract } = await import("../selectors.js");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return contractFromInput(repo, id);
|
|
31
|
+
const id = selector !== undefined && !selector.startsWith("@")
|
|
32
|
+
? contractFromInput(repo, selector).id
|
|
33
|
+
: resolveContextualContract(await library.list({ repo }), selector, scope);
|
|
34
|
+
return { id, contract: library.of({ repo, id }) };
|
|
36
35
|
}
|
|
37
36
|
async function bindDraftReceipt(establishWorld, markdown) {
|
|
38
37
|
const { preserveBindDraft } = await import("../draft.js");
|
|
@@ -51,7 +50,12 @@ async function invokeBind(input) {
|
|
|
51
50
|
const { bindFromCommand } = await import("./bind.js");
|
|
52
51
|
const { acceptedBind, resultFromMutationCall } = await import("../accepted.js");
|
|
53
52
|
if (parsed.forkOf !== undefined) {
|
|
54
|
-
return resultFromMutationCall("bind", () => bindFromCommand({
|
|
53
|
+
return resultFromMutationCall("bind", () => bindFromCommand({
|
|
54
|
+
command: parsed,
|
|
55
|
+
repo,
|
|
56
|
+
...(actor === undefined ? {} : { actor }),
|
|
57
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
58
|
+
}), (accepted) => {
|
|
55
59
|
const bound = accepted.facts.find((fact) => fact.kind === "bind");
|
|
56
60
|
if (bound === undefined || bound.kind !== "bind")
|
|
57
61
|
throw new Error("accepted bind is missing its bind fact");
|
|
@@ -69,7 +73,7 @@ async function invokeBind(input) {
|
|
|
69
73
|
markdown,
|
|
70
74
|
gates,
|
|
71
75
|
...(actor === undefined ? {} : { actor }),
|
|
72
|
-
hooks,
|
|
76
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
73
77
|
}), (accepted) => {
|
|
74
78
|
const bound = accepted.facts.find((fact) => fact.kind === "bind");
|
|
75
79
|
if (bound === undefined || bound.kind !== "bind")
|
|
@@ -94,22 +98,19 @@ function deliverRefusal(refusal) {
|
|
|
94
98
|
const submodules = "submodules" in refusal && Array.isArray(refusal.submodules) ? refusal.submodules : [];
|
|
95
99
|
return { ...refusal, option: { flag: "--include-dirty", available: submodules.length === 0 } };
|
|
96
100
|
}
|
|
97
|
-
async function existingSeat(input, parsed) {
|
|
101
|
+
async function existingSeat(input, parsed, library) {
|
|
98
102
|
const { repo, edge, scope, hooks } = input;
|
|
99
|
-
const { id, contract } = await selectContract(repo, parsed.contract, scope);
|
|
100
|
-
const actor = actorFromEdge(parsed.actor, edge.environment);
|
|
101
|
-
return { contract, id, ...(actor === undefined ? {} : { actor }), hooks };
|
|
103
|
+
const { id, contract } = await selectContract(repo, parsed.contract, scope, library);
|
|
104
|
+
const actor = "actor" in parsed ? actorFromEdge(parsed.actor, edge.environment) : undefined;
|
|
105
|
+
return { contract, id, ...(actor === undefined ? {} : { actor }), ...(hooks === undefined ? {} : { hooks }) };
|
|
102
106
|
}
|
|
103
|
-
async function invokeDeliver(parsed, seat
|
|
107
|
+
async function invokeDeliver(parsed, seat) {
|
|
104
108
|
const { acceptedDeliver } = await import("../accepted.js");
|
|
105
109
|
try {
|
|
106
110
|
const delivered = await seat.contract.deliver({
|
|
107
|
-
...(seat.actor === undefined ? {} : { actor: seat.actor }),
|
|
108
111
|
...(parsed.message === undefined ? {} : { message: parsed.message }),
|
|
109
|
-
requireBranchesToBeUpToDate,
|
|
110
112
|
includeDirty: parsed.includeDirty,
|
|
111
113
|
materializeConflict: parsed.materializeConflict,
|
|
112
|
-
hooks: seat.hooks,
|
|
113
114
|
});
|
|
114
115
|
if (!("facts" in delivered))
|
|
115
116
|
return delivered;
|
|
@@ -130,16 +131,29 @@ async function invokeReview(parsed, seat, readStdin) {
|
|
|
130
131
|
const { acceptedReview, resultFromMutationCall } = await import("../accepted.js");
|
|
131
132
|
return resultFromMutationCall("review", () => seat.contract.review({
|
|
132
133
|
verdict: parsed.verdict,
|
|
133
|
-
...(seat.actor === undefined ? {} : { actor: seat.actor }),
|
|
134
134
|
...(summary === undefined ? {} : { summary }),
|
|
135
|
-
hooks: seat.hooks,
|
|
136
135
|
}), (result) => acceptedReview(result, seat.id), { coordinate: seat.id });
|
|
137
136
|
}
|
|
137
|
+
async function contractLibrary(input, parsed) {
|
|
138
|
+
const { configuration, edge, hooks } = input;
|
|
139
|
+
if (input.execution.channel.kind !== "local" || !["audit", "deliver", "review"].includes(parsed.command)) {
|
|
140
|
+
const { Keiyaku } = await import("../../library/keiyaku.js");
|
|
141
|
+
return Keiyaku.withExecution({ execution: input.execution });
|
|
142
|
+
}
|
|
143
|
+
const requireBranchesToBeUpToDate = parsed.command !== "review" && configuration !== undefined ? await selectedGitPolicy(configuration) : false;
|
|
144
|
+
const actor = actorFromEdge(undefined, edge.environment);
|
|
145
|
+
const { Keiyaku } = await import("../../library/keiyaku.js");
|
|
146
|
+
return Keiyaku.withLocal({
|
|
147
|
+
...(actor === undefined ? {} : { actor }),
|
|
148
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
149
|
+
requireBranchesToBeUpToDate,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
138
152
|
export async function invokeContractMutation(input) {
|
|
139
|
-
const { parsed, repo, edge, configuration, hooks
|
|
153
|
+
const { parsed, repo, edge, configuration, hooks } = input;
|
|
140
154
|
if (parsed.command === "bind")
|
|
141
155
|
return invokeBind(input);
|
|
142
|
-
const seat = await existingSeat(input, parsed);
|
|
156
|
+
const seat = await existingSeat(input, parsed, await contractLibrary(input, parsed));
|
|
143
157
|
const { id, contract, actor } = seat;
|
|
144
158
|
switch (parsed.command) {
|
|
145
159
|
case "amend": {
|
|
@@ -156,37 +170,35 @@ export async function invokeContractMutation(input) {
|
|
|
156
170
|
...(markdown === undefined ? {} : { markdown }),
|
|
157
171
|
gates,
|
|
158
172
|
...(actor === undefined ? {} : { actor }),
|
|
159
|
-
hooks,
|
|
173
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
160
174
|
}), (result) => acceptedAmend(result, id), { coordinate: id });
|
|
161
175
|
}
|
|
162
176
|
case "deliver":
|
|
163
|
-
return invokeDeliver(parsed, seat
|
|
177
|
+
return invokeDeliver(parsed, seat);
|
|
164
178
|
case "review":
|
|
165
179
|
return invokeReview(parsed, seat, edge.readStdin);
|
|
166
180
|
case "arc": {
|
|
167
181
|
const markdown = await edge.readStdin();
|
|
168
182
|
const { acceptedArc, resultFromMutationCall } = await import("../accepted.js");
|
|
169
|
-
return resultFromMutationCall("arc", () => contract.arc({
|
|
183
|
+
return resultFromMutationCall("arc", () => contract.arc({
|
|
184
|
+
markdown,
|
|
185
|
+
...(actor === undefined ? {} : { actor }),
|
|
186
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
187
|
+
}), (result) => acceptedArc(result, id), { coordinate: id });
|
|
170
188
|
}
|
|
171
189
|
case "abandon": {
|
|
172
190
|
const { acceptedAbandon, resultFromMutationCall } = await import("../accepted.js");
|
|
173
191
|
return resultFromMutationCall("abandon", () => contract.abandon({
|
|
174
192
|
...(actor === undefined ? {} : { actor }),
|
|
175
193
|
...(parsed.note === undefined ? {} : { note: parsed.note }),
|
|
176
|
-
hooks,
|
|
194
|
+
...(hooks === undefined ? {} : { hooks }),
|
|
177
195
|
}), (result) => acceptedAbandon(result, id), { coordinate: id });
|
|
178
196
|
}
|
|
179
197
|
case "audit": {
|
|
180
|
-
if (configuration === undefined)
|
|
181
|
-
throw new Error("audit invocation requires Settings");
|
|
182
|
-
const requireBranchesToBeUpToDate = await selectedGitPolicy(configuration);
|
|
183
198
|
const { acceptedAudit, resultFromMutationCall } = await import("../accepted.js");
|
|
184
199
|
return resultFromMutationCall("audit", () => contract.audit({
|
|
185
|
-
...(actor === undefined ? {} : { actor }),
|
|
186
200
|
includeDirty: parsed.includeDirty,
|
|
187
201
|
showDiff: parsed.showDiff,
|
|
188
|
-
requireBranchesToBeUpToDate,
|
|
189
|
-
hooks,
|
|
190
202
|
}), (result) => acceptedAudit(result, id), { coordinate: id });
|
|
191
203
|
}
|
|
192
204
|
}
|
|
@@ -30,14 +30,14 @@ export type ParsedAmend = Output & Actor & Readonly<{
|
|
|
30
30
|
gates?: readonly string[];
|
|
31
31
|
stdin?: true;
|
|
32
32
|
}>;
|
|
33
|
-
export type ParsedDeliver = Output &
|
|
33
|
+
export type ParsedDeliver = Output & Readonly<{
|
|
34
34
|
command: "deliver";
|
|
35
35
|
contract?: string;
|
|
36
36
|
message?: string;
|
|
37
37
|
includeDirty: boolean;
|
|
38
38
|
materializeConflict: boolean;
|
|
39
39
|
}>;
|
|
40
|
-
export type ParsedReview = Output &
|
|
40
|
+
export type ParsedReview = Output & Readonly<{
|
|
41
41
|
command: "review";
|
|
42
42
|
contract?: string;
|
|
43
43
|
verdict: "satisfied" | "unsatisfied";
|
|
@@ -72,7 +72,6 @@ export type ParsedAudit = Output & Readonly<{
|
|
|
72
72
|
contract?: string;
|
|
73
73
|
includeDirty: boolean;
|
|
74
74
|
showDiff: boolean;
|
|
75
|
-
actor?: string;
|
|
76
75
|
}>;
|
|
77
76
|
export type ParsedReconcile = Output & Readonly<{
|
|
78
77
|
command: "reconcile";
|
|
@@ -108,7 +107,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
108
107
|
readonly "fork-of": "value";
|
|
109
108
|
readonly json: "boolean";
|
|
110
109
|
};
|
|
111
|
-
readonly usage: "bind [--task <task/...>] [--target <ref>] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref>] [--actor <actor>]";
|
|
110
|
+
readonly usage: "bind [--task <task/...>] [--target <ref>] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] [--json] - | bind --fork-of <kei/...> [--target <ref>] [--actor <actor>] [--json]";
|
|
112
111
|
readonly purpose: "Create one Contract from stdin Markdown or a sibling fork.";
|
|
113
112
|
};
|
|
114
113
|
readonly amend: {
|
|
@@ -121,7 +120,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
121
120
|
readonly gates: "raw-value";
|
|
122
121
|
readonly json: "boolean";
|
|
123
122
|
};
|
|
124
|
-
readonly usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name,...>] [--actor <actor>] [-]";
|
|
123
|
+
readonly usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name,...>] [--actor <actor>] [--json] [-]";
|
|
125
124
|
readonly purpose: "Amend one Contract's document operations or structured terms.";
|
|
126
125
|
readonly details: string;
|
|
127
126
|
};
|
|
@@ -129,13 +128,12 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
129
128
|
readonly positional: "optional";
|
|
130
129
|
readonly stdin: "none";
|
|
131
130
|
readonly flags: {
|
|
132
|
-
readonly actor: "value";
|
|
133
131
|
readonly message: "value";
|
|
134
132
|
readonly "include-dirty": "boolean";
|
|
135
133
|
readonly "materialize-conflict": "boolean";
|
|
136
134
|
readonly json: "boolean";
|
|
137
135
|
};
|
|
138
|
-
readonly usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--materialize-conflict] [--
|
|
136
|
+
readonly usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--materialize-conflict] [--json]";
|
|
139
137
|
readonly purpose: "Deliver one Contract candidate from the appointed worktree.";
|
|
140
138
|
readonly details: string;
|
|
141
139
|
};
|
|
@@ -143,13 +141,12 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
143
141
|
readonly positional: "optional";
|
|
144
142
|
readonly stdin: "optional";
|
|
145
143
|
readonly flags: {
|
|
146
|
-
readonly actor: "value";
|
|
147
144
|
readonly satisfied: "boolean";
|
|
148
145
|
readonly unsatisfied: "boolean";
|
|
149
146
|
readonly summary: "value";
|
|
150
147
|
readonly json: "boolean";
|
|
151
148
|
};
|
|
152
|
-
readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--
|
|
149
|
+
readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--json]";
|
|
153
150
|
readonly purpose: "Record one review verdict.";
|
|
154
151
|
};
|
|
155
152
|
readonly arc: {
|
|
@@ -159,7 +156,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
159
156
|
readonly actor: "value";
|
|
160
157
|
readonly json: "boolean";
|
|
161
158
|
};
|
|
162
|
-
readonly usage: "arc [<contract>|@<contract>] [--actor <actor>] -";
|
|
159
|
+
readonly usage: "arc [<contract>|@<contract>] [--actor <actor>] [--json] -";
|
|
163
160
|
readonly purpose: "Record stdin arc Markdown for one Contract.";
|
|
164
161
|
};
|
|
165
162
|
readonly abandon: {
|
|
@@ -170,7 +167,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
170
167
|
readonly note: "value";
|
|
171
168
|
readonly json: "boolean";
|
|
172
169
|
};
|
|
173
|
-
readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>]";
|
|
170
|
+
readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>] [--json]";
|
|
174
171
|
readonly purpose: "Abandon one Contract with an optional note.";
|
|
175
172
|
};
|
|
176
173
|
readonly status: {
|
|
@@ -179,7 +176,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
179
176
|
readonly flags: {
|
|
180
177
|
readonly json: "boolean";
|
|
181
178
|
};
|
|
182
|
-
readonly usage: "status [<contract>|@name|<aku/...>]...";
|
|
179
|
+
readonly usage: "status [<contract>|@name|<aku/...>]... [--json]";
|
|
183
180
|
readonly purpose: "Read the world status board or one or more Contract and Akuma projections.";
|
|
184
181
|
};
|
|
185
182
|
readonly show: {
|
|
@@ -188,7 +185,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
188
185
|
readonly flags: {
|
|
189
186
|
readonly json: "boolean";
|
|
190
187
|
};
|
|
191
|
-
readonly usage: "show [<contract>|@<contract>]";
|
|
188
|
+
readonly usage: "show [<contract>|@<contract>] [--json]";
|
|
192
189
|
readonly purpose: "Read one Contract guidance projection.";
|
|
193
190
|
};
|
|
194
191
|
readonly ls: {
|
|
@@ -197,7 +194,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
197
194
|
readonly flags: {
|
|
198
195
|
readonly json: "boolean";
|
|
199
196
|
};
|
|
200
|
-
readonly usage: "ls task[/]\
|
|
197
|
+
readonly usage: "ls task[/] [--json]\nls kei[/] [--json]\nls aku[/] [--json]\nls aku/<akuma>[/] [--json]\nls \"aku/*/*\" [--json]";
|
|
201
198
|
readonly purpose: "List one identity directory.";
|
|
202
199
|
};
|
|
203
200
|
readonly audit: {
|
|
@@ -206,10 +203,9 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
206
203
|
readonly flags: {
|
|
207
204
|
readonly "include-dirty": "boolean";
|
|
208
205
|
readonly diff: "boolean";
|
|
209
|
-
readonly actor: "value";
|
|
210
206
|
readonly json: "boolean";
|
|
211
207
|
};
|
|
212
|
-
readonly usage: "audit [<contract>|@<contract>] [--include-dirty] [--diff] [--
|
|
208
|
+
readonly usage: "audit [<contract>|@<contract>] [--include-dirty] [--diff] [--json]";
|
|
213
209
|
readonly purpose: "Ask what candidate preparation, Verification, and target placement would do.";
|
|
214
210
|
};
|
|
215
211
|
readonly reconcile: {
|
|
@@ -219,7 +215,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
219
215
|
readonly "retry-hooks": "boolean";
|
|
220
216
|
readonly json: "boolean";
|
|
221
217
|
};
|
|
222
|
-
readonly usage: "reconcile [<contract>|@<contract>] [--retry-hooks]";
|
|
218
|
+
readonly usage: "reconcile [<contract>|@<contract>] [--retry-hooks] [--json]";
|
|
223
219
|
readonly purpose: "Reconcile one Contract or the invocation world.";
|
|
224
220
|
};
|
|
225
221
|
readonly nuke: {
|
|
@@ -238,8 +234,8 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
238
234
|
readonly flags: {
|
|
239
235
|
readonly json: "boolean";
|
|
240
236
|
};
|
|
241
|
-
readonly usage: "settings";
|
|
242
|
-
readonly purpose: "
|
|
237
|
+
readonly usage: "settings [--json]";
|
|
238
|
+
readonly purpose: "Show effective Settings (user + project, read-only)";
|
|
243
239
|
};
|
|
244
240
|
readonly region: {
|
|
245
241
|
readonly positional: "optional";
|
|
@@ -248,7 +244,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
248
244
|
readonly path: "repeat-value";
|
|
249
245
|
readonly json: "boolean";
|
|
250
246
|
};
|
|
251
|
-
readonly usage: "region [<contract>]\
|
|
247
|
+
readonly usage: "region [<contract>] [--json]\nregion --path <pattern> [--path <pattern> ...] [--json]";
|
|
252
248
|
readonly purpose: "Read active declared Contract Regions.";
|
|
253
249
|
};
|
|
254
250
|
};
|