@skrr-ai/cli 0.1.110 → 0.1.111

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 (391) hide show
  1. package/bin/run.js +15 -1
  2. package/dist/base-command.d.ts +31 -3
  3. package/dist/base-command.js +136 -22
  4. package/dist/commands/actions/list.js +2 -1
  5. package/dist/commands/agenda/trigger/create.js +1 -1
  6. package/dist/commands/agenda/trigger/list.js +2 -1
  7. package/dist/commands/agent-groups/list.js +2 -1
  8. package/dist/commands/agents/actions/list.js +2 -1
  9. package/dist/commands/agents/always-on/status.js +5 -0
  10. package/dist/commands/agents/chat.js +4 -1
  11. package/dist/commands/agents/duplicate.js +4 -0
  12. package/dist/commands/agents/eval/list.js +2 -1
  13. package/dist/commands/agents/files/list.js +2 -1
  14. package/dist/commands/agents/folders/list.js +2 -1
  15. package/dist/commands/agents/goals/list.js +2 -1
  16. package/dist/commands/agents/intuitions/list.js +8 -5
  17. package/dist/commands/agents/list.d.ts +12 -0
  18. package/dist/commands/agents/list.js +45 -8
  19. package/dist/commands/agents/releases/known-issues/list.js +2 -1
  20. package/dist/commands/agents/releases/list.js +5 -1
  21. package/dist/commands/agents/releases/trusted-publishers/list.js +2 -1
  22. package/dist/commands/agents/roles/list.js +2 -1
  23. package/dist/commands/agents/skills/list.js +2 -1
  24. package/dist/commands/agents/todos/list.js +2 -1
  25. package/dist/commands/agents/triggers/list.js +2 -1
  26. package/dist/commands/api-keys/list.js +2 -1
  27. package/dist/commands/apps/channel.d.ts +20 -0
  28. package/dist/commands/apps/channel.js +64 -0
  29. package/dist/commands/apps/check-draft.d.ts +12 -0
  30. package/dist/commands/apps/check-draft.js +41 -0
  31. package/dist/commands/apps/check.d.ts +42 -0
  32. package/dist/commands/apps/check.js +91 -0
  33. package/dist/commands/apps/create.d.ts +15 -0
  34. package/dist/commands/apps/create.js +59 -0
  35. package/dist/commands/apps/data/put.d.ts +18 -0
  36. package/dist/commands/apps/data/put.js +72 -0
  37. package/dist/commands/apps/data/query.d.ts +20 -0
  38. package/dist/commands/apps/data/query.js +88 -0
  39. package/dist/commands/apps/disclosure.d.ts +16 -0
  40. package/dist/commands/apps/disclosure.js +71 -0
  41. package/dist/commands/apps/file/cat.d.ts +15 -0
  42. package/dist/commands/apps/file/cat.js +50 -0
  43. package/dist/commands/apps/file/ls.d.ts +13 -0
  44. package/dist/commands/apps/file/ls.js +47 -0
  45. package/dist/commands/apps/file/mv.d.ts +15 -0
  46. package/dist/commands/apps/file/mv.js +49 -0
  47. package/dist/commands/apps/file/rm.d.ts +15 -0
  48. package/dist/commands/apps/file/rm.js +53 -0
  49. package/dist/commands/apps/file/write.d.ts +17 -0
  50. package/dist/commands/apps/file/write.js +81 -0
  51. package/dist/commands/apps/install.d.ts +19 -0
  52. package/dist/commands/apps/install.js +136 -0
  53. package/dist/commands/apps/installations/list.d.ts +11 -0
  54. package/dist/commands/apps/installations/list.js +49 -0
  55. package/dist/commands/apps/installations/show.d.ts +12 -0
  56. package/dist/commands/apps/installations/show.js +61 -0
  57. package/dist/commands/apps/layout/set.d.ts +11 -0
  58. package/dist/commands/apps/layout/set.js +125 -0
  59. package/dist/commands/apps/layout/show.d.ts +9 -0
  60. package/dist/commands/apps/layout/show.js +33 -0
  61. package/dist/commands/apps/list.d.ts +10 -0
  62. package/dist/commands/apps/list.js +45 -0
  63. package/dist/commands/apps/logs.d.ts +13 -0
  64. package/dist/commands/apps/logs.js +55 -0
  65. package/dist/commands/apps/preview.d.ts +12 -0
  66. package/dist/commands/apps/preview.js +39 -0
  67. package/dist/commands/apps/publish/propose.d.ts +14 -0
  68. package/dist/commands/apps/publish/propose.js +45 -0
  69. package/dist/commands/apps/pull.d.ts +14 -0
  70. package/dist/commands/apps/pull.js +56 -0
  71. package/dist/commands/apps/push.d.ts +15 -0
  72. package/dist/commands/apps/push.js +75 -0
  73. package/dist/commands/apps/reconsent.d.ts +13 -0
  74. package/dist/commands/apps/reconsent.js +67 -0
  75. package/dist/commands/apps/report.d.ts +20 -0
  76. package/dist/commands/apps/report.js +63 -0
  77. package/dist/commands/apps/resume.d.ts +12 -0
  78. package/dist/commands/apps/resume.js +36 -0
  79. package/dist/commands/apps/settings/set.d.ts +13 -0
  80. package/dist/commands/apps/settings/set.js +54 -0
  81. package/dist/commands/apps/settings/show.d.ts +11 -0
  82. package/dist/commands/apps/settings/show.js +31 -0
  83. package/dist/commands/apps/show.d.ts +12 -0
  84. package/dist/commands/apps/show.js +49 -0
  85. package/dist/commands/apps/suspend.d.ts +12 -0
  86. package/dist/commands/apps/suspend.js +35 -0
  87. package/dist/commands/apps/uninstall.d.ts +13 -0
  88. package/dist/commands/apps/uninstall.js +43 -0
  89. package/dist/commands/apps/upgrade.d.ts +14 -0
  90. package/dist/commands/apps/upgrade.js +49 -0
  91. package/dist/commands/apps/version/create.d.ts +14 -0
  92. package/dist/commands/apps/version/create.js +53 -0
  93. package/dist/commands/apps/version/show.d.ts +12 -0
  94. package/dist/commands/apps/version/show.js +39 -0
  95. package/dist/commands/apps/versions.d.ts +12 -0
  96. package/dist/commands/apps/versions.js +40 -0
  97. package/dist/commands/apps/webhooks/list.d.ts +12 -0
  98. package/dist/commands/apps/webhooks/list.js +47 -0
  99. package/dist/commands/characters/list.js +2 -1
  100. package/dist/commands/chats/files/list.js +2 -1
  101. package/dist/commands/chats/folders/list.js +2 -1
  102. package/dist/commands/chats/list.js +2 -1
  103. package/dist/commands/chats/spaces/list.js +2 -1
  104. package/dist/commands/chats/widgets/list.js +2 -1
  105. package/dist/commands/code/jobs/list.js +4 -1
  106. package/dist/commands/commerce/incidents/list.js +2 -1
  107. package/dist/commands/commitments/accounting.js +3 -0
  108. package/dist/commands/commitments/action-proposals.d.ts +8 -0
  109. package/dist/commands/commitments/action-proposals.js +17 -2
  110. package/dist/commands/commitments/cost.d.ts +11 -0
  111. package/dist/commands/commitments/cost.js +25 -0
  112. package/dist/commands/commitments/create.js +6 -1
  113. package/dist/commands/commitments/endpoints/list.js +2 -1
  114. package/dist/commands/commitments/links/list.js +2 -1
  115. package/dist/commands/commitments/list.js +2 -1
  116. package/dist/commands/commitments/liveness.d.ts +30 -0
  117. package/dist/commands/commitments/liveness.js +22 -5
  118. package/dist/commands/commitments/pack/list.js +2 -1
  119. package/dist/commands/commitments/preflight.js +6 -2
  120. package/dist/commands/commitments/update.js +10 -1
  121. package/dist/commands/compass/list.js +2 -1
  122. package/dist/commands/context.js +7 -1
  123. package/dist/commands/convos/list.js +3 -2
  124. package/dist/commands/dm/list.js +2 -1
  125. package/dist/commands/dm/work.d.ts +19 -0
  126. package/dist/commands/dm/work.js +54 -0
  127. package/dist/commands/feeds/list.js +2 -1
  128. package/dist/commands/followups/list.js +2 -1
  129. package/dist/commands/followups/plans/cancel.d.ts +13 -0
  130. package/dist/commands/followups/plans/cancel.js +26 -0
  131. package/dist/commands/followups/plans/create.d.ts +11 -0
  132. package/dist/commands/followups/plans/create.js +35 -0
  133. package/dist/commands/followups/plans/list.d.ts +13 -0
  134. package/dist/commands/followups/plans/list.js +50 -0
  135. package/dist/commands/followups/plans/observability.d.ts +11 -0
  136. package/dist/commands/followups/plans/observability.js +46 -0
  137. package/dist/commands/followups/plans/revise.d.ts +13 -0
  138. package/dist/commands/followups/plans/revise.js +35 -0
  139. package/dist/commands/followups/plans/show.d.ts +11 -0
  140. package/dist/commands/followups/plans/show.js +32 -0
  141. package/dist/commands/goals/key-results/list.js +2 -1
  142. package/dist/commands/goals/labels/list.js +3 -2
  143. package/dist/commands/goals/list.js +3 -2
  144. package/dist/commands/grants/list.js +2 -1
  145. package/dist/commands/harnesses/grants/list.js +2 -1
  146. package/dist/commands/harnesses/leases/list.js +2 -1
  147. package/dist/commands/harnesses/list.js +10 -1
  148. package/dist/commands/ingress/list.js +2 -1
  149. package/dist/commands/initiatives/list.js +2 -1
  150. package/dist/commands/instruction-blocks/list.js +2 -1
  151. package/dist/commands/instructions/list.js +2 -1
  152. package/dist/commands/integrations/connections/list.js +2 -1
  153. package/dist/commands/integrations/tools/list.js +2 -1
  154. package/dist/commands/labels/list.js +3 -2
  155. package/dist/commands/learning/adapters.d.ts +16 -0
  156. package/dist/commands/learning/adapters.js +44 -0
  157. package/dist/commands/machines/dedicated/list.js +2 -1
  158. package/dist/commands/machines/hosted/list.js +2 -1
  159. package/dist/commands/machines/list.js +2 -1
  160. package/dist/commands/machines/show.js +5 -2
  161. package/dist/commands/measures/list.js +2 -1
  162. package/dist/commands/memory/list.js +2 -1
  163. package/dist/commands/memory/proposals/list.js +2 -1
  164. package/dist/commands/memory/stores/list.js +2 -1
  165. package/dist/commands/memory/topics/list.js +2 -1
  166. package/dist/commands/memory/versions/list.js +2 -1
  167. package/dist/commands/messages/list.js +2 -1
  168. package/dist/commands/northstars/intents/list.js +2 -1
  169. package/dist/commands/northstars/list.js +2 -1
  170. package/dist/commands/northstars/recommendations/list.js +2 -1
  171. package/dist/commands/outbox/list.js +2 -1
  172. package/dist/commands/profiles/list.js +2 -1
  173. package/dist/commands/projects/docs/list.js +8 -1
  174. package/dist/commands/projects/updates/list.js +2 -1
  175. package/dist/commands/proposals/list.js +2 -1
  176. package/dist/commands/requests/comments/list.js +2 -1
  177. package/dist/commands/requests/list.js +2 -1
  178. package/dist/commands/shares/list.js +2 -1
  179. package/dist/commands/shortcuts/list.js +2 -1
  180. package/dist/commands/signals/monitors/list.js +2 -1
  181. package/dist/commands/signals/schemas/list.js +2 -1
  182. package/dist/commands/signals/sources/list.js +2 -1
  183. package/dist/commands/space-directory-views/list.js +2 -1
  184. package/dist/commands/spaces/actions/list.js +4 -3
  185. package/dist/commands/spaces/briefs/list.js +2 -1
  186. package/dist/commands/spaces/cycles/list.js +2 -1
  187. package/dist/commands/spaces/files/folders/list.js +2 -1
  188. package/dist/commands/spaces/files/list.js +3 -2
  189. package/dist/commands/spaces/heartbeats/list.js +3 -2
  190. package/dist/commands/spaces/labels/list.js +3 -2
  191. package/dist/commands/spaces/list.d.ts +3 -18
  192. package/dist/commands/spaces/list.js +28 -35
  193. package/dist/commands/spaces/live/cards/list.js +2 -1
  194. package/dist/commands/spaces/members/list.d.ts +1 -0
  195. package/dist/commands/spaces/members/list.js +4 -1
  196. package/dist/commands/spaces/show.js +2 -2
  197. package/dist/commands/spaces/skills/list.js +6 -2
  198. package/dist/commands/spaces/states/list.js +2 -1
  199. package/dist/commands/spaces/views/list.js +2 -1
  200. package/dist/commands/spaces/widgets/list.js +3 -2
  201. package/dist/commands/spaces/workflow-templates/list.js +2 -1
  202. package/dist/commands/spaces/workflows/fixtures/list.js +2 -1
  203. package/dist/commands/spaces/workflows/list.js +3 -2
  204. package/dist/commands/spaces/workflows/proposals/list.js +2 -1
  205. package/dist/commands/spaces/workflows/triggers/list.js +2 -1
  206. package/dist/commands/store/acquisitions/list.js +2 -1
  207. package/dist/commands/store/admissions/list.js +17 -1
  208. package/dist/commands/store/advisories/list.js +2 -1
  209. package/dist/commands/store/follows/list.js +2 -1
  210. package/dist/commands/store/publishers/domains/list.js +2 -1
  211. package/dist/commands/store/reports/list.js +2 -1
  212. package/dist/commands/subscriptions/list.js +2 -1
  213. package/dist/commands/tasks/actionability.js +7 -30
  214. package/dist/commands/tasks/activity.js +3 -7
  215. package/dist/commands/tasks/approvals/list.js +2 -1
  216. package/dist/commands/tasks/assign.d.ts +1 -0
  217. package/dist/commands/tasks/assign.js +43 -7
  218. package/dist/commands/tasks/attachments/list.js +2 -1
  219. package/dist/commands/tasks/chat/send.js +34 -0
  220. package/dist/commands/tasks/comments/add.js +6 -1
  221. package/dist/commands/tasks/comments/list.js +2 -1
  222. package/dist/commands/tasks/complete.js +26 -2
  223. package/dist/commands/tasks/continue.d.ts +18 -0
  224. package/dist/commands/tasks/continue.js +54 -0
  225. package/dist/commands/tasks/create-tree.d.ts +5 -0
  226. package/dist/commands/tasks/create-tree.js +399 -219
  227. package/dist/commands/tasks/create.d.ts +1 -0
  228. package/dist/commands/tasks/create.js +63 -11
  229. package/dist/commands/tasks/deliverable/add.js +10 -3
  230. package/dist/commands/tasks/deliverable/list.js +2 -1
  231. package/dist/commands/tasks/events/list.js +2 -1
  232. package/dist/commands/tasks/execution-state.d.ts +12 -0
  233. package/dist/commands/tasks/execution-state.js +28 -0
  234. package/dist/commands/tasks/expectations/assess.js +40 -5
  235. package/dist/commands/tasks/guide.d.ts +10 -0
  236. package/dist/commands/tasks/guide.js +20 -0
  237. package/dist/commands/tasks/labels/list.js +2 -1
  238. package/dist/commands/tasks/list.d.ts +19 -0
  239. package/dist/commands/tasks/list.js +97 -4
  240. package/dist/commands/tasks/move.js +10 -2
  241. package/dist/commands/tasks/preflight.d.ts +14 -0
  242. package/dist/commands/tasks/preflight.js +77 -0
  243. package/dist/commands/tasks/resource/list.js +2 -1
  244. package/dist/commands/tasks/result/submit.js +10 -1
  245. package/dist/commands/tasks/review.js +6 -1
  246. package/dist/commands/tasks/revisions.d.ts +2 -0
  247. package/dist/commands/tasks/revisions.js +8 -1
  248. package/dist/commands/tasks/show.js +17 -11
  249. package/dist/commands/tasks/start.d.ts +1 -0
  250. package/dist/commands/tasks/start.js +35 -0
  251. package/dist/commands/tasks/templates/list.js +2 -1
  252. package/dist/commands/tasks/timeline.d.ts +5 -0
  253. package/dist/commands/tasks/timeline.js +9 -1
  254. package/dist/commands/tasks/update.d.ts +1 -0
  255. package/dist/commands/tasks/update.js +25 -2
  256. package/dist/commands/tasks/updates/add.js +6 -1
  257. package/dist/commands/tasks/updates/list.js +2 -1
  258. package/dist/commands/tasks/upsert.d.ts +1 -0
  259. package/dist/commands/tasks/upsert.js +8 -1
  260. package/dist/commands/token/list.js +2 -1
  261. package/dist/commands/tokens/list.js +2 -1
  262. package/dist/commands/tones/list.js +4 -2
  263. package/dist/commands/triggers/list.js +2 -1
  264. package/dist/commands/views/list.js +2 -1
  265. package/dist/commands/webhooks/list.js +2 -1
  266. package/dist/commands/whoami.js +1 -1
  267. package/dist/commands/widgets/list.js +2 -1
  268. package/dist/commands/widgets/save-as-app.d.ts +13 -0
  269. package/dist/commands/widgets/save-as-app.js +65 -0
  270. package/dist/commands/work-views/list.js +2 -1
  271. package/dist/commands/worklog/list.js +2 -1
  272. package/dist/commands/workspaces/list.js +3 -2
  273. package/dist/commands/workspaces/members.d.ts +1 -0
  274. package/dist/commands/workspaces/members.js +5 -2
  275. package/dist/generated/managed-instruction-guides.json +2 -2
  276. package/dist/help.js +7 -0
  277. package/dist/lib/agent-proactive-baseline.d.ts +9 -0
  278. package/dist/lib/agent-proactive-baseline.js +44 -0
  279. package/dist/lib/agentic-stream.d.ts +4 -1
  280. package/dist/lib/agentic-stream.js +29 -4
  281. package/dist/lib/appData.d.ts +75 -0
  282. package/dist/lib/appData.js +274 -0
  283. package/dist/lib/appInstallations.d.ts +117 -0
  284. package/dist/lib/appInstallations.js +960 -0
  285. package/dist/lib/appSettings.d.ts +3 -0
  286. package/dist/lib/appSettings.js +71 -0
  287. package/dist/lib/appWebhooks.d.ts +7 -0
  288. package/dist/lib/appWebhooks.js +59 -0
  289. package/dist/lib/apps-command.d.ts +44 -0
  290. package/dist/lib/apps-command.js +164 -0
  291. package/dist/lib/apps.d.ts +45 -0
  292. package/dist/lib/apps.js +148 -0
  293. package/dist/lib/appsCheck.d.ts +12 -0
  294. package/dist/lib/appsCheck.js +173 -0
  295. package/dist/lib/appsFs.d.ts +58 -0
  296. package/dist/lib/appsFs.js +384 -0
  297. package/dist/lib/auth-failure.d.ts +20 -0
  298. package/dist/lib/auth-failure.js +40 -3
  299. package/dist/lib/cli-installers.d.ts +9 -2
  300. package/dist/lib/command-miss.js +107 -0
  301. package/dist/lib/commitment-loop-status.js +25 -3
  302. package/dist/lib/commitments.d.ts +44 -3
  303. package/dist/lib/commitments.js +107 -9
  304. package/dist/lib/compasses.d.ts +4 -0
  305. package/dist/lib/compasses.js +11 -0
  306. package/dist/lib/daemon-setup.js +7 -7
  307. package/dist/lib/daemonHandoff.js +3 -2
  308. package/dist/lib/dedicated-ssh.d.ts +2 -0
  309. package/dist/lib/dedicated-ssh.js +98 -28
  310. package/dist/lib/json-output.d.ts +33 -0
  311. package/dist/lib/json-output.js +37 -0
  312. package/dist/lib/list-output.d.ts +9 -4
  313. package/dist/lib/list-output.js +36 -9
  314. package/dist/lib/lookbackPlans.d.ts +13 -0
  315. package/dist/lib/lookbackPlans.js +68 -0
  316. package/dist/lib/machines.d.ts +27 -6
  317. package/dist/lib/machines.js +25 -14
  318. package/dist/lib/member-output.d.ts +20 -0
  319. package/dist/lib/member-output.js +57 -0
  320. package/dist/lib/preflight-copy.d.ts +7 -0
  321. package/dist/lib/preflight-copy.js +31 -0
  322. package/dist/lib/roles.d.ts +2 -2
  323. package/dist/lib/task-admission.d.ts +9 -0
  324. package/dist/lib/task-admission.js +35 -0
  325. package/dist/lib/task-batch.d.ts +4 -0
  326. package/dist/lib/task-batch.js +2 -0
  327. package/dist/lib/task-operations.d.ts +25 -0
  328. package/dist/lib/task-operations.js +123 -0
  329. package/dist/lib/task-preflight.d.ts +35 -0
  330. package/dist/lib/task-preflight.js +121 -0
  331. package/dist/lib/task-resource-references.d.ts +23 -0
  332. package/dist/lib/task-resource-references.js +119 -0
  333. package/dist/lib/task-spec-verification.d.ts +42 -0
  334. package/dist/lib/task-spec-verification.js +101 -0
  335. package/dist/lib/task-work.d.ts +11 -0
  336. package/dist/lib/task-work.js +41 -0
  337. package/dist/lib/task-write-attribution.d.ts +26 -0
  338. package/dist/lib/task-write-attribution.js +47 -0
  339. package/dist/lib/tasks.d.ts +13 -0
  340. package/dist/lib/tasks.js +61 -8
  341. package/dist/lib/triggers.d.ts +7 -0
  342. package/dist/lib/triggers.js +54 -4
  343. package/dist/lib/usage-discovery.d.ts +4 -0
  344. package/dist/lib/usage-discovery.js +14 -4
  345. package/dist/lib/widgetApps.d.ts +10 -0
  346. package/dist/lib/widgetApps.js +47 -0
  347. package/dist/lib/widgetStaticScan.js +25 -1
  348. package/dist/lib/workspaces.d.ts +11 -4
  349. package/dist/lib/workspaces.js +7 -3
  350. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +14 -1
  351. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +47 -2
  352. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.d.ts +49 -1
  353. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +26 -0
  354. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +118 -0
  355. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +614 -0
  356. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +2 -0
  357. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -2
  358. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.d.ts +5 -0
  359. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.js +3 -1
  360. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionRevocation.d.ts +177 -0
  361. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionRevocation.js +484 -0
  362. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.d.ts +11 -0
  363. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +46 -7
  364. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +232 -0
  365. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +372 -0
  366. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/types.d.ts +17 -1
  367. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/types.js +12 -1
  368. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +14 -1
  369. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +45 -2
  370. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.d.ts +49 -1
  371. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +24 -0
  372. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +118 -0
  373. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +608 -0
  374. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +2 -0
  375. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +15 -2
  376. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.d.ts +5 -0
  377. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.js +3 -1
  378. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionRevocation.d.ts +177 -0
  379. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionRevocation.js +472 -0
  380. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.d.ts +11 -0
  381. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +44 -6
  382. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +232 -0
  383. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +360 -0
  384. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/types.d.ts +17 -1
  385. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/types.js +12 -1
  386. package/dist/node_modules/@skrr-ai/auth-core/package.json +30 -0
  387. package/dist/node_modules/@skrr-ai/data-provider/index.js +25239 -18730
  388. package/docs/v1/operations.md +52 -0
  389. package/docs/v1/space-search.md +19 -0
  390. package/oclif.manifest.json +4719 -479
  391. package/package.json +23 -2
@@ -0,0 +1,3 @@
1
+ import type { AppSettings, AppSettingsManifest } from '@skrr-ai/data-provider';
2
+ export declare function readAppSettingsFile(file: string, manifest: AppSettingsManifest): AppSettings;
3
+ export declare function formatAppSettings(manifest: AppSettingsManifest, settings: AppSettings, timezone?: string): string[];
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.readAppSettingsFile = readAppSettingsFile;
37
+ exports.formatAppSettings = formatAppSettings;
38
+ const fs = __importStar(require("node:fs"));
39
+ const data_provider_1 = require("@skrr-ai/data-provider");
40
+ function readAppSettingsFile(file, manifest) {
41
+ // Bound before reading: the UTF-8 file cannot exceed four bytes per permitted UTF-16 character.
42
+ if (fs.statSync(file).size > data_provider_1.APP_SETTINGS_LIMITS.settingsJsonMaxChars * 4)
43
+ throw new Error('Settings file is too large');
44
+ const text = fs.readFileSync(file, 'utf8');
45
+ if (text.length > data_provider_1.APP_SETTINGS_LIMITS.settingsJsonMaxChars)
46
+ throw new Error('Settings file is too large');
47
+ const value = JSON.parse(text);
48
+ if (!data_provider_1.AppSettingsSchema.safeParse(value).success)
49
+ throw new Error('Settings must be a bounded record of non-secret primitive values');
50
+ const parsed = (0, data_provider_1.parseAppSettings)(manifest, value);
51
+ if (!parsed.ok)
52
+ throw new Error(parsed.issues.map((issue) => `${issue.path}: ${issue.message}`).join('; '));
53
+ return parsed.settings;
54
+ }
55
+ function formatAppSettings(manifest, settings, timezone = 'your account timezone') {
56
+ const jobs = (0, data_provider_1.appSettingsSchedulePreview)(manifest, settings);
57
+ if (jobs.some((job) => job.problem))
58
+ throw new Error(jobs
59
+ .filter((job) => job.problem)
60
+ .map((job) => `${(0, data_provider_1.plainAppLabel)(job.title)}: ${job.problem}`)
61
+ .join('; '));
62
+ return [
63
+ `Settings: ${JSON.stringify(settings)}`,
64
+ ...jobs.map((job) => `${(0, data_provider_1.plainAppLabel)(job.title)}: ${job.schedule} (${timezone})`),
65
+ ...(jobs.length
66
+ ? [
67
+ 'These jobs run under your existing installer authority and may use model/runtime quota. Saving explicitly approves these settings and schedules.',
68
+ ]
69
+ : []),
70
+ ];
71
+ }
@@ -0,0 +1,7 @@
1
+ import type { AppWebhookList, AppWebhookView } from '@skrr-ai/data-provider';
2
+ /** The list a server sent, or null when this CLI does not understand it ("cannot show", never "no hooks"). */
3
+ export declare function readWebhookList(raw: unknown): AppWebhookList | null;
4
+ /** One hook, in lines. The path is the endpoint's address on this platform; it is not a secret and is not a credential. */
5
+ export declare function formatWebhook(view: AppWebhookView): string[];
6
+ /** The lines of a whole list; an empty list says so in words. */
7
+ export declare function formatWebhookList(list: AppWebhookList): string[];
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readWebhookList = readWebhookList;
4
+ exports.formatWebhook = formatWebhook;
5
+ exports.formatWebhookList = formatWebhookList;
6
+ /**
7
+ * `skrr apps webhooks list`: what the inbound hooks of an installed app look like to a terminal.
8
+ *
9
+ * It builds no URL. The call is `dataService.listAppInstallationWebhooks` (`@skrr-ai/data-provider`), which is
10
+ * what keeps this CLI and the web screen on one route (and what `domain-api-parity.spec.ts` checks). What lives
11
+ * here is what a terminal needs around it: reading the list through the contract, and saying each hook in a line.
12
+ *
13
+ * WHAT IT NEVER SHOWS. The list carries the existence of an endpoint, its state, its revision and its times, and
14
+ * nothing that works as a credential: the token and the signing secret are shown ONCE, by whatever made them, and
15
+ * cannot be read again by anyone. (No screen in the product makes one today: the routes admit only an interactive
16
+ * first-party session, so this says "no endpoint has been made yet" and does not send a person to a screen.) There is deliberately no `create`, `rotate` or `revoke` here
17
+ * (the routes admit only an interactive first-party session; a credential printed to a terminal lands in the
18
+ * transcript of whatever is running there), so this file has nothing to print that could be one.
19
+ */
20
+ const data_provider_1 = require("@skrr-ai/data-provider");
21
+ /** The list a server sent, or null when this CLI does not understand it ("cannot show", never "no hooks"). */
22
+ function readWebhookList(raw) {
23
+ return (0, data_provider_1.parseAppWebhookList)(raw);
24
+ }
25
+ function endpointWords(view) {
26
+ const endpoint = view.endpoint;
27
+ if (!endpoint) {
28
+ return view.declared
29
+ ? 'declared; no endpoint yet (no screen in the product makes one today)'
30
+ : 'nothing';
31
+ }
32
+ if (endpoint.state === 'revoked') {
33
+ return `revoked ${endpoint.revokedAt ?? ''}`.trim();
34
+ }
35
+ const parts = [`active (rev ${endpoint.rev}, ${endpoint.lastSeq} accepted)`];
36
+ if (endpoint.previousValidUntil) {
37
+ parts.push(`the previous credentials still work until ${endpoint.previousValidUntil}`);
38
+ }
39
+ if (!view.declared) {
40
+ parts.push('the running version no longer declares it, so it receives nothing');
41
+ }
42
+ return parts.join('; ');
43
+ }
44
+ /** One hook, in lines. The path is the endpoint's address on this platform; it is not a secret and is not a credential. */
45
+ function formatWebhook(view) {
46
+ const head = `${view.name} -> ${view.collection ?? '(not declared by the running version)'}${view.title ? ` "${view.title}"` : ''}`;
47
+ const lines = [head, ` ${endpointWords(view)}`];
48
+ if (view.endpoint) {
49
+ lines.push(` POST ${view.endpoint.path}`);
50
+ }
51
+ return lines;
52
+ }
53
+ /** The lines of a whole list; an empty list says so in words. */
54
+ function formatWebhookList(list) {
55
+ if (list.webhooks.length === 0) {
56
+ return ['This installation declares no webhooks.'];
57
+ }
58
+ return list.webhooks.flatMap((view) => formatWebhook(view));
59
+ }
@@ -0,0 +1,44 @@
1
+ import { BaseCommand } from '../base-command';
2
+ /**
3
+ * The base of every `skrr apps` command that talks to the API.
4
+ *
5
+ * What it adds to `BaseCommand` is one thing: the loop's refusals (a stale revision, a path that is not
6
+ * allowed, a draft with errors) are not API failures to be translated generically, they are answers, and
7
+ * a harness that reads this CLI's exit and `--json` has to be able to tell `APP_REV_MISMATCH` (read again,
8
+ * retry) from `APP_CHECK_FAILED` (fix the draft) from a network error (try later). The ones this does not
9
+ * know (forbidden, not found, the server being down) are the base command's to say.
10
+ */
11
+ export declare abstract class AppsCommand extends BaseCommand {
12
+ /** The id of the app the person named (an id or a slug). */
13
+ protected appId(ref: string): Promise<string>;
14
+ /**
15
+ * Say what went wrong with an INSTALLATION call (`/api/apps/installations`): the refusals that route makes
16
+ * are answers with a next step (a bundle that moved while the person decided, data that would be deleted),
17
+ * so they come under their own machine code and exit, and a refusal that is not one of them is the base
18
+ * command's. Never returns.
19
+ */
20
+ protected failInstallation(error: unknown, { subject }?: {
21
+ subject?: string;
22
+ }): never;
23
+ /**
24
+ * Say what went wrong with a call to the PERSON channel (`apps data put | query`): a document that was not given or
25
+ * is not JSON (before anything was sent), a refusal from the contract's closed set, or a conflict, which is an
26
+ * answer ("someone wrote first": the revision to retry from) and exits non-zero because nothing was written. What
27
+ * the channel does not say (the server being down, a sign-in that expired) is the base command's. Never returns.
28
+ */
29
+ protected failPersonData(error: unknown, target: {
30
+ installation: string;
31
+ collection: string;
32
+ id?: string;
33
+ }): never;
34
+ /**
35
+ * Say what went wrong with a REPORT: the refusals only a report makes (a reason the Store does not take, a
36
+ * second report on the same version) get their own machine code and words; the ones an installation call
37
+ * also makes (not found, forbidden) are {@link failInstallation}'s. Never returns.
38
+ */
39
+ protected failReport(error: unknown): never;
40
+ /** Say what went wrong with a call, in the loop's own terms where it has them. Never returns. */
41
+ protected failApps(error: unknown, { subject }?: {
42
+ subject?: string;
43
+ }): never;
44
+ }
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppsCommand = void 0;
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../base-command");
6
+ const apps_1 = require("./apps");
7
+ const appInstallations_1 = require("./appInstallations");
8
+ const appsFs_1 = require("./appsFs");
9
+ const appData_1 = require("./appData");
10
+ /**
11
+ * The base of every `skrr apps` command that talks to the API.
12
+ *
13
+ * What it adds to `BaseCommand` is one thing: the loop's refusals (a stale revision, a path that is not
14
+ * allowed, a draft with errors) are not API failures to be translated generically, they are answers, and
15
+ * a harness that reads this CLI's exit and `--json` has to be able to tell `APP_REV_MISMATCH` (read again,
16
+ * retry) from `APP_CHECK_FAILED` (fix the draft) from a network error (try later). The ones this does not
17
+ * know (forbidden, not found, the server being down) are the base command's to say.
18
+ */
19
+ class AppsCommand extends base_command_1.BaseCommand {
20
+ /** The id of the app the person named (an id or a slug). */
21
+ async appId(ref) {
22
+ try {
23
+ return await (0, apps_1.resolveAppRef)(ref);
24
+ }
25
+ catch (error) {
26
+ if (error instanceof apps_1.AppRefError) {
27
+ return this.failWithCliError({
28
+ message: error.message,
29
+ code: error.code === 'ambiguous' ? 'APP_AMBIGUOUS' : 'APP_NOT_FOUND',
30
+ exit: error.code === 'ambiguous' ? 1 : 4,
31
+ retryable: false,
32
+ });
33
+ }
34
+ return this.handleApiError(error);
35
+ }
36
+ }
37
+ /**
38
+ * Say what went wrong with an INSTALLATION call (`/api/apps/installations`): the refusals that route makes
39
+ * are answers with a next step (a bundle that moved while the person decided, data that would be deleted),
40
+ * so they come under their own machine code and exit, and a refusal that is not one of them is the base
41
+ * command's. Never returns.
42
+ */
43
+ failInstallation(error, { subject } = {}) {
44
+ const refusal = (0, apps_1.readAppsRefusal)(error);
45
+ if (refusal && (0, data_provider_1.isAppInstallationConflict)(refusal.error)) {
46
+ const words = (0, appInstallations_1.describeInstallationConflict)(refusal, this.config.bin);
47
+ if (words !== null) {
48
+ return this.failWithCliError({
49
+ message: words,
50
+ code: appInstallations_1.ALL_INSTALLATION_REFUSAL_CODES[refusal.error],
51
+ ...(refusal.status === undefined ? {} : { status: refusal.status }),
52
+ exit: (0, appInstallations_1.installationRefusalExit)(refusal.error),
53
+ retryable: false,
54
+ details: {
55
+ ...(refusal.reason === undefined ? {} : { reason: refusal.reason }),
56
+ ...(refusal.docCount === undefined ? {} : { docCount: refusal.docCount }),
57
+ ...(refusal.installationId === undefined
58
+ ? {}
59
+ : { installationId: refusal.installationId }),
60
+ ...(refusal.current ? { current: refusal.current } : {}),
61
+ },
62
+ });
63
+ }
64
+ }
65
+ return this.failApps(error, subject ? { subject } : {});
66
+ }
67
+ /**
68
+ * Say what went wrong with a call to the PERSON channel (`apps data put | query`): a document that was not given or
69
+ * is not JSON (before anything was sent), a refusal from the contract's closed set, or a conflict, which is an
70
+ * answer ("someone wrote first": the revision to retry from) and exits non-zero because nothing was written. What
71
+ * the channel does not say (the server being down, a sign-in that expired) is the base command's. Never returns.
72
+ */
73
+ failPersonData(error, target) {
74
+ if (error instanceof appData_1.AppDataInputError) {
75
+ return this.failWithCliError({
76
+ message: error.message,
77
+ code: error.code,
78
+ exit: 2,
79
+ retryable: false,
80
+ });
81
+ }
82
+ if (error instanceof appsFs_1.AppsFsError) {
83
+ return this.failApps(error);
84
+ }
85
+ const failure = (0, appData_1.readPersonDataFailure)(error);
86
+ if (failure === null) {
87
+ return this.failApps(error);
88
+ }
89
+ if (failure.kind === 'conflict') {
90
+ return this.failWithCliError({
91
+ message: (0, appData_1.describePersonDataConflict)(failure, { ...target, id: target.id ?? '<id>' }, this.config.bin),
92
+ code: appData_1.PERSON_DATA_CONFLICT_CODES[failure.conflict],
93
+ ...(failure.status === undefined ? {} : { status: failure.status }),
94
+ exit: (0, appData_1.personDataFailureExit)(failure),
95
+ retryable: false,
96
+ details: {
97
+ conflict: failure.conflict,
98
+ ...(failure.currentRev === undefined ? {} : { currentRev: failure.currentRev }),
99
+ },
100
+ });
101
+ }
102
+ return this.failWithCliError({
103
+ message: (0, appData_1.describePersonDataRefusal)(failure, this.config.bin),
104
+ code: appData_1.PERSON_DATA_REFUSAL_CODES[failure.code],
105
+ ...(failure.status === undefined ? {} : { status: failure.status }),
106
+ exit: (0, appData_1.personDataFailureExit)(failure),
107
+ retryable: (0, appData_1.personDataFailureRetryable)(failure),
108
+ ...(failure.retryAfterMs === undefined
109
+ ? {}
110
+ : { details: { retryAfterMs: failure.retryAfterMs } }),
111
+ });
112
+ }
113
+ /**
114
+ * Say what went wrong with a REPORT: the refusals only a report makes (a reason the Store does not take, a
115
+ * second report on the same version) get their own machine code and words; the ones an installation call
116
+ * also makes (not found, forbidden) are {@link failInstallation}'s. Never returns.
117
+ */
118
+ failReport(error) {
119
+ const refusal = (0, apps_1.readAppsRefusal)(error);
120
+ const machineCode = refusal?.error ? appInstallations_1.REPORT_REFUSAL_CODES[refusal.error] : undefined;
121
+ if (refusal && machineCode) {
122
+ const words = (0, appInstallations_1.describeReportRefusal)(refusal, this.config.bin);
123
+ if (words !== null) {
124
+ return this.failWithCliError({
125
+ message: words,
126
+ code: machineCode,
127
+ ...(refusal.status === undefined ? {} : { status: refusal.status }),
128
+ exit: 1,
129
+ retryable: false,
130
+ });
131
+ }
132
+ }
133
+ return this.failInstallation(error);
134
+ }
135
+ /** Say what went wrong with a call, in the loop's own terms where it has them. Never returns. */
136
+ failApps(error, { subject } = {}) {
137
+ if (error instanceof appsFs_1.AppsFsError) {
138
+ return this.failWithCliError({
139
+ message: error.message,
140
+ code: `APP_FS_${error.code.toUpperCase()}`,
141
+ exit: 1,
142
+ retryable: false,
143
+ details: { at: error.at },
144
+ });
145
+ }
146
+ const refusal = (0, apps_1.readAppsRefusal)(error);
147
+ if (refusal && refusal.error && apps_1.APPS_REFUSAL_CODES[refusal.error]) {
148
+ return this.failWithCliError({
149
+ message: (0, apps_1.describeAppsRefusal)(refusal, this.config.bin),
150
+ code: apps_1.APPS_REFUSAL_CODES[refusal.error],
151
+ ...(refusal.status === undefined ? {} : { status: refusal.status }),
152
+ exit: 1,
153
+ retryable: false,
154
+ details: {
155
+ ...(refusal.currentRev === undefined ? {} : { currentRev: refusal.currentRev }),
156
+ ...(refusal.problems ? { problems: refusal.problems } : {}),
157
+ ...(refusal.check ? { check: refusal.check } : {}),
158
+ },
159
+ });
160
+ }
161
+ return this.handleApiError(error, subject ? { subject } : {});
162
+ }
163
+ }
164
+ exports.AppsCommand = AppsCommand;
@@ -0,0 +1,45 @@
1
+ import type { AppCheckReport, AppListedEntry, AppPathProblem, AppSummary } from '@skrr-ai/data-provider';
2
+ export declare class AppRefError extends Error {
3
+ readonly code: 'not_found' | 'ambiguous';
4
+ constructor(code: 'not_found' | 'ambiguous', message: string);
5
+ }
6
+ /**
7
+ * The id of the app a person named: an id (`app_...`) is taken as it is, a slug is looked up among the
8
+ * apps they can edit. Two apps with one slug (their own and one shared with them) is ambiguous and says
9
+ * both ids.
10
+ */
11
+ export declare function resolveAppRef(ref: string): Promise<string>;
12
+ /** What a refusal the server made on purpose carries (`{ error, message, ...details }`). */
13
+ export interface AppsRefusal {
14
+ status?: number;
15
+ error?: string;
16
+ message?: string;
17
+ currentRev?: number;
18
+ previewRev?: number;
19
+ path?: string;
20
+ problems?: AppPathProblem[];
21
+ check?: AppCheckReport;
22
+ /** An installation call's refusal (`appInstallations.ts`): the reason a `forbidden` carries, and what a conflict names. */
23
+ reason?: string;
24
+ docCount?: number;
25
+ installationId?: string;
26
+ current?: {
27
+ versionId?: string;
28
+ bundleHash?: string;
29
+ };
30
+ /** What an install was MISSING (`issues`) and why what it carried would not do (`unsuitable`), on a `binding_required`. */
31
+ issues?: unknown;
32
+ unsuitable?: unknown;
33
+ /** What an app declares that the principal it would be installed on cannot serve, on a `principal_scope_unserved`. */
34
+ unserved?: unknown;
35
+ }
36
+ /** Read the refusal out of an API error, or null when the error is not one of ours (a network failure, an HTML error page). */
37
+ export declare function readAppsRefusal(error: unknown): AppsRefusal | null;
38
+ /** Refusals this CLI reads itself, with the machine code it exits under. Everything else is the base command's. */
39
+ export declare const APPS_REFUSAL_CODES: Record<string, string>;
40
+ /** The words for a refusal: what it was, the revision to retry from, each problem, what to do. */
41
+ export declare function describeAppsRefusal(refusal: AppsRefusal, bin: string): string;
42
+ /** A table row of the apps a person can edit. */
43
+ export declare function formatAppRow(app: AppSummary): string;
44
+ /** `dir/` and `file (size)` lines, as `ls` would. */
45
+ export declare function formatEntryLine(entry: AppListedEntry): string;
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APPS_REFUSAL_CODES = exports.AppRefError = void 0;
4
+ exports.resolveAppRef = resolveAppRef;
5
+ exports.readAppsRefusal = readAppsRefusal;
6
+ exports.describeAppsRefusal = describeAppsRefusal;
7
+ exports.formatAppRow = formatAppRow;
8
+ exports.formatEntryLine = formatEntryLine;
9
+ /**
10
+ * `skrr apps`: what the commands share. The domain lib of the Agent App authoring loop.
11
+ *
12
+ * It builds no URL. Every call to the API is a `dataService` function (`@skrr-ai/data-provider`), which
13
+ * is what keeps this CLI, the web editor and the MCP tools on one set of routes (and what
14
+ * `domain-api-parity.spec.ts` checks). What lives here is what a terminal needs around them: finding an
15
+ * app by the name a person types, reading a refusal the server made on purpose, and saying a result.
16
+ */
17
+ const data_provider_1 = require("@skrr-ai/data-provider");
18
+ const appInstallations_1 = require("./appInstallations");
19
+ /** An app's public id: what the API addresses an app by. A slug cannot look like one (no underscore). */
20
+ const APP_ID = /^app_[A-Za-z0-9_-]{1,60}$/;
21
+ class AppRefError extends Error {
22
+ code;
23
+ constructor(code, message) {
24
+ super(message);
25
+ this.name = 'AppRefError';
26
+ this.code = code;
27
+ }
28
+ }
29
+ exports.AppRefError = AppRefError;
30
+ /**
31
+ * The id of the app a person named: an id (`app_...`) is taken as it is, a slug is looked up among the
32
+ * apps they can edit. Two apps with one slug (their own and one shared with them) is ambiguous and says
33
+ * both ids.
34
+ */
35
+ async function resolveAppRef(ref) {
36
+ if (APP_ID.test(ref)) {
37
+ return ref;
38
+ }
39
+ const { apps, truncated } = await data_provider_1.dataService.listMyApps({ limit: data_provider_1.APP_DRAFT_LIMITS.appsListMax });
40
+ const matches = apps.filter((app) => app.slug === ref);
41
+ if (matches.length === 1) {
42
+ return matches[0].id;
43
+ }
44
+ if (matches.length === 0) {
45
+ // A cut list cannot say "no such app", only "not among these": the person may edit more than one page of them.
46
+ throw new AppRefError('not_found', truncated === true
47
+ ? `No app called "${ref}" is among the ${apps.length} you changed most recently, and you can edit more than that, so it may exist. Give its id (app_...) instead of its slug.`
48
+ : `No app you can edit is called "${ref}". List yours with \`apps list\`, or give the id (app_...).`);
49
+ }
50
+ throw new AppRefError('ambiguous', `"${ref}" names more than one app (${matches.map((app) => app.id).join(', ')}): give the id.`);
51
+ }
52
+ /** Read the refusal out of an API error, or null when the error is not one of ours (a network failure, an HTML error page). */
53
+ function readAppsRefusal(error) {
54
+ const e = error;
55
+ if (!e || typeof e.body !== 'string') {
56
+ return null;
57
+ }
58
+ try {
59
+ const body = JSON.parse(e.body);
60
+ if (!body || typeof body !== 'object' || typeof body.error !== 'string') {
61
+ return null;
62
+ }
63
+ return {
64
+ ...(typeof e.status === 'number' ? { status: e.status } : {}),
65
+ error: body.error,
66
+ ...(typeof body.message === 'string' ? { message: body.message } : {}),
67
+ ...(typeof body.currentRev === 'number' ? { currentRev: body.currentRev } : {}),
68
+ ...(typeof body.previewRev === 'number' ? { previewRev: body.previewRev } : {}),
69
+ ...(typeof body.path === 'string' ? { path: body.path } : {}),
70
+ ...(Array.isArray(body.problems) ? { problems: body.problems } : {}),
71
+ ...(body.check && typeof body.check === 'object'
72
+ ? { check: body.check }
73
+ : {}),
74
+ ...(typeof body.reason === 'string' ? { reason: body.reason } : {}),
75
+ ...(typeof body.docCount === 'number' ? { docCount: body.docCount } : {}),
76
+ ...(typeof body.installationId === 'string' ? { installationId: body.installationId } : {}),
77
+ ...(body.current && typeof body.current === 'object'
78
+ ? { current: body.current }
79
+ : {}),
80
+ ...(Array.isArray(body.issues) ? { issues: body.issues } : {}),
81
+ ...(body.unsuitable && typeof body.unsuitable === 'object'
82
+ ? { unsuitable: body.unsuitable }
83
+ : {}),
84
+ ...(Array.isArray(body.unserved) ? { unserved: body.unserved } : {}),
85
+ };
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ }
91
+ /** Refusals this CLI reads itself, with the machine code it exits under. Everything else is the base command's. */
92
+ exports.APPS_REFUSAL_CODES = {
93
+ rev_mismatch: 'APP_REV_MISMATCH',
94
+ invalid: 'APP_INVALID',
95
+ exists: 'APP_EXISTS',
96
+ check_failed: 'APP_CHECK_FAILED',
97
+ limit: 'APP_LIMIT',
98
+ visibility_unavailable: 'APP_VISIBILITY_UNAVAILABLE',
99
+ preview_superseded: 'APP_PREVIEW_SUPERSEDED',
100
+ preview_expired: 'APP_PREVIEW_EXPIRED',
101
+ // the installation calls (`appInstallations.ts`): installing, approving again, moving, pausing, removing
102
+ ...appInstallations_1.INSTALLATION_REFUSAL_CODES,
103
+ };
104
+ /** The words for a refusal: what it was, the revision to retry from, each problem, what to do. */
105
+ function describeAppsRefusal(refusal, bin) {
106
+ const installation = (0, appInstallations_1.describeInstallationConflict)(refusal, bin);
107
+ if (installation !== null) {
108
+ return installation;
109
+ }
110
+ const lines = [refusal.message || refusal.error || 'refused'];
111
+ if (refusal.error === 'rev_mismatch' && refusal.currentRev !== undefined) {
112
+ lines.push(`→ The draft is now at revision ${refusal.currentRev}. Read it again (\`${bin} apps file ls <app>\` shows \`rev\`), merge, and retry with --expected-rev ${refusal.currentRev}.`);
113
+ }
114
+ if (refusal.error === 'preview_superseded' || refusal.error === 'preview_expired') {
115
+ lines.push(`→ Open a new preview: \`${bin} apps preview <app>\`.`);
116
+ }
117
+ for (const problem of (refusal.problems ?? []).slice(0, 10)) {
118
+ lines.push(` - ${problem.path ? `${problem.path}: ` : ''}${problem.message}`);
119
+ }
120
+ if ((refusal.problems ?? []).length > 10) {
121
+ lines.push(` - ...and ${(refusal.problems ?? []).length - 10} more`);
122
+ }
123
+ if (refusal.check) {
124
+ const first = refusal.check.issues.filter((issue) => issue.severity === 'error').slice(0, 5);
125
+ for (const issue of first) {
126
+ lines.push(` - ${issue.code}${issue.path ? ` ${issue.path}${issue.line ? `:${issue.line}` : ''}` : ''}: ${issue.message}`);
127
+ }
128
+ lines.push(`→ Run \`${bin} apps check-draft <app>\` for the whole report.`);
129
+ }
130
+ return lines.join('\n');
131
+ }
132
+ /** A table row of the apps a person can edit. */
133
+ function formatAppRow(app) {
134
+ return [
135
+ app.id,
136
+ app.slug.padEnd(24),
137
+ `rev ${app.draftRev ?? '-'}`.padEnd(8),
138
+ app.latestVersionId ? `latest ${app.latestVersionId}` : 'no published version',
139
+ ].join(' ');
140
+ }
141
+ /** `dir/` and `file (size)` lines, as `ls` would. */
142
+ function formatEntryLine(entry) {
143
+ if (entry.kind === 'dir') {
144
+ return `${entry.name}/`;
145
+ }
146
+ const where = entry.storage === 'asset' ? 'asset' : `${entry.size ?? 0} bytes`;
147
+ return `${entry.name} (${where})`;
148
+ }
@@ -0,0 +1,12 @@
1
+ import type { AppCheckReport, AppDraftFile } from '@skrr-ai/data-provider';
2
+ /** Compile `source` as a classic script and say what is wrong with it, or null. */
3
+ export declare function compileScript(source: string): {
4
+ message: string;
5
+ line?: number;
6
+ } | null;
7
+ /** Check a package that is already in memory. */
8
+ export declare function checkLocalFiles(files: readonly AppDraftFile[], options?: {
9
+ expectedId?: string;
10
+ }): AppCheckReport;
11
+ /** The report as lines for a terminal: the verdict, then each finding with where it is and what to do. */
12
+ export declare function formatAppCheckReport(report: AppCheckReport): string[];