@astrale-os/cli 0.8.0-alpha.0 → 0.8.1-alpha.2

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 (317) hide show
  1. package/README.md +4 -1
  2. package/dist/astrale.js +62968 -41240
  3. package/dist/public/connect-core.js +55030 -0
  4. package/dist/public/keys/index.js +45631 -0
  5. package/dist/public/paths/index.js +43990 -0
  6. package/dist/types/admin/instance/model.d.ts +40 -0
  7. package/dist/types/connect-core.d.ts +22 -0
  8. package/dist/types/connection/auth.d.ts +33 -0
  9. package/dist/types/errors.d.ts +23 -0
  10. package/dist/types/identity/registry.d.ts +25 -0
  11. package/dist/types/keys/algorithm.d.ts +6 -0
  12. package/dist/types/keys/credential.d.ts +21 -0
  13. package/dist/types/keys/index.d.ts +4 -0
  14. package/dist/types/keys/pair.d.ts +34 -0
  15. package/dist/types/lib/admin-target.d.ts +74 -0
  16. package/dist/types/lib/ca-fetch.d.ts +2 -0
  17. package/dist/types/lib/config.d.ts +71 -0
  18. package/dist/types/lib/format.d.ts +1 -0
  19. package/dist/types/lib/idp-session.d.ts +33 -0
  20. package/dist/types/lib/idp.d.ts +397 -0
  21. package/dist/types/lib/instance-target.d.ts +36 -0
  22. package/dist/types/lib/instance.d.ts +186 -0
  23. package/dist/types/lib/log.d.ts +30 -0
  24. package/dist/types/lib/login-flow.d.ts +49 -0
  25. package/dist/types/lib/meta.d.ts +36 -0
  26. package/dist/types/lib/output.d.ts +83 -0
  27. package/dist/types/lib/table.d.ts +18 -0
  28. package/dist/types/lib/validation.d.ts +11 -0
  29. package/dist/types/paths/index.d.ts +2 -0
  30. package/dist/types/state/exchange-credentials.d.ts +25 -0
  31. package/dist/types/state/files.d.ts +9 -0
  32. package/dist/types/state/identities.d.ts +42 -0
  33. package/dist/types/state/index.d.ts +8 -0
  34. package/dist/types/state/paths.d.ts +32 -0
  35. package/package.json +30 -8
  36. package/src/admin/.spec/api.d.ts +3 -0
  37. package/src/admin/.spec/architecture.md +15 -0
  38. package/src/admin/.spec/icon.svg +3 -0
  39. package/src/admin/.spec/layout.ts +6 -0
  40. package/src/admin/catalog/.spec/api.d.ts +65 -0
  41. package/src/admin/catalog/.spec/architecture.md +6 -0
  42. package/src/admin/catalog/.spec/icon.svg +3 -0
  43. package/src/admin/catalog/.spec/layout.ts +6 -0
  44. package/src/admin/catalog/__tests__/client.test.ts +171 -0
  45. package/src/admin/catalog/client.ts +214 -0
  46. package/src/admin/catalog/index.ts +13 -0
  47. package/src/admin/catalog/model.ts +42 -0
  48. package/src/admin/catalog/tsconfig.json +8 -0
  49. package/src/admin/graph/.spec/api.d.ts +28 -0
  50. package/src/admin/graph/.spec/architecture.md +5 -0
  51. package/src/admin/graph/.spec/icon.svg +3 -0
  52. package/src/admin/graph/.spec/layout.ts +3 -0
  53. package/src/admin/graph/index.ts +6 -0
  54. package/src/admin/graph/nodes.ts +56 -0
  55. package/src/admin/index.ts +2 -0
  56. package/src/admin/instance/.spec/api.d.ts +66 -0
  57. package/src/admin/instance/.spec/architecture.md +10 -0
  58. package/src/admin/instance/.spec/icon.svg +3 -0
  59. package/src/admin/instance/.spec/layout.ts +6 -0
  60. package/src/admin/instance/__tests__/client.test.ts +289 -0
  61. package/src/admin/instance/client.ts +298 -0
  62. package/src/admin/instance/index.ts +16 -0
  63. package/src/admin/instance/model.ts +65 -0
  64. package/src/admin/instance/tsconfig.json +8 -0
  65. package/src/commands/__tests__/admin-instance.test.ts +3 -36
  66. package/src/commands/__tests__/call.test.ts +21 -68
  67. package/src/commands/__tests__/domain-install-owned.test.ts +26 -27
  68. package/src/commands/__tests__/domain-list.test.ts +2 -6
  69. package/src/commands/__tests__/logs.test.ts +50 -98
  70. package/src/commands/__tests__/ls.test.ts +21 -17
  71. package/src/commands/__tests__/read-commands.test.ts +171 -101
  72. package/src/commands/__tests__/view.test.ts +100 -51
  73. package/src/commands/admin/status.ts +3 -3
  74. package/src/commands/admin/use.ts +29 -6
  75. package/src/commands/auth/login.ts +1 -1
  76. package/src/commands/auth/logout.ts +4 -2
  77. package/src/commands/auth/status.ts +2 -2
  78. package/src/commands/auth/token.ts +2 -2
  79. package/src/commands/browser.ts +1 -1
  80. package/src/commands/call.ts +55 -91
  81. package/src/commands/describe.ts +52 -147
  82. package/src/commands/domain/install.ts +81 -50
  83. package/src/commands/domain/list.ts +4 -8
  84. package/src/commands/domain/publish.ts +9 -31
  85. package/src/commands/get.ts +32 -65
  86. package/src/commands/identity/__tests__/register.test.ts +93 -0
  87. package/src/commands/identity/create.ts +2 -2
  88. package/src/commands/identity/delete.ts +2 -2
  89. package/src/commands/identity/export.ts +7 -33
  90. package/src/commands/identity/import.ts +21 -70
  91. package/src/commands/identity/list.ts +2 -2
  92. package/src/commands/identity/register.ts +148 -117
  93. package/src/commands/identity/sync.ts +2 -2
  94. package/src/commands/identity/unsync.ts +2 -2
  95. package/src/commands/identity/use.ts +2 -2
  96. package/src/commands/identity/whoami.ts +2 -2
  97. package/src/commands/idp/add.ts +1 -1
  98. package/src/commands/idp/list.ts +1 -1
  99. package/src/commands/idp/refresh.ts +1 -1
  100. package/src/commands/idp/remove.ts +2 -2
  101. package/src/commands/idp/show.ts +1 -1
  102. package/src/commands/instance/active.ts +2 -2
  103. package/src/commands/instance/bookmark.ts +8 -2
  104. package/src/commands/instance/create.ts +1 -1
  105. package/src/commands/instance/delete.ts +4 -10
  106. package/src/commands/instance/forget.ts +1 -1
  107. package/src/commands/instance/list.ts +3 -3
  108. package/src/commands/instance/status.ts +5 -7
  109. package/src/commands/instance/use.ts +3 -3
  110. package/src/commands/logs.ts +152 -279
  111. package/src/commands/ls.ts +78 -204
  112. package/src/commands/mutate.ts +70 -139
  113. package/src/commands/query.ts +100 -278
  114. package/src/commands/session/analyze.ts +1 -1
  115. package/src/commands/session/list.ts +1 -1
  116. package/src/commands/setup.ts +1 -1
  117. package/src/commands/status.ts +1 -1
  118. package/src/commands/studio.ts +1 -1
  119. package/src/commands/token.ts +26 -21
  120. package/src/commands/update.ts +1 -1
  121. package/src/commands/use.ts +2 -3
  122. package/src/commands/view-serve.ts +1 -1
  123. package/src/commands/view.ts +67 -109
  124. package/src/connect-core.test.ts +38 -0
  125. package/src/connect-core.ts +42 -0
  126. package/src/connection/.spec/api.d.ts +111 -0
  127. package/src/connection/.spec/architecture.md +41 -0
  128. package/src/connection/.spec/capabilities/connection.ts +13 -0
  129. package/src/connection/.spec/examples/call.ts +7 -0
  130. package/src/connection/.spec/flows/command.ts +20 -0
  131. package/src/connection/.spec/flows/session.ts +61 -0
  132. package/src/connection/.spec/laws/connection.ts +181 -0
  133. package/src/connection/.spec/layout.ts +19 -0
  134. package/src/{kernel → connection}/__tests__/auth.test.ts +26 -2
  135. package/src/connection/__tests__/ca-fetch.test.ts +53 -0
  136. package/src/connection/__tests__/call.test.ts +17 -0
  137. package/src/connection/__tests__/credential.test.ts +109 -0
  138. package/src/connection/__tests__/errors.test.ts +96 -0
  139. package/src/connection/__tests__/exchange.test.ts +224 -0
  140. package/src/connection/__tests__/fixtures/localhost-cert.pem +19 -0
  141. package/src/connection/__tests__/fixtures/localhost-key.base64 +1 -0
  142. package/src/connection/__tests__/managed.test.ts +39 -0
  143. package/src/connection/__tests__/self.test.ts +51 -0
  144. package/src/connection/__tests__/session.test.ts +140 -0
  145. package/src/connection/__tests__/target.test.ts +93 -0
  146. package/src/{kernel → connection}/auth.ts +8 -8
  147. package/src/connection/call.ts +7 -0
  148. package/src/{kernel/run.ts → connection/command.ts} +22 -13
  149. package/src/connection/credential.ts +114 -0
  150. package/src/{kernel → connection}/errors.ts +32 -9
  151. package/src/connection/exchange.ts +274 -0
  152. package/src/connection/index.ts +8 -0
  153. package/src/connection/self.ts +120 -0
  154. package/src/connection/session.ts +176 -0
  155. package/src/connection/target.ts +111 -0
  156. package/src/connection/tsconfig.json +6 -0
  157. package/src/graph/.spec/api.d.ts +34 -0
  158. package/src/graph/.spec/laws/documents.ts +24 -0
  159. package/src/graph/.spec/laws/projection.ts +13 -0
  160. package/src/graph/.spec/layout.ts +6 -0
  161. package/src/graph/__tests__/mutation.test.ts +43 -0
  162. package/src/graph/__tests__/projection.test.ts +22 -0
  163. package/src/graph/__tests__/query.test.ts +154 -0
  164. package/src/graph/index.ts +3 -0
  165. package/src/graph/mutation.ts +18 -0
  166. package/src/graph/projection.ts +21 -0
  167. package/src/graph/query.ts +108 -0
  168. package/src/graph/tsconfig.json +6 -0
  169. package/src/identity/.history/ard/bootstrap-root-transfer.md +57 -0
  170. package/src/identity/.history/ard/domain-mediated-registration.md +36 -0
  171. package/src/identity/.spec/api.d.ts +124 -0
  172. package/src/identity/.spec/architecture.md +33 -0
  173. package/src/identity/.spec/capabilities/identity.ts +7 -0
  174. package/src/identity/.spec/flows/bootstrap-root.ts +79 -0
  175. package/src/identity/.spec/flows/domain-mediated-registration.ts +51 -0
  176. package/src/identity/.spec/flows/import.ts +29 -0
  177. package/src/identity/.spec/laws/identity.ts +56 -0
  178. package/src/identity/.spec/layout.ts +13 -0
  179. package/src/identity/.spec/schemas/identity-export-v1.schema.json +25 -0
  180. package/src/identity/__tests__/fixtures/registry-journey.ts +53 -0
  181. package/src/identity/__tests__/registration.test.ts +64 -0
  182. package/src/identity/__tests__/registry.test.ts +70 -0
  183. package/src/identity/__tests__/transfer.test.ts +198 -0
  184. package/src/identity/index.ts +23 -0
  185. package/src/identity/registration.ts +72 -0
  186. package/src/identity/registry.ts +172 -0
  187. package/src/identity/transfer.ts +187 -0
  188. package/src/identity/tsconfig.json +6 -0
  189. package/src/index.ts +1 -0
  190. package/src/keys/.spec/api.d.ts +74 -0
  191. package/src/keys/.spec/architecture.md +13 -0
  192. package/src/keys/.spec/laws/keys.ts +43 -0
  193. package/src/keys/.spec/layout.ts +6 -0
  194. package/src/keys/__tests__/algorithm.test.ts +39 -0
  195. package/src/keys/__tests__/keys.test.ts +168 -0
  196. package/src/keys/algorithm.ts +33 -0
  197. package/src/keys/credential.ts +112 -0
  198. package/src/keys/index.ts +14 -0
  199. package/src/keys/pair.ts +219 -0
  200. package/src/keys/tsconfig.json +6 -0
  201. package/src/lib/__tests__/admin-target.test.ts +67 -7
  202. package/src/lib/__tests__/binary.test.ts +2 -3
  203. package/src/lib/__tests__/command-dx.test.ts +2 -2
  204. package/src/lib/__tests__/config.test.ts +3 -2
  205. package/src/lib/__tests__/idp.test.ts +4 -6
  206. package/src/lib/__tests__/instance-target.test.ts +7 -4
  207. package/src/lib/__tests__/local-status.test.ts +1 -1
  208. package/src/lib/__tests__/log.test.ts +31 -0
  209. package/src/lib/__tests__/meta.test.ts +55 -0
  210. package/src/lib/__tests__/sdk-deps.test.ts +1 -1
  211. package/src/lib/__tests__/self.test.ts +8 -230
  212. package/src/lib/__tests__/use-target.test.ts +1 -1
  213. package/src/lib/__tests__/view-open-intent.test.ts +78 -104
  214. package/src/lib/__tests__/view-session.test.ts +99 -0
  215. package/src/lib/admin-domain.ts +39 -25
  216. package/src/lib/admin-instance.ts +38 -43
  217. package/src/lib/admin-target.ts +67 -13
  218. package/src/lib/binary.ts +13 -34
  219. package/src/lib/browser.ts +1 -1
  220. package/src/{kernel → lib}/ca-fetch.ts +35 -27
  221. package/src/lib/config.ts +1 -1
  222. package/src/lib/idp-session.ts +1 -1
  223. package/src/lib/idp.ts +3 -8
  224. package/src/lib/instance-target.ts +12 -8
  225. package/src/lib/instance.ts +34 -2
  226. package/src/lib/local-status.ts +2 -2
  227. package/src/lib/log.ts +3 -1
  228. package/src/lib/login-flow.ts +32 -5
  229. package/src/lib/meta.ts +15 -11
  230. package/src/lib/provision-instance.ts +4 -12
  231. package/src/lib/self.ts +5 -147
  232. package/src/lib/update.ts +1 -1
  233. package/src/lib/use-target.ts +1 -1
  234. package/src/lib/validation.ts +2 -2
  235. package/src/lib/view/open-intent.ts +7 -37
  236. package/src/lib/view/port-allocation.ts +1 -1
  237. package/src/lib/view/resolve.ts +52 -45
  238. package/src/lib/view/server.ts +16 -33
  239. package/src/lib/view/session.ts +51 -22
  240. package/src/paths/.spec/api.d.ts +13 -0
  241. package/src/paths/.spec/architecture.md +5 -0
  242. package/src/paths/.spec/layout.ts +3 -0
  243. package/src/paths/index.ts +13 -0
  244. package/src/program/.spec/api.d.ts +42 -0
  245. package/src/program/.spec/architecture.md +18 -0
  246. package/src/program/.spec/laws/program.ts +29 -0
  247. package/src/program/.spec/layout.ts +14 -0
  248. package/src/program/__tests__/program.test.ts +359 -0
  249. package/src/program/build.ts +190 -0
  250. package/src/program/command.ts +42 -0
  251. package/src/program/index.ts +2 -0
  252. package/src/program/options.ts +40 -0
  253. package/src/{registry.ts → program/registry.ts} +5 -1
  254. package/src/program/tsconfig.json +6 -0
  255. package/src/setup/steps/admin.ts +18 -3
  256. package/src/setup/steps/instance.ts +1 -1
  257. package/src/state/.spec/api.d.ts +133 -0
  258. package/src/state/.spec/architecture.md +31 -0
  259. package/src/state/.spec/capabilities/state.ts +7 -0
  260. package/src/state/.spec/flows/identity-update.ts +22 -0
  261. package/src/state/.spec/laws/state.ts +73 -0
  262. package/src/state/.spec/layout.ts +14 -0
  263. package/src/state/__tests__/exchange-credentials.test.ts +188 -0
  264. package/src/state/__tests__/files.test.ts +113 -0
  265. package/src/state/__tests__/fixtures/identity-transition.ts +37 -0
  266. package/src/state/__tests__/identities.test.ts +142 -0
  267. package/src/state/__tests__/paths.test.ts +27 -0
  268. package/src/state/exchange-credentials.ts +219 -0
  269. package/src/state/files.ts +129 -0
  270. package/src/state/identities.ts +236 -0
  271. package/src/state/index.ts +29 -0
  272. package/src/state/paths.ts +61 -0
  273. package/src/state/tsconfig.json +6 -0
  274. package/src/telemetry/__tests__/redact.test.ts +3 -3
  275. package/src/telemetry/__tests__/trigger.test.ts +1 -1
  276. package/src/telemetry/settings.ts +1 -1
  277. package/src/telemetry/store.ts +1 -1
  278. package/src/test-utils.ts +1 -1
  279. package/studio/client/dist/assets/elk-api-D0cBetPW.js +1 -0
  280. package/studio/client/dist/assets/elk-worker.min-C9JGDOE-.js +6312 -0
  281. package/studio/client/dist/assets/index-BQnJ5sgd.css +1 -0
  282. package/studio/client/dist/assets/index-ChOr3yP0.css +1 -0
  283. package/studio/client/dist/assets/index-Dspir4w7.js +81 -0
  284. package/studio/client/dist/assets/index-bVD2KJgz.js +8 -0
  285. package/studio/client/dist/index.html +2 -2
  286. package/studio/package.json +10 -1
  287. package/studio/server/introspect/extractor.ts +1 -1
  288. package/studio/server/state/views.test.ts +3 -7
  289. package/studio/server/state/views.ts +23 -30
  290. package/studio/tsconfig.json +23 -0
  291. package/tsconfig.json +1 -1
  292. package/viewer/dist/main.js +65 -39
  293. package/viewer/tsconfig.json +13 -0
  294. package/src/command.ts +0 -42
  295. package/src/commands/__tests__/help-contract.test.ts +0 -164
  296. package/src/kernel/__tests__/client-owned-lookup.test.ts +0 -51
  297. package/src/kernel/__tests__/errors.test.ts +0 -43
  298. package/src/kernel/__tests__/expand.test.ts +0 -123
  299. package/src/kernel/client.ts +0 -214
  300. package/src/kernel/expand.ts +0 -192
  301. package/src/kernel/graph.ts +0 -96
  302. package/src/kernel/index.ts +0 -29
  303. package/src/kernel/options.ts +0 -22
  304. package/src/kernel/types.ts +0 -14
  305. package/src/lib/__tests__/domain-identity.test.ts +0 -60
  306. package/src/lib/__tests__/fs-atomic.test.ts +0 -104
  307. package/src/lib/__tests__/identity.test.ts +0 -79
  308. package/src/lib/__tests__/keys.test.ts +0 -129
  309. package/src/lib/domain-identity.ts +0 -49
  310. package/src/lib/env.ts +0 -49
  311. package/src/lib/fs-atomic.ts +0 -126
  312. package/src/lib/identity.ts +0 -256
  313. package/src/lib/keys.ts +0 -294
  314. package/src/lib/paths.ts +0 -11
  315. package/src/program.ts +0 -213
  316. package/studio/client/dist/assets/index-BaqEuIQJ.js +0 -109
  317. package/studio/client/dist/assets/index-jRdExahh.css +0 -1
@@ -0,0 +1,49 @@
1
+ import { type IdpSession } from './idp';
2
+ /**
3
+ * The IdP login flow, lifted out of the `auth login` command so it can be
4
+ * driven from anywhere (the command renders the result; `astrale setup` runs it
5
+ * as one hand-held step). The side effects — saving the session cache and
6
+ * upserting the IdP-backed identity — live here so every caller gets identical
7
+ * behavior; presentation (the device URL is logged here; success lines are the
8
+ * caller's) does not.
9
+ */
10
+ export type LoginFlowOpts = {
11
+ idp?: string;
12
+ name?: string;
13
+ scope?: string;
14
+ audience?: string;
15
+ clientId?: string;
16
+ clientSecretEnv?: string;
17
+ clientCredentials?: boolean;
18
+ code?: string;
19
+ redirectUri?: string;
20
+ codeVerifier?: string;
21
+ /** Switch the default identity to the one we just logged in (default true). */
22
+ use?: boolean;
23
+ /**
24
+ * Optional device-flow presentation boundary. When supplied, the caller
25
+ * receives the verification coordinates instead of terminal log output.
26
+ */
27
+ onVerification?: (event: DeviceVerification) => void;
28
+ };
29
+ export type DeviceVerification = {
30
+ verificationUri: string;
31
+ verificationUriComplete?: string;
32
+ userCode?: string;
33
+ expiresIn?: number;
34
+ message?: string;
35
+ };
36
+ export type LoginResult = {
37
+ session: IdpSession;
38
+ identityName: string;
39
+ idpName: string;
40
+ };
41
+ /**
42
+ * Authenticate against an IdP and persist the result. Throws on any failure
43
+ * (no session is written) — notably BEFORE saving when an explicit `--audience`
44
+ * does not match the minted access token, so a wrong-audience login never
45
+ * leaves a half-written cache.
46
+ */
47
+ export declare function loginViaIdp(opts: LoginFlowOpts): Promise<LoginResult>;
48
+ /** Resolve which IdP to use: explicit name, the sole configured one, or WorkOS. */
49
+ export declare function resolveIdpName(name: string | undefined): Promise<string>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Issuer reachability helpers — OIDC discovery + JWKS.
3
+ *
4
+ * Kernels don't expose `/meta`. They expose OIDC discovery at
5
+ * `/.well-known/openid-configuration` (standard, returns `issuer` and
6
+ * `jwks_uri`) and JWKS at `/.well-known/jwks.json`. These helpers probe
7
+ * both to verify the issuer is alive and publishes at least one key.
8
+ *
9
+ * Domain workers may expose `/meta` for deployment drift detection; that is
10
+ * outside this connect-only CLI surface.
11
+ */
12
+ type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
13
+ export type DiscoveryDocument = {
14
+ /** OIDC issuer URL. */
15
+ issuer: string;
16
+ /** JWKS URI (defaults to `<issuer>/.well-known/jwks.json`). */
17
+ jwksUri: string;
18
+ };
19
+ export declare function fetchDiscovery(url: string, timeoutMs?: number, fetchImpl?: FetchLike): Promise<DiscoveryDocument>;
20
+ export declare function fetchJwks(jwksUri: string, timeoutMs?: number, fetchImpl?: FetchLike): Promise<{
21
+ keys: Array<{
22
+ kid?: string;
23
+ }>;
24
+ }>;
25
+ /**
26
+ * Discover the WorkOS organization an instance host pins
27
+ */
28
+ export declare function fetchOrgHint(url: string, timeoutMs?: number): Promise<string | undefined>;
29
+ /** Verify the pinned issuer publishes self-consistent OIDC discovery and a non-empty JWKS. */
30
+ export declare function checkIssuerReachability(url: string, issuerOverride?: string, fetchImpl?: FetchLike): Promise<{
31
+ issuer: string;
32
+ keys: Array<{
33
+ kid?: string;
34
+ }>;
35
+ }>;
36
+ export {};
@@ -0,0 +1,83 @@
1
+ import { type Column } from './table';
2
+ export type { Column } from './table';
3
+ export type OutputOpts = {
4
+ raw?: boolean;
5
+ json?: boolean;
6
+ format?: 'yaml' | 'json';
7
+ };
8
+ export type RawOutputOpts = Pick<OutputOpts, 'raw' | 'json'>;
9
+ export declare const RAW_OUTPUT_OPTIONS: readonly [{
10
+ readonly flags: '--json';
11
+ readonly description: 'Always-valid JSON (for jq)';
12
+ }, {
13
+ readonly flags: '--raw';
14
+ readonly description: 'Unwrapped: bare scalar / raw bytes / JSON for objects';
15
+ }];
16
+ /**
17
+ * Is the consumer a machine (emit structured data, not a pretty view)?
18
+ * True for `--json`, `--raw`, or any non-TTY stdout (pipe, redirect, CI, agent).
19
+ */
20
+ export declare function isMachine(opts?: RawOutputOpts): boolean;
21
+ /**
22
+ * `--raw` = the *unwrapped* value (bare scalar, raw bytes). The raw-vs-json
23
+ * distinction only manifests for scalars and binary; objects/arrays fall back
24
+ * to JSON under either flag.
25
+ */
26
+ export declare function isUnwrapped(opts?: RawOutputOpts): boolean;
27
+ /**
28
+ * Write structured data to stdout in the appropriate format.
29
+ *
30
+ * Precedence:
31
+ * - `--raw` / `--json` → plain JSON, no colors (machine-readable)
32
+ * - explicit `--format yaml|json` → honor regardless of TTY, colors only on TTY
33
+ * - default on TTY → highlighted YAML
34
+ * - default on non-TTY → plain JSON
35
+ *
36
+ * Void-returning syscalls surface as `undefined` here; `JSON.stringify(undefined)`
37
+ * itself returns `undefined`, which would print the bare string `undefined` and
38
+ * break any caller doing `JSON.parse(stdout)`. Normalize to `null` (parseable
39
+ * JSON, valid YAML) at the entry so every formatter branch is consistent.
40
+ */
41
+ export declare function output(data: unknown, opts: OutputOpts): void;
42
+ export type PresentOpts = OutputOpts & {
43
+ denoise?: boolean;
44
+ };
45
+ /** One display row per item plus the columns and (optional) `-q` paths. */
46
+ export type ListProjection = {
47
+ columns: Column[];
48
+ rows: Array<Record<string, string>>;
49
+ paths?: string[];
50
+ };
51
+ export type ListOpts = OutputOpts & {
52
+ quiet?: boolean;
53
+ count?: boolean;
54
+ long?: boolean;
55
+ };
56
+ /**
57
+ * Strip heavy, low-signal keys (serialized schema blobs, SVG icons, code) at any
58
+ * depth — so machine output is the kernel's data minus the noise, never a wall.
59
+ */
60
+ export declare function denoise(value: unknown): unknown;
61
+ /**
62
+ * Present a single kernel value, shape- and audience-aware.
63
+ *
64
+ * - scalar → `--raw` bare (no quotes, for `X=$(…)`) · `--json`/pipe JSON · TTY bare
65
+ * - object → YAML on a TTY, JSON for machines (delegates to {@link output})
66
+ * - array → YAML/JSON fallback (use {@link presentList} for a table)
67
+ *
68
+ * `null`/`undefined` normalize to `null` (via `output`) so `JSON.parse(stdout)`
69
+ * never breaks.
70
+ */
71
+ export declare function present(value: unknown, opts?: PresentOpts): void;
72
+ /**
73
+ * Present an array of objects.
74
+ *
75
+ * - `--count` → just the number
76
+ * - `-q/--quiet` → one path per line (unix-pipeable)
77
+ * - machine → denoised JSON of the raw items (`-l` keeps full items)
78
+ * - TTY → an aligned table + a dim count footer
79
+ *
80
+ * Projection (columns/rows/paths) is for the human table and `-q` only; the
81
+ * machine surface stays the kernel's own item fields.
82
+ */
83
+ export declare function presentList<T>(items: T[], opts: ListOpts, project: (items: T[]) => ListProjection): void;
@@ -0,0 +1,18 @@
1
+ /** A display column: which row key to read, its header, and an optional cell color. */
2
+ export type Column = {
3
+ key: string;
4
+ header: string;
5
+ color?: (s: string) => string;
6
+ };
7
+ /**
8
+ * Render an aligned, optionally-colored table.
9
+ *
10
+ * Cells may carry ANSI (e.g. a per-row status color) — widths are computed on
11
+ * visible length so alignment stays correct. `Column.color` colors a whole
12
+ * column of otherwise-plain cells. Columns empty across every row are dropped;
13
+ * the last column is left unpadded so there's no trailing whitespace.
14
+ */
15
+ export declare function renderTable(rows: Array<Record<string, string>>, opts: {
16
+ columns: Column[];
17
+ showHeader?: boolean;
18
+ }): string;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ declare const RESERVED_SLUGS: Set<string>;
3
+ export { RESERVED_SLUGS };
4
+ export declare function validateName(name: string, entity: string): void;
5
+ export declare function validateSlug(slug: string): void;
6
+ export declare function validateUrl(url: string): void;
7
+ /** Non-throwing predicate form of `validateUrl`. */
8
+ export declare function isHttpUrl(url: string): boolean;
9
+ /** `local` = only this machine. `remote` = mirrored via astrale cloud (§2.7). */
10
+ export declare const RegistryModeSchema: z.ZodEnum<["local", "remote"]>;
11
+ export type RegistryMode = z.infer<typeof RegistryModeSchema>;
@@ -0,0 +1,2 @@
1
+ export { ASTRALE_HOME, CONFIG_PATH, DATA_DIR, IDENTITIES_PATH, IDPS_PATH, IDP_SESSIONS_DIR, INSTALL_PATH, INSTANCES_PATH, KEYS_DIR, createPaths, } from '../state/index';
2
+ export type { PathEnvironment, Paths } from '../state/index';
@@ -0,0 +1,25 @@
1
+ export declare namespace exchange {
2
+ interface Artifact {
3
+ readonly version: 1;
4
+ readonly entries: Record<string, Entry>;
5
+ }
6
+ interface Key {
7
+ readonly kernelIssuer: string;
8
+ readonly domainIssuer: string;
9
+ readonly user: string;
10
+ }
11
+ interface Entry {
12
+ readonly credential: string;
13
+ readonly expiresAt: number;
14
+ }
15
+ }
16
+ export declare class ExchangeCredentialCache {
17
+ private readonly path;
18
+ private readonly refreshing;
19
+ constructor(path?: string);
20
+ getOrRefresh(key: exchange.Key, refresh: () => Promise<exchange.Entry>, now?: () => number): Promise<string>;
21
+ deleteKernel(kernelIssuer: string): Promise<void>;
22
+ clear(): Promise<void>;
23
+ private getOrRefreshOnce;
24
+ private transition;
25
+ }
@@ -0,0 +1,9 @@
1
+ /** Atomically publish one complete private state file through a same-directory temporary file. */
2
+ export declare function atomicWrite(path: string, data: string): Promise<void>;
3
+ export interface FileLockOptions {
4
+ readonly pollIntervalMs?: number;
5
+ readonly staleAfterMs?: number;
6
+ readonly timeoutMs?: number;
7
+ }
8
+ /** Run one transition under a bounded cross-process create-exclusive lock. */
9
+ export declare function withFileLock<Value>(lockPath: string, transition: () => Promise<Value>, options?: FileLockOptions): Promise<Value>;
@@ -0,0 +1,42 @@
1
+ import type { FileLockOptions } from './files';
2
+ export type IdentitySource = 'key' | 'idp';
3
+ export type IdentityMode = 'local' | 'remote';
4
+ export interface Registration {
5
+ readonly iss: string;
6
+ readonly sub: string;
7
+ readonly registeredAt: string;
8
+ }
9
+ export interface Identity {
10
+ readonly subject: string;
11
+ readonly createdAt: string;
12
+ readonly source?: IdentitySource;
13
+ readonly mode?: IdentityMode;
14
+ readonly kid?: string;
15
+ readonly idp?: string;
16
+ readonly issuer?: string;
17
+ readonly audience?: string;
18
+ readonly claims?: Readonly<Record<string, unknown>>;
19
+ readonly registrations?: Readonly<Record<string, Registration>>;
20
+ }
21
+ export interface IdentityStore {
22
+ readonly default: string;
23
+ readonly identities: Readonly<Record<string, Identity>>;
24
+ }
25
+ export declare const IDENTITY_STORE_VERSION: 1;
26
+ export type IdentityStateErrorCode = 'IDENTITY_STATE_INVALID' | 'IDENTITY_STATE_VERSION_UNSUPPORTED' | 'IDENTITY_STATE_UNREADABLE' | 'IDENTITY_STATE_BACKUP_CONFLICT';
27
+ export declare class IdentityStateError extends Error {
28
+ readonly code: IdentityStateErrorCode;
29
+ readonly path: string;
30
+ constructor(code: IdentityStateErrorCode, path: string, message: string, cause?: unknown);
31
+ }
32
+ export interface IdentityStoreOptions {
33
+ readonly path?: string;
34
+ readonly now?: () => Date;
35
+ readonly lock?: FileLockOptions;
36
+ }
37
+ export interface IdentityUpdate<Value> {
38
+ readonly next: IdentityStore;
39
+ readonly value: Value;
40
+ }
41
+ export declare function readIdentityStore(options?: IdentityStoreOptions): Promise<IdentityStore>;
42
+ export declare function updateIdentityStore<Value>(transition: (current: IdentityStore) => IdentityUpdate<Value> | Promise<IdentityUpdate<Value>>, options?: IdentityStoreOptions): Promise<Value>;
@@ -0,0 +1,8 @@
1
+ export { atomicWrite, withFileLock } from './files';
2
+ export type { FileLockOptions } from './files';
3
+ export { ExchangeCredentialCache } from './exchange-credentials';
4
+ export type { exchange } from './exchange-credentials';
5
+ export { IDENTITY_STORE_VERSION, readIdentityStore, updateIdentityStore } from './identities';
6
+ export type { Identity, IdentityMode, IdentitySource, IdentityStore, IdentityStoreOptions, IdentityUpdate, Registration, } from './identities';
7
+ export { ASTRALE_HOME, CONFIG_PATH, DATA_DIR, IDENTITIES_PATH, IDPS_PATH, IDP_SESSIONS_DIR, EXCHANGE_CREDENTIALS_PATH, INSTALL_PATH, INSTANCES_PATH, KEYS_DIR, createPaths, paths, } from './paths';
8
+ export type { PathEnvironment, Paths } from './paths';
@@ -0,0 +1,32 @@
1
+ export interface PathEnvironment {
2
+ readonly ASTRALE_HOME?: string;
3
+ readonly ASTRALE_KEYS_DIR?: string;
4
+ readonly ASTRALE_DATA_DIR?: string;
5
+ }
6
+ export interface Paths {
7
+ readonly home: string;
8
+ readonly keys: string;
9
+ readonly data: string;
10
+ readonly config: string;
11
+ readonly install: string;
12
+ readonly identities: string;
13
+ readonly instances: string;
14
+ readonly idps: string;
15
+ readonly idpSessionsDir: string;
16
+ readonly exchangeCredentials: string;
17
+ idpDir(name: string): string;
18
+ idpSession(identityName: string): string;
19
+ }
20
+ /** Resolve every CLI state path once from explicit input and the captured environment. */
21
+ export declare function createPaths(home?: string, environment?: PathEnvironment): Paths;
22
+ export declare const paths: Paths;
23
+ export declare const ASTRALE_HOME: string;
24
+ export declare const KEYS_DIR: string;
25
+ export declare const DATA_DIR: string;
26
+ export declare const CONFIG_PATH: string;
27
+ export declare const INSTALL_PATH: string;
28
+ export declare const IDENTITIES_PATH: string;
29
+ export declare const INSTANCES_PATH: string;
30
+ export declare const IDPS_PATH: string;
31
+ export declare const IDP_SESSIONS_DIR: string;
32
+ export declare const EXCHANGE_CREDENTIALS_PATH: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/cli",
3
- "version": "0.8.0-alpha.0",
3
+ "version": "0.8.1-alpha.2",
4
4
  "description": "Astrale CLI — connect to existing Astrale kernels",
5
5
  "keywords": [
6
6
  "astrale",
@@ -29,16 +29,28 @@
29
29
  ],
30
30
  "type": "module",
31
31
  "exports": {
32
- "./keys": "./src/lib/keys.ts",
33
- "./paths": "./src/lib/paths.ts"
32
+ "./connect-core": {
33
+ "types": "./dist/types/connect-core.d.ts",
34
+ "import": "./dist/public/connect-core.js",
35
+ "default": "./dist/public/connect-core.js"
36
+ },
37
+ "./keys": {
38
+ "types": "./dist/types/keys/index.d.ts",
39
+ "import": "./dist/public/keys/index.js",
40
+ "default": "./dist/public/keys/index.js"
41
+ },
42
+ "./paths": {
43
+ "types": "./dist/types/paths/index.d.ts",
44
+ "import": "./dist/public/paths/index.js",
45
+ "default": "./dist/public/paths/index.js"
46
+ },
47
+ "./identity-export-v1.schema.json": "./src/identity/.spec/schemas/identity-export-v1.schema.json"
34
48
  },
35
49
  "publishConfig": {
36
50
  "access": "public",
37
51
  "registry": "https://registry.npmjs.org"
38
52
  },
39
53
  "dependencies": {
40
- "@astrale-os/kernel-client": ">=0.3.1 <1.0.0",
41
- "@astrale-os/kernel-core": ">=0.7.0 <1.0.0",
42
54
  "@inquirer/prompts": "^8.5.2",
43
55
  "chalk": "^5.6.2",
44
56
  "chokidar": "^4.0.3",
@@ -50,8 +62,10 @@
50
62
  "zod": "^3.25.0"
51
63
  },
52
64
  "devDependencies": {
65
+ "@astrale-os/kernel-client": "0.6.0-beta.1",
53
66
  "@astrale-os/ox": ">=0.1.0 <1.0.0",
54
- "@astrale-os/shell": ">=0.3.5 <1.0.0",
67
+ "@astrale-os/sdk": "0.5.0-beta.1",
68
+ "@astrale-os/shell": "0.3.8-beta.1",
55
69
  "@astrale/commitlint-config": "npm:@jsr/astrale__commitlint-config@~2.0.1",
56
70
  "@commitlint/cli": "~20.3.1",
57
71
  "@commitlint/config-conventional": "~20.3.1",
@@ -74,13 +88,21 @@
74
88
  "oxfmt --write"
75
89
  ]
76
90
  },
91
+ "devEngines": {
92
+ "runtime": {
93
+ "name": "node",
94
+ "version": ">=24 <25",
95
+ "onFail": "error"
96
+ }
97
+ },
77
98
  "engines": {
78
- "node": ">=20"
99
+ "node": ">=22"
79
100
  },
80
101
  "scripts": {
81
102
  "preinstall": "node .check-workspace.cjs",
82
103
  "build": "bun scripts/build.ts",
83
- "typecheck": "tsgo --noEmit && tsgo --noEmit -p viewer",
104
+ "package:check": "pnpm run typecheck && pnpm run test && pnpm run build && node scripts/verify-public-exports.mjs",
105
+ "typecheck": "tsgo --noEmit && tsgo --noEmit -p tsconfig.tests.json && tsgo --noEmit -p viewer && tsgo --noEmit -p studio",
84
106
  "lint": "oxlint .",
85
107
  "lint:fix": "oxlint --fix .",
86
108
  "format": "pnpm exec oxfmt --write .",
@@ -0,0 +1,3 @@
1
+ /** CLI-private V2 Admin adapters; no package export or duplicate control-plane semantics. */
2
+ export * as catalog from '../catalog/.spec/api.js'
3
+ export * as instance from '../instance/.spec/api.js'
@@ -0,0 +1,15 @@
1
+ # CLI Admin adapters
2
+
3
+ This private aggregate translates the frozen CLI command journey into the discovered V2
4
+ `admin.astrale.ai` contract. It binds the exact served Domain revision through Kernel Client,
5
+ uses `GraphApi` for policy-visible inventory, and invokes receiver-oriented Methods through
6
+ `DomainBinding`. It does not import Admin implementation code, hard-code one schema revision, call
7
+ Host directly, or persist remote graph truth.
8
+
9
+ `instance` owns create/list/status/delete/install projection and explicitly excludes the reserved
10
+ Admin Host from consumer placement. `catalog` owns Domain inventory, publication, and default-set
11
+ configuration. `graph` is their bounded cursor helper and is not re-exported by the aggregate.
12
+
13
+ Commander grammar, help text, output shapes, bookmark behavior, and current interactive host
14
+ selection remain owned by the existing command surface; these adapters change only its remote
15
+ semantic owner.
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#7c3aed" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M12 3 4.5 7v10L12 21l7.5-4V7z"/><path d="M8 10h8M8 14h5"/><circle cx="17" cy="16" r="2.5"/>
3
+ </svg>
@@ -0,0 +1,6 @@
1
+ import { defineLayout } from '@astrale-os/spec/authoring'
2
+
3
+ export default defineLayout({
4
+ entries: ['catalog/', 'graph/', 'index.ts', 'instance/'],
5
+ exact: true,
6
+ })
@@ -0,0 +1,65 @@
1
+ import type { DomainBinding } from '@astrale-os/kernel-client/domain'
2
+ import type { ClientSession } from '@astrale-os/kernel-client/session'
3
+
4
+ import type { AdminGraphApi } from '../../graph/.spec/api.js'
5
+
6
+ export interface DomainInfo {
7
+ readonly id: string
8
+ readonly origin: string
9
+ readonly name: string
10
+ readonly url?: string
11
+ readonly description?: string
12
+ readonly installByDefault?: boolean
13
+ readonly createdAt: string
14
+ readonly updatedAt: string
15
+ }
16
+
17
+ export interface PublishDomainInput {
18
+ readonly origin: string
19
+ readonly name: string
20
+ readonly url: string
21
+ readonly description?: string
22
+ readonly installByDefault?: boolean
23
+ }
24
+
25
+ export interface PublishDomainResult {
26
+ readonly entry: DomainInfo
27
+ readonly changed: boolean
28
+ readonly isNew: boolean
29
+ }
30
+
31
+ export interface InstallDomainResult {
32
+ readonly name: string
33
+ readonly origin: string
34
+ readonly instanceId: string
35
+ readonly url: string
36
+ readonly ok: boolean
37
+ readonly error?: string | null
38
+ }
39
+
40
+ export interface AdminCatalogContext {
41
+ readonly session: ClientSession
42
+ readonly graph: AdminGraphApi
43
+ }
44
+
45
+ export interface AdminCatalogApi {
46
+ list(): Promise<DomainInfo[]>
47
+ require(identifier: string): Promise<DomainInfo>
48
+ publish(input: PublishDomainInput): Promise<PublishDomainResult>
49
+ }
50
+
51
+ export class AdminDomainNotFoundError extends Error {
52
+ constructor(identifier: string)
53
+ readonly name: 'NotFoundError'
54
+ readonly identifier: string
55
+ }
56
+
57
+ export interface AdminCatalogDependencies {
58
+ readonly bind?: (session: ClientSession) => Promise<DomainBinding>
59
+ readonly operationId?: (kind: 'publish' | 'configure-default') => string
60
+ }
61
+
62
+ export function connectAdminCatalog(
63
+ context: AdminCatalogContext,
64
+ dependencies?: AdminCatalogDependencies,
65
+ ): Promise<AdminCatalogApi>
@@ -0,0 +1,6 @@
1
+ # CLI Admin catalog adapter
2
+
3
+ The adapter reads policy-visible `Domain` Nodes through bounded Graph pages and derives default
4
+ membership from the Fleet relation. Publication invokes `Fleet.publishDomain`; a requested default
5
+ change is a separate explicit `Domain.configureDefault` call. Unchanged publication input is a
6
+ no-op, and an omitted description preserves the current value.
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#059669" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M5 4h14v16H5zM8 8h8M8 12h8M8 16h5"/><circle cx="17" cy="16" r="2"/>
3
+ </svg>
@@ -0,0 +1,6 @@
1
+ import { defineLayout } from '@astrale-os/spec/authoring'
2
+
3
+ export default defineLayout({
4
+ entries: ['__tests__/', 'client.ts', 'index.ts', 'model.ts', 'tsconfig.json'],
5
+ exact: true,
6
+ })