@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
@@ -97,7 +97,9 @@ function classifyRefreshResponse(status, body) {
97
97
  const fallback = body?.code === 'REFRESH_MISSING' ? 'Refresh token missing' : reason;
98
98
  return {
99
99
  kind: 'failure',
100
- failure: new types_js_1.PermanentAuthFailure(reason, body?.message ?? fallback),
100
+ failure: new types_js_1.PermanentAuthFailure(reason, body?.message ?? fallback, reason === 'SESSION_REVOKED' && typeof body?.reason === 'string'
101
+ ? body.reason
102
+ : undefined),
101
103
  };
102
104
  }
103
105
  // Unknown-shape 401 (no code, or a code we don't recognise). This is NOT a
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Why a session was signed out, and what the person should do next (OSK-16941).
3
+ *
4
+ * ## Why this file exists
5
+ *
6
+ * The server always knew why it refused a session: `requireJwtAuth` answers
7
+ * `401 SESSION_REVOKED` with a `reason` for an inactive account, an account-wide
8
+ * revocation, a password change and a per-session sign-out. Nothing passed it
9
+ * on. The CLI dropped the field, the web client folded every unrecognised code
10
+ * into "your saved credentials are no longer valid", and a refresh refused for a
11
+ * revoked session answered with no code at all. A person signed out with no
12
+ * explanation reasonably concludes their account was stolen.
13
+ *
14
+ * So the vocabulary lives here, once, beside the one function that turns a
15
+ * reason into words: the API writes these codes, the web login page, the desktop
16
+ * banner, the desktop main process (OS notification and tray) and the CLI all
17
+ * render them through `describeSessionRevocation`.
18
+ *
19
+ * ## Why auth-core, behind its own subpath
20
+ *
21
+ * It was declared in `@skrr-ai/data-provider`, which the Electron main process
22
+ * does not (and should not) depend on — so main kept printing the server's raw
23
+ * message in the OS notification and the tray. auth-core is already the
24
+ * package that LATCHES the reason (`refresh.ts` writes `revocationReason` into
25
+ * `needs-reauth.json`), and every desktop, daemon and CLI process already
26
+ * depends on it. This module imports nothing, so the
27
+ * `@skrr-ai/auth-core/session-revocation` subpath is safe in a browser, React
28
+ * Native and Node alike, the same way `first-party-harness` is.
29
+ * `@skrr-ai/data-provider` re-exports it unchanged: there is still exactly one
30
+ * declaration of the vocabulary and one copy of its words.
31
+ *
32
+ * ## Three closed lists
33
+ *
34
+ * - `SESSION_REVOCATION_REASONS` — what a refused CLIENT is told. Wire values;
35
+ * the 401 body's `reason` field. The account-state members keep the spelling
36
+ * `requireJwtAuth` already sent (`banned`, `pending_deletion`, ...), so a
37
+ * client that already switched on them keeps working.
38
+ * - `SESSION_REVOCATION_CAUSES` — what HAPPENED, recorded in Security activity
39
+ * when sessions are revoked. Each cause names its trigger and the reason the
40
+ * signed-out client is told.
41
+ * - `SESSION_REVOCATION_TRIGGERS` — who or what did it.
42
+ *
43
+ * ## Unknown is a member, and it is never hidden
44
+ *
45
+ * Each list carries an explicit `unknown`. A missing, empty or unrecognised
46
+ * value normalizes to it, and its copy says plainly that we could not tell why.
47
+ * It is never folded into the nearest reassuring reading: "Everything reads
48
+ * healthy and the thing is unusable" (root CLAUDE.md) is exactly what an
49
+ * optimistic default here would produce.
50
+ *
51
+ * Copy avoids contractions in code strings so a terminal and a source file read
52
+ * them the same; the web reads the localized keys instead.
53
+ */
54
+ /**
55
+ * The CLI binary the `cli` surface names when the caller passes no `bin`. A
56
+ * literal because this module imports nothing; `@skrr-ai/data-provider`'s
57
+ * `sessionRevocation.spec` asserts it equals `BRAND_NAME`, so the two cannot
58
+ * drift.
59
+ */
60
+ export declare const SESSION_REVOCATION_DEFAULT_BIN: "skrr";
61
+ export declare const SESSION_REVOCATION_REASONS: readonly ["password_change", "sessions_revoked", "logged_out", "session_limit", "sign_in_method_removed", "security_check", "machine_removed", "banned", "disabled", "deleted", "pending_deletion", "unknown"];
62
+ export type SessionRevocationReason = (typeof SESSION_REVOCATION_REASONS)[number];
63
+ export declare const SESSION_REVOCATION_UNKNOWN: "unknown";
64
+ /**
65
+ * The login-page query parameter that carries a revocation reason across the
66
+ * sign-out redirect (`/login?reason=SESSION_REVOKED&revocation=password_change`).
67
+ * `reason` keeps the refusal CODE it always carried, so a login page that
68
+ * predates this still says something.
69
+ */
70
+ export declare const SESSION_REVOCATION_QUERY_PARAM: "revocation";
71
+ export declare function isSessionRevocationReason(value: unknown): value is SessionRevocationReason;
72
+ /**
73
+ * The canonical reason for any value a server or a URL handed us. Anything not
74
+ * in the vocabulary is `unknown` — never a guess.
75
+ */
76
+ export declare function normalizeSessionRevocationReason(value: unknown): SessionRevocationReason;
77
+ /**
78
+ * Refusal codes that end a session WITHOUT revoking it, each of which a surface
79
+ * explains in its own sentence (expired, no longer valid). Every other code a
80
+ * refusal latch can carry is read as a revocation.
81
+ */
82
+ export declare const NON_REVOCATION_REFUSAL_CODES: readonly ["REFRESH_EXPIRED", "TOKEN_EXPIRED", "REFRESH_INVALID", "TOKEN_INVALID"];
83
+ export type NonRevocationRefusalCode = (typeof NON_REVOCATION_REFUSAL_CODES)[number];
84
+ export declare function isNonRevocationRefusalCode(value: unknown): value is NonRevocationRefusalCode;
85
+ /**
86
+ * The revocation reason a refusal names — from a refusal CODE (`SESSION_REVOKED`,
87
+ * `REFRESH_REUSED`, ...) and the revocation reason that travelled beside it —
88
+ * or `null` when the code is one of `NON_REVOCATION_REFUSAL_CODES`.
89
+ *
90
+ * - A revocation reason, when present, always wins.
91
+ * - `SESSION_REVOKED` with no reason beside it IS a revocation whose reason we
92
+ * do not know, so it is `unknown`.
93
+ * - `REFRESH_REUSED` is the refresh-family burn, i.e. a security check.
94
+ * - Any other code, including none at all, is `unknown`: "we could not tell
95
+ * why", never a guess.
96
+ *
97
+ * Shared by the web banner and the desktop main process so the two read one
98
+ * latch the same way.
99
+ */
100
+ export declare function sessionRevocationForRefusal(code: string | undefined | null, revocation?: string | undefined | null): SessionRevocationReason | null;
101
+ export declare const SESSION_REVOCATION_NEXT_STEPS: readonly ["sign_in", "sign_in_and_review", "cancel_deletion", "contact_support", "use_another_account"];
102
+ export type SessionRevocationNextStep = (typeof SESSION_REVOCATION_NEXT_STEPS)[number];
103
+ /** Where the copy is shown: the CLI names its command, an app names a screen. */
104
+ export type SessionRevocationSurface = 'cli' | 'app';
105
+ /** Translation keys the web client renders; English values mirror the copy above. */
106
+ export interface SessionRevocationKeys {
107
+ title: `com_auth_revoked_${SessionRevocationReason}_title`;
108
+ detail: `com_auth_revoked_${SessionRevocationReason}_detail`;
109
+ nextStep: `com_auth_revoked_next_${SessionRevocationNextStep}`;
110
+ }
111
+ export interface SessionRevocationDescription {
112
+ /** The canonical reason; `unknown` for anything unrecognised or missing. */
113
+ reason: SessionRevocationReason;
114
+ /**
115
+ * The value as received when it was NOT a recognised reason (and not empty),
116
+ * so a surface can show the code it could not explain instead of losing it.
117
+ */
118
+ unrecognized: string | null;
119
+ title: string;
120
+ detail: string;
121
+ nextStep: SessionRevocationNextStep;
122
+ /** The next step as a sentence for the requested surface. */
123
+ nextStepText: string;
124
+ /** Whether the person should look at Security activity to explain it. */
125
+ reviewSecurityActivity: boolean;
126
+ keys: SessionRevocationKeys;
127
+ }
128
+ /**
129
+ * THE copy for a revoked session. Never throws, whatever it is given: the server
130
+ * can ship a reason before a client knows it, and that case must still say
131
+ * something true ("we could not tell why"), not nothing.
132
+ */
133
+ export declare function describeSessionRevocation(value: unknown, { surface, bin, }?: {
134
+ surface?: SessionRevocationSurface;
135
+ bin?: string;
136
+ }): SessionRevocationDescription;
137
+ /** One line for a terminal or a notification: title, detail and next step. */
138
+ export declare function formatSessionRevocation(value: unknown, options?: {
139
+ surface?: SessionRevocationSurface;
140
+ bin?: string;
141
+ }): string;
142
+ export declare const SESSION_REVOCATION_TRIGGERS: readonly ["account_owner", "administrator", "security_system", "external_provider", "account_lifecycle", "unknown"];
143
+ export type SessionRevocationTrigger = (typeof SESSION_REVOCATION_TRIGGERS)[number];
144
+ export declare const SESSION_REVOCATION_CAUSES: readonly ["password_change", "password_reset", "sign_out_everywhere", "sign_out_other_sessions", "session_signed_out", "two_factor_change", "email_change", "email_change_reverted", "account_recovery", "reported_not_me", "sign_in_method_removed", "machine_removed", "oauth_app_revoked", "session_limit", "suspicious_reuse", "administrator", "account_suspended", "external_provider", "account_deletion_scheduled", "account_superseded", "unverified_account_cleanup", "unknown"];
145
+ export type SessionRevocationCause = (typeof SESSION_REVOCATION_CAUSES)[number];
146
+ interface CauseFacts {
147
+ trigger: SessionRevocationTrigger;
148
+ /** What a client signed out by this cause is told. */
149
+ reason: SessionRevocationReason;
150
+ /** English sentence for the Security activity row. */
151
+ copy: string;
152
+ }
153
+ export declare const SESSION_REVOCATION_CAUSE_FACTS: Readonly<Record<SessionRevocationCause, CauseFacts>>;
154
+ export declare const SESSION_REVOCATION_TRIGGER_COPY: Readonly<Record<SessionRevocationTrigger, string>>;
155
+ export declare function normalizeSessionRevocationCause(value: unknown): SessionRevocationCause;
156
+ export declare function normalizeSessionRevocationTrigger(value: unknown): SessionRevocationTrigger;
157
+ export interface SessionRevocationActivityDescription {
158
+ cause: SessionRevocationCause;
159
+ trigger: SessionRevocationTrigger;
160
+ reason: SessionRevocationReason;
161
+ causeText: string;
162
+ triggerText: string;
163
+ keys: {
164
+ cause: `com_nav_security_activity_revocation_cause_${SessionRevocationCause}`;
165
+ trigger: `com_nav_security_activity_revocation_trigger_${SessionRevocationTrigger}`;
166
+ };
167
+ }
168
+ /**
169
+ * How Security activity explains one recorded revocation. A stored trigger wins
170
+ * over the cause's usual one (an administrator can change a password too); an
171
+ * unreadable one is `unknown`, never the cause's default.
172
+ */
173
+ export declare function describeSessionRevocationActivity(record: {
174
+ cause?: unknown;
175
+ trigger?: unknown;
176
+ }): SessionRevocationActivityDescription;
177
+ export {};
@@ -0,0 +1,484 @@
1
+ "use strict";
2
+ /**
3
+ * Why a session was signed out, and what the person should do next (OSK-16941).
4
+ *
5
+ * ## Why this file exists
6
+ *
7
+ * The server always knew why it refused a session: `requireJwtAuth` answers
8
+ * `401 SESSION_REVOKED` with a `reason` for an inactive account, an account-wide
9
+ * revocation, a password change and a per-session sign-out. Nothing passed it
10
+ * on. The CLI dropped the field, the web client folded every unrecognised code
11
+ * into "your saved credentials are no longer valid", and a refresh refused for a
12
+ * revoked session answered with no code at all. A person signed out with no
13
+ * explanation reasonably concludes their account was stolen.
14
+ *
15
+ * So the vocabulary lives here, once, beside the one function that turns a
16
+ * reason into words: the API writes these codes, the web login page, the desktop
17
+ * banner, the desktop main process (OS notification and tray) and the CLI all
18
+ * render them through `describeSessionRevocation`.
19
+ *
20
+ * ## Why auth-core, behind its own subpath
21
+ *
22
+ * It was declared in `@skrr-ai/data-provider`, which the Electron main process
23
+ * does not (and should not) depend on — so main kept printing the server's raw
24
+ * message in the OS notification and the tray. auth-core is already the
25
+ * package that LATCHES the reason (`refresh.ts` writes `revocationReason` into
26
+ * `needs-reauth.json`), and every desktop, daemon and CLI process already
27
+ * depends on it. This module imports nothing, so the
28
+ * `@skrr-ai/auth-core/session-revocation` subpath is safe in a browser, React
29
+ * Native and Node alike, the same way `first-party-harness` is.
30
+ * `@skrr-ai/data-provider` re-exports it unchanged: there is still exactly one
31
+ * declaration of the vocabulary and one copy of its words.
32
+ *
33
+ * ## Three closed lists
34
+ *
35
+ * - `SESSION_REVOCATION_REASONS` — what a refused CLIENT is told. Wire values;
36
+ * the 401 body's `reason` field. The account-state members keep the spelling
37
+ * `requireJwtAuth` already sent (`banned`, `pending_deletion`, ...), so a
38
+ * client that already switched on them keeps working.
39
+ * - `SESSION_REVOCATION_CAUSES` — what HAPPENED, recorded in Security activity
40
+ * when sessions are revoked. Each cause names its trigger and the reason the
41
+ * signed-out client is told.
42
+ * - `SESSION_REVOCATION_TRIGGERS` — who or what did it.
43
+ *
44
+ * ## Unknown is a member, and it is never hidden
45
+ *
46
+ * Each list carries an explicit `unknown`. A missing, empty or unrecognised
47
+ * value normalizes to it, and its copy says plainly that we could not tell why.
48
+ * It is never folded into the nearest reassuring reading: "Everything reads
49
+ * healthy and the thing is unusable" (root CLAUDE.md) is exactly what an
50
+ * optimistic default here would produce.
51
+ *
52
+ * Copy avoids contractions in code strings so a terminal and a source file read
53
+ * them the same; the web reads the localized keys instead.
54
+ */
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.SESSION_REVOCATION_TRIGGER_COPY = exports.SESSION_REVOCATION_CAUSE_FACTS = exports.SESSION_REVOCATION_CAUSES = exports.SESSION_REVOCATION_TRIGGERS = exports.SESSION_REVOCATION_NEXT_STEPS = exports.NON_REVOCATION_REFUSAL_CODES = exports.SESSION_REVOCATION_QUERY_PARAM = exports.SESSION_REVOCATION_UNKNOWN = exports.SESSION_REVOCATION_REASONS = exports.SESSION_REVOCATION_DEFAULT_BIN = void 0;
57
+ exports.isSessionRevocationReason = isSessionRevocationReason;
58
+ exports.normalizeSessionRevocationReason = normalizeSessionRevocationReason;
59
+ exports.isNonRevocationRefusalCode = isNonRevocationRefusalCode;
60
+ exports.sessionRevocationForRefusal = sessionRevocationForRefusal;
61
+ exports.describeSessionRevocation = describeSessionRevocation;
62
+ exports.formatSessionRevocation = formatSessionRevocation;
63
+ exports.normalizeSessionRevocationCause = normalizeSessionRevocationCause;
64
+ exports.normalizeSessionRevocationTrigger = normalizeSessionRevocationTrigger;
65
+ exports.describeSessionRevocationActivity = describeSessionRevocationActivity;
66
+ /**
67
+ * The CLI binary the `cli` surface names when the caller passes no `bin`. A
68
+ * literal because this module imports nothing; `@skrr-ai/data-provider`'s
69
+ * `sessionRevocation.spec` asserts it equals `BRAND_NAME`, so the two cannot
70
+ * drift.
71
+ */
72
+ exports.SESSION_REVOCATION_DEFAULT_BIN = 'skrr';
73
+ /* ------------------------------------------------------------------------ */
74
+ /* Reasons — what a refused client is told */
75
+ /* ------------------------------------------------------------------------ */
76
+ exports.SESSION_REVOCATION_REASONS = [
77
+ 'password_change',
78
+ 'sessions_revoked',
79
+ 'logged_out',
80
+ 'session_limit',
81
+ 'sign_in_method_removed',
82
+ 'security_check',
83
+ 'machine_removed',
84
+ 'banned',
85
+ 'disabled',
86
+ 'deleted',
87
+ 'pending_deletion',
88
+ 'unknown',
89
+ ];
90
+ exports.SESSION_REVOCATION_UNKNOWN = 'unknown';
91
+ /**
92
+ * The login-page query parameter that carries a revocation reason across the
93
+ * sign-out redirect (`/login?reason=SESSION_REVOKED&revocation=password_change`).
94
+ * `reason` keeps the refusal CODE it always carried, so a login page that
95
+ * predates this still says something.
96
+ */
97
+ exports.SESSION_REVOCATION_QUERY_PARAM = 'revocation';
98
+ /**
99
+ * Other spellings that already reach clients for the SAME reason: the
100
+ * revocation-bus `cause` strings an older server put on `auth:revoked`, and the
101
+ * `missing` account state. Kept so a client newer than its server still names
102
+ * them; a new server sends the canonical member.
103
+ */
104
+ const SESSION_REVOCATION_REASON_ALIASES = Object.freeze({
105
+ logout: 'logged_out',
106
+ explicit_logout: 'logged_out',
107
+ session_limit_reached: 'session_limit',
108
+ reuse: 'security_check',
109
+ reuse_detected: 'security_check',
110
+ missing: 'deleted',
111
+ });
112
+ function isSessionRevocationReason(value) {
113
+ return (typeof value === 'string' && exports.SESSION_REVOCATION_REASONS.includes(value));
114
+ }
115
+ /**
116
+ * The canonical reason for any value a server or a URL handed us. Anything not
117
+ * in the vocabulary is `unknown` — never a guess.
118
+ */
119
+ function normalizeSessionRevocationReason(value) {
120
+ if (isSessionRevocationReason(value))
121
+ return value;
122
+ if (typeof value === 'string' &&
123
+ Object.prototype.hasOwnProperty.call(SESSION_REVOCATION_REASON_ALIASES, value)) {
124
+ return SESSION_REVOCATION_REASON_ALIASES[value];
125
+ }
126
+ return exports.SESSION_REVOCATION_UNKNOWN;
127
+ }
128
+ /**
129
+ * Refusal codes that end a session WITHOUT revoking it, each of which a surface
130
+ * explains in its own sentence (expired, no longer valid). Every other code a
131
+ * refusal latch can carry is read as a revocation.
132
+ */
133
+ exports.NON_REVOCATION_REFUSAL_CODES = [
134
+ 'REFRESH_EXPIRED',
135
+ 'TOKEN_EXPIRED',
136
+ 'REFRESH_INVALID',
137
+ 'TOKEN_INVALID',
138
+ ];
139
+ function isNonRevocationRefusalCode(value) {
140
+ return (typeof value === 'string' && exports.NON_REVOCATION_REFUSAL_CODES.includes(value));
141
+ }
142
+ /**
143
+ * The revocation reason a refusal names — from a refusal CODE (`SESSION_REVOKED`,
144
+ * `REFRESH_REUSED`, ...) and the revocation reason that travelled beside it —
145
+ * or `null` when the code is one of `NON_REVOCATION_REFUSAL_CODES`.
146
+ *
147
+ * - A revocation reason, when present, always wins.
148
+ * - `SESSION_REVOKED` with no reason beside it IS a revocation whose reason we
149
+ * do not know, so it is `unknown`.
150
+ * - `REFRESH_REUSED` is the refresh-family burn, i.e. a security check.
151
+ * - Any other code, including none at all, is `unknown`: "we could not tell
152
+ * why", never a guess.
153
+ *
154
+ * Shared by the web banner and the desktop main process so the two read one
155
+ * latch the same way.
156
+ */
157
+ function sessionRevocationForRefusal(code, revocation) {
158
+ if (revocation)
159
+ return normalizeSessionRevocationReason(revocation);
160
+ if (code === 'SESSION_REVOKED')
161
+ return exports.SESSION_REVOCATION_UNKNOWN;
162
+ if (code === 'REFRESH_REUSED')
163
+ return 'security_check';
164
+ if (isNonRevocationRefusalCode(code))
165
+ return null;
166
+ return normalizeSessionRevocationReason(code);
167
+ }
168
+ /* ------------------------------------------------------------------------ */
169
+ /* Next steps */
170
+ /* ------------------------------------------------------------------------ */
171
+ exports.SESSION_REVOCATION_NEXT_STEPS = [
172
+ 'sign_in',
173
+ 'sign_in_and_review',
174
+ 'cancel_deletion',
175
+ 'contact_support',
176
+ 'use_another_account',
177
+ ];
178
+ const REASON_COPY = Object.freeze({
179
+ password_change: {
180
+ title: 'Your password was changed.',
181
+ detail: 'Changing the password signs out every session that was opened before the change, including this one.',
182
+ nextStep: 'sign_in_and_review',
183
+ },
184
+ sessions_revoked: {
185
+ title: 'Every session on your account was signed out.',
186
+ detail: 'All sessions were ended at once. That happens when someone signed in to the account chooses to sign out everywhere, changes two-factor or email settings, uses a recovery key or reports a sign-in, and when an administrator or an automatic security measure revokes sessions. Security activity records which one it was.',
187
+ nextStep: 'sign_in_and_review',
188
+ },
189
+ logged_out: {
190
+ title: 'This session was signed out.',
191
+ detail: 'It was signed out on this device or from another device signed in to your account.',
192
+ nextStep: 'sign_in',
193
+ },
194
+ session_limit: {
195
+ title: 'This session was signed out to make room for a newer one.',
196
+ detail: 'Your account reached its limit of signed-in sessions, so the oldest one was ended.',
197
+ nextStep: 'sign_in',
198
+ },
199
+ sign_in_method_removed: {
200
+ title: 'The way this session signed in was removed from your account.',
201
+ detail: 'The password, passkey or sign-in provider this session used is no longer on the account.',
202
+ nextStep: 'sign_in_and_review',
203
+ },
204
+ security_check: {
205
+ title: 'This session was ended by a security check.',
206
+ detail: 'Its credential was presented in a way that suggested it may have been copied, so it was ended to protect your account.',
207
+ nextStep: 'sign_in_and_review',
208
+ },
209
+ machine_removed: {
210
+ title: 'The machine this session belonged to was removed.',
211
+ detail: 'The machine connection that held this sign-in was removed or replaced.',
212
+ nextStep: 'sign_in',
213
+ },
214
+ banned: {
215
+ title: 'This account has been suspended.',
216
+ detail: 'An administrator suspended the account, so its sessions no longer work.',
217
+ nextStep: 'contact_support',
218
+ },
219
+ disabled: {
220
+ title: 'This account is disabled.',
221
+ detail: 'The account was disabled, so its sessions no longer work.',
222
+ nextStep: 'contact_support',
223
+ },
224
+ deleted: {
225
+ title: 'This account no longer exists.',
226
+ detail: 'The account this session belonged to was deleted.',
227
+ nextStep: 'use_another_account',
228
+ },
229
+ pending_deletion: {
230
+ title: 'This account is scheduled for deletion.',
231
+ detail: 'Until the deletion is carried out, signing in can only cancel it.',
232
+ nextStep: 'cancel_deletion',
233
+ },
234
+ unknown: {
235
+ title: 'You were signed out, and we could not tell why.',
236
+ detail: 'The server ended this session without saying why. That can happen with an older server or an unexpected error.',
237
+ nextStep: 'sign_in_and_review',
238
+ },
239
+ });
240
+ function nextStepCopy(step, surface, bin) {
241
+ const signIn = surface === 'cli' ? `Run \`${bin} login\` to sign in again.` : 'Sign in again to continue.';
242
+ switch (step) {
243
+ case 'sign_in':
244
+ return signIn;
245
+ case 'sign_in_and_review':
246
+ return (`${signIn} If this was not you, open Settings > Account > Security activity to see ` +
247
+ 'what happened, and change your password.');
248
+ case 'cancel_deletion':
249
+ return surface === 'cli'
250
+ ? 'Sign in on the web to cancel the deletion if you want to keep the account.'
251
+ : 'Sign in to cancel the deletion if you want to keep the account.';
252
+ case 'contact_support':
253
+ return 'Contact support if you think this is a mistake.';
254
+ case 'use_another_account':
255
+ return surface === 'cli'
256
+ ? `Run \`${bin} login\` to sign in with a different account.`
257
+ : 'Sign in with a different account, or create a new one.';
258
+ }
259
+ }
260
+ /**
261
+ * THE copy for a revoked session. Never throws, whatever it is given: the server
262
+ * can ship a reason before a client knows it, and that case must still say
263
+ * something true ("we could not tell why"), not nothing.
264
+ */
265
+ function describeSessionRevocation(value, { surface = 'app', bin = exports.SESSION_REVOCATION_DEFAULT_BIN, } = {}) {
266
+ const reason = normalizeSessionRevocationReason(value);
267
+ const unrecognized = reason === exports.SESSION_REVOCATION_UNKNOWN &&
268
+ typeof value === 'string' &&
269
+ value.trim() !== '' &&
270
+ value !== exports.SESSION_REVOCATION_UNKNOWN
271
+ ? value.trim().slice(0, 64)
272
+ : null;
273
+ const copy = REASON_COPY[reason];
274
+ return {
275
+ reason,
276
+ unrecognized,
277
+ title: copy.title,
278
+ detail: copy.detail,
279
+ nextStep: copy.nextStep,
280
+ nextStepText: nextStepCopy(copy.nextStep, surface, bin),
281
+ reviewSecurityActivity: copy.nextStep === 'sign_in_and_review',
282
+ keys: {
283
+ title: `com_auth_revoked_${reason}_title`,
284
+ detail: `com_auth_revoked_${reason}_detail`,
285
+ nextStep: `com_auth_revoked_next_${copy.nextStep}`,
286
+ },
287
+ };
288
+ }
289
+ /** One line for a terminal or a notification: title, detail and next step. */
290
+ function formatSessionRevocation(value, options = {}) {
291
+ const d = describeSessionRevocation(value, options);
292
+ const code = d.unrecognized ? ` (reason code: ${d.unrecognized})` : '';
293
+ return `${d.title}${code} ${d.detail} ${d.nextStepText}`;
294
+ }
295
+ /* ------------------------------------------------------------------------ */
296
+ /* Triggers and causes — the Security activity record */
297
+ /* ------------------------------------------------------------------------ */
298
+ exports.SESSION_REVOCATION_TRIGGERS = [
299
+ 'account_owner',
300
+ 'administrator',
301
+ 'security_system',
302
+ 'external_provider',
303
+ 'account_lifecycle',
304
+ 'unknown',
305
+ ];
306
+ exports.SESSION_REVOCATION_CAUSES = [
307
+ 'password_change',
308
+ 'password_reset',
309
+ 'sign_out_everywhere',
310
+ 'sign_out_other_sessions',
311
+ 'session_signed_out',
312
+ 'two_factor_change',
313
+ 'email_change',
314
+ 'email_change_reverted',
315
+ 'account_recovery',
316
+ 'reported_not_me',
317
+ 'sign_in_method_removed',
318
+ 'machine_removed',
319
+ 'oauth_app_revoked',
320
+ 'session_limit',
321
+ 'suspicious_reuse',
322
+ 'administrator',
323
+ 'account_suspended',
324
+ 'external_provider',
325
+ 'account_deletion_scheduled',
326
+ 'account_superseded',
327
+ 'unverified_account_cleanup',
328
+ 'unknown',
329
+ ];
330
+ exports.SESSION_REVOCATION_CAUSE_FACTS = Object.freeze({
331
+ password_change: {
332
+ trigger: 'account_owner',
333
+ reason: 'password_change',
334
+ copy: 'The password was changed.',
335
+ },
336
+ password_reset: {
337
+ trigger: 'account_owner',
338
+ reason: 'password_change',
339
+ copy: 'The password was reset from an emailed link.',
340
+ },
341
+ sign_out_everywhere: {
342
+ trigger: 'account_owner',
343
+ reason: 'sessions_revoked',
344
+ copy: 'Sign out everywhere was chosen.',
345
+ },
346
+ sign_out_other_sessions: {
347
+ trigger: 'account_owner',
348
+ reason: 'logged_out',
349
+ copy: 'Every other session was signed out.',
350
+ },
351
+ session_signed_out: {
352
+ trigger: 'account_owner',
353
+ reason: 'logged_out',
354
+ copy: 'A session was signed out.',
355
+ },
356
+ two_factor_change: {
357
+ trigger: 'account_owner',
358
+ reason: 'sessions_revoked',
359
+ copy: 'Two-factor authentication settings changed.',
360
+ },
361
+ email_change: {
362
+ trigger: 'account_owner',
363
+ reason: 'sessions_revoked',
364
+ copy: 'The account email address was changed.',
365
+ },
366
+ email_change_reverted: {
367
+ trigger: 'account_owner',
368
+ reason: 'sessions_revoked',
369
+ copy: 'An email address change was undone from the link sent to the previous address.',
370
+ },
371
+ account_recovery: {
372
+ trigger: 'account_owner',
373
+ reason: 'sessions_revoked',
374
+ copy: 'The account was recovered with a recovery key.',
375
+ },
376
+ reported_not_me: {
377
+ trigger: 'account_owner',
378
+ reason: 'sessions_revoked',
379
+ copy: 'A sign-in was reported as not you.',
380
+ },
381
+ sign_in_method_removed: {
382
+ trigger: 'account_owner',
383
+ reason: 'sign_in_method_removed',
384
+ copy: 'A sign-in method was removed, and the sessions that used it were ended.',
385
+ },
386
+ machine_removed: {
387
+ trigger: 'account_owner',
388
+ reason: 'machine_removed',
389
+ copy: 'A machine connection was removed, and the sessions it held were ended.',
390
+ },
391
+ oauth_app_revoked: {
392
+ trigger: 'account_owner',
393
+ reason: 'logged_out',
394
+ copy: 'Access for a connected application was revoked.',
395
+ },
396
+ session_limit: {
397
+ trigger: 'security_system',
398
+ reason: 'session_limit',
399
+ copy: 'The limit of signed-in sessions was reached, so the oldest session was ended.',
400
+ },
401
+ suspicious_reuse: {
402
+ trigger: 'security_system',
403
+ reason: 'security_check',
404
+ copy: 'A sign-in credential was presented twice, which can mean it was copied, so its sessions were ended.',
405
+ },
406
+ administrator: {
407
+ trigger: 'administrator',
408
+ reason: 'sessions_revoked',
409
+ copy: 'An administrator revoked the sessions.',
410
+ },
411
+ account_suspended: {
412
+ trigger: 'administrator',
413
+ reason: 'banned',
414
+ copy: 'An administrator suspended the account, which ends every session.',
415
+ },
416
+ external_provider: {
417
+ trigger: 'external_provider',
418
+ reason: 'sessions_revoked',
419
+ copy: 'Your sign-in provider reported a change to the account it vouches for.',
420
+ },
421
+ account_deletion_scheduled: {
422
+ trigger: 'account_owner',
423
+ reason: 'pending_deletion',
424
+ copy: 'Deletion of the account was requested.',
425
+ },
426
+ account_superseded: {
427
+ trigger: 'account_lifecycle',
428
+ reason: 'password_change',
429
+ copy: 'A new registration proved this email address and replaced the unverified account.',
430
+ },
431
+ unverified_account_cleanup: {
432
+ trigger: 'account_lifecycle',
433
+ reason: 'deleted',
434
+ copy: 'The unverified account was cleaned up.',
435
+ },
436
+ unknown: {
437
+ trigger: 'unknown',
438
+ reason: 'unknown',
439
+ copy: 'Sessions were revoked, and the server did not record why.',
440
+ },
441
+ });
442
+ exports.SESSION_REVOCATION_TRIGGER_COPY = Object.freeze({
443
+ account_owner: 'Someone signed in to this account',
444
+ administrator: 'An administrator',
445
+ security_system: 'An automatic security measure',
446
+ external_provider: 'Your sign-in provider',
447
+ account_lifecycle: 'Account cleanup',
448
+ unknown: 'Unknown: the server could not tell who or what',
449
+ });
450
+ function normalizeSessionRevocationCause(value) {
451
+ return typeof value === 'string' &&
452
+ exports.SESSION_REVOCATION_CAUSES.includes(value)
453
+ ? value
454
+ : 'unknown';
455
+ }
456
+ function normalizeSessionRevocationTrigger(value) {
457
+ return typeof value === 'string' &&
458
+ exports.SESSION_REVOCATION_TRIGGERS.includes(value)
459
+ ? value
460
+ : 'unknown';
461
+ }
462
+ /**
463
+ * How Security activity explains one recorded revocation. A stored trigger wins
464
+ * over the cause's usual one (an administrator can change a password too); an
465
+ * unreadable one is `unknown`, never the cause's default.
466
+ */
467
+ function describeSessionRevocationActivity(record) {
468
+ const cause = normalizeSessionRevocationCause(record?.cause);
469
+ const trigger = record?.trigger === undefined || record?.trigger === null
470
+ ? 'unknown'
471
+ : normalizeSessionRevocationTrigger(record.trigger);
472
+ const facts = exports.SESSION_REVOCATION_CAUSE_FACTS[cause];
473
+ return {
474
+ cause,
475
+ trigger,
476
+ reason: facts.reason,
477
+ causeText: facts.copy,
478
+ triggerText: exports.SESSION_REVOCATION_TRIGGER_COPY[trigger],
479
+ keys: {
480
+ cause: `com_nav_security_activity_revocation_cause_${cause}`,
481
+ trigger: `com_nav_security_activity_revocation_trigger_${trigger}`,
482
+ },
483
+ };
484
+ }