@decibelsystems/tools 2.2.0-beta.0 → 3.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 (435) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/dist/agentCommands.d.ts +0 -1
  3. package/dist/agentCommands.d.ts.map +1 -1
  4. package/dist/agentCommands.js +19 -8
  5. package/dist/agentCommands.js.map +1 -1
  6. package/dist/agentPresence.d.ts +82 -0
  7. package/dist/agentPresence.d.ts.map +1 -1
  8. package/dist/agentPresence.js +194 -26
  9. package/dist/agentPresence.js.map +1 -1
  10. package/dist/agentic/index.d.ts +18 -8
  11. package/dist/agentic/index.d.ts.map +1 -1
  12. package/dist/agentic/index.js +18 -144
  13. package/dist/agentic/index.js.map +1 -1
  14. package/dist/agentic/types.d.ts +106 -0
  15. package/dist/agentic/types.d.ts.map +1 -1
  16. package/dist/agentic/types.js +77 -1
  17. package/dist/agentic/types.js.map +1 -1
  18. package/dist/architectAdrs.d.ts +27 -3
  19. package/dist/architectAdrs.d.ts.map +1 -1
  20. package/dist/architectAdrs.js +92 -4
  21. package/dist/architectAdrs.js.map +1 -1
  22. package/dist/artifacts.d.ts +60 -0
  23. package/dist/artifacts.d.ts.map +1 -0
  24. package/dist/artifacts.js +208 -0
  25. package/dist/artifacts.js.map +1 -0
  26. package/dist/asks.d.ts +93 -0
  27. package/dist/asks.d.ts.map +1 -0
  28. package/dist/asks.js +383 -0
  29. package/dist/asks.js.map +1 -0
  30. package/dist/chat.d.ts +47 -0
  31. package/dist/chat.d.ts.map +1 -0
  32. package/dist/chat.js +288 -0
  33. package/dist/chat.js.map +1 -0
  34. package/dist/client/transports.d.ts.map +1 -1
  35. package/dist/client/transports.js +13 -3
  36. package/dist/client/transports.js.map +1 -1
  37. package/dist/daemon.d.ts +33 -3
  38. package/dist/daemon.d.ts.map +1 -1
  39. package/dist/daemon.js +225 -52
  40. package/dist/daemon.js.map +1 -1
  41. package/dist/daemonConfig.d.ts +46 -0
  42. package/dist/daemonConfig.d.ts.map +1 -1
  43. package/dist/daemonConfig.js +57 -12
  44. package/dist/daemonConfig.js.map +1 -1
  45. package/dist/decibelPaths.d.ts.map +1 -1
  46. package/dist/decibelPaths.js +39 -6
  47. package/dist/decibelPaths.js.map +1 -1
  48. package/dist/domain/issue.d.ts +81 -0
  49. package/dist/domain/issue.d.ts.map +1 -0
  50. package/dist/domain/issue.js +106 -0
  51. package/dist/domain/issue.js.map +1 -0
  52. package/dist/domain/issueCodec.d.ts +39 -0
  53. package/dist/domain/issueCodec.d.ts.map +1 -0
  54. package/dist/domain/issueCodec.js +308 -0
  55. package/dist/domain/issueCodec.js.map +1 -0
  56. package/dist/domain/issueRepository.d.ts +124 -0
  57. package/dist/domain/issueRepository.d.ts.map +1 -0
  58. package/dist/domain/issueRepository.js +296 -0
  59. package/dist/domain/issueRepository.js.map +1 -0
  60. package/dist/domain/uid.d.ts +16 -0
  61. package/dist/domain/uid.d.ts.map +1 -0
  62. package/dist/domain/uid.js +43 -0
  63. package/dist/domain/uid.js.map +1 -0
  64. package/dist/facades/definitions.d.ts +0 -1
  65. package/dist/facades/definitions.d.ts.map +1 -1
  66. package/dist/facades/definitions.js +140 -116
  67. package/dist/facades/definitions.js.map +1 -1
  68. package/dist/facades/index.d.ts +2 -1
  69. package/dist/facades/index.d.ts.map +1 -1
  70. package/dist/facades/index.js +1 -1
  71. package/dist/facades/index.js.map +1 -1
  72. package/dist/facades/types.d.ts +17 -0
  73. package/dist/facades/types.d.ts.map +1 -1
  74. package/dist/hq/defineAgent.d.ts.map +1 -1
  75. package/dist/hq/defineAgent.js +7 -11
  76. package/dist/hq/defineAgent.js.map +1 -1
  77. package/dist/httpArgs.d.ts +11 -0
  78. package/dist/httpArgs.d.ts.map +1 -0
  79. package/dist/httpArgs.js +39 -0
  80. package/dist/httpArgs.js.map +1 -0
  81. package/dist/httpServer.d.ts +1 -12
  82. package/dist/httpServer.d.ts.map +1 -1
  83. package/dist/httpServer.js +298 -144
  84. package/dist/httpServer.js.map +1 -1
  85. package/dist/identity.d.ts +123 -0
  86. package/dist/identity.d.ts.map +1 -0
  87. package/dist/identity.js +312 -0
  88. package/dist/identity.js.map +1 -0
  89. package/dist/kernel.d.ts +46 -1
  90. package/dist/kernel.d.ts.map +1 -1
  91. package/dist/kernel.js +334 -26
  92. package/dist/kernel.js.map +1 -1
  93. package/dist/killSwitch.d.ts +117 -0
  94. package/dist/killSwitch.d.ts.map +1 -0
  95. package/dist/killSwitch.js +161 -0
  96. package/dist/killSwitch.js.map +1 -0
  97. package/dist/lib/agent-services/assumptions.d.ts.map +1 -1
  98. package/dist/lib/agent-services/assumptions.js +8 -2
  99. package/dist/lib/agent-services/assumptions.js.map +1 -1
  100. package/dist/lib/atomicWrite.d.ts +49 -0
  101. package/dist/lib/atomicWrite.d.ts.map +1 -0
  102. package/dist/lib/atomicWrite.js +157 -0
  103. package/dist/lib/atomicWrite.js.map +1 -0
  104. package/dist/lib/envelope.d.ts +31 -0
  105. package/dist/lib/envelope.d.ts.map +1 -0
  106. package/dist/lib/envelope.js +80 -0
  107. package/dist/lib/envelope.js.map +1 -0
  108. package/dist/lib/fileLock.d.ts +38 -0
  109. package/dist/lib/fileLock.d.ts.map +1 -0
  110. package/dist/lib/fileLock.js +124 -0
  111. package/dist/lib/fileLock.js.map +1 -0
  112. package/dist/lib/recordIdAllocator.d.ts +102 -0
  113. package/dist/lib/recordIdAllocator.d.ts.map +1 -0
  114. package/dist/lib/recordIdAllocator.js +179 -0
  115. package/dist/lib/recordIdAllocator.js.map +1 -0
  116. package/dist/orgId.d.ts +23 -0
  117. package/dist/orgId.d.ts.map +1 -0
  118. package/dist/orgId.js +73 -0
  119. package/dist/orgId.js.map +1 -0
  120. package/dist/pairCli.d.ts +2 -0
  121. package/dist/pairCli.d.ts.map +1 -0
  122. package/dist/pairCli.js +97 -0
  123. package/dist/pairCli.js.map +1 -0
  124. package/dist/peerBroker.d.ts +40 -0
  125. package/dist/peerBroker.d.ts.map +1 -0
  126. package/dist/peerBroker.js +70 -0
  127. package/dist/peerBroker.js.map +1 -0
  128. package/dist/peerBrokerSupervisor.d.ts +21 -0
  129. package/dist/peerBrokerSupervisor.d.ts.map +1 -0
  130. package/dist/peerBrokerSupervisor.js +131 -0
  131. package/dist/peerBrokerSupervisor.js.map +1 -0
  132. package/dist/projectPaths.d.ts.map +1 -1
  133. package/dist/projectPaths.js +1 -19
  134. package/dist/projectPaths.js.map +1 -1
  135. package/dist/projectRegistry.d.ts +22 -0
  136. package/dist/projectRegistry.d.ts.map +1 -1
  137. package/dist/projectRegistry.js +69 -2
  138. package/dist/projectRegistry.js.map +1 -1
  139. package/dist/pty/boundary.d.ts +39 -0
  140. package/dist/pty/boundary.d.ts.map +1 -0
  141. package/dist/pty/boundary.js +100 -0
  142. package/dist/pty/boundary.js.map +1 -0
  143. package/dist/pty/errors.d.ts +6 -0
  144. package/dist/pty/errors.d.ts.map +1 -0
  145. package/dist/pty/errors.js +12 -0
  146. package/dist/pty/errors.js.map +1 -0
  147. package/dist/pty/fleet.d.ts +159 -0
  148. package/dist/pty/fleet.d.ts.map +1 -0
  149. package/dist/pty/fleet.js +543 -0
  150. package/dist/pty/fleet.js.map +1 -0
  151. package/dist/pty/launchProfile.d.ts +45 -0
  152. package/dist/pty/launchProfile.d.ts.map +1 -0
  153. package/dist/pty/launchProfile.js +149 -0
  154. package/dist/pty/launchProfile.js.map +1 -0
  155. package/dist/pty/openTerminal.d.ts +48 -0
  156. package/dist/pty/openTerminal.d.ts.map +1 -0
  157. package/dist/pty/openTerminal.js +185 -0
  158. package/dist/pty/openTerminal.js.map +1 -0
  159. package/dist/pty/pairDialog.d.ts +16 -0
  160. package/dist/pty/pairDialog.d.ts.map +1 -0
  161. package/dist/pty/pairDialog.js +121 -0
  162. package/dist/pty/pairDialog.js.map +1 -0
  163. package/dist/pty/pairing.d.ts +86 -0
  164. package/dist/pty/pairing.d.ts.map +1 -0
  165. package/dist/pty/pairing.js +351 -0
  166. package/dist/pty/pairing.js.map +1 -0
  167. package/dist/pty/routes.d.ts +49 -0
  168. package/dist/pty/routes.d.ts.map +1 -0
  169. package/dist/pty/routes.js +624 -0
  170. package/dist/pty/routes.js.map +1 -0
  171. package/dist/pty/sessions.d.ts +167 -0
  172. package/dist/pty/sessions.d.ts.map +1 -0
  173. package/dist/pty/sessions.js +513 -0
  174. package/dist/pty/sessions.js.map +1 -0
  175. package/dist/pty/tmux.d.ts +109 -0
  176. package/dist/pty/tmux.d.ts.map +1 -0
  177. package/dist/pty/tmux.js +271 -0
  178. package/dist/pty/tmux.js.map +1 -0
  179. package/dist/roster.d.ts +37 -0
  180. package/dist/roster.d.ts.map +1 -0
  181. package/dist/roster.js +126 -0
  182. package/dist/roster.js.map +1 -0
  183. package/dist/runtime/circuitBreaker.d.ts +95 -0
  184. package/dist/runtime/circuitBreaker.d.ts.map +1 -0
  185. package/dist/runtime/circuitBreaker.js +178 -0
  186. package/dist/runtime/circuitBreaker.js.map +1 -0
  187. package/dist/runtime/daemonMeta.d.ts +53 -0
  188. package/dist/runtime/daemonMeta.d.ts.map +1 -0
  189. package/dist/runtime/daemonMeta.js +121 -0
  190. package/dist/runtime/daemonMeta.js.map +1 -0
  191. package/dist/runtime/ensureRuntime.d.ts +103 -0
  192. package/dist/runtime/ensureRuntime.d.ts.map +1 -0
  193. package/dist/runtime/ensureRuntime.js +276 -0
  194. package/dist/runtime/ensureRuntime.js.map +1 -0
  195. package/dist/runtime/extensions.d.ts +57 -0
  196. package/dist/runtime/extensions.d.ts.map +1 -0
  197. package/dist/runtime/extensions.js +216 -0
  198. package/dist/runtime/extensions.js.map +1 -0
  199. package/dist/runtime/localHttp.d.ts +24 -0
  200. package/dist/runtime/localHttp.d.ts.map +1 -0
  201. package/dist/runtime/localHttp.js +84 -0
  202. package/dist/runtime/localHttp.js.map +1 -0
  203. package/dist/runtime/projectResolution.d.ts +29 -0
  204. package/dist/runtime/projectResolution.d.ts.map +1 -0
  205. package/dist/runtime/projectResolution.js +67 -0
  206. package/dist/runtime/projectResolution.js.map +1 -0
  207. package/dist/runtime/protocol.d.ts +62 -0
  208. package/dist/runtime/protocol.d.ts.map +1 -0
  209. package/dist/runtime/protocol.js +74 -0
  210. package/dist/runtime/protocol.js.map +1 -0
  211. package/dist/sentinelIssues.d.ts +42 -2
  212. package/dist/sentinelIssues.d.ts.map +1 -1
  213. package/dist/sentinelIssues.js +167 -65
  214. package/dist/sentinelIssues.js.map +1 -1
  215. package/dist/server.js +123 -15
  216. package/dist/server.js.map +1 -1
  217. package/dist/toolConfig.d.ts.map +1 -1
  218. package/dist/toolConfig.js +12 -0
  219. package/dist/toolConfig.js.map +1 -1
  220. package/dist/tools/agentic/agentQueue.d.ts.map +1 -1
  221. package/dist/tools/agentic/agentQueue.js +4 -0
  222. package/dist/tools/agentic/agentQueue.js.map +1 -1
  223. package/dist/tools/agentic/index.d.ts.map +1 -1
  224. package/dist/tools/agentic/index.js +28 -2
  225. package/dist/tools/agentic/index.js.map +1 -1
  226. package/dist/tools/architect/index.d.ts +1 -0
  227. package/dist/tools/architect/index.d.ts.map +1 -1
  228. package/dist/tools/architect/index.js +52 -3
  229. package/dist/tools/architect/index.js.map +1 -1
  230. package/dist/tools/architect.d.ts.map +1 -1
  231. package/dist/tools/architect.js +59 -8
  232. package/dist/tools/architect.js.map +1 -1
  233. package/dist/tools/artifacts.d.ts +5 -0
  234. package/dist/tools/artifacts.d.ts.map +1 -0
  235. package/dist/tools/artifacts.js +89 -0
  236. package/dist/tools/artifacts.js.map +1 -0
  237. package/dist/tools/asks.d.ts +6 -0
  238. package/dist/tools/asks.d.ts.map +1 -0
  239. package/dist/tools/asks.js +104 -0
  240. package/dist/tools/asks.js.map +1 -0
  241. package/dist/tools/context.d.ts +10 -5
  242. package/dist/tools/context.d.ts.map +1 -1
  243. package/dist/tools/context.js +45 -18
  244. package/dist/tools/context.js.map +1 -1
  245. package/dist/tools/coordinator/coordinator.d.ts.map +1 -1
  246. package/dist/tools/coordinator/coordinator.js +48 -19
  247. package/dist/tools/coordinator/coordinator.js.map +1 -1
  248. package/dist/tools/coordinator/index.d.ts +1 -0
  249. package/dist/tools/coordinator/index.d.ts.map +1 -1
  250. package/dist/tools/coordinator/index.js +42 -2
  251. package/dist/tools/coordinator/index.js.map +1 -1
  252. package/dist/tools/crit.d.ts +2 -1
  253. package/dist/tools/crit.d.ts.map +1 -1
  254. package/dist/tools/crit.js +19 -4
  255. package/dist/tools/crit.js.map +1 -1
  256. package/dist/tools/data-inspector.d.ts +1 -1
  257. package/dist/tools/data-inspector.d.ts.map +1 -1
  258. package/dist/tools/data-inspector.js +1 -1
  259. package/dist/tools/data-inspector.js.map +1 -1
  260. package/dist/tools/designer/index.d.ts.map +1 -1
  261. package/dist/tools/designer/index.js +4 -3
  262. package/dist/tools/designer/index.js.map +1 -1
  263. package/dist/tools/designer/lateral-tools.d.ts.map +1 -1
  264. package/dist/tools/designer/lateral-tools.js +4 -2
  265. package/dist/tools/designer/lateral-tools.js.map +1 -1
  266. package/dist/tools/designer.d.ts +2 -1
  267. package/dist/tools/designer.d.ts.map +1 -1
  268. package/dist/tools/designer.js +24 -12
  269. package/dist/tools/designer.js.map +1 -1
  270. package/dist/tools/dojo/index.d.ts.map +1 -1
  271. package/dist/tools/dojo/index.js +52 -3
  272. package/dist/tools/dojo/index.js.map +1 -1
  273. package/dist/tools/dojo.d.ts +65 -3
  274. package/dist/tools/dojo.d.ts.map +1 -1
  275. package/dist/tools/dojo.js +148 -23
  276. package/dist/tools/dojo.js.map +1 -1
  277. package/dist/tools/friction.d.ts.map +1 -1
  278. package/dist/tools/friction.js +16 -6
  279. package/dist/tools/friction.js.map +1 -1
  280. package/dist/tools/guardian.d.ts +7 -0
  281. package/dist/tools/guardian.d.ts.map +1 -1
  282. package/dist/tools/guardian.js +152 -11
  283. package/dist/tools/guardian.js.map +1 -1
  284. package/dist/tools/hygiene/oracle-hygiene.d.ts.map +1 -1
  285. package/dist/tools/hygiene/oracle-hygiene.js +8 -2
  286. package/dist/tools/hygiene/oracle-hygiene.js.map +1 -1
  287. package/dist/tools/index.d.ts.map +1 -1
  288. package/dist/tools/index.js +33 -18
  289. package/dist/tools/index.js.map +1 -1
  290. package/dist/tools/killswitch/index.d.ts +13 -0
  291. package/dist/tools/killswitch/index.d.ts.map +1 -0
  292. package/dist/tools/killswitch/index.js +138 -0
  293. package/dist/tools/killswitch/index.js.map +1 -0
  294. package/dist/tools/learnings.d.ts +2 -1
  295. package/dist/tools/learnings.d.ts.map +1 -1
  296. package/dist/tools/learnings.js +31 -15
  297. package/dist/tools/learnings.js.map +1 -1
  298. package/dist/tools/oracle/index.d.ts.map +1 -1
  299. package/dist/tools/oracle/index.js +8 -0
  300. package/dist/tools/oracle/index.js.map +1 -1
  301. package/dist/tools/oracle.d.ts +7 -0
  302. package/dist/tools/oracle.d.ts.map +1 -1
  303. package/dist/tools/oracle.js +41 -12
  304. package/dist/tools/oracle.js.map +1 -1
  305. package/dist/tools/policy.d.ts +2 -1
  306. package/dist/tools/policy.d.ts.map +1 -1
  307. package/dist/tools/policy.js +28 -9
  308. package/dist/tools/policy.js.map +1 -1
  309. package/dist/tools/postoffice/index.d.ts +10 -0
  310. package/dist/tools/postoffice/index.d.ts.map +1 -0
  311. package/dist/tools/postoffice/index.js +218 -0
  312. package/dist/tools/postoffice/index.js.map +1 -0
  313. package/dist/tools/postoffice.d.ts +78 -0
  314. package/dist/tools/postoffice.d.ts.map +1 -0
  315. package/dist/tools/postoffice.js +199 -0
  316. package/dist/tools/postoffice.js.map +1 -0
  317. package/dist/tools/provenance.d.ts +18 -2
  318. package/dist/tools/provenance.d.ts.map +1 -1
  319. package/dist/tools/provenance.js +68 -40
  320. package/dist/tools/provenance.js.map +1 -1
  321. package/dist/tools/registry/index.d.ts.map +1 -1
  322. package/dist/tools/registry/index.js +24 -0
  323. package/dist/tools/registry/index.js.map +1 -1
  324. package/dist/tools/sentinel/index.d.ts +1 -0
  325. package/dist/tools/sentinel/index.d.ts.map +1 -1
  326. package/dist/tools/sentinel/index.js +142 -6
  327. package/dist/tools/sentinel/index.js.map +1 -1
  328. package/dist/tools/sentinel.d.ts +152 -1
  329. package/dist/tools/sentinel.d.ts.map +1 -1
  330. package/dist/tools/sentinel.js +609 -328
  331. package/dist/tools/sentinel.js.map +1 -1
  332. package/dist/tools/shared/index.d.ts +2 -1
  333. package/dist/tools/shared/index.d.ts.map +1 -1
  334. package/dist/tools/shared/index.js +2 -1
  335. package/dist/tools/shared/index.js.map +1 -1
  336. package/dist/tools/shared/response.d.ts +24 -0
  337. package/dist/tools/shared/response.d.ts.map +1 -1
  338. package/dist/tools/shared/response.js +61 -7
  339. package/dist/tools/shared/response.js.map +1 -1
  340. package/dist/tools/shared/runTracker.d.ts +2 -0
  341. package/dist/tools/shared/runTracker.d.ts.map +1 -1
  342. package/dist/tools/shared/runTracker.js +38 -0
  343. package/dist/tools/shared/runTracker.js.map +1 -1
  344. package/dist/tools/shared/storeRead.d.ts +153 -0
  345. package/dist/tools/shared/storeRead.d.ts.map +1 -0
  346. package/dist/tools/shared/storeRead.js +242 -0
  347. package/dist/tools/shared/storeRead.js.map +1 -0
  348. package/dist/tools/swarm.d.ts +3 -1
  349. package/dist/tools/swarm.d.ts.map +1 -1
  350. package/dist/tools/swarm.js +6 -12
  351. package/dist/tools/swarm.js.map +1 -1
  352. package/dist/tools/testSpec.d.ts +3 -2
  353. package/dist/tools/testSpec.d.ts.map +1 -1
  354. package/dist/tools/testSpec.js +51 -14
  355. package/dist/tools/testSpec.js.map +1 -1
  356. package/dist/tools/vector.d.ts +33 -1
  357. package/dist/tools/vector.d.ts.map +1 -1
  358. package/dist/tools/vector.js +31 -5
  359. package/dist/tools/vector.js.map +1 -1
  360. package/dist/tools/voice/index.d.ts +1 -0
  361. package/dist/tools/voice/index.d.ts.map +1 -1
  362. package/dist/tools/voice/index.js +33 -2
  363. package/dist/tools/voice/index.js.map +1 -1
  364. package/dist/tools/voice.d.ts +48 -1
  365. package/dist/tools/voice.d.ts.map +1 -1
  366. package/dist/tools/voice.js +63 -3
  367. package/dist/tools/voice.js.map +1 -1
  368. package/dist/tools/zoom/index.d.ts +15 -0
  369. package/dist/tools/zoom/index.d.ts.map +1 -0
  370. package/dist/tools/zoom/index.js +174 -0
  371. package/dist/tools/zoom/index.js.map +1 -0
  372. package/dist/tools/zoom.d.ts +234 -0
  373. package/dist/tools/zoom.d.ts.map +1 -0
  374. package/dist/tools/zoom.js +627 -0
  375. package/dist/tools/zoom.js.map +1 -0
  376. package/dist/transports/bridge.d.ts +1 -1
  377. package/dist/transports/bridge.d.ts.map +1 -1
  378. package/dist/transports/bridge.js +4 -1
  379. package/dist/transports/bridge.js.map +1 -1
  380. package/dist/transports/http.d.ts +1 -1
  381. package/dist/transports/http.d.ts.map +1 -1
  382. package/dist/transports/http.js +3 -1
  383. package/dist/transports/http.js.map +1 -1
  384. package/dist/transports/index.d.ts +1 -0
  385. package/dist/transports/index.d.ts.map +1 -1
  386. package/dist/transports/index.js +1 -0
  387. package/dist/transports/index.js.map +1 -1
  388. package/dist/transports/mcp.d.ts +1 -1
  389. package/dist/transports/mcp.d.ts.map +1 -1
  390. package/dist/transports/mcp.js +9 -4
  391. package/dist/transports/mcp.js.map +1 -1
  392. package/dist/transports/stdio.d.ts +1 -1
  393. package/dist/transports/stdio.d.ts.map +1 -1
  394. package/dist/transports/stdio.js +2 -0
  395. package/dist/transports/stdio.js.map +1 -1
  396. package/dist/transports/thinStdio.d.ts +22 -0
  397. package/dist/transports/thinStdio.d.ts.map +1 -0
  398. package/dist/transports/thinStdio.js +218 -0
  399. package/dist/transports/thinStdio.js.map +1 -0
  400. package/dist/transports/types.d.ts +8 -1
  401. package/dist/transports/types.d.ts.map +1 -1
  402. package/dist/types/agent-services.d.ts +7 -0
  403. package/dist/types/agent-services.d.ts.map +1 -1
  404. package/dist/version.d.ts +5 -0
  405. package/dist/version.d.ts.map +1 -0
  406. package/dist/version.js +23 -0
  407. package/dist/version.js.map +1 -0
  408. package/package.json +20 -4
  409. package/templates/AGENT.md +3 -0
  410. package/templates/CLAUDE-decibel.md +11 -0
  411. package/templates/com.decibel.daemon.plist +6 -1
  412. package/dist/tools/deck.d.ts +0 -11
  413. package/dist/tools/deck.d.ts.map +0 -1
  414. package/dist/tools/deck.js +0 -1656
  415. package/dist/tools/deck.js.map +0 -1
  416. package/dist/tools/mother.d.ts +0 -11
  417. package/dist/tools/mother.d.ts.map +0 -1
  418. package/dist/tools/mother.js +0 -503
  419. package/dist/tools/mother.js.map +0 -1
  420. package/dist/tools/registry.d.ts +0 -3
  421. package/dist/tools/registry.d.ts.map +0 -1
  422. package/dist/tools/registry.js +0 -189
  423. package/dist/tools/registry.js.map +0 -1
  424. package/dist/tools/senken.d.ts +0 -11
  425. package/dist/tools/senken.d.ts.map +0 -1
  426. package/dist/tools/senken.js +0 -482
  427. package/dist/tools/senken.js.map +0 -1
  428. package/dist/tools/terminal.d.ts +0 -17
  429. package/dist/tools/terminal.d.ts.map +0 -1
  430. package/dist/tools/terminal.js +0 -968
  431. package/dist/tools/terminal.js.map +0 -1
  432. package/dist/tools/toolsIndex.d.ts +0 -5
  433. package/dist/tools/toolsIndex.d.ts.map +0 -1
  434. package/dist/tools/toolsIndex.js +0 -37
  435. package/dist/tools/toolsIndex.js.map +0 -1
@@ -0,0 +1,218 @@
1
+ // ============================================================================
2
+ // Post Office Tools — EPIC-0037
3
+ // ============================================================================
4
+ // Seven verbs, one per tool. The surface is deliberately exactly the far side's
5
+ // surface: an eighth verb is a contract change across two repos, so there is no
6
+ // convenience action here that composes several.
7
+ // ============================================================================
8
+ import { toolSuccess, toolError, requireFields } from '../shared/index.js';
9
+ import { agentsList, threadsOpen, messagesSend, messagesRead, messagesAck, handoffRequest, handoffRespond, isPostOfficeError, } from '../postoffice.js';
10
+ /**
11
+ * Post office failures carry a code and usually a hint that names the fix.
12
+ * Flattening them into a bare message would discard the actionable half — an
13
+ * unconfigured credential and a revoked one need different responses.
14
+ */
15
+ function settle(result) {
16
+ if (isPostOfficeError(result)) {
17
+ return toolError(JSON.stringify({ error: result.error, code: result.code, hint: result.hint }));
18
+ }
19
+ return toolSuccess(result);
20
+ }
21
+ export const postOfficeAgentsListTool = {
22
+ definition: {
23
+ name: 'postoffice_agents_list',
24
+ description: 'List agents reachable through AgentHQ, with live presence. A view over presence, not a second roster.',
25
+ annotations: { title: 'List Agents', readOnlyHint: true, destructiveHint: false, idempotentHint: true },
26
+ inputSchema: { type: 'object', properties: {} },
27
+ },
28
+ handler: async () => {
29
+ try {
30
+ return settle(await agentsList());
31
+ }
32
+ catch (err) {
33
+ return toolError(err instanceof Error ? err.message : String(err));
34
+ }
35
+ },
36
+ };
37
+ export const postOfficeThreadsOpenTool = {
38
+ definition: {
39
+ name: 'postoffice_threads_open',
40
+ description: 'Open a conversation thread. A thread is the unit a handoff happens inside — open one before sending.',
41
+ annotations: { title: 'Open Thread', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
42
+ inputSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ subject: { type: 'string', description: 'What the thread is about. Required.' },
46
+ project: { type: 'string', description: 'Optional HQ project UUID (not a Decibel project slug — hq.agent_threads.project_id is a uuid). Omit unless you hold the uuid.' },
47
+ intent: { type: 'string', description: 'Optional free-text intent for the thread as a whole.' },
48
+ },
49
+ required: ['subject'],
50
+ },
51
+ },
52
+ handler: async (args) => {
53
+ try {
54
+ requireFields(args, 'subject');
55
+ return settle(await threadsOpen(args));
56
+ }
57
+ catch (err) {
58
+ return toolError(err instanceof Error ? err.message : String(err));
59
+ }
60
+ },
61
+ };
62
+ export const postOfficeMessagesSendTool = {
63
+ definition: {
64
+ name: 'postoffice_messages_send',
65
+ description: 'Send a message to another agent inside a thread. The recipient is addressed by agent name or id; the sender is taken from the credential and cannot be spoofed.',
66
+ annotations: { title: 'Send Message', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
67
+ inputSchema: {
68
+ type: 'object',
69
+ properties: {
70
+ to: { type: 'string', description: 'Recipient agent name or uuid, in your org.' },
71
+ thread: { type: 'string', description: 'Thread id from postoffice_threads_open.' },
72
+ summary: { type: 'string', description: 'The message. Max 2048 characters.' },
73
+ intent: {
74
+ type: 'string',
75
+ enum: ['inform', 'request', 'respond'],
76
+ description: 'Why you are writing. Defaults to inform. Handoff intents are set by the handoff tools.',
77
+ },
78
+ context_refs: {
79
+ type: 'array',
80
+ items: { type: 'string' },
81
+ description: 'Up to 32 references (issue ids, file paths, URLs) the recipient will need.',
82
+ },
83
+ request: { type: 'string', description: 'What you are asking for, when intent is request.' },
84
+ expected_output: { type: 'string', description: 'What a good answer looks like. Max 1024 characters.' },
85
+ },
86
+ required: ['to', 'thread', 'summary'],
87
+ },
88
+ },
89
+ handler: async (args) => {
90
+ try {
91
+ requireFields(args, 'to', 'thread', 'summary');
92
+ return settle(await messagesSend(args));
93
+ }
94
+ catch (err) {
95
+ return toolError(err instanceof Error ? err.message : String(err));
96
+ }
97
+ },
98
+ };
99
+ export const postOfficeMessagesReadTool = {
100
+ definition: {
101
+ name: 'postoffice_messages_read',
102
+ description: 'Read your mail. Reading does NOT acknowledge — ack separately with postoffice_messages_ack once you have acted. Do not poll with status="sent": reading marks sent->read, so that filter cannot return a message twice and a reader that dies before acting loses it silently. Leave status unset to see everything still addressed to you.',
103
+ annotations: { title: 'Read Messages', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
104
+ inputSchema: {
105
+ type: 'object',
106
+ properties: {
107
+ thread: { type: 'string', description: 'Optional: restrict to one thread.' },
108
+ status: {
109
+ type: 'string',
110
+ enum: ['sent', 'read', 'acked', 'failed'],
111
+ description: 'Optional exact-status filter. Omit when polling — see the tool description.',
112
+ },
113
+ limit: { type: 'number', description: 'Max messages to return. Default 25, capped at 100.' },
114
+ },
115
+ },
116
+ },
117
+ handler: async (args) => {
118
+ try {
119
+ return settle(await messagesRead((args ?? {})));
120
+ }
121
+ catch (err) {
122
+ return toolError(err instanceof Error ? err.message : String(err));
123
+ }
124
+ },
125
+ };
126
+ export const postOfficeMessagesAckTool = {
127
+ definition: {
128
+ name: 'postoffice_messages_ack',
129
+ description: 'Acknowledge a message: "I have this and I am acting on it." Separate from reading on purpose. Acking twice is not an error and does not change status, but it currently REWRITES acked_at to the later time — so a retry moves the recorded acknowledgement time. Only the recipient can ack.',
130
+ // idempotentHint is FALSE deliberately, and it is not a mistake that the
131
+ // description says acking twice is safe. Status is idempotent; acked_at is
132
+ // not — a double ack measured 0.959s of drift against the live service on
133
+ // 2026-08-31, and the drift always moves the timestamp LATER, which flatters
134
+ // any ack-latency measure. A retry-on-timeout is exactly when a client acks
135
+ // twice and exactly when the first ack probably landed, so the error
136
+ // correlates with slow calls and hides them.
137
+ //
138
+ // Claiming idempotent here would tell a client that retrying is free. It is
139
+ // free for delivery and not free for the record. HQ owns the fix
140
+ // (coalesce(acked_at, now()) server-side); when it lands this flips back to
141
+ // true and this comment explains why it ever moved.
142
+ annotations: { title: 'Ack Message', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
143
+ inputSchema: {
144
+ type: 'object',
145
+ properties: { message: { type: 'string', description: 'Message id to acknowledge.' } },
146
+ required: ['message'],
147
+ },
148
+ },
149
+ handler: async (args) => {
150
+ try {
151
+ requireFields(args, 'message');
152
+ return settle(await messagesAck(args));
153
+ }
154
+ catch (err) {
155
+ return toolError(err instanceof Error ? err.message : String(err));
156
+ }
157
+ },
158
+ };
159
+ export const postOfficeHandoffRequestTool = {
160
+ definition: {
161
+ name: 'postoffice_handoff_request',
162
+ description: 'Ask another agent to take over a thread. Writes a handoff_request message so the handoff is legible in the thread it happened in, rather than in a side table.',
163
+ annotations: { title: 'Request Handoff', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
164
+ inputSchema: {
165
+ type: 'object',
166
+ properties: {
167
+ thread: { type: 'string', description: 'Thread to hand over.' },
168
+ to: { type: 'string', description: 'Agent to hand it to, by name or uuid.' },
169
+ summary: { type: 'string', description: 'What you are handing over and what state it is in.' },
170
+ },
171
+ required: ['thread'],
172
+ },
173
+ },
174
+ handler: async (args) => {
175
+ try {
176
+ requireFields(args, 'thread');
177
+ return settle(await handoffRequest(args));
178
+ }
179
+ catch (err) {
180
+ return toolError(err instanceof Error ? err.message : String(err));
181
+ }
182
+ },
183
+ };
184
+ export const postOfficeHandoffRespondTool = {
185
+ definition: {
186
+ name: 'postoffice_handoff_respond',
187
+ description: 'Accept or decline a handoff you were offered. Writes a handoff_respond message into the same thread.',
188
+ annotations: { title: 'Respond to Handoff', readOnlyHint: false, destructiveHint: false, idempotentHint: false },
189
+ inputSchema: {
190
+ type: 'object',
191
+ properties: {
192
+ thread: { type: 'string', description: 'Thread the handoff was offered in.' },
193
+ accept: { type: 'boolean', description: 'true to take it, false to decline.' },
194
+ summary: { type: 'string', description: 'Optional note explaining the decision.' },
195
+ },
196
+ required: ['thread', 'accept'],
197
+ },
198
+ },
199
+ handler: async (args) => {
200
+ try {
201
+ requireFields(args, 'thread', 'accept');
202
+ return settle(await handoffRespond(args));
203
+ }
204
+ catch (err) {
205
+ return toolError(err instanceof Error ? err.message : String(err));
206
+ }
207
+ },
208
+ };
209
+ export const postOfficeTools = [
210
+ postOfficeAgentsListTool,
211
+ postOfficeThreadsOpenTool,
212
+ postOfficeMessagesSendTool,
213
+ postOfficeMessagesReadTool,
214
+ postOfficeMessagesAckTool,
215
+ postOfficeHandoffRequestTool,
216
+ postOfficeHandoffRespondTool,
217
+ ];
218
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/postoffice/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAC/E,gFAAgF;AAChF,gFAAgF;AAChF,iDAAiD;AACjD,+EAA+E;AAG/E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,W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IACxB,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,yBAAyB;IACzB,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC"}
@@ -0,0 +1,78 @@
1
+ /** The seven verbs the far side implements. An eighth is a two-repo change. */
2
+ export type PostOfficeVerb = 'agents.list' | 'threads.open' | 'messages.send' | 'messages.read' | 'messages.ack' | 'handoff.request' | 'handoff.respond';
3
+ export interface PostOfficeError {
4
+ error: string;
5
+ code: 'HQ_NOT_CONFIGURED' | 'HQ_UNAUTHORIZED' | 'HQ_FORBIDDEN' | 'HQ_NOT_FOUND' | 'HQ_REJECTED' | 'HQ_UNAVAILABLE';
6
+ hint?: string;
7
+ }
8
+ export declare function isPostOfficeError(v: unknown): v is PostOfficeError;
9
+ /**
10
+ * One request to the post office.
11
+ *
12
+ * Every failure is mapped to something a caller can act on. The far side is
13
+ * deliberate about its status codes — 403 names the scope it wanted, 404
14
+ * distinguishes an unknown recipient from an unknown thread — and flattening
15
+ * those into "request failed" would discard the part that tells you what to fix.
16
+ */
17
+ export declare function postOfficeCall(verb: PostOfficeVerb, payload?: Record<string, unknown>): Promise<Record<string, unknown> | PostOfficeError>;
18
+ export declare function agentsList(): Promise<Record<string, unknown> | PostOfficeError>;
19
+ export interface ThreadsOpenInput {
20
+ subject: string;
21
+ /**
22
+ * HQ project UUID, NOT a Decibel project slug. hq.agent_threads.project_id is
23
+ * a uuid referencing hq.projects, so passing 'decibel-tools-mcp' is rejected
24
+ * by Postgres rather than resolved. There is no lookup verb in the seven, so
25
+ * a caller that does not already hold the uuid should omit this.
26
+ */
27
+ project?: string;
28
+ intent?: string;
29
+ }
30
+ export declare function threadsOpen(input: ThreadsOpenInput): Promise<Record<string, unknown> | PostOfficeError>;
31
+ export interface MessagesSendInput {
32
+ to: string;
33
+ thread: string;
34
+ summary: string;
35
+ intent?: 'inform' | 'request' | 'respond';
36
+ context_refs?: string[];
37
+ request?: string;
38
+ expected_output?: string;
39
+ }
40
+ export declare function messagesSend(input: MessagesSendInput): Promise<Record<string, unknown> | PostOfficeError>;
41
+ export interface MessagesReadInput {
42
+ thread?: string;
43
+ status?: string;
44
+ limit?: number;
45
+ }
46
+ /**
47
+ * Read this agent's mail.
48
+ *
49
+ * `status` is deliberately NOT defaulted, and polling must not set it to
50
+ * 'sent'. The far side marks sent -> read as a side effect of reading, so a
51
+ * mailbox query filtered to status='sent' never returns a message twice: a
52
+ * reader that fetches and then dies before acting has silently consumed it,
53
+ * and no restart recovers it. Unfiltered, the same message comes back as
54
+ * 'read' and can still be acted on.
55
+ *
56
+ * That is the whole reason read and ack are separate verbs — at-least-once
57
+ * beats at-most-once here, because a duplicated message costs a minute and a
58
+ * dropped handoff stalls work invisibly.
59
+ */
60
+ export declare function messagesRead(input?: MessagesReadInput): Promise<Record<string, unknown> | PostOfficeError>;
61
+ export interface MessagesAckInput {
62
+ message: string;
63
+ }
64
+ /** Idempotent by construction on the far side: acking twice is not an error. */
65
+ export declare function messagesAck(input: MessagesAckInput): Promise<Record<string, unknown> | PostOfficeError>;
66
+ export interface HandoffRequestInput {
67
+ thread: string;
68
+ to?: string;
69
+ summary?: string;
70
+ }
71
+ export declare function handoffRequest(input: HandoffRequestInput): Promise<Record<string, unknown> | PostOfficeError>;
72
+ export interface HandoffRespondInput {
73
+ thread: string;
74
+ accept: boolean;
75
+ summary?: string;
76
+ }
77
+ export declare function handoffRespond(input: HandoffRespondInput): Promise<Record<string, unknown> | PostOfficeError>;
78
+ //# sourceMappingURL=postoffice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postoffice.d.ts","sourceRoot":"","sources":["../../src/tools/postoffice.ts"],"names":[],"mappings":"AAiCA,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,cAAc,GACd,eAAe,GACf,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAC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AO,EAAE,MAAM,CAAC;CAAE;AACtD,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,sDAElD;AAED,MAAM,WAAW,mBAAmB;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAAE;AACvF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sDAExD;AAED,MAAM,WAAW,mBAAmB;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAAE;AAC3F,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,sDAExD"}
@@ -0,0 +1,199 @@
1
+ // ============================================================================
2
+ // Post Office — the client half of EPIC-0037
3
+ // ============================================================================
4
+ // AgentHQ runs the post office: hq.agent_threads / hq.agent_messages behind an
5
+ // edge function that speaks seven verbs over a bearer credential. ChatGPT could
6
+ // already authenticate and write into a thread; Claude Code could not read or
7
+ // ack, which is the only thing that stood between here and a round trip.
8
+ //
9
+ // This module is a transport, not a second model. It does not cache messages,
10
+ // does not maintain its own inbox, and does not decide delivery — the runtime
11
+ // on the other side owns all of that. Everything here maps one facade action to
12
+ // one verb and surfaces what came back.
13
+ //
14
+ // THE CREDENTIAL IS NEVER LOGGED. It is read from the environment or
15
+ // ~/.decibel/config.yaml and used only as an Authorization header. It is not a
16
+ // tool argument, so it never reaches ~/.decibel/logs/dispatch.jsonl, which is
17
+ // written to disk in plaintext. Nothing here may put it in an error message
18
+ // either: an access token lasts an hour and a refresh token thirty days, so a
19
+ // leak into a rotated log file is not a momentary exposure.
20
+ // ============================================================================
21
+ import { log } from '../config.js';
22
+ import { loadConfig } from '../daemonConfig.js';
23
+ /**
24
+ * Default origin. NOT hq.decibelsystems.com — that host has no DNS at all
25
+ * (verified 2026-08-30, unresolvable). Pointing at it fails closed with a
26
+ * DNS error rather than anything a caller can act on.
27
+ */
28
+ const DEFAULT_HQ_URL = 'https://home.theagenthq.app';
29
+ const POST_OFFICE_PATH = '/agents/mcp';
30
+ const REQUEST_TIMEOUT_MS = 15_000;
31
+ export function isPostOfficeError(v) {
32
+ return typeof v === 'object' && v !== null && 'code' in v && 'error' in v;
33
+ }
34
+ /**
35
+ * Resolve the endpoint and credential.
36
+ *
37
+ * Env wins over config so a session can point at a staging HQ without editing
38
+ * a file that other processes read. Returns an error rather than throwing,
39
+ * because "you have not set this up yet" is a normal state for most projects
40
+ * and should read as instructions, not as a stack trace.
41
+ */
42
+ function resolveCredential() {
43
+ const cfg = loadConfig();
44
+ const url = (process.env.DECIBEL_HQ_URL || cfg.hq?.url || DEFAULT_HQ_URL).replace(/\/+$/, '');
45
+ const token = process.env.DECIBEL_HQ_TOKEN || cfg.hq?.token;
46
+ if (!token) {
47
+ return {
48
+ error: 'No AgentHQ credential is configured, so this agent cannot reach the post office.',
49
+ code: 'HQ_NOT_CONFIGURED',
50
+ hint: 'A credential is issued once and never recoverable. An org admin runs ' +
51
+ "hq.issue_agent_token(p_org, p_agent_name, ...) and it returns the raw token exactly once. " +
52
+ 'Then set DECIBEL_HQ_TOKEN, or add hq.token to ~/.decibel/config.yaml. ' +
53
+ `Endpoint currently resolves to ${url}${POST_OFFICE_PATH}.`,
54
+ };
55
+ }
56
+ return { url, token };
57
+ }
58
+ /**
59
+ * One request to the post office.
60
+ *
61
+ * Every failure is mapped to something a caller can act on. The far side is
62
+ * deliberate about its status codes — 403 names the scope it wanted, 404
63
+ * distinguishes an unknown recipient from an unknown thread — and flattening
64
+ * those into "request failed" would discard the part that tells you what to fix.
65
+ */
66
+ export async function postOfficeCall(verb, payload = {}) {
67
+ const cred = resolveCredential();
68
+ if (isPostOfficeError(cred))
69
+ return cred;
70
+ const endpoint = `${cred.url}${POST_OFFICE_PATH}`;
71
+ const controller = new AbortController();
72
+ const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
73
+ let res;
74
+ try {
75
+ res = await fetch(endpoint, {
76
+ method: 'POST',
77
+ headers: {
78
+ 'Content-Type': 'application/json',
79
+ // The only place the credential appears. Not logged, not echoed.
80
+ Authorization: `Bearer ${cred.token}`,
81
+ },
82
+ body: JSON.stringify({ verb, ...payload }),
83
+ signal: controller.signal,
84
+ });
85
+ }
86
+ catch (err) {
87
+ const detail = err instanceof Error ? err.message : String(err);
88
+ return {
89
+ error: `Could not reach the post office at ${endpoint}: ${detail}`,
90
+ code: 'HQ_UNAVAILABLE',
91
+ hint: 'Check the host resolves and is reachable. Note hq.decibelsystems.com has no DNS — ' +
92
+ `the working origin is ${DEFAULT_HQ_URL}.`,
93
+ };
94
+ }
95
+ finally {
96
+ clearTimeout(timer);
97
+ }
98
+ const text = await res.text();
99
+ let body;
100
+ try {
101
+ body = JSON.parse(text);
102
+ }
103
+ catch {
104
+ return {
105
+ error: `Post office returned ${res.status} with a non-JSON body: ${text.slice(0, 200)}`,
106
+ code: 'HQ_UNAVAILABLE',
107
+ };
108
+ }
109
+ if (res.ok) {
110
+ log(`PostOffice: ${verb} ok`);
111
+ return body;
112
+ }
113
+ // The far side attaches `detail` to rejections that came from Postgres —
114
+ // a CHECK bound, a type mismatch, a missing FK. That detail IS the
115
+ // actionable half: "thread_rejected" says nothing, while
116
+ // 'invalid input syntax for type uuid: "decibel-tools-mcp"' says exactly
117
+ // what to pass instead. Dropping it was the first thing that cost a
118
+ // round-trip attempt to diagnose.
119
+ const base = typeof body.error === 'string' ? body.error : `HTTP ${res.status}`;
120
+ const detail = typeof body.detail === 'string' ? body.detail : undefined;
121
+ const message = detail ? `${base}: ${detail}` : base;
122
+ if (res.status === 401) {
123
+ return {
124
+ error: `The post office rejected this agent's credential: ${message}`,
125
+ code: 'HQ_UNAUTHORIZED',
126
+ hint: 'The token is wrong, revoked, or expired. Tokens are stored as a sha256 and cannot be ' +
127
+ 'recovered — issue a new one with hq.issue_agent_token and replace DECIBEL_HQ_TOKEN.',
128
+ };
129
+ }
130
+ if (res.status === 403) {
131
+ const required = typeof body.required === 'string' ? body.required : 'a scope';
132
+ return {
133
+ error: `This credential lacks ${required}.`,
134
+ code: 'HQ_FORBIDDEN',
135
+ hint: 'Reads need postoffice.read and writes need postoffice.write. Re-issue with the scope.',
136
+ };
137
+ }
138
+ if (res.status === 404) {
139
+ return { error: message, code: 'HQ_NOT_FOUND' };
140
+ }
141
+ if (res.status === 400) {
142
+ const supported = Array.isArray(body.supported)
143
+ ? ` Supported verbs: ${body.supported.join(', ')}.`
144
+ : '';
145
+ return { error: `${message}${supported}`, code: 'HQ_REJECTED' };
146
+ }
147
+ return { error: `Post office error (${res.status}): ${message}`, code: 'HQ_UNAVAILABLE' };
148
+ }
149
+ // ============================================================================
150
+ // Verbs
151
+ // ============================================================================
152
+ export function agentsList() {
153
+ return postOfficeCall('agents.list');
154
+ }
155
+ export function threadsOpen(input) {
156
+ return postOfficeCall('threads.open', {
157
+ subject: input.subject,
158
+ project: input.project,
159
+ intent: input.intent,
160
+ });
161
+ }
162
+ export function messagesSend(input) {
163
+ return postOfficeCall('messages.send', { ...input });
164
+ }
165
+ /**
166
+ * Read this agent's mail.
167
+ *
168
+ * `status` is deliberately NOT defaulted, and polling must not set it to
169
+ * 'sent'. The far side marks sent -> read as a side effect of reading, so a
170
+ * mailbox query filtered to status='sent' never returns a message twice: a
171
+ * reader that fetches and then dies before acting has silently consumed it,
172
+ * and no restart recovers it. Unfiltered, the same message comes back as
173
+ * 'read' and can still be acted on.
174
+ *
175
+ * That is the whole reason read and ack are separate verbs — at-least-once
176
+ * beats at-most-once here, because a duplicated message costs a minute and a
177
+ * dropped handoff stalls work invisibly.
178
+ */
179
+ export function messagesRead(input = {}) {
180
+ const payload = {};
181
+ if (input.thread)
182
+ payload.thread = input.thread;
183
+ if (input.status)
184
+ payload.status = input.status;
185
+ if (input.limit)
186
+ payload.limit = input.limit;
187
+ return postOfficeCall('messages.read', payload);
188
+ }
189
+ /** Idempotent by construction on the far side: acking twice is not an error. */
190
+ export function messagesAck(input) {
191
+ return postOfficeCall('messages.ack', { message: input.message });
192
+ }
193
+ export function handoffRequest(input) {
194
+ return postOfficeCall('handoff.request', { ...input });
195
+ }
196
+ export function handoffRespond(input) {
197
+ return postOfficeCall('handoff.respond', { ...input });
198
+ }
199
+ //# sourceMappingURL=postoffice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postoffice.js","sourceRoot":"","sources":["../../src/tools/postoffice.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,wCAAwC;AACxC,EAAE;AACF,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,4DAA4D;AAC5D,+EAA+E;AAE/E,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,MAAM,gBAAgB,GAAG,aAAa,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAwBlC,MAAM,UAAU,iBAAiB,CAAC,CAAU;IAC1C,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC;AAC5E,CAAC;AAID;;;;;;;GAOG;AACH,SAAS,iBAAiB;IACxB,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC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AC"}
@@ -31,6 +31,13 @@ export interface ListProvenanceInput {
31
31
  export interface ListProvenanceOutput {
32
32
  events: ProvenanceEvent[];
33
33
  total_count: number;
34
+ /**
35
+ * Records that could not be read or parsed and are therefore absent from
36
+ * `events`. Zero on a healthy store. Present so that a short list is
37
+ * detectable — an empty result with unreadable_count > 0 means "could not
38
+ * read", which is a different fact from "no activity".
39
+ */
40
+ unreadable_count: number;
34
41
  }
35
42
  export interface ProjectResolutionError {
36
43
  error: 'project_resolution_failed';
@@ -47,8 +54,17 @@ export declare function generateEventId(): string;
47
54
  */
48
55
  export declare function hashContent(content: string): string;
49
56
  /**
50
- * Get the default actor ID from environment or fallback.
51
- * Priority: DECIBEL_ACTOR_ID env var > git config > $USER
57
+ * Get the default actor ID.
58
+ * Priority: the acting identity for this dispatch > DECIBEL_ACTOR_ID > git > $USER
59
+ *
60
+ * The first step is the one added by EPIC-0040, and it is what makes a
61
+ * provenance event agree with the record it describes. A call arriving over
62
+ * the daemon with an X-User-Key resolves to `user:<uuid>`; re-deriving from
63
+ * git here would have attributed that event to whoever owns the box the
64
+ * daemon runs on, which is a different person entirely and silently so.
65
+ *
66
+ * Outside a dispatch — a direct in-process caller, a test, a script — there is
67
+ * no scope open and the original env/git/$USER order stands unchanged.
52
68
  */
53
69
  export declare function getDefaultActorId(): string;
54
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../src/tools/provenance.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AACjH,MAAM,MAAM,UAAU,GAClB,kBAAkB,GAClB,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,WAAW,GAC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