@astrale-os/cli 1.0.0-beta.32 → 1.0.0-beta.43

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 (441) hide show
  1. package/CHANGELOG.md +928 -0
  2. package/README.md +53 -43
  3. package/THIRD-PARTY-NOTICES.md +37 -1
  4. package/dist/astrale.js +349631 -83669
  5. package/dist/public/connect-core.js +16 -47
  6. package/dist/public/keys/index.js +1 -1
  7. package/dist/types/admin/contract.d.ts +11 -0
  8. package/dist/types/admin/graph/index.d.ts +1 -0
  9. package/dist/types/admin/graph/nodes.d.ts +12 -0
  10. package/dist/types/admin/instance/client.d.ts +2 -0
  11. package/dist/types/connection/lifetime.d.ts +1 -1
  12. package/dist/types/errors.d.ts +3 -0
  13. package/dist/types/lib/proc.d.ts +1 -0
  14. package/dist/types/lib/update.d.ts +15 -7
  15. package/package.json +8 -6
  16. package/studio/client/dist/assets/index-5C1uT6ML.css +2 -0
  17. package/studio/client/dist/assets/index-C4kNlvwF.js +80 -0
  18. package/studio/client/dist/assets/schema-studio-BR9d0faB.js +8 -0
  19. package/studio/client/dist/index.html +13 -2
  20. package/studio/package.json +2 -1
  21. package/studio/server/agent/ask.test.ts +7 -1
  22. package/studio/server/agent/bridge/grant.ts +15 -3
  23. package/studio/server/agent/prompts/system.test.ts +5 -0
  24. package/studio/server/agent/prompts/system.ts +19 -4
  25. package/studio/server/agent/routes.test.ts +39 -1
  26. package/studio/server/agent/routes.ts +3 -0
  27. package/studio/server/agent/run/coordinator.test.ts +7 -1
  28. package/studio/server/agent/run/preparation.ts +1 -0
  29. package/studio/server/agent/run/transcript.test.ts +47 -2
  30. package/studio/server/agent/run/transcript.ts +32 -3
  31. package/studio/server/api/documents.test.ts +31 -0
  32. package/studio/server/api/documents.ts +35 -1
  33. package/studio/server/api-agent-loadout.test.ts +7 -1
  34. package/studio/server/api.test.ts +7 -1
  35. package/studio/server/cache.ts +4 -4
  36. package/studio/server/detect.ts +9 -12
  37. package/studio/server/domain.test.ts +83 -3
  38. package/studio/server/domain.ts +205 -27
  39. package/studio/server/handoff/service.ts +1 -1
  40. package/studio/server/index.ts +5 -8
  41. package/studio/server/introspect/extractor.ts +111 -17
  42. package/studio/server/introspect/overlay-tsmorph.test.ts +9 -9
  43. package/studio/server/introspect/overlay.ts +1 -1
  44. package/studio/server/introspect/runtime.ts +9 -1
  45. package/studio/server/introspect/source-overlay/spans.ts +2 -5
  46. package/studio/server/lifecycle.ts +1 -1
  47. package/studio/server/state/baseline.test.ts +14 -0
  48. package/studio/server/state/baseline.ts +16 -2
  49. package/studio/server/watch.test.ts +2 -1
  50. package/studio/server/watch.ts +5 -2
  51. package/studio/server/workspace/create.ts +9 -8
  52. package/studio/server/workspace-state.ts +4 -6
  53. package/studio/server/workspace-watch.ts +33 -22
  54. package/studio/shared/contracts/agent.ts +3 -0
  55. package/viewer/dist/main.js +12 -12
  56. package/src/__tests__/fixtures/publication.ts +0 -20
  57. package/src/admin/.spec/api.d.ts +0 -3
  58. package/src/admin/.spec/architecture.md +0 -22
  59. package/src/admin/.spec/icon.svg +0 -3
  60. package/src/admin/.spec/layout.ts +0 -6
  61. package/src/admin/__tests__/fixture.ts +0 -25
  62. package/src/admin/catalog/.spec/api.d.ts +0 -63
  63. package/src/admin/catalog/.spec/architecture.md +0 -7
  64. package/src/admin/catalog/.spec/icon.svg +0 -3
  65. package/src/admin/catalog/.spec/layout.ts +0 -6
  66. package/src/admin/catalog/__tests__/client.test.ts +0 -245
  67. package/src/admin/catalog/client.ts +0 -195
  68. package/src/admin/catalog/index.ts +0 -13
  69. package/src/admin/catalog/model.ts +0 -41
  70. package/src/admin/catalog/tsconfig.json +0 -8
  71. package/src/admin/contract.ts +0 -47
  72. package/src/admin/graph/.spec/api.d.ts +0 -22
  73. package/src/admin/graph/.spec/architecture.md +0 -5
  74. package/src/admin/graph/.spec/icon.svg +0 -3
  75. package/src/admin/graph/.spec/layout.ts +0 -3
  76. package/src/admin/graph/index.ts +0 -6
  77. package/src/admin/graph/nodes.ts +0 -56
  78. package/src/admin/index.ts +0 -2
  79. package/src/admin/instance/.spec/api.d.ts +0 -62
  80. package/src/admin/instance/.spec/architecture.md +0 -10
  81. package/src/admin/instance/.spec/icon.svg +0 -3
  82. package/src/admin/instance/.spec/layout.ts +0 -6
  83. package/src/admin/instance/__tests__/client.test.ts +0 -273
  84. package/src/admin/instance/client.ts +0 -191
  85. package/src/admin/instance/index.ts +0 -15
  86. package/src/admin/instance/model.ts +0 -59
  87. package/src/admin/instance/tsconfig.json +0 -8
  88. package/src/commands/__tests__/admin-instance.test.ts +0 -91
  89. package/src/commands/__tests__/auth-login.test.ts +0 -231
  90. package/src/commands/__tests__/auth-token.test.ts +0 -223
  91. package/src/commands/__tests__/call-describe.test.ts +0 -80
  92. package/src/commands/__tests__/call.test.ts +0 -63
  93. package/src/commands/__tests__/domain-install-operation.test.ts +0 -145
  94. package/src/commands/__tests__/domain-install-owned.test.ts +0 -191
  95. package/src/commands/__tests__/domain-list.test.ts +0 -133
  96. package/src/commands/__tests__/domain-uninstall.test.ts +0 -53
  97. package/src/commands/__tests__/install-direct.test.ts +0 -128
  98. package/src/commands/__tests__/install-identity-override.test.ts +0 -76
  99. package/src/commands/__tests__/instance-bookmark.test.ts +0 -166
  100. package/src/commands/__tests__/instance-list-admin.test.ts +0 -26
  101. package/src/commands/__tests__/instance-list-rows.test.ts +0 -64
  102. package/src/commands/__tests__/instance-status.test.ts +0 -139
  103. package/src/commands/__tests__/instance-use.test.ts +0 -67
  104. package/src/commands/__tests__/introspect-parse.test.ts +0 -100
  105. package/src/commands/__tests__/logs.test.ts +0 -345
  106. package/src/commands/__tests__/read-commands.test.ts +0 -377
  107. package/src/commands/__tests__/setup-plan.test.ts +0 -61
  108. package/src/commands/__tests__/studio-descriptor.test.ts +0 -22
  109. package/src/commands/__tests__/token-ttl.test.ts +0 -66
  110. package/src/commands/__tests__/update.test.ts +0 -95
  111. package/src/commands/__tests__/view-build.test.ts +0 -58
  112. package/src/commands/__tests__/view.test.ts +0 -197
  113. package/src/commands/admin/status.ts +0 -61
  114. package/src/commands/admin/use.ts +0 -100
  115. package/src/commands/auth/login.ts +0 -82
  116. package/src/commands/auth/logout.ts +0 -53
  117. package/src/commands/auth/status.ts +0 -86
  118. package/src/commands/auth/token.ts +0 -174
  119. package/src/commands/browser.ts +0 -236
  120. package/src/commands/call-describe.ts +0 -123
  121. package/src/commands/call.ts +0 -230
  122. package/src/commands/domain/install.ts +0 -575
  123. package/src/commands/domain/list.ts +0 -155
  124. package/src/commands/domain/publish.ts +0 -136
  125. package/src/commands/domain/uninstall.ts +0 -128
  126. package/src/commands/get.ts +0 -69
  127. package/src/commands/identity/__tests__/register.test.ts +0 -93
  128. package/src/commands/identity/create.ts +0 -35
  129. package/src/commands/identity/delete.ts +0 -24
  130. package/src/commands/identity/export.ts +0 -46
  131. package/src/commands/identity/import.ts +0 -61
  132. package/src/commands/identity/list.ts +0 -56
  133. package/src/commands/identity/register.ts +0 -195
  134. package/src/commands/identity/sync.ts +0 -38
  135. package/src/commands/identity/unsync.ts +0 -34
  136. package/src/commands/identity/use.ts +0 -24
  137. package/src/commands/identity/whoami.ts +0 -34
  138. package/src/commands/idp/add.ts +0 -150
  139. package/src/commands/idp/list.ts +0 -57
  140. package/src/commands/idp/refresh.ts +0 -38
  141. package/src/commands/idp/remove.ts +0 -36
  142. package/src/commands/idp/show.ts +0 -29
  143. package/src/commands/instance/active.ts +0 -73
  144. package/src/commands/instance/bookmark.ts +0 -101
  145. package/src/commands/instance/create.ts +0 -61
  146. package/src/commands/instance/delete.ts +0 -69
  147. package/src/commands/instance/forget.ts +0 -26
  148. package/src/commands/instance/list.ts +0 -197
  149. package/src/commands/instance/status.ts +0 -92
  150. package/src/commands/instance/use.ts +0 -263
  151. package/src/commands/introspect.ts +0 -129
  152. package/src/commands/logs.ts +0 -371
  153. package/src/commands/mutate.ts +0 -122
  154. package/src/commands/query.ts +0 -142
  155. package/src/commands/session/analyze.ts +0 -72
  156. package/src/commands/session/list.ts +0 -36
  157. package/src/commands/setup.ts +0 -54
  158. package/src/commands/status.ts +0 -60
  159. package/src/commands/studio.ts +0 -434
  160. package/src/commands/token.ts +0 -121
  161. package/src/commands/ui/__tests__/commands.test.ts +0 -152
  162. package/src/commands/ui/add.ts +0 -51
  163. package/src/commands/ui/doctor.ts +0 -21
  164. package/src/commands/ui/init.ts +0 -38
  165. package/src/commands/ui/list.ts +0 -26
  166. package/src/commands/ui/preset-apply.ts +0 -19
  167. package/src/commands/ui/preset-list.ts +0 -12
  168. package/src/commands/ui/shared.ts +0 -25
  169. package/src/commands/update.ts +0 -356
  170. package/src/commands/use.ts +0 -86
  171. package/src/commands/view-serve.ts +0 -26
  172. package/src/commands/view.ts +0 -658
  173. package/src/connect-core.test.ts +0 -38
  174. package/src/connect-core.ts +0 -42
  175. package/src/connection/.spec/api.d.ts +0 -110
  176. package/src/connection/.spec/architecture.md +0 -58
  177. package/src/connection/.spec/capabilities/connection.ts +0 -13
  178. package/src/connection/.spec/examples/call.ts +0 -7
  179. package/src/connection/.spec/flows/command.ts +0 -20
  180. package/src/connection/.spec/flows/session.ts +0 -62
  181. package/src/connection/.spec/laws/connection.ts +0 -213
  182. package/src/connection/.spec/layout.ts +0 -22
  183. package/src/connection/__tests__/auth.test.ts +0 -129
  184. package/src/connection/__tests__/ca-fetch.test.ts +0 -60
  185. package/src/connection/__tests__/call.test.ts +0 -17
  186. package/src/connection/__tests__/credential.test.ts +0 -254
  187. package/src/connection/__tests__/errors.test.ts +0 -577
  188. package/src/connection/__tests__/exchange.test.ts +0 -404
  189. package/src/connection/__tests__/failure-fixtures.ts +0 -39
  190. package/src/connection/__tests__/failure-safety.test.ts +0 -75
  191. package/src/connection/__tests__/fixtures/localhost-cert.pem +0 -19
  192. package/src/connection/__tests__/fixtures/localhost-key.base64 +0 -1
  193. package/src/connection/__tests__/managed.test.ts +0 -39
  194. package/src/connection/__tests__/reasons.test.ts +0 -78
  195. package/src/connection/__tests__/self.test.ts +0 -71
  196. package/src/connection/__tests__/session.test.ts +0 -144
  197. package/src/connection/__tests__/target.test.ts +0 -95
  198. package/src/connection/auth.ts +0 -265
  199. package/src/connection/call.ts +0 -7
  200. package/src/connection/command.ts +0 -67
  201. package/src/connection/credential.ts +0 -138
  202. package/src/connection/errors.ts +0 -1
  203. package/src/connection/exchange.ts +0 -394
  204. package/src/connection/failure/classify.ts +0 -110
  205. package/src/connection/failure/index.ts +0 -18
  206. package/src/connection/failure/model.ts +0 -28
  207. package/src/connection/failure/render.ts +0 -116
  208. package/src/connection/index.ts +0 -8
  209. package/src/connection/lifetime.ts +0 -25
  210. package/src/connection/reasons.ts +0 -209
  211. package/src/connection/self.ts +0 -138
  212. package/src/connection/session.ts +0 -203
  213. package/src/connection/target.ts +0 -112
  214. package/src/connection/tsconfig.json +0 -6
  215. package/src/errors.ts +0 -66
  216. package/src/graph/.spec/api.d.ts +0 -41
  217. package/src/graph/.spec/laws/documents.ts +0 -24
  218. package/src/graph/.spec/laws/projection.ts +0 -13
  219. package/src/graph/.spec/layout.ts +0 -14
  220. package/src/graph/__tests__/mutation.test.ts +0 -51
  221. package/src/graph/__tests__/projection.test.ts +0 -22
  222. package/src/graph/__tests__/query.test.ts +0 -180
  223. package/src/graph/class.ts +0 -30
  224. package/src/graph/index.ts +0 -4
  225. package/src/graph/mutation.ts +0 -46
  226. package/src/graph/projection.ts +0 -21
  227. package/src/graph/query.ts +0 -95
  228. package/src/graph/tsconfig.json +0 -6
  229. package/src/identity/.history/ard/bootstrap-root-transfer.md +0 -57
  230. package/src/identity/.history/ard/domain-mediated-registration.md +0 -36
  231. package/src/identity/.spec/api.d.ts +0 -124
  232. package/src/identity/.spec/architecture.md +0 -33
  233. package/src/identity/.spec/capabilities/identity.ts +0 -7
  234. package/src/identity/.spec/flows/bootstrap-root.ts +0 -79
  235. package/src/identity/.spec/flows/domain-mediated-registration.ts +0 -51
  236. package/src/identity/.spec/flows/import.ts +0 -29
  237. package/src/identity/.spec/laws/identity.ts +0 -56
  238. package/src/identity/.spec/layout.ts +0 -13
  239. package/src/identity/__tests__/fixtures/registry-journey.ts +0 -65
  240. package/src/identity/__tests__/registration.test.ts +0 -64
  241. package/src/identity/__tests__/registry.test.ts +0 -74
  242. package/src/identity/__tests__/transfer.test.ts +0 -198
  243. package/src/identity/index.ts +0 -23
  244. package/src/identity/registration.ts +0 -72
  245. package/src/identity/registry.ts +0 -181
  246. package/src/identity/transfer.ts +0 -187
  247. package/src/identity/tsconfig.json +0 -6
  248. package/src/index.ts +0 -1
  249. package/src/keys/.spec/api.d.ts +0 -74
  250. package/src/keys/.spec/architecture.md +0 -13
  251. package/src/keys/.spec/laws/keys.ts +0 -43
  252. package/src/keys/.spec/layout.ts +0 -6
  253. package/src/keys/__tests__/algorithm.test.ts +0 -39
  254. package/src/keys/__tests__/keys.test.ts +0 -172
  255. package/src/keys/algorithm.ts +0 -33
  256. package/src/keys/credential.ts +0 -113
  257. package/src/keys/index.ts +0 -14
  258. package/src/keys/pair.ts +0 -219
  259. package/src/keys/tsconfig.json +0 -6
  260. package/src/lib/__tests__/admin-target.test.ts +0 -184
  261. package/src/lib/__tests__/binary.test.ts +0 -70
  262. package/src/lib/__tests__/browser-retention.test.ts +0 -212
  263. package/src/lib/__tests__/command-dx.test.ts +0 -102
  264. package/src/lib/__tests__/concurrency.test.ts +0 -62
  265. package/src/lib/__tests__/config.test.ts +0 -81
  266. package/src/lib/__tests__/design.test.ts +0 -99
  267. package/src/lib/__tests__/domain-publication.test.ts +0 -138
  268. package/src/lib/__tests__/format.test.ts +0 -22
  269. package/src/lib/__tests__/idp-session.driver.ts +0 -60
  270. package/src/lib/__tests__/idp-session.test.ts +0 -404
  271. package/src/lib/__tests__/idp.test.ts +0 -415
  272. package/src/lib/__tests__/instance-candidates.test.ts +0 -146
  273. package/src/lib/__tests__/instance-target.test.ts +0 -213
  274. package/src/lib/__tests__/instance.test.ts +0 -192
  275. package/src/lib/__tests__/local-status.test.ts +0 -202
  276. package/src/lib/__tests__/log-errors.test.ts +0 -64
  277. package/src/lib/__tests__/log.test.ts +0 -31
  278. package/src/lib/__tests__/meta.test.ts +0 -55
  279. package/src/lib/__tests__/output.test.ts +0 -162
  280. package/src/lib/__tests__/panel.test.ts +0 -40
  281. package/src/lib/__tests__/port.test.ts +0 -44
  282. package/src/lib/__tests__/prompt.test.ts +0 -25
  283. package/src/lib/__tests__/sdk-deps.test.ts +0 -68
  284. package/src/lib/__tests__/self.test.ts +0 -50
  285. package/src/lib/__tests__/skills.test.ts +0 -834
  286. package/src/lib/__tests__/studio-server-deps.test.ts +0 -111
  287. package/src/lib/__tests__/table.test.ts +0 -53
  288. package/src/lib/__tests__/update.test.ts +0 -511
  289. package/src/lib/__tests__/use-target.test.ts +0 -56
  290. package/src/lib/__tests__/validation.test.ts +0 -34
  291. package/src/lib/__tests__/view-assets.test.ts +0 -171
  292. package/src/lib/__tests__/view-external-open-intent.test.ts +0 -150
  293. package/src/lib/__tests__/view-external-open-origins.test.ts +0 -27
  294. package/src/lib/__tests__/view-open-intent.test.ts +0 -280
  295. package/src/lib/__tests__/view-port-allocation.test.ts +0 -82
  296. package/src/lib/__tests__/view-server.test.ts +0 -91
  297. package/src/lib/__tests__/view-session.test.ts +0 -100
  298. package/src/lib/__tests__/view-snapshot.test.ts +0 -77
  299. package/src/lib/admin-domain.ts +0 -43
  300. package/src/lib/admin-instance.ts +0 -56
  301. package/src/lib/admin-target.ts +0 -290
  302. package/src/lib/binary.ts +0 -127
  303. package/src/lib/browser-retention.ts +0 -210
  304. package/src/lib/browser.ts +0 -150
  305. package/src/lib/ca-fetch.ts +0 -133
  306. package/src/lib/command-dx.ts +0 -191
  307. package/src/lib/concurrency.ts +0 -31
  308. package/src/lib/config.ts +0 -57
  309. package/src/lib/credential-lifetime.ts +0 -24
  310. package/src/lib/domain-publication.ts +0 -104
  311. package/src/lib/failure-debug.ts +0 -26
  312. package/src/lib/format.ts +0 -4
  313. package/src/lib/idp-session.ts +0 -156
  314. package/src/lib/idp.ts +0 -926
  315. package/src/lib/instance-candidates.ts +0 -49
  316. package/src/lib/instance-target.ts +0 -197
  317. package/src/lib/instance.ts +0 -468
  318. package/src/lib/invocation.ts +0 -11
  319. package/src/lib/local-status.ts +0 -152
  320. package/src/lib/log.ts +0 -143
  321. package/src/lib/login-flow.ts +0 -201
  322. package/src/lib/meta.ts +0 -90
  323. package/src/lib/output.ts +0 -238
  324. package/src/lib/panel.ts +0 -61
  325. package/src/lib/port.ts +0 -41
  326. package/src/lib/proc.ts +0 -87
  327. package/src/lib/prompt.ts +0 -136
  328. package/src/lib/provision-instance.ts +0 -139
  329. package/src/lib/sdk-deps.ts +0 -104
  330. package/src/lib/self.ts +0 -22
  331. package/src/lib/skills/lock.ts +0 -117
  332. package/src/lib/skills/sync.ts +0 -878
  333. package/src/lib/skills.ts +0 -120
  334. package/src/lib/table.ts +0 -62
  335. package/src/lib/update.ts +0 -568
  336. package/src/lib/use-target.ts +0 -24
  337. package/src/lib/validation.ts +0 -59
  338. package/src/lib/view/assets.ts +0 -87
  339. package/src/lib/view/external-open-intent.ts +0 -41
  340. package/src/lib/view/external-open-origins.ts +0 -37
  341. package/src/lib/view/host-capabilities.ts +0 -17
  342. package/src/lib/view/open-intent.ts +0 -67
  343. package/src/lib/view/port-allocation.ts +0 -19
  344. package/src/lib/view/resolve.ts +0 -111
  345. package/src/lib/view/server.ts +0 -259
  346. package/src/lib/view/session.ts +0 -154
  347. package/src/lib/view/snapshot.ts +0 -101
  348. package/src/paths/.spec/api.d.ts +0 -13
  349. package/src/paths/.spec/architecture.md +0 -5
  350. package/src/paths/.spec/layout.ts +0 -3
  351. package/src/paths/index.ts +0 -13
  352. package/src/program/.spec/api.d.ts +0 -43
  353. package/src/program/.spec/architecture.md +0 -18
  354. package/src/program/.spec/laws/program.ts +0 -29
  355. package/src/program/.spec/layout.ts +0 -14
  356. package/src/program/__tests__/program.test.ts +0 -556
  357. package/src/program/argv.ts +0 -14
  358. package/src/program/build.ts +0 -205
  359. package/src/program/command.ts +0 -43
  360. package/src/program/index.ts +0 -3
  361. package/src/program/options.ts +0 -41
  362. package/src/program/registry.ts +0 -64
  363. package/src/program/tsconfig.json +0 -6
  364. package/src/setup/__tests__/instance-step.test.ts +0 -256
  365. package/src/setup/__tests__/util.test.ts +0 -29
  366. package/src/setup/engine.ts +0 -83
  367. package/src/setup/render.ts +0 -107
  368. package/src/setup/steps/admin.ts +0 -93
  369. package/src/setup/steps/agent-browser.ts +0 -81
  370. package/src/setup/steps/auth.ts +0 -54
  371. package/src/setup/steps/domain.ts +0 -68
  372. package/src/setup/steps/index.ts +0 -18
  373. package/src/setup/steps/instance.ts +0 -206
  374. package/src/setup/steps/skills-bridge.ts +0 -70
  375. package/src/setup/steps/skills.ts +0 -61
  376. package/src/setup/types.ts +0 -61
  377. package/src/setup/util.ts +0 -34
  378. package/src/state/.spec/api.d.ts +0 -152
  379. package/src/state/.spec/architecture.md +0 -45
  380. package/src/state/.spec/capabilities/state.ts +0 -7
  381. package/src/state/.spec/flows/identity-update.ts +0 -22
  382. package/src/state/.spec/laws/state.ts +0 -73
  383. package/src/state/.spec/layout.ts +0 -15
  384. package/src/state/__tests__/exchange-credentials.test.ts +0 -341
  385. package/src/state/__tests__/files.test.ts +0 -136
  386. package/src/state/__tests__/fixtures/identity-transition.ts +0 -37
  387. package/src/state/__tests__/fixtures/session-route-process.ts +0 -93
  388. package/src/state/__tests__/identities.test.ts +0 -142
  389. package/src/state/__tests__/paths.test.ts +0 -28
  390. package/src/state/__tests__/session-routes.test.ts +0 -138
  391. package/src/state/exchange-credentials.ts +0 -250
  392. package/src/state/files.ts +0 -170
  393. package/src/state/identities.ts +0 -229
  394. package/src/state/index.ts +0 -31
  395. package/src/state/paths.ts +0 -64
  396. package/src/state/session-routes.ts +0 -34
  397. package/src/state/tsconfig.json +0 -6
  398. package/src/telemetry/__tests__/analyze-log.test.ts +0 -38
  399. package/src/telemetry/__tests__/gate.test.ts +0 -63
  400. package/src/telemetry/__tests__/recorder.test.ts +0 -111
  401. package/src/telemetry/__tests__/redact.test.ts +0 -79
  402. package/src/telemetry/__tests__/retention.test.ts +0 -267
  403. package/src/telemetry/__tests__/session.test.ts +0 -166
  404. package/src/telemetry/__tests__/settings.test.ts +0 -102
  405. package/src/telemetry/__tests__/store-scan.test.ts +0 -128
  406. package/src/telemetry/__tests__/trigger.test.ts +0 -78
  407. package/src/telemetry/adapters/__tests__/claude-code.test.ts +0 -89
  408. package/src/telemetry/adapters/__tests__/codex.test.ts +0 -138
  409. package/src/telemetry/adapters/__tests__/index.test.ts +0 -88
  410. package/src/telemetry/adapters/claude-code.ts +0 -90
  411. package/src/telemetry/adapters/codex.ts +0 -160
  412. package/src/telemetry/adapters/index.ts +0 -45
  413. package/src/telemetry/adapters/types.ts +0 -21
  414. package/src/telemetry/analyze.ts +0 -249
  415. package/src/telemetry/gate.ts +0 -79
  416. package/src/telemetry/recorder.ts +0 -68
  417. package/src/telemetry/redact.ts +0 -53
  418. package/src/telemetry/retention.ts +0 -176
  419. package/src/telemetry/session.ts +0 -94
  420. package/src/telemetry/settings.ts +0 -79
  421. package/src/telemetry/store.ts +0 -174
  422. package/src/telemetry/trigger.ts +0 -107
  423. package/src/telemetry/types.ts +0 -64
  424. package/src/test-utils.ts +0 -18
  425. package/src/ui/.spec/api.d.ts +0 -14
  426. package/src/ui/.spec/architecture.md +0 -14
  427. package/src/ui/.spec/laws.ts +0 -50
  428. package/src/ui/.spec/layout.ts +0 -16
  429. package/src/ui/__tests__/ui.test.ts +0 -1742
  430. package/src/ui/index.ts +0 -13
  431. package/src/ui/lock.ts +0 -89
  432. package/src/ui/model.ts +0 -83
  433. package/src/ui/operations.ts +0 -1044
  434. package/src/ui/project.ts +0 -333
  435. package/src/ui/release.ts +0 -398
  436. package/src/ui/runner.ts +0 -18
  437. package/studio/client/dist/assets/index-BFVFs_8x.js +0 -81
  438. package/studio/client/dist/assets/index-DuB9iUdu.css +0 -2
  439. package/studio/client/dist/assets/schema-studio-DH6oEWME.js +0 -8
  440. package/studio/tsconfig.json +0 -24
  441. package/viewer/tsconfig.json +0 -13
@@ -1,206 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- import type { OwnedInstanceInfo } from '../../lib/admin-instance'
4
- import type { SetupContext, SetupStep } from '../types'
5
-
6
- import { AstraleError } from '../../errors'
7
- import { listOwnedInstancesWithIdentity } from '../../lib/admin-instance'
8
- import { normalizeInstanceKernelUrl, setActive, upsertManagedBookmark } from '../../lib/instance'
9
- import { readLocalStatus } from '../../lib/local-status'
10
- import { log, withSpinner } from '../../lib/log'
11
- import { renderInstanceHero } from '../../lib/panel'
12
- import { confirmDefaultYes, promptText, selectFrom } from '../../lib/prompt'
13
- import { provisionInstance, type ProvisionResult } from '../../lib/provision-instance'
14
- import { guiOrigin, slugError } from '../util'
15
-
16
- export type InstanceSetupDependencies = {
17
- fetchOwned: (ctx: SetupContext) => Promise<{
18
- readonly instances: OwnedInstanceInfo[]
19
- readonly identity?: string
20
- }>
21
- adopt: (info: OwnedInstanceInfo, identity?: string) => Promise<void>
22
- selectReady: (instances: OwnedInstanceInfo[]) => Promise<OwnedInstanceInfo | null>
23
- confirmCreate: () => Promise<boolean>
24
- promptSlug: () => Promise<string | undefined>
25
- provision: (slug: string) => Promise<ProvisionResult>
26
- }
27
-
28
- export type OwnedInstanceAdoptionDependencies = {
29
- upsert: typeof upsertManagedBookmark
30
- activate: (slug: string) => Promise<unknown>
31
- }
32
-
33
- /** Print the click-inviting hero for a freshly-active instance. */
34
- function hero(slug: string, kernelUrl: string): void {
35
- console.log('')
36
- console.log(renderInstanceHero(slug, guiOrigin(kernelUrl)))
37
- console.log('')
38
- }
39
-
40
- export async function adoptOwnedInstance(
41
- info: OwnedInstanceInfo,
42
- defaultIdentity?: string,
43
- deps: OwnedInstanceAdoptionDependencies = {
44
- upsert: upsertManagedBookmark,
45
- activate: setActive,
46
- },
47
- ): Promise<void> {
48
- const { repointedFrom } = await deps.upsert({
49
- key: info.slug,
50
- slug: info.slug,
51
- url: info.url,
52
- ...(info.organizationId ? { organizationId: info.organizationId } : {}),
53
- ...(defaultIdentity ? { defaultIdentity } : {}),
54
- })
55
- await deps.activate(info.slug)
56
- if (repointedFrom) {
57
- log.warn(
58
- `Bookmark "${info.slug}" repointed: ${repointedFrom} → ${normalizeInstanceKernelUrl(info.url)}`,
59
- )
60
- }
61
- log.success(`Active instance: ${info.slug}`)
62
- hero(info.slug, info.url)
63
- }
64
-
65
- function defaultDependencies(ctx: SetupContext): InstanceSetupDependencies {
66
- return {
67
- fetchOwned: (setupCtx) =>
68
- withSpinner('Checking for existing instances', !setupCtx.machine, () =>
69
- listOwnedInstancesWithIdentity(setupCtx.opts),
70
- ),
71
- adopt: adoptOwnedInstance,
72
- selectReady: (instances) =>
73
- selectFrom(
74
- 'No active instance. Pick one:',
75
- instances.map((info) => ({
76
- label: `${info.slug} ${chalk.dim(guiOrigin(info.url))}`,
77
- value: info,
78
- })),
79
- ),
80
- confirmCreate: () => confirmDefaultYes('No instances yet. Provision your first one now?'),
81
- promptSlug: () =>
82
- ctx.slug
83
- ? Promise.resolve(ctx.slug)
84
- : promptText('Pick a slug for your instance', { validate: slugError }),
85
- provision: (slug) => provisionInstance(slug, ctx.opts),
86
- }
87
- }
88
-
89
- /**
90
- * Reconcile owner-scoped admin instances when no local active bookmark exists.
91
- * A failed ownership lookup is never treated as an empty account: setup stops
92
- * before creation so a transient auth/network failure cannot create a duplicate.
93
- */
94
- export async function ensureOwnedInstance(
95
- ctx: SetupContext,
96
- deps: InstanceSetupDependencies = defaultDependencies(ctx),
97
- ): Promise<'fixed' | 'skipped'> {
98
- let inventory: Awaited<ReturnType<InstanceSetupDependencies['fetchOwned']>>
99
- try {
100
- inventory = await deps.fetchOwned(ctx)
101
- } catch (cause) {
102
- const detail = cause instanceof Error ? cause.message : String(cause)
103
- throw new AstraleError(
104
- 'INSTANCE_DISCOVERY_FAILED',
105
- `Could not check your Astrale instances: ${detail}`,
106
- 'No instance was created. Check `astrale admin status`, then rerun `astrale setup`.',
107
- )
108
- }
109
-
110
- const owned = inventory.instances
111
-
112
- const ready = owned.filter((info) => info.state === 'ready')
113
- if (ready.length === 1) {
114
- await deps.adopt(ready[0]!, inventory.identity)
115
- return 'fixed'
116
- }
117
-
118
- if (ready.length > 1) {
119
- const choice = await deps.selectReady(ready)
120
- if (choice === null) {
121
- log.dim(' Skipped — no active instance set.')
122
- return 'skipped'
123
- }
124
- await deps.adopt(choice, inventory.identity)
125
- return 'fixed'
126
- }
127
-
128
- if (owned.length > 0) {
129
- reportNotReady(owned)
130
- return 'skipped'
131
- }
132
-
133
- if (!(await deps.confirmCreate())) {
134
- log.dim(' Skipped — create one later: astrale instance create <slug>')
135
- return 'skipped'
136
- }
137
-
138
- const slug = await deps.promptSlug()
139
- if (!slug) {
140
- log.dim(' Skipped — no slug given.')
141
- return 'skipped'
142
- }
143
-
144
- const { created, selectionError } = await deps.provision(slug)
145
- if (selectionError) {
146
- const detail = selectionError instanceof Error ? selectionError.message : String(selectionError)
147
- throw new AstraleError(
148
- 'INSTANCE_SELECTION_FAILED',
149
- `Instance "${slug}" was provisioned, but the CLI could not select it: ${detail}`,
150
- `Fix local CLI storage, then run \`astrale instance use ${slug}\`.`,
151
- )
152
- }
153
- hero(slug, created.url)
154
- return 'fixed'
155
- }
156
-
157
- function reportNotReady(instances: OwnedInstanceInfo[]): void {
158
- log.warn(
159
- `${instances.length === 1 ? 'Your instance is' : 'Your instances are'} not ready; setup will not create another.`,
160
- )
161
- for (const info of instances) {
162
- const phase = info.phase && info.phase !== info.state ? ` (${info.phase})` : ''
163
- log.dim(` ${info.slug}: ${info.state}${phase} · astrale instance status ${info.slug}`)
164
- if (info.error) log.dim(` ${info.error}`)
165
- }
166
- if (instances.some((info) => info.state === 'failed')) {
167
- log.dim(
168
- ' Inspect the failure, then deliberately delete/recreate it with `astrale instance` commands.',
169
- )
170
- } else {
171
- log.dim(' Wait for provisioning to finish, then rerun `astrale setup`.')
172
- }
173
- }
174
-
175
- /**
176
- * Step 3 — an active instance, the heart of the flow. If the user already has
177
- * owned instances, adopt the sole ready one or ask among several; only a
178
- * confirmed empty owner list may fall through to first-instance provisioning.
179
- */
180
- export const instanceStep: SetupStep = {
181
- id: 'instance',
182
- title: 'Active instance',
183
- group: 'connect',
184
-
185
- async detect(ctx: SetupContext) {
186
- const { instance } = await readLocalStatus()
187
- if (instance) {
188
- return { state: 'satisfied', summary: `${instance.active} (${guiOrigin(instance.url)})` }
189
- }
190
- return {
191
- state: 'gap',
192
- summary: 'No active instance',
193
- fixHint: ctx.slug ? `astrale instance create ${ctx.slug}` : 'astrale instance create <slug>',
194
- }
195
- },
196
-
197
- async ensure(ctx: SetupContext) {
198
- const { instance } = await readLocalStatus()
199
- if (instance) {
200
- log.success(`Active instance: ${instance.active} (${guiOrigin(instance.url)})`)
201
- return 'unchanged'
202
- }
203
-
204
- return ensureOwnedInstance(ctx)
205
- },
206
- }
@@ -1,70 +0,0 @@
1
- import { existsSync, readdirSync } from 'node:fs'
2
- import { join } from 'node:path'
3
-
4
- import type { SetupStep } from '../types'
5
-
6
- import { log } from '../../lib/log'
7
- import { ensureSkillsBridge, skillsBridgeStatus } from '../../lib/skills'
8
-
9
- /**
10
- * Equip — make a workspace's own staged skills loadable. Agent tooling stages
11
- * skills under `.agents/skills`, but the harness (Claude Code et al.) only loads
12
- * `.claude/skills` (walking up to the project root). A single
13
- * `.claude/skills -> ../.agents/skills` symlink bridges every staged skill —
14
- * present and future — for this workspace and every project nested under it.
15
- * This is exactly how this monorepo wires its own skills; doing it in `setup`
16
- * means a skill landing in `.agents/skills` is loaded, not silently invisible
17
- * (the gap that let agent-browser report "installed" yet never load).
18
- *
19
- * Runs first in the equip group so the per-skill steps below detect against the
20
- * already-bridged state. Idempotent and non-destructive.
21
- */
22
- function countStaged(root: string): number {
23
- try {
24
- const dir = join(root, '.agents', 'skills')
25
- return readdirSync(dir).filter((e) => existsSync(join(dir, e, 'SKILL.md'))).length
26
- } catch {
27
- return 0
28
- }
29
- }
30
-
31
- export const skillsBridgeStep: SetupStep = {
32
- id: 'skills-bridge',
33
- title: 'workspace skills bridge',
34
- group: 'equip',
35
-
36
- async detect() {
37
- const s = skillsBridgeStatus()
38
- if (s.kind === 'none') return { state: 'satisfied', summary: 'no workspace skills to bridge' }
39
- if (s.kind === 'bridged')
40
- return { state: 'satisfied', summary: '.agents/skills bridged → the harness loads them' }
41
- if (s.kind === 'foreign')
42
- return { state: 'satisfied', summary: '.claude/skills already present — left as-is' }
43
- const n = countStaged(s.root)
44
- return {
45
- state: 'gap',
46
- summary: `${n} skill${n === 1 ? '' : 's'} in .agents/skills not loaded by the harness`,
47
- fixHint: `ln -s ../.agents/skills ${s.link}`,
48
- }
49
- },
50
-
51
- async ensure() {
52
- const before = skillsBridgeStatus()
53
- if (before.kind === 'none' || before.kind === 'bridged') return 'unchanged'
54
- if (before.kind === 'foreign') {
55
- log.dim(' .claude/skills already exists — leaving it untouched.')
56
- return 'unchanged'
57
- }
58
- const after = ensureSkillsBridge()
59
- if (after.kind === 'bridged') {
60
- log.success(
61
- `Workspace skills bridged — ${join(after.root, '.agents/skills')} → .claude/skills`,
62
- )
63
- return 'fixed'
64
- }
65
- log.warn(
66
- 'Could not create the skills bridge — create it manually: ln -s ../.agents/skills .claude/skills',
67
- )
68
- return 'failed'
69
- },
70
- }
@@ -1,61 +0,0 @@
1
- import type { SetupStep } from '../types'
2
-
3
- import { log } from '../../lib/log'
4
- import { checkAstraleSkills, SKILL_INSTALL_HINT, syncAstraleSkills } from '../../lib/skills'
5
-
6
- const FIX = SKILL_INSTALL_HINT
7
-
8
- /**
9
- * Equip — reconcile every top-level Astrale-owned skill from astrale-os/cli main.
10
- * Setup and update deliberately share one owner, so an existence-only setup check
11
- * can never bless an incomplete or stale global cohort.
12
- */
13
- export const skillsStep: SetupStep = {
14
- id: 'skills',
15
- title: 'Astrale agent skills',
16
- group: 'equip',
17
-
18
- async detect() {
19
- const result = await checkAstraleSkills()
20
- if (result.status === 'current') {
21
- return { state: 'satisfied', summary: 'Astrale skills are installed and up to date' }
22
- }
23
- if (result.status === 'unavailable') {
24
- return {
25
- state: 'broken',
26
- summary: 'Astrale skills could not be verified',
27
- detail: result.error,
28
- fixHint: FIX,
29
- }
30
- }
31
- return {
32
- state: 'gap',
33
- summary:
34
- result.status === 'repair-needed'
35
- ? 'Astrale skills need repair'
36
- : 'Astrale skills need installation or update',
37
- fixHint: FIX,
38
- }
39
- },
40
-
41
- async ensure() {
42
- log.step('Ensuring Astrale agent skills are current and healthy')
43
- try {
44
- const result = await syncAstraleSkills()
45
- if (result.status === 'unchanged') {
46
- log.success('Astrale skills already up to date')
47
- return 'unchanged'
48
- }
49
- if (result.status === 'installed') log.success('Astrale skills installed')
50
- else if (result.status === 'updated') log.success('Astrale skills updated')
51
- else if (result.status === 'repaired') log.success('Astrale skills repaired and updated')
52
- return 'fixed'
53
- } catch (error) {
54
- log.warn(
55
- `Astrale skills could not be installed safely${error instanceof Error ? `: ${error.message}` : ''}`,
56
- )
57
- log.dim(` Retry: ${FIX}`)
58
- return 'failed'
59
- }
60
- },
61
- }
@@ -1,61 +0,0 @@
1
- import type { AdminTargetCommandOpts } from '../lib/admin-target'
2
-
3
- /**
4
- * The setup reconciler models onboarding as a list of small, independent steps,
5
- * each able to (a) `detect` its state without side effects and (b) `ensure` its
6
- * state interactively, taking the user by the hand. `detect` powers the
7
- * read-only plan + checklist (and the agent-facing `--plan` JSON); `ensure` is
8
- * the hand-held fix. Both are idempotent — re-running setup when everything is
9
- * already satisfied just prints a row of ✔.
10
- */
11
-
12
- export type StepState = 'satisfied' | 'gap' | 'broken'
13
-
14
- export type StepDetection = {
15
- state: StepState
16
- /** One-line status for the checklist (no symbol — the renderer adds it). */
17
- summary: string
18
- /** Optional dim detail line. */
19
- detail?: string
20
- /** The granular command an agent (or a human) would run to close the gap. */
21
- fixHint?: string
22
- }
23
-
24
- export type StepOutcome = 'fixed' | 'unchanged' | 'skipped' | 'failed'
25
-
26
- export type SetupOpts = AdminTargetCommandOpts & {
27
- /** Read-only: print the plan and exit without mutating anything. */
28
- plan?: boolean
29
- json?: boolean
30
- raw?: boolean
31
- // Global flags (program.ts) that force non-interactive.
32
- ci?: boolean
33
- noPrompt?: boolean
34
- // Threaded into admin-kernel calls (provisioning, instance listing).
35
- as?: string
36
- creds?: string
37
- timeout?: string
38
- debug?: boolean
39
- }
40
-
41
- export type SetupContext = {
42
- /** TTY and not --ci / --no-prompt / CI: ok to prompt and mutate. */
43
- interactive: boolean
44
- /** isMachine(opts): --json / --raw or piped — structured output, no spinners. */
45
- machine: boolean
46
- opts: SetupOpts
47
- /** Instance slug hint from the positional arg, used when provisioning. */
48
- slug?: string
49
- }
50
-
51
- export type StepGroup = 'connect' | 'equip'
52
-
53
- export type SetupStep = {
54
- id: string
55
- title: string
56
- group: StepGroup
57
- /** Read-only probe for the plan + checklist. Never prompts, never mutates. */
58
- detect: (ctx: SetupContext) => Promise<StepDetection>
59
- /** Interactive, idempotent hand-holding. May print rich output (e.g. a hero). */
60
- ensure: (ctx: SetupContext) => Promise<StepOutcome>
61
- }
package/src/setup/util.ts DELETED
@@ -1,34 +0,0 @@
1
- import { validateSlug, validateUrl } from '../lib/validation'
2
-
3
- /**
4
- * The clickable GUI origin for an instance — its kernel URL stripped of the
5
- * `/api` path bookmarks carry (`https://app.eu.astrale.ai/api` →
6
- * `https://app.eu.astrale.ai`). This is the URL we put in front of the user.
7
- */
8
- export function guiOrigin(kernelUrl: string): string {
9
- try {
10
- return new URL(kernelUrl).origin
11
- } catch {
12
- return kernelUrl
13
- }
14
- }
15
-
16
- /** inquirer `validate`: true when the slug is valid, else the human message. */
17
- export function slugError(value: string): true | string {
18
- try {
19
- validateSlug(value)
20
- return true
21
- } catch (e) {
22
- return e instanceof Error ? e.message : 'Invalid slug'
23
- }
24
- }
25
-
26
- /** inquirer `validate`: true when the value is an http(s) URL, else the message. */
27
- export function urlError(value: string): true | string {
28
- try {
29
- validateUrl(value)
30
- return true
31
- } catch (e) {
32
- return e instanceof Error ? e.message : 'Invalid URL'
33
- }
34
- }
@@ -1,152 +0,0 @@
1
- import type { SessionRouteArtifact, SessionRouteStore } from '@astrale-os/sdk/client/session'
2
-
3
- /** Environment values that affect CLI-owned state placement. */
4
- export interface PathEnvironment {
5
- readonly ASTRALE_HOME?: string
6
- readonly ASTRALE_KEYS_DIR?: string
7
- readonly ASTRALE_DATA_DIR?: string
8
- }
9
-
10
- /** One captured set of CLI-owned durable-state coordinates. */
11
- export interface Paths {
12
- readonly home: string
13
- readonly keys: string
14
- readonly data: string
15
- readonly config: string
16
- readonly install: string
17
- readonly identities: string
18
- readonly instances: string
19
- readonly idps: string
20
- readonly idpSessionsDir: string
21
- readonly exchangeCredentials: string
22
- readonly sessionRoutes: string
23
- idpDir(name: string): string
24
- idpSession(identityName: string): string
25
- }
26
-
27
- /** Resolve explicit home, environment overrides, and platform home exactly once. */
28
- export function createPaths(home?: string, environment?: PathEnvironment): Paths
29
-
30
- export const paths: Paths
31
- export const ASTRALE_HOME: string
32
- export const KEYS_DIR: string
33
- export const DATA_DIR: string
34
- export const CONFIG_PATH: string
35
- export const INSTALL_PATH: string
36
- export const IDENTITIES_PATH: string
37
- export const INSTANCES_PATH: string
38
- export const IDPS_PATH: string
39
- export const IDP_SESSIONS_DIR: string
40
- export const EXCHANGE_CREDENTIALS_PATH: string
41
- export const SESSION_ROUTES_PATH: string
42
-
43
- export namespace exchange {
44
- interface Artifact {
45
- readonly version: 2
46
- readonly entries: Record<string, Entry>
47
- }
48
-
49
- interface Key {
50
- readonly kernelIssuer: string
51
- readonly domainIssuer: string
52
- readonly sourceIssuer: string
53
- readonly sourceSubject: string
54
- }
55
-
56
- interface Entry {
57
- readonly credential: string
58
- readonly expiresAt: number
59
- readonly user: string
60
- readonly sourceIssuer: string
61
- readonly sourceSubject: string
62
- }
63
- }
64
-
65
- /** Persist exact Domain bearer tokens under a private, cross-process synchronized cache. */
66
- export class ExchangeCredentialCache {
67
- constructor(path?: string)
68
- getOrRefresh(
69
- key: exchange.Key,
70
- refresh: () => Promise<exchange.Entry>,
71
- now?: () => number,
72
- ): Promise<string>
73
- deleteKernel(kernelIssuer: string): Promise<void>
74
- clear(): Promise<void>
75
- }
76
-
77
- export type IdentitySource = 'key' | 'idp'
78
- export type IdentityMode = 'local' | 'remote'
79
-
80
- export interface Registration {
81
- readonly iss: string
82
- readonly sub: string
83
- readonly registeredAt: string
84
- }
85
-
86
- export interface Identity {
87
- readonly subject: string
88
- readonly createdAt: string
89
- readonly source?: IdentitySource
90
- readonly mode?: IdentityMode
91
- readonly kid?: string
92
- readonly idp?: string
93
- readonly issuer?: string
94
- readonly audience?: string
95
- readonly claims?: Readonly<Record<string, unknown>>
96
- readonly registrations?: Readonly<Record<string, Registration>>
97
- }
98
-
99
- /** Decoded semantic identity state; persistence-version metadata is not exposed to consumers. */
100
- export interface IdentityStore {
101
- readonly default: string
102
- readonly identities: Readonly<Record<string, Identity>>
103
- }
104
-
105
- export const IDENTITY_STORE_VERSION: 1
106
-
107
- export interface IdentityStoreOptions {
108
- readonly path?: string
109
- readonly now?: () => Date
110
- readonly lock?: FileLockOptions
111
- }
112
-
113
- export interface IdentityUpdate<Value> {
114
- readonly next: IdentityStore
115
- readonly value: Value
116
- }
117
-
118
- /** Decode the missing, legacy, or current identity file without writing or migrating it. */
119
- export function readIdentityStore(options?: IdentityStoreOptions): Promise<IdentityStore>
120
-
121
- /** Reread and commit one identity transition under the file's cross-process lock. */
122
- export function updateIdentityStore<Value>(
123
- transition: (current: IdentityStore) => IdentityUpdate<Value> | Promise<IdentityUpdate<Value>>,
124
- options?: IdentityStoreOptions,
125
- ): Promise<Value>
126
-
127
- /** Atomically replace one private CLI state file through a same-directory temporary file. */
128
- export function atomicWrite(path: string, data: string): Promise<void>
129
- export function atomicWriteSync(path: string, data: string): void
130
-
131
- /** CLI filesystem representation for Kernel Client's admitted confidential route artifact. */
132
- export class FileSessionRouteStore implements SessionRouteStore {
133
- constructor(path?: string)
134
- read(): unknown
135
- write(artifact: SessionRouteArtifact): void
136
- clear(): void
137
- }
138
-
139
- export const SESSION_ROUTE_STORE: Readonly<FileSessionRouteStore>
140
-
141
- export interface FileLockOptions {
142
- readonly pollIntervalMs?: number
143
- readonly staleAfterMs?: number
144
- readonly timeoutMs?: number
145
- }
146
-
147
- /** Run one state transition under a bounded cross-process file lock. */
148
- export function withFileLock<Value>(
149
- lockPath: string,
150
- transition: () => Promise<Value>,
151
- options?: FileLockOptions,
152
- ): Promise<Value>
@@ -1,45 +0,0 @@
1
- # CLI state architecture
2
-
3
- This module owns CLI filesystem placement, the durable file-transition primitives shared by state
4
- registries, and each registry's persistence admission. `createPaths` captures explicit and
5
- environment coordinates once. `atomicWrite` publishes one complete `0600` file through a
6
- same-directory temporary file. `withFileLock` bounds cross-process read-modify-write exclusion and
7
- releases its lock on every terminal path.
8
-
9
- The identity registry decodes the legacy unversioned shape and current V1 envelope into one semantic
10
- `IdentityStore`. Reads never migrate. The first successful mutation of a legacy file preserves its
11
- exact bytes at `identities.json.v0.bak` before publishing V1. Invalid or newer files remain untouched
12
- and fail closed. Identity orchestration owns key and IdP-session effects above this module.
13
-
14
- The exchange registry owns a versioned `exchange.Artifact`. Each V2 entry is keyed by the atomic
15
- `(Kernel issuer, Domain issuer, source issuer, source subject)` identity and stores one inspected
16
- Domain credential, expiry, and the exact registered Kernel User proven when that credential was
17
- minted, together with the exact upstream source issuer and subject that selected the entry. This lets
18
- a warm command validate and reuse the credential before any network `whoami` without accepting a
19
- refresh result filed under another source identity.
20
- V1 is not migrated or retained; it is discarded and replaced by the next exact exchange. The
21
- registry reuses the same atomic-write and bounded file-lock primitives and maintains owner-only
22
- directory and file modes.
23
-
24
- The session-route registry is a separate representation adapter for Kernel Client's versioned,
25
- bounded confidential route artifact. Kernel Client exclusively owns route keying, admission, expiry,
26
- and stale/miss recovery. CLI owns only synchronous owner-private JSON I/O so a new CLI process can
27
- reuse admitted routing state without an Admin-specific shortcut. Writes are atomic snapshots; a
28
- lost concurrent cache update or any read/write failure is only a future cold route miss and cannot
29
- change product correctness.
30
- Authentication logout and identity deletion remove this artifact together with exchanged Domain
31
- credentials so locally retired authority does not leave reusable destination bearers behind.
32
-
33
- Shape decoding, migrations, and backup policy remain with each semantic registry. Commands do not
34
- call these primitives directly, and Kernel Client owns no CLI filesystem state.
35
-
36
- ```mermaid
37
- flowchart LR
38
- C[CLI command] --> I[identity orchestration]
39
- I --> R[IdentityStore transition]
40
- R --> L[withFileLock]
41
- L --> B[legacy backup when needed]
42
- B --> A[atomicWrite V1]
43
- A --> F[identities.json]
44
- P[createPaths] --> R
45
- ```
@@ -1,7 +0,0 @@
1
- import { defineCapability } from '@astrale-os/spec/authoring'
2
-
3
- export const CLI_STATE = defineCapability({
4
- id: 'CLI-STATE',
5
- statement:
6
- 'Owns captured CLI filesystem coordinates and bounded atomic transitions for local durable state.',
7
- })
@@ -1,22 +0,0 @@
1
- import type { IdentityStore, IdentityUpdate } from '../api.js'
2
-
3
- declare const withIdentityLock: <Value>(transition: () => Promise<Value>) => Promise<Value>
4
- declare const readLatest: () => Promise<{
5
- readonly store: IdentityStore
6
- readonly legacyBytes?: string
7
- }>
8
- declare const preserveLegacyBackup: (bytes: string) => Promise<void>
9
- declare const publishV1: (store: IdentityStore) => Promise<void>
10
-
11
- /** One identity mutation rereads, transitions, backs up legacy bytes, then publishes exactly once. */
12
- export function updateIdentity<Value>(
13
- transition: (current: IdentityStore) => IdentityUpdate<Value> | Promise<IdentityUpdate<Value>>,
14
- ): Promise<Value> {
15
- return withIdentityLock(async () => {
16
- const current = await readLatest()
17
- const update = await transition(current.store)
18
- if (current.legacyBytes !== undefined) await preserveLegacyBackup(current.legacyBytes)
19
- await publishV1(update.next)
20
- return update.value
21
- })
22
- }