@astrosheep/keiyaku 4.6.27 → 4.6.29
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 +76 -35
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +41 -4
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +41 -4
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +41 -4
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +42 -22
- package/build/plugins/pi/README.md +17 -12
- package/build/plugins/pi/akuma-tools.ts +5 -20
- package/build/plugins/pi/keiyaku.ts +73 -1
- package/build/skills/keiyaku-akuma/SKILL.md +41 -4
- package/build/skills/keiyaku-akuma/references/automation.md +4 -7
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +39 -15
- package/build/skills/keiyaku-workflow/SKILL.md +42 -22
- 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 +5 -5
- package/build/src/akuma/akuma.d.ts +12 -26
- package/build/src/akuma/akuma.js +17 -7
- 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 +4 -1
- package/build/src/akuma/identity.js +7 -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 +30 -24
- package/build/src/akuma/projection.js +6 -1
- 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/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 +47 -16
- package/build/src/cli/commands/contract.js +27 -26
- package/build/src/cli/commands/debt.js +3 -3
- 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 +1 -0
- package/build/src/cli/render/akuma-activity.d.ts +0 -1
- package/build/src/cli/render/akuma-activity.js +8 -12
- package/build/src/cli/render/akuma.js +1 -1
- 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 +11 -8
- package/build/src/index.js +2 -2
- package/build/src/kanshi/counts.d.ts +15 -0
- package/build/src/kanshi/counts.js +66 -0
- package/build/src/kanshi/index.d.ts +2 -0
- package/build/src/kanshi/index.js +1 -0
- 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 +15 -36
- package/build/src/library/selection.js +64 -132
- 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/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 +17 -12
- package/plugins/pi/akuma-tools.ts +5 -20
- package/plugins/pi/keiyaku.ts +73 -1
- package/skills/keiyaku-akuma/SKILL.md +41 -4
- package/skills/keiyaku-akuma/references/automation.md +4 -7
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +39 -15
- package/skills/keiyaku-workflow/SKILL.md +42 -22
- 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,143 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const requestEnvelopeSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodString;
|
|
4
|
-
action: z.ZodString;
|
|
5
|
-
payload: z.ZodUnknown;
|
|
6
|
-
}, z.core.$strict>;
|
|
7
|
-
declare const receiptEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
-
id: z.ZodString;
|
|
9
|
-
action: z.ZodString;
|
|
10
|
-
state: z.ZodLiteral<"served">;
|
|
11
|
-
outcome: z.ZodUnion<readonly [z.ZodObject<{
|
|
12
|
-
kind: z.ZodLiteral<"returned">;
|
|
13
|
-
result: z.ZodUnknown;
|
|
14
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
-
kind: z.ZodLiteral<"failed">;
|
|
16
|
-
failure: z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
-
kind: z.ZodLiteral<"akuma-not-born">;
|
|
18
|
-
id: z.ZodString;
|
|
19
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
-
kind: z.ZodLiteral<"failed">;
|
|
21
|
-
diagnostic: z.ZodString;
|
|
22
|
-
}, z.core.$strict>]>;
|
|
23
|
-
}, z.core.$strict>]>;
|
|
24
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
25
|
-
id: z.ZodString;
|
|
26
|
-
action: z.ZodString;
|
|
27
|
-
state: z.ZodLiteral<"served">;
|
|
28
|
-
reference: z.ZodUnknown;
|
|
29
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
-
id: z.ZodString;
|
|
31
|
-
action: z.ZodString;
|
|
32
|
-
state: z.ZodLiteral<"refused">;
|
|
33
|
-
diagnostic: z.ZodString;
|
|
34
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
35
|
-
id: z.ZodString;
|
|
36
|
-
action: z.ZodString;
|
|
37
|
-
state: z.ZodLiteral<"voided">;
|
|
38
|
-
evidence: z.ZodString;
|
|
39
|
-
failure: z.ZodOptional<z.ZodUnknown>;
|
|
40
|
-
outcome: z.ZodOptional<z.ZodUnknown>;
|
|
41
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
42
|
-
id: z.ZodString;
|
|
43
|
-
action: z.ZodString;
|
|
44
|
-
state: z.ZodLiteral<"unproven">;
|
|
45
|
-
evidence: z.ZodString;
|
|
46
|
-
failure: z.ZodOptional<z.ZodUnknown>;
|
|
47
|
-
}, z.core.$strict>]>;
|
|
48
|
-
export type RequestEnvelope = z.infer<typeof requestEnvelopeSchema>;
|
|
49
|
-
/**
|
|
50
|
-
* A Body Request operation is owned by the verb that defines its public
|
|
51
|
-
* values. Transport only carries the opaque values produced here.
|
|
52
|
-
*/
|
|
53
|
-
export type RequestProtocol<Input, Output, Reference> = Readonly<{
|
|
54
|
-
action: string;
|
|
55
|
-
/** An opted-in service request accepts cancellation after publication. */
|
|
56
|
-
supportsCancellation?: boolean;
|
|
57
|
-
encodeRequest(input: Input): unknown;
|
|
58
|
-
decodeRequest(payload: unknown): Input | null;
|
|
59
|
-
encodeResult(result: Output): unknown;
|
|
60
|
-
decodeResult(result: unknown): Output;
|
|
61
|
-
encodeFailure?(error: unknown): unknown | null;
|
|
62
|
-
decodeFailure?(failure: unknown): Error | null;
|
|
63
|
-
decodeReference(reference: unknown): Reference;
|
|
64
|
-
isPermitted(allowed: readonly string[]): boolean;
|
|
65
|
-
}>;
|
|
66
|
-
export type ExecutionFacts = Readonly<{
|
|
67
|
-
id: string;
|
|
68
|
-
admittedAt: string;
|
|
69
|
-
requester: string;
|
|
70
|
-
signal: AbortSignal;
|
|
71
|
-
admissionOpen(): boolean;
|
|
72
|
-
/** Best-effort, ephemeral progress for this one live request. */
|
|
73
|
-
progress?(value: unknown): void;
|
|
74
|
-
}>;
|
|
75
|
-
export type ChildRequestCommand<Input, Output, Reference> = Readonly<{
|
|
76
|
-
completion: "child";
|
|
77
|
-
protocol: RequestProtocol<Input, Output, Reference>;
|
|
78
|
-
projectChild(child: string): Reference;
|
|
79
|
-
execute(input: Input, facts: ExecutionFacts): Promise<Readonly<{
|
|
80
|
-
result: Output;
|
|
81
|
-
child: string;
|
|
82
|
-
}>>;
|
|
83
|
-
}>;
|
|
84
|
-
export type ServiceCompletion<Output, Service> = Readonly<{
|
|
85
|
-
kind: "served";
|
|
86
|
-
result: Output;
|
|
87
|
-
service: Service;
|
|
88
|
-
}> | Readonly<{
|
|
89
|
-
kind: "voided";
|
|
90
|
-
outcome: Output;
|
|
91
|
-
}>;
|
|
92
|
-
export type ServiceRequestCommand<Input, Output, Service, Reference> = Readonly<{
|
|
93
|
-
completion: "service";
|
|
94
|
-
protocol: RequestProtocol<Input, Output, Reference>;
|
|
95
|
-
encodeService(service: Service): unknown;
|
|
96
|
-
decodeService(service: unknown): Service;
|
|
97
|
-
projectService(service: Service): Reference;
|
|
98
|
-
execute(input: Input, facts: ExecutionFacts): Promise<ServiceCompletion<Output, Service>>;
|
|
99
|
-
}>;
|
|
100
|
-
type ErasedRequest = Readonly<{
|
|
101
|
-
payloadJson: string;
|
|
102
|
-
supportsCancellation: boolean;
|
|
103
|
-
isPermitted(allowed: readonly string[]): boolean;
|
|
104
|
-
encodeFailure(error: unknown): unknown | null;
|
|
105
|
-
}>;
|
|
106
|
-
type ErasedChildRequest = ErasedRequest & Readonly<{
|
|
107
|
-
execute(facts: ExecutionFacts): Promise<Readonly<{
|
|
108
|
-
result: unknown;
|
|
109
|
-
child: string;
|
|
110
|
-
}>>;
|
|
111
|
-
}>;
|
|
112
|
-
type ErasedServiceRequest = ErasedRequest & Readonly<{
|
|
113
|
-
execute(facts: ExecutionFacts): Promise<Readonly<{
|
|
114
|
-
kind: "served";
|
|
115
|
-
result: unknown;
|
|
116
|
-
serviceJson: string;
|
|
117
|
-
}> | Readonly<{
|
|
118
|
-
kind: "voided";
|
|
119
|
-
outcome: unknown;
|
|
120
|
-
}>>;
|
|
121
|
-
}>;
|
|
122
|
-
export type ErasedRequestCommand = Readonly<{
|
|
123
|
-
action: string;
|
|
124
|
-
completion: "child";
|
|
125
|
-
projectChild(child: string): unknown;
|
|
126
|
-
resolve(payload: unknown): ErasedChildRequest | null;
|
|
127
|
-
}> | Readonly<{
|
|
128
|
-
action: string;
|
|
129
|
-
completion: "service";
|
|
130
|
-
projectServiceJson(serviceJson: string): unknown;
|
|
131
|
-
resolve(payload: unknown): ErasedServiceRequest | null;
|
|
132
|
-
}>;
|
|
133
|
-
/** Erases only static TypeScript parameters; each operation codec remains captured by its owner descriptor. */
|
|
134
|
-
export declare function eraseRequestCommand<Input, Output, Reference>(command: ChildRequestCommand<Input, Output, Reference>): ErasedRequestCommand;
|
|
135
|
-
export declare function eraseRequestCommand<Input, Output, Service, Reference>(command: ServiceRequestCommand<Input, Output, Service, Reference>): ErasedRequestCommand;
|
|
136
|
-
export declare function composeRequestCommands(...maps: readonly Readonly<Record<string, ErasedRequestCommand>>[]): Readonly<Record<string, ErasedRequestCommand>>;
|
|
137
|
-
export type ReceiptEnvelope = z.infer<typeof receiptEnvelopeSchema>;
|
|
138
|
-
export declare function decodeEnvelope(bytes: string, fileId: string): RequestEnvelope | null;
|
|
139
|
-
export declare function decodeReceiptEnvelope(bytes: string, id: string, action: string): ReceiptEnvelope | null;
|
|
140
|
-
export declare function requestPath(directory: string, id: string): string;
|
|
141
|
-
export declare function receiptPath(directory: string, id: string): string;
|
|
142
|
-
export declare function atomicJson(path: string, value: unknown, signal?: AbortSignal, beforeRename?: () => void | Promise<void>): Promise<void>;
|
|
143
|
-
export {};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
6
|
-
const requestIdSchema = z.string().regex(UUID);
|
|
7
|
-
const actionSchema = z.string().refine((value) => value.trim() !== "");
|
|
8
|
-
const requestEnvelopeSchema = z.object({ id: requestIdSchema, action: actionSchema, payload: z.unknown() }).strict();
|
|
9
|
-
const upstreamRequestFailureSchema = z.union([
|
|
10
|
-
z.object({ kind: z.literal("akuma-not-born"), id: z.string() }).strict(),
|
|
11
|
-
z.object({ kind: z.literal("failed"), diagnostic: z.string() }).strict(),
|
|
12
|
-
]);
|
|
13
|
-
const returnedEnvelopeSchema = z.union([
|
|
14
|
-
z.object({ kind: z.literal("returned"), result: z.unknown() }).strict(),
|
|
15
|
-
z.object({ kind: z.literal("failed"), failure: upstreamRequestFailureSchema }).strict(),
|
|
16
|
-
]);
|
|
17
|
-
const receiptEnvelopeSchema = z.union([
|
|
18
|
-
z
|
|
19
|
-
.object({ id: requestIdSchema, action: actionSchema, state: z.literal("served"), outcome: returnedEnvelopeSchema })
|
|
20
|
-
.strict(),
|
|
21
|
-
z.object({ id: requestIdSchema, action: actionSchema, state: z.literal("served"), reference: z.unknown() }).strict(),
|
|
22
|
-
z.object({ id: requestIdSchema, action: actionSchema, state: z.literal("refused"), diagnostic: z.string() }).strict(),
|
|
23
|
-
z
|
|
24
|
-
.object({
|
|
25
|
-
id: requestIdSchema,
|
|
26
|
-
action: actionSchema,
|
|
27
|
-
state: z.literal("voided"),
|
|
28
|
-
evidence: z.string(),
|
|
29
|
-
failure: z.unknown().optional(),
|
|
30
|
-
outcome: z.unknown().optional(),
|
|
31
|
-
})
|
|
32
|
-
.strict(),
|
|
33
|
-
z
|
|
34
|
-
.object({
|
|
35
|
-
id: requestIdSchema,
|
|
36
|
-
action: actionSchema,
|
|
37
|
-
state: z.literal("unproven"),
|
|
38
|
-
evidence: z.string(),
|
|
39
|
-
failure: z.unknown().optional(),
|
|
40
|
-
})
|
|
41
|
-
.strict(),
|
|
42
|
-
]);
|
|
43
|
-
export function eraseRequestCommand(command) {
|
|
44
|
-
const { protocol } = command;
|
|
45
|
-
switch (command.completion) {
|
|
46
|
-
case "child":
|
|
47
|
-
return {
|
|
48
|
-
action: protocol.action,
|
|
49
|
-
completion: "child",
|
|
50
|
-
projectChild: command.projectChild,
|
|
51
|
-
resolve: (payload) => {
|
|
52
|
-
const input = protocol.decodeRequest(payload);
|
|
53
|
-
if (input === null)
|
|
54
|
-
return null;
|
|
55
|
-
return {
|
|
56
|
-
payloadJson: JSON.stringify(protocol.encodeRequest(input)),
|
|
57
|
-
supportsCancellation: protocol.supportsCancellation === true,
|
|
58
|
-
isPermitted: (allowed) => protocol.isPermitted(allowed),
|
|
59
|
-
execute: async (facts) => {
|
|
60
|
-
const served = await command.execute(input, facts);
|
|
61
|
-
return { result: protocol.encodeResult(served.result), child: served.child };
|
|
62
|
-
},
|
|
63
|
-
encodeFailure: (error) => protocol.encodeFailure?.(error) ?? null,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
case "service":
|
|
68
|
-
return {
|
|
69
|
-
action: protocol.action,
|
|
70
|
-
completion: "service",
|
|
71
|
-
projectServiceJson: (serviceJson) => command.projectService(command.decodeService(JSON.parse(serviceJson))),
|
|
72
|
-
resolve: (payload) => {
|
|
73
|
-
const input = protocol.decodeRequest(payload);
|
|
74
|
-
if (input === null)
|
|
75
|
-
return null;
|
|
76
|
-
return {
|
|
77
|
-
payloadJson: JSON.stringify(protocol.encodeRequest(input)),
|
|
78
|
-
supportsCancellation: protocol.supportsCancellation === true,
|
|
79
|
-
isPermitted: (allowed) => protocol.isPermitted(allowed),
|
|
80
|
-
execute: async (facts) => {
|
|
81
|
-
const served = await command.execute(input, facts);
|
|
82
|
-
if (served.kind === "voided")
|
|
83
|
-
return { kind: "voided", outcome: protocol.encodeResult(served.outcome) };
|
|
84
|
-
return {
|
|
85
|
-
kind: "served",
|
|
86
|
-
result: protocol.encodeResult(served.result),
|
|
87
|
-
serviceJson: JSON.stringify(command.encodeService(served.service)),
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
encodeFailure: (error) => protocol.encodeFailure?.(error) ?? null,
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export function composeRequestCommands(...maps) {
|
|
97
|
-
const commands = Object.create(null);
|
|
98
|
-
for (const map of maps) {
|
|
99
|
-
for (const [action, command] of Object.entries(map)) {
|
|
100
|
-
if (Object.hasOwn(commands, action))
|
|
101
|
-
throw new Error(`duplicate request command action: ${action}`);
|
|
102
|
-
commands[action] = command;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return commands;
|
|
106
|
-
}
|
|
107
|
-
export function decodeEnvelope(bytes, fileId) {
|
|
108
|
-
let decoded;
|
|
109
|
-
try {
|
|
110
|
-
decoded = JSON.parse(bytes);
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
const parsed = requestEnvelopeSchema.safeParse(decoded);
|
|
116
|
-
return UUID.test(fileId) && parsed.success ? parsed.data : null;
|
|
117
|
-
}
|
|
118
|
-
export function decodeReceiptEnvelope(bytes, id, action) {
|
|
119
|
-
let decoded;
|
|
120
|
-
try {
|
|
121
|
-
decoded = JSON.parse(bytes);
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
const parsed = receiptEnvelopeSchema.safeParse(decoded);
|
|
127
|
-
return parsed.success && parsed.data.id === id && parsed.data.action === action ? parsed.data : null;
|
|
128
|
-
}
|
|
129
|
-
export function requestPath(directory, id) {
|
|
130
|
-
return join(directory, `${id}.request.json`);
|
|
131
|
-
}
|
|
132
|
-
export function receiptPath(directory, id) {
|
|
133
|
-
return join(directory, `${id}.receipt.json`);
|
|
134
|
-
}
|
|
135
|
-
export async function atomicJson(path, value, signal, beforeRename) {
|
|
136
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
137
|
-
try {
|
|
138
|
-
await writeFile(temporary, `${JSON.stringify(value)}\n`, { flag: "wx" });
|
|
139
|
-
await beforeRename?.();
|
|
140
|
-
signal?.throwIfAborted();
|
|
141
|
-
await rename(temporary, path);
|
|
142
|
-
}
|
|
143
|
-
finally {
|
|
144
|
-
await rm(temporary, { force: true });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { AkumaBodyRequestError, requestBodyCommand } from "./request-rendezvous.js";
|
|
2
|
-
type ExecutionChannel = Readonly<{
|
|
3
|
-
kind: "local";
|
|
4
|
-
}> | Readonly<{
|
|
5
|
-
kind: "body-request";
|
|
6
|
-
directory: string;
|
|
7
|
-
}>;
|
|
8
|
-
export type ExecutionContext = Readonly<{
|
|
9
|
-
channel: ExecutionChannel;
|
|
10
|
-
}>;
|
|
11
|
-
export type LibraryExecution = ExecutionContext;
|
|
12
|
-
export declare function localExecutionContext(): ExecutionContext;
|
|
13
|
-
export declare function bodyRequestExecutionContext(directory: unknown): ExecutionContext;
|
|
14
|
-
/** Constructs the one direct-parent route a caller may explicitly compose. */
|
|
15
|
-
export declare function bodyRequestExecution(input: Readonly<{
|
|
16
|
-
directory: string;
|
|
17
|
-
}>): LibraryExecution;
|
|
18
|
-
/** Resolve persistent transport once at private process composition, never during an operation. */
|
|
19
|
-
export declare function executionForEnvironment(environment: Readonly<Record<string, string | undefined>>, signal?: AbortSignal): Promise<LibraryExecution>;
|
|
20
|
-
export declare function executionChannel(context?: ExecutionContext): ExecutionChannel;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { isAbsolute, resolve } from "node:path";
|
|
3
|
-
import { AKUMA_REQUESTS_ENTRY_ENV, AKUMA_REQUESTS_ENV } from "./providers/execution-environment.js";
|
|
4
|
-
export { AkumaBodyRequestError, requestBodyCommand } from "./request-rendezvous.js";
|
|
5
|
-
const LOCAL_CHANNEL = Object.freeze({ kind: "local" });
|
|
6
|
-
export function localExecutionContext() {
|
|
7
|
-
return Object.freeze({ channel: LOCAL_CHANNEL });
|
|
8
|
-
}
|
|
9
|
-
export function bodyRequestExecutionContext(directory) {
|
|
10
|
-
if (typeof directory !== "string" || !isAbsolute(directory) || resolve(directory) !== directory) {
|
|
11
|
-
throw new Error("AKUMA_REQUESTS must be an absolute normalized path");
|
|
12
|
-
}
|
|
13
|
-
return Object.freeze({ channel: Object.freeze({ kind: "body-request", directory }) });
|
|
14
|
-
}
|
|
15
|
-
function valueRecord(value, label) {
|
|
16
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
17
|
-
throw new TypeError(`${label} must be an object`);
|
|
18
|
-
}
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
function closed(value, keys, label) {
|
|
22
|
-
for (const key of Object.keys(value)) {
|
|
23
|
-
if (!keys.includes(key))
|
|
24
|
-
throw new TypeError(`${label} has unknown field: ${key}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/** Constructs the one direct-parent route a caller may explicitly compose. */
|
|
28
|
-
export function bodyRequestExecution(input) {
|
|
29
|
-
const value = valueRecord(input, "body request execution input");
|
|
30
|
-
closed(value, ["directory"], "body request execution input");
|
|
31
|
-
if (typeof value.directory !== "string")
|
|
32
|
-
throw new TypeError("body request execution directory must be a string");
|
|
33
|
-
try {
|
|
34
|
-
return bodyRequestExecutionContext(value.directory);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
throw new TypeError(error instanceof Error ? error.message : String(error));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** Resolve persistent transport once at private process composition, never during an operation. */
|
|
41
|
-
export async function executionForEnvironment(environment, signal) {
|
|
42
|
-
signal?.throwIfAborted();
|
|
43
|
-
const directory = environment[AKUMA_REQUESTS_ENV];
|
|
44
|
-
const entry = environment[AKUMA_REQUESTS_ENTRY_ENV];
|
|
45
|
-
if (entry === undefined)
|
|
46
|
-
return directory === undefined ? localExecutionContext() : bodyRequestExecution({ directory });
|
|
47
|
-
if (directory !== undefined)
|
|
48
|
-
throw new TypeError("AKUMA_REQUESTS and AKUMA_REQUESTS_ENTRY are mutually exclusive");
|
|
49
|
-
if (!isAbsolute(entry) || resolve(entry) !== entry) {
|
|
50
|
-
throw new TypeError("AKUMA_REQUESTS_ENTRY must be an absolute normalized path");
|
|
51
|
-
}
|
|
52
|
-
let serialized;
|
|
53
|
-
try {
|
|
54
|
-
serialized = await readFile(entry, { encoding: "utf8", signal });
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
signal?.throwIfAborted();
|
|
58
|
-
throw new Error(`Akuma stable request entry unavailable: no current request channel at ${entry}`, { cause: error });
|
|
59
|
-
}
|
|
60
|
-
signal?.throwIfAborted();
|
|
61
|
-
try {
|
|
62
|
-
const value = valueRecord(JSON.parse(serialized), "body request entry");
|
|
63
|
-
closed(value, ["directory"], "body request entry");
|
|
64
|
-
return bodyRequestExecution({ directory: value.directory });
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
throw new TypeError(`Akuma stable request entry malformed at ${entry}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export function executionChannel(context) {
|
|
71
|
-
return context?.channel ?? LOCAL_CHANNEL;
|
|
72
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { WorldRoot } from "../world.js";
|
|
2
|
-
import type { BodyLauncher } from "./body-launch.js";
|
|
3
|
-
import type { AkumaStatus } from "./akuma.js";
|
|
4
|
-
import type { SelectionRequestPort } from "./selection-request.js";
|
|
5
|
-
/**
|
|
6
|
-
* The parent's Selection owner boundary: one forwarded request arrives as complete
|
|
7
|
-
* identities the child resolved without reading a Heart, and this side answers
|
|
8
|
-
* for them. It proves every target through the one addressability
|
|
9
|
-
* normalization before the operation begins, so a refusal that reaches the wire
|
|
10
|
-
* truthfully claims no product effect and a plural operation with an
|
|
11
|
-
* unaddressable member never starts; the executor's own access to the target is
|
|
12
|
-
* then the product act, never a second addressing probe.
|
|
13
|
-
*/
|
|
14
|
-
export declare function selectionRequestPort(world: WorldRoot, spawn: BodyLauncher, servingBodyId?: AkumaStatus["id"]): SelectionRequestPort;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AkumaSelfInterruptError } from "./akuma-errors.js";
|
|
2
|
-
import { requireBornAkuma } from "./akuma-probe.js";
|
|
3
|
-
import { executeAskAkuma, executeKillAkuma, executeTellAkuma } from "./akuma-selection-execution.js";
|
|
4
|
-
import { executeWaitAkuma } from "./akuma-wait.js";
|
|
5
|
-
import { akumaObservationOf } from "./selection-observation.js";
|
|
6
|
-
/**
|
|
7
|
-
* The parent's Selection owner boundary: one forwarded request arrives as complete
|
|
8
|
-
* identities the child resolved without reading a Heart, and this side answers
|
|
9
|
-
* for them. It proves every target through the one addressability
|
|
10
|
-
* normalization before the operation begins, so a refusal that reaches the wire
|
|
11
|
-
* truthfully claims no product effect and a plural operation with an
|
|
12
|
-
* unaddressable member never starts; the executor's own access to the target is
|
|
13
|
-
* then the product act, never a second addressing probe.
|
|
14
|
-
*/
|
|
15
|
-
export function selectionRequestPort(world, spawn, servingBodyId) {
|
|
16
|
-
const prove = async (targets) => {
|
|
17
|
-
for (const id of targets)
|
|
18
|
-
await requireBornAkuma(world, id);
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
wait: async ({ targets, ...request }) => {
|
|
22
|
-
await prove(targets);
|
|
23
|
-
// The lower wait owner returns association-free native evidence; the
|
|
24
|
-
// actual request crossing composes its canonical transport shape.
|
|
25
|
-
const native = await executeWaitAkuma({
|
|
26
|
-
path: world,
|
|
27
|
-
ids: targets,
|
|
28
|
-
...request,
|
|
29
|
-
});
|
|
30
|
-
return { ...native, observations: native.observations.map(akumaObservationOf) };
|
|
31
|
-
},
|
|
32
|
-
tell: async ({ target, ...request }) => {
|
|
33
|
-
if (request.interrupt === true && servingBodyId === target)
|
|
34
|
-
throw new AkumaSelfInterruptError(target);
|
|
35
|
-
await prove([target]);
|
|
36
|
-
return await executeTellAkuma({ path: world, id: target, spawn, ...request });
|
|
37
|
-
},
|
|
38
|
-
ask: async ({ target, ...request }) => {
|
|
39
|
-
if (request.interrupt === true && servingBodyId === target)
|
|
40
|
-
throw new AkumaSelfInterruptError(target);
|
|
41
|
-
await prove([target]);
|
|
42
|
-
return await executeAskAkuma({
|
|
43
|
-
spawn,
|
|
44
|
-
path: world,
|
|
45
|
-
id: target,
|
|
46
|
-
...request,
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
kill: async ({ targets, ...request }) => {
|
|
50
|
-
await prove(targets);
|
|
51
|
-
return await executeKillAkuma({ path: world, ids: targets, spawn, ...request });
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|