@astrosheep/keiyaku 4.6.26 → 4.6.28
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 +113 -35
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +14 -26
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +64 -44
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +13 -25
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +42 -29
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +13 -8
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +57 -61
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +14 -26
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +64 -44
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +13 -25
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +42 -29
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +13 -8
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +57 -61
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +14 -26
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +64 -44
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +13 -25
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +42 -29
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +13 -8
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +57 -61
- package/build/plugins/pi/README.md +7 -12
- package/build/plugins/pi/akuma-tools.ts +3 -18
- package/build/skills/keiyaku/SKILL.md +14 -26
- package/build/skills/keiyaku-akuma/SKILL.md +64 -44
- package/build/skills/keiyaku-akuma/references/automation.md +13 -25
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +42 -29
- package/build/skills/keiyaku-debt/SKILL.md +13 -8
- package/build/skills/keiyaku-workflow/SKILL.md +57 -61
- package/build/src/akuma/akuma-call.d.ts +15 -18
- package/build/src/akuma/akuma-call.js +55 -112
- package/build/src/akuma/akuma-errors.d.ts +0 -5
- package/build/src/akuma/akuma-errors.js +0 -9
- package/build/src/akuma/akuma-instance.d.ts +0 -2
- package/build/src/akuma/akuma-instance.js +18 -14
- package/build/src/akuma/akuma-observe.js +0 -1
- package/build/src/akuma/akuma-owner.js +0 -1
- package/build/src/akuma/akuma.d.ts +10 -26
- package/build/src/akuma/akuma.js +0 -2
- package/build/src/akuma/archetype.d.ts +0 -2
- package/build/src/akuma/archetype.js +3 -9
- package/build/src/akuma/body-launch.d.ts +12 -4
- package/build/src/akuma/body.d.ts +2 -5
- package/build/src/akuma/body.js +5 -49
- package/build/src/akuma/call-initial-tell.d.ts +39 -147
- package/build/src/akuma/call-initial-tell.js +0 -48
- package/build/src/akuma/caller.d.ts +0 -4
- package/build/src/akuma/custody.js +1 -57
- package/build/src/akuma/heart/facts.d.ts +0 -39
- package/build/src/akuma/heart/facts.js +0 -1
- package/build/src/akuma/heart/index.d.ts +1 -2
- package/build/src/akuma/heart/index.js +0 -1
- package/build/src/akuma/heart/schema.js +0 -26
- package/build/src/akuma/heart/soul.d.ts +2 -2
- package/build/src/akuma/heart/soul.js +2 -4
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +0 -2
- package/build/src/akuma/in-process-body.d.ts +1 -1
- package/build/src/akuma/index.d.ts +0 -2
- package/build/src/akuma/index.js +0 -1
- package/build/src/akuma/projection.d.ts +23 -23
- package/build/src/akuma/provider.d.ts +0 -5
- package/build/src/akuma/provider.js +0 -1
- package/build/src/akuma/providers/acp/core.js +1 -1
- package/build/src/akuma/providers/claude/index.js +1 -2
- package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
- package/build/src/akuma/providers/codex-app-server/events.js +1 -3
- package/build/src/akuma/providers/codex-app-server/index.js +1 -1
- package/build/src/akuma/providers/execution-environment.d.ts +1 -3
- package/build/src/akuma/providers/execution-environment.js +1 -7
- package/build/src/akuma/providers/opencode-sdk/index.js +0 -1
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +0 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +4 -4
- package/build/src/akuma/providers/paseo/index.js +2 -9
- package/build/src/akuma/providers/pi/index.js +8 -14
- package/build/src/akuma/publication.d.ts +24 -59
- package/build/src/akuma/publication.js +29 -64
- package/build/src/akuma/selection-observation.d.ts +47 -2036
- package/build/src/akuma/selection-observation.js +1 -59
- package/build/src/akuma/turn-drive.d.ts +0 -8
- package/build/src/akuma/turn-drive.js +19 -103
- package/build/src/akuma-body.js +3 -6
- package/build/src/body-host.d.ts +8 -2
- package/build/src/body-host.js +30 -4
- package/build/src/cli/commands/akuma-grammar.d.ts +0 -2
- package/build/src/cli/commands/akuma-grammar.js +14 -37
- package/build/src/cli/commands/akuma.js +31 -49
- package/build/src/cli/commands/contract-grammar.d.ts +7 -1
- package/build/src/cli/commands/contract-grammar.js +15 -0
- package/build/src/cli/commands/contract-help.d.ts +13 -1
- package/build/src/cli/commands/contract-help.js +88 -81
- package/build/src/cli/commands/contract.js +27 -26
- package/build/src/cli/commands/debt-grammar.js +15 -15
- package/build/src/cli/commands/debt.js +3 -3
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +1 -2
- package/build/src/cli/commands/whoami.d.ts +0 -2
- package/build/src/cli/commands/whoami.js +0 -5
- package/build/src/cli/coordinates.js +15 -0
- package/build/src/cli/delivery-identity.d.ts +3 -0
- package/build/src/cli/delivery-identity.js +23 -0
- package/build/src/cli/parse.js +2 -1
- package/build/src/cli/render/akuma-activity.d.ts +0 -1
- package/build/src/cli/render/akuma-activity.js +1 -4
- package/build/src/cli/render/catalog.js +7 -1
- package/build/src/cli/render/contract-history.js +16 -38
- package/build/src/cli/render/contract-observation.d.ts +23 -10
- package/build/src/cli/render/contract-observation.js +9 -6
- package/build/src/cli/render/contract-wait.d.ts +2 -0
- package/build/src/cli/render/contract-wait.js +18 -0
- package/build/src/cli/render/contract.d.ts +2 -2
- package/build/src/cli/render/contract.js +57 -39
- package/build/src/cli/render/delivery-preview.js +13 -26
- package/build/src/cli/render/execution-progress.js +9 -9
- package/build/src/cli/render/kanshi.js +4 -11
- package/build/src/cli/render/receipt.d.ts +18 -0
- package/build/src/cli/render/receipt.js +34 -10
- package/build/src/cli/render/reconcile.js +3 -0
- package/build/src/cli/render/refusal.js +28 -6
- package/build/src/cli/render/whoami.js +1 -4
- package/build/src/cli/runtime.d.ts +0 -2
- package/build/src/cli/runtime.js +3 -7
- package/build/src/cli/selectors.d.ts +1 -2
- package/build/src/cli/selectors.js +2 -5
- package/build/src/contract-guidance.js +4 -2
- package/build/src/contract-worktree.d.ts +3 -3
- package/build/src/core/facts/codec.js +38 -5
- package/build/src/core/facts/fold.js +1 -0
- package/build/src/core/facts/gate.d.ts +10 -4
- package/build/src/core/facts/gate.js +56 -39
- package/build/src/core/facts/observation.d.ts +7 -1
- package/build/src/core/facts/observation.js +15 -0
- package/build/src/core/facts/offer.d.ts +2 -2
- package/build/src/core/facts/types.d.ts +17 -1
- package/build/src/core/facts/types.js +6 -0
- package/build/src/core/verbs/amend.js +8 -0
- package/build/src/core/verbs/bind.d.ts +3 -1
- package/build/src/core/verbs/bind.js +9 -1
- package/build/src/core/verbs/deliver.d.ts +2 -1
- package/build/src/core/verbs/deliver.js +4 -1
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +7 -4
- package/build/src/core/verbs/reintegrate.d.ts +2 -1
- package/build/src/core/verbs/reintegrate.js +4 -1
- package/build/src/debt/board.d.ts +10 -10
- package/build/src/debt/created-observation.d.ts +3 -3
- package/build/src/debt/document.d.ts +1 -1
- package/build/src/debt/index.d.ts +2 -24
- package/build/src/debt/index.js +11 -71
- package/build/src/debt/operation-types.d.ts +44 -3
- package/build/src/git/admission.js +18 -6
- package/build/src/git/integration.d.ts +4 -4
- package/build/src/git/integration.js +7 -1
- package/build/src/git/observe.d.ts +6 -4
- package/build/src/git/observe.js +18 -17
- package/build/src/git/reconcile.d.ts +20 -8
- package/build/src/git/reconcile.js +94 -45
- package/build/src/git/repository.d.ts +3 -1
- package/build/src/git/repository.js +26 -4
- package/build/src/git/scratch.d.ts +1 -1
- package/build/src/git/scratch.js +19 -18
- package/build/src/git/target-placement.d.ts +33 -7
- package/build/src/git/target-placement.js +67 -18
- package/build/src/git/target.d.ts +32 -0
- package/build/src/git/target.js +84 -0
- package/build/src/git/terminal-reconcile.d.ts +1 -1
- package/build/src/git/terminal-reconcile.js +34 -6
- package/build/src/index.d.ts +9 -7
- package/build/src/index.js +1 -1
- package/build/src/library/address.d.ts +1 -20
- package/build/src/library/address.js +3 -24
- package/build/src/library/akuma-creation.d.ts +2 -5
- package/build/src/library/akuma-creation.js +60 -44
- package/build/src/library/akumas.d.ts +3 -9
- package/build/src/library/akumas.js +12 -25
- package/build/src/library/bind.d.ts +21 -9
- package/build/src/library/bind.js +5 -1
- package/build/src/library/continuation.d.ts +130 -155
- package/build/src/library/continuation.js +1 -4
- package/build/src/library/contract-composition.d.ts +4 -9
- package/build/src/library/contract-composition.js +8 -12
- package/build/src/library/contract-creation.d.ts +1 -3
- package/build/src/library/contract-creation.js +2 -3
- package/build/src/library/contract-execution.d.ts +3 -5
- package/build/src/library/contract-execution.js +55 -96
- package/build/src/library/contract-outcomes.d.ts +2 -1
- package/build/src/library/contract-types.d.ts +5 -0
- package/build/src/library/contract-wait.d.ts +35 -0
- package/build/src/library/contract-wait.js +141 -0
- package/build/src/library/delivery.d.ts +13 -525
- package/build/src/library/delivery.js +1 -12
- package/build/src/library/input.js +2 -1
- package/build/src/library/invocation.d.ts +5 -1
- package/build/src/library/invocation.js +9 -2
- package/build/src/library/keiyaku.d.ts +7 -6
- package/build/src/library/keiyaku.js +12 -7
- package/build/src/library/outcome.d.ts +461 -12586
- package/build/src/library/outcome.js +15 -234
- package/build/src/library/reconcile.d.ts +12 -0
- package/build/src/library/reconcile.js +1 -0
- package/build/src/library/refusal.d.ts +251 -34
- package/build/src/library/refusal.js +10 -5
- package/build/src/library/selection.d.ts +9 -35
- package/build/src/library/selection.js +59 -129
- package/build/src/plugin/akuma-signals.d.ts +2 -2
- package/build/src/plugin/akuma-signals.js +2 -2
- package/build/src/plugin/public.d.ts +0 -7
- package/build/src/plugin/runtime.d.ts +2 -2
- package/build/src/plugin/runtime.js +4 -3
- package/build/src/protocol/attempt.js +7 -3
- package/build/src/protocol/bind.d.ts +18 -4
- package/build/src/protocol/bind.js +102 -35
- package/build/src/protocol/completion.d.ts +18 -331
- package/build/src/protocol/completion.js +17 -130
- package/build/src/protocol/deliver.d.ts +3 -3
- package/build/src/protocol/deliver.js +64 -74
- package/build/src/protocol/delivery-preview.d.ts +85 -28
- package/build/src/protocol/delivery-preview.js +34 -22
- package/build/src/protocol/execution-observation.d.ts +12 -9
- package/build/src/protocol/execution-observation.js +0 -1
- package/build/src/protocol/intent.d.ts +20 -50
- package/build/src/protocol/intent.js +37 -44
- package/build/src/protocol/operations.d.ts +299 -19
- package/build/src/protocol/operations.js +68 -27
- package/build/src/protocol/outcome.d.ts +1 -1
- package/build/src/protocol/placement.d.ts +2 -2
- package/build/src/protocol/placement.js +4 -3
- package/build/src/protocol/progress.d.ts +35 -2
- package/build/src/protocol/progress.js +12 -1
- package/build/src/protocol/read/observation.js +15 -4
- package/build/src/protocol/read/status.d.ts +9 -14
- package/build/src/protocol/read/status.js +15 -22
- package/build/src/protocol/reintegrate.d.ts +4 -3
- package/build/src/protocol/reintegrate.js +21 -5
- package/build/src/protocol/review.d.ts +9 -15
- package/build/src/protocol/review.js +2 -6
- package/build/src/protocol/run.d.ts +1 -1
- package/build/src/protocol/verify.d.ts +51 -0
- package/build/src/protocol/verify.js +128 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/verification/declaration.d.ts +5 -1
- package/build/src/verification/declaration.js +19 -2
- package/build/src/verification/execution.d.ts +5 -2
- package/build/src/verification/execution.js +48 -53
- package/build/src/verification/observation.d.ts +10 -6
- package/build/src/verification/observation.js +5 -2
- package/package.json +3 -3
- package/plugins/paseo/plugin/index.server.ts +3 -0
- package/plugins/paseo/plugin/server/attach.ts +42 -0
- package/plugins/paseo/plugin/server/mirror-identity.ts +51 -0
- package/plugins/paseo/plugin/server/model.ts +26 -0
- package/plugins/paseo/plugin/server/provider.ts +4 -6
- package/plugins/paseo/plugin/server/reopen.ts +4 -39
- package/plugins/pi/README.md +7 -12
- package/plugins/pi/akuma-tools.ts +3 -18
- package/skills/keiyaku/SKILL.md +14 -26
- package/skills/keiyaku-akuma/SKILL.md +64 -44
- package/skills/keiyaku-akuma/references/automation.md +13 -25
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +42 -29
- package/skills/keiyaku-debt/SKILL.md +13 -8
- package/skills/keiyaku-workflow/SKILL.md +57 -61
- package/build/src/akuma/allowed.d.ts +0 -23
- package/build/src/akuma/allowed.js +0 -63
- package/build/src/akuma/call-request.d.ts +0 -308
- package/build/src/akuma/call-request.js +0 -175
- package/build/src/akuma/heart/request-authority.d.ts +0 -16
- package/build/src/akuma/heart/request-authority.js +0 -140
- package/build/src/akuma/heart/request-rows.d.ts +0 -18
- package/build/src/akuma/heart/request-rows.js +0 -107
- package/build/src/akuma/request-lifecycle.d.ts +0 -42
- package/build/src/akuma/request-lifecycle.js +0 -197
- package/build/src/akuma/request-observation.d.ts +0 -45
- package/build/src/akuma/request-observation.js +0 -162
- package/build/src/akuma/request-rendezvous.d.ts +0 -32
- package/build/src/akuma/request-rendezvous.js +0 -189
- package/build/src/akuma/request-serve.d.ts +0 -16
- package/build/src/akuma/request-serve.js +0 -188
- package/build/src/akuma/request-wire.d.ts +0 -143
- package/build/src/akuma/request-wire.js +0 -146
- package/build/src/akuma/requests.d.ts +0 -20
- package/build/src/akuma/requests.js +0 -72
- package/build/src/akuma/selection-owner-port.d.ts +0 -14
- package/build/src/akuma/selection-owner-port.js +0 -54
- package/build/src/akuma/selection-request.d.ts +0 -305
- package/build/src/akuma/selection-request.js +0 -307
- package/build/src/body-requests.d.ts +0 -13
- package/build/src/body-requests.js +0 -131
- package/build/src/cli/square-identity.d.ts +0 -10
- package/build/src/cli/square-identity.js +0 -130
- package/build/src/debt/mutation-result.d.ts +0 -981
- package/build/src/debt/mutation-result.js +0 -109
- package/build/src/debt/mutation.d.ts +0 -424
- package/build/src/debt/mutation.js +0 -223
- package/build/src/library/contract-operations.d.ts +0 -382
- package/build/src/library/contract-operations.js +0 -300
|
@@ -2,21 +2,20 @@ import { akumaCallerFromEnvironment } from "../akuma-caller.js";
|
|
|
2
2
|
import { CliUsageError, isBlankInput } from "../usage.js";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
-
import {
|
|
6
|
-
import { emitPluginSignal } from "../../plugin/akuma-signals.js";
|
|
5
|
+
import { deliveryOwner } from "../delivery-identity.js";
|
|
7
6
|
import { canonicalBirthCwd } from "../../akuma/call-input.js";
|
|
8
7
|
import { Schema } from "../../akuma/index.js";
|
|
9
|
-
import { executionChannel } from "../../akuma/requests.js";
|
|
10
8
|
import { settings } from "../../settings.js";
|
|
11
|
-
import { AkumaWorldScopeError } from "../../index.js";
|
|
12
|
-
import {
|
|
9
|
+
import { Akumas, AkumaWorldScopeError, } from "../../index.js";
|
|
10
|
+
import { Keiyaku } from "../../index.js";
|
|
13
11
|
import { World } from "../../world.js";
|
|
14
12
|
import { contractFromInput } from "../selectors.js";
|
|
15
13
|
import { ActivityDriver } from "../activity.js";
|
|
16
14
|
import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout, } from "../streams.js";
|
|
17
15
|
import { callObservationStream } from "../render/akuma-activity.js";
|
|
16
|
+
import { contractWaitText } from "../render/contract-wait.js";
|
|
18
17
|
import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitText, } from "../render/akuma-activity.js";
|
|
19
|
-
import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome,
|
|
18
|
+
import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome, } from "../render/akuma.js";
|
|
20
19
|
export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
|
|
21
20
|
// ---------------------------------------------------------------------------
|
|
22
21
|
// Leaf dispatch: acquisition, one public SDK invocation, direct rendering
|
|
@@ -28,7 +27,7 @@ async function settingsAt(root, home) {
|
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
function akumas(input) {
|
|
31
|
-
return
|
|
30
|
+
return Akumas.of(input.path, { reportDiagnostic: writeStderr });
|
|
32
31
|
}
|
|
33
32
|
async function schemaFromFile(path) {
|
|
34
33
|
try {
|
|
@@ -50,34 +49,9 @@ async function promptBody(action, command, input) {
|
|
|
50
49
|
throw new CliUsageError(`${action} requires a nonblank prompt`);
|
|
51
50
|
return bytes;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*/
|
|
57
|
-
async function submittingInitiator(input) {
|
|
58
|
-
const declared = input.environment.KEIYAKU_INITIATOR?.trim();
|
|
59
|
-
if (declared !== undefined && declared !== "")
|
|
60
|
-
return declared;
|
|
61
|
-
try {
|
|
62
|
-
return await squareSeat({ path: input.path, environment: input.environment }, { ...(input.signal === undefined ? {} : { signal: input.signal }) });
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async function inputInitiator(input) {
|
|
69
|
-
const initiator = await submittingInitiator(input);
|
|
70
|
-
if (initiator === undefined)
|
|
71
|
-
return {};
|
|
72
|
-
// Identity preparation needs established plugin custody, not just a candidate.
|
|
73
|
-
if (!(await World.established(input.path)))
|
|
74
|
-
return { initiator };
|
|
75
|
-
await emitPluginSignal({
|
|
76
|
-
world: input.path,
|
|
77
|
-
...(input.settings === undefined ? {} : { settings: input.settings }),
|
|
78
|
-
reportDiagnostic: (message) => writeStderr(message),
|
|
79
|
-
}, { kind: "akuma.initiating", initiator });
|
|
80
|
-
return { initiator };
|
|
52
|
+
function inputInitiator(input) {
|
|
53
|
+
const initiator = deliveryOwner(input.environment);
|
|
54
|
+
return initiator === undefined ? {} : { initiator };
|
|
81
55
|
}
|
|
82
56
|
function emitAnswer(body, exact) {
|
|
83
57
|
if (exact)
|
|
@@ -89,10 +63,7 @@ function emitAnswer(body, exact) {
|
|
|
89
63
|
async function runCall(command, input) {
|
|
90
64
|
const body = command.prompt === undefined ? undefined : await promptBody("call", { prompt: command.prompt }, input);
|
|
91
65
|
const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
|
|
92
|
-
const declaredCaller =
|
|
93
|
-
? undefined
|
|
94
|
-
: await akumaCallerFromEnvironment(input.environment);
|
|
95
|
-
// Establish the selected World before preparing the submitting Square route.
|
|
66
|
+
const declaredCaller = await akumaCallerFromEnvironment(input.environment);
|
|
96
67
|
await World.at(input.path);
|
|
97
68
|
const caller = akumas(input);
|
|
98
69
|
const request = {
|
|
@@ -105,7 +76,6 @@ async function runCall(command, input) {
|
|
|
105
76
|
...(input.executionCwd === undefined ? {} : { cwd: input.executionCwd }),
|
|
106
77
|
...(input.contract === undefined ? {} : { contract: input.contract }),
|
|
107
78
|
...(command.alias === undefined ? {} : { alias: command.alias }),
|
|
108
|
-
...(command.allowed === undefined ? {} : { allowed: command.allowed }),
|
|
109
79
|
...(input.writableDirectories === undefined ? {} : { writableDirectories: input.writableDirectories }),
|
|
110
80
|
...(command.bare === undefined ? {} : { bare: command.bare }),
|
|
111
81
|
...(schema === undefined ? {} : { schema }),
|
|
@@ -192,10 +162,7 @@ async function runAsk(command, input) {
|
|
|
192
162
|
const body = await promptBody("ask", command, input);
|
|
193
163
|
const schema = command.schema === undefined ? undefined : await schemaFromFile(command.schema);
|
|
194
164
|
const alias = inputAlias(command.akuma);
|
|
195
|
-
const
|
|
196
|
-
const progress = command.output === "text" && channel.kind === "local"
|
|
197
|
-
? askProgressStream(undefined, alias, resultContext())
|
|
198
|
-
: undefined;
|
|
165
|
+
const progress = command.output === "text" ? askProgressStream(undefined, alias, resultContext()) : undefined;
|
|
199
166
|
const driver = new ActivityDriver(process.stderr);
|
|
200
167
|
try {
|
|
201
168
|
const result = await akumas(input).ask({
|
|
@@ -222,8 +189,6 @@ async function runAsk(command, input) {
|
|
|
222
189
|
});
|
|
223
190
|
if (progress !== undefined)
|
|
224
191
|
driver.conclude(progress.conclude(result).join("\n"));
|
|
225
|
-
else if (command.output === "text" && channel.kind === "body-request")
|
|
226
|
-
writeStderr(waitedTellProgress(result, alias, resultContext()));
|
|
227
192
|
if (command.output === "json")
|
|
228
193
|
writeJson(result);
|
|
229
194
|
else
|
|
@@ -309,13 +274,12 @@ async function akumaInput(command, coordinates, workdir, runtime) {
|
|
|
309
274
|
throw new TypeError("--add-dir requires a nonblank directory");
|
|
310
275
|
return canonicalBirthCwd(resolve(coordinates.cwd, path));
|
|
311
276
|
}));
|
|
312
|
-
const execution = runtime.execution;
|
|
313
277
|
const home = command.command === "call" ? runtime.home : undefined;
|
|
314
278
|
const configuration = command.command === "call" ? await settingsAt(path, home) : undefined;
|
|
315
279
|
if (command.command === "call" && command.contract !== undefined && coordinates.repo === undefined)
|
|
316
280
|
throw new Error("call with Contract requires a resolved Repo");
|
|
317
281
|
const contract = command.command === "call" && command.contract !== undefined
|
|
318
|
-
? contractFromInput(coordinates.repo, command.contract
|
|
282
|
+
? contractFromInput(coordinates.repo, command.contract).contract
|
|
319
283
|
: undefined;
|
|
320
284
|
return {
|
|
321
285
|
path,
|
|
@@ -327,12 +291,30 @@ async function akumaInput(command, coordinates, workdir, runtime) {
|
|
|
327
291
|
...(coordinates.repo === undefined ? {} : { repo: coordinates.repo }),
|
|
328
292
|
environment: runtime.environment,
|
|
329
293
|
readStdin: runtime.readStdin,
|
|
330
|
-
execution,
|
|
331
294
|
...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
|
|
332
295
|
};
|
|
333
296
|
}
|
|
334
297
|
export async function runAkumaCommand(command, coordinates, workdir, runtime) {
|
|
335
298
|
try {
|
|
299
|
+
if (command.command === "wait") {
|
|
300
|
+
const contracts = command.akuma.filter((selector) => selector.startsWith("kei/"));
|
|
301
|
+
if (contracts.length > 0) {
|
|
302
|
+
if (coordinates.repo === undefined)
|
|
303
|
+
throw new CliUsageError("Contract wait requires a repository");
|
|
304
|
+
const result = await Keiyaku.with().wait({
|
|
305
|
+
repo: coordinates.repo,
|
|
306
|
+
contracts,
|
|
307
|
+
...(command.completion === undefined ? {} : { completion: command.completion }),
|
|
308
|
+
...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
|
|
309
|
+
...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
|
|
310
|
+
});
|
|
311
|
+
if (command.output === "json")
|
|
312
|
+
writeJson(result);
|
|
313
|
+
else
|
|
314
|
+
writeStdout(contractWaitText(result));
|
|
315
|
+
return result.kind === "missing" ? "refused" : "accepted";
|
|
316
|
+
}
|
|
317
|
+
}
|
|
336
318
|
const input = await akumaInput(command, coordinates, workdir, runtime);
|
|
337
319
|
switch (command.command) {
|
|
338
320
|
case "call":
|
|
@@ -59,6 +59,12 @@ export type ParsedDeliver = Output & Readonly<{
|
|
|
59
59
|
materializeConflict: boolean;
|
|
60
60
|
overwrite: boolean;
|
|
61
61
|
}>;
|
|
62
|
+
export type ParsedVerify = Output & Readonly<{
|
|
63
|
+
command: "verify";
|
|
64
|
+
contract?: string;
|
|
65
|
+
index?: number;
|
|
66
|
+
includeDirty: boolean;
|
|
67
|
+
}>;
|
|
62
68
|
export type ParsedReview = Output & Actor & Readonly<{
|
|
63
69
|
command: "review";
|
|
64
70
|
contract?: string;
|
|
@@ -129,7 +135,7 @@ export type ParsedContractParts = Readonly<{
|
|
|
129
135
|
output: "text" | "json";
|
|
130
136
|
actor?: string;
|
|
131
137
|
}>;
|
|
132
|
-
export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
|
|
138
|
+
export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedVerify | ParsedReview | ParsedArc | ParsedAbandon | ParsedShow | ParsedStatus | ParsedLs | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
|
|
133
139
|
export type StatusCategory = "akuma" | "contract";
|
|
134
140
|
export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
|
|
135
141
|
export {};
|
|
@@ -129,6 +129,19 @@ function parseDeliver(parts) {
|
|
|
129
129
|
output: parts.output,
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
function parseVerify(parts) {
|
|
133
|
+
const contract = parts.positionals[0];
|
|
134
|
+
const index = optionalFlag(parts.flags, "index");
|
|
135
|
+
if (index !== undefined && (!/^[1-9][0-9]*$/u.test(index) || !Number.isSafeInteger(Number(index))))
|
|
136
|
+
refuse("verify", "--index requires a positive safe integer");
|
|
137
|
+
return {
|
|
138
|
+
command: "verify",
|
|
139
|
+
...(contract === undefined ? {} : { contract }),
|
|
140
|
+
...(index === undefined ? {} : { index: Number(index) }),
|
|
141
|
+
includeDirty: parts.flags["include-dirty"] === true,
|
|
142
|
+
output: parts.output,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
132
145
|
function parseReview(parts) {
|
|
133
146
|
if (Number(parts.flags.satisfied === true) + Number(parts.flags.unsatisfied === true) !== 1) {
|
|
134
147
|
refuse("review", "review requires exactly one verdict flag");
|
|
@@ -318,6 +331,8 @@ export function parseContractCommand(parts) {
|
|
|
318
331
|
return parseAmend(parts);
|
|
319
332
|
case "deliver":
|
|
320
333
|
return parseDeliver(parts);
|
|
334
|
+
case "verify":
|
|
335
|
+
return parseVerify(parts);
|
|
321
336
|
case "review":
|
|
322
337
|
return parseReview(parts);
|
|
323
338
|
case "arc": {
|
|
@@ -21,7 +21,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
21
21
|
readonly "fork-of": "value";
|
|
22
22
|
readonly json: "boolean";
|
|
23
23
|
};
|
|
24
|
-
readonly usage: "bind [--debt <debt/...>] [--target <
|
|
24
|
+
readonly usage: "bind [--debt <debt/...>] [--target <branch|kei/...> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <branch|kei/...> | --no-target] [--actor <actor>] [--repo <path>]";
|
|
25
25
|
readonly purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.";
|
|
26
26
|
readonly details: string;
|
|
27
27
|
};
|
|
@@ -55,6 +55,18 @@ export declare const CONTRACT_COMMAND_SPECS: {
|
|
|
55
55
|
readonly purpose: "Submit work for a Contract and integrate it when its requirements are met.";
|
|
56
56
|
readonly details: string;
|
|
57
57
|
};
|
|
58
|
+
readonly verify: {
|
|
59
|
+
readonly positional: "optional";
|
|
60
|
+
readonly stdin: "none";
|
|
61
|
+
readonly flags: {
|
|
62
|
+
readonly index: "value";
|
|
63
|
+
readonly "include-dirty": "boolean";
|
|
64
|
+
readonly json: "boolean";
|
|
65
|
+
};
|
|
66
|
+
readonly usage: "verify [<contract>|@<contract>] [--index <n>] [--include-dirty] [--repo <path>]";
|
|
67
|
+
readonly purpose: "Execute independent Verification checks and record their evidence.";
|
|
68
|
+
readonly details: string;
|
|
69
|
+
};
|
|
58
70
|
readonly review: {
|
|
59
71
|
readonly positional: "optional";
|
|
60
72
|
readonly stdin: "optional";
|
|
@@ -13,17 +13,19 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
13
13
|
"fork-of": "value",
|
|
14
14
|
json: "boolean",
|
|
15
15
|
},
|
|
16
|
-
usage: "bind [--debt <debt/...>] [--target <
|
|
16
|
+
usage: "bind [--debt <debt/...>] [--target <branch|kei/...> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <branch|kei/...> | --no-target] [--actor <actor>] [--repo <path>]",
|
|
17
17
|
purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.",
|
|
18
18
|
details: [
|
|
19
|
-
"--target names
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
19
|
+
"--target names an existing local branch or a complete active kei/... identity.",
|
|
20
|
+
"A Contract target lands into its appointed detached worktree, not its branch;",
|
|
21
|
+
"only its committed HEAD is used as the child's start. To name a branch beginning",
|
|
22
|
+
"kei/, use refs/heads/kei/.... Omitting --target selects the invocation worktree's",
|
|
23
|
+
"current branch, or no target on detached committed HEAD. --no-target explicitly",
|
|
24
|
+
"selects no target and cannot be combined with --target. A fork inherits its",
|
|
25
|
+
"source's exact target when neither flag is given, including its worktree identity.",
|
|
24
26
|
"",
|
|
25
27
|
"Gates are acceptance obligations checked at placement: reviewed awaits a",
|
|
26
|
-
"satisfied review, verified awaits
|
|
28
|
+
"satisfied review, verified awaits satisfied evidence for every Verification declaration.",
|
|
27
29
|
"",
|
|
28
30
|
"--gates <name,...> selects reviewed, verified, or named gate groups from Settings",
|
|
29
31
|
"(keiyaku settings). A group expands into its gates; unknown names are rejected",
|
|
@@ -41,20 +43,18 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
41
43
|
" # <title>",
|
|
42
44
|
" ## Context motivation, authority, baseline, and boundaries",
|
|
43
45
|
" ## Objective one observable end state",
|
|
44
|
-
" ## Design
|
|
45
|
-
" leave implementation details to the person doing the work",
|
|
46
|
+
" ## Design settled design: decisions the implementation must follow",
|
|
46
47
|
" ## Region narrowest justified intended writes for this approach, one pattern per line",
|
|
47
48
|
" ## Criteria one or more ### <criterion> entries",
|
|
48
49
|
" ## Verification optional fenced executor declarations",
|
|
49
50
|
"",
|
|
50
|
-
"Region
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"info string or exactly 'txt'.",
|
|
51
|
+
"Region lists the narrowest writes this approach needs, not every file involved;",
|
|
52
|
+
"avoid broad directories and redundant parent/child patterns. Put one repository-relative",
|
|
53
|
+
"pattern per nonblank line: bare lines, list items, or fences (no info string, or",
|
|
54
|
+
"txt) are combined. A trailing '/' means 'path/**'. Whitespace in a pattern",
|
|
55
|
+
"binds with a warning.",
|
|
56
56
|
"",
|
|
57
|
-
"
|
|
57
|
+
"Only verify runs Verification; without the verified gate the section is inert text.",
|
|
58
58
|
"Verification uses one or more closed bash, zsh, or pwsh fences. Its fence",
|
|
59
59
|
"may add timeout=<integer><ms|s|m|h>; the section contains no other prose.",
|
|
60
60
|
"Unknown ## sections are retained as extensions; reserved section names are refused.",
|
|
@@ -67,17 +67,13 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
67
67
|
usage: "amend [<contract>|@<contract>] [--after <kei/...> [--after <kei/...>]... | --clear-after] [--gates <name,...>] [--actor <actor>] [--repo <path>] [-]",
|
|
68
68
|
purpose: "Change a Contract's document, prerequisites, or acceptance gates.",
|
|
69
69
|
details: [
|
|
70
|
-
"Gates are
|
|
71
|
-
"satisfied
|
|
72
|
-
"",
|
|
73
|
-
|
|
74
|
-
"from Settings (keiyaku settings). A group expands into its gates; unknown names",
|
|
75
|
-
"are rejected with the known names listed. Custom gates must be declared in a",
|
|
76
|
-
"configured group. Duplicates are removed in first-seen order.",
|
|
77
|
-
"Names match ^[a-z][a-z0-9-]{0,63}$.",
|
|
78
|
-
'Omitting --gates leaves gates unchanged; --gates "" clears them.',
|
|
70
|
+
"Gates are checked at integration: reviewed needs a satisfied review;",
|
|
71
|
+
"verified needs satisfied evidence for every declaration. --gates <name,...> replaces them with",
|
|
72
|
+
"reviewed, verified, or configured groups (see keiyaku settings).",
|
|
73
|
+
'Omitting --gates keeps them; --gates "" clears them.',
|
|
79
74
|
"",
|
|
80
|
-
"
|
|
75
|
+
"stdin is an amendment; each heading is one edit:",
|
|
76
|
+
" ## Context|Objective|Design|Region|Criteria|Verification|<extension> (replace, or add a new extension)",
|
|
81
77
|
" ## Replace: Context|Objective|Design|Region|Criteria|Verification|<extension>",
|
|
82
78
|
" ## Append: Context|Objective|Design|Criteria|<extension>",
|
|
83
79
|
" ## Add: Criteria|<new-extension-title>",
|
|
@@ -100,22 +96,61 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
100
96
|
usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--materialize-conflict] [--overwrite] [--repo <path>]\ndeliver [<contract>|@<contract>] --dry-run [--include-dirty] [--show-diff] [--repo <path>]",
|
|
101
97
|
purpose: "Submit work for a Contract and integrate it when its requirements are met.",
|
|
102
98
|
details: [
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"Content identity
|
|
99
|
+
"Delivery is judged against the whole Contract, not the current Arc. It uses",
|
|
100
|
+
"HEAD and consumes standing gate evidence. If prerequisites and every gate",
|
|
101
|
+
"requirement pass, it integrates and accepts now; otherwise the candidate waits.",
|
|
102
|
+
"Delivery never runs Verification or counts as a review.",
|
|
103
|
+
"",
|
|
104
|
+
"Repeating delivery with unchanged work resumes unfinished integration.",
|
|
105
|
+
"Changed work replaces the candidate and invalidates earlier review.",
|
|
106
|
+
"Identical content keeps review across rebase or target movement.",
|
|
107
|
+
"",
|
|
108
|
+
"Progress goes to stderr; stdout carries one final result. Ctrl-C requests a",
|
|
109
|
+
"stop and waits for the final receipt; it does not roll back admitted work.",
|
|
110
|
+
"Content identity is a content hash, not a commit: it survives rebase, and Git",
|
|
111
|
+
"cannot look it up.",
|
|
112
|
+
"",
|
|
113
|
+
" --include-dirty Include all non-ignored changes, staged or not;",
|
|
114
|
+
" capturing them leaves your branch and index unchanged.",
|
|
115
|
+
" --message Set the delivery commit's subject.",
|
|
116
|
+
" --dry-run Preview candidate, conflicts, standing evidence and",
|
|
117
|
+
" target followability. No Verification, hooks or",
|
|
118
|
+
" integration; refs, index and worktrees stay untouched.",
|
|
119
|
+
" Real delivery checks again; preview promises no acceptance.",
|
|
120
|
+
" --show-diff Include the proposed diff; requires --dry-run.",
|
|
121
|
+
" --materialize-conflict Write the observed conflict as an uncommitted merge.",
|
|
122
|
+
" With --include-dirty, preserve current changes first.",
|
|
123
|
+
" --overwrite Bypass reuse of a pending candidate.",
|
|
115
124
|
"",
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
"--message, --materialize-conflict and --overwrite are refused with --dry-run.",
|
|
126
|
+
].join("\n"),
|
|
127
|
+
},
|
|
128
|
+
verify: {
|
|
129
|
+
positional: "optional",
|
|
130
|
+
stdin: "none",
|
|
131
|
+
flags: { index: "value", "include-dirty": "boolean", json: "boolean" },
|
|
132
|
+
usage: "verify [<contract>|@<contract>] [--index <n>] [--include-dirty] [--repo <path>]",
|
|
133
|
+
purpose: "Execute independent Verification checks and record their evidence.",
|
|
134
|
+
details: [
|
|
135
|
+
"Requires an active Contract with the verified gate and Verification declarations.",
|
|
136
|
+
"Omitted selection uses the exact appointed worktree's Contract context.",
|
|
137
|
+
"--index selects one declaration by its current one-based position; it must be",
|
|
138
|
+
"a positive safe integer written with digits only, with no leading zero.",
|
|
139
|
+
"Omitting --index runs all declarations. An out-of-range index refuses before execution.",
|
|
140
|
+
"",
|
|
141
|
+
"Each selected declaration always executes in its own clean scratch, including",
|
|
142
|
+
"when satisfied evidence already exists. Setup and cleanup run independently;",
|
|
143
|
+
"checks cannot share scratch files. Normal failure or timeout records an",
|
|
144
|
+
"unsatisfied verdict and allows remaining checks to run. Operational stops",
|
|
145
|
+
"and cancellation retain earlier admitted evidence without inventing a verdict.",
|
|
146
|
+
"",
|
|
147
|
+
"--include-dirty captures all non-ignored worktree changes without changing",
|
|
148
|
+
"the real index or branch. Checks cover the exact prospective integration.",
|
|
149
|
+
"Verify admits no delivery. After execution it requests ordinary completion;",
|
|
150
|
+
"only an already-delivered candidate with all requirements met can integrate.",
|
|
151
|
+
"The receipt names each check's execution, verdict, admission or reuse, and stop.",
|
|
152
|
+
"Progress goes to stderr; stdout carries one final result. Ctrl-C requests",
|
|
153
|
+
"a stop and waits for the final receipt, preserving admitted evidence.",
|
|
119
154
|
].join("\n"),
|
|
120
155
|
},
|
|
121
156
|
review: {
|
|
@@ -128,6 +163,7 @@ export const CONTRACT_COMMAND_SPECS = {
|
|
|
128
163
|
"A review checks the whole Contract, not just one Arc. After delivery it checks the candidate; before delivery it checks the current Contract and worktree, but cannot integrate.",
|
|
129
164
|
"--satisfied means every acceptance criterion is met. It records the verdict and requests integration; if the candidate, prerequisites, and gates are ready, this invocation integrates and accepts the Contract. Otherwise the Contract stays active.",
|
|
130
165
|
"--unsatisfied records what is missing and does not request integration.",
|
|
166
|
+
"Review consumes standing gate evidence and never executes Verification.",
|
|
131
167
|
"--summary gives the conclusion and evidence for --satisfied, or the specific blocker for --unsatisfied.",
|
|
132
168
|
"Progress appears on stderr; stdout contains one final result.",
|
|
133
169
|
].join("\n"),
|
|
@@ -230,55 +266,26 @@ export function renderContractHelp(command) {
|
|
|
230
266
|
const spec = CONTRACT_COMMAND_SPECS[command];
|
|
231
267
|
if (command === "settings") {
|
|
232
268
|
return [
|
|
233
|
-
"Show effective Settings
|
|
269
|
+
"Show effective Settings (read-only), merged from:",
|
|
234
270
|
" user ~/.keiyaku/settings.json",
|
|
235
271
|
" project <WorldRoot>/.keiyaku/settings.json",
|
|
236
|
-
"A project record wholly shadows the same-name user record.",
|
|
272
|
+
"A project record wholly shadows the same-name user record. Edit the files",
|
|
273
|
+
"directly; there is no write command.",
|
|
237
274
|
"",
|
|
238
|
-
|
|
239
|
-
"command; edit the files directly.",
|
|
275
|
+
usageLine(spec.usage),
|
|
240
276
|
"",
|
|
241
277
|
"Recognized settings:",
|
|
242
|
-
" gates named gate groups
|
|
243
|
-
" worktree commands run when worktrees are created or destroyed",
|
|
244
|
-
" git.requireBranchesToBeUpToDate whether delivery and
|
|
245
|
-
" providers
|
|
246
|
-
"",
|
|
247
|
-
"Each entry is validated by the feature that reads it. A rejected",
|
|
248
|
-
"value's diagnostic states the expected shape.",
|
|
278
|
+
" gates named gate groups for bind/amend --gates",
|
|
279
|
+
" worktree commands run when Contract worktrees are created or destroyed",
|
|
280
|
+
" git.requireBranchesToBeUpToDate whether delivery and preview require an up-to-date target",
|
|
281
|
+
" providers Akuma providers and how each is run",
|
|
249
282
|
"",
|
|
250
283
|
"Akuma definitions are Markdown files, one per name:",
|
|
251
284
|
" user ~/.keiyaku/akumas/<name>.md",
|
|
252
285
|
" project <WorldRoot>/.keiyaku/akumas/<name>.md",
|
|
253
|
-
"
|
|
254
|
-
"
|
|
255
|
-
"
|
|
256
|
-
"an optional system prompt.",
|
|
257
|
-
"",
|
|
258
|
-
"Local Paseo provider in settings.json:",
|
|
259
|
-
' { "providers": { "paseo": {',
|
|
260
|
-
' "kind": "paseo",',
|
|
261
|
-
' "config": { "url": "ws://127.0.0.1:6767/ws", "provider": "claude" }',
|
|
262
|
-
" } } }",
|
|
263
|
-
"The native provider id is bare (claude, codex, pi), not provider/model.",
|
|
264
|
-
"Example .keiyaku/akumas/paseo-worker.md frontmatter:",
|
|
265
|
-
" ---",
|
|
266
|
-
" provider: paseo",
|
|
267
|
-
" model: <native-model-id>",
|
|
268
|
-
" effort: high",
|
|
269
|
-
" ---",
|
|
270
|
-
"Model and effort must be offered by the selected native provider;",
|
|
271
|
-
"effort names its native thinking option id.",
|
|
272
|
-
'PASEO_PASSWORD=<password> keiyaku call paseo-worker "<prompt>"',
|
|
273
|
-
"Paseo must already be running locally. Resume keeps its live native",
|
|
274
|
-
"runtime; after Paseo native reload/restart create a fresh Akuma.",
|
|
275
|
-
"Observed busy agents refuse; native steer still has a check/send race.",
|
|
276
|
-
"Explicit control cancels native current execution session-wide and may",
|
|
277
|
-
"affect concurrent human work. Normal completion only retires the client",
|
|
278
|
-
"and its sockets; it never cancels later work or closes the native runtime.",
|
|
279
|
-
"Socket closure does not prove native cancellation succeeded.",
|
|
280
|
-
"",
|
|
281
|
-
usageLine(spec.usage),
|
|
286
|
+
"Project wins. Frontmatter: provider, base, model, effort, network,",
|
|
287
|
+
"systemPromptMode, description. The body is an optional system prompt.",
|
|
288
|
+
"Provider setup: see README Configuration.",
|
|
282
289
|
].join("\n");
|
|
283
290
|
}
|
|
284
291
|
const help = `${spec.purpose}\n\n${usageLine(spec.usage)}`;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { executionChannel } from "../../akuma/requests.js";
|
|
2
1
|
import { Akumas, Keiyaku, KeiyakuError, kanshiCategory, listArchetypeDefinitions, nuke } from "../../index.js";
|
|
3
2
|
import { kanshi, selectRegion } from "../../kanshi/index.js";
|
|
4
3
|
import { observeNamedAddress, resolveNamedAddress } from "../../library/address.js";
|
|
5
|
-
import {
|
|
4
|
+
import { observeKeiyaku } from "../../library/contract-composition.js";
|
|
6
5
|
import { validateArcMarkdown, validateContractMarkdown } from "../../library/input.js";
|
|
7
|
-
import { createKeiyakuHandle } from "../../library/keiyaku.js";
|
|
8
6
|
import { SettingsError, settings } from "../../settings.js";
|
|
9
7
|
import { akumaCallerFromEnvironment } from "../akuma-caller.js";
|
|
10
8
|
import { Debts } from "../../debt/index.js";
|
|
@@ -35,17 +33,6 @@ async function settingsAt(root, home) {
|
|
|
35
33
|
...(home === undefined ? {} : { home }),
|
|
36
34
|
});
|
|
37
35
|
}
|
|
38
|
-
/**
|
|
39
|
-
* The process edge loads one Settings value and hands it to the private composition.
|
|
40
|
-
* A forwarded preview/deliver/review is served by its parent, which loads its own.
|
|
41
|
-
*/
|
|
42
|
-
async function contractSettings(command, execution, world, home) {
|
|
43
|
-
const forwarded = executionChannel(execution).kind === "body-request" &&
|
|
44
|
-
(command.command === "deliver" || command.command === "review");
|
|
45
|
-
if (forwarded)
|
|
46
|
-
return undefined;
|
|
47
|
-
return await settingsAt(world ?? undefined, home);
|
|
48
|
-
}
|
|
49
36
|
function draftWarning(error) {
|
|
50
37
|
return { warning: `bind draft could not be preserved: ${error instanceof Error ? error.message : String(error)}` };
|
|
51
38
|
}
|
|
@@ -201,6 +188,22 @@ async function runDeliver(command, runtime, seat) {
|
|
|
201
188
|
}
|
|
202
189
|
return await finishContractAnswer(answer, command.output, deliverRefusalProjection);
|
|
203
190
|
}
|
|
191
|
+
async function runVerify(command, runtime, seat) {
|
|
192
|
+
const driver = command.output === "text" ? await runtime.progress() : undefined;
|
|
193
|
+
let answer;
|
|
194
|
+
try {
|
|
195
|
+
answer = await seat.contract.verify({
|
|
196
|
+
...(command.index === undefined ? {} : { index: command.index }),
|
|
197
|
+
includeDirty: command.includeDirty,
|
|
198
|
+
...(runtime.signal === undefined ? {} : { signal: runtime.signal }),
|
|
199
|
+
}, { ...(driver === undefined ? {} : { observe: driver.observe }) });
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
if (driver !== undefined)
|
|
203
|
+
await driver.finish().catch(() => undefined);
|
|
204
|
+
}
|
|
205
|
+
return await finishContractAnswer(answer, command.output, deliverRefusalProjection);
|
|
206
|
+
}
|
|
204
207
|
async function runReview(command, runtime, seat) {
|
|
205
208
|
const summary = command.summaryFromStdin === true ? await runtime.readStdin() : command.summary;
|
|
206
209
|
if (command.summaryFromStdin === true && isBlankInput(summary ?? ""))
|
|
@@ -247,11 +250,11 @@ async function runAbandon(command, seat) {
|
|
|
247
250
|
return await finishContractAnswer(answer, command.output);
|
|
248
251
|
}
|
|
249
252
|
async function runContractMutation(command, input) {
|
|
250
|
-
const {
|
|
251
|
-
const actor =
|
|
253
|
+
const { configuration, runtime } = input;
|
|
254
|
+
const actor = ["deliver", "verify", "review"].includes(command.command)
|
|
252
255
|
? actorFromEdge(undefined, runtime.environment)
|
|
253
256
|
: undefined;
|
|
254
|
-
const library =
|
|
257
|
+
const library = Keiyaku.with({
|
|
255
258
|
...(configuration === undefined ? {} : { settings: configuration }),
|
|
256
259
|
...(actor === undefined ? {} : { actor }),
|
|
257
260
|
});
|
|
@@ -263,6 +266,8 @@ async function runContractMutation(command, input) {
|
|
|
263
266
|
return await runAmend(command, input, seat);
|
|
264
267
|
case "deliver":
|
|
265
268
|
return await runDeliver(command, input.runtime, seat);
|
|
269
|
+
case "verify":
|
|
270
|
+
return await runVerify(command, input.runtime, seat);
|
|
266
271
|
case "review":
|
|
267
272
|
return await runReview(command, input.runtime, seat);
|
|
268
273
|
case "arc":
|
|
@@ -501,12 +506,10 @@ export async function runContractHistoryCommand(command, coordinates) {
|
|
|
501
506
|
}
|
|
502
507
|
return emit(command.output, history, () => renderContractHistory(history, { full: command.full }), "accepted");
|
|
503
508
|
}
|
|
504
|
-
async function runReconcile(command, coordinates,
|
|
509
|
+
async function runReconcile(command, coordinates, home) {
|
|
505
510
|
const repo = requiredRepo(coordinates);
|
|
506
|
-
const configuration = await
|
|
507
|
-
const library =
|
|
508
|
-
...(configuration === undefined ? {} : { settings: configuration }),
|
|
509
|
-
});
|
|
511
|
+
const configuration = await settingsAt(coordinates.world ?? undefined, home);
|
|
512
|
+
const library = Keiyaku.with({ settings: configuration });
|
|
510
513
|
let report;
|
|
511
514
|
if (command.contract === undefined) {
|
|
512
515
|
report = await library.reconcile({ repo, retryHooks: command.retryHooks });
|
|
@@ -530,7 +533,6 @@ async function runReconcile(command, coordinates, execution, home) {
|
|
|
530
533
|
return reconcileHasFailure(report) ? "failed" : "accepted";
|
|
531
534
|
}
|
|
532
535
|
export async function runContractCommand(command, coordinates, runtime) {
|
|
533
|
-
const execution = runtime.execution;
|
|
534
536
|
const home = runtime.home;
|
|
535
537
|
switch (command.command) {
|
|
536
538
|
case "settings":
|
|
@@ -546,13 +548,12 @@ export async function runContractCommand(command, coordinates, runtime) {
|
|
|
546
548
|
case "region":
|
|
547
549
|
return await runRegion(command, coordinates);
|
|
548
550
|
case "reconcile":
|
|
549
|
-
return await runReconcile(command, coordinates,
|
|
551
|
+
return await runReconcile(command, coordinates, home);
|
|
550
552
|
default: {
|
|
551
|
-
const configuration = await
|
|
553
|
+
const configuration = await settingsAt(coordinates.world ?? undefined, home);
|
|
552
554
|
return await runContractMutation(command, {
|
|
553
555
|
coordinates,
|
|
554
556
|
runtime,
|
|
555
|
-
execution,
|
|
556
557
|
...(configuration === undefined ? {} : { configuration }),
|
|
557
558
|
});
|
|
558
559
|
}
|