@astrosheep/keiyaku 4.0.1 → 4.0.2
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 +137 -5
- 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 +3 -3
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -35
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +98 -58
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +152 -53
- package/build/src/akuma/abort.d.ts +2 -0
- package/build/src/akuma/abort.js +50 -0
- package/build/src/akuma/akuma.d.ts +23 -14
- package/build/src/akuma/akuma.js +120 -104
- package/build/src/akuma/archetype.d.ts +7 -6
- package/build/src/akuma/archetype.js +68 -41
- package/build/src/akuma/body.d.ts +3 -5
- package/build/src/akuma/body.js +408 -213
- package/build/src/akuma/heart/facts.d.ts +25 -34
- package/build/src/akuma/heart/facts.js +18 -7
- package/build/src/akuma/heart/index.d.ts +39 -42
- package/build/src/akuma/heart/index.js +134 -93
- package/build/src/akuma/heart/rows.d.ts +9 -31
- package/build/src/akuma/heart/rows.js +26 -44
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +7 -15
- package/build/src/akuma/heart/soul.d.ts +8 -0
- package/build/src/akuma/heart/soul.js +136 -0
- package/build/src/akuma/heart/storage.d.ts +28 -14
- package/build/src/akuma/heart/storage.js +86 -26
- package/build/src/akuma/identity.d.ts +2 -2
- package/build/src/akuma/identity.js +9 -9
- package/build/src/akuma/index.d.ts +6 -1
- package/build/src/akuma/index.js +6 -0
- package/build/src/akuma/projection.d.ts +117 -38
- package/build/src/akuma/projection.js +208 -97
- package/build/src/akuma/provider-recipe.d.ts +24 -0
- package/build/src/akuma/provider-recipe.js +100 -0
- package/build/src/akuma/provider.d.ts +12 -4
- package/build/src/akuma/provider.js +117 -70
- package/build/src/akuma/providers/acp/core.d.ts +19 -0
- package/build/src/akuma/providers/acp/core.js +159 -0
- package/build/src/akuma/providers/acp/events.d.ts +20 -0
- package/build/src/akuma/providers/acp/events.js +73 -0
- package/build/src/akuma/providers/acp/index.d.ts +12 -0
- package/build/src/akuma/providers/acp/index.js +94 -0
- package/build/src/akuma/providers/claude/events.js +66 -13
- package/build/src/akuma/providers/claude/index.d.ts +2 -1
- package/build/src/akuma/providers/claude/index.js +35 -21
- package/build/src/akuma/providers/codex-app-server/events.js +4 -1
- package/build/src/akuma/providers/codex-app-server/index.d.ts +3 -3
- package/build/src/akuma/providers/codex-app-server/index.js +24 -31
- package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
- package/build/src/akuma/providers/grok-build/index.js +70 -0
- package/build/src/akuma/providers/index.d.ts +5 -3
- package/build/src/akuma/providers/index.js +24 -59
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +40 -34
- package/build/src/akuma/providers/opencode-sdk/events.js +220 -101
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +3 -2
- package/build/src/akuma/providers/opencode-sdk/index.js +233 -128
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +11 -26
- package/build/src/akuma/providers/opencode-sdk/session.js +10 -9
- package/build/src/akuma/providers/pi/events.js +49 -11
- package/build/src/akuma/providers/pi/index.d.ts +1 -1
- package/build/src/akuma/providers/pi/index.js +50 -21
- package/build/src/akuma/publication.d.ts +3 -3
- package/build/src/akuma/publication.js +28 -40
- package/build/src/akuma/requests.d.ts +9 -7
- package/build/src/akuma/requests.js +92 -65
- package/build/src/alias/index.d.ts +2 -2
- package/build/src/alias/index.js +10 -10
- package/build/src/body/decode.js +7 -1
- package/build/src/body/region.d.ts +2 -0
- package/build/src/body/region.js +77 -7
- package/build/src/cli/accepted.d.ts +17 -13
- package/build/src/cli/accepted.js +72 -34
- package/build/src/cli/actor.js +3 -3
- package/build/src/cli/commands/akuma-invoke.d.ts +4 -3
- package/build/src/cli/commands/akuma-invoke.js +14 -9
- package/build/src/cli/commands/akuma.d.ts +13 -3
- package/build/src/cli/commands/akuma.js +67 -34
- package/build/src/cli/commands/contract.d.ts +18 -5
- package/build/src/cli/commands/contract.js +9 -3
- package/build/src/cli/commands/task-invoke.d.ts +17 -4
- package/build/src/cli/commands/task-invoke.js +43 -20
- package/build/src/cli/commands/task-query.d.ts +5 -0
- package/build/src/cli/commands/task-query.js +247 -0
- package/build/src/cli/commands/task.d.ts +3 -1
- package/build/src/cli/commands/task.js +51 -13
- package/build/src/cli/coordinates.d.ts +18 -0
- package/build/src/cli/coordinates.js +120 -0
- package/build/src/cli/draft.d.ts +8 -0
- package/build/src/cli/draft.js +96 -0
- package/build/src/cli/invoke.d.ts +4 -3
- package/build/src/cli/invoke.js +160 -179
- package/build/src/cli/main.js +34 -6
- package/build/src/cli/parse.d.ts +9 -2
- package/build/src/cli/parse.js +29 -7
- package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
- package/build/src/cli/render/akuma-tool-command.js +144 -0
- package/build/src/cli/render/akuma-tool.d.ts +2 -2
- package/build/src/cli/render/akuma-tool.js +30 -4
- package/build/src/cli/render/akuma.d.ts +1 -0
- package/build/src/cli/render/akuma.js +211 -116
- package/build/src/cli/render/audit.d.ts +3 -0
- package/build/src/cli/render/audit.js +104 -0
- package/build/src/cli/render/contract.d.ts +3 -3
- package/build/src/cli/render/contract.js +192 -79
- package/build/src/cli/render/kanshi.js +263 -168
- package/build/src/cli/render/receipt.d.ts +19 -0
- package/build/src/cli/render/receipt.js +106 -0
- package/build/src/cli/render/refusal.d.ts +16 -2
- package/build/src/cli/render/refusal.js +88 -20
- package/build/src/cli/render/region.d.ts +2 -0
- package/build/src/cli/render/region.js +17 -0
- package/build/src/cli/render/task.d.ts +2 -1
- package/build/src/cli/render/task.js +223 -60
- package/build/src/cli/render/terminal.d.ts +7 -0
- package/build/src/cli/render/terminal.js +46 -0
- package/build/src/cli/render/text.js +6 -3
- package/build/src/cli/result.d.ts +115 -20
- package/build/src/cli/usage.d.ts +1 -0
- package/build/src/cli/usage.js +3 -0
- package/build/src/contract-worktree.d.ts +6 -5
- package/build/src/contract-worktree.js +95 -57
- package/build/src/coordination/durable-file.d.ts +4 -3
- package/build/src/coordination/durable-file.js +29 -25
- package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
- package/build/src/coordination/sqlite-transaction-lock.js +22 -5
- package/build/src/core/facts/fold.js +1 -6
- package/build/src/core/facts/gate.d.ts +1 -0
- package/build/src/core/facts/gate.js +1 -0
- package/build/src/core/verbs/amend.d.ts +1 -1
- package/build/src/core/verbs/amend.js +0 -11
- package/build/src/core/verbs/deliver.d.ts +1 -1
- package/build/src/core/verbs/deliver.js +1 -7
- package/build/src/core/verbs/placement.d.ts +1 -1
- package/build/src/core/verbs/placement.js +4 -1
- package/build/src/dispatch/index.d.ts +2 -2
- package/build/src/dispatch/index.js +17 -17
- package/build/src/git/admission.d.ts +1 -1
- package/build/src/git/admission.js +11 -11
- package/build/src/git/hooks.js +13 -13
- package/build/src/git/integration.d.ts +14 -15
- package/build/src/git/integration.js +80 -44
- package/build/src/git/observe.d.ts +5 -3
- package/build/src/git/observe.js +18 -12
- package/build/src/git/read-observation.js +9 -9
- package/build/src/git/reconcile.d.ts +2 -0
- package/build/src/git/reconcile.js +138 -95
- package/build/src/git/repository.d.ts +27 -19
- package/build/src/git/repository.js +155 -83
- package/build/src/git/scratch.d.ts +7 -3
- package/build/src/git/scratch.js +44 -37
- package/build/src/git/target-placement.d.ts +40 -4
- package/build/src/git/target-placement.js +221 -101
- package/build/src/git/tender.d.ts +6 -5
- package/build/src/git/tender.js +24 -43
- package/build/src/git/terminal-seal.d.ts +1 -1
- package/build/src/git/terminal-seal.js +7 -5
- package/build/src/git/workspace.d.ts +36 -4
- package/build/src/git/workspace.js +53 -18
- package/build/src/identity/selector.js +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.js +1 -1
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +2 -1
- package/build/src/kanshi/read.js +118 -27
- package/build/src/kanshi/report.d.ts +50 -0
- package/build/src/kanshi/select.d.ts +5 -0
- package/build/src/kanshi/select.js +32 -0
- package/build/src/library/address.d.ts +12 -3
- package/build/src/library/address.js +77 -46
- package/build/src/library/akuma-creation.d.ts +6 -1
- package/build/src/library/akuma-creation.js +86 -13
- package/build/src/library/audit.d.ts +18 -0
- package/build/src/library/audit.js +44 -0
- package/build/src/library/bind.js +4 -4
- package/build/src/library/catalog.d.ts +1 -1
- package/build/src/library/catalog.js +5 -8
- package/build/src/library/contract.d.ts +5 -6
- package/build/src/library/contract.js +11 -35
- package/build/src/library/delivery.d.ts +2 -1
- package/build/src/library/fleet.d.ts +2 -2
- package/build/src/library/fleet.js +35 -71
- package/build/src/library/keiyaku.d.ts +3 -2
- package/build/src/library/keiyaku.js +1 -0
- package/build/src/library/mutation.d.ts +7 -6
- package/build/src/library/mutation.js +23 -25
- package/build/src/library/reconcile.d.ts +29 -0
- package/build/src/library/reconcile.js +179 -0
- package/build/src/library/region.d.ts +12 -0
- package/build/src/library/region.js +15 -1
- package/build/src/library/repo.d.ts +4 -16
- package/build/src/library/repo.js +13 -38
- package/build/src/protocol/attempt.js +6 -6
- package/build/src/protocol/bind.js +4 -4
- package/build/src/protocol/intent.d.ts +15 -2
- package/build/src/protocol/intent.js +21 -6
- package/build/src/protocol/operations.d.ts +73 -22
- package/build/src/protocol/operations.js +292 -88
- package/build/src/protocol/outcome.d.ts +9 -3
- package/build/src/protocol/outcome.js +3 -1
- package/build/src/protocol/placement.d.ts +15 -4
- package/build/src/protocol/placement.js +58 -25
- package/build/src/protocol/read/status.d.ts +8 -1
- package/build/src/protocol/read/status.js +61 -14
- package/build/src/runtime/proc/line-rpc.d.ts +3 -8
- package/build/src/runtime/proc/line-rpc.js +16 -43
- package/build/src/runtime/proc/run.d.ts +15 -29
- package/build/src/runtime/proc/run.js +113 -105
- package/build/src/runtime/proc/stdio.d.ts +18 -0
- package/build/src/runtime/proc/stdio.js +58 -0
- package/build/src/settings.d.ts +2 -2
- package/build/src/settings.js +8 -8
- package/build/src/settlement/fence.d.ts +0 -4
- package/build/src/settlement/fence.js +0 -9
- package/build/src/settlement/holder.d.ts +11 -1
- package/build/src/settlement/holder.js +25 -0
- package/build/src/settlement/settle.d.ts +1 -1
- package/build/src/settlement/settle.js +52 -89
- package/build/src/task/board.d.ts +3 -3
- package/build/src/task/board.js +6 -9
- package/build/src/task/compose.d.ts +1 -1
- package/build/src/task/compose.js +18 -10
- package/build/src/task/context.d.ts +3 -3
- package/build/src/task/context.js +14 -14
- package/build/src/task/document.d.ts +2 -1
- package/build/src/task/document.js +15 -5
- package/build/src/task/index.d.ts +19 -7
- package/build/src/task/index.js +42 -23
- package/build/src/task/operations.d.ts +15 -9
- package/build/src/task/operations.js +78 -48
- package/build/src/task/query.d.ts +67 -0
- package/build/src/task/query.js +279 -0
- package/build/src/task/store.d.ts +2 -2
- package/build/src/task/store.js +40 -25
- package/build/src/verification/execution.d.ts +4 -2
- package/build/src/verification/execution.js +9 -5
- package/build/src/workspace-place.d.ts +41 -0
- package/build/src/workspace-place.js +386 -0
- package/build/src/world.d.ts +13 -2
- package/build/src/world.js +81 -48
- package/package.json +3 -2
- package/build/src/protocol/read/audit.d.ts +0 -31
- package/build/src/protocol/read/audit.js +0 -55
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { currentBranchOperation, NoGitWorldError,
|
|
2
|
-
import { settleAll } from "../settlement/settle.js";
|
|
1
|
+
import { currentBranchOperation, NoGitWorldError, scopeOperation, } from "../protocol/operations.js";
|
|
3
2
|
import { optionalNonblank, requireInput } from "./input.js";
|
|
4
3
|
import { worktreeHooksOption } from "./configuration.js";
|
|
5
4
|
import { withGitDecodeChannel } from "../git/read-observation.js";
|
|
6
|
-
import {
|
|
5
|
+
import { completeRepoReconcile, } from "./reconcile.js";
|
|
7
6
|
export { NoGitWorldError };
|
|
8
7
|
const REPO_SCOPES = new WeakMap();
|
|
9
|
-
function resolvePinnedScope(path) {
|
|
10
|
-
return scopeOperation({ coordinate: path === undefined ? process.cwd() : path });
|
|
8
|
+
async function resolvePinnedScope(path) {
|
|
9
|
+
return await scopeOperation({ coordinate: path === undefined ? process.cwd() : path });
|
|
11
10
|
}
|
|
12
11
|
export function reconcileInput(input) {
|
|
13
12
|
const values = input === undefined ? undefined : requireInput(input, "reconcile input");
|
|
@@ -25,45 +24,21 @@ export class Repo {
|
|
|
25
24
|
this.root = scope.primaryWorktree;
|
|
26
25
|
REPO_SCOPES.set(this, scope);
|
|
27
26
|
}
|
|
28
|
-
static at(input) {
|
|
27
|
+
static async at(input) {
|
|
29
28
|
const values = input === undefined ? undefined : requireInput(input, "Repo.at input");
|
|
30
|
-
return new Repo(resolvePinnedScope(optionalNonblank(values?.path, "repository path")));
|
|
29
|
+
return new Repo(await resolvePinnedScope(optionalNonblank(values?.path, "repository path")));
|
|
31
30
|
}
|
|
32
31
|
async currentBranch() {
|
|
33
|
-
return currentBranchOperation({ scope: scopeForRepo(this) });
|
|
32
|
+
return await currentBranchOperation({ scope: scopeForRepo(this) });
|
|
34
33
|
}
|
|
35
34
|
async reconcile(input) {
|
|
36
35
|
const scope = scopeForRepo(this);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
contracts: retained.contracts.map((contract) => ({
|
|
44
|
-
state: contract.state,
|
|
45
|
-
effects: contract.report.effects,
|
|
46
|
-
})),
|
|
47
|
-
});
|
|
48
|
-
const deferRemoval = retained.contracts.some((contract) => contract.state !== null && contract.state.terminal !== null
|
|
49
|
-
&& contract.state.coordinates.workspace === "worktree");
|
|
50
|
-
const cleanup = deferRemoval ? await reconcileAllOperation({ scope, channel, ...options }) : null;
|
|
51
|
-
const later = cleanup === null ? null : new Map(cleanup.contracts.map((contract) => [contract.contractId, contract.report]));
|
|
52
|
-
return {
|
|
53
|
-
contracts: retained.contracts.map((contract, index) => {
|
|
54
|
-
const report = later?.get(contract.contractId);
|
|
55
|
-
const projection = projectContractWorktree(scope, contract.state);
|
|
56
|
-
return {
|
|
57
|
-
contractId: contract.contractId,
|
|
58
|
-
report: {
|
|
59
|
-
effects: [...contract.report.effects, ...projection.effects, ...(report?.effects ?? [])],
|
|
60
|
-
lag: [...contract.report.lag, ...projection.lag, ...(report?.lag ?? [])],
|
|
61
|
-
settlement: settlements[index],
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}),
|
|
65
|
-
};
|
|
66
|
-
});
|
|
36
|
+
const options = reconcileInput(input);
|
|
37
|
+
return await withGitDecodeChannel(scope, (channel) => completeRepoReconcile({
|
|
38
|
+
scope,
|
|
39
|
+
channel,
|
|
40
|
+
...options,
|
|
41
|
+
}));
|
|
67
42
|
}
|
|
68
43
|
}
|
|
69
44
|
export function scopeForRepo(value) {
|
|
@@ -77,14 +77,14 @@ function recoveredAcceptance(observation, offer, primaryContract) {
|
|
|
77
77
|
journal: record.entries,
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
function publicationPremiseMoved(repository, observation, offer, assertions) {
|
|
81
|
-
if (readRef(repository, GIT_REF) !== observation.admission.snapshot.commit)
|
|
80
|
+
async function publicationPremiseMoved(repository, observation, offer, assertions) {
|
|
81
|
+
if (await readRef(repository, GIT_REF) !== observation.admission.snapshot.commit)
|
|
82
82
|
return true;
|
|
83
83
|
for (const assertion of assertions)
|
|
84
|
-
if (readRef(repository, assertion.ref) !== assertion.oid)
|
|
84
|
+
if (await readRef(repository, assertion.ref) !== assertion.oid)
|
|
85
85
|
return true;
|
|
86
86
|
return offer.target !== undefined
|
|
87
|
-
&& readRef(repository, offer.target.target) !== offer.target.expectedOid;
|
|
87
|
+
&& await readRef(repository, offer.target.target) !== offer.target.expectedOid;
|
|
88
88
|
}
|
|
89
89
|
/** Admit one decided offer without making another legal decision. */
|
|
90
90
|
export async function admitDecidedOffer(input) {
|
|
@@ -92,7 +92,7 @@ export async function admitDecidedOffer(input) {
|
|
|
92
92
|
const assertions = input.assertions ?? [];
|
|
93
93
|
validateOffer(offer, attempt);
|
|
94
94
|
const primary = primaryAppend(offer, primaryContract);
|
|
95
|
-
const admission = admit(repository, offer, decisionObservation.admission, assertions);
|
|
95
|
+
const admission = await admit(repository, offer, decisionObservation.admission, assertions);
|
|
96
96
|
if (admission.kind === "accepted") {
|
|
97
97
|
return {
|
|
98
98
|
kind: "accepted",
|
|
@@ -102,7 +102,7 @@ export async function admitDecidedOffer(input) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
if (admission.kind === "publication-failed") {
|
|
105
|
-
return publicationPremiseMoved(repository, decisionObservation, offer, assertions)
|
|
105
|
+
return await publicationPremiseMoved(repository, decisionObservation, offer, assertions)
|
|
106
106
|
? { kind: "redecide" }
|
|
107
107
|
: admission;
|
|
108
108
|
}
|
|
@@ -10,11 +10,11 @@ function contractIdFor(title, suffix) {
|
|
|
10
10
|
const stem = fitIdentityStem({ stem: normalizeIdentityStem({ source: title }) || "contract", maxBytes: 48 });
|
|
11
11
|
return contractIdFromSegment(suffix === undefined ? stem : `${stem}-${suffix}`);
|
|
12
12
|
}
|
|
13
|
-
function bindPreparation(input, target, seed) {
|
|
13
|
+
async function bindPreparation(input, target, seed) {
|
|
14
14
|
if (input.verification.kind === "refused") {
|
|
15
15
|
return { kind: "prepared", input: { ...seed, preparation: input.verification } };
|
|
16
16
|
}
|
|
17
|
-
const observed = observeBindCoordinates(input.scope, target);
|
|
17
|
+
const observed = await observeBindCoordinates(input.scope, target);
|
|
18
18
|
if (observed === null)
|
|
19
19
|
return { kind: "refused", refusal: { kind: "target-missing" } };
|
|
20
20
|
if (input.workspace === "here" && target !== undefined && observed.branch !== target) {
|
|
@@ -44,7 +44,7 @@ function bindPreparation(input, target, seed) {
|
|
|
44
44
|
export async function bindOperation(input) {
|
|
45
45
|
let target;
|
|
46
46
|
if (input.target !== undefined) {
|
|
47
|
-
const normalized = normalizeTargetBranch(input.scope, input.target);
|
|
47
|
+
const normalized = await normalizeTargetBranch(input.scope, input.target);
|
|
48
48
|
if (normalized === null)
|
|
49
49
|
return { kind: "refused", refusal: { kind: "invalid-target" } };
|
|
50
50
|
target = normalized;
|
|
@@ -56,7 +56,7 @@ export async function bindOperation(input) {
|
|
|
56
56
|
at,
|
|
57
57
|
}, decideBind, {
|
|
58
58
|
observedContracts: [id, ...input.terms.after],
|
|
59
|
-
prepareInput: (_observation, original) => bindPreparation(input, target, original),
|
|
59
|
+
prepareInput: async (_observation, original) => bindPreparation(input, target, original),
|
|
60
60
|
...(input.decorateOffer === undefined ? {} : { decorateOffer: input.decorateOffer }),
|
|
61
61
|
}), { contractId: id });
|
|
62
62
|
if (input.contractId !== undefined)
|
|
@@ -5,7 +5,7 @@ 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";
|
|
7
7
|
import type { DecideInput, OfferDecision } from "../core/decide.js";
|
|
8
|
-
import type { ActorId, ContractId, ContractState } from "../core/facts/types.js";
|
|
8
|
+
import type { ActorId, ContractId, ContractState, EntryUlid, SnapshotId } from "../core/facts/types.js";
|
|
9
9
|
import { type AttestationRefusal } from "../core/verbs/attestation.js";
|
|
10
10
|
import { type VerificationDefinition } from "../verification/declaration.js";
|
|
11
11
|
import { type CompanionDecorator, type ProtocolResult } from "./run.js";
|
|
@@ -43,6 +43,7 @@ type VerifyDeliveryInput = Readonly<{
|
|
|
43
43
|
actor?: ActorId;
|
|
44
44
|
at: string;
|
|
45
45
|
state: ContractState;
|
|
46
|
+
snapshot?: SnapshotId;
|
|
46
47
|
environment: NodeJS.ProcessEnv;
|
|
47
48
|
signal?: AbortSignal;
|
|
48
49
|
verification?: VerificationDefinition;
|
|
@@ -68,9 +69,21 @@ export type VerificationCleanupFailure = Readonly<{
|
|
|
68
69
|
export type VerificationStep = ProtocolResult<AttestationRefusal> | VerificationRuntimeStop;
|
|
69
70
|
export type VerificationResult = Readonly<{
|
|
70
71
|
step: VerificationStep;
|
|
72
|
+
counts?: Readonly<{
|
|
73
|
+
passed: number;
|
|
74
|
+
total: number;
|
|
75
|
+
verdict: "satisfied" | "unsatisfied";
|
|
76
|
+
summary?: string;
|
|
77
|
+
}>;
|
|
71
78
|
cleanup?: VerificationCleanupFailure;
|
|
72
79
|
leak?: WorktreeLeak;
|
|
73
80
|
}>;
|
|
74
|
-
|
|
81
|
+
export type CurrentVerifiedAttestation = Readonly<{
|
|
82
|
+
entry: EntryUlid;
|
|
83
|
+
verdict: "satisfied" | "unsatisfied";
|
|
84
|
+
}>;
|
|
85
|
+
/** Read the latest current verified attestation through the generic currentness judge. */
|
|
86
|
+
export declare function currentVerifiedAttestation(state: ContractState): CurrentVerifiedAttestation | undefined;
|
|
87
|
+
/** Run Verification against an explicit or admitted integration snapshot. */
|
|
75
88
|
export declare function verifyDelivery(input: VerifyDeliveryInput): Promise<VerificationResult | null>;
|
|
76
89
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { materializeScratchCandidate } from "../git/scratch.js";
|
|
2
2
|
import { projectSettings } from "../settings.js";
|
|
3
3
|
import { dependencyKeySet } from "../core/subject.js";
|
|
4
|
+
import { latestCurrentAttestations } from "../core/facts/gate.js";
|
|
4
5
|
import { decideAttestation } from "../core/verbs/attestation.js";
|
|
5
6
|
import { executeVerification } from "../verification/execution.js";
|
|
6
7
|
import { VERIFIED } from "../verification/declaration.js";
|
|
@@ -43,19 +44,23 @@ function verificationInput(outcome, input, subject) {
|
|
|
43
44
|
},
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
/**
|
|
47
|
+
/** Read the latest current verified attestation through the generic currentness judge. */
|
|
48
|
+
export function currentVerifiedAttestation(state) {
|
|
49
|
+
const current = latestCurrentAttestations(state, new Set([VERIFIED])).get(VERIFIED);
|
|
50
|
+
return current === undefined ? undefined : { entry: current.entry, verdict: current.data.verdict };
|
|
51
|
+
}
|
|
52
|
+
/** Run Verification against an explicit or admitted integration snapshot. */
|
|
47
53
|
export async function verifyDelivery(input) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|| input.verification === undefined)
|
|
54
|
+
const snapshot = input.snapshot ?? input.state.delivery?.data.integration.snapshot;
|
|
55
|
+
if (snapshot === undefined || input.verification === undefined)
|
|
51
56
|
return null;
|
|
52
57
|
const subject = dependencyKeySet([
|
|
53
|
-
{ kind: "snapshot", value:
|
|
58
|
+
{ kind: "snapshot", value: snapshot },
|
|
54
59
|
{ kind: "segment", value: input.verification.segment },
|
|
55
60
|
]);
|
|
56
61
|
const execution = await executeVerification({
|
|
57
62
|
repository: input.repository,
|
|
58
|
-
candidate:
|
|
63
|
+
candidate: snapshot,
|
|
59
64
|
declarations: input.verification.declarations,
|
|
60
65
|
environment: input.environment,
|
|
61
66
|
materializeScratchCandidate,
|
|
@@ -84,6 +89,16 @@ export async function verifyDelivery(input) {
|
|
|
84
89
|
}
|
|
85
90
|
return {
|
|
86
91
|
step,
|
|
92
|
+
...(execution.outcome.kind === "terminal"
|
|
93
|
+
? {
|
|
94
|
+
counts: {
|
|
95
|
+
passed: execution.outcome.passed,
|
|
96
|
+
total: execution.outcome.total,
|
|
97
|
+
verdict: execution.outcome.verdict,
|
|
98
|
+
...(execution.outcome.summary === undefined ? {} : { summary: execution.outcome.summary }),
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
: {}),
|
|
87
102
|
...(execution.cleanup === undefined ? {} : { cleanup: execution.cleanup }),
|
|
88
103
|
...(execution.leak === undefined ? {} : { leak: execution.leak }),
|
|
89
104
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type IntegrationPreparationRefusal } from "../git/integration.js";
|
|
1
|
+
import { type DeliveryDiffScope, type IntegrationPreparationRefusal } from "../git/integration.js";
|
|
2
2
|
import { type DirtyWorkspaceRefusal, type WorkspaceDirtyDelta } from "../git/tender.js";
|
|
3
3
|
import { type ReconcileResult } from "../git/reconcile.js";
|
|
4
4
|
import type { WorktreeHooks } from "../git/hooks.js";
|
|
5
5
|
import { NoGitWorldError, type GitRepository } from "../git/repository.js";
|
|
6
6
|
import { type GitDecodeChannel, type GitTreeSelection } from "../git/read-observation.js";
|
|
7
7
|
import type { WorktreeLeak } from "../git/scratch.js";
|
|
8
|
-
import type { ActorId, AmendData, ArcData, AttestationData, ContractId, ContractState, ContractTerms, DeliverData, DocumentKey, SnapshotId } from "../core/facts/types.js";
|
|
8
|
+
import type { ActorId, AmendData, ArcData, AttestationData, ChangeId, ContractId, ContractState, ContractTerms, DeliverData, DocumentKey, SnapshotId } from "../core/facts/types.js";
|
|
9
9
|
import { type AbandonRefusal } from "../core/verbs/abandon.js";
|
|
10
10
|
import { type AmendRefusal } from "../core/verbs/amend.js";
|
|
11
11
|
import { type ArcRefusal } from "../core/verbs/arc.js";
|
|
@@ -13,26 +13,27 @@ import { type DeliverRefusal } from "../core/verbs/deliver.js";
|
|
|
13
13
|
import type { PlacementRefusal } from "../core/verbs/placement.js";
|
|
14
14
|
import { type AttestationRefusal } from "../core/verbs/attestation.js";
|
|
15
15
|
import type { VerificationDeclarationPreparation, VerificationDeclarationRefusal } from "../verification/declaration.js";
|
|
16
|
-
import { type VerificationRuntimeStop, type VerificationCleanupFailure } from "./intent.js";
|
|
17
|
-
import type
|
|
18
|
-
import { type AuditReport as AuditReadReport } from "./read/audit.js";
|
|
16
|
+
import { type CurrentVerifiedAttestation, type VerificationRuntimeStop, type VerificationCleanupFailure } from "./intent.js";
|
|
17
|
+
import { type AuditTargetAnswer, type TargetPlacementRefusal } from "../git/target-placement.js";
|
|
19
18
|
import { type ContractDocumentProjection } from "./read/documents.js";
|
|
20
19
|
import { type ContractBoard, type ContractDisposition, type ContractGateCurrent, type ContractGateReport, type ContractObservation, type ContractPhase, type ContractRow } from "./read/status.js";
|
|
20
|
+
import { type ManagedWorktreeAppointment } from "../workspace-place.js";
|
|
21
21
|
export { bindOperation } from "./bind.js";
|
|
22
|
+
export { reconcileObservationFailure } from "../git/reconcile.js";
|
|
22
23
|
import type { BindRefusal, TargetInputRefusal } from "./bind.js";
|
|
23
24
|
import { type IntentOutcome as ProtocolIntentOutcome } from "./outcome.js";
|
|
24
25
|
import type { ProtocolTerminal } from "./run.js";
|
|
25
26
|
import type { CompanionDecorator } from "./run.js";
|
|
26
|
-
export type { FactKind
|
|
27
|
+
export type { FactKind } from "../core/facts/types.js";
|
|
27
28
|
export type { ContractDocumentProjection } from "./read/documents.js";
|
|
28
|
-
type DeliveryPreparationRefusal = Readonly<{
|
|
29
|
+
export type DeliveryPreparationRefusal = Readonly<{
|
|
29
30
|
kind: "target-missing" | "worktree-missing";
|
|
30
31
|
contractId: ContractId;
|
|
31
32
|
}> | DirtyWorkspaceRefusal | IntegrationPreparationRefusal | TargetPlacementRefusal;
|
|
32
33
|
type ReviewPreparationRefusal = Readonly<{
|
|
33
|
-
kind: "
|
|
34
|
+
kind: "worktree-missing";
|
|
34
35
|
contractId: ContractId;
|
|
35
|
-
}> | DirtyWorkspaceRefusal
|
|
36
|
+
}> | DirtyWorkspaceRefusal;
|
|
36
37
|
type ReviewRefusal = AttestationRefusal | ReviewPreparationRefusal;
|
|
37
38
|
export type IntentRefusal = AbandonRefusal | AmendRefusal | ArcRefusal | BindRefusal | DeliverRefusal | DeliveryPreparationRefusal | PlacementRefusal | ReviewRefusal | TargetInputRefusal | VerificationDeclarationRefusal;
|
|
38
39
|
export type { TargetInputRefusal } from "./bind.js";
|
|
@@ -46,11 +47,47 @@ type OperationInput = Readonly<{
|
|
|
46
47
|
type MutationOperationInput = OperationInput & Readonly<{
|
|
47
48
|
channel: GitDecodeChannel;
|
|
48
49
|
}>;
|
|
49
|
-
export type
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
}>;
|
|
53
89
|
}>;
|
|
90
|
+
export type VerificationReuse = CurrentVerifiedAttestation;
|
|
54
91
|
export type DocumentDerivation = Readonly<{
|
|
55
92
|
document: DocumentKey;
|
|
56
93
|
title: string;
|
|
@@ -64,7 +101,7 @@ export type StepStop<R> = Readonly<{
|
|
|
64
101
|
refusal?: never;
|
|
65
102
|
}>;
|
|
66
103
|
export type VerificationStop = StepStop<AttestationRefusal> | VerificationRuntimeStop;
|
|
67
|
-
export type PlacementStop = StepStop<PlacementRefusal | TargetPlacementRefusal> | Readonly<{
|
|
104
|
+
export type PlacementStop = StepStop<PlacementRefusal | TargetPlacementRefusal | IntegrationPreparationRefusal> | Readonly<{
|
|
68
105
|
failure: "target-moved";
|
|
69
106
|
contractId: ContractId;
|
|
70
107
|
target: string;
|
|
@@ -79,10 +116,10 @@ type ScopeOperationInput = Readonly<{
|
|
|
79
116
|
}>;
|
|
80
117
|
export type RepositoryScope = GitRepository;
|
|
81
118
|
export { NoGitWorldError };
|
|
82
|
-
export declare function scopeOperation(input: ScopeOperationInput): RepositoryScope
|
|
119
|
+
export declare function scopeOperation(input: ScopeOperationInput): Promise<RepositoryScope>;
|
|
83
120
|
export declare function currentBranchOperation(input: Readonly<{
|
|
84
121
|
scope: RepositoryScope;
|
|
85
|
-
}>): string | null
|
|
122
|
+
}>): Promise<string | null>;
|
|
86
123
|
export declare function contractsOperation(input: Readonly<{
|
|
87
124
|
scope: RepositoryScope;
|
|
88
125
|
channel: GitDecodeChannel;
|
|
@@ -112,6 +149,7 @@ type Amendment = Readonly<{
|
|
|
112
149
|
export declare function amendOperation(input: AmendOperationInput): Promise<IntentOutcome<Amendment, AmendRefusal | VerificationDeclarationRefusal>>;
|
|
113
150
|
export type DeliverValue = DeliveryIdentity & Readonly<{
|
|
114
151
|
verification?: VerificationStop;
|
|
152
|
+
verificationReuse?: VerificationReuse;
|
|
115
153
|
placement?: PlacementStop;
|
|
116
154
|
cleanup?: VerificationCleanupFailure;
|
|
117
155
|
leak?: WorktreeLeak;
|
|
@@ -126,22 +164,25 @@ type DeliverOperationInput = MutationOperationInput & Readonly<{
|
|
|
126
164
|
export declare function prepareDelivery(repository: GitRepository, stage: Readonly<{
|
|
127
165
|
contractId: ContractId;
|
|
128
166
|
coordinates: ContractState["coordinates"];
|
|
167
|
+
appointment?: Extract<ManagedWorktreeAppointment, {
|
|
168
|
+
kind: "appointed";
|
|
169
|
+
}>;
|
|
129
170
|
}>, input: Readonly<{
|
|
130
171
|
title: string;
|
|
131
172
|
message?: string;
|
|
132
173
|
requireBranchesToBeUpToDate?: boolean;
|
|
133
174
|
includeDirty?: boolean;
|
|
134
|
-
}>): {
|
|
175
|
+
}>): Promise<{
|
|
135
176
|
kind: "prepared";
|
|
136
177
|
data: DeliverData;
|
|
137
178
|
} | {
|
|
138
179
|
kind: "refused";
|
|
139
180
|
refusal: DeliveryPreparationRefusal;
|
|
140
|
-
}
|
|
181
|
+
}>;
|
|
141
182
|
export declare function prepareReview(repository: GitRepository, stage: Readonly<{
|
|
142
183
|
contractId: ContractId;
|
|
143
184
|
coordinates: ContractState["coordinates"];
|
|
144
|
-
}>): {
|
|
185
|
+
}>): Promise<{
|
|
145
186
|
kind: "prepared";
|
|
146
187
|
data: Readonly<{
|
|
147
188
|
changeId: DeliverData["integration"]["changeId"];
|
|
@@ -150,7 +191,7 @@ export declare function prepareReview(repository: GitRepository, stage: Readonly
|
|
|
150
191
|
} | {
|
|
151
192
|
kind: "refused";
|
|
152
193
|
refusal: ReviewPreparationRefusal;
|
|
153
|
-
}
|
|
194
|
+
}>;
|
|
154
195
|
export declare function deliverOperation(input: DeliverOperationInput): Promise<IntentOutcome<DeliverValue>>;
|
|
155
196
|
export declare function abandonOperation(input: MutationOperationInput & Readonly<{
|
|
156
197
|
note?: string;
|
|
@@ -169,10 +210,14 @@ export type ReviewValue = Readonly<{
|
|
|
169
210
|
workspace?: WorkspaceDirtyDelta;
|
|
170
211
|
}>;
|
|
171
212
|
export declare function reviewOperation(input: ReviewOperationInput): Promise<IntentOutcome<ReviewValue, ReviewRefusal>>;
|
|
172
|
-
|
|
213
|
+
type AuditOperationInput = MutationOperationInput & Readonly<{
|
|
173
214
|
deriveDocument?: (state: ContractState) => DocumentDerivation;
|
|
215
|
+
requireBranchesToBeUpToDate?: boolean;
|
|
216
|
+
includeDirty?: boolean;
|
|
217
|
+
showDiff?: boolean;
|
|
174
218
|
signal?: AbortSignal;
|
|
175
|
-
}
|
|
219
|
+
}>;
|
|
220
|
+
export declare function auditOperation(input: AuditOperationInput): Promise<IntentOutcome<AuditReport>>;
|
|
176
221
|
export type ReconcileReport = ReconcileResult;
|
|
177
222
|
export type ReconcileObservation = Readonly<{
|
|
178
223
|
state: ContractState | null;
|
|
@@ -182,6 +227,8 @@ type ReconcileOptions = Readonly<{
|
|
|
182
227
|
hooks: WorktreeHooks;
|
|
183
228
|
retryHooks: boolean;
|
|
184
229
|
retainTerminalWorktree?: boolean;
|
|
230
|
+
place?: string;
|
|
231
|
+
places?: ReadonlyMap<ContractId, string>;
|
|
185
232
|
}>;
|
|
186
233
|
export declare function reconcileOperation(input: MutationOperationInput & ReconcileOptions): Promise<ReconcileObservation>;
|
|
187
234
|
type RepoReconcileItem = Readonly<{
|
|
@@ -192,6 +239,10 @@ type RepoReconcileItem = Readonly<{
|
|
|
192
239
|
export type RepoReconcileReport = Readonly<{
|
|
193
240
|
contracts: readonly RepoReconcileItem[];
|
|
194
241
|
}>;
|
|
242
|
+
export declare function worldContractStates(input: Readonly<{
|
|
243
|
+
scope: RepositoryScope;
|
|
244
|
+
channel: GitDecodeChannel;
|
|
245
|
+
}>): Promise<readonly ContractState[]>;
|
|
195
246
|
export declare function reconcileAllOperation(input: Readonly<{
|
|
196
247
|
scope: RepositoryScope;
|
|
197
248
|
channel: GitDecodeChannel;
|