jg-agent-hq 1.1.0 → 3.0.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 (411) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +51 -17
  3. package/api/README.md +390 -69
  4. package/dist/accounts/accounts.d.ts +21 -0
  5. package/dist/accounts/accounts.js +37 -0
  6. package/dist/accounts/index.d.ts +1 -0
  7. package/dist/accounts/index.js +2 -0
  8. package/dist/actions/actions.d.ts +59 -6
  9. package/dist/actions/actions.js +558 -372
  10. package/dist/actions/live/live.d.ts +2 -0
  11. package/dist/actions/live/live.js +11 -1
  12. package/dist/actions/reads.d.ts +6 -1
  13. package/dist/actions/reads.js +33 -2
  14. package/dist/agent-tools/agent-tools.d.ts +6 -0
  15. package/dist/agent-tools/agent-tools.js +181 -0
  16. package/dist/agent-tools/constants.d.ts +7 -0
  17. package/dist/agent-tools/constants.js +45 -0
  18. package/dist/agent-tools/index.d.ts +4 -0
  19. package/dist/agent-tools/index.js +4 -0
  20. package/dist/agent-tools/mcp/index.d.ts +1 -0
  21. package/dist/agent-tools/mcp/index.js +2 -0
  22. package/dist/agent-tools/mcp/mcp.d.ts +7 -0
  23. package/dist/agent-tools/mcp/mcp.js +50 -0
  24. package/dist/agent-tools/types.d.ts +64 -0
  25. package/dist/agent-tools/types.js +1 -0
  26. package/dist/agent-tools/utilities.d.ts +13 -0
  27. package/dist/agent-tools/utilities.js +37 -0
  28. package/dist/cli/cli.js +70 -43
  29. package/dist/cli/utilities.d.ts +3 -0
  30. package/dist/cli/utilities.js +30 -0
  31. package/dist/collaboration/collaboration.d.ts +7 -0
  32. package/dist/collaboration/collaboration.js +119 -0
  33. package/dist/collaboration/constants.d.ts +2 -0
  34. package/dist/collaboration/constants.js +3 -0
  35. package/dist/collaboration/dispatch/dispatch.d.ts +12 -0
  36. package/dist/collaboration/dispatch/dispatch.js +148 -0
  37. package/dist/collaboration/dispatch/index.d.ts +3 -0
  38. package/dist/collaboration/dispatch/index.js +4 -0
  39. package/dist/collaboration/dispatch/types.d.ts +632 -0
  40. package/dist/collaboration/dispatch/types.js +44 -0
  41. package/dist/collaboration/grants/grants.d.ts +45 -0
  42. package/dist/collaboration/grants/grants.js +131 -0
  43. package/dist/collaboration/grants/index.d.ts +1 -0
  44. package/dist/collaboration/grants/index.js +2 -0
  45. package/dist/collaboration/identity/credentials.d.ts +17 -0
  46. package/dist/collaboration/identity/credentials.js +182 -0
  47. package/dist/collaboration/identity/index.d.ts +4 -0
  48. package/dist/collaboration/identity/index.js +4 -0
  49. package/dist/collaboration/identity/types.d.ts +171 -0
  50. package/dist/collaboration/identity/types.js +87 -0
  51. package/dist/collaboration/index.d.ts +3 -0
  52. package/dist/collaboration/index.js +3 -0
  53. package/dist/collaboration/types.d.ts +25 -0
  54. package/dist/collaboration/types.js +1 -0
  55. package/dist/contracts/accounts/index.d.ts +4 -0
  56. package/dist/contracts/accounts/index.js +3 -0
  57. package/dist/contracts/accounts/types.d.ts +66 -0
  58. package/dist/contracts/accounts/types.js +57 -0
  59. package/dist/contracts/actions/index.d.ts +2 -2
  60. package/dist/contracts/actions/index.js +1 -1
  61. package/dist/contracts/actions/types.d.ts +536 -60
  62. package/dist/contracts/actions/types.js +99 -19
  63. package/dist/contracts/agent-tools/index.d.ts +2 -0
  64. package/dist/contracts/agent-tools/index.js +2 -0
  65. package/dist/contracts/agent-tools/types.d.ts +695 -0
  66. package/dist/contracts/agent-tools/types.js +125 -0
  67. package/dist/contracts/browser/types.d.ts +483 -187
  68. package/dist/contracts/browser/types.js +0 -3
  69. package/dist/contracts/collaboration/index.d.ts +4 -0
  70. package/dist/contracts/collaboration/index.js +4 -0
  71. package/dist/contracts/collaboration/reports/constants.d.ts +1 -0
  72. package/dist/contracts/collaboration/reports/constants.js +2 -0
  73. package/dist/contracts/collaboration/reports/index.d.ts +3 -0
  74. package/dist/contracts/collaboration/reports/index.js +3 -0
  75. package/dist/contracts/collaboration/reports/types.d.ts +69 -0
  76. package/dist/contracts/collaboration/reports/types.js +53 -0
  77. package/dist/contracts/collaboration/types.d.ts +6734 -0
  78. package/dist/contracts/collaboration/types.js +696 -0
  79. package/dist/contracts/configuration/index.d.ts +2 -0
  80. package/dist/contracts/configuration/index.js +2 -0
  81. package/dist/contracts/configuration/types.d.ts +69 -0
  82. package/dist/contracts/configuration/types.js +56 -0
  83. package/dist/contracts/evidence/index.d.ts +2 -0
  84. package/dist/contracts/evidence/index.js +2 -0
  85. package/dist/contracts/evidence/types.d.ts +160 -0
  86. package/dist/contracts/evidence/types.js +74 -0
  87. package/dist/contracts/extensions/index.d.ts +4 -0
  88. package/dist/contracts/extensions/index.js +3 -0
  89. package/dist/contracts/extensions/types.d.ts +150 -0
  90. package/dist/contracts/extensions/types.js +93 -0
  91. package/dist/contracts/identities/index.d.ts +2 -1
  92. package/dist/contracts/identities/index.js +1 -1
  93. package/dist/contracts/identities/types.d.ts +7 -0
  94. package/dist/contracts/identities/types.js +8 -0
  95. package/dist/contracts/index.d.ts +31 -6
  96. package/dist/contracts/index.js +26 -4
  97. package/dist/contracts/inputs/index.d.ts +2 -0
  98. package/dist/contracts/inputs/index.js +2 -0
  99. package/dist/contracts/inputs/types.d.ts +30 -0
  100. package/dist/contracts/inputs/types.js +21 -0
  101. package/dist/contracts/models/index.d.ts +2 -0
  102. package/dist/contracts/models/index.js +2 -0
  103. package/dist/contracts/models/types.d.ts +34 -0
  104. package/dist/contracts/models/types.js +28 -0
  105. package/dist/contracts/plans/types.d.ts +11 -17
  106. package/dist/contracts/plans/types.js +2 -1
  107. package/dist/contracts/providers/index.d.ts +2 -0
  108. package/dist/contracts/providers/index.js +2 -0
  109. package/dist/contracts/providers/types.d.ts +1276 -0
  110. package/dist/contracts/providers/types.js +79 -0
  111. package/dist/contracts/results/index.d.ts +2 -0
  112. package/dist/contracts/results/index.js +2 -0
  113. package/dist/contracts/results/types.d.ts +44 -0
  114. package/dist/contracts/results/types.js +55 -0
  115. package/dist/contracts/skills/types.d.ts +25 -3
  116. package/dist/contracts/skills/types.js +7 -1
  117. package/dist/contracts/types.d.ts +10908 -2321
  118. package/dist/contracts/types.js +99 -22
  119. package/dist/extensions/extensions.d.ts +25 -0
  120. package/dist/extensions/extensions.js +176 -0
  121. package/dist/extensions/index.d.ts +1 -0
  122. package/dist/extensions/index.js +2 -0
  123. package/dist/index.d.ts +13 -0
  124. package/dist/index.js +4 -0
  125. package/dist/ipc/client.d.ts +1 -1
  126. package/dist/ipc/client.js +16 -1
  127. package/dist/plans/admission.d.ts +134 -21
  128. package/dist/plans/admission.js +110 -4
  129. package/dist/plans/authority.d.ts +2 -0
  130. package/dist/plans/authority.js +8 -0
  131. package/dist/plans/documents.d.ts +23 -0
  132. package/dist/plans/documents.js +33 -2
  133. package/dist/plans/files.js +3 -1
  134. package/dist/plans/plans.d.ts +108 -21
  135. package/dist/plans/plans.js +3 -1
  136. package/dist/plans/types.d.ts +5 -0
  137. package/dist/providers/claude/accounts/accounts.d.ts +6 -0
  138. package/dist/providers/claude/accounts/accounts.js +41 -0
  139. package/dist/providers/claude/accounts/index.d.ts +1 -0
  140. package/dist/providers/claude/accounts/index.js +2 -0
  141. package/dist/providers/claude/adapter.d.ts +7 -0
  142. package/dist/providers/claude/adapter.js +313 -0
  143. package/dist/providers/claude/authentication/authentication.d.ts +23 -0
  144. package/dist/providers/claude/authentication/authentication.js +67 -0
  145. package/dist/providers/claude/authentication/index.d.ts +1 -0
  146. package/dist/providers/claude/authentication/index.js +2 -0
  147. package/dist/providers/claude/claude.d.ts +82 -2
  148. package/dist/providers/claude/claude.js +112 -14
  149. package/dist/providers/claude/configuration/configuration.d.ts +16 -0
  150. package/dist/providers/claude/configuration/configuration.js +94 -0
  151. package/dist/providers/claude/configuration/index.d.ts +1 -0
  152. package/dist/providers/claude/configuration/index.js +2 -0
  153. package/dist/providers/claude/control/control.d.ts +147 -5
  154. package/dist/providers/claude/control/control.js +310 -60
  155. package/dist/providers/claude/control/permissions.d.ts +1 -1
  156. package/dist/providers/claude/control/permissions.js +86 -3
  157. package/dist/providers/claude/control/stream.js +78 -4
  158. package/dist/providers/claude/control/types.d.ts +14 -5
  159. package/dist/providers/claude/extensions/extensions.d.ts +18 -0
  160. package/dist/providers/claude/extensions/extensions.js +168 -0
  161. package/dist/providers/claude/extensions/index.d.ts +1 -0
  162. package/dist/providers/claude/extensions/index.js +2 -0
  163. package/dist/providers/claude/history/history.model.d.ts +2 -0
  164. package/dist/providers/claude/history/history.model.js +110 -69
  165. package/dist/providers/claude/history/types.d.ts +3610 -371
  166. package/dist/providers/claude/history/types.js +10 -2
  167. package/dist/providers/claude/history/utilities.d.ts +1 -1
  168. package/dist/providers/claude/history/utilities.js +32 -3
  169. package/dist/providers/claude/index.d.ts +1 -0
  170. package/dist/providers/claude/index.js +1 -0
  171. package/dist/providers/claude/models/index.d.ts +1 -0
  172. package/dist/providers/claude/models/index.js +2 -0
  173. package/dist/providers/claude/models/models.d.ts +9 -0
  174. package/dist/providers/claude/models/models.js +67 -0
  175. package/dist/providers/claude/models/types.d.ts +14 -0
  176. package/dist/providers/claude/models/types.js +22 -0
  177. package/dist/providers/claude/rpc.d.ts +15 -3
  178. package/dist/providers/claude/rpc.js +38 -7
  179. package/dist/providers/claude/transformers.js +14 -1
  180. package/dist/providers/claude/types.d.ts +4 -11
  181. package/dist/providers/claude/types.js +5 -8
  182. package/dist/providers/codex/accounts/accounts.d.ts +10 -0
  183. package/dist/providers/codex/accounts/accounts.js +48 -0
  184. package/dist/providers/codex/accounts/index.d.ts +1 -0
  185. package/dist/providers/codex/accounts/index.js +2 -0
  186. package/dist/providers/codex/adapter.d.ts +6 -0
  187. package/dist/providers/codex/adapter.js +273 -0
  188. package/dist/providers/codex/approvals/types.d.ts +21 -0
  189. package/dist/providers/codex/approvals/types.js +23 -0
  190. package/dist/providers/codex/approvals/utilities.d.ts +2 -2
  191. package/dist/providers/codex/approvals/utilities.js +53 -30
  192. package/dist/providers/codex/authentication/authentication.d.ts +37 -0
  193. package/dist/providers/codex/authentication/authentication.js +242 -0
  194. package/dist/providers/codex/authentication/index.d.ts +1 -0
  195. package/dist/providers/codex/authentication/index.js +2 -0
  196. package/dist/providers/codex/codex.d.ts +2 -1
  197. package/dist/providers/codex/codex.js +331 -43
  198. package/dist/providers/codex/configuration/configuration.d.ts +44 -0
  199. package/dist/providers/codex/configuration/configuration.js +137 -0
  200. package/dist/providers/codex/configuration/index.d.ts +1 -0
  201. package/dist/providers/codex/configuration/index.js +2 -0
  202. package/dist/providers/codex/events.d.ts +9 -0
  203. package/dist/providers/codex/events.js +214 -0
  204. package/dist/providers/codex/extensions/extensions.d.ts +14 -0
  205. package/dist/providers/codex/extensions/extensions.js +213 -0
  206. package/dist/providers/codex/extensions/index.d.ts +1 -0
  207. package/dist/providers/codex/extensions/index.js +2 -0
  208. package/dist/providers/codex/index.d.ts +1 -0
  209. package/dist/providers/codex/index.js +1 -0
  210. package/dist/providers/codex/models/index.d.ts +1 -0
  211. package/dist/providers/codex/models/index.js +2 -0
  212. package/dist/providers/codex/models/models.d.ts +11 -0
  213. package/dist/providers/codex/models/models.js +23 -0
  214. package/dist/providers/codex/models/types.d.ts +15 -0
  215. package/dist/providers/codex/models/types.js +19 -0
  216. package/dist/providers/codex/rpc.d.ts +1 -1
  217. package/dist/providers/codex/rpc.js +4 -2
  218. package/dist/providers/codex/transformers.d.ts +4 -2
  219. package/dist/providers/codex/transformers.js +58 -5
  220. package/dist/providers/codex/types.d.ts +120 -11
  221. package/dist/providers/codex/types.js +14 -2
  222. package/dist/providers/configuration/configuration.d.ts +16 -0
  223. package/dist/providers/configuration/configuration.js +50 -0
  224. package/dist/providers/configuration/index.d.ts +1 -0
  225. package/dist/providers/configuration/index.js +2 -0
  226. package/dist/providers/constants.d.ts +7 -0
  227. package/dist/providers/constants.js +11 -0
  228. package/dist/providers/elicitation/elicitation.d.ts +16 -0
  229. package/dist/providers/elicitation/elicitation.js +39 -0
  230. package/dist/providers/elicitation/index.d.ts +1 -0
  231. package/dist/providers/elicitation/index.js +2 -0
  232. package/dist/providers/extensions/index.d.ts +2 -0
  233. package/dist/providers/extensions/index.js +2 -0
  234. package/dist/providers/extensions/types.d.ts +66 -0
  235. package/dist/providers/extensions/types.js +16 -0
  236. package/dist/providers/index.d.ts +10 -3
  237. package/dist/providers/index.js +9 -2
  238. package/dist/providers/inputs/index.d.ts +2 -0
  239. package/dist/providers/inputs/index.js +2 -0
  240. package/dist/providers/inputs/inputs.d.ts +13 -0
  241. package/dist/providers/inputs/inputs.js +108 -0
  242. package/dist/providers/lineage/index.d.ts +1 -0
  243. package/dist/providers/lineage/index.js +2 -0
  244. package/dist/providers/lineage/lineage.d.ts +8 -0
  245. package/dist/providers/lineage/lineage.js +24 -0
  246. package/dist/providers/process/index.d.ts +1 -0
  247. package/dist/providers/process/index.js +2 -0
  248. package/dist/providers/process/ownership.d.ts +11 -0
  249. package/dist/providers/process/ownership.js +63 -0
  250. package/dist/providers/process.js +5 -56
  251. package/dist/providers/registry/index.d.ts +3 -0
  252. package/dist/providers/registry/index.js +4 -0
  253. package/dist/providers/registry/registry.d.ts +43 -0
  254. package/dist/providers/registry/registry.js +594 -0
  255. package/dist/providers/registry/types.d.ts +13 -0
  256. package/dist/providers/registry/types.js +1 -0
  257. package/dist/providers/registry/utilities.d.ts +12 -0
  258. package/dist/providers/registry/utilities.js +45 -0
  259. package/dist/providers/registry/validations.d.ts +30 -0
  260. package/dist/providers/registry/validations.js +131 -0
  261. package/dist/providers/results/index.d.ts +1 -0
  262. package/dist/providers/results/index.js +2 -0
  263. package/dist/providers/results/results.d.ts +6 -0
  264. package/dist/providers/results/results.js +48 -0
  265. package/dist/providers/types.d.ts +204 -7
  266. package/dist/providers/types.js +19 -1
  267. package/dist/runtime/runtime.d.ts +4 -2
  268. package/dist/runtime/runtime.js +139 -82
  269. package/dist/runtime/state/index.d.ts +1 -1
  270. package/dist/runtime/state/index.js +1 -1
  271. package/dist/runtime/state/state.d.ts +16 -1
  272. package/dist/runtime/state/state.js +94 -3
  273. package/dist/runtime/types.d.ts +24 -2
  274. package/dist/runtime/types.js +8 -0
  275. package/dist/sessions/evidence/index.d.ts +3 -0
  276. package/dist/sessions/evidence/index.js +4 -0
  277. package/dist/sessions/evidence/types.d.ts +18 -0
  278. package/dist/sessions/evidence/types.js +24 -0
  279. package/dist/sessions/evidence/utilities.d.ts +41 -0
  280. package/dist/sessions/evidence/utilities.js +181 -0
  281. package/dist/sessions/sessions.d.ts +10 -3
  282. package/dist/sessions/sessions.js +107 -66
  283. package/dist/sessions/types.d.ts +1 -1
  284. package/dist/sessions/utilities.js +1 -1
  285. package/dist/skills/skills.d.ts +15 -3
  286. package/dist/skills/skills.js +28 -13
  287. package/dist/snapshots/artifacts.d.ts +7 -0
  288. package/dist/snapshots/artifacts.js +50 -0
  289. package/dist/snapshots/capture.d.ts +14 -0
  290. package/dist/snapshots/capture.js +142 -0
  291. package/dist/snapshots/constants.d.ts +5 -0
  292. package/dist/snapshots/constants.js +11 -0
  293. package/dist/snapshots/database.d.ts +20 -0
  294. package/dist/snapshots/database.js +262 -0
  295. package/dist/snapshots/fences.d.ts +15 -0
  296. package/dist/snapshots/fences.js +64 -0
  297. package/dist/snapshots/files.d.ts +45 -0
  298. package/dist/snapshots/files.js +196 -0
  299. package/dist/snapshots/index.d.ts +4 -0
  300. package/dist/snapshots/index.js +5 -0
  301. package/dist/snapshots/snapshots.d.ts +36 -0
  302. package/dist/snapshots/snapshots.js +186 -0
  303. package/dist/snapshots/snapshots.worker.d.ts +1 -0
  304. package/dist/snapshots/snapshots.worker.js +35 -0
  305. package/dist/snapshots/types.d.ts +176 -0
  306. package/dist/snapshots/types.js +70 -0
  307. package/dist/storage/constants.d.ts +6 -0
  308. package/dist/storage/constants.js +7 -0
  309. package/dist/storage/index.d.ts +5 -0
  310. package/dist/storage/index.js +7 -0
  311. package/dist/storage/schema/constants.d.ts +2 -0
  312. package/dist/storage/schema/constants.js +3 -0
  313. package/dist/storage/schema/index.d.ts +4 -0
  314. package/dist/storage/schema/index.js +5 -0
  315. package/dist/storage/schema/schema.d.ts +16 -0
  316. package/dist/storage/schema/schema.js +73 -0
  317. package/dist/storage/schema/types.d.ts +17 -0
  318. package/dist/storage/schema/types.js +8 -0
  319. package/dist/storage/schema/v1-to-v2.sql +1 -0
  320. package/dist/storage/schema/v1.sql +538 -0
  321. package/dist/storage/storage.d.ts +13 -0
  322. package/dist/storage/storage.js +98 -0
  323. package/dist/storage/types.d.ts +14 -0
  324. package/dist/storage/types.js +14 -0
  325. package/dist/storage/upgrade/index.d.ts +2 -0
  326. package/dist/storage/upgrade/index.js +2 -0
  327. package/dist/storage/upgrade/types.d.ts +61 -0
  328. package/dist/storage/upgrade/types.js +42 -0
  329. package/dist/storage/upgrade/upgrade.d.ts +33 -0
  330. package/dist/storage/upgrade/upgrade.js +196 -0
  331. package/dist/storage/upgrade/upgrade.worker.d.ts +1 -0
  332. package/dist/storage/upgrade/upgrade.worker.js +220 -0
  333. package/dist/store/browser/browser.model.js +15 -7
  334. package/dist/store/collaboration/authority.d.ts +228 -0
  335. package/dist/store/collaboration/authority.js +128 -0
  336. package/dist/store/collaboration/collaboration.model.d.ts +412 -0
  337. package/dist/store/collaboration/collaboration.model.js +254 -0
  338. package/dist/store/collaboration/constants.d.ts +13 -0
  339. package/dist/store/collaboration/constants.js +14 -0
  340. package/dist/store/collaboration/dispatch.d.ts +19 -0
  341. package/dist/store/collaboration/dispatch.js +197 -0
  342. package/dist/store/collaboration/identity.d.ts +21 -0
  343. package/dist/store/collaboration/identity.js +146 -0
  344. package/dist/store/collaboration/index.d.ts +3 -0
  345. package/dist/store/collaboration/index.js +5 -0
  346. package/dist/store/collaboration/invocation.d.ts +21 -0
  347. package/dist/store/collaboration/invocation.js +162 -0
  348. package/dist/store/collaboration/messages.d.ts +54 -0
  349. package/dist/store/collaboration/messages.js +157 -0
  350. package/dist/store/collaboration/outcomes.d.ts +11 -0
  351. package/dist/store/collaboration/outcomes.js +216 -0
  352. package/dist/store/collaboration/queries.d.ts +23 -0
  353. package/dist/store/collaboration/queries.js +259 -0
  354. package/dist/store/collaboration/reports.d.ts +37 -0
  355. package/dist/store/collaboration/reports.js +117 -0
  356. package/dist/store/collaboration/requests.d.ts +22 -0
  357. package/dist/store/collaboration/requests.js +111 -0
  358. package/dist/store/collaboration/search.d.ts +13 -0
  359. package/dist/store/collaboration/search.js +58 -0
  360. package/dist/store/collaboration/spawn.d.ts +33 -0
  361. package/dist/store/collaboration/spawn.js +96 -0
  362. package/dist/store/collaboration/streams.d.ts +13 -0
  363. package/dist/store/collaboration/streams.js +100 -0
  364. package/dist/store/collaboration/tasks.d.ts +20 -0
  365. package/dist/store/collaboration/tasks.js +169 -0
  366. package/dist/store/collaboration/transformers.d.ts +56 -0
  367. package/dist/store/collaboration/transformers.js +179 -0
  368. package/dist/store/collaboration/types.d.ts +25 -0
  369. package/dist/store/collaboration/types.js +8 -0
  370. package/dist/store/collaboration/utilities.d.ts +23 -0
  371. package/dist/store/collaboration/utilities.js +77 -0
  372. package/dist/store/collaboration/waits.d.ts +26 -0
  373. package/dist/store/collaboration/waits.js +114 -0
  374. package/dist/store/control/constants.d.ts +3 -3
  375. package/dist/store/control/constants.js +3 -3
  376. package/dist/store/control/control.model.d.ts +20 -3
  377. package/dist/store/control/control.model.js +456 -129
  378. package/dist/store/control/index.d.ts +4 -2
  379. package/dist/store/control/index.js +4 -1
  380. package/dist/store/control/transformers.d.ts +2 -2
  381. package/dist/store/control/transformers.js +12 -5
  382. package/dist/store/control/types.d.ts +602 -126
  383. package/dist/store/control/types.js +48 -8
  384. package/dist/store/plans/plans.model.js +22 -20
  385. package/dist/store/schema.d.ts +15 -0
  386. package/dist/store/schema.js +93 -0
  387. package/dist/store/schema.sql +430 -96
  388. package/dist/store/store.d.ts +4 -0
  389. package/dist/store/store.js +50 -18
  390. package/dist/store/store.worker.js +239 -166
  391. package/dist/store/types.d.ts +4653 -1414
  392. package/dist/store/types.js +48 -18
  393. package/docs/recovery.md +37 -0
  394. package/errors/README.md +60 -27
  395. package/package.json +5 -3
  396. package/dist/contracts/handoffs/index.d.ts +0 -2
  397. package/dist/contracts/handoffs/index.js +0 -2
  398. package/dist/contracts/handoffs/types.d.ts +0 -585
  399. package/dist/contracts/handoffs/types.js +0 -112
  400. package/dist/handoffs/handoffs.d.ts +0 -43
  401. package/dist/handoffs/handoffs.js +0 -465
  402. package/dist/handoffs/index.d.ts +0 -4
  403. package/dist/handoffs/index.js +0 -6
  404. package/dist/handoffs/types.d.ts +0 -492
  405. package/dist/handoffs/types.js +0 -29
  406. package/dist/handoffs/utilities.d.ts +0 -11
  407. package/dist/handoffs/utilities.js +0 -24
  408. package/dist/store/handoffs/handoffs.model.d.ts +0 -37
  409. package/dist/store/handoffs/handoffs.model.js +0 -150
  410. package/dist/store/handoffs/index.d.ts +0 -1
  411. package/dist/store/handoffs/index.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0
4
+
5
+ - Check protocol 0.2 plans with jg-plans 0.3.0 at each stage that grants authority: plan approval requires plan.md to conform, and finalization, sequence approval, authorization and execution require plan.md and milestones.md to conform together. Reading, status and revision workflows are unaffected, and plans without the 0.2 marker keep their current behavior.
6
+
7
+ - Version HQ storage independently of host user_version. Add explicit offline Node/CLI upgrades with a verified pre-upgrade backup, transactional rollback and uncertainty handling, retaining published 2.0.0 snapshots and version-specific restore fences.
8
+
9
+ - Expose native Codex credit balances and available earned resets without consuming them. Preserve valid single-bucket quota responses when the multi-bucket view is absent.
10
+ - Identify Claude five-hour and seven-day usage meters with explicit model/surface scopes, preserving independent windows, reset times and account-bound freshness. Keep older provider observations compatible.
11
+
12
+ ## 2.0.0
13
+
14
+ - Add provider-neutral session capabilities, native lifecycle/configuration, file inputs, structured results, permissions, account observations and extension controls. Detect usable native contracts instead of restricting CLI version labels; isolate unavailable providers.
15
+ - Add task-scoped agent identities, streams, subscriptions, requests, verified skill grants and bounded report storage/search. Agents can delegate, yield for named children and continue from their exact results across vendors or within one vendor. Replace the fixed-provider handoff API with this flow.
16
+ - Support optional verified jg-skills delegation without changing native explicit-only loading, later approval checkpoints or standalone workflows. Keep execution grants, native tool permissions, outcomes and operator approval separate.
17
+ - Expose trusted shared SQLite metadata and coordinated host maintenance. Capture WAL data, host tables, reports and registered plan companions; validate offline recovery with the matching private key and paused automation. Hosts own off-machine backup operations.
18
+ - Ship the current schema and API directly. Start with a fresh development state root when changing the schema; no data conversion is provided. Add public host examples and packed-consumer coverage for storage and recovery.
19
+
3
20
  ## 1.1.0
4
21
 
5
22
  - Rebuild the homepage around a native-session visual, local setup and three complete source-backed walkthroughs. Show cross-provider reviews and retained revision evidence with explicit host decisions.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # jg-agent-hq
2
2
 
3
- Workspace primitives for native coding agents. The public API provides owner-aware filesystem locks, Claude and Codex thread control, live input and history, actual account usage, and revision-bound plan authority.
3
+ A TypeScript library and local controller for applications that run coding agents. Create native Claude Code and Codex sessions, send work, handle permissions and follow results through one API. Agents collaborate through indexed streams, directed requests and exact reports, with explicit authority for delegated work.
4
+
5
+ Use it to build an agent dashboard, editor integration or automated development workflow. HQ owns local session control, agent identity, collaboration state and plan coordination. Your application owns its interface, authentication and off-machine backups. Native CLIs supply the coding harnesses, tools, skills and sign-in; additional providers can implement the same host contract.
4
6
 
5
7
  Requires Node.js 24.15.0 or later on Linux or macOS. The lock protocol uses POSIX ownership, private directories and process-liveness probes. Windows is outside the supported host contract.
6
8
 
@@ -35,21 +37,37 @@ Intentional failures use `Exception` from `jg-exception`, with the named string
35
37
 
36
38
  ## Local controller
37
39
 
38
- Install Codex and sign in through its native CLI, then start `jg-agent-hq serve --state-root .runtime --workspace-root /path/to/workspace`. Run `jg-agent-hq status --state-root .runtime` in a client. `threads`, `thread`, `turns`, `items` and `usage` read native information; `stop` waits for confirmed runtime shutdown.
40
+ Install the providers you want and sign in through their native CLIs, then start `jg-agent-hq serve --state-root .runtime --workspace-root /path/to/workspace`. Run `jg-agent-hq status --state-root .runtime` in a client. `threads`, `thread`, `turns`, `items` and `usage` read native information; `stop` waits for confirmed runtime shutdown.
39
41
 
40
42
  The Node API exposes `createAgentHq({ stateRoot, allowedRoots })` and `requestAgentHq(stateRoot, command)`. Configuration comes from these trusted operator inputs. Coding-instruction files are not runtime configuration.
41
43
 
42
- The controller owns its SQLite worker and native connections independently of client connections. Private state contains the lifetime owner, Unix socket and SQLite discovery metadata. Conversation bodies remain in the native providers' storage. Browsing never resumes an external session or starts inference. Quota windows come from native account observations, with explicit stale and unavailable states.
44
+ The controller owns its SQLite worker and native connections independently of client connections. Its provider registry starts each native integration only when selected. Storage and managed-session reads work without an installed coding CLI; an unavailable provider does not disable another provider. Private state contains the lifetime owner, Unix socket and SQLite discovery metadata. Conversation histories remain in native storage; HQ retains complete bounded final results on their action receipts. Browsing never resumes an external session or starts inference. Quota windows come from native account observations, with explicit stale and unavailable states. Usage reads include Codex credit balances and available earned-reset counts when reported, plus Claude five-hour and seven-day meters with their model/surface scopes and reset times.
45
+
46
+ Use `sessions` for discovery and `session-evidence` for newest-first historical evidence. These reads fit within 65,536 serialized bytes, retain exact native identities and content hashes, and continue large bodies in UTF-8 chunks. Select an item, turn or item kinds with filters. Matching names remain separate sessions. Provenance distinguishes native evidence from exact host submissions; historical text and quoted feedback never grant approval. See [bounded session evidence](api/README.md#bounded-session-evidence).
47
+
48
+ Trusted Node hosts can open the database described by `hq.storage` and keep application tables under their own prefix. HQ reserves `hq_`, validates its current schema stamp on startup, and leaves application schema ownership and `user_version` with the host. Use `hq.withStorageMaintenance(callback)` for host schema changes; it drains admitted work and rejects active native execution before the callback. Fresh state starts at HQ storage version 2. Published 2.0.0 state requires an explicit offline upgrade; startup never migrates. Stop HQ and independent database/plan writers, then run `jg-agent-hq upgrade-storage --state-root /path/to/state --backup-directory /private/backups/before-upgrade --workspace-root /path/to/workspace`. The backup destination must be absent under an existing private canonical parent. Keep the verified backup. Trusted Node hosts use `upgradeHqStorage(options)` for the same operation. See the [shared storage contract](api/README.md#shared-storage).
49
+
50
+ `createHqSnapshot(hq, destination)` captures quiescent local state through SQLite's backup API, including host tables, stored reports, action.key and registered plan companions. Busy checkpoints return a conflict without interrupting work. `inspectHqSnapshot(directory)` verifies the complete snapshot; `restoreHqSnapshot({ snapshotDirectory, destination })` validates and stages it into a new private recovery workspace. Version 1 and version 2 snapshots remain supported. Restored version 1 storage requires the explicit offline upgrade before startup. Restored automation is paused, skill grants are revoked, native ownership needs reconciliation and allowed roots must be selected explicitly. Hosts own remote backups; a failed disk can lose changes since the last successful off-machine backup. See [snapshot and restore](api/README.md#snapshot-and-restore) and [recovery](docs/recovery.md).
51
+
52
+ Provider IDs are bounded lowercase identifiers. Codex and Claude are built in; trusted Node hosts can register additional `IAgentProviderFactory` implementations through `providerFactories`. Capabilities report current operation support, provider/session scope and unavailable reasons. Native version labels are diagnostic metadata and never determine admission. Unknown essential control data fails explicitly. `jg-agent-hq/contracts` contains browser-safe schemas and types; importing it does not import the host runtime.
53
+
54
+ Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader validates required identity, workspace and chain fields, tolerates additive fields and mixed version labels, and keeps byte locations rather than conversation bodies in SQLite. Unknown ordered content is presented as unsupported; untrustworthy identity or ordering makes the affected read unavailable. File history cannot establish current execution state. See the [reader limits and freshness contract](api/README.md#claude-history).
55
+
56
+ Explicit actions create, name, adopt, resume and close threads; send idle messages; steer an exact running turn; queue the next message; interrupt; and answer native questions, permissions or MCP elicitation. Actions have stable UUIDs and durable receipts. Repeating the same request returns its receipt; changing that UUID's payload conflicts. A lost acknowledgement stays uncertain until the exact native response arrives or the operator makes an explicit recovery choice. HQ never resends uncertain input.
43
57
 
44
- The current read contracts were exercised against Codex 0.163.0 and Claude Code versions 2.1.304 and 2.1.306 on Linux. Unsupported native responses fail explicitly. `jg-agent-hq/contracts` contains browser-safe schemas and types; importing it does not import the host runtime.
58
+ Actions also fork native history into a distinct session, compact idle sessions, and use native archive/unarchive and history revert where supported. Forks retain exact native lineage and receive no plan execution authority from their source. Unarchive leaves a session inactive until explicitly resumed. Revert changes conversation history; it does not undo files. Claude exposes compaction and fork, with archive and conversation revert reported as unsupported.
45
59
 
46
- Use `--provider claude` for Claude history and usage; the default is `codex`. Claude connects lazily through its native structured CLI, with normal settings enabled and no user prompt. Usage requests explicitly disable the optional transcript-behavior scan. Its local history reader accepts only qualified transcript versions 2.1.296, 2.1.299, 2.1.304 and 2.1.306, including transcripts spanning these versions, keeps byte locations rather than conversation bodies in SQLite, and reports unsupported history as unavailable. File history cannot establish current execution state. See the [reader limits and freshness contract](api/README.md#claude-history).
60
+ Use `account --provider <id>` for safe native account metadata, and `mcp-servers --thread-id <id>` for configured server status. `mcp-tools` and `mcp-resources` select `--server-name <name>` and support bounded continuation. Native reload and authentication controls use the existing JSON `request` interface and durable action receipts. Login URLs are live presentation and are never saved in SQLite. See [native accounts and extensions](api/README.md#native-accounts-and-extensions).
47
61
 
48
- Explicit actions create, name, adopt, resume and close threads; send idle messages; steer an exact running turn; queue the next message; interrupt; and answer native questions or permissions. Actions have stable UUIDs and durable receipts. Repeating the same request returns its receipt; changing that UUID's payload conflicts. A lost acknowledgement stays uncertain until the exact native response arrives or the operator makes an explicit recovery choice. HQ never resends uncertain input.
62
+ Use `models --provider <id>` for native model and effort choices, and `configuration --provider <id> --workspace-root <path> [--thread-id <id>]` for known effective settings and paged native agent/profile metadata. Creation and explicit resume accept typed startup settings; messages can select a model and effort for the next turn. Startup instructions, native Claude agents and permission settings require an idle session restart. Capability schemas describe supported selections and change modes. Unknown settings remain explicit, and native configuration files stay with each CLI. See the [configuration contract](api/README.md#native-configuration).
49
63
 
50
64
  Native execution settings, instructions, skills and tool permissions remain with each CLI. Claude uses an owned structured process per controlled session and reports immediate steering as unavailable. Plan approval grants no native tool permission. Close other CLI controllers before confirming adoption, resume or recovery. HQ coordinates sessions sharing one state directory; it cannot lock independently running native CLIs. Integrating browser hosts can use durable host-action admission and operator-scoped reconciliation through the programmatic API; see the [browser host contract](api/README.md#browser-host-integration). The standalone CLI advertises only commands it implements.
51
65
 
52
- Durable state includes `action.key`, which must stay private and accompany its SQLite database. Queued undelivered text is saved; ordinary message bodies and question answers are not.
66
+ Approval reads return indexed, cursor-paginated pending, answered and expired metadata after reconnect or restart. Sensitive presentation is available only while the exact native request is live. Native permissions require explicit responses; unknown request kinds or scopes are denied. See [native replies and reconnect reads](api/README.md#thread-control-and-live-input).
67
+
68
+ Durable state includes `action.key`, which must stay private and accompany its SQLite database. Queued undelivered inputs and complete bounded final results are saved; ordinary input bodies and question answers are not.
69
+
70
+ Text and skill inputs can attach bounded workspace files by path and media type. HQ verifies their content hashes again before queued delivery. Output schemas use native Codex turn parameters or Claude's structured-session flag; complete validated results and known token usage remain available on selected receipts after reconnect. Live previews stay bounded and explicitly mark truncation. See [file inputs and complete results](api/README.md#file-inputs-and-complete-results).
53
71
 
54
72
  Use `suggest-thread-name --topic "Build usage" --state-root <directory>` for an editable label and `managed-thread-name --name build-usage --state-root <directory>` to resolve it. Creation adds a short ordinal suffix when a name is occupied. Actions and relationships retain immutable IDs.
55
73
 
@@ -57,6 +75,10 @@ Use `skills --thread-id <id> --state-root <directory>` to browse the controlled
57
75
 
58
76
  Use `jg-agent-hq request --state-root <directory>` with a closed HQ command on stdin for action and control reads. The [API reference](api/README.md) describes action envelopes, receipts and reconnect reads.
59
77
 
78
+ Trusted hosts can create collaboration tasks, add managed agents from any provider, and coordinate them through durable streams. Streams contain small indexed messages and optional directed or claimable requests. Subscription, reading, acknowledgement, assignment and completion are separate records. Metadata operations retain replay receipts and recover notification fan-out after restart. Directed requests can run through the existing native action ledger when the host enables automatic dispatch or explicitly selects a request. An assigned agent can publish direct child requests and yield with a bounded wait set. Exact child outcomes or requester clarifications continue the parent under its current authority; child completion never completes or approves the parent. Information, reads and acknowledgements do not start turns. HQ stores exact bounded outcome reports independently of native histories. Hosts issue exact task-scoped skill grants; role labels and message text grant no authority. See [task collaboration](api/README.md#task-collaboration).
79
+
80
+ Controlled agents use `hq_identity` to recover their stable managed ID, task memberships, permissions and pending inbox counts. Codex uses experimental native dynamic tools; Claude uses a private session-specific stdio MCP bridge. Both use the same closed operations for streams, verified invocation context, requests, report chunks, session evidence and authorized managed spawning. Children can use either provider and inherit equal or narrower task permissions. The host sets a finite cumulative spawn budget. Native subagents share their owning HQ session identity. See [agent tools](api/README.md#agent-tools).
81
+
60
82
  ## Plan coordination
61
83
 
62
84
  `plan-status --directory <path>` and `plan-milestones --directory <path>` inspect a selected ordinary planning directory. No project registry is required. Mutations use the existing `request` JSON command with `kind: 'plan'`; see the [plan command reference](api/README.md#plan-coordination).
@@ -67,36 +89,46 @@ Coordinators can retain revision-bound compatibility reviews in that same file.
67
89
 
68
90
  Begin a revision before native planning. HQ stops bound implementation threads and their owned background work, captures partial-work evidence, and keeps execution paused while the CLI revises the plan and regenerates milestones. The finalizer carries exact matches automatically and asks for one confirmation covering every unmatched completed or partial milestone. Equivalent rewording preserves the original completion evidence. Changed requirements remain pending. Present and approve the canonical sequence, then explicitly authorize the new execution scope and mode. Neither approval nor restart resumes implementation. Whole-plan checkpoints and completion evidence also work without a milestone file. Removing a sequence requires explicit confirmation covering its retained milestone evidence before whole-plan execution can begin. See the [revision recovery contract](api/README.md#revision-and-progress-recovery).
69
91
 
70
- ## Cross-provider feedback
92
+ ## Agent review and feedback
71
93
 
72
- Create a handoff with the JSON request interface: `kind: 'handoff'` and a `create` command containing a UUID, current `runtimeEpoch`, managed `sourceThreadId` and `purpose: 'challenge' | 'review'`. Creation opens a short-named reviewer session with the opposite provider, without sending a prompt. Preview the exact native skill invocation, then explicitly send its digest. Both CLIs keep their own skills, tool permissions and conversation histories.
94
+ Choose any managed reviewer and author, including the same provider, and send task-scoped stream requests. Optional native skills use exact host-issued grants: jg-review-session can read the selected evidence, and jg-feedback can assess an exact report reference. HQ selects the installed native skill and verifies the invocation before dispatch. Missing or unavailable skills remain blocked; no copied workflow is substituted.
73
95
 
74
- Collect one completed reviewer message by its exact native turn/item reference. Preview and explicitly send it through `jg-feedback` to the original author. Feedback remains untrusted advice; delivery and native turn completion grant no plan approval, execution authority or acceptance of recommendations. Busy authors receive queued feedback through the existing action ledger. An uncertain send is never automatically retried.
75
-
76
- `handoff-show --id <uuid>` reads one handoff; `handoffs --workspace-root <path>` pages the inbox. The [handoff reference](api/README.md#cross-provider-handoffs) describes creation, preview, send and native findings collection through the same CLI's JSON request interface.
96
+ Reports return through HQ storage and delivery without manual copying or another reviewer turn. Feedback is untrusted advice and grants no plan approval, execution authority or acceptance of recommendations. Parent work can yield for child results and continue through its existing authority. Busy agents queue; uncertainty never causes automatic resending. See [native skill delegation](api/README.md#native-skill-delegation) and [task collaboration](api/README.md#task-collaboration).
77
97
 
78
98
  ## Source examples
79
99
 
80
100
  Follow the [three complete walkthroughs](https://jg-agent-hq.jesusgraterol.dev/examples/), with copyable source, visual results and explicit host decisions.
81
101
 
82
- `examples/control-session.ts` creates a native session and reads its actual delivery, output, permission and usage observations. `examples/review-handoff.ts` presents exact cross-provider review/feedback previews and delivers selected findings. `examples/revise-plan.ts` runs the planning skills through the revision lease, retains verified work through explicit correspondence, and obtains fresh approvals and execution scope.
102
+ `examples/control-session.ts` creates a native session and reads its actual delivery, output, permission and usage observations. `examples/review-handoff.ts` confirms stream review/assessment requests and returns exact report references, with optional skills and host-selected agents. `examples/revise-plan.ts` runs the planning skills through the revision lease, retains verified work through explicit correspondence, and obtains fresh approvals and execution scope.
83
103
 
84
104
  These complete TypeScript examples use the public client and contracts. Start the local controller, sign in to the native CLIs, and install the required skills and supported project-local jg-plans CLI first. The host supplies actual user decisions and keeps native permission handling separate. Retain request identities before submission; after an interrupted client call, inspect those receipts instead of rerunning a whole example. Examples are development sources, not package exports or automatic website actions.
85
105
 
106
+ `examples/shared-storage.ts` uses a quiescent trusted Node runtime to save a singleton application preference under the app\_ prefix, capture and inspect shared SQLite storage, and verify the value after offline restore. It closes its own SQL connections and preserves the host's user_version. Select absent output directories and pause every other writer first. The application write commits before capture; a later backup failure does not roll it back. The recovered state still requires explicit allowed roots and fresh authority before execution.
107
+
108
+ The [qualification matrix](api/README.md#qualification) records native journeys, host coverage and remaining interface limits.
109
+
86
110
  ## Project blueprint
87
111
 
88
112
  - `src/index.ts`: the explicit public package boundary.
113
+ - `examples/`: public source helpers for sessions, stream review, plan revision and shared host storage.
89
114
  - `src/locks/`: lock ownership, acquisition, status and deliberate recovery.
90
115
  - `src/runtime/`: trusted configuration and lifetime ownership.
91
116
  - `src/ipc/` and `src/cli/`: private local commands and the installed executable.
92
117
  - `src/providers/codex/`: native history and account protocol.
93
- - `src/providers/claude/`: native structured control and usage, plus the version-checked, worker-owned local history reader.
94
- - `src/sessions/`: authorized, cursor-bound history reads and short label suggestions.
118
+ - `src/providers/claude/`: native structured control and usage, plus the identity-validated, worker-owned local history reader.
119
+ - `src/providers/registry/`: lazy factories, normalized provider evidence, bounded lifecycle and source isolation.
120
+ - `src/providers/inputs/` and `src/providers/results/`: checked file delivery and complete native result validation.
121
+ - `src/providers/configuration/` and `src/providers/lineage/`: bounded native choices and confirmed immutable session relationships.
122
+ - `src/sessions/`: authorized discovery, bounded evidence and provenance, cursor-bound history reads and short label suggestions.
95
123
  - `src/plans/`: execution digests, milestone finalization, revision checkpoints, retained verification and explicit plan authority.
96
124
  - `src/skills/`: bounded native catalogs, invocation previews and explicit input preparation.
97
- - `src/handoffs/`: explicit cross-provider challenges, selected native findings and author assessment links.
125
+ - `src/accounts/` and `src/extensions/`: safe account observations and authorized, bounded native MCP inventories.
126
+ - `src/collaboration/`: host-owned tasks, streams, scoped skill-grant admission and event-driven directed request dispatch.
127
+ - `src/collaboration/identity/` and `src/agent-tools/`: native-bound identity, private bridge credentials, shared agent tools and the stdio MCP entry.
98
128
  - `src/actions/`: durable action dispatch, native input routing and bounded live presentation.
99
- - `src/store/`: SQLite discovery metadata and the action/control ledger in one worker.
129
+ - `src/store/`: SQLite discovery metadata, collaboration streams and the action/control ledger in one worker.
130
+ - `src/storage/`: trusted host metadata, exclusive maintenance, schema lineage and offline upgrades.
131
+ - `src/snapshots/`: quiescent capture, streamed inventory validation and offline recovery with execution paused.
100
132
  - `src/contracts/`: browser-safe command and response contracts.
101
133
  - `scripts/package/`: build-output cleanup and packed-consumer checks.
102
134
  - `scripts/release/`: registry version/integrity checks and trusted publication of the tested archive.
@@ -106,6 +138,8 @@ These complete TypeScript examples use the public client and contracts. Start th
106
138
  - `errors/README.md`: stable application errors.
107
139
  - `website/`: private public-site workspace with its own README and test/check commands; canonical documentation bodies remain in this root README and `api/README.md`.
108
140
  - `docs/website.md`: durable website architecture, verification and generated-asset sources.
141
+ - `docs/architecture.md`: provider and database ownership, schema initialization and host maintenance.
142
+ - `docs/recovery.md`: local snapshot coverage, offline recovery and the host's remote durability responsibilities.
109
143
 
110
144
  `/docs` is reserved for concise, quickly scannable documentation of essential durable concepts and processes. API references remain outside `/docs`.
111
145