@astrale-os/cli 1.0.0-beta.1 → 1.0.0-beta.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 (180) hide show
  1. package/README.md +7 -11
  2. package/dist/astrale.js +3737 -3523
  3. package/dist/public/connect-core.js +396 -392
  4. package/dist/public/keys/index.js +371 -378
  5. package/dist/public/paths/index.js +371 -378
  6. package/dist/types/lib/idp.d.ts +6 -0
  7. package/dist/types/lib/meta.d.ts +2 -2
  8. package/package.json +6 -4
  9. package/src/admin/binding.ts +168 -0
  10. package/src/admin/catalog/__tests__/client.test.ts +2 -2
  11. package/src/admin/catalog/client.ts +4 -9
  12. package/src/admin/instance/__tests__/client.test.ts +2 -2
  13. package/src/admin/instance/client.ts +6 -11
  14. package/src/commands/__tests__/auth-login.test.ts +54 -1
  15. package/src/commands/__tests__/call.test.ts +5 -1
  16. package/src/commands/__tests__/domain-install-operation.test.ts +23 -7
  17. package/src/commands/__tests__/domain-install-owned.test.ts +5 -1
  18. package/src/commands/__tests__/domain-list.test.ts +83 -4
  19. package/src/commands/__tests__/install-identity-override.test.ts +30 -19
  20. package/src/commands/__tests__/studio-descriptor.test.ts +22 -0
  21. package/src/commands/__tests__/update.test.ts +23 -16
  22. package/src/commands/domain/install.ts +11 -15
  23. package/src/commands/domain/list.ts +17 -12
  24. package/src/commands/studio.ts +20 -0
  25. package/src/commands/update.ts +9 -5
  26. package/src/connection/__tests__/errors.test.ts +16 -12
  27. package/src/connection/__tests__/exchange.test.ts +6 -5
  28. package/src/connection/exchange.ts +5 -4
  29. package/src/lib/__tests__/domain-publication.test.ts +144 -0
  30. package/src/lib/__tests__/idp-session.test.ts +22 -0
  31. package/src/lib/__tests__/idp.test.ts +2 -0
  32. package/src/lib/__tests__/instance.test.ts +6 -0
  33. package/src/lib/__tests__/studio-server-deps.test.ts +53 -16
  34. package/src/lib/__tests__/update.test.ts +12 -0
  35. package/src/lib/domain-publication.ts +102 -0
  36. package/src/lib/idp.ts +5 -1
  37. package/src/lib/instance.ts +6 -1
  38. package/src/lib/login-flow.ts +13 -3
  39. package/src/lib/meta.ts +2 -2
  40. package/src/lib/update.ts +4 -4
  41. package/src/program/__tests__/program.test.ts +1 -1
  42. package/studio/client/dist/assets/{elk-api-D2xgMJvi.js → elk-api-lwhFo7vB.js} +1 -1
  43. package/studio/client/dist/assets/index-B-c-smo9.js +8 -0
  44. package/studio/client/dist/assets/index-BckHuAWk.js +81 -0
  45. package/studio/client/dist/assets/index-C4aNQ6dz.css +1 -0
  46. package/studio/client/dist/index.html +2 -2
  47. package/studio/package.json +3 -1
  48. package/studio/server/agent/bridge/stdio.ts +8 -1
  49. package/studio/server/agent/conversation.test.ts +10 -5
  50. package/studio/server/agent/conversation.ts +56 -8
  51. package/studio/server/agent/harness/codex/loadout.ts +18 -21
  52. package/studio/server/agent/harness/gateway/config.ts +20 -18
  53. package/studio/server/agent/harness/selection.ts +9 -1
  54. package/studio/server/agent/prompts/system.ts +3 -2
  55. package/studio/server/agent/prompts/turn.ts +13 -4
  56. package/studio/server/agent/run/completion.ts +2 -2
  57. package/studio/server/agent/run/preparation.ts +6 -5
  58. package/studio/server/agent/run/transcript.test.ts +35 -1
  59. package/studio/server/agent/run/transcript.ts +169 -3
  60. package/studio/server/agent/run/usage.test.ts +24 -0
  61. package/studio/server/agent/run/usage.ts +26 -1
  62. package/studio/server/api/canvas.ts +44 -0
  63. package/studio/server/api/comments.ts +85 -0
  64. package/studio/server/api/context.ts +61 -0
  65. package/studio/server/api/deployment.ts +39 -0
  66. package/studio/server/api/documents.ts +55 -0
  67. package/studio/server/api/domain.ts +59 -0
  68. package/studio/server/api/http.ts +45 -0
  69. package/studio/server/api/project.ts +57 -0
  70. package/studio/server/api/schema.ts +12 -0
  71. package/studio/server/api/views.ts +57 -0
  72. package/studio/server/api/workspace.ts +60 -0
  73. package/studio/server/api.test.ts +147 -0
  74. package/studio/server/api.ts +20 -422
  75. package/studio/server/cache.test.ts +111 -0
  76. package/studio/server/cache.ts +163 -9
  77. package/studio/server/cli-consumers.test.ts +494 -0
  78. package/studio/server/cli.test.ts +88 -0
  79. package/studio/server/cli.ts +240 -0
  80. package/studio/server/client-package.ts +25 -1
  81. package/studio/server/domain.test.ts +30 -2
  82. package/studio/server/domain.ts +14 -2
  83. package/studio/server/environment/dotenv-preview.test.ts +39 -0
  84. package/studio/server/environment/dotenv-preview.ts +27 -0
  85. package/studio/server/environment/files.test.ts +53 -0
  86. package/studio/server/{state/env.ts → environment/files.ts} +7 -48
  87. package/studio/server/{state → handoff}/copy.ts +21 -6
  88. package/studio/server/handoff/service.test.ts +22 -0
  89. package/studio/server/{state/handoff.ts → handoff/service.ts} +21 -14
  90. package/studio/server/instances/active.ts +72 -0
  91. package/studio/server/instances/deploy-record.test.ts +31 -0
  92. package/studio/server/instances/deploy-record.ts +37 -0
  93. package/studio/server/instances/deploy.ts +56 -0
  94. package/studio/server/{state/instance.test.ts → instances/probe.test.ts} +25 -21
  95. package/studio/server/instances/probe.ts +67 -0
  96. package/studio/server/instances/status.test.ts +12 -0
  97. package/studio/server/instances/status.ts +49 -0
  98. package/studio/server/introspect/anatomy/client-tree.ts +57 -0
  99. package/studio/server/introspect/anatomy/env-fields.ts +66 -0
  100. package/studio/server/introspect/anatomy/schema-definition.ts +53 -0
  101. package/studio/server/introspect/anatomy/source.ts +181 -0
  102. package/studio/server/introspect/anatomy/views/legacy.ts +232 -0
  103. package/studio/server/introspect/anatomy/views/routes.ts +105 -0
  104. package/studio/server/introspect/anatomy/views.ts +58 -0
  105. package/studio/server/introspect/anatomy-extras.test.ts +91 -4
  106. package/studio/server/introspect/anatomy-extras.ts +7 -726
  107. package/studio/server/introspect/anatomy.ts +46 -19
  108. package/studio/server/introspect/bundle.ts +15 -6
  109. package/studio/server/introspect/canonical-schema.test.ts +79 -0
  110. package/studio/server/introspect/canonical-schema.ts +80 -18
  111. package/studio/server/introspect/config-preview.test.ts +32 -0
  112. package/studio/server/introspect/config-preview.ts +119 -0
  113. package/studio/server/introspect/diff.test.ts +7 -11
  114. package/studio/server/introspect/diff.ts +28 -37
  115. package/studio/server/introspect/extractor.ts +8 -6
  116. package/studio/server/introspect/hash.ts +5 -2
  117. package/studio/server/introspect/overlay-tsmorph.ts +7 -1305
  118. package/studio/server/introspect/revision.test.ts +54 -0
  119. package/studio/server/introspect/revision.ts +49 -0
  120. package/studio/server/introspect/runtime.test.ts +63 -5
  121. package/studio/server/introspect/runtime.ts +49 -3
  122. package/studio/server/introspect/schema-ir-json.ts +181 -0
  123. package/studio/server/introspect/source-overlay/annotations.ts +14 -0
  124. package/studio/server/introspect/source-overlay/handlers.ts +681 -0
  125. package/studio/server/introspect/source-overlay/kernel-calls.ts +49 -0
  126. package/studio/server/introspect/source-overlay/project.ts +248 -0
  127. package/studio/server/introspect/source-overlay/spans.ts +360 -0
  128. package/studio/server/json.ts +46 -0
  129. package/studio/server/lifecycle.ts +5 -1
  130. package/studio/server/sse.test.ts +26 -0
  131. package/studio/server/sse.ts +4 -1
  132. package/studio/server/state/baseline.test.ts +212 -1
  133. package/studio/server/state/baseline.ts +145 -29
  134. package/studio/server/state/comments.test.ts +66 -1
  135. package/studio/server/state/comments.ts +173 -10
  136. package/studio/server/state/context.ts +34 -2
  137. package/studio/server/state/documents.ts +42 -1
  138. package/studio/server/state/integrations.ts +27 -1
  139. package/studio/server/state/layout.test.ts +34 -0
  140. package/studio/server/state/layout.ts +44 -17
  141. package/studio/server/state/settings.ts +29 -22
  142. package/studio/server/state/store.test.ts +122 -0
  143. package/studio/server/state/store.ts +66 -17
  144. package/studio/server/state/visibility.ts +22 -7
  145. package/studio/server/views/model.test.ts +57 -0
  146. package/studio/server/views/model.ts +66 -0
  147. package/studio/server/views/runtime.ts +40 -0
  148. package/studio/server/views/selection-repository.test.ts +31 -0
  149. package/studio/server/views/selection-repository.ts +60 -0
  150. package/studio/server/views/session.test.ts +73 -0
  151. package/studio/server/views/session.ts +166 -0
  152. package/studio/server/{state/views.test.ts → views/target.test.ts} +8 -159
  153. package/studio/server/views/target.ts +248 -0
  154. package/studio/server/watch.ts +1 -1
  155. package/studio/server/workspace/catalog.test.ts +17 -0
  156. package/studio/server/workspace/catalog.ts +43 -0
  157. package/studio/server/{state → workspace}/create.test.ts +1 -1
  158. package/studio/server/{state → workspace}/create.ts +1 -1
  159. package/studio/server/{state → workspace}/git.ts +1 -1
  160. package/studio/server/workspace/updates.ts +83 -0
  161. package/studio/server/workspace-state.ts +1 -1
  162. package/studio/shared/contracts/README.md +16 -0
  163. package/studio/shared/contracts/agent.ts +270 -0
  164. package/studio/shared/contracts/runtime.ts +50 -0
  165. package/studio/shared/contracts/schema.ts +462 -0
  166. package/studio/shared/contracts/surface.test.ts +319 -0
  167. package/studio/shared/contracts/workspace.ts +274 -0
  168. package/studio/shared/layout.test.ts +116 -0
  169. package/studio/shared/schema/identity.test.ts +58 -0
  170. package/studio/shared/schema/identity.ts +82 -0
  171. package/studio/shared/types.ts +11 -1099
  172. package/studio/tsconfig.json +1 -1
  173. package/viewer/dist/main.js +35 -35
  174. package/studio/client/dist/assets/index-BMdnsIJA.css +0 -1
  175. package/studio/client/dist/assets/index-D-vRV8w7.js +0 -8
  176. package/studio/client/dist/assets/index-LGSWRrk8.js +0 -81
  177. package/studio/server/state/catalog.ts +0 -117
  178. package/studio/server/state/instance.ts +0 -280
  179. package/studio/server/state/updates.ts +0 -63
  180. package/studio/server/state/views.ts +0 -535
@@ -1,12 +1,10 @@
1
1
  /**
2
- * diff.ts — structural diff of two Schema IRs + breaking/additive classification.
3
- * Shared by change tracking (baseline) and data versioning. Pure.
2
+ * diff.ts — indicative structural diff of two Studio render IRs. Pure.
4
3
  *
5
4
  * Canonical V1 keeps optionality in the owning `required` arrays and nullability
6
- * in each value schema. Legacy nullable projections remain supported. Contract
7
- * changes are classified conservatively: removals, tightened value schemas,
8
- * callable/auth/policy changes, topology changes, dependency revisions and Core
9
- * changes are breaking; pure additions and descriptions are additive.
5
+ * in each value schema. Legacy nullable projections remain supported. This
6
+ * inventory deliberately makes no installation or data-migration claim;
7
+ * only the Kernel Runtime can assess those transitions against installed data.
10
8
  */
11
9
  import type {
12
10
  IrClass,
@@ -75,7 +73,7 @@ export function diffSchemas(prev: SchemaIR | null, next: SchemaIR | null): Schem
75
73
  },
76
74
  )
77
75
  ) {
78
- changes.push({ kind: 'schema-metadata-changed', target: next.domain, breaking: true })
76
+ changes.push({ kind: 'schema-metadata-changed', target: next.domain })
79
77
  }
80
78
 
81
79
  diffValueRecord(prev.types ?? {}, next.types ?? {}, 'type', changes)
@@ -92,7 +90,7 @@ export function diffSchemas(prev: SchemaIR | null, next: SchemaIR | null): Schem
92
90
  diffValueRecord(prev.policies ?? {}, next.policies ?? {}, 'policy', changes)
93
91
  diffDependencies(prev.dependencies ?? [], next.dependencies ?? [], changes)
94
92
  if (!same(prev.core, next.core) && (prev.core !== undefined || next.core !== undefined)) {
95
- changes.push({ kind: 'core-changed', target: next.domain, breaking: prev.core !== undefined })
93
+ changes.push({ kind: 'core-changed', target: next.domain })
96
94
  }
97
95
  return changes
98
96
  }
@@ -105,14 +103,14 @@ function diffValueRecord(
105
103
  ): void {
106
104
  for (const name of sortedKeys(next)) {
107
105
  if (!(name in prev)) {
108
- out.push({ kind: `${scope}-added`, target: name, breaking: false })
106
+ out.push({ kind: `${scope}-added`, target: name })
109
107
  }
110
108
  }
111
109
  for (const name of sortedKeys(prev)) {
112
110
  if (!(name in next)) {
113
- out.push({ kind: `${scope}-removed`, target: name, breaking: true })
111
+ out.push({ kind: `${scope}-removed`, target: name })
114
112
  } else if (!same(prev[name], next[name])) {
115
- out.push({ kind: `${scope}-changed`, target: name, breaking: true })
113
+ out.push({ kind: `${scope}-changed`, target: name })
116
114
  }
117
115
  }
118
116
  }
@@ -123,18 +121,18 @@ function diffFunctions(
123
121
  out: SchemaChange[],
124
122
  ): void {
125
123
  for (const name of sortedKeys(next)) {
126
- if (!prev[name]) out.push({ kind: 'function-added', target: name, breaking: false })
124
+ if (!prev[name]) out.push({ kind: 'function-added', target: name })
127
125
  }
128
126
  for (const name of sortedKeys(prev)) {
129
127
  if (!next[name]) {
130
- out.push({ kind: 'function-removed', target: name, breaking: true })
128
+ out.push({ kind: 'function-removed', target: name })
131
129
  continue
132
130
  }
133
131
  if (!same(callableContract(prev[name]), callableContract(next[name]))) {
134
- out.push({ kind: 'function-signature-changed', target: name, breaking: true })
132
+ out.push({ kind: 'function-signature-changed', target: name })
135
133
  }
136
134
  if (prev[name].description !== next[name].description) {
137
- out.push({ kind: 'function-metadata-changed', target: name, breaking: false })
135
+ out.push({ kind: 'function-metadata-changed', target: name })
138
136
  }
139
137
  }
140
138
  }
@@ -145,11 +143,11 @@ function diffViews(
145
143
  out: SchemaChange[],
146
144
  ): void {
147
145
  for (const name of sortedKeys(next)) {
148
- if (!(name in prev)) out.push({ kind: 'view-added', target: name, breaking: false })
146
+ if (!(name in prev)) out.push({ kind: 'view-added', target: name })
149
147
  }
150
148
  for (const name of sortedKeys(prev)) {
151
149
  if (!(name in next)) {
152
- out.push({ kind: 'view-removed', target: name, breaking: true })
150
+ out.push({ kind: 'view-removed', target: name })
153
151
  continue
154
152
  }
155
153
  if (
@@ -161,10 +159,10 @@ function diffViews(
161
159
  },
162
160
  )
163
161
  ) {
164
- out.push({ kind: 'view-changed', target: name, breaking: true })
162
+ out.push({ kind: 'view-changed', target: name })
165
163
  }
166
164
  if (prev[name].description !== next[name].description) {
167
- out.push({ kind: 'view-metadata-changed', target: name, breaking: false })
165
+ out.push({ kind: 'view-metadata-changed', target: name })
168
166
  }
169
167
  }
170
168
  }
@@ -182,18 +180,17 @@ function diffDependencies(
182
180
  )
183
181
  for (const origin of sortedKeys(after)) {
184
182
  if (!(origin in before)) {
185
- out.push({ kind: 'dependency-added', target: origin, breaking: true })
183
+ out.push({ kind: 'dependency-added', target: origin })
186
184
  }
187
185
  }
188
186
  for (const origin of sortedKeys(before)) {
189
187
  if (!(origin in after)) {
190
- out.push({ kind: 'dependency-removed', target: origin, breaking: true })
188
+ out.push({ kind: 'dependency-removed', target: origin })
191
189
  } else if (before[origin] !== after[origin]) {
192
190
  out.push({
193
191
  kind: 'dependency-changed',
194
192
  target: origin,
195
193
  detail: `${before[origin]} → ${after[origin]}`,
196
- breaking: true,
197
194
  })
198
195
  }
199
196
  }
@@ -213,13 +210,13 @@ function diffMembers(
213
210
  for (const name of sortedKeys(next)) {
214
211
  if (!prev[name]) {
215
212
  const k = memberKind(next[name])
216
- out.push({ kind: `${k}-added` as SchemaChange['kind'], target: name, breaking: false })
213
+ out.push({ kind: `${k}-added` as SchemaChange['kind'], target: name })
217
214
  }
218
215
  }
219
216
  for (const name of sortedKeys(prev)) {
220
217
  if (!next[name]) {
221
218
  const k = memberKind(prev[name])
222
- out.push({ kind: `${k}-removed` as SchemaChange['kind'], target: name, breaking: true })
219
+ out.push({ kind: `${k}-removed` as SchemaChange['kind'], target: name })
223
220
  continue
224
221
  }
225
222
  diffMemberBody(name, prev[name], next[name], out)
@@ -241,13 +238,12 @@ function diffMemberBody(
241
238
  kind: 'prop-added',
242
239
  target: `${name}.${p}`,
243
240
  detail: required ? 'required' : 'optional',
244
- breaking: required,
245
241
  })
246
242
  }
247
243
  }
248
244
  for (const p of sortedKeys(pa)) {
249
245
  if (!pb[p]) {
250
- out.push({ kind: 'prop-removed', target: `${name}.${p}`, breaking: true })
246
+ out.push({ kind: 'prop-removed', target: `${name}.${p}` })
251
247
  continue
252
248
  }
253
249
  if (!same(pa[p], pb[p])) {
@@ -258,7 +254,6 @@ function diffMemberBody(
258
254
  detail: baseChanged
259
255
  ? `${baseType(pa[p])} → ${baseType(pb[p])}`
260
256
  : 'value constraints changed',
261
- breaking: true,
262
257
  })
263
258
  }
264
259
  const wasOpt = !propertyRequired(a, p)
@@ -268,7 +263,6 @@ function diffMemberBody(
268
263
  kind: 'prop-required-changed',
269
264
  target: `${name}.${p}`,
270
265
  detail: wasOpt ? 'optional → required' : 'required → optional',
271
- breaking: wasOpt && !nowOpt, // optional→required is breaking
272
266
  })
273
267
  }
274
268
  }
@@ -280,20 +274,19 @@ function diffMemberBody(
280
274
  out.push({
281
275
  kind: 'method-added',
282
276
  target: `${name}.${m}`,
283
- breaking: b.type === 'interface' && mb[m].inheritance === 'abstract',
284
277
  })
285
278
  }
286
279
  }
287
280
  for (const m of sortedKeys(ma)) {
288
281
  if (!mb[m]) {
289
- out.push({ kind: 'method-removed', target: `${name}.${m}`, breaking: true })
282
+ out.push({ kind: 'method-removed', target: `${name}.${m}` })
290
283
  continue
291
284
  }
292
285
  if (!same(callableContract(ma[m]), callableContract(mb[m]))) {
293
- out.push({ kind: 'method-signature-changed', target: `${name}.${m}`, breaking: true })
286
+ out.push({ kind: 'method-signature-changed', target: `${name}.${m}` })
294
287
  }
295
288
  if (ma[m].description !== mb[m].description) {
296
- out.push({ kind: 'method-metadata-changed', target: `${name}.${m}`, breaking: false })
289
+ out.push({ kind: 'method-metadata-changed', target: `${name}.${m}` })
297
290
  }
298
291
  }
299
292
 
@@ -302,11 +295,10 @@ function diffMemberBody(
302
295
  out.push({
303
296
  kind: `${kind}-contract-changed`,
304
297
  target: name,
305
- breaking: true,
306
298
  })
307
299
  }
308
300
  if (!same(memberMetadata(a), memberMetadata(b))) {
309
- out.push({ kind: 'definition-metadata-changed', target: name, breaking: false })
301
+ out.push({ kind: 'definition-metadata-changed', target: name })
310
302
  }
311
303
  }
312
304
 
@@ -356,7 +348,6 @@ function canonical(value: unknown): unknown {
356
348
  )
357
349
  }
358
350
 
359
- export function classify(changes: SchemaChange[]): 'none' | 'additive' | 'breaking' {
360
- if (changes.length === 0) return 'none'
361
- return changes.some((c) => c.breaking) ? 'breaking' : 'additive'
351
+ export function structuralStatusOf(changes: SchemaChange[]): 'none' | 'changed' {
352
+ return changes.length === 0 ? 'none' : 'changed'
362
353
  }
@@ -11,7 +11,7 @@
11
11
  * render state, never a crash.
12
12
  */
13
13
  import {
14
- closureFromSdk,
14
+ admitCanonicalSchemaFromSdk,
15
15
  findCanonicalDomainSchemaExport,
16
16
  normalizeLegacySchemaIR,
17
17
  projectCanonicalSchema,
@@ -39,15 +39,15 @@ async function main() {
39
39
  const canonicalRoot = findCanonicalDomainSchemaExport(mod)
40
40
  if (canonicalRoot) {
41
41
  const domainSdk = await loadSdkSchema()
42
- const projected = projectCanonicalSchema(
43
- canonicalRoot,
44
- closureFromSdk(domainSdk, canonicalRoot),
45
- )
42
+ const admission = admitCanonicalSchemaFromSdk(domainSdk, canonicalRoot)
43
+ const projected = projectCanonicalSchema(admission.root, admission.closure)
46
44
  process.stdout.write(
47
45
  JSON.stringify({
48
46
  ok: true,
49
47
  ir: projected.ir,
50
- root: canonicalRoot,
48
+ root: admission.root,
49
+ schemaMode: admission.status === 'admitted' ? 'canonical-admitted' : 'canonical-preview',
50
+ revision: admission.revision,
51
51
  importedInterfaces: projected.importedInterfaces,
52
52
  }),
53
53
  )
@@ -118,6 +118,8 @@ async function main() {
118
118
  ok: true,
119
119
  ir: normalizeLegacySchemaIR(ir),
120
120
  root: null,
121
+ schemaMode: 'legacy',
122
+ revision: null,
121
123
  importedInterfaces,
122
124
  }),
123
125
  )
@@ -15,7 +15,10 @@ function sortKeys(v: any): any {
15
15
  return v
16
16
  }
17
17
 
18
- /** sha256 over canonical JSON, short-prefixed — the schemaHash (identifies a schema version). */
19
- export function schemaHashOf(value: unknown): string {
18
+ /**
19
+ * Short, deterministic identity for Studio rendering/cache invalidation only.
20
+ * This is deliberately not the DSL-owned `schema.revision()`.
21
+ */
22
+ export function renderFingerprintOf(value: unknown): string {
20
23
  return 'sha-' + createHash('sha256').update(canonicalJSON(value)).digest('hex').slice(0, 12)
21
24
  }