@astrosheep/keiyaku 4.6.11 → 4.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/plugins/claude/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/plugins/codex/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +3 -1
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/skills/keiyaku/SKILL.md +3 -1
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +3 -2
- package/build/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/src/akuma/akuma-errors.d.ts +5 -0
- package/build/src/akuma/akuma-errors.js +9 -0
- package/build/src/akuma/akuma-owner.d.ts +14 -19
- package/build/src/akuma/akuma-owner.js +56 -54
- package/build/src/akuma/akuma-selection-execution.d.ts +5 -4
- package/build/src/akuma/akuma-selection-execution.js +59 -17
- package/build/src/akuma/akuma.d.ts +1 -2
- package/build/src/akuma/allowed.d.ts +2 -3
- package/build/src/akuma/allowed.js +1 -3
- package/build/src/akuma/body.js +17 -7
- package/build/src/akuma/call-initial-tell.d.ts +18 -0
- package/build/src/akuma/call-initial-tell.js +18 -0
- package/build/src/akuma/call-request.d.ts +20 -4
- package/build/src/akuma/heart/facts.d.ts +13 -0
- package/build/src/akuma/heart/facts.js +6 -0
- package/build/src/akuma/heart/index.d.ts +29 -14
- package/build/src/akuma/heart/index.js +75 -29
- package/build/src/akuma/heart/rows.d.ts +9 -2
- package/build/src/akuma/heart/rows.js +72 -11
- package/build/src/akuma/heart/storage.d.ts +2 -8
- package/build/src/akuma/heart/storage.js +13 -13
- package/build/src/akuma/heart/tells.d.ts +3 -1
- package/build/src/akuma/heart/tells.js +18 -2
- package/build/src/akuma/provider.d.ts +2 -4
- package/build/src/akuma/provider.js +29 -6
- package/build/src/akuma/providers/acp/core.js +23 -21
- package/build/src/akuma/providers/claude/index.js +0 -8
- package/build/src/akuma/providers/codex-app-server/index.js +9 -8
- package/build/src/akuma/providers/execution-environment.d.ts +1 -1
- package/build/src/akuma/providers/execution-environment.js +1 -0
- package/build/src/akuma/providers/opencode-sdk/events.js +111 -81
- package/build/src/akuma/providers/opencode-sdk/index.js +179 -150
- package/build/src/akuma/providers/opencode-sdk/native-http.js +7 -3
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +5 -3
- package/build/src/akuma/providers/opencode-sdk/session.js +32 -27
- package/build/src/akuma/providers/paseo/index.js +0 -2
- package/build/src/akuma/providers/pi/index.js +23 -20
- package/build/src/akuma/selection-observation.d.ts +78 -9
- package/build/src/akuma/selection-owner-port.d.ts +2 -1
- package/build/src/akuma/selection-owner-port.js +6 -1
- package/build/src/akuma/selection-request.d.ts +1 -1
- package/build/src/akuma/selection-request.js +8 -3
- package/build/src/akuma/turn-drive.js +79 -48
- package/build/src/akuma-body.js +5 -3
- package/build/src/cli/commands/akuma-grammar.js +2 -2
- package/build/src/cli/commands/akuma.js +24 -16
- package/build/src/cli/commands/contract-grammar.d.ts +3 -7
- package/build/src/cli/commands/contract-grammar.js +12 -10
- package/build/src/cli/commands/contract-help.d.ts +3 -13
- package/build/src/cli/commands/contract-help.js +7 -16
- package/build/src/cli/commands/contract.js +19 -35
- package/build/src/cli/commands/debt.js +30 -29
- package/build/src/cli/parse.js +0 -1
- package/build/src/cli/render/akuma-activity.d.ts +36 -9
- package/build/src/cli/render/akuma-activity.js +142 -65
- package/build/src/cli/render/akuma.d.ts +6 -0
- package/build/src/cli/render/akuma.js +67 -24
- package/build/src/cli/render/catalog.js +0 -1
- package/build/src/cli/render/contract-observation.d.ts +16 -3
- package/build/src/cli/render/contract-observation.js +3 -0
- package/build/src/cli/render/contract.d.ts +2 -2
- package/build/src/cli/render/contract.js +4 -4
- package/build/src/cli/render/delivery-preview.d.ts +7 -0
- package/build/src/cli/render/{audit.js → delivery-preview.js} +29 -27
- package/build/src/cli/render/kanshi-akuma.d.ts +3 -1
- package/build/src/cli/render/kanshi-akuma.js +23 -8
- package/build/src/cli/render/kanshi.js +4 -1
- package/build/src/cli/render/receipt.js +3 -3
- package/build/src/cli/render/refusal.js +2 -2
- package/build/src/cli/render/terminal.d.ts +0 -1
- package/build/src/cli/render/terminal.js +1 -1
- package/build/src/cli/square-identity.d.ts +15 -0
- package/build/src/cli/square-identity.js +180 -0
- package/build/src/contract-worktree.js +1 -1
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +1 -1
- package/build/src/debt/context.d.ts +0 -5
- package/build/src/debt/context.js +32 -44
- package/build/src/git/process.d.ts +1 -0
- package/build/src/git/process.js +18 -1
- package/build/src/git/read-observation.js +2 -1
- package/build/src/git/scratch.d.ts +5 -1
- package/build/src/git/scratch.js +41 -12
- package/build/src/git/target-placement.d.ts +22 -4
- package/build/src/git/target-placement.js +44 -20
- package/build/src/index.d.ts +2 -2
- package/build/src/kanshi/read.js +187 -105
- package/build/src/kanshi/report.d.ts +5 -0
- package/build/src/library/address.d.ts +18 -4
- package/build/src/library/address.js +27 -6
- package/build/src/library/contract-address.d.ts +6 -0
- package/build/src/library/contract-address.js +12 -1
- package/build/src/library/contract-execution.d.ts +2 -2
- package/build/src/library/contract-execution.js +13 -17
- package/build/src/library/contract-operations.d.ts +59 -94
- package/build/src/library/contract-operations.js +23 -19
- package/build/src/library/contract-outcomes.d.ts +3 -3
- package/build/src/library/contract-settings.d.ts +1 -0
- package/build/src/library/contract-settings.js +1 -1
- package/build/src/library/invocation.d.ts +2 -2
- package/build/src/library/invocation.js +1 -1
- package/build/src/library/keiyaku.d.ts +2 -2
- package/build/src/library/keiyaku.js +2 -2
- package/build/src/library/outcome.d.ts +148 -268
- package/build/src/library/outcome.js +4 -8
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/refusal.js +2 -2
- package/build/src/plugin/runtime.js +15 -19
- package/build/src/protocol/{audit.d.ts → delivery-preview.d.ts} +62 -97
- package/build/src/protocol/delivery-preview.js +167 -0
- package/build/src/protocol/progress.d.ts +1 -1
- package/build/src/runtime/proc/run.js +22 -4
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/verification/execution.d.ts +1 -1
- package/build/src/verification/execution.js +5 -3
- package/package.json +5 -2
- package/skills/keiyaku/SKILL.md +3 -1
- package/skills/keiyaku-babysit/SKILL.md +1 -1
- package/skills/keiyaku-bind/SKILL.md +3 -2
- package/skills/keiyaku-workflow/SKILL.md +9 -8
- package/build/src/cli/render/audit.d.ts +0 -7
- package/build/src/protocol/audit.js +0 -203
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { deliverDataSchema, deliveryPreparationRefusalSchema, verificationStopSchema, changeIdSchema, verdictSchema, entryUlidSchema, } from "./operations.js";
|
|
3
|
-
import { auditTargetAnswerSchema } from "../git/target-placement.js";
|
|
4
|
-
import { verificationReuseSchema } from "./intent.js";
|
|
5
|
-
import { deliveryDiffScopeSchema, readDeliveryDiff, readDeliveryScope } from "../git/integration.js";
|
|
6
|
-
import { observeContractsForAdmissionAt } from "../git/observe.js";
|
|
7
|
-
import { activeContract, documentIsCurrent } from "../core/facts/observation.js";
|
|
8
|
-
import { adjudicateAuditTarget } from "../git/target-placement.js";
|
|
9
|
-
import { observeTargetLag, contractTargetLagSchema, worktreeWorkspaceSchema } from "../git/workspace.js";
|
|
10
|
-
import { readManagedWorktreeAppointment } from "../workspace-place.js";
|
|
11
|
-
import { currentVerifiedAttestation, verifyDelivery } from "./intent.js";
|
|
12
|
-
import { accepted, admitted } from "./outcome.js";
|
|
13
|
-
import { prepareDelivery } from "./deliver.js";
|
|
14
|
-
import { recordedIntegrationSnapshots, timestamp, unpackVerificationOutcome } from "./operations.js";
|
|
15
|
-
export const auditReportSchema = z
|
|
16
|
-
.object({
|
|
17
|
-
candidate: z.union([
|
|
18
|
-
z.object({ kind: z.literal("blocked"), refusal: deliveryPreparationRefusalSchema }).strict(),
|
|
19
|
-
z
|
|
20
|
-
.object({
|
|
21
|
-
kind: z.literal("ready"),
|
|
22
|
-
workspace: worktreeWorkspaceSchema,
|
|
23
|
-
identity: deliverDataSchema,
|
|
24
|
-
scope: deliveryDiffScopeSchema,
|
|
25
|
-
diff: z.string().optional(),
|
|
26
|
-
})
|
|
27
|
-
.strict(),
|
|
28
|
-
]),
|
|
29
|
-
verification: z.union([
|
|
30
|
-
z.object({ kind: z.literal("not-run") }).strict(),
|
|
31
|
-
z.object({ kind: z.literal("undeclared") }).strict(),
|
|
32
|
-
z.object({ kind: z.literal("stopped"), stop: verificationStopSchema }).strict(),
|
|
33
|
-
z
|
|
34
|
-
.object({
|
|
35
|
-
kind: z.enum(["satisfied", "unsatisfied"]),
|
|
36
|
-
passed: z.number(),
|
|
37
|
-
total: z.number(),
|
|
38
|
-
summary: z.string().optional(),
|
|
39
|
-
})
|
|
40
|
-
.strict(),
|
|
41
|
-
verificationReuseSchema.extend({ kind: z.literal("reused") }).strict(),
|
|
42
|
-
]),
|
|
43
|
-
target: z.union([z.object({ kind: z.literal("not-observed") }).strict(), auditTargetAnswerSchema]),
|
|
44
|
-
targetLag: contractTargetLagSchema.optional(),
|
|
45
|
-
delivery: z
|
|
46
|
-
.object({
|
|
47
|
-
changeId: changeIdSchema,
|
|
48
|
-
relation: z.enum(["identical", "differs"]),
|
|
49
|
-
verification: z.union([
|
|
50
|
-
z.object({ kind: z.enum(["undeclared", "unrecorded"]) }).strict(),
|
|
51
|
-
z.object({ kind: z.literal("recorded"), verdict: verdictSchema, fact: entryUlidSchema }).strict(),
|
|
52
|
-
]),
|
|
53
|
-
})
|
|
54
|
-
.strict()
|
|
55
|
-
.optional(),
|
|
56
|
-
})
|
|
57
|
-
.strict();
|
|
58
|
-
async function auditWorkspace(repository, state) {
|
|
59
|
-
const appointed = await readManagedWorktreeAppointment(repository, state.id);
|
|
60
|
-
if (appointed.kind === "failed")
|
|
61
|
-
throw new Error(appointed.diagnostic);
|
|
62
|
-
if (appointed.kind === "unappointed")
|
|
63
|
-
return appointed;
|
|
64
|
-
return { kind: "ready", answer: { kind: "worktree", path: appointed.path }, appointment: appointed };
|
|
65
|
-
}
|
|
66
|
-
function auditDeliveryRelation(state, candidate, declaration) {
|
|
67
|
-
const recorded = state.delivery?.data.integration.changeId;
|
|
68
|
-
if (recorded === undefined)
|
|
69
|
-
return undefined;
|
|
70
|
-
const verification = declaration == null ? undefined : currentVerifiedAttestation(state);
|
|
71
|
-
return {
|
|
72
|
-
changeId: recorded,
|
|
73
|
-
relation: recorded === candidate.integration.changeId ? "identical" : "differs",
|
|
74
|
-
verification: declaration == null
|
|
75
|
-
? { kind: "undeclared" }
|
|
76
|
-
: verification === undefined
|
|
77
|
-
? { kind: "unrecorded" }
|
|
78
|
-
: { kind: "recorded", verdict: verification.verdict, fact: verification.entry },
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
async function auditCandidateVerification(input, state, snapshot, definition) {
|
|
82
|
-
const verification = await verifyDelivery({
|
|
83
|
-
channel: input.channel,
|
|
84
|
-
repository: input.scope,
|
|
85
|
-
contractId: input.contractId,
|
|
86
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
87
|
-
at: timestamp(),
|
|
88
|
-
state,
|
|
89
|
-
snapshot,
|
|
90
|
-
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
91
|
-
verification: definition,
|
|
92
|
-
...(input.progress === undefined ? {} : { progress: input.progress }),
|
|
93
|
-
});
|
|
94
|
-
if (verification === null)
|
|
95
|
-
throw new Error("audit verification preparation unexpectedly produced no attempt");
|
|
96
|
-
return unpackVerificationOutcome(verification);
|
|
97
|
-
}
|
|
98
|
-
function auditVerificationAnswer(verified, declaration) {
|
|
99
|
-
if (declaration === null)
|
|
100
|
-
return { kind: "undeclared" };
|
|
101
|
-
if (verified === undefined)
|
|
102
|
-
throw new Error("declared audit Verification produced no attempt");
|
|
103
|
-
if (verified.stop !== undefined)
|
|
104
|
-
return { kind: "stopped", stop: verified.stop };
|
|
105
|
-
if (verified.counts === undefined)
|
|
106
|
-
throw new Error("terminal Verification is missing producer counts");
|
|
107
|
-
return {
|
|
108
|
-
kind: verified.counts.verdict,
|
|
109
|
-
passed: verified.counts.passed,
|
|
110
|
-
total: verified.counts.total,
|
|
111
|
-
...(verified.counts.summary === undefined ? {} : { summary: verified.counts.summary }),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
async function readyAuditCandidate(repository, candidate, workspace, showDiff) {
|
|
115
|
-
const predecessor = candidate.integration.predecessor;
|
|
116
|
-
const snapshot = candidate.integration.snapshot;
|
|
117
|
-
const scope = await readDeliveryScope(repository, predecessor, snapshot, showDiff);
|
|
118
|
-
const diff = showDiff ? await readDeliveryDiff(repository, predecessor, snapshot) : undefined;
|
|
119
|
-
return {
|
|
120
|
-
kind: "ready",
|
|
121
|
-
workspace,
|
|
122
|
-
identity: candidate,
|
|
123
|
-
scope,
|
|
124
|
-
...(diff === undefined || diff === null ? {} : { diff }),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
async function auditTargetAnswer(repository, state, candidate) {
|
|
128
|
-
const target = state.coordinates.target;
|
|
129
|
-
if (target === undefined)
|
|
130
|
-
return { kind: "not-observed" };
|
|
131
|
-
return await adjudicateAuditTarget(repository, {
|
|
132
|
-
contractId: state.id,
|
|
133
|
-
coordinates: { ...state.coordinates, target },
|
|
134
|
-
predecessor: candidate.integration.predecessor,
|
|
135
|
-
candidate: candidate.integration.snapshot,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function blockedAudit(refusal) {
|
|
139
|
-
return {
|
|
140
|
-
candidate: { kind: "blocked", refusal },
|
|
141
|
-
verification: { kind: "not-run" },
|
|
142
|
-
target: { kind: "not-observed" },
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function completedAudit(state, verified, value) {
|
|
146
|
-
const obligations = {
|
|
147
|
-
...(verified?.cleanup === undefined ? {} : { cleanup: verified.cleanup }),
|
|
148
|
-
...(verified?.leak === undefined ? {} : { leak: verified.leak }),
|
|
149
|
-
};
|
|
150
|
-
return verified?.admission === undefined
|
|
151
|
-
? accepted(state, [], value, undefined, obligations)
|
|
152
|
-
: { ...admitted(verified.admission, value), ...obligations };
|
|
153
|
-
}
|
|
154
|
-
// eslint-disable-next-line complexity -- one adjudicated audit retains partial observations before each later owner boundary.
|
|
155
|
-
export async function auditOperation(input) {
|
|
156
|
-
const observed = await observeContractsForAdmissionAt(input.scope, input.channel, [input.contractId]);
|
|
157
|
-
const state = activeContract(observed.decision, input.contractId);
|
|
158
|
-
if ("kind" in state)
|
|
159
|
-
return { kind: "refused", refusal: state };
|
|
160
|
-
const derivation = input.deriveDocument?.(state);
|
|
161
|
-
if (derivation === undefined || !documentIsCurrent(state, derivation.document)) {
|
|
162
|
-
return { kind: "refused", refusal: { kind: "document-moved", contractId: input.contractId } };
|
|
163
|
-
}
|
|
164
|
-
if (derivation.verification.kind === "refused")
|
|
165
|
-
return { kind: "refused", refusal: derivation.verification.refusal };
|
|
166
|
-
const workspace = await auditWorkspace(input.scope, state);
|
|
167
|
-
if (workspace.kind === "unappointed") {
|
|
168
|
-
return accepted(state, [], blockedAudit({ kind: "worktree-missing", contractId: state.id }));
|
|
169
|
-
}
|
|
170
|
-
const prepared = await prepareDelivery(input.scope, {
|
|
171
|
-
contractId: state.id,
|
|
172
|
-
coordinates: state.coordinates,
|
|
173
|
-
recordedIntegrations: recordedIntegrationSnapshots(observed.journals.get(state.id)?.entries ?? []),
|
|
174
|
-
...(workspace.appointment === undefined ? {} : { appointment: workspace.appointment }),
|
|
175
|
-
}, {
|
|
176
|
-
title: derivation.title,
|
|
177
|
-
document: derivation.bytes,
|
|
178
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
179
|
-
requireBranchesToBeUpToDate: input.requireBranchesToBeUpToDate ?? false,
|
|
180
|
-
includeDirty: input.includeDirty ?? false,
|
|
181
|
-
});
|
|
182
|
-
if (prepared.kind === "refused")
|
|
183
|
-
return accepted(state, [], blockedAudit(prepared.refusal));
|
|
184
|
-
const candidate = await readyAuditCandidate(input.scope, prepared.data, workspace.answer, input.showDiff === true);
|
|
185
|
-
input.progress?.recordAudit(state.id, { candidate });
|
|
186
|
-
const verified = derivation.verification.data === null
|
|
187
|
-
? undefined
|
|
188
|
-
: await auditCandidateVerification(input, state, prepared.data.integration.snapshot, derivation.verification.data);
|
|
189
|
-
const verification = auditVerificationAnswer(verified, derivation.verification.data);
|
|
190
|
-
const delivery = auditDeliveryRelation(verified?.admission?.state ?? state, prepared.data, derivation.verification.data);
|
|
191
|
-
input.progress?.recordAudit(state.id, { verification, ...(delivery === undefined ? {} : { delivery }) });
|
|
192
|
-
const target = await auditTargetAnswer(input.scope, state, prepared.data);
|
|
193
|
-
input.progress?.recordAudit(state.id, { target });
|
|
194
|
-
const targetLag = target.kind === "placeable" ? await observeTargetLag(input.scope, workspace.answer.path, target.head) : undefined;
|
|
195
|
-
const value = {
|
|
196
|
-
candidate,
|
|
197
|
-
verification,
|
|
198
|
-
target,
|
|
199
|
-
...(targetLag === undefined ? {} : { targetLag }),
|
|
200
|
-
...(delivery === undefined ? {} : { delivery }),
|
|
201
|
-
};
|
|
202
|
-
return completedAudit(state, verified, value);
|
|
203
|
-
}
|