@astrosheep/keiyaku 4.6.26 → 4.6.28

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 (301) hide show
  1. package/README.md +113 -35
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +14 -26
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +64 -44
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +13 -25
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +42 -29
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +13 -8
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +57 -61
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +14 -26
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +64 -44
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +13 -25
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +42 -29
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +13 -8
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +57 -61
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +14 -26
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +64 -44
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +13 -25
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +42 -29
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +13 -8
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +57 -61
  26. package/build/plugins/pi/README.md +7 -12
  27. package/build/plugins/pi/akuma-tools.ts +3 -18
  28. package/build/skills/keiyaku/SKILL.md +14 -26
  29. package/build/skills/keiyaku-akuma/SKILL.md +64 -44
  30. package/build/skills/keiyaku-akuma/references/automation.md +13 -25
  31. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  32. package/build/skills/keiyaku-bind/SKILL.md +42 -29
  33. package/build/skills/keiyaku-debt/SKILL.md +13 -8
  34. package/build/skills/keiyaku-workflow/SKILL.md +57 -61
  35. package/build/src/akuma/akuma-call.d.ts +15 -18
  36. package/build/src/akuma/akuma-call.js +55 -112
  37. package/build/src/akuma/akuma-errors.d.ts +0 -5
  38. package/build/src/akuma/akuma-errors.js +0 -9
  39. package/build/src/akuma/akuma-instance.d.ts +0 -2
  40. package/build/src/akuma/akuma-instance.js +18 -14
  41. package/build/src/akuma/akuma-observe.js +0 -1
  42. package/build/src/akuma/akuma-owner.js +0 -1
  43. package/build/src/akuma/akuma.d.ts +10 -26
  44. package/build/src/akuma/akuma.js +0 -2
  45. package/build/src/akuma/archetype.d.ts +0 -2
  46. package/build/src/akuma/archetype.js +3 -9
  47. package/build/src/akuma/body-launch.d.ts +12 -4
  48. package/build/src/akuma/body.d.ts +2 -5
  49. package/build/src/akuma/body.js +5 -49
  50. package/build/src/akuma/call-initial-tell.d.ts +39 -147
  51. package/build/src/akuma/call-initial-tell.js +0 -48
  52. package/build/src/akuma/caller.d.ts +0 -4
  53. package/build/src/akuma/custody.js +1 -57
  54. package/build/src/akuma/heart/facts.d.ts +0 -39
  55. package/build/src/akuma/heart/facts.js +0 -1
  56. package/build/src/akuma/heart/index.d.ts +1 -2
  57. package/build/src/akuma/heart/index.js +0 -1
  58. package/build/src/akuma/heart/schema.js +0 -26
  59. package/build/src/akuma/heart/soul.d.ts +2 -2
  60. package/build/src/akuma/heart/soul.js +2 -4
  61. package/build/src/akuma/identity.d.ts +0 -1
  62. package/build/src/akuma/identity.js +0 -2
  63. package/build/src/akuma/in-process-body.d.ts +1 -1
  64. package/build/src/akuma/index.d.ts +0 -2
  65. package/build/src/akuma/index.js +0 -1
  66. package/build/src/akuma/projection.d.ts +23 -23
  67. package/build/src/akuma/provider.d.ts +0 -5
  68. package/build/src/akuma/provider.js +0 -1
  69. package/build/src/akuma/providers/acp/core.js +1 -1
  70. package/build/src/akuma/providers/claude/index.js +1 -2
  71. package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
  72. package/build/src/akuma/providers/codex-app-server/events.js +1 -3
  73. package/build/src/akuma/providers/codex-app-server/index.js +1 -1
  74. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  75. package/build/src/akuma/providers/execution-environment.js +1 -7
  76. package/build/src/akuma/providers/opencode-sdk/index.js +0 -1
  77. package/build/src/akuma/providers/opencode-sdk/session.d.ts +0 -1
  78. package/build/src/akuma/providers/opencode-sdk/session.js +4 -4
  79. package/build/src/akuma/providers/paseo/index.js +2 -9
  80. package/build/src/akuma/providers/pi/index.js +8 -14
  81. package/build/src/akuma/publication.d.ts +24 -59
  82. package/build/src/akuma/publication.js +29 -64
  83. package/build/src/akuma/selection-observation.d.ts +47 -2036
  84. package/build/src/akuma/selection-observation.js +1 -59
  85. package/build/src/akuma/turn-drive.d.ts +0 -8
  86. package/build/src/akuma/turn-drive.js +19 -103
  87. package/build/src/akuma-body.js +3 -6
  88. package/build/src/body-host.d.ts +8 -2
  89. package/build/src/body-host.js +30 -4
  90. package/build/src/cli/commands/akuma-grammar.d.ts +0 -2
  91. package/build/src/cli/commands/akuma-grammar.js +14 -37
  92. package/build/src/cli/commands/akuma.js +31 -49
  93. package/build/src/cli/commands/contract-grammar.d.ts +7 -1
  94. package/build/src/cli/commands/contract-grammar.js +15 -0
  95. package/build/src/cli/commands/contract-help.d.ts +13 -1
  96. package/build/src/cli/commands/contract-help.js +88 -81
  97. package/build/src/cli/commands/contract.js +27 -26
  98. package/build/src/cli/commands/debt-grammar.js +15 -15
  99. package/build/src/cli/commands/debt.js +3 -3
  100. package/build/src/cli/commands/install.d.ts +1 -1
  101. package/build/src/cli/commands/install.js +1 -2
  102. package/build/src/cli/commands/whoami.d.ts +0 -2
  103. package/build/src/cli/commands/whoami.js +0 -5
  104. package/build/src/cli/coordinates.js +15 -0
  105. package/build/src/cli/delivery-identity.d.ts +3 -0
  106. package/build/src/cli/delivery-identity.js +23 -0
  107. package/build/src/cli/parse.js +2 -1
  108. package/build/src/cli/render/akuma-activity.d.ts +0 -1
  109. package/build/src/cli/render/akuma-activity.js +1 -4
  110. package/build/src/cli/render/catalog.js +7 -1
  111. package/build/src/cli/render/contract-history.js +16 -38
  112. package/build/src/cli/render/contract-observation.d.ts +23 -10
  113. package/build/src/cli/render/contract-observation.js +9 -6
  114. package/build/src/cli/render/contract-wait.d.ts +2 -0
  115. package/build/src/cli/render/contract-wait.js +18 -0
  116. package/build/src/cli/render/contract.d.ts +2 -2
  117. package/build/src/cli/render/contract.js +57 -39
  118. package/build/src/cli/render/delivery-preview.js +13 -26
  119. package/build/src/cli/render/execution-progress.js +9 -9
  120. package/build/src/cli/render/kanshi.js +4 -11
  121. package/build/src/cli/render/receipt.d.ts +18 -0
  122. package/build/src/cli/render/receipt.js +34 -10
  123. package/build/src/cli/render/reconcile.js +3 -0
  124. package/build/src/cli/render/refusal.js +28 -6
  125. package/build/src/cli/render/whoami.js +1 -4
  126. package/build/src/cli/runtime.d.ts +0 -2
  127. package/build/src/cli/runtime.js +3 -7
  128. package/build/src/cli/selectors.d.ts +1 -2
  129. package/build/src/cli/selectors.js +2 -5
  130. package/build/src/contract-guidance.js +4 -2
  131. package/build/src/contract-worktree.d.ts +3 -3
  132. package/build/src/core/facts/codec.js +38 -5
  133. package/build/src/core/facts/fold.js +1 -0
  134. package/build/src/core/facts/gate.d.ts +10 -4
  135. package/build/src/core/facts/gate.js +56 -39
  136. package/build/src/core/facts/observation.d.ts +7 -1
  137. package/build/src/core/facts/observation.js +15 -0
  138. package/build/src/core/facts/offer.d.ts +2 -2
  139. package/build/src/core/facts/types.d.ts +17 -1
  140. package/build/src/core/facts/types.js +6 -0
  141. package/build/src/core/verbs/amend.js +8 -0
  142. package/build/src/core/verbs/bind.d.ts +3 -1
  143. package/build/src/core/verbs/bind.js +9 -1
  144. package/build/src/core/verbs/deliver.d.ts +2 -1
  145. package/build/src/core/verbs/deliver.js +4 -1
  146. package/build/src/core/verbs/placement.d.ts +2 -1
  147. package/build/src/core/verbs/placement.js +7 -4
  148. package/build/src/core/verbs/reintegrate.d.ts +2 -1
  149. package/build/src/core/verbs/reintegrate.js +4 -1
  150. package/build/src/debt/board.d.ts +10 -10
  151. package/build/src/debt/created-observation.d.ts +3 -3
  152. package/build/src/debt/document.d.ts +1 -1
  153. package/build/src/debt/index.d.ts +2 -24
  154. package/build/src/debt/index.js +11 -71
  155. package/build/src/debt/operation-types.d.ts +44 -3
  156. package/build/src/git/admission.js +18 -6
  157. package/build/src/git/integration.d.ts +4 -4
  158. package/build/src/git/integration.js +7 -1
  159. package/build/src/git/observe.d.ts +6 -4
  160. package/build/src/git/observe.js +18 -17
  161. package/build/src/git/reconcile.d.ts +20 -8
  162. package/build/src/git/reconcile.js +94 -45
  163. package/build/src/git/repository.d.ts +3 -1
  164. package/build/src/git/repository.js +26 -4
  165. package/build/src/git/scratch.d.ts +1 -1
  166. package/build/src/git/scratch.js +19 -18
  167. package/build/src/git/target-placement.d.ts +33 -7
  168. package/build/src/git/target-placement.js +67 -18
  169. package/build/src/git/target.d.ts +32 -0
  170. package/build/src/git/target.js +84 -0
  171. package/build/src/git/terminal-reconcile.d.ts +1 -1
  172. package/build/src/git/terminal-reconcile.js +34 -6
  173. package/build/src/index.d.ts +9 -7
  174. package/build/src/index.js +1 -1
  175. package/build/src/library/address.d.ts +1 -20
  176. package/build/src/library/address.js +3 -24
  177. package/build/src/library/akuma-creation.d.ts +2 -5
  178. package/build/src/library/akuma-creation.js +60 -44
  179. package/build/src/library/akumas.d.ts +3 -9
  180. package/build/src/library/akumas.js +12 -25
  181. package/build/src/library/bind.d.ts +21 -9
  182. package/build/src/library/bind.js +5 -1
  183. package/build/src/library/continuation.d.ts +130 -155
  184. package/build/src/library/continuation.js +1 -4
  185. package/build/src/library/contract-composition.d.ts +4 -9
  186. package/build/src/library/contract-composition.js +8 -12
  187. package/build/src/library/contract-creation.d.ts +1 -3
  188. package/build/src/library/contract-creation.js +2 -3
  189. package/build/src/library/contract-execution.d.ts +3 -5
  190. package/build/src/library/contract-execution.js +55 -96
  191. package/build/src/library/contract-outcomes.d.ts +2 -1
  192. package/build/src/library/contract-types.d.ts +5 -0
  193. package/build/src/library/contract-wait.d.ts +35 -0
  194. package/build/src/library/contract-wait.js +141 -0
  195. package/build/src/library/delivery.d.ts +13 -525
  196. package/build/src/library/delivery.js +1 -12
  197. package/build/src/library/input.js +2 -1
  198. package/build/src/library/invocation.d.ts +5 -1
  199. package/build/src/library/invocation.js +9 -2
  200. package/build/src/library/keiyaku.d.ts +7 -6
  201. package/build/src/library/keiyaku.js +12 -7
  202. package/build/src/library/outcome.d.ts +461 -12586
  203. package/build/src/library/outcome.js +15 -234
  204. package/build/src/library/reconcile.d.ts +12 -0
  205. package/build/src/library/reconcile.js +1 -0
  206. package/build/src/library/refusal.d.ts +251 -34
  207. package/build/src/library/refusal.js +10 -5
  208. package/build/src/library/selection.d.ts +9 -35
  209. package/build/src/library/selection.js +59 -129
  210. package/build/src/plugin/akuma-signals.d.ts +2 -2
  211. package/build/src/plugin/akuma-signals.js +2 -2
  212. package/build/src/plugin/public.d.ts +0 -7
  213. package/build/src/plugin/runtime.d.ts +2 -2
  214. package/build/src/plugin/runtime.js +4 -3
  215. package/build/src/protocol/attempt.js +7 -3
  216. package/build/src/protocol/bind.d.ts +18 -4
  217. package/build/src/protocol/bind.js +102 -35
  218. package/build/src/protocol/completion.d.ts +18 -331
  219. package/build/src/protocol/completion.js +17 -130
  220. package/build/src/protocol/deliver.d.ts +3 -3
  221. package/build/src/protocol/deliver.js +64 -74
  222. package/build/src/protocol/delivery-preview.d.ts +85 -28
  223. package/build/src/protocol/delivery-preview.js +34 -22
  224. package/build/src/protocol/execution-observation.d.ts +12 -9
  225. package/build/src/protocol/execution-observation.js +0 -1
  226. package/build/src/protocol/intent.d.ts +20 -50
  227. package/build/src/protocol/intent.js +37 -44
  228. package/build/src/protocol/operations.d.ts +299 -19
  229. package/build/src/protocol/operations.js +68 -27
  230. package/build/src/protocol/outcome.d.ts +1 -1
  231. package/build/src/protocol/placement.d.ts +2 -2
  232. package/build/src/protocol/placement.js +4 -3
  233. package/build/src/protocol/progress.d.ts +35 -2
  234. package/build/src/protocol/progress.js +12 -1
  235. package/build/src/protocol/read/observation.js +15 -4
  236. package/build/src/protocol/read/status.d.ts +9 -14
  237. package/build/src/protocol/read/status.js +15 -22
  238. package/build/src/protocol/reintegrate.d.ts +4 -3
  239. package/build/src/protocol/reintegrate.js +21 -5
  240. package/build/src/protocol/review.d.ts +9 -15
  241. package/build/src/protocol/review.js +2 -6
  242. package/build/src/protocol/run.d.ts +1 -1
  243. package/build/src/protocol/verify.d.ts +51 -0
  244. package/build/src/protocol/verify.js +128 -0
  245. package/build/src/runtime/proc/windows-launch.exe +0 -0
  246. package/build/src/verification/declaration.d.ts +5 -1
  247. package/build/src/verification/declaration.js +19 -2
  248. package/build/src/verification/execution.d.ts +5 -2
  249. package/build/src/verification/execution.js +48 -53
  250. package/build/src/verification/observation.d.ts +10 -6
  251. package/build/src/verification/observation.js +5 -2
  252. package/package.json +3 -3
  253. package/plugins/paseo/plugin/index.server.ts +3 -0
  254. package/plugins/paseo/plugin/server/attach.ts +42 -0
  255. package/plugins/paseo/plugin/server/mirror-identity.ts +51 -0
  256. package/plugins/paseo/plugin/server/model.ts +26 -0
  257. package/plugins/paseo/plugin/server/provider.ts +4 -6
  258. package/plugins/paseo/plugin/server/reopen.ts +4 -39
  259. package/plugins/pi/README.md +7 -12
  260. package/plugins/pi/akuma-tools.ts +3 -18
  261. package/skills/keiyaku/SKILL.md +14 -26
  262. package/skills/keiyaku-akuma/SKILL.md +64 -44
  263. package/skills/keiyaku-akuma/references/automation.md +13 -25
  264. package/skills/keiyaku-babysit/SKILL.md +1 -1
  265. package/skills/keiyaku-bind/SKILL.md +42 -29
  266. package/skills/keiyaku-debt/SKILL.md +13 -8
  267. package/skills/keiyaku-workflow/SKILL.md +57 -61
  268. package/build/src/akuma/allowed.d.ts +0 -23
  269. package/build/src/akuma/allowed.js +0 -63
  270. package/build/src/akuma/call-request.d.ts +0 -308
  271. package/build/src/akuma/call-request.js +0 -175
  272. package/build/src/akuma/heart/request-authority.d.ts +0 -16
  273. package/build/src/akuma/heart/request-authority.js +0 -140
  274. package/build/src/akuma/heart/request-rows.d.ts +0 -18
  275. package/build/src/akuma/heart/request-rows.js +0 -107
  276. package/build/src/akuma/request-lifecycle.d.ts +0 -42
  277. package/build/src/akuma/request-lifecycle.js +0 -197
  278. package/build/src/akuma/request-observation.d.ts +0 -45
  279. package/build/src/akuma/request-observation.js +0 -162
  280. package/build/src/akuma/request-rendezvous.d.ts +0 -32
  281. package/build/src/akuma/request-rendezvous.js +0 -189
  282. package/build/src/akuma/request-serve.d.ts +0 -16
  283. package/build/src/akuma/request-serve.js +0 -188
  284. package/build/src/akuma/request-wire.d.ts +0 -143
  285. package/build/src/akuma/request-wire.js +0 -146
  286. package/build/src/akuma/requests.d.ts +0 -20
  287. package/build/src/akuma/requests.js +0 -72
  288. package/build/src/akuma/selection-owner-port.d.ts +0 -14
  289. package/build/src/akuma/selection-owner-port.js +0 -54
  290. package/build/src/akuma/selection-request.d.ts +0 -305
  291. package/build/src/akuma/selection-request.js +0 -307
  292. package/build/src/body-requests.d.ts +0 -13
  293. package/build/src/body-requests.js +0 -131
  294. package/build/src/cli/square-identity.d.ts +0 -10
  295. package/build/src/cli/square-identity.js +0 -130
  296. package/build/src/debt/mutation-result.d.ts +0 -981
  297. package/build/src/debt/mutation-result.js +0 -109
  298. package/build/src/debt/mutation.d.ts +0 -424
  299. package/build/src/debt/mutation.js +0 -223
  300. package/build/src/library/contract-operations.d.ts +0 -382
  301. package/build/src/library/contract-operations.js +0 -300
@@ -4,6 +4,8 @@ import { StringDecoder } from "node:string_decoder";
4
4
  import { lstat } from "node:fs/promises";
5
5
  import { resolve } from "node:path";
6
6
  import { acquireSqliteTransactionLock, } from "../coordination/sqlite-transaction-lock.js";
7
+ import { targetName, } from "../core/facts/types.js";
8
+ import { resolveContractTarget, targetRef, targetRepository, targetWorkspaceRefusalSchema, } from "./target.js";
7
9
  import { gitObjectId, gitObjectIdForSnapshot, gitRefLocator, mintSnapshotId } from "./identity.js";
8
10
  import { commonGitDirectory, decodeGitNameOnly, readRef, registeredWorktrees } from "./repository.js";
9
11
  import { consumeGitStdout, GitPlumbingError, executeGit } from "./process.js";
@@ -34,8 +36,15 @@ export const targetCheckoutLagSchema = z
34
36
  diagnostic: z.string().refine((value) => value.trim() !== ""),
35
37
  })
36
38
  .strict();
39
+ export const targetWorkspaceLagSchema = z
40
+ .object({
41
+ kind: z.literal("target-workspace-retained"),
42
+ contractId: contractIdSchema,
43
+ reason: targetWorkspaceRefusalSchema.shape.reason,
44
+ })
45
+ .strict();
37
46
  export async function observeTargetHead(repository, target) {
38
- const value = await readRef(repository, target);
47
+ const value = await readRef(targetRepository(repository, target), targetRef(target));
39
48
  return value === null ? null : mintSnapshotId(value);
40
49
  }
41
50
  function diagnostic(error) {
@@ -58,7 +67,7 @@ export async function observedTreeEqualsCandidate(repository, observed, snapshot
58
67
  return (await commitTree(repository, observed)) === (await commitTree(repository, snapshot));
59
68
  }
60
69
  function checkoutRefusal(contractId, target, path, reason, paths) {
61
- return { kind: "checkout-not-followable", contractId, target: target.target, path, reason, paths };
70
+ return { kind: "checkout-not-followable", contractId, target: targetName(target.target), path, reason, paths };
62
71
  }
63
72
  /** Only immutable commit contents are prepared outside the publication seat. */
64
73
  export async function prepareTargetPlacementChanges(repository, target) {
@@ -225,9 +234,19 @@ export async function observeTargetPlacement(repository, input, changes) {
225
234
  changes ??= await prepareTargetPlacementChanges(repository, target);
226
235
  if (changes.predecessor !== target.expectedOid || changes.candidate !== target.newOid)
227
236
  throw new Error("target changes do not match the observed movement");
228
- const worktrees = (await registeredWorktrees(repository))
229
- .filter((worktree) => worktree.branch === target.target)
230
- .sort((left, right) => left.path.localeCompare(right.path));
237
+ const destination = target.target;
238
+ let worktrees;
239
+ if (typeof destination === "string") {
240
+ worktrees = (await registeredWorktrees(repository))
241
+ .filter((worktree) => worktree.branch === destination)
242
+ .sort((left, right) => left.path.localeCompare(right.path));
243
+ }
244
+ else {
245
+ const resolved = await resolveContractTarget(repository, destination.contractId, destination);
246
+ if (resolved.kind === "refused")
247
+ return resolved;
248
+ worktrees = [{ path: resolved.path }];
249
+ }
231
250
  const arms = [];
232
251
  const checkouts = [];
233
252
  for (const worktree of worktrees) {
@@ -256,19 +275,25 @@ export const previewTargetAnswerSchema = z.union([
256
275
  observed: snapshotIdSchema.nullable(),
257
276
  })
258
277
  .strict(),
259
- z.object({ kind: z.literal("refused"), refusal: checkoutNotFollowableRefusalSchema }).strict(),
278
+ z
279
+ .object({
280
+ kind: z.literal("refused"),
281
+ refusal: z.union([checkoutNotFollowableRefusalSchema, targetWorkspaceRefusalSchema]),
282
+ })
283
+ .strict(),
260
284
  z.object({ kind: z.literal("failed"), diagnostic: z.string().refine((value) => value.trim() !== "") }).strict(),
261
285
  ]);
262
286
  /** Adjudicate prospective target followability without placing or running Verification. */
263
287
  export async function adjudicatePreviewTarget(repository, input) {
264
- const ref = input.coordinates.target;
288
+ const destination = input.coordinates.target;
289
+ const ref = targetName(destination);
265
290
  const expected = input.predecessor;
266
291
  try {
267
- const head = await observeTargetHead(repository, ref);
292
+ const head = await observeTargetHead(repository, destination);
268
293
  if (head !== expected)
269
294
  return { kind: "moved", ref, expected, observed: head };
270
295
  const follow = await observeTargetPlacement(repository, input);
271
- const observed = await observeTargetHead(repository, ref);
296
+ const observed = await observeTargetHead(repository, destination);
272
297
  if (observed !== expected)
273
298
  return { kind: "moved", ref, expected, observed };
274
299
  return follow.kind === "refused"
@@ -305,7 +330,12 @@ export async function followTargetPlacement(repository, prepared, onPhysical) {
305
330
  const beforeEffects = effects.length, beforeLag = lag.length;
306
331
  try {
307
332
  await executeGit(repository, ["-C", arm.path, "read-tree", "-m", "-u", predecessor, candidate]);
308
- effects.push({ kind: "target-checkout", path: arm.path, target: prepared.target.target, action: "followed" });
333
+ effects.push({
334
+ kind: "target-checkout",
335
+ path: arm.path,
336
+ target: targetName(prepared.target.target),
337
+ action: "followed",
338
+ });
309
339
  }
310
340
  catch (error) {
311
341
  if (!(error instanceof GitPlumbingError))
@@ -313,7 +343,7 @@ export async function followTargetPlacement(repository, prepared, onPhysical) {
313
343
  lag.push({
314
344
  kind: "target-checkout-retained",
315
345
  path: arm.path,
316
- target: prepared.target.target,
346
+ target: targetName(prepared.target.target),
317
347
  diagnostic: diagnostic(error),
318
348
  });
319
349
  }
@@ -393,7 +423,18 @@ export async function recoverTargetPlacement(repository, state, onPhysical) {
393
423
  if (state.terminal?.kind !== "claimed" || target === undefined || delivery === null)
394
424
  return { effects: [], lag: [] };
395
425
  const integration = state.currentIntegration;
396
- if (integration === null || (await readRef(repository, target)) !== integration.snapshot)
426
+ if (integration === null)
427
+ return { effects: [], lag: [] };
428
+ const resolved = typeof target === "string" ? undefined : await resolveContractTarget(repository, target.contractId, target);
429
+ if (resolved?.kind === "refused") {
430
+ return {
431
+ effects: [],
432
+ lag: [
433
+ { kind: "target-workspace-retained", contractId: resolved.refusal.contractId, reason: resolved.refusal.reason },
434
+ ],
435
+ };
436
+ }
437
+ if ((await readRef(targetRepository(repository, target), targetRef(target))) !== integration.snapshot)
397
438
  return { effects: [], lag: [] };
398
439
  const movement = {
399
440
  target,
@@ -403,9 +444,17 @@ export async function recoverTargetPlacement(repository, state, onPhysical) {
403
444
  const changes = await prepareTargetPlacementChanges(repository, movement);
404
445
  const candidateTree = await commitTree(repository, integration.snapshot);
405
446
  const predecessorTree = await commitTree(repository, integration.predecessor);
406
- const worktrees = (await registeredWorktrees(repository))
407
- .filter((worktree) => worktree.branch === target)
408
- .sort((left, right) => left.path.localeCompare(right.path));
447
+ let worktrees;
448
+ if (typeof target === "string") {
449
+ worktrees = (await registeredWorktrees(repository))
450
+ .filter((worktree) => worktree.branch === target)
451
+ .sort((left, right) => left.path.localeCompare(right.path));
452
+ }
453
+ else {
454
+ if (resolved === undefined || resolved.kind !== "resolved")
455
+ throw new Error("missing resolved target workspace");
456
+ worktrees = [{ path: resolved.path }];
457
+ }
409
458
  const effects = [];
410
459
  const lag = [];
411
460
  for (const worktree of worktrees) {
@@ -423,18 +472,18 @@ export async function recoverTargetPlacement(repository, state, onPhysical) {
423
472
  candidateTree,
424
473
  });
425
474
  if (recovery.kind === "retained") {
426
- lag.push(recoveryLag(worktree.path, target, recovery.diagnostic));
475
+ lag.push(recoveryLag(worktree.path, targetName(target), recovery.diagnostic));
427
476
  onPhysical?.({ effects: [], lag: lag.slice(beforeLag) });
428
477
  continue;
429
478
  }
430
479
  if (recovery.kind === "recovered") {
431
- effects.push({ kind: "target-checkout", path: worktree.path, target, action: "recovered" });
480
+ effects.push({ kind: "target-checkout", path: worktree.path, target: targetName(target), action: "recovered" });
432
481
  }
433
482
  }
434
483
  catch (error) {
435
484
  if (!(error instanceof GitPlumbingError))
436
485
  throw error;
437
- lag.push(recoveryLag(worktree.path, target, diagnostic(error)));
486
+ lag.push(recoveryLag(worktree.path, targetName(target), diagnostic(error)));
438
487
  }
439
488
  onPhysical?.({ effects: effects.slice(beforeEffects), lag: lag.slice(beforeLag) });
440
489
  }
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ import { type ContractId, type ContractTarget, type SnapshotId } from "../core/facts/types.js";
3
+ import { type GitRepository } from "./process.js";
4
+ export type ContractDestination = Exclude<ContractTarget, string>;
5
+ export declare const targetWorkspaceRefusalSchema: z.ZodObject<{
6
+ kind: z.ZodLiteral<"target-workspace-unavailable">;
7
+ contractId: z.ZodPipe<z.ZodString, z.ZodTransform<ContractId, string>>;
8
+ reason: z.ZodEnum<{
9
+ missing: "missing";
10
+ replaced: "replaced";
11
+ unappointed: "unappointed";
12
+ association: "association";
13
+ attached: "attached";
14
+ uncommitted: "uncommitted";
15
+ operation: "operation";
16
+ }>;
17
+ }, z.core.$strict>;
18
+ export type TargetWorkspaceRefusal = z.infer<typeof targetWorkspaceRefusalSchema>;
19
+ type TargetResolution = Readonly<{
20
+ kind: "resolved";
21
+ target: ContractDestination;
22
+ path: string;
23
+ head: SnapshotId;
24
+ }> | Readonly<{
25
+ kind: "refused";
26
+ refusal: TargetWorkspaceRefusal;
27
+ }>;
28
+ export declare function targetRepository(repository: GitRepository, target: ContractTarget): GitRepository;
29
+ export declare function targetRef(target: ContractTarget): string;
30
+ /** Prove only the existing Place and its linked-worktree incarnation; never create or adopt it. */
31
+ export declare function resolveContractTarget(repository: GitRepository, id: ContractId, expected?: ContractDestination): Promise<TargetResolution>;
32
+ export {};
@@ -0,0 +1,84 @@
1
+ import { createHash } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { readFile, realpath, stat } from "node:fs/promises";
4
+ import { basename, dirname, join, resolve } from "node:path";
5
+ import { contractId } from "../core/facts/types.js";
6
+ import { appointmentFor, readPlaceRegister } from "../workspace-place.js";
7
+ import { contractIdSchema, mintSnapshotId } from "./identity.js";
8
+ import { executeGit, GitPlumbingError } from "./process.js";
9
+ import { commonGitDirectory, currentBranch, registeredWorktrees, worktreeGitDirectory } from "./repository.js";
10
+ import { workspaceMergeStatePresent, worktreePath } from "./workspace.js";
11
+ export const targetWorkspaceRefusalSchema = z
12
+ .object({
13
+ kind: z.literal("target-workspace-unavailable"),
14
+ contractId: contractIdSchema,
15
+ reason: z.enum(["unappointed", "missing", "association", "replaced", "attached", "uncommitted", "operation"]),
16
+ })
17
+ .strict();
18
+ export function targetRepository(repository, target) {
19
+ return typeof target === "string" ? repository : { ...repository, effectiveCwd: repository.primaryWorktree };
20
+ }
21
+ export function targetRef(target) {
22
+ return typeof target === "string" ? target : `worktrees/${target.worktree.id}/HEAD`;
23
+ }
24
+ async function fingerprint(root, admin) {
25
+ const [a, b] = await Promise.all([stat(root, { bigint: true }), stat(admin, { bigint: true })]);
26
+ const identity = [a, b].map((entry) => `${entry.dev}:${entry.ino}:${entry.birthtimeNs}`).join("|");
27
+ return createHash("sha256").update(identity).digest("hex");
28
+ }
29
+ /** Prove only the existing Place and its linked-worktree incarnation; never create or adopt it. */
30
+ export async function resolveContractTarget(repository, id, expected) {
31
+ const refuse = (reason) => ({
32
+ kind: "refused",
33
+ refusal: { kind: "target-workspace-unavailable", contractId: id, reason },
34
+ });
35
+ const place = appointmentFor(await readPlaceRegister(repository), contractId(id));
36
+ if (place === undefined)
37
+ return refuse("unappointed");
38
+ const path = worktreePath(repository, place.place);
39
+ try {
40
+ const root = await realpath(path);
41
+ if (root !== resolve(path))
42
+ return refuse("association");
43
+ const registered = (await registeredWorktrees(repository)).find((worktree) => worktree.path === root);
44
+ if (registered === undefined)
45
+ return refuse("association");
46
+ const admin = await worktreeGitDirectory(repository, root);
47
+ const parent = await realpath(join(commonGitDirectory(repository), "worktrees"));
48
+ if (dirname(admin) !== parent)
49
+ return refuse("association");
50
+ const adminId = basename(admin);
51
+ const reverse = (await readFile(join(admin, "gitdir"), "utf8")).trim();
52
+ if ((await realpath(reverse)) !== (await realpath(join(root, ".git"))))
53
+ return refuse("association");
54
+ const identity = await fingerprint(root, admin);
55
+ if (expected !== undefined && (expected.worktree.id !== adminId || expected.worktree.identity !== identity))
56
+ return refuse("replaced");
57
+ if (registered.branch !== null || (await currentBranch(repository, root)) !== null)
58
+ return refuse("attached");
59
+ if (await workspaceMergeStatePresent(repository, root))
60
+ return refuse("operation");
61
+ let head;
62
+ try {
63
+ head = mintSnapshotId((await executeGit(repository, ["-C", root, "rev-parse", "--verify", "HEAD^{commit}"])).toString("utf8").trim());
64
+ }
65
+ catch (error) {
66
+ if (error instanceof GitPlumbingError && error.status !== null)
67
+ return refuse("uncommitted");
68
+ throw error;
69
+ }
70
+ return {
71
+ kind: "resolved",
72
+ target: { kind: "contract", contractId: id, worktree: { id: adminId, identity } },
73
+ path: root,
74
+ head,
75
+ };
76
+ }
77
+ catch (error) {
78
+ if (error.code === "ENOENT")
79
+ return refuse("missing");
80
+ if (error instanceof GitPlumbingError && error.status !== null)
81
+ return refuse("association");
82
+ throw error;
83
+ }
84
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ContractState, SnapshotId } from "../core/facts/types.js";
2
- import type { GitDecodeChannel } from "./read-observation.js";
2
+ import { type GitDecodeChannel } from "./read-observation.js";
3
3
  import { type WorktreeHooks } from "./hooks.js";
4
4
  import { type GitRepository } from "./process.js";
5
5
  import type { Effect, ReconcileAccumulation, ReconcileResult, WorktreeTopology } from "./reconcile.js";
@@ -1,6 +1,9 @@
1
1
  import { lstat } from "node:fs/promises";
2
- import { isKeiyakuOwnedRef, readRef, writeCommit } from "./repository.js";
3
- import { gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
2
+ import { CANDIDATE_PIN_REF_NAMESPACE, isKeiyakuOwnedRef, readRef, writeCommit } from "./repository.js";
3
+ import { contractPhysicalName, gitObjectIdForSnapshot, mintSnapshotId } from "./identity.js";
4
+ import { withGitReadObservation } from "./read-observation.js";
5
+ import { observeContractWorld } from "./observe.js";
6
+ import { resolveContractTarget } from "./target.js";
4
7
  import { runDestroyHooks } from "./hooks.js";
5
8
  import { terminalSealExpectations as decodeTerminalSealExpectations, terminalSealSnapshots, observeTerminalWorkspace, } from "./terminal-seal.js";
6
9
  import { GitPlumbingError, executeGit } from "./process.js";
@@ -117,6 +120,25 @@ async function snapshotCustodian(repository, snapshot) {
117
120
  }
118
121
  return null;
119
122
  }
123
+ async function hasIncomingLanding(repository, channel, state, head) {
124
+ const world = await withGitReadObservation(repository, channel, async (read) => await observeContractWorld(read));
125
+ for (const { state: child } of world.contracts.values()) {
126
+ const target = child?.coordinates.target;
127
+ const integration = child?.currentIntegration?.snapshot;
128
+ if (child?.terminal?.kind !== "claimed" ||
129
+ typeof target !== "object" ||
130
+ target.contractId !== state.id ||
131
+ !integration)
132
+ continue;
133
+ const pin = `${CANDIDATE_PIN_REF_NAMESPACE}/${contractPhysicalName(child.id)}`;
134
+ if ((await readRef(repository, pin)) !== integration || !(await commitIsAncestor(repository, integration, head)))
135
+ continue;
136
+ const resolved = await resolveContractTarget(repository, state.id, target);
137
+ if (resolved.kind === "resolved" || ["attached", "operation", "uncommitted"].includes(resolved.refusal.reason))
138
+ return true;
139
+ }
140
+ return false;
141
+ }
120
142
  function fromPrimaryWorktree(repository) {
121
143
  return { ...repository, effectiveCwd: repository.primaryWorktree };
122
144
  }
@@ -133,7 +155,12 @@ async function terminalSealExpectations(channel, state) {
133
155
  const objects = await channel.readObjects(snapshots.map(gitObjectIdForSnapshot));
134
156
  return decodeTerminalSealExpectations(state, objects);
135
157
  }
136
- async function removeSealedTerminalWorktree({ repository, topology, path, state, expected, hooks, acc, }) {
158
+ async function mustRetainUnsealed(repository, channel, state, canRecover, workspace) {
159
+ return (!canRecover ||
160
+ workspace.submodules.length > 0 ||
161
+ (await hasIncomingLanding(repository, channel, state, workspace.head)));
162
+ }
163
+ async function removeSealedTerminalWorktree({ repository, channel, topology, path, state, expected, hooks, acc, }) {
137
164
  if (topology.paths.has(path) && (await pathExists(path))) {
138
165
  const terminal = state.terminal;
139
166
  if (terminal === null)
@@ -162,7 +189,7 @@ async function removeSealedTerminalWorktree({ repository, topology, path, state,
162
189
  const beforeWorkspace = before.workspace;
163
190
  const beforeHooks = before.unsealed;
164
191
  if (beforeHooks !== null) {
165
- if (!canRecover || beforeWorkspace.submodules.length > 0) {
192
+ if (await mustRetainUnsealed(repository, channel, state, canRecover, beforeWorkspace)) {
166
193
  return retainTerminalWorktree(path, beforeHooks, acc);
167
194
  }
168
195
  recovery = await recordRecovery(beforeWorkspace);
@@ -175,7 +202,7 @@ async function removeSealedTerminalWorktree({ repository, topology, path, state,
175
202
  const afterWorkspace = after.workspace;
176
203
  const afterHooks = after.unsealed;
177
204
  if (afterHooks !== null) {
178
- if (!canRecover || afterWorkspace.submodules.length > 0) {
205
+ if (await mustRetainUnsealed(repository, channel, state, canRecover, afterWorkspace)) {
179
206
  return retainTerminalWorktree(path, afterHooks, acc);
180
207
  }
181
208
  }
@@ -199,7 +226,7 @@ async function removeSealedTerminalWorktree({ repository, topology, path, state,
199
226
  return null;
200
227
  }
201
228
  async function targetCustodyForClaimedIntegration(repository, state, integration) {
202
- if (state.terminal?.kind !== "claimed" || state.coordinates.target === undefined)
229
+ if (state.terminal?.kind !== "claimed" || typeof state.coordinates.target !== "string")
203
230
  return null;
204
231
  const target = await readRef(repository, state.coordinates.target);
205
232
  if (target === null)
@@ -282,6 +309,7 @@ export async function reconcileTerminalManagedWorktree({ repository, channel, ho
282
309
  }
283
310
  const retained = await removeSealedTerminalWorktree({
284
311
  repository: primary,
312
+ channel,
285
313
  topology,
286
314
  path,
287
315
  state,
@@ -47,27 +47,29 @@ export { actorId } from "./core/facts/types.js";
47
47
  * configuration helpers stay off this entry; only CLI and Body import them.
48
48
  */
49
49
  export { z } from "zod";
50
- export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
51
- export type { AkumaCaller, AkumaOrigin, ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaHostOptions, AkumaIdleOptions, AkumaIdleResult, AkumaReportOptions, AkumaReportResult, AkumaSignalOptions, AkumaStatus, AkumaStreamSnapshot, AkumaTellOptions, AkumaTellResult, AllowedAction, AllowedActions, ArchetypeCatalog, ArchetypeCatalogInput, ArchetypeCatalogRow, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
52
- export type { ActorId, ChangeId, ContractHead, ContractId, ContractState, JournalEntry as Fact, FactKind, SnapshotId, } from "./core/facts/types.js";
50
+ export { Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
51
+ export type { AkumaCaller, AkumaOrigin, ActivityHistory, ActivityRow, AkuId, AkumaAskObservation, AkumaAskOptions, AkumaAskResult, AkumaBirthInput, AkumaHistoryOptions, AkumaHostOptions, AkumaIdleOptions, AkumaIdleResult, AkumaReportOptions, AkumaReportResult, AkumaSignalOptions, AkumaStatus, AkumaStreamSnapshot, AkumaTellOptions, AkumaTellResult, ArchetypeCatalog, ArchetypeCatalogInput, ArchetypeCatalogRow, InterruptReceipt, JsonSchema, JsonSchemaDocument, KillEvidence, SchemaLike, StandardSchemaV1, } from "./akuma/index.js";
52
+ export type { ActorId, ChangeId, ContractHead, ContractId, ContractState, ContractTarget, JournalEntry as Fact, FactKind, SnapshotId, } from "./core/facts/types.js";
53
53
  export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
54
54
  export type { AkumaKanshiRow, AkumaKanshiWorld, ContractEndpointObservation, ContractHolderObservation, ContractKanshiBoard, ContractKanshiRow, KanshiCategoryInput, KanshiCategoryReport, KanshiInput, KanshiRegionSelection, KanshiReport, KanshiSelection, RegionDeclaration, RegionRead, Section, DebtKanshiRow, DebtKanshiWorld, } from "./kanshi/index.js";
55
55
  export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
56
56
  export type { AkumaAddressInput, AkumaAskInput, AkumaHistoryInput, AkumaHistoryResult, AkumaKillInput, AkumaKillResult, AkumaList, AkumaListInput, AkumaObservation, AkumaObservationStage, AkumaTellInput, AkumaWaitInput, AkumaWaitResult, AkumaWorldScopeRefusal, CallInput, CallResult, CallWaitHead, CreatedDebtObservation, DispatchAssociation, DispatchStage, ForkInput, ForkResult, TellResult, TellWake, } from "./library/akumas.js";
57
57
  export type { ContinuationReport } from "./library/continuation.js";
58
+ export type { ContractWaitInput, ContractWaitOptions, ContractWaitMember, ContractWaitResult, } from "./library/contract-wait.js";
58
59
  export type { KeiyakuLibrary, ReconcileInput } from "./library/contract-composition.js";
59
- export type { AbandonOutcome, AmendOutcome, ArcOutcome, DeliveryPreviewInput, DeliveryPreviewOutcome, BindOutcome, BindResult, DeliverOutcome, ReviewOutcome, } from "./library/contract-outcomes.js";
60
- export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, ContractResolveInput, ContractResolution, ContractSelectorRefusal, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, } from "./library/contract-types.js";
60
+ export type { AbandonOutcome, AmendOutcome, ArcOutcome, DeliveryPreviewInput, DeliveryPreviewOutcome, BindOutcome, BindResult, DeliverOutcome, ReviewOutcome, VerifyOutcome, } from "./library/contract-outcomes.js";
61
+ export type { AbandonInput, AmendInput, ArcInput, BindInput, ContractHistory, ContractHistoryEvent, ContractList, ContractListInput, ContractObservationInput, ContractResolveInput, ContractResolution, ContractSelectorRefusal, DeliverInput, KeiyakuSelectInput, LocalContractComposition, ReviewInput, VerifyInput, } from "./library/contract-types.js";
61
62
  export { nukeKeiyaku as nuke } from "./library/nuke.js";
62
63
  export type { NukeInput, NukeResult } from "./library/nuke.js";
63
- export type { InvocationEffect, KeiyakuErrorCategory, PartialOutcomeEnvelope, PendingSurface, ReconciliationLag, Review, } from "./library/outcome.js";
64
+ export type { InvocationEffect, KeiyakuErrorCategory, PartialOutcomeEnvelope, PendingSurface, ReconciliationLag, Review, Verify, } from "./library/outcome.js";
64
65
  export type { ReconcileCompletion, RepoContractReconcileReport, RepoReconcileReport } from "./library/reconcile.js";
65
66
  export type { KeiyakuRefusal, KeiyakuRetryReason, NukeConfirmationRefusal, NukeConfirmationRequiredRefusal, OperationRetries, } from "./library/refusal.js";
66
67
  export type { RegionOverlap } from "./library/region.js";
67
68
  export type { RepoAtInput } from "./library/repo.js";
68
69
  export type { KeiyakuPlugin, PluginAkumaCaller, PluginAkumaOrigin, PluginBodyEnd, PluginContext, PluginHooks, PluginInstance, PluginManifest, PluginOutcome, PluginWaitDeferral, PluginWaitDeferralInput, PluginSignal, PluginSignalMap, } from "./plugin/public.js";
70
+ export type { VerifyValue, VerificationCheck } from "./protocol/verify.js";
69
71
  export type { DeliveryPreviewReport } from "./protocol/delivery-preview.js";
70
- export type { IntegrationConflictMaterialized, VerificationReuse } from "./protocol/deliver.js";
72
+ export type { IntegrationConflictMaterialized } from "./protocol/deliver.js";
71
73
  export type { ExecutionObservation, ExecutionObserver } from "./protocol/execution-observation.js";
72
74
  export type { PlacementStop, VerificationStop } from "./protocol/operations.js";
73
75
  export type { ExecutionCleanup, ExecutionStop } from "./protocol/progress.js";
@@ -46,7 +46,7 @@ export { actorId } from "./core/facts/types.js";
46
46
  * configuration helpers stay off this entry; only CLI and Body import them.
47
47
  */
48
48
  export { z } from "zod";
49
- export { ALLOWED_ACTIONS, Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
49
+ export { Akuma, AkumaArchetypeError, AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError, Schema, listArchetypeDefinitions, } from "./akuma/index.js";
50
50
  export { kanshi, kanshiCategory, observeKanshi, selectKanshi, selectRegion } from "./kanshi/index.js";
51
51
  export { AkumaAddressError, AkumaWorldScopeError, Akumas } from "./library/akumas.js";
52
52
  export { nukeKeiyaku as nuke } from "./library/nuke.js";
@@ -70,27 +70,8 @@ type AddressedAkuma = Readonly<{
70
70
  path: WorldRoot;
71
71
  id: AkuId;
72
72
  }>;
73
- /**
74
- * Resolves one selector to a complete identity without proving it born. The
75
- * caller is a forwarding boundary: the parent Selection answers for the target, so
76
- * this process must not read its own Heart files to decide.
77
- */
78
- export declare function resolveAkuma(input: UncheckedAkumaAddressInput): Promise<AddressedAkuma>;
79
- /**
80
- * Resolves one selector against this World, where a local caller is answered
81
- * for the target's birth by the one addressability normalization.
82
- */
73
+ /** Resolve one selector and prove its birth through the native addressability owner. */
83
74
  export declare function addressAkuma(input: UncheckedAkumaAddressInput): Promise<AddressedAkuma>;
84
- /**
85
- * Resolves a selector set to complete identities without proving any born. The
86
- * caller is a forwarding boundary, the parent Selection owns the answer, and no
87
- * member's Heart is read here.
88
- */
89
- export declare function resolveAkumaSet(input: UncheckedAkumaAddressInput): Promise<Readonly<{
90
- path: WorldRoot;
91
- ids: readonly AkuId[];
92
- orderedIds: readonly AkuId[];
93
- }>>;
94
75
  export declare function addressAkumaSet(input: UncheckedAkumaAddressInput): Promise<Readonly<{
95
76
  path: WorldRoot;
96
77
  ids: readonly AkuId[];
@@ -113,12 +113,8 @@ export function resolveNamedAddress(input) {
113
113
  throw new TypeError("cannot resolve a named selector while Alias authority is failed");
114
114
  throw new AkumaAddressError({ kind: "akuma-alias-not-found", alias });
115
115
  }
116
- /**
117
- * Resolves one selector to a complete identity without proving it born. The
118
- * caller is a forwarding boundary: the parent Selection answers for the target, so
119
- * this process must not read its own Heart files to decide.
120
- */
121
- export async function resolveAkuma(input) {
116
+ /** Resolve one selector and prove its birth through the native addressability owner. */
117
+ export async function addressAkuma(input) {
122
118
  const values = requireInput(input, "Akuma address input");
123
119
  for (const key of Object.keys(values)) {
124
120
  if (!["path", "akuma", "repo"].includes(key)) {
@@ -129,17 +125,9 @@ export async function resolveAkuma(input) {
129
125
  scopeForRepo(values.repo);
130
126
  const path = await World.prove(nonblank(values.path, "path"));
131
127
  const id = await directId(path, nonblank(values.akuma, "akuma"));
128
+ await requireBornAkuma(path, id);
132
129
  return { path, id };
133
130
  }
134
- /**
135
- * Resolves one selector against this World, where a local caller is answered
136
- * for the target's birth by the one addressability normalization.
137
- */
138
- export async function addressAkuma(input) {
139
- const addressed = await resolveAkuma(input);
140
- await requireBornAkuma(addressed.path, addressed.id);
141
- return addressed;
142
- }
143
131
  function parseSetSelector(raw) {
144
132
  const selector = nonblank(raw, "akuma selector");
145
133
  if (selector.startsWith("kei/"))
@@ -231,15 +219,6 @@ async function readAkumaSet(input) {
231
219
  addSelectorIds(selector, sources, selected, contractMembers, explicit);
232
220
  return { path, orderedIds: [...selected], ids: canonicalAkumaOrder(selected), contractMembers, explicit };
233
221
  }
234
- /**
235
- * Resolves a selector set to complete identities without proving any born. The
236
- * caller is a forwarding boundary, the parent Selection owns the answer, and no
237
- * member's Heart is read here.
238
- */
239
- export async function resolveAkumaSet(input) {
240
- const resolved = await readAkumaSet(input);
241
- return { path: resolved.path, ids: resolved.ids, orderedIds: resolved.orderedIds };
242
- }
243
222
  export async function addressAkumaSet(input) {
244
223
  const resolved = await readAkumaSet(input);
245
224
  for (const id of resolved.explicit)
@@ -3,10 +3,8 @@ import { type ForkReceipt } from "../akuma/akuma-owner.js";
3
3
  import type { BodyLauncher } from "../akuma/body-launch.js";
4
4
  import { type AskObserver } from "../akuma/akuma-selection-execution.js";
5
5
  import type { AkumaStatus } from "../akuma/akuma.js";
6
- import type { AllowedAction } from "../akuma/allowed.js";
7
6
  import type { TellResult } from "../akuma/body.js";
8
7
  import { type AkuId } from "../akuma/identity.js";
9
- import type { ExecutionContext } from "../akuma/requests.js";
10
8
  import { type Schema } from "../akuma/schema.js";
11
9
  import type { AkumaAskResult } from "../akuma/selection-observation.js";
12
10
  import { type AliasBinding } from "../alias/index.js";
@@ -62,7 +60,6 @@ export type CallInput = Readonly<{
62
60
  settings?: Settings;
63
61
  contract?: Keiyaku;
64
62
  alias?: AkumaAlias;
65
- allowed?: readonly AllowedAction[];
66
63
  writableDirectories?: readonly string[];
67
64
  bare?: boolean;
68
65
  schema?: Schema<unknown>;
@@ -92,7 +89,7 @@ export type CallResult = Readonly<{
92
89
  akuma: AkuId;
93
90
  execution: Readonly<{
94
91
  cwd: string;
95
- source: "input" | "caller" | "process" | "world";
92
+ source: "input" | "process" | "world";
96
93
  }>;
97
94
  dispatch: DispatchStage;
98
95
  alias: AliasStage;
@@ -120,7 +117,7 @@ export type ForkResult = Readonly<{
120
117
  }>);
121
118
  export declare function callAkumas(input: CallInput & Readonly<{
122
119
  path: WorldRoot;
123
- }>, execution: ExecutionContext, spawn: BodyLauncher, reportDiagnostic?: (message: string) => void): Promise<CallResult>;
120
+ }>, spawn: BodyLauncher, reportDiagnostic?: (message: string) => void): Promise<CallResult>;
124
121
  export declare function forkAkumas(input: ForkInput & Readonly<{
125
122
  path: WorldRoot;
126
123
  }>, spawn: BodyLauncher): Promise<ForkResult>;