@astrale-os/sdk 0.5.0-beta.96 → 0.5.0-beta.97

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0-beta.97](https://github.com/astrale-os/sdk/compare/sdk-v0.5.0-beta.96...sdk-v0.5.0-beta.97) (2026-08-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **tooling:** admit stable local state machines ([#374](https://github.com/astrale-os/sdk/issues/374)) ([7ebd1b5](https://github.com/astrale-os/sdk/commit/7ebd1b54e282e1b85587e8d33d3faa22b5421cc6))
9
+
3
10
  ## [0.5.0-beta.96](https://github.com/astrale-os/sdk/compare/sdk-v0.5.0-beta.95...sdk-v0.5.0-beta.96) (2026-08-31)
4
11
 
5
12
 
@@ -7,7 +7,7 @@ export type StateMachineResolution = Readonly<{
7
7
  }> | Readonly<{
8
8
  kind: 'ambiguous' | 'absent';
9
9
  }>;
10
- export type MachineExportStatus = 'exported' | 'private' | 'not-a-declaration';
10
+ export type MachineExportStatus = 'exported' | 'private' | 'mutable' | 'not-a-declaration';
11
11
  /** Resolve a direct or static local alias of the SDK stateMachine constructor. */
12
12
  export declare function stateMachineConstructorOrigin(file: SourceFile, expression: ts.Expression, seen?: ReadonlySet<string>): StateMachineOrigin;
13
13
  /** Resolve one local binding to an exported SDK stateMachine authority. */
@@ -42,6 +42,19 @@ export function stateMachineIdentity(project, file, expression, seen = new Set()
42
42
  const identity = `${file.path}\0${value.text}`;
43
43
  if (seen.has(identity))
44
44
  return { kind: 'ambiguous' };
45
+ const initializer = unwrap(declaration.initializer);
46
+ if (ts.isCallExpression(initializer)) {
47
+ const origin = stateMachineConstructorOrigin(file, initializer.expression);
48
+ if (origin === 'ambiguous')
49
+ return { kind: 'ambiguous' };
50
+ if (origin === 'resolved') {
51
+ if (!declaration.constant)
52
+ return { kind: 'ambiguous' };
53
+ return machineExportStatus(file, initializer) === 'exported'
54
+ ? { kind: 'resolved', identity: machineIdentity(file, value.text) }
55
+ : { kind: 'absent' };
56
+ }
57
+ }
45
58
  const next = new Set(seen);
46
59
  next.add(identity);
47
60
  const resolution = stateMachineIdentity(project, file, declaration.initializer, next);
@@ -213,6 +226,8 @@ export function machineExportStatus(file, call) {
213
226
  const directlyExported = ts
214
227
  .getModifiers(statement)
215
228
  ?.some(({ kind }) => kind === ts.SyntaxKind.ExportKeyword);
229
+ if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0)
230
+ return 'mutable';
216
231
  if (directlyExported || locallyExported(file, declaration.name.text))
217
232
  return 'exported';
218
233
  return 'private';
@@ -356,7 +371,9 @@ function localMachineOrigin(file, name) {
356
371
  declaration.initializer !== undefined &&
357
372
  ts.isCallExpression(unwrap(declaration.initializer))) {
358
373
  const call = unwrap(declaration.initializer);
359
- return stateMachineConstructorOrigin(file, call.expression);
374
+ const origin = stateMachineConstructorOrigin(file, call.expression);
375
+ const constant = (statement.declarationList.flags & ts.NodeFlags.Const) !== 0;
376
+ return constant || origin === 'absent' ? origin : 'ambiguous';
360
377
  }
361
378
  }
362
379
  }
@@ -40,7 +40,9 @@ export const stateRules = [
40
40
  if (exportStatus !== 'exported') {
41
41
  evidence.push(violation(machine.file, machine.call, exportStatus === 'private'
42
42
  ? 'State machine relation must be exported as its Schema module StateMachine authority.'
43
- : 'State machine relation must be assigned to one exported top-level binding.'));
43
+ : exportStatus === 'mutable'
44
+ ? 'State machine relation must be declared const as its stable Schema module authority.'
45
+ : 'State machine relation must be assigned to one exported top-level binding.'));
44
46
  }
45
47
  evidence.push(...admitStaticRelation(machine.file, machine.call));
46
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/sdk",
3
- "version": "0.5.0-beta.96",
3
+ "version": "0.5.0-beta.97",
4
4
  "description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
5
5
  "keywords": [
6
6
  "astrale",