@skrr-ai/cli 0.1.146 → 0.1.148

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 (289) 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/triggers/policy.js +11 -1
  19. package/dist/commands/agents/visibility.js +2 -1
  20. package/dist/commands/balance/show.js +28 -5
  21. package/dist/commands/balance/statement.js +2 -1
  22. package/dist/commands/commands.js +2 -1
  23. package/dist/commands/commitments/create.js +2 -1
  24. package/dist/commands/commitments/delivery.js +2 -1
  25. package/dist/commands/commitments/doctor.js +2 -1
  26. package/dist/commands/commitments/observations.js +2 -2
  27. package/dist/commands/commitments/operating-review.js +2 -1
  28. package/dist/commands/commitments/pack/preflight.js +2 -1
  29. package/dist/commands/commitments/preflight.js +5 -1
  30. package/dist/commands/commitments/trigger-status.js +2 -1
  31. package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
  32. package/dist/commands/commitments/wake-capabilities.js +16 -0
  33. package/dist/commands/convos/messages.js +2 -1
  34. package/dist/commands/daemon/logs.js +18 -9
  35. package/dist/commands/daemon/usage.js +2 -1
  36. package/dist/commands/dm/messages.js +2 -1
  37. package/dist/commands/dm/thread/messages.js +2 -1
  38. package/dist/commands/dm/threads.js +2 -1
  39. package/dist/commands/doctor.js +2 -1
  40. package/dist/commands/goals/key-results/assess.js +2 -1
  41. package/dist/commands/goals/key-results/history.js +2 -1
  42. package/dist/commands/harnesses/forget.js +2 -1
  43. package/dist/commands/harnesses/show.js +12 -6
  44. package/dist/commands/inbox/index.js +4 -3
  45. package/dist/commands/initiatives/decide.js +2 -1
  46. package/dist/commands/instructions/diff.js +2 -1
  47. package/dist/commands/instructions/show.js +2 -1
  48. package/dist/commands/login.js +4 -2
  49. package/dist/commands/machines/dedicated/cp.js +2 -1
  50. package/dist/commands/machines/dedicated/power/set.js +2 -1
  51. package/dist/commands/machines/show.js +2 -1
  52. package/dist/commands/memory/maintain.js +2 -1
  53. package/dist/commands/memory/read.js +2 -1
  54. package/dist/commands/memory/rebuild-index.js +2 -1
  55. package/dist/commands/memory/rebuild.js +2 -1
  56. package/dist/commands/memory/search.js +2 -1
  57. package/dist/commands/messages/list.js +2 -1
  58. package/dist/commands/revoke-daemon.js +2 -1
  59. package/dist/commands/revoke-token.js +2 -1
  60. package/dist/commands/search/all.js +14 -7
  61. package/dist/commands/search/workspace.js +2 -1
  62. package/dist/commands/set-capabilities.js +2 -1
  63. package/dist/commands/skills/browse.js +8 -2
  64. package/dist/commands/spaces/auto-executor/preview.js +3 -2
  65. package/dist/commands/spaces/auto-executor/runs.js +4 -1
  66. package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
  67. package/dist/commands/spaces/workflow-templates/extract.js +9 -1
  68. package/dist/commands/spaces/workflows/events.js +6 -3
  69. package/dist/commands/spaces/workflows/run.js +5 -3
  70. package/dist/commands/spaces/workflows/update.js +2 -1
  71. package/dist/commands/store/gallery-admissions/preview.js +2 -1
  72. package/dist/commands/store/publishers/profile/handle.js +2 -1
  73. package/dist/commands/tasks/comments/anchor.js +23 -9
  74. package/dist/commands/tasks/complete.js +4 -2
  75. package/dist/commands/tasks/create-tree.js +7 -3
  76. package/dist/commands/tasks/create.js +2 -1
  77. package/dist/commands/tasks/deliverable/add.js +2 -1
  78. package/dist/commands/tasks/deliverable/archive.js +2 -1
  79. package/dist/commands/tasks/deliverable/list.js +2 -1
  80. package/dist/commands/tasks/expectations/assess.js +2 -1
  81. package/dist/commands/tasks/labels/create.js +2 -1
  82. package/dist/commands/tasks/preflight.js +4 -2
  83. package/dist/commands/tasks/ready.js +2 -1
  84. package/dist/commands/tasks/result/submit.js +2 -1
  85. package/dist/commands/tasks/updates/add.js +2 -1
  86. package/dist/commands/tasks/wait.js +2 -1
  87. package/dist/commands/token/list.js +2 -1
  88. package/dist/commands/token/mint.js +2 -1
  89. package/dist/commands/wiki/write.js +14 -7
  90. package/dist/hooks/command-not-found.js +2 -1
  91. package/dist/lib/agent-chat-start.d.ts +77 -0
  92. package/dist/lib/agent-chat-start.js +169 -0
  93. package/dist/lib/agent-config.js +2 -1
  94. package/dist/lib/agent-endpoints.js +4 -2
  95. package/dist/lib/agent-evals.js +2 -1
  96. package/dist/lib/agent-guide-reference-gate.js +22 -11
  97. package/dist/lib/agent-guides.js +4 -1
  98. package/dist/lib/agent-instructions.js +5 -1
  99. package/dist/lib/agent-ref.js +8 -4
  100. package/dist/lib/agent-trigger-listing.js +2 -1
  101. package/dist/lib/agentic-stream.js +8 -5
  102. package/dist/lib/api-error-reason.js +2 -1
  103. package/dist/lib/api-fetch.js +5 -3
  104. package/dist/lib/appData.js +6 -6
  105. package/dist/lib/appInstallations.js +10 -5
  106. package/dist/lib/appsCheck.js +2 -1
  107. package/dist/lib/auth-failure.js +2 -1
  108. package/dist/lib/auth-storage.js +2 -1
  109. package/dist/lib/balance.d.ts +33 -3
  110. package/dist/lib/balance.js +39 -7
  111. package/dist/lib/capability-matrix.js +4 -2
  112. package/dist/lib/cli-runtime.js +2 -1
  113. package/dist/lib/code-handover.js +8 -3
  114. package/dist/lib/command-hygiene.js +28 -12
  115. package/dist/lib/command-manifest.js +6 -3
  116. package/dist/lib/commitment-attention-copy.js +2 -1
  117. package/dist/lib/commitment-event-wakes.js +9 -0
  118. package/dist/lib/commitment-product.js +5 -3
  119. package/dist/lib/commitment-terms.js +2 -1
  120. package/dist/lib/commitments.d.ts +13 -0
  121. package/dist/lib/commitments.js +24 -9
  122. package/dist/lib/compasses.js +2 -1
  123. package/dist/lib/completion-index.js +2 -1
  124. package/dist/lib/computer-files.js +8 -6
  125. package/dist/lib/config.js +11 -5
  126. package/dist/lib/conversation-search.js +4 -2
  127. package/dist/lib/daemon-installer.js +6 -2
  128. package/dist/lib/daemon-maintenance.js +2 -1
  129. package/dist/lib/daemon-ref.js +2 -1
  130. package/dist/lib/daemonBroker.js +6 -3
  131. package/dist/lib/daemonBrokerRefusal.js +4 -2
  132. package/dist/lib/daemonHandoff.js +14 -7
  133. package/dist/lib/daemonIslandProfile.js +2 -1
  134. package/dist/lib/dedicated-copy.js +9 -3
  135. package/dist/lib/dedicated-exec.js +2 -1
  136. package/dist/lib/dedicated-keep-awake.js +2 -1
  137. package/dist/lib/dedicated-machines.js +9 -5
  138. package/dist/lib/dedicated-service.js +2 -1
  139. package/dist/lib/dedicated-ssh.js +5 -3
  140. package/dist/lib/deployed-build.js +2 -1
  141. package/dist/lib/device-code.js +4 -3
  142. package/dist/lib/dpop-auth.js +2 -1
  143. package/dist/lib/earnings.js +2 -1
  144. package/dist/lib/exec-runtime-binary.js +5 -3
  145. package/dist/lib/first-party-harness-broker.js +4 -3
  146. package/dist/lib/first-party-harness-managed.js +2 -1
  147. package/dist/lib/first-party-harness-startup-update.js +8 -4
  148. package/dist/lib/first-party-harness-update.js +2 -1
  149. package/dist/lib/first-party-harness.js +2 -1
  150. package/dist/lib/format.js +8 -4
  151. package/dist/lib/git-task.js +10 -5
  152. package/dist/lib/github-tools.js +6 -3
  153. package/dist/lib/harnesses.js +4 -2
  154. package/dist/lib/hosted-machines.js +2 -1
  155. package/dist/lib/html-text.js +33 -16
  156. package/dist/lib/ingress.js +2 -1
  157. package/dist/lib/instruction-blocks.js +2 -1
  158. package/dist/lib/iso-instant.js +5 -3
  159. package/dist/lib/keychain.js +15 -5
  160. package/dist/lib/label-scope.js +2 -1
  161. package/dist/lib/live-runtime-binary.js +10 -7
  162. package/dist/lib/local-skills.js +10 -6
  163. package/dist/lib/login.js +3 -2
  164. package/dist/lib/machine-audit.js +2 -1
  165. package/dist/lib/machine-daemon-log.js +2 -1
  166. package/dist/lib/machine-services.js +2 -1
  167. package/dist/lib/memory-history-session.js +2 -1
  168. package/dist/lib/memory-sync.js +6 -2
  169. package/dist/lib/message-intent.d.ts +10 -0
  170. package/dist/lib/node-adapter.js +4 -2
  171. package/dist/lib/northstars.js +4 -2
  172. package/dist/lib/oauthLogin.js +16 -7
  173. package/dist/lib/open-target.js +8 -4
  174. package/dist/lib/option-hint.js +2 -4
  175. package/dist/lib/outbox.js +2 -1
  176. package/dist/lib/planOutcome.d.ts +5 -3
  177. package/dist/lib/planOutcome.js +7 -4
  178. package/dist/lib/platform-update-local.js +2 -3
  179. package/dist/lib/preflight-copy.js +31 -0
  180. package/dist/lib/rate-limit-retry.js +2 -1
  181. package/dist/lib/reflection.js +2 -1
  182. package/dist/lib/request-field-flags.js +2 -1
  183. package/dist/lib/runtime-start-verification.js +2 -1
  184. package/dist/lib/schedule.js +2 -1
  185. package/dist/lib/scoped-memory-command.js +7 -3
  186. package/dist/lib/search-display.js +11 -4
  187. package/dist/lib/skill-store-pagination.js +2 -1
  188. package/dist/lib/space-notebook.js +5 -3
  189. package/dist/lib/store-listing.js +2 -1
  190. package/dist/lib/task-agent-context-capabilities.js +2 -1
  191. package/dist/lib/task-asset-upload.js +7 -3
  192. package/dist/lib/task-closure.js +2 -1
  193. package/dist/lib/task-economics.js +2 -1
  194. package/dist/lib/task-execution.js +16 -8
  195. package/dist/lib/task-extras.js +4 -2
  196. package/dist/lib/task-operation-watch.js +2 -1
  197. package/dist/lib/task-preflight.js +3 -2
  198. package/dist/lib/task-recurrence-summary.js +4 -2
  199. package/dist/lib/task-runtime-headers.js +10 -5
  200. package/dist/lib/task-transcript.js +3 -2
  201. package/dist/lib/task-transfer.js +9 -5
  202. package/dist/lib/tasks.js +2 -1
  203. package/dist/lib/triggers.d.ts +21 -0
  204. package/dist/lib/triggers.js +41 -3
  205. package/dist/lib/update-check.js +12 -7
  206. package/dist/lib/usage-discovery.js +2 -1
  207. package/dist/lib/usd-micros.js +2 -1
  208. package/dist/lib/web-url.js +2 -1
  209. package/dist/lib/widgetCheck.js +15 -9
  210. package/dist/lib/widgetStaticScan.js +26 -14
  211. package/dist/lib/workflow-run-view.js +5 -3
  212. package/dist/lib/workflow-templates.d.ts +10 -0
  213. package/dist/lib/workflow-templates.js +47 -0
  214. package/dist/lib/write-target.js +4 -5
  215. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
  216. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
  217. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
  218. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
  219. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
  220. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
  221. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
  222. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
  223. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
  224. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
  225. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
  226. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
  227. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
  228. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
  229. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
  230. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
  231. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
  232. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
  233. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
  234. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
  235. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
  236. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
  237. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
  238. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
  239. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
  240. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
  241. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
  242. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
  243. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
  244. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
  245. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
  246. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
  247. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
  248. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
  249. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
  250. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
  251. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
  252. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
  253. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
  254. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
  255. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
  256. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
  257. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
  258. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
  259. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
  260. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
  261. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
  262. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
  263. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
  264. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
  265. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
  266. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
  267. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
  268. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
  269. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
  270. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
  271. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
  272. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
  273. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
  274. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
  275. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
  276. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
  277. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
  278. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
  279. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
  280. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
  281. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  282. package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
  283. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
  284. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
  285. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
  286. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
  287. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  288. package/oclif.manifest.json +17 -2
  289. package/package.json +1 -1
@@ -104,6 +104,7 @@ const cred_envelope_1 = require("./cred-envelope");
104
104
  const config_1 = require("./config");
105
105
  const cli_id_1 = require("./cli-id");
106
106
  const harness_context_1 = require("./harness-context");
107
+ const NORMALIZE_SERVER_ORIGIN_RE = /\/+$/;
107
108
  /** Filename for the non-darwin file backend. Parallel to the daemon's
108
109
  * `auth.json`, deliberately distinct so the two binaries never clobber
109
110
  * each other's tokens (CLI holds scope=cli, daemon holds scope=daemon). */
@@ -898,7 +899,7 @@ function normalizeServerOrigin(value) {
898
899
  const parsed = new URL((0, config_1.canonicalizeKnownBaseURL)(value.trim()));
899
900
  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
900
901
  return null;
901
- const pathName = parsed.pathname.replace(/\/+$/, '');
902
+ const pathName = parsed.pathname.replace(NORMALIZE_SERVER_ORIGIN_RE, '');
902
903
  return `${parsed.origin}${pathName}`;
903
904
  }
904
905
  catch {
@@ -46,8 +46,11 @@ export interface BalanceStatus {
46
46
  availableMicros?: number;
47
47
  postedBalanceMicros?: number;
48
48
  /** Committed to work in flight: the gap between "there is a balance" and
49
- * "a new session can start". */
49
+ * "a new session can start". Part of it may be FROZEN rather than in flight;
50
+ * see `heldBreakdown`. */
50
51
  heldMicros?: number;
52
+ /** Only when asked for (`getBalance({ holds: 'breakdown' })`). */
53
+ heldBreakdown?: HeldBreakdown;
51
54
  currency?: string;
52
55
  autoRefillEnabled?: boolean;
53
56
  refillIntervalValue?: number;
@@ -59,6 +62,22 @@ export interface BalanceStatus {
59
62
  periodTokensUsed?: number;
60
63
  periodStartDate?: string;
61
64
  }
65
+ /**
66
+ * What `heldMicros` is made of, from `?holds=breakdown`. Held money is reserved for hosted
67
+ * turns. A turn that is running clears on its own; one that ended without settling is FROZEN: its
68
+ * hold expired into an exception, which billing keeps held until it is cleared
69
+ * (docs/runbooks/billing-exceptions.md). Both used to read as "sessions in flight" (OSK-22651).
70
+ */
71
+ export interface HeldBreakdown {
72
+ inFlightMicros: number;
73
+ inFlightCount: number;
74
+ frozenMicros: number;
75
+ frozenCount: number;
76
+ /** When the oldest frozen hold froze, or null when none is. */
77
+ oldestFrozenAt: string | null;
78
+ /** Held in the counter but accounted for by no hold row. */
79
+ unattributedMicros: number;
80
+ }
62
81
  export interface BalanceTransaction {
63
82
  tokenType?: string;
64
83
  context?: string;
@@ -77,7 +96,9 @@ export interface BalanceHistory {
77
96
  hasNextPage: boolean;
78
97
  }
79
98
  /** The account's current credits, limit and period usage. */
80
- export declare function getBalance(): Promise<BalanceStatus>;
99
+ export declare function getBalance(options?: {
100
+ holds?: 'breakdown';
101
+ }): Promise<BalanceStatus>;
81
102
  export declare function getSkyCodeUsage(workspaceId?: string): Promise<TSkyCodeUsageSnapshot>;
82
103
  /** The personal Sky Code subscription, distinct from published agent-service subscriptions. */
83
104
  export declare function getSkyCodeSubscription(): Promise<TSubscription>;
@@ -126,8 +147,12 @@ export interface WorkspaceBalance {
126
147
  availableMicros: number;
127
148
  postedBalanceMicros: number;
128
149
  heldMicros: number;
150
+ /** Only when asked for (`getWorkspaceBalance(id, { holds: 'breakdown' })`). */
151
+ heldBreakdown?: HeldBreakdown;
129
152
  }
130
- export declare function getWorkspaceBalance(workspaceId: string): Promise<WorkspaceBalance>;
153
+ export declare function getWorkspaceBalance(workspaceId: string, options?: {
154
+ holds?: 'breakdown';
155
+ }): Promise<WorkspaceBalance>;
131
156
  /**
132
157
  * The heading for a workspace balance, naming the workspace the reader is
133
158
  * looking at. It printed the raw id alone — "workspace 038b2251-…" — even
@@ -147,6 +172,11 @@ export declare function workspaceBalanceHeading(workspaceId: string, name: strin
147
172
  * surface exactly.
148
173
  */
149
174
  export declare function workspaceBalanceLines(balance: Pick<WorkspaceBalance, 'availableMicros' | 'postedBalanceMicros' | 'heldMicros'>): string[];
175
+ /**
176
+ * The lines that say what a Held figure is made of, indented under it. Empty when the server did not
177
+ * send a breakdown (an older server ignores the request), so nothing is invented for it.
178
+ */
179
+ export declare function heldBreakdownLines(held: HeldBreakdown | undefined): string[];
150
180
  /**
151
181
  * Render micros as currency. Micros are millionths of a unit, and the balance
152
182
  * that refuses a session is compared against a price — so this rounds to cents
@@ -12,6 +12,7 @@ exports.formatCredits = formatCredits;
12
12
  exports.getWorkspaceBalance = getWorkspaceBalance;
13
13
  exports.workspaceBalanceHeading = workspaceBalanceHeading;
14
14
  exports.workspaceBalanceLines = workspaceBalanceLines;
15
+ exports.heldBreakdownLines = heldBreakdownLines;
15
16
  exports.formatMicros = formatMicros;
16
17
  exports.getBalanceStatement = getBalanceStatement;
17
18
  exports.getWorkspaceBalanceStatement = getWorkspaceBalanceStatement;
@@ -21,9 +22,13 @@ exports.formatCreditsWithUsd = formatCreditsWithUsd;
21
22
  exports.formatTransactionAmount = formatTransactionAmount;
22
23
  exports.formatBalanceTimestamp = formatBalanceTimestamp;
23
24
  const api_fetch_1 = require("./api-fetch");
25
+ const DESCRIBE_CHARGE_RE = /([a-z0-9])([A-Z])/g;
26
+ const DESCRIBE_CHARGE_RE_2 = /[_-]+/g;
27
+ const DESCRIBE_CHARGE_RE_3 = /^./;
24
28
  /** The account's current credits, limit and period usage. */
25
- async function getBalance() {
26
- return (0, api_fetch_1.apiFetch)('/api/balance');
29
+ async function getBalance(options = {}) {
30
+ // Opt-in: the default call is the cheap one every other reader makes.
31
+ return (0, api_fetch_1.apiFetch)(options.holds === 'breakdown' ? '/api/balance?holds=breakdown' : '/api/balance');
27
32
  }
28
33
  async function getSkyCodeUsage(workspaceId) {
29
34
  const path = workspaceId
@@ -93,8 +98,9 @@ function formatCredits(value) {
93
98
  }
94
99
  return Math.round(value).toLocaleString('en-US');
95
100
  }
96
- async function getWorkspaceBalance(workspaceId) {
97
- return (0, api_fetch_1.apiFetch)(`/api/workspaces/${encodeURIComponent(workspaceId)}/billing/balance`);
101
+ async function getWorkspaceBalance(workspaceId, options = {}) {
102
+ const path = `/api/workspaces/${encodeURIComponent(workspaceId)}/billing/balance`;
103
+ return (0, api_fetch_1.apiFetch)(options.holds === 'breakdown' ? `${path}?holds=breakdown` : path);
98
104
  }
99
105
  /**
100
106
  * The heading for a workspace balance, naming the workspace the reader is
@@ -127,6 +133,32 @@ function workspaceBalanceLines(balance) {
127
133
  ` Posted: ${formatCreditsWithUsd(balance.postedBalanceMicros)}`,
128
134
  ];
129
135
  }
136
+ /**
137
+ * The lines that say what a Held figure is made of, indented under it. Empty when the server did not
138
+ * send a breakdown (an older server ignores the request), so nothing is invented for it.
139
+ */
140
+ function heldBreakdownLines(held) {
141
+ if (!held)
142
+ return [];
143
+ const lines = [];
144
+ if (held.inFlightMicros > 0) {
145
+ lines.push(` in flight ${formatCreditsWithUsd(held.inFlightMicros)}` +
146
+ ` (${held.inFlightCount} running or just ended; clears when they settle)`);
147
+ }
148
+ if (held.frozenMicros > 0) {
149
+ const since = held.oldestFrozenAt
150
+ ? `, the oldest since ${held.oldestFrozenAt.slice(0, 10)}`
151
+ : '';
152
+ lines.push(` frozen ${formatCreditsWithUsd(held.frozenMicros)}` +
153
+ ` (${held.frozenCount} turn${held.frozenCount === 1 ? '' : 's'} that ended without settling${since};` +
154
+ ' held until billing clears them)');
155
+ }
156
+ if (held.unattributedMicros > 0) {
157
+ lines.push(` other ${formatCreditsWithUsd(held.unattributedMicros)}` +
158
+ ' (in the held total, not tied to a hold)');
159
+ }
160
+ return lines;
161
+ }
130
162
  /**
131
163
  * Render micros as currency. Micros are millionths of a unit, and the balance
132
164
  * that refuses a session is compared against a price — so this rounds to cents
@@ -223,9 +255,9 @@ function describeCharge(context) {
223
255
  return KNOWN[context];
224
256
  }
225
257
  return context
226
- .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
227
- .replace(/[_-]+/g, ' ')
228
- .replace(/^./, (c) => c.toUpperCase());
258
+ .replace(DESCRIBE_CHARGE_RE, '$1 $2')
259
+ .replace(DESCRIBE_CHARGE_RE_2, ' ')
260
+ .replace(DESCRIBE_CHARGE_RE_3, (c) => c.toUpperCase());
229
261
  }
230
262
  /**
231
263
  * A credit is a MICRO-DOLLAR. This is the bridge between the spend surfaces,
@@ -66,6 +66,8 @@ exports.auditCommitmentTermCoverage = auditCommitmentTermCoverage;
66
66
  const fs = __importStar(require("node:fs"));
67
67
  const path = __importStar(require("node:path"));
68
68
  const data_provider_1 = require("@skrr-ai/data-provider");
69
+ const PARSE_DECLARED_FLAGS_RE = /static\s+override\s+flags\s*=\s*\{/;
70
+ const PARSE_DECLARED_FLAGS_RE_2 = /^['"]?([a-zA-Z][\w-]*)['"]?\s*:/;
69
71
  /** `commitments:attach` → `commitments/attach.ts` */
70
72
  function commandIdToFile(commandsRoot, commandId) {
71
73
  return path.join(commandsRoot, `${commandId.split(':').join(path.sep)}.ts`);
@@ -78,7 +80,7 @@ function commandIdToFile(commandsRoot, commandId) {
78
80
  * depth counting rather than a lazy regex, because flag definitions nest.
79
81
  */
80
82
  function parseDeclaredFlags(source) {
81
- const start = source.search(/static\s+override\s+flags\s*=\s*\{/);
83
+ const start = source.search(PARSE_DECLARED_FLAGS_RE);
82
84
  if (start === -1)
83
85
  return [];
84
86
  const openBrace = source.indexOf('{', start);
@@ -106,7 +108,7 @@ function parseDeclaredFlags(source) {
106
108
  for (const line of block.split('\n')) {
107
109
  const trimmed = line.trim();
108
110
  if (localDepth === 0) {
109
- const match = /^['"]?([a-zA-Z][\w-]*)['"]?\s*:/.exec(trimmed);
111
+ const match = PARSE_DECLARED_FLAGS_RE_2.exec(trimmed);
110
112
  if (match)
111
113
  names.push(match[1]);
112
114
  }
@@ -39,6 +39,7 @@ exports.buildCliSourceMetadata = buildCliSourceMetadata;
39
39
  const fs = __importStar(require("node:fs"));
40
40
  const path = __importStar(require("node:path"));
41
41
  const runtime_context_1 = require("./runtime-context");
42
+ const COMMAND_ID_TO_INVOCATION_RE = /:/g;
42
43
  let cachedVersion = null;
43
44
  function getCliVersion(rootDir) {
44
45
  if (cachedVersion)
@@ -63,7 +64,7 @@ function getCliVersion(rootDir) {
63
64
  return 'unknown';
64
65
  }
65
66
  function commandIdToInvocation(commandId) {
66
- return commandId ? commandId.replace(/:/g, ' ') : 'unknown';
67
+ return commandId ? commandId.replace(COMMAND_ID_TO_INVOCATION_RE, ' ') : 'unknown';
67
68
  }
68
69
  function buildCliSourceMetadata({ commandId, rootDir, }) {
69
70
  const sessionId = optionalString(process.env.OVERSKY_SESSION_ID);
@@ -17,12 +17,16 @@ exports.classifySessionExportError = classifySessionExportError;
17
17
  exports.renderSessionTranscript = renderSessionTranscript;
18
18
  exports.matchAgent = matchAgent;
19
19
  const auth_core_1 = require("@skrr-ai/auth-core");
20
+ const PARSE_GIT_HUB_REPO_RE = /github\.com[:/]([^/\s]+)\/(.+?)(?:\.git)?\/?$/i;
21
+ const CLASSIFY_SESSION_EXPORT_ERROR_RE = /unknown (command|subcommand)|unrecognized|not a valid|did you mean|usage:/i;
22
+ const CLASSIFY_SESSION_EXPORT_ERROR_RE_2 = /(no such|cannot find|could not find|not found|does not exist|unknown)[\s\S]{0,60}session/i;
23
+ const CLASSIFY_SESSION_EXPORT_ERROR_RE_3 = /session[\s\S]{0,60}(no such|not found|does not exist|missing|unknown)/i;
20
24
  /** `owner/name` from any GitHub remote URL shape. */
21
25
  function parseGitHubRepo(remoteUrl) {
22
26
  if (!remoteUrl || !remoteUrl.trim()) {
23
27
  return null;
24
28
  }
25
- const match = remoteUrl.trim().match(/github\.com[:/]([^/\s]+)\/(.+?)(?:\.git)?\/?$/i);
29
+ const match = remoteUrl.trim().match(PARSE_GIT_HUB_REPO_RE);
26
30
  if (!match) {
27
31
  return null;
28
32
  }
@@ -118,8 +122,9 @@ function classifySessionExportError(err) {
118
122
  // "session <id> not found" is an unknown session; "unknown command: session"
119
123
  // is an engine that predates the contract. Both contain the words 'session'
120
124
  // and 'unknown', so the command-not-understood phrasing is excluded FIRST.
121
- const commandNotUnderstood = /unknown (command|subcommand)|unrecognized|not a valid|did you mean|usage:/i.test(stderr);
122
- const sessionMissing = /(no such|cannot find|could not find|not found|does not exist|unknown)[\s\S]{0,60}session/i.test(stderr) || /session[\s\S]{0,60}(no such|not found|does not exist|missing|unknown)/i.test(stderr);
125
+ const commandNotUnderstood = CLASSIFY_SESSION_EXPORT_ERROR_RE.test(stderr);
126
+ const sessionMissing = CLASSIFY_SESSION_EXPORT_ERROR_RE_2.test(stderr) ||
127
+ CLASSIFY_SESSION_EXPORT_ERROR_RE_3.test(stderr);
123
128
  if (!commandNotUnderstood && sessionMissing) {
124
129
  return { kind: 'unknown-session', detail: stderr || (err.message ?? '') };
125
130
  }
@@ -38,6 +38,20 @@ exports.auditCommands = auditCommands;
38
38
  const fs = __importStar(require("node:fs"));
39
39
  const path = __importStar(require("node:path"));
40
40
  const usage_discovery_1 = require("./usage-discovery");
41
+ const READ_COMMAND_SOURCE_RE = /\/\*[\s\S]*?\*\//g;
42
+ const READ_COMMAND_SOURCE_RE_2 = /\/\/.*$/gm;
43
+ const READ_COMMAND_SOURCE_RE_3 = /^export\s*\{\s*default\s*\}\s*from\s*['"](\.{1,2}\/[^'"]+)['"]\s*;?$/;
44
+ const AUDIT_COMMANDS_RE = /['"]from-json['"]/;
45
+ const AUDIT_COMMANDS_RE_2 = /json:\s*Flags\.boolean/;
46
+ const AUDIT_COMMANDS_RE_3 = /Args\.string\(\{[\s\S]*?\}\)/g;
47
+ const AUDIT_COMMANDS_RE_4 = /ignoreStdin:\s*true/;
48
+ const AUDIT_COMMANDS_RE_5 = /\.\.\.[\w.]*Flags\b/;
49
+ const AUDIT_COMMANDS_RE_6 = /static (?:override )?description\s*=/;
50
+ const AUDIT_COMMANDS_RE_7 = /this\.error\(/;
51
+ const AUDIT_COMMANDS_RE_8 = /:archive$/;
52
+ const AUDIT_COMMANDS_RE_9 = /:/g;
53
+ const COMMAND_ID_FROM_RELATIVE_PATH_RE = /\.ts$/;
54
+ const COMMAND_ID_FROM_RELATIVE_PATH_RE_2 = /[/\\]/g;
41
55
  const provided = (note) => ({ status: 'provided', note });
42
56
  const missing = (note) => ({ status: 'missing', note });
43
57
  const notApplicable = (note) => ({
@@ -469,10 +483,10 @@ const AGENT_CRITICAL_COMMANDS = [
469
483
  function readCommandSource(file) {
470
484
  const source = fs.readFileSync(file, 'utf8');
471
485
  const code = source
472
- .replace(/\/\*[\s\S]*?\*\//g, '')
473
- .replace(/\/\/.*$/gm, '')
486
+ .replace(READ_COMMAND_SOURCE_RE, '')
487
+ .replace(READ_COMMAND_SOURCE_RE_2, '')
474
488
  .trim();
475
- const alias = code.match(/^export\s*\{\s*default\s*\}\s*from\s*['"](\.{1,2}\/[^'"]+)['"]\s*;?$/);
489
+ const alias = code.match(READ_COMMAND_SOURCE_RE_3);
476
490
  if (!alias)
477
491
  return source;
478
492
  const target = path.resolve(path.dirname(file), alias[1]);
@@ -544,13 +558,13 @@ function auditCommands({ rootDir, manifest, }) {
544
558
  const source = readCommandSource(file);
545
559
  const command = commandIdFromRelativePath(rel);
546
560
  sourceCommandIds.add(command);
547
- const hasFromJson = /['"]from-json['"]/.test(source);
548
- const hasJson = /json:\s*Flags\.boolean/.test(source);
561
+ const hasFromJson = AUDIT_COMMANDS_RE.test(source);
562
+ const hasJson = AUDIT_COMMANDS_RE_2.test(source);
549
563
  if (hasFromJson)
550
564
  fromJsonCommands += 1;
551
- for (const block of source.matchAll(/Args\.string\(\{[\s\S]*?\}\)/g)) {
565
+ for (const block of source.matchAll(AUDIT_COMMANDS_RE_3)) {
552
566
  argsStringBlocks += 1;
553
- if (!/ignoreStdin:\s*true/.test(block[0])) {
567
+ if (!AUDIT_COMMANDS_RE_4.test(block[0])) {
554
568
  issues.push({
555
569
  code: 'ARG_IMPLICIT_STDIN_ENABLED',
556
570
  severity: 'error',
@@ -566,7 +580,7 @@ function auditCommands({ rootDir, manifest, }) {
566
580
  if (!manifest && isEnforcedDomain(command)) {
567
581
  // A spread of a shared flag set (`...paginatedExportFlags(...)`) may carry
568
582
  // --json from another file; only the manifest can tell, so do not guess.
569
- const spreadsSharedFlags = /\.\.\.[\w.]*Flags\b/.test(source);
583
+ const spreadsSharedFlags = AUDIT_COMMANDS_RE_5.test(source);
570
584
  if (!hasJson && !spreadsSharedFlags && isMachineRelevantCommand(command)) {
571
585
  issues.push({
572
586
  code: 'JSON_SUCCESS_OUTPUT_MISSING',
@@ -576,7 +590,7 @@ function auditCommands({ rootDir, manifest, }) {
576
590
  message: 'Machine-relevant command has no --json success-output flag. Keep human-only commands intentional.',
577
591
  });
578
592
  }
579
- if (!/static (?:override )?description\s*=/.test(source)) {
593
+ if (!AUDIT_COMMANDS_RE_6.test(source)) {
580
594
  issues.push({
581
595
  code: 'COMMAND_DESCRIPTION_MISSING',
582
596
  severity: 'error',
@@ -595,7 +609,7 @@ function auditCommands({ rootDir, manifest, }) {
595
609
  message: 'Commands that accept --from-json must also expose --json for machine output.',
596
610
  });
597
611
  }
598
- if (hasJson && /this\.error\(/.test(source)) {
612
+ if (hasJson && AUDIT_COMMANDS_RE_7.test(source)) {
599
613
  issues.push({
600
614
  code: 'LOCAL_ERROR_RELIES_ON_BASE_JSON_TRANSLATION',
601
615
  severity: 'warning',
@@ -640,7 +654,7 @@ function auditCommands({ rootDir, manifest, }) {
640
654
  code: 'VERB_GRAMMAR_INVERSE_AS_FLAG',
641
655
  severity: 'warning',
642
656
  command: id,
643
- message: `Naming grammar: a state flip is its own verb (\`${id.replace(/:archive$/, ':unarchive').replace(/:/g, ' ')}\`), not --unarchive on the forward verb. Keep the flag as a deprecated alias when adding the verb.`,
657
+ message: `Naming grammar: a state flip is its own verb (\`${id.replace(AUDIT_COMMANDS_RE_8, ':unarchive').replace(AUDIT_COMMANDS_RE_9, ' ')}\`), not --unarchive on the forward verb. Keep the flag as a deprecated alias when adding the verb.`,
644
658
  });
645
659
  }
646
660
  }
@@ -689,7 +703,9 @@ function walkTypeScriptFiles(dir) {
689
703
  return files.sort();
690
704
  }
691
705
  function commandIdFromRelativePath(relativePath) {
692
- return relativePath.replace(/\.ts$/, '').replace(/[/\\]/g, ':');
706
+ return relativePath
707
+ .replace(COMMAND_ID_FROM_RELATIVE_PATH_RE, '')
708
+ .replace(COMMAND_ID_FROM_RELATIVE_PATH_RE_2, ':');
693
709
  }
694
710
  function hasJsonFlag(flags) {
695
711
  return Boolean(flags && typeof flags === 'object' && 'json' in flags);
@@ -40,6 +40,9 @@ exports.visibleCommandEntries = visibleCommandEntries;
40
40
  exports.searchVisibleCommandEntries = searchVisibleCommandEntries;
41
41
  const fs = __importStar(require("node:fs"));
42
42
  const path = __importStar(require("node:path"));
43
+ const COMMAND_KEY_RE = /\s+/g;
44
+ const VISIBLE_COMMAND_ENTRIES_RE = /:/g;
45
+ const SEARCH_VISIBLE_COMMAND_ENTRIES_RE = /\s+/;
43
46
  function manifestPath(rootDir) {
44
47
  return path.join(rootDir, 'oclif.manifest.json');
45
48
  }
@@ -49,7 +52,7 @@ function loadCommandManifest(rootDir) {
49
52
  return JSON.parse(raw);
50
53
  }
51
54
  function commandKey(command) {
52
- return command.trim().replace(/\s+/g, ':');
55
+ return command.trim().replace(COMMAND_KEY_RE, ':');
53
56
  }
54
57
  function visibleCommandEntries(manifest) {
55
58
  const commands = manifest.commands ?? {};
@@ -58,7 +61,7 @@ function visibleCommandEntries(manifest) {
58
61
  .sort(([a], [b]) => a.localeCompare(b))
59
62
  .map(([id, command]) => ({
60
63
  id,
61
- command: id.replace(/:/g, ' '),
64
+ command: id.replace(VISIBLE_COMMAND_ENTRIES_RE, ' '),
62
65
  description: command.description ?? '',
63
66
  aliases: command.aliases ?? [],
64
67
  args: command.args ?? {},
@@ -73,7 +76,7 @@ function visibleCommandEntries(manifest) {
73
76
  * also makes the same semantics available to future catalog surfaces.
74
77
  */
75
78
  function searchVisibleCommandEntries(entries, query) {
76
- const terms = query?.trim().toLowerCase().split(/\s+/).filter(Boolean) ?? [];
79
+ const terms = query?.trim().toLowerCase().split(SEARCH_VISIBLE_COMMAND_ENTRIES_RE).filter(Boolean) ?? [];
77
80
  if (terms.length === 0)
78
81
  return entries;
79
82
  return entries.filter((entry) => {
@@ -21,6 +21,7 @@ exports.describeEventSources = describeEventSources;
21
21
  exports.quietHoursInputProblem = quietHoursInputProblem;
22
22
  exports.describeQuietHours = describeQuietHours;
23
23
  exports.describeQuietHoursEnd = describeQuietHoursEnd;
24
+ const PARSE_MAX_NUDGES_FLAG_RE = /^\d+$/;
24
25
  /** What the owner can type for `--max-nudges`, as `--help` prints it. */
25
26
  exports.MAX_NUDGES_FLAG_HELP = 'Daily limit on messages that interrupt you: a whole number from 0 up (0 mutes it: ' +
26
27
  'it never contacts you) or "unlimited" to remove the limit. Left unset it is unlimited';
@@ -34,7 +35,7 @@ function parseMaxNudgesFlag(raw) {
34
35
  const value = raw.trim().toLowerCase();
35
36
  if (value === 'unlimited')
36
37
  return null;
37
- if (/^\d+$/.test(value)) {
38
+ if (PARSE_MAX_NUDGES_FLAG_RE.test(value)) {
38
39
  const parsed = Number(value);
39
40
  if (Number.isSafeInteger(parsed))
40
41
  return parsed;
@@ -33,6 +33,15 @@ function eventWakeLines(caps) {
33
33
  ` (${gap.impact === 'evidence_read' ? 'needed by' : 'blocks'} ${(gap.events ?? []).join(', ')})`)
34
34
  .join('; ')} — the routing GitHub installation does not hold the permission`);
35
35
  }
36
+ if ((caps.selectedEvents ?? []).length) {
37
+ lines.push(' selected events:');
38
+ for (const item of caps.selectedEvents) {
39
+ const name = `${item.source ?? 'source'}: ${item.event ?? '(incomplete selection)'}`;
40
+ lines.push(item.verdict === 'set_aside'
41
+ ? ` ${name} — set aside: ${item.detail ?? item.reason ?? 'it cannot wake this Commitment'}`
42
+ : ` ${name} — can wake`);
43
+ }
44
+ }
36
45
  if (caps.degradedReason)
37
46
  lines.push(` degraded: ${caps.degradedReason}`);
38
47
  return lines;
@@ -7,6 +7,8 @@ exports.deliveryInput = deliveryInput;
7
7
  exports.renderExecutionReceipt = renderExecutionReceipt;
8
8
  exports.renderExecutionReceiptQuarterlyMetrics = renderExecutionReceiptQuarterlyMetrics;
9
9
  const data_provider_1 = require("@skrr-ai/data-provider");
10
+ const DELIVERY_INPUT_RE = /-/g;
11
+ const RENDER_EXECUTION_RECEIPT_RE = /^[A-Za-z0-9_.:-]+$/;
10
12
  exports.COMMITMENT_DELIVERY_CHOICES = [
11
13
  'report-only',
12
14
  'local-patch',
@@ -29,8 +31,8 @@ function normalizeTaskReviewPolicy(value) {
29
31
  return value;
30
32
  }
31
33
  function deliveryInput(mode, options = {}) {
32
- const normalized = mode.replace(/-/g, '_');
33
- if (!exports.COMMITMENT_DELIVERY_CHOICES.some((choice) => choice.replace(/-/g, '_') === normalized)) {
34
+ const normalized = mode.replace(DELIVERY_INPUT_RE, '_');
35
+ if (!exports.COMMITMENT_DELIVERY_CHOICES.some((choice) => choice.replace(DELIVERY_INPUT_RE, '_') === normalized)) {
34
36
  throw new Error(`Unknown delivery. Choose ${exports.COMMITMENT_DELIVERY_CHOICES.join(', ')}.`);
35
37
  }
36
38
  return {
@@ -66,7 +68,7 @@ function renderExecutionReceipt(receipt, log, verbose = false) {
66
68
  // there) is not an action either: the actor is printed alone.
67
69
  const narrative = [receipt.summary, receipt.blocker?.summary].filter(Boolean);
68
70
  const reason = receipt.nextActor?.reason;
69
- const action = reason && !narrative.includes(reason) && !/^[A-Za-z0-9_.:-]+$/.test(reason.trim())
71
+ const action = reason && !narrative.includes(reason) && !RENDER_EXECUTION_RECEIPT_RE.test(reason.trim())
70
72
  ? reason
71
73
  : '';
72
74
  if (receipt.nextActor)
@@ -24,6 +24,7 @@ exports.appendUnique = appendUnique;
24
24
  exports.removeByKey = removeByKey;
25
25
  exports.renderCommitmentTerms = renderCommitmentTerms;
26
26
  const commitments_1 = require("./commitments");
27
+ const PARSE_SENSOR_REF_RE = /^(trigger|ingress):(.+)$/;
27
28
  /**
28
29
  * Parse a sensor reference. Accepts `ingress:<id>` / `trigger:<id>`, or a bare
29
30
  * id which is treated as an ingress — the common case, and the server rejects a
@@ -33,7 +34,7 @@ function parseSensorRef(input) {
33
34
  const raw = String(input || '').trim();
34
35
  if (!raw)
35
36
  throw new Error('Sensor reference is empty.');
36
- const match = /^(trigger|ingress):(.+)$/.exec(raw);
37
+ const match = PARSE_SENSOR_REF_RE.exec(raw);
37
38
  if (match) {
38
39
  return { kind: match[1], refId: match[2] };
39
40
  }
@@ -732,6 +732,14 @@ export type EventWakeCapabilities = {
732
732
  impact?: string;
733
733
  }[];
734
734
  degradedReason?: string;
735
+ /** What the author selected through `config.events`, and which selections were set aside (OSK-22600). */
736
+ selectedEvents?: {
737
+ source?: string;
738
+ event?: string | null;
739
+ verdict?: 'can_wake' | 'set_aside';
740
+ reason?: string;
741
+ detail?: string;
742
+ }[];
735
743
  };
736
744
  /** Shape of `GET /:id/wake-capabilities`. */
737
745
  export interface CommitmentWakeCapabilities {
@@ -745,6 +753,11 @@ export interface CommitmentWakeCapabilities {
745
753
  kind?: string;
746
754
  source?: string;
747
755
  }>;
756
+ /** Eligible capabilities the server withheld, with why: an attached sensor that no longer exists (OSK-22591). */
757
+ unavailableCapabilities?: Array<{
758
+ id: string;
759
+ reason?: string;
760
+ }>;
748
761
  /**
749
762
  * The event-wake facts `trigger-status` reports, verbatim, plus the Agent's own enabled event
750
763
  * waits. Absent from a server that predates it, or when the status could not be read: "no
@@ -95,6 +95,10 @@ const commitment_attention_copy_1 = require("./commitment-attention-copy");
95
95
  const instruction_input_1 = require("./instruction-input");
96
96
  const format_1 = require("./format");
97
97
  const triggers_1 = require("./triggers");
98
+ const PARSE_INTERVAL_TO_MS_RE = /^\d+(\.\d+)?$/;
99
+ const DESCRIBE_EVIDENCE_HEALTH_RE = /_indeterminate$/;
100
+ const STANDSTILL_FIX_FOR_READ_RE = /^[A-Za-z0-9_-]{1,80}$/;
101
+ const DESCRIBE_OPERATION_RE = /^lifecycle_([a-z_]+)$/;
98
102
  /** Derived from the installed compatibility vocabulary so the CLI remains
99
103
  * safe even while data-provider and CLI packages roll out separately. */
100
104
  exports.COMMITMENT_AUTHORABLE_CADENCE_MODES = data_provider_2.COMMITMENT_CADENCE_MODES.filter((mode) => mode !== 'sampled');
@@ -660,7 +664,7 @@ function parseIntervalToMs(input) {
660
664
  if (!raw)
661
665
  throw new Error('Empty interval. Use a form like "15m", "6h", "1d", or "360".');
662
666
  let minutes;
663
- if (/^\d+(\.\d+)?$/.test(raw)) {
667
+ if (PARSE_INTERVAL_TO_MS_RE.test(raw)) {
664
668
  minutes = Number(raw);
665
669
  }
666
670
  else {
@@ -832,7 +836,7 @@ function describeEvidenceHealth(health, criteriaCount) {
832
836
  // The coarse `*_indeterminate` reasons ride alongside a precise one and say
833
837
  // only "something was indeterminate", so showing them crowds out the reason
834
838
  // that names what to do.
835
- const reasons = (health?.reasons || []).filter((r) => !/_indeterminate$/.test(r));
839
+ const reasons = (health?.reasons || []).filter((r) => !DESCRIBE_EVIDENCE_HEALTH_RE.test(r));
836
840
  const detail = reasons.length ? ` (${reasons.join(', ')})` : '';
837
841
  if (state === 'unevidenceable_criteria') {
838
842
  // This is not the same problem as criteria that exist but cannot be
@@ -1104,7 +1108,7 @@ function standstillFixForRead(standstill, commitmentId) {
1104
1108
  if (!(0, data_provider_2.isLegacyStandstillReason)(standstill.reason))
1105
1109
  return standstill.fix;
1106
1110
  const fix = (0, data_provider_2.describeStandstill)(standstill.reason).fix ?? undefined;
1107
- if (!fix || !commitmentId || !/^[A-Za-z0-9_-]{1,80}$/.test(commitmentId))
1111
+ if (!fix || !commitmentId || !STANDSTILL_FIX_FOR_READ_RE.test(commitmentId))
1108
1112
  return fix;
1109
1113
  return fix.split('<commitment>').join(commitmentId);
1110
1114
  }
@@ -1143,6 +1147,16 @@ function describeExecutorBlocked(commitment) {
1143
1147
  : reason || 'blocked';
1144
1148
  return `${label}${until ? ` until ${until}` : ''}`;
1145
1149
  }
1150
+ /**
1151
+ * A Run waiting for a stopped machine cannot be checked for the one thing that
1152
+ * fails it after the start: its working directory must sit inside a Git
1153
+ * repository with a commit, or the daemon refuses the Run with
1154
+ * `EXECUTION_ISOLATION_UNAVAILABLE`. Activation Preflight asks a daemon that is
1155
+ * online and answers `indeterminate` for one that is stopped, so the person who
1156
+ * pays for the start learned of it only afterwards (OSK-22386). The sentence is
1157
+ * conditional on purpose: a runtime with its own sandbox workspace is fine.
1158
+ */
1159
+ const STOPPED_MACHINE_ISOLATION_NOTE = ' If its working directory is not inside a git repository with a commit, each Run is refused (EXECUTION_ISOLATION_UNAVAILABLE); that cannot be checked while the machine is stopped.';
1146
1160
  /**
1147
1161
  * What happens next to a stopped Dedicated machine, said only as far as the
1148
1162
  * server told us (OSK-22392). `wake: 'owner'` is a `manual` power policy:
@@ -1151,11 +1165,12 @@ function describeExecutorBlocked(commitment) {
1151
1165
  * honest sentence makes no promise.
1152
1166
  */
1153
1167
  function describeStoppedMachine(wake) {
1154
- if (wake === 'owner')
1155
- return 'executor machine is stopped and its power policy is manual, so it waits until you start it';
1156
- if (wake === 'automatic')
1157
- return 'executor machine is stopped and will be started for the work';
1158
- return 'executor machine is stopped';
1168
+ const base = wake === 'owner'
1169
+ ? 'executor machine is stopped and its power policy is manual, so it waits until you start it'
1170
+ : wake === 'automatic'
1171
+ ? 'executor machine is stopped and will be started for the work'
1172
+ : 'executor machine is stopped';
1173
+ return `${base}.${STOPPED_MACHINE_ISOLATION_NOTE}`;
1159
1174
  }
1160
1175
  /**
1161
1176
  * The Operation line's wording for a Commitment that is not running because of its lifecycle.
@@ -1184,7 +1199,7 @@ function describeOperation(operation, reason) {
1184
1199
  // while `show` said `ready` seconds later (OSK-21105).
1185
1200
  if (reason === 'operation_read_unavailable')
1186
1201
  return 'not read yet — no status is recorded for the current contract, which is not a failure; `skrr commitments show` reads it live';
1187
- const lifecycle = typeof reason === 'string' ? /^lifecycle_([a-z_]+)$/.exec(reason) : null;
1202
+ const lifecycle = typeof reason === 'string' ? DESCRIBE_OPERATION_RE.exec(reason) : null;
1188
1203
  if (!lifecycle) {
1189
1204
  const words = operationReasonWords(reason);
1190
1205
  return `${operation ?? 'blocked'}${reason ? ` — ${reason}${words ? `: ${words}` : ''}` : ''}`;
@@ -37,6 +37,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
37
37
  const data_provider_2 = require("@skrr-ai/data-provider");
38
38
  const format_1 = require("./format");
39
39
  const triggers_1 = require("./triggers");
40
+ const RENDER_COMPASS_TRACE_RE = /_/g;
40
41
  exports.COMPASS_STATUSES = ['active', 'archived'];
41
42
  const base = (id) => `/api/compasses/${encodeURIComponent(id)}`;
42
43
  exports.compassApi = {
@@ -351,7 +352,7 @@ function renderCompassTrace(trace, log) {
351
352
  }
352
353
  (0, format_1.renderTable)(trace.events.map((event) => ({
353
354
  when: shortDate(event.occurredAt),
354
- type: event.type.replace(/_/g, ' '),
355
+ type: event.type.replace(RENDER_COMPASS_TRACE_RE, ' '),
355
356
  status: event.status ?? '—',
356
357
  event: event.summary ?? '—',
357
358
  commitment: String(event.references?.commitmentId ?? '—'),
@@ -42,6 +42,7 @@ exports.completionCandidates = completionCandidates;
42
42
  const fs = __importStar(require("node:fs/promises"));
43
43
  const path = __importStar(require("node:path"));
44
44
  const node_crypto_1 = require("node:crypto");
45
+ const CREATE_COMPLETION_CACHE_SCOPE_RE = /\/+$/;
45
46
  const INDEX_VERSION = 1;
46
47
  const CACHE_VERSION = 2;
47
48
  /** Bind references to the command's resolved context, never a stored login. */
@@ -52,7 +53,7 @@ function createCompletionCacheScope(context) {
52
53
  const hash = (value) => (0, node_crypto_1.createHash)('sha256').update(value).digest('hex');
53
54
  // The adapter appends API paths to the full request base. Preserve deployment
54
55
  // prefixes, queries and fragments; normalize its trailing-slash handling.
55
- const requestBase = new URL(context.baseURL.replace(/\/+$/, '')).href;
56
+ const requestBase = new URL(context.baseURL.replace(CREATE_COMPLETION_CACHE_SCOPE_RE, '')).href;
56
57
  return {
57
58
  namespace: hash(JSON.stringify([
58
59
  path.resolve(context.configRoot), context.profile,