@astrale-os/cli 1.0.0-beta.3 → 1.0.0-beta.30
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.
- package/README.md +80 -6
- package/dist/astrale.js +55471 -58674
- package/dist/public/connect-core.js +2158 -30706
- package/dist/public/keys/index.js +1016 -29541
- package/dist/public/paths/index.js +370 -28654
- package/dist/types/admin/contract.d.ts +26 -0
- package/dist/types/admin/instance/client.d.ts +20 -0
- package/dist/types/admin/instance/index.d.ts +2 -0
- package/dist/types/admin/instance/model.d.ts +6 -10
- package/dist/types/connection/auth.d.ts +3 -0
- package/dist/types/connection/call.d.ts +3 -0
- package/dist/types/connection/command.d.ts +27 -0
- package/dist/types/connection/credential.d.ts +14 -0
- package/dist/types/connection/errors.d.ts +1 -0
- package/dist/types/connection/exchange.d.ts +9 -0
- package/dist/types/connection/failure/classify.d.ts +2 -0
- package/dist/types/connection/failure/index.d.ts +5 -0
- package/dist/types/connection/failure/model.d.ts +25 -0
- package/dist/types/connection/failure/render.d.ts +3 -0
- package/dist/types/connection/index.d.ts +8 -0
- package/dist/types/connection/reasons.d.ts +37 -0
- package/dist/types/connection/self.d.ts +37 -0
- package/dist/types/connection/session.d.ts +31 -0
- package/dist/types/connection/target.d.ts +38 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/lib/admin-instance.d.ts +17 -0
- package/dist/types/lib/admin-target.d.ts +11 -36
- package/dist/types/lib/config.d.ts +13 -59
- package/dist/types/lib/failure-debug.d.ts +1 -0
- package/dist/types/lib/idp.d.ts +25 -173
- package/dist/types/lib/instance-target.d.ts +1 -1
- package/dist/types/lib/instance.d.ts +30 -88
- package/dist/types/lib/log.d.ts +5 -3
- package/dist/types/lib/output.d.ts +1 -1
- package/dist/types/lib/proc.d.ts +43 -0
- package/dist/types/lib/self.d.ts +9 -0
- package/dist/types/lib/update.d.ts +109 -0
- package/dist/types/lib/validation.d.ts +4 -1
- package/dist/types/state/exchange-credentials.d.ts +6 -2
- package/dist/types/state/files.d.ts +2 -0
- package/dist/types/state/index.d.ts +3 -2
- package/dist/types/state/paths.d.ts +2 -0
- package/dist/types/state/session-routes.d.ts +10 -0
- package/package.json +16 -19
- package/src/__tests__/fixtures/publication.ts +20 -0
- package/src/admin/.spec/architecture.md +12 -5
- package/src/admin/__tests__/fixture.ts +25 -0
- package/src/admin/catalog/.spec/api.d.ts +1 -3
- package/src/admin/catalog/.spec/architecture.md +5 -4
- package/src/admin/catalog/__tests__/client.test.ts +143 -69
- package/src/admin/catalog/client.ts +40 -54
- package/src/admin/catalog/model.ts +3 -4
- package/src/admin/contract.ts +47 -0
- package/src/admin/graph/.spec/api.d.ts +4 -10
- package/src/admin/graph/nodes.ts +1 -1
- package/src/admin/instance/.spec/api.d.ts +5 -9
- package/src/admin/instance/.spec/architecture.md +7 -7
- package/src/admin/instance/__tests__/client.test.ts +157 -175
- package/src/admin/instance/client.ts +39 -128
- package/src/admin/instance/index.ts +1 -2
- package/src/admin/instance/model.ts +12 -18
- package/src/commands/__tests__/admin-instance.test.ts +11 -8
- package/src/commands/__tests__/call-describe.test.ts +46 -33
- package/src/commands/__tests__/call.test.ts +34 -0
- package/src/commands/__tests__/domain-install-operation.test.ts +30 -22
- package/src/commands/__tests__/domain-install-owned.test.ts +1 -1
- package/src/commands/__tests__/domain-list.test.ts +5 -25
- package/src/commands/__tests__/install-direct.test.ts +115 -8
- package/src/commands/__tests__/install-identity-override.test.ts +6 -17
- package/src/commands/__tests__/instance-list-rows.test.ts +1 -1
- package/src/commands/__tests__/instance-status.test.ts +139 -0
- package/src/commands/__tests__/introspect-parse.test.ts +80 -1
- package/src/commands/__tests__/logs.test.ts +250 -2
- package/src/commands/__tests__/read-commands.test.ts +118 -10
- package/src/commands/__tests__/token-ttl.test.ts +49 -4
- package/src/commands/__tests__/update.test.ts +25 -3
- package/src/commands/__tests__/view.test.ts +50 -2
- package/src/commands/auth/logout.ts +2 -1
- package/src/commands/browser.ts +29 -0
- package/src/commands/call-describe.ts +60 -68
- package/src/commands/call.ts +71 -59
- package/src/commands/domain/install.ts +73 -46
- package/src/commands/domain/list.ts +1 -1
- package/src/commands/domain/publish.ts +14 -11
- package/src/commands/domain/uninstall.ts +2 -2
- package/src/commands/get.ts +15 -16
- package/src/commands/identity/__tests__/register.test.ts +3 -3
- package/src/commands/identity/register.ts +8 -8
- package/src/commands/instance/create.ts +8 -16
- package/src/commands/instance/delete.ts +12 -9
- package/src/commands/instance/list.ts +2 -2
- package/src/commands/instance/status.ts +66 -20
- package/src/commands/instance/use.ts +16 -12
- package/src/commands/introspect.ts +53 -41
- package/src/commands/logs.ts +123 -36
- package/src/commands/mutate.ts +6 -5
- package/src/commands/query.ts +35 -32
- package/src/commands/session/analyze.ts +26 -4
- package/src/commands/token.ts +42 -27
- package/src/commands/ui/__tests__/commands.test.ts +152 -0
- package/src/commands/ui/add.ts +51 -0
- package/src/commands/ui/doctor.ts +21 -0
- package/src/commands/ui/init.ts +38 -0
- package/src/commands/ui/list.ts +26 -0
- package/src/commands/ui/preset-apply.ts +19 -0
- package/src/commands/ui/preset-list.ts +12 -0
- package/src/commands/ui/shared.ts +25 -0
- package/src/commands/update.ts +89 -48
- package/src/commands/view.ts +82 -37
- package/src/connection/.spec/api.d.ts +7 -8
- package/src/connection/.spec/architecture.md +14 -5
- package/src/connection/.spec/flows/session.ts +2 -2
- package/src/connection/.spec/laws/connection.ts +6 -2
- package/src/connection/.spec/layout.ts +1 -0
- package/src/connection/__tests__/auth.test.ts +1 -0
- package/src/connection/__tests__/credential.test.ts +21 -1
- package/src/connection/__tests__/errors.test.ts +27 -20
- package/src/connection/__tests__/exchange.test.ts +64 -11
- package/src/connection/__tests__/failure-fixtures.ts +39 -0
- package/src/connection/__tests__/failure-safety.test.ts +75 -0
- package/src/connection/__tests__/self.test.ts +31 -11
- package/src/connection/__tests__/session.test.ts +8 -4
- package/src/connection/__tests__/target.test.ts +2 -0
- package/src/connection/auth.ts +13 -0
- package/src/connection/call.ts +1 -1
- package/src/connection/credential.ts +2 -2
- package/src/connection/errors.ts +1 -355
- package/src/connection/exchange.ts +110 -61
- package/src/connection/failure/classify.ts +110 -0
- package/src/connection/failure/index.ts +18 -0
- package/src/connection/failure/model.ts +28 -0
- package/src/connection/failure/render.ts +116 -0
- package/src/connection/reasons.ts +16 -0
- package/src/connection/self.ts +39 -21
- package/src/connection/session.ts +27 -9
- package/src/errors.ts +3 -2
- package/src/graph/.spec/api.d.ts +12 -5
- package/src/graph/.spec/layout.ts +9 -1
- package/src/graph/__tests__/mutation.test.ts +2 -2
- package/src/graph/__tests__/query.test.ts +25 -6
- package/src/graph/class.ts +30 -0
- package/src/graph/index.ts +1 -0
- package/src/graph/query.ts +21 -32
- package/src/identity/.spec/api.d.ts +2 -2
- package/src/identity/__tests__/fixtures/registry-journey.ts +13 -1
- package/src/identity/__tests__/registration.test.ts +1 -1
- package/src/identity/__tests__/registry.test.ts +4 -0
- package/src/identity/registration.ts +3 -3
- package/src/identity/registry.ts +2 -0
- package/src/keys/__tests__/keys.test.ts +4 -0
- package/src/keys/credential.ts +1 -0
- package/src/lib/__tests__/admin-target.test.ts +12 -0
- package/src/lib/__tests__/binary.test.ts +16 -1
- package/src/lib/__tests__/browser-retention.test.ts +212 -0
- package/src/lib/__tests__/command-dx.test.ts +1 -1
- package/src/lib/__tests__/config.test.ts +27 -0
- package/src/lib/__tests__/domain-publication.test.ts +10 -16
- package/src/lib/__tests__/idp.test.ts +34 -4
- package/src/lib/__tests__/instance-candidates.test.ts +1 -3
- package/src/lib/__tests__/instance-target.test.ts +7 -39
- package/src/lib/__tests__/log-errors.test.ts +64 -0
- package/src/lib/__tests__/skills.test.ts +809 -0
- package/src/lib/__tests__/studio-server-deps.test.ts +1 -1
- package/src/lib/__tests__/update.test.ts +264 -11
- package/src/lib/__tests__/view-assets.test.ts +25 -0
- package/src/lib/__tests__/view-external-open-intent.test.ts +150 -0
- package/src/lib/__tests__/view-external-open-origins.test.ts +27 -0
- package/src/lib/__tests__/view-open-intent.test.ts +0 -2
- package/src/lib/__tests__/view-server.test.ts +26 -3
- package/src/lib/__tests__/view-session.test.ts +2 -1
- package/src/lib/admin-instance.ts +14 -8
- package/src/lib/admin-target.ts +21 -2
- package/src/lib/binary.ts +22 -5
- package/src/lib/browser-retention.ts +210 -0
- package/src/lib/command-dx.ts +9 -9
- package/src/lib/config.ts +12 -1
- package/src/lib/domain-publication.ts +9 -7
- package/src/lib/failure-debug.ts +26 -0
- package/src/lib/idp.ts +34 -3
- package/src/lib/instance-candidates.ts +2 -2
- package/src/lib/instance-target.ts +3 -14
- package/src/lib/instance.ts +16 -11
- package/src/lib/log.ts +16 -9
- package/src/lib/output.ts +1 -1
- package/src/lib/proc.ts +7 -2
- package/src/lib/provision-instance.ts +34 -57
- package/src/lib/skills/lock.ts +117 -0
- package/src/lib/skills/sync.ts +814 -0
- package/src/lib/skills.ts +1 -52
- package/src/lib/update.ts +298 -45
- package/src/lib/validation.ts +2 -2
- package/src/lib/view/assets.ts +11 -2
- package/src/lib/view/external-open-intent.ts +41 -0
- package/src/lib/view/external-open-origins.ts +37 -0
- package/src/lib/view/host-capabilities.ts +17 -0
- package/src/lib/view/resolve.ts +1 -1
- package/src/lib/view/server.ts +18 -3
- package/src/lib/view/session.ts +2 -0
- package/src/program/.spec/api.d.ts +1 -0
- package/src/program/__tests__/program.test.ts +163 -6
- package/src/program/argv.ts +14 -0
- package/src/program/build.ts +26 -4
- package/src/program/command.ts +1 -0
- package/src/program/index.ts +1 -0
- package/src/program/registry.ts +2 -1
- package/src/setup/__tests__/instance-step.test.ts +27 -10
- package/src/setup/steps/instance.ts +22 -15
- package/src/setup/steps/skills.ts +40 -38
- package/src/state/.spec/api.d.ts +21 -2
- package/src/state/.spec/architecture.md +18 -4
- package/src/state/.spec/layout.ts +1 -0
- package/src/state/__tests__/exchange-credentials.test.ts +88 -42
- package/src/state/__tests__/files.test.ts +24 -1
- package/src/state/__tests__/fixtures/session-route-process.ts +93 -0
- package/src/state/__tests__/paths.test.ts +1 -0
- package/src/state/__tests__/session-routes.test.ts +138 -0
- package/src/state/exchange-credentials.ts +22 -9
- package/src/state/files.ts +41 -0
- package/src/state/index.ts +3 -1
- package/src/state/paths.ts +3 -0
- package/src/state/session-routes.ts +34 -0
- package/src/telemetry/__tests__/analyze-log.test.ts +38 -0
- package/src/telemetry/__tests__/recorder.test.ts +1 -0
- package/src/telemetry/__tests__/retention.test.ts +267 -0
- package/src/telemetry/__tests__/settings.test.ts +102 -0
- package/src/telemetry/__tests__/store-scan.test.ts +128 -0
- package/src/telemetry/__tests__/trigger.test.ts +33 -4
- package/src/telemetry/analyze.ts +24 -2
- package/src/telemetry/recorder.ts +15 -4
- package/src/telemetry/retention.ts +176 -0
- package/src/telemetry/session.ts +18 -12
- package/src/telemetry/settings.ts +64 -11
- package/src/telemetry/store.ts +92 -9
- package/src/telemetry/trigger.ts +16 -28
- package/src/ui/.spec/api.d.ts +14 -0
- package/src/ui/.spec/architecture.md +14 -0
- package/src/ui/.spec/laws.ts +50 -0
- package/src/ui/.spec/layout.ts +16 -0
- package/src/ui/__tests__/ui.test.ts +1742 -0
- package/src/ui/index.ts +13 -0
- package/src/ui/lock.ts +89 -0
- package/src/ui/model.ts +83 -0
- package/src/ui/operations.ts +1044 -0
- package/src/ui/project.ts +333 -0
- package/src/ui/release.ts +398 -0
- package/src/ui/runner.ts +18 -0
- package/studio/client/dist/assets/elk-api-DjmKsHXc.js +1 -0
- package/studio/client/dist/assets/index-BFVFs_8x.js +81 -0
- package/studio/client/dist/assets/index-DuB9iUdu.css +2 -0
- package/studio/client/dist/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/studio/client/dist/assets/schema-studio--a0kX3QU.css +1 -0
- package/studio/client/dist/assets/schema-studio-DH6oEWME.js +8 -0
- package/studio/client/dist/index.html +4 -3
- package/studio/package.json +8 -14
- package/studio/server/agent/ask.test.ts +1 -1
- package/studio/server/agent/bridge/grant.test.ts +1 -1
- package/studio/server/agent/bridge/routes.test.ts +1 -1
- package/studio/server/agent/harness/claude/adapter.test.ts +15 -5
- package/studio/server/agent/harness/gateway/token.test.ts +1 -1
- package/studio/server/agent/harness/gateway/token.ts +3 -3
- package/studio/server/agent/prompts/anchors.test.ts +41 -32
- package/studio/server/agent/prompts/anchors.ts +23 -51
- package/studio/server/agent/prompts/system.test.ts +4 -4
- package/studio/server/agent/prompts/system.ts +5 -5
- package/studio/server/agent/routes.test.ts +1 -1
- package/studio/server/agent/run/coordinator.test.ts +1 -1
- package/studio/server/agent/run/preparation.ts +1 -1
- package/studio/server/api/canvas.ts +0 -1
- package/studio/server/api/context.ts +1 -1
- package/studio/server/api/deployment.ts +1 -1
- package/studio/server/api/views.ts +2 -2
- package/studio/server/api/workspace.ts +1 -1
- package/studio/server/api-agent-loadout.test.ts +1 -1
- package/studio/server/api.test.ts +1 -1
- package/studio/server/cache.test.ts +24 -18
- package/studio/server/cache.ts +10 -54
- package/studio/server/cli-consumers.test.ts +31 -3
- package/studio/server/domain.test.ts +50 -68
- package/studio/server/domain.ts +82 -63
- package/studio/server/handoff/copy.ts +2 -2
- package/studio/server/index.ts +1 -1
- package/studio/server/instances/probe.test.ts +1 -1
- package/studio/server/introspect/anatomy/views/routes.ts +46 -37
- package/studio/server/introspect/anatomy/views.ts +10 -16
- package/studio/server/introspect/anatomy-extras.test.ts +29 -56
- package/studio/server/introspect/anatomy.test.ts +22 -14
- package/studio/server/introspect/anatomy.ts +6 -9
- package/studio/server/introspect/bundle.ts +0 -3
- package/studio/server/introspect/canonical-schema.test.ts +155 -424
- package/studio/server/introspect/canonical-schema.ts +248 -601
- package/studio/server/introspect/core.ts +14 -22
- package/studio/server/introspect/diff.test.ts +21 -9
- package/studio/server/introspect/diff.ts +19 -64
- package/studio/server/introspect/extractor.ts +23 -122
- package/studio/server/introspect/overlay-tsmorph.test.ts +116 -241
- package/studio/server/introspect/overlay-tsmorph.ts +0 -1
- package/studio/server/introspect/overlay.ts +3 -51
- package/studio/server/introspect/revision.test.ts +24 -28
- package/studio/server/introspect/revision.ts +11 -22
- package/studio/server/introspect/runtime.test.ts +77 -195
- package/studio/server/introspect/runtime.ts +5 -67
- package/studio/server/introspect/schema-ir-json.test.ts +81 -0
- package/studio/server/introspect/schema-ir-json.ts +39 -69
- package/studio/server/introspect/schema-refs.test.ts +43 -88
- package/studio/server/introspect/schema-refs.ts +14 -49
- package/studio/server/introspect/source-overlay/handlers.ts +116 -636
- package/studio/server/introspect/source-overlay/kernel-calls.ts +0 -3
- package/studio/server/introspect/source-overlay/spans.ts +15 -45
- package/studio/server/lifecycle.ts +4 -1
- package/studio/server/state/baseline.test.ts +14 -9
- package/studio/server/state/baseline.ts +3 -5
- package/studio/server/state/documents.test.ts +69 -0
- package/studio/server/state/documents.ts +57 -10
- package/studio/server/state/visibility.ts +1 -5
- package/studio/server/views/model.ts +3 -3
- package/studio/server/views/target.test.ts +18 -76
- package/studio/server/views/target.ts +24 -50
- package/studio/server/watch.test.ts +11 -11
- package/studio/server/watch.ts +8 -4
- package/studio/server/workspace/updates.ts +23 -1
- package/studio/server/workspace-watch.ts +2 -2
- package/studio/shared/contracts/runtime.ts +4 -0
- package/studio/shared/contracts/schema.ts +44 -131
- package/studio/shared/contracts/surface.test.ts +15 -17
- package/studio/shared/contracts/workspace.ts +5 -11
- package/studio/shared/schema/identity.test.ts +20 -44
- package/studio/shared/schema/identity.ts +9 -24
- package/studio/tsconfig.json +2 -1
- package/tsconfig.json +1 -1
- package/viewer/dist/index.html +21 -0
- package/viewer/dist/main.js +41 -62
- package/.check-workspace.cjs +0 -40
- package/src/admin/binding.ts +0 -168
- package/src/commands/__tests__/instance-create-hosts.test.ts +0 -29
- package/studio/client/dist/assets/elk-api-lwhFo7vB.js +0 -1
- package/studio/client/dist/assets/index-B-c-smo9.js +0 -8
- package/studio/client/dist/assets/index-BckHuAWk.js +0 -81
- package/studio/client/dist/assets/index-C4aNQ6dz.css +0 -1
- package/studio/client/dist/assets/index-ChOr3yP0.css +0 -1
- package/studio/server/introspect/anatomy/views/legacy.ts +0 -232
- package/studio/server/introspect/core-extractor.ts +0 -139
- package/studio/server/introspect/overlay.test.ts +0 -72
- package/studio/server/introspect/source-overlay/annotations.ts +0 -14
package/studio/server/cache.ts
CHANGED
|
@@ -16,17 +16,16 @@ import { buildAnatomy } from './introspect/anatomy'
|
|
|
16
16
|
import { buildBundle } from './introspect/bundle'
|
|
17
17
|
import { isCanonicalDomainSchemaV1 } from './introspect/canonical-schema'
|
|
18
18
|
import { buildCore } from './introspect/core'
|
|
19
|
-
import {
|
|
20
|
-
import { asBoolean, asFiniteNumber, asJsonRecord, asString
|
|
19
|
+
import { decodeSchemaIR } from './introspect/schema-ir-json'
|
|
20
|
+
import { asBoolean, asFiniteNumber, asJsonRecord, asString } from './json'
|
|
21
21
|
import { hashAnatomyFiles } from './state/baseline'
|
|
22
22
|
import { readJson, writeJson } from './state/store'
|
|
23
23
|
|
|
24
24
|
const bundles = new Map<string, StudioSchemaBundle>()
|
|
25
25
|
const anatomies = new Map<string, Promise<DomainAnatomy>>()
|
|
26
|
-
const cores = new Map<string, StudioCore>()
|
|
27
26
|
|
|
28
27
|
const BUNDLE_CACHE_FILE = '.cache/schema-bundle.json'
|
|
29
|
-
const BUNDLE_CACHE_VERSION =
|
|
28
|
+
const BUNDLE_CACHE_VERSION = 6
|
|
30
29
|
const LOCKFILES = ['bun.lock', 'pnpm-lock.yaml', 'package-lock.json', 'yarn.lock']
|
|
31
30
|
const TOOL_INPUTS = [
|
|
32
31
|
'cache.ts',
|
|
@@ -37,7 +36,6 @@ const TOOL_INPUTS = [
|
|
|
37
36
|
'introspect/canonical-schema.ts',
|
|
38
37
|
'introspect/overlay.ts',
|
|
39
38
|
'introspect/overlay-tsmorph.ts',
|
|
40
|
-
'introspect/source-overlay/annotations.ts',
|
|
41
39
|
'introspect/source-overlay/handlers.ts',
|
|
42
40
|
'introspect/source-overlay/kernel-calls.ts',
|
|
43
41
|
'introspect/source-overlay/project.ts',
|
|
@@ -53,20 +51,12 @@ interface BundleCacheEntry {
|
|
|
53
51
|
bundle: StudioSchemaBundle
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
function isCrossDomainImport(value: unknown): boolean {
|
|
57
|
-
const record = asJsonRecord(value)
|
|
58
|
-
return (
|
|
59
|
-
typeof record?.name === 'string' &&
|
|
60
|
-
typeof record.origin === 'string' &&
|
|
61
|
-
(record.definition === 'class' || record.definition === 'interface')
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
54
|
function isHandlerLink(value: unknown): boolean {
|
|
66
55
|
const record = asJsonRecord(value)
|
|
67
56
|
return (
|
|
68
57
|
typeof record?.owner === 'string' &&
|
|
69
|
-
['class', '
|
|
58
|
+
['class', 'function'].includes(String(record.ownerKind)) &&
|
|
59
|
+
['action', 'workflow'].includes(String(record.kind)) &&
|
|
70
60
|
typeof record.method === 'string' &&
|
|
71
61
|
typeof record.static === 'boolean' &&
|
|
72
62
|
typeof record.implemented === 'boolean'
|
|
@@ -83,37 +73,15 @@ function isSourceSpan(value: unknown): boolean {
|
|
|
83
73
|
)
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
function isAnnotation(value: unknown): boolean {
|
|
87
|
-
const record = asJsonRecord(value)
|
|
88
|
-
return (
|
|
89
|
-
typeof record?.target === 'string' &&
|
|
90
|
-
(record.severity === 'warn' || record.severity === 'info') &&
|
|
91
|
-
(record.code === 'COMPILE_ERROR' || record.code === 'EDGE_PROP_TYPE_MISSING') &&
|
|
92
|
-
typeof record.message === 'string'
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
76
|
function decodeOverlay(value: unknown): SchemaOverlay | undefined {
|
|
97
77
|
const record = asJsonRecord(value)
|
|
98
|
-
const requires = asStringArray(record?.requires)
|
|
99
|
-
const crossDomainImports = record?.crossDomainImports
|
|
100
|
-
const mixins = record?.mixins
|
|
101
78
|
const handlerLinks = record?.handlerLinks
|
|
102
79
|
const sourceSpans = asJsonRecord(record?.sourceSpans)
|
|
103
|
-
const annotations = record?.annotations
|
|
104
80
|
if (
|
|
105
|
-
typeof record?.origin !== 'string' ||
|
|
106
|
-
!requires ||
|
|
107
|
-
!Array.isArray(crossDomainImports) ||
|
|
108
|
-
!crossDomainImports.every(isCrossDomainImport) ||
|
|
109
|
-
!Array.isArray(mixins) ||
|
|
110
|
-
!mixins.every(isCrossDomainImport) ||
|
|
111
81
|
!Array.isArray(handlerLinks) ||
|
|
112
82
|
!handlerLinks.every(isHandlerLink) ||
|
|
113
83
|
!sourceSpans ||
|
|
114
|
-
!Object.values(sourceSpans).every(isSourceSpan)
|
|
115
|
-
!Array.isArray(annotations) ||
|
|
116
|
-
!annotations.every(isAnnotation)
|
|
84
|
+
!Object.values(sourceSpans).every(isSourceSpan)
|
|
117
85
|
) {
|
|
118
86
|
return undefined
|
|
119
87
|
}
|
|
@@ -125,9 +93,9 @@ function decodeBundle(value: unknown): StudioSchemaBundle | undefined {
|
|
|
125
93
|
if (!record) return undefined
|
|
126
94
|
const domainId = asString(record.domainId)
|
|
127
95
|
const renderFingerprint = asString(record.renderFingerprint)
|
|
128
|
-
const schemaMode = (
|
|
129
|
-
|
|
130
|
-
)
|
|
96
|
+
const schemaMode = (['canonical-admitted', 'canonical-preview', 'unavailable'] as const).find(
|
|
97
|
+
(candidate) => candidate === record.schemaMode,
|
|
98
|
+
)
|
|
131
99
|
const extractedBy = record.extractedBy
|
|
132
100
|
const depsInstalled = asBoolean(record.depsInstalled)
|
|
133
101
|
const ir = record.ir === null ? null : decodeSchemaIR(record.ir)
|
|
@@ -153,11 +121,6 @@ function decodeBundle(value: unknown): StudioSchemaBundle | undefined {
|
|
|
153
121
|
) {
|
|
154
122
|
return undefined
|
|
155
123
|
}
|
|
156
|
-
const importedInterfaces =
|
|
157
|
-
record.importedInterfaces === undefined
|
|
158
|
-
? undefined
|
|
159
|
-
: decodeIrInterfaceRecord(record.importedInterfaces)
|
|
160
|
-
if (record.importedInterfaces !== undefined && importedInterfaces === undefined) return undefined
|
|
161
124
|
const errorRecord = record.error === null ? null : asJsonRecord(record.error)
|
|
162
125
|
const errorMessage = asString(errorRecord?.message)
|
|
163
126
|
if (record.error !== undefined && record.error !== null && errorMessage === undefined) {
|
|
@@ -173,7 +136,6 @@ function decodeBundle(value: unknown): StudioSchemaBundle | undefined {
|
|
|
173
136
|
ir,
|
|
174
137
|
...(record.schemaRoot === undefined ? {} : { schemaRoot: record.schemaRoot }),
|
|
175
138
|
overlay,
|
|
176
|
-
...(importedInterfaces === undefined ? {} : { importedInterfaces }),
|
|
177
139
|
...(record.error === undefined
|
|
178
140
|
? {}
|
|
179
141
|
: record.error === null
|
|
@@ -287,10 +249,7 @@ export async function getAnatomy(id: string, rebuild = false): Promise<DomainAna
|
|
|
287
249
|
export async function getCore(id: string, rebuild = false): Promise<StudioCore | null> {
|
|
288
250
|
const h = getDomain(id)
|
|
289
251
|
if (!h) return null
|
|
290
|
-
|
|
291
|
-
const c = await buildCore(h)
|
|
292
|
-
cores.set(id, c)
|
|
293
|
-
return c
|
|
252
|
+
return buildCore(h, await getBundle(id, rebuild))
|
|
294
253
|
}
|
|
295
254
|
|
|
296
255
|
export function invalidate(id: string, what: 'schema' | 'anatomy' | 'all'): void {
|
|
@@ -300,7 +259,4 @@ export function invalidate(id: string, what: 'schema' | 'anatomy' | 'all'): void
|
|
|
300
259
|
const domain = getDomain(id)
|
|
301
260
|
if (domain) invalidateClientPackage(domain.root)
|
|
302
261
|
}
|
|
303
|
-
// Core is derived from the canonical schema (or the legacy composition entry),
|
|
304
|
-
// both of which belong to the anatomy invalidation set.
|
|
305
|
-
if (what !== 'schema') cores.delete(id)
|
|
306
262
|
}
|
|
@@ -3,7 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileS
|
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
|
|
6
|
-
import type { StudioSchemaBundle, ViewInfo } from '../shared/types'
|
|
6
|
+
import type { StaleReport, StudioSchemaBundle, ViewInfo } from '../shared/types'
|
|
7
7
|
|
|
8
8
|
import { STUDIO_CLI_DESCRIPTOR_ENV } from './cli'
|
|
9
9
|
import { activeInstanceName, listInstances, setActiveInstance } from './instances/active'
|
|
@@ -209,6 +209,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
209
209
|
latest: '0.8.0',
|
|
210
210
|
channel: 'latest',
|
|
211
211
|
},
|
|
212
|
+
skills: { status: 'update-available' },
|
|
212
213
|
sdk: {
|
|
213
214
|
stale: true,
|
|
214
215
|
inProject: true,
|
|
@@ -235,6 +236,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
235
236
|
latest: '0.8.0',
|
|
236
237
|
channel: 'latest',
|
|
237
238
|
},
|
|
239
|
+
skills: { status: 'update-available' },
|
|
238
240
|
sdk: {
|
|
239
241
|
stale: true,
|
|
240
242
|
inProject: true,
|
|
@@ -251,6 +253,31 @@ describe('workspace update CLI orchestration', () => {
|
|
|
251
253
|
])
|
|
252
254
|
})
|
|
253
255
|
|
|
256
|
+
test('accepts an older CLI report without a skills axis during binary replacement', async () => {
|
|
257
|
+
const checkArgs = ['update', '--check', '--json']
|
|
258
|
+
const fake = installFakeCli([
|
|
259
|
+
{
|
|
260
|
+
args: checkArgs,
|
|
261
|
+
responses: [
|
|
262
|
+
{
|
|
263
|
+
stdout: {
|
|
264
|
+
stale: false,
|
|
265
|
+
cli: { stale: false, managed: true },
|
|
266
|
+
sdk: { stale: false, inProject: false, outdated: [] },
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
])
|
|
272
|
+
|
|
273
|
+
expect(await getUpdates(fake.root)).toEqual({
|
|
274
|
+
stale: false,
|
|
275
|
+
cli: { stale: false, managed: true },
|
|
276
|
+
skills: { status: 'current' },
|
|
277
|
+
sdk: { stale: false, inProject: false, outdated: [] },
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
|
|
254
281
|
test('hides the badge when check output is malformed or fails', async () => {
|
|
255
282
|
const checkArgs = ['update', '--check', '--json']
|
|
256
283
|
const fake = installFakeCli([
|
|
@@ -262,6 +289,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
262
289
|
stdout: {
|
|
263
290
|
stale: true,
|
|
264
291
|
cli: { stale: true, managed: true },
|
|
292
|
+
skills: { status: 'current' },
|
|
265
293
|
sdk: {
|
|
266
294
|
stale: true,
|
|
267
295
|
inProject: true,
|
|
@@ -274,9 +302,10 @@ describe('workspace update CLI orchestration', () => {
|
|
|
274
302
|
],
|
|
275
303
|
},
|
|
276
304
|
])
|
|
277
|
-
const expected = {
|
|
305
|
+
const expected: StaleReport = {
|
|
278
306
|
stale: false,
|
|
279
307
|
cli: { stale: false, managed: true },
|
|
308
|
+
skills: { status: 'current' },
|
|
280
309
|
sdk: { stale: false, inProject: false, outdated: [] },
|
|
281
310
|
}
|
|
282
311
|
|
|
@@ -301,7 +330,6 @@ const bundle = {
|
|
|
301
330
|
views: {
|
|
302
331
|
'issue-detail': {
|
|
303
332
|
name: 'issue-detail',
|
|
304
|
-
auth: 'required',
|
|
305
333
|
target: {
|
|
306
334
|
kind: 'definition',
|
|
307
335
|
definitions: [{ origin: 'issues.example.dev', kind: 'class', name: 'Issue' }],
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { afterEach, expect, test } from 'bun:test'
|
|
1
|
+
import { afterEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { basename, join } from 'node:path'
|
|
5
5
|
|
|
6
|
-
import { resolveTarget } from './detect'
|
|
7
6
|
import {
|
|
8
7
|
depsInstalled,
|
|
9
8
|
isDomainDir,
|
|
10
9
|
registerDomain,
|
|
11
|
-
|
|
10
|
+
resolveApplicationEntry,
|
|
11
|
+
resolveSchemaEntry,
|
|
12
12
|
unregisterDomain,
|
|
13
13
|
} from './domain'
|
|
14
14
|
|
|
@@ -20,76 +20,58 @@ afterEach(() => {
|
|
|
20
20
|
while (roots.length) rmSync(roots.pop()!, { recursive: true, force: true })
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
-
function fixture(
|
|
24
|
-
const root = mkdtempSync(join(
|
|
23
|
+
function fixture(nested = false): string {
|
|
24
|
+
const root = mkdtempSync(join(tmpdir(), 'studio-application-layout-'))
|
|
25
25
|
roots.push(root)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
writeFileSync(
|
|
29
|
-
|
|
26
|
+
const owner = nested ? join(root, 'domain') : root
|
|
27
|
+
mkdirSync(join(owner, 'schema'), { recursive: true })
|
|
28
|
+
writeFileSync(
|
|
29
|
+
join(root, 'astrale.config.ts'),
|
|
30
|
+
nested
|
|
31
|
+
? "import application from './domain/application.js'\nexport default { application }\n"
|
|
32
|
+
: 'export default {}\n',
|
|
33
|
+
)
|
|
34
|
+
writeFileSync(join(owner, 'application.ts'), 'export default {}\n')
|
|
35
|
+
writeFileSync(join(owner, 'schema/index.ts'), 'export const schema = {}\n')
|
|
30
36
|
return root
|
|
31
37
|
}
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const handle = registerDomain(root)!
|
|
46
|
-
domainIds.push(handle.id)
|
|
47
|
-
expect(basename(handle.domainFile)).toBe('implementation.ts')
|
|
48
|
-
expect(resolveTarget(root).map((domain) => domain.root)).toEqual([root])
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('preserves domain.ts and kernel-core as the legacy fallback', () => {
|
|
52
|
-
const root = fixture('domain.ts')
|
|
53
|
-
mkdirSync(join(root, 'node_modules', '@astrale-os', 'kernel-core'), { recursive: true })
|
|
54
|
-
|
|
55
|
-
expect(isDomainDir(root)).toBe(true)
|
|
56
|
-
expect(depsInstalled(root)).toBe(true)
|
|
57
|
-
const handle = registerDomain(root)!
|
|
58
|
-
domainIds.push(handle.id)
|
|
59
|
-
expect(basename(handle.domainFile)).toBe('domain.ts')
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('prefers implementation.ts when both composition entries exist', () => {
|
|
63
|
-
const root = fixture('domain.ts')
|
|
64
|
-
writeFileSync(join(root, 'implementation.ts'), 'export const domain = {}\n')
|
|
65
|
-
|
|
66
|
-
expect(basename(resolveDomainEntry(root)!)).toBe('implementation.ts')
|
|
67
|
-
})
|
|
39
|
+
describe('SDK V1 project discovery', () => {
|
|
40
|
+
test('discovers conventional root Application and Schema entries', () => {
|
|
41
|
+
const root = fixture()
|
|
42
|
+
expect(isDomainDir(root)).toBe(true)
|
|
43
|
+
expect(basename(resolveApplicationEntry(root)!)).toBe('application.ts')
|
|
44
|
+
expect(basename(resolveSchemaEntry(root, resolveApplicationEntry(root)!)!)).toBe('index.ts')
|
|
45
|
+
const handle = registerDomain(root)!
|
|
46
|
+
domainIds.push(handle.id)
|
|
47
|
+
expect(basename(handle.applicationFile)).toBe('application.ts')
|
|
48
|
+
expect(handle.schemaDirName).toBe('schema')
|
|
49
|
+
})
|
|
68
50
|
|
|
69
|
-
test('
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
test('follows a config-imported nested Application and adjacent Schema', () => {
|
|
52
|
+
const root = fixture(true)
|
|
53
|
+
const application = resolveApplicationEntry(root)!
|
|
54
|
+
expect(application).toBe(join(root, 'domain/application.ts'))
|
|
55
|
+
expect(resolveSchemaEntry(root, application)).toBe(join(root, 'domain/schema/index.ts'))
|
|
56
|
+
})
|
|
75
57
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
join(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
type: 'module',
|
|
85
|
-
exports: { './schema': './schema.js' },
|
|
86
|
-
}),
|
|
87
|
-
)
|
|
88
|
-
writeFileSync(
|
|
89
|
-
join(hoistedWorkspace, 'node_modules', '@astrale-os', 'sdk', 'schema.js'),
|
|
90
|
-
'export const schema = {}\n',
|
|
91
|
-
)
|
|
92
|
-
const hoistedRoot = fixture('implementation.ts', join(hoistedWorkspace, 'packages'))
|
|
58
|
+
test('requires the semantic SDK dependency, not Kernel implementation packages', () => {
|
|
59
|
+
const root = fixture()
|
|
60
|
+
expect(depsInstalled(root)).toBe(false)
|
|
61
|
+
mkdirSync(join(root, 'node_modules', '@astrale-os', 'kernel-core'), { recursive: true })
|
|
62
|
+
expect(depsInstalled(root)).toBe(false)
|
|
63
|
+
mkdirSync(join(root, 'node_modules', '@astrale-os', 'sdk'), { recursive: true })
|
|
64
|
+
expect(depsInstalled(root)).toBe(true)
|
|
65
|
+
})
|
|
93
66
|
|
|
94
|
-
|
|
67
|
+
test('rejects implementation.ts and domain.ts compatibility layouts', () => {
|
|
68
|
+
const root = mkdtempSync(join(tmpdir(), 'studio-legacy-layout-'))
|
|
69
|
+
roots.push(root)
|
|
70
|
+
mkdirSync(join(root, 'schema'))
|
|
71
|
+
writeFileSync(join(root, 'astrale.config.ts'), 'export default {}\n')
|
|
72
|
+
writeFileSync(join(root, 'implementation.ts'), 'export default {}\n')
|
|
73
|
+
writeFileSync(join(root, 'domain.ts'), 'export default {}\n')
|
|
74
|
+
writeFileSync(join(root, 'schema/index.ts'), 'export const schema = {}\n')
|
|
75
|
+
expect(isDomainDir(root)).toBe(false)
|
|
76
|
+
})
|
|
95
77
|
})
|
package/studio/server/domain.ts
CHANGED
|
@@ -1,74 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Current SDK projects use implementation.ts; domain.ts remains the legacy
|
|
5
|
-
* fallback. The schema dir is configurable (default 'schema') and threaded
|
|
6
|
-
* everywhere.
|
|
7
|
-
*/
|
|
8
|
-
import { existsSync } from 'node:fs'
|
|
9
|
-
import { basename, join, resolve } from 'node:path'
|
|
1
|
+
/** SDK V1 project discovery and the in-process Studio registry. */
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
3
|
+
import { basename, dirname, extname, join, relative, resolve } from 'node:path'
|
|
10
4
|
|
|
11
5
|
export interface DomainHandle {
|
|
12
|
-
id: string
|
|
13
|
-
root: string
|
|
14
|
-
configFile: string
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
schemaIndex: string
|
|
6
|
+
readonly id: string
|
|
7
|
+
readonly root: string
|
|
8
|
+
readonly configFile: string
|
|
9
|
+
readonly applicationFile: string
|
|
10
|
+
readonly schemaDirName: string
|
|
11
|
+
readonly schemaDir: string
|
|
12
|
+
readonly schemaIndex: string
|
|
20
13
|
origin?: string
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
const registry = new Map<string, DomainHandle>()
|
|
24
17
|
|
|
25
|
-
export const DOMAIN_ENTRY_FILES = ['implementation.ts', 'domain.ts'] as const
|
|
26
|
-
|
|
27
18
|
export function makeId(root: string): string {
|
|
28
19
|
return basename(resolve(root)).replace(/[^a-zA-Z0-9_-]/g, '-') || 'domain'
|
|
29
20
|
}
|
|
30
21
|
|
|
31
|
-
/** Resolve the
|
|
32
|
-
export function
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
/** Resolve the Application imported by config, with root application.ts as convention. */
|
|
23
|
+
export function resolveApplicationEntry(root: string): string | null {
|
|
24
|
+
const project = resolve(root)
|
|
25
|
+
const conventional = join(project, 'application.ts')
|
|
26
|
+
if (existsSync(conventional)) return conventional
|
|
27
|
+
const config = join(project, 'astrale.config.ts')
|
|
28
|
+
if (!existsSync(config)) return null
|
|
29
|
+
let source: string
|
|
30
|
+
try {
|
|
31
|
+
source = readFileSync(config, 'utf8')
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
for (const match of source.matchAll(/\bfrom\s+['"]([^'"]+)['"]/gu)) {
|
|
36
|
+
const specifier = match[1]
|
|
37
|
+
if (
|
|
38
|
+
!specifier?.startsWith('.') ||
|
|
39
|
+
basename(specifier).replace(/\.[^.]+$/u, '') !== 'application'
|
|
40
|
+
) {
|
|
41
|
+
continue
|
|
42
|
+
}
|
|
43
|
+
const selected = resolveSourceFile(project, specifier)
|
|
44
|
+
if (selected !== null) return selected
|
|
37
45
|
}
|
|
38
46
|
return null
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
/**
|
|
49
|
+
/** Resolve schema.ts or schema/index.ts beside the Application, then at project root. */
|
|
50
|
+
export function resolveSchemaEntry(
|
|
51
|
+
root: string,
|
|
52
|
+
applicationFile: string,
|
|
53
|
+
schemaDirName = 'schema',
|
|
54
|
+
): string | null {
|
|
55
|
+
const project = resolve(root)
|
|
56
|
+
const applicationDir = dirname(applicationFile)
|
|
57
|
+
const candidates = [
|
|
58
|
+
join(applicationDir, 'schema.ts'),
|
|
59
|
+
join(applicationDir, schemaDirName, 'index.ts'),
|
|
60
|
+
join(project, 'schema.ts'),
|
|
61
|
+
join(project, schemaDirName, 'index.ts'),
|
|
62
|
+
]
|
|
63
|
+
return [...new Set(candidates)].find(existsSync) ?? null
|
|
64
|
+
}
|
|
65
|
+
|
|
42
66
|
export function isDomainDir(root: string, schemaDirName = 'schema'): boolean {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
existsSync(join(r, schemaDirName, 'index.ts'))
|
|
48
|
-
)
|
|
67
|
+
const project = resolve(root)
|
|
68
|
+
if (!existsSync(join(project, 'astrale.config.ts'))) return false
|
|
69
|
+
const application = resolveApplicationEntry(project)
|
|
70
|
+
return application !== null && resolveSchemaEntry(project, application, schemaDirName) !== null
|
|
49
71
|
}
|
|
50
72
|
|
|
51
|
-
/** Confirm + register a domain rooted at `root`. Returns null if the triple is incomplete. */
|
|
52
73
|
export function registerDomain(root: string, schemaDirName = 'schema'): DomainHandle | null {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
const project = resolve(root)
|
|
75
|
+
const applicationFile = resolveApplicationEntry(project)
|
|
76
|
+
if (applicationFile === null || !existsSync(join(project, 'astrale.config.ts'))) return null
|
|
77
|
+
const schemaIndex = resolveSchemaEntry(project, applicationFile, schemaDirName)
|
|
78
|
+
if (schemaIndex === null) return null
|
|
79
|
+
const schemaDir = dirname(schemaIndex)
|
|
58
80
|
const handle: DomainHandle = {
|
|
59
|
-
id: makeId(
|
|
60
|
-
root:
|
|
61
|
-
configFile: join(
|
|
62
|
-
|
|
63
|
-
schemaDirName,
|
|
81
|
+
id: makeId(project),
|
|
82
|
+
root: project,
|
|
83
|
+
configFile: join(project, 'astrale.config.ts'),
|
|
84
|
+
applicationFile,
|
|
85
|
+
schemaDirName: relative(project, schemaDir).replaceAll('\\', '/') || '.',
|
|
64
86
|
schemaDir,
|
|
65
|
-
schemaIndex
|
|
87
|
+
schemaIndex,
|
|
66
88
|
}
|
|
67
89
|
registry.set(handle.id, handle)
|
|
68
90
|
return handle
|
|
69
91
|
}
|
|
70
92
|
|
|
71
|
-
/** Drop a domain from the registry (its dir/triple is gone). */
|
|
72
93
|
export function unregisterDomain(id: string): void {
|
|
73
94
|
registry.delete(id)
|
|
74
95
|
}
|
|
@@ -81,25 +102,23 @@ export function allDomains(): DomainHandle[] {
|
|
|
81
102
|
return [...registry.values()]
|
|
82
103
|
}
|
|
83
104
|
|
|
84
|
-
/**
|
|
105
|
+
/** Studio's current project model always requires the semantic SDK Schema facade. */
|
|
85
106
|
export function depsInstalled(root: string): boolean {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return false
|
|
93
|
-
}
|
|
107
|
+
if (existsSync(join(root, 'node_modules', '@astrale-os', 'sdk'))) return true
|
|
108
|
+
try {
|
|
109
|
+
Bun.resolveSync('@astrale-os/sdk/schema', root)
|
|
110
|
+
return true
|
|
111
|
+
} catch {
|
|
112
|
+
return false
|
|
94
113
|
}
|
|
114
|
+
}
|
|
95
115
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return sdk || installed('kernel-core', '@astrale-os/kernel-core')
|
|
116
|
+
function resolveSourceFile(root: string, specifier: string): string | null {
|
|
117
|
+
const absolute = resolve(root, specifier)
|
|
118
|
+
const extension = extname(absolute)
|
|
119
|
+
const candidates =
|
|
120
|
+
extension === ''
|
|
121
|
+
? [`${absolute}.ts`, join(absolute, 'index.ts')]
|
|
122
|
+
: [absolute, `${absolute.slice(0, -extension.length)}.ts`]
|
|
123
|
+
return candidates.find(existsSync) ?? null
|
|
105
124
|
}
|
|
@@ -10,7 +10,7 @@ import type { Comment, ContextItem, DocMeta, SchemaRevision, ThreadEntry } from
|
|
|
10
10
|
interface CopyParts {
|
|
11
11
|
origin: string
|
|
12
12
|
root: string
|
|
13
|
-
/** Studio render fingerprint retained by the
|
|
13
|
+
/** Studio render fingerprint retained by the handoff machine-state. */
|
|
14
14
|
renderFingerprint: string
|
|
15
15
|
schemaRevision?: SchemaRevision
|
|
16
16
|
openComments: Comment[]
|
|
@@ -84,7 +84,7 @@ export function buildCopyMarkdown(parts: CopyParts): string {
|
|
|
84
84
|
lines.push(`- **Render fingerprint:** \`${renderFingerprint}\``)
|
|
85
85
|
lines.push('')
|
|
86
86
|
lines.push(
|
|
87
|
-
'Load the **astrale-domain** skill,
|
|
87
|
+
'Load the **astrale-domain** skill and, for UI work, **astrale-frontend-design**. Use the context/threads below, ' +
|
|
88
88
|
'read any listed context documents if relevant, edit code on disk, and reply by appending one `{role:"author"}` entry per open thread ' +
|
|
89
89
|
'(merge by `id`). Resolve a thread by adding a closing note plus `"status":"closed"`; ' +
|
|
90
90
|
'a thread whose last entry is not yours will be resent.',
|
package/studio/server/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ const domains = resolveTarget(target, schemaDir)
|
|
|
42
42
|
if (!domains.length) {
|
|
43
43
|
console.error(`\n ✗ No Astrale domains found at ${target}`)
|
|
44
44
|
console.error(
|
|
45
|
-
` (looking for: astrale.config.ts +
|
|
45
|
+
` (looking for: astrale.config.ts + application.ts + schema.ts or ${schemaDir}/index.ts)\n`,
|
|
46
46
|
)
|
|
47
47
|
process.exit(1)
|
|
48
48
|
}
|
|
@@ -21,7 +21,7 @@ describe('installed Domain introspection', () => {
|
|
|
21
21
|
])
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
test('retains the complete installed Bundle for
|
|
24
|
+
test('retains the complete installed Bundle for installed SDK admission', () => {
|
|
25
25
|
const root = {
|
|
26
26
|
version: 'v1',
|
|
27
27
|
domain: 'issues.astrale.ai',
|