@skrr-ai/cli 0.1.145 → 0.1.147

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 (296) hide show
  1. package/dist/base-command.js +38 -21
  2. package/dist/commands/agenda/plan.d.ts +14 -0
  3. package/dist/commands/agenda/plan.js +29 -0
  4. package/dist/commands/agent/message/approve.js +5 -1
  5. package/dist/commands/agent/message/decline.js +5 -1
  6. package/dist/commands/agent/message/send.d.ts +11 -0
  7. package/dist/commands/agent/message/send.js +34 -8
  8. package/dist/commands/agent-worker.js +2 -1
  9. package/dist/commands/agents/activity.js +2 -1
  10. package/dist/commands/agents/always-on/enable.js +1 -1
  11. package/dist/commands/agents/badge.js +10 -5
  12. package/dist/commands/agents/categories/index.js +2 -1
  13. package/dist/commands/agents/chat.d.ts +1 -0
  14. package/dist/commands/agents/chat.js +29 -1
  15. package/dist/commands/agents/create.js +4 -1
  16. package/dist/commands/agents/overview.js +2 -1
  17. package/dist/commands/agents/releases/create.js +2 -1
  18. package/dist/commands/agents/schedule-overview.js +12 -11
  19. package/dist/commands/agents/schedule.js +2 -1
  20. package/dist/commands/agents/spawn.d.ts +38 -1
  21. package/dist/commands/agents/spawn.js +112 -9
  22. package/dist/commands/agents/tools/auth.js +2 -1
  23. package/dist/commands/agents/tools/calls.js +2 -1
  24. package/dist/commands/agents/triggers/fire.js +20 -0
  25. package/dist/commands/agents/visibility.js +2 -1
  26. package/dist/commands/balance/show.js +17 -2
  27. package/dist/commands/balance/statement.js +2 -1
  28. package/dist/commands/commands.js +2 -1
  29. package/dist/commands/commitments/create.js +2 -1
  30. package/dist/commands/commitments/delivery.js +2 -1
  31. package/dist/commands/commitments/doctor.js +2 -1
  32. package/dist/commands/commitments/observations.js +2 -2
  33. package/dist/commands/commitments/operating-review.js +2 -1
  34. package/dist/commands/commitments/pack/preflight.js +2 -1
  35. package/dist/commands/commitments/trigger-status.js +2 -1
  36. package/dist/commands/convos/messages.js +2 -1
  37. package/dist/commands/daemon/logs.js +18 -9
  38. package/dist/commands/daemon/usage.js +2 -1
  39. package/dist/commands/dm/messages.js +2 -1
  40. package/dist/commands/dm/thread/messages.js +2 -1
  41. package/dist/commands/dm/threads.js +2 -1
  42. package/dist/commands/doctor.js +2 -1
  43. package/dist/commands/goals/key-results/assess.js +2 -1
  44. package/dist/commands/goals/key-results/history.js +2 -1
  45. package/dist/commands/harnesses/forget.js +2 -1
  46. package/dist/commands/harnesses/show.js +12 -6
  47. package/dist/commands/inbox/index.js +4 -3
  48. package/dist/commands/initiatives/decide.js +2 -1
  49. package/dist/commands/instructions/diff.js +2 -1
  50. package/dist/commands/instructions/show.js +2 -1
  51. package/dist/commands/login.js +4 -2
  52. package/dist/commands/machines/dedicated/cp.js +2 -1
  53. package/dist/commands/machines/dedicated/power/set.js +2 -1
  54. package/dist/commands/machines/show.js +2 -1
  55. package/dist/commands/memory/maintain.js +2 -1
  56. package/dist/commands/memory/read.js +2 -1
  57. package/dist/commands/memory/rebuild-index.js +2 -1
  58. package/dist/commands/memory/rebuild.js +2 -1
  59. package/dist/commands/memory/search.js +2 -1
  60. package/dist/commands/messages/list.js +2 -1
  61. package/dist/commands/revoke-daemon.js +2 -1
  62. package/dist/commands/revoke-token.js +2 -1
  63. package/dist/commands/search/all.js +14 -7
  64. package/dist/commands/search/workspace.js +2 -1
  65. package/dist/commands/set-capabilities.js +2 -1
  66. package/dist/commands/skills/browse.js +8 -2
  67. package/dist/commands/spaces/auto-executor/preview.js +3 -2
  68. package/dist/commands/spaces/auto-executor/runs.js +4 -1
  69. package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
  70. package/dist/commands/spaces/workflow-templates/extract.js +9 -1
  71. package/dist/commands/spaces/workflows/events.js +6 -3
  72. package/dist/commands/spaces/workflows/run.js +5 -3
  73. package/dist/commands/spaces/workflows/update.js +2 -1
  74. package/dist/commands/store/gallery-admissions/preview.js +2 -1
  75. package/dist/commands/store/publishers/profile/handle.js +2 -1
  76. package/dist/commands/tasks/comments/anchor.js +23 -9
  77. package/dist/commands/tasks/complete.js +4 -2
  78. package/dist/commands/tasks/create-tree.js +7 -3
  79. package/dist/commands/tasks/create.js +2 -1
  80. package/dist/commands/tasks/deliverable/add.js +2 -1
  81. package/dist/commands/tasks/deliverable/archive.js +2 -1
  82. package/dist/commands/tasks/deliverable/list.js +2 -1
  83. package/dist/commands/tasks/expectations/assess.js +2 -1
  84. package/dist/commands/tasks/labels/create.js +2 -1
  85. package/dist/commands/tasks/preflight.js +4 -2
  86. package/dist/commands/tasks/ready.js +2 -1
  87. package/dist/commands/tasks/result/submit.js +2 -1
  88. package/dist/commands/tasks/updates/add.js +2 -1
  89. package/dist/commands/tasks/wait.js +2 -1
  90. package/dist/commands/token/list.js +2 -1
  91. package/dist/commands/token/mint.js +2 -1
  92. package/dist/commands/triggers/audit.js +1 -1
  93. package/dist/commands/triggers/fire.js +19 -0
  94. package/dist/commands/wiki/write.js +14 -7
  95. package/dist/hooks/command-not-found.js +2 -1
  96. package/dist/lib/agent-chat-start.d.ts +77 -0
  97. package/dist/lib/agent-chat-start.js +169 -0
  98. package/dist/lib/agent-config.js +2 -1
  99. package/dist/lib/agent-endpoints.js +4 -2
  100. package/dist/lib/agent-evals.js +2 -1
  101. package/dist/lib/agent-guide-reference-gate.js +22 -11
  102. package/dist/lib/agent-guides.js +4 -1
  103. package/dist/lib/agent-instructions.js +5 -1
  104. package/dist/lib/agent-ref.js +8 -4
  105. package/dist/lib/agent-trigger-listing.js +2 -1
  106. package/dist/lib/agentic-stream.d.ts +21 -0
  107. package/dist/lib/agentic-stream.js +75 -6
  108. package/dist/lib/api-error-reason.js +2 -1
  109. package/dist/lib/api-fetch.js +5 -3
  110. package/dist/lib/appData.js +6 -6
  111. package/dist/lib/appInstallations.js +10 -5
  112. package/dist/lib/appsCheck.js +2 -1
  113. package/dist/lib/auth-failure.js +2 -1
  114. package/dist/lib/auth-storage.js +2 -1
  115. package/dist/lib/balance.js +6 -3
  116. package/dist/lib/capability-matrix.js +4 -2
  117. package/dist/lib/cli-runtime.js +2 -1
  118. package/dist/lib/code-handover.js +8 -3
  119. package/dist/lib/command-hygiene.js +28 -12
  120. package/dist/lib/command-manifest.js +6 -3
  121. package/dist/lib/commitment-attention-copy.js +2 -1
  122. package/dist/lib/commitment-event-wakes.js +9 -0
  123. package/dist/lib/commitment-product.js +5 -3
  124. package/dist/lib/commitment-terms.js +2 -1
  125. package/dist/lib/commitments.d.ts +8 -0
  126. package/dist/lib/commitments.js +8 -4
  127. package/dist/lib/compasses.js +2 -1
  128. package/dist/lib/completion-index.js +2 -1
  129. package/dist/lib/computer-files.js +8 -6
  130. package/dist/lib/config.js +11 -5
  131. package/dist/lib/conversation-search.js +4 -2
  132. package/dist/lib/daemon-installer.js +6 -2
  133. package/dist/lib/daemon-maintenance.js +2 -1
  134. package/dist/lib/daemon-ref.js +2 -1
  135. package/dist/lib/daemonBroker.js +6 -3
  136. package/dist/lib/daemonBrokerRefusal.js +4 -2
  137. package/dist/lib/daemonHandoff.js +14 -7
  138. package/dist/lib/daemonIslandProfile.js +2 -1
  139. package/dist/lib/dedicated-copy.js +9 -3
  140. package/dist/lib/dedicated-exec.js +2 -1
  141. package/dist/lib/dedicated-keep-awake.js +2 -1
  142. package/dist/lib/dedicated-machines.js +9 -5
  143. package/dist/lib/dedicated-service.js +2 -1
  144. package/dist/lib/dedicated-ssh.js +5 -3
  145. package/dist/lib/deployed-build.js +2 -1
  146. package/dist/lib/device-code.js +4 -3
  147. package/dist/lib/dpop-auth.js +2 -1
  148. package/dist/lib/earnings.js +2 -1
  149. package/dist/lib/exec-runtime-binary.js +5 -3
  150. package/dist/lib/first-party-harness-broker.js +4 -3
  151. package/dist/lib/first-party-harness-managed.js +2 -1
  152. package/dist/lib/first-party-harness-startup-update.js +8 -4
  153. package/dist/lib/first-party-harness-update.js +2 -1
  154. package/dist/lib/first-party-harness.js +2 -1
  155. package/dist/lib/format.d.ts +5 -0
  156. package/dist/lib/format.js +24 -4
  157. package/dist/lib/git-task.js +10 -5
  158. package/dist/lib/github-tools.js +6 -3
  159. package/dist/lib/harnesses.js +4 -2
  160. package/dist/lib/hosted-machines.js +2 -1
  161. package/dist/lib/html-text.js +33 -16
  162. package/dist/lib/instruction-blocks.js +2 -1
  163. package/dist/lib/iso-instant.js +5 -3
  164. package/dist/lib/keychain.js +15 -5
  165. package/dist/lib/label-scope.js +2 -1
  166. package/dist/lib/live-runtime-binary.js +10 -7
  167. package/dist/lib/local-skills.js +10 -6
  168. package/dist/lib/login.js +3 -2
  169. package/dist/lib/machine-audit.js +2 -1
  170. package/dist/lib/machine-daemon-log.js +2 -1
  171. package/dist/lib/machine-services.js +2 -1
  172. package/dist/lib/memory-history-session.js +2 -1
  173. package/dist/lib/memory-sync.js +6 -2
  174. package/dist/lib/message-intent.d.ts +10 -0
  175. package/dist/lib/node-adapter.js +4 -2
  176. package/dist/lib/northstars.js +4 -2
  177. package/dist/lib/oauthLogin.js +16 -7
  178. package/dist/lib/open-target.js +8 -4
  179. package/dist/lib/option-hint.js +2 -4
  180. package/dist/lib/outbox.js +2 -1
  181. package/dist/lib/planOutcome.d.ts +5 -3
  182. package/dist/lib/planOutcome.js +7 -4
  183. package/dist/lib/platform-update-local.js +2 -3
  184. package/dist/lib/proactiveApi.d.ts +38 -1
  185. package/dist/lib/proactiveApi.js +17 -1
  186. package/dist/lib/rate-limit-retry.js +2 -1
  187. package/dist/lib/reflection.js +2 -1
  188. package/dist/lib/request-field-flags.js +2 -1
  189. package/dist/lib/runtime-start-verification.js +2 -1
  190. package/dist/lib/schedule.d.ts +15 -0
  191. package/dist/lib/schedule.js +16 -1
  192. package/dist/lib/scoped-memory-command.js +7 -3
  193. package/dist/lib/search-display.js +11 -4
  194. package/dist/lib/skill-store-pagination.js +2 -1
  195. package/dist/lib/space-notebook.js +5 -3
  196. package/dist/lib/store-listing.js +2 -1
  197. package/dist/lib/task-agent-context-capabilities.js +2 -1
  198. package/dist/lib/task-asset-upload.js +7 -3
  199. package/dist/lib/task-closure.js +2 -1
  200. package/dist/lib/task-economics.js +2 -1
  201. package/dist/lib/task-execution.js +16 -8
  202. package/dist/lib/task-extras.js +4 -2
  203. package/dist/lib/task-operation-watch.js +2 -1
  204. package/dist/lib/task-preflight.js +3 -2
  205. package/dist/lib/task-recurrence-summary.js +4 -2
  206. package/dist/lib/task-runtime-headers.js +10 -5
  207. package/dist/lib/task-transcript.js +3 -2
  208. package/dist/lib/task-transfer.js +9 -5
  209. package/dist/lib/tasks.js +2 -1
  210. package/dist/lib/triggers.d.ts +144 -3
  211. package/dist/lib/triggers.js +280 -23
  212. package/dist/lib/update-check.js +12 -7
  213. package/dist/lib/usage-discovery.js +2 -1
  214. package/dist/lib/usd-micros.js +2 -1
  215. package/dist/lib/web-url.js +2 -1
  216. package/dist/lib/widgetCheck.js +15 -9
  217. package/dist/lib/widgetStaticScan.js +26 -14
  218. package/dist/lib/workflow-run-view.js +5 -3
  219. package/dist/lib/workflow-templates.d.ts +10 -0
  220. package/dist/lib/workflow-templates.js +47 -0
  221. package/dist/lib/write-target.js +4 -5
  222. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
  223. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
  224. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
  225. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
  226. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
  227. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
  228. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
  229. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
  230. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
  231. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
  232. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
  233. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
  234. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
  235. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
  236. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
  237. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
  238. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
  239. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
  240. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
  241. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
  242. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
  243. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
  244. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
  245. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
  246. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
  247. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
  248. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
  249. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
  250. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
  251. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
  252. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
  253. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
  254. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
  271. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
  272. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
  273. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
  274. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
  275. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
  276. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
  277. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
  278. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
  279. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
  280. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
  281. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
  282. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
  283. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
  284. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
  285. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
  286. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
  287. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
  288. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  289. package/dist/node_modules/@skrr-ai/data-provider/index.js +20520 -20130
  290. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
  291. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
  292. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
  293. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
  294. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  295. package/oclif.manifest.json +24 -2
  296. package/package.json +1 -1
@@ -7,6 +7,8 @@ exports.deliveryInput = deliveryInput;
7
7
  exports.renderExecutionReceipt = renderExecutionReceipt;
8
8
  exports.renderExecutionReceiptQuarterlyMetrics = renderExecutionReceiptQuarterlyMetrics;
9
9
  const data_provider_1 = require("@skrr-ai/data-provider");
10
+ const DELIVERY_INPUT_RE = /-/g;
11
+ const RENDER_EXECUTION_RECEIPT_RE = /^[A-Za-z0-9_.:-]+$/;
10
12
  exports.COMMITMENT_DELIVERY_CHOICES = [
11
13
  'report-only',
12
14
  'local-patch',
@@ -29,8 +31,8 @@ function normalizeTaskReviewPolicy(value) {
29
31
  return value;
30
32
  }
31
33
  function deliveryInput(mode, options = {}) {
32
- const normalized = mode.replace(/-/g, '_');
33
- if (!exports.COMMITMENT_DELIVERY_CHOICES.some((choice) => choice.replace(/-/g, '_') === normalized)) {
34
+ const normalized = mode.replace(DELIVERY_INPUT_RE, '_');
35
+ if (!exports.COMMITMENT_DELIVERY_CHOICES.some((choice) => choice.replace(DELIVERY_INPUT_RE, '_') === normalized)) {
34
36
  throw new Error(`Unknown delivery. Choose ${exports.COMMITMENT_DELIVERY_CHOICES.join(', ')}.`);
35
37
  }
36
38
  return {
@@ -66,7 +68,7 @@ function renderExecutionReceipt(receipt, log, verbose = false) {
66
68
  // there) is not an action either: the actor is printed alone.
67
69
  const narrative = [receipt.summary, receipt.blocker?.summary].filter(Boolean);
68
70
  const reason = receipt.nextActor?.reason;
69
- const action = reason && !narrative.includes(reason) && !/^[A-Za-z0-9_.:-]+$/.test(reason.trim())
71
+ const action = reason && !narrative.includes(reason) && !RENDER_EXECUTION_RECEIPT_RE.test(reason.trim())
70
72
  ? reason
71
73
  : '';
72
74
  if (receipt.nextActor)
@@ -24,6 +24,7 @@ exports.appendUnique = appendUnique;
24
24
  exports.removeByKey = removeByKey;
25
25
  exports.renderCommitmentTerms = renderCommitmentTerms;
26
26
  const commitments_1 = require("./commitments");
27
+ const PARSE_SENSOR_REF_RE = /^(trigger|ingress):(.+)$/;
27
28
  /**
28
29
  * Parse a sensor reference. Accepts `ingress:<id>` / `trigger:<id>`, or a bare
29
30
  * id which is treated as an ingress — the common case, and the server rejects a
@@ -33,7 +34,7 @@ function parseSensorRef(input) {
33
34
  const raw = String(input || '').trim();
34
35
  if (!raw)
35
36
  throw new Error('Sensor reference is empty.');
36
- const match = /^(trigger|ingress):(.+)$/.exec(raw);
37
+ const match = PARSE_SENSOR_REF_RE.exec(raw);
37
38
  if (match) {
38
39
  return { kind: match[1], refId: match[2] };
39
40
  }
@@ -732,6 +732,14 @@ export type EventWakeCapabilities = {
732
732
  impact?: string;
733
733
  }[];
734
734
  degradedReason?: string;
735
+ /** What the author selected through `config.events`, and which selections were set aside (OSK-22600). */
736
+ selectedEvents?: {
737
+ source?: string;
738
+ event?: string | null;
739
+ verdict?: 'can_wake' | 'set_aside';
740
+ reason?: string;
741
+ detail?: string;
742
+ }[];
735
743
  };
736
744
  /** Shape of `GET /:id/wake-capabilities`. */
737
745
  export interface CommitmentWakeCapabilities {
@@ -95,6 +95,10 @@ const commitment_attention_copy_1 = require("./commitment-attention-copy");
95
95
  const instruction_input_1 = require("./instruction-input");
96
96
  const format_1 = require("./format");
97
97
  const triggers_1 = require("./triggers");
98
+ const PARSE_INTERVAL_TO_MS_RE = /^\d+(\.\d+)?$/;
99
+ const DESCRIBE_EVIDENCE_HEALTH_RE = /_indeterminate$/;
100
+ const STANDSTILL_FIX_FOR_READ_RE = /^[A-Za-z0-9_-]{1,80}$/;
101
+ const DESCRIBE_OPERATION_RE = /^lifecycle_([a-z_]+)$/;
98
102
  /** Derived from the installed compatibility vocabulary so the CLI remains
99
103
  * safe even while data-provider and CLI packages roll out separately. */
100
104
  exports.COMMITMENT_AUTHORABLE_CADENCE_MODES = data_provider_2.COMMITMENT_CADENCE_MODES.filter((mode) => mode !== 'sampled');
@@ -660,7 +664,7 @@ function parseIntervalToMs(input) {
660
664
  if (!raw)
661
665
  throw new Error('Empty interval. Use a form like "15m", "6h", "1d", or "360".');
662
666
  let minutes;
663
- if (/^\d+(\.\d+)?$/.test(raw)) {
667
+ if (PARSE_INTERVAL_TO_MS_RE.test(raw)) {
664
668
  minutes = Number(raw);
665
669
  }
666
670
  else {
@@ -832,7 +836,7 @@ function describeEvidenceHealth(health, criteriaCount) {
832
836
  // The coarse `*_indeterminate` reasons ride alongside a precise one and say
833
837
  // only "something was indeterminate", so showing them crowds out the reason
834
838
  // that names what to do.
835
- const reasons = (health?.reasons || []).filter((r) => !/_indeterminate$/.test(r));
839
+ const reasons = (health?.reasons || []).filter((r) => !DESCRIBE_EVIDENCE_HEALTH_RE.test(r));
836
840
  const detail = reasons.length ? ` (${reasons.join(', ')})` : '';
837
841
  if (state === 'unevidenceable_criteria') {
838
842
  // This is not the same problem as criteria that exist but cannot be
@@ -1104,7 +1108,7 @@ function standstillFixForRead(standstill, commitmentId) {
1104
1108
  if (!(0, data_provider_2.isLegacyStandstillReason)(standstill.reason))
1105
1109
  return standstill.fix;
1106
1110
  const fix = (0, data_provider_2.describeStandstill)(standstill.reason).fix ?? undefined;
1107
- if (!fix || !commitmentId || !/^[A-Za-z0-9_-]{1,80}$/.test(commitmentId))
1111
+ if (!fix || !commitmentId || !STANDSTILL_FIX_FOR_READ_RE.test(commitmentId))
1108
1112
  return fix;
1109
1113
  return fix.split('<commitment>').join(commitmentId);
1110
1114
  }
@@ -1184,7 +1188,7 @@ function describeOperation(operation, reason) {
1184
1188
  // while `show` said `ready` seconds later (OSK-21105).
1185
1189
  if (reason === 'operation_read_unavailable')
1186
1190
  return 'not read yet — no status is recorded for the current contract, which is not a failure; `skrr commitments show` reads it live';
1187
- const lifecycle = typeof reason === 'string' ? /^lifecycle_([a-z_]+)$/.exec(reason) : null;
1191
+ const lifecycle = typeof reason === 'string' ? DESCRIBE_OPERATION_RE.exec(reason) : null;
1188
1192
  if (!lifecycle) {
1189
1193
  const words = operationReasonWords(reason);
1190
1194
  return `${operation ?? 'blocked'}${reason ? ` — ${reason}${words ? `: ${words}` : ''}` : ''}`;
@@ -37,6 +37,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
37
37
  const data_provider_2 = require("@skrr-ai/data-provider");
38
38
  const format_1 = require("./format");
39
39
  const triggers_1 = require("./triggers");
40
+ const RENDER_COMPASS_TRACE_RE = /_/g;
40
41
  exports.COMPASS_STATUSES = ['active', 'archived'];
41
42
  const base = (id) => `/api/compasses/${encodeURIComponent(id)}`;
42
43
  exports.compassApi = {
@@ -351,7 +352,7 @@ function renderCompassTrace(trace, log) {
351
352
  }
352
353
  (0, format_1.renderTable)(trace.events.map((event) => ({
353
354
  when: shortDate(event.occurredAt),
354
- type: event.type.replace(/_/g, ' '),
355
+ type: event.type.replace(RENDER_COMPASS_TRACE_RE, ' '),
355
356
  status: event.status ?? '—',
356
357
  event: event.summary ?? '—',
357
358
  commitment: String(event.references?.commitmentId ?? '—'),
@@ -42,6 +42,7 @@ exports.completionCandidates = completionCandidates;
42
42
  const fs = __importStar(require("node:fs/promises"));
43
43
  const path = __importStar(require("node:path"));
44
44
  const node_crypto_1 = require("node:crypto");
45
+ const CREATE_COMPLETION_CACHE_SCOPE_RE = /\/+$/;
45
46
  const INDEX_VERSION = 1;
46
47
  const CACHE_VERSION = 2;
47
48
  /** Bind references to the command's resolved context, never a stored login. */
@@ -52,7 +53,7 @@ function createCompletionCacheScope(context) {
52
53
  const hash = (value) => (0, node_crypto_1.createHash)('sha256').update(value).digest('hex');
53
54
  // The adapter appends API paths to the full request base. Preserve deployment
54
55
  // prefixes, queries and fragments; normalize its trailing-slash handling.
55
- const requestBase = new URL(context.baseURL.replace(/\/+$/, '')).href;
56
+ const requestBase = new URL(context.baseURL.replace(CREATE_COMPLETION_CACHE_SCOPE_RE, '')).href;
56
57
  return {
57
58
  namespace: hash(JSON.stringify([
58
59
  path.resolve(context.configRoot), context.profile,
@@ -67,6 +67,8 @@ const base_command_1 = require("../base-command");
67
67
  const api_fetch_1 = require("./api-fetch");
68
68
  const dedicated_machines_1 = require("./dedicated-machines");
69
69
  const dedicated_file_retry_1 = require("./dedicated-file-retry");
70
+ const PARSE_COMPUTER_FILE_TAG_RE = /^\d+$/;
71
+ const DESCRIBE_COMPUTER_FILE_REFUSAL_RE = /path|file|folder|directory/i;
70
72
  /**
71
73
  * The lease could not say which generation is running — a server that does not
72
74
  * publish it yet, or a lease with none. File calls cannot be fenced without
@@ -371,10 +373,10 @@ function parseComputerFileTag(text) {
371
373
  }
372
374
  const parts = trimmed.split(':');
373
375
  if ((parts.length === 3 || parts.length === 4) &&
374
- /^\d+$/.test(parts[0]) &&
375
- /^\d+$/.test(parts[1]) &&
376
+ PARSE_COMPUTER_FILE_TAG_RE.test(parts[0]) &&
377
+ PARSE_COMPUTER_FILE_TAG_RE.test(parts[1]) &&
376
378
  Number.isSafeInteger(Number(parts[1])) &&
377
- /^\d+$/.test(parts[2]) &&
379
+ PARSE_COMPUTER_FILE_TAG_RE.test(parts[2]) &&
378
380
  (parts.length === 3 || CONTENTS_TAG.test(parts[3]))) {
379
381
  return {
380
382
  inode: parts[0],
@@ -397,12 +399,12 @@ function entityTagOf(tag) {
397
399
  function isEntityTag(value) {
398
400
  const tag = value;
399
401
  return (typeof tag?.inode === 'string' &&
400
- /^\d+$/.test(tag.inode) &&
402
+ PARSE_COMPUTER_FILE_TAG_RE.test(tag.inode) &&
401
403
  typeof tag?.size === 'number' &&
402
404
  Number.isSafeInteger(tag.size) &&
403
405
  tag.size >= 0 &&
404
406
  typeof tag?.mtimeNs === 'string' &&
405
- /^\d+$/.test(tag.mtimeNs) &&
407
+ PARSE_COMPUTER_FILE_TAG_RE.test(tag.mtimeNs) &&
406
408
  (tag.contents === undefined ||
407
409
  (typeof tag.contents === 'string' && CONTENTS_TAG.test(tag.contents))));
408
410
  }
@@ -617,7 +619,7 @@ function describeComputerFileRefusal(refusal, ctx) {
617
619
  case 'not_found': {
618
620
  // `details.path` marks a path refusal; without it the machine itself was
619
621
  // not found — "No computer exists by that machine id."
620
- if (refusal.details?.path || /path|file|folder|directory/i.test(refusal.message)) {
622
+ if (refusal.details?.path || DESCRIBE_COMPUTER_FILE_REFUSAL_RE.test(refusal.message)) {
621
623
  return `${refusal.message} Look with \`${bin} machines dedicated ls ${lease} <dir>\`.`;
622
624
  }
623
625
  return `${refusal.message} List your machines with \`${bin} machines dedicated list\`.`;
@@ -60,6 +60,10 @@ const auth_diagnostics_1 = require("./auth-diagnostics");
60
60
  const cli_id_1 = require("./cli-id");
61
61
  const device_id_1 = require("./device-id");
62
62
  const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
63
+ const ENVIRONMENT_FOR_BASE_URL_RE = /\/+$/;
64
+ const CANONICALIZE_KNOWN_BASE_URL_RE = /^http:\/\//;
65
+ const CANONICALIZE_KNOWN_BASE_URL_RE_2 = /^https:\/\/www\./;
66
+ const ENV_OVERLAY_VALUE_RE = /^OVERSKY_/;
63
67
  // Both from config/public-endpoints.json, the one domain contract, rather than a
64
68
  // fourth hand-copied pair. The CLI previously knew only about dev — there was no
65
69
  // prod constant at all — which matters more here than it looks: baseURL decides
@@ -90,7 +94,9 @@ exports.ENVIRONMENT_BASE_URLS = {
90
94
  };
91
95
  /** Which deployment a base URL denotes, or null for a self-hosted server. */
92
96
  function environmentForBaseURL(value) {
93
- const normalized = canonicalizeKnownBaseURL(value).replace(/\/+$/, '').toLowerCase();
97
+ const normalized = canonicalizeKnownBaseURL(value)
98
+ .replace(ENVIRONMENT_FOR_BASE_URL_RE, '')
99
+ .toLowerCase();
94
100
  for (const [name, url] of Object.entries(exports.ENVIRONMENT_BASE_URLS)) {
95
101
  if (normalized === url.toLowerCase())
96
102
  return name;
@@ -124,11 +130,11 @@ function describeDeployment(baseURL) {
124
130
  return env ? `${env} (${baseURL})` : baseURL;
125
131
  }
126
132
  function canonicalizeKnownBaseURL(value) {
127
- const trimmed = value.trim().replace(/\/+$/, '');
128
- const normalized = trimmed.toLowerCase().replace(/^http:\/\//, 'https://');
133
+ const trimmed = value.trim().replace(ENVIRONMENT_FOR_BASE_URL_RE, '');
134
+ const normalized = trimmed.toLowerCase().replace(CANONICALIZE_KNOWN_BASE_URL_RE, 'https://');
129
135
  if (normalized === exports.LEGACY_DEV_BASE_URL)
130
136
  return exports.CANONICAL_DEV_BASE_URL;
131
- const withoutWww = normalized.replace(/^https:\/\/www\./, 'https://');
137
+ const withoutWww = normalized.replace(CANONICALIZE_KNOWN_BASE_URL_RE_2, 'https://');
132
138
  // Checked after `www.` is stripped, so `https://www.oversky.ai` folds too.
133
139
  if (withoutWww === exports.LEGACY_PROD_BASE_URL)
134
140
  return exports.CANONICAL_PROD_BASE_URL;
@@ -201,7 +207,7 @@ const ENV_VAR = {
201
207
  let warnedEnvPrefixConflict = false;
202
208
  function envOverlayValue(key) {
203
209
  const legacyName = ENV_VAR[key];
204
- const renamedName = legacyName.replace(/^OVERSKY_/, 'SKRR_');
210
+ const renamedName = legacyName.replace(ENV_OVERLAY_VALUE_RE, 'SKRR_');
205
211
  const legacy = process.env[legacyName]?.trim();
206
212
  const renamed = process.env[renamedName]?.trim();
207
213
  if (legacy && renamed && legacy !== renamed && !warnedEnvPrefixConflict) {
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizedSnippetLength = normalizedSnippetLength;
4
4
  exports.compactMessageSearchHit = compactMessageSearchHit;
5
+ const FIND_QUERY_MATCH_RE = /[^\p{L}\p{N}]+/u;
6
+ const COMPACT_MESSAGE_SEARCH_HIT_RE = /\s+/g;
5
7
  const MAX_SEARCH_SNIPPET_CHARS = 4000;
6
8
  function normalizedSnippetLength(value) {
7
9
  if (!Number.isFinite(value))
@@ -21,7 +23,7 @@ function findQueryMatch(text, query) {
21
23
  // present, center on the earliest substantive query token so the bounded CLI
22
24
  // result still explains why it matched instead of truncating just before the
23
25
  // highlighted word returned by the server crop.
24
- const tokens = Array.from(new Set(normalizedQuery.split(/[^\p{L}\p{N}]+/u).filter((token) => token.length >= 2)));
26
+ const tokens = Array.from(new Set(normalizedQuery.split(FIND_QUERY_MATCH_RE).filter((token) => token.length >= 2)));
25
27
  let best = null;
26
28
  for (const token of tokens) {
27
29
  const at = loweredText.indexOf(token);
@@ -34,7 +36,7 @@ function findQueryMatch(text, query) {
34
36
  function compactMessageSearchHit(message, requestedSnippetLength, query = '') {
35
37
  const limit = normalizedSnippetLength(requestedSnippetLength);
36
38
  const normalizedText = String(message.text ?? '')
37
- .replace(/\s+/g, ' ')
39
+ .replace(COMPACT_MESSAGE_SEARCH_HIT_RE, ' ')
38
40
  .trim();
39
41
  const normalizedQuery = query.trim();
40
42
  let text = normalizedText;
@@ -63,6 +63,8 @@ const node_os_1 = __importDefault(require("node:os"));
63
63
  const node_path_1 = __importDefault(require("node:path"));
64
64
  const auth_core_1 = require("@skrr-ai/auth-core");
65
65
  Object.defineProperty(exports, "isTrustedArtifactOrigin", { enumerable: true, get: function () { return auth_core_1.isTrustedArtifactOrigin; } });
66
+ const DAEMON_FEED_BASE_RE = /\/+$/;
67
+ const GET_BYTES_WITH_TIMEOUT_RE = /^\d+$/;
66
68
  /** Public CloudFront feed. Mirrors the daemon's own `CLOUDFRONT_FEED_BASE`. */
67
69
  exports.DEFAULT_DAEMON_FEED_BASE = 'https://updates.skrr.ai/daemon';
68
70
  /** Same override the daemon honours, so one env var steers both. */
@@ -74,7 +76,7 @@ const MAX_ARTIFACT_BYTES = 256 * 1_024 * 1_024;
74
76
  const MANIFEST_TIMEOUT_MS = 30_000;
75
77
  const ARTIFACT_TIMEOUT_MS = 10 * 60_000;
76
78
  function daemonFeedBase(env = process.env) {
77
- return (env[exports.DAEMON_FEED_BASE_ENV]?.trim() || exports.DEFAULT_DAEMON_FEED_BASE).replace(/\/+$/, '');
79
+ return (env[exports.DAEMON_FEED_BASE_ENV]?.trim() || exports.DEFAULT_DAEMON_FEED_BASE).replace(DAEMON_FEED_BASE_RE, '');
78
80
  }
79
81
  /**
80
82
  * Where the fetched binary lands. `exec-runtime-binary.ts` already looks here, so a
@@ -158,7 +160,9 @@ async function getBytesWithTimeout(url, timeoutMs, maxBytes, fetchImpl, signal)
158
160
  if (!response.ok)
159
161
  throw new Error(`returned HTTP ${response.status}`);
160
162
  const contentLength = response.headers.get('content-length');
161
- if (contentLength && /^\d+$/.test(contentLength.trim()) && Number(contentLength) > maxBytes) {
163
+ if (contentLength &&
164
+ GET_BYTES_WITH_TIMEOUT_RE.test(contentLength.trim()) &&
165
+ Number(contentLength) > maxBytes) {
162
166
  throw new DownloadSizeLimitError(maxBytes);
163
167
  }
164
168
  if (!response.body)
@@ -22,6 +22,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
22
22
  const format_1 = require("./format");
23
23
  const hosted_machines_1 = require("./hosted-machines");
24
24
  const machines_1 = require("./machines");
25
+ const NORMALIZE_SPACES_RE = /\s+/g;
25
26
  /**
26
27
  * daemon-maintenance.ts — the owner's pause on one of their own machines, from the
27
28
  * terminal (`skrr daemon maintenance status | hold | resume | attest`; OSK-19107,
@@ -709,7 +710,7 @@ async function runStatus(input, io) {
709
710
  };
710
711
  }
711
712
  function normalizeSpaces(text) {
712
- return text.replace(/\s+/g, ' ').trim();
713
+ return text.replace(NORMALIZE_SPACES_RE, ' ').trim();
713
714
  }
714
715
  /**
715
716
  * `hold`: take the hold, and optionally wait for the machine to be ready.
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.formatDaemonRef = formatDaemonRef;
21
21
  exports.normalizeDaemonRef = normalizeDaemonRef;
22
+ const NORMALIZE_DAEMON_REF_RE = /(?:\.{3}|…)$/;
22
23
  /** Prefix the short form carries so a truncated id is visibly truncated. */
23
24
  const DISPLAY_PREFIX = 'd_';
24
25
  /**
@@ -42,6 +43,6 @@ function normalizeDaemonRef(input) {
42
43
  let out = input.trim();
43
44
  if (out.toLowerCase().startsWith(DISPLAY_PREFIX))
44
45
  out = out.slice(DISPLAY_PREFIX.length);
45
- out = out.replace(/(?:\.{3}|…)$/, '');
46
+ out = out.replace(NORMALIZE_DAEMON_REF_RE, '');
46
47
  return out.trim();
47
48
  }
@@ -108,6 +108,9 @@ const harness_context_1 = require("./harness-context");
108
108
  const cli_identity_1 = require("./cli-identity");
109
109
  const daemonRestartWait_1 = require("./daemonRestartWait");
110
110
  const keychain_1 = require("./keychain");
111
+ const NORMALIZE_BASE_URL_RE = /\/+$/;
112
+ const RESOLVE_PROFILE_BOOTSTRAP_PATHS_RE = /^daemon-island\.(?!default\.json$)[^.]+\.json$/;
113
+ const ADOPTION_LOCK_PATH_RE = /[^A-Za-z0-9._-]/g;
111
114
  const REQUEST_TIMEOUT_MS = 20_000;
112
115
  /**
113
116
  * Normalize a base URL for equality comparison. Mirrors the daemon-side
@@ -118,7 +121,7 @@ const REQUEST_TIMEOUT_MS = 20_000;
118
121
  function normalizeBaseUrl(u) {
119
122
  if (typeof u !== 'string' || u.length === 0)
120
123
  return null;
121
- const trimmed = u.trim().replace(/\/+$/, '');
124
+ const trimmed = u.trim().replace(NORMALIZE_BASE_URL_RE, '');
122
125
  if (trimmed.length === 0)
123
126
  return null;
124
127
  try {
@@ -160,7 +163,7 @@ function resolveBootstrapPath(profile = 'default') {
160
163
  /** Build deterministic non-default bootstrap paths from a daemon config directory. */
161
164
  function resolveProfileBootstrapPaths(primary, entryNames) {
162
165
  const extras = entryNames
163
- .filter((name) => /^daemon-island\.(?!default\.json$)[^.]+\.json$/.test(name))
166
+ .filter((name) => RESOLVE_PROFILE_BOOTSTRAP_PATHS_RE.test(name))
164
167
  .sort()
165
168
  .map((name) => path.join(path.dirname(primary), name));
166
169
  return [primary, ...extras];
@@ -1280,7 +1283,7 @@ function daemonDidNotAnswer(failure) {
1280
1283
  }
1281
1284
  /** The adoption lock: one per config root and profile. */
1282
1285
  function adoptionLockPath(profile) {
1283
- const safe = profile.replace(/[^A-Za-z0-9._-]/g, '_') || 'default';
1286
+ const safe = profile.replace(ADOPTION_LOCK_PATH_RE, '_') || 'default';
1284
1287
  return path.join((0, config_1.configRoot)(), `cli-session-adopt.${safe}.lock`);
1285
1288
  }
1286
1289
  function storedAccessToken(baseURL) {
@@ -6,6 +6,8 @@ exports.describeGuestDaemonUnavailable = describeGuestDaemonUnavailable;
6
6
  exports.describeLocalDaemonUnavailable = describeLocalDaemonUnavailable;
7
7
  exports.describeBrokerFailure = describeBrokerFailure;
8
8
  const daemon_command_hint_1 = require("./daemon-command-hint");
9
+ const SENTENCE_RE = /[.!?]$/;
10
+ const DESCRIBE_LOCAL_DAEMON_UNAVAILABLE_RE = /[.]$/;
9
11
  /**
10
12
  * True when a daemon ANSWERED the hand-off and refused it — as opposed to no
11
13
  * daemon being there to ask (`no_bootstrap`, a stale descriptor nobody listens
@@ -54,7 +56,7 @@ function sentence(detail) {
54
56
  const d = (detail ?? '').trim();
55
57
  if (!d)
56
58
  return '';
57
- return /[.!?]$/.test(d) ? ` ${d}` : ` ${d}.`;
59
+ return SENTENCE_RE.test(d) ? ` ${d}` : ` ${d}.`;
58
60
  }
59
61
  /**
60
62
  * Describe a broker failure for a person, or null when there is nothing to
@@ -254,7 +256,7 @@ function describeLocalDaemonUnavailable(failure, bin = 'skrr') {
254
256
  else if (failure.reason === 'bootstrap_parse' ||
255
257
  failure.descriptorState === 'unreadable' ||
256
258
  failure.descriptorState === 'invalid') {
257
- headline = `${who} is not available: its sign-in hand-off${where} could not be read${failure.detail ? ` (${failure.detail.replace(/[.]$/, '')})` : ''}.`;
259
+ headline = `${who} is not available: its sign-in hand-off${where} could not be read${failure.detail ? ` (${failure.detail.replace(DESCRIBE_LOCAL_DAEMON_UNAVAILABLE_RE, '')})` : ''}.`;
258
260
  }
259
261
  else if (failure.descriptorState === 'dead_pid') {
260
262
  headline =
@@ -11,6 +11,13 @@ const dedicated_service_1 = require("./dedicated-service");
11
11
  const exec_runtime_binary_1 = require("./exec-runtime-binary");
12
12
  const auth_core_1 = require("@skrr-ai/auth-core");
13
13
  const keychain_1 = require("./keychain");
14
+ const WINDOWS_SHIM_RE = /\.(cmd|bat)$/i;
15
+ const PARSE_ID_PROVENANCE_RE = /id-source=([A-Za-z0-9._:-]+)/;
16
+ const PARSE_ID_PROVENANCE_RE_2 = /machine-uuid=([A-Za-z0-9._:-]+)/;
17
+ const PARSE_ID_PROVENANCE_RE_3 = /server=(\S+)/;
18
+ const CANONICAL_SERVER_RE = /\/+$/;
19
+ const FIRST_MEANINGFUL_LINE_RE = /^[{}]/;
20
+ const CHECK_LOCAL_DAEMON_MACHINE_IDENTITY_RE = /unknown command/i;
14
21
  /**
15
22
  * Ceilings, not expectations. Both calls finish in milliseconds when anything is
16
23
  * working; these exist so that when something is NOT working the login ends.
@@ -39,7 +46,7 @@ function runOversky(binary, args, opts) {
39
46
  // failed on EVERY Windows login and reported it as the daemon refusing the
40
47
  // bundle. Restricted to the shim case so real binaries keep the argv-array
41
48
  // exec path, which needs no quoting rules to be right.
42
- const isWinShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(binary);
49
+ const isWinShim = process.platform === 'win32' && WINDOWS_SHIM_RE.test(binary);
43
50
  const child = (0, node_child_process_1.spawn)(binary, (0, exec_runtime_binary_1.normalizeRuntimeGlobalArgs)(args), {
44
51
  // stderr is CAPTURED, not discarded. Discarding it cost a debugging cycle
45
52
  // on the first real run: the daemon exited non-zero with
@@ -118,11 +125,11 @@ function parseIdProvenance(stderr) {
118
125
  const line = stderr.split('\n').find((l) => l.includes('skrrd:accept-handoff'));
119
126
  if (!line)
120
127
  return {};
121
- const idSource = /id-source=([A-Za-z0-9._:-]+)/.exec(line)?.[1];
122
- const machineUuid = /machine-uuid=([A-Za-z0-9._:-]+)/.exec(line)?.[1];
128
+ const idSource = PARSE_ID_PROVENANCE_RE.exec(line)?.[1];
129
+ const machineUuid = PARSE_ID_PROVENANCE_RE_2.exec(line)?.[1];
123
130
  // Any non-space run: this one is a URL, and a URL contains characters the
124
131
  // other two never do.
125
- const daemonServer = /server=(\S+)/.exec(line)?.[1];
132
+ const daemonServer = PARSE_ID_PROVENANCE_RE_3.exec(line)?.[1];
126
133
  return { idSource, machineUuid, daemonServer };
127
134
  }
128
135
  /**
@@ -161,7 +168,7 @@ function describeDelivery(opts) {
161
168
  * is the fold the rest of the CLI already compares through.
162
169
  */
163
170
  function canonicalServer(url) {
164
- return (0, config_1.canonicalizeKnownBaseURL)(url).trim().replace(/\/+$/, '').toLowerCase();
171
+ return (0, config_1.canonicalizeKnownBaseURL)(url).trim().replace(CANONICAL_SERVER_RE, '').toLowerCase();
165
172
  }
166
173
  /** The most useful line of a failure, so a remedy can name the cause. */
167
174
  function firstMeaningfulLine(text) {
@@ -170,7 +177,7 @@ function firstMeaningfulLine(text) {
170
177
  .map((l) => l.trim())
171
178
  .find((l) => l &&
172
179
  !l.startsWith('at ') &&
173
- !/^[{}]/.test(l) &&
180
+ !FIRST_MEANINGFUL_LINE_RE.test(l) &&
174
181
  // The provenance line is a protocol between these two programs, not a
175
182
  // diagnosis. Reporting it as one would answer "why did this fail?" with
176
183
  // a machine's own bookkeeping.
@@ -413,7 +420,7 @@ async function checkLocalDaemonMachineIdentity(profile, binary = (0, exec_runtim
413
420
  if (!printed.ok) {
414
421
  // A daemon too old to have `accept-handoff` answers "unknown command": it is
415
422
  // older than per-profile identities too, which is the skew itself.
416
- if (/unknown command/i.test(printed.stderr)) {
423
+ if (CHECK_LOCAL_DAEMON_MACHINE_IDENTITY_RE.test(printed.stderr)) {
417
424
  return (0, daemon_machine_identity_1.daemonMachineIdentitySkew)({ profile, binary, reported: null });
418
425
  }
419
426
  // Any other failed probe says nothing about the daemon's identity, and
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.bootstrapDescriptorProfile = bootstrapDescriptorProfile;
7
7
  const node_os_1 = __importDefault(require("node:os"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
+ const BOOTSTRAP_DESCRIPTOR_PROFILE_RE = /^daemon-island\.([^.]+)\.json$/;
9
10
  /**
10
11
  * The daemon profile an island descriptor belongs to, read from its path, or
11
12
  * null when the path names none (a Dedicated Runtime or Hosted Machine hand-off
@@ -28,7 +29,7 @@ function bootstrapDescriptorProfile(descriptorPath) {
28
29
  if (!descriptorPath)
29
30
  return null;
30
31
  const base = node_path_1.default.basename(descriptorPath);
31
- const named = /^daemon-island\.([^.]+)\.json$/.exec(base);
32
+ const named = BOOTSTRAP_DESCRIPTOR_PROFILE_RE.exec(base);
32
33
  if (named)
33
34
  return named[1];
34
35
  if (base !== 'daemon-island.json')
@@ -15,6 +15,10 @@ const node_path_1 = require("node:path");
15
15
  const computer_files_1 = require("./computer-files");
16
16
  const dedicated_file_retry_1 = require("./dedicated-file-retry");
17
17
  const dedicated_machines_1 = require("./dedicated-machines");
18
+ const NAMES_REMOTE_DIRECTORY_RE = /(^|\/)\.?$/;
19
+ const INTO_REMOTE_DIRECTORY_RE = /\/\.?$/;
20
+ const INTO_REMOTE_DIRECTORY_RE_2 = /^\.$/;
21
+ const STAT_DESTINATION_RE = /path|file|folder|directory/i;
18
22
  /**
19
23
  * A refusal the CLI makes itself, with the code the server uses for the same
20
24
  * cause. A file over the limit, a file that changed and a file that is missing
@@ -133,11 +137,13 @@ function isContinuousIntegration(env = process.env) {
133
137
  }
134
138
  /** `dir/`, `dir/.` or `.`: a machine path that names a directory to copy into. */
135
139
  function namesRemoteDirectory(remotePath) {
136
- return /(^|\/)\.?$/.test(remotePath);
140
+ return NAMES_REMOTE_DIRECTORY_RE.test(remotePath);
137
141
  }
138
142
  /** `name` inside the machine directory `directory`, however it was spelled. */
139
143
  function intoRemoteDirectory(directory, name) {
140
- const parent = directory.replace(/\/\.?$/, '').replace(/^\.$/, '');
144
+ const parent = directory
145
+ .replace(INTO_REMOTE_DIRECTORY_RE, '')
146
+ .replace(INTO_REMOTE_DIRECTORY_RE_2, '');
141
147
  return parent ? `${parent}/${name}` : name;
142
148
  }
143
149
  /**
@@ -155,7 +161,7 @@ async function statDestination(statPath, leaseId, remotePath, generation, scope,
155
161
  // `details.path` (or a path-shaped message) marks a missing PATH; without
156
162
  // it the machine itself was not found, which is not a destination to create.
157
163
  if (refusal?.code === 'not_found' &&
158
- (refusal.details?.path !== undefined || /path|file|folder|directory/i.test(refusal.message))) {
164
+ (refusal.details?.path !== undefined || STAT_DESTINATION_RE.test(refusal.message))) {
159
165
  return { kind: 'absent' };
160
166
  }
161
167
  throw err;
@@ -8,6 +8,7 @@ exports.describeTruncation = describeTruncation;
8
8
  const node_crypto_1 = require("node:crypto");
9
9
  const api_fetch_1 = require("./api-fetch");
10
10
  const dedicated_machines_1 = require("./dedicated-machines");
11
+ const IS_UNANSWERED_REQUEST_RE = /fetch failed|socket hang up|network|terminated|other side closed/i;
11
12
  /**
12
13
  * `skrr machines dedicated exec`, as a start and a series of short observations
13
14
  * (OSK-8705).
@@ -143,7 +144,7 @@ function isUnansweredRequest(err) {
143
144
  if (['ECONNRESET', 'ECONNREFUSED', 'ETIMEDOUT', 'EPIPE', 'ENOTFOUND', 'EAI_AGAIN'].includes(code)) {
144
145
  return true;
145
146
  }
146
- return /fetch failed|socket hang up|network|terminated|other side closed/i.test(e.message || '');
147
+ return IS_UNANSWERED_REQUEST_RE.test(e.message || '');
147
148
  }
148
149
  function backoff(attempt) {
149
150
  return Math.min(1000 * 2 ** Math.max(0, attempt - 1), MAX_BACKOFF_MS);
@@ -10,6 +10,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
10
10
  const api_fetch_1 = require("./api-fetch");
11
11
  const format_1 = require("./format");
12
12
  const dedicated_machines_1 = require("./dedicated-machines");
13
+ const PARSE_KEEP_AWAKE_DURATION_RE = /^(\d+)\s*(m|h|d)?$/i;
13
14
  /**
14
15
  * Domain lib for `skrr machines dedicated power keep-awake` (K1). Keep-awake is a
15
16
  * temporary override that forbids AUTOMATIC stop; it never starts the machine.
@@ -31,7 +32,7 @@ function clearDedicatedKeepAwake(leaseId, scope = {}) {
31
32
  * minutes (the unit the API speaks). Returns minutes, or throws a plain message.
32
33
  */
33
34
  function parseKeepAwakeDuration(value) {
34
- const match = value.trim().match(/^(\d+)\s*(m|h|d)?$/i);
35
+ const match = value.trim().match(PARSE_KEEP_AWAKE_DURATION_RE);
35
36
  if (!match) {
36
37
  throw new Error(`Invalid --for value "${value}". Use a number with m, h or d, such as 90m, 2h or 3d.`);
37
38
  }
@@ -61,6 +61,10 @@ const machine_spend_cap_1 = require("./machine-spend-cap");
61
61
  const web_url_1 = require("./web-url");
62
62
  const edge_error_page_1 = require("./edge-error-page");
63
63
  const harnesses_1 = require("./harnesses");
64
+ const VERSION_PARTS_RE = /^v?(\d+)\.(\d+)\.(\d+)/;
65
+ const IS_DEDICATED_REPOSITORY_REF_RE = /^(?:https?:\/\/)?(?:github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?(?:\.git)?$/i;
66
+ const FORMAT_INVOICE_AMOUNT_RE = /^[A-Z]{3}$/;
67
+ const DEDICATED_DELETION_LINES_RE = /^unless /;
64
68
  exports.DEDICATED_LEASE_ACTIONS = [
65
69
  'start',
66
70
  'stop',
@@ -82,7 +86,7 @@ function describeDedicatedCheckpoint(lease) {
82
86
  return (0, data_provider_1.describeMachineCheckpointOutcome)(operation.checkpoint, { action: operation.action });
83
87
  }
84
88
  function versionParts(version) {
85
- const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(String(version || '').trim());
89
+ const match = VERSION_PARTS_RE.exec(String(version || '').trim());
86
90
  return match ? match.slice(1, 4).map(Number) : null;
87
91
  }
88
92
  /** -1 / 0 / 1, or null when either side is not a version. */
@@ -238,7 +242,7 @@ function dedicatedRuntimeCreateInput(input) {
238
242
  * billable request is sent.
239
243
  */
240
244
  function isDedicatedRepositoryRef(value) {
241
- return /^(?:https?:\/\/)?(?:github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?(?:\.git)?$/i.test(value.trim());
245
+ return IS_DEDICATED_REPOSITORY_REF_RE.test(value.trim());
242
246
  }
243
247
  // Takes the finished path rather than composing one from a suffix, so the route
244
248
  // each call reaches is a literal at the call site. `cli/src/__tests__/helpers/
@@ -910,7 +914,7 @@ const LEGACY_DELETION_REMEDY_TEXT = {
910
914
  /** An invoice's amount in its own currency, from Stripe's minor units. */
911
915
  function formatInvoiceAmount(amountDue, currency) {
912
916
  const code = String(currency || '').toUpperCase();
913
- if (!/^[A-Z]{3}$/.test(code) || !Number.isSafeInteger(amountDue))
917
+ if (!FORMAT_INVOICE_AMOUNT_RE.test(code) || !Number.isSafeInteger(amountDue))
914
918
  return null;
915
919
  try {
916
920
  const format = new Intl.NumberFormat('en-US', { style: 'currency', currency: code });
@@ -1014,7 +1018,7 @@ function dedicatedDeletionLines(lease, now = new Date()) {
1014
1018
  // Until its files are about to be deleted, clearing the cause still stops it.
1015
1019
  remedyApplies = plan.cancellable === true;
1016
1020
  lines.push(remedyApplies
1017
- ? `workspace is being deleted — not too late: it stops, with every file kept, ${remedy.clause.replace(/^unless /, 'if ')}`
1021
+ ? `workspace is being deleted — not too late: it stops, with every file kept, ${remedy.clause.replace(DEDICATED_DELETION_LINES_RE, 'if ')}`
1018
1022
  : 'workspace is being deleted');
1019
1023
  }
1020
1024
  else if (plan.status === 'scheduled') {
@@ -1023,7 +1027,7 @@ function dedicatedDeletionLines(lease, now = new Date()) {
1023
1027
  }
1024
1028
  else {
1025
1029
  remedyApplies = true;
1026
- lines.push(`files kept until at least ${formatDedicatedDeadline(plan.retentionEndsAt, now)}; no deletion date until a deletion notice reaches your email, then at least ${plan.noticeFloorDays || 30} days; no deletion at all ${remedy.clause.replace(/^unless /, 'if ')}`);
1030
+ lines.push(`files kept until at least ${formatDedicatedDeadline(plan.retentionEndsAt, now)}; no deletion date until a deletion notice reaches your email, then at least ${plan.noticeFloorDays || 30} days; no deletion at all ${remedy.clause.replace(DEDICATED_DELETION_LINES_RE, 'if ')}`);
1027
1031
  }
1028
1032
  if (remedyApplies)
1029
1033
  lines.push(...remedy.lines);
@@ -28,6 +28,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
28
28
  const agentic_stream_1 = require("./agentic-stream");
29
29
  const dpop_auth_1 = require("./dpop-auth");
30
30
  const format_1 = require("./format");
31
+ const CALL_EVENT_RE = /^[A-Za-z0-9_.:-]{1,128}$/;
31
32
  /**
32
33
  * Declared services on a Dedicated Runtime — the CLI half of
33
34
  * docs/architecture/dedicated-runtime-always-on-workloads-2026-09-21.md (§5.3
@@ -545,7 +546,7 @@ class DedicatedServiceChannel {
545
546
  // socket response can be inspected or replayed without a second effect.
546
547
  // Other verbs retain their historical per-call id generation.
547
548
  const supplied = payload.requestId;
548
- const requestId = typeof supplied === 'string' && /^[A-Za-z0-9_.:-]{1,128}$/.test(supplied)
549
+ const requestId = typeof supplied === 'string' && CALL_EVENT_RE.test(supplied)
549
550
  ? supplied
550
551
  : `svc-${(0, node_crypto_1.randomUUID)()}`;
551
552
  return new Promise((resolve, reject) => {