@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
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { EMPTY_CREATED_DEBT_OBSERVATION, createdDebtObservationSchema } from "../debt/created-observation.js";
|
|
3
|
-
import { akumaStatusSchema } from "./akuma.js";
|
|
4
|
-
import { tellResultSchema } from "./call-initial-tell.js";
|
|
5
|
-
import { NO_DISPATCH_ASSOCIATION, dispatchAssociationSchema } from "./dispatch-association.js";
|
|
6
|
-
import { akumaIdSchema } from "./identity.js";
|
|
7
|
-
const killEvidenceSchema = z.enum([
|
|
8
|
-
"killed",
|
|
9
|
-
"already-killed",
|
|
10
|
-
"already-stopped",
|
|
11
|
-
"hung",
|
|
12
|
-
"untidy",
|
|
13
|
-
"unavailable",
|
|
14
|
-
]);
|
|
15
|
-
const akumaObservationSchema = z
|
|
16
|
-
.object({
|
|
17
|
-
status: akumaStatusSchema,
|
|
18
|
-
contract: dispatchAssociationSchema,
|
|
19
|
-
createdDebts: createdDebtObservationSchema,
|
|
20
|
-
})
|
|
21
|
-
.strict();
|
|
22
|
-
const akumaUnobservedSchema = z.object({ id: akumaIdSchema, diagnostic: z.string() }).strict();
|
|
23
|
-
const akumaKillResultItemSchema = z.object({ id: akumaIdSchema, evidence: killEvidenceSchema }).strict();
|
|
24
|
-
const akumaWaitResultSchema = z
|
|
25
|
-
.object({
|
|
26
|
-
mode: z.enum(["any", "all"]),
|
|
27
|
-
reason: z.enum(["completed", "deadline"]),
|
|
28
|
-
observations: z.array(akumaObservationSchema).readonly(),
|
|
29
|
-
unobserved: z.array(akumaUnobservedSchema).readonly(),
|
|
30
|
-
})
|
|
31
|
-
.strict();
|
|
32
|
-
const akumaKillResultSchema = z.object({ results: z.array(akumaKillResultItemSchema).readonly() }).strict();
|
|
33
|
-
const akumaTellResultSchema = z.object({ akuma: akumaIdSchema, tell: tellResultSchema }).strict();
|
|
34
|
-
const askObservationSchema = z.union([
|
|
35
|
-
z.object({ reason: z.literal("answered"), answer: z.unknown() }).strict(),
|
|
36
|
-
z.object({ reason: z.literal("failed"), diagnostic: z.string() }).strict(),
|
|
37
|
-
z.object({ reason: z.literal("invalid-output"), diagnostic: z.string(), answer: z.string() }).strict(),
|
|
38
|
-
z.object({ reason: z.literal("unanswered") }).strict(),
|
|
39
|
-
z.object({ reason: z.literal("deadline") }).strict(),
|
|
40
|
-
]);
|
|
41
|
-
const akumaAskResultSchema = z
|
|
42
|
-
.object({
|
|
43
|
-
akuma: akumaIdSchema,
|
|
44
|
-
tell: tellResultSchema,
|
|
45
|
-
observation: askObservationSchema,
|
|
46
|
-
completedAt: z.string().datetime({ offset: true }).nullable().optional(),
|
|
47
|
-
})
|
|
48
|
-
.strict();
|
|
49
|
-
/** Compose one native status into the canonical observation its crossing transports. */
|
|
50
|
-
export function akumaObservationOf(status) {
|
|
51
|
-
return { status, contract: NO_DISPATCH_ASSOCIATION, createdDebts: EMPTY_CREATED_DEBT_OBSERVATION };
|
|
52
|
-
}
|
|
53
|
-
export const selectionResultSchemas = {
|
|
54
|
-
wait: akumaWaitResultSchema,
|
|
55
|
-
tell: akumaTellResultSchema,
|
|
56
|
-
ask: akumaAskResultSchema,
|
|
57
|
-
kill: akumaKillResultSchema,
|
|
58
|
-
killEvidence: killEvidenceSchema,
|
|
59
|
-
};
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { type ResumeCoordinate, type Soul, type TellFact } from "./heart/index.js";
|
|
2
2
|
import type { AkumaPaths } from "./identity.js";
|
|
3
3
|
import { type ExecutionAssociationReader } from "./execution-instructions.js";
|
|
4
|
-
import type { CallInitialTellAdmission } from "./call-initial-tell.js";
|
|
5
|
-
import type { InitialTellAdmissionRequest } from "./call-request.js";
|
|
6
4
|
import { type ProviderAdapter, type TurnResult } from "./provider.js";
|
|
7
|
-
import { type AkumaCallRequestChildLaunch } from "./call-request.js";
|
|
8
|
-
import { type ErasedRequestCommand } from "./request-wire.js";
|
|
9
5
|
import { BodySupervisor } from "./body-supervisor.js";
|
|
10
|
-
import type { LiveBodyLaunch } from "./body-launch.js";
|
|
11
6
|
export declare function turnRecipe(paths: AkumaPaths, soul: Soul): Promise<Readonly<{
|
|
12
7
|
cwd: string;
|
|
13
8
|
options: Soul["options"];
|
|
@@ -31,10 +26,7 @@ export type DriveTurnInput = Readonly<{
|
|
|
31
26
|
initiator?: string;
|
|
32
27
|
schemaJson?: string;
|
|
33
28
|
supervisor: BodySupervisor;
|
|
34
|
-
runtimeSpawn(launch: AkumaCallRequestChildLaunch): Promise<LiveBodyLaunch | void>;
|
|
35
|
-
admitInitialTell(input: InitialTellAdmissionRequest): Promise<CallInitialTellAdmission>;
|
|
36
29
|
world: import("../world.js").WorldRoot;
|
|
37
|
-
externalCommands: Readonly<Record<string, ErasedRequestCommand>>;
|
|
38
30
|
executionAssociation?: ExecutionAssociationReader;
|
|
39
31
|
turnStarted: Readonly<{
|
|
40
32
|
emit(turnSequence: number): Promise<void>;
|
|
@@ -4,9 +4,6 @@ import { appendActivity, beginTurn, bindTellsToTurn, BodyControlledError, breakB
|
|
|
4
4
|
import { keiyakuExecutionInstructions } from "./execution-instructions.js";
|
|
5
5
|
import { withoutModel } from "./provider-recipe.js";
|
|
6
6
|
import { encodeAgentEvent, } from "./provider.js";
|
|
7
|
-
import { akumaCallRequestCommands } from "./call-request.js";
|
|
8
|
-
import { BodyRequestPump } from "./request-serve.js";
|
|
9
|
-
import { composeRequestCommands } from "./request-wire.js";
|
|
10
7
|
import { CONTROL_RESPONSE_MS } from "./body-supervisor.js";
|
|
11
8
|
function serializeEffects() {
|
|
12
9
|
let tail = Promise.resolve();
|
|
@@ -46,21 +43,6 @@ export async function turnRecipe(paths, soul) {
|
|
|
46
43
|
...(session === undefined ? {} : { session }),
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
|
-
async function failedTurnSetup(input, turnSequence, requests, cancelDrive, error) {
|
|
50
|
-
try {
|
|
51
|
-
await requests.close();
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
/* Preserve the setup or pump failure. */
|
|
55
|
-
}
|
|
56
|
-
input.supervisor.signal.removeEventListener("abort", cancelDrive);
|
|
57
|
-
if (input.supervisor.signal.aborted) {
|
|
58
|
-
if (input.supervisor.reason === "heart-gone")
|
|
59
|
-
throw error;
|
|
60
|
-
return { kind: "stopped" };
|
|
61
|
-
}
|
|
62
|
-
return { kind: "failed", turnSequence, diagnostic: error instanceof Error ? error.message : String(error) };
|
|
63
|
-
}
|
|
64
46
|
async function writeProviderEvent(input, active, event, witness) {
|
|
65
47
|
if (input.supervisor.signal.aborted)
|
|
66
48
|
return;
|
|
@@ -100,7 +82,6 @@ function startProviderAttempt(input, setup) {
|
|
|
100
82
|
bodySequence: input.bodySequence,
|
|
101
83
|
turnSequence: setup.turnSequence,
|
|
102
84
|
},
|
|
103
|
-
requests: { dir: setup.requests.directory, entry: setup.requests.entry },
|
|
104
85
|
...(setup.runtimeInstructions === undefined ? {} : { runtimeInstructions: setup.runtimeInstructions }),
|
|
105
86
|
...(setup.schemaJson === undefined ? {} : { schemaJson: setup.schemaJson }),
|
|
106
87
|
};
|
|
@@ -136,59 +117,30 @@ async function startTurnDrive(input) {
|
|
|
136
117
|
await input.turnStarted.emit(turn.sequence);
|
|
137
118
|
if (input.supervisor.signal.aborted)
|
|
138
119
|
return { kind: "stopped" };
|
|
139
|
-
|
|
140
|
-
const commands = composeRequestCommands(akumaCallRequestCommands({ world, paths, parent, spawn, admitInitialTell }), externalCommands);
|
|
141
|
-
const requests = await BodyRequestPump.open({
|
|
142
|
-
paths: input.paths,
|
|
143
|
-
allowed: input.soul.allowed,
|
|
144
|
-
bodySequence: input.bodySequence,
|
|
145
|
-
now: input.now,
|
|
146
|
-
commands,
|
|
147
|
-
signal: input.supervisor.signal,
|
|
148
|
-
});
|
|
149
|
-
return await establishTurnDrive(input, turn.sequence, requests, {
|
|
120
|
+
return await establishTurnDrive(input, turn.sequence, {
|
|
150
121
|
...recipe,
|
|
151
122
|
boundTells,
|
|
152
123
|
...(schemaJson === undefined ? {} : { schemaJson }),
|
|
153
124
|
...(runtimeInstructions === undefined ? {} : { runtimeInstructions }),
|
|
154
125
|
});
|
|
155
126
|
}
|
|
156
|
-
async function establishTurnDrive(input, turnSequence,
|
|
127
|
+
async function establishTurnDrive(input, turnSequence, recipe) {
|
|
157
128
|
const { cwd, options, session, boundTells, schemaJson, runtimeInstructions } = recipe;
|
|
158
|
-
const driveController = new AbortController();
|
|
159
|
-
const cancelDrive = () => {
|
|
160
|
-
if (!driveController.signal.aborted)
|
|
161
|
-
driveController.abort(input.supervisor.signal.reason);
|
|
162
|
-
};
|
|
163
|
-
input.supervisor.signal.addEventListener("abort", cancelDrive, { once: true });
|
|
164
|
-
if (input.supervisor.signal.aborted)
|
|
165
|
-
cancelDrive();
|
|
166
|
-
void requests.failure.catch((error) => {
|
|
167
|
-
if (!driveController.signal.aborted)
|
|
168
|
-
driveController.abort(error);
|
|
169
|
-
});
|
|
170
129
|
const attempt = startProviderAttempt(input, {
|
|
171
130
|
recipe,
|
|
172
131
|
tells: boundTells,
|
|
173
|
-
|
|
174
|
-
signal: driveController.signal,
|
|
132
|
+
signal: input.supervisor.signal,
|
|
175
133
|
turnSequence,
|
|
176
134
|
schemaJson,
|
|
177
135
|
runtimeInstructions,
|
|
178
136
|
});
|
|
179
137
|
const custodyFailure = observeFailure(attempt.closed);
|
|
180
138
|
try {
|
|
181
|
-
const selected = await abortable(Promise.race([attempt.result,
|
|
139
|
+
const selected = await abortable(Promise.race([attempt.result, custodyFailure]), input.supervisor.signal);
|
|
182
140
|
if (input.supervisor.signal.aborted) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (retirement.kind === "hung")
|
|
187
|
-
return retirement;
|
|
188
|
-
}
|
|
189
|
-
finally {
|
|
190
|
-
input.supervisor.signal.removeEventListener("abort", cancelDrive);
|
|
191
|
-
}
|
|
141
|
+
const retirement = await retireProviderCustody(input, turnSequence, attempt);
|
|
142
|
+
if (retirement.kind === "hung")
|
|
143
|
+
return retirement;
|
|
192
144
|
return { kind: "stopped" };
|
|
193
145
|
}
|
|
194
146
|
if (boundTells.length > 0)
|
|
@@ -199,30 +151,25 @@ async function establishTurnDrive(input, turnSequence, requests, recipe) {
|
|
|
199
151
|
fence: selected.admission.fence,
|
|
200
152
|
deliveredAt: input.now(),
|
|
201
153
|
})));
|
|
202
|
-
void selected.completion.then(() => requests.stopAdmission(), () => undefined);
|
|
203
154
|
return {
|
|
204
155
|
turnSequence,
|
|
205
156
|
attempt,
|
|
206
157
|
drive: selected,
|
|
207
|
-
requests,
|
|
208
158
|
cwd,
|
|
209
159
|
options,
|
|
210
|
-
releaseDriveSignal: () => input.supervisor.signal.removeEventListener("abort", cancelDrive),
|
|
211
160
|
...(session === undefined ? {} : { resume: session }),
|
|
212
161
|
};
|
|
213
162
|
}
|
|
214
163
|
catch (error) {
|
|
215
164
|
const retirement = await retireProviderCustody(input, turnSequence, attempt);
|
|
216
|
-
if (retirement.kind === "hung")
|
|
217
|
-
try {
|
|
218
|
-
await requests.close();
|
|
219
|
-
}
|
|
220
|
-
finally {
|
|
221
|
-
input.supervisor.signal.removeEventListener("abort", cancelDrive);
|
|
222
|
-
}
|
|
165
|
+
if (retirement.kind === "hung")
|
|
223
166
|
return retirement;
|
|
167
|
+
if (input.supervisor.signal.aborted) {
|
|
168
|
+
if (input.supervisor.reason === "heart-gone")
|
|
169
|
+
throw error;
|
|
170
|
+
return { kind: "stopped" };
|
|
224
171
|
}
|
|
225
|
-
return
|
|
172
|
+
return { kind: "failed", turnSequence, diagnostic: error instanceof Error ? error.message : String(error) };
|
|
226
173
|
}
|
|
227
174
|
}
|
|
228
175
|
async function retireProviderCustody(input, turnSequence, attempt) {
|
|
@@ -314,28 +261,9 @@ async function submitPendingLiveTells(writers, pending, attempted, tellLive) {
|
|
|
314
261
|
}
|
|
315
262
|
return "live";
|
|
316
263
|
}
|
|
317
|
-
async function stopActiveDrive(input, active) {
|
|
318
|
-
try {
|
|
319
|
-
const retirement = await retireProviderCustody(input, active.turnSequence, active.attempt);
|
|
320
|
-
await active.requests.close();
|
|
321
|
-
return retirement;
|
|
322
|
-
}
|
|
323
|
-
finally {
|
|
324
|
-
active.releaseDriveSignal();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
264
|
function hasUnattemptedTell(liveTells, tellPump, pending, attempted) {
|
|
328
265
|
return (liveTells && tellPump === null && pending.some((tell) => !attempted.has(tell.id) && tell.schemaJson === undefined));
|
|
329
266
|
}
|
|
330
|
-
async function settleCompletion(result, session, active) {
|
|
331
|
-
try {
|
|
332
|
-
await active.requests.close();
|
|
333
|
-
return result.kind === "answered" ? { ...result, ...(session === undefined ? {} : { session }) } : result;
|
|
334
|
-
}
|
|
335
|
-
finally {
|
|
336
|
-
active.releaseDriveSignal();
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
267
|
/**
|
|
340
268
|
* One bounded wake slot per live Turn source.
|
|
341
269
|
*
|
|
@@ -400,7 +328,7 @@ function createTurnWakeups(observeHeart) {
|
|
|
400
328
|
};
|
|
401
329
|
}
|
|
402
330
|
async function consumeTurnDrive(input, active) {
|
|
403
|
-
const { turnSequence, drive,
|
|
331
|
+
const { turnSequence, drive, resume } = active;
|
|
404
332
|
let heart = input.supervisor.current();
|
|
405
333
|
let turnSession = resume;
|
|
406
334
|
const attempted = new Set(drainPendingTells(input.launchTells).map((tell) => tell.id));
|
|
@@ -463,7 +391,7 @@ async function consumeTurnDrive(input, active) {
|
|
|
463
391
|
const ready = () => eventsEnded && result !== undefined && attemptClosed && tellPump === null;
|
|
464
392
|
/** Retirement decides the ending: only a provider that could not retire replaces the requested one. */
|
|
465
393
|
const stopAndReturn = async (outcome) => {
|
|
466
|
-
const retirement = await
|
|
394
|
+
const retirement = await retireProviderCustody(input, turnSequence, active.attempt);
|
|
467
395
|
if (retirement.kind === "hung")
|
|
468
396
|
return retirement;
|
|
469
397
|
return input.supervisor.signal.aborted ? { kind: "stopped" } : outcome;
|
|
@@ -471,7 +399,6 @@ async function consumeTurnDrive(input, active) {
|
|
|
471
399
|
wakeups.event(iterator.next());
|
|
472
400
|
wakeups.heart(heart);
|
|
473
401
|
wakeups.failure(receiptFailure);
|
|
474
|
-
wakeups.failure(requests.failure);
|
|
475
402
|
wakeups.completion(drive.completion);
|
|
476
403
|
wakeups.closure(active.attempt.closed);
|
|
477
404
|
try {
|
|
@@ -496,7 +423,9 @@ async function consumeTurnDrive(input, active) {
|
|
|
496
423
|
}
|
|
497
424
|
if (ready() && effectsDrained) {
|
|
498
425
|
writesOpen = false;
|
|
499
|
-
return
|
|
426
|
+
return result.kind === "answered"
|
|
427
|
+
? { ...result, ...(turnSession === undefined ? {} : { session: turnSession }) }
|
|
428
|
+
: result;
|
|
500
429
|
}
|
|
501
430
|
}
|
|
502
431
|
}
|
|
@@ -507,13 +436,6 @@ async function consumeTurnDrive(input, active) {
|
|
|
507
436
|
if (input.supervisor.signal.aborted)
|
|
508
437
|
return await stopAndReturn({ kind: "stopped" });
|
|
509
438
|
const retirement = await retireProviderCustody(input, turnSequence, active.attempt);
|
|
510
|
-
try {
|
|
511
|
-
await requests.close();
|
|
512
|
-
}
|
|
513
|
-
catch {
|
|
514
|
-
/* Preserve the first pump failure. */
|
|
515
|
-
}
|
|
516
|
-
active.releaseDriveSignal();
|
|
517
439
|
if (retirement.kind === "hung")
|
|
518
440
|
return retirement;
|
|
519
441
|
return { kind: "failed", diagnostic: error instanceof Error ? error.message : String(error) };
|
|
@@ -545,12 +467,6 @@ export async function driveTurn(input) {
|
|
|
545
467
|
}
|
|
546
468
|
catch (error) {
|
|
547
469
|
if (await heartExists(input.paths)) {
|
|
548
|
-
try {
|
|
549
|
-
await active.requests.close();
|
|
550
|
-
}
|
|
551
|
-
finally {
|
|
552
|
-
active.releaseDriveSignal();
|
|
553
|
-
}
|
|
554
470
|
return {
|
|
555
471
|
kind: "failed",
|
|
556
472
|
diagnostic: error instanceof Error ? error.message : String(error),
|
|
@@ -558,7 +474,7 @@ export async function driveTurn(input) {
|
|
|
558
474
|
};
|
|
559
475
|
}
|
|
560
476
|
input.supervisor.cancel("heart-gone");
|
|
561
|
-
const retirement = await
|
|
477
|
+
const retirement = await retireProviderCustody(input, active.turnSequence, active.attempt);
|
|
562
478
|
return retirement.kind === "hung" ? retirement : { kind: "stopped" };
|
|
563
479
|
}
|
|
564
480
|
}
|
package/build/src/akuma-body.js
CHANGED
|
@@ -3,20 +3,17 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
import { driveAkumaBody } from "./akuma/body.js";
|
|
4
4
|
import { bodyLaunchSchema } from "./akuma/body-launch.js";
|
|
5
5
|
import { LEASH_HELD_EXIT, spawnAkumaBody } from "./akuma/detached-body.js";
|
|
6
|
-
import {
|
|
6
|
+
import { bodyExecutionContext } from "./body-host.js";
|
|
7
7
|
async function runBodyEntrypoint() {
|
|
8
8
|
const encoded = process.argv[2];
|
|
9
9
|
if (encoded === undefined)
|
|
10
10
|
throw new TypeError("Akuma body launch payload is missing");
|
|
11
11
|
const launch = bodyLaunchSchema.parse(JSON.parse(Buffer.from(encoded, "base64url").toString("utf8")));
|
|
12
12
|
const spawn = spawnAkumaBody;
|
|
13
|
-
const
|
|
13
|
+
const context = await bodyExecutionContext(launch);
|
|
14
14
|
if ((await driveAkumaBody(launch, undefined, {
|
|
15
|
-
|
|
16
|
-
externalCommands: commands,
|
|
17
|
-
executionAssociation,
|
|
15
|
+
...context,
|
|
18
16
|
spawn,
|
|
19
|
-
requestSpawn: spawn,
|
|
20
17
|
})) === "held")
|
|
21
18
|
process.exitCode = LEASH_HELD_EXIT;
|
|
22
19
|
}
|
package/build/src/body-host.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { BodyLauncher } from "./akuma/body-launch.js";
|
|
1
|
+
import type { BodyLaunch, BodyLauncher } from "./akuma/body-launch.js";
|
|
2
|
+
import type { ExecutionAssociationReader } from "./akuma/execution-instructions.js";
|
|
3
|
+
import { World } from "./world.js";
|
|
4
|
+
export declare function bodyExecutionContext(launch: BodyLaunch): Promise<Readonly<{
|
|
5
|
+
world: Awaited<ReturnType<typeof World.prove>>;
|
|
6
|
+
executionAssociation: ExecutionAssociationReader;
|
|
7
|
+
}>>;
|
|
2
8
|
export type AkumaHostOptions = Readonly<{
|
|
3
9
|
/** Detached by default. In-process Bodies share this Node runtime's lifetime. */
|
|
4
10
|
hosting?: "detached" | "in-process";
|
|
@@ -20,7 +26,7 @@ export declare const AkumaHost: Readonly<{
|
|
|
20
26
|
/** Create an in-process launch scope. Pass the scope itself as the public host option. */
|
|
21
27
|
inProcess(options?: Pick<AkumaHostOptions, "reportDiagnostic">): AkumaHostScope;
|
|
22
28
|
}>;
|
|
23
|
-
/** Capture
|
|
29
|
+
/** Capture the invoking composition's host capabilities. */
|
|
24
30
|
export declare function captureAkumaHost(host?: AkumaHostOptions): Readonly<{
|
|
25
31
|
spawn: BodyLauncher;
|
|
26
32
|
reportDiagnostic?: (message: string) => void;
|
package/build/src/body-host.js
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
import { setMaxListeners } from "node:events";
|
|
2
2
|
import { spawnAkumaBody } from "./akuma/detached-body.js";
|
|
3
3
|
import { launchInProcessBody } from "./akuma/in-process-body.js";
|
|
4
|
-
import {
|
|
4
|
+
import { worldRootForAkumaPaths } from "./akuma/identity.js";
|
|
5
|
+
import { readSoul } from "./akuma/heart/index.js";
|
|
6
|
+
import { readDispatch } from "./dispatch/index.js";
|
|
7
|
+
import { NoGitWorldError, repositoryAt } from "./git/repository.js";
|
|
8
|
+
import { World } from "./world.js";
|
|
9
|
+
export async function bodyExecutionContext(launch) {
|
|
10
|
+
const world = await World.prove(worldRootForAkumaPaths(launch.paths));
|
|
11
|
+
const akuma = launch.seed?.id ?? (await readSoul(launch.paths))?.id;
|
|
12
|
+
return {
|
|
13
|
+
world,
|
|
14
|
+
executionAssociation: async () => {
|
|
15
|
+
if (akuma !== undefined) {
|
|
16
|
+
try {
|
|
17
|
+
const dispatch = await readDispatch(await repositoryAt(world), akuma);
|
|
18
|
+
if (dispatch !== null)
|
|
19
|
+
return { contractId: dispatch.contractId };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (!(error instanceof NoGitWorldError)) {
|
|
23
|
+
console.error(`Keiyaku execution association unavailable for ${akuma}: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const contractId = launch.completion?.contractId;
|
|
28
|
+
return contractId === undefined ? undefined : { contractId };
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
5
32
|
function inProcessLauncher(scopeSignal, enroll) {
|
|
6
33
|
const spawn = (launch) => {
|
|
7
34
|
scopeSignal?.throwIfAborted();
|
|
8
35
|
const pending = launchInProcessBody(launch, async (signal) => {
|
|
9
36
|
signal.throwIfAborted();
|
|
10
|
-
|
|
11
|
-
return { world, externalCommands: commands, executionAssociation, spawn, requestSpawn: spawnAkumaBody };
|
|
37
|
+
return { ...(await bodyExecutionContext(launch)), spawn };
|
|
12
38
|
}, undefined, scopeSignal);
|
|
13
39
|
// Every launch, including automatic succession, enrols before yielding.
|
|
14
40
|
enroll?.(pending);
|
|
@@ -62,7 +88,7 @@ export const AkumaHost = Object.freeze({
|
|
|
62
88
|
return new ScopedAkumaHost(options);
|
|
63
89
|
},
|
|
64
90
|
});
|
|
65
|
-
/** Capture
|
|
91
|
+
/** Capture the invoking composition's host capabilities. */
|
|
66
92
|
export function captureAkumaHost(host) {
|
|
67
93
|
if (host !== undefined && (typeof host !== "object" || host === null || Array.isArray(host)))
|
|
68
94
|
throw new TypeError("Akuma host options must be an object");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type CliUsageGuide } from "../usage.js";
|
|
2
2
|
import { type AkumaAlias } from "../../identity/selector.js";
|
|
3
|
-
import { type AllowedActions } from "../../akuma/allowed.js";
|
|
4
3
|
type Output = Readonly<{
|
|
5
4
|
output: "text" | "json";
|
|
6
5
|
}>;
|
|
@@ -23,7 +22,6 @@ export type ParsedAkumaCommand = Output & ((Readonly<{
|
|
|
23
22
|
alias?: AkumaAlias;
|
|
24
23
|
mode: "wait" | "detach";
|
|
25
24
|
timeoutMs?: number;
|
|
26
|
-
allowed?: AllowedActions;
|
|
27
25
|
writableDirectories?: readonly string[];
|
|
28
26
|
bare?: boolean;
|
|
29
27
|
schema?: string;
|
|
@@ -2,9 +2,7 @@ import { CliUsageError, commandGuide, usageLine } from "../usage.js";
|
|
|
2
2
|
import { scanArgs } from "../scan.js";
|
|
3
3
|
import { parseDuration as decodeDuration } from "../../duration.js";
|
|
4
4
|
import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
|
|
5
|
-
import { ALLOWED_ACTIONS, DEFAULT_ALLOWED_ACTIONS, decodeAllowedActions, } from "../../akuma/allowed.js";
|
|
6
5
|
import { parsePublicHistoryId } from "../../akuma/identity.js";
|
|
7
|
-
const EXTRA_ALLOWED_ACTIONS = ALLOWED_ACTIONS.filter((action) => !DEFAULT_ALLOWED_ACTIONS.includes(action));
|
|
8
6
|
const SET_SELECTORS = '(<aku/...> | @alias | <kei/...> | "aku/<name-pattern>/<hex-pattern>")...';
|
|
9
7
|
const SET_DETAILS = "Globs contain * and use lowercase hex digits or * in the suffix. --repo requires at least one Contract (kei/...) selector.";
|
|
10
8
|
const SCHEMA_DETAILS = "--schema supplies a JSON Schema answer contract to the provider; on observation the CLI parses JSON but does not independently validate schema conformance.";
|
|
@@ -14,8 +12,8 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
14
12
|
stdin: true,
|
|
15
13
|
flags: { json: "boolean" },
|
|
16
14
|
usage: "report (<text> | -) [--json]",
|
|
17
|
-
purpose: "
|
|
18
|
-
details: "Give
|
|
15
|
+
purpose: "Report progress to your caller and keep working.",
|
|
16
|
+
details: "Give <text> as one argument, or - to read stdin. Works only from inside a running Akuma. It does not end your turn or replace your final answer.",
|
|
19
17
|
},
|
|
20
18
|
call: {
|
|
21
19
|
arity: 1,
|
|
@@ -24,13 +22,12 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
24
22
|
contract: "value",
|
|
25
23
|
alias: "value",
|
|
26
24
|
wait: "value",
|
|
27
|
-
allowed: "repeat",
|
|
28
25
|
"add-dir": "repeat",
|
|
29
26
|
bare: "boolean",
|
|
30
27
|
json: "boolean",
|
|
31
28
|
schema: "value",
|
|
32
29
|
},
|
|
33
|
-
usage: "call <akuma-name> [--contract <kei/...>] [--repo <path>] [--workdir <path>] [--alias <name>] [--
|
|
30
|
+
usage: "call <akuma-name> [--contract <kei/...>] [--repo <path>] [--workdir <path>] [--alias <name>] [--add-dir <path>]... [--bare] [--schema <file>] [--wait <duration>] [<prompt> | -]",
|
|
34
31
|
purpose: "Call an Akuma into the world.",
|
|
35
32
|
details: [
|
|
36
33
|
"Use keiyaku ls aku/ to find visible Akuma names; hidden definitions can still be called by name.",
|
|
@@ -41,15 +38,8 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
41
38
|
"By default, call returns after birth and optional first Tell admission; --wait also waits for its first answer, up to the given duration.",
|
|
42
39
|
"--contract records an association, not the work or execution directory; include the Contract and worktree context in the prompt as needed. --repo requires --contract.",
|
|
43
40
|
"--workdir selects where the Akuma works; relative paths resolve from the invocation directory selected by -C/--cwd, or the process cwd when omitted. Without --workdir, the invocation directory is used.",
|
|
44
|
-
"--add-dir explicitly grants another existing writable directory to Codex native workspace-write tools; repeat for multiple roots. Relative paths resolve from the invocation directory. Other sandbox modes, permission profiles, and providers refuse nonempty grants instead of broadening policy. Existing network policy and writable roots are preserved
|
|
41
|
+
"--add-dir explicitly grants another existing writable directory to Codex native workspace-write tools; repeat for multiple roots. Relative paths resolve from the invocation directory. Other sandbox modes, permission profiles, and providers refuse nonempty grants instead of broadening policy. Existing network policy and writable roots are preserved; the repo and Home are never granted automatically.",
|
|
45
42
|
"--alias <name> gives the new Akuma the selector @name instead of aku/<id>; an existing @name is reassigned to this Akuma.",
|
|
46
|
-
`Default actions: ${DEFAULT_ALLOWED_ACTIONS.join(", ")}.`,
|
|
47
|
-
...(EXTRA_ALLOWED_ACTIONS.length === 0
|
|
48
|
-
? []
|
|
49
|
-
: [`Also available with --allowed: ${EXTRA_ALLOWED_ACTIONS.join(", ")}.`]),
|
|
50
|
-
"Repeated --allowed adds actions to the selected Akuma's allowed actions; it cannot remove inherited permissions.",
|
|
51
|
-
"If no actions are configured, defaults apply; an explicitly empty list allows none.",
|
|
52
|
-
"An Akuma started by another Akuma can use only actions its parent can use. Use keiyaku status <aku/...|@alias> --json to inspect status.allowed.",
|
|
53
43
|
SCHEMA_DETAILS,
|
|
54
44
|
"With --wait, completed activity streams on stderr and the final answer is written to stdout once.",
|
|
55
45
|
].join("\n"),
|
|
@@ -59,14 +49,13 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
59
49
|
stdin: false,
|
|
60
50
|
flags: { any: "boolean", all: "boolean", timeout: "value", json: "boolean" },
|
|
61
51
|
usage: `wait ${SET_SELECTORS} [--any | --all] [--timeout <duration>] [--repo <path>]`,
|
|
62
|
-
purpose: "Wait for
|
|
52
|
+
purpose: "Wait for Contract changes or terminal state, or Akumas to finish work.",
|
|
63
53
|
details: [
|
|
64
|
-
"
|
|
54
|
+
"Select Contracts or Akumas, never both in one wait. Contract IDs wait for their next journal change or terminal state, not associated Akumas.",
|
|
55
|
+
"The default mode is any; --all waits for every selected member. Each Contract starts from its current journal head; already accepted or abandoned Contracts complete immediately.",
|
|
65
56
|
SET_DETAILS,
|
|
66
|
-
"An already completed
|
|
67
|
-
"
|
|
68
|
-
"An answer is part of that snapshot; wait writes no separate copy of it to stdout.",
|
|
69
|
-
"With --json stdout carries the result document.",
|
|
57
|
+
"An already completed Akuma counts immediately; a deadline only bounds observation.",
|
|
58
|
+
"With --json stdout carries the native result document.",
|
|
70
59
|
].join("\n"),
|
|
71
60
|
},
|
|
72
61
|
tell: {
|
|
@@ -77,7 +66,7 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
77
66
|
purpose: "Tell an Akuma something without waiting for its answer.",
|
|
78
67
|
details: [
|
|
79
68
|
"Give <prompt> as one argument, or use - to read stdin.",
|
|
80
|
-
"--interrupt
|
|
69
|
+
"--interrupt admits the Tell and asks current work to yield; the Tell remains admitted even if yielding cannot be confirmed.",
|
|
81
70
|
"Use ask to block for the answer or supply a schema.",
|
|
82
71
|
].join("\n"),
|
|
83
72
|
},
|
|
@@ -89,7 +78,7 @@ const AKUMA_COMMAND_SPECS = {
|
|
|
89
78
|
purpose: "Ask an Akuma and block until it answers.",
|
|
90
79
|
details: [
|
|
91
80
|
"Give <prompt> as one argument, or use - to read stdin.",
|
|
92
|
-
"--interrupt
|
|
81
|
+
"--interrupt admits the Tell and asks current work to yield; the Tell remains admitted even if yielding cannot be confirmed.",
|
|
93
82
|
SCHEMA_DETAILS,
|
|
94
83
|
"--wait bounds how long to block for the answer; the Tell stays admitted past the deadline.",
|
|
95
84
|
"Completed activity streams on stderr and the final answer is written to stdout once.",
|
|
@@ -213,6 +202,9 @@ function validateSet(value, fail) {
|
|
|
213
202
|
function parseWait(rawSelectors, flags, output, fail) {
|
|
214
203
|
if (flags.any === true && flags.all === true)
|
|
215
204
|
fail("wait --any and --all are mutually exclusive");
|
|
205
|
+
const contracts = rawSelectors.filter((selector) => selector.startsWith("kei/"));
|
|
206
|
+
if (contracts.length > 0 && contracts.length !== rawSelectors.length)
|
|
207
|
+
fail("wait cannot mix Contract and Akuma selectors");
|
|
216
208
|
const completion = flags.any === true ? "any" : flags.all === true ? "all" : undefined;
|
|
217
209
|
return {
|
|
218
210
|
command: "wait",
|
|
@@ -316,19 +308,6 @@ function parseAsk(flags, subject, prompt, output, fail) {
|
|
|
316
308
|
output,
|
|
317
309
|
};
|
|
318
310
|
}
|
|
319
|
-
function parseAllowedFlag(raw, fail) {
|
|
320
|
-
if (raw === undefined)
|
|
321
|
-
return undefined;
|
|
322
|
-
if (!Array.isArray(raw))
|
|
323
|
-
fail("--allowed requires a value");
|
|
324
|
-
const selected = raw;
|
|
325
|
-
try {
|
|
326
|
-
return decodeAllowedActions(selected, "--allowed");
|
|
327
|
-
}
|
|
328
|
-
catch (error) {
|
|
329
|
-
fail(error instanceof Error ? error.message : "invalid --allowed action");
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
311
|
function parseCall(flags, archetype, prompt, output, fail) {
|
|
333
312
|
let alias;
|
|
334
313
|
if (flags.alias !== undefined) {
|
|
@@ -342,7 +321,6 @@ function parseCall(flags, archetype, prompt, output, fail) {
|
|
|
342
321
|
}
|
|
343
322
|
const mode = flags.wait === undefined ? "detach" : "wait";
|
|
344
323
|
const timeoutMs = flags.wait === undefined ? undefined : parseDuration(flags.wait, "--wait", fail);
|
|
345
|
-
const allowed = parseAllowedFlag(flags.allowed, fail);
|
|
346
324
|
const schema = flags.schema === undefined ? undefined : stringFlag(flags.schema, "call --schema requires a file", fail);
|
|
347
325
|
if (prompt === undefined && schema !== undefined)
|
|
348
326
|
fail("call --schema requires a prompt");
|
|
@@ -355,7 +333,6 @@ function parseCall(flags, archetype, prompt, output, fail) {
|
|
|
355
333
|
...(alias === undefined ? {} : { alias }),
|
|
356
334
|
mode,
|
|
357
335
|
...(timeoutMs === undefined ? {} : { timeoutMs }),
|
|
358
|
-
...(allowed === undefined ? {} : { allowed }),
|
|
359
336
|
...(flags["add-dir"] === undefined ? {} : { writableDirectories: flags["add-dir"] }),
|
|
360
337
|
...(flags.bare === true ? { bare: true } : {}),
|
|
361
338
|
...(schema === undefined ? {} : { schema }),
|