@astrosheep/keiyaku 4.6.32 → 4.6.34
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 +18 -7
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/README.md +55 -97
- package/build/plugins/pi/keiyaku.ts +1 -142
- package/build/skills/keiyaku-akuma/SKILL.md +18 -11
- package/build/skills/keiyaku-babysit/SKILL.md +8 -6
- package/build/skills/keiyaku-debt/SKILL.md +2 -1
- package/build/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/src/akuma/akuma-instance.d.ts +11 -0
- package/build/src/akuma/akuma-instance.js +1 -2
- package/build/src/akuma/akuma-observe.d.ts +8 -0
- package/build/src/akuma/akuma-observe.js +81 -14
- package/build/src/akuma/akuma-owner.d.ts +1 -0
- package/build/src/akuma/akuma-owner.js +3 -5
- package/build/src/akuma/akuma-selection-execution.d.ts +82 -7
- package/build/src/akuma/akuma-selection-execution.js +26 -27
- package/build/src/akuma/akuma-wait.d.ts +155 -1
- package/build/src/akuma/akuma-wait.js +94 -34
- package/build/src/akuma/akuma.d.ts +17 -1
- package/build/src/akuma/akuma.js +37 -18
- package/build/src/akuma/body.js +13 -18
- package/build/src/akuma/call-initial-tell.d.ts +0 -1
- package/build/src/akuma/call-initial-tell.js +0 -1
- package/build/src/akuma/heart/activity-schema.d.ts +16 -0
- package/build/src/akuma/heart/activity-schema.js +7 -0
- package/build/src/akuma/heart/facts.d.ts +1 -0
- package/build/src/akuma/heart/facts.js +14 -0
- package/build/src/akuma/heart/index.d.ts +7 -1
- package/build/src/akuma/heart/index.js +35 -9
- package/build/src/akuma/heart/rows.d.ts +1 -0
- package/build/src/akuma/heart/rows.js +4 -0
- package/build/src/akuma/heart/timeline.js +4 -4
- package/build/src/akuma/lineage-cache.d.ts +7 -2
- package/build/src/akuma/lineage-cache.js +48 -24
- package/build/src/akuma/projection-read.d.ts +4 -2
- package/build/src/akuma/projection-read.js +25 -23
- package/build/src/akuma/projection.d.ts +94 -2
- package/build/src/akuma/projection.js +47 -47
- package/build/src/akuma/provider.d.ts +2 -2
- package/build/src/akuma/provider.js +27 -20
- package/build/src/akuma/providers/acp/core.js +2 -5
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +2 -1
- package/build/src/akuma/providers/opencode-sdk/events.js +31 -1
- package/build/src/akuma/publication.js +3 -2
- package/build/src/akuma/selection-observation.d.ts +645 -0
- package/build/src/akuma/selection-observation.js +22 -7
- package/build/src/akuma/status-projection.d.ts +14 -1
- package/build/src/akuma/status-projection.js +40 -2
- package/build/src/akuma/turn-drive.js +21 -15
- package/build/src/body/amend.js +5 -17
- package/build/src/body/decode.js +11 -1
- package/build/src/body/envelope.d.ts +5 -1
- package/build/src/body/envelope.js +4 -2
- package/build/src/body/render.js +4 -6
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +10 -0
- package/build/src/cli/commands/akuma-grammar.d.ts +5 -8
- package/build/src/cli/commands/akuma-grammar.js +52 -77
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +12 -61
- package/build/src/cli/commands/contract-grammar.d.ts +1 -0
- package/build/src/cli/commands/contract-grammar.js +39 -42
- package/build/src/cli/commands/contract-help.d.ts +6 -5
- package/build/src/cli/commands/contract-help.js +21 -13
- package/build/src/cli/commands/contract.d.ts +3 -3
- package/build/src/cli/commands/contract.js +13 -9
- package/build/src/cli/commands/debt-grammar.js +2 -4
- package/build/src/cli/parse.d.ts +4 -10
- package/build/src/cli/parse.js +2 -5
- package/build/src/cli/render/akuma-activity.d.ts +12 -34
- package/build/src/cli/render/akuma-activity.js +99 -180
- package/build/src/cli/render/akuma.d.ts +5 -11
- package/build/src/cli/render/akuma.js +22 -30
- package/build/src/cli/render/catalog.js +4 -6
- package/build/src/cli/render/contract-history.d.ts +1 -3
- package/build/src/cli/render/contract-history.js +70 -49
- package/build/src/cli/render/contract-observation.d.ts +2 -1
- package/build/src/cli/render/contract-observation.js +25 -1
- package/build/src/cli/render/contract-wait.d.ts +2 -2
- package/build/src/cli/render/contract-wait.js +21 -17
- package/build/src/cli/render/contract.js +12 -9
- package/build/src/cli/render/debt.js +1 -2
- package/build/src/cli/render/execution-progress.js +1 -3
- package/build/src/cli/render/kanshi-akuma.d.ts +4 -3
- package/build/src/cli/render/kanshi-akuma.js +27 -23
- package/build/src/cli/render/kanshi.js +45 -60
- package/build/src/cli/render/receipt.d.ts +1 -1
- package/build/src/cli/render/receipt.js +33 -28
- package/build/src/cli/render/reconcile.js +2 -5
- package/build/src/cli/render/refusal.js +3 -6
- package/build/src/cli/render/terminal.d.ts +2 -4
- package/build/src/cli/render/terminal.js +10 -17
- package/build/src/cli/render/verbs.d.ts +1 -0
- package/build/src/cli/render/verbs.js +39 -34
- package/build/src/cli/runtime.js +12 -32
- package/build/src/core/facts/codec.js +7 -2
- package/build/src/core/facts/eligibility.d.ts +4 -4
- package/build/src/core/facts/eligibility.js +11 -0
- package/build/src/core/facts/fold.js +9 -5
- package/build/src/core/facts/gate.d.ts +5 -1
- package/build/src/core/facts/gate.js +14 -10
- package/build/src/core/facts/types.d.ts +5 -1
- package/build/src/core/facts/types.js +7 -0
- package/build/src/core/subject.d.ts +4 -1
- package/build/src/core/subject.js +10 -2
- package/build/src/core/verbs/amend.d.ts +15 -4
- package/build/src/core/verbs/amend.js +19 -9
- package/build/src/debt/board.d.ts +2 -1
- package/build/src/debt/board.js +3 -3
- package/build/src/debt/catalog.js +2 -1
- package/build/src/debt/document.d.ts +1 -0
- package/build/src/debt/document.js +3 -0
- package/build/src/debt/index.d.ts +2 -2
- package/build/src/debt/index.js +9 -14
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +6 -4
- package/build/src/debt/operations.d.ts +2 -1
- package/build/src/dispatch/index.d.ts +0 -17
- package/build/src/dispatch/index.js +1 -10
- package/build/src/git/identity.js +16 -45
- package/build/src/git/nuke.js +13 -23
- package/build/src/git/observe.d.ts +7 -3
- package/build/src/git/observe.js +29 -26
- package/build/src/git/process.js +11 -18
- package/build/src/git/read-observation.d.ts +5 -4
- package/build/src/git/repository.d.ts +2 -0
- package/build/src/git/repository.js +13 -1
- package/build/src/git/scratch.js +2 -14
- package/build/src/git/terminal-reconcile.js +1 -13
- package/build/src/history.d.ts +26 -0
- package/build/src/history.js +43 -0
- package/build/src/index.d.ts +6 -3
- package/build/src/kanshi/counts.d.ts +15 -1
- package/build/src/kanshi/counts.js +14 -3
- package/build/src/kanshi/index.d.ts +3 -4
- package/build/src/kanshi/index.js +2 -3
- package/build/src/kanshi/read.d.ts +21 -0
- package/build/src/kanshi/read.js +7 -3
- package/build/src/kanshi/report.d.ts +94 -0
- package/build/src/library/address.d.ts +12 -5
- package/build/src/library/address.js +18 -32
- package/build/src/library/akuma-creation.d.ts +39 -0
- package/build/src/library/akuma-creation.js +3 -9
- package/build/src/library/akumas.d.ts +5 -1
- package/build/src/library/akumas.js +11 -5
- package/build/src/library/continuation.d.ts +10 -0
- package/build/src/library/contract-composition.js +10 -10
- package/build/src/library/contract-creation.js +12 -13
- package/build/src/library/contract-outcomes.d.ts +72 -1
- package/build/src/library/contract-outcomes.js +1 -0
- package/build/src/library/contract-types.d.ts +233 -25
- package/build/src/library/contract-types.js +32 -12
- package/build/src/library/contract-wait.d.ts +212 -0
- package/build/src/library/contract-wait.js +65 -49
- package/build/src/library/delivery.d.ts +25 -0
- package/build/src/library/input.d.ts +8 -26
- package/build/src/library/input.js +17 -12
- package/build/src/library/kei.js +167 -90
- package/build/src/library/keiyaku-attribution.d.ts +1 -1
- package/build/src/library/keiyaku-attribution.js +3 -1
- package/build/src/library/keiyaku-classify.js +8 -4
- package/build/src/library/keiyaku-debt.d.ts +8 -7
- package/build/src/library/keiyaku-debt.js +1 -2
- package/build/src/library/keiyaku-identity.d.ts +4 -3
- package/build/src/library/keiyaku-identity.js +35 -7
- package/build/src/library/keiyaku-verbs.d.ts +974 -1409
- package/build/src/library/keiyaku-verbs.js +154 -161
- package/build/src/library/keiyaku-wait.d.ts +753 -0
- package/build/src/library/keiyaku-wait.js +230 -0
- package/build/src/library/keiyaku.d.ts +3110 -29
- package/build/src/library/keiyaku.js +342 -438
- package/build/src/library/model-tools.d.ts +754 -0
- package/build/src/library/model-tools.js +362 -0
- package/build/src/library/outcome.js +5 -6
- package/build/src/library/refusal.d.ts +25 -1
- package/build/src/library/refusal.js +4 -5
- package/build/src/library/selection.d.ts +18 -5
- package/build/src/library/selection.js +11 -5
- package/build/src/mcp/adapter.d.ts +0 -6
- package/build/src/mcp/adapter.js +11 -160
- package/build/src/mcp/description.d.ts +2 -0
- package/build/src/mcp/description.js +2 -0
- package/build/src/mcp/help.d.ts +1 -1
- package/build/src/mcp/help.js +10 -7
- package/build/src/pi/index.d.ts +5 -0
- package/build/src/pi/index.js +99 -0
- package/build/src/pi/status.d.ts +12 -0
- package/build/src/pi/status.js +140 -0
- package/build/src/protocol/amend.d.ts +14 -3
- package/build/src/protocol/amend.js +113 -46
- package/build/src/protocol/bind.d.ts +1 -1
- package/build/src/protocol/bind.js +5 -16
- package/build/src/protocol/completion.d.ts +30 -0
- package/build/src/protocol/completion.js +8 -5
- package/build/src/protocol/deliver.js +7 -20
- package/build/src/protocol/delivery-preview.d.ts +5 -0
- package/build/src/protocol/execution-observation.d.ts +8 -0
- package/build/src/protocol/intent.d.ts +1 -0
- package/build/src/protocol/intent.js +4 -1
- package/build/src/protocol/operations.d.ts +56 -16
- package/build/src/protocol/operations.js +18 -32
- package/build/src/protocol/placement.js +7 -1
- package/build/src/protocol/progress.js +0 -6
- package/build/src/protocol/read/status.d.ts +52 -4
- package/build/src/protocol/read/status.js +26 -22
- package/build/src/protocol/reintegrate.js +2 -2
- package/build/src/protocol/result-leaves.d.ts +56 -8
- package/build/src/protocol/result-leaves.js +11 -2
- package/build/src/protocol/run.js +1 -4
- package/build/src/protocol/verify.d.ts +10 -0
- package/build/src/protocol/verify.js +1 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/settle.js +19 -68
- package/package.json +7 -3
- package/plugins/paseo/plugin/index.server.ts +6 -2
- package/plugins/paseo/plugin/server/attach.ts +68 -48
- package/plugins/paseo/plugin/server/directory.ts +259 -0
- package/plugins/paseo/plugin/server/mirror-identity.ts +3 -32
- package/plugins/paseo/plugin/server/reopen.ts +52 -38
- package/plugins/pi/README.md +55 -97
- package/plugins/pi/keiyaku.ts +1 -142
- package/skills/keiyaku-akuma/SKILL.md +18 -11
- package/skills/keiyaku-babysit/SKILL.md +8 -6
- package/skills/keiyaku-debt/SKILL.md +2 -1
- package/skills/keiyaku-workflow/SKILL.md +2 -1
- package/build/plugins/pi/akuma-tools.ts +0 -283
- package/build/src/body/keys.d.ts +0 -4
- package/build/src/body/keys.js +0 -11
- package/build/src/kanshi/roster.d.ts +0 -2
- package/build/src/kanshi/roster.js +0 -2
- package/build/src/mcp/output.d.ts +0 -385
- package/build/src/mcp/output.js +0 -193
- package/plugins/pi/akuma-tools.ts +0 -283
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type LifecycleSelection } from "../bounded-list.js";
|
|
2
3
|
import type { DecideInput, OfferDecision } from "../core/decide.js";
|
|
3
4
|
import type { ContractId, ContractState, DeliverData, DocumentKey } from "../core/facts/types.js";
|
|
4
5
|
export { deliverDataSchema, gateSchema, verdictSchema, candidateContentChangeSchema, gateCurrentSchema, requirementIdSchema, requirementReportSchema, gateReportSchema, } from "./result-leaves.js";
|
|
@@ -39,15 +40,22 @@ export declare const bindRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Zod
|
|
|
39
40
|
}>;
|
|
40
41
|
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
41
42
|
}, z.core.$strict>>]>;
|
|
42
|
-
export declare const amendRefusalSchema: z.ZodReadonly<z.ZodObject<{
|
|
43
|
+
export declare const amendRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
43
44
|
kind: z.ZodEnum<{
|
|
44
45
|
"contract-missing": "contract-missing";
|
|
45
46
|
terminal: "terminal";
|
|
46
47
|
"unknown-prerequisite": "unknown-prerequisite";
|
|
47
48
|
"terms-moved": "terms-moved";
|
|
48
49
|
"cyclic-prerequisite": "cyclic-prerequisite";
|
|
50
|
+
"cyclic-target": "cyclic-target";
|
|
49
51
|
}>;
|
|
50
|
-
}, z.core.$strict
|
|
52
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
53
|
+
kind: z.ZodEnum<{
|
|
54
|
+
"target-contract-missing": "target-contract-missing";
|
|
55
|
+
"target-contract-terminal": "target-contract-terminal";
|
|
56
|
+
}>;
|
|
57
|
+
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
58
|
+
}, z.core.$strict>>]>;
|
|
51
59
|
export declare const deliverRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
52
60
|
kind: z.ZodEnum<{
|
|
53
61
|
"contract-missing": "contract-missing";
|
|
@@ -113,12 +121,16 @@ export declare const placementRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<
|
|
|
113
121
|
satisfied: "satisfied";
|
|
114
122
|
unsatisfied: "unsatisfied";
|
|
115
123
|
}>;
|
|
116
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
124
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
117
125
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
118
126
|
target: z.ZodExactOptional<z.ZodString>;
|
|
119
127
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
120
128
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
121
|
-
}, z.core.$strict
|
|
129
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
130
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
131
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
132
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
133
|
+
}, z.core.$strict>>]>>;
|
|
122
134
|
}, z.core.$strict>>]>;
|
|
123
135
|
}, z.core.$strict>>>>;
|
|
124
136
|
satisfied: z.ZodBoolean;
|
|
@@ -138,12 +150,16 @@ export declare const placementRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<
|
|
|
138
150
|
satisfied: "satisfied";
|
|
139
151
|
unsatisfied: "unsatisfied";
|
|
140
152
|
}>;
|
|
141
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
153
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
142
154
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
143
155
|
target: z.ZodExactOptional<z.ZodString>;
|
|
144
156
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
145
157
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
146
|
-
}, z.core.$strict
|
|
158
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
159
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
160
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
161
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
162
|
+
}, z.core.$strict>>]>>;
|
|
147
163
|
}, z.core.$strict>>]>;
|
|
148
164
|
}, z.core.$strict>>>>;
|
|
149
165
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -209,15 +225,22 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
209
225
|
"contract-missing": "contract-missing";
|
|
210
226
|
terminal: "terminal";
|
|
211
227
|
}>;
|
|
212
|
-
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
228
|
+
}, z.core.$strict>>, z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
213
229
|
kind: z.ZodEnum<{
|
|
214
230
|
"contract-missing": "contract-missing";
|
|
215
231
|
terminal: "terminal";
|
|
216
232
|
"unknown-prerequisite": "unknown-prerequisite";
|
|
217
233
|
"terms-moved": "terms-moved";
|
|
218
234
|
"cyclic-prerequisite": "cyclic-prerequisite";
|
|
235
|
+
"cyclic-target": "cyclic-target";
|
|
219
236
|
}>;
|
|
220
|
-
}, z.core.$strict>>, z.
|
|
237
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
238
|
+
kind: z.ZodEnum<{
|
|
239
|
+
"target-contract-missing": "target-contract-missing";
|
|
240
|
+
"target-contract-terminal": "target-contract-terminal";
|
|
241
|
+
}>;
|
|
242
|
+
targetContractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
|
|
243
|
+
}, z.core.$strict>>]>, z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
221
244
|
kind: z.ZodEnum<{
|
|
222
245
|
"contract-exists": "contract-exists";
|
|
223
246
|
"invalid-after": "invalid-after";
|
|
@@ -327,12 +350,16 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
327
350
|
satisfied: "satisfied";
|
|
328
351
|
unsatisfied: "unsatisfied";
|
|
329
352
|
}>;
|
|
330
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
353
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
331
354
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
332
355
|
target: z.ZodExactOptional<z.ZodString>;
|
|
333
356
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
334
357
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
335
|
-
}, z.core.$strict
|
|
358
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
359
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
360
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
361
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
362
|
+
}, z.core.$strict>>]>>;
|
|
336
363
|
}, z.core.$strict>>]>;
|
|
337
364
|
}, z.core.$strict>>>>;
|
|
338
365
|
satisfied: z.ZodBoolean;
|
|
@@ -352,12 +379,16 @@ export declare const intentRefusalSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
352
379
|
satisfied: "satisfied";
|
|
353
380
|
unsatisfied: "unsatisfied";
|
|
354
381
|
}>;
|
|
355
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
382
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
356
383
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
357
384
|
target: z.ZodExactOptional<z.ZodString>;
|
|
358
385
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
359
386
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
360
|
-
}, z.core.$strict
|
|
387
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
388
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
389
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
390
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
391
|
+
}, z.core.$strict>>]>>;
|
|
361
392
|
}, z.core.$strict>>]>;
|
|
362
393
|
}, z.core.$strict>>>>;
|
|
363
394
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -506,12 +537,16 @@ export declare const placementStopSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
506
537
|
satisfied: "satisfied";
|
|
507
538
|
unsatisfied: "unsatisfied";
|
|
508
539
|
}>;
|
|
509
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
540
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
510
541
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
511
542
|
target: z.ZodExactOptional<z.ZodString>;
|
|
512
543
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
513
544
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
514
|
-
}, z.core.$strict
|
|
545
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
546
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
547
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
548
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
549
|
+
}, z.core.$strict>>]>>;
|
|
515
550
|
}, z.core.$strict>>]>;
|
|
516
551
|
}, z.core.$strict>>>>;
|
|
517
552
|
satisfied: z.ZodBoolean;
|
|
@@ -531,12 +566,16 @@ export declare const placementStopSchema: z.ZodUnion<readonly [z.ZodReadonly<z.Z
|
|
|
531
566
|
satisfied: "satisfied";
|
|
532
567
|
unsatisfied: "unsatisfied";
|
|
533
568
|
}>;
|
|
534
|
-
reason: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
|
|
569
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
535
570
|
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
536
571
|
target: z.ZodExactOptional<z.ZodString>;
|
|
537
572
|
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
538
573
|
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").ChangeId, string>>;
|
|
539
|
-
}, z.core.$strict
|
|
574
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
575
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
576
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
577
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<import("../core/facts/types.js").SnapshotId, string>>;
|
|
578
|
+
}, z.core.$strict>>]>>;
|
|
540
579
|
}, z.core.$strict>>]>;
|
|
541
580
|
}, z.core.$strict>>>>;
|
|
542
581
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
@@ -636,6 +675,7 @@ export declare function contractsOperation(input: Readonly<{
|
|
|
636
675
|
export declare function contractCatalogueOperation(input: Readonly<{
|
|
637
676
|
scope: RepositoryScope;
|
|
638
677
|
channel: GitDecodeChannel;
|
|
678
|
+
selection?: LifecycleSelection;
|
|
639
679
|
limit?: number;
|
|
640
680
|
}>): Promise<ContractCatalogue>;
|
|
641
681
|
export declare function contractObservationOperation(input: Readonly<{
|
|
@@ -17,6 +17,7 @@ import { verificationRuntimeStopSchema } from "./intent.js";
|
|
|
17
17
|
import { complete } from "./outcome.js";
|
|
18
18
|
import { readDocuments } from "./read/documents.js";
|
|
19
19
|
import { readContractMembershipAt, readContractCatalogue, readContractObservationAt, } from "./read/status.js";
|
|
20
|
+
import { targetLifecycleReasonSchema } from "./result-reasons.js";
|
|
20
21
|
import { protocolTerminalSchema } from "./run.js";
|
|
21
22
|
export { changeIdSchema, contractIdSchema, snapshotIdSchema } from "../git/identity.js";
|
|
22
23
|
export { entryUlidSchema } from "./attempt.js";
|
|
@@ -29,33 +30,24 @@ export const bindRefusalSchema = z.union([
|
|
|
29
30
|
.object({ kind: z.enum(["contract-exists", "invalid-after", "unknown-prerequisite"]) })
|
|
30
31
|
.strict()
|
|
31
32
|
.readonly(),
|
|
32
|
-
|
|
33
|
-
.object({
|
|
34
|
-
kind: z.enum(["target-contract-missing", "target-contract-terminal"]),
|
|
35
|
-
targetContractId: contractIdSchema,
|
|
36
|
-
})
|
|
37
|
-
.strict()
|
|
38
|
-
.readonly(),
|
|
33
|
+
targetLifecycleReasonSchema,
|
|
39
34
|
]);
|
|
40
|
-
export const amendRefusalSchema = z
|
|
41
|
-
.object({
|
|
42
|
-
kind: z.enum(["contract-missing", "terminal", "terms-moved", "unknown-prerequisite", "cyclic-prerequisite"]),
|
|
43
|
-
})
|
|
44
|
-
.strict()
|
|
45
|
-
.readonly();
|
|
46
|
-
export const deliverRefusalSchema = z.union([
|
|
47
|
-
z
|
|
48
|
-
.object({ kind: z.enum(["contract-missing", "terminal"]) })
|
|
49
|
-
.strict()
|
|
50
|
-
.readonly(),
|
|
35
|
+
export const amendRefusalSchema = z.union([
|
|
51
36
|
z
|
|
52
|
-
.
|
|
53
|
-
kind: z.enum([
|
|
54
|
-
|
|
37
|
+
.strictObject({
|
|
38
|
+
kind: z.enum([
|
|
39
|
+
"contract-missing",
|
|
40
|
+
"terminal",
|
|
41
|
+
"terms-moved",
|
|
42
|
+
"unknown-prerequisite",
|
|
43
|
+
"cyclic-prerequisite",
|
|
44
|
+
"cyclic-target",
|
|
45
|
+
]),
|
|
55
46
|
})
|
|
56
|
-
.strict()
|
|
57
47
|
.readonly(),
|
|
48
|
+
targetLifecycleReasonSchema,
|
|
58
49
|
]);
|
|
50
|
+
export const deliverRefusalSchema = z.union([activeContractRefusalSchema, targetLifecycleReasonSchema]);
|
|
59
51
|
export const verificationDeclarationRefusalSchema = z
|
|
60
52
|
.object({ kind: z.literal("verification-declaration-invalid") })
|
|
61
53
|
.strict()
|
|
@@ -68,13 +60,7 @@ export const verifyRefusalSchema = z
|
|
|
68
60
|
.strict()
|
|
69
61
|
.readonly();
|
|
70
62
|
export const placementRefusalSchema = z.union([
|
|
71
|
-
|
|
72
|
-
.object({
|
|
73
|
-
kind: z.enum(["target-contract-missing", "target-contract-terminal"]),
|
|
74
|
-
targetContractId: contractIdSchema,
|
|
75
|
-
})
|
|
76
|
-
.strict()
|
|
77
|
-
.readonly(),
|
|
63
|
+
targetLifecycleReasonSchema,
|
|
78
64
|
targetWorkspaceRefusalSchema,
|
|
79
65
|
z
|
|
80
66
|
.object({ kind: z.enum(["contract-missing", "delivery-missing", "terminal"]) })
|
|
@@ -248,7 +234,7 @@ export async function contractsOperation(input) {
|
|
|
248
234
|
}
|
|
249
235
|
export async function contractCatalogueOperation(input) {
|
|
250
236
|
const limit = input.limit === undefined ? undefined : boundedListLimit(input.limit);
|
|
251
|
-
return withGitReadObservation(input.scope, input.channel, (observation) => readContractCatalogue(observation, limit));
|
|
237
|
+
return withGitReadObservation(input.scope, input.channel, (observation) => readContractCatalogue(observation, limit, input.selection));
|
|
252
238
|
}
|
|
253
239
|
export async function contractObservationOperation(input) {
|
|
254
240
|
return await readContractObservationAt(input.scope, input.channel, input.contractId);
|
|
@@ -261,8 +247,8 @@ export async function stateOperation(input) {
|
|
|
261
247
|
return (await observeContractAt(input.scope, input.channel, input.contractId)).state;
|
|
262
248
|
}
|
|
263
249
|
export async function deliveryOperation(input) {
|
|
264
|
-
const state =
|
|
265
|
-
if (state === null || state
|
|
250
|
+
const state = await stateOperation(input);
|
|
251
|
+
if (state === null || state.delivery === null)
|
|
266
252
|
return null;
|
|
267
253
|
return state.currentIntegration === null
|
|
268
254
|
? state.delivery.data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqliteTransactionLockError } from "../coordination/sqlite-transaction-lock.js";
|
|
2
2
|
import { AuthorityCorruptionError } from "../core/facts/errors.js";
|
|
3
3
|
import { contractState } from "../core/facts/observation.js";
|
|
4
|
-
import { targetName } from "../core/facts/types.js";
|
|
4
|
+
import { sameTarget, targetName } from "../core/facts/types.js";
|
|
5
5
|
import { decidePlacement } from "../core/verbs/placement.js";
|
|
6
6
|
import { observeContractsForAdmissionAt, observeGitForAdmissionAt } from "../git/observe.js";
|
|
7
7
|
import { withPrivateStatePublicationSeat } from "../git/private-state-seat.js";
|
|
@@ -191,6 +191,12 @@ export async function admitPlacement(admission) {
|
|
|
191
191
|
contracts: [input.contractId],
|
|
192
192
|
attempts,
|
|
193
193
|
decide: decidePlacement,
|
|
194
|
+
preparation: {
|
|
195
|
+
external: () => ({ kind: "prepared", prepared: input }),
|
|
196
|
+
assemble: (observation) => sameTarget(contractState(observation.decision, input.contractId)?.coordinates.target, target)
|
|
197
|
+
? { kind: "prepared", input }
|
|
198
|
+
: { kind: "stale" },
|
|
199
|
+
},
|
|
194
200
|
...(admission.progress === undefined ? {} : { progress: admission.progress }),
|
|
195
201
|
observe: (observedRepository, observedChannel, contracts) => observeGitForAdmissionAt(observedRepository, observedChannel, contracts),
|
|
196
202
|
};
|
|
@@ -41,12 +41,6 @@ export function isOperationalFailure(error) {
|
|
|
41
41
|
export function isOperationalStop(error, signal) {
|
|
42
42
|
if (signal?.aborted === true && error === signal.reason)
|
|
43
43
|
return true;
|
|
44
|
-
if (error instanceof AuthorityCorruptionError ||
|
|
45
|
-
error instanceof TypeError ||
|
|
46
|
-
error instanceof RangeError ||
|
|
47
|
-
error instanceof ReferenceError ||
|
|
48
|
-
error instanceof SyntaxError)
|
|
49
|
-
return false;
|
|
50
44
|
return isOperationalFailure(error);
|
|
51
45
|
}
|
|
52
46
|
/** Classify operational failures only; programming errors and corrupt authority still throw. */
|
|
@@ -2,13 +2,15 @@ import { z } from "zod";
|
|
|
2
2
|
import type { ContractWorkspaceObservation } from "../../git/workspace.js";
|
|
3
3
|
import type { GitRepository } from "../../git/process.js";
|
|
4
4
|
import { type GitDecodeChannel, type GitReadObservation } from "../../git/read-observation.js";
|
|
5
|
-
import { type ContractId, type SnapshotId } from "../../core/facts/types.js";
|
|
5
|
+
import { type ContractId, type ContractState, type SnapshotId } from "../../core/facts/types.js";
|
|
6
|
+
import { type LifecycleSelection } from "../../bounded-list.js";
|
|
6
7
|
declare const phaseSchema: z.ZodEnum<{
|
|
7
8
|
claimed: "claimed";
|
|
8
9
|
abandoned: "abandoned";
|
|
9
10
|
bound: "bound";
|
|
10
11
|
}>;
|
|
11
12
|
export type ContractPhase = z.output<typeof phaseSchema>;
|
|
13
|
+
export declare function contractLifecycle(phase: ContractPhase): "active" | "settled";
|
|
12
14
|
declare const summaryGateSchema: z.ZodReadonly<z.ZodObject<{
|
|
13
15
|
name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
14
16
|
verdict: z.ZodEnum<{
|
|
@@ -151,6 +153,16 @@ declare const detailCurrentSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObjec
|
|
|
151
153
|
kind: z.ZodLiteral<"missing">;
|
|
152
154
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
153
155
|
kind: z.ZodLiteral<"stale">;
|
|
156
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
157
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
158
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
159
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
160
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
161
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
162
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
163
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
164
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
165
|
+
}, z.core.$strict>>]>>;
|
|
154
166
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
155
167
|
kind: z.ZodLiteral<"attested">;
|
|
156
168
|
verdict: z.ZodEnum<{
|
|
@@ -167,6 +179,16 @@ declare const rowGateSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
167
179
|
kind: z.ZodLiteral<"missing">;
|
|
168
180
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
169
181
|
kind: z.ZodLiteral<"stale">;
|
|
182
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
183
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
184
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
185
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
186
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
187
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
189
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
190
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
191
|
+
}, z.core.$strict>>]>>;
|
|
170
192
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
171
193
|
kind: z.ZodLiteral<"attested">;
|
|
172
194
|
verdict: z.ZodEnum<{
|
|
@@ -260,6 +282,16 @@ export declare const contractDetailSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
260
282
|
kind: z.ZodLiteral<"missing">;
|
|
261
283
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
262
284
|
kind: z.ZodLiteral<"stale">;
|
|
285
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
286
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
287
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
288
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
289
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
290
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
291
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
292
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
293
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
294
|
+
}, z.core.$strict>>]>>;
|
|
263
295
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
264
296
|
kind: z.ZodLiteral<"attested">;
|
|
265
297
|
verdict: z.ZodEnum<{
|
|
@@ -343,6 +375,16 @@ export declare const contractObservationSchema: z.ZodUnion<readonly [z.ZodReadon
|
|
|
343
375
|
kind: z.ZodLiteral<"missing">;
|
|
344
376
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
345
377
|
kind: z.ZodLiteral<"stale">;
|
|
378
|
+
reason: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
379
|
+
kind: z.ZodLiteral<"candidate-content-changed">;
|
|
380
|
+
target: z.ZodExactOptional<z.ZodString>;
|
|
381
|
+
previousChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
382
|
+
currentChange: z.ZodPipe<z.ZodString, z.ZodTransform<import("../../core/facts/types.js").ChangeId, string>>;
|
|
383
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
384
|
+
kind: z.ZodLiteral<"snapshot-changed">;
|
|
385
|
+
previousSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
386
|
+
currentSnapshot: z.ZodPipe<z.ZodString, z.ZodTransform<SnapshotId, string>>;
|
|
387
|
+
}, z.core.$strict>>]>>;
|
|
346
388
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
347
389
|
kind: z.ZodLiteral<"attested">;
|
|
348
390
|
verdict: z.ZodEnum<{
|
|
@@ -382,13 +424,19 @@ export declare function readContractCount(observation: GitReadObservation): numb
|
|
|
382
424
|
/** Selection observes journals and appointments, never physical state or dependencies. */
|
|
383
425
|
export declare function readContractMembership(observation: GitReadObservation, ids?: readonly ContractId[]): Promise<readonly ContractMembership[]>;
|
|
384
426
|
export declare function readContractMembershipAt(repository: GitRepository, channel: GitDecodeChannel, ids?: readonly ContractId[]): Promise<readonly ContractMembership[]>;
|
|
427
|
+
export declare function summaryFor({ state, bindAt }: Pick<SelectedContractState, "state" | "bindAt">): ContractSummary;
|
|
385
428
|
/** Observe one Contract and its target from one fresh ref epoch. */
|
|
386
429
|
export declare function readContractObservation(observation: GitReadObservation, id: ContractId): Promise<ContractObservation>;
|
|
430
|
+
type SelectedContractState = Readonly<{
|
|
431
|
+
state: ContractState;
|
|
432
|
+
bindAt: string;
|
|
433
|
+
lastJournalAt: string;
|
|
434
|
+
}>;
|
|
387
435
|
/**
|
|
388
|
-
* Observe
|
|
389
|
-
*
|
|
436
|
+
* Observe selected lifecycle classes under one recent-journal order and bound,
|
|
437
|
+
* from one immutable Git observation. Settled rows never observe physical state.
|
|
390
438
|
*/
|
|
391
|
-
export declare function readContractCatalogue(observation: GitReadObservation, limit?: number): Promise<ContractCatalogue>;
|
|
439
|
+
export declare function readContractCatalogue(observation: GitReadObservation, limit?: number, selection?: LifecycleSelection): Promise<ContractCatalogue>;
|
|
392
440
|
/**
|
|
393
441
|
* Observe only a Contract's phase from one immutable git observation, without
|
|
394
442
|
* workspace or target reads.
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { errorCategory } from "../../errors.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { contractIdSchema, contractJournalPaths, snapshotIdSchema } from "../../git/identity.js";
|
|
4
|
-
import { gateSchema } from "../result-leaves.js";
|
|
5
|
-
import {
|
|
4
|
+
import { gateSchema, gateStaleReasonSchema } from "../result-leaves.js";
|
|
5
|
+
import { observedContractJournalPaths, observeContractJournals, observeContractsForAdmissionInObservationAt, deliveryTargetObserver, withContractReadObservationAt, } from "../../git/observe.js";
|
|
6
6
|
import { decodeContractDocument } from "../../body/decode.js";
|
|
7
7
|
import { observeTargetLag, observeWorkspace, worktreePath } from "../../git/workspace.js";
|
|
8
8
|
import { appointmentFor, readPlaceRegister } from "../../workspace-place.js";
|
|
9
9
|
import { withGitTargetedReadObservation, } from "../../git/read-observation.js";
|
|
10
10
|
import { gateReports } from "../../core/facts/gate.js";
|
|
11
11
|
import { verificationRequirement } from "../../verification/declaration.js";
|
|
12
|
+
import { targetName, } from "../../core/facts/types.js";
|
|
12
13
|
import { projectBoundedList } from "../../bounded-list.js";
|
|
13
14
|
import { observeCurrentPhysicalIssue } from "./observation.js";
|
|
14
15
|
const phaseSchema = z.enum(["bound", "claimed", "abandoned"]);
|
|
16
|
+
export function contractLifecycle(phase) {
|
|
17
|
+
return phase === "bound" ? "active" : "settled";
|
|
18
|
+
}
|
|
15
19
|
const summaryGateSchema = z
|
|
16
20
|
.strictObject({
|
|
17
21
|
name: gateSchema,
|
|
@@ -77,7 +81,7 @@ export const contractCatalogueSchema = z
|
|
|
77
81
|
.readonly();
|
|
78
82
|
const detailCurrentSchema = z.union([
|
|
79
83
|
z.strictObject({ kind: z.literal("missing") }).readonly(),
|
|
80
|
-
z.strictObject({ kind: z.literal("stale") }).readonly(),
|
|
84
|
+
z.strictObject({ kind: z.literal("stale"), reason: gateStaleReasonSchema.exactOptional() }).readonly(),
|
|
81
85
|
z
|
|
82
86
|
.strictObject({
|
|
83
87
|
kind: z.literal("attested"),
|
|
@@ -162,12 +166,12 @@ export const contractObservationSchema = z.union([
|
|
|
162
166
|
z.strictObject({ kind: z.literal("present"), row: contractDetailSchema }).readonly(),
|
|
163
167
|
]);
|
|
164
168
|
export function readContractCount(observation) {
|
|
165
|
-
return
|
|
169
|
+
return observedContractJournalPaths(observation, "active").length;
|
|
166
170
|
}
|
|
167
171
|
/** Selection observes journals and appointments, never physical state or dependencies. */
|
|
168
172
|
export async function readContractMembership(observation, ids) {
|
|
169
173
|
const contracts = ids === undefined
|
|
170
|
-
? await
|
|
174
|
+
? await observeContractJournals(observation, "active")
|
|
171
175
|
: (await observeContractsForAdmissionInObservationAt(observation, ids)).journals;
|
|
172
176
|
const register = await readPlaceRegister(observation.repository);
|
|
173
177
|
return [...contracts.values()].flatMap(({ state }) => {
|
|
@@ -225,7 +229,7 @@ function summaryVerdict(current) {
|
|
|
225
229
|
return "stale";
|
|
226
230
|
return current.verdict;
|
|
227
231
|
}
|
|
228
|
-
function summaryFor({ state, bindAt }) {
|
|
232
|
+
export function summaryFor({ state, bindAt }) {
|
|
229
233
|
const document = documentFor(state);
|
|
230
234
|
const title = titleFor(document);
|
|
231
235
|
const gates = gateReports(state).reports.map((report) => ({
|
|
@@ -389,7 +393,9 @@ export async function readContractObservation(observation, id) {
|
|
|
389
393
|
verdict: current.verdict,
|
|
390
394
|
...(current.summary === undefined ? {} : { summary: current.summary }),
|
|
391
395
|
}
|
|
392
|
-
:
|
|
396
|
+
: current.kind === "stale"
|
|
397
|
+
? { kind: current.kind, ...(current.reason === undefined ? {} : { reason: current.reason }) }
|
|
398
|
+
: { kind: current.kind },
|
|
393
399
|
};
|
|
394
400
|
}),
|
|
395
401
|
}));
|
|
@@ -400,13 +406,7 @@ export async function readContractObservation(observation, id) {
|
|
|
400
406
|
...(title === undefined ? {} : { title }),
|
|
401
407
|
phase: phaseFor(state),
|
|
402
408
|
workspace: facts.workspace,
|
|
403
|
-
...(state.coordinates.target === undefined
|
|
404
|
-
? {}
|
|
405
|
-
: {
|
|
406
|
-
target: typeof state.coordinates.target === "string"
|
|
407
|
-
? state.coordinates.target
|
|
408
|
-
: state.coordinates.target.contractId,
|
|
409
|
-
}),
|
|
409
|
+
...(state.coordinates.target === undefined ? {} : { target: targetName(state.coordinates.target) }),
|
|
410
410
|
...(facts.targetLag === undefined ? {} : { targetLag: facts.targetLag }),
|
|
411
411
|
...(state.delivery === null
|
|
412
412
|
? {}
|
|
@@ -448,20 +448,24 @@ function selectedContractStates(contracts) {
|
|
|
448
448
|
]);
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
451
|
-
* Observe
|
|
452
|
-
*
|
|
451
|
+
* Observe selected lifecycle classes under one recent-journal order and bound,
|
|
452
|
+
* from one immutable Git observation. Settled rows never observe physical state.
|
|
453
453
|
*/
|
|
454
|
-
export async function readContractCatalogue(observation, limit) {
|
|
454
|
+
export async function readContractCatalogue(observation, limit, selection = "active") {
|
|
455
455
|
const observedAt = new Date().toISOString();
|
|
456
|
-
const
|
|
457
|
-
const
|
|
458
|
-
.filter(({ state }) => state
|
|
456
|
+
const contracts = await observeContractJournals(observation, selection === "all" ? undefined : selection === "active" ? "active" : "terminal");
|
|
457
|
+
const matching = selectedContractStates(contracts)
|
|
458
|
+
.filter(({ state }) => selection === "all" || contractLifecycle(phaseFor(state)) === selection)
|
|
459
459
|
.sort(compareRecentContracts);
|
|
460
|
-
const selected = limit === undefined ? { rows:
|
|
461
|
-
const register =
|
|
460
|
+
const selected = limit === undefined ? { rows: matching, hasMore: false } : projectBoundedList(matching, limit);
|
|
461
|
+
const register = selected.rows.some(({ state }) => contractLifecycle(phaseFor(state)) === "active")
|
|
462
|
+
? await readPlaceRegister(observation.repository)
|
|
463
|
+
: undefined;
|
|
462
464
|
const observeTarget = deliveryTargetObserver(observation);
|
|
463
465
|
const rows = await Promise.all(selected.rows.map(async (selected) => {
|
|
464
466
|
const { state } = selected;
|
|
467
|
+
if (contractLifecycle(phaseFor(state)) === "settled")
|
|
468
|
+
return summaryFor(selected);
|
|
465
469
|
const attention = summaryAttention(await managedWorkspaceFacts(observation.repository, state, appointedWorkspace(observation.repository, register, state), await observeTarget(state)));
|
|
466
470
|
return { ...summaryFor(selected), ...(attention.length === 0 ? {} : { attention }) };
|
|
467
471
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { contractState, targetContractRefusal } from "../core/facts/observation.js";
|
|
2
|
-
import { targetName, } from "../core/facts/types.js";
|
|
2
|
+
import { targetName, sameTarget, } from "../core/facts/types.js";
|
|
3
3
|
import { resolveContractTarget, targetRef } from "../git/target.js";
|
|
4
4
|
import { decideReintegrate } from "../core/verbs/reintegrate.js";
|
|
5
5
|
import { materializeReintegrationSnapshot, persistedTender, planIntegration, reusableIntegrationSnapshot, } from "../git/integration.js";
|
|
@@ -38,7 +38,7 @@ function assembleReintegrationAttempt(input, observation, external) {
|
|
|
38
38
|
}
|
|
39
39
|
if (external.kind === "unavailable")
|
|
40
40
|
return STALE_PRIVATE_STATE_PREPARATION;
|
|
41
|
-
if (external.witness.head !== state.head)
|
|
41
|
+
if (external.witness.head !== state.head || !sameTarget(state.coordinates.target, input.target))
|
|
42
42
|
return STALE_PRIVATE_STATE_PREPARATION;
|
|
43
43
|
if (state.delivery === null || state.currentIntegration === null) {
|
|
44
44
|
return { kind: "unavailable", refusal: { kind: "delivery-missing" } };
|