@astrale-os/sdk 0.5.0-beta.124 → 0.5.0-beta.126
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/CHANGELOG.md +17 -0
- package/README.md +3 -1
- package/dist/application/runtime/authoring.d.ts +1 -0
- package/dist/application/runtime/declarations.d.ts +43 -0
- package/dist/application/runtime/declarations.js +1 -0
- package/dist/application/runtime/define.d.ts +2 -1
- package/dist/platform/schema/errors/index.d.ts +3 -0
- package/dist/platform/schema/errors/index.js +2 -0
- package/dist/platform/schema/index.d.ts +2 -0
- package/dist/platform/schema/index.js +1 -0
- package/dist/platform/schema/schema-authoring.d.ts +48 -0
- package/dist/platform/schema/schema-authoring.js +3 -0
- package/dist/tooling/cli/astrale/failure.d.ts +3 -0
- package/dist/tooling/cli/astrale/failure.js +4 -1
- package/dist/tooling/cli/installation/reconcile.js +10 -4
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.0-beta.126](https://github.com/astrale-os/sdk/compare/sdk-v0.5.0-beta.125...sdk-v0.5.0-beta.126) (2026-09-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* expose runtime-safe schema error declarations ([#457](https://github.com/astrale-os/sdk/issues/457)) ([67e2fd1](https://github.com/astrale-os/sdk/commit/67e2fd1a92fca1096a928510405d8a6c6f0fd7ef))
|
|
9
|
+
* preserve safe installation failure diagnostics ([#456](https://github.com/astrale-os/sdk/issues/456)) ([5466a9e](https://github.com/astrale-os/sdk/commit/5466a9e7aa597d114fcd947be26df5ce823d6277))
|
|
10
|
+
|
|
11
|
+
## [0.5.0-beta.125](https://github.com/astrale-os/sdk/compare/sdk-v0.5.0-beta.124...sdk-v0.5.0-beta.125) (2026-09-07)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **runtime:** emit inferred recipe tuples without repeating schemas ([#451](https://github.com/astrale-os/sdk/issues/451)) ([e4e6fbc](https://github.com/astrale-os/sdk/commit/e4e6fbc72a9b5a80a876be9c9a9ba89a1f4d3ffd))
|
|
17
|
+
* **runtime:** retain mixed recipe collection contracts ([#453](https://github.com/astrale-os/sdk/issues/453)) ([e7d18d0](https://github.com/astrale-os/sdk/commit/e7d18d0b669df90001d417c76c33f578b92b5039))
|
|
18
|
+
* **schema:** retain inferred dependency graphs without repeated expansion ([#455](https://github.com/astrale-os/sdk/issues/455)) ([5c02a00](https://github.com/astrale-os/sdk/commit/5c02a00ffca51f9d5c3bfa6301fabd657c0cd65c))
|
|
19
|
+
|
|
3
20
|
## [0.5.0-beta.124](https://github.com/astrale-os/sdk/compare/sdk-v0.5.0-beta.123...sdk-v0.5.0-beta.124) (2026-09-07)
|
|
4
21
|
|
|
5
22
|
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Schema authoring.
|
|
|
65
65
|
Declare reusable business errors in `schema/modules/<module>/errors/` through the Schema facade:
|
|
66
66
|
|
|
67
67
|
```typescript
|
|
68
|
-
import { error } from '@astrale-os/sdk/schema'
|
|
68
|
+
import { error } from '@astrale-os/sdk/schema/errors'
|
|
69
69
|
import { z } from 'zod'
|
|
70
70
|
|
|
71
71
|
export const resourceUnavailable = error({
|
|
@@ -79,6 +79,8 @@ Register the declaration under a code in an Action or Workflow's options:
|
|
|
79
79
|
`{ errors: { RESOURCE_UNAVAILABLE: resourceUnavailable } }`. Its handler can then
|
|
80
80
|
`throw error('RESOURCE_UNAVAILABLE', { resource: id })` using the context factory.
|
|
81
81
|
The builder validates and freezes declaration metadata while preserving exact details inference.
|
|
82
|
+
Use `sdk/schema/errors` for declarations shared with handlers: this narrow entrypoint keeps the
|
|
83
|
+
Schema compiler and Kernel Schema initialization out of the deployed Runtime.
|
|
82
84
|
Error declarations are not yet published in the installed Kernel Schema.
|
|
83
85
|
|
|
84
86
|
## Development
|
|
@@ -3,3 +3,4 @@ export type { RuntimeInput } from './define.js';
|
|
|
3
3
|
export type { RuntimeInitialization, RuntimeInitializationContext, RuntimeInitializer, } from './initialize.js';
|
|
4
4
|
export type { RuntimeIntegrations } from './integrations.js';
|
|
5
5
|
export type { Runtime } from './runtime.js';
|
|
6
|
+
export type { AuthoredRuntime } from './declarations.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { schema } from '../../platform/schema/index.js';
|
|
2
|
+
import type { ActionAddress, ActionDefinition } from '../action/index.js';
|
|
3
|
+
import type { DeclaredErrors } from '../error/index.js';
|
|
4
|
+
import type { Integrations } from '../integration/index.js';
|
|
5
|
+
import type { WorkflowAddress, WorkflowDefinition } from '../workflow/index.js';
|
|
6
|
+
import type { RuntimeInitialization, RuntimeInitializer } from './initialize.js';
|
|
7
|
+
import type { RuntimeIntegrations } from './integrations.js';
|
|
8
|
+
import type { Runtime } from './runtime.js';
|
|
9
|
+
/** Retain each recipe's exact contract without repeating the owning Schema in every tuple slot. */
|
|
10
|
+
type RuntimeFunctionSignature<Recipe> = Recipe extends ActionDefinition<infer Schema, infer Address, infer Definitions, infer Errors> ? readonly [
|
|
11
|
+
'action',
|
|
12
|
+
Address,
|
|
13
|
+
Definitions,
|
|
14
|
+
Errors,
|
|
15
|
+
{
|
|
16
|
+
[Key in keyof Recipe as Exclude<Key, keyof ActionDefinition<Schema, Address, Definitions, Errors>>]: Recipe[Key];
|
|
17
|
+
}
|
|
18
|
+
] : Recipe extends WorkflowDefinition<infer Schema, infer Address, infer Definitions, infer Errors> ? readonly [
|
|
19
|
+
'workflow',
|
|
20
|
+
Address,
|
|
21
|
+
Definitions,
|
|
22
|
+
Errors,
|
|
23
|
+
{
|
|
24
|
+
[Key in keyof Recipe as Exclude<Key, keyof WorkflowDefinition<Schema, Address, Definitions, Errors>>]: Recipe[Key];
|
|
25
|
+
}
|
|
26
|
+
] : never;
|
|
27
|
+
export type RuntimeFunctionSignatures<Functions extends readonly unknown[]> = {
|
|
28
|
+
[Index in keyof Functions]: RuntimeFunctionSignature<Functions[Index]>;
|
|
29
|
+
};
|
|
30
|
+
type RuntimeFunction<Schema extends schema.DomainSchema, Signature> = Signature extends readonly [
|
|
31
|
+
infer Kind,
|
|
32
|
+
infer Address,
|
|
33
|
+
infer Definitions extends Integrations,
|
|
34
|
+
infer Errors extends DeclaredErrors,
|
|
35
|
+
infer Extra
|
|
36
|
+
] ? Kind extends 'action' ? ActionDefinition<Schema, Extract<Address, ActionAddress<Schema>>, Definitions, Errors> & Extra : WorkflowDefinition<Schema, Extract<Address, WorkflowAddress<Schema>>, Definitions, Errors> & Extra : never;
|
|
37
|
+
type RuntimeFunctions<Schema extends schema.DomainSchema, Signatures extends readonly unknown[]> = {
|
|
38
|
+
[Index in keyof Signatures]: RuntimeFunction<Schema, Signatures[Index]>;
|
|
39
|
+
};
|
|
40
|
+
/** A portable inferred Runtime keeps its Schema once while retaining the exact recipe tuple. */
|
|
41
|
+
export interface AuthoredRuntime<Schema extends schema.DomainSchema, Integrations extends RuntimeIntegrations, Initialize extends RuntimeInitializer<never, RuntimeInitialization, Schema>, Signatures extends readonly unknown[]> extends Runtime<Schema, Integrations, Initialize, RuntimeFunctions<Schema, Signatures>> {
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { schema } from '../../platform/schema/index.js';
|
|
|
2
2
|
import type { ActionDefinition } from '../action/index.js';
|
|
3
3
|
import type { Providers } from '../integration/index.js';
|
|
4
4
|
import type { WorkflowDefinition } from '../workflow/index.js';
|
|
5
|
+
import type { AuthoredRuntime, RuntimeFunctionSignatures } from './declarations.js';
|
|
5
6
|
import type { RuntimeInitialization, RuntimeInitializer } from './initialize.js';
|
|
6
7
|
import type { RuntimeIntegrations } from './integrations.js';
|
|
7
8
|
import type { Runtime } from './runtime.js';
|
|
@@ -22,6 +23,6 @@ export interface RuntimeInput<Integrations extends RuntimeIntegrations, Initiali
|
|
|
22
23
|
readonly functions: Functions;
|
|
23
24
|
}
|
|
24
25
|
/** Define one inert Runtime declaration; realization requires an exact loaded DSL Domain. */
|
|
25
|
-
export declare function defineRuntime<Schema extends schema.DomainSchema>(): <const Integrations extends RuntimeIntegrations, Initialize extends AnyRuntimeInitializer<Schema>, const Functions extends readonly unknown[]>(input: RuntimeInput<Integrations, Initialize, Functions> & AdmitsRecipeSchema<Schema, Functions> & AdmitsIntegrations<Integrations, Functions> & AdmitsProviders<Integrations, Initialize>) =>
|
|
26
|
+
export declare function defineRuntime<Schema extends schema.DomainSchema>(): <const Integrations extends RuntimeIntegrations, Initialize extends AnyRuntimeInitializer<Schema>, const Functions extends readonly unknown[]>(input: RuntimeInput<Integrations, Initialize, Functions> & AdmitsRecipeSchema<Schema, Functions> & AdmitsIntegrations<Integrations, Functions> & AdmitsProviders<Integrations, Initialize>) => AuthoredRuntime<Schema, Integrations, Initialize, RuntimeFunctionSignatures<Functions>>;
|
|
26
27
|
export declare function isRuntime(input: unknown): input is Runtime;
|
|
27
28
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { KernelSchema as CoreKernelSchema } from '@astrale-os/kernel-core/schema';
|
|
2
2
|
export * from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
export { defineSchema } from './schema-authoring.js';
|
|
4
|
+
export type { AuthoredSchema, AuthoredDomain } from './schema-authoring.js';
|
|
3
5
|
export { stateProperty } from './state-property.js';
|
|
4
6
|
export type { StateProperty } from './state-property.js';
|
|
5
7
|
export { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
@@ -2,6 +2,7 @@ import { KernelSchema as CoreKernelSchema } from '@astrale-os/kernel-core/schema
|
|
|
2
2
|
/** Canonical Schema authoring, compilation, loading, and resolved Domain surface. */
|
|
3
3
|
import { schema as language } from '@astrale-os/kernel-dsl/v1';
|
|
4
4
|
export * from '@astrale-os/kernel-dsl/v1';
|
|
5
|
+
export { defineSchema } from './schema-authoring.js';
|
|
5
6
|
export { stateProperty } from './state-property.js';
|
|
6
7
|
export { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
7
8
|
export { defineClass, nodeClass } from './class-authoring.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DefinedSchema, ResolvedDomainOfInput } from '@astrale-os/kernel-dsl/v1/builder';
|
|
2
|
+
import type { DomainSchema } from '@astrale-os/kernel-dsl/v1/schema';
|
|
3
|
+
import { defineSchema as kernelDefineSchema } from '@astrale-os/kernel-dsl/v1';
|
|
4
|
+
type DomainSchemaInput = Parameters<typeof kernelDefineSchema>[1];
|
|
5
|
+
declare const authoredGraph: unique symbol;
|
|
6
|
+
/** Opaque legacy Schemas retain their witness; SDK Schemas retain authored input and edges. */
|
|
7
|
+
type Entry = readonly [origin: string, schema: DomainSchema] | readonly [
|
|
8
|
+
origin: string,
|
|
9
|
+
input: DomainSchemaInput,
|
|
10
|
+
dependencies: Readonly<Record<string, string>>
|
|
11
|
+
];
|
|
12
|
+
type Dependencies<Input> = 'dependencies' extends keyof Input ? NonNullable<Input['dependencies']> : {};
|
|
13
|
+
type GraphOf<Schema> = typeof authoredGraph extends keyof Schema ? Schema[typeof authoredGraph] extends infer Graph ? Graph extends Entry ? Graph : never : never : Schema extends DomainSchema<infer Origin> ? readonly [Origin, Schema] : never;
|
|
14
|
+
type GraphOfInput<Origin extends string, Input extends DomainSchemaInput> = readonly [
|
|
15
|
+
Origin,
|
|
16
|
+
{
|
|
17
|
+
readonly [Key in keyof Input as Exclude<Key, 'dependencies'>]: Input[Key];
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
readonly [Alias in keyof Dependencies<Input>]: Dependencies<Input>[Alias] extends DomainSchema<infer DependencyOrigin> ? DependencyOrigin : never;
|
|
21
|
+
}
|
|
22
|
+
] | {
|
|
23
|
+
[Alias in keyof Dependencies<Input>]: GraphOf<Dependencies<Input>[Alias]>;
|
|
24
|
+
}[keyof Dependencies<Input>];
|
|
25
|
+
type LastEntry<Graph> = (Graph extends unknown ? (entry: () => Graph) => void : never) extends (entry: infer Intersection) => void ? Intersection extends () => infer Last ? Last : never : never;
|
|
26
|
+
type WithoutEquivalent<Graph, Selected> = Graph extends Selected ? Selected extends Graph ? never : Graph : Graph;
|
|
27
|
+
type UniqueEntries<Graph, Selected = LastEntry<Graph>> = [Graph] extends [never] ? never : Selected | UniqueEntries<WithoutEquivalent<Graph, Selected>>;
|
|
28
|
+
type InputOf<Origin extends string, Graph extends Entry> = Extract<Graph, readonly [Origin, DomainSchemaInput, Readonly<Record<string, string>>]> extends readonly [
|
|
29
|
+
string,
|
|
30
|
+
infer Input extends DomainSchemaInput,
|
|
31
|
+
infer Dependencies extends Readonly<Record<string, string>>
|
|
32
|
+
] ? Input & {
|
|
33
|
+
readonly dependencies: {
|
|
34
|
+
readonly [Alias in keyof Dependencies]: SchemaOf<Dependencies[Alias], Graph>;
|
|
35
|
+
};
|
|
36
|
+
} : never;
|
|
37
|
+
type SchemaOf<Origin extends string, Graph extends Entry> = Extract<Graph, readonly [Origin, DomainSchema]> extends infer Legacy ? [Legacy] extends [never] ? AuthoredSchema<Origin, Graph> : Legacy extends readonly [string, infer Schema extends DomainSchema] ? Schema : never : never;
|
|
38
|
+
/** Resolve a dependency graph without expanding a shared Schema at each dependency edge. */
|
|
39
|
+
export interface AuthoredDomain<Origin extends string, Graph extends Entry> extends ResolvedDomainOfInput<Origin, InputOf<Origin, Graph>> {
|
|
40
|
+
}
|
|
41
|
+
/** A Schema retains each transitive author's input once, with dependency edges represented by origin. */
|
|
42
|
+
export interface AuthoredSchema<Origin extends string, Graph extends Entry> extends DefinedSchema<Origin, AuthoredDomain<Origin, Graph>> {
|
|
43
|
+
readonly [authoredGraph]?: Graph;
|
|
44
|
+
}
|
|
45
|
+
type DefineSchema = <const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input) => string extends Origin | Extract<Dependencies<Input>[keyof Dependencies<Input>], DomainSchema>['origin'] ? DefinedSchema<Origin, ResolvedDomainOfInput<Origin, Input>> : AuthoredSchema<Origin, Extract<UniqueEntries<GraphOfInput<Origin, Input>>, Entry>>;
|
|
46
|
+
/** The canonical implementation with a portable, automatically inferred declaration. */
|
|
47
|
+
export declare const defineSchema: DefineSchema;
|
|
48
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { AstraleProcessResult } from './process.js';
|
|
2
|
+
/** Only sanitized CLI diagnostics may be promoted through installation failures. */
|
|
3
|
+
export declare class AstraleCliError extends Error {
|
|
4
|
+
}
|
|
2
5
|
export declare function astraleFailure(command: string, result: AstraleProcessResult): Error;
|
|
3
6
|
export declare function isDomainNotInstalledFailure(stderr: string): boolean;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Only sanitized CLI diagnostics may be promoted through installation failures. */
|
|
2
|
+
export class AstraleCliError extends Error {
|
|
3
|
+
}
|
|
1
4
|
export function astraleFailure(command, result) {
|
|
2
5
|
let diagnostic;
|
|
3
6
|
try {
|
|
@@ -11,7 +14,7 @@ export function astraleFailure(command, result) {
|
|
|
11
14
|
catch {
|
|
12
15
|
// Never forward raw stderr because a credential-bearing command owns it.
|
|
13
16
|
}
|
|
14
|
-
return new
|
|
17
|
+
return new AstraleCliError(`Astrale CLI ${command} failed${diagnostic === undefined ? '' : ` (${diagnostic})`}.`);
|
|
15
18
|
}
|
|
16
19
|
function admittedCode(input) {
|
|
17
20
|
return typeof input === 'string' && /^[A-Z][A-Z0-9_]{0,63}$/u.test(input) ? input : undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { astraleAuthorityArguments } from '../astrale/authority.js';
|
|
2
|
-
import { isDomainNotInstalledFailure, astraleFailure } from '../astrale/failure.js';
|
|
2
|
+
import { AstraleCliError, isDomainNotInstalledFailure, astraleFailure } from '../astrale/failure.js';
|
|
3
3
|
import { runAstrale } from '../astrale/process.js';
|
|
4
4
|
import { canonicalIssuer, decodeInstallationObservation } from './observation.js';
|
|
5
5
|
/** Reconcile one observed Release without ever replacing a different issuer. */
|
|
@@ -57,10 +57,10 @@ export async function reconcileInstallation(input, dependencies = {
|
|
|
57
57
|
after = await observe(input, origin, authority, executable, dependencies);
|
|
58
58
|
}
|
|
59
59
|
catch (cause) {
|
|
60
|
-
throw
|
|
60
|
+
throw installationError(installationFailure === undefined ? [cause] : [installationFailure, cause], 'Domain installation outcome is unknown because reconciliation failed.');
|
|
61
61
|
}
|
|
62
62
|
if (installationFailure !== undefined && after === undefined) {
|
|
63
|
-
throw
|
|
63
|
+
throw installationError([installationFailure], 'Domain installation failed and no installed Release was observed.');
|
|
64
64
|
}
|
|
65
65
|
if (after === undefined)
|
|
66
66
|
throw new TypeError('Installed Domain was absent after installation.');
|
|
@@ -73,10 +73,16 @@ export async function reconcileInstallation(input, dependencies = {
|
|
|
73
73
|
catch (cause) {
|
|
74
74
|
if (installationFailure === undefined)
|
|
75
75
|
throw cause;
|
|
76
|
-
throw
|
|
76
|
+
throw installationError([installationFailure, cause], 'Domain installation failed with a different observed Release.');
|
|
77
77
|
}
|
|
78
78
|
return evidence(before === undefined ? 'installed' : 'upgraded', input.target.instance, after);
|
|
79
79
|
}
|
|
80
|
+
function installationError(causes, message) {
|
|
81
|
+
const diagnostics = causes
|
|
82
|
+
.filter((cause) => cause instanceof AstraleCliError)
|
|
83
|
+
.map((cause) => cause.message);
|
|
84
|
+
return new AggregateError(causes, [message, ...diagnostics].join(' '));
|
|
85
|
+
}
|
|
80
86
|
async function observe(input, origin, authority, executable, dependencies) {
|
|
81
87
|
const result = await dependencies.run({
|
|
82
88
|
executable,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/sdk",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.126",
|
|
4
4
|
"description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"types": "./dist/platform/schema/icons/index.d.ts",
|
|
48
48
|
"import": "./dist/platform/schema/icons/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./schema/errors": {
|
|
51
|
+
"types": "./dist/platform/schema/errors/index.d.ts",
|
|
52
|
+
"import": "./dist/platform/schema/errors/index.js"
|
|
53
|
+
},
|
|
50
54
|
"./schema/addressing": {
|
|
51
55
|
"types": "./dist/platform/schema/addressing/index.d.ts",
|
|
52
56
|
"import": "./dist/platform/schema/addressing/index.js"
|