@skrr-ai/cli 0.1.92 → 0.1.94

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 (323) hide show
  1. package/dist/base-command.d.ts +44 -0
  2. package/dist/base-command.js +96 -0
  3. package/dist/commands/agents/badge.d.ts +41 -0
  4. package/dist/commands/agents/badge.js +158 -0
  5. package/dist/commands/agents/create.d.ts +24 -0
  6. package/dist/commands/agents/create.js +212 -0
  7. package/dist/commands/agents/embed.d.ts +20 -0
  8. package/dist/commands/agents/embed.js +61 -0
  9. package/dist/commands/agents/operating-plan.d.ts +11 -0
  10. package/dist/commands/agents/operating-plan.js +54 -0
  11. package/dist/commands/agents/roles/example.d.ts +11 -0
  12. package/dist/commands/agents/roles/example.js +30 -0
  13. package/dist/commands/{commitments/mode.d.ts → agents/roles/export.d.ts} +5 -5
  14. package/dist/commands/agents/roles/export.js +81 -0
  15. package/dist/commands/agents/roles/install.d.ts +12 -0
  16. package/dist/commands/agents/roles/install.js +48 -0
  17. package/dist/commands/agents/roles/list.d.ts +11 -0
  18. package/dist/commands/agents/roles/list.js +36 -0
  19. package/dist/commands/agents/roles/preview.d.ts +14 -0
  20. package/dist/commands/agents/roles/preview.js +49 -0
  21. package/dist/commands/agents/roles/withdraw.d.ts +13 -0
  22. package/dist/commands/agents/roles/withdraw.js +43 -0
  23. package/dist/commands/agents/share.d.ts +27 -0
  24. package/dist/commands/agents/share.js +100 -0
  25. package/dist/commands/agents/vanity.d.ts +21 -0
  26. package/dist/commands/agents/vanity.js +77 -0
  27. package/dist/commands/agents/visibility.d.ts +21 -1
  28. package/dist/commands/agents/visibility.js +112 -0
  29. package/dist/commands/commands.d.ts +1 -0
  30. package/dist/commands/commands.js +22 -9
  31. package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.d.ts +5 -7
  32. package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.js +13 -15
  33. package/dist/commands/commitments/cost.d.ts +1 -1
  34. package/dist/commands/commitments/cost.js +1 -1
  35. package/dist/commands/commitments/create.d.ts +0 -7
  36. package/dist/commands/commitments/create.js +9 -98
  37. package/dist/commands/commitments/delivery.js +3 -21
  38. package/dist/commands/commitments/doctor.js +28 -27
  39. package/dist/commands/commitments/effective-policy.js +5 -36
  40. package/dist/commands/commitments/evaluations.d.ts +15 -0
  41. package/dist/commands/commitments/evaluations.js +54 -0
  42. package/dist/commands/commitments/pack/activate.d.ts +11 -0
  43. package/dist/commands/commitments/pack/activate.js +22 -0
  44. package/dist/commands/commitments/pack/bind.js +1 -1
  45. package/dist/commands/commitments/remediate.js +2 -5
  46. package/dist/commands/commitments/show.js +1 -1
  47. package/dist/commands/commitments/update.js +9 -9
  48. package/dist/commands/commitments/wake-capabilities.d.ts +1 -3
  49. package/dist/commands/commitments/wake-capabilities.js +5 -21
  50. package/dist/commands/earnings/attributions.d.ts +17 -0
  51. package/dist/commands/earnings/attributions.js +82 -0
  52. package/dist/commands/earnings/index.js +2 -1
  53. package/dist/commands/generate-recovery-code.js +4 -3
  54. package/dist/commands/github/allow-tools.d.ts +1 -0
  55. package/dist/commands/github/app/install.d.ts +1 -0
  56. package/dist/commands/github/app/status.d.ts +1 -0
  57. package/dist/commands/github/connect.d.ts +1 -0
  58. package/dist/commands/github/connections.d.ts +1 -0
  59. package/dist/commands/github/disconnect.d.ts +1 -0
  60. package/dist/commands/github/finalize.d.ts +1 -0
  61. package/dist/commands/github/reconnect.d.ts +1 -0
  62. package/dist/commands/github/run.d.ts +1 -0
  63. package/dist/commands/github/tools.d.ts +1 -0
  64. package/dist/commands/integrations/connections/connect.d.ts +1 -0
  65. package/dist/commands/integrations/connections/disconnect.d.ts +1 -0
  66. package/dist/commands/integrations/connections/finalize.d.ts +1 -0
  67. package/dist/commands/integrations/connections/list.d.ts +1 -0
  68. package/dist/commands/integrations/connections/reconnect.d.ts +1 -0
  69. package/dist/commands/integrations/execute.d.ts +1 -0
  70. package/dist/commands/integrations/search.d.ts +1 -0
  71. package/dist/commands/integrations/toolkits.d.ts +1 -0
  72. package/dist/commands/integrations/tools/allow.d.ts +1 -0
  73. package/dist/commands/integrations/tools/list.d.ts +1 -0
  74. package/dist/commands/login.js +12 -0
  75. package/dist/commands/machines/dedicated/logs.d.ts +19 -0
  76. package/dist/commands/machines/dedicated/logs.js +103 -0
  77. package/dist/commands/machines/dedicated/power/set.js +1 -1
  78. package/dist/commands/open.d.ts +24 -0
  79. package/dist/commands/open.js +74 -0
  80. package/dist/commands/projects/archive.d.ts +1 -0
  81. package/dist/commands/projects/archive.js +23 -0
  82. package/dist/commands/projects/delete.d.ts +1 -0
  83. package/dist/commands/projects/delete.js +23 -0
  84. package/dist/commands/projects/list.d.ts +3 -0
  85. package/dist/commands/projects/list.js +12 -2
  86. package/dist/commands/spaces/actions/add.js +4 -3
  87. package/dist/commands/spaces/actions/available.js +3 -2
  88. package/dist/commands/spaces/actions/list.js +5 -4
  89. package/dist/commands/spaces/actions/replace.js +6 -5
  90. package/dist/commands/spaces/archive.js +3 -2
  91. package/dist/commands/spaces/auto-executor/preview.js +4 -3
  92. package/dist/commands/spaces/auto-executor/run.js +4 -3
  93. package/dist/commands/spaces/auto-executor/runs.js +3 -2
  94. package/dist/commands/spaces/auto-executor/update.js +4 -3
  95. package/dist/commands/spaces/bootstrap.js +3 -2
  96. package/dist/commands/spaces/briefs/delete.js +3 -2
  97. package/dist/commands/spaces/briefs/get.js +3 -2
  98. package/dist/commands/spaces/briefs/list.js +3 -2
  99. package/dist/commands/spaces/briefs/set.js +5 -4
  100. package/dist/commands/spaces/capacity.js +5 -4
  101. package/dist/commands/spaces/conversations.js +3 -2
  102. package/dist/commands/spaces/cycles/create.js +3 -2
  103. package/dist/commands/spaces/cycles/graph.js +2 -1
  104. package/dist/commands/spaces/cycles/list.js +3 -2
  105. package/dist/commands/spaces/cycles/settings.js +4 -3
  106. package/dist/commands/spaces/cycles/show.js +3 -2
  107. package/dist/commands/spaces/cycles/update.js +3 -2
  108. package/dist/commands/spaces/delete.js +4 -3
  109. package/dist/commands/spaces/expertise-suggestions.js +4 -3
  110. package/dist/commands/spaces/files/delete.js +3 -2
  111. package/dist/commands/spaces/files/folders/create.js +3 -2
  112. package/dist/commands/spaces/files/folders/delete.js +3 -2
  113. package/dist/commands/spaces/files/folders/list.js +3 -2
  114. package/dist/commands/spaces/files/folders/update.js +3 -2
  115. package/dist/commands/spaces/files/list.js +3 -2
  116. package/dist/commands/spaces/files/move.js +3 -2
  117. package/dist/commands/spaces/files/rename.js +3 -2
  118. package/dist/commands/spaces/files/upload.js +6 -5
  119. package/dist/commands/spaces/github-automations/set.js +3 -2
  120. package/dist/commands/spaces/github-automations/show.js +3 -2
  121. package/dist/commands/spaces/goals.js +2 -1
  122. package/dist/commands/spaces/heartbeats/create.js +4 -3
  123. package/dist/commands/spaces/heartbeats/delete.js +4 -3
  124. package/dist/commands/spaces/heartbeats/list.js +4 -3
  125. package/dist/commands/spaces/heartbeats/status.js +3 -2
  126. package/dist/commands/spaces/heartbeats/update.js +4 -3
  127. package/dist/commands/spaces/insights.js +5 -4
  128. package/dist/commands/spaces/labels/add.js +4 -3
  129. package/dist/commands/spaces/labels/list.js +2 -1
  130. package/dist/commands/spaces/labels/remove.js +4 -3
  131. package/dist/commands/spaces/list.d.ts +3 -0
  132. package/dist/commands/spaces/list.js +11 -2
  133. package/dist/commands/spaces/live/cards/create.js +3 -2
  134. package/dist/commands/spaces/live/cards/list.js +3 -2
  135. package/dist/commands/spaces/live/cards/reorder.js +7 -2
  136. package/dist/commands/spaces/live/scene.js +4 -3
  137. package/dist/commands/spaces/members/add.js +7 -6
  138. package/dist/commands/spaces/members/list.js +4 -3
  139. package/dist/commands/spaces/members/remove.js +7 -6
  140. package/dist/commands/spaces/move.js +3 -2
  141. package/dist/commands/spaces/pin.js +5 -4
  142. package/dist/commands/spaces/preferences/show.js +4 -3
  143. package/dist/commands/spaces/preferences/tabs.js +4 -3
  144. package/dist/commands/spaces/revisions.js +3 -2
  145. package/dist/commands/spaces/room/ensure.js +5 -4
  146. package/dist/commands/spaces/room/messages.js +3 -2
  147. package/dist/commands/spaces/room/show.js +5 -4
  148. package/dist/commands/spaces/skills/add.js +4 -3
  149. package/dist/commands/spaces/skills/list.js +3 -2
  150. package/dist/commands/spaces/skills/pin.js +4 -3
  151. package/dist/commands/spaces/skills/remove.js +4 -3
  152. package/dist/commands/spaces/snapshot.js +3 -2
  153. package/dist/commands/spaces/states/archive.js +3 -2
  154. package/dist/commands/spaces/states/create.js +3 -2
  155. package/dist/commands/spaces/states/list.js +3 -2
  156. package/dist/commands/spaces/states/reorder.js +2 -1
  157. package/dist/commands/spaces/states/update.js +3 -2
  158. package/dist/commands/spaces/summary.js +4 -3
  159. package/dist/commands/spaces/tasks.d.ts +3 -0
  160. package/dist/commands/spaces/tasks.js +14 -3
  161. package/dist/commands/spaces/triggers/delete.js +5 -4
  162. package/dist/commands/spaces/triggers/set.js +4 -3
  163. package/dist/commands/spaces/triggers/show.js +4 -3
  164. package/dist/commands/spaces/unarchive.js +3 -2
  165. package/dist/commands/spaces/update.js +5 -4
  166. package/dist/commands/spaces/views/create.js +3 -2
  167. package/dist/commands/spaces/views/list.js +3 -2
  168. package/dist/commands/spaces/views/reorder.js +6 -3
  169. package/dist/commands/spaces/views/subscribe.js +2 -1
  170. package/dist/commands/spaces/views/subscriptions.js +1 -0
  171. package/dist/commands/spaces/views/unsubscribe.js +2 -1
  172. package/dist/commands/spaces/widgets/add.js +4 -3
  173. package/dist/commands/spaces/widgets/list.js +3 -2
  174. package/dist/commands/spaces/widgets/remove.js +5 -4
  175. package/dist/commands/spaces/work-graph.js +2 -1
  176. package/dist/commands/store/install.d.ts +1 -1
  177. package/dist/commands/store/install.js +24 -8
  178. package/dist/commands/store/show.d.ts +25 -0
  179. package/dist/commands/store/show.js +203 -0
  180. package/dist/commands/store/stats.d.ts +33 -0
  181. package/dist/commands/store/stats.js +258 -0
  182. package/dist/commands/tasks/actions/attach.js +1 -1
  183. package/dist/commands/tasks/actions/detach.js +4 -3
  184. package/dist/commands/tasks/activity.js +3 -2
  185. package/dist/commands/tasks/ancestors.js +2 -1
  186. package/dist/commands/tasks/approvals/create.js +2 -1
  187. package/dist/commands/tasks/approvals/delete.js +3 -2
  188. package/dist/commands/tasks/approvals/list.js +5 -4
  189. package/dist/commands/tasks/approvals/resolve.js +2 -1
  190. package/dist/commands/tasks/archive.js +3 -2
  191. package/dist/commands/tasks/assign.js +4 -3
  192. package/dist/commands/tasks/attachments/delete.js +3 -2
  193. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  194. package/dist/commands/tasks/attachments/download.js +20 -1
  195. package/dist/commands/tasks/attachments/list.js +2 -1
  196. package/dist/commands/tasks/attachments/set-role.js +2 -1
  197. package/dist/commands/tasks/attachments/upload.js +2 -1
  198. package/dist/commands/tasks/bulk-update.d.ts +1 -0
  199. package/dist/commands/tasks/bulk-update.js +106 -15
  200. package/dist/commands/tasks/cancel-cascade.d.ts +1 -0
  201. package/dist/commands/tasks/cancel-cascade.js +13 -3
  202. package/dist/commands/tasks/cascade-status.js +2 -1
  203. package/dist/commands/tasks/checkout.js +3 -2
  204. package/dist/commands/tasks/children.js +2 -1
  205. package/dist/commands/tasks/comments/add.js +7 -6
  206. package/dist/commands/tasks/comments/anchor.js +8 -7
  207. package/dist/commands/tasks/comments/delete.js +3 -2
  208. package/dist/commands/tasks/comments/list.js +2 -1
  209. package/dist/commands/tasks/comments/reopen.js +3 -2
  210. package/dist/commands/tasks/comments/resolve.js +3 -2
  211. package/dist/commands/tasks/create-tree.d.ts +63 -0
  212. package/dist/commands/tasks/create-tree.js +197 -4
  213. package/dist/commands/tasks/delete.js +5 -4
  214. package/dist/commands/tasks/descendants.js +2 -1
  215. package/dist/commands/tasks/dri-plan.js +3 -2
  216. package/dist/commands/tasks/dri-run.js +3 -2
  217. package/dist/commands/tasks/dri-status.js +2 -1
  218. package/dist/commands/tasks/duplicate-pipeline.js +2 -1
  219. package/dist/commands/tasks/execution-summary.js +2 -1
  220. package/dist/commands/tasks/execution-timeline.js +2 -1
  221. package/dist/commands/tasks/fork.js +1 -0
  222. package/dist/commands/tasks/forward.js +4 -3
  223. package/dist/commands/tasks/handover.js +1 -0
  224. package/dist/commands/tasks/interrupt.js +3 -2
  225. package/dist/commands/tasks/labels/attach.js +4 -3
  226. package/dist/commands/tasks/labels/detach.js +4 -3
  227. package/dist/commands/tasks/labels/suggest.js +5 -4
  228. package/dist/commands/tasks/list.d.ts +27 -1
  229. package/dist/commands/tasks/list.js +101 -3
  230. package/dist/commands/tasks/move.js +4 -3
  231. package/dist/commands/tasks/output.js +6 -5
  232. package/dist/commands/tasks/pause-schedule.js +3 -2
  233. package/dist/commands/tasks/promote.js +1 -0
  234. package/dist/commands/tasks/prompt-log.js +2 -1
  235. package/dist/commands/tasks/release.js +5 -4
  236. package/dist/commands/tasks/remind.js +2 -1
  237. package/dist/commands/tasks/replay.js +3 -2
  238. package/dist/commands/tasks/report.js +1 -0
  239. package/dist/commands/tasks/resume-schedule.js +3 -2
  240. package/dist/commands/tasks/retry-schedule.js +3 -2
  241. package/dist/commands/tasks/retry.js +10 -9
  242. package/dist/commands/tasks/revisions.js +2 -1
  243. package/dist/commands/tasks/runs.js +6 -5
  244. package/dist/commands/tasks/schedule.js +3 -2
  245. package/dist/commands/tasks/self-schedule.js +6 -5
  246. package/dist/commands/tasks/skills/pin.js +3 -2
  247. package/dist/commands/tasks/skills/unpin.js +3 -2
  248. package/dist/commands/tasks/snooze.js +6 -5
  249. package/dist/commands/tasks/start-all.js +5 -4
  250. package/dist/commands/tasks/subscribe.js +1 -0
  251. package/dist/commands/tasks/tags/add.js +4 -3
  252. package/dist/commands/tasks/tags/remove.js +4 -3
  253. package/dist/commands/tasks/timeline.js +3 -2
  254. package/dist/commands/tasks/today.d.ts +4 -1
  255. package/dist/commands/tasks/today.js +12 -2
  256. package/dist/commands/tasks/transcript.js +6 -5
  257. package/dist/commands/tasks/unschedule.js +3 -2
  258. package/dist/commands/tasks/unsnooze.js +3 -2
  259. package/dist/commands/tasks/unsubscribe.js +2 -1
  260. package/dist/commands/tasks/update.js +5 -4
  261. package/dist/commands/tasks/wait.js +5 -4
  262. package/dist/lib/agent-distribution.d.ts +37 -0
  263. package/dist/lib/agent-distribution.js +63 -0
  264. package/dist/lib/agent-ref.d.ts +69 -0
  265. package/dist/lib/agent-ref.js +168 -0
  266. package/dist/lib/api-fetch.d.ts +2 -0
  267. package/dist/lib/api-fetch.js +14 -3
  268. package/dist/lib/command-hygiene.d.ts +13 -0
  269. package/dist/lib/command-hygiene.js +62 -2
  270. package/dist/lib/commitment-product.d.ts +0 -6
  271. package/dist/lib/commitment-product.js +1 -30
  272. package/dist/lib/commitments.d.ts +9 -45
  273. package/dist/lib/commitments.js +24 -95
  274. package/dist/lib/dedicated-power.d.ts +5 -0
  275. package/dist/lib/dedicated-power.js +30 -2
  276. package/dist/lib/dry-run-plans.d.ts +50 -0
  277. package/dist/lib/dry-run-plans.js +85 -0
  278. package/dist/lib/json-output.d.ts +31 -0
  279. package/dist/lib/json-output.js +78 -0
  280. package/dist/lib/list-output.d.ts +75 -0
  281. package/dist/lib/list-output.js +266 -0
  282. package/dist/lib/machine-daemon-log.d.ts +36 -0
  283. package/dist/lib/machine-daemon-log.js +78 -0
  284. package/dist/lib/node-adapter.js +10 -1
  285. package/dist/lib/northstars.js +1 -1
  286. package/dist/lib/open-target.d.ts +12 -0
  287. package/dist/lib/open-target.js +108 -0
  288. package/dist/lib/rate-limit-retry.d.ts +45 -0
  289. package/dist/lib/rate-limit-retry.js +88 -0
  290. package/dist/lib/roles.d.ts +98 -0
  291. package/dist/lib/roles.js +45 -0
  292. package/dist/lib/store-listing.d.ts +45 -0
  293. package/dist/lib/store-listing.js +186 -0
  294. package/dist/lib/task-batch.d.ts +67 -0
  295. package/dist/lib/task-batch.js +227 -0
  296. package/dist/lib/terminal-qr.d.ts +55 -0
  297. package/dist/lib/terminal-qr.js +119 -0
  298. package/dist/lib/web-url.d.ts +11 -0
  299. package/dist/lib/web-url.js +24 -0
  300. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.d.ts +45 -0
  301. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +550 -0
  302. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +68 -0
  303. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +47 -1
  304. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.d.ts +7 -44
  305. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.js +8 -47
  306. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.d.ts +45 -0
  307. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +545 -0
  308. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +68 -0
  309. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +46 -0
  310. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.d.ts +7 -44
  311. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.js +8 -47
  312. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  313. package/dist/node_modules/@skrr-ai/data-provider/index.js +7285 -6673
  314. package/dist/node_modules/@skrr-ai/data-provider/package.json +2 -2
  315. package/oclif.manifest.json +35937 -26820
  316. package/package.json +6 -2
  317. package/dist/commands/commitments/autonomy.d.ts +0 -30
  318. package/dist/commands/commitments/autonomy.js +0 -67
  319. package/dist/commands/commitments/mode.js +0 -58
  320. package/dist/commands/commitments/pack/promote.d.ts +0 -19
  321. package/dist/commands/commitments/pack/promote.js +0 -46
  322. package/dist/commands/commitments/pack/shadow.d.ts +0 -20
  323. package/dist/commands/commitments/pack/shadow.js +0 -42
@@ -0,0 +1,545 @@
1
+ import { isDeepStrictEqual } from 'node:util';
2
+ /** Mode-free responsibility context. Tool permissions belong to the Agent runtime. */
3
+ export const COMMITMENT_EXECUTION_CONTRACT_VERSION = 3;
4
+ export const COMMITMENT_EXECUTION_CONTRACT_CAPABILITY = 'commitment_execution_contract_v3';
5
+ const DELIVERY_MODES = new Set([
6
+ 'report_only',
7
+ 'local_patch',
8
+ 'draft_pr',
9
+ 'push_branch',
10
+ 'direct_branch',
11
+ ]);
12
+ const FACT_KEYS = new Set([
13
+ 'id',
14
+ 'source',
15
+ 'type',
16
+ 'eventType',
17
+ 'checkName',
18
+ 'workflowName',
19
+ 'workflowRunId',
20
+ 'revision',
21
+ 'appId',
22
+ 'appSlug',
23
+ 'slug',
24
+ 'app',
25
+ 'action',
26
+ 'status',
27
+ 'conclusion',
28
+ 'sha',
29
+ 'headSha',
30
+ 'head_sha',
31
+ 'branch',
32
+ 'headBranch',
33
+ 'head_branch',
34
+ 'repo',
35
+ 'repository',
36
+ 'fullName',
37
+ 'full_name',
38
+ 'repoFullName',
39
+ 'prNumber',
40
+ 'owner',
41
+ 'name',
42
+ 'number',
43
+ 'checkRunId',
44
+ 'check_run_id',
45
+ 'runId',
46
+ 'run_id',
47
+ 'url',
48
+ 'runUrl',
49
+ 'htmlUrl',
50
+ 'html_url',
51
+ 'createdAt',
52
+ 'updatedAt',
53
+ 'occurredAt',
54
+ 'completed_at',
55
+ 'started_at',
56
+ 'check_run',
57
+ 'check_suite',
58
+ 'workflow_run',
59
+ 'pull_request',
60
+ 'base',
61
+ 'head',
62
+ 'ref',
63
+ 'eventId',
64
+ 'rerun',
65
+ 'checkAnnotations',
66
+ 'path',
67
+ 'startLine',
68
+ 'endLine',
69
+ 'level',
70
+ 'message',
71
+ 'title',
72
+ ]);
73
+ const CAPABILITY_SOURCE_KEYS = new Set([
74
+ 'source',
75
+ 'provider',
76
+ 'capability',
77
+ 'scope',
78
+ 'status',
79
+ 'attestation',
80
+ 'accountFingerprint',
81
+ 'testedAt',
82
+ 'expiresAt',
83
+ 'runtimeId',
84
+ 'reason',
85
+ ]);
86
+ const WORKSPACE_CONSTRAINT_KEYS = new Set([
87
+ 'allowedCommitmentDeliveryModes',
88
+ 'requireAttestedAccessForDeliveryModes',
89
+ 'maxInitiativesPerDay',
90
+ 'maxAutoRunsPerDay',
91
+ 'maxCommitmentActionRunsPerDay',
92
+ 'maxCommitmentObservationRunsPerDay',
93
+ 'maxCommitmentConcurrentRuns',
94
+ 'maxCommitmentCostUsdPerDay',
95
+ 'requireApprovalRiskLevels',
96
+ 'requireApprovalActionClasses',
97
+ 'blockedSourceKinds',
98
+ ]);
99
+ const CAPABILITY_SOURCES = new Set([
100
+ 'event_payload',
101
+ 'cloud_runtime',
102
+ 'local_harness',
103
+ 'platform_grant',
104
+ ]);
105
+ const CAPABILITY_STATUSES = new Set(['available', 'unavailable', 'unknown', 'stale']);
106
+ const CAPABILITY_ATTESTATIONS = new Set(['platform', 'runtime', 'machine', 'none']);
107
+ function plainObject(value) {
108
+ if (!value || typeof value !== 'object' || Array.isArray(value))
109
+ return false;
110
+ const prototype = Object.getPrototypeOf(value);
111
+ return prototype === Object.prototype || prototype === null;
112
+ }
113
+ function hasOnlyKeys(value, allowed) {
114
+ return plainObject(value) && Object.keys(value).every((key) => allowed.has(key));
115
+ }
116
+ function boundedString(value, max = 1000) {
117
+ return typeof value === 'string' && value.length > 0 && value.length <= max;
118
+ }
119
+ function optionalString(value, max = 1000) {
120
+ return typeof value === 'string' && value.length <= max;
121
+ }
122
+ function isoTimestamp(value) {
123
+ return (typeof value === 'string' &&
124
+ value.length <= 40 &&
125
+ Number.isFinite(Date.parse(value)) &&
126
+ new Date(value).toISOString() === value);
127
+ }
128
+ function normalizedEventFactValue(item, depth) {
129
+ if (typeof item === 'string') {
130
+ if (containsCredentialSignature(item))
131
+ return undefined;
132
+ return item.slice(0, 1000);
133
+ }
134
+ if (typeof item === 'number' || typeof item === 'boolean')
135
+ return item;
136
+ if (Array.isArray(item)) {
137
+ return item
138
+ .slice(0, 20)
139
+ .map((entry) => normalizedEventFacts(entry, depth + 1))
140
+ .filter((entry) => entry !== undefined);
141
+ }
142
+ return normalizedEventFacts(item, depth + 1);
143
+ }
144
+ const CREDENTIAL_SIGNATURE_RE = /(?:bearer\s+(?!\[REDACTED\](?:\s|$))\S{8,}|github_pat_[A-Za-z0-9_]{8,}|gh[pousr]_[A-Za-z0-9_]{8,}|xox[baprs]-[A-Za-z0-9-]{8,}|sk_(?:live|test)_[A-Za-z0-9]{8,}|(?:AKIA|ASIA)[A-Z0-9]{16}|eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}|[a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:(?!\[REDACTED\]@)[^\s/@]+@|-----BEGIN [A-Z ]*PRIVATE KEY-----)/i;
145
+ function containsCredentialSignature(value) {
146
+ return typeof value === 'string' && CREDENTIAL_SIGNATURE_RE.test(value);
147
+ }
148
+ function normalizedEventFacts(value, depth = 0) {
149
+ if (!plainObject(value) || depth > 3)
150
+ return undefined;
151
+ return Object.fromEntries(Object.entries(value)
152
+ .filter(([key]) => FACT_KEYS.has(key))
153
+ .slice(0, 30)
154
+ .map(([key, item]) => [key, normalizedEventFactValue(item, depth)])
155
+ .filter(([, item]) => item !== undefined));
156
+ }
157
+ const CI_LOG_EVIDENCE_KEYS = new Set([
158
+ 'version',
159
+ 'provider',
160
+ 'kind',
161
+ 'repoFullName',
162
+ 'checkRunId',
163
+ 'workflowRunId',
164
+ 'jobId',
165
+ 'capability',
166
+ 'attestation',
167
+ 'fetchedAt',
168
+ 'status',
169
+ 'reason',
170
+ 'byteLength',
171
+ 'lineCount',
172
+ 'excerptLines',
173
+ 'excerpt',
174
+ 'digest',
175
+ // Attribution facts, taken off the job row the server had to fetch to prove
176
+ // identity. Allowed on an UNREADABLE row: attribution happens before the
177
+ // download, so the failing step name survives a log the server could not
178
+ // read. Only text FROM the log is withheld when the read failed.
179
+ 'jobName',
180
+ 'failedStepName',
181
+ 'failedStepNumber',
182
+ ]);
183
+ const CI_LOG_EVIDENCE_STATUSES = new Set(['available', 'truncated', 'unavailable', 'unauthorized']);
184
+ const CI_LOG_EVIDENCE_READABLE = new Set(['available', 'truncated']);
185
+ const CI_LOG_EXCERPT_MAX_CHARS = 12_000;
186
+ function validCiLogEvidence(value) {
187
+ if (!hasOnlyKeys(value, CI_LOG_EVIDENCE_KEYS))
188
+ return false;
189
+ if (value.version !== 1 ||
190
+ value.provider !== 'github' ||
191
+ value.kind !== 'actions_job_log' ||
192
+ value.capability !== 'github:actions:read' ||
193
+ value.attestation !== 'platform' ||
194
+ !CI_LOG_EVIDENCE_STATUSES.has(String(value.status)) ||
195
+ !isoTimestamp(value.fetchedAt) ||
196
+ !/^[\w.-]+\/[\w.-]+$/.test(String(value.repoFullName || '')) ||
197
+ !/^\d{1,20}$/.test(String(value.checkRunId || '')))
198
+ return false;
199
+ for (const key of ['workflowRunId', 'jobId']) {
200
+ if (value[key] !== undefined && !/^\d{1,20}$/.test(String(value[key])))
201
+ return false;
202
+ }
203
+ for (const key of ['byteLength', 'lineCount', 'excerptLines', 'failedStepNumber']) {
204
+ const item = value[key];
205
+ if (item !== undefined && (!Number.isSafeInteger(item) || item < 0))
206
+ return false;
207
+ }
208
+ for (const key of ['jobName', 'failedStepName']) {
209
+ if (value[key] !== undefined && !boundedString(value[key], 200))
210
+ return false;
211
+ }
212
+ if (value.reason !== undefined && !/^[a-z0-9_]{1,80}$/.test(String(value.reason)))
213
+ return false;
214
+ if (value.digest !== undefined && !/^[a-f0-9]{16}$/.test(String(value.digest)))
215
+ return false;
216
+ // A read that failed carries no text: an unreadable log must not be able to
217
+ // arrive looking like a readable one.
218
+ if (!CI_LOG_EVIDENCE_READABLE.has(String(value.status))) {
219
+ return value.excerpt === undefined && value.digest === undefined && Boolean(value.reason);
220
+ }
221
+ return boundedString(value.excerpt, CI_LOG_EXCERPT_MAX_CHARS) && value.jobId !== undefined;
222
+ }
223
+ function validEvidence(value) {
224
+ if (!hasOnlyKeys(value, new Set(['version', 'ci'])))
225
+ return false;
226
+ return (value.version === 1 &&
227
+ Array.isArray(value.ci) &&
228
+ value.ci.length >= 1 &&
229
+ value.ci.length <= 4 &&
230
+ value.ci.every(validCiLogEvidence));
231
+ }
232
+ // Mirror of `validObserve` in
233
+ // api/server/services/Commitments/CommitmentExecutionContract.js. The daemon
234
+ // has no projector, so canonical form is part of validity on both sides:
235
+ // `egress` must be strictly ascending (sorted AND unique). The shared parity
236
+ // fixture holds the two to one verdict.
237
+ const OBSERVE_KEYS = new Set(['egress', 'web', 'shell', 'browser']);
238
+ const OBSERVE_EGRESS_MAX = 32;
239
+ const OBSERVE_HOST_PATTERN = /^(\*\.)?[a-z0-9.-]+$/;
240
+ const OBSERVE_HOST_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
241
+ function evidenceMatchesEvent(row, event) {
242
+ if (!plainObject(row) || !plainObject(event))
243
+ return true;
244
+ const same = (a, b) => String(a).toLowerCase() === String(b).toLowerCase();
245
+ if (event.repoFullName !== undefined && !same(row.repoFullName, event.repoFullName))
246
+ return false;
247
+ if (event.checkRunId !== undefined && !same(row.checkRunId, event.checkRunId))
248
+ return false;
249
+ if (row.workflowRunId !== undefined &&
250
+ event.workflowRunId !== undefined &&
251
+ !same(row.workflowRunId, event.workflowRunId))
252
+ return false;
253
+ return true;
254
+ }
255
+ function validCapabilitySource(value) {
256
+ if (!hasOnlyKeys(value, CAPABILITY_SOURCE_KEYS))
257
+ return false;
258
+ if (!CAPABILITY_SOURCES.has(String(value.source)) ||
259
+ !boundedString(value.provider, 80) ||
260
+ !/^[a-z0-9_.-]{1,80}$/i.test(value.provider) ||
261
+ !boundedString(value.capability, 120) ||
262
+ !/^[a-z0-9_:.-]{1,120}$/i.test(value.capability) ||
263
+ !CAPABILITY_STATUSES.has(String(value.status)) ||
264
+ !CAPABILITY_ATTESTATIONS.has(String(value.attestation)))
265
+ return false;
266
+ if (value.scope !== undefined && !optionalString(value.scope, 500))
267
+ return false;
268
+ if (value.accountFingerprint !== undefined &&
269
+ !/^[a-f0-9]{64}$/i.test(String(value.accountFingerprint)))
270
+ return false;
271
+ if (value.testedAt !== undefined && !isoTimestamp(value.testedAt))
272
+ return false;
273
+ if (value.expiresAt !== undefined && !isoTimestamp(value.expiresAt))
274
+ return false;
275
+ if (value.testedAt &&
276
+ value.expiresAt &&
277
+ Date.parse(String(value.expiresAt)) <= Date.parse(String(value.testedAt)))
278
+ return false;
279
+ if (value.runtimeId !== undefined && !boundedString(value.runtimeId, 200))
280
+ return false;
281
+ if (value.reason !== undefined && !optionalString(value.reason, 1000))
282
+ return false;
283
+ if (value.source === 'event_payload' && value.attestation !== 'platform')
284
+ return false;
285
+ if (value.source === 'platform_grant' && value.attestation !== 'platform')
286
+ return false;
287
+ if (value.source === 'local_harness' &&
288
+ (!['machine', 'none'].includes(String(value.attestation)) ||
289
+ (value.status === 'available' &&
290
+ (value.attestation !== 'machine' ||
291
+ !value.accountFingerprint ||
292
+ !value.testedAt ||
293
+ !value.expiresAt ||
294
+ !value.runtimeId))))
295
+ return false;
296
+ if (value.source === 'cloud_runtime' &&
297
+ (!['runtime', 'none'].includes(String(value.attestation)) ||
298
+ (value.status === 'available' &&
299
+ (value.attestation !== 'runtime' ||
300
+ !value.accountFingerprint ||
301
+ !value.testedAt ||
302
+ !value.expiresAt ||
303
+ !value.runtimeId))))
304
+ return false;
305
+ return true;
306
+ }
307
+ function validStringArray(value, max, values) {
308
+ return (Array.isArray(value) &&
309
+ value.length <= max &&
310
+ value.every((item) => boundedString(item, 120) && (!values || values.has(item))));
311
+ }
312
+ function validWorkspacePolicy(value) {
313
+ if (!hasOnlyKeys(value, new Set(['hardStop', 'hardConstraints'])))
314
+ return false;
315
+ if (value.hardStop !== undefined && value.hardStop !== null) {
316
+ if (!hasOnlyKeys(value.hardStop, new Set(['enabled', 'reason', 'scope'])))
317
+ return false;
318
+ if (typeof value.hardStop.enabled !== 'boolean')
319
+ return false;
320
+ if (value.hardStop.reason !== undefined && !optionalString(value.hardStop.reason, 1000))
321
+ return false;
322
+ if (value.hardStop.scope !== undefined && !optionalString(value.hardStop.scope, 100))
323
+ return false;
324
+ }
325
+ if (value.hardConstraints === undefined)
326
+ return true;
327
+ if (!hasOnlyKeys(value.hardConstraints, WORKSPACE_CONSTRAINT_KEYS))
328
+ return false;
329
+ for (const [key, item] of Object.entries(value.hardConstraints)) {
330
+ if (item === null)
331
+ continue;
332
+ if (key === 'allowedCommitmentDeliveryModes' ||
333
+ key === 'requireAttestedAccessForDeliveryModes') {
334
+ if (!validStringArray(item, 5, DELIVERY_MODES))
335
+ return false;
336
+ }
337
+ else if (key === 'maxCommitmentCostUsdPerDay') {
338
+ if (typeof item !== 'number' || !Number.isFinite(item) || item < 0)
339
+ return false;
340
+ }
341
+ else if (key.startsWith('max')) {
342
+ if (!Number.isSafeInteger(item) || Number(item) < 0)
343
+ return false;
344
+ }
345
+ else if (key === 'requireApprovalRiskLevels') {
346
+ if (!validStringArray(item, 3, new Set(['low', 'medium', 'high'])))
347
+ return false;
348
+ }
349
+ else if (!validStringArray(item, key === 'blockedSourceKinds' ? 50 : 20))
350
+ return false;
351
+ }
352
+ return true;
353
+ }
354
+ function validBranch(value) {
355
+ return (boundedString(value, 255) &&
356
+ value !== 'HEAD' &&
357
+ !value.startsWith('refs/') &&
358
+ !value.startsWith('origin/') &&
359
+ !value.startsWith('-') &&
360
+ !value.startsWith('/') &&
361
+ !value.endsWith('/') &&
362
+ !value.endsWith('.') &&
363
+ // Control characters are exactly what this rejects: a Git ref name may not
364
+ // contain them, so the class is deliberate rather than an oversight.
365
+ // eslint-disable-next-line no-control-regex
366
+ !/[\s~^:?*[\\\x00-\x1f\x7f]/.test(value) &&
367
+ !value.includes('..') &&
368
+ !value.includes('@{') &&
369
+ !value.includes('//') &&
370
+ value !== '@' &&
371
+ !value.split('/').some((part) => part.startsWith('.') || part.endsWith('.lock')));
372
+ }
373
+ function validDelivery(value) {
374
+ if (!hasOnlyKeys(value, new Set(['version', 'mode', 'repo', 'baseBranch', 'expectations'])))
375
+ return false;
376
+ if (value.version !== 1 || !DELIVERY_MODES.has(String(value.mode)))
377
+ return false;
378
+ if (value.repo !== undefined &&
379
+ (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(String(value.repo)) ||
380
+ String(value.repo) !== String(value.repo).toLowerCase()))
381
+ return false;
382
+ if (value.baseBranch !== undefined && !validBranch(value.baseBranch))
383
+ return false;
384
+ if (['draft_pr', 'push_branch', 'direct_branch'].includes(String(value.mode)) &&
385
+ (!value.repo || !value.baseBranch))
386
+ return false;
387
+ if (value.expectations !== undefined) {
388
+ if (!Array.isArray(value.expectations) || value.expectations.length > 20)
389
+ return false;
390
+ const ids = new Set();
391
+ const allowed = new Set([
392
+ 'id',
393
+ 'shape',
394
+ 'kind',
395
+ 'format',
396
+ 'target',
397
+ 'minimumAuthority',
398
+ 'description',
399
+ 'presetKey',
400
+ ]);
401
+ for (const expectation of value.expectations) {
402
+ if (!hasOnlyKeys(expectation, allowed) ||
403
+ !['code', 'page', 'url', 'file', 'message', 'dataset'].includes(String(expectation.kind)))
404
+ return false;
405
+ if (expectation.id !== undefined) {
406
+ if (!boundedString(expectation.id, 64) ||
407
+ expectation.id === 'commitment-delivery' ||
408
+ ids.has(expectation.id))
409
+ return false;
410
+ ids.add(expectation.id);
411
+ }
412
+ if (expectation.shape !== undefined &&
413
+ !['checkable', 'judged'].includes(String(expectation.shape)))
414
+ return false;
415
+ if (expectation.minimumAuthority !== undefined &&
416
+ !['self_reported', 'human_confirmed', 'observation_backed'].includes(String(expectation.minimumAuthority)))
417
+ return false;
418
+ for (const [key, max] of [
419
+ ['format', 40],
420
+ ['target', 500],
421
+ ['description', 500],
422
+ ['presetKey', 64],
423
+ ]) {
424
+ if (expectation[key] !== undefined && !optionalString(expectation[key], max))
425
+ return false;
426
+ }
427
+ }
428
+ }
429
+ return true;
430
+ }
431
+ function validDeliverySource(value) {
432
+ if (!hasOnlyKeys(value, new Set(['parentTaskId', 'branch', 'headSha', 'baseCommit', 'runtime'])))
433
+ return false;
434
+ return (typeof value.parentTaskId === 'string' &&
435
+ value.parentTaskId.length > 0 &&
436
+ value.parentTaskId.length <= 200 &&
437
+ typeof value.branch === 'string' &&
438
+ /^[A-Za-z0-9][A-Za-z0-9_./-]{0,239}$/.test(value.branch) &&
439
+ !value.branch.includes('..') &&
440
+ !value.branch.includes('@{') &&
441
+ /^[a-f0-9]{40,64}$/i.test(value.headSha) &&
442
+ typeof value.baseCommit === 'string' &&
443
+ /^[a-f0-9]{40,64}$/i.test(value.baseCommit) &&
444
+ hasOnlyKeys(value.runtime, new Set(['kind', 'id'])) &&
445
+ ['local_daemon', 'hosted_machine'].includes(String(value.runtime.kind)) &&
446
+ boundedString(value.runtime.id, 200) &&
447
+ (value.runtime.kind !== 'hosted_machine' || value.runtime.id.startsWith('sbs_')));
448
+ }
449
+ function eventSourceRevision(event) {
450
+ if (!event)
451
+ return '';
452
+ const nestedCheck = event.check_run;
453
+ const nestedWorkflow = event.workflow_run;
454
+ const value = event.headSha ||
455
+ event.head_sha ||
456
+ event.sha ||
457
+ nestedCheck?.head_sha ||
458
+ nestedWorkflow?.head_sha;
459
+ return /^[a-f0-9]{40,64}$/i.test(String(value || '')) ? String(value).toLowerCase() : '';
460
+ }
461
+ export function eventRepository(event) {
462
+ if (!event)
463
+ return '';
464
+ const repository = event.repository;
465
+ const value = event.repoFullName || repository?.full_name || repository?.fullName;
466
+ return /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(String(value || ''))
467
+ ? String(value).toLowerCase()
468
+ : '';
469
+ }
470
+ function failedGitHubCheck(event) {
471
+ const eventType = String(event?.eventType || event?.type || '').toLowerCase();
472
+ return eventType === 'github.check_run_failed' || eventType === 'check_run_failed';
473
+ }
474
+ /** One strict parser used at storage admission and at runtime admission. */
475
+ export function normalizeCommitmentExecutionContract(value) {
476
+ if (!hasOnlyKeys(value, new Set([
477
+ 'version',
478
+ 'kind',
479
+ 'responsibilityRef',
480
+ 'responsibility',
481
+ 'event',
482
+ 'workspace',
483
+ 'delivery',
484
+ 'capabilitySources',
485
+ 'evidence',
486
+ 'workspacePolicy',
487
+ 'deliverySource',
488
+ 'mustNot',
489
+ 'return',
490
+ ])))
491
+ return null;
492
+ const contract = value;
493
+ const event = contract.event === undefined ? null : contract.event;
494
+ const eventSha = eventSourceRevision(event);
495
+ const eventRepo = eventRepository(event);
496
+ const taskDelivery = contract.kind === 'task_delivery';
497
+ if (contract.version !== COMMITMENT_EXECUTION_CONTRACT_VERSION ||
498
+ !['commitment', 'task_delivery'].includes(contract.kind) ||
499
+ !hasOnlyKeys(contract.responsibilityRef, new Set(['kind', 'id', 'version'])) ||
500
+ contract.responsibilityRef.kind !== (taskDelivery ? 'task' : 'commitment') ||
501
+ !boundedString(contract.responsibilityRef.id, 240) ||
502
+ !Number.isSafeInteger(contract.responsibilityRef.version) ||
503
+ contract.responsibilityRef.version < 1 ||
504
+ !boundedString(contract.responsibility, 2000) ||
505
+ !hasOnlyKeys(contract.workspace, new Set(['kind', 'base', 'fetchBase'])) ||
506
+ contract.workspace.kind !== 'ephemeral' ||
507
+ !boundedString(contract.workspace.base, 255) ||
508
+ (contract.workspace.fetchBase !== undefined &&
509
+ (contract.workspace.fetchBase !== true || contract.workspace.kind !== 'ephemeral')) ||
510
+ !validDelivery(contract.delivery) ||
511
+ !Array.isArray(contract.capabilitySources) ||
512
+ contract.capabilitySources.length > 32 ||
513
+ !contract.capabilitySources.every(validCapabilitySource) ||
514
+ !validWorkspacePolicy(contract.workspacePolicy ?? {}) ||
515
+ !isDeepStrictEqual(contract.mustNot, [
516
+ 'change_workspace_administration',
517
+ 'broaden_credentials',
518
+ ...(taskDelivery ? ['reimplement_source_work'] : []),
519
+ ]) ||
520
+ (taskDelivery
521
+ ? contract.return !== 'task_output'
522
+ : contract.return !== 'commitment_result_v1') ||
523
+ (event !== null &&
524
+ (!plainObject(event) || !isDeepStrictEqual(event, normalizedEventFacts(event)))) ||
525
+ (eventSha && contract.workspace.base.toLowerCase() !== eventSha) ||
526
+ (eventRepo &&
527
+ contract.delivery.repo &&
528
+ String(contract.delivery.repo).toLowerCase() !== eventRepo) ||
529
+ (failedGitHubCheck(event) && (!eventSha || !eventRepo)) ||
530
+ (contract.evidence !== undefined &&
531
+ (taskDelivery ||
532
+ !validEvidence(contract.evidence) ||
533
+ !contract.evidence.ci.every((row) => evidenceMatchesEvent(row, event)))) ||
534
+ (taskDelivery &&
535
+ (event !== null ||
536
+ !['draft_pr', 'push_branch', 'direct_branch'].includes(contract.delivery.mode) ||
537
+ contract.workspace.kind !== 'ephemeral' ||
538
+ !validDeliverySource(contract.deliverySource) ||
539
+ contract.responsibilityRef.id !== contract.deliverySource?.parentTaskId ||
540
+ contract.workspace.base.toLowerCase() !==
541
+ String(contract.deliverySource?.baseCommit).toLowerCase())) ||
542
+ (!taskDelivery && contract.deliverySource !== undefined))
543
+ return null;
544
+ return JSON.parse(JSON.stringify(contract));
545
+ }
@@ -151,6 +151,14 @@ export declare const DAEMON_COMPUTER_EVENTS: {
151
151
  * `computer_declared_services_v1`.
152
152
  */
153
153
  readonly services: "daemon:computer:services";
154
+ /**
155
+ * Read the tail of the daemon's OWN process log (a bounded, redacted copy of
156
+ * what its logger wrote since it started), for the owner who asks why their
157
+ * machine reconnected. Carries a `requestId` and the principal the API
158
+ * authorized (`observe`); the daemon checks the principal against the grant
159
+ * set it holds. Needs `computer_daemon_log_v1`.
160
+ */
161
+ readonly daemonLog: "daemon:computer:log";
154
162
  /** The answer to any request that carried a `requestId`. */
155
163
  readonly ack: "daemon:computer:ack";
156
164
  readonly manifest: "daemon:computer:manifest";
@@ -295,6 +303,15 @@ export declare const COMPUTER_CAPABILITIES: {
295
303
  * browser; nothing is proxied to it. Announced by the relay that serves it.
296
304
  */
297
305
  readonly declaredServices: "computer_declared_services_v1";
306
+ /**
307
+ * The daemon serves the tail of its own process log
308
+ * (`daemon:computer:log`): an in-memory ring of lines its logger
309
+ * wrote, redacted before they enter the ring, read at the `watch` tier. It
310
+ * is NOT syslog or the journal and never reads either. Announced by the relay
311
+ * that serves it; a personal machine's daemon announces it too and refuses
312
+ * the read `consent_missing` until `skrr computer allow`.
313
+ */
314
+ readonly daemonLog: "computer_daemon_log_v1";
298
315
  /**
299
316
  * The page follows the controlling window (§6.2 "a stable viewport", §7.1,
300
317
  * OSK-13808): a browser `viewport` input, sent only by the attachment that
@@ -1080,3 +1097,54 @@ export declare function computerPowerPhaseForLeaseState(state: unknown): Compute
1080
1097
  export declare function computerShowsDesktop(phase: ComputerPowerPhase): boolean;
1081
1098
  /** Power actions are offered for a Dedicated Runtime only; a personal machine has none (§18). */
1082
1099
  export declare function computerOffersPowerActions(machineKind: ComputerMachineKind): boolean;
1100
+ /**
1101
+ * Why the daemon's log is a wire feature at all: the tenant uid on a Dedicated
1102
+ * Runtime guest cannot read syslog or the journal, so an owner could not see
1103
+ * why their machine's daemon reconnected or failed. The daemon keeps the last
1104
+ * lines its OWN logger wrote in memory and serves them; it opens no file and no
1105
+ * system log for this.
1106
+ */
1107
+ export declare const COMPUTER_DAEMON_LOG_LEVELS: readonly ["trace", "debug", "info", "warn", "error"];
1108
+ export type ComputerDaemonLogLevel = (typeof COMPUTER_DAEMON_LOG_LEVELS)[number];
1109
+ /** Every bound is the daemon's to enforce and the API's to validate against. */
1110
+ export declare const COMPUTER_DAEMON_LOG_LIMITS: {
1111
+ /** Lines the daemon keeps in memory; older ones fall off the front. */
1112
+ readonly ringLines: 2000;
1113
+ /** A line longer than this is cut and marked, never kept whole. */
1114
+ readonly lineChars: 1000;
1115
+ /** Lines returned when the caller names none. */
1116
+ readonly defaultLines: 100;
1117
+ /** The most lines one answer carries. */
1118
+ readonly maxLines: 500;
1119
+ /** The most bytes (UTF-8) one answer's text carries; far under the 1 MiB SSE frame. */
1120
+ readonly maxBytes: number;
1121
+ /** The longest look-back a `sinceMs` may ask for (24 h; the ring is shorter anyway). */
1122
+ readonly maxSinceMs: number;
1123
+ /** Requests the daemon answers per `rateWindowMs`; one more is `rate_limited`. */
1124
+ readonly rateMax: 30;
1125
+ readonly rateWindowMs: number;
1126
+ };
1127
+ /** One line of the daemon's log as it leaves the daemon: redacted, time and level split out. */
1128
+ export interface ComputerDaemonLogLine {
1129
+ /** Epoch milliseconds the daemon wrote it. */
1130
+ at: number;
1131
+ level: ComputerDaemonLogLevel;
1132
+ text: string;
1133
+ }
1134
+ /**
1135
+ * The answer to `daemon:computer:log`. `lines` are oldest first, at most
1136
+ * the asked number of the NEWEST that match. `truncated` is true when more
1137
+ * matched than were returned (by count or bytes); `ringFull` is true when the
1138
+ * ring has already dropped older lines, so "no line before this" does not mean
1139
+ * "the daemon logged nothing earlier". `startedAt` is the daemon process start:
1140
+ * a reconnect that restarted the daemon is visible as a new one.
1141
+ */
1142
+ export interface ComputerDaemonLogResult {
1143
+ lines: ComputerDaemonLogLine[];
1144
+ startedAt: number;
1145
+ now: number;
1146
+ truncated: boolean;
1147
+ ringFull: boolean;
1148
+ /** Lines the redaction rewrote anywhere in the ring (a count, never content). */
1149
+ redactedLines: number;
1150
+ }