@skrr-ai/cli 0.1.146 → 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 (282) hide show
  1. package/dist/base-command.js +38 -21
  2. package/dist/commands/agent/message/send.d.ts +11 -0
  3. package/dist/commands/agent/message/send.js +34 -8
  4. package/dist/commands/agent-worker.js +2 -1
  5. package/dist/commands/agents/activity.js +2 -1
  6. package/dist/commands/agents/badge.js +10 -5
  7. package/dist/commands/agents/categories/index.js +2 -1
  8. package/dist/commands/agents/chat.d.ts +1 -0
  9. package/dist/commands/agents/chat.js +29 -1
  10. package/dist/commands/agents/create.js +4 -1
  11. package/dist/commands/agents/overview.js +2 -1
  12. package/dist/commands/agents/releases/create.js +2 -1
  13. package/dist/commands/agents/schedule-overview.js +3 -1
  14. package/dist/commands/agents/schedule.js +2 -1
  15. package/dist/commands/agents/spawn.js +9 -6
  16. package/dist/commands/agents/tools/auth.js +2 -1
  17. package/dist/commands/agents/tools/calls.js +2 -1
  18. package/dist/commands/agents/visibility.js +2 -1
  19. package/dist/commands/balance/show.js +17 -2
  20. package/dist/commands/balance/statement.js +2 -1
  21. package/dist/commands/commands.js +2 -1
  22. package/dist/commands/commitments/create.js +2 -1
  23. package/dist/commands/commitments/delivery.js +2 -1
  24. package/dist/commands/commitments/doctor.js +2 -1
  25. package/dist/commands/commitments/observations.js +2 -2
  26. package/dist/commands/commitments/operating-review.js +2 -1
  27. package/dist/commands/commitments/pack/preflight.js +2 -1
  28. package/dist/commands/commitments/trigger-status.js +2 -1
  29. package/dist/commands/convos/messages.js +2 -1
  30. package/dist/commands/daemon/logs.js +18 -9
  31. package/dist/commands/daemon/usage.js +2 -1
  32. package/dist/commands/dm/messages.js +2 -1
  33. package/dist/commands/dm/thread/messages.js +2 -1
  34. package/dist/commands/dm/threads.js +2 -1
  35. package/dist/commands/doctor.js +2 -1
  36. package/dist/commands/goals/key-results/assess.js +2 -1
  37. package/dist/commands/goals/key-results/history.js +2 -1
  38. package/dist/commands/harnesses/forget.js +2 -1
  39. package/dist/commands/harnesses/show.js +12 -6
  40. package/dist/commands/inbox/index.js +4 -3
  41. package/dist/commands/initiatives/decide.js +2 -1
  42. package/dist/commands/instructions/diff.js +2 -1
  43. package/dist/commands/instructions/show.js +2 -1
  44. package/dist/commands/login.js +4 -2
  45. package/dist/commands/machines/dedicated/cp.js +2 -1
  46. package/dist/commands/machines/dedicated/power/set.js +2 -1
  47. package/dist/commands/machines/show.js +2 -1
  48. package/dist/commands/memory/maintain.js +2 -1
  49. package/dist/commands/memory/read.js +2 -1
  50. package/dist/commands/memory/rebuild-index.js +2 -1
  51. package/dist/commands/memory/rebuild.js +2 -1
  52. package/dist/commands/memory/search.js +2 -1
  53. package/dist/commands/messages/list.js +2 -1
  54. package/dist/commands/revoke-daemon.js +2 -1
  55. package/dist/commands/revoke-token.js +2 -1
  56. package/dist/commands/search/all.js +14 -7
  57. package/dist/commands/search/workspace.js +2 -1
  58. package/dist/commands/set-capabilities.js +2 -1
  59. package/dist/commands/skills/browse.js +8 -2
  60. package/dist/commands/spaces/auto-executor/preview.js +3 -2
  61. package/dist/commands/spaces/auto-executor/runs.js +4 -1
  62. package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
  63. package/dist/commands/spaces/workflow-templates/extract.js +9 -1
  64. package/dist/commands/spaces/workflows/events.js +6 -3
  65. package/dist/commands/spaces/workflows/run.js +5 -3
  66. package/dist/commands/spaces/workflows/update.js +2 -1
  67. package/dist/commands/store/gallery-admissions/preview.js +2 -1
  68. package/dist/commands/store/publishers/profile/handle.js +2 -1
  69. package/dist/commands/tasks/comments/anchor.js +23 -9
  70. package/dist/commands/tasks/complete.js +4 -2
  71. package/dist/commands/tasks/create-tree.js +7 -3
  72. package/dist/commands/tasks/create.js +2 -1
  73. package/dist/commands/tasks/deliverable/add.js +2 -1
  74. package/dist/commands/tasks/deliverable/archive.js +2 -1
  75. package/dist/commands/tasks/deliverable/list.js +2 -1
  76. package/dist/commands/tasks/expectations/assess.js +2 -1
  77. package/dist/commands/tasks/labels/create.js +2 -1
  78. package/dist/commands/tasks/preflight.js +4 -2
  79. package/dist/commands/tasks/ready.js +2 -1
  80. package/dist/commands/tasks/result/submit.js +2 -1
  81. package/dist/commands/tasks/updates/add.js +2 -1
  82. package/dist/commands/tasks/wait.js +2 -1
  83. package/dist/commands/token/list.js +2 -1
  84. package/dist/commands/token/mint.js +2 -1
  85. package/dist/commands/wiki/write.js +14 -7
  86. package/dist/hooks/command-not-found.js +2 -1
  87. package/dist/lib/agent-chat-start.d.ts +77 -0
  88. package/dist/lib/agent-chat-start.js +169 -0
  89. package/dist/lib/agent-config.js +2 -1
  90. package/dist/lib/agent-endpoints.js +4 -2
  91. package/dist/lib/agent-evals.js +2 -1
  92. package/dist/lib/agent-guide-reference-gate.js +22 -11
  93. package/dist/lib/agent-guides.js +4 -1
  94. package/dist/lib/agent-instructions.js +5 -1
  95. package/dist/lib/agent-ref.js +8 -4
  96. package/dist/lib/agent-trigger-listing.js +2 -1
  97. package/dist/lib/agentic-stream.js +8 -5
  98. package/dist/lib/api-error-reason.js +2 -1
  99. package/dist/lib/api-fetch.js +5 -3
  100. package/dist/lib/appData.js +6 -6
  101. package/dist/lib/appInstallations.js +10 -5
  102. package/dist/lib/appsCheck.js +2 -1
  103. package/dist/lib/auth-failure.js +2 -1
  104. package/dist/lib/auth-storage.js +2 -1
  105. package/dist/lib/balance.js +6 -3
  106. package/dist/lib/capability-matrix.js +4 -2
  107. package/dist/lib/cli-runtime.js +2 -1
  108. package/dist/lib/code-handover.js +8 -3
  109. package/dist/lib/command-hygiene.js +28 -12
  110. package/dist/lib/command-manifest.js +6 -3
  111. package/dist/lib/commitment-attention-copy.js +2 -1
  112. package/dist/lib/commitment-event-wakes.js +9 -0
  113. package/dist/lib/commitment-product.js +5 -3
  114. package/dist/lib/commitment-terms.js +2 -1
  115. package/dist/lib/commitments.d.ts +8 -0
  116. package/dist/lib/commitments.js +8 -4
  117. package/dist/lib/compasses.js +2 -1
  118. package/dist/lib/completion-index.js +2 -1
  119. package/dist/lib/computer-files.js +8 -6
  120. package/dist/lib/config.js +11 -5
  121. package/dist/lib/conversation-search.js +4 -2
  122. package/dist/lib/daemon-installer.js +6 -2
  123. package/dist/lib/daemon-maintenance.js +2 -1
  124. package/dist/lib/daemon-ref.js +2 -1
  125. package/dist/lib/daemonBroker.js +6 -3
  126. package/dist/lib/daemonBrokerRefusal.js +4 -2
  127. package/dist/lib/daemonHandoff.js +14 -7
  128. package/dist/lib/daemonIslandProfile.js +2 -1
  129. package/dist/lib/dedicated-copy.js +9 -3
  130. package/dist/lib/dedicated-exec.js +2 -1
  131. package/dist/lib/dedicated-keep-awake.js +2 -1
  132. package/dist/lib/dedicated-machines.js +9 -5
  133. package/dist/lib/dedicated-service.js +2 -1
  134. package/dist/lib/dedicated-ssh.js +5 -3
  135. package/dist/lib/deployed-build.js +2 -1
  136. package/dist/lib/device-code.js +4 -3
  137. package/dist/lib/dpop-auth.js +2 -1
  138. package/dist/lib/earnings.js +2 -1
  139. package/dist/lib/exec-runtime-binary.js +5 -3
  140. package/dist/lib/first-party-harness-broker.js +4 -3
  141. package/dist/lib/first-party-harness-managed.js +2 -1
  142. package/dist/lib/first-party-harness-startup-update.js +8 -4
  143. package/dist/lib/first-party-harness-update.js +2 -1
  144. package/dist/lib/first-party-harness.js +2 -1
  145. package/dist/lib/format.js +8 -4
  146. package/dist/lib/git-task.js +10 -5
  147. package/dist/lib/github-tools.js +6 -3
  148. package/dist/lib/harnesses.js +4 -2
  149. package/dist/lib/hosted-machines.js +2 -1
  150. package/dist/lib/html-text.js +33 -16
  151. package/dist/lib/instruction-blocks.js +2 -1
  152. package/dist/lib/iso-instant.js +5 -3
  153. package/dist/lib/keychain.js +15 -5
  154. package/dist/lib/label-scope.js +2 -1
  155. package/dist/lib/live-runtime-binary.js +10 -7
  156. package/dist/lib/local-skills.js +10 -6
  157. package/dist/lib/login.js +3 -2
  158. package/dist/lib/machine-audit.js +2 -1
  159. package/dist/lib/machine-daemon-log.js +2 -1
  160. package/dist/lib/machine-services.js +2 -1
  161. package/dist/lib/memory-history-session.js +2 -1
  162. package/dist/lib/memory-sync.js +6 -2
  163. package/dist/lib/message-intent.d.ts +10 -0
  164. package/dist/lib/node-adapter.js +4 -2
  165. package/dist/lib/northstars.js +4 -2
  166. package/dist/lib/oauthLogin.js +16 -7
  167. package/dist/lib/open-target.js +8 -4
  168. package/dist/lib/option-hint.js +2 -4
  169. package/dist/lib/outbox.js +2 -1
  170. package/dist/lib/planOutcome.d.ts +5 -3
  171. package/dist/lib/planOutcome.js +7 -4
  172. package/dist/lib/platform-update-local.js +2 -3
  173. package/dist/lib/rate-limit-retry.js +2 -1
  174. package/dist/lib/reflection.js +2 -1
  175. package/dist/lib/request-field-flags.js +2 -1
  176. package/dist/lib/runtime-start-verification.js +2 -1
  177. package/dist/lib/schedule.js +2 -1
  178. package/dist/lib/scoped-memory-command.js +7 -3
  179. package/dist/lib/search-display.js +11 -4
  180. package/dist/lib/skill-store-pagination.js +2 -1
  181. package/dist/lib/space-notebook.js +5 -3
  182. package/dist/lib/store-listing.js +2 -1
  183. package/dist/lib/task-agent-context-capabilities.js +2 -1
  184. package/dist/lib/task-asset-upload.js +7 -3
  185. package/dist/lib/task-closure.js +2 -1
  186. package/dist/lib/task-economics.js +2 -1
  187. package/dist/lib/task-execution.js +16 -8
  188. package/dist/lib/task-extras.js +4 -2
  189. package/dist/lib/task-operation-watch.js +2 -1
  190. package/dist/lib/task-preflight.js +3 -2
  191. package/dist/lib/task-recurrence-summary.js +4 -2
  192. package/dist/lib/task-runtime-headers.js +10 -5
  193. package/dist/lib/task-transcript.js +3 -2
  194. package/dist/lib/task-transfer.js +9 -5
  195. package/dist/lib/tasks.js +2 -1
  196. package/dist/lib/triggers.d.ts +15 -0
  197. package/dist/lib/triggers.js +32 -3
  198. package/dist/lib/update-check.js +12 -7
  199. package/dist/lib/usage-discovery.js +2 -1
  200. package/dist/lib/usd-micros.js +2 -1
  201. package/dist/lib/web-url.js +2 -1
  202. package/dist/lib/widgetCheck.js +15 -9
  203. package/dist/lib/widgetStaticScan.js +26 -14
  204. package/dist/lib/workflow-run-view.js +5 -3
  205. package/dist/lib/workflow-templates.d.ts +10 -0
  206. package/dist/lib/workflow-templates.js +47 -0
  207. package/dist/lib/write-target.js +4 -5
  208. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
  209. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
  210. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
  211. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
  212. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
  213. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
  214. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
  215. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
  216. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
  217. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
  218. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
  219. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
  220. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
  221. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
  222. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
  223. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
  224. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
  225. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
  226. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
  227. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
  228. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
  229. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
  230. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
  231. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
  232. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
  233. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
  234. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
  235. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
  236. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
  237. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
  238. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
  239. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
  240. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
  241. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
  242. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
  243. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
  244. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
  245. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
  246. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
  247. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
  248. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
  249. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
  250. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
  251. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
  252. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
  253. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
  254. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
  271. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
  272. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
  273. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
  274. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  275. package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
  276. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
  277. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
  278. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
  279. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
  280. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  281. package/oclif.manifest.json +17 -2
  282. package/package.json +1 -1
@@ -54,6 +54,7 @@ exports.renderTriggerList = renderTriggerList;
54
54
  exports.formatDuplicateSubscriptionWarning = formatDuplicateSubscriptionWarning;
55
55
  exports.windowAuthoringAdvice = windowAuthoringAdvice;
56
56
  exports.schedulerLimitSentence = schedulerLimitSentence;
57
+ exports.claimsAwaitingStartLine = claimsAwaitingStartLine;
57
58
  exports.armedStateLabel = armedStateLabel;
58
59
  exports.writeModeLabel = writeModeLabel;
59
60
  exports.webhookIngestUrl = webhookIngestUrl;
@@ -79,6 +80,9 @@ const node_fs_1 = require("node:fs");
79
80
  const http_error_1 = require("./http-error");
80
81
  const format_1 = require("./format");
81
82
  const planOutcome_1 = require("./planOutcome");
83
+ const PARSE_JSON_ARRAY_RE = /^[[{]/;
84
+ const ARMED_STATE_LABEL_RE = /^skipped:(.+)$/;
85
+ const WEBHOOK_INGEST_URL_RE = /\/+$/;
82
86
  exports.TRIGGER_KINDS = [
83
87
  'schedule',
84
88
  'once',
@@ -451,7 +455,7 @@ function parseJsonArray(raw, flagName) {
451
455
  return undefined;
452
456
  let text = raw;
453
457
  const trimmed = raw.trim();
454
- if (trimmed.startsWith('@') || (!/^[[{]/.test(trimmed) && (0, node_fs_1.existsSync)(trimmed))) {
458
+ if (trimmed.startsWith('@') || (!PARSE_JSON_ARRAY_RE.test(trimmed) && (0, node_fs_1.existsSync)(trimmed))) {
455
459
  const path = trimmed.startsWith('@') ? trimmed.slice(1) : trimmed;
456
460
  try {
457
461
  text = (0, node_fs_1.readFileSync)(path, 'utf8');
@@ -1426,6 +1430,28 @@ function schedulerLimitSentence(limits) {
1426
1430
  return (`the scheduler has used ${used} (the trigger itself has ${counted}), so it skips every slot` +
1427
1431
  `${lifetime ? '' : ' until the day rolls over'}; see \`skrr triggers preflight\``);
1428
1432
  }
1433
+ /** A claim younger than this is an ordinary dispatch in flight, not a late slot (OSK-22638). */
1434
+ const LATE_CLAIM_GRACE_MS = 2 * 60 * 1000;
1435
+ /**
1436
+ * Slots the scheduler has claimed and charged to the run limit whose trigger has not started, once they
1437
+ * are late enough to matter. The audit has no row for such a slot and `claimed` runs ahead of the fires
1438
+ * counted, which reads like a lost claim; it is a durable outbox row the dispatcher keeps retrying
1439
+ * (a rollout, a held admission gate or a dead dispatcher's lease makes it late). Undefined when there
1440
+ * is nothing late to say, so a healthy trigger prints nothing.
1441
+ */
1442
+ function claimsAwaitingStartLine(limits) {
1443
+ const waiting = limits?.awaitingStart;
1444
+ const age = waiting?.oldestAgeMs;
1445
+ if (!waiting || !waiting.awaitingStart || age === undefined || age < LATE_CLAIM_GRACE_MS) {
1446
+ return undefined;
1447
+ }
1448
+ const count = waiting.awaitingStart;
1449
+ const minutes = Math.round(age / 60_000);
1450
+ const late = minutes >= 120 ? `${Math.round(minutes / 60)} h` : `${minutes} min`;
1451
+ return (`Claimed: ${count} slot${count === 1 ? '' : 's'} the scheduler claimed ${count === 1 ? 'has' : 'have'} ` +
1452
+ `not started: the oldest was due ${waiting.oldestDueAt ?? '-'} (${late} ago). Each is charged to the run ` +
1453
+ `limit and the dispatcher keeps retrying it, so it is late, not lost`);
1454
+ }
1429
1455
  /**
1430
1456
  * Human phrasing for a trigger's enabled state (OSK-4886).
1431
1457
  *
@@ -1477,7 +1503,7 @@ windowVerdict) {
1477
1503
  // "Will fire" is the row's intent. A platform-managed row whose owner is fenced (Always-On off) ticks on
1478
1504
  // schedule and is skipped every time, and the same screen's `Fires:` line says so; the first line a reader
1479
1505
  // meets must not say the opposite (dogfood df-261031-commitment-authoring, OSK-21103).
1480
- const skipped = typeof lastResult === 'string' ? /^skipped:(.+)$/.exec(lastResult) : null;
1506
+ const skipped = typeof lastResult === 'string' ? ARMED_STATE_LABEL_RE.exec(lastResult) : null;
1481
1507
  return skipped
1482
1508
  ? `yes — but its last tick was skipped (${skipped[1]}), so it did not run`
1483
1509
  : 'yes — will fire';
@@ -1514,7 +1540,7 @@ const WEBHOOK_INGEST_KINDS = new Set(['on_demand', 'form', 'chat_message']);
1514
1540
  * the configured base URL rather than guessed.
1515
1541
  */
1516
1542
  function webhookIngestUrl(baseURL, triggerId) {
1517
- return `${String(baseURL).replace(/\/+$/, '')}/api/triggers/webhook/${encodeURIComponent(triggerId)}`;
1543
+ return `${String(baseURL).replace(WEBHOOK_INGEST_URL_RE, '')}/api/triggers/webhook/${encodeURIComponent(triggerId)}`;
1518
1544
  }
1519
1545
  /** An id or token that is short and plain, so it is safe in a command a person will paste. */
1520
1546
  const PLAIN_TOKEN = /^[A-Za-z0-9_.-]{1,64}$/;
@@ -1830,6 +1856,9 @@ function renderTriggerSummary(trigger, log, options = {}) {
1830
1856
  log(`${upcoming ? (dropped || windowed ? 'Next slot:' : 'Next run:') : 'Last run:'}${next.length > 0 ? ` ${next}` : ''}` +
1831
1857
  `${dropped ? ' (will be skipped: the scheduler\'s run limit is reached)' : windowNote}`);
1832
1858
  }
1859
+ const lateClaims = claimsAwaitingStartLine(trigger.schedulerLimits);
1860
+ if (lateClaims)
1861
+ log(lateClaims);
1833
1862
  /*
1834
1863
  * What actually happened when it fired.
1835
1864
  *
@@ -55,6 +55,12 @@ const path = __importStar(require("node:path"));
55
55
  const node_crypto_1 = require("node:crypto");
56
56
  const node_util_1 = require("node:util");
57
57
  const auth_core_1 = require("@skrr-ai/auth-core");
58
+ const NORMALIZE_BASE_URL_RE = /\/+$/;
59
+ const CLASSIFY_CLI_INSTALL_RE = /[/\\]Cellar[/\\]/;
60
+ const CLI_UPDATE_COMMAND_RE = /'/g;
61
+ const UPDATER_ENVIRONMENT_RE = /(?:TOKEN|SECRET|PASSWORD|CREDENTIAL|API_KEY|PRIVATE_KEY|AUTH_FD|AUTH_SOCK)/i;
62
+ const UPDATER_ENVIRONMENT_RE_2 = /^(?:SKRR_|OVERSKY_|OPENAI_|ANTHROPIC_|CODEX_|CLAUDE_|NODE_OPTIONS$)/i;
63
+ const SHOULD_CHECK_CLI_UPDATE_AT_STARTUP_RE = /^(?:--json(?:=|$)|--help$|-h$|--version$|-v$|--headless$|--print$|-p$|--non-interactive$|--no-interactive$)/;
58
64
  /** One update owner and one startup advisory. npm continues to own npm bytes;
59
65
  * the durable worker waits for cooperating CLI sessions before replacing them.
60
66
  * All update decisions are observable, and checking never schedules a change. */
@@ -69,7 +75,7 @@ function cacheFilePath(env = process.env) {
69
75
  return path.join((0, auth_core_1.resolveConfigRoot)(env), 'cli-update-check.json');
70
76
  }
71
77
  function normalizeBaseUrl(url) {
72
- return url.trim().replace(/\/+$/, '').toLowerCase();
78
+ return url.trim().replace(NORMALIZE_BASE_URL_RE, '').toLowerCase();
73
79
  }
74
80
  function isTruthyEnv(value) {
75
81
  return !!value && ['1', 'true', 'on', 'yes'].includes(value.trim().toLowerCase());
@@ -179,7 +185,7 @@ function classifyCliInstall(env, argv, npmGlobalRoot, probeWritable = true) {
179
185
  return { kind: 'bundled' };
180
186
  const entry = argv[1];
181
187
  try {
182
- if (entry && /[/\\]Cellar[/\\]/.test(fs.realpathSync(entry)))
188
+ if (entry && CLASSIFY_CLI_INSTALL_RE.test(fs.realpathSync(entry)))
183
189
  return { kind: 'homebrew' };
184
190
  }
185
191
  catch {
@@ -285,7 +291,7 @@ function cliUpdateCommand(owner, npmPrefix) {
285
291
  switch (owner) {
286
292
  case 'npm-global':
287
293
  return npmPrefix
288
- ? `npm install --global --prefix '${npmPrefix.replace(/'/g, "'\\''")}' ${CLI_PACKAGE}@latest`
294
+ ? `npm install --global --prefix '${npmPrefix.replace(CLI_UPDATE_COMMAND_RE, "'\\''")}' ${CLI_PACKAGE}@latest`
289
295
  : `npm install -g ${CLI_PACKAGE}@latest`;
290
296
  case 'npm-local':
291
297
  return `Use npm in the project that owns ${CLI_PACKAGE}`;
@@ -503,7 +509,7 @@ async function checkCliUpdate(opts) {
503
509
  // Independent probes share the same 1.5-second bound rather than adding
504
510
  // an npm probe after the network timeout on every first invocation.
505
511
  const [response, npmRoot] = await Promise.all([
506
- fetch(`${opts.baseURL.replace(/\/+$/, '')}/api/config/cli-version`, {
512
+ fetch(`${opts.baseURL.replace(NORMALIZE_BASE_URL_RE, '')}/api/config/cli-version`, {
507
513
  signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
508
514
  headers: { accept: 'application/json' },
509
515
  }),
@@ -557,8 +563,7 @@ function npmExecutable(env) {
557
563
  }
558
564
  function updaterEnvironment(env) {
559
565
  // The public npm package update does not require application credentials.
560
- return Object.fromEntries(Object.entries(env).filter(([key]) => !/(?:TOKEN|SECRET|PASSWORD|CREDENTIAL|API_KEY|PRIVATE_KEY|AUTH_FD|AUTH_SOCK)/i.test(key) &&
561
- !/^(?:SKRR_|OVERSKY_|OPENAI_|ANTHROPIC_|CODEX_|CLAUDE_|NODE_OPTIONS$)/i.test(key)));
566
+ return Object.fromEntries(Object.entries(env).filter(([key]) => !UPDATER_ENVIRONMENT_RE.test(key) && !UPDATER_ENVIRONMENT_RE_2.test(key)));
562
567
  }
563
568
  function startWorker(directory, env) {
564
569
  const sourceDir = path.resolve(__dirname, '..', '..', 'bin');
@@ -704,7 +709,7 @@ async function maybeWarnOutdatedCli(opts) {
704
709
  function shouldCheckCliUpdateAtStartup(argv, isTTY, env = process.env) {
705
710
  if (!isTTY || isNudgeSuppressed(env) || isTruthyEnv(env.CI))
706
711
  return false;
707
- if (argv.some((arg) => /^(?:--json(?:=|$)|--help$|-h$|--version$|-v$|--headless$|--print$|-p$|--non-interactive$|--no-interactive$)/.test(arg)))
712
+ if (argv.some((arg) => SHOULD_CHECK_CLI_UPDATE_AT_STARTUP_RE.test(arg)))
708
713
  return false;
709
714
  const command = argv
710
715
  .filter((arg) => !arg.startsWith('-'))
@@ -10,6 +10,7 @@ exports.renderUsageOverview = renderUsageOverview;
10
10
  exports.renderUsageReference = renderUsageReference;
11
11
  exports.auditUsageBudgets = auditUsageBudgets;
12
12
  const command_manifest_1 = require("./command-manifest");
13
+ const COMPACT_RE = /\s+/g;
13
14
  /**
14
15
  * `skrr commands --json` is intentionally exhaustive. That makes it the right
15
16
  * source of truth, but a bad first read for an agent: loading several hundred
@@ -236,7 +237,7 @@ function exampleFor(entry, bin) {
236
237
  return compact(raw || `${bin} ${entry.command}`, 96);
237
238
  }
238
239
  function compact(value, maxCharacters) {
239
- const normalized = value.replace(/\s+/g, ' ').trim();
240
+ const normalized = value.replace(COMPACT_RE, ' ').trim();
240
241
  if (normalized.length <= maxCharacters)
241
242
  return normalized;
242
243
  return `${normalized.slice(0, Math.max(0, maxCharacters - 1)).trimEnd()}…`;
@@ -6,6 +6,7 @@ exports.expectedPriceFlagMicros = expectedPriceFlagMicros;
6
6
  exports.expectedPriceMismatchMessage = expectedPriceMismatchMessage;
7
7
  exports.withUsdPrices = withUsdPrices;
8
8
  const data_provider_1 = require("@skrr-ai/data-provider");
9
+ const PARSE_USD_CENTS_RE = /^\d+(\.\d{1,2})?$/;
9
10
  /**
10
11
  * Parse a user-typed USD amount ("5", "2.50") into integer micros.
11
12
  *
@@ -30,7 +31,7 @@ function usdToMicrosOrZero(amount) {
30
31
  }
31
32
  function parseUsdCents(amount) {
32
33
  const trimmed = amount.trim();
33
- if (!/^\d+(\.\d{1,2})?$/.test(trimmed))
34
+ if (!PARSE_USD_CENTS_RE.test(trimmed))
34
35
  return null;
35
36
  const [whole, frac = ''] = trimmed.split('.');
36
37
  const cents = Number(whole) * 100 + Number(frac.padEnd(2, '0'));
@@ -46,6 +46,7 @@ exports.withDataUrls = withDataUrls;
46
46
  exports.workflowUrlFrom = workflowUrlFrom;
47
47
  const data_provider_1 = require("@skrr-ai/data-provider");
48
48
  const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
49
+ const TRIM_TRAILING_SLASH_RE = /\/+$/;
49
50
  /**
50
51
  * Site-relative canonical path for an entity, or `null` when the required id is
51
52
  * missing. When a task/goal knows its hosting space we emit the canonical
@@ -430,5 +431,5 @@ function encodeId(value) {
430
431
  return raw ? encodeURIComponent(raw) : '';
431
432
  }
432
433
  function trimTrailingSlash(value) {
433
- return value.replace(/\/+$/, '');
434
+ return value.replace(TRIM_TRAILING_SLASH_RE, '');
434
435
  }
@@ -68,6 +68,12 @@ exports.formatWidgetCheckReport = formatWidgetCheckReport;
68
68
  const vm = __importStar(require("node:vm"));
69
69
  const data_provider_1 = require("@skrr-ai/data-provider");
70
70
  const widgetStaticScan_1 = require("./widgetStaticScan");
71
+ const SYNTAX_ISSUE_RE = /^widget\.js:(\d+)/;
72
+ const GRAMMAR_FIX_RE = /more than once/;
73
+ const GRAMMAR_FIX_RE_2 = /no html or js/;
74
+ const GRAMMAR_FIX_RE_3 = /before the first section marker/;
75
+ const CHECK_FENCE_TEXT_RE = /\r\n?/g;
76
+ const SCHEMA_ISSUES_RE = /exceeds .* characters/;
71
77
  // ── report types (the `--json` shape; stable) ───────────────────────────────
72
78
  exports.WIDGET_CHECK_REPORT_VERSION = 1;
73
79
  exports.WIDGET_CHECK_HEURISTIC_NOTE = 'Grammar, schema, size and JavaScript syntax findings are exact. Static findings are a heuristic ' +
@@ -202,7 +208,7 @@ function syntaxIssue(script, section, firstLine) {
202
208
  const message = errorMessage(err);
203
209
  const stack = err?.stack;
204
210
  const head = typeof stack === 'string' ? stack.split('\n')[0] : '';
205
- const at = /^widget\.js:(\d+)/.exec(head);
211
+ const at = SYNTAX_ISSUE_RE.exec(head);
206
212
  const fix = SYNTAX_FIXES.find(([pattern]) => pattern.test(message))?.[1];
207
213
  return {
208
214
  severity: 'error',
@@ -291,13 +297,13 @@ function grammarFix(reason, message) {
291
297
  case 'invalid-header':
292
298
  return `Write the opening line like ${exampleOpener()}: the title in quotes, height an integer, nothing after the closing brace.`;
293
299
  case 'invalid-payload':
294
- if (/more than once/.test(message)) {
300
+ if (GRAMMAR_FIX_RE.test(message)) {
295
301
  return `Use each section at most once (${order}; the platform reads them in any order). Any of them may be left out.`;
296
302
  }
297
- if (/no html or js/.test(message)) {
303
+ if (GRAMMAR_FIX_RE_2.test(message)) {
298
304
  return 'Add an html section or a js section; a stylesheet alone is refused.';
299
305
  }
300
- if (/before the first section marker/.test(message)) {
306
+ if (GRAMMAR_FIX_RE_3.test(message)) {
301
307
  return `Start the first line after the opening line with a section marker (${order}).`;
302
308
  }
303
309
  return undefined;
@@ -331,7 +337,7 @@ function fenceReportFromPartial(partial) {
331
337
  function checkFenceText(text, strict) {
332
338
  // CR and CRLF each count as one line break in the grammar, and inside a block
333
339
  // they are normalised to LF anyway, so normalising first changes no verdict.
334
- const normalised = text.replace(/\r\n?/g, '\n');
340
+ const normalised = text.replace(CHECK_FENCE_TEXT_RE, '\n');
335
341
  const trailingBreak = normalised.endsWith('\n');
336
342
  const lines = normalised.split('\n');
337
343
  if (trailingBreak) {
@@ -470,7 +476,7 @@ function schemaIssues(issues, schema, handled) {
470
476
  if (issue.code === 'too_big' && field && handled.has(field)) {
471
477
  continue;
472
478
  }
473
- if (issue.code === 'custom' && /exceeds .* characters/.test(issue.message)) {
479
+ if (issue.code === 'custom' && SCHEMA_ISSUES_RE.test(issue.message)) {
474
480
  continue;
475
481
  }
476
482
  let message;
@@ -898,9 +904,9 @@ function renderWidgetFences(result) {
898
904
  }
899
905
  const back = (0, data_provider_1.parseUiWidgetFences)(block);
900
906
  const widget = back.widgets[0];
901
- const css = (input.css ?? '').replace(/\r\n?/g, '\n');
902
- const html = (input.html ?? '').replace(/\r\n?/g, '\n');
903
- const js = (input.js ?? '').replace(/\r\n?/g, '\n');
907
+ const css = (input.css ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
908
+ const html = (input.html ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
909
+ const js = (input.js ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
904
910
  const matches = back.errors.length === 0 &&
905
911
  back.widgets.length === 1 &&
906
912
  widget.title === input.title &&
@@ -6,6 +6,19 @@ exports.maskCssComments = maskCssComments;
6
6
  exports.maskHtmlComments = maskHtmlComments;
7
7
  exports.classifyUrl = classifyUrl;
8
8
  exports.scanWidgetSource = scanWidgetSource;
9
+ const IS_IDENT_CHAR_RE = /[A-Za-z0-9_$]/;
10
+ const LEX_JS_RE = /[a-z]/i;
11
+ const LEX_JS_RE_2 = /[A-Za-z_$]/;
12
+ const LEX_JS_RE_3 = /[0-9A-Za-z_.]/;
13
+ const CLASSIFY_URL_RE = /^[a-z][a-z0-9+.-]*:/;
14
+ const IS_NAMESPACE_URL_RE = /^https?:\/\/www\.w3\.org\//i;
15
+ const SCAN_CSS_INTO_RE = /@import\s+(?:url\(\s*)?['"]?([^'")\s;]+)/i;
16
+ const SCAN_CSS_INTO_RE_2 = /^['"]|['"]$/g;
17
+ const CALLS_RE = /\b(?:window\s*\.\s*)?skrr\s*\.\s*app\s*\.\s*(?:http|service)\s*\.\s*fetch\s*\(/g;
18
+ const BROKER_FETCH_OFFSETS_RE = /\s/;
19
+ const SCAN_JS_INTO_RE = /\bopenLink\b/;
20
+ const SCAN_JS_INTO_RE_2 = /<\/script/i;
21
+ const SRCSET_URLS_RE = /\s+/;
9
22
  const OPEN_LINK = 'window.skrr.openLink(url)';
10
23
  // ── small text helpers ──────────────────────────────────────────────────────
11
24
  /** ASCII-only lowercase: the same length as the input, so offsets stay valid. */
@@ -75,7 +88,7 @@ const REGEX_PRECEDING_WORDS = new Set([
75
88
  'yield',
76
89
  'await',
77
90
  ]);
78
- const isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c) || c > '\u007f';
91
+ const isIdentChar = (c) => IS_IDENT_CHAR_RE.test(c) || c > '\u007f';
79
92
  /**
80
93
  * Read a script once. Total and linear: it never throws, every loop advances, and
81
94
  * a misread costs a missed or an extra finding, never a hang. It is a heuristic
@@ -191,7 +204,7 @@ function lexJs(src) {
191
204
  if (closed !== -1) {
192
205
  keep('regex', i, i + 1, closed);
193
206
  i = closed + 1;
194
- while (i < n && /[a-z]/i.test(src.charAt(i))) {
207
+ while (i < n && LEX_JS_RE.test(src.charAt(i))) {
195
208
  i += 1;
196
209
  }
197
210
  regexAllowed = false;
@@ -201,7 +214,7 @@ function lexJs(src) {
201
214
  regexAllowed = true;
202
215
  }
203
216
  }
204
- else if (/[A-Za-z_$]/.test(c) || c > '\u007f') {
217
+ else if (LEX_JS_RE_2.test(c) || c > '\u007f') {
205
218
  let j = i + 1;
206
219
  while (j < n && isIdentChar(src.charAt(j))) {
207
220
  j += 1;
@@ -211,7 +224,7 @@ function lexJs(src) {
211
224
  }
212
225
  else if (c >= '0' && c <= '9') {
213
226
  let j = i + 1;
214
- while (j < n && /[0-9A-Za-z_.]/.test(src.charAt(j))) {
227
+ while (j < n && LEX_JS_RE_3.test(src.charAt(j))) {
215
228
  j += 1;
216
229
  }
217
230
  regexAllowed = false;
@@ -296,14 +309,14 @@ function classifyUrl(raw) {
296
309
  lower.startsWith('tel:')) {
297
310
  return 'inline';
298
311
  }
299
- if (lower.startsWith('//') || /^[a-z][a-z0-9+.-]*:/.test(lower)) {
312
+ if (lower.startsWith('//') || CLASSIFY_URL_RE.test(lower)) {
300
313
  return 'external';
301
314
  }
302
315
  return 'relative';
303
316
  }
304
317
  /** XML namespace identifiers look like URLs and load nothing. */
305
318
  function isNamespaceUrl(url) {
306
- return /^https?:\/\/www\.w3\.org\//i.test(url);
319
+ return IS_NAMESPACE_URL_RE.test(url);
307
320
  }
308
321
  // ── collector ───────────────────────────────────────────────────────────────
309
322
  class Collector {
@@ -333,7 +346,7 @@ function scanCssInto(source, baseLine, out) {
333
346
  while (i !== -1) {
334
347
  const end = lower.indexOf(';', i);
335
348
  const statement = masked.slice(i, end === -1 ? undefined : end);
336
- const target = /@import\s+(?:url\(\s*)?['"]?([^'")\s;]+)/i.exec(statement);
349
+ const target = SCAN_CSS_INTO_RE.exec(statement);
337
350
  const kind = target ? classifyUrl(target[1]) : 'relative';
338
351
  if (kind === 'external') {
339
352
  out.add('error', 'external-resource', lineOf(i), '@import of a URL: the frame allows no stylesheet from a URL, so the rules never load.', 'Write the rules inline in this section; there are no web fonts or remote stylesheets.');
@@ -347,7 +360,7 @@ function scanCssInto(source, baseLine, out) {
347
360
  while (u !== -1) {
348
361
  const close = masked.indexOf(')', u + 4);
349
362
  const inner = masked.slice(u + 4, close === -1 ? undefined : close).trim();
350
- const value = inner.replace(/^['"]|['"]$/g, '');
363
+ const value = inner.replace(SCAN_CSS_INTO_RE_2, '');
351
364
  const kind = classifyUrl(value);
352
365
  if (kind === 'external') {
353
366
  out.add('error', 'external-resource', lineOf(u), 'url() of an external address: img-src and font-src allow only data: and blob: URLs here, so it is blocked.', 'Use inline SVG, a gradient, or a data: URI.');
@@ -508,14 +521,13 @@ const STRING_ARGUMENT_RULES = [
508
521
  /** Broker calls send a capability message; they never use the frame's network API. */
509
522
  function brokerFetchOffsets(code) {
510
523
  const offsets = new Set();
511
- const calls = /\b(?:window\s*\.\s*)?skrr\s*\.\s*app\s*\.\s*(?:http|service)\s*\.\s*fetch\s*\(/g;
512
- for (const match of code.matchAll(calls)) {
524
+ for (const match of code.matchAll(CALLS_RE)) {
513
525
  const start = match.index ?? 0;
514
526
  if (start > 0 && isIdentChar(code[start - 1]))
515
527
  continue;
516
528
  // `other . skrr.app.http.fetch` is another object's property, not the host SDK.
517
529
  let before = start - 1;
518
- while (before >= 0 && /\s/.test(code[before]))
530
+ while (before >= 0 && BROKER_FETCH_OFFSETS_RE.test(code[before]))
519
531
  before -= 1;
520
532
  if (before >= 0 && code[before] === '.')
521
533
  continue;
@@ -561,14 +573,14 @@ function scanJsInto(source, baseLine, out) {
561
573
  const url = match[1];
562
574
  const index = literal.start + (match.index ?? 0);
563
575
  const text = codeLines[lineAt(starts, index) - 1] ?? '';
564
- if (isNamespaceUrl(url) || /\bopenLink\b/.test(text)) {
576
+ if (isNamespaceUrl(url) || SCAN_JS_INTO_RE.test(text)) {
565
577
  continue;
566
578
  }
567
579
  out.add('warn', 'external-url', lineOf(index), `A URL string (${url.length > 60 ? `${url.slice(0, 57)}...` : url}): the frame can load nothing from a URL.`, `If it is a link, pass it to ${OPEN_LINK}; if it is data or an image, inline it.`);
568
580
  }
569
581
  }
570
582
  // The one rule that reads the text as the HTML parser would, and so reads strings too.
571
- if (/<\/script/i.test(commentless)) {
583
+ if (SCAN_JS_INTO_RE_2.test(commentless)) {
572
584
  const at = asciiLower(commentless).indexOf('</script');
573
585
  out.add('warn', 'element-close', lineOf(at), 'The text contains a closing script tag, which can end the script early depending on how the frame embeds it.', 'Write it as <\\/script> inside a string.');
574
586
  }
@@ -676,7 +688,7 @@ const RESOURCE_ATTRIBUTES = ['src', 'srcset', 'poster', 'data', 'background', 'x
676
688
  function srcsetUrls(value) {
677
689
  return value
678
690
  .split(',')
679
- .map((candidate) => candidate.trim().split(/\s+/)[0])
691
+ .map((candidate) => candidate.trim().split(SRCSET_URLS_RE)[0])
680
692
  .filter(Boolean);
681
693
  }
682
694
  const STYLESHEET_LIKE_REL = /\b(?:stylesheet|preload|modulepreload|prefetch|icon|manifest)\b/i;
@@ -8,10 +8,12 @@ exports.describeSignalHints = describeSignalHints;
8
8
  exports.describePartialOutcomes = describePartialOutcomes;
9
9
  const data_provider_1 = require("@skrr-ai/data-provider");
10
10
  const format_1 = require("./format");
11
+ // eslint-disable-next-line no-control-regex
12
+ const PRINTABLE_RE = /[\u0000-\u001f\u007f-\u009f]/g;
13
+ const DESCRIBE_NODE_DETAIL_RE = /_/g;
11
14
  /** One printable line: control characters (an ESC sequence included) become spaces. */
12
15
  function printable(value) {
13
- // eslint-disable-next-line no-control-regex
14
- return (0, format_1.collapseWhitespace)(value.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' '));
16
+ return (0, format_1.collapseWhitespace)(value.replace(PRINTABLE_RE, ' '));
15
17
  }
16
18
  /**
17
19
  * Nodes in graph order: the server's topological `depth` first, then the order the server
@@ -65,7 +67,7 @@ function describeNodeDetail(node, attention = '') {
65
67
  // `succeeded` with half its graph unrun looked unexplained; only --json said why (OSK-22461).
66
68
  const extra = node;
67
69
  if (node.status === 'skipped' && typeof extra.output?.reason === 'string') {
68
- parts.push(`skipped: ${extra.output.reason.replace(/_/g, ' ')}`);
70
+ parts.push(`skipped: ${extra.output.reason.replace(DESCRIBE_NODE_DETAIL_RE, ' ')}`);
69
71
  }
70
72
  if (extra.nodeType === 'condition' && node.status === 'succeeded' && typeof extra.outcome === 'string') {
71
73
  parts.push(`took "${extra.outcome}"`);
@@ -114,6 +114,15 @@ export declare function buildTemplateInsertPayload(input: {
114
114
  semanticRevision: number;
115
115
  presentationRevision: number;
116
116
  }): WorkflowTemplateInsertParams;
117
+ /**
118
+ * One `--keep-concrete nodeKey.configPath` value, as the server's override list wants it.
119
+ *
120
+ * The extraction scrubs space-locked values (a `workflow_call`'s workflow id, an assignee) into
121
+ * slots so the fragment is portable. Keeping one concrete is a deliberate act the API supports
122
+ * (`slotOverrides[].keepConcrete`) and the canvas offers; without this flag the CLI could not
123
+ * reach it, so the template that results from the same selection differed by surface.
124
+ */
125
+ export declare function parseKeepConcrete(values: readonly string[] | undefined, nodeKeys: readonly string[]): TemplatePlan<NonNullable<WorkflowTemplateExtractParams['slotOverrides']>>;
117
126
  /** Shape the save-from-selection request. The client names node keys only. */
118
127
  export declare function buildTemplateExtractPayload(flags: {
119
128
  nodes?: string;
@@ -122,6 +131,7 @@ export declare function buildTemplateExtractPayload(flags: {
122
131
  tags?: string;
123
132
  scope?: string;
124
133
  publish?: boolean;
134
+ keepConcrete?: readonly string[];
125
135
  }): TemplatePlan<WorkflowTemplateExtractParams>;
126
136
  /**
127
137
  * Whether a failed insert lost the draft compare-and-swap.
@@ -12,6 +12,7 @@ exports.buildInsertConnect = buildInsertConnect;
12
12
  exports.parseSlotBindings = parseSlotBindings;
13
13
  exports.resolveTemplateVersionId = resolveTemplateVersionId;
14
14
  exports.buildTemplateInsertPayload = buildTemplateInsertPayload;
15
+ exports.parseKeepConcrete = parseKeepConcrete;
15
16
  exports.buildTemplateExtractPayload = buildTemplateExtractPayload;
16
17
  exports.isWorkflowDraftConflict = isWorkflowDraftConflict;
17
18
  exports.toTemplateListRow = toTemplateListRow;
@@ -491,6 +492,48 @@ function buildTemplateInsertPayload(input) {
491
492
  expectedPresentationRevision: input.presentationRevision,
492
493
  };
493
494
  }
495
+ /**
496
+ * One `--keep-concrete nodeKey.configPath` value, as the server's override list wants it.
497
+ *
498
+ * The extraction scrubs space-locked values (a `workflow_call`'s workflow id, an assignee) into
499
+ * slots so the fragment is portable. Keeping one concrete is a deliberate act the API supports
500
+ * (`slotOverrides[].keepConcrete`) and the canvas offers; without this flag the CLI could not
501
+ * reach it, so the template that results from the same selection differed by surface.
502
+ */
503
+ function parseKeepConcrete(values, nodeKeys) {
504
+ const overrides = [];
505
+ const seen = new Set();
506
+ for (const raw of values ?? []) {
507
+ const value = raw.trim();
508
+ const dot = value.indexOf('.');
509
+ const nodeKey = dot > 0 ? value.slice(0, dot) : '';
510
+ const configPath = dot > 0 ? value.slice(dot + 1) : '';
511
+ if (!nodeKey || !configPath) {
512
+ return {
513
+ ok: false,
514
+ error: {
515
+ code: 'WORKFLOW_TEMPLATE_KEEP_CONCRETE_INVALID',
516
+ message: `--keep-concrete takes nodeKey.configPath, for example call_1.definitionId (got "${raw}").`,
517
+ },
518
+ };
519
+ }
520
+ // An override for a node that is not being extracted would change nothing and say nothing.
521
+ if (!nodeKeys.includes(nodeKey)) {
522
+ return {
523
+ ok: false,
524
+ error: {
525
+ code: 'WORKFLOW_TEMPLATE_KEEP_CONCRETE_NOT_SELECTED',
526
+ message: `--keep-concrete ${value}: node "${nodeKey}" is not in --nodes (${nodeKeys.join(', ')}).`,
527
+ },
528
+ };
529
+ }
530
+ if (seen.has(value))
531
+ continue;
532
+ seen.add(value);
533
+ overrides.push({ nodeKey, configPath, keepConcrete: true });
534
+ }
535
+ return { ok: true, payload: overrides };
536
+ }
494
537
  /** Shape the save-from-selection request. The client names node keys only. */
495
538
  function buildTemplateExtractPayload(flags) {
496
539
  const nodeKeys = flags.nodes ? csv(flags.nodes) : [];
@@ -524,6 +567,9 @@ function buildTemplateExtractPayload(flags) {
524
567
  const scope = parseTemplateScope(flags.scope);
525
568
  if (!scope.ok)
526
569
  return scope;
570
+ const keepConcrete = parseKeepConcrete(flags.keepConcrete, nodeKeys);
571
+ if (!keepConcrete.ok)
572
+ return keepConcrete;
527
573
  return {
528
574
  ok: true,
529
575
  payload: defined({
@@ -532,6 +578,7 @@ function buildTemplateExtractPayload(flags) {
532
578
  description: flags.description,
533
579
  tags: tags.payload,
534
580
  scope: scope.payload,
581
+ slotOverrides: keepConcrete.payload.length ? keepConcrete.payload : undefined,
535
582
  // The server default is `true`; an explicit `false` has to survive so
536
583
  // `--no-publish` actually leaves the row unpublished.
537
584
  publish: flags.publish,
@@ -19,6 +19,7 @@ exports.firstUnmetExpectation = firstUnmetExpectation;
19
19
  * them and whether an expectation holds.
20
20
  */
21
21
  const core_1 = require("@oclif/core");
22
+ const HOST_OF_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
22
23
  /** `stevedu518@gmail.com on https://skrr.ai (no workspace)` */
23
24
  function formatWriteTarget(target) {
24
25
  const who = target.account ?? target.accountId ?? 'an account that could not be read';
@@ -27,7 +28,7 @@ function formatWriteTarget(target) {
27
28
  }
28
29
  function hostOf(value) {
29
30
  try {
30
- return new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(value) ? value : `https://${value}`).host.toLowerCase();
31
+ return new URL(HOST_OF_RE.test(value) ? value : `https://${value}`).host.toLowerCase();
31
32
  }
32
33
  catch {
33
34
  return null;
@@ -48,12 +49,10 @@ function matchesExpectedTarget(target, expected) {
48
49
  const value = expected.trim();
49
50
  if (!value)
50
51
  return false;
51
- if (value.includes('@') && !/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) {
52
+ if (value.includes('@') && !HOST_OF_RE.test(value)) {
52
53
  return target.account !== null && target.account.toLowerCase() === value.toLowerCase();
53
54
  }
54
- if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value) ||
55
- value.includes('.') ||
56
- value.startsWith('localhost')) {
55
+ if (HOST_OF_RE.test(value) || value.includes('.') || value.startsWith('localhost')) {
57
56
  const expectedHost = hostOf(value);
58
57
  return expectedHost !== null && expectedHost === hostOf(target.server);
59
58
  }
@@ -39,6 +39,7 @@ var import_node_child_process = require("node:child_process");
39
39
  var import_node_fs = __toESM(require("node:fs"), 1);
40
40
  var import_node_path = __toESM(require("node:path"), 1);
41
41
  var import_runtime = require("./runtime.js");
42
+ const PARSE_HELPER_OUTPUT_RE = /\s/;
42
43
  const MAX_OUTPUT_BYTES = 64 * 1024;
43
44
  const DEFAULT_TIMEOUT_MS = 1e4;
44
45
  const DEFAULT_TTL_MS = 5 * 6e4;
@@ -234,7 +235,7 @@ function parseHelperOutput(stdout, log) {
234
235
  return null;
235
236
  }
236
237
  }
237
- if (/\s/.test(trimmed)) {
238
+ if (PARSE_HELPER_OUTPUT_RE.test(trimmed)) {
238
239
  log.error("[authHelper] bare-token output contains whitespace \u2014 refusing (use JSON if helper logs to stdout)");
239
240
  return null;
240
241
  }