@astrale-domains/shell 0.1.0-beta.20 → 0.1.0-beta.21

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 (166) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +13 -10
  3. package/dist/application.d.ts +3 -2
  4. package/dist/application.js +49 -18
  5. package/dist/{workflows → functions}/group/assign.d.ts +1 -1
  6. package/dist/{workflows → functions}/group/change.d.ts +1 -1
  7. package/dist/{workflows → functions}/group/unassign.d.ts +1 -1
  8. package/dist/functions/registry/index.d.ts +12 -0
  9. package/dist/functions/registry/index.js +12 -0
  10. package/dist/{workflows → functions}/setup/admin.d.ts +1 -1
  11. package/dist/{workflows → functions}/setup/index.d.ts +0 -1
  12. package/dist/{workflows → functions}/setup/index.js +0 -1
  13. package/dist/{workflows → functions}/setup/member.d.ts +1 -1
  14. package/dist/{workflows → functions}/setup/provision.d.ts +2 -2
  15. package/dist/{workflows → functions}/setup/run.d.ts +2 -2
  16. package/dist/{workflows → functions}/setup/run.js +9 -2
  17. package/dist/{workflows → functions}/space/access.d.ts +1 -1
  18. package/dist/{workflows → functions}/space/add.d.ts +1 -1
  19. package/dist/{workflows → functions}/space/default.d.ts +1 -1
  20. package/dist/{workflows → functions}/space/remove.d.ts +1 -1
  21. package/dist/functions/user/index.d.ts +3 -0
  22. package/dist/functions/user/index.js +3 -0
  23. package/dist/{actions → functions}/user/resolve-home.d.ts +1 -1
  24. package/dist/mutations/group/membership.d.ts +1 -1
  25. package/dist/mutations/space/access.d.ts +1 -1
  26. package/dist/mutations/space/default.d.ts +1 -1
  27. package/dist/mutations/user/repair.d.ts +3 -21
  28. package/dist/queries/space/access.d.ts +1 -1
  29. package/dist/queries/space/admin.d.ts +1 -1
  30. package/dist/queries/space/member.d.ts +1 -1
  31. package/dist/queries/user/groups.d.ts +1 -1
  32. package/dist/queries/user/home.d.ts +1 -1
  33. package/dist/queries/user/owned-spaces.d.ts +1 -1
  34. package/dist/queries/user/profile.d.ts +1 -1
  35. package/dist/queries/user/setup.d.ts +1 -1
  36. package/dist/rules/user/index.d.ts +1 -0
  37. package/dist/rules/user/index.js +1 -0
  38. package/dist/rules/user/setup.d.ts +38 -0
  39. package/dist/{workflows/setup/plan.js → rules/user/setup.js} +0 -5
  40. package/dist/runtime.d.ts +6 -3
  41. package/dist/runtime.js +7 -13
  42. package/dist/schema/index.d.ts +4 -6
  43. package/dist/schema/index.js +4 -6
  44. package/dist/schema/{group/class.d.ts → modules/group/classes/group.d.ts} +2 -1
  45. package/dist/schema/{group/class.js → modules/group/classes/group.js} +2 -1
  46. package/dist/schema/{group/relationships.js → modules/group/classes/member-of-group.js} +2 -2
  47. package/dist/schema/modules/group/core/admin-group.d.ts +1 -0
  48. package/dist/schema/modules/group/core/admin-group.js +2 -0
  49. package/dist/schema/modules/group/core/core.d.ts +8 -0
  50. package/dist/schema/modules/group/core/core.js +6 -0
  51. package/dist/schema/modules/group/core/identity.d.ts +1 -0
  52. package/dist/schema/modules/group/core/identity.js +10 -0
  53. package/dist/schema/modules/group/core/member-group.d.ts +1 -0
  54. package/dist/schema/modules/group/core/member-group.js +2 -0
  55. package/dist/schema/modules/group/functions/assign-user.d.ts +6 -0
  56. package/dist/schema/modules/group/functions/assign-user.js +2 -0
  57. package/dist/schema/modules/group/functions/membership.d.ts +7 -0
  58. package/dist/schema/{group/methods.js → modules/group/functions/membership.js} +4 -6
  59. package/dist/schema/modules/group/functions/unassign-user.d.ts +6 -0
  60. package/dist/schema/modules/group/functions/unassign-user.js +2 -0
  61. package/dist/schema/modules/group/index.d.ts +9 -0
  62. package/dist/schema/modules/group/index.js +9 -0
  63. package/dist/schema/{group/policies.js → modules/group/policies/may-setup-users.js} +1 -1
  64. package/dist/schema/{group/view.js → modules/group/views/group.js} +1 -1
  65. package/dist/schema/modules/space/classes/administers-space.d.ts +16 -0
  66. package/dist/schema/modules/space/classes/administers-space.js +9 -0
  67. package/dist/schema/modules/space/classes/default-space.d.ts +16 -0
  68. package/dist/schema/modules/space/classes/default-space.js +8 -0
  69. package/dist/schema/modules/space/classes/member-of-space.d.ts +16 -0
  70. package/dist/schema/modules/space/classes/member-of-space.js +9 -0
  71. package/dist/schema/modules/space/classes/owns-space.d.ts +16 -0
  72. package/dist/schema/modules/space/classes/owns-space.js +9 -0
  73. package/dist/schema/{space/class.d.ts → modules/space/classes/space.d.ts} +3 -1
  74. package/dist/schema/{space/class.js → modules/space/classes/space.js} +3 -1
  75. package/dist/schema/{space → modules/space/core}/core.d.ts +0 -1
  76. package/dist/schema/modules/space/core/core.js +12 -0
  77. package/dist/schema/modules/space/core/default-space.d.ts +1 -0
  78. package/dist/schema/modules/space/core/default-space.js +6 -0
  79. package/dist/schema/modules/space/functions/access.d.ts +10 -0
  80. package/dist/schema/modules/space/functions/access.js +9 -0
  81. package/dist/schema/modules/space/functions/add-user.d.ts +7 -0
  82. package/dist/schema/modules/space/functions/add-user.js +11 -0
  83. package/dist/schema/modules/space/functions/remove-user.d.ts +6 -0
  84. package/dist/schema/modules/space/functions/remove-user.js +9 -0
  85. package/dist/schema/modules/space/functions/set-default.d.ts +4 -0
  86. package/dist/schema/modules/space/functions/set-default.js +9 -0
  87. package/dist/schema/modules/space/index.d.ts +14 -0
  88. package/dist/schema/modules/space/index.js +14 -0
  89. package/dist/schema/modules/space/policies/belongs-to-space.d.ts +1 -0
  90. package/dist/schema/modules/space/policies/belongs-to-space.js +9 -0
  91. package/dist/schema/modules/space/policies/group-space-branch.d.ts +4 -0
  92. package/dist/schema/modules/space/policies/group-space-branch.js +7 -0
  93. package/dist/schema/modules/space/policies/may-administer-space.d.ts +1 -0
  94. package/dist/schema/modules/space/policies/may-administer-space.js +8 -0
  95. package/dist/schema/modules/space/policies/owns-space.d.ts +1 -0
  96. package/dist/schema/modules/space/policies/owns-space.js +7 -0
  97. package/dist/schema/{space/view.js → modules/space/views/space.js} +1 -1
  98. package/dist/schema/{user/class.d.ts → modules/user/classes/user.d.ts} +1 -1
  99. package/dist/schema/{user/class.js → modules/user/classes/user.js} +1 -1
  100. package/dist/schema/modules/user/functions/setup-admin.d.ts +14 -0
  101. package/dist/schema/modules/user/functions/setup-admin.js +2 -0
  102. package/dist/schema/{setup/functions.d.ts → modules/user/functions/setup-member.d.ts} +0 -14
  103. package/dist/schema/modules/user/functions/setup-member.js +2 -0
  104. package/dist/schema/modules/user/functions/setup-user.d.ts +15 -0
  105. package/dist/schema/{setup/functions.js → modules/user/functions/setup-user.js} +4 -11
  106. package/dist/schema/modules/user/index.d.ts +6 -0
  107. package/dist/schema/modules/user/index.js +6 -0
  108. package/dist/schema/{user/view.js → modules/user/views/user.js} +1 -1
  109. package/dist/schema/{domain/index.d.ts → schema.d.ts} +4 -5
  110. package/dist/schema/{domain/index.js → schema.js} +3 -6
  111. package/package.json +16 -10
  112. package/dist/actions/index.d.ts +0 -1
  113. package/dist/actions/index.js +0 -1
  114. package/dist/actions/user/index.d.ts +0 -1
  115. package/dist/actions/user/index.js +0 -1
  116. package/dist/entrypoints/application.d.ts +0 -1
  117. package/dist/entrypoints/application.js +0 -1
  118. package/dist/entrypoints/runtime.d.ts +0 -1
  119. package/dist/entrypoints/runtime.js +0 -1
  120. package/dist/schema/group/core.d.ts +0 -10
  121. package/dist/schema/group/core.js +0 -14
  122. package/dist/schema/group/index.d.ts +0 -6
  123. package/dist/schema/group/index.js +0 -6
  124. package/dist/schema/group/methods.d.ts +0 -13
  125. package/dist/schema/home/index.d.ts +0 -1
  126. package/dist/schema/home/index.js +0 -1
  127. package/dist/schema/setup/index.d.ts +0 -1
  128. package/dist/schema/setup/index.js +0 -1
  129. package/dist/schema/space/core.js +0 -15
  130. package/dist/schema/space/index.d.ts +0 -6
  131. package/dist/schema/space/index.js +0 -6
  132. package/dist/schema/space/methods.d.ts +0 -18
  133. package/dist/schema/space/methods.js +0 -28
  134. package/dist/schema/space/policies.d.ts +0 -4
  135. package/dist/schema/space/policies.js +0 -21
  136. package/dist/schema/space/relationships.d.ts +0 -64
  137. package/dist/schema/space/relationships.js +0 -24
  138. package/dist/schema/user/index.d.ts +0 -3
  139. package/dist/schema/user/index.js +0 -3
  140. package/dist/workflows/index.d.ts +0 -3
  141. package/dist/workflows/index.js +0 -3
  142. package/dist/workflows/setup/plan.d.ts +0 -18
  143. /package/dist/{workflows → functions}/group/assign.js +0 -0
  144. /package/dist/{workflows → functions}/group/change.js +0 -0
  145. /package/dist/{workflows → functions}/group/index.d.ts +0 -0
  146. /package/dist/{workflows → functions}/group/index.js +0 -0
  147. /package/dist/{workflows → functions}/group/unassign.js +0 -0
  148. /package/dist/{workflows → functions}/setup/admin.js +0 -0
  149. /package/dist/{workflows → functions}/setup/member.js +0 -0
  150. /package/dist/{workflows → functions}/setup/provision.js +0 -0
  151. /package/dist/{workflows → functions}/space/access.js +0 -0
  152. /package/dist/{workflows → functions}/space/add.js +0 -0
  153. /package/dist/{workflows → functions}/space/default.js +0 -0
  154. /package/dist/{workflows → functions}/space/index.d.ts +0 -0
  155. /package/dist/{workflows → functions}/space/index.js +0 -0
  156. /package/dist/{workflows → functions}/space/remove.js +0 -0
  157. /package/dist/{actions → functions}/user/resolve-home.js +0 -0
  158. /package/dist/schema/{group/relationships.d.ts → modules/group/classes/member-of-group.d.ts} +0 -0
  159. /package/dist/schema/{group/policies.d.ts → modules/group/policies/may-setup-users.d.ts} +0 -0
  160. /package/dist/schema/{group/view.d.ts → modules/group/views/group.d.ts} +0 -0
  161. /package/dist/schema/{space/view.d.ts → modules/space/views/space.d.ts} +0 -0
  162. /package/dist/schema/{user/methods.d.ts → modules/user/functions/resolve-home.d.ts} +0 -0
  163. /package/dist/schema/{user/methods.js → modules/user/functions/resolve-home.js} +0 -0
  164. /package/dist/schema/{home/view.d.ts → modules/user/views/home.d.ts} +0 -0
  165. /package/dist/schema/{home/view.js → modules/user/views/home.js} +0 -0
  166. /package/dist/schema/{user/view.d.ts → modules/user/views/user.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-beta.21](https://github.com/astrale-os/shell/compare/shell-domain-v0.1.0-beta.20...shell-domain-v0.1.0-beta.21) (2026-09-01)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * adopt unified Domain functions layer ([#157](https://github.com/astrale-os/shell/issues/157))
9
+
10
+ ### Features
11
+
12
+ * adopt unified Domain functions layer ([#157](https://github.com/astrale-os/shell/issues/157)) ([ae73910](https://github.com/astrale-os/shell/commit/ae739107da4b3827ff06f09a1bf86958135a2a5a))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **domain:** stabilize executable declarations ([a12caa6](https://github.com/astrale-os/shell/commit/a12caa64cb42d8b7d623a53463ff2f1242d27052))
18
+
3
19
  ## [0.1.0-beta.20](https://github.com/astrale-os/shell/compare/shell-domain-v0.1.0-beta.19...shell-domain-v0.1.0-beta.20) (2026-08-31)
4
20
 
5
21
 
package/README.md CHANGED
@@ -42,13 +42,15 @@ one generation.
42
42
 
43
43
  ## Source ownership
44
44
 
45
- - `schema/` owns the complete Domain contract, public Method values, Policies, relationships, DSL
46
- Views, and Core graph;
45
+ - `schema/schema.ts` composes the complete Domain contract, while
46
+ `schema/modules/{user,group,space,home}/` owns each declaration and its focused evidence;
47
+ - every standalone Function and receiver-bound Method declaration has one file under its semantic
48
+ module's `functions/` directory; there is no separate code-kind `methods/` owner;
49
+ - `rules/user/` owns the pure closed decision for User setup and exposes no graph effect;
47
50
  - `queries/` owns canonical graph observations through the invocation-bound Query executor;
48
51
  - `mutations/` owns canonical graph changes and exact preconditions;
49
- - `actions/` owns the single-operation `User.resolveHome` implementation;
50
- - `workflows/` owns setup, Group membership, and Space access/default journeys plus
51
- unknown-outcome observation; and
52
+ - `functions/` owns the single-operation `User.resolveHome` Action, setup Workflows, Group
53
+ membership, Space access/default journeys, and unknown-outcome observation; and
52
54
  - each semantic owner keeps focused evidence in its own `__tests__/` directory, while root tests
53
55
  remain reserved for cross-layer or physical evidence.
54
56
 
@@ -56,8 +58,8 @@ No current responsibility earns a `states/`, `capabilities/`, `integrations/`, `
56
58
  `views/`, or `ui/` source layer. DSL View declarations remain in Schema; a future frontend
57
59
  projection or UI must establish its own concrete responsibility before adding those layers.
58
60
 
59
- Shell never re-declares shared metadata properties. `Group` and `Space` name `K.Named` and
60
- `K.Descriptable` in their `implements` lists because those Kernel Classes own the admitted
61
+ Shell never re-declares shared metadata properties. `Group` and `Space` extend `K.Named` and
62
+ `K.Descriptable` because those Kernel Classes own the admitted
61
63
  `name` and `description` properties; no timestamps are authored by Shell.
62
64
 
63
65
  ## Execution and evidence
@@ -84,9 +86,10 @@ schema facade.
84
86
  Domain publication product. It publishes the remote Shell application and runtime needed by platform
85
87
  Worker deployments through the explicit `./application` and `./runtime` subpaths, while its root remains
86
88
  Schema-only. Its build therefore compiles the explicit roots in `tsconfig.package.json` and applies
87
- Shell-owned checks to the emitted platform closure. Tarball qualification then verifies the exact
88
- exports, isolated entrypoints, absence of source maps, and an install using only public npm
89
- dependencies.
89
+ Shell-owned normalization and checks to the emitted platform closure. Source-only `#` aliases are
90
+ rewritten to relative declaration references so consumer path mappings cannot capture private Shell
91
+ types. Tarball qualification then verifies the exact exports, isolated subpaths, absence of source
92
+ maps, and an install using only public npm dependencies.
90
93
 
91
94
  The generic `astrale-domain package` command remains Schema-only and exposes only the Domain root plus
92
95
  package metadata. This Shell exception must not be copied to ordinary product Domains or used to
@@ -1,6 +1,7 @@
1
1
  import { type Application, type Frontend, type Requirements } from '@astrale-os/sdk/application';
2
2
  import runtime from './runtime.js';
3
3
  import { ShellSchema } from './schema/index.js';
4
- export declare const frontend: Frontend<typeof ShellSchema>;
5
- export declare const application: Application<typeof ShellSchema, typeof runtime, typeof frontend, undefined, Requirements>;
4
+ declare const frontend: Frontend<typeof ShellSchema>;
5
+ declare const applicationRequirements: Requirements;
6
+ export declare const application: Application<typeof ShellSchema, typeof runtime, typeof frontend, undefined, typeof applicationRequirements>;
6
7
  export default application;
@@ -2,18 +2,7 @@ import { defineApplication, defineFrontend, external, requirements, } from '@ast
2
2
  import { K, KernelRootFunctions } from '@astrale-os/sdk/schema';
3
3
  import runtime from './runtime.js';
4
4
  import { S, ShellSchema } from './schema/index.js';
5
- const classOperations = ['create', 'read', 'traverse', 'update', 'delete'];
6
- const authority = {
7
- grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
8
- revoke: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'grant'],
9
- };
10
- const memberFunctions = [
11
- K.classes.View.static.methods.resolve,
12
- K.functions.introspect,
13
- K.functions.mutate,
14
- K.functions.query,
15
- ];
16
- export const frontend = defineFrontend({
5
+ const frontend = defineFrontend({
17
6
  schema: ShellSchema,
18
7
  source: external('https://app.astrale.ai'),
19
8
  routes: {
@@ -24,7 +13,7 @@ export const frontend = defineFrontend({
24
13
  },
25
14
  entrypoint: 'home',
26
15
  });
27
- const trustedKernel = requirements({
16
+ const applicationRequirements = requirements({
28
17
  functions: KernelRootFunctions,
29
18
  classes: [
30
19
  {
@@ -32,23 +21,65 @@ const trustedKernel = requirements({
32
21
  operations: ['create', 'read', 'traverse', 'delete'],
33
22
  },
34
23
  ],
35
- authority,
24
+ authority: {
25
+ grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
26
+ revoke: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'grant'],
27
+ },
36
28
  profiles: [
37
29
  {
38
30
  subject: S.core.nodes.admin,
39
31
  functions: KernelRootFunctions,
40
32
  classes: [
41
- ...Object.values(S.classes).map((value) => ({ class: value, operations: classOperations })),
33
+ {
34
+ class: S.classes.Group,
35
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
36
+ },
37
+ {
38
+ class: S.classes.Space,
39
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
40
+ },
41
+ {
42
+ class: S.classes.User,
43
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
44
+ },
45
+ {
46
+ class: S.classes.administers_space,
47
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
48
+ },
49
+ {
50
+ class: S.classes.default_space,
51
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
52
+ },
53
+ {
54
+ class: S.classes.member_of_group,
55
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
56
+ },
57
+ {
58
+ class: S.classes.member_of_space,
59
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
60
+ },
61
+ {
62
+ class: S.classes.owns_space,
63
+ operations: ['create', 'read', 'traverse', 'update', 'delete'],
64
+ },
42
65
  {
43
66
  class: K.classes.extends_with,
44
67
  operations: ['create', 'read', 'traverse', 'delete'],
45
68
  },
46
69
  ],
47
- authority,
70
+ authority: {
71
+ grant: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'revoke'],
72
+ revoke: ['create', 'read', 'update', 'delete', 'traverse', 'use', 'grant'],
73
+ },
48
74
  },
49
75
  {
50
76
  subject: S.core.nodes.member,
51
- functions: memberFunctions,
77
+ functions: [
78
+ K.classes.View.static.methods.resolve,
79
+ K.functions.introspect,
80
+ K.functions.mutate,
81
+ K.functions.query,
82
+ ],
52
83
  },
53
84
  ],
54
85
  });
@@ -56,6 +87,6 @@ export const application = defineApplication({
56
87
  schema: ShellSchema,
57
88
  runtime,
58
89
  frontend,
59
- requirements: trustedKernel,
90
+ requirements: applicationRequirements,
60
91
  });
61
92
  export default application;
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const assignGroupUserWorkflow: WorkflowDefinition<typeof ShellSchema, 'Group.assignUser'>;
@@ -1,5 +1,5 @@
1
1
  import type { WorkflowContext } from '@astrale-os/sdk/workflow';
2
- import type { S, Shell } from '#schema';
2
+ import type { S, Shell } from '../../schema/index.js';
3
3
  type GroupCallable = typeof S.classes.Group.self.methods.assignUser | typeof S.classes.Group.self.methods.unassignUser;
4
4
  type GroupContext = WorkflowContext<GroupCallable, Shell>;
5
5
  export declare function changeMembership(context: GroupContext, present: boolean): Promise<Readonly<Record<never, never>>>;
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const unassignGroupUserWorkflow: WorkflowDefinition<typeof ShellSchema, 'Group.unassignUser'>;
@@ -0,0 +1,12 @@
1
+ import { assignGroupUserWorkflow, unassignGroupUserWorkflow } from '../group/index.js';
2
+ import { setupAdminWorkflow, setupMemberWorkflow } from '../setup/index.js';
3
+ import { addSpaceUserWorkflow, removeSpaceUserWorkflow, setDefaultSpaceWorkflow } from '../space/index.js';
4
+ export declare const workflows: readonly [
5
+ typeof setupAdminWorkflow,
6
+ typeof setupMemberWorkflow,
7
+ typeof assignGroupUserWorkflow,
8
+ typeof unassignGroupUserWorkflow,
9
+ typeof addSpaceUserWorkflow,
10
+ typeof removeSpaceUserWorkflow,
11
+ typeof setDefaultSpaceWorkflow
12
+ ];
@@ -0,0 +1,12 @@
1
+ import { assignGroupUserWorkflow, unassignGroupUserWorkflow } from '#functions/group';
2
+ import { setupAdminWorkflow, setupMemberWorkflow } from '#functions/setup';
3
+ import { addSpaceUserWorkflow, removeSpaceUserWorkflow, setDefaultSpaceWorkflow, } from '#functions/space';
4
+ export const workflows = [
5
+ setupAdminWorkflow,
6
+ setupMemberWorkflow,
7
+ assignGroupUserWorkflow,
8
+ unassignGroupUserWorkflow,
9
+ addSpaceUserWorkflow,
10
+ removeSpaceUserWorkflow,
11
+ setDefaultSpaceWorkflow,
12
+ ];
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const setupAdminWorkflow: WorkflowDefinition<typeof ShellSchema, 'setupAdmin'>;
@@ -1,5 +1,4 @@
1
1
  export { setupAdminWorkflow } from './admin.js';
2
2
  export { setupMemberWorkflow } from './member.js';
3
- export { planUserSetup, type SetupConflictReason, type SetupPlan, type SetupRole } from './plan.js';
4
3
  export { provisioningRequest, provisioningResult } from './provision.js';
5
4
  export { runSetup } from './run.js';
@@ -1,5 +1,4 @@
1
1
  export { setupAdminWorkflow } from './admin.js';
2
2
  export { setupMemberWorkflow } from './member.js';
3
- export { planUserSetup } from './plan.js';
4
3
  export { provisioningRequest, provisioningResult } from './provision.js';
5
4
  export { runSetup } from './run.js';
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const setupMemberWorkflow: WorkflowDefinition<typeof ShellSchema, 'setupMember'>;
@@ -1,5 +1,5 @@
1
1
  import type { ProvisionRequest, ProvisionResult } from '@astrale-os/sdk/auth';
2
- import type { SetupUserInput, SetupUserResult, Shell } from '#schema';
3
- import type { SetupRole } from './plan.js';
2
+ import type { SetupRole } from '../../rules/user/index.js';
3
+ import type { SetupUserInput, SetupUserResult, Shell } from '../../schema/index.js';
4
4
  export declare function provisioningRequest(domain: Shell, input: SetupUserInput, role: SetupRole): ProvisionRequest;
5
5
  export declare function provisioningResult(result: ProvisionResult): SetupUserResult;
@@ -1,6 +1,6 @@
1
1
  import type { WorkflowContext } from '@astrale-os/sdk/workflow';
2
- import type { S, SetupUserResult, Shell } from '#schema';
3
- import { type SetupRole } from './plan.js';
2
+ import type { S, SetupUserResult, Shell } from '../../schema/index.js';
3
+ import { type SetupRole } from '../../rules/user/index.js';
4
4
  type SetupCallable = typeof S.functions.setupAdmin | typeof S.functions.setupMember;
5
5
  type SetupContext = WorkflowContext<SetupCallable, Shell>;
6
6
  export declare function runSetup(context: SetupContext, role: SetupRole): Promise<SetupUserResult>;
@@ -4,7 +4,7 @@ import { InvocationError } from '@astrale-os/sdk/execution';
4
4
  import { Path } from '@astrale-os/sdk/graph/path';
5
5
  import { repairUser } from '#mutations/user';
6
6
  import { observeUserSetup } from '#queries/user';
7
- import { planUserSetup } from './plan.js';
7
+ import { planUserSetup } from '#rules/user';
8
8
  import { provisioningRequest, provisioningResult } from './provision.js';
9
9
  export async function runSetup(context, role) {
10
10
  const { input, step } = context;
@@ -42,7 +42,14 @@ async function convergeExisting(context, role, userId, changedBeforeObservation)
42
42
  changed: changedBeforeObservation,
43
43
  });
44
44
  }
45
- const repaired = await context.step.run('repair-user-setup', () => context.graph.self.mutate(repairUser, plan.repair));
45
+ const repaired = await context.step.run('repair-user-setup', () => context.graph.self.mutate(repairUser, {
46
+ ...plan.repair,
47
+ guards: {
48
+ home: observed.home.guard,
49
+ ownedSpaces: observed.ownedSpaces.guard,
50
+ groups: observed.groups.guard,
51
+ },
52
+ }));
46
53
  if (repaired.ok) {
47
54
  return Object.freeze({ userId, personalSpaceId: repaired.personalSpaceId, changed: true });
48
55
  }
@@ -1,5 +1,5 @@
1
1
  import type { WorkflowContext } from '@astrale-os/sdk/workflow';
2
- import type { S, Shell } from '#schema';
2
+ import type { S, Shell } from '../../schema/index.js';
3
3
  export type DesiredSpaceAccess = 'member' | 'admin' | null;
4
4
  type SpaceAccessCallable = typeof S.classes.Space.self.methods.addUser | typeof S.classes.Space.self.methods.removeUser;
5
5
  type SpaceAccessContext = WorkflowContext<SpaceAccessCallable, Shell>;
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const addSpaceUserWorkflow: WorkflowDefinition<typeof ShellSchema, 'Space.addUser'>;
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const setDefaultSpaceWorkflow: WorkflowDefinition<typeof ShellSchema, 'Space.setDefault'>;
@@ -1,3 +1,3 @@
1
1
  import { type WorkflowDefinition } from '@astrale-os/sdk/workflow';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const removeSpaceUserWorkflow: WorkflowDefinition<typeof ShellSchema, 'Space.removeUser'>;
@@ -0,0 +1,3 @@
1
+ import { resolveHomeAction } from './resolve-home.js';
2
+ export { resolveHomeAction };
3
+ export declare const actions: readonly [typeof resolveHomeAction];
@@ -0,0 +1,3 @@
1
+ import { resolveHomeAction } from './resolve-home.js';
2
+ export { resolveHomeAction };
3
+ export const actions = [resolveHomeAction];
@@ -1,3 +1,3 @@
1
1
  import { type ActionDefinition } from '@astrale-os/sdk/action';
2
- import type { ShellSchema } from '#schema';
2
+ import type { ShellSchema } from '../../schema/index.js';
3
3
  export declare const resolveHomeAction: ActionDefinition<typeof ShellSchema, 'User.resolveHome'>;
@@ -2,7 +2,7 @@ import type { NodeId } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryEdgeAST } from '@astrale-os/sdk/query';
4
4
  import { type Mutation } from '@astrale-os/sdk/mutation';
5
- import type { Shell } from '#schema';
5
+ import type { Shell } from '../../schema/index.js';
6
6
  export interface GroupMembershipChange {
7
7
  readonly user: string;
8
8
  readonly group: NodeId;
@@ -2,7 +2,7 @@ import type { NodeId } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST } from '@astrale-os/sdk/query';
4
4
  import { type Mutation } from '@astrale-os/sdk/mutation';
5
- import type { Shell } from '#schema';
5
+ import type { Shell } from '../../schema/index.js';
6
6
  export interface SpaceAccessChange {
7
7
  readonly user: string;
8
8
  readonly space: NodeId;
@@ -2,7 +2,7 @@ import type { NodeId } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST } from '@astrale-os/sdk/query';
4
4
  import { type Mutation } from '@astrale-os/sdk/mutation';
5
- import type { Shell } from '#schema';
5
+ import type { Shell } from '../../schema/index.js';
6
6
  export interface DefaultSpaceChange {
7
7
  readonly user: NodeId;
8
8
  readonly previous?: NodeId;
@@ -2,27 +2,9 @@ import type { NodeId } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryEdgeAST, QueryNodeAST } from '@astrale-os/sdk/query';
4
4
  import { type Mutation } from '@astrale-os/sdk/mutation';
5
- import type { Shell } from '#schema';
6
- export interface UserRepair {
7
- readonly userId: NodeId;
8
- readonly currentDisplayName?: string;
9
- readonly displayName?: string;
10
- readonly home: {
11
- readonly kind: 'existing';
12
- readonly id: NodeId;
13
- readonly currentName: string;
14
- readonly name?: string;
15
- } | {
16
- readonly kind: 'create';
17
- readonly name: string;
18
- };
19
- readonly addDefault: boolean;
20
- readonly addOwnership: boolean;
21
- readonly addMember: boolean;
22
- readonly addMemberAuthority: boolean;
23
- readonly addAdmin: boolean;
24
- readonly addAdminAuthority: boolean;
25
- readonly removeAdminAuthority: boolean;
5
+ import type { UserSetupRepair } from '../../rules/user/index.js';
6
+ import type { Shell } from '../../schema/index.js';
7
+ export interface UserRepair extends UserSetupRepair {
26
8
  readonly guards: {
27
9
  readonly home: QueryPrecondition<QueryNodeAST>;
28
10
  readonly ownedSpaces: QueryPrecondition<QueryNodeAST>;
@@ -1,5 +1,5 @@
1
1
  import { type CompositeQueryDefinition } from '@astrale-os/sdk/query';
2
- import type { Shell } from '#schema';
2
+ import type { Shell } from '../../schema/index.js';
3
3
  import { type AdminSpacesObservation } from './admin.js';
4
4
  import { type MemberSpacesObservation } from './member.js';
5
5
  export interface DirectSpaceAccessObservation {
@@ -1,7 +1,7 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
4
- import type { Shell } from '#schema';
4
+ import type { Shell } from '../../schema/index.js';
5
5
  export interface AdminSpacesObservation {
6
6
  readonly spaces: readonly Node[];
7
7
  readonly guard: QueryPrecondition<QueryNodeAST>;
@@ -1,7 +1,7 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
4
- import type { Shell } from '#schema';
4
+ import type { Shell } from '../../schema/index.js';
5
5
  export interface MemberSpacesObservation {
6
6
  readonly spaces: readonly Node[];
7
7
  readonly guard: QueryPrecondition<QueryNodeAST>;
@@ -1,7 +1,7 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryEdgeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
4
- import type { Shell } from '#schema';
4
+ import type { Shell } from '../../schema/index.js';
5
5
  export interface UserGroupsObservation {
6
6
  readonly groups: readonly Node[];
7
7
  readonly authorities: readonly Node[];
@@ -1,7 +1,7 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
4
- import type { Shell } from '#schema';
4
+ import type { Shell } from '../../schema/index.js';
5
5
  export interface HomeObservation {
6
6
  readonly spaces: readonly Node[];
7
7
  readonly guard: QueryPrecondition<QueryNodeAST>;
@@ -1,7 +1,7 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
3
3
  import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
4
- import type { Shell } from '#schema';
4
+ import type { Shell } from '../../schema/index.js';
5
5
  export interface OwnedSpacesObservation {
6
6
  readonly spaces: readonly Node[];
7
7
  readonly guard: QueryPrecondition<QueryNodeAST>;
@@ -1,4 +1,4 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import { type SingleQueryDefinition } from '@astrale-os/sdk/query';
3
- import type { Shell } from '#schema';
3
+ import type { Shell } from '../../schema/index.js';
4
4
  export declare const readUserProfile: SingleQueryDefinition<Shell, string, Node>;
@@ -1,6 +1,6 @@
1
1
  import type { Node } from '@astrale-os/sdk/graph/node';
2
2
  import { type CompositeQueryDefinition } from '@astrale-os/sdk/query';
3
- import type { Shell } from '#schema';
3
+ import type { Shell } from '../../schema/index.js';
4
4
  import type { UserGroupsObservation } from './groups.js';
5
5
  import { type HomeObservation } from './home.js';
6
6
  import { type OwnedSpacesObservation } from './owned-spaces.js';
@@ -0,0 +1 @@
1
+ export { planUserSetup, type SetupConflictReason, type SetupPlan, type SetupRole, type UserSetupRepair, } from './setup.js';
@@ -0,0 +1 @@
1
+ export { planUserSetup, } from './setup.js';
@@ -0,0 +1,38 @@
1
+ import type { Node } from '@astrale-os/sdk/graph/node';
2
+ import type { UserSetupObservation } from '../../queries/user/index.js';
3
+ import type { SetupUserInput, Shell } from '../../schema/index.js';
4
+ export type SetupRole = 'member' | 'admin';
5
+ export type SetupPlan = {
6
+ readonly kind: 'conflict';
7
+ readonly reason: SetupConflictReason;
8
+ readonly message: string;
9
+ } | {
10
+ readonly kind: 'unchanged';
11
+ readonly personalSpaceId: Node['id'];
12
+ } | {
13
+ readonly kind: 'repair';
14
+ readonly repair: UserSetupRepair;
15
+ };
16
+ export interface UserSetupRepair {
17
+ readonly userId: Node['id'];
18
+ readonly currentDisplayName?: string;
19
+ readonly displayName?: string;
20
+ readonly home: {
21
+ readonly kind: 'existing';
22
+ readonly id: Node['id'];
23
+ readonly currentName: string;
24
+ readonly name?: string;
25
+ } | {
26
+ readonly kind: 'create';
27
+ readonly name: string;
28
+ };
29
+ readonly addDefault: boolean;
30
+ readonly addOwnership: boolean;
31
+ readonly addMember: boolean;
32
+ readonly addMemberAuthority: boolean;
33
+ readonly addAdmin: boolean;
34
+ readonly addAdminAuthority: boolean;
35
+ readonly removeAdminAuthority: boolean;
36
+ }
37
+ export type SetupConflictReason = 'IDENTITY_CLASS_CONFLICT' | 'IDENTITY_FACT_CONFLICT' | 'MULTIPLE_DEFAULT_SPACES' | 'DEFAULT_SPACE_CLASS_CONFLICT' | 'AMBIGUOUS_PERSONAL_SPACE';
38
+ export declare function planUserSetup(domain: Shell, input: SetupUserInput, role: SetupRole, observation: UserSetupObservation): SetupPlan;
@@ -82,11 +82,6 @@ export function planUserSetup(domain, input, role, observation) {
82
82
  addAdmin,
83
83
  addAdminAuthority,
84
84
  removeAdminAuthority,
85
- guards: Object.freeze({
86
- home: observation.home.guard,
87
- ownedSpaces: observation.ownedSpaces.guard,
88
- groups: observation.groups.guard,
89
- }),
90
85
  }),
91
86
  });
92
87
  }
package/dist/runtime.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import { type Runtime } from '@astrale-os/sdk/runtime';
2
+ import { workflows } from './functions/registry/index.js';
3
+ import { actions } from './functions/user/index.js';
2
4
  import type { ShellSchema } from './schema/index.js';
3
5
  declare const integrations: {};
4
6
  declare const initialize: () => {
5
7
  providers: {};
6
8
  };
7
- declare const actions: readonly [import("@astrale-os/sdk/action").ActionDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "User.resolveHome", Readonly<Record<never, never>>>];
8
- declare const workflows: readonly [import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "setupAdmin", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "setupMember", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Group.assignUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Group.unassignUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.addUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.removeUser", Readonly<Record<never, never>>>, import("@astrale-os/sdk/workflow").WorkflowDefinition<import("@astrale-os/sdk/schema").DefinedSchema<"shell.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"shell.astrale.ai", import("./schema/domain/index.js").ShellSchemaInput>>, "Space.setDefault", Readonly<Record<never, never>>>];
9
- declare const runtime: Runtime<typeof ShellSchema, typeof integrations, typeof initialize, typeof actions, typeof workflows>;
9
+ declare const runtime: Runtime<typeof ShellSchema, typeof integrations, typeof initialize, [
10
+ ...typeof actions,
11
+ ...typeof workflows
12
+ ]>;
10
13
  export default runtime;
package/dist/runtime.js CHANGED
@@ -1,17 +1,11 @@
1
1
  import { defineRuntime } from '@astrale-os/sdk/runtime';
2
- import { resolveHomeAction } from './actions/index.js';
3
- import { addSpaceUserWorkflow, assignGroupUserWorkflow, removeSpaceUserWorkflow, setDefaultSpaceWorkflow, setupAdminWorkflow, setupMemberWorkflow, unassignGroupUserWorkflow, } from './workflows/index.js';
2
+ import { workflows } from '#functions/registry';
3
+ import { actions } from '#functions/user';
4
4
  const integrations = {};
5
5
  const initialize = () => ({ providers: {} });
6
- const actions = [resolveHomeAction];
7
- const workflows = [
8
- setupAdminWorkflow,
9
- setupMemberWorkflow,
10
- assignGroupUserWorkflow,
11
- unassignGroupUserWorkflow,
12
- addSpaceUserWorkflow,
13
- removeSpaceUserWorkflow,
14
- setDefaultSpaceWorkflow,
15
- ];
16
- const runtime = defineRuntime()({ integrations, initialize, actions, workflows });
6
+ const runtime = defineRuntime()({
7
+ integrations,
8
+ initialize,
9
+ functions: [...actions, ...workflows],
10
+ });
17
11
  export default runtime;
@@ -1,6 +1,4 @@
1
- export { ORIGIN, S, ShellCore, ShellSchema, type GroupMembershipInput, type GroupMembershipResult, type ResolveHomeResult, type SetDefaultSpaceInput, type SetDefaultSpaceResult, type SetupUserInput, type SetupUserResult, type Shell, type SpaceUserAccess, type SpaceUserAccessInput, type SpaceUserAccessResult, type SpaceUserInput, type SpaceUserResult, } from '#schema/domain';
2
- export { Group, adminGroup, groupAssignUser, groupCore, groupUnassignUser, groupView, maySetupUsers, memberGroup, member_of_group, } from '#schema/group';
3
- export { homeView } from '#schema/home';
4
- export { setupAdmin, setupMember } from '#schema/setup';
5
- export { Space, administers_space, belongsToSpace, default_space, defaultSpace, mayAdministerSpace, member_of_space, owns_space, ownsSpace, spaceAddUser, spaceCore, spaceRemoveUser, spaceSetDefault, spaceView, } from '#schema/space';
6
- export { User, resolveHome, userView } from '#schema/user';
1
+ export { ORIGIN, S, ShellCore, ShellSchema, type GroupMembershipInput, type GroupMembershipResult, type ResolveHomeResult, type SetDefaultSpaceInput, type SetDefaultSpaceResult, type SetupUserInput, type SetupUserResult, type Shell, type SpaceUserAccess, type SpaceUserAccessInput, type SpaceUserAccessResult, type SpaceUserInput, type SpaceUserResult, } from './schema.js';
2
+ export { Group, adminGroup, groupAssignUser, groupCore, groupUnassignUser, groupView, maySetupUsers, memberGroup, member_of_group, } from './modules/group/index.js';
3
+ export { Space, administers_space, belongsToSpace, default_space, defaultSpace, mayAdministerSpace, member_of_space, owns_space, ownsSpace, spaceAddUser, spaceCore, spaceRemoveUser, spaceSetDefault, spaceView, } from './modules/space/index.js';
4
+ export { User, homeView, resolveHome, setupAdmin, setupMember, userView, } from './modules/user/index.js';