@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
@@ -24,6 +24,8 @@ const data_provider_1 = require("@skrr-ai/data-provider");
24
24
  const agentic_stream_1 = require("./agentic-stream");
25
25
  const dpop_auth_1 = require("./dpop-auth");
26
26
  const ssh_ordered_bytes_1 = require("./ssh-ordered-bytes");
27
+ const ENSURE_SSH_IDENTITY_RE = /\s+/;
28
+ const WRITE_KNOWN_HOSTS_RE = /^[A-Za-z0-9+/]+=*$/;
27
29
  /**
28
30
  * Owner SSH to a Dedicated Runtime — SSH protocol over the admitted relay.
29
31
  *
@@ -121,7 +123,7 @@ function ensureSshIdentity(home = (0, node_os_1.homedir)()) {
121
123
  (0, node_fs_1.chmodSync)(publicKeyPath, 0o644);
122
124
  }
123
125
  const line = (0, node_fs_1.readFileSync)(publicKeyPath, 'utf8').trim();
124
- const [keyType, keyBlob] = line.split(/\s+/);
126
+ const [keyType, keyBlob] = line.split(ENSURE_SSH_IDENTITY_RE);
125
127
  if (!keyType || !keyBlob) {
126
128
  throw new DedicatedSshError(`could not read ${publicKeyPath}`, 'SSH_KEY_UNREADABLE');
127
129
  }
@@ -141,7 +143,7 @@ function writeKnownHosts(host, hostKeys, home = (0, node_os_1.homedir)()) {
141
143
  (0, node_fs_1.mkdirSync)(dir, { recursive: true, mode: 0o700 });
142
144
  (0, node_fs_1.chmodSync)(dir, 0o700);
143
145
  const lines = hostKeys
144
- .filter((k) => k && HOSTKEY_TYPES.has(k.type) && /^[A-Za-z0-9+/]+=*$/.test(k.key))
146
+ .filter((k) => k && HOSTKEY_TYPES.has(k.type) && WRITE_KNOWN_HOSTS_RE.test(k.key))
145
147
  .map((k) => `${host} ${k.type} ${k.key}`);
146
148
  if (lines.length === 0)
147
149
  return false;
@@ -155,7 +157,7 @@ function writeKnownHosts(host, hostKeys, home = (0, node_os_1.homedir)()) {
155
157
  catch {
156
158
  /* first connect */
157
159
  }
158
- const kept = existing.filter((l) => l.split(/\s+/)[0] !== host);
160
+ const kept = existing.filter((l) => l.split(ENSURE_SSH_IDENTITY_RE)[0] !== host);
159
161
  const tmp = `${target}.${process.pid}.${(0, node_crypto_1.randomUUID)()}.tmp`;
160
162
  (0, node_fs_1.writeFileSync)(tmp, `${[...kept, ...lines].join('\n')}\n`, { mode: 0o600 });
161
163
  (0, node_fs_1.renameSync)(tmp, target);
@@ -21,6 +21,7 @@
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.readDeployedBuild = readDeployedBuild;
23
23
  exports.deployedBuildLines = deployedBuildLines;
24
+ const READ_DEPLOYED_BUILD_RE = /\/+$/;
24
25
  const COMMIT = /^[a-f0-9]{40}$/;
25
26
  const TIMEOUT_MS = 5_000;
26
27
  async function readCommit(url, pick, unstamped, fetchImpl) {
@@ -46,7 +47,7 @@ async function readCommit(url, pick, unstamped, fetchImpl) {
46
47
  }
47
48
  }
48
49
  async function readDeployedBuild(baseURL, fetchImpl = fetch) {
49
- const origin = baseURL.replace(/\/+$/, '');
50
+ const origin = baseURL.replace(READ_DEPLOYED_BUILD_RE, '');
50
51
  const [api, web] = await Promise.all([
51
52
  readCommit(`${origin}/api/health`, (body) => body?.build?.commit, 'the server does not report the commit its API was built from', fetchImpl),
52
53
  readCommit(`${origin}/web-version.json`, (body) => body?.sha, 'the published web shell carries no commit', fetchImpl),
@@ -25,6 +25,7 @@ exports.DeviceCodeLoginCancelledError = void 0;
25
25
  exports.startDeviceCode = startDeviceCode;
26
26
  exports.pollDeviceCode = pollDeviceCode;
27
27
  exports.revokeDeviceRefreshToken = revokeDeviceRefreshToken;
28
+ const START_DEVICE_CODE_RE = /\/$/;
28
29
  const DEFAULT_POLL_INTERVAL_MS = 2_000;
29
30
  /** Server-side TTL is 300s; we add a small safety margin for clock drift. */
30
31
  const DEFAULT_OVERALL_TIMEOUT_MS = 320_000;
@@ -49,7 +50,7 @@ exports.DeviceCodeLoginCancelledError = DeviceCodeLoginCancelledError;
49
50
  * default to `'daemon'`, which still works for the CLI's REST surface.
50
51
  */
51
52
  async function startDeviceCode(baseURL, daemonId) {
52
- const res = await fetch(`${baseURL.replace(/\/$/, '')}/api/daemons/device-code`, {
53
+ const res = await fetch(`${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/device-code`, {
53
54
  method: 'POST',
54
55
  headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
55
56
  body: JSON.stringify({ daemonId, source: 'cli' }),
@@ -88,7 +89,7 @@ async function pollDeviceCode(baseURL, code, opts = {}) {
88
89
  }
89
90
  let res;
90
91
  try {
91
- res = await fetch(`${baseURL.replace(/\/$/, '')}/api/daemons/device-code/${encodeURIComponent(code)}/status`, { method: 'GET', headers: { Accept: 'application/json' }, ...(signal ? { signal } : {}) });
92
+ res = await fetch(`${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/device-code/${encodeURIComponent(code)}/status`, { method: 'GET', headers: { Accept: 'application/json' }, ...(signal ? { signal } : {}) });
92
93
  }
93
94
  catch {
94
95
  if (signal?.aborted)
@@ -137,7 +138,7 @@ async function pollDeviceCode(baseURL, code, opts = {}) {
137
138
  async function revokeDeviceRefreshToken(baseURL, refreshToken) {
138
139
  if (!refreshToken)
139
140
  return;
140
- const url = `${baseURL.replace(/\/$/, '')}/api/daemons/token/revoke`;
141
+ const url = `${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/token/revoke`;
141
142
  const controller = new AbortController();
142
143
  const timer = setTimeout(() => controller.abort(), 5_000);
143
144
  try {
@@ -18,6 +18,7 @@ exports.dpopHeadersFor = dpopHeadersFor;
18
18
  exports.socketHandshakeHtu = socketHandshakeHtu;
19
19
  exports.socketAuthWithDpop = socketAuthWithDpop;
20
20
  const brokered_dpop_1 = require("./brokered-dpop");
21
+ const SOCKET_HANDSHAKE_HTU_RE = /\/+$/;
21
22
  /** RFC 9449 §4.1. */
22
23
  exports.DPOP_HEADER = 'DPoP';
23
24
  /** Headers to add to one HTTP request made with `token`; `{}` when unbound. */
@@ -35,7 +36,7 @@ async function dpopHeadersFor(token, method, url) {
35
36
  function socketHandshakeHtu(wsOrigin, ioPath = '/ws/agentic') {
36
37
  const u = new URL(wsOrigin);
37
38
  u.protocol = u.protocol === 'wss:' ? 'https:' : u.protocol === 'ws:' ? 'http:' : u.protocol;
38
- u.pathname = ioPath.replace(/\/+$/, '');
39
+ u.pathname = ioPath.replace(SOCKET_HANDSHAKE_HTU_RE, '');
39
40
  u.search = '';
40
41
  u.hash = '';
41
42
  return u.toString();
@@ -7,6 +7,7 @@ exports.renderStatement = renderStatement;
7
7
  exports.renderPayoutHistory = renderPayoutHistory;
8
8
  const data_provider_1 = require("@skrr-ai/data-provider");
9
9
  const format_1 = require("./format");
10
+ const DOLLARS_RE = /^\$/;
10
11
  /**
11
12
  * earnings.ts — the read-only publisher payout surface (OSK-12272).
12
13
  *
@@ -34,7 +35,7 @@ exports.PERIOD_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
34
35
  function dollars(usd) {
35
36
  if (usd == null || usd === '')
36
37
  return '-';
37
- const trimmed = String(usd).replace(/^\$/, '');
38
+ const trimmed = String(usd).replace(DOLLARS_RE, '');
38
39
  return trimmed.startsWith('-') ? `-$${trimmed.slice(1)}` : `$${trimmed}`;
39
40
  }
40
41
  function day(value) {
@@ -33,6 +33,8 @@ exports.runtimeBinarySupportsSubcommand = runtimeBinarySupportsSubcommand;
33
33
  const node_child_process_1 = require("node:child_process");
34
34
  const node_fs_1 = require("node:fs");
35
35
  const node_path_1 = __importDefault(require("node:path"));
36
+ const EXEC_RUNTIME_BINARY_RE = /\.(cmd|bat)$/i;
37
+ const RUNTIME_BINARY_SUPPORTS_SUBCOMMAND_RE = /[.*+?^${}()|[\]\\]/g;
36
38
  /** Runtime binary names, current first. */
37
39
  exports.RUNTIME_BINARY_NAMES = ['skrrd', 'oversky'];
38
40
  /**
@@ -240,7 +242,7 @@ function execRuntimeBinary(args, opts = {}) {
240
242
  // binaries keep the safer argv-array exec path. Node 20.12+ (required
241
243
  // by package.json engines `>=20.0.0` — pin at install time) quotes
242
244
  // args when shell:true on Windows per CVE-2024-27980's fix.
243
- const isWinShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(bin);
245
+ const isWinShim = process.platform === 'win32' && EXEC_RUNTIME_BINARY_RE.test(bin);
244
246
  const child = (0, node_child_process_1.spawn)(bin, normalizeRuntimeGlobalArgs(args), {
245
247
  stdio: 'inherit',
246
248
  env: runtimeEnv(),
@@ -272,7 +274,7 @@ function execRuntimeBinaryCapture(args, opts = {}) {
272
274
  reject(new Error('runtime-binary-not-installed'));
273
275
  return;
274
276
  }
275
- const isWinShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(bin);
277
+ const isWinShim = process.platform === 'win32' && EXEC_RUNTIME_BINARY_RE.test(bin);
276
278
  const child = (0, node_child_process_1.spawn)(bin, normalizeRuntimeGlobalArgs(args), {
277
279
  stdio: ['ignore', 'pipe', 'pipe'],
278
280
  env: runtimeEnv(),
@@ -353,7 +355,7 @@ function runtimeBinarySupportsSubcommand(subcommand) {
353
355
  child.on('exit', (code) => {
354
356
  if (code !== 0)
355
357
  return settle(null);
356
- const escaped = subcommand.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
358
+ const escaped = subcommand.replace(RUNTIME_BINARY_SUPPORTS_SUBCOMMAND_RE, '\\$&');
357
359
  settle(new RegExp(`^\\s*${escaped}(?:\\s|$)`, 'm').test(output));
358
360
  });
359
361
  });
@@ -86,6 +86,7 @@ const first_party_harness_1 = require("./first-party-harness");
86
86
  const first_party_harness_agent_1 = require("./first-party-harness-agent");
87
87
  const first_party_harness_managed_1 = require("./first-party-harness-managed");
88
88
  const task_execution_1 = require("./task-execution");
89
+ const RELEASE_LEASE_RE = /\/+$/;
89
90
  /**
90
91
  * Harness selections the POLICY resolves, mirroring the server's own set.
91
92
  *
@@ -548,7 +549,7 @@ async function acquireManagedSession(input = {}, deps = {}) {
548
549
  * than a lease the server's reaper collects a couple of minutes later.
549
550
  */
550
551
  async function releaseLease(input, fetchImpl, log) {
551
- const url = `${input.serverUrl.replace(/\/+$/, '')}` +
552
+ const url = `${input.serverUrl.replace(RELEASE_LEASE_RE, '')}` +
552
553
  `/api/agentic/sessions/${encodeURIComponent(input.sessionId)}/inference/release`;
553
554
  const controller = new AbortController();
554
555
  const timeout = setTimeout(() => controller.abort(), RELEASE_TIMEOUT_MS);
@@ -643,7 +644,7 @@ async function mintSessionToken(input, api, signal) {
643
644
  * alive.
644
645
  */
645
646
  async function refreshSessionCapability(input, fetchImpl) {
646
- const url = `${input.serverUrl.replace(/\/+$/, '')}` +
647
+ const url = `${input.serverUrl.replace(RELEASE_LEASE_RE, '')}` +
647
648
  `/api/agentic/sessions/${encodeURIComponent(input.sessionId)}/session-token/renew`;
648
649
  const controller = new AbortController();
649
650
  const timeout = setTimeout(() => controller.abort(), CAPABILITY_REFRESH_TIMEOUT_MS);
@@ -802,7 +803,7 @@ async function admitLease(input, fetchImpl,
802
803
  // path is one line away, and the user was promised one number for the whole
803
804
  // handshake rather than one per hop.
804
805
  signal) {
805
- const url = `${input.serverUrl.replace(/\/+$/, '')}` +
806
+ const url = `${input.serverUrl.replace(RELEASE_LEASE_RE, '')}` +
806
807
  `/api/agentic/sessions/${encodeURIComponent(input.sessionId)}/inference/admit`;
807
808
  let response;
808
809
  try {
@@ -48,6 +48,7 @@ const node_fs_1 = require("node:fs");
48
48
  const auth_core_1 = require("@skrr-ai/auth-core");
49
49
  const config_1 = require("./config");
50
50
  const runtime_context_1 = require("./runtime-context");
51
+ const CAMEL_CASE_SLUG_RE = /-([a-z0-9])/g;
51
52
  /** The neutral operator switch for CLI-hosted managed inference. */
52
53
  exports.MANAGED_ENV_FLAG = auth_core_1.FIRST_PARTY_HARNESS_ENV.managed.name;
53
54
  /**
@@ -88,7 +89,7 @@ exports.AGENT_FLAG_SPELLINGS = [exports.SKRR_AGENT_FLAG, exports.OVERSKY_AGENT_F
88
89
  exports.AGENT_CONFIG_KEY = 'firstPartyHarnessAgentId';
89
90
  /** `a-b` → `aB`: how a hyphenated spelling became part of a config key. */
90
91
  function camelCaseSlug(slug) {
91
- return slug.replace(/-([a-z0-9])/g, (_, next) => next.toUpperCase());
92
+ return slug.replace(CAMEL_CASE_SLUG_RE, (_, next) => next.toUpperCase());
92
93
  }
93
94
  // TODO(identity): move to auth-core — the identity module derives on-disk binary
94
95
  // names from its artifact spellings; it has no notion of a legacy CONFIG key yet.
@@ -12,6 +12,10 @@ const node_path_1 = __importDefault(require("node:path"));
12
12
  const node_readline_1 = __importDefault(require("node:readline"));
13
13
  const auth_core_1 = require("@skrr-ai/auth-core");
14
14
  const first_party_harness_update_1 = require("./first-party-harness-update");
15
+ const DISABLED_RE = /^(0|false|off|no|disabled)$/i;
16
+ const ENABLED_RE = /^(1|true|on|yes)$/i;
17
+ const SHOULD_CHECK_CODE_AT_STARTUP_RE = /^(--help|-h|--version|-v|--json|--print|-p|--no-tui|--output|--format)(=|$)/;
18
+ const SHOULD_CHECK_CODE_AT_STARTUP_RE_2 = /^(run|acp|serve|web|auth|upgrade|update|doctor|install|rollback|export|import|session|models)$/;
15
19
  function preferencesPath(env) {
16
20
  return node_path_1.default.join((0, auth_core_1.resolveConfigRoot)(env), 'code-update-preferences.json');
17
21
  }
@@ -71,8 +75,8 @@ function configureCodeStartupChecks(enabled, env = process.env) {
71
75
  (0, node_fs_1.renameSync)(staging, file);
72
76
  return { enabled, preferencesPath: file };
73
77
  }
74
- const disabled = (value) => /^(0|false|off|no|disabled)$/i.test(value ?? '');
75
- const enabled = (value) => /^(1|true|on|yes)$/i.test(value ?? '');
78
+ const disabled = (value) => DISABLED_RE.test(value ?? '');
79
+ const enabled = (value) => ENABLED_RE.test(value ?? '');
76
80
  function shouldCheckCodeAtStartup(input) {
77
81
  const env = input.env ?? process.env;
78
82
  if (!(input.stdinTTY ?? process.stdin.isTTY) ||
@@ -87,9 +91,9 @@ function shouldCheckCodeAtStartup(input) {
87
91
  return false;
88
92
  if ((0, first_party_harness_update_1.localCodeUpdateOwner)(env) !== 'managed' || readPreferences(env).promptOnStartup === false)
89
93
  return false;
90
- if (input.argv.some((arg) => /^(--help|-h|--version|-v|--json|--print|-p|--no-tui|--output|--format)(=|$)/.test(arg)))
94
+ if (input.argv.some((arg) => SHOULD_CHECK_CODE_AT_STARTUP_RE.test(arg)))
91
95
  return false;
92
- if (/^(run|acp|serve|web|auth|upgrade|update|doctor|install|rollback|export|import|session|models)$/.test(input.argv[0] ?? ''))
96
+ if (SHOULD_CHECK_CODE_AT_STARTUP_RE_2.test(input.argv[0] ?? ''))
93
97
  return false;
94
98
  return true;
95
99
  }
@@ -17,6 +17,7 @@ const node_path_1 = __importDefault(require("node:path"));
17
17
  const auth_core_1 = require("@skrr-ai/auth-core");
18
18
  const first_party_harness_updater_1 = require("@skrr-ai/auth-core/first-party-harness-updater");
19
19
  const first_party_harness_1 = require("./first-party-harness");
20
+ const LOCAL_CODE_UPDATE_OWNER_RE = /\.app[/\\]/i;
20
21
  function localCodeUpdateOwner(env = process.env) {
21
22
  if ((0, first_party_harness_1.isDedicatedRuntimeWorkload)(env) ||
22
23
  ['dedicated-runtime', 'hosted-machine', 'cloud-coding'].includes(env.OVERSKY_DAEMON_SOURCE ?? '') ||
@@ -34,7 +35,7 @@ function localCodeUpdateOwner(env = process.env) {
34
35
  /* Resolution reports a disappearing binary separately. */
35
36
  }
36
37
  if (env.SKRR_FIRST_PARTY_HARNESS_OWNER === 'desktop' ||
37
- (activePath && /\.app[/\\]/i.test(activePath)))
38
+ (activePath && LOCAL_CODE_UPDATE_OWNER_RE.test(activePath)))
38
39
  return 'desktop';
39
40
  return ['managed', 'legacy-managed', 'unresolved'].includes(resolution.source) &&
40
41
  !resolution.envName
@@ -51,6 +51,7 @@ const node_path_1 = __importDefault(require("node:path"));
51
51
  const auth_core_1 = require("@skrr-ai/auth-core");
52
52
  const inference_broker_1 = require("@skrr-ai/inference-broker");
53
53
  const config_1 = require("./config");
54
+ const SPAWN_ENGINE_RE = /\.(cmd|bat)$/i;
54
55
  // Deliberately does NOT import the managed marker any more. This module used to
55
56
  // read it to decide whether a run was managed; that decision now arrives as a
56
57
  // declared `credentialMode`, and re-introducing the import here would be the first
@@ -689,7 +690,7 @@ function spawnEngine(bin, args, env, extraEnv, mode,
689
690
  // every path — including one where this promise rejects.
690
691
  outcome, policyEnv) {
691
692
  return new Promise((resolve, reject) => {
692
- const isWinShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(bin);
693
+ const isWinShim = process.platform === 'win32' && SPAWN_ENGINE_RE.test(bin);
693
694
  const child = (0, node_child_process_1.spawn)(bin, args, {
694
695
  stdio: 'inherit',
695
696
  env: engineSpawnEnv(env, extraEnv, mode, policyEnv),
@@ -169,3 +169,8 @@ export type WhenOptions = {
169
169
  * the raw ISO string; this is for text only. Unparseable input is returned as is.
170
170
  */
171
171
  export declare function formatWhen(value: unknown, options?: WhenOptions): string;
172
+ /**
173
+ * A span of seconds as people say it: "45s", "7m 36s", "1h 5m". Used for how far past its time a
174
+ * one-shot is, where a bare second count (456) hides that it is minutes.
175
+ */
176
+ export declare function formatElapsed(seconds: number): string;
@@ -15,6 +15,11 @@ exports.zoneAbbreviation = zoneAbbreviation;
15
15
  exports.zonedTime = zonedTime;
16
16
  exports.localizeIsoInstants = localizeIsoInstants;
17
17
  exports.formatWhen = formatWhen;
18
+ exports.formatElapsed = formatElapsed;
19
+ const TRIM_RE = /[\s,;:(\-—]+$/u;
20
+ const TRUNCATE_AT_WORD_RE = /^\s/u;
21
+ const TRUNCATE_AT_WORD_RE_2 = /\s\S*$/u;
22
+ const COLLAPSE_WHITESPACE_RE = /\s+/g;
18
23
  /**
19
24
  * Code points that occupy TWO terminal columns (Unicode East Asian Wide and
20
25
  * Fullwidth), plus the emoji blocks terminals render double-width.
@@ -168,11 +173,11 @@ function truncateAtWord(s, max) {
168
173
  const hard = truncate(s, max);
169
174
  const kept = hard.slice(0, -1); // the longest prefix that leaves room for the ellipsis
170
175
  const rest = s.slice(kept.length);
171
- const trim = (value) => value.replace(/[\s,;:(\-—]+$/u, '');
176
+ const trim = (value) => value.replace(TRIM_RE, '');
172
177
  // The cut already fell on a word boundary.
173
- if (/^\s/u.test(rest))
178
+ if (TRUNCATE_AT_WORD_RE.test(rest))
174
179
  return `${trim(kept)}…`;
175
- const boundary = kept.search(/\s\S*$/u);
180
+ const boundary = kept.search(TRUNCATE_AT_WORD_RE_2);
176
181
  if (boundary > 0 && displayWidth(kept.slice(0, boundary)) >= max * 0.4) {
177
182
  return `${trim(kept.slice(0, boundary))}…`;
178
183
  }
@@ -224,7 +229,7 @@ function stringifyCell(value, depth) {
224
229
  * that happened to come through `formatCell`.
225
230
  */
226
231
  function collapseWhitespace(value) {
227
- return value.replace(/\s+/g, ' ').trim();
232
+ return value.replace(COLLAPSE_WHITESPACE_RE, ' ').trim();
228
233
  }
229
234
  function renderTable(rows, columns, log) {
230
235
  if (rows.length === 0)
@@ -474,3 +479,18 @@ function formatWhen(value, options = {}) {
474
479
  const relative = span === 'under a minute' ? 'just now' : delta >= 0 ? `in ${span}` : `${span} ago`;
475
480
  return `${stamp} (${relative})`;
476
481
  }
482
+ /**
483
+ * A span of seconds as people say it: "45s", "7m 36s", "1h 5m". Used for how far past its time a
484
+ * one-shot is, where a bare second count (456) hides that it is minutes.
485
+ */
486
+ function formatElapsed(seconds) {
487
+ const total = Math.max(0, Math.floor(seconds));
488
+ const h = Math.floor(total / 3600);
489
+ const m = Math.floor((total % 3600) / 60);
490
+ const sec = total % 60;
491
+ if (h > 0)
492
+ return m > 0 ? `${h}h ${m}m` : `${h}h`;
493
+ if (m > 0)
494
+ return sec > 0 ? `${m}m ${sec}s` : `${m}m`;
495
+ return `${sec}s`;
496
+ }
@@ -41,6 +41,10 @@ exports.currentGitTaskBranch = currentGitTaskBranch;
41
41
  exports.checkoutTaskBranch = checkoutTaskBranch;
42
42
  const node_child_process_1 = require("node:child_process");
43
43
  const taskReferences = __importStar(require("@skrr-ai/data-provider"));
44
+ const SAFE_TASK_BRANCH_REF_RE = /[A-Za-z][A-Za-z0-9]{1,31}-\d{1,12}/;
45
+ const RESOLVE_REMOTE_DEFAULT_RE = /^ref:\s+refs\/heads\/(\S+)\s+HEAD$/m;
46
+ const INSPECT_TASK_DELIVERY_ARTIFACTS_RE = /^[0-9a-f]{40}$/i;
47
+ const INSPECT_TASK_DELIVERY_ARTIFACTS_RE_2 = /^[0-9a-f]{7,40}$/i;
44
48
  const COMMIT_ARTIFACT_RE = /(?:^|[\s,;:(/])(?:commit\s+)?([0-9a-f]{7,40})(?=$|[\s,;:)?#])/gi;
45
49
  const GITHUB_PR_ARTIFACT_RE = /https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/\d+/i;
46
50
  function runCommand(command, args, cwd) {
@@ -66,14 +70,14 @@ function commitArtifacts(deliverables) {
66
70
  return commits;
67
71
  }
68
72
  function safeTaskBranchRef(taskRef, sha) {
69
- const match = taskRef.match(/[A-Za-z][A-Za-z0-9]{1,31}-\d{1,12}/);
73
+ const match = taskRef.match(SAFE_TASK_BRANCH_REF_RE);
70
74
  const label = match?.[0].toUpperCase() || 'recovery';
71
75
  return `oversky/task/${label}/recovery-${sha.slice(0, 12)}`;
72
76
  }
73
77
  function resolveRemoteDefault(cwd, remote, runner) {
74
78
  const live = runner('git', ['ls-remote', '--symref', remote, 'HEAD'], cwd);
75
79
  if (live.status === 0) {
76
- const match = live.stdout.match(/^ref:\s+refs\/heads\/(\S+)\s+HEAD$/m);
80
+ const match = live.stdout.match(RESOLVE_REMOTE_DEFAULT_RE);
77
81
  if (match)
78
82
  return match[1];
79
83
  }
@@ -103,7 +107,7 @@ function inspectTaskDeliveryArtifacts(opts) {
103
107
  let containingBranch;
104
108
  for (const claimed of commits) {
105
109
  const resolved = runner('git', ['rev-parse', '--verify', `${claimed}^{commit}`], cwd);
106
- if (resolved.status !== 0 || !/^[0-9a-f]{40}$/i.test(resolved.stdout))
110
+ if (resolved.status !== 0 || !INSPECT_TASK_DELIVERY_ARTIFACTS_RE.test(resolved.stdout))
107
111
  continue;
108
112
  const sha = resolved.stdout.toLowerCase();
109
113
  verifiedCommits.push(sha);
@@ -148,9 +152,10 @@ function inspectTaskDeliveryArtifacts(opts) {
148
152
  state: pr.mergedAt ? 'integrated' : 'pr_open',
149
153
  prUrl,
150
154
  ...(typeof pr.headRefName === 'string' ? { branch: pr.headRefName } : {}),
151
- ...(headSha && /^[0-9a-f]{7,40}$/i.test(headSha) ? { headSha } : {}),
155
+ ...(headSha && INSPECT_TASK_DELIVERY_ARTIFACTS_RE_2.test(headSha) ? { headSha } : {}),
152
156
  ...(typeof pr.baseRefName === 'string' ? { integrationBranch: pr.baseRefName } : {}),
153
- ...(typeof mergeCommit === 'string' && /^[0-9a-f]{7,40}$/i.test(mergeCommit)
157
+ ...(typeof mergeCommit === 'string' &&
158
+ INSPECT_TASK_DELIVERY_ARTIFACTS_RE_2.test(mergeCommit)
154
159
  ? { mergeCommit }
155
160
  : {}),
156
161
  };
@@ -10,6 +10,9 @@ exports.isGitHubTool = isGitHubTool;
10
10
  exports.filterGitHubTools = filterGitHubTools;
11
11
  exports.isGitHubConnection = isGitHubConnection;
12
12
  exports.filterGitHubConnections = filterGitHubConnections;
13
+ const NORMALIZE_GIT_HUB_TOOL_SLUG_RE = /^github[._:-]+/i;
14
+ const NORMALIZE_GIT_HUB_TOOL_SLUG_RE_2 = /[\s.:-]+/g;
15
+ const IS_GIT_HUB_TOOL_RE = /^GITHUB(_|$)/i;
13
16
  exports.GITHUB_TOOLKIT = 'github';
14
17
  exports.DEFAULT_INTEGRATION_PROVIDER = 'composio';
15
18
  const FATAL_POLL_STATUSES = new Set([401, 403, 503]);
@@ -23,8 +26,8 @@ function normalizeGitHubToolSlug(value) {
23
26
  if (!raw) {
24
27
  throw new Error('GitHub tool slug is required.');
25
28
  }
26
- const withoutPrefix = raw.replace(/^github[._:-]+/i, '');
27
- const normalized = withoutPrefix.replace(/[\s.:-]+/g, '_').toUpperCase();
29
+ const withoutPrefix = raw.replace(NORMALIZE_GIT_HUB_TOOL_SLUG_RE, '');
30
+ const normalized = withoutPrefix.replace(NORMALIZE_GIT_HUB_TOOL_SLUG_RE_2, '_').toUpperCase();
28
31
  return normalized.startsWith('GITHUB_') ? normalized : `GITHUB_${normalized}`;
29
32
  }
30
33
  function normalizeGitHubToolList(value) {
@@ -55,7 +58,7 @@ function assertTrustedIntegrationRedirectUrl(redirectUrl) {
55
58
  }
56
59
  }
57
60
  function isGitHubTool(tool) {
58
- return /^GITHUB(_|$)/i.test(tool.name || '');
61
+ return IS_GIT_HUB_TOOL_RE.test(tool.name || '');
59
62
  }
60
63
  function filterGitHubTools(tools) {
61
64
  return tools.filter(isGitHubTool);
@@ -28,6 +28,8 @@ exports.performHarnessLeaseAction = performHarnessLeaseAction;
28
28
  exports.setHarnessLeaseBilling = setHarnessLeaseBilling;
29
29
  const data_provider_1 = require("@skrr-ai/data-provider");
30
30
  const api_fetch_1 = require("./api-fetch");
31
+ const DESCRIBE_HEALTH_REASON_SENTENCES_RE = /\.$/;
32
+ const PARSE_HARNESS_PRUNE_AGE_RE = /^(\d+)\s*(m|h|d)?$/i;
31
33
  /**
32
34
  * A machine's health reason codes as the sentences a person reads, from the
33
35
  * copy map the web renders too (`describeMachineHealthReasons`,
@@ -47,7 +49,7 @@ function describeHealthReasonSentences(reasons, state) {
47
49
  return lines
48
50
  .map((line) => line.known || line.codes.length === 0
49
51
  ? line.sentence
50
- : `${line.sentence.replace(/\.$/, '')} (${line.codes.join(', ')}).`)
52
+ : `${line.sentence.replace(DESCRIBE_HEALTH_REASON_SENTENCES_RE, '')} (${line.codes.join(', ')}).`)
51
53
  .join(' ');
52
54
  }
53
55
  /**
@@ -202,7 +204,7 @@ async function pruneHarnesses(options = { dryRun: true }) {
202
204
  * window whatever this says.
203
205
  */
204
206
  function parseHarnessPruneAge(value) {
205
- const match = value.trim().match(/^(\d+)\s*(m|h|d)?$/i);
207
+ const match = value.trim().match(PARSE_HARNESS_PRUNE_AGE_RE);
206
208
  if (!match) {
207
209
  throw new Error(`Invalid --older-than value "${value}". Use a number with m, h or d, such as 90m, 36h or 7d.`);
208
210
  }
@@ -29,6 +29,7 @@ exports.offlineForLabel = offlineForLabel;
29
29
  const api_fetch_1 = require("./api-fetch");
30
30
  const edge_error_page_1 = require("./edge-error-page");
31
31
  const machine_spend_cap_1 = require("./machine-spend-cap");
32
+ const PARSE_DURATION_MS_RE = /^(\d+)(ms|s|m|h)?$/i;
32
33
  function curateHostedMachineList(response) {
33
34
  return {
34
35
  object: 'list',
@@ -146,7 +147,7 @@ function isHostedMachineTerminal(session) {
146
147
  function parseDurationMs(value, flagName) {
147
148
  if (!value)
148
149
  return undefined;
149
- const match = value.trim().match(/^(\d+)(ms|s|m|h)?$/i);
150
+ const match = value.trim().match(PARSE_DURATION_MS_RE);
150
151
  if (!match)
151
152
  throw new Error(`Invalid ${flagName} value: ${value}`);
152
153
  const amount = Number(match[1]);
@@ -15,9 +15,25 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.htmlToDisplayText = htmlToDisplayText;
18
+ const LOOKS_LIKE_HTML_RE = /<\/?[a-z][^>]*>/i;
19
+ const HTML_TO_DISPLAY_TEXT_RE = /<video\b([^>]*)>([\s\S]*?)<\/video\s*>|<video\b([^>]*)\/?>/gi;
20
+ const HTML_TO_DISPLAY_TEXT_RE_2 = /<source\b[^>]*>/i;
21
+ const HTML_TO_DISPLAY_TEXT_RE_3 = /<img\b[^>]*>/gi;
22
+ const HTML_TO_DISPLAY_TEXT_RE_4 = /<br\s*\/?>/gi;
23
+ const HTML_TO_DISPLAY_TEXT_RE_5 = /<\/(p|div|li|h[1-6])>/gi;
24
+ const HTML_TO_DISPLAY_TEXT_RE_6 = /<li[^>]*>/gi;
25
+ const HTML_TO_DISPLAY_TEXT_RE_7 = /<[^>]+>/g;
26
+ const HTML_TO_DISPLAY_TEXT_RE_8 = /&nbsp;/g;
27
+ const HTML_TO_DISPLAY_TEXT_RE_9 = /&#39;/g;
28
+ const HTML_TO_DISPLAY_TEXT_RE_10 = /&quot;/g;
29
+ const HTML_TO_DISPLAY_TEXT_RE_11 = /&lt;/g;
30
+ const HTML_TO_DISPLAY_TEXT_RE_12 = /&gt;/g;
31
+ const HTML_TO_DISPLAY_TEXT_RE_13 = /&amp;/g;
32
+ const HTML_TO_DISPLAY_TEXT_RE_14 = /[ \t]+/g;
33
+ const HTML_TO_DISPLAY_TEXT_RE_15 = /\n{3,}/g;
18
34
  /** Cheap, deliberate: a tag-shaped substring is the only trigger. */
19
35
  function looksLikeHtml(value) {
20
- return /<\/?[a-z][^>]*>/i.test(value);
36
+ return LOOKS_LIKE_HTML_RE.test(value);
21
37
  }
22
38
  /** Pull one attribute out of a tag body — `src="…"`, `src='…'`, `src=…`. */
23
39
  function tagAttr(tag, name) {
@@ -34,32 +50,33 @@ function htmlToDisplayText(value) {
34
50
  // it becomes a labelled link to the stable reference. The element's
35
51
  // children — `<source>` and fallback text — go with it; a `<source>` src
36
52
  // is used when the element itself carries none (OSK-10129).
37
- .replace(/<video\b([^>]*)>([\s\S]*?)<\/video\s*>|<video\b([^>]*)\/?>/gi, (_m, open, inner, bare) => {
53
+ .replace(HTML_TO_DISPLAY_TEXT_RE, (_m, open, inner, bare) => {
38
54
  const tag = String(open ?? bare ?? '');
39
- const src = tagAttr(tag, 'src') || tagAttr(/<source\b[^>]*>/i.exec(inner ?? '')?.[0] ?? '', 'src');
55
+ const src = tagAttr(tag, 'src') ||
56
+ tagAttr(HTML_TO_DISPLAY_TEXT_RE_2.exec(inner ?? '')?.[0] ?? '', 'src');
40
57
  const title = tagAttr(tag, 'title');
41
58
  return src ? `[video: ${title || 'recording'}](${src})\n` : '';
42
59
  })
43
60
  // An <img> carries meaning — the asset reference or URL — that the
44
61
  // generic tag strip below would erase entirely. Keep it as a markdown
45
62
  // image so `task-asset:<id>` refs stay legible in a terminal (OSK-9856).
46
- .replace(/<img\b[^>]*>/gi, (tag) => {
63
+ .replace(HTML_TO_DISPLAY_TEXT_RE_3, (tag) => {
47
64
  const src = tagAttr(tag, 'src');
48
65
  const alt = tagAttr(tag, 'alt');
49
66
  return src ? `![${alt || 'image'}](${src})` : '';
50
67
  })
51
- .replace(/<br\s*\/?>/gi, '\n')
52
- .replace(/<\/(p|div|li|h[1-6])>/gi, '\n')
53
- .replace(/<li[^>]*>/gi, ' - ')
54
- .replace(/<[^>]+>/g, '')
55
- .replace(/&nbsp;/g, ' ')
56
- .replace(/&#39;/g, "'")
57
- .replace(/&quot;/g, '"')
58
- .replace(/&lt;/g, '<')
59
- .replace(/&gt;/g, '>')
68
+ .replace(HTML_TO_DISPLAY_TEXT_RE_4, '\n')
69
+ .replace(HTML_TO_DISPLAY_TEXT_RE_5, '\n')
70
+ .replace(HTML_TO_DISPLAY_TEXT_RE_6, ' - ')
71
+ .replace(HTML_TO_DISPLAY_TEXT_RE_7, '')
72
+ .replace(HTML_TO_DISPLAY_TEXT_RE_8, ' ')
73
+ .replace(HTML_TO_DISPLAY_TEXT_RE_9, "'")
74
+ .replace(HTML_TO_DISPLAY_TEXT_RE_10, '"')
75
+ .replace(HTML_TO_DISPLAY_TEXT_RE_11, '<')
76
+ .replace(HTML_TO_DISPLAY_TEXT_RE_12, '>')
60
77
  // `&amp;` LAST, or `&amp;lt;` would decode twice into a bare `<`.
61
- .replace(/&amp;/g, '&')
62
- .replace(/[ \t]+/g, ' ')
63
- .replace(/\n{3,}/g, '\n\n')
78
+ .replace(HTML_TO_DISPLAY_TEXT_RE_13, '&')
79
+ .replace(HTML_TO_DISPLAY_TEXT_RE_14, ' ')
80
+ .replace(HTML_TO_DISPLAY_TEXT_RE_15, '\n\n')
64
81
  .trim());
65
82
  }
@@ -12,6 +12,7 @@ exports.moveEntry = moveEntry;
12
12
  exports.findBlock = findBlock;
13
13
  exports.renderInstructionBlockDetail = renderInstructionBlockDetail;
14
14
  const node_crypto_1 = require("node:crypto");
15
+ const PARSE_BINDINGS_RE = /^[a-z][a-z0-9_]{0,63}$/;
15
16
  /**
16
17
  * Helpers shared by the reusable Block Library commands and the per-Agent
17
18
  * composition commands. Keep this deliberately about data shape, not HTTP:
@@ -48,7 +49,7 @@ function parseBindings(values) {
48
49
  throw new Error(`Invalid binding "${value}". Use --binding key=value.`);
49
50
  }
50
51
  const key = value.slice(0, separator).trim();
51
- if (!/^[a-z][a-z0-9_]{0,63}$/.test(key)) {
52
+ if (!PARSE_BINDINGS_RE.test(key)) {
52
53
  throw new Error(`Invalid binding key "${key}".`);
53
54
  }
54
55
  if (Object.prototype.hasOwnProperty.call(bindings, key)) {
@@ -25,6 +25,8 @@ exports.parseUtcInstant = parseUtcInstant;
25
25
  exports.formatUtcInstant = formatUtcInstant;
26
26
  exports.formatLocalInstant = formatLocalInstant;
27
27
  exports.describeInstant = describeInstant;
28
+ const PARSE_UTC_INSTANT_RE = /\.000Z$/;
29
+ const DESCRIBE_INSTANT_RE = / (UTC|GMT)$/;
28
30
  const EXAMPLE = '2026-12-01T09:00:00Z';
29
31
  const UTC_INSTANT = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?Z$/;
30
32
  const ZONELESS = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?$/;
@@ -111,7 +113,7 @@ function parseUtcInstant(raw, label = '--at') {
111
113
  let converted = '';
112
114
  if (!calendarProblem(year, month, day) && !clockProblem(hour, minute, second)) {
113
115
  const at = new Date(Date.UTC(year, month - 1, day, hour, minute, second) - shiftMinutes * 60_000);
114
- converted = ` (${value} is ${at.toISOString().replace(/\.000Z$/, 'Z')})`;
116
+ converted = ` (${value} is ${at.toISOString().replace(PARSE_UTC_INSTANT_RE, 'Z')})`;
115
117
  }
116
118
  return fail('numeric_offset', `Numeric offsets such as ${offset[8]}${offset[9]}:${offset[10]} are not accepted; convert the time to UTC and end it with Z${converted}.`);
117
119
  }
@@ -126,7 +128,7 @@ function parseUtcInstant(raw, label = '--at') {
126
128
  }
127
129
  /** `2027-02-02T09:00:00Z` - the instant in UTC, whole seconds when there are no milliseconds. */
128
130
  function formatUtcInstant(date) {
129
- return date.toISOString().replace(/\.000Z$/, 'Z');
131
+ return date.toISOString().replace(PARSE_UTC_INSTANT_RE, 'Z');
130
132
  }
131
133
  /**
132
134
  * `2027-02-02 01:00:00 PST` - the same instant on this machine's wall clock, with the
@@ -156,7 +158,7 @@ function formatLocalInstant(date, timeZone) {
156
158
  function describeInstant(date, timeZone) {
157
159
  const utc = formatUtcInstant(date);
158
160
  const local = formatLocalInstant(date, timeZone);
159
- if (/ (UTC|GMT)$/.test(local))
161
+ if (DESCRIBE_INSTANT_RE.test(local))
160
162
  return utc;
161
163
  return `${utc} (${local})`;
162
164
  }