@astrosheep/keiyaku 4.5.20 → 4.5.21

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.
Files changed (154) hide show
  1. package/README.md +4 -4
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +3 -3
  3. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +22 -8
  4. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/references/automation.md +237 -0
  5. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +6 -7
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +2 -3
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +3 -3
  8. package/build/src/akuma/akuma-handle.d.ts +5 -1
  9. package/build/src/akuma/akuma-handle.js +4 -1
  10. package/build/src/akuma/akuma-instance.d.ts +7 -2
  11. package/build/src/akuma/akuma-instance.js +14 -7
  12. package/build/src/akuma/akuma-observe.d.ts +11 -0
  13. package/build/src/akuma/akuma-observe.js +22 -0
  14. package/build/src/akuma/akuma-product.d.ts +1 -0
  15. package/build/src/akuma/akuma-product.js +3 -0
  16. package/build/src/akuma/akuma.d.ts +1 -0
  17. package/build/src/akuma/body.d.ts +25 -5
  18. package/build/src/akuma/body.js +65 -8
  19. package/build/src/akuma/call-request.d.ts +2 -0
  20. package/build/src/akuma/call-request.js +2 -0
  21. package/build/src/akuma/fleet-execution.d.ts +28 -0
  22. package/build/src/akuma/fleet-execution.js +36 -4
  23. package/build/src/akuma/fleet-request.d.ts +10 -0
  24. package/build/src/akuma/fleet-request.js +11 -2
  25. package/build/src/akuma/heart/facts.d.ts +2 -0
  26. package/build/src/akuma/heart/index.d.ts +1 -0
  27. package/build/src/akuma/heart/index.js +4 -1
  28. package/build/src/akuma/heart/rows.d.ts +2 -0
  29. package/build/src/akuma/heart/rows.js +7 -5
  30. package/build/src/akuma/heart/schema.d.ts +1 -1
  31. package/build/src/akuma/heart/schema.js +3 -1
  32. package/build/src/akuma/heart/tells.js +6 -5
  33. package/build/src/akuma/heart/timeline.js +1 -1
  34. package/build/src/akuma/provider.d.ts +1 -1
  35. package/build/src/akuma/provider.js +1 -1
  36. package/build/src/akuma/providers/acp/core.js +3 -6
  37. package/build/src/akuma/providers/claude/index.js +9 -12
  38. package/build/src/akuma/providers/codex-app-server/index.js +4 -11
  39. package/build/src/akuma/providers/execution-environment.d.ts +6 -0
  40. package/build/src/akuma/providers/execution-environment.js +24 -0
  41. package/build/src/akuma/providers/opencode-sdk/index.js +30 -23
  42. package/build/src/akuma/providers/opencode-sdk/session.d.ts +8 -1
  43. package/build/src/akuma/providers/opencode-sdk/session.js +6 -5
  44. package/build/src/akuma/providers/pi/events.js +7 -2
  45. package/build/src/akuma/providers/pi/index.js +3 -2
  46. package/build/src/akuma/request-rendezvous.js +8 -3
  47. package/build/src/akuma/turn-drive.d.ts +1 -0
  48. package/build/src/akuma/turn-drive.js +2 -0
  49. package/build/src/akuma-body.js +2 -0
  50. package/build/src/body/amend.js +6 -4
  51. package/build/src/body/decode.d.ts +3 -1
  52. package/build/src/body/decode.js +53 -17
  53. package/build/src/body/region.d.ts +9 -1
  54. package/build/src/body/region.js +87 -12
  55. package/build/src/body/render.js +1 -1
  56. package/build/src/body/verification.d.ts +3 -1
  57. package/build/src/body/verification.js +4 -1
  58. package/build/src/cli/accepted.js +19 -2
  59. package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
  60. package/build/src/cli/commands/akuma-invoke.js +133 -13
  61. package/build/src/cli/commands/akuma.js +11 -4
  62. package/build/src/cli/commands/contract-help.js +17 -4
  63. package/build/src/cli/commands/contract.js +6 -4
  64. package/build/src/cli/commands/status-set.js +15 -24
  65. package/build/src/cli/main.js +5 -0
  66. package/build/src/cli/parse.d.ts +2 -0
  67. package/build/src/cli/parse.js +5 -0
  68. package/build/src/cli/render/akuma-activity.d.ts +99 -2
  69. package/build/src/cli/render/akuma-activity.js +484 -40
  70. package/build/src/cli/render/akuma.d.ts +10 -0
  71. package/build/src/cli/render/akuma.js +28 -21
  72. package/build/src/cli/render/audit.js +1 -1
  73. package/build/src/cli/render/board.js +1 -1
  74. package/build/src/cli/render/catalog.js +16 -13
  75. package/build/src/cli/render/contract-history.js +39 -10
  76. package/build/src/cli/render/contract-observation.js +10 -6
  77. package/build/src/cli/render/contract.js +109 -106
  78. package/build/src/cli/render/execution-progress.d.ts +23 -1
  79. package/build/src/cli/render/execution-progress.js +151 -28
  80. package/build/src/cli/render/kanshi-akuma.js +27 -39
  81. package/build/src/cli/render/kanshi.js +33 -26
  82. package/build/src/cli/render/nuke.js +1 -1
  83. package/build/src/cli/render/receipt.d.ts +1 -1
  84. package/build/src/cli/render/receipt.js +5 -5
  85. package/build/src/cli/render/refusal.js +10 -7
  86. package/build/src/cli/render/region.js +1 -1
  87. package/build/src/cli/render/settings.js +12 -2
  88. package/build/src/cli/render/status-line.d.ts +30 -0
  89. package/build/src/cli/render/status-line.js +58 -0
  90. package/build/src/cli/render/status-set.js +1 -1
  91. package/build/src/cli/render/task.d.ts +2 -0
  92. package/build/src/cli/render/task.js +11 -7
  93. package/build/src/cli/render/terminal.d.ts +0 -1
  94. package/build/src/cli/render/terminal.js +47 -15
  95. package/build/src/cli/result.d.ts +1 -0
  96. package/build/src/cli/runtime.d.ts +2 -0
  97. package/build/src/cli/runtime.js +13 -7
  98. package/build/src/cli/usage.js +2 -2
  99. package/build/src/cli/version.d.ts +1 -0
  100. package/build/src/cli/version.js +25 -0
  101. package/build/src/git/workspace.d.ts +1 -1
  102. package/build/src/git/workspace.js +1 -1
  103. package/build/src/identity/mint.d.ts +13 -0
  104. package/build/src/identity/mint.js +26 -0
  105. package/build/src/identity/normalize.d.ts +4 -0
  106. package/build/src/identity/normalize.js +30 -0
  107. package/build/src/index.d.ts +2 -0
  108. package/build/src/index.js +1 -0
  109. package/build/src/kanshi/read.js +17 -4
  110. package/build/src/kanshi/report.d.ts +1 -0
  111. package/build/src/library/akuma-creation.d.ts +2 -0
  112. package/build/src/library/akuma-creation.js +33 -17
  113. package/build/src/library/bind.js +18 -16
  114. package/build/src/library/contract-bind.d.ts +3 -1
  115. package/build/src/library/contract-bind.js +5 -3
  116. package/build/src/library/contract-operations.d.ts +2 -2
  117. package/build/src/library/contract-operations.js +1 -1
  118. package/build/src/library/contract-types.d.ts +1 -0
  119. package/build/src/library/fleet.d.ts +4 -1
  120. package/build/src/library/fleet.js +32 -8
  121. package/build/src/plugin/akuma-signals.d.ts +6 -0
  122. package/build/src/plugin/akuma-signals.js +8 -0
  123. package/build/src/plugin/public.d.ts +4 -0
  124. package/build/src/plugin/runtime.js +4 -1
  125. package/build/src/protocol/amend.js +4 -3
  126. package/build/src/protocol/attempt.d.ts +2 -0
  127. package/build/src/protocol/bind.js +41 -14
  128. package/build/src/protocol/completion.d.ts +3 -0
  129. package/build/src/protocol/completion.js +7 -1
  130. package/build/src/protocol/deliver.js +165 -92
  131. package/build/src/protocol/execution-observation.d.ts +0 -4
  132. package/build/src/protocol/intent.d.ts +15 -20
  133. package/build/src/protocol/intent.js +29 -17
  134. package/build/src/protocol/operations.d.ts +2 -0
  135. package/build/src/protocol/placement.js +5 -1
  136. package/build/src/protocol/read/status.d.ts +1 -0
  137. package/build/src/protocol/read/status.js +10 -2
  138. package/build/src/protocol/reintegrate.d.ts +1 -1
  139. package/build/src/protocol/reintegrate.js +70 -43
  140. package/build/src/protocol/result-codec.js +9 -7
  141. package/build/src/protocol/review.js +53 -30
  142. package/build/src/protocol/run.d.ts +83 -36
  143. package/build/src/protocol/run.js +90 -75
  144. package/build/src/runtime/proc/windows-launch.exe +0 -0
  145. package/build/src/settings.js +5 -14
  146. package/build/src/task/document.d.ts +5 -1
  147. package/build/src/task/document.js +6 -1
  148. package/build/src/verification/execution.d.ts +0 -1
  149. package/build/src/verification/execution.js +0 -24
  150. package/build/src/verification/observation.d.ts +0 -4
  151. package/build/src/verification/observation.js +1 -2
  152. package/package.json +3 -1
  153. package/build/src/git/verification-environment.d.ts +0 -10
  154. package/build/src/git/verification-environment.js +0 -281
@@ -3,16 +3,12 @@ import { appendPrivateStateSeatClose, isPrivateStateSeatContention, mergePrivate
3
3
  import { GIT_REF, readRefs } from "../git/repository.js";
4
4
  import { admitDecidedOffer } from "./attempt.js";
5
5
  export const STALE_PRIVATE_STATE_PREPARATION = {
6
- kind: "publication-failed",
7
- diagnostic: "stale private-state preparation",
6
+ kind: "stale",
8
7
  };
9
- export function privateRootCommit(observation) {
10
- return observation.admission.snapshot.commit;
8
+ export function contractStateWitness(state) {
9
+ return { head: state.head };
11
10
  }
12
- export function samePrivateRootObservation(prepared, fresh) {
13
- return privateRootCommit(prepared) === privateRootCommit(fresh);
14
- }
15
- export function sameSpeculativeWorktreeInput(prepared, fresh) {
11
+ export function sameWorktreeWitness(prepared, fresh) {
16
12
  if (prepared === undefined || fresh === undefined)
17
13
  return prepared === fresh;
18
14
  return (prepared.tree === fresh.tree &&
@@ -32,14 +28,6 @@ export function publicationFailedFromSeatError(error) {
32
28
  return { kind: "publication-failed", diagnostic: error.message };
33
29
  throw error;
34
30
  }
35
- export async function matchingPrivateRootObservation(repository, channel, contractId, prepared, revalidate) {
36
- const fresh = await observeContractsForAdmissionAt(repository, channel, [contractId]);
37
- if (!samePrivateRootObservation(prepared, fresh))
38
- return STALE_PRIVATE_STATE_PREPARATION;
39
- if (revalidate !== undefined && !(await revalidate(fresh)))
40
- return STALE_PRIVATE_STATE_PREPARATION;
41
- return fresh;
42
- }
43
31
  export async function privateStateSeatAttempt(repository, action, wrap) {
44
32
  try {
45
33
  return wrap(await withPrivateStatePublicationSeat(repository, action));
@@ -53,30 +41,23 @@ async function observeProtocolDecision(input) {
53
41
  ? await observeContractsForAdmissionAt(input.repository, input.channel, input.contracts, input.observationSelection)
54
42
  : await input.observe(input.repository, input.channel, input.contracts);
55
43
  }
56
- async function prepareProtocolSeed(input, observation) {
57
- if (!("prepareInput" in input) || input.prepareInput === undefined) {
58
- return { kind: "prepared", input: input.input, assertions: [] };
59
- }
60
- const prepared = await input.prepareInput(observation, input.input);
61
- return prepared.kind === "refused" ? prepared : { ...prepared, assertions: prepared.assertions ?? [] };
62
- }
63
- async function decideDecoratedProtocolOffer(input, baseAttempt, decisionObservation, preparedInput) {
64
- const attempt = input.extendAttempt === undefined
65
- ? baseAttempt
66
- : input.extendAttempt(baseAttempt, decisionObservation.decision.size);
67
- const decision = input.decide({
68
- input: preparedInput.input,
44
+ async function decideDecoratedProtocolOffer(admission, primaryContract, decisionObservation, prepared) {
45
+ const attempt = admission.extendAttempt === undefined
46
+ ? prepared.attempt
47
+ : admission.extendAttempt(prepared.attempt, decisionObservation.decision.size);
48
+ const decision = admission.decide({
49
+ input: prepared.input,
69
50
  attempt,
70
51
  observation: decisionObservation.decision,
71
52
  });
72
53
  if (decision.kind === "refused")
73
54
  return decision;
74
- const companions = input.decorateOffer === undefined
55
+ const companions = admission.decorateOffer === undefined
75
56
  ? []
76
- : await input.decorateOffer({
77
- repository: input.repository,
57
+ : await admission.decorateOffer({
58
+ repository: admission.repository,
78
59
  observation: decisionObservation,
79
- contractId: input.input.contractId,
60
+ contractId: primaryContract,
80
61
  offer: decision.offer,
81
62
  });
82
63
  const offer = companions.length === 0
@@ -84,22 +65,31 @@ async function decideDecoratedProtocolOffer(input, baseAttempt, decisionObservat
84
65
  : { ...decision.offer, companions: [...(decision.offer.companions ?? []), ...companions] };
85
66
  const admissionObservation = companions.length === 0
86
67
  ? decisionObservation
87
- : await extendAdmissionPathsAt(input.channel, decisionObservation, companions.map(({ path }) => path));
68
+ : await extendAdmissionPathsAt(admission.channel, decisionObservation, companions.map(({ path }) => path));
88
69
  return {
89
70
  kind: "offered",
90
71
  observation: admissionObservation,
91
72
  attempt,
92
73
  offer,
93
- assertions: preparedInput.assertions,
74
+ assertions: prepared.assertions,
94
75
  };
95
76
  }
96
- /** Form one decided offer without admitting or reinterpreting it. */
97
- export async function prepareProtocolAttempt(input, baseAttempt) {
98
- const decisionObservation = await observeProtocolDecision(input);
99
- const preparedInput = await prepareProtocolSeed(input, decisionObservation);
100
- if (preparedInput.kind === "refused")
101
- return preparedInput;
102
- return await decideDecoratedProtocolOffer(input, baseAttempt, decisionObservation, preparedInput);
77
+ async function admitDecidedProtocolOffer(admission, primaryContract, seat, decisionObservation, prepared) {
78
+ const decided = await decideDecoratedProtocolOffer(admission, primaryContract, decisionObservation, prepared);
79
+ if (decided.kind === "refused")
80
+ return decided;
81
+ return await admitDecidedOffer({
82
+ channel: admission.channel,
83
+ repository: admission.repository,
84
+ seat,
85
+ decisionObservation: decided.observation,
86
+ attempt: decided.attempt,
87
+ offer: decided.offer,
88
+ primaryContract,
89
+ ...(admission.progress === undefined ? {} : { progress: admission.progress }),
90
+ assertions: decided.assertions,
91
+ ...(admission.validateAdmission === undefined ? {} : { validateAdmission: admission.validateAdmission }),
92
+ });
103
93
  }
104
94
  function protocolAttemptWithSeatClose(outcome) {
105
95
  return mergePrivateStateSeatClose(outcome, (value, closeLag) => {
@@ -108,47 +98,72 @@ function protocolAttemptWithSeatClose(outcome) {
108
98
  return { ...value, seatClose: appendPrivateStateSeatClose(value.seatClose, closeLag) };
109
99
  });
110
100
  }
111
- async function speculateProtocolAttempt(input) {
112
- const observation = await observeProtocolDecision(input);
113
- const prepared = await prepareProtocolSeed(input, observation);
114
- return prepared.kind === "refused" ? prepared : { observation, ...prepared };
101
+ async function runDirectProtocolAttempt(input, attempt) {
102
+ return await privateStateSeatAttempt(input.repository, async (seat) => {
103
+ const observation = await observeProtocolDecision(input);
104
+ return await admitDecidedProtocolOffer(input, input.input.contractId, seat, observation, {
105
+ attempt,
106
+ input: input.input,
107
+ assertions: [],
108
+ });
109
+ }, protocolAttemptWithSeatClose);
110
+ }
111
+ /**
112
+ * One full attempt: repeatable preparation outside custody, then a single in-custody cycle of
113
+ * observation, witness validation, assembly, decision, companions, and atomic publication.
114
+ */
115
+ async function runSplitProtocolAttempt(input, attempt) {
116
+ const external = await input.preparation.external(input.input);
117
+ if (external.kind === "refused")
118
+ return external;
119
+ return await privateStateSeatAttempt(input.repository, async (seat) => {
120
+ const observation = await observeProtocolDecision(input);
121
+ const assembled = await input.preparation.assemble(observation, input.input, external.prepared);
122
+ if (assembled.kind !== "prepared")
123
+ return assembled;
124
+ const assertions = [...(external.assertions ?? []), ...(assembled.assertions ?? [])];
125
+ if (!(await privateStateAssertionsMatch(input.repository, assertions)))
126
+ return STALE_PRIVATE_STATE_PREPARATION;
127
+ return await admitDecidedProtocolOffer(input, input.input.contractId, seat, observation, {
128
+ attempt,
129
+ input: assembled.input,
130
+ assertions,
131
+ });
132
+ }, protocolAttemptWithSeatClose);
115
133
  }
116
- async function admitSpeculativeProtocolAttempt(input, seat, speculated, attempt) {
117
- const fresh = await observeProtocolDecision(input);
118
- if (!samePrivateRootObservation(speculated.observation, fresh) ||
119
- !(await privateStateAssertionsMatch(input.repository, speculated.assertions))) {
120
- return STALE_PRIVATE_STATE_PREPARATION;
121
- }
122
- const decided = await decideDecoratedProtocolOffer(input, attempt, fresh, {
123
- kind: "prepared",
124
- input: speculated.input,
125
- assertions: speculated.assertions,
126
- });
127
- if (decided.kind === "refused")
128
- return decided;
129
- return await admitDecidedOffer({
130
- channel: input.channel,
131
- repository: input.repository,
132
- seat,
133
- decisionObservation: decided.observation,
134
- attempt: decided.attempt,
135
- offer: decided.offer,
136
- primaryContract: input.input.contractId,
137
- ...(input.progress === undefined ? {} : input.progress === undefined ? {} : { progress: input.progress }),
138
- assertions: decided.assertions,
139
- ...(input.validateAdmission === undefined ? {} : { validateAdmission: input.validateAdmission }),
134
+ /** Form one decided offer without admitting or reinterpreting it. */
135
+ export async function prepareProtocolAttempt(input, baseAttempt) {
136
+ if (input.preparation === undefined)
137
+ return await prepareDirectProtocolAttempt(input, baseAttempt);
138
+ const external = await input.preparation.external(input.input);
139
+ if (external.kind === "refused")
140
+ return external;
141
+ const decisionObservation = await observeProtocolDecision(input);
142
+ const assembled = await input.preparation.assemble(decisionObservation, input.input, external.prepared);
143
+ if (assembled.kind !== "prepared")
144
+ return assembled;
145
+ return await decideDecoratedProtocolOffer(input, input.input.contractId, decisionObservation, {
146
+ attempt: baseAttempt,
147
+ input: assembled.input,
148
+ assertions: [...(external.assertions ?? []), ...(assembled.assertions ?? [])],
140
149
  });
141
150
  }
142
- async function runSpeculativeProtocolAttempt(input, speculated, attempt) {
143
- if (speculated.kind === "refused")
144
- return speculated;
145
- return await privateStateSeatAttempt(input.repository, async (seat) => await admitSpeculativeProtocolAttempt(input, seat, speculated, attempt), protocolAttemptWithSeatClose);
151
+ async function prepareDirectProtocolAttempt(input, baseAttempt) {
152
+ const decisionObservation = await observeProtocolDecision(input);
153
+ return await decideDecoratedProtocolOffer(input, input.input.contractId, decisionObservation, {
154
+ attempt: baseAttempt,
155
+ input: input.input,
156
+ assertions: [],
157
+ });
146
158
  }
147
159
  /** Run bounded, verb-neutral attempts and return one real admission on acceptance. */
148
160
  export async function runProtocol(input) {
149
161
  const attempts = input.attempts;
150
162
  for (let index = 0; index < attempts.length; index += 1) {
151
- const result = await runSpeculativeProtocolAttempt(input, await speculateProtocolAttempt(input), attempts[index]);
163
+ const attempt = attempts[index];
164
+ const result = input.preparation === undefined
165
+ ? await runDirectProtocolAttempt(input, attempt)
166
+ : await runSplitProtocolAttempt(input, attempt);
152
167
  if (result.kind === "refused" || result.kind === "accepted" || result.kind === "publication-failed")
153
168
  return result;
154
169
  if (result.kind === "collision" && index + 1 === attempts.length)
@@ -152,9 +152,6 @@ function bundleGates(name, value) {
152
152
  if (!gateWord(gate)) {
153
153
  throw new SettingsError(`gate bundle '${name}' contains an invalid gate word`);
154
154
  }
155
- if (gate !== "reviewed" && gate !== "verified") {
156
- throw new SettingsError(`gate bundle '${name}' contains a gate without a producer: ${gate}`);
157
- }
158
155
  return gate;
159
156
  });
160
157
  }
@@ -167,8 +164,10 @@ export function gatesFrom(input) {
167
164
  const names = input.names ?? ["default"];
168
165
  for (const name of names) {
169
166
  if (!gateWord(name))
170
- throw new SettingsError("gate bundle name must match ^[a-z][a-z0-9-]{0,63}$");
167
+ throw new SettingsError("gate or bundle name must match ^[a-z][a-z0-9-]{0,63}$");
171
168
  }
169
+ if (names.length === 0)
170
+ return Object.freeze([]);
172
171
  const view = input.settings.namespace("gates");
173
172
  if (view.kind === "failed")
174
173
  namespaceFailure(view);
@@ -176,16 +175,8 @@ export function gatesFrom(input) {
176
175
  const seen = new Set();
177
176
  for (const name of names) {
178
177
  const selected = view.entries.find((entry) => entry.name === name);
179
- if (selected === undefined) {
180
- if (input.names === undefined) {
181
- if (!seen.has("reviewed"))
182
- expanded.push("reviewed");
183
- seen.add("reviewed");
184
- continue;
185
- }
186
- throw new SettingsError(`unknown gate bundle: ${name}`);
187
- }
188
- for (const gate of bundleGates(name, selected.value)) {
178
+ const gates = selected === undefined ? [input.names === undefined ? "reviewed" : name] : bundleGates(name, selected.value);
179
+ for (const gate of gates) {
189
180
  if (seen.has(gate))
190
181
  continue;
191
182
  seen.add(gate);
@@ -18,7 +18,11 @@ export type TaskDocument = Readonly<{
18
18
  }>;
19
19
  export type TaskCreationDocument = Omit<TaskDocument, "id" | "createdBy" | "createdAt" | "updatedAt">;
20
20
  export declare class TaskAuthorityCorruptionError extends Error {
21
- constructor(message: string, options?: ErrorOptions);
21
+ /** The Task document whose bytes failed decode, when the reader knew its coordinate. */
22
+ readonly coordinate?: TaskId;
23
+ constructor(message: string, options?: ErrorOptions & {
24
+ coordinate?: TaskId;
25
+ });
22
26
  }
23
27
  export declare function parseTaskDocument(bytes: Uint8Array, expected: TaskCoordinate): TaskDocument;
24
28
  export declare function parseTaskCreationDocument(markdown: string): TaskCreationDocument;
@@ -1,9 +1,13 @@
1
1
  import { isMap, parseDocument, stringify } from "yaml";
2
2
  import { formatTaskId, parseTaskId } from "./identity.js";
3
3
  export class TaskAuthorityCorruptionError extends Error {
4
+ /** The Task document whose bytes failed decode, when the reader knew its coordinate. */
5
+ coordinate;
4
6
  constructor(message, options) {
5
7
  super(message, options);
6
8
  this.name = "TaskAuthorityCorruptionError";
9
+ if (options?.coordinate !== undefined)
10
+ this.coordinate = options.coordinate;
7
11
  }
8
12
  }
9
13
  const STATES = new Set(["open", "in_progress", "on_hold", "done", "drop"]);
@@ -107,8 +111,9 @@ function fields(value, body, fail) {
107
111
  };
108
112
  }
109
113
  export function parseTaskDocument(bytes, expected) {
114
+ const coordinate = formatTaskId(expected);
110
115
  const fail = (message, cause) => {
111
- throw new TaskAuthorityCorruptionError(message, cause === undefined ? {} : { cause });
116
+ throw new TaskAuthorityCorruptionError(message, { coordinate, ...(cause === undefined ? {} : { cause }) });
112
117
  };
113
118
  const { value, body } = frontMatter(Buffer.from(bytes).toString("utf8"), fail);
114
119
  closed(value, STORED_KEYS, REQUIRED_STORED_KEYS, fail);
@@ -50,7 +50,6 @@ export type ExecuteVerificationInput = Readonly<{
50
50
  declarations: readonly VerificationDeclaration[];
51
51
  materializeScratchCandidate: (repository: GitRepository, candidate: SnapshotId) => Promise<MaterializedScratchCandidate>;
52
52
  projectSettings: (root: string) => Promise<Settings>;
53
- environmentSource?: string;
54
53
  observe?: (event: VerificationObservation) => void;
55
54
  signal?: AbortSignal;
56
55
  }>;
@@ -1,6 +1,5 @@
1
1
  import { runHookCommands, worktreeHooksFrom } from "../git/hooks.js";
2
2
  import { runProcess } from "../runtime/proc/run.js";
3
- import { inheritVerificationEnvironment } from "../git/verification-environment.js";
4
3
  const SUMMARY_BYTES = 32 * 1024;
5
4
  export function capturedOutput(value) {
6
5
  return {
@@ -137,32 +136,9 @@ async function materializeScratch(input) {
137
136
  };
138
137
  }
139
138
  }
140
- async function inheritEnvironment(input, cwd) {
141
- const coordinate = {
142
- phase: "environment",
143
- cwd,
144
- ...(input.environmentSource === undefined ? {} : { source: input.environmentSource }),
145
- };
146
- observe(input, { kind: "phase", ...coordinate, state: "started" });
147
- try {
148
- if (input.environmentSource !== undefined)
149
- await inheritVerificationEnvironment(input.repository, input.environmentSource, cwd, input.signal);
150
- observe(input, { kind: "phase", ...coordinate, state: "finished", outcome: "ok" });
151
- }
152
- catch (error) {
153
- observe(input, {
154
- kind: "phase",
155
- ...coordinate,
156
- state: "finished",
157
- outcome: input.signal?.aborted ? "cancelled" : "failed",
158
- });
159
- throw error;
160
- }
161
- }
162
139
  async function runScratch(input, scratch) {
163
140
  try {
164
141
  input.signal?.throwIfAborted();
165
- await inheritEnvironment(input, scratch.cwd);
166
142
  const hooks = worktreeHooksFrom({ settings: await input.projectSettings(scratch.cwd) });
167
143
  const readiness = await observedHooks({
168
144
  execution: input,
@@ -9,12 +9,10 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
9
9
  phase: z.ZodEnum<{
10
10
  cleanup: "cleanup";
11
11
  materialize: "materialize";
12
- environment: "environment";
13
12
  setup: "setup";
14
13
  declaration: "declaration";
15
14
  }>;
16
15
  cwd: z.ZodOptional<z.ZodString>;
17
- source: z.ZodOptional<z.ZodString>;
18
16
  name: z.ZodOptional<z.ZodString>;
19
17
  command: z.ZodOptional<z.ZodString>;
20
18
  index: z.ZodOptional<z.ZodNumber>;
@@ -29,12 +27,10 @@ export declare const verificationObservationSchema: z.ZodDiscriminatedUnion<[z.Z
29
27
  phase: z.ZodEnum<{
30
28
  cleanup: "cleanup";
31
29
  materialize: "materialize";
32
- environment: "environment";
33
30
  setup: "setup";
34
31
  declaration: "declaration";
35
32
  }>;
36
33
  cwd: z.ZodOptional<z.ZodString>;
37
- source: z.ZodOptional<z.ZodString>;
38
34
  name: z.ZodOptional<z.ZodString>;
39
35
  command: z.ZodOptional<z.ZodString>;
40
36
  index: z.ZodOptional<z.ZodNumber>;
@@ -1,9 +1,8 @@
1
1
  import { z } from "zod";
2
- const phase = z.enum(["materialize", "environment", "setup", "declaration", "cleanup"]);
2
+ const phase = z.enum(["materialize", "setup", "declaration", "cleanup"]);
3
3
  const coordinate = {
4
4
  phase,
5
5
  cwd: z.string().optional(),
6
- source: z.string().optional(),
7
6
  name: z.string().optional(),
8
7
  command: z.string().optional(),
9
8
  index: z.number().int().positive().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.5.20",
3
+ "version": "4.5.21",
4
4
  "workspaces": [
5
5
  "plugins/*"
6
6
  ],
@@ -39,6 +39,7 @@
39
39
  "node": ">=22.19.0"
40
40
  },
41
41
  "scripts": {
42
+ "release": "npm run test:release && npm version patch && npm publish",
42
43
  "build": "node --input-type=module -e \"import { rmSync } from 'node:fs'; rmSync('build', { recursive: true, force: true })\" && tsc -p tsconfig.json && npm run build --workspace @astrosheep/keiyaku-plugin-square && node scripts/copy-integrations.js && node scripts/build-windows-launcher.js && node --input-type=module -e \"import { chmodSync } from 'node:fs'; chmodSync('build/src/cli/index.js', 0o755)\"",
43
44
  "prepack": "node scripts/verify-package.js",
44
45
  "postpack": "node scripts/verify-package.js",
@@ -80,6 +81,7 @@
80
81
  "@agentclientprotocol/sdk": "^1.3.0",
81
82
  "@anthropic-ai/claude-agent-sdk": "^0.3.226",
82
83
  "@astrosheep/keiyaku-plugin-square": "0.1.5",
84
+ "@astrosheep/square": "^0.3.50",
83
85
  "@earendil-works/pi-coding-agent": "0.85.1",
84
86
  "@opencode-ai/sdk": "1.18.3",
85
87
  "cross-spawn": "^7.0.6",
@@ -1,10 +0,0 @@
1
- import { type GitRepository } from "./process.js";
2
- /** A source or destination filesystem shape that cannot safely be inherited. */
3
- export declare class VerificationEnvironmentError extends Error {
4
- constructor(message: string);
5
- }
6
- /**
7
- * Copy the selected appointment's ignored and untracked execution state into a
8
- * materialized candidate without changing either Git worktree's authority.
9
- */
10
- export declare function inheritVerificationEnvironment(repository: GitRepository, source: string, destination: string, signal?: AbortSignal): Promise<void>;