@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,173 @@
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.compileScript = compileScript;
37
+ exports.checkLocalFiles = checkLocalFiles;
38
+ exports.formatAppCheckReport = formatAppCheckReport;
39
+ /**
40
+ * `skrr apps check`: the authoring self-check, offline.
41
+ *
42
+ * The check is `checkAppPackage` in `@skrr-ai/data-provider`, the one implementation the server runs
43
+ * too (`app_check`, and the gate before a version is cut), so what a harness is told here is what the
44
+ * platform will say. This file supplies the two things that package cannot do for itself:
45
+ *
46
+ * - compile a classic script (`vm.Script`, which parses and never runs), and
47
+ * - read the frame heuristics. That scanner is `widgetStaticScan.ts`, the one `skrr widgets check`
48
+ * runs, passed in as it is: this EXTENDS the widget check to a whole package and does not copy it.
49
+ * (The server's copy is transpiled from the same file and held to it by a spec.)
50
+ *
51
+ * It reaches no API. A package on disk is read with `appsFs.ts`, which never follows a link.
52
+ */
53
+ const vm = __importStar(require("node:vm"));
54
+ const data_provider_1 = require("@skrr-ai/data-provider");
55
+ const widgetStaticScan_1 = require("./widgetStaticScan");
56
+ /** Compile `source` as a classic script and say what is wrong with it, or null. */
57
+ function compileScript(source) {
58
+ try {
59
+ new vm.Script(source, { filename: 'app.js' });
60
+ return null;
61
+ }
62
+ catch (error) {
63
+ const message = error?.message;
64
+ const stack = error?.stack;
65
+ const head = typeof stack === 'string' ? stack.split('\n')[0] : '';
66
+ const at = /^app\.js:(\d+)/.exec(head);
67
+ return {
68
+ message: typeof message === 'string' ? message : String(error),
69
+ ...(at ? { line: Number(at[1]) } : {}),
70
+ };
71
+ }
72
+ }
73
+ function scanSandbox(sections) {
74
+ const scan = (0, widgetStaticScan_1.scanWidgetSource)(sections);
75
+ return {
76
+ findings: scan.findings.map((found) => ({
77
+ severity: found.severity,
78
+ code: found.code,
79
+ section: found.section,
80
+ line: found.line,
81
+ message: found.message,
82
+ ...(found.fix ? { fix: found.fix } : {}),
83
+ })),
84
+ inlineScripts: scan.inlineScripts,
85
+ };
86
+ }
87
+ /** Check a package that is already in memory. */
88
+ function checkLocalFiles(files, options = {}) {
89
+ return (0, data_provider_1.checkAppPackage)(files, {
90
+ ...(options.expectedId === undefined ? {} : { expectedId: options.expectedId }),
91
+ checkScriptSyntax: compileScript,
92
+ scanSandbox,
93
+ });
94
+ }
95
+ /** How a finding's effect on a store listing reads in a terminal. Words, not colours: the line is also read by an agent. */
96
+ const TIER_TAG = {
97
+ block: 'keeps it out of the store',
98
+ warn: 'shown to the installer',
99
+ info: 'shown, low-key',
100
+ unanalyzable: 'cannot analyze',
101
+ };
102
+ /** The store gate in one sentence per outcome. None of them is a green light. */
103
+ function storeLine(report) {
104
+ const { outcome, counts, store } = report.security;
105
+ switch (outcome) {
106
+ case 'blocked_for_store':
107
+ return `store: ${store.blockers} finding${store.blockers === 1 ? '' : 's'} would keep this out of the store${store.strict ? ' (under the stricter reading for a first app or a version that asks for more)' : ''}. Drafts, versions and private installs are not affected.`;
108
+ case 'cannot_analyze':
109
+ return `store: ${counts.unanalyzable} place${counts.unanalyzable === 1 ? '' : 's'} could not be read. Nothing else keeps it out of the store, and nothing says it is safe.`;
110
+ case 'findings':
111
+ return `store: ${counts.warn + counts.info} finding${counts.warn + counts.info === 1 ? '' : 's'} to read; none keeps it out of the store.`;
112
+ default:
113
+ return 'store: nothing found. That is not a statement that the app is safe; see below.';
114
+ }
115
+ }
116
+ function placeOf(issue) {
117
+ if (!issue.path)
118
+ return '';
119
+ return issue.line ? `${issue.path}:${issue.line}` : issue.path;
120
+ }
121
+ /** The report as lines for a terminal: the verdict, then each finding with where it is and what to do. */
122
+ function formatAppCheckReport(report) {
123
+ const lines = [];
124
+ const { errors, warnings, blockers } = report.summary;
125
+ lines.push(report.ok
126
+ ? `ok: no errors${warnings > 0 ? `, ${warnings} warning${warnings === 1 ? '' : 's'}` : ''}`
127
+ : `not ok: ${errors} error${errors === 1 ? '' : 's'}${warnings > 0 ? `, ${warnings} warning${warnings === 1 ? '' : 's'}` : ''}` +
128
+ (blockers < errors
129
+ ? ` (${blockers} would stop a version being cut; the other ${errors - blockers} ${errors - blockers === 1 ? 'is a guess from reading the source' : 'are guesses from reading the source'})`
130
+ : ' (all would stop a version being cut)'));
131
+ lines.push(`files: ${report.files.count}/${report.files.maxFiles}, ${report.files.chars}/${report.files.maxChars} characters`);
132
+ if (report.entry) {
133
+ const part = (name, use) => `${name} ${use.used}/${use.max} (${use.percent}%)`;
134
+ lines.push(`entry: ${part('css', report.entry.css)}, ${part('html', report.entry.html)}, ${part('js', report.entry.js)}, ${part('total', report.entry.total)}`);
135
+ }
136
+ if (report.capabilities.declared.length > 0 || report.capabilities.used.length > 0) {
137
+ lines.push(`capabilities: declared [${report.capabilities.declared.join(', ')}], used by the script [${report.capabilities.used.join(', ')}]`);
138
+ }
139
+ // A report from a server older than the store gate has no `security` section: print what it has.
140
+ const security = report.security;
141
+ if (security) {
142
+ lines.push(storeLine(report));
143
+ if (!security.scan.complete) {
144
+ lines.push(`scan: stopped before the end (${security.scan.filesSkipped} of ${security.scan.filesScanned + security.scan.filesSkipped} files not read in full).`);
145
+ }
146
+ if (security.disabledRules.length > 0) {
147
+ lines.push(`policy: ${security.disabledRules.length} rule(s) switched off: ${security.disabledRules.join(', ')}`);
148
+ }
149
+ }
150
+ const explained = {};
151
+ for (const issue of report.issues) {
152
+ const place = placeOf(issue);
153
+ const tag = issue.tier ? ` [${TIER_TAG[issue.tier]}]` : '';
154
+ lines.push(`${issue.severity === 'error' ? 'error' : 'warn '} ${issue.code}${place ? ` ${place}` : ''}${issue.at ? ` (${issue.at})` : ''}${issue.heuristic ? ' [heuristic]' : ''}${tag}`);
155
+ lines.push(` ${issue.message}`);
156
+ if (issue.evidence)
157
+ lines.push(` found: ${issue.evidence}`);
158
+ const rule = issue.tier && security ? security.rules[issue.code] : undefined;
159
+ if (rule && explained[issue.code] !== true) {
160
+ explained[issue.code] = true;
161
+ lines.push(` why it matters: ${rule.why}`);
162
+ }
163
+ if (issue.fix)
164
+ lines.push(` fix: ${issue.fix}`);
165
+ }
166
+ if (security) {
167
+ lines.push('', security.limitations.headline);
168
+ for (const point of security.limitations.points)
169
+ lines.push(` - ${point}`);
170
+ }
171
+ lines.push('', report.heuristic);
172
+ return lines;
173
+ }
@@ -0,0 +1,58 @@
1
+ import type { AppDraftFile, AppPathProblem } from '@skrr-ai/data-provider';
2
+ /** Why a read or a write of a package was refused. */
3
+ export type AppsFsErrorCode = 'symlink' | 'not_regular' | 'too_large' | 'too_many' | 'not_text' | 'bad_path' | 'outside_root' | 'exists' | 'not_directory' | 'unreadable';
4
+ export declare class AppsFsError extends Error {
5
+ readonly code: AppsFsErrorCode;
6
+ /** The path (relative to the package, or as typed) the refusal is about. */
7
+ readonly at: string;
8
+ constructor(code: AppsFsErrorCode, at: string, message: string);
9
+ }
10
+ /** UTF-8 is at most four bytes a character: the largest file a text of the limit's length can be. */
11
+ export declare const APPS_FS_FILE_MAX_BYTES: number;
12
+ export interface LocalPackage {
13
+ /** The root, resolved once. */
14
+ root: string;
15
+ files: AppDraftFile[];
16
+ /** What was left out on purpose: a name that starts with ".", `node_modules`. Never a link, never a file. */
17
+ skipped: string[];
18
+ }
19
+ /** A seam for the spec only: runs between the look (`lstat`) and the open, where a race would land. */
20
+ export interface ReadHooks {
21
+ betweenLookAndOpen?: () => void;
22
+ }
23
+ /**
24
+ * Read ONE file the way the rules above say, from a name the caller already trusts to be a candidate.
25
+ * Returns its text. `label` is what the file is called in a message.
26
+ */
27
+ export declare function readRegularTextFile(absolute: string, label: string, hooks?: ReadHooks): string;
28
+ /**
29
+ * Read a package directory: every regular file under `root`, as text, with its package path.
30
+ *
31
+ * Throws `AppsFsError` for what must not be followed or cannot be stored (a link, a pipe, a file that is
32
+ * too large or not text, a name the contract refuses, too many files). The caller still judges the whole
33
+ * set (`appDraftProblems`), which is where case collisions and totals are.
34
+ */
35
+ export declare function readPackageDir(rootInput: string): LocalPackage;
36
+ export interface WriteResult {
37
+ root: string;
38
+ written: string[];
39
+ }
40
+ /** The problems of a set of paths a server sent, judged as strangers' input. */
41
+ export declare function remoteTreeProblems(files: readonly AppDraftFile[]): AppPathProblem[];
42
+ /**
43
+ * Write files into `rootInput`. All of them are judged first and nothing is written unless all are
44
+ * acceptable; an existing file is replaced only with `force`, and a link is never written through or
45
+ * replaced.
46
+ */
47
+ export declare function writePackageDir(rootInput: string, files: readonly AppDraftFile[], { force }?: {
48
+ force?: boolean;
49
+ }): WriteResult;
50
+ /**
51
+ * Text from stdin, bounded: a pipe that never ends is read until the limit and then refused, not until
52
+ * the memory is gone. Strict UTF-8, kept byte for byte.
53
+ */
54
+ export declare function readStdinText(stream?: NodeJS.ReadableStream): Promise<string>;
55
+ export declare const APPS_FS_FLAGS: {
56
+ readonly O_NOFOLLOW: number;
57
+ readonly O_DIRECTORY: number;
58
+ };
@@ -0,0 +1,384 @@
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.APPS_FS_FLAGS = exports.APPS_FS_FILE_MAX_BYTES = exports.AppsFsError = void 0;
37
+ exports.readRegularTextFile = readRegularTextFile;
38
+ exports.readPackageDir = readPackageDir;
39
+ exports.remoteTreeProblems = remoteTreeProblems;
40
+ exports.writePackageDir = writePackageDir;
41
+ exports.readStdinText = readStdinText;
42
+ /**
43
+ * `skrr apps`: reading an app's package off a disk, and writing one onto it, without being led out of it.
44
+ *
45
+ * WHY THIS IS ITS OWN FILE. A package directory is the one place in the authoring loop where a NAME is
46
+ * not a string but a thing on a disk, and a name on a disk can be something else: a symbolic link to
47
+ * `~/.skrr/credentials`, a link to a directory outside the package, a device or a pipe that never ends.
48
+ * The platform's design (unified design 7.2, after the worst incident Anthropic described around its
49
+ * own sandbox) is one rule: RESOLVE BEFORE YOU CHECK. A path string that passes `isSafeAppPath` says
50
+ * nothing about what the disk will do when it is opened. Reading `./app/index.html` that is a link to
51
+ * the user's credentials would upload them into an app draft an agent can read; writing a pulled file
52
+ * into a directory that is a link to `~/.ssh` would plant a key. Both are done with a perfectly
53
+ * well-formed path.
54
+ *
55
+ * The rules, each of which has a test that plants the thing and a naive implementation that follows it:
56
+ *
57
+ * - Nothing is FOLLOWED. A link anywhere in the tree is refused, naming it and where it points, rather
58
+ * than skipped (a silent skip drops a file its author thinks is included) or followed (the exploit).
59
+ * The root the person typed is resolved once, and everything is checked against THAT.
60
+ * - A file is opened with `O_NOFOLLOW` and then looked at through the descriptor, not the name
61
+ * (`fstat`): the thing opened must be a regular file, the one `lstat` saw, and no larger than the
62
+ * limit, so a name swapped for a link between the look and the open is an error, not a read.
63
+ * - Only regular files and directories exist. A pipe, a socket or a device is refused (reading one can
64
+ * hang forever or return forever).
65
+ * - Sizes are checked from the metadata BEFORE a byte is read, then again on what was read.
66
+ * - Bytes are decoded as strict UTF-8 and kept exactly (`ignoreBOM`), because a version's hash is over
67
+ * the bytes. A file that is not text is refused here: the working tree holds text (images are a
68
+ * later step, and a lossy decode would store something other than what the person has).
69
+ * - What the SERVER sends back (a pull) is as untrusted as a cloned repository: every path is judged
70
+ * by the contract's grammar again, the whole set is judged for collisions, and nothing is written
71
+ * until all of it is acceptable. Directories are made one component at a time, each looked at with
72
+ * `lstat`; a file is created with `O_EXCL | O_NOFOLLOW`; an existing file is replaced only with
73
+ * `force`, by unlinking it (never by writing through it), and a link is never replaced at all.
74
+ *
75
+ * WHAT IT CANNOT DO. It cannot stop a process that is already running as the same person from swapping a
76
+ * directory for a link during the few microseconds between two calls: that process can do anything the
77
+ * person can. The threat is CONTENT (a cloned repository, a downloaded app, a server's answer), not a
78
+ * concurrent attacker on one's own machine. On Windows `O_NOFOLLOW` does not exist, and the `lstat` checks
79
+ * are what is left.
80
+ */
81
+ const fs = __importStar(require("node:fs"));
82
+ const path = __importStar(require("node:path"));
83
+ const data_provider_1 = require("@skrr-ai/data-provider");
84
+ class AppsFsError extends Error {
85
+ code;
86
+ /** The path (relative to the package, or as typed) the refusal is about. */
87
+ at;
88
+ constructor(code, at, message) {
89
+ super(message);
90
+ this.name = 'AppsFsError';
91
+ this.code = code;
92
+ this.at = at;
93
+ }
94
+ }
95
+ exports.AppsFsError = AppsFsError;
96
+ /** UTF-8 is at most four bytes a character: the largest file a text of the limit's length can be. */
97
+ exports.APPS_FS_FILE_MAX_BYTES = data_provider_1.APP_DRAFT_LIMITS.fileMaxChars * 4;
98
+ const O_NOFOLLOW = fs.constants.O_NOFOLLOW ?? 0;
99
+ const O_DIRECTORY = fs.constants.O_DIRECTORY ?? 0;
100
+ /** Directories that are never part of a package and are walked past, not into. */
101
+ const SKIPPED_DIRECTORIES = new Set(['node_modules']);
102
+ function describeLink(absolute) {
103
+ try {
104
+ return ` (it points at ${fs.readlinkSync(absolute)})`;
105
+ }
106
+ catch {
107
+ return '';
108
+ }
109
+ }
110
+ function lstatOrNull(target) {
111
+ try {
112
+ return fs.lstatSync(target);
113
+ }
114
+ catch (error) {
115
+ if (error.code === 'ENOENT') {
116
+ return null;
117
+ }
118
+ throw new AppsFsError('unreadable', target, `Could not look at ${target}: ${errorText(error)}`);
119
+ }
120
+ }
121
+ function errorText(error) {
122
+ return error?.message
123
+ ? String(error.message)
124
+ : String(error);
125
+ }
126
+ /**
127
+ * Read ONE file the way the rules above say, from a name the caller already trusts to be a candidate.
128
+ * Returns its text. `label` is what the file is called in a message.
129
+ */
130
+ function readRegularTextFile(absolute, label, hooks = {}) {
131
+ const before = lstatOrNull(absolute);
132
+ if (!before) {
133
+ throw new AppsFsError('unreadable', label, `${label} does not exist.`);
134
+ }
135
+ if (before.isSymbolicLink()) {
136
+ throw new AppsFsError('symlink', label, `${label} is a symbolic link${describeLink(absolute)}: a package holds its own files, never a link to one elsewhere. Copy the file in.`);
137
+ }
138
+ if (!before.isFile()) {
139
+ throw new AppsFsError('not_regular', label, `${label} is not a regular file.`);
140
+ }
141
+ if (before.size > exports.APPS_FS_FILE_MAX_BYTES) {
142
+ throw new AppsFsError('too_large', label, `${label} is ${before.size} bytes; a text file of at most ${data_provider_1.APP_DRAFT_LIMITS.fileMaxChars} characters is at most ${exports.APPS_FS_FILE_MAX_BYTES}.`);
143
+ }
144
+ hooks.betweenLookAndOpen?.();
145
+ let fd;
146
+ try {
147
+ // O_NOFOLLOW: if the name became a link after the look above, this fails (ELOOP) instead of following it.
148
+ fd = fs.openSync(absolute, fs.constants.O_RDONLY | O_NOFOLLOW);
149
+ }
150
+ catch (error) {
151
+ const code = error.code;
152
+ if (code === 'ELOOP' || code === 'EMLINK') {
153
+ throw new AppsFsError('symlink', label, `${label} changed into a symbolic link while it was being read.`);
154
+ }
155
+ throw new AppsFsError('unreadable', label, `Could not open ${label}: ${errorText(error)}`);
156
+ }
157
+ try {
158
+ const opened = fs.fstatSync(fd);
159
+ if (!opened.isFile()) {
160
+ throw new AppsFsError('not_regular', label, `${label} is not a regular file.`);
161
+ }
162
+ // Where there are inode numbers, the thing opened is the thing that was looked at.
163
+ if (before.ino !== 0 &&
164
+ opened.ino !== 0 &&
165
+ (opened.ino !== before.ino || opened.dev !== before.dev)) {
166
+ throw new AppsFsError('symlink', label, `${label} was replaced while it was being read.`);
167
+ }
168
+ if (opened.size > exports.APPS_FS_FILE_MAX_BYTES) {
169
+ throw new AppsFsError('too_large', label, `${label} is larger than a package file may be.`);
170
+ }
171
+ const buffer = Buffer.alloc(opened.size);
172
+ let read = 0;
173
+ while (read < buffer.length) {
174
+ const n = fs.readSync(fd, buffer, read, buffer.length - read, read);
175
+ if (n === 0)
176
+ break;
177
+ read += n;
178
+ }
179
+ try {
180
+ // `ignoreBOM: true` keeps a leading BOM as a character, so the text encodes back to the same bytes.
181
+ return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(buffer.subarray(0, read));
182
+ }
183
+ catch {
184
+ throw new AppsFsError('not_text', label, `${label} is not UTF-8 text: a draft holds text files, and this one would be stored as something other than what is on disk.`);
185
+ }
186
+ }
187
+ finally {
188
+ fs.closeSync(fd);
189
+ }
190
+ }
191
+ /**
192
+ * Read a package directory: every regular file under `root`, as text, with its package path.
193
+ *
194
+ * Throws `AppsFsError` for what must not be followed or cannot be stored (a link, a pipe, a file that is
195
+ * too large or not text, a name the contract refuses, too many files). The caller still judges the whole
196
+ * set (`appDraftProblems`), which is where case collisions and totals are.
197
+ */
198
+ function readPackageDir(rootInput) {
199
+ const typed = path.resolve(rootInput);
200
+ const rootStat = lstatOrNull(typed);
201
+ if (!rootStat) {
202
+ throw new AppsFsError('unreadable', rootInput, `${rootInput} does not exist.`);
203
+ }
204
+ // The ONE place a link is resolved: the directory the person named. Everything is checked against what
205
+ // it resolves to, so `~/work -> /Volumes/x/work` is fine and a link INSIDE it is not.
206
+ let root;
207
+ try {
208
+ root = fs.realpathSync(typed);
209
+ }
210
+ catch (error) {
211
+ throw new AppsFsError('unreadable', rootInput, `Could not resolve ${rootInput}: ${errorText(error)}`);
212
+ }
213
+ if (!fs.statSync(root).isDirectory()) {
214
+ throw new AppsFsError('not_directory', rootInput, `${rootInput} is not a directory.`);
215
+ }
216
+ const files = [];
217
+ const skipped = [];
218
+ const walk = (relative, depth) => {
219
+ const absolute = relative === '' ? root : path.join(root, ...relative.split('/'));
220
+ if (depth > data_provider_1.APP_PATH_LIMITS.pathMaxSegments) {
221
+ throw new AppsFsError('bad_path', relative, `${relative} is more than ${data_provider_1.APP_PATH_LIMITS.pathMaxSegments} directories deep.`);
222
+ }
223
+ let names;
224
+ try {
225
+ names = fs.readdirSync(absolute).sort();
226
+ }
227
+ catch (error) {
228
+ throw new AppsFsError('unreadable', relative || '.', `Could not list ${relative || '.'}: ${errorText(error)}`);
229
+ }
230
+ for (const name of names) {
231
+ const childRelative = relative === '' ? name : `${relative}/${name}`;
232
+ if (name.startsWith('.') || SKIPPED_DIRECTORIES.has(name)) {
233
+ skipped.push(childRelative);
234
+ continue;
235
+ }
236
+ const childAbsolute = path.join(absolute, name);
237
+ const stat = lstatOrNull(childAbsolute);
238
+ if (!stat) {
239
+ continue; // gone since it was listed
240
+ }
241
+ if (stat.isSymbolicLink()) {
242
+ throw new AppsFsError('symlink', childRelative, `${childRelative} is a symbolic link${describeLink(childAbsolute)}: a package holds its own files, never a link to one elsewhere. Copy the file in, or remove the link.`);
243
+ }
244
+ if (stat.isDirectory()) {
245
+ walk(childRelative, depth + 1);
246
+ continue;
247
+ }
248
+ if (!stat.isFile()) {
249
+ throw new AppsFsError('not_regular', childRelative, `${childRelative} is not a regular file (a pipe, a socket or a device).`);
250
+ }
251
+ const bad = (0, data_provider_1.appPathProblem)(childRelative);
252
+ if (bad) {
253
+ throw new AppsFsError('bad_path', childRelative, bad.message);
254
+ }
255
+ if (files.length >= data_provider_1.APP_DRAFT_LIMITS.filesMax) {
256
+ throw new AppsFsError('too_many', childRelative, `A package holds at most ${data_provider_1.APP_DRAFT_LIMITS.filesMax} files; this directory has more. Leave out what is not part of the app.`);
257
+ }
258
+ const content = readRegularTextFile(childAbsolute, childRelative);
259
+ // After the read: the real location of what was read is inside the root.
260
+ const real = fs.realpathSync(childAbsolute);
261
+ if (real !== path.join(root, ...childRelative.split('/'))) {
262
+ throw new AppsFsError('outside_root', childRelative, `${childRelative} is not where it appears to be (${real}).`);
263
+ }
264
+ files.push({ path: childRelative, content });
265
+ }
266
+ };
267
+ walk('', 1);
268
+ return { root, files, skipped };
269
+ }
270
+ /** The problems of a set of paths a server sent, judged as strangers' input. */
271
+ function remoteTreeProblems(files) {
272
+ return (0, data_provider_1.appDraftProblems)(files);
273
+ }
274
+ /**
275
+ * Write files into `rootInput`. All of them are judged first and nothing is written unless all are
276
+ * acceptable; an existing file is replaced only with `force`, and a link is never written through or
277
+ * replaced.
278
+ */
279
+ function writePackageDir(rootInput, files, { force = false } = {}) {
280
+ const problems = remoteTreeProblems(files);
281
+ if (problems.length > 0) {
282
+ throw new AppsFsError('bad_path', problems[0].path, `Refusing to write: ${problems[0].message}`);
283
+ }
284
+ for (const file of files) {
285
+ if (typeof file.content !== 'string') {
286
+ throw new AppsFsError('not_text', file.path, `${file.path} is not a text file; this command writes text files only.`);
287
+ }
288
+ }
289
+ const typed = path.resolve(rootInput);
290
+ const existing = lstatOrNull(typed);
291
+ if (existing && !existing.isDirectory() && !existing.isSymbolicLink()) {
292
+ throw new AppsFsError('not_directory', rootInput, `${rootInput} exists and is not a directory.`);
293
+ }
294
+ if (!existing) {
295
+ fs.mkdirSync(typed, { recursive: true, mode: 0o755 });
296
+ }
297
+ const root = fs.realpathSync(typed);
298
+ if (!fs.statSync(root).isDirectory()) {
299
+ throw new AppsFsError('not_directory', rootInput, `${rootInput} is not a directory.`);
300
+ }
301
+ const written = [];
302
+ for (const file of files) {
303
+ const segments = file.path.split('/');
304
+ // The directories, one component at a time, each looked at before it is trusted.
305
+ let current = root;
306
+ for (let i = 0; i < segments.length - 1; i += 1) {
307
+ current = path.join(current, segments[i]);
308
+ const stat = lstatOrNull(current);
309
+ if (!stat) {
310
+ fs.mkdirSync(current, { mode: 0o755 });
311
+ }
312
+ else if (stat.isSymbolicLink()) {
313
+ throw new AppsFsError('symlink', segments.slice(0, i + 1).join('/'), `${segments.slice(0, i + 1).join('/')} is a symbolic link${describeLink(current)}: nothing is written through a link.`);
314
+ }
315
+ else if (!stat.isDirectory()) {
316
+ throw new AppsFsError('not_directory', segments.slice(0, i + 1).join('/'), `${segments.slice(0, i + 1).join('/')} exists and is not a directory.`);
317
+ }
318
+ // the directory is now a real directory, and it is inside the root
319
+ if (fs.realpathSync(current) !== current) {
320
+ throw new AppsFsError('outside_root', segments.slice(0, i + 1).join('/'), `${segments.slice(0, i + 1).join('/')} does not resolve to itself.`);
321
+ }
322
+ }
323
+ const target = path.join(current, segments[segments.length - 1]);
324
+ const there = lstatOrNull(target);
325
+ if (there) {
326
+ if (there.isSymbolicLink()) {
327
+ throw new AppsFsError('symlink', file.path, `${file.path} is a symbolic link${describeLink(target)}: it is never replaced or written through.`);
328
+ }
329
+ if (!there.isFile()) {
330
+ throw new AppsFsError('not_regular', file.path, `${file.path} exists and is not a regular file.`);
331
+ }
332
+ if (!force) {
333
+ throw new AppsFsError('exists', file.path, `${file.path} already exists. Use --force to replace it.`);
334
+ }
335
+ fs.unlinkSync(target);
336
+ }
337
+ let fd;
338
+ try {
339
+ fd = fs.openSync(target, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | O_NOFOLLOW, 0o644);
340
+ }
341
+ catch (error) {
342
+ throw new AppsFsError('unreadable', file.path, `Could not create ${file.path}: ${errorText(error)}`);
343
+ }
344
+ try {
345
+ const bytes = Buffer.from(file.content, 'utf8');
346
+ let offset = 0;
347
+ while (offset < bytes.length) {
348
+ offset += fs.writeSync(fd, bytes, offset);
349
+ }
350
+ }
351
+ finally {
352
+ fs.closeSync(fd);
353
+ }
354
+ if (fs.realpathSync(target) !== target) {
355
+ throw new AppsFsError('outside_root', file.path, `${file.path} does not resolve to itself.`);
356
+ }
357
+ written.push(file.path);
358
+ }
359
+ return { root, written };
360
+ }
361
+ /**
362
+ * Text from stdin, bounded: a pipe that never ends is read until the limit and then refused, not until
363
+ * the memory is gone. Strict UTF-8, kept byte for byte.
364
+ */
365
+ async function readStdinText(stream = process.stdin) {
366
+ const chunks = [];
367
+ let total = 0;
368
+ for await (const chunk of stream) {
369
+ const buffer = typeof chunk === 'string' ? Buffer.from(chunk, 'utf8') : chunk;
370
+ total += buffer.length;
371
+ if (total > exports.APPS_FS_FILE_MAX_BYTES) {
372
+ throw new AppsFsError('too_large', 'stdin', `stdin holds more than a package file may (${exports.APPS_FS_FILE_MAX_BYTES} bytes).`);
373
+ }
374
+ chunks.push(buffer);
375
+ }
376
+ try {
377
+ return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(Buffer.concat(chunks));
378
+ }
379
+ catch {
380
+ throw new AppsFsError('not_text', 'stdin', 'stdin is not UTF-8 text.');
381
+ }
382
+ }
383
+ // kept for the spec: the flags a disk-touching call is made with
384
+ exports.APPS_FS_FLAGS = { O_NOFOLLOW, O_DIRECTORY };
@@ -11,17 +11,37 @@
11
11
  * same record `skrr whoami` prints as "Refresh state"). This module reads that
12
12
  * latch and turns it into the sentence the error should have carried.
13
13
  */
14
+ import type { SessionRevocationReason } from '@skrr-ai/data-provider';
14
15
  export interface RefreshRefusal {
15
16
  /** Permanent reason code the refresh latched (`REFRESH_INVALID`, `SESSION_REVOKED`, …). */
16
17
  reason?: string;
17
18
  /** The server's own message for the refusal, when auth-core recorded one. */
18
19
  message?: string;
20
+ /**
21
+ * OSK-16941 — for `SESSION_REVOKED`, why the server revoked the session
22
+ * (`@skrr-ai/data-provider` `SESSION_REVOCATION_REASONS`). Absent on a latch
23
+ * written by an older auth-core, which then reads as unknown.
24
+ */
25
+ revocationReason?: string;
19
26
  }
20
27
  export interface DescribedAuthFailure {
21
28
  message: string;
22
29
  /** The code a script should key on: the refresh refusal when known. */
23
30
  code: string;
31
+ /** OSK-16941 — the vocabulary reason a revoked session was revoked for. */
32
+ revocationReason?: SessionRevocationReason;
24
33
  }
34
+ /**
35
+ * OSK-16941 — the refusal an API 401 body describes, when it is a revoked
36
+ * session (`{ code: 'SESSION_REVOKED', reason }`). Lets the 401 explain itself
37
+ * when no refresh refusal was latched, and fills the reason in when the latch
38
+ * predates it.
39
+ */
40
+ export declare function refusalFromResponse(body: {
41
+ code?: unknown;
42
+ reason?: unknown;
43
+ message?: unknown;
44
+ } | null | undefined, latched: RefreshRefusal | null | undefined): RefreshRefusal | null;
25
45
  /**
26
46
  * Explain one refresh refusal in terms of what the reader can do about it.
27
47
  * Returns null when there is no latched refusal, so the caller keeps its