@astrale-os/sdk 0.5.0-beta.125 → 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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
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)
4
12
 
5
13
 
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
@@ -0,0 +1,3 @@
1
+ /** Runtime-safe business-error declarations shared by Schema and handlers. */
2
+ export { error } from '../error.js';
3
+ export type { DeclaredErrorDefinition, DeclaredErrorFamily } from '../error.js';
@@ -0,0 +1,2 @@
1
+ /** Runtime-safe business-error declarations shared by Schema and handlers. */
2
+ export { error } from '../error.js';
@@ -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 Error(`Astrale CLI ${command} failed${diagnostic === undefined ? '' : ` (${diagnostic})`}.`);
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 new AggregateError(installationFailure === undefined ? [cause] : [installationFailure, cause], 'Domain installation outcome is unknown because reconciliation failed.');
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 new AggregateError([installationFailure], 'Domain installation failed and no installed Release was observed.');
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 new AggregateError([installationFailure, cause], 'Domain installation failed with a different observed Release.');
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.125",
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"