@astrosheep/keiyaku 4.5.11 → 4.5.13
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/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +135 -377
- package/build/integrations/pi/keiyaku.ts +11 -116
- package/build/src/akuma/akuma-errors.d.ts +1 -0
- package/build/src/akuma/akuma-errors.js +1 -0
- package/build/src/akuma/akuma-handle.d.ts +1 -0
- package/build/src/akuma/akuma-handle.js +6 -7
- package/build/src/akuma/akuma-product.d.ts +6 -8
- package/build/src/akuma/akuma-product.js +141 -57
- package/build/src/akuma/akuma.d.ts +5 -7
- package/build/src/akuma/akuma.js +1 -22
- package/build/src/akuma/archetype.d.ts +6 -5
- package/build/src/akuma/archetype.js +137 -38
- package/build/src/akuma/body.d.ts +5 -5
- package/build/src/akuma/body.js +223 -63
- package/build/src/akuma/call-input.d.ts +4 -0
- package/build/src/akuma/call-input.js +21 -0
- package/build/src/akuma/call-request.d.ts +5 -8
- package/build/src/akuma/call-request.js +28 -73
- package/build/src/akuma/fleet-execution.d.ts +26 -0
- package/build/src/akuma/fleet-execution.js +109 -0
- package/build/src/{library/fleet-result.d.ts → akuma/fleet-observation.d.ts} +13 -57
- package/build/src/{library/fleet-result.js → akuma/fleet-observation.js} +4 -25
- package/build/src/akuma/fleet-request.d.ts +122 -0
- package/build/src/akuma/fleet-request.js +168 -0
- package/build/src/akuma/heart/facts.d.ts +23 -0
- package/build/src/akuma/heart/facts.js +7 -0
- package/build/src/akuma/heart/index.d.ts +43 -4
- package/build/src/akuma/heart/index.js +107 -7
- package/build/src/akuma/heart/request-authority.d.ts +2 -0
- package/build/src/akuma/heart/request-authority.js +28 -3
- package/build/src/akuma/heart/request-rows.d.ts +2 -0
- package/build/src/akuma/heart/request-rows.js +24 -5
- package/build/src/akuma/heart/rows.d.ts +4 -1
- package/build/src/akuma/heart/rows.js +46 -19
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +28 -6
- package/build/src/akuma/heart/storage.d.ts +1 -1
- package/build/src/akuma/heart/tells.d.ts +29 -0
- package/build/src/akuma/heart/tells.js +136 -5
- package/build/src/akuma/heart/timeline.js +9 -3
- package/build/src/akuma/projection-read.js +36 -3
- package/build/src/akuma/projection.js +3 -4
- package/build/src/akuma/provider.d.ts +4 -0
- package/build/src/akuma/provider.js +56 -3
- package/build/src/akuma/providers/claude/index.js +3 -0
- package/build/src/akuma/providers/codex-app-server/index.js +14 -12
- package/build/src/akuma/providers/pi/index.js +7 -1
- package/build/src/akuma/publication.js +65 -49
- package/build/src/akuma/request-lifecycle.d.ts +5 -4
- package/build/src/akuma/request-lifecycle.js +29 -16
- package/build/src/akuma/request-rendezvous.d.ts +15 -12
- package/build/src/akuma/request-rendezvous.js +80 -51
- package/build/src/akuma/request-serve.d.ts +1 -2
- package/build/src/akuma/request-serve.js +94 -39
- package/build/src/akuma/request-wire.d.ts +57 -26
- package/build/src/akuma/request-wire.js +64 -25
- package/build/src/akuma/turn-drive.d.ts +5 -4
- package/build/src/akuma/turn-drive.js +27 -11
- package/build/src/akuma-body.d.ts +4 -6
- package/build/src/akuma-body.js +19 -17
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +14 -0
- package/build/src/cli/accepted.d.ts +1 -1
- package/build/src/cli/accepted.js +1 -0
- package/build/src/cli/commands/akuma-invoke.js +1 -25
- package/build/src/cli/commands/contract-help.d.ts +5 -2
- package/build/src/cli/commands/contract-help.js +62 -12
- package/build/src/cli/commands/contract-invoke.d.ts +5 -0
- package/build/src/cli/commands/contract-invoke.js +26 -1
- package/build/src/cli/commands/contract.js +50 -18
- package/build/src/cli/commands/task-invoke.js +10 -2
- package/build/src/cli/commands/task-query.js +3 -4
- package/build/src/cli/coordinates.d.ts +13 -0
- package/build/src/cli/coordinates.js +38 -24
- package/build/src/cli/draft.d.ts +1 -1
- package/build/src/cli/invoke.js +14 -1
- package/build/src/cli/render/akuma-activity.d.ts +0 -1
- package/build/src/cli/render/akuma-activity.js +5 -38
- package/build/src/cli/render/akuma.js +4 -1
- package/build/src/cli/render/audit.js +4 -1
- package/build/src/cli/render/catalog.js +13 -39
- package/build/src/cli/render/contract.js +4 -14
- package/build/src/cli/render/kanshi-akuma.js +3 -8
- package/build/src/cli/render/kanshi.js +8 -34
- package/build/src/cli/render/nuke.js +7 -3
- package/build/src/cli/render/receipt.d.ts +1 -0
- package/build/src/cli/render/receipt.js +8 -0
- package/build/src/cli/render/refusal.js +4 -3
- package/build/src/cli/render/task.js +4 -37
- package/build/src/cli/render/terminal.d.ts +2 -6
- package/build/src/cli/render/terminal.js +4 -9
- package/build/src/cli/result.d.ts +2 -1
- package/build/src/contract-guidance.js +13 -3
- package/build/src/contract-worktree.d.ts +1 -0
- package/build/src/contract-worktree.js +26 -2
- package/build/src/core/facts/codec.d.ts +2 -1
- package/build/src/core/facts/codec.js +3 -0
- package/build/src/core/facts/gate.d.ts +2 -1
- package/build/src/core/facts/gate.js +63 -0
- package/build/src/core/verbs/abandon.d.ts +2 -1
- package/build/src/core/verbs/abandon.js +16 -0
- package/build/src/core/verbs/amend.d.ts +2 -1
- package/build/src/core/verbs/amend.js +20 -0
- package/build/src/core/verbs/arc.d.ts +2 -1
- package/build/src/core/verbs/arc.js +16 -0
- package/build/src/core/verbs/attestation.d.ts +2 -1
- package/build/src/core/verbs/attestation.js +16 -0
- package/build/src/core/verbs/bind.d.ts +2 -1
- package/build/src/core/verbs/bind.js +16 -0
- package/build/src/core/verbs/deliver.d.ts +2 -1
- package/build/src/core/verbs/deliver.js +16 -0
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +58 -1
- package/build/src/dispatch/association.d.ts +13 -0
- package/build/src/dispatch/association.js +20 -0
- package/build/src/dispatch/index.d.ts +6 -0
- package/build/src/dispatch/index.js +27 -3
- package/build/src/git/hooks.d.ts +9 -1
- package/build/src/git/hooks.js +79 -1
- package/build/src/git/nuke.d.ts +2 -1
- package/build/src/git/nuke.js +6 -11
- package/build/src/git/private-state-seat.d.ts +26 -1
- package/build/src/git/private-state-seat.js +78 -13
- package/build/src/git/process.d.ts +2 -0
- package/build/src/git/reconcile.d.ts +1 -2
- package/build/src/git/reconcile.js +0 -6
- package/build/src/git/repository.d.ts +0 -2
- package/build/src/git/repository.js +27 -25
- package/build/src/git/result-codec.d.ts +29 -0
- package/build/src/git/result-codec.js +306 -0
- package/build/src/git/target-placement.js +2 -8
- package/build/src/git/workspace.d.ts +2 -0
- package/build/src/git/workspace.js +4 -0
- package/build/src/index.d.ts +1 -0
- package/build/src/kanshi/fleet.js +1 -1
- package/build/src/kanshi/read.js +55 -28
- package/build/src/kanshi/report.d.ts +4 -3
- package/build/src/kanshi/select.js +14 -1
- package/build/src/library/address.d.ts +1 -0
- package/build/src/library/address.js +4 -7
- package/build/src/library/akuma-creation.d.ts +5 -3
- package/build/src/library/akuma-creation.js +90 -33
- package/build/src/library/audit.js +2 -1
- package/build/src/library/catalog.d.ts +10 -2
- package/build/src/library/catalog.js +65 -25
- package/build/src/library/composition.d.ts +1 -0
- package/build/src/library/composition.js +1 -0
- package/build/src/library/configuration.d.ts +4 -21
- package/build/src/library/configuration.js +2 -158
- package/build/src/library/continuation.d.ts +20 -1
- package/build/src/library/continuation.js +36 -0
- package/build/src/library/contract-bind.d.ts +1 -0
- package/build/src/library/contract-bind.js +16 -5
- package/build/src/library/contract-forwarding.d.ts +2 -2
- package/build/src/library/contract-forwarding.js +18 -4
- package/build/src/library/contract-handle.js +4 -3
- package/build/src/library/contract-operations.d.ts +5 -9
- package/build/src/library/contract-operations.js +34 -47
- package/build/src/library/contract.d.ts +11 -2
- package/build/src/library/contract.js +21 -1
- package/build/src/library/delivery.d.ts +4 -1
- package/build/src/library/delivery.js +47 -0
- package/build/src/library/fleet.d.ts +4 -136
- package/build/src/library/fleet.js +31 -315
- package/build/src/library/keiyaku.d.ts +7 -3
- package/build/src/library/keiyaku.js +1 -0
- package/build/src/library/mutation.d.ts +431 -3
- package/build/src/library/mutation.js +192 -19
- package/build/src/library/nuke.d.ts +7 -1
- package/build/src/library/nuke.js +18 -4
- package/build/src/library/reconcile.d.ts +14 -0
- package/build/src/library/reconcile.js +22 -8
- package/build/src/library/refusal.d.ts +9 -1
- package/build/src/library/refusal.js +76 -0
- package/build/src/library/region.d.ts +0 -8
- package/build/src/library/region.js +1 -29
- package/build/src/library/result-codec.d.ts +2 -0
- package/build/src/library/result-codec.js +12 -0
- package/build/src/markdown/lex.js +9 -2
- package/build/src/markdown/types.d.ts +2 -1
- package/build/src/markdown/types.js +3 -1
- package/build/src/plugin/akuma-signals.d.ts +12 -0
- package/build/src/plugin/akuma-signals.js +14 -0
- package/build/src/plugin/public.d.ts +51 -0
- package/build/src/plugin/public.js +1 -0
- package/build/src/plugin/runtime.d.ts +14 -0
- package/build/src/plugin/runtime.js +357 -0
- package/build/src/protocol/amend.js +3 -3
- package/build/src/protocol/attempt.d.ts +2 -1
- package/build/src/protocol/attempt.js +1 -1
- package/build/src/protocol/audit.d.ts +1 -1
- package/build/src/protocol/audit.js +1 -1
- package/build/src/protocol/bind.d.ts +3 -1
- package/build/src/protocol/bind.js +26 -0
- package/build/src/protocol/completion.js +0 -1
- package/build/src/protocol/deliver.d.ts +1 -1
- package/build/src/protocol/deliver.js +136 -57
- package/build/src/protocol/intent.d.ts +0 -1
- package/build/src/protocol/intent.js +0 -1
- package/build/src/protocol/operations.d.ts +9 -2
- package/build/src/protocol/operations.js +16 -1
- package/build/src/protocol/outcome.d.ts +3 -0
- package/build/src/protocol/outcome.js +17 -1
- package/build/src/protocol/placement.js +10 -3
- package/build/src/protocol/read/status.d.ts +8 -0
- package/build/src/protocol/read/status.js +49 -0
- package/build/src/protocol/reintegrate.js +10 -3
- package/build/src/protocol/result-codec.d.ts +22 -0
- package/build/src/protocol/result-codec.js +442 -0
- package/build/src/protocol/review.d.ts +1 -1
- package/build/src/protocol/review.js +81 -46
- package/build/src/protocol/run.d.ts +22 -2
- package/build/src/protocol/run.js +119 -29
- package/build/src/runtime/proc/lifecycle.js +1 -1
- package/build/src/runtime/proc/line-rpc.d.ts +7 -1
- package/build/src/runtime/proc/line-rpc.js +49 -9
- package/build/src/runtime/proc/run.d.ts +0 -1
- package/build/src/runtime/proc/run.js +1 -11
- package/build/src/runtime/proc/termination.d.ts +1 -0
- package/build/src/runtime/proc/termination.js +63 -18
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +10 -0
- package/build/src/settings.js +88 -2
- package/build/src/settlement/result-codec.d.ts +2 -0
- package/build/src/settlement/result-codec.js +56 -0
- package/build/src/settlement/settle.d.ts +5 -12
- package/build/src/settlement/settle.js +60 -55
- package/build/src/task/board.d.ts +3 -0
- package/build/src/task/board.js +22 -4
- package/build/src/task/catalog.d.ts +13 -2
- package/build/src/task/catalog.js +59 -5
- package/build/src/task/compose.d.ts +4 -2
- package/build/src/task/compose.js +56 -30
- package/build/src/task/created-observation.d.ts +39 -0
- package/build/src/task/created-observation.js +26 -0
- package/build/src/task/identity.d.ts +6 -0
- package/build/src/task/identity.js +48 -7
- package/build/src/task/index.d.ts +4 -3
- package/build/src/task/index.js +19 -16
- package/build/src/task/input.d.ts +3 -1
- package/build/src/task/input.js +7 -4
- package/build/src/task/lifecycle-operations.d.ts +6 -0
- package/build/src/task/lifecycle-operations.js +116 -0
- package/build/src/task/mutation-result.d.ts +762 -20
- package/build/src/task/mutation-result.js +34 -9
- package/build/src/task/mutation.d.ts +4 -9
- package/build/src/task/mutation.js +17 -52
- package/build/src/task/operation-types.d.ts +114 -0
- package/build/src/task/operation-types.js +1 -0
- package/build/src/task/operations.d.ts +6 -113
- package/build/src/task/operations.js +75 -117
- package/build/src/task/query.d.ts +8 -11
- package/build/src/task/query.js +7 -14
- package/build/src/task/store.d.ts +11 -1
- package/build/src/task/store.js +169 -55
- package/build/src/task/view.d.ts +4 -0
- package/build/src/task/view.js +7 -0
- package/build/src/verification/declaration.d.ts +1 -0
- package/build/src/verification/declaration.js +18 -1
- package/build/src/verification/execution.d.ts +0 -1
- package/build/src/verification/execution.js +5 -5
- package/build/src/world.d.ts +0 -2
- package/build/src/world.js +3 -7
- package/package.json +17 -5
- package/build/src/cli/square-edge.d.ts +0 -7
- package/build/src/cli/square-edge.js +0 -159
- package/build/src/git/ref-migration.d.ts +0 -22
- package/build/src/git/ref-migration.js +0 -55
- package/build/src/library/contract-forwarding-reconciliation-result.d.ts +0 -102
- package/build/src/library/contract-forwarding-reconciliation-result.js +0 -92
- package/build/src/library/contract-forwarding-result.d.ts +0 -4270
- package/build/src/library/contract-forwarding-result.js +0 -521
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import { admitRequest, isRequestInputConflict, readRequest, serveRequest as serveChildRequest, serveUpstreamRequest, voidRequest, } from "./heart/index.js";
|
|
1
|
+
import { admitRequest, beginRequest, isRequestInputConflict, readHeart, readRequest, serveRequest as serveChildRequest, serveUpstreamRequest, voidRequest, unproveRequest, } from "./heart/index.js";
|
|
2
2
|
import { atomicJson, receiptPath, } from "./request-wire.js";
|
|
3
|
-
import { BodyRequestPump as LifecycleBodyRequestPump, } from "./request-lifecycle.js";
|
|
3
|
+
import { BodyRequestPump as LifecycleBodyRequestPump, settleReserved, } from "./request-lifecycle.js";
|
|
4
4
|
export { clearBodyRequestTransport, settleBodyRequests } from "./request-lifecycle.js";
|
|
5
|
+
function replayReference(fact, command) {
|
|
6
|
+
if (fact.state !== "served") {
|
|
7
|
+
throw new Error(`request ${fact.id} completion corruption: cannot replay ${fact.state} request`);
|
|
8
|
+
}
|
|
9
|
+
switch (command.completion) {
|
|
10
|
+
case "child":
|
|
11
|
+
if (!("child" in fact)) {
|
|
12
|
+
throw new Error(`request ${fact.id} completion corruption: child command has a service settlement`);
|
|
13
|
+
}
|
|
14
|
+
return command.projectChild(fact.child);
|
|
15
|
+
case "service":
|
|
16
|
+
if (!("serviceJson" in fact)) {
|
|
17
|
+
throw new Error(`request ${fact.id} completion corruption: service command has a child settlement`);
|
|
18
|
+
}
|
|
19
|
+
return command.projectServiceJson(fact.serviceJson);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
5
22
|
async function projectCommandReceipt(input, fact, command, outcome, failure) {
|
|
6
23
|
const receipt = fact.state === "refused"
|
|
7
24
|
? { id: fact.id, action: fact.action, state: "refused", diagnostic: fact.diagnostic }
|
|
@@ -13,25 +30,22 @@ async function projectCommandReceipt(input, fact, command, outcome, failure) {
|
|
|
13
30
|
evidence: fact.evidence,
|
|
14
31
|
...(failure === undefined ? {} : { failure }),
|
|
15
32
|
}
|
|
16
|
-
:
|
|
17
|
-
?
|
|
33
|
+
: fact.state === "unproven"
|
|
34
|
+
? {
|
|
35
|
+
id: fact.id,
|
|
36
|
+
action: fact.action,
|
|
37
|
+
state: "unproven",
|
|
38
|
+
evidence: fact.evidence,
|
|
39
|
+
...(failure === undefined ? {} : { failure }),
|
|
40
|
+
}
|
|
41
|
+
: outcome === undefined
|
|
18
42
|
? {
|
|
19
43
|
id: fact.id,
|
|
20
44
|
action: fact.action,
|
|
21
45
|
state: "served",
|
|
22
|
-
reference:
|
|
46
|
+
reference: replayReference(fact, command),
|
|
23
47
|
}
|
|
24
|
-
: "
|
|
25
|
-
? {
|
|
26
|
-
id: fact.id,
|
|
27
|
-
action: fact.action,
|
|
28
|
-
state: "served",
|
|
29
|
-
reference: command.projectChild(fact.child),
|
|
30
|
-
}
|
|
31
|
-
: null
|
|
32
|
-
: { id: fact.id, action: fact.action, state: "served", outcome };
|
|
33
|
-
if (receipt === null)
|
|
34
|
-
return;
|
|
48
|
+
: { id: fact.id, action: fact.action, state: "served", outcome };
|
|
35
49
|
try {
|
|
36
50
|
await atomicJson(receiptPath(input.directory, input.transportId), receipt);
|
|
37
51
|
}
|
|
@@ -40,57 +54,95 @@ async function projectCommandReceipt(input, fact, command, outcome, failure) {
|
|
|
40
54
|
throw error;
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
|
-
async function
|
|
44
|
-
const request = command.resolve(input.claim.payload);
|
|
45
|
-
if (request === null)
|
|
46
|
-
throw new Error(`registered request action ${input.claim.action} rejected its payload`);
|
|
57
|
+
async function serveResolvedCommand(input, command, request, execute) {
|
|
47
58
|
let fact = await admitRequest(input.paths, {
|
|
48
59
|
id: input.claim.id,
|
|
49
60
|
action: input.claim.action,
|
|
50
61
|
payloadJson: request.payloadJson,
|
|
51
62
|
admittedAt: input.now(),
|
|
52
|
-
permitted: request.isPermitted(input.
|
|
63
|
+
permitted: request.isPermitted(input.allowed),
|
|
53
64
|
});
|
|
54
65
|
if (fact.state !== "admitted") {
|
|
55
|
-
await projectCommandReceipt(input, fact,
|
|
66
|
+
await projectCommandReceipt(input, fact, command);
|
|
56
67
|
return true;
|
|
57
68
|
}
|
|
58
69
|
if (!input.admissionOpen()) {
|
|
59
70
|
fact = await voidRequest(input.paths, fact.id, "body closed request admission");
|
|
60
|
-
await projectCommandReceipt(input, fact,
|
|
71
|
+
await projectCommandReceipt(input, fact, command);
|
|
61
72
|
return true;
|
|
62
73
|
}
|
|
63
74
|
try {
|
|
64
|
-
const
|
|
75
|
+
const facts = {
|
|
65
76
|
id: fact.id,
|
|
66
77
|
admittedAt: fact.admittedAt,
|
|
67
78
|
requester: fact.requester,
|
|
68
79
|
signal: input.signal,
|
|
69
|
-
upstream: input.upstream,
|
|
70
|
-
paths: input.paths,
|
|
71
|
-
parent: input.parent,
|
|
72
|
-
spawn: input.spawn,
|
|
73
80
|
admissionOpen: input.admissionOpen,
|
|
74
|
-
}
|
|
75
|
-
fact
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
: await serveUpstreamRequest(input.paths, fact.id, served.serviceJson);
|
|
79
|
-
await projectCommandReceipt(input, fact, request, { kind: "returned", result: served.result });
|
|
81
|
+
};
|
|
82
|
+
const served = await execute(fact, facts);
|
|
83
|
+
fact = served.fact;
|
|
84
|
+
await projectCommandReceipt(input, fact, command, served.outcome);
|
|
80
85
|
}
|
|
81
86
|
catch (error) {
|
|
82
87
|
const failure = encodedFailure(request, error);
|
|
83
88
|
const current = await readRequest(input.paths, fact.id);
|
|
84
89
|
if (current === null)
|
|
85
90
|
throw error;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
if (current.state === "reserved") {
|
|
92
|
+
const parent = (await readHeart(input.paths)).soul;
|
|
93
|
+
if (parent === null)
|
|
94
|
+
throw new Error("reserved request settlement requires a born parent Soul");
|
|
95
|
+
if (!(await settleReserved(input.paths, parent, current, input.now, input.signal)))
|
|
96
|
+
return true;
|
|
97
|
+
fact = (await readRequest(input.paths, fact.id)) ?? current;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
fact =
|
|
101
|
+
current.state === "admitted"
|
|
102
|
+
? await voidRequest(input.paths, fact.id, diagnostic(error))
|
|
103
|
+
: current.state === "begun"
|
|
104
|
+
? provesNoProductEffect(failure)
|
|
105
|
+
? await voidRequest(input.paths, fact.id, diagnostic(error))
|
|
106
|
+
: await unproveRequest(input.paths, fact.id, diagnostic(error))
|
|
107
|
+
: current;
|
|
108
|
+
}
|
|
109
|
+
await projectCommandReceipt(input, fact, command, undefined, failure);
|
|
91
110
|
}
|
|
92
111
|
return true;
|
|
93
112
|
}
|
|
113
|
+
async function serveChildCommand(input, command) {
|
|
114
|
+
const request = command.resolve(input.claim.payload);
|
|
115
|
+
if (request === null)
|
|
116
|
+
throw new Error(`registered request action ${input.claim.action} rejected its payload`);
|
|
117
|
+
return await serveResolvedCommand(input, command, request, async (fact, facts) => {
|
|
118
|
+
const served = await request.execute(facts);
|
|
119
|
+
return {
|
|
120
|
+
fact: await serveChildRequest(input.paths, fact.id, served.child),
|
|
121
|
+
outcome: { kind: "returned", result: served.result },
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
async function serveServiceCommand(input, command) {
|
|
126
|
+
const request = command.resolve(input.claim.payload);
|
|
127
|
+
if (request === null)
|
|
128
|
+
throw new Error(`registered request action ${input.claim.action} rejected its payload`);
|
|
129
|
+
return await serveResolvedCommand(input, command, request, async (fact, facts) => {
|
|
130
|
+
await beginRequest(input.paths, fact.id);
|
|
131
|
+
const served = await request.execute(facts);
|
|
132
|
+
return {
|
|
133
|
+
fact: await serveUpstreamRequest(input.paths, fact.id, served.serviceJson),
|
|
134
|
+
outcome: { kind: "returned", result: served.result },
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async function serveCommand(input, command) {
|
|
139
|
+
switch (command.completion) {
|
|
140
|
+
case "child":
|
|
141
|
+
return await serveChildCommand(input, command);
|
|
142
|
+
case "service":
|
|
143
|
+
return await serveServiceCommand(input, command);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
94
146
|
function diagnostic(error) {
|
|
95
147
|
return error instanceof Error ? error.message : String(error);
|
|
96
148
|
}
|
|
@@ -103,6 +155,9 @@ function encodedFailure(request, error) {
|
|
|
103
155
|
return undefined;
|
|
104
156
|
}
|
|
105
157
|
}
|
|
158
|
+
function provesNoProductEffect(failure) {
|
|
159
|
+
return failure !== null && typeof failure === "object" && failure.kind === "refused";
|
|
160
|
+
}
|
|
106
161
|
export async function serveRequest(input) {
|
|
107
162
|
const command = input.commands[input.claim.action];
|
|
108
163
|
if (command === undefined) {
|
|
@@ -57,13 +57,19 @@ declare const receiptEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
57
57
|
state: z.ZodLiteral<"voided">;
|
|
58
58
|
evidence: z.ZodString;
|
|
59
59
|
failure: z.ZodOptional<z.ZodUnknown>;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
action: z.ZodString;
|
|
63
|
+
state: z.ZodLiteral<"unproven">;
|
|
64
|
+
evidence: z.ZodString;
|
|
65
|
+
failure: z.ZodOptional<z.ZodUnknown>;
|
|
60
66
|
}, z.core.$strict>]>;
|
|
61
67
|
export type RequestEnvelope = z.infer<typeof requestEnvelopeSchema>;
|
|
62
68
|
/**
|
|
63
69
|
* A Body Request operation is owned by the verb that defines its public
|
|
64
70
|
* values. Transport only carries the opaque values produced here.
|
|
65
71
|
*/
|
|
66
|
-
export type
|
|
72
|
+
export type RequestProtocol<Input, Output, Reference> = Readonly<{
|
|
67
73
|
action: string;
|
|
68
74
|
encodeRequest(input: Input): unknown;
|
|
69
75
|
decodeRequest(payload: unknown): Input | null;
|
|
@@ -71,43 +77,68 @@ export type RequestCommand<Input, Output, Service, Reference = Service, Context
|
|
|
71
77
|
decodeResult(result: unknown): Output;
|
|
72
78
|
encodeFailure?(error: unknown): unknown | null;
|
|
73
79
|
decodeFailure?(failure: unknown): Error | null;
|
|
74
|
-
encodeService(service: Service): unknown;
|
|
75
|
-
decodeService(service: unknown): Service;
|
|
76
|
-
projectService(service: Service): Reference;
|
|
77
|
-
projectChild?(child: string): Reference;
|
|
78
80
|
decodeReference(reference: unknown): Reference;
|
|
79
|
-
/** The operation owner proves the Body-owned execution capability before use. */
|
|
80
|
-
decodeExecutionContext(value: unknown): Context;
|
|
81
81
|
isPermitted(allowed: readonly string[]): boolean;
|
|
82
|
-
|
|
82
|
+
}>;
|
|
83
|
+
export type ExecutionFacts = Readonly<{
|
|
84
|
+
id: string;
|
|
85
|
+
admittedAt: string;
|
|
86
|
+
requester: string;
|
|
87
|
+
signal: AbortSignal;
|
|
88
|
+
admissionOpen(): boolean;
|
|
89
|
+
}>;
|
|
90
|
+
export type ChildRequestCommand<Input, Output, Reference> = Readonly<{
|
|
91
|
+
completion: "child";
|
|
92
|
+
protocol: RequestProtocol<Input, Output, Reference>;
|
|
93
|
+
projectChild(child: string): Reference;
|
|
94
|
+
execute(input: Input, facts: ExecutionFacts): Promise<Readonly<{
|
|
83
95
|
result: Output;
|
|
84
|
-
}> & (Readonly<{
|
|
85
|
-
service: Service;
|
|
86
|
-
}> | Readonly<{
|
|
87
96
|
child: string;
|
|
88
|
-
}
|
|
97
|
+
}>>;
|
|
89
98
|
}>;
|
|
90
|
-
export type
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
export type ServiceRequestCommand<Input, Output, Service, Reference> = Readonly<{
|
|
100
|
+
completion: "service";
|
|
101
|
+
protocol: RequestProtocol<Input, Output, Reference>;
|
|
102
|
+
encodeService(service: Service): unknown;
|
|
103
|
+
decodeService(service: unknown): Service;
|
|
104
|
+
projectService(service: Service): Reference;
|
|
105
|
+
execute(input: Input, facts: ExecutionFacts): Promise<Readonly<{
|
|
106
|
+
result: Output;
|
|
107
|
+
service: Service;
|
|
108
|
+
}>>;
|
|
93
109
|
}>;
|
|
94
|
-
|
|
110
|
+
type ErasedRequest = Readonly<{
|
|
95
111
|
payloadJson: string;
|
|
96
112
|
isPermitted(allowed: readonly string[]): boolean;
|
|
97
|
-
execute(context: unknown): Promise<ErasedRequestExecution>;
|
|
98
113
|
encodeFailure(error: unknown): unknown | null;
|
|
99
|
-
projectServiceJson(serviceJson: string): unknown;
|
|
100
|
-
projectChild(child: string): unknown;
|
|
101
114
|
}>;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
115
|
+
type ErasedChildRequest = ErasedRequest & Readonly<{
|
|
116
|
+
execute(facts: ExecutionFacts): Promise<Readonly<{
|
|
117
|
+
result: unknown;
|
|
118
|
+
child: string;
|
|
119
|
+
}>>;
|
|
120
|
+
}>;
|
|
121
|
+
type ErasedServiceRequest = ErasedRequest & Readonly<{
|
|
122
|
+
execute(facts: ExecutionFacts): Promise<Readonly<{
|
|
123
|
+
result: unknown;
|
|
124
|
+
serviceJson: string;
|
|
125
|
+
}>>;
|
|
126
|
+
}>;
|
|
127
|
+
export type ErasedRequestCommand = Readonly<{
|
|
128
|
+
action: string;
|
|
129
|
+
completion: "child";
|
|
130
|
+
projectChild(child: string): unknown;
|
|
131
|
+
resolve(payload: unknown): ErasedChildRequest | null;
|
|
105
132
|
}> | Readonly<{
|
|
106
|
-
|
|
107
|
-
|
|
133
|
+
action: string;
|
|
134
|
+
completion: "service";
|
|
135
|
+
projectServiceJson(serviceJson: string): unknown;
|
|
136
|
+
resolve(payload: unknown): ErasedServiceRequest | null;
|
|
108
137
|
}>;
|
|
109
138
|
/** Erases only static TypeScript parameters; each operation codec remains captured by its owner descriptor. */
|
|
110
|
-
export declare function eraseRequestCommand<Input, Output,
|
|
139
|
+
export declare function eraseRequestCommand<Input, Output, Reference>(command: ChildRequestCommand<Input, Output, Reference>): ErasedRequestCommand;
|
|
140
|
+
export declare function eraseRequestCommand<Input, Output, Service, Reference>(command: ServiceRequestCommand<Input, Output, Service, Reference>): ErasedRequestCommand;
|
|
141
|
+
export declare function composeRequestCommands(...maps: readonly Readonly<Record<string, ErasedRequestCommand>>[]): Readonly<Record<string, ErasedRequestCommand>>;
|
|
111
142
|
export type UpstreamRequestFailure = z.infer<typeof upstreamRequestFailureSchema>;
|
|
112
143
|
export type ReturnedEnvelope = z.infer<typeof returnedEnvelopeSchema>;
|
|
113
144
|
export type ReceiptEnvelope = z.infer<typeof receiptEnvelopeSchema>;
|
|
@@ -115,5 +146,5 @@ export declare function decodeEnvelope(bytes: string, fileId: string): RequestEn
|
|
|
115
146
|
export declare function decodeReceiptEnvelope(bytes: string, id: string, action: string): ReceiptEnvelope | null;
|
|
116
147
|
export declare function requestPath(directory: string, id: string): string;
|
|
117
148
|
export declare function receiptPath(directory: string, id: string): string;
|
|
118
|
-
export declare function atomicJson(path: string, value: unknown): Promise<void>;
|
|
149
|
+
export declare function atomicJson(path: string, value: unknown, signal?: AbortSignal, beforeRename?: () => void | Promise<void>): Promise<void>;
|
|
119
150
|
export {};
|
|
@@ -29,37 +29,74 @@ const receiptEnvelopeSchema = z.union([
|
|
|
29
29
|
failure: z.unknown().optional(),
|
|
30
30
|
})
|
|
31
31
|
.strict(),
|
|
32
|
+
z
|
|
33
|
+
.object({
|
|
34
|
+
id: requestIdSchema,
|
|
35
|
+
action: actionSchema,
|
|
36
|
+
state: z.literal("unproven"),
|
|
37
|
+
evidence: z.string(),
|
|
38
|
+
failure: z.unknown().optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict(),
|
|
32
41
|
]);
|
|
33
|
-
/** Erases only static TypeScript parameters; each operation codec remains captured by its owner descriptor. */
|
|
34
42
|
export function eraseRequestCommand(command) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const input = command.decodeRequest(payload);
|
|
39
|
-
if (input === null)
|
|
40
|
-
return null;
|
|
43
|
+
const { protocol } = command;
|
|
44
|
+
switch (command.completion) {
|
|
45
|
+
case "child":
|
|
41
46
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
action: protocol.action,
|
|
48
|
+
completion: "child",
|
|
49
|
+
projectChild: command.projectChild,
|
|
50
|
+
resolve: (payload) => {
|
|
51
|
+
const input = protocol.decodeRequest(payload);
|
|
52
|
+
if (input === null)
|
|
53
|
+
return null;
|
|
54
|
+
return {
|
|
55
|
+
payloadJson: JSON.stringify(protocol.encodeRequest(input)),
|
|
56
|
+
isPermitted: (allowed) => protocol.isPermitted(allowed),
|
|
57
|
+
execute: async (facts) => {
|
|
58
|
+
const served = await command.execute(input, facts);
|
|
59
|
+
return { result: protocol.encodeResult(served.result), child: served.child };
|
|
60
|
+
},
|
|
61
|
+
encodeFailure: (error) => protocol.encodeFailure?.(error) ?? null,
|
|
62
|
+
};
|
|
52
63
|
},
|
|
53
|
-
|
|
64
|
+
};
|
|
65
|
+
case "service":
|
|
66
|
+
return {
|
|
67
|
+
action: protocol.action,
|
|
68
|
+
completion: "service",
|
|
54
69
|
projectServiceJson: (serviceJson) => command.projectService(command.decodeService(JSON.parse(serviceJson))),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
resolve: (payload) => {
|
|
71
|
+
const input = protocol.decodeRequest(payload);
|
|
72
|
+
if (input === null)
|
|
73
|
+
return null;
|
|
74
|
+
return {
|
|
75
|
+
payloadJson: JSON.stringify(protocol.encodeRequest(input)),
|
|
76
|
+
isPermitted: (allowed) => protocol.isPermitted(allowed),
|
|
77
|
+
execute: async (facts) => {
|
|
78
|
+
const served = await command.execute(input, facts);
|
|
79
|
+
return {
|
|
80
|
+
result: protocol.encodeResult(served.result),
|
|
81
|
+
serviceJson: JSON.stringify(command.encodeService(served.service)),
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
encodeFailure: (error) => protocol.encodeFailure?.(error) ?? null,
|
|
85
|
+
};
|
|
59
86
|
},
|
|
60
87
|
};
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function composeRequestCommands(...maps) {
|
|
91
|
+
const commands = Object.create(null);
|
|
92
|
+
for (const map of maps) {
|
|
93
|
+
for (const [action, command] of Object.entries(map)) {
|
|
94
|
+
if (Object.hasOwn(commands, action))
|
|
95
|
+
throw new Error(`duplicate request command action: ${action}`);
|
|
96
|
+
commands[action] = command;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return commands;
|
|
63
100
|
}
|
|
64
101
|
export function decodeEnvelope(bytes, fileId) {
|
|
65
102
|
let decoded;
|
|
@@ -89,10 +126,12 @@ export function requestPath(directory, id) {
|
|
|
89
126
|
export function receiptPath(directory, id) {
|
|
90
127
|
return join(directory, `${id}.receipt.json`);
|
|
91
128
|
}
|
|
92
|
-
export async function atomicJson(path, value) {
|
|
129
|
+
export async function atomicJson(path, value, signal, beforeRename) {
|
|
93
130
|
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
94
131
|
try {
|
|
95
132
|
await writeFile(temporary, `${JSON.stringify(value)}\n`, { flag: "wx" });
|
|
133
|
+
await beforeRename?.();
|
|
134
|
+
signal?.throwIfAborted();
|
|
96
135
|
await rename(temporary, path);
|
|
97
136
|
}
|
|
98
137
|
finally {
|
|
@@ -1,8 +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 ProviderAdapter, type TurnResult } from "./provider.js";
|
|
4
|
-
import type
|
|
5
|
-
import type
|
|
4
|
+
import { type AkumaCallRequestChildLaunch } from "./call-request.js";
|
|
5
|
+
import { type ErasedRequestCommand } from "./request-wire.js";
|
|
6
6
|
import { BodySupervisor } from "./body-supervisor.js";
|
|
7
7
|
import type { OwnedProcess } from "../runtime/proc/run.js";
|
|
8
8
|
export declare function turnRecipe(paths: AkumaPaths, soul: Soul): Promise<Readonly<{
|
|
@@ -25,10 +25,11 @@ export type DriveTurnInput = Readonly<{
|
|
|
25
25
|
body: string;
|
|
26
26
|
call?: string;
|
|
27
27
|
launchTells: readonly TellFact[];
|
|
28
|
+
schemaJson?: string;
|
|
28
29
|
supervisor: BodySupervisor;
|
|
29
30
|
runtimeSpawn(launch: AkumaCallRequestChildLaunch): Promise<OwnedProcess | void>;
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
world: import("../world.js").WorldRoot;
|
|
32
|
+
externalCommands: Readonly<Record<string, ErasedRequestCommand>>;
|
|
32
33
|
now(): string;
|
|
33
34
|
}>;
|
|
34
35
|
export declare function driveTurn(input: DriveTurnInput): Promise<(DrivenTurn & Readonly<{
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { abortableDelay } from "./abort.js";
|
|
2
2
|
/* eslint-disable max-lines-per-function -- Turn setup and consumption each preserve one ordered lifecycle transaction. */
|
|
3
|
-
import { appendActivity, beginTurn, breakBody, heartExists, readHeart, recordSession, recordTellDeliveries, recordTellReceipt, } from "./heart/index.js";
|
|
3
|
+
import { appendActivity, beginTurn, bindTellsToTurn, breakBody, drainPendingTells, heartExists, readHeart, recordSession, recordTellDeliveries, recordTellReceipt, } from "./heart/index.js";
|
|
4
4
|
import { encodeAgentEvent, } from "./provider.js";
|
|
5
|
+
import { akumaCallRequestCommands } from "./call-request.js";
|
|
5
6
|
import { BodyRequestPump } from "./request-serve.js";
|
|
7
|
+
import { composeRequestCommands } from "./request-wire.js";
|
|
6
8
|
import { CONTROL_RESPONSE_MS } from "./body-supervisor.js";
|
|
7
9
|
function serializeEffects() {
|
|
8
10
|
let tail = Promise.resolve();
|
|
@@ -68,19 +70,29 @@ async function startTurnDrive(input) {
|
|
|
68
70
|
const { cwd, options, session } = await turnRecipe(input.paths, input.soul);
|
|
69
71
|
if (session !== undefined && input.adapter.resume === undefined)
|
|
70
72
|
return { kind: "resume-unsupported" };
|
|
73
|
+
const boundTells = drainPendingTells(input.launchTells);
|
|
74
|
+
const schemaJson = input.schemaJson ?? boundTells.find((tell) => tell.schemaJson !== undefined)?.schemaJson;
|
|
71
75
|
const turn = await beginTurn(input.paths, {
|
|
72
76
|
bodySequence: input.bodySequence,
|
|
73
77
|
startedAt: input.now(),
|
|
74
78
|
...(input.call === undefined ? {} : { call: input.call }),
|
|
79
|
+
...(schemaJson === undefined ? {} : { schemaJson }),
|
|
75
80
|
});
|
|
81
|
+
if (boundTells.length > 0) {
|
|
82
|
+
await bindTellsToTurn(input.paths, {
|
|
83
|
+
turnSequence: turn.sequence,
|
|
84
|
+
tellIds: boundTells.map((tell) => tell.id),
|
|
85
|
+
boundAt: input.now(),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const { world, paths, soul: parent, runtimeSpawn: spawn, externalCommands } = input;
|
|
89
|
+
const commands = composeRequestCommands(akumaCallRequestCommands({ world, paths, parent, spawn }), externalCommands);
|
|
76
90
|
const requests = await BodyRequestPump.open({
|
|
77
91
|
paths: input.paths,
|
|
78
|
-
|
|
92
|
+
allowed: input.soul.allowed,
|
|
79
93
|
bodySequence: input.bodySequence,
|
|
80
94
|
now: input.now,
|
|
81
|
-
|
|
82
|
-
...(input.upstream === undefined ? {} : { upstream: input.upstream }),
|
|
83
|
-
commands: input.commands,
|
|
95
|
+
commands,
|
|
84
96
|
signal: input.supervisor.signal,
|
|
85
97
|
});
|
|
86
98
|
const driveController = new AbortController();
|
|
@@ -97,11 +109,12 @@ async function startTurnDrive(input) {
|
|
|
97
109
|
});
|
|
98
110
|
const driveInput = {
|
|
99
111
|
body: input.body,
|
|
100
|
-
launchTells:
|
|
112
|
+
launchTells: boundTells.map((tell) => ({ id: tell.id, text: tell.body })),
|
|
101
113
|
cwd,
|
|
102
114
|
options,
|
|
103
115
|
signal: driveController.signal,
|
|
104
116
|
requests: { dir: requests.directory },
|
|
117
|
+
...(schemaJson === undefined ? {} : { schemaJson }),
|
|
105
118
|
};
|
|
106
119
|
const attempt = session === undefined
|
|
107
120
|
? input.adapter.start({ ...driveInput, session: { kind: "fresh" } })
|
|
@@ -121,8 +134,8 @@ async function startTurnDrive(input) {
|
|
|
121
134
|
}
|
|
122
135
|
return { kind: "stopped" };
|
|
123
136
|
}
|
|
124
|
-
if (
|
|
125
|
-
await recordTellDeliveries(input.paths,
|
|
137
|
+
if (boundTells.length > 0)
|
|
138
|
+
await recordTellDeliveries(input.paths, boundTells.map((tell) => ({
|
|
126
139
|
tellId: tell.id,
|
|
127
140
|
route: "launch",
|
|
128
141
|
turnSequence: turn.sequence,
|
|
@@ -226,13 +239,14 @@ function observeCompletionFailure(drive) {
|
|
|
226
239
|
async function submitPendingLiveTells(writers, pending, attempted, tellLive) {
|
|
227
240
|
const { input, turnSequence, drive, writeWitness, mayWrite } = writers;
|
|
228
241
|
for (const tell of pending) {
|
|
229
|
-
if (attempted.has(tell.id))
|
|
242
|
+
if (attempted.has(tell.id) || tell.schemaJson !== undefined)
|
|
230
243
|
continue;
|
|
231
244
|
attempted.add(tell.id);
|
|
232
245
|
const outcome = await writeWitness(async () => {
|
|
233
246
|
const submission = await tellLive({ id: tell.id, text: tell.body });
|
|
234
247
|
if (!mayWrite() || submission.kind === "turn-ended")
|
|
235
248
|
return "turn-ended";
|
|
249
|
+
await bindTellsToTurn(input.paths, { turnSequence, tellIds: [tell.id], boundAt: input.now() });
|
|
236
250
|
await recordTellDeliveries(input.paths, [
|
|
237
251
|
{
|
|
238
252
|
tellId: tell.id,
|
|
@@ -261,7 +275,9 @@ async function stopActiveDrive(input, active) {
|
|
|
261
275
|
}
|
|
262
276
|
}
|
|
263
277
|
function hasUnattemptedTell(liveTells, tellPump, pending, attempted) {
|
|
264
|
-
return liveTells &&
|
|
278
|
+
return (liveTells &&
|
|
279
|
+
tellPump === null &&
|
|
280
|
+
pending.some((tell) => !attempted.has(tell.id) && tell.schemaJson === undefined));
|
|
265
281
|
}
|
|
266
282
|
async function settleCompletion(result, session, active) {
|
|
267
283
|
try {
|
|
@@ -276,7 +292,7 @@ async function consumeTurnDrive(input, active) {
|
|
|
276
292
|
const { turnSequence, drive, requests, resume } = active;
|
|
277
293
|
let heart = input.supervisor.current();
|
|
278
294
|
let turnSession = resume;
|
|
279
|
-
const attempted = new Set(input.launchTells.map((tell) => tell.id));
|
|
295
|
+
const attempted = new Set(drainPendingTells(input.launchTells).map((tell) => tell.id));
|
|
280
296
|
const writeWitness = serializeEffects();
|
|
281
297
|
let writesOpen = true;
|
|
282
298
|
const mayWrite = () => writesOpen && !input.supervisor.signal.aborted;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { type BodyLaunch } from "./akuma/body.js";
|
|
2
|
-
import {
|
|
3
|
-
import { type FleetRequestPort } from "./library/fleet.js";
|
|
4
|
-
import { type ContractRequestPort } from "./library/contract-operations.js";
|
|
5
|
-
import { type TaskMutationRequestPort } from "./task/mutation.js";
|
|
2
|
+
import { World } from "./world.js";
|
|
6
3
|
type BodyProcessConfiguration = Readonly<{
|
|
7
4
|
home?: string;
|
|
8
5
|
gitPath?: string;
|
|
9
6
|
}>;
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
7
|
+
export declare function externalRequestCommandsFor(launch: BodyLaunch, processConfiguration: BodyProcessConfiguration): Promise<Readonly<{
|
|
8
|
+
world: Awaited<ReturnType<typeof World.prove>>;
|
|
9
|
+
commands: Readonly<Record<string, import("./akuma/request-wire.js").ErasedRequestCommand>>;
|
|
12
10
|
}>>;
|
|
13
11
|
export {};
|
package/build/src/akuma-body.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { LEASH_HELD_EXIT, runAkumaBody } from "./akuma/body.js";
|
|
2
|
-
import { akumaCallRequestCommands } from "./akuma/call-request.js";
|
|
3
2
|
import { worldRootForAkumaPaths } from "./akuma/identity.js";
|
|
4
3
|
import { World } from "./world.js";
|
|
5
|
-
import { executeKillAkuma, executeTellAkuma, executeWaitAkuma } from "./
|
|
6
|
-
import { fleetRequestCommands } from "./
|
|
7
|
-
import {
|
|
4
|
+
import { executeKillAkuma, executeTellAkuma, executeWaitAkuma } from "./akuma/fleet-execution.js";
|
|
5
|
+
import { fleetRequestCommands } from "./akuma/fleet-request.js";
|
|
6
|
+
import { worktreeHooksFrom } from "./git/hooks.js";
|
|
8
7
|
import { contractRequestCommands, executeForwardedAudit, executeForwardedDeliver, executeForwardedReview, } from "./library/contract-operations.js";
|
|
9
8
|
import { Repo } from "./library/repo.js";
|
|
10
|
-
import { settings } from "./settings.js";
|
|
9
|
+
import { requireBranchesToBeUpToDateFrom, settings } from "./settings.js";
|
|
11
10
|
import { executeTaskMutation, taskMutationRequestCommands } from "./task/mutation.js";
|
|
11
|
+
import { composeRequestCommands } from "./akuma/request-wire.js";
|
|
12
12
|
async function contractDependencies(repoRoot, processConfiguration) {
|
|
13
13
|
const repo = await Repo.at({
|
|
14
14
|
path: repoRoot,
|
|
@@ -65,11 +65,8 @@ function contractUpstream(processConfiguration) {
|
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
const world = await World.prove(worldRootForAkumaPaths(launch.paths));
|
|
68
|
+
function fleetRequestPort(world) {
|
|
70
69
|
return {
|
|
71
|
-
launchWorld: () => world,
|
|
72
|
-
...contractUpstream(processConfiguration),
|
|
73
70
|
wait: async (input) => await executeWaitAkuma({
|
|
74
71
|
path: world,
|
|
75
72
|
ids: input.targets,
|
|
@@ -89,6 +86,10 @@ export async function upstreamFor(launch, processConfiguration) {
|
|
|
89
86
|
const result = await executeKillAkuma({ path: world, ids: input.targets, signal: input.signal });
|
|
90
87
|
return result;
|
|
91
88
|
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function taskMutationRequestPort() {
|
|
92
|
+
return {
|
|
92
93
|
task: async (input) => await executeTaskMutation({
|
|
93
94
|
world: input.world,
|
|
94
95
|
request: input.request,
|
|
@@ -110,12 +111,13 @@ const configuration = {
|
|
|
110
111
|
...(mappedHome === undefined || mappedHome.length === 0 ? {} : { home: mappedHome }),
|
|
111
112
|
...(mappedGitPath === undefined ? {} : { gitPath: mappedGitPath }),
|
|
112
113
|
};
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
114
|
+
export async function externalRequestCommandsFor(launch, processConfiguration) {
|
|
115
|
+
const world = await World.prove(worldRootForAkumaPaths(launch.paths));
|
|
116
|
+
return {
|
|
117
|
+
world,
|
|
118
|
+
commands: composeRequestCommands(fleetRequestCommands(fleetRequestPort(world)), contractRequestCommands(contractUpstream(processConfiguration)), taskMutationRequestCommands(taskMutationRequestPort())),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const { world, commands: externalCommands } = await externalRequestCommandsFor(launch, configuration);
|
|
122
|
+
if ((await runAkumaBody(launch, world, externalCommands)) === "held")
|
|
121
123
|
process.exitCode = LEASH_HELD_EXIT;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DEFAULT_BOUNDED_LIST_LIMIT = 50;
|
|
2
|
+
export declare const MAX_BOUNDED_LIST_LIMIT = 500;
|
|
3
|
+
export type BoundedList<Row> = Readonly<{
|
|
4
|
+
rows: readonly Row[];
|
|
5
|
+
hasMore: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function boundedListLimit(value?: unknown): number;
|
|
8
|
+
export declare function projectBoundedList<Row>(rows: readonly Row[], limit: number): BoundedList<Row>;
|