@astrosheep/keiyaku 4.0.3 → 4.0.5
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/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +4 -4
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +15 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +3 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +34 -13
- package/build/src/akuma/akuma.d.ts +34 -12
- package/build/src/akuma/akuma.js +118 -63
- package/build/src/akuma/allowed.d.ts +7 -0
- package/build/src/akuma/allowed.js +33 -0
- package/build/src/akuma/archetype.d.ts +7 -4
- package/build/src/akuma/archetype.js +15 -16
- package/build/src/akuma/body.d.ts +6 -1
- package/build/src/akuma/body.js +36 -27
- package/build/src/akuma/heart/facts.d.ts +82 -14
- package/build/src/akuma/heart/index.d.ts +5 -18
- package/build/src/akuma/heart/index.js +14 -84
- package/build/src/akuma/heart/request-authority.d.ts +12 -0
- package/build/src/akuma/heart/request-authority.js +119 -0
- package/build/src/akuma/heart/request-rows.d.ts +16 -0
- package/build/src/akuma/heart/request-rows.js +88 -0
- package/build/src/akuma/heart/rows.d.ts +1 -26
- package/build/src/akuma/heart/rows.js +0 -50
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +22 -10
- package/build/src/akuma/heart/soul.js +2 -36
- package/build/src/akuma/heart/storage.d.ts +1 -0
- package/build/src/akuma/heart/storage.js +15 -0
- package/build/src/akuma/heart/timeline.d.ts +1 -5
- package/build/src/akuma/heart/timeline.js +8 -17
- package/build/src/akuma/index.d.ts +5 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/projection.d.ts +17 -3
- package/build/src/akuma/projection.js +40 -3
- package/build/src/akuma/provider-recipe.js +1 -11
- package/build/src/akuma/provider.d.ts +2 -7
- package/build/src/akuma/provider.js +2 -1
- package/build/src/akuma/providers/acp/core.d.ts +3 -1
- package/build/src/akuma/providers/acp/core.js +10 -6
- package/build/src/akuma/providers/acp/events.d.ts +11 -3
- package/build/src/akuma/providers/acp/events.js +78 -4
- package/build/src/akuma/providers/acp/index.js +0 -1
- package/build/src/akuma/providers/claude/events.js +62 -3
- package/build/src/akuma/providers/claude/index.d.ts +0 -4
- package/build/src/akuma/providers/claude/index.js +7 -3
- package/build/src/akuma/providers/codex-app-server/events.js +1 -13
- package/build/src/akuma/providers/codex-app-server/index.d.ts +2 -27
- package/build/src/akuma/providers/codex-app-server/index.js +0 -2
- package/build/src/akuma/providers/grok-build/index.d.ts +2 -1
- package/build/src/akuma/providers/grok-build/index.js +72 -3
- package/build/src/akuma/providers/opencode-sdk/events.js +71 -6
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +2 -28
- package/build/src/akuma/providers/opencode-sdk/index.js +8 -4
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +1 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +1 -1
- package/build/src/akuma/providers/pi/events.js +17 -3
- package/build/src/akuma/providers/pi/index.js +11 -4
- package/build/src/akuma/providers/unified-patch.d.ts +4 -0
- package/build/src/akuma/providers/unified-patch.js +14 -0
- package/build/src/akuma/publication.d.ts +1 -1
- package/build/src/akuma/publication.js +1 -1
- package/build/src/akuma/request-serve.d.ts +87 -0
- package/build/src/akuma/request-serve.js +484 -0
- package/build/src/akuma/request-wire.d.ts +124 -0
- package/build/src/akuma/request-wire.js +380 -0
- package/build/src/akuma/requests.d.ts +41 -41
- package/build/src/akuma/requests.js +75 -374
- package/build/src/akuma-body.d.ts +8 -0
- package/build/src/akuma-body.js +84 -0
- package/build/src/body/arc.js +4 -29
- package/build/src/body/decode.js +5 -39
- package/build/src/body/envelope.d.ts +7 -0
- package/build/src/body/envelope.js +37 -0
- package/build/src/cli/accepted.d.ts +4 -1
- package/build/src/cli/accepted.js +39 -9
- package/build/src/cli/commands/akuma-invoke.d.ts +8 -7
- package/build/src/cli/commands/akuma-invoke.js +18 -10
- package/build/src/cli/commands/akuma.d.ts +11 -2
- package/build/src/cli/commands/akuma.js +67 -28
- package/build/src/cli/commands/amend.d.ts +1 -1
- package/build/src/cli/commands/amend.js +1 -1
- package/build/src/cli/commands/contract.d.ts +8 -8
- package/build/src/cli/commands/contract.js +3 -3
- package/build/src/cli/commands/install.js +2 -2
- package/build/src/cli/commands/task-invoke.js +98 -9
- package/build/src/cli/commands/task-query.d.ts +1 -1
- package/build/src/cli/commands/task-query.js +11 -5
- package/build/src/cli/coordinates.d.ts +2 -0
- package/build/src/cli/coordinates.js +12 -5
- package/build/src/cli/invoke.d.ts +1 -0
- package/build/src/cli/invoke.js +116 -75
- package/build/src/cli/main.d.ts +2 -0
- package/build/src/cli/main.js +29 -4
- package/build/src/cli/parse.d.ts +3 -2
- package/build/src/cli/parse.js +25 -8
- package/build/src/cli/render/akuma.d.ts +2 -2
- package/build/src/cli/render/akuma.js +138 -24
- package/build/src/cli/render/audit.js +18 -8
- package/build/src/cli/render/contract.d.ts +2 -0
- package/build/src/cli/render/contract.js +243 -36
- package/build/src/cli/render/kanshi.js +64 -29
- package/build/src/cli/render/receipt.d.ts +2 -1
- package/build/src/cli/render/receipt.js +37 -2
- package/build/src/cli/render/terminal.d.ts +0 -2
- package/build/src/cli/render/terminal.js +0 -29
- package/build/src/cli/render/text.js +3 -1
- package/build/src/cli/result.d.ts +52 -9
- package/build/src/cli/selectors.d.ts +1 -0
- package/build/src/cli/selectors.js +9 -6
- package/build/src/contract-worktree.d.ts +1 -2
- package/build/src/contract-worktree.js +7 -9
- package/build/src/core/facts/codec.js +9 -0
- package/build/src/core/facts/fold.js +13 -1
- package/build/src/core/facts/types.d.ts +8 -1
- package/build/src/core/subject.js +4 -3
- package/build/src/core/verbs/placement.d.ts +9 -1
- package/build/src/core/verbs/placement.js +24 -6
- package/build/src/core/verbs/reintegrate.d.ts +13 -0
- package/build/src/core/verbs/reintegrate.js +24 -0
- package/build/src/dispatch/index.d.ts +1 -1
- package/build/src/dispatch/index.js +50 -39
- package/build/src/git/admission.d.ts +2 -1
- package/build/src/git/hooks.d.ts +0 -4
- package/build/src/git/hooks.js +0 -36
- package/build/src/git/integration.d.ts +7 -8
- package/build/src/git/integration.js +62 -9
- package/build/src/git/observe.d.ts +2 -1
- package/build/src/git/observe.js +6 -5
- package/build/src/git/process.d.ts +26 -0
- package/build/src/git/process.js +94 -0
- package/build/src/git/read-observation.d.ts +2 -1
- package/build/src/git/read-observation.js +3 -2
- package/build/src/git/reconcile.d.ts +8 -2
- package/build/src/git/reconcile.js +63 -14
- package/build/src/git/repository.d.ts +2 -29
- package/build/src/git/repository.js +4 -118
- package/build/src/git/scratch.d.ts +1 -1
- package/build/src/git/scratch.js +1 -1
- package/build/src/git/target-placement.d.ts +1 -1
- package/build/src/git/target-placement.js +9 -7
- package/build/src/git/tender.d.ts +20 -5
- package/build/src/git/tender.js +45 -13
- package/build/src/git/terminal-seal.d.ts +16 -2
- package/build/src/git/terminal-seal.js +15 -5
- package/build/src/git/workspace.d.ts +2 -1
- package/build/src/git/workspace.js +13 -5
- package/build/src/index.d.ts +1 -2
- package/build/src/index.js +1 -1
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +9 -1
- package/build/src/kanshi/read.js +91 -37
- package/build/src/kanshi/report.d.ts +1 -0
- package/build/src/library/address.d.ts +5 -14
- package/build/src/library/address.js +27 -23
- package/build/src/library/akuma-creation.d.ts +4 -2
- package/build/src/library/akuma-creation.js +43 -26
- package/build/src/library/audit.d.ts +2 -1
- package/build/src/library/audit.js +1 -1
- package/build/src/library/bind.d.ts +2 -1
- package/build/src/library/bind.js +4 -4
- package/build/src/library/catalog.d.ts +1 -2
- package/build/src/library/catalog.js +11 -6
- package/build/src/library/configuration.d.ts +5 -1
- package/build/src/library/configuration.js +71 -18
- package/build/src/library/contract.d.ts +70 -3
- package/build/src/library/contract.js +213 -27
- package/build/src/library/delivery.d.ts +1 -1
- package/build/src/library/fleet.d.ts +70 -12
- package/build/src/library/fleet.js +236 -56
- package/build/src/library/input.d.ts +0 -1
- package/build/src/library/input.js +1 -5
- package/build/src/library/keiyaku.d.ts +4 -4
- package/build/src/library/keiyaku.js +1 -2
- package/build/src/library/mutation.d.ts +2 -1
- package/build/src/library/reconcile.d.ts +2 -1
- package/build/src/library/reconcile.js +3 -1
- package/build/src/library/region.d.ts +1 -1
- package/build/src/library/repo.d.ts +3 -1
- package/build/src/library/repo.js +8 -4
- package/build/src/protocol/abandon.d.ts +9 -0
- package/build/src/protocol/abandon.js +15 -0
- package/build/src/protocol/amend.d.ts +16 -0
- package/build/src/protocol/amend.js +77 -0
- package/build/src/protocol/arc.d.ts +6 -0
- package/build/src/protocol/arc.js +12 -0
- package/build/src/protocol/attempt.d.ts +2 -1
- package/build/src/protocol/audit.d.ts +53 -0
- package/build/src/protocol/audit.js +140 -0
- package/build/src/protocol/bind.d.ts +2 -3
- package/build/src/protocol/bind.js +2 -16
- package/build/src/protocol/completion.d.ts +32 -0
- package/build/src/protocol/completion.js +130 -0
- package/build/src/protocol/deliver.d.ts +37 -0
- package/build/src/protocol/deliver.js +160 -0
- package/build/src/protocol/intent.d.ts +1 -1
- package/build/src/protocol/intent.js +1 -1
- package/build/src/protocol/operations.d.ts +65 -198
- package/build/src/protocol/operations.js +21 -634
- package/build/src/protocol/placement.d.ts +4 -13
- package/build/src/protocol/placement.js +3 -15
- package/build/src/protocol/read/status.d.ts +4 -2
- package/build/src/protocol/read/status.js +27 -15
- package/build/src/protocol/reconcile.d.ts +35 -0
- package/build/src/protocol/reconcile.js +41 -0
- package/build/src/protocol/reintegrate.d.ts +31 -0
- package/build/src/protocol/reintegrate.js +74 -0
- package/build/src/protocol/review.d.ts +33 -0
- package/build/src/protocol/review.js +148 -0
- package/build/src/protocol/run.d.ts +1 -1
- package/build/src/runtime/proc/run.d.ts +1 -0
- package/build/src/runtime/proc/run.js +9 -2
- package/build/src/settlement/fence.d.ts +1 -1
- package/build/src/settlement/holder.d.ts +1 -1
- package/build/src/settlement/settle.d.ts +2 -1
- package/build/src/settlement/settle.js +4 -1
- package/build/src/task/board.d.ts +18 -4
- package/build/src/task/board.js +73 -29
- package/build/src/task/compose.d.ts +1 -1
- package/build/src/task/compose.js +11 -4
- package/build/src/task/index.d.ts +4 -4
- package/build/src/task/index.js +8 -131
- package/build/src/task/input.d.ts +18 -0
- package/build/src/task/input.js +189 -0
- package/build/src/task/mutation.d.ts +39 -0
- package/build/src/task/mutation.js +85 -0
- package/build/src/task/operations.d.ts +4 -19
- package/build/src/task/operations.js +64 -18
- package/build/src/task/query.d.ts +9 -2
- package/build/src/task/query.js +32 -64
- package/build/src/task/store.js +0 -2
- package/build/src/verification/execution.d.ts +1 -1
- package/build/src/verification/execution.js +2 -1
- package/build/src/workspace-place.d.ts +1 -4
- package/build/src/workspace-place.js +0 -15
- package/package.json +5 -3
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { materializeIntegrationSnapshot, planIntegration, worktreeChangeId, } from "../git/integration.js";
|
|
2
|
+
import { captureTender, dirtyTenderRefusal, materializeTenderSnapshot, prepareDeliveryCommitMetadata, } from "../git/tender.js";
|
|
3
|
+
import { currentBranch, observeContractsForAdmissionAt } from "../git/observe.js";
|
|
4
|
+
import { contractState } from "../core/facts/observation.js";
|
|
5
|
+
import { decideDeliver } from "../core/verbs/deliver.js";
|
|
6
|
+
import { admitDecidedOffer, mintAttempts } from "./attempt.js";
|
|
7
|
+
import { admitted } from "./outcome.js";
|
|
8
|
+
import { completeCandidate } from "./completion.js";
|
|
9
|
+
import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
|
|
10
|
+
import { timestamp } from "./operations.js";
|
|
11
|
+
export async function prepareDelivery(repository, stage, input) {
|
|
12
|
+
const { contractId, coordinates } = stage;
|
|
13
|
+
if (coordinates.workspace === "here" && coordinates.target !== undefined) {
|
|
14
|
+
const branch = await currentBranch(repository);
|
|
15
|
+
if (branch !== coordinates.target) {
|
|
16
|
+
return {
|
|
17
|
+
kind: "refused",
|
|
18
|
+
refusal: { kind: "workspace-not-on-target", contractId, target: coordinates.target, branch },
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const appointed = coordinates.workspace === "worktree"
|
|
23
|
+
? stage.appointment === undefined
|
|
24
|
+
? appointmentFor(await readPlaceRegister(repository), contractId)
|
|
25
|
+
: { contract: contractId, place: stage.appointment.place }
|
|
26
|
+
: undefined;
|
|
27
|
+
const tender = await captureTender(repository, {
|
|
28
|
+
contractId,
|
|
29
|
+
coordinates,
|
|
30
|
+
...(appointed === undefined ? {} : { place: appointed.place }),
|
|
31
|
+
});
|
|
32
|
+
if (tender.kind === "refused")
|
|
33
|
+
return tender;
|
|
34
|
+
if ((tender.data.dirty && input.includeDirty !== true) || tender.data.changes.submodules.length > 0) {
|
|
35
|
+
return { kind: "refused", refusal: await dirtyTenderRefusal(repository, contractId, tender.data) };
|
|
36
|
+
}
|
|
37
|
+
const commit = await prepareDeliveryCommitMetadata(repository, {
|
|
38
|
+
contractId,
|
|
39
|
+
title: input.title,
|
|
40
|
+
document: input.document,
|
|
41
|
+
at: tender.data.at,
|
|
42
|
+
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
43
|
+
...(input.message === undefined ? {} : { message: input.message }),
|
|
44
|
+
});
|
|
45
|
+
const tenderSnapshot = await materializeTenderSnapshot(repository, tender.data, commit);
|
|
46
|
+
const requireBranchesToBeUpToDate = input.requireBranchesToBeUpToDate ?? false;
|
|
47
|
+
const integration = await planIntegration(repository, { contractId, coordinates }, { ...tender.data, head: tenderSnapshot }, requireBranchesToBeUpToDate);
|
|
48
|
+
if (integration.kind === "refused")
|
|
49
|
+
return integration;
|
|
50
|
+
const integrationSnapshot = coordinates.target === undefined
|
|
51
|
+
? tenderSnapshot
|
|
52
|
+
: await materializeIntegrationSnapshot(repository, integration.data.tree, integration.data.predecessor, commit);
|
|
53
|
+
return {
|
|
54
|
+
kind: "prepared",
|
|
55
|
+
data: {
|
|
56
|
+
tenderSnapshot,
|
|
57
|
+
integration: {
|
|
58
|
+
predecessor: integration.data.predecessor,
|
|
59
|
+
snapshot: integrationSnapshot,
|
|
60
|
+
changeId: await worktreeChangeId(repository, { contractId, coordinates }, tender.data),
|
|
61
|
+
},
|
|
62
|
+
method: "squash",
|
|
63
|
+
policy: { requireBranchesToBeUpToDate },
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function deliverAttempt(input, attempt) {
|
|
68
|
+
const decisionObservation = await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]);
|
|
69
|
+
const state = contractState(decisionObservation.decision, input.contractId);
|
|
70
|
+
const derivation = state === null ? undefined : input.deriveDocument(state);
|
|
71
|
+
let preparation;
|
|
72
|
+
if (state === null || derivation === undefined) {
|
|
73
|
+
preparation = { kind: "unavailable" };
|
|
74
|
+
}
|
|
75
|
+
else if (derivation.verification.kind === "refused") {
|
|
76
|
+
preparation = { kind: "refused", document: derivation.document, refusal: derivation.verification.refusal };
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const prepared = await prepareDelivery(input.scope, { contractId: state.id, coordinates: state.coordinates }, {
|
|
80
|
+
title: derivation.title,
|
|
81
|
+
document: derivation.bytes,
|
|
82
|
+
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
83
|
+
...(input.message === undefined ? {} : { message: input.message }),
|
|
84
|
+
requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate,
|
|
85
|
+
includeDirty: input.includeDirty,
|
|
86
|
+
});
|
|
87
|
+
preparation = prepared.kind === "refused"
|
|
88
|
+
? { kind: "refused", document: derivation.document, refusal: prepared.refusal }
|
|
89
|
+
: { kind: "prepared", document: derivation.document, data: prepared.data };
|
|
90
|
+
}
|
|
91
|
+
const decision = decideDeliver({
|
|
92
|
+
input: {
|
|
93
|
+
contractId: input.contractId,
|
|
94
|
+
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
95
|
+
at: timestamp(),
|
|
96
|
+
preparation,
|
|
97
|
+
},
|
|
98
|
+
attempt,
|
|
99
|
+
observation: decisionObservation.decision,
|
|
100
|
+
});
|
|
101
|
+
if (decision.kind === "refused")
|
|
102
|
+
return { kind: "refused", refusal: decision.refusal };
|
|
103
|
+
if (preparation.kind !== "prepared")
|
|
104
|
+
throw new Error("offered delivery is missing its mechanical preparation");
|
|
105
|
+
const admission = await admitDecidedOffer({
|
|
106
|
+
channel: input.channel,
|
|
107
|
+
repository: input.scope,
|
|
108
|
+
decisionObservation,
|
|
109
|
+
attempt,
|
|
110
|
+
offer: decision.offer,
|
|
111
|
+
primaryContract: input.contractId,
|
|
112
|
+
});
|
|
113
|
+
if (admission.kind === "accepted") {
|
|
114
|
+
if (derivation === undefined)
|
|
115
|
+
throw new Error("accepted delivery is missing its document derivation");
|
|
116
|
+
return { ...admission, value: { delivery: preparation.data, derivation } };
|
|
117
|
+
}
|
|
118
|
+
return admission;
|
|
119
|
+
}
|
|
120
|
+
async function completeDelivery(input, first) {
|
|
121
|
+
const derivation = first.value.derivation;
|
|
122
|
+
if (derivation.verification.kind !== "prepared") {
|
|
123
|
+
throw new Error("accepted delivery is missing its Verification preparation");
|
|
124
|
+
}
|
|
125
|
+
const completed = await completeCandidate({
|
|
126
|
+
channel: input.channel,
|
|
127
|
+
repository: input.scope,
|
|
128
|
+
contractId: input.contractId,
|
|
129
|
+
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
130
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
131
|
+
...(first.state.coordinates.target === undefined ? {} : { target: first.state.coordinates.target }),
|
|
132
|
+
verification: derivation.verification,
|
|
133
|
+
initial: first,
|
|
134
|
+
verifyInitial: true,
|
|
135
|
+
});
|
|
136
|
+
return admitted(completed.admission, {
|
|
137
|
+
...first.value.delivery,
|
|
138
|
+
...completed.evidence,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export async function deliverOperation(input) {
|
|
142
|
+
const attempts = mintAttempts({ entryCount: 2 });
|
|
143
|
+
let first = null;
|
|
144
|
+
for (let index = 0; index < attempts.length; index += 1) {
|
|
145
|
+
const result = await deliverAttempt(input, attempts[index]);
|
|
146
|
+
if (result.kind === "accepted") {
|
|
147
|
+
first = result;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
if (result.kind === "refused")
|
|
151
|
+
return result;
|
|
152
|
+
if (result.kind === "publication-failed")
|
|
153
|
+
return { kind: "retry", reason: result };
|
|
154
|
+
if (result.kind === "collision" && index + 1 === attempts.length)
|
|
155
|
+
return { kind: "retry", reason: result };
|
|
156
|
+
}
|
|
157
|
+
if (first === null)
|
|
158
|
+
return { kind: "retry", reason: { kind: "exhausted" } };
|
|
159
|
+
return await completeDelivery(input, first);
|
|
160
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GitDecisionObservation } from "../git/observe.js";
|
|
2
2
|
import type { GitDecodeChannel, GitTreeSelection } from "../git/read-observation.js";
|
|
3
|
-
import type { GitRepository } from "../git/
|
|
3
|
+
import type { GitRepository } from "../git/process.js";
|
|
4
4
|
import type { GitRefAssertion } from "../git/repository.js";
|
|
5
5
|
import { type WorktreeLeak } from "../git/scratch.js";
|
|
6
6
|
import type { HookFailure } from "../git/hooks.js";
|
|
@@ -51,7 +51,7 @@ export function currentVerifiedAttestation(state) {
|
|
|
51
51
|
}
|
|
52
52
|
/** Run Verification against an explicit or admitted integration snapshot. */
|
|
53
53
|
export async function verifyDelivery(input) {
|
|
54
|
-
const snapshot = input.snapshot ?? input.state.
|
|
54
|
+
const snapshot = input.snapshot ?? input.state.currentIntegration?.snapshot;
|
|
55
55
|
if (snapshot === undefined || input.verification === undefined)
|
|
56
56
|
return null;
|
|
57
57
|
const subject = dependencyKeySet([
|
|
@@ -1,122 +1,102 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
import { type
|
|
4
|
-
import type { WorktreeHooks } from "../git/hooks.js";
|
|
5
|
-
import { NoGitWorldError, type GitRepository } from "../git/repository.js";
|
|
6
|
-
import { type GitDecodeChannel, type GitTreeSelection } from "../git/read-observation.js";
|
|
1
|
+
import { type DirtyWorkspaceRefusal } from "../git/tender.js";
|
|
2
|
+
import type { GitRepository } from "../git/process.js";
|
|
3
|
+
import { type GitDecodeChannel } from "../git/read-observation.js";
|
|
7
4
|
import type { WorktreeLeak } from "../git/scratch.js";
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { type DeliverRefusal } from "../core/verbs/deliver.js";
|
|
5
|
+
import type { AbandonRefusal } from "../core/verbs/abandon.js";
|
|
6
|
+
import type { AmendRefusal } from "../core/verbs/amend.js";
|
|
7
|
+
import type { ArcRefusal } from "../core/verbs/arc.js";
|
|
8
|
+
import type { DeliverRefusal } from "../core/verbs/deliver.js";
|
|
13
9
|
import type { PlacementRefusal } from "../core/verbs/placement.js";
|
|
14
|
-
import {
|
|
10
|
+
import type { AttestationRefusal } from "../core/verbs/attestation.js";
|
|
11
|
+
import type { ContractId, ContractState, DeliverData, DocumentKey, SnapshotId } from "../core/facts/types.js";
|
|
12
|
+
import type { BindRefusal, TargetInputRefusal } from "./bind.js";
|
|
13
|
+
import type { IntegrationPreparationRefusal } from "../git/integration.js";
|
|
14
|
+
import type { TargetPlacementRefusal } from "../git/target-placement.js";
|
|
15
|
+
import type { VerificationCleanupFailure, VerificationRuntimeStop, VerificationResult } from "./intent.js";
|
|
15
16
|
import type { VerificationDeclarationPreparation, VerificationDeclarationRefusal } from "../verification/declaration.js";
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
17
|
+
import type { PlacementProtocolResult } from "./placement.js";
|
|
18
|
+
import type { AcceptedAdmission, DecidedOfferResult } from "./attempt.js";
|
|
19
|
+
import type { AcceptedProtocolStep, IntentOutcome as ProtocolIntentOutcome } from "./outcome.js";
|
|
20
|
+
import type { ProtocolResult, ProtocolTerminal } from "./run.js";
|
|
18
21
|
import { type ContractDocumentProjection } from "./read/documents.js";
|
|
19
|
-
import { type ContractBoard, type
|
|
20
|
-
import { type ManagedWorktreeAppointment } from "../workspace-place.js";
|
|
21
|
-
export { bindOperation } from "./bind.js";
|
|
22
|
-
export { reconcileObservationFailure } from "../git/reconcile.js";
|
|
23
|
-
import type { BindRefusal, TargetInputRefusal } from "./bind.js";
|
|
24
|
-
import { type IntentOutcome as ProtocolIntentOutcome } from "./outcome.js";
|
|
25
|
-
import type { ProtocolTerminal } from "./run.js";
|
|
26
|
-
import type { CompanionDecorator } from "./run.js";
|
|
27
|
-
export type { FactKind } from "../core/facts/types.js";
|
|
28
|
-
export type { ContractDocumentProjection } from "./read/documents.js";
|
|
22
|
+
import { type ContractBoard, type ContractObservation } from "./read/status.js";
|
|
29
23
|
export type DeliveryPreparationRefusal = Readonly<{
|
|
30
24
|
kind: "target-missing" | "worktree-missing";
|
|
31
25
|
contractId: ContractId;
|
|
32
26
|
}> | DirtyWorkspaceRefusal | IntegrationPreparationRefusal | TargetPlacementRefusal;
|
|
33
|
-
type
|
|
34
|
-
kind: "worktree-missing";
|
|
35
|
-
contractId: ContractId;
|
|
36
|
-
}> | DirtyWorkspaceRefusal;
|
|
37
|
-
type ReviewRefusal = AttestationRefusal | ReviewPreparationRefusal;
|
|
38
|
-
export type IntentRefusal = AbandonRefusal | AmendRefusal | ArcRefusal | BindRefusal | DeliverRefusal | DeliveryPreparationRefusal | PlacementRefusal | ReviewRefusal | TargetInputRefusal | VerificationDeclarationRefusal;
|
|
39
|
-
export type { TargetInputRefusal } from "./bind.js";
|
|
27
|
+
export type IntentRefusal = AbandonRefusal | AmendRefusal | ArcRefusal | BindRefusal | DeliverRefusal | DeliveryPreparationRefusal | PlacementRefusal | AttestationRefusal | TargetInputRefusal | VerificationDeclarationRefusal;
|
|
40
28
|
export type IntentRetry = ProtocolTerminal;
|
|
41
29
|
export type IntentOutcome<Value, Refusal = IntentRefusal> = ProtocolIntentOutcome<Value, Refusal>;
|
|
42
30
|
type OperationInput = Readonly<{
|
|
43
31
|
scope: RepositoryScope;
|
|
44
32
|
contractId: ContractId;
|
|
45
|
-
actor?: ActorId;
|
|
33
|
+
actor?: import("../core/facts/types.js").ActorId;
|
|
46
34
|
}>;
|
|
47
|
-
type MutationOperationInput = OperationInput & Readonly<{
|
|
35
|
+
export type MutationOperationInput = OperationInput & Readonly<{
|
|
48
36
|
channel: GitDecodeChannel;
|
|
49
37
|
}>;
|
|
50
|
-
export type AuditWorkspace = Readonly<{
|
|
51
|
-
kind: "worktree" | "here";
|
|
52
|
-
path: string;
|
|
53
|
-
}>;
|
|
54
|
-
export type DiffScope = DeliveryDiffScope;
|
|
55
|
-
export type AuditReport = Readonly<{
|
|
56
|
-
candidate: Readonly<{
|
|
57
|
-
kind: "blocked";
|
|
58
|
-
refusal: DeliveryPreparationRefusal;
|
|
59
|
-
}> | Readonly<{
|
|
60
|
-
kind: "ready";
|
|
61
|
-
workspace: AuditWorkspace;
|
|
62
|
-
identity: DeliveryIdentity;
|
|
63
|
-
scope: DiffScope;
|
|
64
|
-
diff?: string;
|
|
65
|
-
}>;
|
|
66
|
-
verification: Readonly<{
|
|
67
|
-
kind: "not-run";
|
|
68
|
-
}> | Readonly<{
|
|
69
|
-
kind: "satisfied";
|
|
70
|
-
passed: number;
|
|
71
|
-
total: number;
|
|
72
|
-
summary?: string;
|
|
73
|
-
}> | Readonly<{
|
|
74
|
-
kind: "unsatisfied";
|
|
75
|
-
passed: number;
|
|
76
|
-
total: number;
|
|
77
|
-
summary?: string;
|
|
78
|
-
}> | Readonly<{
|
|
79
|
-
kind: "stopped";
|
|
80
|
-
stop: VerificationStop;
|
|
81
|
-
}>;
|
|
82
|
-
target: Readonly<{
|
|
83
|
-
kind: "not-observed";
|
|
84
|
-
}> | AuditTargetAnswer;
|
|
85
|
-
delivery?: Readonly<{
|
|
86
|
-
changeId: ChangeId;
|
|
87
|
-
relation: "identical" | "differs";
|
|
88
|
-
}>;
|
|
89
|
-
}>;
|
|
90
|
-
export type VerificationReuse = CurrentVerifiedAttestation;
|
|
91
38
|
export type DocumentDerivation = Readonly<{
|
|
92
39
|
document: DocumentKey;
|
|
40
|
+
bytes: string;
|
|
93
41
|
title: string;
|
|
94
42
|
verification: VerificationDeclarationPreparation;
|
|
95
43
|
}>;
|
|
96
|
-
|
|
44
|
+
type StepStop<R> = Readonly<{
|
|
97
45
|
refusal: R;
|
|
98
46
|
retry?: never;
|
|
99
47
|
} | {
|
|
100
48
|
retry: IntentRetry;
|
|
101
49
|
refusal?: never;
|
|
102
50
|
}>;
|
|
103
|
-
export type VerificationStop = StepStop<AttestationRefusal> | VerificationRuntimeStop;
|
|
104
|
-
export type PlacementStop = StepStop<PlacementRefusal | TargetPlacementRefusal | IntegrationPreparationRefusal
|
|
51
|
+
export type VerificationStop = StepStop<AttestationRefusal | VerificationDeclarationRefusal> | VerificationRuntimeStop;
|
|
52
|
+
export type PlacementStop = StepStop<PlacementRefusal | TargetPlacementRefusal | IntegrationPreparationRefusal | Readonly<{
|
|
53
|
+
kind: "target-missing";
|
|
54
|
+
contractId: ContractId;
|
|
55
|
+
}>> | Readonly<{
|
|
105
56
|
failure: "target-moved";
|
|
106
57
|
contractId: ContractId;
|
|
107
58
|
target: string;
|
|
108
59
|
expected: SnapshotId;
|
|
109
60
|
observed: SnapshotId | null;
|
|
61
|
+
}> | Readonly<{
|
|
62
|
+
failure: "target-moved";
|
|
63
|
+
contractId: ContractId;
|
|
64
|
+
target: string;
|
|
65
|
+
integratedAt: SnapshotId;
|
|
66
|
+
observed: SnapshotId | null;
|
|
67
|
+
attempts: number;
|
|
110
68
|
}> | Readonly<{
|
|
111
69
|
failure: "target-placement-failed";
|
|
112
70
|
diagnostic: string;
|
|
113
71
|
}>;
|
|
114
|
-
type
|
|
115
|
-
|
|
72
|
+
export type AttemptDecision<Value, Refusal = IntentRefusal> = (AcceptedAdmission & Readonly<{
|
|
73
|
+
value: Value;
|
|
74
|
+
}>) | Readonly<{
|
|
75
|
+
kind: "refused";
|
|
76
|
+
refusal: Refusal;
|
|
77
|
+
}> | Readonly<{
|
|
78
|
+
kind: "redecide";
|
|
79
|
+
}> | Readonly<{
|
|
80
|
+
kind: "collision";
|
|
81
|
+
}> | Extract<DecidedOfferResult, {
|
|
82
|
+
kind: "publication-failed";
|
|
83
|
+
}>;
|
|
84
|
+
export declare function timestamp(): string;
|
|
85
|
+
export declare function mergeAdmissions(current: AcceptedProtocolStep, next: AcceptedProtocolStep): AcceptedProtocolStep;
|
|
86
|
+
export declare function stepStop<Refusal>(result: ProtocolResult<Refusal>): StepStop<Refusal> | undefined;
|
|
87
|
+
export declare function unpackVerificationOutcome(verification: VerificationResult): Readonly<{
|
|
88
|
+
cleanup?: VerificationCleanupFailure;
|
|
89
|
+
leak?: WorktreeLeak;
|
|
90
|
+
stop?: VerificationStop;
|
|
91
|
+
admission?: AcceptedProtocolStep;
|
|
92
|
+
counts?: NonNullable<VerificationResult["counts"]>;
|
|
116
93
|
}>;
|
|
94
|
+
export declare function placementStop(result: PlacementProtocolResult<IntegrationPreparationRefusal>): PlacementStop | undefined;
|
|
117
95
|
export type RepositoryScope = GitRepository;
|
|
118
|
-
export
|
|
119
|
-
|
|
96
|
+
export declare function scopeOperation(input: Readonly<{
|
|
97
|
+
coordinate: string;
|
|
98
|
+
gitPath?: string;
|
|
99
|
+
}>): Promise<RepositoryScope>;
|
|
120
100
|
export declare function currentBranchOperation(input: Readonly<{
|
|
121
101
|
scope: RepositoryScope;
|
|
122
102
|
}>): Promise<string | null>;
|
|
@@ -125,125 +105,12 @@ export declare function contractsOperation(input: Readonly<{
|
|
|
125
105
|
channel: GitDecodeChannel;
|
|
126
106
|
}>): Promise<ContractBoard>;
|
|
127
107
|
export declare function contractObservationOperation(input: MutationOperationInput): Promise<ContractObservation>;
|
|
128
|
-
export type { ContractBoard, ContractDisposition, ContractGateCurrent, ContractGateReport, ContractObservation, ContractPhase, ContractRow };
|
|
129
108
|
export declare function documentsOperationAt(scope: RepositoryScope, channel: GitDecodeChannel): Promise<readonly ContractDocumentProjection[]>;
|
|
130
109
|
export declare function stateOperation(input: MutationOperationInput): Promise<ContractState>;
|
|
131
|
-
|
|
132
|
-
export declare function
|
|
133
|
-
type DeliveryDiffOperationInput = Readonly<{
|
|
110
|
+
export declare function deliveryOperation(input: MutationOperationInput): Promise<DeliverData | null>;
|
|
111
|
+
export declare function deliveryDiffOperation(input: Readonly<{
|
|
134
112
|
scope: RepositoryScope;
|
|
135
113
|
integrationPredecessor: SnapshotId;
|
|
136
114
|
integrationSnapshot: SnapshotId;
|
|
137
|
-
}>;
|
|
138
|
-
export
|
|
139
|
-
type AmendOperationInput = MutationOperationInput & Readonly<{
|
|
140
|
-
source?: ContractTerms;
|
|
141
|
-
deriveAmendment?: (source: ContractTerms) => Readonly<{
|
|
142
|
-
terms: AmendData;
|
|
143
|
-
verification: VerificationDeclarationPreparation;
|
|
144
|
-
}>;
|
|
145
|
-
}>;
|
|
146
|
-
type Amendment = Readonly<{
|
|
147
|
-
source: ContractTerms;
|
|
148
|
-
}> & ReturnType<NonNullable<AmendOperationInput["deriveAmendment"]>>;
|
|
149
|
-
export declare function amendOperation(input: AmendOperationInput): Promise<IntentOutcome<Amendment, AmendRefusal | VerificationDeclarationRefusal>>;
|
|
150
|
-
export type DeliverValue = DeliveryIdentity & Readonly<{
|
|
151
|
-
verification?: VerificationStop;
|
|
152
|
-
verificationReuse?: VerificationReuse;
|
|
153
|
-
placement?: PlacementStop;
|
|
154
|
-
cleanup?: VerificationCleanupFailure;
|
|
155
|
-
leak?: WorktreeLeak;
|
|
156
|
-
}>;
|
|
157
|
-
type DeliverOperationInput = MutationOperationInput & Readonly<{
|
|
158
|
-
deriveDocument?: (state: ContractState) => DocumentDerivation;
|
|
159
|
-
message?: string;
|
|
160
|
-
requireBranchesToBeUpToDate: boolean;
|
|
161
|
-
includeDirty: boolean;
|
|
162
|
-
signal?: AbortSignal;
|
|
163
|
-
}>;
|
|
164
|
-
export declare function prepareDelivery(repository: GitRepository, stage: Readonly<{
|
|
165
|
-
contractId: ContractId;
|
|
166
|
-
coordinates: ContractState["coordinates"];
|
|
167
|
-
appointment?: Extract<ManagedWorktreeAppointment, {
|
|
168
|
-
kind: "appointed";
|
|
169
|
-
}>;
|
|
170
|
-
}>, input: Readonly<{
|
|
171
|
-
title: string;
|
|
172
|
-
message?: string;
|
|
173
|
-
requireBranchesToBeUpToDate?: boolean;
|
|
174
|
-
includeDirty?: boolean;
|
|
175
|
-
}>): Promise<{
|
|
176
|
-
kind: "prepared";
|
|
177
|
-
data: DeliverData;
|
|
178
|
-
} | {
|
|
179
|
-
kind: "refused";
|
|
180
|
-
refusal: DeliveryPreparationRefusal;
|
|
181
|
-
}>;
|
|
182
|
-
export declare function prepareReview(repository: GitRepository, stage: Readonly<{
|
|
183
|
-
contractId: ContractId;
|
|
184
|
-
coordinates: ContractState["coordinates"];
|
|
185
|
-
}>): Promise<{
|
|
186
|
-
kind: "prepared";
|
|
187
|
-
data: Readonly<{
|
|
188
|
-
changeId: DeliverData["integration"]["changeId"];
|
|
189
|
-
workspace?: WorkspaceDirtyDelta;
|
|
190
|
-
}>;
|
|
191
|
-
} | {
|
|
192
|
-
kind: "refused";
|
|
193
|
-
refusal: ReviewPreparationRefusal;
|
|
194
|
-
}>;
|
|
195
|
-
export declare function deliverOperation(input: DeliverOperationInput): Promise<IntentOutcome<DeliverValue>>;
|
|
196
|
-
export declare function abandonOperation(input: MutationOperationInput & Readonly<{
|
|
197
|
-
note?: string;
|
|
198
|
-
decorateOffer?: CompanionDecorator;
|
|
199
|
-
observationSelection?: GitTreeSelection;
|
|
200
|
-
}>): Promise<IntentOutcome<void, AbandonRefusal>>;
|
|
201
|
-
export declare function arcOperation(input: MutationOperationInput & Readonly<{
|
|
202
|
-
chapter: Omit<ArcData, "seq">;
|
|
203
|
-
}>): Promise<IntentOutcome<void, ArcRefusal>>;
|
|
204
|
-
type ReviewOperationInput = MutationOperationInput & Readonly<{
|
|
205
|
-
verdict: AttestationData["verdict"];
|
|
206
|
-
summary?: string;
|
|
207
|
-
}>;
|
|
208
|
-
export type ReviewValue = Readonly<{
|
|
209
|
-
placement?: PlacementStop;
|
|
210
|
-
workspace?: WorkspaceDirtyDelta;
|
|
211
|
-
}>;
|
|
212
|
-
export declare function reviewOperation(input: ReviewOperationInput): Promise<IntentOutcome<ReviewValue, ReviewRefusal>>;
|
|
213
|
-
type AuditOperationInput = MutationOperationInput & Readonly<{
|
|
214
|
-
deriveDocument?: (state: ContractState) => DocumentDerivation;
|
|
215
|
-
requireBranchesToBeUpToDate?: boolean;
|
|
216
|
-
includeDirty?: boolean;
|
|
217
|
-
showDiff?: boolean;
|
|
218
|
-
signal?: AbortSignal;
|
|
219
|
-
}>;
|
|
220
|
-
export declare function auditOperation(input: AuditOperationInput): Promise<IntentOutcome<AuditReport>>;
|
|
221
|
-
export type ReconcileReport = ReconcileResult;
|
|
222
|
-
export type ReconcileObservation = Readonly<{
|
|
223
|
-
state: ContractState | null;
|
|
224
|
-
report: ReconcileReport;
|
|
225
|
-
}>;
|
|
226
|
-
type ReconcileOptions = Readonly<{
|
|
227
|
-
hooks: WorktreeHooks;
|
|
228
|
-
retryHooks: boolean;
|
|
229
|
-
retainTerminalWorktree?: boolean;
|
|
230
|
-
place?: string;
|
|
231
|
-
places?: ReadonlyMap<ContractId, string>;
|
|
232
|
-
}>;
|
|
233
|
-
export declare function reconcileOperation(input: MutationOperationInput & ReconcileOptions): Promise<ReconcileObservation>;
|
|
234
|
-
type RepoReconcileItem = Readonly<{
|
|
235
|
-
contractId: ContractId;
|
|
236
|
-
state: ContractState | null;
|
|
237
|
-
report: ReconcileReport;
|
|
238
|
-
}>;
|
|
239
|
-
export type RepoReconcileReport = Readonly<{
|
|
240
|
-
contracts: readonly RepoReconcileItem[];
|
|
241
|
-
}>;
|
|
242
|
-
export declare function worldContractStates(input: Readonly<{
|
|
243
|
-
scope: RepositoryScope;
|
|
244
|
-
channel: GitDecodeChannel;
|
|
245
|
-
}>): Promise<readonly ContractState[]>;
|
|
246
|
-
export declare function reconcileAllOperation(input: Readonly<{
|
|
247
|
-
scope: RepositoryScope;
|
|
248
|
-
channel: GitDecodeChannel;
|
|
249
|
-
}> & ReconcileOptions): Promise<RepoReconcileReport>;
|
|
115
|
+
}>): Promise<string | null>;
|
|
116
|
+
export {};
|