@skrr-ai/cli 0.1.47 → 0.1.48

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 (274) hide show
  1. package/README.md +1 -1
  2. package/dist/base-command.d.ts +18 -0
  3. package/dist/base-command.js +61 -1
  4. package/dist/commands/agents/chat.d.ts +21 -0
  5. package/dist/commands/agents/chat.js +26 -9
  6. package/dist/commands/balance/usage/breakdown.d.ts +14 -0
  7. package/dist/commands/balance/usage/breakdown.js +68 -0
  8. package/dist/commands/balance/usage.js +24 -0
  9. package/dist/commands/commerce/entitlements/explain.d.ts +22 -0
  10. package/dist/commands/commerce/entitlements/explain.js +40 -0
  11. package/dist/commands/commerce/incidents/audit.d.ts +20 -0
  12. package/dist/commands/commerce/incidents/audit.js +37 -0
  13. package/dist/commands/commerce/incidents/list.d.ts +22 -0
  14. package/dist/commands/commerce/incidents/list.js +49 -0
  15. package/dist/commands/commerce/incidents/resolve.d.ts +23 -0
  16. package/dist/commands/commerce/incidents/resolve.js +45 -0
  17. package/dist/commands/commerce/incidents/retry.d.ts +22 -0
  18. package/dist/commands/commerce/incidents/retry.js +45 -0
  19. package/dist/commands/commerce/incidents/show.d.ts +13 -0
  20. package/dist/commands/commerce/incidents/show.js +30 -0
  21. package/dist/commands/commerce/offers/approve.d.ts +17 -0
  22. package/dist/commands/commerce/offers/approve.js +33 -0
  23. package/dist/commands/commerce/offers/create.d.ts +18 -0
  24. package/dist/commands/commerce/offers/create.js +34 -0
  25. package/dist/commands/commerce/offers/publish.d.ts +13 -0
  26. package/dist/commands/commerce/offers/publish.js +28 -0
  27. package/dist/commands/commerce/offers/retire.d.ts +17 -0
  28. package/dist/commands/commerce/offers/retire.js +32 -0
  29. package/dist/commands/commerce/offers/validate.d.ts +18 -0
  30. package/dist/commands/commerce/offers/validate.js +33 -0
  31. package/dist/commands/commerce/products/create.d.ts +10 -0
  32. package/dist/commands/commerce/products/create.js +25 -0
  33. package/dist/commands/commerce/promotions/redeem.d.ts +13 -0
  34. package/dist/commands/commerce/promotions/redeem.js +32 -0
  35. package/dist/commands/commerce/terms/accept.d.ts +18 -0
  36. package/dist/commands/commerce/terms/accept.js +39 -0
  37. package/dist/commands/commerce/terms/show.d.ts +10 -0
  38. package/dist/commands/commerce/terms/show.js +34 -0
  39. package/dist/commands/commerce/trials/conversion-preview.d.ts +18 -0
  40. package/dist/commands/commerce/trials/conversion-preview.js +39 -0
  41. package/dist/commands/commerce/trials/start.d.ts +23 -0
  42. package/dist/commands/commerce/trials/start.js +58 -0
  43. package/dist/commands/commitments/accounting.d.ts +39 -0
  44. package/dist/commands/commitments/accounting.js +116 -0
  45. package/dist/commands/commitments/action-history.d.ts +1 -0
  46. package/dist/commands/commitments/action-history.js +8 -1
  47. package/dist/commands/commitments/case.d.ts +1 -0
  48. package/dist/commands/commitments/case.js +19 -3
  49. package/dist/commands/commitments/cases.d.ts +1 -0
  50. package/dist/commands/commitments/cases.js +11 -1
  51. package/dist/commands/commitments/checks.d.ts +1 -0
  52. package/dist/commands/commitments/checks.js +5 -1
  53. package/dist/commands/commitments/cost.d.ts +62 -0
  54. package/dist/commands/commitments/cost.js +130 -0
  55. package/dist/commands/commitments/create.js +1 -1
  56. package/dist/commands/commitments/delete.d.ts +1 -0
  57. package/dist/commands/commitments/delete.js +56 -6
  58. package/dist/commands/commitments/feedback.js +9 -1
  59. package/dist/commands/commitments/handover.js +16 -0
  60. package/dist/commands/commitments/hypotheses.d.ts +1 -0
  61. package/dist/commands/commitments/hypotheses.js +17 -2
  62. package/dist/commands/commitments/links/list.js +4 -1
  63. package/dist/commands/commitments/liveness.d.ts +18 -0
  64. package/dist/commands/commitments/liveness.js +80 -0
  65. package/dist/commands/commitments/metrics.d.ts +1 -0
  66. package/dist/commands/commitments/metrics.js +8 -1
  67. package/dist/commands/commitments/next-tick.d.ts +39 -0
  68. package/dist/commands/commitments/next-tick.js +122 -0
  69. package/dist/commands/commitments/observations.d.ts +1 -0
  70. package/dist/commands/commitments/observations.js +19 -2
  71. package/dist/commands/commitments/pause.js +12 -0
  72. package/dist/commands/commitments/receipt.d.ts +2 -0
  73. package/dist/commands/commitments/receipt.js +16 -2
  74. package/dist/commands/commitments/remediation-proposal.js +6 -2
  75. package/dist/commands/commitments/remediation-proposals.js +5 -1
  76. package/dist/commands/commitments/restore.d.ts +25 -0
  77. package/dist/commands/commitments/restore.js +46 -0
  78. package/dist/commands/commitments/show.js +32 -0
  79. package/dist/commands/commitments/trigger-status.js +33 -0
  80. package/dist/commands/commitments/update.d.ts +1 -0
  81. package/dist/commands/commitments/update.js +31 -5
  82. package/dist/commands/commitments/wake-capabilities.d.ts +0 -1
  83. package/dist/commands/commitments/wake-capabilities.js +8 -4
  84. package/dist/commands/enterprise/budgets/create.d.ts +11 -0
  85. package/dist/commands/enterprise/budgets/create.js +27 -0
  86. package/dist/commands/enterprise/budgets/evaluate.d.ts +17 -0
  87. package/dist/commands/enterprise/budgets/evaluate.js +32 -0
  88. package/dist/commands/enterprise/budgets/publish.d.ts +14 -0
  89. package/dist/commands/enterprise/budgets/publish.js +30 -0
  90. package/dist/commands/enterprise/contracts/activate.d.ts +14 -0
  91. package/dist/commands/enterprise/contracts/activate.js +30 -0
  92. package/dist/commands/enterprise/contracts/create.d.ts +14 -0
  93. package/dist/commands/enterprise/contracts/create.js +32 -0
  94. package/dist/commands/enterprise/contracts/issue.d.ts +18 -0
  95. package/dist/commands/enterprise/contracts/issue.js +34 -0
  96. package/dist/commands/enterprise/domains/begin.d.ts +20 -0
  97. package/dist/commands/enterprise/domains/begin.js +39 -0
  98. package/dist/commands/enterprise/domains/verify.d.ts +14 -0
  99. package/dist/commands/enterprise/domains/verify.js +32 -0
  100. package/dist/commands/enterprise/external-config/activate.d.ts +22 -0
  101. package/dist/commands/enterprise/external-config/activate.js +49 -0
  102. package/dist/commands/enterprise/external-config/set.d.ts +25 -0
  103. package/dist/commands/enterprise/external-config/set.js +123 -0
  104. package/dist/commands/enterprise/external-config/show.d.ts +12 -0
  105. package/dist/commands/enterprise/external-config/show.js +39 -0
  106. package/dist/commands/enterprise/external-config/suspend.d.ts +13 -0
  107. package/dist/commands/enterprise/external-config/suspend.js +41 -0
  108. package/dist/commands/enterprise/finance/close-snapshot.d.ts +11 -0
  109. package/dist/commands/enterprise/finance/close-snapshot.js +28 -0
  110. package/dist/commands/enterprise/finance/record-document.d.ts +18 -0
  111. package/dist/commands/enterprise/finance/record-document.js +35 -0
  112. package/dist/commands/enterprise/profile.d.ts +20 -0
  113. package/dist/commands/enterprise/profile.js +38 -0
  114. package/dist/commands/login.d.ts +13 -0
  115. package/dist/commands/login.js +77 -0
  116. package/dist/commands/machines/dedicated/index.js +3 -0
  117. package/dist/commands/machines/dedicated/service/apply.d.ts +23 -0
  118. package/dist/commands/machines/dedicated/service/apply.js +99 -0
  119. package/dist/commands/machines/dedicated/service/approve.d.ts +23 -0
  120. package/dist/commands/machines/dedicated/service/approve.js +52 -0
  121. package/dist/commands/machines/dedicated/service/create.d.ts +55 -0
  122. package/dist/commands/machines/dedicated/service/create.js +222 -0
  123. package/dist/commands/machines/dedicated/service/edit.d.ts +30 -0
  124. package/dist/commands/machines/dedicated/service/edit.js +146 -0
  125. package/dist/commands/machines/dedicated/service/exec.d.ts +26 -0
  126. package/dist/commands/machines/dedicated/service/exec.js +92 -0
  127. package/dist/commands/machines/dedicated/service/export.d.ts +29 -0
  128. package/dist/commands/machines/dedicated/service/export.js +106 -0
  129. package/dist/commands/machines/dedicated/service/index.d.ts +14 -0
  130. package/dist/commands/machines/dedicated/service/index.js +49 -0
  131. package/dist/commands/machines/dedicated/service/logs.d.ts +33 -0
  132. package/dist/commands/machines/dedicated/service/logs.js +148 -0
  133. package/dist/commands/machines/dedicated/service/ls.d.ts +20 -0
  134. package/dist/commands/machines/dedicated/service/ls.js +80 -0
  135. package/dist/commands/machines/dedicated/service/restart.d.ts +14 -0
  136. package/dist/commands/machines/dedicated/service/restart.js +29 -0
  137. package/dist/commands/machines/dedicated/service/rm.d.ts +20 -0
  138. package/dist/commands/machines/dedicated/service/rm.js +33 -0
  139. package/dist/commands/machines/dedicated/service/secret/index.d.ts +14 -0
  140. package/dist/commands/machines/dedicated/service/secret/index.js +25 -0
  141. package/dist/commands/machines/dedicated/service/secret/rm.d.ts +22 -0
  142. package/dist/commands/machines/dedicated/service/secret/rm.js +54 -0
  143. package/dist/commands/machines/dedicated/service/secret/set.d.ts +22 -0
  144. package/dist/commands/machines/dedicated/service/secret/set.js +93 -0
  145. package/dist/commands/machines/dedicated/service/start.d.ts +14 -0
  146. package/dist/commands/machines/dedicated/service/start.js +29 -0
  147. package/dist/commands/machines/dedicated/service/status.d.ts +21 -0
  148. package/dist/commands/machines/dedicated/service/status.js +85 -0
  149. package/dist/commands/machines/dedicated/service/stop.d.ts +20 -0
  150. package/dist/commands/machines/dedicated/service/stop.js +35 -0
  151. package/dist/commands/machines/dedicated/service/top.d.ts +22 -0
  152. package/dist/commands/machines/dedicated/service/top.js +120 -0
  153. package/dist/commands/machines/dedicated/sign-in-status.d.ts +22 -0
  154. package/dist/commands/machines/dedicated/sign-in-status.js +79 -0
  155. package/dist/commands/machines/dedicated/ssh-config.d.ts +28 -0
  156. package/dist/commands/machines/dedicated/ssh-config.js +66 -0
  157. package/dist/commands/machines/dedicated/ssh-proxy.d.ts +22 -0
  158. package/dist/commands/machines/dedicated/ssh-proxy.js +62 -0
  159. package/dist/commands/machines/dedicated/ssh.d.ts +29 -0
  160. package/dist/commands/machines/dedicated/ssh.js +121 -0
  161. package/dist/commands/native/allow-all.d.ts +14 -0
  162. package/dist/commands/native/allow-all.js +25 -0
  163. package/dist/commands/native/allow.d.ts +24 -0
  164. package/dist/commands/native/allow.js +45 -0
  165. package/dist/commands/native/deny.d.ts +24 -0
  166. package/dist/commands/native/deny.js +43 -0
  167. package/dist/commands/native/disable.d.ts +17 -0
  168. package/dist/commands/native/disable.js +28 -0
  169. package/dist/commands/native/enable.d.ts +12 -0
  170. package/dist/commands/native/enable.js +29 -0
  171. package/dist/commands/native/list-apps.d.ts +19 -0
  172. package/dist/commands/native/list-apps.js +30 -0
  173. package/dist/commands/native/restrict-to.d.ts +22 -0
  174. package/dist/commands/native/restrict-to.js +41 -0
  175. package/dist/commands/native/status.d.ts +19 -0
  176. package/dist/commands/native/status.js +33 -0
  177. package/dist/commands/native.d.ts +39 -0
  178. package/dist/commands/native.js +76 -0
  179. package/dist/commands/service/index.d.ts +14 -0
  180. package/dist/commands/service/index.js +31 -0
  181. package/dist/commands/service/logs.d.ts +18 -0
  182. package/dist/commands/service/logs.js +53 -0
  183. package/dist/commands/service/ls.d.ts +13 -0
  184. package/dist/commands/service/ls.js +48 -0
  185. package/dist/commands/service/propose.d.ts +34 -0
  186. package/dist/commands/service/propose.js +113 -0
  187. package/dist/commands/service/status.d.ts +17 -0
  188. package/dist/commands/service/status.js +56 -0
  189. package/dist/commands/spaces/auto-executor/runs.d.ts +13 -0
  190. package/dist/commands/spaces/auto-executor/runs.js +56 -0
  191. package/dist/commands/store/governance/artifacts.d.ts +25 -0
  192. package/dist/commands/store/governance/artifacts.js +55 -0
  193. package/dist/commands/store/governance/assign.d.ts +16 -0
  194. package/dist/commands/store/governance/assign.js +54 -0
  195. package/dist/commands/store/governance/create-license.d.ts +18 -0
  196. package/dist/commands/store/governance/create-license.js +35 -0
  197. package/dist/commands/store/governance/install-plan.d.ts +25 -0
  198. package/dist/commands/store/governance/install-plan.js +56 -0
  199. package/dist/commands/store/governance/license-policy.d.ts +30 -0
  200. package/dist/commands/store/governance/license-policy.js +69 -0
  201. package/dist/commands/store/governance/policy.d.ts +25 -0
  202. package/dist/commands/store/governance/policy.js +65 -0
  203. package/dist/commands/store/governance/publish-release.d.ts +17 -0
  204. package/dist/commands/store/governance/publish-release.js +34 -0
  205. package/dist/commands/tasks/deliverable/add.d.ts +15 -0
  206. package/dist/commands/tasks/deliverable/add.js +174 -0
  207. package/dist/commands/tasks/deliverable/archive.d.ts +35 -0
  208. package/dist/commands/tasks/deliverable/archive.js +205 -0
  209. package/dist/commands/tasks/labels/detach.js +3 -0
  210. package/dist/commands/tasks/labels/suggest.d.ts +24 -0
  211. package/dist/commands/tasks/labels/suggest.js +69 -0
  212. package/dist/commands/tasks/list.d.ts +16 -2
  213. package/dist/commands/tasks/list.js +100 -24
  214. package/dist/commands/tasks/show.d.ts +23 -0
  215. package/dist/commands/tasks/show.js +51 -1
  216. package/dist/commands/wiki/rm.d.ts +22 -1
  217. package/dist/commands/wiki/rm.js +52 -3
  218. package/dist/lib/agentic-stream.js +10 -2
  219. package/dist/lib/balance.d.ts +6 -1
  220. package/dist/lib/balance.js +15 -0
  221. package/dist/lib/commerce-command.d.ts +48 -0
  222. package/dist/lib/commerce-command.js +70 -0
  223. package/dist/lib/commerce.d.ts +93 -0
  224. package/dist/lib/commerce.js +129 -0
  225. package/dist/lib/commitment-product.js +1 -1
  226. package/dist/lib/commitments.d.ts +202 -29
  227. package/dist/lib/commitments.js +300 -33
  228. package/dist/lib/dedicated-lease-command.js +10 -0
  229. package/dist/lib/dedicated-machines.d.ts +37 -0
  230. package/dist/lib/dedicated-machines.js +47 -0
  231. package/dist/lib/dedicated-service-command.d.ts +60 -0
  232. package/dist/lib/dedicated-service-command.js +182 -0
  233. package/dist/lib/dedicated-service.d.ts +342 -0
  234. package/dist/lib/dedicated-service.js +741 -0
  235. package/dist/lib/dedicated-ssh.d.ts +136 -0
  236. package/dist/lib/dedicated-ssh.js +387 -0
  237. package/dist/lib/delegated-cli.js +51 -13
  238. package/dist/lib/enterprise-commerce.d.ts +67 -0
  239. package/dist/lib/enterprise-commerce.js +112 -0
  240. package/dist/lib/enterprise-external-configuration.d.ts +60 -0
  241. package/dist/lib/enterprise-external-configuration.js +58 -0
  242. package/dist/lib/first-party-harness.js +17 -3
  243. package/dist/lib/governed-store.d.ts +110 -0
  244. package/dist/lib/governed-store.js +79 -0
  245. package/dist/lib/guest-service-command.d.ts +16 -0
  246. package/dist/lib/guest-service-command.js +32 -0
  247. package/dist/lib/guest-service.d.ts +67 -0
  248. package/dist/lib/guest-service.js +112 -0
  249. package/dist/lib/prompt.d.ts +1 -0
  250. package/dist/lib/prompt.js +1 -0
  251. package/dist/lib/task-asset-upload.d.ts +20 -0
  252. package/dist/lib/task-asset-upload.js +30 -8
  253. package/dist/lib/task-extras.d.ts +23 -0
  254. package/dist/lib/task-extras.js +6 -0
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.d.ts +9 -3
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonScopes.js +10 -3
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +6 -5
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.d.ts +16 -0
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.js +21 -4
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +1 -1
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +24 -2
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.d.ts +9 -3
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonScopes.js +10 -3
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.d.ts +16 -0
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.js +20 -4
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +1 -1
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +24 -2
  271. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  272. package/dist/node_modules/@skrr-ai/data-provider/index.js +5060 -4827
  273. package/oclif.manifest.json +37416 -31416
  274. package/package.json +43 -1
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GUEST_SERVICE_CALL_TIMEOUT_MS = void 0;
4
+ exports.callGuestServiceSocket = callGuestServiceSocket;
5
+ exports.proposeGuestService = proposeGuestService;
6
+ exports.callGuestServiceRead = callGuestServiceRead;
7
+ exports.readGuestSpecFile = readGuestSpecFile;
8
+ const node_fs_1 = require("node:fs");
9
+ const node_net_1 = require("node:net");
10
+ const dedicated_service_1 = require("./dedicated-service");
11
+ exports.GUEST_SERVICE_CALL_TIMEOUT_MS = 15_000;
12
+ /**
13
+ * Write one document to the propose socket and read the daemon's one reply.
14
+ * Half-closing after the write is the "request is complete" signal — a
15
+ * keep-alive protocol would need framing the design does not specify.
16
+ */
17
+ function callGuestServiceSocket(document, options = {}) {
18
+ const socketPath = options.socketPath ?? dedicated_service_1.GUEST_SERVICE_SOCKET_PATH;
19
+ const connect = options.connect ?? node_net_1.connect;
20
+ const timeoutMs = options.timeoutMs ?? exports.GUEST_SERVICE_CALL_TIMEOUT_MS;
21
+ return new Promise((resolve, reject) => {
22
+ const socket = connect(socketPath);
23
+ const chunks = [];
24
+ let done = false;
25
+ const fail = (error) => {
26
+ if (done)
27
+ return;
28
+ done = true;
29
+ socket.destroy();
30
+ reject(error);
31
+ };
32
+ const timer = setTimeout(() => {
33
+ fail(new dedicated_service_1.DedicatedServiceError('The machine’s daemon did not answer the service socket in time.', 'GUEST_SERVICE_TIMEOUT'));
34
+ }, timeoutMs);
35
+ socket.on('connect', () => {
36
+ socket.write(`${JSON.stringify(document)}\n`, () => {
37
+ socket.end();
38
+ });
39
+ });
40
+ socket.on('data', (chunk) => chunks.push(chunk));
41
+ socket.on('error', (err) => {
42
+ clearTimeout(timer);
43
+ if (err.code === 'ENOENT' || err.code === 'ECONNREFUSED') {
44
+ fail(new dedicated_service_1.DedicatedServiceError(`The service socket (${socketPath}) is not there — this machine's daemon does not offer the service lane. ` +
45
+ 'An agent should ask the owner to run `skrr machines dedicated service …` instead.', 'GUEST_SERVICE_UNAVAILABLE'));
46
+ return;
47
+ }
48
+ fail(new dedicated_service_1.DedicatedServiceError(`The service socket refused the connection: ${err.message}`, 'GUEST_SERVICE_SOCKET'));
49
+ });
50
+ socket.on('close', () => {
51
+ if (done)
52
+ return;
53
+ done = true;
54
+ clearTimeout(timer);
55
+ const text = Buffer.concat(chunks).toString('utf8').trim();
56
+ if (!text) {
57
+ reject(new dedicated_service_1.DedicatedServiceError('The daemon closed the service socket without an answer.', 'GUEST_SERVICE_EMPTY'));
58
+ return;
59
+ }
60
+ let reply;
61
+ try {
62
+ reply = JSON.parse(text);
63
+ }
64
+ catch {
65
+ reject(new dedicated_service_1.DedicatedServiceError(`The daemon answered with something that is not JSON: ${text.slice(0, 200)}`, 'GUEST_SERVICE_REPLY'));
66
+ return;
67
+ }
68
+ if (!reply.ok) {
69
+ reject(new dedicated_service_1.DedicatedServiceError(reply.error || 'The daemon refused the service request.', reply.code || 'GUEST_SERVICE_REFUSED'));
70
+ return;
71
+ }
72
+ resolve(reply);
73
+ });
74
+ });
75
+ }
76
+ /** `skrr service propose` — hand the daemon a spec, get back a proposal id. */
77
+ async function proposeGuestService(spec, options = {}) {
78
+ const reply = await callGuestServiceSocket({ verb: 'propose', spec: (0, dedicated_service_1.specPayload)(spec) }, options);
79
+ // The daemon's pending proposal is keyed by the service name — that IS
80
+ // the id the owner approves with.
81
+ const proposalId = typeof reply.proposalId === 'string'
82
+ ? reply.proposalId
83
+ : typeof reply.name === 'string'
84
+ ? reply.name
85
+ : typeof reply.result?.proposalId === 'string'
86
+ ? reply.result.proposalId
87
+ : '';
88
+ return { proposalId, reply };
89
+ }
90
+ /**
91
+ * `skrr service ls|status|logs` — the read verbs on the same socket. The
92
+ * daemon returns `result` in whatever shape the verb defines; the commands
93
+ * render it, they do not reinterpret it.
94
+ */
95
+ async function callGuestServiceRead(op, args = {}, options = {}) {
96
+ return callGuestServiceSocket({
97
+ verb: op,
98
+ ...(args.name ? { name: args.name } : {}),
99
+ ...(args.tailBytes !== undefined ? { tailBytes: args.tailBytes } : {}),
100
+ }, options);
101
+ }
102
+ /** Parse and validate a spec document read from a file the guest hands the daemon. */
103
+ function readGuestSpecFile(filePath) {
104
+ let raw;
105
+ try {
106
+ raw = (0, node_fs_1.readFileSync)(filePath, 'utf8');
107
+ }
108
+ catch (err) {
109
+ throw new dedicated_service_1.DedicatedServiceError(`Cannot read ${filePath}: ${err instanceof Error ? err.message : err}`, 'SPEC_FILE');
110
+ }
111
+ return (0, dedicated_service_1.parseServiceSpecDocument)(raw, filePath);
112
+ }
@@ -47,6 +47,7 @@ export declare function confirmDestructive(question: string, yesFlag: boolean, f
47
47
  */
48
48
  export declare function readJsonValue(source: string | undefined): Promise<unknown>;
49
49
  export declare function readJsonBody(source: string | undefined): Promise<Record<string, unknown>>;
50
+ export declare function readStdin(): Promise<string>;
50
51
  /**
51
52
  * Copy every defined property from `overrides` onto `base` and return the
52
53
  * result. `undefined` values are skipped so unset oclif flags don't clobber
@@ -38,6 +38,7 @@ exports.confirm = confirm;
38
38
  exports.confirmDestructive = confirmDestructive;
39
39
  exports.readJsonValue = readJsonValue;
40
40
  exports.readJsonBody = readJsonBody;
41
+ exports.readStdin = readStdin;
41
42
  exports.mergeDefined = mergeDefined;
42
43
  const fs = __importStar(require("node:fs"));
43
44
  const readline = __importStar(require("node:readline"));
@@ -1,4 +1,23 @@
1
1
  export type TaskAssetRole = 'input' | 'evidence' | 'deliverable';
2
+ /**
3
+ * What the bytes ARE in the work ledger, for an upload that is the archived
4
+ * copy of an artifact that already has a name (`docs/policies/payout.md`).
5
+ *
6
+ * Without it the server keys the Resource on the attachment id, which is right
7
+ * for a screenshot and wrong for a named document: the coordinate somebody
8
+ * cited and the copy nobody can match to it become two Resources.
9
+ *
10
+ * Both upload paths carry it. On the direct-to-storage path it is declared at
11
+ * INTENT time and persisted on the attachment row, because `complete` — which
12
+ * writes the receipt — runs in a later request that never sees the intent's
13
+ * body. Without that, a Deliverable's ledger identity would depend on its
14
+ * SIZE, which is an implementation detail deciding a durable record.
15
+ */
16
+ export interface TaskAssetLedgerResource {
17
+ identity: string;
18
+ title?: string;
19
+ expectationIds?: string[];
20
+ }
2
21
  export interface UploadedTaskAsset {
3
22
  id: string;
4
23
  /**
@@ -35,6 +54,7 @@ export declare function uploadTaskAssetFile(opts: {
35
54
  taskId: string;
36
55
  filePath: string;
37
56
  role?: TaskAssetRole;
57
+ ledger?: TaskAssetLedgerResource;
38
58
  }): Promise<UploadedTaskAsset>;
39
59
  /**
40
60
  * Upload every `--attach` file and return the reference objects an Update or
@@ -105,7 +105,7 @@ async function readTaskForUpload(taskId) {
105
105
  * Throws a plain Error; callers decide how to surface it.
106
106
  */
107
107
  async function uploadTaskAssetFile(opts) {
108
- const { taskId, filePath, role } = opts;
108
+ const { taskId, filePath, role, ledger } = opts;
109
109
  if (!fs.existsSync(filePath)) {
110
110
  throw new Error(`File not found: ${filePath}`);
111
111
  }
@@ -130,13 +130,13 @@ async function uploadTaskAssetFile(opts) {
130
130
  if (sessionPath) {
131
131
  await readTaskForUpload(taskId);
132
132
  result = direct
133
- ? await sessionDirectUpload({ filePath, size, filename, mimeType, role })
134
- : await sessionBufferedUpload({ filePath, filename, mimeType, role });
133
+ ? await sessionDirectUpload({ filePath, size, filename, mimeType, role, ledger })
134
+ : await sessionBufferedUpload({ filePath, filename, mimeType, role, ledger });
135
135
  }
136
136
  else {
137
137
  result = direct
138
- ? await genericDirectUpload({ taskId, filePath, size, filename, mimeType, role })
139
- : await genericBufferedUpload({ taskId, filePath, filename, mimeType, role });
138
+ ? await genericDirectUpload({ taskId, filePath, size, filename, mimeType, role, ledger })
139
+ : await genericBufferedUpload({ taskId, filePath, filename, mimeType, role, ledger });
140
140
  }
141
141
  }
142
142
  catch (err) {
@@ -205,23 +205,31 @@ function taskAssetMarkdownRef(asset) {
205
205
  * The buffered path holds the file in memory by design: it is capped at the
206
206
  * buffered limit, and the server needs the whole body to canonicalize it.
207
207
  */
208
- function fileFormData(filePath, filename, mimeType, role) {
208
+ function fileFormData(filePath, filename, mimeType, role, ledger) {
209
209
  const fd = new FormData();
210
210
  fd.append('file', new node_buffer_1.Blob([fs.readFileSync(filePath)], { type: mimeType }), filename);
211
211
  if (role)
212
212
  fd.append('role', role);
213
+ if (ledger?.identity) {
214
+ fd.append('identity', ledger.identity);
215
+ if (ledger.title)
216
+ fd.append('title', ledger.title);
217
+ if (ledger.expectationIds?.length) {
218
+ fd.append('expectationIds', JSON.stringify(ledger.expectationIds));
219
+ }
220
+ }
213
221
  return fd;
214
222
  }
215
223
  async function genericBufferedUpload(p) {
216
224
  return data_provider_1.dataService.uploadTaskAttachment({
217
225
  taskId: p.taskId,
218
- formData: fileFormData(p.filePath, p.filename, p.mimeType, p.role),
226
+ formData: fileFormData(p.filePath, p.filename, p.mimeType, p.role, p.ledger),
219
227
  });
220
228
  }
221
229
  async function sessionBufferedUpload(p) {
222
230
  return (0, api_fetch_1.apiFetch)((await (0, session_task_endpoints_1.sessionScopedTaskPath)('attachment')), {
223
231
  method: 'POST',
224
- body: fileFormData(p.filePath, p.filename, p.mimeType, p.role),
232
+ body: fileFormData(p.filePath, p.filename, p.mimeType, p.role, p.ledger),
225
233
  });
226
234
  }
227
235
  async function genericDirectUpload(p) {
@@ -232,6 +240,13 @@ async function genericDirectUpload(p) {
232
240
  sizeBytes: p.size,
233
241
  sha256: await sha256OfFile(p.filePath),
234
242
  role: p.role,
243
+ ...(p.ledger?.identity
244
+ ? {
245
+ identity: p.ledger.identity,
246
+ title: p.ledger.title,
247
+ expectationIds: p.ledger.expectationIds,
248
+ }
249
+ : {}),
235
250
  });
236
251
  if (!intent.uploadUrl)
237
252
  return intent.attachment;
@@ -257,6 +272,13 @@ async function sessionDirectUpload(p) {
257
272
  sizeBytes: p.size,
258
273
  sha256: await sha256OfFile(p.filePath),
259
274
  ...(p.role ? { role: p.role } : {}),
275
+ ...(p.ledger?.identity
276
+ ? {
277
+ identity: p.ledger.identity,
278
+ title: p.ledger.title,
279
+ expectationIds: p.ledger.expectationIds,
280
+ }
281
+ : {}),
260
282
  },
261
283
  });
262
284
  if (!intent.uploadUrl)
@@ -133,4 +133,27 @@ export declare const taskChatApi: {
133
133
  */
134
134
  taskHistory: (id: string, query?: Query) => Promise<Json>;
135
135
  };
136
+ /**
137
+ * `POST /api/tasks/:taskId/labels/suggest` — the on-demand half of the
138
+ * create-time `_labelGuidance` hint. The server keeps the model call off the
139
+ * task-create path (the hottest write in the product); this is how a caller
140
+ * pays for ONE suggestion when it actually wants it. Advisory only: the model
141
+ * chooses from the declared vocabulary and nothing is written.
142
+ *
143
+ * `apiFetch` rather than `request.post` for consistency with the lib's other
144
+ * standalone verbs; either would do — nothing here needs the idempotency
145
+ * stamp, because a suggestion is a read in POST clothing.
146
+ */
147
+ export interface TaskLabelSuggestion {
148
+ id?: string;
149
+ name?: string;
150
+ }
151
+ export interface TaskLabelSuggestionResponse {
152
+ taskId?: string;
153
+ identifier?: string;
154
+ /** Size of the applicable vocabulary AFTER the task's own labels are excluded. */
155
+ vocabularySize?: number;
156
+ suggestions?: TaskLabelSuggestion[];
157
+ }
158
+ export declare function taskLabelSuggestion(taskId: string): Promise<TaskLabelSuggestionResponse>;
136
159
  export {};
@@ -6,6 +6,7 @@ exports.taskRunHandover = taskRunHandover;
6
6
  exports.taskRunFork = taskRunFork;
7
7
  exports.taskRunPromote = taskRunPromote;
8
8
  exports.parseExecutionTargetRef = parseExecutionTargetRef;
9
+ exports.taskLabelSuggestion = taskLabelSuggestion;
9
10
  /**
10
11
  * task-extras.ts — the `/api/tasks` endpoints that have no `dataService.*`
11
12
  * wrapper, gathered so every one of them is reachable from `skrr`.
@@ -185,3 +186,8 @@ exports.taskChatApi = {
185
186
  */
186
187
  taskHistory: (id, query = {}) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/transcript`, query)),
187
188
  };
189
+ function taskLabelSuggestion(taskId) {
190
+ return (0, api_fetch_1.apiFetch)(`${base(taskId)}/labels/suggest`, {
191
+ method: 'POST',
192
+ });
193
+ }
@@ -29,29 +29,35 @@
29
29
  * never rename in place.
30
30
  */
31
31
  /**
32
- * The canonical daemon scope vocabulary. Six strings, frozen.
32
+ * The canonical daemon scope vocabulary. Seven strings, append-only.
33
33
  *
34
34
  * - `daemon:tools:bash` — bash tool execution
35
35
  * - `daemon:tools:fs:read` — Read tool (file read)
36
36
  * - `daemon:tools:fs:write` — Write + Edit tools (file mutation)
37
37
  * - `daemon:browser:cdp` — browser automation via CDP (reserved)
38
+ * - `daemon:native-ui:control` — native app GUI control via the helper
38
39
  * - `daemon:session:replay` — `daemon:session:replay` socket event
39
40
  * - `daemon:offline-queue` — daemon-initiated offline queue
40
41
  *
41
42
  * Order is the consent-screen render order: tools-first, I/O second,
42
43
  * control-flow last.
44
+ *
45
+ * `daemon:native-ui:control` is deliberately NOT folded into
46
+ * `daemon:tools:bash`: a token minted to run shell commands must not
47
+ * thereby be able to click around the user's desktop (OSK-11009).
43
48
  */
44
49
  export declare const SCOPES: Readonly<{
45
50
  readonly TOOLS_BASH: "daemon:tools:bash";
46
51
  readonly TOOLS_FS_READ: "daemon:tools:fs:read";
47
52
  readonly TOOLS_FS_WRITE: "daemon:tools:fs:write";
48
53
  readonly BROWSER_CDP: "daemon:browser:cdp";
54
+ readonly NATIVE_UI_CONTROL: "daemon:native-ui:control";
49
55
  readonly SESSION_REPLAY: "daemon:session:replay";
50
56
  readonly OFFLINE_QUEUE: "daemon:offline-queue";
51
57
  }>;
52
58
  export type DaemonScope = (typeof SCOPES)[keyof typeof SCOPES];
53
59
  /**
54
- * The six daemon scopes in canonical order. Frozen so consumers can
60
+ * The seven daemon scopes in canonical order. Frozen so consumers can
55
61
  * pass it directly to OAuth `scope` parameters without defensive
56
62
  * copies.
57
63
  */
@@ -64,7 +70,7 @@ export declare const VALID_DAEMON_SCOPE_SET: ReadonlySet<string>;
64
70
  export declare function isDaemonScope(s: unknown): s is DaemonScope;
65
71
  /**
66
72
  * `cli` — REST-only sign-in grant for first-party CLI clients. Peer
67
- * to the six daemon scopes; lives on `OAuthClient.allowedScopes` for
73
+ * to the daemon scopes; lives on `OAuthClient.allowedScopes` for
68
74
  * the `oversky-cli` client. See the data-schemas canonical for the
69
75
  * full reasoning behind keeping this OUT of `ALL_DAEMON_SCOPES` (the
70
76
  * grandfather sentinel `expandScopes(undefined)` would over-grant).
@@ -33,28 +33,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.OAUTH_CLI_SCOPE = exports.VALID_DAEMON_SCOPE_SET = exports.ALL_DAEMON_SCOPES = exports.SCOPES = void 0;
34
34
  exports.isDaemonScope = isDaemonScope;
35
35
  /**
36
- * The canonical daemon scope vocabulary. Six strings, frozen.
36
+ * The canonical daemon scope vocabulary. Seven strings, append-only.
37
37
  *
38
38
  * - `daemon:tools:bash` — bash tool execution
39
39
  * - `daemon:tools:fs:read` — Read tool (file read)
40
40
  * - `daemon:tools:fs:write` — Write + Edit tools (file mutation)
41
41
  * - `daemon:browser:cdp` — browser automation via CDP (reserved)
42
+ * - `daemon:native-ui:control` — native app GUI control via the helper
42
43
  * - `daemon:session:replay` — `daemon:session:replay` socket event
43
44
  * - `daemon:offline-queue` — daemon-initiated offline queue
44
45
  *
45
46
  * Order is the consent-screen render order: tools-first, I/O second,
46
47
  * control-flow last.
48
+ *
49
+ * `daemon:native-ui:control` is deliberately NOT folded into
50
+ * `daemon:tools:bash`: a token minted to run shell commands must not
51
+ * thereby be able to click around the user's desktop (OSK-11009).
47
52
  */
48
53
  exports.SCOPES = Object.freeze({
49
54
  TOOLS_BASH: 'daemon:tools:bash',
50
55
  TOOLS_FS_READ: 'daemon:tools:fs:read',
51
56
  TOOLS_FS_WRITE: 'daemon:tools:fs:write',
52
57
  BROWSER_CDP: 'daemon:browser:cdp',
58
+ NATIVE_UI_CONTROL: 'daemon:native-ui:control',
53
59
  SESSION_REPLAY: 'daemon:session:replay',
54
60
  OFFLINE_QUEUE: 'daemon:offline-queue',
55
61
  });
56
62
  /**
57
- * The six daemon scopes in canonical order. Frozen so consumers can
63
+ * The seven daemon scopes in canonical order. Frozen so consumers can
58
64
  * pass it directly to OAuth `scope` parameters without defensive
59
65
  * copies.
60
66
  */
@@ -63,6 +69,7 @@ exports.ALL_DAEMON_SCOPES = Object.freeze([
63
69
  exports.SCOPES.TOOLS_FS_READ,
64
70
  exports.SCOPES.TOOLS_FS_WRITE,
65
71
  exports.SCOPES.BROWSER_CDP,
72
+ exports.SCOPES.NATIVE_UI_CONTROL,
66
73
  exports.SCOPES.SESSION_REPLAY,
67
74
  exports.SCOPES.OFFLINE_QUEUE,
68
75
  ]);
@@ -76,7 +83,7 @@ function isDaemonScope(s) {
76
83
  }
77
84
  /**
78
85
  * `cli` — REST-only sign-in grant for first-party CLI clients. Peer
79
- * to the six daemon scopes; lives on `OAuthClient.allowedScopes` for
86
+ * to the daemon scopes; lives on `OAuthClient.allowedScopes` for
80
87
  * the `oversky-cli` client. See the data-schemas canonical for the
81
88
  * full reasoning behind keeping this OUT of `ALL_DAEMON_SCOPES` (the
82
89
  * grandfather sentinel `expandScopes(undefined)` would over-grant).
@@ -11,7 +11,7 @@ export { configureAuthCore, getAuthLogger, getAuthConfigDir, getAuthKillSwitches
11
11
  export { PermanentAuthFailure, TransientAuthFailure, type PermanentAuthReason, type ReauthState, type TokenPair, } from './types.js';
12
12
  export { decodeJwtExpiry, decodeJwtPayload } from './jwtUtils.js';
13
13
  export { isAuthExpiredSseEvent, handleMidStreamAuthExpiry, type ParsedSseLike, type AuthExpiredCallbacks, type HandleMidStreamAuthExpiryResult, } from './authExpiredDetector.js';
14
- export { formatReauthMessage, EXIT_NEEDS_REAUTH, type AuthFailureReason } from './messages.js';
14
+ export { formatReauthMessage, reauthCommand, EXIT_NEEDS_REAUTH, type AuthFailureReason, } from './messages.js';
15
15
  export { classifyRefreshResponse, type RefreshResponseShape, type ClassifiedRefreshResult, type ClassifiedRefreshSuccess, type ClassifiedRefreshFailure, } from './refreshClassification.js';
16
16
  export { refreshDaemonToken, revokeDaemonRefreshSession, withAuthLock, persistReauthState, needsReauthState, clearReauthState, installLockExitHandlers, __refreshDiagnostics, __resetUnknown401StreaksForTest, UNKNOWN_401_BUDGET, } from './refresh.js';
17
17
  export { createRefreshScheduler, type RefreshScheduler, type RefreshSchedulerOptions, } from './refreshScheduler.js';
@@ -22,11 +22,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.challenge = exports.generateVerifier = exports.invalidateHeadersHelperCache = exports.runHeadersHelper = exports.SENTINEL_TRIGGERING_FAILURES = exports.__resetAuthHelperFailureReasonForTest = exports.getLastAuthHelperFailureReason = exports.getDefaultHelperTtlMs = exports.invokeAuthHelper = exports.AuthHelperUnavailableError = exports.AuthHelperUntrustedError = exports.CI_TOKEN_PREFIX = exports.classifyTokenKind = exports.invalidateAuthHelperCache = exports.__resetCredentialResolverForTest = exports.CREDENTIAL_PRECEDENCE = exports.CredentialResolver = exports.__setFdReaderForTest = exports.readAuthFromFd = exports.createRefreshScheduler = exports.UNKNOWN_401_BUDGET = exports.__resetUnknown401StreaksForTest = exports.__refreshDiagnostics = exports.installLockExitHandlers = exports.clearReauthState = exports.needsReauthState = exports.persistReauthState = exports.withAuthLock = exports.revokeDaemonRefreshSession = exports.refreshDaemonToken = exports.classifyRefreshResponse = exports.EXIT_NEEDS_REAUTH = exports.formatReauthMessage = exports.handleMidStreamAuthExpiry = exports.isAuthExpiredSseEvent = exports.decodeJwtPayload = exports.decodeJwtExpiry = exports.TransientAuthFailure = exports.PermanentAuthFailure = exports.emitAuthTelemetry = exports.getAuthBinaryName = exports.getAuthKillSwitches = exports.getAuthConfigDir = exports.getAuthLogger = exports.configureAuthCore = exports.OAUTH_CLI_SCOPE = exports.isDaemonScope = exports.VALID_DAEMON_SCOPE_SET = exports.ALL_DAEMON_SCOPES = exports.SCOPES = void 0;
26
- exports.tokenHash = exports.publicJwkFromX = exports.normalizeHtu = exports.jwkThumbprint = exports.generateDeviceKeyPair = exports.buildDeviceProof = exports.zeroizeKekCaches = exports.WindowsKek = exports.registerZeroizeHook = exports.MacosKek = exports.LinuxKek = exports.KekUnavailableError = exports.UnavailableKek = exports.InMemoryKek = exports.getKekStrategy = exports.__setKekStrategyForTest = exports.credEnvelopeWrap = exports.credEnvelopeUnwrap = exports.credEnvelopeSerialize = exports.credSealBuffer = exports.credOpenBuffer = exports.CRED_KEY_LEN = exports.isCredEnvelopeString = exports.generateDek = exports.CRED_ENVELOPE_MAGIC = exports.credEnvelopeEncrypt = exports.credEnvelopeDeserialize = exports.credEnvelopeDecrypt = exports.buildCredentialAad = exports.isValidRecoveryCode = exports.normalizeRecoveryCode = exports.parseRecoveryCode = exports.formatRecoveryCode = exports.MAX_TTL_DAYS = exports.MIN_TTL_DAYS = exports.parseTtlDays = exports.LoginExchangeError = exports.LoginInitError = exports.loginWithLocalhost = exports.LocalCallbackMalformedError = exports.LocalCallbackDeniedError = exports.LocalCallbackStateMismatchError = exports.LocalCallbackTimeoutError = exports.LocalCallbackBindError = exports.LocalCallbackError = exports.DEFAULT_LOGIN_TIMEOUT_MS = exports.startLocalCallback = exports.verifyChallenge = exports.safeEqual = exports.generateState = void 0;
27
- exports.HARNESS_TIERS = exports.pairUint8ArrayToBase64Url = exports.pairUint8ArrayToBase64 = exports.parsePairUrl = exports.parsePairPlaintext = exports.parsePairBundle = exports.openPairBundleBase64 = exports.generatePairKeyPair = exports.buildPairUrl = exports.buildPairAad = exports.pairBase64UrlToUint8Array = exports.pairBase64ToUint8Array = exports.assemblePairBundleBase64 = exports.PairBundleError = exports.PAIR_SECRET_LEN = exports.PAIR_PUBKEY_LEN = exports.PAIR_NONCE_LEN = exports.PAIR_BUNDLE_MAX_BASE64_LEN = exports.PAIR_AAD_MAX_LEN = exports.PAIR_AAD_PREFIX = exports.__resetCachedDaemonIdForTest = exports.legacyDaemonUuids = exports.ensureMachineDaemonId = exports.__getDeviceIdentityStateForTest = exports.__setDeviceIdentityStateForTest = exports.__enrollmentBackoffPathForTest = exports.__enrollmentMarkerPathForTest = exports.__privateKeyPathForTest = exports.__publicKeyPathForTest = exports.describeDeviceIdentityState = exports.getDevicePublicKey = exports.isDeviceIdentityActive = exports.clearEnrollmentMarker = exports.enrollWithServer = exports.signServerRequest = exports.resetDeviceIdentity = exports.initDeviceIdentity = exports.__resetShutdownGuardForTest = exports.__getCredEnvelopeStateForTest = exports.__setCredEnvelopeStateForTest = exports.__wrappedDekFilePathForTest = exports.maybeDecryptOnRead = exports.maybeEncryptForWrite = exports.describeCredEnvelopeState = exports.hasCredEnvelopePathConflict = exports.isCredEnvelopeActive = exports.shutdownCredEnvelope = exports.resetCredEnvelope = exports.initCredEnvelope = exports.verifyDeviceProof = void 0;
28
- exports.resolveProfileStateDir = exports.legacyProfileStateDir = exports.profileStateDir = exports.SUPERSEDED_COPY_SUFFIX = exports.SUPERSEDED_MARKER_SUFFIX = exports.PROFILES_SEGMENT = exports.isConfigRootOverridden = exports.configRootPath = exports.resolveConfigRoot = exports.verifyManifest = exports.verifyArtifact = exports.getDeltaFor = exports.buildManifestMessage = exports.buildArtifactMessage = exports.MAX_SIGS = exports.OVERSKY_RELEASE_PUBLIC_KEYS = exports.resolveFirstPartyHarnessChannel = exports.resolveChannelManifestUrl = exports.isFirstPartyHarnessChannel = exports.firstPartyHarnessFeedCandidates = exports.firstPartyHarnessFeedBase = exports.firstPartyHarnessChannelPrefix = exports.FIRST_PARTY_HARNESS_CHANNELS = exports.DEFAULT_FIRST_PARTY_HARNESS_CHANNEL = exports.migrateFirstPartyHarnessHome = exports.linkFirstPartyHarnessAliases = exports.firstPartyHarnessInstalledBinaryPath = exports.firstPartyHarnessHomeDir = exports.firstPartyHarnessBinDir = exports.FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX = exports.FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX = exports.describeLegacyState = exports.findLegacyLocalState = exports.DEFAULT_BINARY_NAME = exports.LEGACY_NATIVE_ID_PREFIXES = exports.NATIVE_ID_PREFIX = exports.LEGACY_CONFIG_DIR_NAMES = exports.CONFIG_DIR_NAME = exports.SENSITIVE_ENV_PREFIX_EXCEPTIONS = exports.SENSITIVE_ENV_NAME_TOKENS = exports.SENSITIVE_ENV_SUFFIXES = exports.SENSITIVE_ENV_PREFIXES = exports.SENSITIVE_ENV_VARS = exports.sanitizeSpawnEnv = exports.harnessLoadsClaudeSkillsLayout = exports.claudeSkillsLayoutEvidence = exports.HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT = exports.tierPermitsConfiguredAutoMode = exports.credentialPolicyForTier = exports.getHarnessTier = void 0;
29
- exports.consolidateProfileState = exports.profileStateFilePathsToClear = exports.profileStateFileLocations = exports.resolveProfileStateFile = void 0;
25
+ exports.generateVerifier = exports.invalidateHeadersHelperCache = exports.runHeadersHelper = exports.SENTINEL_TRIGGERING_FAILURES = exports.__resetAuthHelperFailureReasonForTest = exports.getLastAuthHelperFailureReason = exports.getDefaultHelperTtlMs = exports.invokeAuthHelper = exports.AuthHelperUnavailableError = exports.AuthHelperUntrustedError = exports.CI_TOKEN_PREFIX = exports.classifyTokenKind = exports.invalidateAuthHelperCache = exports.__resetCredentialResolverForTest = exports.CREDENTIAL_PRECEDENCE = exports.CredentialResolver = exports.__setFdReaderForTest = exports.readAuthFromFd = exports.createRefreshScheduler = exports.UNKNOWN_401_BUDGET = exports.__resetUnknown401StreaksForTest = exports.__refreshDiagnostics = exports.installLockExitHandlers = exports.clearReauthState = exports.needsReauthState = exports.persistReauthState = exports.withAuthLock = exports.revokeDaemonRefreshSession = exports.refreshDaemonToken = exports.classifyRefreshResponse = exports.EXIT_NEEDS_REAUTH = exports.reauthCommand = exports.formatReauthMessage = exports.handleMidStreamAuthExpiry = exports.isAuthExpiredSseEvent = exports.decodeJwtPayload = exports.decodeJwtExpiry = exports.TransientAuthFailure = exports.PermanentAuthFailure = exports.emitAuthTelemetry = exports.getAuthBinaryName = exports.getAuthKillSwitches = exports.getAuthConfigDir = exports.getAuthLogger = exports.configureAuthCore = exports.OAUTH_CLI_SCOPE = exports.isDaemonScope = exports.VALID_DAEMON_SCOPE_SET = exports.ALL_DAEMON_SCOPES = exports.SCOPES = void 0;
26
+ exports.publicJwkFromX = exports.normalizeHtu = exports.jwkThumbprint = exports.generateDeviceKeyPair = exports.buildDeviceProof = exports.zeroizeKekCaches = exports.WindowsKek = exports.registerZeroizeHook = exports.MacosKek = exports.LinuxKek = exports.KekUnavailableError = exports.UnavailableKek = exports.InMemoryKek = exports.getKekStrategy = exports.__setKekStrategyForTest = exports.credEnvelopeWrap = exports.credEnvelopeUnwrap = exports.credEnvelopeSerialize = exports.credSealBuffer = exports.credOpenBuffer = exports.CRED_KEY_LEN = exports.isCredEnvelopeString = exports.generateDek = exports.CRED_ENVELOPE_MAGIC = exports.credEnvelopeEncrypt = exports.credEnvelopeDeserialize = exports.credEnvelopeDecrypt = exports.buildCredentialAad = exports.isValidRecoveryCode = exports.normalizeRecoveryCode = exports.parseRecoveryCode = exports.formatRecoveryCode = exports.MAX_TTL_DAYS = exports.MIN_TTL_DAYS = exports.parseTtlDays = exports.LoginExchangeError = exports.LoginInitError = exports.loginWithLocalhost = exports.LocalCallbackMalformedError = exports.LocalCallbackDeniedError = exports.LocalCallbackStateMismatchError = exports.LocalCallbackTimeoutError = exports.LocalCallbackBindError = exports.LocalCallbackError = exports.DEFAULT_LOGIN_TIMEOUT_MS = exports.startLocalCallback = exports.verifyChallenge = exports.safeEqual = exports.generateState = exports.challenge = void 0;
27
+ exports.pairUint8ArrayToBase64Url = exports.pairUint8ArrayToBase64 = exports.parsePairUrl = exports.parsePairPlaintext = exports.parsePairBundle = exports.openPairBundleBase64 = exports.generatePairKeyPair = exports.buildPairUrl = exports.buildPairAad = exports.pairBase64UrlToUint8Array = exports.pairBase64ToUint8Array = exports.assemblePairBundleBase64 = exports.PairBundleError = exports.PAIR_SECRET_LEN = exports.PAIR_PUBKEY_LEN = exports.PAIR_NONCE_LEN = exports.PAIR_BUNDLE_MAX_BASE64_LEN = exports.PAIR_AAD_MAX_LEN = exports.PAIR_AAD_PREFIX = exports.__resetCachedDaemonIdForTest = exports.legacyDaemonUuids = exports.ensureMachineDaemonId = exports.__getDeviceIdentityStateForTest = exports.__setDeviceIdentityStateForTest = exports.__enrollmentBackoffPathForTest = exports.__enrollmentMarkerPathForTest = exports.__privateKeyPathForTest = exports.__publicKeyPathForTest = exports.describeDeviceIdentityState = exports.getDevicePublicKey = exports.isDeviceIdentityActive = exports.clearEnrollmentMarker = exports.enrollWithServer = exports.signServerRequest = exports.resetDeviceIdentity = exports.initDeviceIdentity = exports.__resetShutdownGuardForTest = exports.__getCredEnvelopeStateForTest = exports.__setCredEnvelopeStateForTest = exports.__wrappedDekFilePathForTest = exports.maybeDecryptOnRead = exports.maybeEncryptForWrite = exports.describeCredEnvelopeState = exports.hasCredEnvelopePathConflict = exports.isCredEnvelopeActive = exports.shutdownCredEnvelope = exports.resetCredEnvelope = exports.initCredEnvelope = exports.verifyDeviceProof = exports.tokenHash = void 0;
28
+ exports.legacyProfileStateDir = exports.profileStateDir = exports.SUPERSEDED_COPY_SUFFIX = exports.SUPERSEDED_MARKER_SUFFIX = exports.PROFILES_SEGMENT = exports.isConfigRootOverridden = exports.configRootPath = exports.resolveConfigRoot = exports.verifyManifest = exports.verifyArtifact = exports.getDeltaFor = exports.buildManifestMessage = exports.buildArtifactMessage = exports.MAX_SIGS = exports.OVERSKY_RELEASE_PUBLIC_KEYS = exports.resolveFirstPartyHarnessChannel = exports.resolveChannelManifestUrl = exports.isFirstPartyHarnessChannel = exports.firstPartyHarnessFeedCandidates = exports.firstPartyHarnessFeedBase = exports.firstPartyHarnessChannelPrefix = exports.FIRST_PARTY_HARNESS_CHANNELS = exports.DEFAULT_FIRST_PARTY_HARNESS_CHANNEL = exports.migrateFirstPartyHarnessHome = exports.linkFirstPartyHarnessAliases = exports.firstPartyHarnessInstalledBinaryPath = exports.firstPartyHarnessHomeDir = exports.firstPartyHarnessBinDir = exports.FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX = exports.FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX = exports.describeLegacyState = exports.findLegacyLocalState = exports.DEFAULT_BINARY_NAME = exports.LEGACY_NATIVE_ID_PREFIXES = exports.NATIVE_ID_PREFIX = exports.LEGACY_CONFIG_DIR_NAMES = exports.CONFIG_DIR_NAME = exports.SENSITIVE_ENV_PREFIX_EXCEPTIONS = exports.SENSITIVE_ENV_NAME_TOKENS = exports.SENSITIVE_ENV_SUFFIXES = exports.SENSITIVE_ENV_PREFIXES = exports.SENSITIVE_ENV_VARS = exports.sanitizeSpawnEnv = exports.harnessLoadsClaudeSkillsLayout = exports.claudeSkillsLayoutEvidence = exports.HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT = exports.tierPermitsConfiguredAutoMode = exports.credentialPolicyForTier = exports.getHarnessTier = exports.HARNESS_TIERS = void 0;
29
+ exports.consolidateProfileState = exports.profileStateFilePathsToClear = exports.profileStateFileLocations = exports.resolveProfileStateFile = exports.resolveProfileStateDir = void 0;
30
30
  // Daemon scope vocabulary — single source of truth for non-Mongoose tiers
31
31
  // (daemon, desktop, cli). Schema-bound canonical lives in
32
32
  // `@skrr-ai/data-schemas/common/daemonScopes`; the two are kept byte-equal
@@ -63,6 +63,7 @@ Object.defineProperty(exports, "handleMidStreamAuthExpiry", { enumerable: true,
63
63
  // Reauth messaging
64
64
  var messages_js_1 = require("./messages.js");
65
65
  Object.defineProperty(exports, "formatReauthMessage", { enumerable: true, get: function () { return messages_js_1.formatReauthMessage; } });
66
+ Object.defineProperty(exports, "reauthCommand", { enumerable: true, get: function () { return messages_js_1.reauthCommand; } });
66
67
  Object.defineProperty(exports, "EXIT_NEEDS_REAUTH", { enumerable: true, get: function () { return messages_js_1.EXIT_NEEDS_REAUTH; } });
67
68
  // Pure HTTP→{Permanent, Transient, Success} response classification —
68
69
  // exposed so RN-side clients can apply the same mapping daemon uses.
@@ -1,4 +1,20 @@
1
1
  export type AuthFailureReason = 'REFRESH_INVALID' | 'REFRESH_REUSED' | 'REFRESH_EXPIRED' | 'SESSION_REVOKED' | 'TOKEN_EXPIRED' | 'TOKEN_INVALID' | 'UNKNOWN_401' | 'UNKNOWN';
2
+ /**
3
+ * The command that recovers this process from a re-auth latch.
4
+ *
5
+ * ONE function owns this, because the answer is printed twice in the same
6
+ * millisecond — once in the human block below and once on the machine-readable
7
+ * `[oversky-reauth]` line a log scraper pages on — and the two used to be
8
+ * written independently. They disagreed: the block said `skrrd login --device`
9
+ * while the error line said `skrr login`, naming a different binary and
10
+ * different flags for one action, so an operator reading either one did
11
+ * something the other did not describe (OSK-10224).
12
+ *
13
+ * The binary is whatever the consumer registered with
14
+ * `configureAuthCore({ binaryName })` — the binary the user actually typed —
15
+ * and `--device` is added only when there is no TTY to open a browser from.
16
+ */
17
+ export declare function reauthCommand(): string;
2
18
  export declare function formatReauthMessage(reason: AuthFailureReason | string): string;
3
19
  /**
4
20
  * Exit code for "permanent auth failure during initial connect" — picked to
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EXIT_NEEDS_REAUTH = void 0;
4
+ exports.reauthCommand = reauthCommand;
4
5
  exports.formatReauthMessage = formatReauthMessage;
5
6
  /**
6
7
  * User-facing messages for auth state transitions.
@@ -21,17 +22,33 @@ const REASON_HUMAN = {
21
22
  UNKNOWN_401: 'skrr needs you to sign in again.',
22
23
  UNKNOWN: 'skrr needs you to sign in again.',
23
24
  };
25
+ /**
26
+ * The command that recovers this process from a re-auth latch.
27
+ *
28
+ * ONE function owns this, because the answer is printed twice in the same
29
+ * millisecond — once in the human block below and once on the machine-readable
30
+ * `[oversky-reauth]` line a log scraper pages on — and the two used to be
31
+ * written independently. They disagreed: the block said `skrrd login --device`
32
+ * while the error line said `skrr login`, naming a different binary and
33
+ * different flags for one action, so an operator reading either one did
34
+ * something the other did not describe (OSK-10224).
35
+ *
36
+ * The binary is whatever the consumer registered with
37
+ * `configureAuthCore({ binaryName })` — the binary the user actually typed —
38
+ * and `--device` is added only when there is no TTY to open a browser from.
39
+ */
40
+ function reauthCommand() {
41
+ const bin = (0, runtime_js_1.getAuthBinaryName)();
42
+ return process.stdout.isTTY ? `${bin} login` : `${bin} login --device`;
43
+ }
24
44
  function formatReauthMessage(reason) {
25
45
  const norm = REASON_HUMAN[reason] || REASON_HUMAN.UNKNOWN;
26
- const isHeadless = !process.stdout.isTTY;
27
- const bin = (0, runtime_js_1.getAuthBinaryName)();
28
- const cmd = isHeadless ? `${bin} login --device` : `${bin} login`;
29
46
  return [
30
47
  '',
31
48
  'skrr cannot connect — re-authentication required.',
32
49
  ` Reason: ${norm}`,
33
50
  '',
34
- ` To continue, run: ${cmd}`,
51
+ ` To continue, run: ${reauthCommand()}`,
35
52
  '',
36
53
  ].join('\n');
37
54
  }
@@ -75,7 +75,7 @@ export declare const SENSITIVE_ENV_SUFFIXES: readonly string[];
75
75
  * `SECRETARY` untouched.
76
76
  */
77
77
  export declare const SENSITIVE_ENV_NAME_TOKENS: readonly string[];
78
- /** Specific OVERSKY_ vars to keep (the prefix sweep is broad on purpose). */
78
+ /** Specific names to keep — the prefix sweeps are broad on purpose. */
79
79
  export declare const SENSITIVE_ENV_PREFIX_EXCEPTIONS: ReadonlySet<string>;
80
80
  /**
81
81
  * Build a sanitized snapshot of the parent's own env for a spawned
@@ -61,6 +61,9 @@ exports.sanitizeSpawnEnv = sanitizeSpawnEnv;
61
61
  exports.SENSITIVE_ENV_VARS = new Set([
62
62
  'CLAUDE_CODE_OAUTH_TOKEN',
63
63
  'OVERSKY_TOKEN',
64
+ // The renamed credential alias (cli/src/lib/config.ts honors both spellings).
65
+ // Same double coverage as OVERSKY_TOKEN — name AND the SKRR_ prefix below.
66
+ 'SKRR_TOKEN',
64
67
  'AWS_ACCESS_KEY_ID',
65
68
  'AWS_SECRET_ACCESS_KEY',
66
69
  'AWS_SESSION_TOKEN',
@@ -91,7 +94,16 @@ exports.SENSITIVE_ENV_VARS = new Set([
91
94
  'LD_PRELOAD',
92
95
  ]);
93
96
  /** Variable name prefixes that should be stripped (catches families like AWS_*). */
94
- exports.SENSITIVE_ENV_PREFIXES = ['AWS_', 'OVERSKY_'];
97
+ exports.SENSITIVE_ENV_PREFIXES = [
98
+ 'AWS_',
99
+ 'OVERSKY_',
100
+ // The renamed product namespace: SKRR_TOKEN, SKRR_REFRESH_TOKEN, the
101
+ // session-authority aliases (SKRR_SESSION_*, SKRR_BASE_URL), and the
102
+ // daemon's control-plane identity (SKRR_MACHINE_UUID, SKRR_LEASE_GENERATION)
103
+ // all carry authority a model-driven child must not inherit. Non-secret
104
+ // lane essentials live in SENSITIVE_ENV_PREFIX_EXCEPTIONS below.
105
+ 'SKRR_',
106
+ ];
95
107
  /**
96
108
  * Credential-shaped suffixes are also forbidden. A fixed provider list is
97
109
  * never complete: a newly configured provider would otherwise leak its key
@@ -120,7 +132,7 @@ exports.SENSITIVE_ENV_SUFFIXES = [
120
132
  * `SECRETARY` untouched.
121
133
  */
122
134
  exports.SENSITIVE_ENV_NAME_TOKENS = ['SECRET'];
123
- /** Specific OVERSKY_ vars to keep (the prefix sweep is broad on purpose). */
135
+ /** Specific names to keep — the prefix sweeps are broad on purpose. */
124
136
  exports.SENSITIVE_ENV_PREFIX_EXCEPTIONS = new Set([
125
137
  // Headless flag is read by spawned tools to know they're inside the daemon —
126
138
  // not a secret. Add more here if a tool legitimately needs an OVERSKY_ var.
@@ -130,6 +142,16 @@ exports.SENSITIVE_ENV_PREFIX_EXCEPTIONS = new Set([
130
142
  // know they're inside a supervised daemon on Linux/Windows in addition
131
143
  // to macOS launchd. Not a secret.
132
144
  'OVERSKY_SUPERVISOR',
145
+ // A deployment URL, not a credential. The rename to SKRR_SERVER_URL was
146
+ // chosen precisely because it survives the sanitizer
147
+ // (daemon/src/dedicated-tenant-env.ts), so a spawned lane's `skrr` reaches
148
+ // the deployment this machine is registered with.
149
+ 'SKRR_SERVER_URL',
150
+ // The Dedicated Runtime workload marker the exec wrapper stamps into every
151
+ // tenant lane; grandchildren spawned from a lane (e.g. `skrr code` → the
152
+ // engine) must keep it to detect they already run as the workload uid. Not
153
+ // a secret — it authorizes nothing without the matching real uid.
154
+ 'SKRR_WORKLOAD_UID',
133
155
  ]);
134
156
  /**
135
157
  * Build a sanitized snapshot of the parent's own env for a spawned
@@ -29,29 +29,35 @@
29
29
  * never rename in place.
30
30
  */
31
31
  /**
32
- * The canonical daemon scope vocabulary. Six strings, frozen.
32
+ * The canonical daemon scope vocabulary. Seven strings, append-only.
33
33
  *
34
34
  * - `daemon:tools:bash` — bash tool execution
35
35
  * - `daemon:tools:fs:read` — Read tool (file read)
36
36
  * - `daemon:tools:fs:write` — Write + Edit tools (file mutation)
37
37
  * - `daemon:browser:cdp` — browser automation via CDP (reserved)
38
+ * - `daemon:native-ui:control` — native app GUI control via the helper
38
39
  * - `daemon:session:replay` — `daemon:session:replay` socket event
39
40
  * - `daemon:offline-queue` — daemon-initiated offline queue
40
41
  *
41
42
  * Order is the consent-screen render order: tools-first, I/O second,
42
43
  * control-flow last.
44
+ *
45
+ * `daemon:native-ui:control` is deliberately NOT folded into
46
+ * `daemon:tools:bash`: a token minted to run shell commands must not
47
+ * thereby be able to click around the user's desktop (OSK-11009).
43
48
  */
44
49
  export declare const SCOPES: Readonly<{
45
50
  readonly TOOLS_BASH: "daemon:tools:bash";
46
51
  readonly TOOLS_FS_READ: "daemon:tools:fs:read";
47
52
  readonly TOOLS_FS_WRITE: "daemon:tools:fs:write";
48
53
  readonly BROWSER_CDP: "daemon:browser:cdp";
54
+ readonly NATIVE_UI_CONTROL: "daemon:native-ui:control";
49
55
  readonly SESSION_REPLAY: "daemon:session:replay";
50
56
  readonly OFFLINE_QUEUE: "daemon:offline-queue";
51
57
  }>;
52
58
  export type DaemonScope = (typeof SCOPES)[keyof typeof SCOPES];
53
59
  /**
54
- * The six daemon scopes in canonical order. Frozen so consumers can
60
+ * The seven daemon scopes in canonical order. Frozen so consumers can
55
61
  * pass it directly to OAuth `scope` parameters without defensive
56
62
  * copies.
57
63
  */
@@ -64,7 +70,7 @@ export declare const VALID_DAEMON_SCOPE_SET: ReadonlySet<string>;
64
70
  export declare function isDaemonScope(s: unknown): s is DaemonScope;
65
71
  /**
66
72
  * `cli` — REST-only sign-in grant for first-party CLI clients. Peer
67
- * to the six daemon scopes; lives on `OAuthClient.allowedScopes` for
73
+ * to the daemon scopes; lives on `OAuthClient.allowedScopes` for
68
74
  * the `oversky-cli` client. See the data-schemas canonical for the
69
75
  * full reasoning behind keeping this OUT of `ALL_DAEMON_SCOPES` (the
70
76
  * grandfather sentinel `expandScopes(undefined)` would over-grant).