@astrosheep/keiyaku 4.6.8 → 4.6.9

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 (253) hide show
  1. package/README.md +40 -14
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
  18. package/build/plugins/opencode/index.js +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
  26. package/build/skills/keiyaku/SKILL.md +5 -6
  27. package/build/skills/keiyaku-akuma/SKILL.md +1 -1
  28. package/build/skills/keiyaku-akuma/references/automation.md +8 -8
  29. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  30. package/build/skills/keiyaku-bind/SKILL.md +9 -9
  31. package/build/skills/keiyaku-debt/SKILL.md +91 -0
  32. package/build/skills/keiyaku-workflow/SKILL.md +2 -2
  33. package/build/src/akuma/akuma-instance.d.ts +2 -0
  34. package/build/src/akuma/akuma-instance.js +10 -0
  35. package/build/src/akuma/akuma-observe.d.ts +33 -8
  36. package/build/src/akuma/akuma-observe.js +88 -64
  37. package/build/src/akuma/akuma-owner.d.ts +11 -2
  38. package/build/src/akuma/akuma-owner.js +45 -35
  39. package/build/src/akuma/akuma-selection-execution.js +9 -1
  40. package/build/src/akuma/akuma-stream.d.ts +22 -0
  41. package/build/src/akuma/akuma-stream.js +116 -0
  42. package/build/src/akuma/akuma-wait.d.ts +1 -40
  43. package/build/src/akuma/akuma-wait.js +23 -84
  44. package/build/src/akuma/akuma.d.ts +17 -11
  45. package/build/src/akuma/akuma.js +2 -0
  46. package/build/src/akuma/allowed.d.ts +7 -12
  47. package/build/src/akuma/allowed.js +13 -4
  48. package/build/src/akuma/body-supervisor.d.ts +5 -5
  49. package/build/src/akuma/body-supervisor.js +22 -20
  50. package/build/src/akuma/body.js +28 -1
  51. package/build/src/akuma/call-request.d.ts +12 -22
  52. package/build/src/akuma/heart/activity-schema.d.ts +12 -0
  53. package/build/src/akuma/heart/activity-schema.js +6 -0
  54. package/build/src/akuma/heart/index.d.ts +59 -2
  55. package/build/src/akuma/heart/index.js +87 -8
  56. package/build/src/akuma/heart/rows.js +5 -3
  57. package/build/src/akuma/heart/soul.d.ts +9 -0
  58. package/build/src/akuma/heart/soul.js +29 -0
  59. package/build/src/akuma/heart/storage.d.ts +15 -0
  60. package/build/src/akuma/heart/storage.js +55 -0
  61. package/build/src/akuma/heart/timeline.d.ts +7 -0
  62. package/build/src/akuma/heart/timeline.js +10 -0
  63. package/build/src/akuma/index.d.ts +1 -0
  64. package/build/src/akuma/projection.d.ts +25 -0
  65. package/build/src/akuma/projection.js +24 -7
  66. package/build/src/akuma/provider-recipe.d.ts +11 -0
  67. package/build/src/akuma/provider-recipe.js +23 -0
  68. package/build/src/akuma/provider.d.ts +25 -0
  69. package/build/src/akuma/provider.js +99 -7
  70. package/build/src/akuma/providers/acp/events.js +25 -2
  71. package/build/src/akuma/providers/claude/events.js +76 -10
  72. package/build/src/akuma/providers/claude/index.js +2 -5
  73. package/build/src/akuma/providers/codex-app-server/events.js +17 -2
  74. package/build/src/akuma/providers/codex-app-server/index.js +15 -9
  75. package/build/src/akuma/providers/decode.d.ts +8 -0
  76. package/build/src/akuma/providers/decode.js +21 -0
  77. package/build/src/akuma/providers/grok-build/index.js +10 -26
  78. package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
  79. package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
  80. package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
  81. package/build/src/akuma/providers/opencode-sdk/events.js +147 -284
  82. package/build/src/akuma/providers/opencode-sdk/index.js +267 -421
  83. package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
  84. package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
  85. package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
  86. package/build/src/akuma/providers/opencode-sdk/session.js +75 -82
  87. package/build/src/akuma/providers/paseo/events.d.ts +8 -0
  88. package/build/src/akuma/providers/paseo/events.js +58 -11
  89. package/build/src/akuma/providers/paseo/index.js +11 -7
  90. package/build/src/akuma/providers/pi/events.d.ts +2 -0
  91. package/build/src/akuma/providers/pi/events.js +32 -24
  92. package/build/src/akuma/providers/pi/index.js +21 -35
  93. package/build/src/akuma/request-lifecycle.d.ts +1 -2
  94. package/build/src/akuma/request-lifecycle.js +2 -8
  95. package/build/src/akuma/request-rendezvous.js +38 -55
  96. package/build/src/akuma/request-serve.d.ts +1 -1
  97. package/build/src/akuma/request-serve.js +77 -113
  98. package/build/src/akuma/selection-observation.d.ts +57 -51
  99. package/build/src/akuma/selection-observation.js +3 -3
  100. package/build/src/akuma/turn-drive.d.ts +3 -0
  101. package/build/src/akuma/turn-drive.js +26 -5
  102. package/build/src/akuma-body.js +12 -22
  103. package/build/src/cli/akuma-caller.js +10 -0
  104. package/build/src/cli/commands/akuma-grammar.js +3 -4
  105. package/build/src/cli/commands/akuma.js +13 -51
  106. package/build/src/cli/commands/contract-grammar.d.ts +7 -6
  107. package/build/src/cli/commands/contract-grammar.js +27 -32
  108. package/build/src/cli/commands/contract-help.d.ts +16 -7
  109. package/build/src/cli/commands/contract-help.js +20 -11
  110. package/build/src/cli/commands/contract.js +11 -11
  111. package/build/src/cli/commands/debt-grammar.d.ts +19 -0
  112. package/build/src/cli/commands/debt-grammar.js +323 -0
  113. package/build/src/cli/commands/debt-query.d.ts +5 -0
  114. package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
  115. package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
  116. package/build/src/cli/commands/{task.js → debt.js} +83 -143
  117. package/build/src/cli/coordinates.d.ts +1 -1
  118. package/build/src/cli/coordinates.js +1 -1
  119. package/build/src/cli/parse.d.ts +4 -4
  120. package/build/src/cli/parse.js +17 -16
  121. package/build/src/cli/render/akuma-activity.d.ts +11 -83
  122. package/build/src/cli/render/akuma-activity.js +20 -382
  123. package/build/src/cli/render/catalog.d.ts +2 -2
  124. package/build/src/cli/render/catalog.js +5 -5
  125. package/build/src/cli/render/contract.js +2 -2
  126. package/build/src/cli/render/debt.d.ts +28 -0
  127. package/build/src/cli/render/{task.js → debt.js} +51 -112
  128. package/build/src/cli/render/kanshi.js +28 -28
  129. package/build/src/cli/render/marks.d.ts +5 -5
  130. package/build/src/cli/render/marks.js +4 -10
  131. package/build/src/cli/render/nuke.js +1 -1
  132. package/build/src/cli/runtime.js +3 -3
  133. package/build/src/cli/scan.d.ts +1 -1
  134. package/build/src/cli/usage.d.ts +1 -1
  135. package/build/src/cli/usage.js +4 -4
  136. package/build/src/contract-worktree.js +3 -3
  137. package/build/src/debt/board.d.ts +160 -0
  138. package/build/src/{task → debt}/board.js +89 -89
  139. package/build/src/debt/catalog.d.ts +11 -0
  140. package/build/src/debt/catalog.js +59 -0
  141. package/build/src/{task → debt}/context.d.ts +1 -1
  142. package/build/src/{task → debt}/context.js +1 -1
  143. package/build/src/{task → debt}/created-observation.d.ts +6 -10
  144. package/build/src/{task → debt}/created-observation.js +7 -7
  145. package/build/src/debt/document.d.ts +37 -0
  146. package/build/src/{task → debt}/document.js +37 -37
  147. package/build/src/debt/identity.d.ts +21 -0
  148. package/build/src/{task → debt}/identity.js +35 -35
  149. package/build/src/debt/index.d.ts +111 -0
  150. package/build/src/debt/index.js +203 -0
  151. package/build/src/{task → debt}/input.d.ts +8 -8
  152. package/build/src/{task → debt}/input.js +21 -21
  153. package/build/src/debt/lifecycle-operations.d.ts +6 -0
  154. package/build/src/{task → debt}/lifecycle-operations.js +27 -31
  155. package/build/src/debt/mutation-result.d.ts +981 -0
  156. package/build/src/debt/mutation-result.js +109 -0
  157. package/build/src/debt/mutation.d.ts +424 -0
  158. package/build/src/debt/mutation.js +223 -0
  159. package/build/src/debt/operation-types.d.ts +71 -0
  160. package/build/src/debt/operations.d.ts +28 -0
  161. package/build/src/{task → debt}/operations.js +59 -60
  162. package/build/src/debt/query.d.ts +76 -0
  163. package/build/src/{task → debt}/query.js +55 -55
  164. package/build/src/{task → debt}/store.d.ts +13 -13
  165. package/build/src/{task → debt}/store.js +58 -49
  166. package/build/src/debt/view.d.ts +4 -0
  167. package/build/src/debt/view.js +7 -0
  168. package/build/src/identity/coordinates.d.ts +1 -1
  169. package/build/src/index.d.ts +13 -13
  170. package/build/src/index.js +9 -9
  171. package/build/src/kanshi/index.d.ts +1 -1
  172. package/build/src/kanshi/read.js +33 -33
  173. package/build/src/kanshi/report.d.ts +7 -7
  174. package/build/src/kanshi/select.js +4 -4
  175. package/build/src/library/akumas.d.ts +2 -3
  176. package/build/src/library/bind.d.ts +3 -3
  177. package/build/src/library/bind.js +5 -5
  178. package/build/src/library/contract-creation.js +5 -5
  179. package/build/src/library/contract-execution.js +4 -4
  180. package/build/src/library/contract-types.d.ts +2 -2
  181. package/build/src/library/input.d.ts +2 -2
  182. package/build/src/library/input.js +5 -5
  183. package/build/src/library/invocation.js +2 -2
  184. package/build/src/library/nuke.js +3 -3
  185. package/build/src/library/outcome.d.ts +126 -126
  186. package/build/src/library/outcome.js +3 -3
  187. package/build/src/library/selection.d.ts +1 -4
  188. package/build/src/library/selection.js +11 -62
  189. package/build/src/plugin/public.d.ts +5 -0
  190. package/build/src/plugin/runtime.js +3 -1
  191. package/build/src/runtime/proc/windows-launch.exe +0 -0
  192. package/build/src/settlement/fence.d.ts +3 -3
  193. package/build/src/settlement/fence.js +4 -4
  194. package/build/src/settlement/holder.d.ts +16 -16
  195. package/build/src/settlement/holder.js +69 -63
  196. package/build/src/settlement/settle.d.ts +5 -5
  197. package/build/src/settlement/settle.js +53 -53
  198. package/package.json +12 -6
  199. package/plugins/paseo/plugin/index.server.ts +17 -0
  200. package/plugins/paseo/plugin/paseo-plugin.json +4 -0
  201. package/plugins/paseo/plugin/server/attach.ts +52 -0
  202. package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
  203. package/plugins/paseo/plugin/server/message.ts +60 -0
  204. package/plugins/paseo/plugin/server/mirror.ts +193 -0
  205. package/plugins/paseo/plugin/server/model.ts +14 -0
  206. package/plugins/paseo/plugin/server/provider.ts +276 -0
  207. package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
  208. package/plugins/paseo/plugin/server/sdk.ts +289 -0
  209. package/plugins/paseo/plugin/server/stop.ts +26 -0
  210. package/plugins/paseo/plugin/server/transport.ts +35 -0
  211. package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
  212. package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
  213. package/plugins/paseo/plugin/tsconfig.json +6 -0
  214. package/skills/keiyaku/SKILL.md +5 -6
  215. package/skills/keiyaku-akuma/SKILL.md +1 -1
  216. package/skills/keiyaku-akuma/references/automation.md +8 -8
  217. package/skills/keiyaku-babysit/SKILL.md +1 -1
  218. package/skills/keiyaku-bind/SKILL.md +9 -9
  219. package/skills/keiyaku-debt/SKILL.md +91 -0
  220. package/skills/keiyaku-workflow/SKILL.md +2 -2
  221. package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
  222. package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
  223. package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
  224. package/build/skills/keiyaku-task/SKILL.md +0 -104
  225. package/build/src/cli/commands/task-grammar.d.ts +0 -19
  226. package/build/src/cli/commands/task-grammar.js +0 -384
  227. package/build/src/cli/commands/task-query.d.ts +0 -5
  228. package/build/src/cli/render/task.d.ts +0 -39
  229. package/build/src/task/board.d.ts +0 -168
  230. package/build/src/task/catalog.d.ts +0 -11
  231. package/build/src/task/catalog.js +0 -59
  232. package/build/src/task/compose-language.d.ts +0 -57
  233. package/build/src/task/compose-language.js +0 -364
  234. package/build/src/task/compose-parser.d.ts +0 -32
  235. package/build/src/task/compose-parser.js +0 -180
  236. package/build/src/task/compose.d.ts +0 -16
  237. package/build/src/task/compose.js +0 -189
  238. package/build/src/task/document.d.ts +0 -39
  239. package/build/src/task/identity.d.ts +0 -21
  240. package/build/src/task/index.d.ts +0 -138
  241. package/build/src/task/index.js +0 -269
  242. package/build/src/task/lifecycle-operations.d.ts +0 -6
  243. package/build/src/task/mutation-result.d.ts +0 -1726
  244. package/build/src/task/mutation-result.js +0 -198
  245. package/build/src/task/mutation.d.ts +0 -590
  246. package/build/src/task/mutation.js +0 -262
  247. package/build/src/task/operation-types.d.ts +0 -71
  248. package/build/src/task/operations.d.ts +0 -28
  249. package/build/src/task/query.d.ts +0 -76
  250. package/build/src/task/view.d.ts +0 -4
  251. package/build/src/task/view.js +0 -7
  252. package/skills/keiyaku-task/SKILL.md +0 -104
  253. /package/build/src/{task → debt}/operation-types.js +0 -0
@@ -1,189 +0,0 @@
1
- import { documentDiff } from "../markdown/diff.js";
2
- import { planTaskComposition, } from "./compose-language.js";
3
- import { serializeTaskDocument } from "./document.js";
4
- import { parseTaskId, taskAuthorityPath } from "./identity.js";
5
- import { readBoard, replaceAuthority, withTaskLocks } from "./store.js";
6
- function refusal(diagnostics) {
7
- return { kind: "refused", refusal: { kind: "invalid-composition", diagnostics } };
8
- }
9
- function currentTimestamp() {
10
- return new Date().toISOString();
11
- }
12
- function facts(plan) {
13
- return { aliases: plan.aliases, admissionOrder: plan.admissionOrder, admissions: plannedResult(plan).admissions };
14
- }
15
- function reference(id, remainingAliases) {
16
- const alias = remainingAliases.get(id);
17
- return alias === undefined ? `@${id}` : `^${alias}`;
18
- }
19
- function bodyToken(body) {
20
- const lines = new Set(body.split(/\r\n|\n|\r/u));
21
- for (let suffix = 0; Number.isSafeInteger(suffix); suffix += 1) {
22
- const token = suffix === 0 ? "END_BODY" : `END_BODY_${suffix}`;
23
- if (token.length > 32)
24
- break;
25
- if (!lines.has(token))
26
- return token;
27
- }
28
- throw new Error("compose recovery body token space exhausted");
29
- }
30
- function taskDraft(task, remainingAliases) {
31
- const document = task.after;
32
- const lines = [task.kind === "new" ? `+ ${document.title}` : `@${document.id}`];
33
- if (task.kind === "new" && task.alias !== undefined)
34
- lines.push(`as = ${task.alias}`);
35
- if (task.kind === "new")
36
- lines.push(`state = ${document.state}`);
37
- lines.push(`pri = ${document.priority}`, `needs = ${document.needs.map((id) => reference(id, remainingAliases)).join(", ")}`, `parent = ${document.parent === null ? "" : reference(document.parent, remainingAliases)}`, `supersedes = ${document.supersedes.map((id) => reference(id, remainingAliases)).join(", ")}`, `relates = ${document.relates.map((id) => reference(id, remainingAliases)).join(", ")}`);
38
- if (document.body === "")
39
- lines.push("body =");
40
- else {
41
- const token = bodyToken(document.body);
42
- lines.push(`body <<${token}`, document.body, token);
43
- }
44
- return lines;
45
- }
46
- function recoveryDraft(namespace, remaining) {
47
- const aliases = new Map();
48
- for (const task of remaining) {
49
- if (task.kind === "new" && task.alias !== undefined)
50
- aliases.set(task.after.id, task.alias);
51
- }
52
- const lines = [`ns=${namespace.length === 0 ? "/" : namespace.join("/")}`];
53
- for (const task of remaining)
54
- lines.push("", ...taskDraft(task, aliases));
55
- return `${lines.join("\n")}\n`;
56
- }
57
- function plannedResult(plan) {
58
- const positions = new Map(plan.tasks.map((task) => [task.after.id, task.index + 1]));
59
- return {
60
- kind: "planned",
61
- aliases: plan.aliases.map(({ alias, taskId }) => ({ alias, position: positions.get(taskId) })),
62
- admissionOrder: plan.tasks.map((task) => ({
63
- position: task.index + 1,
64
- ...(task.kind === "existing" ? { taskId: task.after.id } : {}),
65
- ...(task.alias === undefined ? {} : { alias: task.alias }),
66
- })),
67
- admissions: plan.admissions.map((admission) => admission.kind === "new"
68
- ? {
69
- position: admission.position,
70
- kind: "new",
71
- ...(admission.alias === undefined ? {} : { alias: admission.alias }),
72
- title: admission.title,
73
- }
74
- : { position: admission.position, kind: "existing", taskId: admission.taskId, title: admission.title }),
75
- bodies: plan.bodies,
76
- };
77
- }
78
- function physicalPlanDiagnostics(plan) {
79
- try {
80
- taskAuthorityPath("", { namespace: plan.namespace, localId: "placeholder" });
81
- for (const task of plan.tasks)
82
- taskAuthorityPath("", parseTaskId(task.after.id));
83
- return [];
84
- }
85
- catch (error) {
86
- return [
87
- { line: 1, reason: error instanceof Error ? error.message : String(error), token: plan.namespace.join("/") },
88
- ];
89
- }
90
- }
91
- function planAgainst(markdown, board, namespace, at, actor) {
92
- return planTaskComposition({ markdown, board, namespace, at, ...(actor === undefined ? {} : { actor }) });
93
- }
94
- async function admitPlan(world, snapshot, plan, signal) {
95
- const changes = [];
96
- for (let index = 0; index < plan.tasks.length; index += 1) {
97
- signal?.throwIfAborted();
98
- const item = plan.tasks[index];
99
- const beforeBytes = item.before === null ? null : (snapshot.bytes.get(item.after.id) ?? null);
100
- const afterBytes = serializeTaskDocument(item.after);
101
- const before = beforeBytes === null ? "" : Buffer.from(beforeBytes).toString("utf8");
102
- const after = Buffer.from(afterBytes).toString("utf8");
103
- const replaced = await replaceAuthority({
104
- world,
105
- id: item.after.id,
106
- expected: beforeBytes,
107
- next: afterBytes,
108
- });
109
- if (replaced !== "replaced") {
110
- return {
111
- kind: "incomplete",
112
- ...facts(plan),
113
- documentChanges: changes,
114
- stopped: { kind: "retry", reason: "concurrent-modification" },
115
- draft: recoveryDraft(plan.namespace, plan.tasks.slice(index)),
116
- };
117
- }
118
- const label = `${item.after.id}.md`;
119
- changes.push({
120
- taskId: item.after.id,
121
- kind: item.before === null ? "created" : "updated",
122
- documentDiff: documentDiff(label, label, before, after),
123
- });
124
- }
125
- return { kind: "accepted", ...facts(plan), documentChanges: changes };
126
- }
127
- async function composeUnderLocks(input) {
128
- const snapshot = await readBoard(input.world);
129
- const planned = planAgainst(input.markdown, snapshot.board, input.namespace, input.at, input.actor);
130
- if (planned.kind === "refused")
131
- return refusal(planned.diagnostics);
132
- return await withTaskLocks({
133
- world: input.world,
134
- allocation: false,
135
- ids: planned.plan.admissionOrder,
136
- ...(input.signal === undefined ? {} : { signal: input.signal }),
137
- }, async () => {
138
- const fresh = await readBoard(input.world);
139
- const replanned = planAgainst(input.markdown, fresh.board, input.namespace, input.at, input.actor);
140
- if (replanned.kind === "refused")
141
- return refusal(replanned.diagnostics);
142
- return await admitPlan(input.world, fresh, replanned.plan, input.signal);
143
- });
144
- }
145
- function composeInput(input) {
146
- return input;
147
- }
148
- export async function composeTasks(input) {
149
- const { world, markdown, signal, actor, defaultNamespace = [], planOnly = false } = input;
150
- try {
151
- const at = currentTimestamp();
152
- const initial = await readBoard(world);
153
- const initialPlan = planAgainst(markdown, initial.board, defaultNamespace, at, actor);
154
- if (initialPlan.kind === "refused")
155
- return refusal(initialPlan.diagnostics);
156
- const physicalDiagnostics = physicalPlanDiagnostics(initialPlan.plan);
157
- if (physicalDiagnostics.length > 0)
158
- return refusal(physicalDiagnostics);
159
- if (planOnly)
160
- return plannedResult(initialPlan.plan);
161
- const request = composeInput({
162
- world,
163
- markdown,
164
- namespace: defaultNamespace,
165
- at,
166
- ...(actor === undefined ? {} : { actor }),
167
- ...(signal === undefined ? {} : { signal }),
168
- });
169
- const allocation = initialPlan.plan.tasks.some((task) => task.kind === "new");
170
- const admitted = allocation
171
- ? await withTaskLocks({ world, allocation: true, ids: [], ...(signal === undefined ? {} : { signal }) }, async () => await composeUnderLocks(request))
172
- : await composeUnderLocks(request);
173
- if (admitted !== "busy")
174
- return admitted;
175
- return {
176
- kind: "incomplete",
177
- ...facts(initialPlan.plan),
178
- documentChanges: [],
179
- stopped: { kind: "retry", reason: "busy" },
180
- draft: recoveryDraft(initialPlan.plan.namespace, initialPlan.plan.tasks),
181
- };
182
- }
183
- catch (error) {
184
- if (error instanceof TypeError &&
185
- /task identity (?:cannot fit the physical filename budget|contains a Windows-reserved physical segment)/u.test(error.message))
186
- return refusal([{ line: 1, reason: error.message, token: defaultNamespace.join("/") }]);
187
- throw error;
188
- }
189
- }
@@ -1,39 +0,0 @@
1
- import { z } from "zod";
2
- import { type TaskCoordinate, type TaskId } from "./identity.js";
3
- export declare const taskNonblankTextSchema: z.ZodString;
4
- export declare const taskStateSchema: z.ZodEnum<{
5
- open: "open";
6
- in_progress: "in_progress";
7
- on_hold: "on_hold";
8
- done: "done";
9
- drop: "drop";
10
- }>;
11
- export declare const taskPrioritySchema: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
12
- export type TaskState = z.infer<typeof taskStateSchema>;
13
- export type TaskPriority = z.infer<typeof taskPrioritySchema>;
14
- export type TaskDocument = Readonly<{
15
- id: TaskId;
16
- title: string;
17
- state: TaskState;
18
- priority: TaskPriority;
19
- needs: readonly TaskId[];
20
- parent: TaskId | null;
21
- supersedes: readonly TaskId[];
22
- relates: readonly TaskId[];
23
- note: string;
24
- createdBy?: string;
25
- createdAt: string;
26
- updatedAt: string;
27
- body: string;
28
- }>;
29
- export type TaskCreationDocument = Omit<TaskDocument, "id" | "createdBy" | "createdAt" | "updatedAt">;
30
- export declare class TaskAuthorityCorruptionError extends Error {
31
- /** The Task document whose bytes failed decode, when the reader knew its coordinate. */
32
- readonly coordinate?: TaskId;
33
- constructor(message: string, options?: ErrorOptions & {
34
- coordinate?: TaskId;
35
- });
36
- }
37
- export declare function parseTaskDocument(bytes: Uint8Array, expected: TaskCoordinate): TaskDocument;
38
- export declare function parseTaskCreationDocument(markdown: string): TaskCreationDocument;
39
- export declare function serializeTaskDocument(document: TaskDocument): Uint8Array;
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import { type ContractId } from "../core/facts/types.js";
3
- export type TaskId = `task/${string}`;
4
- export type TaskCoordinate = Readonly<{
5
- namespace: readonly string[];
6
- localId: string;
7
- }>;
8
- export declare const TASK_LOCAL_ID_BYTES: number;
9
- export declare function isTaskSegment(value: string): boolean;
10
- export declare function parseTaskId(value: string): TaskCoordinate;
11
- export declare function formatTaskId(coordinate: TaskCoordinate): TaskId;
12
- export declare function canonicalTaskId(value: string): TaskId;
13
- export declare const taskIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`task/${string}`, string>>;
14
- export declare const taskNamespaceSchema: z.ZodReadonly<z.ZodArray<z.ZodString>>;
15
- export declare const taskIdsSchema: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`task/${string}`, string>>>>;
16
- export declare function contractNamespace(id: ContractId): readonly string[];
17
- export declare function taskAuthorityPath(tasksDirectory: string, coordinate: TaskCoordinate): string;
18
- export declare function deriveLocalStem(title: string): string;
19
- export declare function allocateLocalId(stem: string, occupied: ReadonlySet<string>): string;
20
- export declare function physicalTaskSegment(segment: string, maxBytes?: number): string;
21
- export declare function sameNamespace(left: readonly string[], right: readonly string[]): boolean;
@@ -1,138 +0,0 @@
1
- import type { WorldRoot } from "../world.js";
2
- import type { NamespaceContextSource, ResolvedNamespaceContext } from "./context.js";
3
- import { type ExecutionContext } from "../akuma/requests.js";
4
- import { type TaskLifecycleVerb } from "./mutation.js";
5
- export type { WorldRoot } from "../world.js";
6
- import { type BlockedTaskRow, type TaskDetailFacts, type TaskDoctorIssue, type TaskRef, type TaskRow, type TaskTreeNode } from "./board.js";
7
- import { type TaskCompositionAlias, type TaskCompositionAdmission, type TaskCompositionBodyPreview, type TaskCompositionPlanAlias, type TaskCompositionPlanOrder, type TaskCompositionResult } from "./compose.js";
8
- import { TaskAuthorityCorruptionError, type TaskPriority, type TaskState } from "./document.js";
9
- import type { TaskId } from "./identity.js";
10
- import { type AddTaskDocumentInput, type AddTaskInput, type TaskBatchResult, type TaskCleanupFailure, type TaskCompositionDiagnostic, type TaskMutationResult, type TaskOutcome, type TaskRefusal, type TaskRetry, type TaskUpdateResult, type TaskView, type UpdateTaskInput } from "./operations.js";
11
- import { TASK_RELATION_PREDICATE_FIELDS, type TaskPage, type TaskQueryExpression, type TaskQueryPredicate, type TaskQueryRow, type TaskQuerySort, type TaskRelationPredicateField } from "./query.js";
12
- export type TaskDetail = Omit<TaskDetailFacts, "task"> & Readonly<{
13
- task: TaskView;
14
- }>;
15
- export type TaskList = TaskOutcome<TaskPage<TaskRow>>;
16
- export type BlockedTaskList = TaskOutcome<TaskPage<BlockedTaskRow>>;
17
- export type TaskQueryResult = TaskOutcome<TaskPage<TaskQueryRow>>;
18
- export type TaskContextSource = NamespaceContextSource;
19
- export type { ResolvedNamespaceContext };
20
- export type TaskContextResult = TaskOutcome<ResolvedNamespaceContext>;
21
- export type TaskDoctorReport = Readonly<{
22
- issues: readonly TaskDoctorIssue[];
23
- }>;
24
- export type TaskDecompositionTree = TaskOutcome<TaskTreeNode>;
25
- export type { AddTaskDocumentInput, AddTaskInput, BlockedTaskRow, TaskBatchResult, TaskCleanupFailure, TaskCompositionDiagnostic, TaskCompositionAlias, TaskCompositionAdmission, TaskCompositionBodyPreview, TaskCompositionPlanAlias, TaskCompositionPlanOrder, TaskCompositionResult, TaskDoctorIssue, TaskId, TaskMutationResult, TaskOutcome, TaskPriority, TaskRef, TaskRefusal, TaskRetry, TaskRow, TaskState, TaskTreeNode, TaskUpdateResult, TaskView, UpdateTaskInput, TaskPage, TaskQueryExpression, TaskQueryPredicate, TaskQueryRow, TaskQuerySort, TaskRelationPredicateField, };
26
- export type { LibraryExecution } from "../akuma/requests.js";
27
- export { TaskAuthorityCorruptionError, TASK_RELATION_PREDICATE_FIELDS };
28
- export { observeRecentTaskStatus, type RecentTaskStatusRow } from "./catalog.js";
29
- export { boundedListLimit as taskRowViewLimit } from "../bounded-list.js";
30
- type ComposeValues = Readonly<{
31
- markdown: string;
32
- namespace?: readonly string[];
33
- actor?: string;
34
- signal?: AbortSignal;
35
- }>;
36
- /**
37
- * The one bound operation table for a captured route. Each entry either calls the
38
- * local Task operations directly or sends the same validated values as the one
39
- * forwarded request shape. Validation stays in the handle methods.
40
- */
41
- type TaskOperations = Readonly<{
42
- add(values: AddTaskInput): Promise<TaskMutationResult>;
43
- addDocument(values: AddTaskDocumentInput): Promise<TaskMutationResult>;
44
- compose(values: ComposeValues): Promise<TaskCompositionResult>;
45
- update(id: TaskId, values: UpdateTaskInput): Promise<TaskUpdateResult>;
46
- lifecycle(id: TaskId, verb: TaskLifecycleVerb, note: string | undefined, signal?: AbortSignal): Promise<TaskMutationResult>;
47
- batch(verb: TaskLifecycleVerb, ids: readonly TaskId[], note: string | undefined, signal?: AbortSignal): Promise<TaskBatchResult>;
48
- }>;
49
- declare class TaskHandle {
50
- readonly id: TaskId;
51
- private readonly world;
52
- private readonly operations;
53
- constructor(id: TaskId, world: WorldRoot, operations: TaskOperations);
54
- read(): Promise<TaskDetail | null>;
55
- tree(): Promise<TaskDecompositionTree>;
56
- update(input: UpdateTaskInput): Promise<TaskUpdateResult>;
57
- private lifecycle;
58
- start(input?: {
59
- signal?: AbortSignal;
60
- }): Promise<TaskMutationResult>;
61
- stop(input?: {
62
- signal?: AbortSignal;
63
- }): Promise<TaskMutationResult>;
64
- hold(input?: {
65
- signal?: AbortSignal;
66
- }): Promise<TaskMutationResult>;
67
- resume(input?: {
68
- signal?: AbortSignal;
69
- }): Promise<TaskMutationResult>;
70
- done(input?: {
71
- note?: string;
72
- signal?: AbortSignal;
73
- }): Promise<TaskMutationResult>;
74
- drop(input?: {
75
- note?: string;
76
- signal?: AbortSignal;
77
- }): Promise<TaskMutationResult>;
78
- }
79
- export type Task = TaskHandle;
80
- declare class TasksHandle {
81
- private readonly world;
82
- readonly root: WorldRoot;
83
- private readonly operations;
84
- constructor(world: WorldRoot, execution: ExecutionContext);
85
- task(input: Readonly<{
86
- id: string;
87
- }>): Task;
88
- add(input: AddTaskInput): Promise<TaskMutationResult>;
89
- addDocument(input: AddTaskDocumentInput): Promise<TaskMutationResult>;
90
- list(input?: Readonly<{
91
- selection?: "active" | "closed" | "all";
92
- scope?: "namespace" | "world";
93
- namespace?: readonly string[];
94
- limit?: number;
95
- }>): Promise<TaskList>;
96
- ready(input?: Readonly<{
97
- scope?: "namespace" | "world";
98
- namespace?: readonly string[];
99
- parent?: string;
100
- limit?: number;
101
- }>): Promise<TaskList>;
102
- blocked(input?: Readonly<{
103
- scope?: "namespace" | "world";
104
- namespace?: readonly string[];
105
- parent?: string;
106
- limit?: number;
107
- }>): Promise<BlockedTaskList>;
108
- query(input?: Readonly<{
109
- where?: TaskQueryExpression;
110
- scope?: "namespace" | "world";
111
- namespace?: readonly string[];
112
- sort?: TaskQuerySort;
113
- limit?: number;
114
- }>): Promise<TaskQueryResult>;
115
- doctor(): Promise<TaskDoctorReport>;
116
- batch(input: Readonly<{
117
- verb: "start" | "stop" | "done" | "drop" | "hold" | "resume";
118
- ids: readonly string[];
119
- note?: string;
120
- signal?: AbortSignal;
121
- }>): Promise<TaskBatchResult>;
122
- compose(input: Readonly<{
123
- markdown: string;
124
- namespace?: readonly string[];
125
- actor?: string;
126
- signal?: AbortSignal;
127
- plan?: boolean;
128
- }>): Promise<TaskCompositionResult>;
129
- }
130
- export type Tasks = TasksHandle;
131
- /**
132
- * The one Tasks composition. Public `of` fixes local execution; CLI and Body pass their captured
133
- * internal channel through `tasksWithExecution` instead of a second constructor.
134
- */
135
- export declare function tasksWithExecution(world: WorldRoot, execution: ExecutionContext): Tasks;
136
- export declare const Tasks: Readonly<{
137
- of(world: WorldRoot): Tasks;
138
- }>;
@@ -1,269 +0,0 @@
1
- import { executionChannel, localExecutionContext } from "../akuma/requests.js";
2
- import { requestForwardedTask, } from "./mutation.js";
3
- import { buildTree, createTaskRelations, diagnoseBoard, } from "./board.js";
4
- import { composeTasks, } from "./compose.js";
5
- import { TaskAuthorityCorruptionError } from "./document.js";
6
- import { addTask, addTaskDocument, batchTasks, blockedTasks, lifecycleTask, listTasks, queryTasks, readTaskDetail, readyTasks, taskView, updateTask, } from "./operations.js";
7
- import { boundedListLimit } from "../bounded-list.js";
8
- import { readBoard } from "./store.js";
9
- import { actor, addInput, closed, namespace, record, signal, sort, taskId as id, taskIds, text, updateInput, } from "./input.js";
10
- import { normalizeTaskQuery, taskQuerySelection, TASK_RELATION_PREDICATE_FIELDS, } from "./query.js";
11
- export { TaskAuthorityCorruptionError, TASK_RELATION_PREDICATE_FIELDS };
12
- export { observeRecentTaskStatus } from "./catalog.js";
13
- export { boundedListLimit as taskRowViewLimit } from "../bounded-list.js";
14
- function taskRoute(execution) {
15
- const channel = executionChannel(execution);
16
- return channel.kind === "body-request" ? { kind: "forwarded", directory: channel.directory } : { kind: "local" };
17
- }
18
- function forwardTask(directory, world, request, signal) {
19
- return requestForwardedTask({
20
- directory,
21
- world,
22
- request,
23
- ...(signal === undefined ? {} : { signal }),
24
- });
25
- }
26
- /** The single lifecycle request shapes, keyed once by verb instead of switched per handle. */
27
- const SINGLE_LIFECYCLE = {
28
- start: (id) => ({ action: "task.start", id }),
29
- stop: (id) => ({ action: "task.stop", id }),
30
- hold: (id) => ({ action: "task.hold", id }),
31
- resume: (id) => ({ action: "task.resume", id }),
32
- done: (id, note) => ({ action: "task.done", id, ...(note === undefined ? {} : { note }) }),
33
- drop: (id, note) => ({ action: "task.drop", id, ...(note === undefined ? {} : { note }) }),
34
- };
35
- /** The batch lifecycle request shapes for the same verbs. */
36
- const BATCH_LIFECYCLE = {
37
- start: (ids) => ({ action: "task.start", ids }),
38
- stop: (ids) => ({ action: "task.stop", ids }),
39
- hold: (ids) => ({ action: "task.hold", ids }),
40
- resume: (ids) => ({ action: "task.resume", ids }),
41
- done: (ids, note) => ({ action: "task.done", ids, ...(note === undefined ? {} : { note }) }),
42
- drop: (ids, note) => ({ action: "task.drop", ids, ...(note === undefined ? {} : { note }) }),
43
- };
44
- function taskOperations(world, route) {
45
- if (route.kind === "forwarded") {
46
- const { directory } = route;
47
- return {
48
- add: (values) => {
49
- const { actor: _actor, signal, namespace: selected, ...request } = values;
50
- return forwardTask(directory, world, { action: "task.add", input: { ...request, namespace: selected ?? [] } }, signal);
51
- },
52
- addDocument: (values) => forwardTask(directory, world, { action: "task.addDocument", input: { markdown: values.markdown, namespace: values.namespace ?? [] } }, values.signal),
53
- compose: (values) => forwardTask(directory, world, { action: "task.compose", markdown: values.markdown, namespace: values.namespace ?? [] }, values.signal),
54
- update: (id, values) => {
55
- const { signal, ...request } = values;
56
- return forwardTask(directory, world, { action: "task.update", id, input: request }, signal);
57
- },
58
- lifecycle: (id, verb, note, signal) => forwardTask(directory, world, SINGLE_LIFECYCLE[verb](id, note), signal),
59
- batch: (verb, ids, note, signal) => forwardTask(directory, world, BATCH_LIFECYCLE[verb](ids, note), signal),
60
- };
61
- }
62
- return {
63
- add: (values) => addTask(world, values),
64
- addDocument: (values) => addTaskDocument(world, values),
65
- compose: (values) => composeTasks({
66
- world,
67
- markdown: values.markdown,
68
- ...(values.signal === undefined ? {} : { signal: values.signal }),
69
- ...(values.actor === undefined ? {} : { actor: values.actor }),
70
- ...(values.namespace === undefined ? {} : { defaultNamespace: values.namespace }),
71
- planOnly: false,
72
- }),
73
- update: (id, values) => updateTask(world, id, values),
74
- lifecycle: (id, verb, note, signal) => lifecycleTask(world, id, verb, signal, note),
75
- batch: (verb, ids, note, signal) => batchTasks(world, verb, ids, signal, note),
76
- };
77
- }
78
- class TaskHandle {
79
- id;
80
- world;
81
- operations;
82
- constructor(id, world, operations) {
83
- this.id = id;
84
- this.world = world;
85
- this.operations = operations;
86
- }
87
- async read() {
88
- const facts = await readTaskDetail(this.world, this.id);
89
- return facts === null ? null : { ...facts, task: taskView(facts.task) };
90
- }
91
- async tree() {
92
- if (arguments.length > 0)
93
- throw new TypeError("tree accepts no input");
94
- const board = (await readBoard(this.world)).board;
95
- const node = buildTree(board, this.id, createTaskRelations(board));
96
- return node === null
97
- ? { kind: "refused", refusal: { kind: "task-missing", taskId: this.id } }
98
- : { kind: "accepted", value: node };
99
- }
100
- update(input) {
101
- return this.operations.update(this.id, updateInput(input));
102
- }
103
- lifecycle(verb, input) {
104
- const value = record(input ?? {}, `${verb} input`);
105
- closed(value, verb === "drop" || verb === "done" ? ["note", "signal"] : ["signal"], `${verb} input`);
106
- const note = verb === "drop" || verb === "done" ? text(value.note, "note") : undefined;
107
- return this.operations.lifecycle(this.id, verb, note, signal(value.signal));
108
- }
109
- start(input) {
110
- return this.lifecycle("start", input);
111
- }
112
- stop(input) {
113
- return this.lifecycle("stop", input);
114
- }
115
- hold(input) {
116
- return this.lifecycle("hold", input);
117
- }
118
- resume(input) {
119
- return this.lifecycle("resume", input);
120
- }
121
- done(input) {
122
- return this.lifecycle("done", input);
123
- }
124
- drop(input) {
125
- return this.lifecycle("drop", input);
126
- }
127
- }
128
- class TasksHandle {
129
- world;
130
- root;
131
- operations;
132
- constructor(world, execution) {
133
- this.world = world;
134
- this.root = world;
135
- this.operations = taskOperations(world, taskRoute(execution));
136
- }
137
- task(input) {
138
- const v = record(input, "task input");
139
- closed(v, ["id"], "task input");
140
- return new TaskHandle(id(v.id), this.world, this.operations);
141
- }
142
- add(input) {
143
- return this.operations.add(addInput(input));
144
- }
145
- addDocument(input) {
146
- const v = record(input, "addDocument input");
147
- closed(v, ["markdown", "namespace", "actor", "signal"], "addDocument input");
148
- const markdown = text(v.markdown, "markdown");
149
- if (markdown === undefined)
150
- throw new TypeError("markdown is required");
151
- const ns = namespace(v.namespace), createdBy = actor(v.actor), abort = signal(v.signal);
152
- return this.operations.addDocument({
153
- markdown,
154
- ...(ns === undefined ? {} : { namespace: ns }),
155
- ...(createdBy === undefined ? {} : { actor: createdBy }),
156
- ...(abort === undefined ? {} : { signal: abort }),
157
- });
158
- }
159
- async list(input = {}) {
160
- const v = record(input, "list input");
161
- closed(v, ["selection", "scope", "namespace", "limit"], "list input");
162
- if (v.selection !== undefined && v.selection !== "active" && v.selection !== "closed" && v.selection !== "all")
163
- throw new TypeError("selection must be active, closed, or all");
164
- if (v.scope !== undefined && v.scope !== "namespace" && v.scope !== "world")
165
- throw new TypeError("scope must be namespace or world");
166
- const selectedLimit = boundedListLimit(v.limit);
167
- return listTasks(this.world, namespace(v.namespace), v.selection ?? "active", v.scope, selectedLimit);
168
- }
169
- async ready(input = {}) {
170
- const v = record(input, "ready input");
171
- closed(v, ["scope", "namespace", "parent", "limit"], "ready input");
172
- if (v.scope !== undefined && v.scope !== "namespace" && v.scope !== "world")
173
- throw new TypeError("scope must be namespace or world");
174
- const parent = v.parent === undefined ? undefined : id(v.parent);
175
- const selectedLimit = boundedListLimit(v.limit);
176
- return readyTasks(this.world, namespace(v.namespace), v.scope, parent, selectedLimit);
177
- }
178
- async blocked(input = {}) {
179
- const v = record(input, "blocked input");
180
- closed(v, ["scope", "namespace", "parent", "limit"], "blocked input");
181
- if (v.scope !== undefined && v.scope !== "namespace" && v.scope !== "world")
182
- throw new TypeError("scope must be namespace or world");
183
- const parent = v.parent === undefined ? undefined : id(v.parent);
184
- const selectedLimit = boundedListLimit(v.limit);
185
- return blockedTasks(this.world, namespace(v.namespace), v.scope, parent, selectedLimit);
186
- }
187
- async query(input = {}) {
188
- const v = record(input, "query input");
189
- closed(v, ["where", "scope", "namespace", "sort", "limit"], "query input");
190
- if (v.scope !== undefined && v.scope !== "namespace" && v.scope !== "world")
191
- throw new TypeError("scope must be namespace or world");
192
- const expression = v.where === undefined ? taskQuerySelection() : normalizeTaskQuery(v.where);
193
- const selected = namespace(v.namespace);
194
- const selectedLimit = boundedListLimit(v.limit);
195
- return queryTasks({
196
- world: this.world,
197
- ...(selected === undefined ? {} : { namespace: selected }),
198
- expression,
199
- ...(v.scope === undefined ? {} : { scope: v.scope }),
200
- sort: sort(v.sort) ?? "priority",
201
- limit: selectedLimit,
202
- });
203
- }
204
- async doctor() {
205
- return { issues: diagnoseBoard((await readBoard(this.world)).board) };
206
- }
207
- batch(input) {
208
- const v = record(input, "batch input");
209
- closed(v, ["verb", "ids", "note", "signal"], "batch input");
210
- const verb = v.verb;
211
- if (verb !== "start" &&
212
- verb !== "stop" &&
213
- verb !== "done" &&
214
- verb !== "drop" &&
215
- verb !== "hold" &&
216
- verb !== "resume")
217
- throw new TypeError("batch verb is invalid");
218
- const ids = taskIds(v.ids, "ids");
219
- if (ids === undefined || ids.length === 0)
220
- throw new TypeError("ids requires at least one TaskId");
221
- const note = text(v.note, "note");
222
- if (note !== undefined && verb !== "done" && verb !== "drop")
223
- throw new TypeError("batch note is valid only for done or drop");
224
- return this.operations.batch(verb, ids, note, signal(v.signal));
225
- }
226
- compose(input) {
227
- const v = record(input, "compose input");
228
- closed(v, ["markdown", "namespace", "actor", "signal", "plan"], "compose input");
229
- const markdown = text(v.markdown, "markdown");
230
- if (markdown === undefined)
231
- throw new TypeError("markdown is required");
232
- if (v.plan !== undefined && typeof v.plan !== "boolean")
233
- throw new TypeError("plan must be a boolean");
234
- const selected = namespace(v.namespace);
235
- const selectedSignal = signal(v.signal);
236
- const selectedActor = actor(v.actor);
237
- if (v.plan === true) {
238
- // A dry-run plan never leaves the process: it composes locally on any route.
239
- return composeTasks({
240
- world: this.world,
241
- markdown,
242
- ...(selectedSignal === undefined ? {} : { signal: selectedSignal }),
243
- ...(selectedActor === undefined ? {} : { actor: selectedActor }),
244
- ...(selected === undefined ? {} : { defaultNamespace: selected }),
245
- planOnly: true,
246
- });
247
- }
248
- return this.operations.compose({
249
- markdown,
250
- ...(selected === undefined ? {} : { namespace: selected }),
251
- ...(selectedActor === undefined ? {} : { actor: selectedActor }),
252
- ...(selectedSignal === undefined ? {} : { signal: selectedSignal }),
253
- });
254
- }
255
- }
256
- /**
257
- * The one Tasks composition. Public `of` fixes local execution; CLI and Body pass their captured
258
- * internal channel through `tasksWithExecution` instead of a second constructor.
259
- */
260
- export function tasksWithExecution(world, execution) {
261
- if (typeof world !== "string")
262
- throw new TypeError("Tasks.of world must be a WorldRoot");
263
- return new TasksHandle(world, execution);
264
- }
265
- export const Tasks = Object.freeze({
266
- of(world) {
267
- return tasksWithExecution(world, localExecutionContext());
268
- },
269
- });
@@ -1,6 +0,0 @@
1
- import { type SettledTaskResult, type TaskBatchResult, type TaskLifecycleVerb, type TaskMutationResult } from "./operation-types.js";
2
- import type { TaskId } from "./identity.js";
3
- import type { WorldRoot } from "../world.js";
4
- export declare function lifecycleTask(world: WorldRoot, id: TaskId, verb: TaskLifecycleVerb, signal?: AbortSignal, note?: string): Promise<TaskMutationResult>;
5
- export declare function batchTasks(world: WorldRoot, verb: TaskLifecycleVerb, ids: readonly TaskId[], signal?: AbortSignal, note?: string): Promise<TaskBatchResult>;
6
- export declare function settleTask(world: WorldRoot, id: TaskId): Promise<SettledTaskResult>;