@openrig/cli 0.4.6 → 0.4.8

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 (472) hide show
  1. package/daemon/assets/guidance/CULTURE-default.md +19 -0
  2. package/daemon/assets/guidance/openrig-start.md +20 -5
  3. package/daemon/assets/plugins/openrig-core/README.md +1 -1
  4. package/daemon/assets/plugins/openrig-core/skills/applying-a-permission-policy/SKILL.md +120 -0
  5. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +9 -6
  6. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +11 -72
  7. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +0 -0
  8. package/daemon/assets/plugins/openrig-core/skills/delegating-work/SKILL.md +43 -0
  9. package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +36 -22
  10. package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +108 -0
  11. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +7 -13
  12. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +88 -0
  13. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +189 -105
  14. package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +26 -9
  15. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +11 -9
  16. package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +162 -0
  17. package/daemon/assets/plugins/openrig-core/skills/software-for-agents/SKILL.md +165 -0
  18. package/daemon/dist/adapters/claude-code-adapter.d.ts +0 -9
  19. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  20. package/daemon/dist/adapters/claude-code-adapter.js +13 -46
  21. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  22. package/daemon/dist/adapters/claude-resume.d.ts +1 -1
  23. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  24. package/daemon/dist/adapters/claude-resume.js +8 -2
  25. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  26. package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
  27. package/daemon/dist/adapters/cmux-transport.js +8 -1
  28. package/daemon/dist/adapters/cmux-transport.js.map +1 -1
  29. package/daemon/dist/adapters/cmux.d.ts +9 -0
  30. package/daemon/dist/adapters/cmux.d.ts.map +1 -1
  31. package/daemon/dist/adapters/cmux.js +21 -0
  32. package/daemon/dist/adapters/cmux.js.map +1 -1
  33. package/daemon/dist/adapters/codex-resume.d.ts +1 -1
  34. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  35. package/daemon/dist/adapters/codex-resume.js +4 -2
  36. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  37. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +3 -0
  38. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  39. package/daemon/dist/adapters/codex-runtime-adapter.js +30 -9
  40. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  41. package/daemon/dist/adapters/pi-resume.d.ts +1 -1
  42. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  43. package/daemon/dist/adapters/pi-resume.js +7 -2
  44. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  45. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  46. package/daemon/dist/adapters/pi-runtime-adapter.js +4 -1
  47. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  48. package/daemon/dist/adapters/yolo-mode.d.ts +23 -0
  49. package/daemon/dist/adapters/yolo-mode.d.ts.map +1 -0
  50. package/daemon/dist/adapters/yolo-mode.js +49 -0
  51. package/daemon/dist/adapters/yolo-mode.js.map +1 -0
  52. package/daemon/dist/build-info.js +3 -3
  53. package/daemon/dist/db/migrations/055_node_permission_policy.d.ts +13 -0
  54. package/daemon/dist/db/migrations/055_node_permission_policy.d.ts.map +1 -0
  55. package/daemon/dist/db/migrations/055_node_permission_policy.js +17 -0
  56. package/daemon/dist/db/migrations/055_node_permission_policy.js.map +1 -0
  57. package/daemon/dist/db/migrations/056_rig_permission_policy.d.ts +13 -0
  58. package/daemon/dist/db/migrations/056_rig_permission_policy.d.ts.map +1 -0
  59. package/daemon/dist/db/migrations/056_rig_permission_policy.js +17 -0
  60. package/daemon/dist/db/migrations/056_rig_permission_policy.js.map +1 -0
  61. package/daemon/dist/db/migrations/057_node_policy_provenance.d.ts +19 -0
  62. package/daemon/dist/db/migrations/057_node_policy_provenance.d.ts.map +1 -0
  63. package/daemon/dist/db/migrations/057_node_policy_provenance.js +26 -0
  64. package/daemon/dist/db/migrations/057_node_policy_provenance.js.map +1 -0
  65. package/daemon/dist/db/migrations/058_rig_policy_provenance.d.ts +15 -0
  66. package/daemon/dist/db/migrations/058_rig_policy_provenance.d.ts.map +1 -0
  67. package/daemon/dist/db/migrations/058_rig_policy_provenance.js +22 -0
  68. package/daemon/dist/db/migrations/058_rig_policy_provenance.js.map +1 -0
  69. package/daemon/dist/domain/builtin-policy-reference.d.ts +13 -0
  70. package/daemon/dist/domain/builtin-policy-reference.d.ts.map +1 -0
  71. package/daemon/dist/domain/builtin-policy-reference.js +58 -0
  72. package/daemon/dist/domain/builtin-policy-reference.js.map +1 -0
  73. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +3 -0
  74. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  75. package/daemon/dist/domain/claude-compaction-enforcer.js +19 -3
  76. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  77. package/daemon/dist/domain/cmux-layout-service.d.ts +36 -0
  78. package/daemon/dist/domain/cmux-layout-service.d.ts.map +1 -1
  79. package/daemon/dist/domain/cmux-layout-service.js +100 -28
  80. package/daemon/dist/domain/cmux-layout-service.js.map +1 -1
  81. package/daemon/dist/domain/context-monitor.d.ts +2 -0
  82. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  83. package/daemon/dist/domain/context-monitor.js +14 -0
  84. package/daemon/dist/domain/context-monitor.js.map +1 -1
  85. package/daemon/dist/domain/feed/attention-aggregator.js +1 -1
  86. package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -1
  87. package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts.map +1 -1
  88. package/daemon/dist/domain/hosts/hosts-registry-reader.js +12 -10
  89. package/daemon/dist/domain/hosts/hosts-registry-reader.js.map +1 -1
  90. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -1
  91. package/daemon/dist/domain/hosts/hosts-registry-writer.js +3 -2
  92. package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -1
  93. package/daemon/dist/domain/hosts/read-through.js +1 -1
  94. package/daemon/dist/domain/hosts/read-through.js.map +1 -1
  95. package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -1
  96. package/daemon/dist/domain/hosts/remote-daemon-http.js +8 -5
  97. package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -1
  98. package/daemon/dist/domain/native-resume-probe.d.ts +1 -1
  99. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  100. package/daemon/dist/domain/native-resume-probe.js +11 -4
  101. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  102. package/daemon/dist/domain/node-inventory.d.ts +3 -12
  103. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  104. package/daemon/dist/domain/node-inventory.js +57 -15
  105. package/daemon/dist/domain/node-inventory.js.map +1 -1
  106. package/daemon/dist/domain/permission-policy/policy-ref.d.ts +89 -0
  107. package/daemon/dist/domain/permission-policy/policy-ref.d.ts.map +1 -0
  108. package/daemon/dist/domain/permission-policy/policy-ref.js +171 -0
  109. package/daemon/dist/domain/permission-policy/policy-ref.js.map +1 -0
  110. package/daemon/dist/domain/permission-policy/policy-spec.d.ts +34 -0
  111. package/daemon/dist/domain/permission-policy/policy-spec.d.ts.map +1 -0
  112. package/daemon/dist/domain/permission-policy/policy-spec.js +106 -0
  113. package/daemon/dist/domain/permission-policy/policy-spec.js.map +1 -0
  114. package/daemon/dist/domain/plugin-vendor-service.d.ts +2 -0
  115. package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -1
  116. package/daemon/dist/domain/plugin-vendor-service.js +23 -0
  117. package/daemon/dist/domain/plugin-vendor-service.js.map +1 -1
  118. package/daemon/dist/domain/projection-lane.d.ts +7 -0
  119. package/daemon/dist/domain/projection-lane.d.ts.map +1 -0
  120. package/daemon/dist/domain/projection-lane.js +28 -0
  121. package/daemon/dist/domain/projection-lane.js.map +1 -0
  122. package/daemon/dist/domain/ps-projection.d.ts +19 -0
  123. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  124. package/daemon/dist/domain/ps-projection.js +46 -6
  125. package/daemon/dist/domain/ps-projection.js.map +1 -1
  126. package/daemon/dist/domain/queue-repository.d.ts +14 -10
  127. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  128. package/daemon/dist/domain/queue-repository.js +33 -12
  129. package/daemon/dist/domain/queue-repository.js.map +1 -1
  130. package/daemon/dist/domain/restore-orchestrator.d.ts +14 -0
  131. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  132. package/daemon/dist/domain/restore-orchestrator.js +90 -6
  133. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  134. package/daemon/dist/domain/review/compose.d.ts +77 -4
  135. package/daemon/dist/domain/review/compose.d.ts.map +1 -1
  136. package/daemon/dist/domain/review/compose.js +152 -16
  137. package/daemon/dist/domain/review/compose.js.map +1 -1
  138. package/daemon/dist/domain/review/fleet-compose.js +1 -1
  139. package/daemon/dist/domain/review/fleet-compose.js.map +1 -1
  140. package/daemon/dist/domain/review/gather.d.ts +1 -1
  141. package/daemon/dist/domain/review/gather.d.ts.map +1 -1
  142. package/daemon/dist/domain/review/gather.js +92 -67
  143. package/daemon/dist/domain/review/gather.js.map +1 -1
  144. package/daemon/dist/domain/review/proof-io.d.ts +2 -0
  145. package/daemon/dist/domain/review/proof-io.d.ts.map +1 -0
  146. package/daemon/dist/domain/review/proof-io.js +38 -0
  147. package/daemon/dist/domain/review/proof-io.js.map +1 -0
  148. package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
  149. package/daemon/dist/domain/rig-expansion-service.js +10 -1
  150. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  151. package/daemon/dist/domain/rig-repository.d.ts +45 -0
  152. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  153. package/daemon/dist/domain/rig-repository.js +75 -1
  154. package/daemon/dist/domain/rig-repository.js.map +1 -1
  155. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  156. package/daemon/dist/domain/rigspec-codec.js +6 -0
  157. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  158. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  159. package/daemon/dist/domain/rigspec-exporter.js +8 -0
  160. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  161. package/daemon/dist/domain/rigspec-instantiator.d.ts +18 -1
  162. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  163. package/daemon/dist/domain/rigspec-instantiator.js +202 -10
  164. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  165. package/daemon/dist/domain/rigspec-preflight.d.ts +11 -0
  166. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  167. package/daemon/dist/domain/rigspec-preflight.js +35 -1
  168. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  169. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  170. package/daemon/dist/domain/rigspec-schema.js +25 -0
  171. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  172. package/daemon/dist/domain/runtime-adapter.d.ts +5 -0
  173. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  174. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  175. package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts +8 -0
  176. package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts.map +1 -0
  177. package/daemon/dist/domain/scope/plan-lock-artifacts.js +57 -0
  178. package/daemon/dist/domain/scope/plan-lock-artifacts.js.map +1 -0
  179. package/daemon/dist/domain/scope/scaffold-placeholder.d.ts +38 -0
  180. package/daemon/dist/domain/scope/scaffold-placeholder.d.ts.map +1 -0
  181. package/daemon/dist/domain/scope/scaffold-placeholder.js +98 -0
  182. package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -0
  183. package/daemon/dist/domain/scope/scope-approve.d.ts.map +1 -1
  184. package/daemon/dist/domain/scope/scope-approve.js +22 -1
  185. package/daemon/dist/domain/scope/scope-approve.js.map +1 -1
  186. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  187. package/daemon/dist/domain/scope/scope-audit.js +57 -20
  188. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  189. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  190. package/daemon/dist/domain/seat-handover-service.js +7 -1
  191. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  192. package/daemon/dist/domain/session-transport.d.ts +17 -0
  193. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  194. package/daemon/dist/domain/session-transport.js +44 -0
  195. package/daemon/dist/domain/session-transport.js.map +1 -1
  196. package/daemon/dist/domain/slices/qitem-membership.d.ts +17 -0
  197. package/daemon/dist/domain/slices/qitem-membership.d.ts.map +1 -0
  198. package/daemon/dist/domain/slices/qitem-membership.js +60 -0
  199. package/daemon/dist/domain/slices/qitem-membership.js.map +1 -0
  200. package/daemon/dist/domain/slices/slice-detail-projector.d.ts +5 -0
  201. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  202. package/daemon/dist/domain/slices/slice-detail-projector.js +157 -11
  203. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  204. package/daemon/dist/domain/slices/slice-indexer.d.ts +86 -0
  205. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  206. package/daemon/dist/domain/slices/slice-indexer.js +422 -45
  207. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  208. package/daemon/dist/domain/startup-orchestrator.d.ts +9 -0
  209. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  210. package/daemon/dist/domain/startup-orchestrator.js +71 -3
  211. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  212. package/daemon/dist/domain/successor-session-launcher.d.ts +4 -0
  213. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  214. package/daemon/dist/domain/successor-session-launcher.js +2 -0
  215. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  216. package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts +12 -11
  217. package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts.map +1 -1
  218. package/daemon/dist/domain/terminal/cmux-provider-adapter.js +61 -28
  219. package/daemon/dist/domain/terminal/cmux-provider-adapter.js.map +1 -1
  220. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +27 -10
  221. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  222. package/daemon/dist/domain/terminal/herdr-adapter.js +74 -33
  223. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  224. package/daemon/dist/domain/transcript-capture.d.ts +3 -0
  225. package/daemon/dist/domain/transcript-capture.d.ts.map +1 -1
  226. package/daemon/dist/domain/transcript-capture.js +28 -0
  227. package/daemon/dist/domain/transcript-capture.js.map +1 -1
  228. package/daemon/dist/domain/transcript-store.d.ts +10 -0
  229. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  230. package/daemon/dist/domain/transcript-store.js +26 -0
  231. package/daemon/dist/domain/transcript-store.js.map +1 -1
  232. package/daemon/dist/domain/types.d.ts +21 -0
  233. package/daemon/dist/domain/types.d.ts.map +1 -1
  234. package/daemon/dist/domain/types.js.map +1 -1
  235. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
  236. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +9 -4
  237. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
  238. package/daemon/dist/domain/workspace/workspace-doctor.js +1 -1
  239. package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -1
  240. package/daemon/dist/routes/agent-images.d.ts.map +1 -1
  241. package/daemon/dist/routes/agent-images.js +2 -0
  242. package/daemon/dist/routes/agent-images.js.map +1 -1
  243. package/daemon/dist/routes/mission-control.js +1 -1
  244. package/daemon/dist/routes/mission-control.js.map +1 -1
  245. package/daemon/dist/routes/missions.d.ts +7 -0
  246. package/daemon/dist/routes/missions.d.ts.map +1 -1
  247. package/daemon/dist/routes/missions.js +6 -1
  248. package/daemon/dist/routes/missions.js.map +1 -1
  249. package/daemon/dist/routes/ps.d.ts.map +1 -1
  250. package/daemon/dist/routes/ps.js +5 -1
  251. package/daemon/dist/routes/ps.js.map +1 -1
  252. package/daemon/dist/routes/queue.d.ts.map +1 -1
  253. package/daemon/dist/routes/queue.js +9 -2
  254. package/daemon/dist/routes/queue.js.map +1 -1
  255. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  256. package/daemon/dist/routes/rigs.js +29 -10
  257. package/daemon/dist/routes/rigs.js.map +1 -1
  258. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  259. package/daemon/dist/routes/scope-audit.js +141 -135
  260. package/daemon/dist/routes/scope-audit.js.map +1 -1
  261. package/daemon/dist/routes/sessions.js +2 -1
  262. package/daemon/dist/routes/sessions.js.map +1 -1
  263. package/daemon/dist/routes/slices.d.ts.map +1 -1
  264. package/daemon/dist/routes/slices.js +48 -38
  265. package/daemon/dist/routes/slices.js.map +1 -1
  266. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  267. package/daemon/dist/routes/transcripts.js +62 -33
  268. package/daemon/dist/routes/transcripts.js.map +1 -1
  269. package/daemon/dist/startup.d.ts.map +1 -1
  270. package/daemon/dist/startup.js +42 -12
  271. package/daemon/dist/startup.js.map +1 -1
  272. package/daemon/docs/reference/agent-startup-guide.md +1 -0
  273. package/daemon/docs/reference/rig-spec.md +19 -0
  274. package/daemon/policies/builtin/locked.policy.md +24 -0
  275. package/daemon/policies/builtin/open.policy.md +24 -0
  276. package/daemon/policies/builtin/standard.policy.md +25 -0
  277. package/daemon/policies/builtin/yolo.policy.md +20 -0
  278. package/daemon/policies/examples/my-cautious-dev.policy.md +40 -0
  279. package/daemon/specs/agents/apps/vault-specialist/agent.yaml +2 -1
  280. package/daemon/specs/agents/conveyor/builder/agent.yaml +2 -1
  281. package/daemon/specs/agents/conveyor/lead/agent.yaml +2 -1
  282. package/daemon/specs/agents/conveyor/planner/agent.yaml +2 -1
  283. package/daemon/specs/agents/conveyor/reviewer/agent.yaml +2 -1
  284. package/daemon/specs/agents/design/product-designer/agent.yaml +12 -2
  285. package/daemon/specs/agents/development/implementer/agent.yaml +12 -2
  286. package/daemon/specs/agents/development/qa/agent.yaml +12 -2
  287. package/daemon/specs/agents/development/qa/guidance/role.md +1 -0
  288. package/daemon/specs/agents/factory-rsi/dogfood/agent.yaml +2 -1
  289. package/daemon/specs/agents/factory-rsi/release-manager/agent.yaml +2 -1
  290. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +12 -2
  291. package/daemon/specs/agents/product-management/pm/agent.yaml +1 -2
  292. package/daemon/specs/agents/research/analyst/agent.yaml +2 -1
  293. package/daemon/specs/agents/research/synthesizer/agent.yaml +2 -1
  294. package/daemon/specs/agents/review/independent-reviewer/agent.yaml +12 -2
  295. package/daemon/specs/agents/shared/agent.yaml +5 -8
  296. package/daemon/specs/agents/shared/runtime/claude-settings.fragment.json +1 -8
  297. package/daemon/specs/agents/shared/skills/core/agent-starters/SKILL.md +132 -0
  298. package/daemon/{assets/plugins/openrig-core/skills → specs/agents/shared/skills/core}/agent-startup-and-context-ingestion/SKILL.md +27 -19
  299. package/daemon/specs/agents/shared/skills/core/attention-queue/SKILL.md +264 -0
  300. package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +190 -0
  301. package/daemon/specs/agents/shared/skills/core/human-in-the-loop/SKILL.md +104 -0
  302. package/daemon/specs/agents/shared/skills/core/openrig-architect/SKILL.md +23 -8
  303. package/daemon/specs/agents/shared/skills/core/openrig-cmux/SKILL.md +0 -5
  304. package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +1 -6
  305. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +460 -0
  306. package/daemon/specs/agents/shared/skills/core/rig-bundles-and-shareable-artifacts/SKILL.md +101 -0
  307. package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +22 -11
  308. package/daemon/specs/agents/shared/skills/core/session-source-fork/SKILL.md +160 -0
  309. package/daemon/specs/agents/shared/skills/core/specification-system/SKILL.md +103 -0
  310. package/daemon/specs/agents/shared/skills/core/topology-mutation-and-seat-management/SKILL.md +118 -0
  311. package/daemon/specs/agents/shared/skills/core/watchdog/SKILL.md +125 -0
  312. package/daemon/specs/agents/shared/skills/process/brainstorming/OPENRIG.md +3 -3
  313. package/daemon/specs/agents/shared/skills/process/executing-plans/OPENRIG.md +1 -1
  314. package/daemon/specs/agents/shared/skills/process/frontend-design/SKILL.md +6 -3
  315. package/daemon/specs/agents/shared/skills/process/systematic-debugging/find-polluter.sh +0 -0
  316. package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +1 -1
  317. package/daemon/specs/agents/shared/skills/process/using-superpowers/OPENRIG.md +1 -1
  318. package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +13 -2
  319. package/daemon/specs/agents/shared/skills/process/writing-plans/OPENRIG.md +1 -1
  320. package/daemon/specs/rigs/focused/pm-team/CULTURE.md +1 -1
  321. package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/agent.yaml +2 -2
  322. package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/guidance/role.md +5 -4
  323. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/agent.yaml +2 -2
  324. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +3 -5
  325. package/daemon/specs/rigs/launch/kernel/agents/queue/worker/agent.yaml +2 -2
  326. package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +3 -4
  327. package/daemon/specs/rigs/preview/product-team/CULTURE.md +1 -1
  328. package/dist/bin-wrapper.d.ts.map +1 -1
  329. package/dist/bin-wrapper.js +3 -1
  330. package/dist/bin-wrapper.js.map +1 -1
  331. package/dist/build-info.js +3 -3
  332. package/dist/cli-error.d.ts +33 -0
  333. package/dist/cli-error.d.ts.map +1 -0
  334. package/dist/cli-error.js +94 -0
  335. package/dist/cli-error.js.map +1 -0
  336. package/dist/commands/config-init-workspace.js +1 -1
  337. package/dist/commands/doctor.d.ts +1 -1
  338. package/dist/commands/doctor.d.ts.map +1 -1
  339. package/dist/commands/doctor.js +17 -11
  340. package/dist/commands/doctor.js.map +1 -1
  341. package/dist/commands/host.d.ts.map +1 -1
  342. package/dist/commands/host.js +24 -10
  343. package/dist/commands/host.js.map +1 -1
  344. package/dist/commands/proof.js +1 -1
  345. package/dist/commands/proof.js.map +1 -1
  346. package/dist/commands/ps.d.ts.map +1 -1
  347. package/dist/commands/ps.js +16 -2
  348. package/dist/commands/ps.js.map +1 -1
  349. package/dist/commands/queue.d.ts.map +1 -1
  350. package/dist/commands/queue.js +103 -24
  351. package/dist/commands/queue.js.map +1 -1
  352. package/dist/commands/rig.d.ts.map +1 -1
  353. package/dist/commands/rig.js +122 -0
  354. package/dist/commands/rig.js.map +1 -1
  355. package/dist/commands/scope.js +2 -2
  356. package/dist/commands/scope.js.map +1 -1
  357. package/dist/commands/send.d.ts.map +1 -1
  358. package/dist/commands/send.js +118 -24
  359. package/dist/commands/send.js.map +1 -1
  360. package/dist/commands/setup.d.ts +14 -0
  361. package/dist/commands/setup.d.ts.map +1 -1
  362. package/dist/commands/setup.js +131 -8
  363. package/dist/commands/setup.js.map +1 -1
  364. package/dist/commands/slack.d.ts +37 -0
  365. package/dist/commands/slack.d.ts.map +1 -0
  366. package/dist/commands/slack.js +274 -0
  367. package/dist/commands/slack.js.map +1 -0
  368. package/dist/commands/ui.d.ts +1 -0
  369. package/dist/commands/ui.d.ts.map +1 -1
  370. package/dist/commands/ui.js +2 -0
  371. package/dist/commands/ui.js.map +1 -1
  372. package/dist/commands/up.js +1 -1
  373. package/dist/commands/up.js.map +1 -1
  374. package/dist/commands/whoami.d.ts.map +1 -1
  375. package/dist/commands/whoami.js +3 -3
  376. package/dist/commands/whoami.js.map +1 -1
  377. package/dist/daemon-lifecycle.d.ts.map +1 -1
  378. package/dist/daemon-lifecycle.js +45 -14
  379. package/dist/daemon-lifecycle.js.map +1 -1
  380. package/dist/host-registry.d.ts +6 -1
  381. package/dist/host-registry.d.ts.map +1 -1
  382. package/dist/host-registry.js +15 -6
  383. package/dist/host-registry.js.map +1 -1
  384. package/dist/index.d.ts +3 -0
  385. package/dist/index.d.ts.map +1 -1
  386. package/dist/index.js +6 -1
  387. package/dist/index.js.map +1 -1
  388. package/dist/lib/scope/scaffold-placeholder.d.ts +38 -0
  389. package/dist/lib/scope/scaffold-placeholder.d.ts.map +1 -0
  390. package/dist/lib/scope/scaffold-placeholder.js +98 -0
  391. package/dist/lib/scope/scaffold-placeholder.js.map +1 -0
  392. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  393. package/dist/lib/scope/scope-audit.js +57 -20
  394. package/dist/lib/scope/scope-audit.js.map +1 -1
  395. package/dist/lib/scope-templates/backlog-deprecation.md +1 -1
  396. package/dist/lib/scope-templates/backlog-tech-debt.md +1 -1
  397. package/dist/lib/scope-templates/bug-fix.md +1 -1
  398. package/dist/lib/scope-templates/implementation-prd.md +1 -1
  399. package/dist/lib/scope-templates/mission-notes.md +7 -2
  400. package/dist/lib/scope-templates/mission-placeholder.md +1 -1
  401. package/dist/lib/scope-templates/mission-progress.md +1 -1
  402. package/dist/lib/scope-templates/mission-release.md +1 -1
  403. package/dist/lib/scope-templates/placeholder.md +1 -1
  404. package/dist/lib/scope-templates/proof.md +1 -1
  405. package/dist/lib/scope-templates/release-feature.md +1 -1
  406. package/dist/lib/scope-templates/research.md +1 -1
  407. package/dist/lib/scope-templates/slice-progress.md +1 -1
  408. package/dist/remote-host-ops.d.ts.map +1 -1
  409. package/dist/remote-host-ops.js +2 -2
  410. package/dist/remote-host-ops.js.map +1 -1
  411. package/dist/slack/config.d.ts +41 -0
  412. package/dist/slack/config.d.ts.map +1 -0
  413. package/dist/slack/config.js +60 -0
  414. package/dist/slack/config.js.map +1 -0
  415. package/dist/slack/inbound.d.ts +75 -0
  416. package/dist/slack/inbound.d.ts.map +1 -0
  417. package/dist/slack/inbound.js +133 -0
  418. package/dist/slack/inbound.js.map +1 -0
  419. package/dist/slack/message.d.ts +26 -0
  420. package/dist/slack/message.d.ts.map +1 -0
  421. package/dist/slack/message.js +60 -0
  422. package/dist/slack/message.js.map +1 -0
  423. package/dist/slack/outbound.d.ts +39 -0
  424. package/dist/slack/outbound.d.ts.map +1 -0
  425. package/dist/slack/outbound.js +52 -0
  426. package/dist/slack/outbound.js.map +1 -0
  427. package/dist/slack/queue-bridge.d.ts +56 -0
  428. package/dist/slack/queue-bridge.d.ts.map +1 -0
  429. package/dist/slack/queue-bridge.js +114 -0
  430. package/dist/slack/queue-bridge.js.map +1 -0
  431. package/dist/slack/secrets.d.ts +21 -0
  432. package/dist/slack/secrets.d.ts.map +1 -0
  433. package/dist/slack/secrets.js +73 -0
  434. package/dist/slack/secrets.js.map +1 -0
  435. package/dist/slack/slack-api.d.ts +49 -0
  436. package/dist/slack/slack-api.d.ts.map +1 -0
  437. package/dist/slack/slack-api.js +110 -0
  438. package/dist/slack/slack-api.js.map +1 -0
  439. package/dist/slack/state-store.d.ts +62 -0
  440. package/dist/slack/state-store.d.ts.map +1 -0
  441. package/dist/slack/state-store.js +132 -0
  442. package/dist/slack/state-store.js.map +1 -0
  443. package/package.json +1 -1
  444. package/ui/dist/assets/{index-zrFqS7gL.js → index-DkNi0RT8.js} +184 -184
  445. package/ui/dist/assets/index-N-SdPj-I.css +32 -0
  446. package/ui/dist/index.html +2 -2
  447. package/daemon/assets/plugins/openrig-core/skills/openrig-architect/SKILL.md +0 -361
  448. package/daemon/assets/plugins/openrig-core/skills/openrig-cmux/SKILL.md +0 -86
  449. package/daemon/assets/plugins/openrig-core/skills/openrig-herdr/SKILL.md +0 -158
  450. package/daemon/assets/plugins/openrig-core/skills/openrig-operator/SKILL.md +0 -222
  451. package/daemon/docs/reference/product-factory-vps-runbook.md +0 -132
  452. package/daemon/specs/agents/shared/skills/core/mission-slice-sop/SKILL.md +0 -113
  453. package/daemon/specs/agents/shared/skills/core/openrig-installer/SKILL.md +0 -142
  454. package/daemon/specs/agents/shared/skills/core/openrig-operator/SKILL.md +0 -110
  455. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +0 -1245
  456. package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +0 -153
  457. package/daemon/specs/agents/shared/skills/pm/backlog-capture/SKILL.md +0 -43
  458. package/daemon/specs/agents/shared/skills/pm/context-builder/SKILL.md +0 -87
  459. package/daemon/specs/agents/shared/skills/pm/exec-summary/SKILL.md +0 -84
  460. package/daemon/specs/agents/shared/skills/pm/office-hours/SKILL.md +0 -129
  461. package/daemon/specs/agents/shared/skills/pm/plan-review/SKILL.md +0 -98
  462. package/daemon/specs/agents/shared/skills/pm/requirements-writer/SKILL.md +0 -113
  463. package/daemon/specs/agents/shared/skills/pm/ui-mockup/SKILL.md +0 -76
  464. package/daemon/specs/agents/shared/skills/pods/development-team/SKILL.md +0 -148
  465. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +0 -266
  466. package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +0 -210
  467. package/daemon/specs/agents/shared/skills/process/systematic-debugging/CREATION-LOG.md +0 -119
  468. package/daemon/specs/agents/shared/skills/process/systematic-debugging/test-academic.md +0 -14
  469. package/daemon/specs/agents/shared/skills/process/systematic-debugging/test-pressure-1.md +0 -58
  470. package/daemon/specs/agents/shared/skills/process/systematic-debugging/test-pressure-2.md +0 -68
  471. package/daemon/specs/agents/shared/skills/process/systematic-debugging/test-pressure-3.md +0 -69
  472. package/ui/dist/assets/index-CFqxa0zW.css +0 -32
@@ -71,8 +71,13 @@ restore-needs evolve.)
71
71
  2. Read this file's §1 + your §A-§X section + this §9
72
72
  3. Read `missions/{{mission_id}}/README.md` for mission scope
73
73
  4. Read `missions/{{mission_id}}/PROGRESS.md` for delivery state
74
- 5. `rig queue list --destination <your-session>` — your durable inbox
75
- 6. State "restored from {{mission_id}}; resumed at <action>" before acting
74
+ 5. `rig queue list --mine --full --json` triage your durable inbox from full
75
+ bodies; use `rig queue show <id> --full --json` for individual items. Never
76
+ use the bare compact queue list for triage.
77
+ 6. Optionally check `rig transcript <your-session> --tail 100` as secondary
78
+ evidence. It may be unavailable or incomplete for some runtimes; little or
79
+ no output does not prove the session was quiet.
80
+ 7. State "restored from {{mission_id}}; resumed at <action>" before acting
76
81
 
77
82
  ## §10. What NOT to reconstruct
78
83
 
@@ -24,7 +24,7 @@ created: {{created_date}}
24
24
 
25
25
  ## Mission/Slice SOP — how you work this mission & slice
26
26
 
27
- > The canonical files below are the **operating surface of the work** — you track on them, prove on them, hand off through them, and survive compaction on them. They are NOT side-artifacts to "maintain"; keeping them current *is* the work. Load the `mission-slice-sop` skill for the full operating procedure. **Conventions SSOT: `docs/reference/sdlc-conventions.md`** — the slice section names (`## Intent` / `## Mini-requirements` / `## Proof contract`), the proof-contract format, the two locks (`rig scope slice approve --scope spec|delivery`), and the C1 proof headers all live there.
27
+ > The canonical files below are the **operating surface of the work** — you track on them, prove on them, hand off through them, and survive compaction on them. They are NOT side-artifacts to "maintain"; keeping them current *is* the work. Load the `mission-slice-sop` skill for the full operating procedure. **Conventions SSOT: `docs/reference/sdlc-conventions.md`** (installed: `$OPENRIG_HOME/reference/sdlc-conventions.md`) — the slice section names (`## Intent` / `## Mini-requirements` / `## Proof contract`), the proof-contract format, the two locks (`rig scope slice approve --scope spec|delivery`), and the C1 proof headers all live there.
28
28
 
29
29
  ### The canonical files (the operating surface)
30
30
 
@@ -1,6 +1,6 @@
1
1
  # Progress — {{missionName}}
2
2
 
3
- > **WHO/WHEN:** the orchestrator owns the current-state summary; every agent logs its own outcomes here after every slice-done AND every commit. One line per outcome, link down for detail. See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md`).
3
+ > **WHO/WHEN:** the orchestrator owns the current-state summary; every agent logs its own outcomes here after every slice-done AND every commit. One line per outcome, link down for detail. See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md` in the repo, `$OPENRIG_HOME/reference/sdlc-conventions.md` on an installed package).
4
4
 
5
5
  ## Milestones
6
6
 
@@ -29,7 +29,7 @@ created: {{created_date}}
29
29
 
30
30
  ## Mission/Slice SOP — how you work this mission & slice
31
31
 
32
- > The canonical files below are the **operating surface of the work** — you track on them, prove on them, hand off through them, and survive compaction on them. They are NOT side-artifacts to "maintain"; keeping them current *is* the work. Load the `mission-slice-sop` skill for the full operating procedure. **Conventions SSOT: `docs/reference/sdlc-conventions.md`** — the slice section names (`## Intent` / `## Mini-requirements` / `## Proof contract`), the proof-contract format, the two locks (`rig scope slice approve --scope spec|delivery`), and the C1 proof headers all live there.
32
+ > The canonical files below are the **operating surface of the work** — you track on them, prove on them, hand off through them, and survive compaction on them. They are NOT side-artifacts to "maintain"; keeping them current *is* the work. Load the `mission-slice-sop` skill for the full operating procedure. **Conventions SSOT: `docs/reference/sdlc-conventions.md`** (installed: `$OPENRIG_HOME/reference/sdlc-conventions.md`) — the slice section names (`## Intent` / `## Mini-requirements` / `## Proof contract`), the proof-contract format, the two locks (`rig scope slice approve --scope spec|delivery`), and the C1 proof headers all live there.
33
33
 
34
34
  ### The canonical files (the operating surface)
35
35
 
@@ -44,4 +44,4 @@ Non-visual slices: mark this section N/A.
44
44
 
45
45
  ---
46
46
 
47
- > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md`; full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
47
+ > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md` (installed: `$OPENRIG_HOME/reference/sdlc-conventions.md`); full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
@@ -1,6 +1,6 @@
1
1
  # PROOF — {{id}} {{title}}
2
2
 
3
- > **WHO/WHEN:** the impl/QA pair that worked the slice, at slice-close — a slice is NOT done until this file exists and every proof-contract item has evidence (mapped 1:1, artifacts under `proof/`). See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md`).
3
+ > **WHO/WHEN:** the impl/QA pair that worked the slice, at slice-close — a slice is NOT done until this file exists and every proof-contract item has evidence (mapped 1:1, artifacts under `proof/`). See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md` in the repo, `$OPENRIG_HOME/reference/sdlc-conventions.md` on an installed package).
4
4
  >
5
5
  > **HOW (the drop verb, not hand-placement):** put media files under `proof/`, then ATTACH them with `rig proof add {{id}} --artifact-type qa --verdict PASS --candidate-sha <tip> --money-evidence "<one line>" --evidences "1" --media "screenshot-01.png"` — the drop writes the C1 header the Living Notes DELIVERED pairing joins on. Hand-placing files without a drop leaves the deliverable unpaired and `unverified`.
6
6
 
@@ -32,4 +32,4 @@ created: {{created_date}}
32
32
 
33
33
  ---
34
34
 
35
- > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md`; full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
35
+ > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md` (installed: `$OPENRIG_HOME/reference/sdlc-conventions.md`); full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
@@ -36,4 +36,4 @@ created: {{created_date}}
36
36
 
37
37
  ---
38
38
 
39
- > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md`; full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
39
+ > **How you work this slice (SOP):** conventions SSOT: `docs/reference/sdlc-conventions.md` (installed: `$OPENRIG_HOME/reference/sdlc-conventions.md`); full flow: the `mission-slice-sop` skill. Author intent → mini-requirements + proof contract (→ mockups for UI slices) → plan-lock (`rig scope slice approve --scope spec`) → build the locked set → QA visual compare → `rig proof add … --evidences --media` drops into `proof/` (never hand-place evidence without the drop) → proof-lock (`--scope delivery`). Track on PROGRESS.md; a slice is **not done** until every proof-contract item has evidence. Verify with `rig scope audit`.
@@ -1,6 +1,6 @@
1
1
  # Progress — {{sliceName}}
2
2
 
3
- > **WHO/WHEN:** every agent working this slice logs its own outcomes here after every slice-done AND every commit. One line per outcome, link down for detail. See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md`).
3
+ > **WHO/WHEN:** every agent working this slice logs its own outcomes here after every slice-done AND every commit. One line per outcome, link down for detail. See the `mission-slice-sop` skill + the conventions SSOT (`docs/reference/sdlc-conventions.md` in the repo, `$OPENRIG_HOME/reference/sdlc-conventions.md` on an installed package).
4
4
 
5
5
  ## Acceptance
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"remote-host-ops.d.ts","sourceRoot":"","sources":["../src/remote-host-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAmG,MAAM,oBAAoB,CAAC;AACvJ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,IAAI,EAAE,cAAc,EAGpB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GA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EACd,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAerE"}
@@ -1,4 +1,4 @@
1
- import { loadHostRegistry, resolveHost, resolveRemoteBearer, classifyHttpFailedStep, classifyHttpError } from "./host-registry.js";
1
+ import { loadHostRegistry, resolveHost, resolveRemoteBearer, bearerAuthHeaders, classifyHttpFailedStep, classifyHttpError } from "./host-registry.js";
2
2
  export async function runRemoteHttpOp(hostId, method, apiPath, body, deps,
3
3
  // OPR.0.4.6.MH4 — optional per-call deadline (additive; absent = the
4
4
  // DaemonClient default). Every remote call site names its own budget.
@@ -22,7 +22,7 @@ opts) {
22
22
  return { ok: false, failedStep: bearerResult.failedStep, error: bearerResult.error };
23
23
  }
24
24
  const client = deps.clientFactory(httpHost.url);
25
- const headers = { Authorization: `Bearer ${bearerResult.token}` };
25
+ const headers = bearerAuthHeaders(bearerResult.token);
26
26
  const requestOptions = opts.timeoutMs !== undefined ? { headers, timeoutMs: opts.timeoutMs } : { headers };
27
27
  try {
28
28
  const res = method === "POST"
@@ -1 +1 @@
1
- {"version":3,"file":"remote-host-ops.js","sourceRoot":"","sources":["../src/remote-host-ops.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAsB,MAAM,oBAAoB,CAAC;AAevJ,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,MAAsB,EACtB,OAAe,EACf,IAAyB,EACzB,IAAoB;AACpB,qEAAqE;AACrE,sEAAsE;AACtE,IAA4C;IAE5C,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAgB,CAAC;IAC3D,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC1B,IA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A8B,MAAM,KAAK,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;IAEzG,MAAM,IAAI,GAAG,QAAQ,CAAC,IAA0E,CAAC;IAEjG,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;IACrD,IAAI,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;IAEvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACtE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAE,CAAC,KAAK,EAAE,CAAC;IACtE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,MAAM,aAAa,MAAM,KAAK,MAAM,CAAC,MAAM,uDAAuD,EAAE,CAAC;IACzJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,MAAM,uBAAuB,MAAM,EAAE,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,41 @@
1
+ export interface SlackConnectorConfig {
2
+ enabled: boolean;
3
+ /** Inbound: human Slack messages land here. First-class + overridable (T1075). */
4
+ inboundDestination: string;
5
+ /** Outbound: qitems with this tag destined to a human seat alert to Slack. */
6
+ alertTag: string;
7
+ /** Optional explicit human-seat allow-list for outbound (empty = any human-seat/human-gate). */
8
+ outboundDestinations: string[];
9
+ /** Where the queue lives, shown in the posted message footer (never hardcoded). */
10
+ sourceLabel: string;
11
+ /** Slack channel the connector app must be a member of (verified live, item 5). */
12
+ channel: string | null;
13
+ /** Bot scopes the connector requires; verified against GRANTED header, not config (item 5). */
14
+ requiredScopes: string[];
15
+ /** Path to the 0600 env file holding secrets (webhook URL, bot/app tokens). */
16
+ secretsEnvFile: string | null;
17
+ /**
18
+ * Optional explicit queue-daemon URL (OPENRIG_URL) for a REMOTE queue when the
19
+ * connector host differs from the queue/alert host (item 10). Unlike `--host`
20
+ * (which `queue list`/`show` reject), OPENRIG_URL targets ALL queue verbs.
21
+ * Null = use the connector's ambient OPENRIG_URL / local daemon.
22
+ */
23
+ queueUrl: string | null;
24
+ }
25
+ export declare const DEFAULT_CONFIG: SlackConnectorConfig;
26
+ export declare function configPathFor(home?: string): string;
27
+ export declare function loadConfig(home?: string): SlackConnectorConfig;
28
+ export declare function saveConfig(cfg: SlackConnectorConfig, home?: string): string;
29
+ export declare function configFileExists(home?: string): boolean;
30
+ export interface ReadinessItem {
31
+ ok: boolean;
32
+ label: string;
33
+ detail: string;
34
+ }
35
+ /**
36
+ * HONEST unconfigured state (item 5): a static (no-network) readiness checklist
37
+ * from config + secret RESOLVABILITY (not values). Live scope/membership checks
38
+ * are `rig slack verify`. Never throws; reports what's missing.
39
+ */
40
+ export declare function staticReadiness(cfg: SlackConnectorConfig, hasWebhook: boolean, hasBotToken: boolean, hasAppToken: boolean): ReadinessItem[];
41
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/slack/config.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,gGAAgG;IAChG,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,+FAA+F;IAC/F,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,+EAA+E;IAC/E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,EAAE,oBAU5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAQ9D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,oBAAoB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,aAAa,EAAE,CAU3I"}
@@ -0,0 +1,60 @@
1
+ // Slice-11 slack-connector — first-class connector config (item 5 + T1075).
2
+ //
3
+ // Config is a first-class JSON file (NOT env-only): inbound destination,
4
+ // watched channel, alert tag, source label, required scopes, and POINTERS to
5
+ // secrets (never secret VALUES — those live in the 0600 env file / env vars).
6
+ // An unset/partial config yields an HONEST unconfigured state (no throw, no
7
+ // silent nothing) so `rig slack status` can tell the operator exactly what's left.
8
+ import fs from "node:fs";
9
+ import path from "node:path";
10
+ import { getOpenRigHome } from "../openrig-compat.js";
11
+ export const DEFAULT_CONFIG = {
12
+ enabled: false,
13
+ inboundDestination: "operator-agent@kernel",
14
+ alertTag: "founder-alert",
15
+ outboundDestinations: [],
16
+ sourceLabel: "openrig",
17
+ channel: null,
18
+ requiredScopes: ["chat:write", "channels:history", "channels:read"],
19
+ secretsEnvFile: null,
20
+ queueUrl: null,
21
+ };
22
+ export function configPathFor(home) {
23
+ return path.join(home ?? getOpenRigHome(), "slack-connector.json");
24
+ }
25
+ export function loadConfig(home) {
26
+ const p = configPathFor(home);
27
+ try {
28
+ const raw = JSON.parse(fs.readFileSync(p, "utf8"));
29
+ return { ...DEFAULT_CONFIG, ...raw };
30
+ }
31
+ catch {
32
+ return { ...DEFAULT_CONFIG };
33
+ }
34
+ }
35
+ export function saveConfig(cfg, home) {
36
+ const p = configPathFor(home);
37
+ fs.mkdirSync(path.dirname(p), { recursive: true });
38
+ fs.writeFileSync(p, JSON.stringify(cfg, null, 2) + "\n");
39
+ return p;
40
+ }
41
+ export function configFileExists(home) {
42
+ return fs.existsSync(configPathFor(home));
43
+ }
44
+ /**
45
+ * HONEST unconfigured state (item 5): a static (no-network) readiness checklist
46
+ * from config + secret RESOLVABILITY (not values). Live scope/membership checks
47
+ * are `rig slack verify`. Never throws; reports what's missing.
48
+ */
49
+ export function staticReadiness(cfg, hasWebhook, hasBotToken, hasAppToken) {
50
+ return [
51
+ { ok: cfg.secretsEnvFile !== null || hasWebhook || hasBotToken, label: "secrets-source", detail: cfg.secretsEnvFile ? `env file ${cfg.secretsEnvFile}` : "env vars only" },
52
+ { ok: hasWebhook, label: "outbound-webhook", detail: hasWebhook ? "resolved" : "unset (outbound alerts cannot post)" },
53
+ { ok: hasBotToken, label: "bot-token", detail: hasBotToken ? "resolved" : "unset (scope/membership verify unavailable)" },
54
+ { ok: hasAppToken, label: "app-token (Socket Mode)", detail: hasAppToken ? "resolved" : "unset (inbound cannot connect)" },
55
+ { ok: cfg.channel !== null, label: "channel", detail: cfg.channel ?? "unset" },
56
+ { ok: Boolean(cfg.inboundDestination), label: "inbound-destination", detail: cfg.inboundDestination },
57
+ { ok: cfg.enabled, label: "enabled", detail: cfg.enabled ? "yes" : "no (run `rig slack enable`)" },
58
+ ];
59
+ }
60
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/slack/config.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,mFAAmF;AACnF,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA2BtD,MAAM,CAAC,MAAM,cAAc,GAAyB;IAClD,OAAO,EAAE,KAAK;IACd,kBAAkB,EAAE,uBAAuB;IAC3C,QAAQ,EAAE,eAAe;IACzB,oBAAoB,EAAE,EAAE;IACxB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,eAAe,CAAC;IACnE,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,EAAE,EAAE,sBAAsB,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAkC,CAAC;QACpF,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,GAAG,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;AACH,CAA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AAE;QAC1H,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,OAAO,EAAE;QAC9E,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,GAAG,CAAC,kBAAkB,EAAE;QACrG,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,6BAA6B,EAAE;KACnG,CAAC;AACJ,CAAC"}
@@ -0,0 +1,75 @@
1
+ import type { SeenStore, DeadLetterStore } from "./state-store.js";
2
+ import type { QueueRunner } from "./queue-bridge.js";
3
+ export interface SlackEvent {
4
+ type?: string;
5
+ subtype?: string;
6
+ user?: string;
7
+ bot_id?: string;
8
+ text?: string;
9
+ ts?: string;
10
+ channel?: string;
11
+ files?: unknown[];
12
+ }
13
+ /**
14
+ * Loop-safety + non-text ignore. Ingest ONLY genuine human text messages:
15
+ * reject bot posts (our own loop), message subtypes (edits/joins/file_share),
16
+ * and — T1076 — anything carrying files/images. v1 ignores non-text CLEANLY:
17
+ * a false return is a clean skip, never a crash or partial ingestion.
18
+ */
19
+ export declare function shouldIngest(ev: SlackEvent): boolean;
20
+ export interface InboundDeps {
21
+ runner: QueueRunner;
22
+ seen: SeenStore;
23
+ deadLetter: DeadLetterStore<SlackEvent>;
24
+ destination: string;
25
+ sourceLabel?: string;
26
+ log?: (msg: string) => void;
27
+ }
28
+ export declare class InboundRouter {
29
+ private readonly deps;
30
+ private readonly inflight;
31
+ constructor(deps: InboundDeps);
32
+ private summaryOf;
33
+ /**
34
+ * Core landing attempt — NO dead-letter side effect. Dedup by ts (in-flight +
35
+ * durable seen). `reason` distinguishes a dedup skip from a genuine create
36
+ * failure so callers dead-letter ONLY real failures. On success, marks seen
37
+ * (durable qitem exists → safe).
38
+ */
39
+ private attemptLand;
40
+ /**
41
+ * LIVE path: attempt to land; on a genuine create failure, dead-letter the
42
+ * event (attempt-counted) BEFORE returning — NOT marked seen (item 8).
43
+ */
44
+ route(ev: SlackEvent, attempts?: number): Promise<{
45
+ landed: boolean;
46
+ qitemId?: string;
47
+ }>;
48
+ /**
49
+ * INTERRUPTION-SAFE retry (item 8): read the durable set NON-destructively,
50
+ * attempt each, then ATOMICALLY replace the file with only the still-failing
51
+ * entries. The original file stays intact until the atomic replace, so a crash
52
+ * at any point loses nothing (a since-landed event is skipped via the seen-set).
53
+ * Does NOT go through route() (which would double-append) — uses attemptLand.
54
+ */
55
+ retryDeadLetters(): Promise<{
56
+ retried: number;
57
+ landed: number;
58
+ }>;
59
+ }
60
+ export interface SocketEnvelope {
61
+ envelope_id?: string;
62
+ type?: string;
63
+ reason?: string;
64
+ payload?: {
65
+ event?: SlackEvent;
66
+ };
67
+ }
68
+ /**
69
+ * Handle one Socket Mode envelope. FAST-ACK first, ALWAYS (item 8: Socket Mode
70
+ * punishes slow acks; transport redelivery is not the safety net). Then filter
71
+ * and route. Ack happens even if routing later fails — the dead-letter, not
72
+ * transport redelivery, is the zero-drop net.
73
+ */
74
+ export declare function handleEnvelope(env: SocketEnvelope, ack: () => void, router: InboundRouter, log?: (m: string) => void): Promise<void>;
75
+ //# sourceMappingURL=inbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../src/slack/inbound.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,E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CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAU1I"}
@@ -0,0 +1,133 @@
1
+ import { createQitem } from "./queue-bridge.js";
2
+ /**
3
+ * Loop-safety + non-text ignore. Ingest ONLY genuine human text messages:
4
+ * reject bot posts (our own loop), message subtypes (edits/joins/file_share),
5
+ * and — T1076 — anything carrying files/images. v1 ignores non-text CLEANLY:
6
+ * a false return is a clean skip, never a crash or partial ingestion.
7
+ */
8
+ export function shouldIngest(ev) {
9
+ if (ev.type !== "message" && ev.type !== "app_mention")
10
+ return false;
11
+ if (ev.bot_id)
12
+ return false; // never ingest our own / any bot post
13
+ if (ev.subtype)
14
+ return false; // edits, joins, file_share, etc.
15
+ if (ev.files && ev.files.length > 0)
16
+ return false; // T1076: image/file events ignored cleanly (Slice-12)
17
+ if (!ev.user || !ev.text || !ev.text.trim())
18
+ return false;
19
+ return true;
20
+ }
21
+ export class InboundRouter {
22
+ deps;
23
+ inflight = new Set(); // same-ts double-dispatch guard (item 8)
24
+ constructor(deps) {
25
+ this.deps = deps;
26
+ }
27
+ summaryOf(ev) {
28
+ const text = String(ev.text ?? "").slice(0, 1800);
29
+ const meta = `slack channel=${ev.channel} user=${ev.user} ts=${ev.ts}`;
30
+ return {
31
+ summary: `Founder via Slack: ${text.slice(0, 90)}`,
32
+ body: `${text}\n\n---\nSource: ${meta}\nRouted by openrig slack-inbound. Default destination per config; re-route via queue as needed.`,
33
+ };
34
+ }
35
+ /**
36
+ * Core landing attempt — NO dead-letter side effect. Dedup by ts (in-flight +
37
+ * durable seen). `reason` distinguishes a dedup skip from a genuine create
38
+ * failure so callers dead-letter ONLY real failures. On success, marks seen
39
+ * (durable qitem exists → safe).
40
+ */
41
+ async attemptLand(ev) {
42
+ const ts = ev.ts ?? "";
43
+ if (!ts || this.inflight.has(ts) || this.deps.seen.load().has(ts))
44
+ return { landed: false, reason: "dup" };
45
+ this.inflight.add(ts);
46
+ try {
47
+ const { summary, body } = this.summaryOf(ev);
48
+ let qitemId;
49
+ try {
50
+ qitemId = await createQitem(this.deps.runner, {
51
+ source: `human-${ev.user}@kernel`, // provenance classifies as human (name convention)
52
+ destination: this.deps.destination,
53
+ priority: "routine",
54
+ tags: ["founder-slack", "inbound"],
55
+ summary,
56
+ body,
57
+ });
58
+ }
59
+ catch (e) {
60
+ this.deps.log?.(`qitem create failed ts=${ts}: ${e.message}`);
61
+ return { landed: false, reason: "create_failed" };
62
+ }
63
+ this.deps.seen.mark(ts, "landed"); // durable qitem exists → safe to mark
64
+ this.deps.log?.(`qitem ${qitemId} -> ${this.deps.destination} (ts=${ts})`);
65
+ return { landed: true, qitemId };
66
+ }
67
+ finally {
68
+ this.inflight.delete(ts);
69
+ }
70
+ }
71
+ /**
72
+ * LIVE path: attempt to land; on a genuine create failure, dead-letter the
73
+ * event (attempt-counted) BEFORE returning — NOT marked seen (item 8).
74
+ */
75
+ async route(ev, attempts = 0) {
76
+ const r = await this.attemptLand(ev);
77
+ if (!r.landed && r.reason === "create_failed") {
78
+ this.deps.deadLetter.append(ev, attempts + 1);
79
+ this.deps.log?.(`dead-lettered ts=${ev.ts} (attempt ${attempts + 1})`);
80
+ }
81
+ return { landed: r.landed, qitemId: r.qitemId };
82
+ }
83
+ /**
84
+ * INTERRUPTION-SAFE retry (item 8): read the durable set NON-destructively,
85
+ * attempt each, then ATOMICALLY replace the file with only the still-failing
86
+ * entries. The original file stays intact until the atomic replace, so a crash
87
+ * at any point loses nothing (a since-landed event is skipped via the seen-set).
88
+ * Does NOT go through route() (which would double-append) — uses attemptLand.
89
+ */
90
+ async retryDeadLetters() {
91
+ const entries = this.deps.deadLetter.readAll();
92
+ if (entries.length === 0)
93
+ return { retried: 0, landed: 0 };
94
+ this.deps.log?.(`retrying ${entries.length} dead-letter(s)`);
95
+ const stillFailing = [];
96
+ let landed = 0;
97
+ const seen = this.deps.seen.load();
98
+ for (const e of entries) {
99
+ if (e.ev.ts && seen.has(e.ev.ts))
100
+ continue; // already landed → recovered, drop from set
101
+ const r = await this.attemptLand(e.ev);
102
+ if (r.landed)
103
+ landed++;
104
+ else if (r.reason === "create_failed")
105
+ stillFailing.push({ ev: e.ev, at: e.at, attempts: e.attempts + 1 });
106
+ // reason === "dup" (in-flight) → drop; a concurrent path owns it
107
+ }
108
+ this.deps.deadLetter.replaceAll(stillFailing); // atomic; original intact until here
109
+ return { retried: entries.length, landed };
110
+ }
111
+ }
112
+ /**
113
+ * Handle one Socket Mode envelope. FAST-ACK first, ALWAYS (item 8: Socket Mode
114
+ * punishes slow acks; transport redelivery is not the safety net). Then filter
115
+ * and route. Ack happens even if routing later fails — the dead-letter, not
116
+ * transport redelivery, is the zero-drop net.
117
+ */
118
+ export async function handleEnvelope(env, ack, router, log) {
119
+ if (env.envelope_id)
120
+ ack(); // fast-ack, unconditional, first
121
+ if (env.type === "disconnect")
122
+ return;
123
+ if (env.type !== "events_api")
124
+ return;
125
+ const ev = env.payload?.event ?? {};
126
+ if (!shouldIngest(ev)) {
127
+ if (ev.type)
128
+ log?.(`ignored non-ingestible event type=${ev.type} subtype=${ev.subtype ?? "-"} files=${ev.files?.length ?? 0}`);
129
+ return;
130
+ }
131
+ await router.route(ev);
132
+ }
133
+ //# sourceMappingURL=inbound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../src/slack/inbound.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAc;IACzC,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,KAAK,aAAa;QAAE,OAAO,KAAK,CAAC;IACrE,IAA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C,EAAE,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare const SLACK_TEXT_CAP = 3900;
2
+ export declare const DEFAULT_BODY_EXCERPT = 800;
3
+ export interface QitemLike {
4
+ qitemId: string;
5
+ summary?: string | null;
6
+ body?: string | null;
7
+ destinationSession?: string | null;
8
+ }
9
+ export interface OutboundMessageOpts {
10
+ sourceLabel: string;
11
+ bodyExcerpt?: number;
12
+ /** T1076 extension point: extra Block Kit blocks (e.g. future media). v1 unused. */
13
+ extraBlocks?: unknown[];
14
+ }
15
+ export declare function containsSecret(text: string): boolean;
16
+ export declare function redactSecrets(text: string): string;
17
+ export interface SlackMessagePayload {
18
+ text: string;
19
+ blocks: unknown[];
20
+ }
21
+ /**
22
+ * Build the Slack payload for a human-destined qitem. Pure + deterministic
23
+ * (no clock, no io) so it is trivially testable and safe to snapshot.
24
+ */
25
+ export declare function buildOutboundMessage(q: QitemLike, opts: OutboundMessageOpts): SlackMessagePayload;
26
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/slack/message.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;CACzB;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,CAiBjG"}
@@ -0,0 +1,60 @@
1
+ // Slice-11 slack-connector — outbound message construction.
2
+ //
3
+ // Locked item 7 (content hygiene): a posted message carries summary + qitem id
4
+ // + source + a BOUNDED body excerpt, and NEVER a token/secret/secret-bearing
5
+ // path. We never add our own credentials (we only render qitem fields), and as
6
+ // defense-in-depth we redact anything that looks like a Slack/bearer secret
7
+ // leaking through a qitem body before it goes out.
8
+ //
9
+ // T1076 (don't preclude Slice-12): construction is BLOCKS/ATTACHMENTS-capable —
10
+ // we always emit Block Kit `blocks` PLUS a plain-text fallback, and accept
11
+ // optional extra blocks / media refs so image relay can extend this later
12
+ // WITHOUT redefining the shape here. v1 ships text only.
13
+ export const SLACK_TEXT_CAP = 3900; // Slack hard-limits ~4000; stay under.
14
+ export const DEFAULT_BODY_EXCERPT = 800;
15
+ // Secret-looking patterns we refuse to forward (item 7 defense-in-depth).
16
+ const SECRET_PATTERNS = [
17
+ /xox[baprs]-[A-Za-z0-9-]+/g, // Slack bot/user/app/refresh tokens
18
+ /xapp-[A-Za-z0-9-]+/g, // Slack app-level (Socket Mode) token
19
+ /https:\/\/hooks\.slack\.com\/services\/[A-Za-z0-9/_-]+/g, // incoming webhook URL
20
+ /\bBearer\s+[A-Za-z0-9._-]{12,}/gi, // bearer tokens
21
+ /xoxe\.xox[bp]-[A-Za-z0-9-]+/g, // rotation tokens
22
+ ];
23
+ export function containsSecret(text) {
24
+ return SECRET_PATTERNS.some((p) => {
25
+ p.lastIndex = 0;
26
+ return p.test(text);
27
+ });
28
+ }
29
+ export function redactSecrets(text) {
30
+ let out = text;
31
+ for (const p of SECRET_PATTERNS) {
32
+ out = out.replace(p, "[redacted-secret]");
33
+ }
34
+ return out;
35
+ }
36
+ function clamp(s, max) {
37
+ return s.length > max ? s.slice(0, max) : s;
38
+ }
39
+ /**
40
+ * Build the Slack payload for a human-destined qitem. Pure + deterministic
41
+ * (no clock, no io) so it is trivially testable and safe to snapshot.
42
+ */
43
+ export function buildOutboundMessage(q, opts) {
44
+ const summary = redactSecrets(String(q.summary || "(no summary)"));
45
+ const bodyRaw = redactSecrets(String(q.body || ""));
46
+ const body = clamp(bodyRaw, opts.bodyExcerpt ?? DEFAULT_BODY_EXCERPT);
47
+ const dest = q.destinationSession || "(unknown destination)";
48
+ const footer = `qitem ${q.qitemId} → ${dest} on ${opts.sourceLabel}`;
49
+ const text = clamp(`:rotating_light: *${summary}*\n${body}\n_${footer}_`, SLACK_TEXT_CAP);
50
+ const blocks = [
51
+ { type: "section", text: { type: "mrkdwn", text: clamp(`:rotating_light: *${summary}*`, 3000) } },
52
+ ];
53
+ if (body.trim())
54
+ blocks.push({ type: "section", text: { type: "mrkdwn", text: clamp(body, 3000) } });
55
+ blocks.push({ type: "context", elements: [{ type: "mrkdwn", text: footer }] });
56
+ if (opts.extraBlocks?.length)
57
+ blocks.push(...opts.extraBlocks);
58
+ return { text, blocks };
59
+ }
60
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/slack/message.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,mDAAmD;AACnD,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,0EAA0E;AAC1E,yDAAyD;AAEzD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,uCAAuC;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAgBxC,0EAA0E;AA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kB,IAAI,uBAAuB,CAAC;IAC7D,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,OAAO,MAAM,IAAI,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAErE,MAAM,IAAI,GAAG,KAAK,CAAC,qBAAqB,OAAO,MAAM,IAAI,MAAM,MAAM,GAAG,EAAE,cAAc,CAAC,CAAC;IAE1F,MAAM,MAAM,GAAc;QACxB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,qBAAqB,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;KAClG,CAAC;IACF,IAAI,IAAI,CAAC,IAAI,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACrG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/E,IAAI,IAAI,CAAC,WAAW,EAAE,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IAE/D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { SeenStore } from "./state-store.js";
2
+ import type { QueueRunner, AlertFilterOpts } from "./queue-bridge.js";
3
+ import { type FetchImpl } from "./slack-api.js";
4
+ export interface OutboundDeps {
5
+ runner: QueueRunner;
6
+ seen: SeenStore;
7
+ webhookUrl: string;
8
+ fetchImpl?: FetchImpl;
9
+ sourceLabel: string;
10
+ filter: AlertFilterOpts;
11
+ bodyExcerpt?: number;
12
+ log?: (msg: string) => void;
13
+ }
14
+ export interface OutboundResult {
15
+ freshCount: number;
16
+ posted: string[];
17
+ failed: {
18
+ id: string;
19
+ error: string;
20
+ }[];
21
+ }
22
+ /**
23
+ * One outbound sweep. Posts every FRESH human alert, marking it seen ONLY after
24
+ * a 200. A failed post is logged loudly and left UNSEEN so the next sweep
25
+ * retries it — never a silent drop. Returns failures so the caller exits
26
+ * non-zero (fail-visible).
27
+ */
28
+ export declare function runOutboundOnce(deps: OutboundDeps): Promise<OutboundResult>;
29
+ export interface SeedResult {
30
+ seeded: number;
31
+ onlineStatus: string;
32
+ }
33
+ /**
34
+ * Item 9: on ENABLE, seed all currently-active human alerts as history/seen
35
+ * WITHOUT posting, so turning the connector on never replays the backlog.
36
+ * Returns an honest online-status line marking the transition.
37
+ */
38
+ export declare function seedBacklogOnEnable(deps: Pick<OutboundDeps, "runner" | "seen" | "filter" | "log">): Promise<SeedResult>;
39
+ //# sourceMappingURL=outbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../../src/slack/outbound.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG7D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BjF;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ7H"}