@astrosheep/keiyaku 4.5.7 → 4.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/opencode.js +3 -2
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +12 -11
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +33 -12
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +35 -96
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +28 -49
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +21 -15
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +148 -89
- package/build/src/akuma/abort.d.ts +2 -1
- package/build/src/akuma/abort.js +6 -23
- package/build/src/akuma/akuma-handle.js +4 -2
- package/build/src/akuma/akuma-observe.d.ts +2 -0
- package/build/src/akuma/akuma-observe.js +1 -0
- package/build/src/akuma/akuma-product.js +9 -7
- package/build/src/akuma/akuma.d.ts +392 -9
- package/build/src/akuma/akuma.js +31 -1
- package/build/src/akuma/allowed.d.ts +1 -1
- package/build/src/akuma/allowed.js +1 -0
- package/build/src/akuma/archetype.js +1 -1
- package/build/src/akuma/body.d.ts +8 -5
- package/build/src/akuma/body.js +12 -5
- package/build/src/akuma/call-request.d.ts +80 -0
- package/build/src/akuma/call-request.js +211 -0
- package/build/src/akuma/heart/facts.d.ts +16 -78
- package/build/src/akuma/heart/facts.js +11 -0
- package/build/src/akuma/heart/index.d.ts +3 -2
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/request-authority.d.ts +5 -4
- package/build/src/akuma/heart/request-authority.js +20 -34
- package/build/src/akuma/heart/request-rows.js +12 -23
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +5 -13
- package/build/src/akuma/index.d.ts +1 -1
- package/build/src/akuma/index.js +1 -1
- package/build/src/akuma/projection-read.d.ts +1 -0
- package/build/src/akuma/projection-read.js +8 -1
- package/build/src/akuma/projection.d.ts +907 -137
- package/build/src/akuma/projection.js +193 -9
- package/build/src/akuma/provider.d.ts +30 -3
- package/build/src/akuma/provider.js +111 -0
- package/build/src/akuma/providers/acp/core.d.ts +2 -2
- package/build/src/akuma/providers/acp/core.js +13 -6
- package/build/src/akuma/providers/acp/index.js +5 -4
- package/build/src/akuma/providers/claude/events.d.ts +2 -2
- package/build/src/akuma/providers/claude/events.js +16 -3
- package/build/src/akuma/providers/claude/index.d.ts +3 -3
- package/build/src/akuma/providers/claude/index.js +16 -5
- package/build/src/akuma/providers/codex-app-server/events.d.ts +2 -2
- package/build/src/akuma/providers/codex-app-server/events.js +25 -4
- package/build/src/akuma/providers/codex-app-server/index.js +18 -6
- package/build/src/akuma/providers/grok-build/index.js +5 -4
- package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
- package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
- package/build/src/akuma/providers/pi/index.js +72 -58
- package/build/src/akuma/request-lifecycle.d.ts +4 -10
- package/build/src/akuma/request-lifecycle.js +7 -5
- package/build/src/akuma/request-rendezvous.d.ts +26 -0
- package/build/src/akuma/request-rendezvous.js +100 -0
- package/build/src/akuma/request-serve.d.ts +6 -66
- package/build/src/akuma/request-serve.js +83 -210
- package/build/src/akuma/request-wire.d.ts +109 -115
- package/build/src/akuma/request-wire.js +63 -318
- package/build/src/akuma/requests.d.ts +19 -47
- package/build/src/akuma/requests.js +51 -107
- package/build/src/akuma/turn-drive.d.ts +5 -3
- package/build/src/akuma/turn-drive.js +39 -11
- package/build/src/akuma-body.d.ts +7 -2
- package/build/src/akuma-body.js +68 -46
- package/build/src/body/amend.js +18 -19
- package/build/src/cli/accepted.d.ts +1 -1
- package/build/src/cli/accepted.js +2 -2
- package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
- package/build/src/cli/commands/akuma-invoke.js +17 -9
- package/build/src/cli/commands/akuma.js +8 -8
- package/build/src/cli/commands/contract-invoke.d.ts +3 -2
- package/build/src/cli/commands/contract-invoke.js +42 -30
- package/build/src/cli/commands/contract.d.ts +16 -20
- package/build/src/cli/commands/contract.js +58 -25
- package/build/src/cli/commands/install.d.ts +2 -1
- package/build/src/cli/commands/install.js +3 -2
- package/build/src/cli/commands/task-invoke.d.ts +3 -0
- package/build/src/cli/commands/task-invoke.js +23 -140
- package/build/src/cli/commands/task.js +54 -20
- package/build/src/cli/invoke.js +39 -25
- package/build/src/cli/main.js +2 -1
- package/build/src/cli/parse.d.ts +2 -2
- package/build/src/cli/parse.js +56 -27
- package/build/src/cli/render/akuma-activity.d.ts +3 -0
- package/build/src/cli/render/akuma-activity.js +45 -29
- package/build/src/cli/render/akuma-tool.d.ts +5 -1
- package/build/src/cli/render/akuma.js +4 -8
- package/build/src/cli/render/audit.js +1 -1
- package/build/src/cli/render/catalog.js +80 -21
- package/build/src/cli/render/contract-observation.d.ts +2 -0
- package/build/src/cli/render/contract-observation.js +11 -0
- package/build/src/cli/render/contract.js +35 -62
- package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
- package/build/src/cli/render/kanshi-akuma.js +132 -0
- package/build/src/cli/render/kanshi.js +131 -213
- package/build/src/cli/render/receipt.d.ts +1 -2
- package/build/src/cli/render/receipt.js +76 -26
- package/build/src/cli/render/refusal.js +2 -10
- package/build/src/cli/render/region.js +5 -2
- package/build/src/cli/render/settings.d.ts +1 -1
- package/build/src/cli/render/settings.js +27 -8
- package/build/src/cli/render/task.js +22 -5
- package/build/src/cli/render/terminal.d.ts +32 -1
- package/build/src/cli/render/terminal.js +77 -1
- package/build/src/cli/result.d.ts +3 -3
- package/build/src/cli/runtime.js +4 -2
- package/build/src/cli/selectors.d.ts +2 -1
- package/build/src/cli/selectors.js +4 -3
- package/build/src/cli/square-edge.js +120 -36
- package/build/src/cli/usage.js +2 -1
- package/build/src/contract-guidance.d.ts +5 -0
- package/build/src/contract-guidance.js +121 -0
- package/build/src/contract-worktree.d.ts +0 -1
- package/build/src/contract-worktree.js +32 -83
- package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
- package/build/src/coordination/sqlite-transaction-lock.js +5 -0
- package/build/src/core/facts/codec.d.ts +2 -0
- package/build/src/core/facts/codec.js +4 -0
- package/build/src/core/verbs/placement.d.ts +6 -1
- package/build/src/core/verbs/placement.js +5 -3
- package/build/src/dispatch/index.d.ts +0 -2
- package/build/src/dispatch/index.js +54 -55
- package/build/src/git/admission.js +2 -2
- package/build/src/git/hooks.d.ts +9 -15
- package/build/src/git/hooks.js +23 -317
- package/build/src/git/nuke.d.ts +2 -1
- package/build/src/git/nuke.js +39 -21
- package/build/src/git/private-state-seat.d.ts +12 -0
- package/build/src/git/private-state-seat.js +39 -0
- package/build/src/git/process.d.ts +6 -0
- package/build/src/git/process.js +26 -11
- package/build/src/git/read-observation.js +29 -20
- package/build/src/git/reconcile.d.ts +13 -1
- package/build/src/git/reconcile.js +70 -11
- package/build/src/git/ref-migration.d.ts +22 -0
- package/build/src/git/ref-migration.js +55 -0
- package/build/src/git/repository.d.ts +10 -6
- package/build/src/git/repository.js +16 -8
- package/build/src/git/target-placement.d.ts +1 -0
- package/build/src/git/target-placement.js +5 -0
- package/build/src/git/tender.d.ts +1 -0
- package/build/src/git/terminal-reconcile.d.ts +1 -1
- package/build/src/git/terminal-reconcile.js +22 -20
- package/build/src/git/workspace.d.ts +14 -0
- package/build/src/git/workspace.js +44 -0
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/read.js +16 -16
- package/build/src/kanshi/report.d.ts +2 -2
- package/build/src/library/address.d.ts +9 -3
- package/build/src/library/address.js +3 -2
- package/build/src/library/akuma-creation.d.ts +4 -3
- package/build/src/library/akuma-creation.js +19 -13
- package/build/src/library/audit.d.ts +14 -6
- package/build/src/library/audit.js +13 -23
- package/build/src/library/catalog.d.ts +3 -1
- package/build/src/library/catalog.js +20 -6
- package/build/src/library/composition.d.ts +385 -0
- package/build/src/library/composition.js +28 -0
- package/build/src/library/configuration.js +8 -2
- package/build/src/library/continuation.js +66 -30
- package/build/src/library/contract-bind.js +10 -2
- package/build/src/library/contract-forwarding-reconciliation-result.d.ts +102 -0
- package/build/src/library/contract-forwarding-reconciliation-result.js +92 -0
- package/build/src/library/contract-forwarding-result.d.ts +4464 -0
- package/build/src/library/contract-forwarding-result.js +521 -0
- package/build/src/library/contract-forwarding.d.ts +71 -0
- package/build/src/library/contract-forwarding.js +114 -0
- package/build/src/library/contract-handle.d.ts +38 -0
- package/build/src/library/contract-handle.js +314 -0
- package/build/src/library/contract-operations.d.ts +214 -69
- package/build/src/library/contract-operations.js +189 -118
- package/build/src/library/contract-types.d.ts +7 -3
- package/build/src/library/contract.d.ts +21 -34
- package/build/src/library/contract.js +29 -287
- package/build/src/library/fleet-result.d.ts +1580 -0
- package/build/src/library/fleet-result.js +98 -0
- package/build/src/library/fleet.d.ts +112 -54
- package/build/src/library/fleet.js +211 -71
- package/build/src/library/input.d.ts +3 -1
- package/build/src/library/input.js +11 -1
- package/build/src/library/keiyaku.d.ts +388 -20
- package/build/src/library/keiyaku.js +13 -21
- package/build/src/library/mutation.d.ts +3 -3
- package/build/src/library/mutation.js +5 -9
- package/build/src/library/nuke.d.ts +1 -1
- package/build/src/library/nuke.js +4 -3
- package/build/src/library/reconcile.d.ts +4 -0
- package/build/src/library/reconcile.js +2 -0
- package/build/src/library/refusal.d.ts +0 -9
- package/build/src/library/refusal.js +0 -7
- package/build/src/protocol/amend.js +56 -50
- package/build/src/protocol/attempt.d.ts +2 -0
- package/build/src/protocol/attempt.js +8 -1
- package/build/src/protocol/completion.js +7 -0
- package/build/src/protocol/deliver.js +6 -2
- package/build/src/protocol/operations.d.ts +4 -1
- package/build/src/protocol/operations.js +5 -2
- package/build/src/protocol/placement.d.ts +1 -0
- package/build/src/protocol/placement.js +52 -38
- package/build/src/protocol/read/observation.d.ts +1 -4
- package/build/src/protocol/read/observation.js +2 -15
- package/build/src/protocol/reintegrate.js +62 -58
- package/build/src/protocol/review.js +5 -0
- package/build/src/protocol/run.js +17 -13
- package/build/src/runtime/proc/run.d.ts +9 -0
- package/build/src/runtime/proc/run.js +51 -4
- package/build/src/runtime/proc/termination.js +26 -22
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/holder.d.ts +2 -1
- package/build/src/settlement/holder.js +15 -4
- package/build/src/settlement/settle.js +99 -33
- package/build/src/task/board.d.ts +68 -27
- package/build/src/task/board.js +31 -1
- package/build/src/task/catalog.d.ts +4 -0
- package/build/src/task/catalog.js +23 -0
- package/build/src/task/compose-language.js +33 -7
- package/build/src/task/compose-parser.d.ts +1 -1
- package/build/src/task/compose-parser.js +1 -1
- package/build/src/task/compose.js +2 -0
- package/build/src/task/index.d.ts +12 -4
- package/build/src/task/index.js +97 -16
- package/build/src/task/mutation-result.d.ts +923 -0
- package/build/src/task/mutation-result.js +140 -0
- package/build/src/task/mutation.d.ts +552 -28
- package/build/src/task/mutation.js +304 -97
- package/build/src/task/operations.d.ts +1 -4
- package/build/src/task/operations.js +0 -6
- package/build/src/task/public.d.ts +2 -0
- package/build/src/task/public.js +1 -0
- package/build/src/workspace-place.d.ts +7 -2
- package/build/src/workspace-place.js +34 -24
- package/build/src/world.d.ts +1 -0
- package/build/src/world.js +11 -0
- package/package.json +8 -6
- package/build/src/akuma/request-execution.d.ts +0 -8
- package/build/src/akuma/request-execution.js +0 -98
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { KeiyakuHandle, bindKeiyaku, keiyakuOf, listKeiyaku, observeKeiyaku } from "./contract.js";
|
|
2
|
+
import { callKeiyaku, forkKeiyaku } from "./akuma-creation.js";
|
|
3
|
+
import { historyAkuma, interruptAkuma, killAkuma, statusAkuma, tellAkuma, waitAkuma } from "./fleet.js";
|
|
4
|
+
import { listCatalog } from "./catalog.js";
|
|
5
|
+
import { nukeKeiyaku } from "./nuke.js";
|
|
6
|
+
import { type ExecutionContext } from "../akuma/requests.js";
|
|
7
|
+
/** Internal composition root for one immutable execution channel. */
|
|
8
|
+
export declare function composeLibrary(context?: ExecutionContext, composition?: Parameters<typeof bindKeiyaku>[2]): Readonly<{
|
|
9
|
+
prototype: KeiyakuHandle;
|
|
10
|
+
[Symbol.hasInstance]: (value: unknown) => boolean;
|
|
11
|
+
bind: (input: Parameters<typeof bindKeiyaku>[0]) => Promise<import("./contract-types.js").BindResult>;
|
|
12
|
+
call: (input: Parameters<typeof callKeiyaku>[0]) => Promise<Readonly<{
|
|
13
|
+
kind: "called";
|
|
14
|
+
akuma: import("./keiyaku.js").AkuId;
|
|
15
|
+
readonly?: import("../akuma/provider-recipe.js").ReadonlyRestraint;
|
|
16
|
+
execution: Readonly<{
|
|
17
|
+
cwd: string;
|
|
18
|
+
source: "input" | "contract-worktree" | "caller" | "process" | "world";
|
|
19
|
+
}>;
|
|
20
|
+
dispatch: import("./akuma-creation.js").DispatchStage;
|
|
21
|
+
alias: import("./akuma-creation.js").AliasStage;
|
|
22
|
+
observation: import("./akuma-creation.js").CallObservation;
|
|
23
|
+
}>>;
|
|
24
|
+
fork: typeof forkKeiyaku;
|
|
25
|
+
history: typeof historyAkuma;
|
|
26
|
+
interrupt: typeof interruptAkuma;
|
|
27
|
+
kill: (input: Parameters<typeof killAkuma>[0]) => Promise<{
|
|
28
|
+
results: {
|
|
29
|
+
id: import("./keiyaku.js").AkuId;
|
|
30
|
+
evidence: "unavailable" | "killed" | "already-killed" | "already-stopped" | "hung" | "untidy";
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
ls: typeof listCatalog;
|
|
34
|
+
nuke: typeof nukeKeiyaku;
|
|
35
|
+
list: typeof listKeiyaku;
|
|
36
|
+
observe: typeof observeKeiyaku;
|
|
37
|
+
of: (input: Parameters<typeof keiyakuOf>[0]) => KeiyakuHandle;
|
|
38
|
+
status: typeof statusAkuma;
|
|
39
|
+
tell: (input: Parameters<typeof tellAkuma>[0]) => Promise<{
|
|
40
|
+
akuma: import("./keiyaku.js").AkuId;
|
|
41
|
+
tell: {
|
|
42
|
+
admission: {
|
|
43
|
+
fact: "recorded";
|
|
44
|
+
tellId: string;
|
|
45
|
+
};
|
|
46
|
+
row: {
|
|
47
|
+
kind: "tell";
|
|
48
|
+
sequence: number;
|
|
49
|
+
at: string;
|
|
50
|
+
tellId: string;
|
|
51
|
+
text: string;
|
|
52
|
+
state: "pending" | "told";
|
|
53
|
+
deliveries: readonly Readonly<{
|
|
54
|
+
turnSequence: number;
|
|
55
|
+
route: "launch" | "live";
|
|
56
|
+
receipt?: "unavailable" | "required";
|
|
57
|
+
deliveredAt: string;
|
|
58
|
+
}>[];
|
|
59
|
+
};
|
|
60
|
+
wake: {
|
|
61
|
+
kind: "failed";
|
|
62
|
+
diagnostic: string;
|
|
63
|
+
} | {
|
|
64
|
+
child: {
|
|
65
|
+
code: number | null;
|
|
66
|
+
signal: string | null;
|
|
67
|
+
log: {
|
|
68
|
+
path: string;
|
|
69
|
+
from: number;
|
|
70
|
+
to: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
kind: "failed";
|
|
74
|
+
diagnostic: string;
|
|
75
|
+
} | {
|
|
76
|
+
kind: "told";
|
|
77
|
+
} | {
|
|
78
|
+
kind: "held";
|
|
79
|
+
} | {
|
|
80
|
+
kind: "pursuing";
|
|
81
|
+
bodySequence: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
wait: (input: Parameters<typeof waitAkuma>[0]) => Promise<{
|
|
86
|
+
completion: "any" | "all";
|
|
87
|
+
observations: {
|
|
88
|
+
status: {
|
|
89
|
+
id: import("./keiyaku.js").AkuId;
|
|
90
|
+
life: "killed" | "hung" | "untidy" | "running" | "asleep" | "stranded";
|
|
91
|
+
timeline: {
|
|
92
|
+
reportedChanges: readonly {
|
|
93
|
+
sequence: number;
|
|
94
|
+
at: string;
|
|
95
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
96
|
+
path: string;
|
|
97
|
+
diffstat?: {
|
|
98
|
+
added: number;
|
|
99
|
+
removed: number;
|
|
100
|
+
} | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
reportedChangesOmitted: number;
|
|
103
|
+
kind: "unborn";
|
|
104
|
+
entries: readonly never[];
|
|
105
|
+
omitted: 0;
|
|
106
|
+
} | {
|
|
107
|
+
reportedChanges: readonly {
|
|
108
|
+
sequence: number;
|
|
109
|
+
at: string;
|
|
110
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
111
|
+
path: string;
|
|
112
|
+
diffstat?: {
|
|
113
|
+
added: number;
|
|
114
|
+
removed: number;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}[];
|
|
117
|
+
reportedChangesOmitted: number;
|
|
118
|
+
kind: "open";
|
|
119
|
+
turn: {
|
|
120
|
+
kind: "turn";
|
|
121
|
+
sequence: number;
|
|
122
|
+
turnSequence: number;
|
|
123
|
+
bodySequence: number;
|
|
124
|
+
at: string;
|
|
125
|
+
};
|
|
126
|
+
entries: readonly ({
|
|
127
|
+
kind: "gap";
|
|
128
|
+
count: number;
|
|
129
|
+
} | {
|
|
130
|
+
kind: "row";
|
|
131
|
+
row: {
|
|
132
|
+
kind: "tell";
|
|
133
|
+
sequence: number;
|
|
134
|
+
at: string;
|
|
135
|
+
tellId: string;
|
|
136
|
+
text: string;
|
|
137
|
+
state: "pending" | "told";
|
|
138
|
+
deliveries: readonly Readonly<{
|
|
139
|
+
turnSequence: number;
|
|
140
|
+
route: "launch" | "live";
|
|
141
|
+
receipt?: "unavailable" | "required";
|
|
142
|
+
deliveredAt: string;
|
|
143
|
+
}>[];
|
|
144
|
+
} | {
|
|
145
|
+
kind: "call";
|
|
146
|
+
sequence: number;
|
|
147
|
+
turnSequence: number;
|
|
148
|
+
at: string;
|
|
149
|
+
text: string;
|
|
150
|
+
} | {
|
|
151
|
+
kind: "note" | "thought" | "said";
|
|
152
|
+
sequence: number;
|
|
153
|
+
turnSequence: number;
|
|
154
|
+
at: string;
|
|
155
|
+
text: string;
|
|
156
|
+
truncated?: true | undefined;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "tool";
|
|
159
|
+
sequence: number;
|
|
160
|
+
turnSequence: number;
|
|
161
|
+
at: string;
|
|
162
|
+
name: string;
|
|
163
|
+
call: {
|
|
164
|
+
kind: "run";
|
|
165
|
+
command: string;
|
|
166
|
+
} | {
|
|
167
|
+
kind: "read";
|
|
168
|
+
path: string;
|
|
169
|
+
offset?: number | undefined;
|
|
170
|
+
limit?: number | undefined;
|
|
171
|
+
} | {
|
|
172
|
+
kind: "search";
|
|
173
|
+
query: string;
|
|
174
|
+
scope?: "content" | "files" | "web" | undefined;
|
|
175
|
+
path?: string | undefined;
|
|
176
|
+
glob?: string | undefined;
|
|
177
|
+
} | {
|
|
178
|
+
kind: "fileChange";
|
|
179
|
+
changes: readonly {
|
|
180
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
181
|
+
path: string;
|
|
182
|
+
diffstat?: {
|
|
183
|
+
added: number;
|
|
184
|
+
removed: number;
|
|
185
|
+
} | undefined;
|
|
186
|
+
}[];
|
|
187
|
+
} | {
|
|
188
|
+
kind: "other";
|
|
189
|
+
display: string;
|
|
190
|
+
};
|
|
191
|
+
state: "active";
|
|
192
|
+
truncated?: true | undefined;
|
|
193
|
+
} | {
|
|
194
|
+
kind: "tool";
|
|
195
|
+
sequence: number;
|
|
196
|
+
turnSequence: number;
|
|
197
|
+
at: string;
|
|
198
|
+
name: string;
|
|
199
|
+
call: {
|
|
200
|
+
kind: "run";
|
|
201
|
+
command: string;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "read";
|
|
204
|
+
path: string;
|
|
205
|
+
offset?: number | undefined;
|
|
206
|
+
limit?: number | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
kind: "search";
|
|
209
|
+
query: string;
|
|
210
|
+
scope?: "content" | "files" | "web" | undefined;
|
|
211
|
+
path?: string | undefined;
|
|
212
|
+
glob?: string | undefined;
|
|
213
|
+
} | {
|
|
214
|
+
kind: "fileChange";
|
|
215
|
+
changes: readonly {
|
|
216
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
217
|
+
path: string;
|
|
218
|
+
diffstat?: {
|
|
219
|
+
added: number;
|
|
220
|
+
removed: number;
|
|
221
|
+
} | undefined;
|
|
222
|
+
}[];
|
|
223
|
+
} | {
|
|
224
|
+
kind: "other";
|
|
225
|
+
display: string;
|
|
226
|
+
};
|
|
227
|
+
state: {
|
|
228
|
+
status: "error" | "ok";
|
|
229
|
+
message?: string | undefined;
|
|
230
|
+
exitCode?: number | undefined;
|
|
231
|
+
};
|
|
232
|
+
completedAt?: string | undefined;
|
|
233
|
+
durationMs?: number | undefined;
|
|
234
|
+
truncated?: true | undefined;
|
|
235
|
+
};
|
|
236
|
+
})[];
|
|
237
|
+
omitted: number;
|
|
238
|
+
} | {
|
|
239
|
+
reportedChanges: readonly {
|
|
240
|
+
sequence: number;
|
|
241
|
+
at: string;
|
|
242
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
243
|
+
path: string;
|
|
244
|
+
diffstat?: {
|
|
245
|
+
added: number;
|
|
246
|
+
removed: number;
|
|
247
|
+
} | undefined;
|
|
248
|
+
}[];
|
|
249
|
+
reportedChangesOmitted: number;
|
|
250
|
+
kind: "idle";
|
|
251
|
+
entries: readonly ({
|
|
252
|
+
kind: "gap";
|
|
253
|
+
count: number;
|
|
254
|
+
} | {
|
|
255
|
+
kind: "row";
|
|
256
|
+
row: {
|
|
257
|
+
kind: "tell";
|
|
258
|
+
sequence: number;
|
|
259
|
+
at: string;
|
|
260
|
+
tellId: string;
|
|
261
|
+
text: string;
|
|
262
|
+
state: "pending" | "told";
|
|
263
|
+
deliveries: readonly Readonly<{
|
|
264
|
+
turnSequence: number;
|
|
265
|
+
route: "launch" | "live";
|
|
266
|
+
receipt?: "unavailable" | "required";
|
|
267
|
+
deliveredAt: string;
|
|
268
|
+
}>[];
|
|
269
|
+
} | {
|
|
270
|
+
kind: "call";
|
|
271
|
+
sequence: number;
|
|
272
|
+
turnSequence: number;
|
|
273
|
+
at: string;
|
|
274
|
+
text: string;
|
|
275
|
+
} | {
|
|
276
|
+
kind: "note" | "thought" | "said";
|
|
277
|
+
sequence: number;
|
|
278
|
+
turnSequence: number;
|
|
279
|
+
at: string;
|
|
280
|
+
text: string;
|
|
281
|
+
truncated?: true | undefined;
|
|
282
|
+
} | {
|
|
283
|
+
kind: "tool";
|
|
284
|
+
sequence: number;
|
|
285
|
+
turnSequence: number;
|
|
286
|
+
at: string;
|
|
287
|
+
name: string;
|
|
288
|
+
call: {
|
|
289
|
+
kind: "run";
|
|
290
|
+
command: string;
|
|
291
|
+
} | {
|
|
292
|
+
kind: "read";
|
|
293
|
+
path: string;
|
|
294
|
+
offset?: number | undefined;
|
|
295
|
+
limit?: number | undefined;
|
|
296
|
+
} | {
|
|
297
|
+
kind: "search";
|
|
298
|
+
query: string;
|
|
299
|
+
scope?: "content" | "files" | "web" | undefined;
|
|
300
|
+
path?: string | undefined;
|
|
301
|
+
glob?: string | undefined;
|
|
302
|
+
} | {
|
|
303
|
+
kind: "fileChange";
|
|
304
|
+
changes: readonly {
|
|
305
|
+
op: "add" | "update" | "delete" | "unspecified";
|
|
306
|
+
path: string;
|
|
307
|
+
diffstat?: {
|
|
308
|
+
added: number;
|
|
309
|
+
removed: number;
|
|
310
|
+
} | undefined;
|
|
311
|
+
}[];
|
|
312
|
+
} | {
|
|
313
|
+
kind: "other";
|
|
314
|
+
display: string;
|
|
315
|
+
};
|
|
316
|
+
state: {
|
|
317
|
+
status: "error" | "ok";
|
|
318
|
+
message?: string | undefined;
|
|
319
|
+
exitCode?: number | undefined;
|
|
320
|
+
};
|
|
321
|
+
completedAt?: string | undefined;
|
|
322
|
+
durationMs?: number | undefined;
|
|
323
|
+
truncated?: true | undefined;
|
|
324
|
+
};
|
|
325
|
+
})[];
|
|
326
|
+
omitted: number;
|
|
327
|
+
outcome?: {
|
|
328
|
+
kind: "outcome";
|
|
329
|
+
sequence: number;
|
|
330
|
+
turnSequence: number;
|
|
331
|
+
at: string;
|
|
332
|
+
outcome: {
|
|
333
|
+
kind: "answered";
|
|
334
|
+
historyId: string;
|
|
335
|
+
answer: string;
|
|
336
|
+
} | {
|
|
337
|
+
kind: "failed";
|
|
338
|
+
historyId: string;
|
|
339
|
+
diagnostic: string;
|
|
340
|
+
};
|
|
341
|
+
} | undefined;
|
|
342
|
+
};
|
|
343
|
+
readonly?: {
|
|
344
|
+
enforcement: "native";
|
|
345
|
+
} | {
|
|
346
|
+
enforcement: "none";
|
|
347
|
+
diagnostic: string;
|
|
348
|
+
} | undefined;
|
|
349
|
+
strandedReason?: "resume-unsupported" | undefined;
|
|
350
|
+
};
|
|
351
|
+
contract: {
|
|
352
|
+
kind: "none";
|
|
353
|
+
} | {
|
|
354
|
+
kind: "associated";
|
|
355
|
+
contractId: import("./contract.js").ContractId;
|
|
356
|
+
} | {
|
|
357
|
+
kind: "failed";
|
|
358
|
+
diagnostic: string;
|
|
359
|
+
};
|
|
360
|
+
createdTasks: {
|
|
361
|
+
kind: "present";
|
|
362
|
+
rows: readonly {
|
|
363
|
+
id: `task/${string}`;
|
|
364
|
+
title: string;
|
|
365
|
+
state: "open" | "in_progress" | "on_hold" | "done" | "drop";
|
|
366
|
+
priority: 0 | 1 | 2 | 3;
|
|
367
|
+
disposition: "in_progress" | "on_hold" | "done" | "drop" | "ready" | "blocked";
|
|
368
|
+
updatedAt: string;
|
|
369
|
+
bodyPresent: boolean;
|
|
370
|
+
children?: {
|
|
371
|
+
live: number;
|
|
372
|
+
total: number;
|
|
373
|
+
} | undefined;
|
|
374
|
+
}[];
|
|
375
|
+
} | {
|
|
376
|
+
kind: "failed";
|
|
377
|
+
diagnostic: string;
|
|
378
|
+
};
|
|
379
|
+
}[];
|
|
380
|
+
unobserved: {
|
|
381
|
+
id: import("./keiyaku.js").AkuId;
|
|
382
|
+
diagnostic: string;
|
|
383
|
+
}[];
|
|
384
|
+
}>;
|
|
385
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { KeiyakuHandle, bindKeiyaku, keiyakuOf, listKeiyaku, observeKeiyaku } from "./contract.js";
|
|
2
|
+
import { callKeiyaku, forkKeiyaku } from "./akuma-creation.js";
|
|
3
|
+
import { historyAkuma, interruptAkuma, killAkuma, statusAkuma, tellAkuma, waitAkuma } from "./fleet.js";
|
|
4
|
+
import { listCatalog } from "./catalog.js";
|
|
5
|
+
import { nukeKeiyaku } from "./nuke.js";
|
|
6
|
+
import { executionChannel, localExecutionContext } from "../akuma/requests.js";
|
|
7
|
+
/** Internal composition root for one immutable execution channel. */
|
|
8
|
+
export function composeLibrary(context = localExecutionContext(), composition) {
|
|
9
|
+
const captured = Object.freeze({ channel: executionChannel(context) });
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
prototype: KeiyakuHandle.prototype,
|
|
12
|
+
[Symbol.hasInstance]: (value) => value instanceof KeiyakuHandle,
|
|
13
|
+
bind: (input) => bindKeiyaku(input, captured, composition),
|
|
14
|
+
call: (input) => callKeiyaku(input, captured),
|
|
15
|
+
fork: forkKeiyaku,
|
|
16
|
+
history: historyAkuma,
|
|
17
|
+
interrupt: interruptAkuma,
|
|
18
|
+
kill: (input) => killAkuma(input, captured),
|
|
19
|
+
ls: listCatalog,
|
|
20
|
+
nuke: nukeKeiyaku,
|
|
21
|
+
list: listKeiyaku,
|
|
22
|
+
observe: observeKeiyaku,
|
|
23
|
+
of: (input) => keiyakuOf(input, captured, composition),
|
|
24
|
+
status: statusAkuma,
|
|
25
|
+
tell: (input) => tellAkuma(input, captured),
|
|
26
|
+
wait: (input) => waitAkuma(input, captured),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -73,9 +73,11 @@ function command(value, coordinate, ErrorType) {
|
|
|
73
73
|
if (!record(value))
|
|
74
74
|
throw new ErrorType(`${coordinate} must be an object`);
|
|
75
75
|
for (const key of Object.keys(value)) {
|
|
76
|
-
if (key !== "argv" && key !== "timeoutMs")
|
|
76
|
+
if (key !== "name" && key !== "argv" && key !== "timeoutMs")
|
|
77
77
|
throw new ErrorType(`${coordinate} has unknown field: ${key}`);
|
|
78
78
|
}
|
|
79
|
+
if (typeof value.name !== "string" || value.name.trim().length === 0)
|
|
80
|
+
throw new ErrorType(`${coordinate}.name must be nonblank`);
|
|
79
81
|
if (!Array.isArray(value.argv) || value.argv.length === 0 || !value.argv.every((item) => typeof item === "string")) {
|
|
80
82
|
throw new ErrorType(`${coordinate}.argv must be a nonempty string array`);
|
|
81
83
|
}
|
|
@@ -86,7 +88,11 @@ function command(value, coordinate, ErrorType) {
|
|
|
86
88
|
value.timeoutMs > 2_147_483_647) {
|
|
87
89
|
throw new ErrorType(`${coordinate}.timeoutMs must be an integer from 1 through 2147483647`);
|
|
88
90
|
}
|
|
89
|
-
return Object.freeze({
|
|
91
|
+
return Object.freeze({
|
|
92
|
+
name: value.name.trim(),
|
|
93
|
+
argv: Object.freeze([...value.argv]),
|
|
94
|
+
timeoutMs: value.timeoutMs,
|
|
95
|
+
});
|
|
90
96
|
}
|
|
91
97
|
function commands(value, coordinate, ErrorType) {
|
|
92
98
|
if (!Array.isArray(value))
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { observeActiveContractWorld } from "../git/observe.js";
|
|
2
2
|
import { withGitReadObservation } from "../git/read-observation.js";
|
|
3
|
+
import { reconcileDependentWorktree } from "../git/reconcile.js";
|
|
4
|
+
import { worktreePath } from "../git/workspace.js";
|
|
3
5
|
import { continueDeliveryOperation } from "../protocol/deliver.js";
|
|
6
|
+
import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
|
|
4
7
|
function reverseDependents(world) {
|
|
5
8
|
const index = new Map();
|
|
6
9
|
for (const record of world.contracts.values()) {
|
|
@@ -27,48 +30,81 @@ function appendAccepted(primary, child) {
|
|
|
27
30
|
...(effects.length === 0 && lag.length === 0 ? {} : { physical: { effects, lag } }),
|
|
28
31
|
};
|
|
29
32
|
}
|
|
33
|
+
function appendPhysical(primary, physical) {
|
|
34
|
+
const effects = [...(primary.physical?.effects ?? []), ...physical.effects];
|
|
35
|
+
const lag = [...(primary.physical?.lag ?? []), ...physical.lag];
|
|
36
|
+
return {
|
|
37
|
+
...primary,
|
|
38
|
+
...(effects.length === 0 && lag.length === 0 ? {} : { physical: { effects, lag } }),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// The bounded dependency walk keeps selection, physical follow, and child admission together.
|
|
42
|
+
// eslint-disable-next-line max-lines-per-function
|
|
30
43
|
export async function continueDeliveredDependents(input) {
|
|
31
44
|
const world = await withGitReadObservation(input.scope, input.channel, async (observation) => await observeActiveContractWorld(observation));
|
|
32
45
|
const dependents = reverseDependents(world);
|
|
33
|
-
const
|
|
46
|
+
const places = await readPlaceRegister(input.scope);
|
|
47
|
+
const initialTarget = typeof input.accepted.value === "object" && input.accepted.value !== null && "completion" in input.accepted.value
|
|
48
|
+
? (input.accepted.value
|
|
49
|
+
.completion?.integration ?? undefined)
|
|
50
|
+
: undefined;
|
|
51
|
+
const pending = [{ contractId: input.contractId, target: initialTarget }];
|
|
34
52
|
const attempted = new Set();
|
|
35
|
-
const newlyClaimed = new Set(
|
|
53
|
+
const newlyClaimed = new Set([input.contractId]);
|
|
36
54
|
const claimed = [];
|
|
37
55
|
const stopped = [];
|
|
38
56
|
let accepted = input.accepted;
|
|
57
|
+
const process = async (candidate, predecessorTarget) => {
|
|
58
|
+
const contractId = candidate.state.id;
|
|
59
|
+
if (!candidate.state.terms.after.every((dependency) => newlyClaimed.has(dependency) || world.eligibility.get(dependency)?.terminal?.kind === "claimed")) {
|
|
60
|
+
return { accepted, outcome: "skip" };
|
|
61
|
+
}
|
|
62
|
+
attempted.add(contractId);
|
|
63
|
+
if (predecessorTarget !== undefined && candidate.state.coordinates.workspace === "worktree") {
|
|
64
|
+
const appointment = appointmentFor(places, contractId);
|
|
65
|
+
if (appointment !== undefined) {
|
|
66
|
+
const reconciled = await reconcileDependentWorktree(input.scope, contractId, worktreePath(input.scope, appointment.place), predecessorTarget);
|
|
67
|
+
accepted = appendPhysical(accepted, reconciled);
|
|
68
|
+
if (reconciled.lag.length > 0)
|
|
69
|
+
return { accepted, outcome: "stopped" };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const child = await continueDeliveryOperation({
|
|
73
|
+
scope: input.scope,
|
|
74
|
+
channel: input.channel,
|
|
75
|
+
state: candidate.state,
|
|
76
|
+
journal: candidate.journal,
|
|
77
|
+
deriveDocument: input.deriveDocument,
|
|
78
|
+
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
79
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
80
|
+
});
|
|
81
|
+
accepted = appendAccepted(accepted, child.admission);
|
|
82
|
+
if (child.evidence.completion !== undefined) {
|
|
83
|
+
newlyClaimed.add(contractId);
|
|
84
|
+
pending.push({ contractId, target: child.evidence.completion.integration });
|
|
85
|
+
return { accepted, outcome: "claimed" };
|
|
86
|
+
}
|
|
87
|
+
const stop = child.evidence.placement;
|
|
88
|
+
if (stop === undefined)
|
|
89
|
+
throw new Error("incomplete continuation is missing its placement stop");
|
|
90
|
+
return {
|
|
91
|
+
accepted,
|
|
92
|
+
outcome: "stopped",
|
|
93
|
+
stop: "refusal" in stop && stop.refusal.kind === "terminal" ? { kind: "already-terminal" } : stop,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
39
96
|
while (pending.length > 0) {
|
|
40
97
|
const parent = pending.shift();
|
|
41
|
-
for (const candidate of dependents.get(parent) ?? []) {
|
|
98
|
+
for (const candidate of dependents.get(parent.contractId) ?? []) {
|
|
42
99
|
const contractId = candidate.state.id;
|
|
43
|
-
if (attempted.has(contractId)
|
|
44
|
-
!candidate.state.terms.after.every((dependency) => newlyClaimed.has(dependency) || world.eligibility.get(dependency)?.terminal?.kind === "claimed"))
|
|
100
|
+
if (attempted.has(contractId))
|
|
45
101
|
continue;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
channel: input.channel,
|
|
50
|
-
state: candidate.state,
|
|
51
|
-
journal: candidate.journal,
|
|
52
|
-
deriveDocument: input.deriveDocument,
|
|
53
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
54
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
55
|
-
});
|
|
56
|
-
accepted = appendAccepted(accepted, child.admission);
|
|
57
|
-
if (child.evidence.completion !== undefined) {
|
|
102
|
+
const result = await process(candidate, parent.target);
|
|
103
|
+
accepted = result.accepted;
|
|
104
|
+
if (result.outcome === "claimed")
|
|
58
105
|
claimed.push(contractId);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const stop = child.evidence.placement;
|
|
64
|
-
if (stop === undefined)
|
|
65
|
-
throw new Error("incomplete continuation is missing its placement stop");
|
|
66
|
-
if ("refusal" in stop && stop.refusal.kind === "terminal") {
|
|
67
|
-
stopped.push({ contractId, stop: { kind: "already-terminal" } });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
stopped.push({ contractId, stop });
|
|
71
|
-
}
|
|
106
|
+
if (result.outcome === "stopped" && result.stop !== undefined)
|
|
107
|
+
stopped.push({ contractId, stop: result.stop });
|
|
72
108
|
}
|
|
73
109
|
}
|
|
74
110
|
return {
|
|
@@ -9,8 +9,16 @@ import { observeRegion } from "./region.js";
|
|
|
9
9
|
import { scopeForRepo } from "./repo.js";
|
|
10
10
|
import { worktreeHooksOption } from "./configuration.js";
|
|
11
11
|
function acceptedBindResult(result, region) {
|
|
12
|
-
const { facts, head,
|
|
13
|
-
return {
|
|
12
|
+
const { facts, head, lags, settlementLags, recoverySnapshot } = result;
|
|
13
|
+
return {
|
|
14
|
+
facts,
|
|
15
|
+
head,
|
|
16
|
+
keiyaku: result.value,
|
|
17
|
+
lags,
|
|
18
|
+
settlementLags,
|
|
19
|
+
...(recoverySnapshot === undefined ? {} : { recoverySnapshot }),
|
|
20
|
+
...region,
|
|
21
|
+
};
|
|
14
22
|
}
|
|
15
23
|
export async function bindKeiyaku(input, createHandle) {
|
|
16
24
|
const values = requireInput(input, "Keiyaku.bind input");
|