@skrr-ai/cli 0.1.119 → 0.1.121

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 (336) hide show
  1. package/dist/base-command.d.ts +31 -0
  2. package/dist/base-command.js +117 -6
  3. package/dist/commands/agent/message/context.d.ts +1 -0
  4. package/dist/commands/agent/message/context.js +3 -2
  5. package/dist/commands/commands.js +11 -0
  6. package/dist/commands/commitments/action-proposal.d.ts +13 -0
  7. package/dist/commands/commitments/action-proposal.js +39 -0
  8. package/dist/commands/commitments/action-proposals/decide.js +8 -1
  9. package/dist/commands/commitments/action-proposals/execute.js +11 -1
  10. package/dist/commands/commitments/create.js +2 -2
  11. package/dist/commands/commitments/doctor.d.ts +8 -0
  12. package/dist/commands/commitments/doctor.js +22 -0
  13. package/dist/commands/commitments/execute-remediation.js +12 -1
  14. package/dist/commands/commitments/observations.js +2 -2
  15. package/dist/commands/commitments/pack/bind.d.ts +18 -1
  16. package/dist/commands/commitments/pack/bind.js +66 -8
  17. package/dist/commands/commitments/pack/plan.d.ts +4 -1
  18. package/dist/commands/commitments/pack/plan.js +30 -2
  19. package/dist/commands/commitments/update.js +8 -2
  20. package/dist/commands/completion/index.js +1 -1
  21. package/dist/commands/completion/values.js +1 -1
  22. package/dist/commands/computer-use/audio.d.ts +1 -0
  23. package/dist/commands/computer-use/audio.js +1 -0
  24. package/dist/commands/computer-use/browser.d.ts +1 -0
  25. package/dist/commands/computer-use/browser.js +1 -0
  26. package/dist/commands/computer-use/disable.d.ts +1 -0
  27. package/dist/commands/computer-use/disable.js +1 -0
  28. package/dist/commands/computer-use/enable.d.ts +1 -0
  29. package/dist/commands/computer-use/enable.js +1 -0
  30. package/dist/commands/computer-use/index.d.ts +1 -0
  31. package/dist/commands/computer-use/index.js +1 -0
  32. package/dist/commands/computer-use/install.d.ts +1 -0
  33. package/dist/commands/computer-use/install.js +1 -0
  34. package/dist/commands/computer-use/recover.d.ts +1 -0
  35. package/dist/commands/computer-use/recover.js +1 -0
  36. package/dist/commands/computer-use/status.d.ts +1 -0
  37. package/dist/commands/computer-use/status.js +1 -0
  38. package/dist/commands/computer-use/stop.d.ts +1 -0
  39. package/dist/commands/computer-use/stop.js +1 -0
  40. package/dist/commands/context.js +16 -11
  41. package/dist/commands/convos/recovery.js +1 -1
  42. package/dist/commands/daemon/diagnostics.d.ts +9 -0
  43. package/dist/commands/daemon/diagnostics.js +53 -0
  44. package/dist/commands/daemon/index.js +2 -0
  45. package/dist/commands/daemon/maintenance/attest.d.ts +15 -0
  46. package/dist/commands/daemon/maintenance/attest.js +52 -0
  47. package/dist/commands/daemon/maintenance/hold.d.ts +17 -0
  48. package/dist/commands/daemon/maintenance/hold.js +70 -0
  49. package/dist/commands/daemon/maintenance/index.d.ts +12 -0
  50. package/dist/commands/daemon/maintenance/index.js +30 -0
  51. package/dist/commands/daemon/maintenance/resume.d.ts +13 -0
  52. package/dist/commands/daemon/maintenance/resume.js +36 -0
  53. package/dist/commands/daemon/maintenance/status.d.ts +13 -0
  54. package/dist/commands/daemon/maintenance/status.js +36 -0
  55. package/dist/commands/doctor.d.ts +4 -1
  56. package/dist/commands/doctor.js +50 -6
  57. package/dist/commands/followups/plans/cancel-batch.js +6 -3
  58. package/dist/commands/followups/plans/capacity.js +7 -3
  59. package/dist/commands/followups/plans/observability.js +11 -3
  60. package/dist/commands/followups/plans/preferences/set.js +26 -8
  61. package/dist/commands/followups/plans/preferences.js +1 -1
  62. package/dist/commands/followups/plans/show.js +1 -1
  63. package/dist/commands/goals/key-results/assess.d.ts +36 -0
  64. package/dist/commands/goals/key-results/assess.js +110 -0
  65. package/dist/commands/goals/key-results/history.d.ts +30 -0
  66. package/dist/commands/goals/key-results/history.js +104 -0
  67. package/dist/commands/goals/key-results/list.d.ts +5 -4
  68. package/dist/commands/goals/key-results/list.js +12 -6
  69. package/dist/commands/goals/key-results/show.d.ts +4 -2
  70. package/dist/commands/goals/key-results/show.js +25 -4
  71. package/dist/commands/goals/key-results/update.d.ts +4 -0
  72. package/dist/commands/goals/key-results/update.js +18 -24
  73. package/dist/commands/goals/plan-now.js +12 -1
  74. package/dist/commands/goals/planner-compare.d.ts +30 -0
  75. package/dist/commands/goals/planner-compare.js +136 -0
  76. package/dist/commands/machines/dedicated/service/exec.d.ts +3 -0
  77. package/dist/commands/machines/dedicated/service/exec.js +70 -11
  78. package/dist/commands/machines/hosted/destroy.d.ts +1 -0
  79. package/dist/commands/machines/hosted/destroy.js +11 -1
  80. package/dist/commands/machines/hosted/exec.d.ts +1 -0
  81. package/dist/commands/machines/hosted/exec.js +12 -1
  82. package/dist/commands/machines/hosted/index.js +1 -0
  83. package/dist/commands/machines/hosted/operation.d.ts +14 -0
  84. package/dist/commands/machines/hosted/operation.js +51 -0
  85. package/dist/commands/machines/hosted/pull.js +1 -1
  86. package/dist/commands/machines/hosted/start.js +6 -2
  87. package/dist/commands/search/agents.js +5 -1
  88. package/dist/commands/search/all.js +74 -22
  89. package/dist/commands/search/skills.d.ts +1 -0
  90. package/dist/commands/search/skills.js +12 -1
  91. package/dist/commands/search/spaces.d.ts +8 -1
  92. package/dist/commands/search/spaces.js +50 -12
  93. package/dist/commands/search/tasks.d.ts +13 -2
  94. package/dist/commands/search/tasks.js +78 -14
  95. package/dist/commands/search/teams.js +5 -1
  96. package/dist/commands/search/workspace.d.ts +19 -0
  97. package/dist/commands/search/workspace.js +126 -0
  98. package/dist/commands/skills/browse.d.ts +1 -0
  99. package/dist/commands/skills/browse.js +8 -1
  100. package/dist/commands/skills/search.d.ts +1 -0
  101. package/dist/commands/skills/search.js +12 -1
  102. package/dist/commands/spaces/auto-executor/compare.d.ts +18 -0
  103. package/dist/commands/spaces/auto-executor/compare.js +139 -0
  104. package/dist/commands/spaces/auto-executor/runs.d.ts +3 -0
  105. package/dist/commands/spaces/auto-executor/runs.js +13 -1
  106. package/dist/commands/spaces/charter/create-from-description.d.ts +21 -0
  107. package/dist/commands/spaces/charter/create-from-description.js +77 -0
  108. package/dist/commands/spaces/charter/show.d.ts +22 -0
  109. package/dist/commands/spaces/charter/show.js +61 -0
  110. package/dist/commands/spaces/heartbeats/list.d.ts +1 -16
  111. package/dist/commands/spaces/heartbeats/list.js +13 -0
  112. package/dist/commands/spaces/install-template.js +3 -0
  113. package/dist/commands/spaces/list.d.ts +1 -0
  114. package/dist/commands/spaces/list.js +12 -3
  115. package/dist/commands/spaces/loops/migrate.d.ts +32 -0
  116. package/dist/commands/spaces/loops/migrate.js +103 -0
  117. package/dist/commands/spaces/loops/release.d.ts +14 -0
  118. package/dist/commands/spaces/loops/release.js +59 -0
  119. package/dist/commands/spaces/notebook.d.ts +25 -0
  120. package/dist/commands/spaces/notebook.js +75 -0
  121. package/dist/commands/spaces/proposals/discard.d.ts +17 -0
  122. package/dist/commands/spaces/proposals/discard.js +17 -0
  123. package/dist/commands/spaces/proposals/keep.d.ts +17 -0
  124. package/dist/commands/spaces/proposals/keep.js +17 -0
  125. package/dist/commands/spaces/proposals/list.d.ts +24 -0
  126. package/dist/commands/spaces/proposals/list.js +89 -0
  127. package/dist/commands/spaces/search.d.ts +1 -0
  128. package/dist/commands/spaces/search.js +9 -0
  129. package/dist/commands/spaces/skills/propose.d.ts +29 -0
  130. package/dist/commands/spaces/skills/propose.js +82 -0
  131. package/dist/commands/spaces/templates/fork.js +3 -0
  132. package/dist/commands/spaces/triggers/show.js +6 -0
  133. package/dist/commands/spaces/workflows/retry.d.ts +1 -0
  134. package/dist/commands/spaces/workflows/retry.js +8 -1
  135. package/dist/commands/spaces/workflows/triggers/create.js +3 -2
  136. package/dist/commands/spaces/workflows/triggers/fire.js +4 -0
  137. package/dist/commands/spaces/workflows/triggers/update.js +2 -1
  138. package/dist/commands/spaces/write-policy/set.d.ts +22 -0
  139. package/dist/commands/spaces/write-policy/set.js +82 -0
  140. package/dist/commands/spaces/write-policy/show.d.ts +19 -0
  141. package/dist/commands/spaces/write-policy/show.js +49 -0
  142. package/dist/commands/store/artifacts/receipt.d.ts +14 -0
  143. package/dist/commands/store/artifacts/receipt.js +34 -0
  144. package/dist/commands/store/artifacts/release.d.ts +2 -0
  145. package/dist/commands/store/artifacts/release.js +11 -0
  146. package/dist/commands/store/governance/publish-release.d.ts +2 -0
  147. package/dist/commands/store/governance/publish-release.js +30 -1
  148. package/dist/commands/store/governance/release-receipt.d.ts +12 -0
  149. package/dist/commands/store/governance/release-receipt.js +32 -0
  150. package/dist/commands/tasks/approvals/list.d.ts +11 -5
  151. package/dist/commands/tasks/approvals/list.js +13 -6
  152. package/dist/commands/tasks/attachments/facts.d.ts +12 -0
  153. package/dist/commands/tasks/attachments/facts.js +29 -0
  154. package/dist/commands/tasks/attachments/upload.d.ts +1 -0
  155. package/dist/commands/tasks/attachments/upload.js +16 -0
  156. package/dist/commands/tasks/bulk-update.js +35 -1
  157. package/dist/commands/tasks/context.d.ts +15 -0
  158. package/dist/commands/tasks/context.js +69 -0
  159. package/dist/commands/tasks/copy.d.ts +18 -0
  160. package/dist/commands/tasks/copy.js +85 -0
  161. package/dist/commands/tasks/create-tree.js +97 -23
  162. package/dist/commands/tasks/create.js +9 -1
  163. package/dist/commands/tasks/deliverable/add.js +20 -10
  164. package/dist/commands/tasks/move.js +8 -1
  165. package/dist/commands/tasks/operations/show.d.ts +16 -0
  166. package/dist/commands/tasks/operations/show.js +98 -0
  167. package/dist/commands/tasks/operations/wait.d.ts +22 -0
  168. package/dist/commands/tasks/operations/wait.js +114 -0
  169. package/dist/commands/tasks/preflight.d.ts +1 -0
  170. package/dist/commands/tasks/preflight.js +11 -1
  171. package/dist/commands/tasks/rearm-recurrence.js +4 -0
  172. package/dist/commands/tasks/result/show.js +22 -0
  173. package/dist/commands/tasks/result/submit.d.ts +1 -0
  174. package/dist/commands/tasks/result/submit.js +3 -0
  175. package/dist/commands/tasks/retry-receipt.d.ts +15 -0
  176. package/dist/commands/tasks/retry-receipt.js +89 -0
  177. package/dist/commands/tasks/retry-review.d.ts +16 -0
  178. package/dist/commands/tasks/retry-review.js +66 -0
  179. package/dist/commands/tasks/retry.d.ts +4 -8
  180. package/dist/commands/tasks/retry.js +34 -68
  181. package/dist/commands/tasks/runs.d.ts +21 -0
  182. package/dist/commands/tasks/runs.js +95 -0
  183. package/dist/commands/tasks/search.d.ts +1 -0
  184. package/dist/commands/tasks/search.js +9 -0
  185. package/dist/commands/tasks/show.d.ts +2 -0
  186. package/dist/commands/tasks/show.js +15 -1
  187. package/dist/commands/tasks/start-receipt.d.ts +15 -0
  188. package/dist/commands/tasks/start-receipt.js +95 -0
  189. package/dist/commands/tasks/start.d.ts +4 -0
  190. package/dist/commands/tasks/start.js +49 -3
  191. package/dist/commands/tasks/update.js +3 -0
  192. package/dist/commands/tasks/upsert.js +17 -3
  193. package/dist/commands/tasks/watch.d.ts +3 -0
  194. package/dist/commands/tasks/watch.js +85 -20
  195. package/dist/commands/wiki/history.d.ts +33 -0
  196. package/dist/commands/wiki/history.js +134 -0
  197. package/dist/commands/wiki/ls.d.ts +2 -0
  198. package/dist/commands/wiki/ls.js +8 -0
  199. package/dist/commands/wiki/update.d.ts +3 -1
  200. package/dist/commands/wiki/update.js +24 -2
  201. package/dist/commands/wiki/write.d.ts +22 -0
  202. package/dist/commands/wiki/write.js +144 -6
  203. package/dist/generated/agent-guides.json +81 -81
  204. package/dist/generated/managed-instruction-guides.json +1 -1
  205. package/dist/lib/agent-guides.d.ts +9 -0
  206. package/dist/lib/agent-guides.js +23 -1
  207. package/dist/lib/agentic-stream.d.ts +5 -0
  208. package/dist/lib/agentic-stream.js +122 -3
  209. package/dist/lib/api-error-reason.d.ts +2 -0
  210. package/dist/lib/api-error-reason.js +14 -0
  211. package/dist/lib/api-fetch.js +3 -0
  212. package/dist/lib/auth-diagnostics.d.ts +39 -0
  213. package/dist/lib/auth-diagnostics.js +71 -0
  214. package/dist/lib/cli-client-identity.d.ts +6 -0
  215. package/dist/lib/cli-client-identity.js +16 -0
  216. package/dist/lib/cli-installation-diagnostics.d.ts +52 -0
  217. package/dist/lib/cli-installation-diagnostics.js +254 -0
  218. package/dist/lib/command-hygiene.d.ts +45 -0
  219. package/dist/lib/command-hygiene.js +413 -0
  220. package/dist/lib/commitments.d.ts +64 -3
  221. package/dist/lib/commitments.js +34 -6
  222. package/dist/lib/completion-index.d.ts +16 -4
  223. package/dist/lib/completion-index.js +50 -14
  224. package/dist/lib/config.js +7 -1
  225. package/dist/lib/daemon-maintenance-command.d.ts +22 -0
  226. package/dist/lib/daemon-maintenance-command.js +39 -0
  227. package/dist/lib/daemon-maintenance.d.ts +275 -0
  228. package/dist/lib/daemon-maintenance.js +1035 -0
  229. package/dist/lib/dedicated-service.d.ts +3 -2
  230. package/dist/lib/dedicated-service.js +11 -3
  231. package/dist/lib/governed-store.d.ts +8 -0
  232. package/dist/lib/governed-store.js +5 -0
  233. package/dist/lib/hosted-machines.d.ts +33 -2
  234. package/dist/lib/hosted-machines.js +19 -1
  235. package/dist/lib/json-output.d.ts +1 -1
  236. package/dist/lib/machines.d.ts +9 -1
  237. package/dist/lib/machines.js +15 -1
  238. package/dist/lib/node-adapter.js +13 -0
  239. package/dist/lib/record-output.d.ts +22 -0
  240. package/dist/lib/record-output.js +78 -0
  241. package/dist/lib/roles.d.ts +3 -3
  242. package/dist/lib/scoped-memory-command.d.ts +18 -0
  243. package/dist/lib/scoped-memory-command.js +53 -2
  244. package/dist/lib/search-display.d.ts +7 -0
  245. package/dist/lib/search-display.js +31 -0
  246. package/dist/lib/skill-store-pagination.d.ts +8 -0
  247. package/dist/lib/skill-store-pagination.js +35 -0
  248. package/dist/lib/space-charter.d.ts +49 -0
  249. package/dist/lib/space-charter.js +78 -0
  250. package/dist/lib/space-loop-migration.d.ts +18 -0
  251. package/dist/lib/space-loop-migration.js +128 -0
  252. package/dist/lib/space-notebook.d.ts +22 -0
  253. package/dist/lib/space-notebook.js +140 -0
  254. package/dist/lib/space-proposal-decision-command.d.ts +36 -0
  255. package/dist/lib/space-proposal-decision-command.js +108 -0
  256. package/dist/lib/space-proposals.d.ts +44 -0
  257. package/dist/lib/space-proposals.js +186 -0
  258. package/dist/lib/space-templates.d.ts +8 -0
  259. package/dist/lib/space-templates.js +17 -0
  260. package/dist/lib/space-write-policy.d.ts +24 -0
  261. package/dist/lib/space-write-policy.js +103 -0
  262. package/dist/lib/task-agent-context-capabilities.d.ts +10 -0
  263. package/dist/lib/task-agent-context-capabilities.js +22 -0
  264. package/dist/lib/task-agent-context-compatibility.d.ts +9 -0
  265. package/dist/lib/task-agent-context-compatibility.js +30 -0
  266. package/dist/lib/task-asset-upload.d.ts +22 -0
  267. package/dist/lib/task-asset-upload.js +257 -29
  268. package/dist/lib/task-batch.d.ts +15 -1
  269. package/dist/lib/task-batch.js +35 -2
  270. package/dist/lib/task-operation-watch.d.ts +66 -0
  271. package/dist/lib/task-operation-watch.js +159 -0
  272. package/dist/lib/task-resolver.d.ts +1 -1
  273. package/dist/lib/task-resolver.js +4 -3
  274. package/dist/lib/task-work.d.ts +1 -1
  275. package/dist/lib/task-work.js +35 -1
  276. package/dist/lib/task-write-attribution.d.ts +14 -0
  277. package/dist/lib/task-write-attribution.js +35 -2
  278. package/dist/lib/triggers.d.ts +11 -0
  279. package/dist/lib/triggers.js +7 -0
  280. package/dist/lib/wiki-update.d.ts +1 -0
  281. package/dist/lib/wiki-update.js +10 -1
  282. package/dist/lib/wiki.js +4 -1
  283. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +9 -1
  284. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +31 -15
  285. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.d.ts +10 -0
  286. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +147 -0
  287. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.d.ts +20 -0
  288. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +72 -0
  289. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +1 -0
  290. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +13 -7
  291. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.d.ts +21 -0
  292. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +96 -0
  293. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +2 -3
  294. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +102 -20
  295. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.d.ts +370 -0
  296. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +315 -0
  297. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.d.ts +27 -0
  298. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +161 -0
  299. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineScopes.d.ts +26 -0
  300. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineScopes.js +41 -0
  301. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +2 -1
  302. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +15 -0
  303. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +20 -4
  304. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.d.ts +178 -0
  305. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.js +262 -0
  306. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +51 -0
  307. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +106 -0
  308. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +9 -1
  309. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +32 -5
  310. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.d.ts +10 -0
  311. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +172 -1
  312. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.d.ts +20 -0
  313. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +43 -0
  314. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +1 -0
  315. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +33 -14
  316. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.d.ts +21 -0
  317. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +62 -0
  318. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +2 -3
  319. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +133 -25
  320. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.d.ts +370 -0
  321. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +404 -0
  322. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.d.ts +27 -0
  323. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +132 -0
  324. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineScopes.d.ts +26 -0
  325. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineScopes.js +15 -0
  326. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +2 -1
  327. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +2 -1
  328. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +28 -15
  329. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.d.ts +178 -0
  330. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.js +342 -0
  331. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +51 -0
  332. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +138 -0
  333. package/dist/node_modules/@skrr-ai/auth-core/package.json +51 -1
  334. package/dist/node_modules/@skrr-ai/data-provider/index.js +27181 -20293
  335. package/oclif.manifest.json +5745 -1813
  336. package/package.json +20 -2
@@ -0,0 +1,27 @@
1
+ /** The desktop reserves a new profile for every background authorization. */
2
+ export declare const INDEPENDENT_MACHINE_PROFILE_RE: RegExp;
3
+ export declare const INDEPENDENT_MACHINE_RESERVATION_FILE = "independent-machine-attempt.json";
4
+ export interface IndependentMachineReservation {
5
+ version: 2;
6
+ profile: string;
7
+ ownerId: string;
8
+ origin: string;
9
+ secretHash: string;
10
+ encryptedSecret: string;
11
+ createdAt: string;
12
+ }
13
+ /** Reserve a previously absent profile and persist the encrypted attempt secret.
14
+ * `encrypt` must use the platform secure store and throw if it is unavailable. */
15
+ export declare function reserveIndependentMachineProfile(options: {
16
+ root: string;
17
+ ownerId: string;
18
+ origin: string;
19
+ encrypt: (secret: string) => Buffer;
20
+ }): {
21
+ reservation: IndependentMachineReservation;
22
+ secret: string;
23
+ };
24
+ /** A saved reservation is a selection hint, never proof of machine ownership. */
25
+ export declare function readIndependentMachineReservation(root: string, profile: string): IndependentMachineReservation | null;
26
+ /** Confirm a one-shot signer is acting on the desktop's reserved attempt. */
27
+ export declare function verifyIndependentMachineReservation(root: string, profile: string, secret: unknown): boolean;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var independentMachineReservation_exports = {};
30
+ __export(independentMachineReservation_exports, {
31
+ INDEPENDENT_MACHINE_PROFILE_RE: () => INDEPENDENT_MACHINE_PROFILE_RE,
32
+ INDEPENDENT_MACHINE_RESERVATION_FILE: () => INDEPENDENT_MACHINE_RESERVATION_FILE,
33
+ readIndependentMachineReservation: () => readIndependentMachineReservation,
34
+ reserveIndependentMachineProfile: () => reserveIndependentMachineProfile,
35
+ verifyIndependentMachineReservation: () => verifyIndependentMachineReservation
36
+ });
37
+ module.exports = __toCommonJS(independentMachineReservation_exports);
38
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
39
+ var import_node_fs = __toESM(require("node:fs"), 1);
40
+ var import_node_path = __toESM(require("node:path"), 1);
41
+ const INDEPENDENT_MACHINE_PROFILE_RE = /^desktop-bg-[a-f0-9]{32}$/;
42
+ const INDEPENDENT_MACHINE_RESERVATION_FILE = "independent-machine-attempt.json";
43
+ function canonicalOrigin(input) {
44
+ try {
45
+ const url = new URL(input);
46
+ const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
47
+ return !url.username && !url.password && url.origin === input && (url.protocol === "https:" || url.protocol === "http:" && local);
48
+ } catch {
49
+ return false;
50
+ }
51
+ }
52
+ function validSecret(secret) {
53
+ return typeof secret === "string" && /^[A-Za-z0-9_-]{43}$/.test(secret) && Buffer.from(secret, "base64url").length === 32 && Buffer.from(secret, "base64url").toString("base64url") === secret;
54
+ }
55
+ function hashSecret(profile, ownerId, origin, secret) {
56
+ return import_node_crypto.default.createHash("sha256").update("independent-machine-reservation:v2\0").update(profile).update("\0").update(ownerId).update("\0").update(origin).update("\0").update(secret).digest();
57
+ }
58
+ function reservationPath(root, profile) {
59
+ if (!import_node_path.default.isAbsolute(root) || !INDEPENDENT_MACHINE_PROFILE_RE.test(profile)) {
60
+ throw new Error("Invalid independent machine profile");
61
+ }
62
+ return import_node_path.default.join(root, "profiles", profile, INDEPENDENT_MACHINE_RESERVATION_FILE);
63
+ }
64
+ function reserveIndependentMachineProfile(options) {
65
+ if (!import_node_path.default.isAbsolute(options.root) || !/^[a-fA-F0-9]{24}$/.test(options.ownerId) || !canonicalOrigin(options.origin))
66
+ throw new Error("Invalid background authorization context");
67
+ const secret = import_node_crypto.default.randomBytes(32).toString("base64url");
68
+ const encrypted = options.encrypt(secret);
69
+ if (!Buffer.isBuffer(encrypted) || encrypted.length === 0 || encrypted.length > 4096) {
70
+ throw new Error("Background authorization secure storage is unavailable");
71
+ }
72
+ const profiles = import_node_path.default.join(options.root, "profiles");
73
+ const rootExisted = import_node_fs.default.existsSync(options.root);
74
+ const profilesExisted = import_node_fs.default.existsSync(profiles);
75
+ import_node_fs.default.mkdirSync(profiles, { recursive: true, mode: 448 });
76
+ for (let i = 0; i < 5; i += 1) {
77
+ const profile = `desktop-bg-${import_node_crypto.default.randomBytes(16).toString("hex")}`;
78
+ const dir = import_node_path.default.join(profiles, profile);
79
+ try {
80
+ import_node_fs.default.mkdirSync(dir, { mode: 448 });
81
+ } catch (error) {
82
+ if (error.code === "EEXIST")
83
+ continue;
84
+ throw error;
85
+ }
86
+ const reservation = {
87
+ version: 2,
88
+ profile,
89
+ ownerId: options.ownerId.toLowerCase(),
90
+ origin: options.origin,
91
+ secretHash: hashSecret(profile, options.ownerId.toLowerCase(), options.origin, secret).toString("hex"),
92
+ encryptedSecret: encrypted.toString("base64"),
93
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
94
+ };
95
+ const file = reservationPath(options.root, profile);
96
+ const fd = import_node_fs.default.openSync(file, import_node_fs.default.constants.O_WRONLY | import_node_fs.default.constants.O_CREAT | import_node_fs.default.constants.O_EXCL | (import_node_fs.default.constants.O_NOFOLLOW ?? 0), 384);
97
+ try {
98
+ import_node_fs.default.writeFileSync(fd, `${JSON.stringify(reservation)}
99
+ `, "utf8");
100
+ import_node_fs.default.fsyncSync(fd);
101
+ } finally {
102
+ import_node_fs.default.closeSync(fd);
103
+ }
104
+ const directories = [
105
+ dir,
106
+ profiles,
107
+ ...!profilesExisted ? [options.root] : [],
108
+ ...!rootExisted ? [import_node_path.default.dirname(options.root)] : []
109
+ ];
110
+ for (const directory of directories) {
111
+ const directoryFd = import_node_fs.default.openSync(directory, "r");
112
+ try {
113
+ import_node_fs.default.fsyncSync(directoryFd);
114
+ } finally {
115
+ import_node_fs.default.closeSync(directoryFd);
116
+ }
117
+ }
118
+ return { reservation, secret };
119
+ }
120
+ throw new Error("Could not reserve a new background machine profile");
121
+ }
122
+ function readIndependentMachineReservation(root, profile) {
123
+ try {
124
+ const file = reservationPath(root, profile);
125
+ const directory = import_node_fs.default.lstatSync(import_node_path.default.dirname(file));
126
+ if (!directory.isDirectory() || directory.isSymbolicLink())
127
+ return null;
128
+ const fd = import_node_fs.default.openSync(file, import_node_fs.default.constants.O_RDONLY | (import_node_fs.default.constants.O_NOFOLLOW ?? 0));
129
+ let raw;
130
+ try {
131
+ const stat = import_node_fs.default.fstatSync(fd);
132
+ if (!stat.isFile() || stat.nlink !== 1 || stat.size > 8192 || (stat.mode & 63) !== 0)
133
+ return null;
134
+ raw = import_node_fs.default.readFileSync(fd, "utf8");
135
+ } finally {
136
+ import_node_fs.default.closeSync(fd);
137
+ }
138
+ const value = JSON.parse(raw);
139
+ if (value.version !== 2 || value.profile !== profile || typeof value.ownerId !== "string" || !/^[a-f0-9]{24}$/.test(value.ownerId) || typeof value.origin !== "string" || !canonicalOrigin(value.origin) || typeof value.secretHash !== "string" || !/^[a-f0-9]{64}$/.test(value.secretHash) || typeof value.encryptedSecret !== "string" || !/^[A-Za-z0-9+/]+={0,2}$/.test(value.encryptedSecret) || typeof value.createdAt !== "string" || !Number.isFinite(Date.parse(value.createdAt)))
140
+ return null;
141
+ return value;
142
+ } catch {
143
+ return null;
144
+ }
145
+ }
146
+ function verifyIndependentMachineReservation(root, profile, secret) {
147
+ if (!validSecret(secret))
148
+ return false;
149
+ const saved = readIndependentMachineReservation(root, profile);
150
+ if (!saved)
151
+ return false;
152
+ return import_node_crypto.default.timingSafeEqual(Buffer.from(saved.secretHash, "hex"), hashSecret(profile, saved.ownerId, saved.origin, secret));
153
+ }
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ INDEPENDENT_MACHINE_PROFILE_RE,
157
+ INDEPENDENT_MACHINE_RESERVATION_FILE,
158
+ readIndependentMachineReservation,
159
+ reserveIndependentMachineProfile,
160
+ verifyIndependentMachineReservation
161
+ });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The capabilities explained to a person before a separate background
3
+ * machine is authorized. This version is an immutable wire contract: adding
4
+ * access needs a new contract and a new authorization, not an edit to v1.
5
+ */
6
+ export declare const INDEPENDENT_MACHINE_SCOPE_CONTRACT_V1: "desktop-background-v1";
7
+ export declare const INDEPENDENT_MACHINE_PERMISSIONS_V1: readonly [Readonly<{
8
+ scope: "daemon:tools:bash";
9
+ description: "Run terminal commands and local agents";
10
+ }>, Readonly<{
11
+ scope: "daemon:tools:fs:read";
12
+ description: "Read files in allowed folders";
13
+ }>, Readonly<{
14
+ scope: "daemon:tools:fs:write";
15
+ description: "Create and edit files in allowed folders";
16
+ }>, Readonly<{
17
+ scope: "daemon:browser:cdp";
18
+ description: "Control connected browser tabs";
19
+ }>, Readonly<{
20
+ scope: "daemon:session:replay";
21
+ description: "Replay results recorded while offline";
22
+ }>, Readonly<{
23
+ scope: "daemon:offline-queue";
24
+ description: "Send queued results after reconnecting";
25
+ }>];
26
+ export declare const INDEPENDENT_MACHINE_SCOPES_V1: readonly string[];
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var independentMachineScopes_exports = {};
20
+ __export(independentMachineScopes_exports, {
21
+ INDEPENDENT_MACHINE_PERMISSIONS_V1: () => INDEPENDENT_MACHINE_PERMISSIONS_V1,
22
+ INDEPENDENT_MACHINE_SCOPES_V1: () => INDEPENDENT_MACHINE_SCOPES_V1,
23
+ INDEPENDENT_MACHINE_SCOPE_CONTRACT_V1: () => INDEPENDENT_MACHINE_SCOPE_CONTRACT_V1
24
+ });
25
+ module.exports = __toCommonJS(independentMachineScopes_exports);
26
+ const INDEPENDENT_MACHINE_SCOPE_CONTRACT_V1 = "desktop-background-v1";
27
+ const INDEPENDENT_MACHINE_PERMISSIONS_V1 = Object.freeze([
28
+ Object.freeze({ scope: "daemon:tools:bash", description: "Run terminal commands and local agents" }),
29
+ Object.freeze({ scope: "daemon:tools:fs:read", description: "Read files in allowed folders" }),
30
+ Object.freeze({ scope: "daemon:tools:fs:write", description: "Create and edit files in allowed folders" }),
31
+ Object.freeze({ scope: "daemon:browser:cdp", description: "Control connected browser tabs" }),
32
+ Object.freeze({ scope: "daemon:session:replay", description: "Replay results recorded while offline" }),
33
+ Object.freeze({ scope: "daemon:offline-queue", description: "Send queued results after reconnecting" })
34
+ ]);
35
+ const INDEPENDENT_MACHINE_SCOPES_V1 = Object.freeze(INDEPENDENT_MACHINE_PERMISSIONS_V1.map((permission) => permission.scope));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ INDEPENDENT_MACHINE_PERMISSIONS_V1,
39
+ INDEPENDENT_MACHINE_SCOPES_V1,
40
+ INDEPENDENT_MACHINE_SCOPE_CONTRACT_V1
41
+ });
@@ -28,7 +28,7 @@ export { buildCredentialAad, decrypt as credEnvelopeDecrypt, deserialize as cred
28
28
  export { __setKekStrategyForTest, getKekStrategy, InMemoryKek, UnavailableKek, KekUnavailableError, LinuxKek, MacosKek, registerZeroizeHook, WindowsKek, zeroizeKekCaches, type KekStrategy, } from './kek/index.js';
29
29
  export { buildProof as buildDeviceProof, generateDeviceKeyPair, jwkThumbprint, normalizeHtu, publicJwkFromX, tokenHash, verifyProof as verifyDeviceProof, type DeviceKeyPair, type DeviceProofClaims, type DeviceProofHeader, type Ed25519PrivateJwk, type Ed25519PublicJwk, type VerifyFailureReason as DeviceProofVerifyFailureReason, type VerifyFailure as DeviceProofVerifyFailure, type VerifyOptions as DeviceProofVerifyOptions, type VerifySuccess as DeviceProofVerifySuccess, } from './deviceKey.js';
30
30
  export { DPOP_HEADER, DPOP_MAX_AGE_SECONDS, DPOP_PROOF_INVALID, DPOP_PROOF_REQUIRED, DPOP_PROOF_TYP, DPOP_PROOF_VERIFY_UNAVAILABLE, accessTokenHash, createDpopKey, isAth, isJwkThumbprint, normalizeDpopHtu, verifyDpopProof, type DpopKey, type DpopProofClaims, type DpopProofRequest, type DpopVerifyFailureReason, type DpopVerifyOptions, type DpopVerifyResult, } from './dpop.js';
31
- export { initCredEnvelope, resetCredEnvelope, shutdownCredEnvelope, isCredEnvelopeActive, hasCredEnvelopePathConflict, describeCredEnvelopeState, splitKeyConvergencePolicy, maybeEncryptForWrite, maybeDecryptOnRead, DEFAULT_UNREADABLE_CREDENTIAL_HINT, type DecryptOnReadOptions, __wrappedDekFilePathForTest, __setStateForTest as __setCredEnvelopeStateForTest, __getStateForTest as __getCredEnvelopeStateForTest, __resetShutdownGuardForTest, type ReadTransformResult, } from './credentialEnvelopeBridge.js';
31
+ export { initCredEnvelope, initExistingCredEnvelope, initNewIndependentCredEnvelope, resetCredEnvelope, shutdownCredEnvelope, isCredEnvelopeActive, hasCredEnvelopePathConflict, describeCredEnvelopeState, splitKeyConvergencePolicy, maybeEncryptForWrite, maybeDecryptOnRead, DEFAULT_UNREADABLE_CREDENTIAL_HINT, type DecryptOnReadOptions, __wrappedDekFilePathForTest, __setStateForTest as __setCredEnvelopeStateForTest, __getStateForTest as __getCredEnvelopeStateForTest, __resetShutdownGuardForTest, type ReadTransformResult, } from './credentialEnvelopeBridge.js';
32
32
  export { initDeviceIdentity, resetDeviceIdentity, signServerRequest, enrollWithServer, clearEnrollmentMarker, isDeviceIdentityActive, getDevicePublicKey, describeDeviceIdentityState, describeDeviceKeySplit, __publicKeyPathForTest, __privateKeyPathForTest, __enrollmentMarkerPathForTest, __enrollmentBackoffPathForTest, __setStateForTest as __setDeviceIdentityStateForTest, __getStateForTest as __getDeviceIdentityStateForTest, type EnrollmentResult, } from './deviceIdentityBridge.js';
33
33
  export { getMachineUuid, getMachineUuidForProfile, describeMachineIdentity, type MachineIdentityDescription, type MachineIdentityReason, getHardwareMachineUuid, setMachineUuidProfile, getMachineUuidProfile, qualifyMachineUuid, MACHINE_IDENTITY_FILENAME, hostedRuntimeIdOverride, HOSTED_RUNTIME_MACHINE_SOURCES, __resetMachineUuidCacheForTest, } from './machineUuid.js';
34
34
  export { ensureMachineDaemonId, legacyDaemonUuids, __resetCachedDaemonIdForTest, } from './machineId.js';
@@ -50,3 +50,4 @@ export * from './harnessPermissionControls.js';
50
50
  export { compareReleaseVersions } from './releaseVersions.js';
51
51
  export * from './computerUse.js';
52
52
  export * from './desktopWire.js';
53
+ export { INDEPENDENT_MACHINE_PROFILE_RE, INDEPENDENT_MACHINE_RESERVATION_FILE, readIndependentMachineReservation, reserveIndependentMachineProfile, verifyIndependentMachineReservation, type IndependentMachineReservation, } from './independentMachineReservation.js';
@@ -47,6 +47,8 @@ __export(index_exports, {
47
47
  HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT: () => import_harnessSkillLayout.HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT,
48
48
  HARNESS_TIERS: () => import_harnessTrust.HARNESS_TIERS,
49
49
  HOSTED_RUNTIME_MACHINE_SOURCES: () => import_machineUuid.HOSTED_RUNTIME_MACHINE_SOURCES,
50
+ INDEPENDENT_MACHINE_PROFILE_RE: () => import_independentMachineReservation.INDEPENDENT_MACHINE_PROFILE_RE,
51
+ INDEPENDENT_MACHINE_RESERVATION_FILE: () => import_independentMachineReservation.INDEPENDENT_MACHINE_RESERVATION_FILE,
50
52
  InMemoryKek: () => import_kek.InMemoryKek,
51
53
  KekUnavailableError: () => import_kek.KekUnavailableError,
52
54
  LEGACY_CONFIG_DIR_NAMES: () => import_localIdentity.LEGACY_CONFIG_DIR_NAMES,
@@ -189,6 +191,8 @@ __export(index_exports, {
189
191
  hostedRuntimeIdOverride: () => import_machineUuid.hostedRuntimeIdOverride,
190
192
  initCredEnvelope: () => import_credentialEnvelopeBridge.initCredEnvelope,
191
193
  initDeviceIdentity: () => import_deviceIdentityBridge.initDeviceIdentity,
194
+ initExistingCredEnvelope: () => import_credentialEnvelopeBridge.initExistingCredEnvelope,
195
+ initNewIndependentCredEnvelope: () => import_credentialEnvelopeBridge.initNewIndependentCredEnvelope,
192
196
  installLockExitHandlers: () => import_refresh.installLockExitHandlers,
193
197
  invalidateAuthHelperCache: () => import_credentialResolver.invalidateAuthHelperCache,
194
198
  invalidateHeadersHelperCache: () => import_headers_helper.invalidateHeadersHelperCache,
@@ -238,9 +242,11 @@ __export(index_exports, {
238
242
  publicJwkFromX: () => import_deviceKey.publicJwkFromX,
239
243
  qualifyMachineUuid: () => import_machineUuid.qualifyMachineUuid,
240
244
  readAuthFromFd: () => import_fdToken.readAuthFromFd,
245
+ readIndependentMachineReservation: () => import_independentMachineReservation.readIndependentMachineReservation,
241
246
  reauthCommand: () => import_messages.reauthCommand,
242
247
  refreshDaemonToken: () => import_refresh.refreshDaemonToken,
243
248
  registerZeroizeHook: () => import_kek.registerZeroizeHook,
249
+ reserveIndependentMachineProfile: () => import_independentMachineReservation.reserveIndependentMachineProfile,
244
250
  resetCredEnvelope: () => import_credentialEnvelopeBridge.resetCredEnvelope,
245
251
  resetDeviceIdentity: () => import_deviceIdentityBridge.resetDeviceIdentity,
246
252
  resolveChannelManifestUrl: () => import_firstPartyHarnessChannels.resolveChannelManifestUrl,
@@ -263,6 +269,7 @@ __export(index_exports, {
263
269
  verifyChallenge: () => import_pkce.verifyChallenge,
264
270
  verifyDeviceProof: () => import_deviceKey.verifyProof,
265
271
  verifyDpopProof: () => import_dpop.verifyDpopProof,
272
+ verifyIndependentMachineReservation: () => import_independentMachineReservation.verifyIndependentMachineReservation,
266
273
  verifyManifest: () => import_releaseManifest.verifyManifest,
267
274
  withAuthLock: () => import_refresh.withAuthLock,
268
275
  withLoopbackNoProxy: () => import_spawnEnv.withLoopbackNoProxy,
@@ -313,6 +320,7 @@ __reExport(index_exports, require("./harnessPermissionControls.js"), module.expo
313
320
  var import_releaseVersions = require("./releaseVersions.js");
314
321
  __reExport(index_exports, require("./computerUse.js"), module.exports);
315
322
  __reExport(index_exports, require("./desktopWire.js"), module.exports);
323
+ var import_independentMachineReservation = require("./independentMachineReservation.js");
316
324
  // Annotate the CommonJS export names for ESM import in node:
317
325
  0 && (module.exports = {
318
326
  ALL_DAEMON_SCOPES,
@@ -343,6 +351,8 @@ __reExport(index_exports, require("./desktopWire.js"), module.exports);
343
351
  HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT,
344
352
  HARNESS_TIERS,
345
353
  HOSTED_RUNTIME_MACHINE_SOURCES,
354
+ INDEPENDENT_MACHINE_PROFILE_RE,
355
+ INDEPENDENT_MACHINE_RESERVATION_FILE,
346
356
  InMemoryKek,
347
357
  KekUnavailableError,
348
358
  LEGACY_CONFIG_DIR_NAMES,
@@ -485,6 +495,8 @@ __reExport(index_exports, require("./desktopWire.js"), module.exports);
485
495
  hostedRuntimeIdOverride,
486
496
  initCredEnvelope,
487
497
  initDeviceIdentity,
498
+ initExistingCredEnvelope,
499
+ initNewIndependentCredEnvelope,
488
500
  installLockExitHandlers,
489
501
  invalidateAuthHelperCache,
490
502
  invalidateHeadersHelperCache,
@@ -534,9 +546,11 @@ __reExport(index_exports, require("./desktopWire.js"), module.exports);
534
546
  publicJwkFromX,
535
547
  qualifyMachineUuid,
536
548
  readAuthFromFd,
549
+ readIndependentMachineReservation,
537
550
  reauthCommand,
538
551
  refreshDaemonToken,
539
552
  registerZeroizeHook,
553
+ reserveIndependentMachineProfile,
540
554
  resetCredEnvelope,
541
555
  resetDeviceIdentity,
542
556
  resolveChannelManifestUrl,
@@ -559,6 +573,7 @@ __reExport(index_exports, require("./desktopWire.js"), module.exports);
559
573
  verifyChallenge,
560
574
  verifyDeviceProof,
561
575
  verifyDpopProof,
576
+ verifyIndependentMachineReservation,
562
577
  verifyManifest,
563
578
  withAuthLock,
564
579
  withLoopbackNoProxy,
@@ -178,7 +178,6 @@ async function writeKekToKeychain(kek, service, account) {
178
178
  account,
179
179
  "-w",
180
180
  b64,
181
- "-U",
182
181
  keychainPath
183
182
  ]);
184
183
  } catch (err) {
@@ -219,9 +218,26 @@ async function resolveOrCreateKek(service, account) {
219
218
  return existing;
220
219
  }
221
220
  const fresh = import_node_crypto.default.randomBytes(import_credentialEnvelope.KEY_LEN);
222
- await writeKekToKeychain(fresh, service, account);
223
- _kekCacheBySvc.set(cacheKey, fresh);
224
- return fresh;
221
+ try {
222
+ try {
223
+ await writeKekToKeychain(fresh, service, account);
224
+ } catch (error) {
225
+ const winner = await readKekFromKeychain(service, account).catch(() => null);
226
+ if (!winner)
227
+ throw error;
228
+ _kekCacheBySvc.set(cacheKey, winner);
229
+ return winner;
230
+ }
231
+ const persisted = await readKekFromKeychain(service, account);
232
+ if (!persisted || !persisted.equals(fresh)) {
233
+ persisted?.fill(0);
234
+ throw new import_types.KekUnavailableError(KIND_SHELLOUT, "created master KEK could not be verified");
235
+ }
236
+ _kekCacheBySvc.set(cacheKey, persisted);
237
+ return persisted;
238
+ } finally {
239
+ fresh.fill(0);
240
+ }
225
241
  }
226
242
  async function resolveExistingKek(service, account) {
227
243
  const cacheKey = `${service}::${account}`;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The maintenance report wire contract (Machine Maintenance, OSK-19107, task M24;
3
+ * `docs/architecture/machine-maintenance/implementation-plan-2026-10-24.md` §3.5,
4
+ * `phase0/m04-quiescence-evidence.md` §2.5 and §2.6).
5
+ *
6
+ * Declared ONCE, here. The daemon is published and cannot import the API, so the
7
+ * capability name, the payload shape and its bounds live in this package, which
8
+ * every end can import (`@skrr-ai/auth-core/maintenance-report-wire`).
9
+ * `maintenanceReportWire.test.ts` fails on a second spelling of the capability
10
+ * anywhere else in the repo. The shape follows `dedicatedRuntimeBusyWire.ts`, the
11
+ * precedent for a positively announced, fail-closed report, and differs from it
12
+ * only where the owner's pause needs more.
13
+ *
14
+ * WHAT THE REPORT SAYS
15
+ * ---------------------------------------------------------------------------
16
+ * "What does this daemon process hold right now that an update would take from
17
+ * the owner, and has anything been admitted since the last time you asked?" It is
18
+ * a LOCAL read summarised into counts, the handoff's own restart blockers, and
19
+ * the daemon's own update handoff phase.
20
+ *
21
+ * It is EVIDENCE, never authority. The fence does not depend on it: a daemon that
22
+ * lies, or one that sends nothing, cannot make a held machine accept work. Only
23
+ * this report can grant `ready` (a server-side source can only veto it), and a
24
+ * daemon that never announces the capability can only reach `ready` by the
25
+ * owner's attestation.
26
+ *
27
+ * FAIL CLOSED, in three places
28
+ * ---------------------------------------------------------------------------
29
+ * 1. A count is `0` only when the daemon positively counted. A source that could
30
+ * not be read is `complete: 'unknown'`; a daemon that is leaving is
31
+ * `complete: false`. A reader MUST treat both as busy, whatever the counts
32
+ * say (`maintenanceReportIsQuiet` is the one place that says so).
33
+ * 2. A report that is malformed in ANY field is `null` from
34
+ * `parseMaintenanceReport`, and the caller treats the machine as not quiet.
35
+ * A count that is missing, negative, fractional or not a safe integer is not
36
+ * "zero": it is a different, broken report. A version this parser does not
37
+ * know is `null` too: a newer shape needs its own announced capability.
38
+ * 3. Bounds. The blocker list and every string are clamped, so one report can
39
+ * never be large enough to matter, and a field that is NOT in the contract is
40
+ * never copied into what the parser returns (the result is built from a
41
+ * fresh object, so `__proto__` and its kin cannot ride along).
42
+ *
43
+ * `admittedTotal`
44
+ * ---------------------------------------------------------------------------
45
+ * A MONOTONIC counter of admissions since this process started. The server proves
46
+ * "nothing was admitted between two reports" by comparing two values, without
47
+ * trusting the daemon's clock. It counts at every place the daemon admits work
48
+ * and OVER-counts on purpose (one admission may be noted at the gate and again
49
+ * where the work registers): a second increment can only make the proof harder,
50
+ * never easier. A path that the daemon cannot count must say so in
51
+ * `daemon/src/maintenance-report.ts`, not hide in a zero.
52
+ */
53
+ export declare const MAINTENANCE_REPORT_CAPABILITY = "maintenance_report_v1";
54
+ /** The heartbeat (and register) key the report rides under. Sent only by a daemon that announced the capability. */
55
+ export declare const MAINTENANCE_REPORT_HEARTBEAT_KEY = "maintenanceReport";
56
+ export declare const MAINTENANCE_REPORT_VERSION = 1;
57
+ /**
58
+ * The daemon's own update handoff phases (`daemon/src/update/handoff.ts`), and the
59
+ * members of `DaemonMaintenanceHandoff.phase` in `@skrr-ai/data-provider`. A phase
60
+ * outside this list is a newer protocol and makes the whole report `null`.
61
+ */
62
+ export declare const MAINTENANCE_REPORT_HANDOFF_PHASES: readonly ["ready", "deferred", "reconnecting", "verified", "failed", "rolled-back"];
63
+ export type MaintenanceReportHandoffPhase = (typeof MAINTENANCE_REPORT_HANDOFF_PHASES)[number];
64
+ export declare const MAINTENANCE_REPORT_LIMITS: {
65
+ /** The handoff's blockers carried for the "waiting on" text; the counts, not this list, decide busy. */
66
+ readonly maxBlockers: 32;
67
+ readonly maxKindLength: 32;
68
+ readonly maxIdLength: 128;
69
+ readonly maxReasonLength: 240;
70
+ readonly maxHandoffIdLength: 64;
71
+ readonly maxHandoffReasonLength: 64;
72
+ readonly maxProcessStartIdLength: 64;
73
+ /** Hard ceiling on the serialized report. The clamps above keep a valid one well under it. */
74
+ readonly maxSerializedBytes: 20000;
75
+ };
76
+ /** What `complete` can be. Anything but `true` means the counts prove nothing. */
77
+ export type MaintenanceReportComplete = boolean | 'unknown';
78
+ /** The handoff's own `RestartBlocker` shape (`daemon/src/update/handoff.ts`). Reason text is the handoff's, never re-spelled. */
79
+ export interface MaintenanceReportBlocker {
80
+ kind: string;
81
+ id?: string;
82
+ reason: string;
83
+ }
84
+ export interface MaintenanceReportInflight {
85
+ /** Provider sessions and their wrapper processes: in-process turns, preparing dispatches, live wrappers. */
86
+ sessions: number;
87
+ /** Tool calls running, plus background commands still running. */
88
+ tools: number;
89
+ /** Terminals the daemon holds, preservable or not. A person's open shell is work an update would interrupt. */
90
+ terminals: number;
91
+ /** Provider turns that still depend on credentials, permissions, a browser or a model connection the service owns. */
92
+ providerDependencies: number;
93
+ /** Write-ahead entries whose durability the daemon has not confirmed. */
94
+ walUnconfirmed: number;
95
+ }
96
+ export interface MaintenanceReportHandoff {
97
+ phase: MaintenanceReportHandoffPhase;
98
+ handoffId: string;
99
+ reason?: string;
100
+ /** ISO time the daemon's lease on this phase ends. */
101
+ expiresAt?: string;
102
+ }
103
+ export interface MaintenanceReport {
104
+ version: typeof MAINTENANCE_REPORT_VERSION;
105
+ /** The daemon process that read this. The server drops a report that is not its registered process's. */
106
+ processStartId: string;
107
+ /** ISO time of the daemon's own read. Informational: freshness is the server's receipt time. */
108
+ readAt: string;
109
+ /** `true`: every source was read. `'unknown'`: one could not be. `false`: the process is leaving. */
110
+ complete: MaintenanceReportComplete;
111
+ /** Monotonic count of admissions since this process started. */
112
+ admittedTotal: number;
113
+ inflight: MaintenanceReportInflight;
114
+ blockers: MaintenanceReportBlocker[];
115
+ /** True when the daemon had more blockers than it sent. */
116
+ blockersTruncated: boolean;
117
+ /** The daemon's own update handoff, only while it is live or unresolved; otherwise `null`. */
118
+ handoff: MaintenanceReportHandoff | null;
119
+ }
120
+ /**
121
+ * The reader's view of a daemon's heartbeat section. Anything malformed, from a
122
+ * daemon that did not announce the capability, an unknown version, or oversized
123
+ * is `null`, and the caller must then treat the machine as NOT quiet. Never
124
+ * trusts a field it did not validate and never copies one it does not know.
125
+ */
126
+ export declare function parseMaintenanceReport(raw: unknown): MaintenanceReport | null;
127
+ /**
128
+ * A report as it was stored (JSON text on the presence row). Anything that does
129
+ * not parse, or does not validate, is `null`: a stored value is an input like any
130
+ * other and is read with the same suspicion.
131
+ */
132
+ export declare function parseStoredMaintenanceReport(stored: unknown): MaintenanceReport | null;
133
+ /**
134
+ * The one definition of a POSITIVE ZERO: the daemon read every source and found
135
+ * nothing. `complete: 'unknown'` and `complete: false` are never zero whatever
136
+ * the counts say, because the counts were not (all) read.
137
+ *
138
+ * A blocker that is not work (a missing restart owner, say) does not make a
139
+ * report non-quiet; readiness is "nothing is running", not "the daemon can
140
+ * restart itself".
141
+ */
142
+ export declare function maintenanceReportIsQuiet(report: MaintenanceReport | null): boolean;
143
+ export interface BuildMaintenanceReportInput {
144
+ processStartId: string;
145
+ /** Epoch ms of the daemon's own read. */
146
+ readAtMs: number;
147
+ complete: MaintenanceReportComplete;
148
+ admittedTotal: number;
149
+ inflight: MaintenanceReportInflight;
150
+ blockers: ReadonlyArray<{
151
+ kind: string;
152
+ id?: string;
153
+ reason: string;
154
+ }>;
155
+ /** `expiresAtMs` is epoch ms; the wire carries ISO. */
156
+ handoff: {
157
+ phase: MaintenanceReportHandoffPhase;
158
+ handoffId: string;
159
+ reason?: string;
160
+ expiresAtMs?: number;
161
+ } | null;
162
+ }
163
+ /**
164
+ * A report that says nothing was counted. The shape the daemon sends when it
165
+ * could not read an inventory source at all, and the shape `buildMaintenanceReport`
166
+ * falls back to when it was handed something the contract cannot carry.
167
+ */
168
+ export declare function unknownMaintenanceReport(processStartId: string, readAtMs: number, admittedTotal?: number): MaintenanceReport;
169
+ /**
170
+ * Build the wire report from what the daemon read. Input the contract cannot
171
+ * carry (a negative count, a blocker with no kind, a time that is not a time)
172
+ * becomes an `unknown` report rather than a throw or a report that parses to
173
+ * something else, so the result parses whenever `processStartId` is a real id (the
174
+ * daemon's always is). A builder that threw would turn a bad read into silence,
175
+ * and silence is the absence of a report, which the server reads the same way,
176
+ * but later.
177
+ */
178
+ export declare function buildMaintenanceReport(input: BuildMaintenanceReportInput): MaintenanceReport;