@alisio/plugin-swarm 0.0.0-stage → 0.1.0

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 (266) hide show
  1. package/.agents/agents/swarm-architect.md +20 -0
  2. package/.agents/agents/swarm-cleaner.md +20 -0
  3. package/.agents/agents/swarm-coder.md +20 -0
  4. package/.agents/agents/swarm-hardener.md +20 -0
  5. package/.agents/agents/swarm-lieutenant.md +20 -0
  6. package/.agents/agents/swarm-qa.md +20 -0
  7. package/.agents/agents/swarm-refactorer.md +20 -0
  8. package/.agents/agents/swarm-specifier.md +20 -0
  9. package/.agents/skills/swarm-architecture-rules/SKILL.md +43 -0
  10. package/.agents/skills/swarm-clarification/SKILL.md +42 -0
  11. package/.agents/skills/swarm-cleaner-metrics/SKILL.md +44 -0
  12. package/.agents/skills/swarm-engineering-constitution/SKILL.md +44 -0
  13. package/.agents/skills/swarm-gherkin-spec/SKILL.md +43 -0
  14. package/.agents/skills/swarm-handoff-protocol/SKILL.md +45 -0
  15. package/.agents/skills/swarm-lieutenant/SKILL.md +41 -0
  16. package/.agents/skills/swarm-mutation-hardening/SKILL.md +43 -0
  17. package/.agents/skills/swarm-qa-acceptance/SKILL.md +42 -0
  18. package/.agents/skills/swarm-tdd-slice/SKILL.md +44 -0
  19. package/.agents/skills/swarm-toolchain-profile/SKILL.md +41 -0
  20. package/LICENSE +21 -0
  21. package/README.es.md +337 -0
  22. package/README.md +322 -2
  23. package/assets/approval-flow.svg +1 -0
  24. package/assets/architecture.svg +1 -0
  25. package/assets/audit-states.svg +1 -0
  26. package/assets/dashboard.css +964 -0
  27. package/assets/dashboard.html +123 -0
  28. package/assets/dashboard.js +965 -0
  29. package/assets/dashboard.svg +1 -0
  30. package/assets/handoff-sequence.svg +1 -0
  31. package/assets/pack-pipelines.svg +1 -0
  32. package/assets/packs/four-pack/pack.json +18 -0
  33. package/assets/packs/six-pack/pack.json +22 -0
  34. package/assets/packs/two-pack/pack.json +14 -0
  35. package/assets/screenshots/dashboard-board-dark.png +0 -0
  36. package/assets/screenshots/dashboard-board-light.png +0 -0
  37. package/assets/screenshots/dashboard-documents-diff.png +0 -0
  38. package/assets/screenshots/dashboard-empty-state.png +0 -0
  39. package/assets/screenshots/dashboard-phone.png +0 -0
  40. package/assets/screenshots/dashboard-reject-dialog.png +0 -0
  41. package/assets/screenshots/dashboard-transcript-tail.png +0 -0
  42. package/assets/screenshots/dashboard-work-queue.png +0 -0
  43. package/assets/task-states.svg +1 -0
  44. package/assets/toolchains/node-ts.json +61 -0
  45. package/cover.svg +46 -0
  46. package/dist/adapters/child-session-runner.d.ts +36 -0
  47. package/dist/adapters/child-session-runner.d.ts.map +1 -0
  48. package/dist/adapters/child-session-runner.js +156 -0
  49. package/dist/adapters/child-session-runner.js.map +1 -0
  50. package/dist/adapters/fs-board-store.d.ts +11 -0
  51. package/dist/adapters/fs-board-store.d.ts.map +1 -0
  52. package/dist/adapters/fs-board-store.js +27 -0
  53. package/dist/adapters/fs-board-store.js.map +1 -0
  54. package/dist/adapters/fs-handoff-store.d.ts +36 -0
  55. package/dist/adapters/fs-handoff-store.d.ts.map +1 -0
  56. package/dist/adapters/fs-handoff-store.js +254 -0
  57. package/dist/adapters/fs-handoff-store.js.map +1 -0
  58. package/dist/adapters/fs-task-state-store.d.ts +16 -0
  59. package/dist/adapters/fs-task-state-store.d.ts.map +1 -0
  60. package/dist/adapters/fs-task-state-store.js +66 -0
  61. package/dist/adapters/fs-task-state-store.js.map +1 -0
  62. package/dist/adapters/git-worktree.d.ts +31 -0
  63. package/dist/adapters/git-worktree.d.ts.map +1 -0
  64. package/dist/adapters/git-worktree.js +209 -0
  65. package/dist/adapters/git-worktree.js.map +1 -0
  66. package/dist/adapters/process-exec.d.ts +36 -0
  67. package/dist/adapters/process-exec.d.ts.map +1 -0
  68. package/dist/adapters/process-exec.js +138 -0
  69. package/dist/adapters/process-exec.js.map +1 -0
  70. package/dist/adapters/process-gate-runner.d.ts +39 -0
  71. package/dist/adapters/process-gate-runner.d.ts.map +1 -0
  72. package/dist/adapters/process-gate-runner.js +242 -0
  73. package/dist/adapters/process-gate-runner.js.map +1 -0
  74. package/dist/adapters/unavailable-runner.d.ts +4 -0
  75. package/dist/adapters/unavailable-runner.d.ts.map +1 -0
  76. package/dist/adapters/unavailable-runner.js +12 -0
  77. package/dist/adapters/unavailable-runner.js.map +1 -0
  78. package/dist/app/audit.d.ts +23 -0
  79. package/dist/app/audit.d.ts.map +1 -0
  80. package/dist/app/audit.js +9 -0
  81. package/dist/app/audit.js.map +1 -0
  82. package/dist/app/budget.d.ts +29 -0
  83. package/dist/app/budget.d.ts.map +1 -0
  84. package/dist/app/budget.js +78 -0
  85. package/dist/app/budget.js.map +1 -0
  86. package/dist/app/chat-store.d.ts +18 -0
  87. package/dist/app/chat-store.d.ts.map +1 -0
  88. package/dist/app/chat-store.js +48 -0
  89. package/dist/app/chat-store.js.map +1 -0
  90. package/dist/app/documents.d.ts +33 -0
  91. package/dist/app/documents.d.ts.map +1 -0
  92. package/dist/app/documents.js +63 -0
  93. package/dist/app/documents.js.map +1 -0
  94. package/dist/app/forge.d.ts +106 -0
  95. package/dist/app/forge.d.ts.map +1 -0
  96. package/dist/app/forge.js +420 -0
  97. package/dist/app/forge.js.map +1 -0
  98. package/dist/app/operator.d.ts +46 -0
  99. package/dist/app/operator.d.ts.map +1 -0
  100. package/dist/app/operator.js +168 -0
  101. package/dist/app/operator.js.map +1 -0
  102. package/dist/app/pidfile.d.ts +18 -0
  103. package/dist/app/pidfile.d.ts.map +1 -0
  104. package/dist/app/pidfile.js +56 -0
  105. package/dist/app/pidfile.js.map +1 -0
  106. package/dist/app/project.d.ts +93 -0
  107. package/dist/app/project.d.ts.map +1 -0
  108. package/dist/app/project.js +291 -0
  109. package/dist/app/project.js.map +1 -0
  110. package/dist/app/prompts.d.ts +48 -0
  111. package/dist/app/prompts.d.ts.map +1 -0
  112. package/dist/app/prompts.js +88 -0
  113. package/dist/app/prompts.js.map +1 -0
  114. package/dist/app/pump.d.ts +144 -0
  115. package/dist/app/pump.d.ts.map +1 -0
  116. package/dist/app/pump.js +707 -0
  117. package/dist/app/pump.js.map +1 -0
  118. package/dist/app/services.d.ts +112 -0
  119. package/dist/app/services.d.ts.map +1 -0
  120. package/dist/app/services.js +323 -0
  121. package/dist/app/services.js.map +1 -0
  122. package/dist/app/state.d.ts +70 -0
  123. package/dist/app/state.d.ts.map +1 -0
  124. package/dist/app/state.js +96 -0
  125. package/dist/app/state.js.map +1 -0
  126. package/dist/args.d.ts +10 -0
  127. package/dist/args.d.ts.map +1 -0
  128. package/dist/args.js +33 -0
  129. package/dist/args.js.map +1 -0
  130. package/dist/coordinator.d.ts +80 -0
  131. package/dist/coordinator.d.ts.map +1 -0
  132. package/dist/coordinator.js +481 -0
  133. package/dist/coordinator.js.map +1 -0
  134. package/dist/dashboard/api.d.ts +28 -0
  135. package/dist/dashboard/api.d.ts.map +1 -0
  136. package/dist/dashboard/api.js +178 -0
  137. package/dist/dashboard/api.js.map +1 -0
  138. package/dist/dashboard/auth.d.ts +13 -0
  139. package/dist/dashboard/auth.d.ts.map +1 -0
  140. package/dist/dashboard/auth.js +36 -0
  141. package/dist/dashboard/auth.js.map +1 -0
  142. package/dist/dashboard/open.d.ts +7 -0
  143. package/dist/dashboard/open.d.ts.map +1 -0
  144. package/dist/dashboard/open.js +17 -0
  145. package/dist/dashboard/open.js.map +1 -0
  146. package/dist/dashboard/server.d.ts +28 -0
  147. package/dist/dashboard/server.d.ts.map +1 -0
  148. package/dist/dashboard/server.js +176 -0
  149. package/dist/dashboard/server.js.map +1 -0
  150. package/dist/doctor.d.ts +28 -0
  151. package/dist/doctor.d.ts.map +1 -0
  152. package/dist/doctor.js +108 -0
  153. package/dist/doctor.js.map +1 -0
  154. package/dist/domain/attention.d.ts +20 -0
  155. package/dist/domain/attention.d.ts.map +1 -0
  156. package/dist/domain/attention.js +41 -0
  157. package/dist/domain/attention.js.map +1 -0
  158. package/dist/domain/envelope.d.ts +37 -0
  159. package/dist/domain/envelope.d.ts.map +1 -0
  160. package/dist/domain/envelope.js +106 -0
  161. package/dist/domain/envelope.js.map +1 -0
  162. package/dist/domain/handoff.d.ts +57 -0
  163. package/dist/domain/handoff.d.ts.map +1 -0
  164. package/dist/domain/handoff.js +191 -0
  165. package/dist/domain/handoff.js.map +1 -0
  166. package/dist/domain/identifiers.d.ts +18 -0
  167. package/dist/domain/identifiers.d.ts.map +1 -0
  168. package/dist/domain/identifiers.js +70 -0
  169. package/dist/domain/identifiers.js.map +1 -0
  170. package/dist/domain/pack.d.ts +45 -0
  171. package/dist/domain/pack.d.ts.map +1 -0
  172. package/dist/domain/pack.js +207 -0
  173. package/dist/domain/pack.js.map +1 -0
  174. package/dist/domain/pipeline.d.ts +33 -0
  175. package/dist/domain/pipeline.d.ts.map +1 -0
  176. package/dist/domain/pipeline.js +50 -0
  177. package/dist/domain/pipeline.js.map +1 -0
  178. package/dist/domain/task.d.ts +26 -0
  179. package/dist/domain/task.d.ts.map +1 -0
  180. package/dist/domain/task.js +154 -0
  181. package/dist/domain/task.js.map +1 -0
  182. package/dist/domain/taskstate.d.ts +37 -0
  183. package/dist/domain/taskstate.d.ts.map +1 -0
  184. package/dist/domain/taskstate.js +98 -0
  185. package/dist/domain/taskstate.js.map +1 -0
  186. package/dist/gates/dry.d.ts +14 -0
  187. package/dist/gates/dry.d.ts.map +1 -0
  188. package/dist/gates/dry.js +71 -0
  189. package/dist/gates/dry.js.map +1 -0
  190. package/dist/gates/parsers.d.ts +34 -0
  191. package/dist/gates/parsers.d.ts.map +1 -0
  192. package/dist/gates/parsers.js +120 -0
  193. package/dist/gates/parsers.js.map +1 -0
  194. package/dist/index.d.ts +45 -0
  195. package/dist/index.d.ts.map +1 -0
  196. package/dist/index.js +207 -0
  197. package/dist/index.js.map +1 -0
  198. package/dist/options.d.ts +13 -0
  199. package/dist/options.d.ts.map +1 -0
  200. package/dist/options.js +27 -0
  201. package/dist/options.js.map +1 -0
  202. package/dist/panel.d.ts +5 -0
  203. package/dist/panel.d.ts.map +1 -0
  204. package/dist/panel.js +52 -0
  205. package/dist/panel.js.map +1 -0
  206. package/dist/ports/agent-runner.d.ts +51 -0
  207. package/dist/ports/agent-runner.d.ts.map +1 -0
  208. package/dist/ports/agent-runner.js +2 -0
  209. package/dist/ports/agent-runner.js.map +1 -0
  210. package/dist/ports/board-store.d.ts +7 -0
  211. package/dist/ports/board-store.d.ts.map +1 -0
  212. package/dist/ports/board-store.js +2 -0
  213. package/dist/ports/board-store.js.map +1 -0
  214. package/dist/ports/clock.d.ts +5 -0
  215. package/dist/ports/clock.d.ts.map +1 -0
  216. package/dist/ports/clock.js +2 -0
  217. package/dist/ports/clock.js.map +1 -0
  218. package/dist/ports/gate-runner.d.ts +34 -0
  219. package/dist/ports/gate-runner.d.ts.map +1 -0
  220. package/dist/ports/gate-runner.js +2 -0
  221. package/dist/ports/gate-runner.js.map +1 -0
  222. package/dist/ports/handoff-store.d.ts +39 -0
  223. package/dist/ports/handoff-store.d.ts.map +1 -0
  224. package/dist/ports/handoff-store.js +2 -0
  225. package/dist/ports/handoff-store.js.map +1 -0
  226. package/dist/ports/isolation.d.ts +43 -0
  227. package/dist/ports/isolation.d.ts.map +1 -0
  228. package/dist/ports/isolation.js +2 -0
  229. package/dist/ports/isolation.js.map +1 -0
  230. package/dist/ports/notifier.d.ts +28 -0
  231. package/dist/ports/notifier.d.ts.map +1 -0
  232. package/dist/ports/notifier.js +2 -0
  233. package/dist/ports/notifier.js.map +1 -0
  234. package/dist/ports/task-state-store.d.ts +10 -0
  235. package/dist/ports/task-state-store.d.ts.map +1 -0
  236. package/dist/ports/task-state-store.js +2 -0
  237. package/dist/ports/task-state-store.js.map +1 -0
  238. package/dist/refs.d.ts +10 -0
  239. package/dist/refs.d.ts.map +1 -0
  240. package/dist/refs.js +19 -0
  241. package/dist/refs.js.map +1 -0
  242. package/dist/resources.d.ts +55 -0
  243. package/dist/resources.d.ts.map +1 -0
  244. package/dist/resources.js +255 -0
  245. package/dist/resources.js.map +1 -0
  246. package/dist/status.d.ts +18 -0
  247. package/dist/status.d.ts.map +1 -0
  248. package/dist/status.js +60 -0
  249. package/dist/status.js.map +1 -0
  250. package/dist/storage.d.ts +18 -0
  251. package/dist/storage.d.ts.map +1 -0
  252. package/dist/storage.js +79 -0
  253. package/dist/storage.js.map +1 -0
  254. package/dist/toolchains/profile.d.ts +21 -0
  255. package/dist/toolchains/profile.d.ts.map +1 -0
  256. package/dist/toolchains/profile.js +60 -0
  257. package/dist/toolchains/profile.js.map +1 -0
  258. package/dist/toolchains/thresholds.d.ts +29 -0
  259. package/dist/toolchains/thresholds.d.ts.map +1 -0
  260. package/dist/toolchains/thresholds.js +45 -0
  261. package/dist/toolchains/thresholds.js.map +1 -0
  262. package/dist/version.d.ts +2 -0
  263. package/dist/version.d.ts.map +1 -0
  264. package/dist/version.js +3 -0
  265. package/dist/version.js.map +1 -0
  266. package/package.json +51 -3
package/dist/index.js ADDED
@@ -0,0 +1,207 @@
1
+ import { definePlugin } from "@alisio/sdk";
2
+ import { SwarmCoordinator } from "./coordinator.js";
3
+ import { panelNodes } from "./panel.js";
4
+ import { resourcePaths } from "./resources.js";
5
+ import { VERSION } from "./version.js";
6
+ export { ChildSessionRunner } from "./adapters/child-session-runner.js";
7
+ export { FsBoardStore } from "./adapters/fs-board-store.js";
8
+ export { FsHandoffStore } from "./adapters/fs-handoff-store.js";
9
+ export { GitWorktreeIsolation } from "./adapters/git-worktree.js";
10
+ export { ProcessGateRunner } from "./adapters/process-gate-runner.js";
11
+ export { unavailableRunner } from "./adapters/unavailable-runner.js";
12
+ export { Forge } from "./app/forge.js";
13
+ export { ProjectRuntime } from "./app/project.js";
14
+ export { SwarmServices } from "./app/services.js";
15
+ export { SwarmCoordinator } from "./coordinator.js";
16
+ export { formatDoctor, runDoctor } from "./doctor.js";
17
+ export * from "./domain/attention.js";
18
+ export * from "./domain/envelope.js";
19
+ export * from "./domain/handoff.js";
20
+ export * from "./domain/identifiers.js";
21
+ export * from "./domain/pack.js";
22
+ export * from "./domain/pipeline.js";
23
+ export * from "./domain/task.js";
24
+ export { parseTaskRef } from "./refs.js";
25
+ export { agentForRole, isResourceRole, listShippedPacks, loadAgentProfile, loadRoleInstructions, loadShippedPack, loadToolchain, parseResource, resourcePaths, roleSkills, } from "./resources.js";
26
+ export { atomicWrite } from "./storage.js";
27
+ export * from "./toolchains/profile.js";
28
+ export * from "./toolchains/thresholds.js";
29
+ const text = (value, isError = false) => ({
30
+ content: [{ type: "text", text: value }],
31
+ ...(isError ? { isError: true } : {}),
32
+ });
33
+ const failure = (error) => text(error instanceof Error ? error.message : String(error), true);
34
+ /** Register the swarm plugin on an API. `options` are test seams; production passes none. */
35
+ export function registerSwarm(api, options = {}) {
36
+ api.resources.agents(resourcePaths.agents);
37
+ api.resources.skills(resourcePaths.skills);
38
+ const coordinator = new SwarmCoordinator(api, options);
39
+ const register = (name, description, argumentHint, handler) => api.commands.register(name, async (args, context) => handler(coordinator.workspaceOf(context?.sessionId), args), { description, argumentHint });
40
+ register("init", "Create the swarm forge in this workspace", "", (workspace) => coordinator.init(workspace));
41
+ register("doctor", "Check git, Node.js, toolchain commands and the workspace", "", (workspace) => coordinator.doctor(workspace));
42
+ register("pack", "List shipped and workspace packs, or show one", "list | show <name>", (workspace, args) => coordinator.pack(workspace, args));
43
+ register("project", "Create, open, close and list swarm projects", "new <name> [--pack <pack>] [--github <owner/repo>] -- <mission> | open <name> | close <name> | list", (workspace, args) => coordinator.project(workspace, args));
44
+ register("task", "Create a task card and queue it for the first role", "<project> new [name] -- <task text> | delete <name> | retry <name> | accept <name>", (workspace, args) => coordinator.task(workspace, args));
45
+ register("approve", "Approve a task waiting at the approval gate", "<project>/<task>", (workspace, args) => coordinator.approve(workspace, args));
46
+ register("reject", "Reject a task at the approval gate: retry, delete or accept unchanged", "<project>/<task> retry|delete|accept [-- comments]", (workspace, args) => coordinator.reject(workspace, args));
47
+ register("answer", "Answer a clarification question from a role", "<project>/<task> -- <answer>", (workspace, args) => coordinator.answer(workspace, args));
48
+ register("comment", "Comment on a document of a task waiting for approval, or clear the comments", "<project>/<task> <document> -- <comment> | <project>/<task> clear", (workspace, args) => coordinator.comment(workspace, args));
49
+ register("chat", "Talk to the read-only Lieutenant of a project", "[project] -- <message>", (workspace, args) => coordinator.chat(workspace, args));
50
+ register("stop", "Cancel a project's agents and halt its pump (the project stays open)", "<project>", (workspace, args) => coordinator.stop(workspace, args));
51
+ register("run", "Run a project's pump in the foreground until it is idle", "<project> [--seconds <1-3600>]", (workspace, args) => coordinator.run(workspace, args));
52
+ register("budget", "Show the swarm token budget, or raise the cap", "[raise <tokens>]", (workspace, args) => coordinator.budget(workspace, args));
53
+ register("dashboard", "Open the local swarm follow-up dashboard: board, work queue, activity and approvals", "[project | project/task]", (workspace, args) => coordinator.dashboard(workspace, args));
54
+ register("teardown", "Cancel every agent and stop every project (project files stay)", "--confirm TEARDOWN", (workspace, args) => coordinator.teardown(workspace, args));
55
+ register("status", "Show projects, lanes and items that need your attention", "[project]", (workspace, args) => coordinator.statusText(workspace, args));
56
+ registerFallbacks(api, coordinator);
57
+ api.tools.register({
58
+ name: "swarm_status",
59
+ description: "Show swarm projects, the task board and items that need attention.",
60
+ inputSchema: {
61
+ type: "object",
62
+ properties: { project: { type: "string", description: "Limit the report to one project." } },
63
+ additionalProperties: false,
64
+ },
65
+ effect: "read",
66
+ async execute(input, context) {
67
+ try {
68
+ const project = typeof input.project === "string" ? input.project : undefined;
69
+ return await coordinator.statusTool(context.workspace, project);
70
+ }
71
+ catch (error) {
72
+ return failure(error);
73
+ }
74
+ },
75
+ });
76
+ api.tools.register({
77
+ name: "swarm_task_new",
78
+ description: "Create a task card in an open swarm project and queue it for the first role.",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ project: { type: "string", description: "Open project name." },
83
+ text: { type: "string", description: "Task description." },
84
+ name: { type: "string", description: "Optional task slug." },
85
+ },
86
+ required: ["project", "text"],
87
+ additionalProperties: false,
88
+ },
89
+ effect: "write",
90
+ async execute(input, context) {
91
+ try {
92
+ if (typeof input.project !== "string" || typeof input.text !== "string") {
93
+ throw new Error("project and text are required");
94
+ }
95
+ const name = typeof input.name === "string" ? input.name : undefined;
96
+ coordinator.touch(context.session);
97
+ return text(await coordinator.createTask(context.workspace, input.project, input.text, name));
98
+ }
99
+ catch (error) {
100
+ return failure(error);
101
+ }
102
+ },
103
+ });
104
+ api.tools.register({
105
+ name: "swarm_gate_run",
106
+ description: "Run one quality gate (tests-green, test-first, coverage, crap, dry, mutation, structure, acceptance) for a role of an open swarm project and return the structured report.",
107
+ inputSchema: {
108
+ type: "object",
109
+ properties: {
110
+ project: { type: "string", description: "Open project name." },
111
+ role: { type: "string", description: "Pack role whose working directory is checked." },
112
+ gate: { type: "string", description: "Gate name." },
113
+ task: {
114
+ type: "string",
115
+ description: "Optional task name: gates that diff against the role's base commit use it.",
116
+ },
117
+ },
118
+ required: ["project", "role", "gate"],
119
+ additionalProperties: false,
120
+ },
121
+ effect: "process",
122
+ async execute(input, context) {
123
+ try {
124
+ if (typeof input.project !== "string" ||
125
+ typeof input.role !== "string" ||
126
+ typeof input.gate !== "string") {
127
+ throw new Error("project, role and gate are required");
128
+ }
129
+ coordinator.touch(context.session);
130
+ return text(await coordinator.gateRun(context.workspace, {
131
+ project: input.project,
132
+ role: input.role,
133
+ gate: input.gate,
134
+ ...(typeof input.task === "string" ? { task: input.task } : {}),
135
+ }));
136
+ }
137
+ catch (error) {
138
+ return failure(error);
139
+ }
140
+ },
141
+ });
142
+ api.tools.register({
143
+ name: "swarm_doctor",
144
+ description: "Check that git, Node.js, toolchain commands and the workspace are ready for a swarm.",
145
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
146
+ effect: "process",
147
+ async execute(_input, context) {
148
+ try {
149
+ return text(await coordinator.doctor(context.workspace));
150
+ }
151
+ catch (error) {
152
+ return failure(error);
153
+ }
154
+ },
155
+ });
156
+ return coordinator;
157
+ }
158
+ /**
159
+ * Fail-open fallbacks for hosts that offer them: a `ui.panel` tree (projects, roles, tasks) and
160
+ * the `swarm-board` data view that returns the dashboard state. Absence or failure changes nothing.
161
+ */
162
+ function registerFallbacks(api, coordinator) {
163
+ try {
164
+ api.ui?.panel?.("swarm", {
165
+ title: "Swarm",
166
+ nodes: ({ sessionId }) => {
167
+ try {
168
+ return panelNodes(coordinator.forgeFor(api.sessions.workspace(sessionId)));
169
+ }
170
+ catch {
171
+ return [];
172
+ }
173
+ },
174
+ });
175
+ }
176
+ catch {
177
+ // The panel is optional: the dashboard and the commands carry the same information.
178
+ }
179
+ try {
180
+ api.views?.register({
181
+ id: "swarm-board",
182
+ description: "Swarm board, attention items and work queue as JSON.",
183
+ handler: async (_params, context) => coordinator.services.state(context.workspace),
184
+ });
185
+ }
186
+ catch {
187
+ // Views are optional.
188
+ }
189
+ }
190
+ let active;
191
+ const plugin = definePlugin({
192
+ id: "swarm",
193
+ name: "Swarm",
194
+ description: "Runs a handoff-driven pipeline of specialised agents, each in its own git worktree, with durable handoffs and human gates.",
195
+ categories: ["methodology-harness"],
196
+ version: VERSION,
197
+ apiVersion: 1,
198
+ setup(api) {
199
+ active = registerSwarm(api);
200
+ },
201
+ async dispose() {
202
+ await active?.dispose();
203
+ active = undefined;
204
+ },
205
+ });
206
+ export default plugin;
207
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAmC,MAAM,aAAa,CAAC;AACjG,OAAO,EAA2B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCA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{
2
+ /** Roles running at once, below the host's subagent limits. */
3
+ maxConcurrent: number;
4
+ /** Per-role overrides (`pluginOverrides.swarm.options.roles.<role>.model`). */
5
+ roles: Record<string, {
6
+ model?: string;
7
+ }>;
8
+ /** Soft cap on total tokens across the swarm (`options.tokenBudget`); absent means unlimited. */
9
+ tokenBudget?: number;
10
+ }
11
+ /** Lenient: an invalid option falls back to its default instead of breaking startup. */
12
+ export declare function parseOptions(raw: unknown): SwarmOptions;
13
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,iGAAiG;IACjG,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAoBvD"}
@@ -0,0 +1,27 @@
1
+ import { rolePattern } from "./domain/identifiers.js";
2
+ const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
3
+ /** Lenient: an invalid option falls back to its default instead of breaking startup. */
4
+ export function parseOptions(raw) {
5
+ const options = { maxConcurrent: 3, roles: {} };
6
+ if (!isRecord(raw))
7
+ return options;
8
+ const cap = raw.maxConcurrent;
9
+ if (typeof cap === "number" && Number.isInteger(cap) && cap >= 1 && cap <= 8) {
10
+ options.maxConcurrent = cap;
11
+ }
12
+ const budget = raw.tokenBudget;
13
+ if (typeof budget === "number" && Number.isInteger(budget) && budget >= 1000) {
14
+ options.tokenBudget = budget;
15
+ }
16
+ if (isRecord(raw.roles)) {
17
+ for (const [role, value] of Object.entries(raw.roles)) {
18
+ if (!rolePattern.test(role) || !isRecord(value))
19
+ continue;
20
+ const model = value.model;
21
+ options.roles[role] =
22
+ typeof model === "string" && model.length > 0 && model.length <= 200 ? { model } : {};
23
+ }
24
+ }
25
+ return options;
26
+ }
27
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAWtD,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,wFAAwF;AACxF,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,MAAM,OAAO,GAAiB,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC9D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IACnC,MAAM,GAAG,GAAG,GAAG,CAAC,aAAa,CAAC;IAC9B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QAC7E,OAAO,CAAC,aAAa,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC;IAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QAC7E,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC;IAC/B,CAAC;IACD,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,SAAS;YAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;gBACjB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { PanelNode } from "@alisio/sdk";
2
+ import type { Forge } from "./app/forge.js";
3
+ /** The `ui.panel` tree (projects, roles, tasks) of the running projects. Synchronous by contract. */
4
+ export declare function panelNodes(forge: Forge): PanelNode[];
5
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../src/panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAuD5C,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAEpD"}
package/dist/panel.js ADDED
@@ -0,0 +1,52 @@
1
+ import { roleIds } from "./domain/pack.js";
2
+ const COLORS = {
3
+ queued: "gray",
4
+ working: "blue",
5
+ waiting_approval: "yellow",
6
+ rejected: "red",
7
+ merging: "cyan",
8
+ clarifying: "yellow",
9
+ blocked: "red",
10
+ done: "green",
11
+ };
12
+ const projectNodes = (runtime) => {
13
+ const projectId = `project:${runtime.name}`;
14
+ const nodes = [
15
+ {
16
+ id: projectId,
17
+ label: runtime.name,
18
+ color: "green",
19
+ status: "running",
20
+ detail: `${runtime.pack.name}: ${roleIds(runtime.pack).join(" > ")}`,
21
+ },
22
+ ];
23
+ const active = runtime.activeRoles();
24
+ const tasks = runtime.board().tasks;
25
+ for (const role of roleIds(runtime.pack)) {
26
+ const roleId = `${projectId}:role:${role}`;
27
+ const live = active.has(role);
28
+ nodes.push({
29
+ id: roleId,
30
+ parentId: projectId,
31
+ label: role,
32
+ color: live ? "green" : "gray",
33
+ status: live ? "live" : "idle",
34
+ });
35
+ for (const card of tasks.filter((candidate) => candidate.lane === role && candidate.status !== "done")) {
36
+ nodes.push({
37
+ id: `${projectId}:task:${card.name}`,
38
+ parentId: roleId,
39
+ label: card.name,
40
+ color: COLORS[card.status],
41
+ status: card.status,
42
+ detail: `audits ${card.auditCount}`,
43
+ });
44
+ }
45
+ }
46
+ return nodes;
47
+ };
48
+ /** The `ui.panel` tree (projects, roles, tasks) of the running projects. Synchronous by contract. */
49
+ export function panelNodes(forge) {
50
+ return forge.runningRuntimes().flatMap(projectNodes);
51
+ }
52
+ //# sourceMappingURL=panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.js","sourceRoot":"","sources":["../src/panel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,MAAM,GAA+B;IACzC,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,gBAAgB,EAAE,QAAQ;IAC1B,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAAuB,EAAe,EAAE;IAC5D,MAAM,SAAS,GAAG,WAAW,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAgB;QACzB;YACE,EA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E,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,UAAU,IAAI,CAAC,UAAU,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,qGAAqG;AACrG,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,OAAO,KAAK,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,51 @@
1
+ /** Runs one agent turn for a role. v1's real adapter is an Alisio child session (Phase 3). */
2
+ export interface RunRequest {
3
+ /** Stable key of the long-lived conversation: one per project and role, reused across prompts. */
4
+ sessionKey: string;
5
+ project: string;
6
+ role: string;
7
+ /** The pack's agent definition id (its `.agents/agents` file). */
8
+ agent: string;
9
+ /** Working directory of the role: its git worktree, or the main checkout for the master role. */
10
+ workdir: string;
11
+ prompt: string;
12
+ signal?: AbortSignal;
13
+ }
14
+ export interface RunResult {
15
+ status: "completed" | "failed" | "cancelled";
16
+ text: string;
17
+ /** The child hit its turn limit: `text` is partial and must be rejected. */
18
+ turnsExceeded?: boolean;
19
+ error?: string;
20
+ /** Tokens the run consumed, when the host reports them (feeds the swarm token budget). */
21
+ usage?: {
22
+ input: number;
23
+ output: number;
24
+ };
25
+ }
26
+ /** One line of the plugin-recorded activity of a role (the SDK exposes no transcript API). */
27
+ export interface TailEntry {
28
+ at: string;
29
+ kind: "prompt" | "reply";
30
+ text: string;
31
+ }
32
+ /** A read-only view of a role's conversation for observability (dashboard tail, work queue). */
33
+ export interface RunnerView {
34
+ /** The host child session id, when the adapter has one. */
35
+ sessionId?: string;
36
+ /** A run is in flight right now. */
37
+ live: boolean;
38
+ /** Runs started in the last ten minutes: the activity meter of the work queue. */
39
+ recentRuns: number;
40
+ tail: TailEntry[];
41
+ }
42
+ export interface AgentRunner {
43
+ run(request: RunRequest): Promise<RunResult>;
44
+ /** Cancel every running conversation of a project (close, teardown). */
45
+ cancelProject(project: string): void;
46
+ /** Cancel every running conversation (teardown, dispose). */
47
+ cancelAll?(): void;
48
+ /** Observability only: undefined when the role has no conversation yet. */
49
+ inspect?(sessionKey: string): RunnerView | undefined;
50
+ }
51
+ //# sourceMappingURL=agent-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../src/ports/agent-runner.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,WAAW,UAAU;IACzB,kGAAkG;IAClG,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED,8FAA8F;AAC9F,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gGAAgG;AAChG,MAAM,WAAW,UAAU;IACzB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7C,wEAAwE;IACxE,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,6DAA6D;IAC7D,SAAS,CAAC,IAAI,IAAI,CAAC;IACnB,2EAA2E;IAC3E,OAAO,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;CACtD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/ports/agent-runner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { Board } from "../domain/task.js";
2
+ export interface BoardStore {
3
+ /** `undefined` when no board was ever written. Throws when the file is corrupt. */
4
+ read(): Promise<Board | undefined>;
5
+ write(board: Board): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=board-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-store.d.ts","sourceRoot":"","sources":["../../src/ports/board-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,IAAI,IAAI,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACnC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=board-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-store.js","sourceRoot":"","sources":["../../src/ports/board-store.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export interface Clock {
2
+ now(): Date;
3
+ }
4
+ export declare const systemClock: Clock;
5
+ //# sourceMappingURL=clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,IAAI,CAAC;CACb;AAED,eAAO,MAAM,WAAW,EAAE,KAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const systemClock = { now: () => new Date() };
2
+ //# sourceMappingURL=clock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAU,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { GateName, Thresholds } from "../domain/pack.js";
2
+ export interface GateRequest {
3
+ project: string;
4
+ task: string;
5
+ role: string;
6
+ gate: GateName;
7
+ workdir: string;
8
+ /** Toolchain profile id (from the pack). */
9
+ toolchain: string;
10
+ /** Pack thresholds: gates never hard-code them. */
11
+ thresholds: Thresholds;
12
+ /** Commit the role started from: gates look at the diff `since..HEAD`. */
13
+ since?: string;
14
+ signal?: AbortSignal;
15
+ }
16
+ export interface GateReport {
17
+ gate: GateName;
18
+ passed: boolean;
19
+ /** Human-readable findings handed back to the role when the gate fails. */
20
+ findings: string[];
21
+ /** Why the gate did not run a check (for example no deterministic checker exists yet). */
22
+ skipped?: string;
23
+ /** The gate could not run at all (missing tool, unparseable report): a human must look. */
24
+ error?: string;
25
+ timedOut?: boolean;
26
+ durationMs?: number;
27
+ }
28
+ /** Deterministic quality gate runner (spec AD-6). */
29
+ export interface GateRunner {
30
+ run(request: GateRequest): Promise<GateReport>;
31
+ /** Stop gate processes that are still running, optionally only those under a directory. */
32
+ cancelAll?(under?: string): void;
33
+ }
34
+ //# sourceMappingURL=gate-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate-runner.d.ts","sourceRoot":"","sources":["../../src/ports/gate-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,UAAU,EAAE,UAAU,CAAC;IACvB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qDAAqD;AACrD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,2FAA2F;IAC3F,SAAS,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gate-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate-runner.js","sourceRoot":"","sources":["../../src/ports/gate-runner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import type { Handoff, HandoffLocation, InboxBox, StoredHandoff } from "../domain/handoff.js";
2
+ export interface ScanResult {
3
+ records: StoredHandoff[];
4
+ /** Files that failed strict revalidation (relative to the store root). */
5
+ invalid: string[];
6
+ }
7
+ export interface RecoveryResult {
8
+ redelivered: number;
9
+ requeued: number;
10
+ }
11
+ /** Durable, file-based handoff queue. Files are the source of truth for crash recovery. */
12
+ export interface HandoffStore {
13
+ ensureRoles(roles: string[]): Promise<void>;
14
+ /** Write a new handoff at a location, allocating its sequence number and file name. */
15
+ write(handoff: Handoff, location: HandoffLocation): Promise<StoredHandoff>;
16
+ /** Move a handoff to another location, optionally rewriting its header fields. */
17
+ move(stored: StoredHandoff, to: HandoffLocation, patch?: Partial<Pick<Handoff, "approved" | "completedAt" | "dequeuedAt" | "enqueuedAt">>): Promise<StoredHandoff>;
18
+ /** Remove a handoff file (used for superseded audit parkings). Missing files are ignored. */
19
+ discard(stored: StoredHandoff): Promise<void>;
20
+ /** Outbox -> sent, with a copy in every recipient's `inbox/new`. Idempotent. */
21
+ deliver(stored: StoredHandoff): Promise<StoredHandoff[]>;
22
+ /** Phantom-sender handoffs go straight to the recipients' `inbox/new`. */
23
+ inject(handoff: Handoff): Promise<StoredHandoff[]>;
24
+ /** Move the next inbox item (or all equal-priority items of the same task for `batch`) to `in_process`. */
25
+ claim(role: string, options?: {
26
+ batch?: boolean;
27
+ }): Promise<StoredHandoff[]>;
28
+ /** Move claimed items to `completed`. */
29
+ complete(items: StoredHandoff[]): Promise<StoredHandoff[]>;
30
+ /** Remove every file of one task everywhere (task deletion); returns what was removed. */
31
+ purge(taskId: string): Promise<StoredHandoff[]>;
32
+ scan(): Promise<ScanResult>;
33
+ /** Replay after a crash: redeliver outbox items, requeue `in_process` items. */
34
+ recover(): Promise<RecoveryResult>;
35
+ /** Count items waiting in a role's `inbox/new`. */
36
+ pending(role: string): Promise<number>;
37
+ }
38
+ export type { InboxBox };
39
+ //# sourceMappingURL=handoff-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff-store.d.ts","sourceRoot":"","sources":["../../src/ports/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AAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC3D,0FAA0F;IAC1F,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAChD,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B,gFAAgF;IAChF,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC,mDAAmD;IACnD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=handoff-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff-store.js","sourceRoot":"","sources":["../../src/ports/handoff-store.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ export interface MergeResult {
2
+ /** `already` = the commit was an ancestor; `merged` = a merge ran cleanly. */
3
+ status: "already" | "merged" | "conflict" | "error";
4
+ files?: string[];
5
+ message?: string;
6
+ }
7
+ export interface RolePlacement {
8
+ role: string;
9
+ master: boolean;
10
+ }
11
+ /** Filesystem and git isolation for a project: one working directory per role. */
12
+ export interface Isolation {
13
+ /** `git init` on `master` with an initial commit, ignore rules and the commit-msg hook. */
14
+ initProject(projectDir: string, options: {
15
+ mission: string;
16
+ masterRole: string;
17
+ }): Promise<void>;
18
+ /** `git clone`; refuses an existing destination. */
19
+ cloneProject(url: string, projectDir: string, options: {
20
+ masterRole: string;
21
+ }): Promise<void>;
22
+ /** Create (idempotently) the role's working directory and return its absolute path. */
23
+ prepareRole(projectDir: string, project: string, placement: RolePlacement): Promise<string>;
24
+ hasCommit(workdir: string, commit: string): Promise<boolean>;
25
+ /** The ten-character id of HEAD in the working directory. */
26
+ headCommit(workdir: string): Promise<string>;
27
+ merge(workdir: string, commit: string): Promise<MergeResult>;
28
+ /** Abandon a conflicted merge, restoring the working directory. A no-op when none is running. */
29
+ abortMerge(workdir: string): Promise<void>;
30
+ /** Unmerged paths left by a conflicted merge. */
31
+ conflicts(workdir: string): Promise<string[]>;
32
+ /** Point a `refs/swarm/...` ref at a commit (snapshot of rejected work). */
33
+ snapshotRef(workdir: string, ref: string, commit: string): Promise<void>;
34
+ /** Restore the working directory to a commit; refuses when it has uncommitted changes. */
35
+ restoreTo(workdir: string, commit: string): Promise<void>;
36
+ /** Paths changed between two commits (`from` absent: the commit's own changes), relative to the root. */
37
+ changedFiles(workdir: string, from: string | undefined, to: string): Promise<string[]>;
38
+ /** Unified diff between two commits (`from` absent: the commit's own changes). */
39
+ diff(workdir: string, from: string | undefined, to: string): Promise<string>;
40
+ /** Content of a file in a commit, read from the object store (never the working tree); absent when missing. */
41
+ readFileAt(workdir: string, commit: string, path: string): Promise<string | undefined>;
42
+ }
43
+ //# sourceMappingURL=isolation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isolation.d.ts","sourceRoot":"","sources":["../../src/ports/isolation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,WAAW,SAAS;IACxB,2FAA2F;IAC3F,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjG,oDAAoD;IACpD,YAAY,CAAC,GAAG,EAAE,MA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