@astrale-os/sdk 0.5.0-beta.99 → 0.6.0-beta.1

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 (272) hide show
  1. package/README.md +165 -2
  2. package/dist/application/action/action.d.ts +7 -4
  3. package/dist/application/action/authoring.d.ts +2 -1
  4. package/dist/application/action/context.d.ts +18 -13
  5. package/dist/application/action/define.d.ts +5 -1
  6. package/dist/application/action/define.js +6 -1
  7. package/dist/application/action/index.d.ts +2 -1
  8. package/dist/application/dependency/index.d.ts +1 -0
  9. package/dist/application/dependency/invoker.d.ts +26 -0
  10. package/dist/application/error/error.d.ts +23 -0
  11. package/dist/application/error/error.js +87 -0
  12. package/dist/application/error/index.d.ts +2 -0
  13. package/dist/application/error/index.js +1 -0
  14. package/dist/application/index.d.ts +2 -2
  15. package/dist/application/integration/authentication.d.ts +10 -0
  16. package/dist/application/integration/authentication.typecheck.js +18 -0
  17. package/dist/application/integration/client.d.ts +2 -0
  18. package/dist/application/integration/client.js +19 -2
  19. package/dist/application/integration/index.d.ts +1 -0
  20. package/dist/application/integration/operation.d.ts +3 -0
  21. package/dist/application/mutation/authoring/builder.js +2 -2
  22. package/dist/application/mutation/authoring/endpoint.d.ts +3 -3
  23. package/dist/application/mutation/authoring/endpoint.js +9 -0
  24. package/dist/application/mutation/failure.js +13 -7
  25. package/dist/application/mutation/index.d.ts +1 -0
  26. package/dist/application/requirements/{profiles.d.ts → core.d.ts} +5 -3
  27. package/dist/application/requirements/{profiles.js → core.js} +6 -6
  28. package/dist/application/requirements/index.d.ts +4 -4
  29. package/dist/application/requirements/index.js +5 -5
  30. package/dist/application/requirements/requirement.d.ts +3 -2
  31. package/dist/application/runtime/authoring.d.ts +1 -0
  32. package/dist/application/runtime/callables.js +2 -2
  33. package/dist/application/runtime/declarations.d.ts +43 -0
  34. package/dist/application/runtime/define.d.ts +2 -1
  35. package/dist/application/view/index.d.ts +1 -1
  36. package/dist/application/view/route.d.ts +12 -0
  37. package/dist/application/view/route.js +5 -1
  38. package/dist/application/workflow/authoring.d.ts +1 -0
  39. package/dist/application/workflow/context.d.ts +2 -1
  40. package/dist/application/workflow/define.d.ts +5 -1
  41. package/dist/application/workflow/define.js +6 -1
  42. package/dist/application/workflow/index.d.ts +1 -0
  43. package/dist/application/workflow/runner/runner.d.ts +3 -2
  44. package/dist/application/workflow/workflow.d.ts +4 -3
  45. package/dist/deployment/adapter/adapter.d.ts +12 -7
  46. package/dist/deployment/adapter/define.d.ts +5 -2
  47. package/dist/deployment/adapter/define.js +15 -17
  48. package/dist/deployment/adapter/deploy/context.d.ts +6 -0
  49. package/dist/deployment/adapter/deploy/result.d.ts +2 -0
  50. package/dist/deployment/adapter/index.d.ts +2 -3
  51. package/dist/deployment/adapter/index.js +1 -1
  52. package/dist/deployment/adapter/prepare/context.d.ts +13 -5
  53. package/dist/deployment/authoring.d.ts +1 -1
  54. package/dist/deployment/build/compile.js +21 -19
  55. package/dist/deployment/build/frontend/compilation.d.ts +2 -1
  56. package/dist/deployment/build/frontend/compilation.js +1 -0
  57. package/dist/deployment/build/material.js +5 -5
  58. package/dist/deployment/deploy.d.ts +10 -4
  59. package/dist/deployment/deploy.js +5 -5
  60. package/dist/deployment/deployment.d.ts +8 -5
  61. package/dist/deployment/deployment.js +10 -1
  62. package/dist/deployment/index.d.ts +5 -4
  63. package/dist/deployment/index.js +3 -2
  64. package/dist/deployment/release/addressing.d.ts +6 -2
  65. package/dist/deployment/release/addressing.js +9 -4
  66. package/dist/deployment/release/publication/callables.js +1 -1
  67. package/dist/deployment/release/publication/index.d.ts +1 -1
  68. package/dist/deployment/release/publication/index.js +1 -1
  69. package/dist/deployment/release/publication/routes.js +1 -1
  70. package/dist/deployment/release/publication/seal.d.ts +0 -1
  71. package/dist/deployment/release/publication/seal.js +4 -5
  72. package/dist/deployment/release/publication/views.js +2 -1
  73. package/dist/deployment/verify/preflight/artifact.js +1 -1
  74. package/dist/deployment/verify/readiness/deployment.js +7 -3
  75. package/dist/deployment/verify/readiness/identity.js +1 -1
  76. package/dist/deployment/verify/readiness/publication.js +2 -2
  77. package/dist/execution/identity/authentication.js +0 -1
  78. package/dist/execution/identity/exchange.d.ts +1 -0
  79. package/dist/execution/identity/exchange.js +1 -1
  80. package/dist/execution/identity/jwks.js +1 -1
  81. package/dist/execution/invocation/admission/authentication.d.ts +6 -3
  82. package/dist/execution/invocation/admission/authentication.js +16 -6
  83. package/dist/execution/invocation/admission/authority.d.ts +2 -2
  84. package/dist/execution/invocation/dependency/bind.d.ts +5 -0
  85. package/dist/execution/invocation/dependency/bind.js +68 -0
  86. package/dist/execution/invocation/dependency/index.d.ts +1 -0
  87. package/dist/execution/invocation/dependency/index.js +1 -0
  88. package/dist/execution/invocation/dispatch/action.js +19 -2
  89. package/dist/execution/invocation/dispatch/context.d.ts +4 -4
  90. package/dist/execution/invocation/dispatch/context.js +29 -9
  91. package/dist/execution/invocation/dispatch/workflow.js +17 -4
  92. package/dist/execution/invocation/integration/authentication.d.ts +5 -0
  93. package/dist/execution/invocation/integration/authentication.js +53 -0
  94. package/dist/execution/invocation/integration/call.d.ts +7 -1
  95. package/dist/execution/invocation/integration/call.js +8 -3
  96. package/dist/execution/invocation/integration/clients.d.ts +2 -2
  97. package/dist/execution/invocation/integration/clients.js +2 -2
  98. package/dist/execution/invocation/lifecycle/active.js +30 -5
  99. package/dist/execution/invocation/result/errors.d.ts +1 -0
  100. package/dist/execution/invocation/result/errors.js +15 -10
  101. package/dist/execution/service/create.js +3 -1
  102. package/dist/execution/service/service.d.ts +1 -1
  103. package/dist/index.d.ts +3 -1
  104. package/dist/index.js +1 -0
  105. package/dist/platform/auth/index.d.ts +1 -1
  106. package/dist/platform/auth/index.js +0 -1
  107. package/dist/platform/graph/alias.d.ts +6 -0
  108. package/dist/platform/graph/alias.js +6 -0
  109. package/dist/platform/graph/document/index.d.ts +2 -1
  110. package/dist/platform/graph/document/index.js +2 -1
  111. package/dist/platform/graph/index.d.ts +2 -1
  112. package/dist/platform/graph/index.js +2 -1
  113. package/dist/platform/schema/class-authoring.d.ts +37 -0
  114. package/dist/platform/schema/class-authoring.js +20 -0
  115. package/dist/platform/schema/class-icon.d.ts +15 -0
  116. package/dist/platform/schema/class-icon.js +46 -0
  117. package/dist/platform/schema/error.d.ts +11 -0
  118. package/dist/platform/schema/error.js +34 -0
  119. package/dist/platform/schema/errors/index.d.ts +3 -0
  120. package/dist/platform/schema/errors/index.js +2 -0
  121. package/dist/platform/schema/icons/index.d.ts +2 -0
  122. package/dist/platform/schema/icons/index.js +2 -0
  123. package/dist/platform/schema/index.d.ts +20 -13
  124. package/dist/platform/schema/index.js +9 -4
  125. package/dist/platform/schema/kernel.d.ts +22 -0
  126. package/dist/platform/schema/kernel.js +5 -0
  127. package/dist/platform/schema/node-id.d.ts +3 -0
  128. package/dist/platform/schema/node-id.js +6 -0
  129. package/dist/platform/schema/property.d.ts +12 -0
  130. package/dist/platform/schema/property.js +3 -0
  131. package/dist/platform/schema/schema-authoring.d.ts +48 -0
  132. package/dist/platform/schema/schema-authoring.js +3 -0
  133. package/dist/platform/schema/state-property.d.ts +11 -0
  134. package/dist/platform/schema/state-property.js +3 -0
  135. package/dist/project/admit.d.ts +4 -0
  136. package/dist/project/admit.js +22 -0
  137. package/dist/project/define.d.ts +12 -0
  138. package/dist/project/define.js +106 -0
  139. package/dist/project/index.d.ts +4 -0
  140. package/dist/project/index.js +2 -0
  141. package/dist/project/project.d.ts +24 -0
  142. package/dist/project/project.js +1 -0
  143. package/dist/testing/dataset/admission.d.ts +13 -0
  144. package/dist/testing/dataset/admission.js +107 -0
  145. package/dist/testing/dataset/builder.d.ts +42 -0
  146. package/dist/testing/dataset/builder.js +127 -0
  147. package/dist/testing/dataset/codec.d.ts +6 -0
  148. package/dist/testing/dataset/codec.js +113 -0
  149. package/dist/testing/dataset/dataset.d.ts +58 -0
  150. package/dist/testing/dataset/dataset.js +2 -0
  151. package/dist/testing/dataset/define.d.ts +33 -0
  152. package/dist/testing/dataset/define.js +105 -0
  153. package/dist/testing/dataset/index.d.ts +8 -0
  154. package/dist/testing/dataset/index.js +4 -0
  155. package/dist/testing/dataset/references.d.ts +14 -0
  156. package/dist/testing/dataset/references.js +56 -0
  157. package/dist/testing/index.d.ts +9 -0
  158. package/dist/testing/index.js +5 -0
  159. package/dist/testing/load.d.ts +14 -0
  160. package/dist/testing/load.js +44 -0
  161. package/dist/testing/reference.d.ts +11 -0
  162. package/dist/testing/reference.js +19 -0
  163. package/dist/testing/tests.d.ts +12 -0
  164. package/dist/testing/tests.js +31 -0
  165. package/dist/tooling/cli/arguments.d.ts +7 -4
  166. package/dist/tooling/cli/arguments.js +82 -107
  167. package/dist/tooling/cli/astrale/authority.d.ts +5 -0
  168. package/dist/tooling/cli/astrale/authority.js +11 -0
  169. package/dist/tooling/cli/astrale/executable.d.ts +2 -0
  170. package/dist/tooling/cli/astrale/executable.js +47 -0
  171. package/dist/tooling/cli/astrale/failure.d.ts +6 -0
  172. package/dist/tooling/cli/astrale/failure.js +48 -0
  173. package/dist/tooling/cli/astrale/instance.d.ts +11 -0
  174. package/dist/tooling/cli/astrale/instance.js +52 -0
  175. package/dist/tooling/cli/astrale/process.d.ts +13 -0
  176. package/dist/tooling/cli/astrale/process.js +94 -0
  177. package/dist/tooling/cli/astrale/version.d.ts +18 -0
  178. package/dist/tooling/cli/astrale/version.js +55 -0
  179. package/dist/tooling/cli/bun.js +1 -1
  180. package/dist/tooling/cli/credential.d.ts +2 -0
  181. package/dist/tooling/cli/credential.js +57 -0
  182. package/dist/tooling/cli/deprecations.d.ts +9 -0
  183. package/dist/tooling/cli/deprecations.js +15 -0
  184. package/dist/tooling/cli/development/candidate.d.ts +25 -0
  185. package/dist/tooling/cli/development/candidate.js +176 -0
  186. package/dist/tooling/cli/development/deployment.d.ts +16 -0
  187. package/dist/tooling/cli/development/deployment.js +39 -0
  188. package/dist/tooling/cli/development/develop.d.ts +4 -3
  189. package/dist/tooling/cli/development/develop.js +129 -290
  190. package/dist/tooling/cli/development/lease.d.ts +18 -0
  191. package/dist/tooling/cli/development/lease.js +163 -0
  192. package/dist/tooling/cli/development/lifecycle.js +4 -0
  193. package/dist/tooling/cli/development/project-imports.d.ts +22 -0
  194. package/dist/tooling/cli/development/project-imports.js +39 -0
  195. package/dist/tooling/cli/development/project-lock.d.ts +3 -4
  196. package/dist/tooling/cli/development/project-lock.js +14 -166
  197. package/dist/tooling/cli/development/release-evidence.d.ts +4 -0
  198. package/dist/tooling/cli/development/release-evidence.js +10 -0
  199. package/dist/tooling/cli/development/report.d.ts +6 -0
  200. package/dist/tooling/cli/development/report.js +14 -0
  201. package/dist/tooling/cli/development/source-watch.js +53 -5
  202. package/dist/tooling/cli/development/sources.d.ts +7 -0
  203. package/dist/tooling/cli/development/sources.js +48 -0
  204. package/dist/tooling/cli/development/target-lock.d.ts +16 -0
  205. package/dist/tooling/cli/development/target-lock.js +68 -0
  206. package/dist/tooling/cli/development/view.d.ts +28 -0
  207. package/dist/tooling/cli/development/view.js +151 -0
  208. package/dist/tooling/cli/environment-release.d.ts +21 -0
  209. package/dist/tooling/cli/environment-release.js +46 -0
  210. package/dist/tooling/cli/evidence.d.ts +11 -0
  211. package/dist/tooling/cli/evidence.js +53 -0
  212. package/dist/tooling/cli/help.js +78 -34
  213. package/dist/tooling/cli/index.d.ts +1 -1
  214. package/dist/tooling/cli/index.js +1 -1
  215. package/dist/tooling/cli/installation/index.d.ts +2 -0
  216. package/dist/tooling/cli/installation/index.js +1 -0
  217. package/dist/tooling/cli/installation/observation.d.ts +10 -0
  218. package/dist/tooling/cli/installation/observation.js +44 -0
  219. package/dist/tooling/cli/installation/reconcile.d.ts +32 -0
  220. package/dist/tooling/cli/installation/reconcile.js +122 -0
  221. package/dist/tooling/cli/orchestrate.js +88 -45
  222. package/dist/tooling/cli/project.d.ts +17 -0
  223. package/dist/tooling/cli/project.js +18 -0
  224. package/dist/tooling/cli/test.d.ts +12 -0
  225. package/dist/tooling/cli/test.js +47 -0
  226. package/dist/tooling/cli/upgrade/index.d.ts +6 -0
  227. package/dist/tooling/cli/upgrade/index.js +115 -0
  228. package/dist/tooling/cli/upgrade/manifest.d.ts +18 -0
  229. package/dist/tooling/cli/upgrade/manifest.js +77 -0
  230. package/dist/tooling/cli/upgrade/process.d.ts +2 -0
  231. package/dist/tooling/cli/upgrade/process.js +57 -0
  232. package/dist/tooling/linter/adapters/typescript/imports.js +2 -0
  233. package/dist/tooling/linter/adapters/typescript/index.d.ts +1 -0
  234. package/dist/tooling/linter/adapters/typescript/index.js +1 -0
  235. package/dist/tooling/linter/adapters/typescript/query-collection-type.js +4 -51
  236. package/dist/tooling/linter/adapters/typescript/type-analysis.d.ts +9 -0
  237. package/dist/tooling/linter/adapters/typescript/type-analysis.js +55 -0
  238. package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +28 -0
  239. package/dist/tooling/linter/implementations/source/callable-requirements.js +234 -0
  240. package/dist/tooling/linter/implementations/source/dependencies.d.ts +2 -0
  241. package/dist/tooling/linter/implementations/source/dependencies.js +219 -0
  242. package/dist/tooling/linter/implementations/source/global.js +52 -2
  243. package/dist/tooling/linter/implementations/source/mutations.js +520 -38
  244. package/dist/tooling/linter/implementations/source/providers.js +19 -164
  245. package/dist/tooling/linter/implementations/source/schema.js +454 -2
  246. package/dist/tooling/linter/implementations/source/verifiers.js +2 -0
  247. package/dist/tooling/linter/implementations/source/workflows.js +8 -35
  248. package/dist/tooling/linter/policy/generated.js +2 -2
  249. package/dist/tooling/linter/requirements/registry.js +9 -3
  250. package/dist/tooling/packaging/declarations/normalize.js +3 -38
  251. package/dist/tooling/packaging/declarations/paths.d.ts +5 -0
  252. package/dist/tooling/packaging/declarations/paths.js +38 -0
  253. package/dist/tooling/packaging/finalize.d.ts +13 -0
  254. package/dist/tooling/packaging/finalize.js +62 -0
  255. package/dist/tooling/packaging/index.d.ts +2 -0
  256. package/dist/tooling/packaging/index.js +1 -0
  257. package/dist/tooling/packaging/javascript.d.ts +3 -0
  258. package/dist/tooling/packaging/javascript.js +45 -2
  259. package/dist/tooling/packaging/packaging.d.ts +2 -5
  260. package/dist/tooling/packaging/packaging.js +6 -30
  261. package/package.json +42 -12
  262. package/CHANGELOG.md +0 -1506
  263. package/dist/deployment/adapter/development/context.d.ts +0 -18
  264. package/dist/deployment/adapter/development/index.d.ts +0 -4
  265. package/dist/deployment/adapter/development/input.d.ts +0 -6
  266. package/dist/deployment/adapter/development/placement.d.ts +0 -15
  267. package/dist/deployment/adapter/development/session.d.ts +0 -9
  268. /package/dist/{deployment/adapter/development → application/dependency}/index.js +0 -0
  269. /package/dist/{deployment/adapter/development/context.js → application/dependency/invoker.js} +0 -0
  270. /package/dist/{deployment/adapter/development/input.js → application/integration/authentication.js} +0 -0
  271. /package/dist/{deployment/adapter/development/placement.js → application/integration/authentication.typecheck.d.ts} +0 -0
  272. /package/dist/{deployment/adapter/development/session.js → application/runtime/declarations.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { LocalBinding } from '@astrale-os/kernel-core/graph/graph';
2
1
  import { ClassKey } from '@astrale-os/kernel-dsl/v1/addressing';
2
+ import { LocalAlias } from '../../../platform/graph/alias.js';
3
3
  import { endpoint, existingEndpoint } from './endpoint.js';
4
4
  import { precondition } from './precondition.js';
5
5
  import { conditions, delta, properties } from './properties.js';
@@ -33,7 +33,7 @@ export function richMutationBuilder(core) {
33
33
  expect: expectation,
34
34
  createNode(input) {
35
35
  const created = core.createNode({
36
- as: LocalBinding(input.as),
36
+ as: LocalAlias(input.as),
37
37
  class: classKey(input.class),
38
38
  ...(input.props === undefined ? {} : { props: properties(input.class, input.props) }),
39
39
  });
@@ -1,9 +1,9 @@
1
- import type { LocalBinding } from '@astrale-os/kernel-core/graph/graph';
2
1
  import type { NodeId } from '@astrale-os/kernel-core/graph/node';
3
2
  import type { NodeTarget } from '@astrale-os/kernel-core/path';
4
3
  import type { ResolvedClass } from '@astrale-os/kernel-dsl/v1';
4
+ import type { LocalAlias } from '../../../platform/graph/alias.js';
5
5
  export interface CreatedNode<Class extends ResolvedClass<'node'> = ResolvedClass<'node'>> {
6
- readonly created: LocalBinding;
6
+ readonly created: LocalAlias;
7
7
  readonly class: Class;
8
8
  }
9
9
  export type ExistingEndpoint = NodeTarget | Readonly<{
@@ -11,6 +11,6 @@ export type ExistingEndpoint = NodeTarget | Readonly<{
11
11
  }>;
12
12
  export type MutationEndpoint = ExistingEndpoint | CreatedNode;
13
13
  export declare function endpoint(input: MutationEndpoint): NodeTarget | {
14
- readonly created: LocalBinding;
14
+ readonly created: LocalAlias;
15
15
  };
16
16
  export declare function existingEndpoint(input: ExistingEndpoint): NodeTarget;
@@ -1,13 +1,22 @@
1
1
  export function endpoint(input) {
2
+ if (isDefinitionRefCandidate(input))
3
+ return input;
2
4
  if (isCreated(input))
3
5
  return Object.freeze({ created: input.created });
4
6
  return existingEndpoint(input);
5
7
  }
6
8
  export function existingEndpoint(input) {
9
+ if (isDefinitionRefCandidate(input))
10
+ return input;
7
11
  return typeof input === 'object' && input !== null && 'id' in input
8
12
  ? input.id
9
13
  : input;
10
14
  }
15
+ // Keep DefinitionRef candidates intact for Kernel admission: an extra id/created
16
+ // field must not silently redirect the operation to a different Node.
17
+ function isDefinitionRefCandidate(input) {
18
+ return typeof input === 'object' && input !== null && 'kind' in input;
19
+ }
11
20
  function isCreated(input) {
12
21
  return typeof input === 'object' && input !== null && 'created' in input;
13
22
  }
@@ -26,9 +26,9 @@ export function mutationFailure(input) {
26
26
  const event = Reflect.get(input, 'event');
27
27
  if (typeof from !== 'string' || typeof event !== 'string' || explicit === false)
28
28
  return undefined;
29
- return Object.assign(input, { code, outcomeKnown: true, from, event });
29
+ return input;
30
30
  }
31
- return Object.assign(input, {
31
+ return Object.assign(new Error(input.message, { cause: input }), {
32
32
  code,
33
33
  outcomeKnown: explicit !== false && !UNKNOWN_OUTCOME_CODES.has(code),
34
34
  });
@@ -37,15 +37,21 @@ function mutationCode(input) {
37
37
  const value = input;
38
38
  if (value.code === 'STATE_TRANSITION_ILLEGAL')
39
39
  return value.code;
40
- for (const candidate of [value.code, nestedCode(value.reason), nestedCode(value.data)]) {
40
+ for (const candidate of [
41
+ value.code,
42
+ directOrNestedCode(value.reason),
43
+ directOrNestedCode(value.data),
44
+ ]) {
41
45
  if (typeof candidate === 'string' && candidate.startsWith('MUTATION_')) {
42
46
  return candidate;
43
47
  }
44
48
  }
45
49
  return undefined;
46
50
  }
47
- function nestedCode(input) {
48
- return input !== null && typeof input === 'object' && !Array.isArray(input)
49
- ? Reflect.get(input, 'code')
50
- : undefined;
51
+ function directOrNestedCode(input) {
52
+ return typeof input === 'string'
53
+ ? input
54
+ : input !== null && typeof input === 'object' && !Array.isArray(input)
55
+ ? Reflect.get(input, 'code')
56
+ : undefined;
51
57
  }
@@ -5,3 +5,4 @@ export type { Mutation, MutationDefinition, MutationInputOf, MutationOutputOf }
5
5
  export type { CreatedNode, EdgeSelector, ExistingEndpoint, MutationEndpoint, QueryPrecondition, RichMutationBuilder, RichPropertyConditions, RichPropertyDelta, RichPropertyInput, RichPropertyName, } from './authoring/index.js';
6
6
  /** Canonical low-level Mutation documents remain available as the explicit escape hatch. */
7
7
  export * from '@astrale-os/kernel-core/graph/mutate';
8
+ export type { LocalAlias, LocalBinding } from '../../platform/graph/alias.js';
@@ -2,11 +2,13 @@ import type { ResolvedCoreDefinition } from '../../platform/schema/index.js';
2
2
  import type { AuthorityRequirementsInput } from './authority.js';
3
3
  import type { ClassRequirementInput } from './classes.js';
4
4
  import type { FunctionRequirementTarget } from './functions.js';
5
- import type { CapabilityProfileRequirement } from './requirement.js';
6
- export interface CapabilityProfileRequirementInput {
5
+ import type { CoreRequirement } from './requirement.js';
6
+ /** Capabilities assigned to one installation-owned local Core Identity. */
7
+ export interface CoreRequirementInput {
7
8
  readonly subject: Pick<ResolvedCoreDefinition, 'ref'>;
9
+ /** Exact executable local callables or direct dependency callables; does not bypass Policies. */
8
10
  readonly functions?: readonly FunctionRequirementTarget[];
9
11
  readonly classes?: readonly ClassRequirementInput[];
10
12
  readonly authority?: AuthorityRequirementsInput;
11
13
  }
12
- export declare function captureProfiles(input: readonly CapabilityProfileRequirementInput[] | undefined): readonly CapabilityProfileRequirement[];
14
+ export declare function captureCore(input: readonly CoreRequirementInput[] | undefined): readonly CoreRequirement[];
@@ -2,12 +2,12 @@ import { acceptDefinitionRef, Key } from '../../platform/schema/index.js';
2
2
  import { captureAuthority } from './authority.js';
3
3
  import { captureClasses } from './classes.js';
4
4
  import { captureFunctions } from './functions.js';
5
- export function captureProfiles(input) {
5
+ export function captureCore(input) {
6
6
  if (input === undefined)
7
7
  return Object.freeze([]);
8
8
  if (!Array.isArray(input))
9
- throw new TypeError('Requirement profiles must be an array.');
10
- const profiles = input.map((entry) => {
9
+ throw new TypeError('Core requirements must be an array.');
10
+ const core = input.map((entry) => {
11
11
  if (entry === null || typeof entry !== 'object' || Array.isArray(entry))
12
12
  invalid();
13
13
  if (Reflect.ownKeys(entry).some((key) => key !== 'subject' && key !== 'functions' && key !== 'classes' && key !== 'authority')) {
@@ -29,12 +29,12 @@ export function captureProfiles(input) {
29
29
  ...(authority === undefined ? {} : { authority }),
30
30
  });
31
31
  });
32
- if (new Set(profiles.map(({ subject }) => Key.of(subject))).size !== profiles.length)
32
+ if (new Set(core.map(({ subject }) => Key.of(subject))).size !== core.length)
33
33
  invalid();
34
- return Object.freeze([...profiles].sort((left, right) => compare(Key.of(left.subject), Key.of(right.subject))));
34
+ return Object.freeze([...core].sort((left, right) => compare(Key.of(left.subject), Key.of(right.subject))));
35
35
  }
36
36
  function invalid() {
37
- throw new TypeError('Capability profile requirement is invalid.');
37
+ throw new TypeError('Core capability requirement is invalid.');
38
38
  }
39
39
  function compare(left, right) {
40
40
  return left < right ? -1 : left > right ? 1 : 0;
@@ -1,18 +1,18 @@
1
1
  import type { AuthorityRequirementsInput } from './authority.js';
2
2
  import type { ClassRequirementInput } from './classes.js';
3
+ import type { CoreRequirementInput } from './core.js';
3
4
  import type { FunctionRequirementTarget } from './functions.js';
4
- import type { CapabilityProfileRequirementInput } from './profiles.js';
5
5
  import type { Requirements } from './requirement.js';
6
- export type { AuthorityRequirements, CapabilityProfileRequirement, ClassRequirement, Requirements, } from './requirement.js';
6
+ export type { AuthorityRequirements, CoreRequirement, ClassRequirement, Requirements, } from './requirement.js';
7
7
  export { ClassOperationOrder, type ClassOperation, type ClassRequirementInput } from './classes.js';
8
8
  export type { FunctionRequirementTarget } from './functions.js';
9
9
  export type { AuthorityRequirementsInput } from './authority.js';
10
- export type { CapabilityProfileRequirementInput } from './profiles.js';
10
+ export type { CoreRequirementInput } from './core.js';
11
11
  export interface RequirementsInput {
12
12
  readonly functions?: readonly FunctionRequirementTarget[];
13
13
  readonly classes?: readonly ClassRequirementInput[];
14
14
  readonly authority?: AuthorityRequirementsInput;
15
- readonly profiles?: readonly CapabilityProfileRequirementInput[];
15
+ readonly core?: readonly CoreRequirementInput[];
16
16
  }
17
17
  /** Capture canonical dependency requirements; Build proves the pinned dependency closure. */
18
18
  export declare function requirements(input?: RequirementsInput): Requirements;
@@ -1,24 +1,24 @@
1
1
  import { captureAuthority } from './authority.js';
2
2
  import { captureClasses } from './classes.js';
3
+ import { captureCore } from './core.js';
3
4
  import { captureFunctions } from './functions.js';
4
- import { captureProfiles } from './profiles.js';
5
5
  export { ClassOperationOrder } from './classes.js';
6
6
  const admittedRequirements = new WeakSet();
7
7
  /** Capture canonical dependency requirements; Build proves the pinned dependency closure. */
8
8
  export function requirements(input = {}) {
9
9
  if (input === null || typeof input !== 'object' || Array.isArray(input))
10
10
  invalid();
11
- if (Reflect.ownKeys(input).some((key) => key !== 'functions' && key !== 'classes' && key !== 'authority' && key !== 'profiles')) {
11
+ if (Reflect.ownKeys(input).some((key) => key !== 'functions' && key !== 'classes' && key !== 'authority' && key !== 'core')) {
12
12
  invalid();
13
13
  }
14
14
  const functions = captureFunctions(input.functions);
15
15
  const classes = captureClasses(input.classes);
16
16
  const authority = captureAuthority(input.authority);
17
- const profiles = captureProfiles(input.profiles);
17
+ const core = captureCore(input.core);
18
18
  const value = Object.freeze({
19
19
  functions,
20
20
  classes,
21
- profiles,
21
+ core,
22
22
  ...(authority === undefined ? {} : { authority }),
23
23
  });
24
24
  admittedRequirements.add(value);
@@ -28,5 +28,5 @@ export function isRequirements(input) {
28
28
  return input !== null && typeof input === 'object' && admittedRequirements.has(input);
29
29
  }
30
30
  function invalid() {
31
- throw new TypeError('Requirements definition may contain only functions, classes, authority, and profiles.');
31
+ throw new TypeError('Requirements definition may contain only functions, classes, authority, and core.');
32
32
  }
@@ -14,9 +14,10 @@ export interface Requirements {
14
14
  readonly functions: readonly Key.Callable[];
15
15
  readonly classes: readonly ClassRequirement[];
16
16
  readonly authority?: AuthorityRequirements;
17
- readonly profiles: readonly CapabilityProfileRequirement[];
17
+ readonly core: readonly CoreRequirement[];
18
18
  }
19
- export interface CapabilityProfileRequirement {
19
+ /** Capabilities assigned at installation to one Identity declared in the local Core. */
20
+ export interface CoreRequirement {
20
21
  readonly subject: CoreRef;
21
22
  readonly functions: readonly Key.Callable[];
22
23
  readonly classes: readonly ClassRequirement[];
@@ -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';
@@ -12,11 +12,11 @@ export function runtimeCallables(domain) {
12
12
  if (selected.kind !== 'node')
13
13
  continue;
14
14
  for (const callable of selected.self.methods) {
15
- if (callable.inheritance !== 'abstract')
15
+ if (callable.executable)
16
16
  append(callable);
17
17
  }
18
18
  for (const callable of selected.self.static.methods) {
19
- if (callable.inheritance !== 'abstract')
19
+ if (callable.executable)
20
20
  append(callable);
21
21
  }
22
22
  }
@@ -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 {};
@@ -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>) => Runtime<Schema, Integrations, Initialize, Functions>;
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,6 +1,6 @@
1
1
  export { isFrontend } from './admission.js';
2
2
  export { defineFrontend } from './define.js';
3
3
  export type { Frontend, FrontendInput, FrontendRouteInputs, FrontendRoutes, ViewName, } from './frontend.js';
4
- export type { FrontendHandshake, FrontendRoute, FrontendRouteInput, IframeRequirements, } from './route.js';
4
+ export type { FrontendHandshake, FrontendRoute, FrontendRouteInput, IframeRequirements, ViewHostRequirements, } from './route.js';
5
5
  export { external, isFrontendSource, vite } from './source.js';
6
6
  export type { ExternalSource, FrontendSource, ViteSource } from './source.js';
@@ -1,4 +1,10 @@
1
+ import { type ViewHostRequirements } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
2
+ export type { ViewHostRequirements } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
1
3
  export type FrontendHandshake = 'shell' | 'none';
4
+ /**
5
+ * @deprecated Every trusted View receives the Shell's shared browser profile: requirements within
6
+ * it are redundant, and Astrale hosts refuse any beyond it. Declare none.
7
+ */
2
8
  export interface IframeRequirements {
3
9
  readonly sandbox?: readonly string[];
4
10
  readonly allow?: readonly string[];
@@ -7,13 +13,19 @@ export type FrontendRouteInput = string | {
7
13
  readonly path?: string;
8
14
  readonly document?: string;
9
15
  readonly handshake?: FrontendHandshake;
16
+ /**
17
+ * @deprecated Every trusted View receives the Shell's shared browser profile: requirements
18
+ * within it are redundant, and Astrale hosts refuse any beyond it. Remove this field.
19
+ */
10
20
  readonly iframe?: IframeRequirements;
21
+ readonly host?: ViewHostRequirements;
11
22
  };
12
23
  export interface FrontendRoute {
13
24
  readonly path: string;
14
25
  readonly document: string;
15
26
  readonly handshake: FrontendHandshake;
16
27
  readonly iframe?: IframeRequirements;
28
+ readonly host?: ViewHostRequirements;
17
29
  }
18
30
  export declare function normalizeRoute(input: FrontendRouteInput | undefined, fallback: string): FrontendRoute;
19
31
  export declare function defaultRoute(name: string): string;
@@ -1,3 +1,4 @@
1
+ import { acceptViewHostRequirements, } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
1
2
  const TOKEN = /^[a-z][a-z0-9-]*$/u;
2
3
  const BASELINES = Object.freeze({
3
4
  none: iframeRequirements(['allow-scripts'], []),
@@ -8,7 +9,8 @@ export function normalizeRoute(input, fallback) {
8
9
  return Object.freeze({ path: routePath(input), document: 'index.html', handshake: 'shell' });
9
10
  }
10
11
  const value = plainRecord(input ?? {});
11
- if (Reflect.ownKeys(value).some((key) => typeof key !== 'string' || !['path', 'document', 'handshake', 'iframe'].includes(key))) {
12
+ if (Reflect.ownKeys(value).some((key) => typeof key !== 'string' ||
13
+ !['path', 'document', 'handshake', 'iframe', 'host'].includes(key))) {
12
14
  invalid();
13
15
  }
14
16
  const authoredHandshake = dataValue(value, 'handshake');
@@ -19,11 +21,13 @@ export function normalizeRoute(input, fallback) {
19
21
  }
20
22
  const handshake = authoredHandshake ?? 'shell';
21
23
  const iframe = normalizeIframeRequirements(dataValue(value, 'iframe'), handshake);
24
+ const host = acceptViewHostRequirements(dataValue(value, 'host'), handshake, true);
22
25
  return Object.freeze({
23
26
  path: routePath(dataValue(value, 'path') ?? fallback),
24
27
  document: filePath(dataValue(value, 'document') ?? 'index.html'),
25
28
  handshake,
26
29
  ...(iframe === undefined ? {} : { iframe }),
30
+ ...(host === undefined ? {} : { host }),
27
31
  });
28
32
  }
29
33
  function normalizeIframeRequirements(input, handshake) {
@@ -1,3 +1,4 @@
1
1
  export { defineWorkflow } from './define.js';
2
2
  export type { WorkflowContext } from './context.js';
3
3
  export type { Workflow, WorkflowAddress, WorkflowDefinition } from './workflow.js';
4
+ export type { DeclaredErrorDefinition, DeclaredErrorFactory, DeclaredErrorFamily, DeclaredErrorOptions, DeclaredErrors, } from '../error/index.js';
@@ -1,8 +1,9 @@
1
1
  import type { Domain } from '../../platform/schema/index.js';
2
2
  import type { ActionContext, ResolvedCallable } from '../action/index.js';
3
+ import type { DeclaredErrors, NoDeclaredErrors } from '../error/index.js';
3
4
  import type { Integrations } from '../integration/index.js';
4
5
  import type { WorkflowStep } from './step/index.js';
5
6
  /** Exact multi-step Workflow context for one authenticated value-output callable. */
6
- export type WorkflowContext<Callable extends ResolvedCallable, DomainValue extends Domain = Domain, Definitions extends Integrations = Readonly<Record<never, never>>> = ActionContext<Callable, DomainValue, Definitions> & {
7
+ export type WorkflowContext<Callable extends ResolvedCallable, DomainValue extends Domain = Domain, Definitions extends Integrations = Readonly<Record<never, never>>, Errors extends DeclaredErrors = NoDeclaredErrors> = ActionContext<Callable, DomainValue, Definitions, Errors> & {
7
8
  readonly step: WorkflowStep;
8
9
  };
@@ -1,7 +1,11 @@
1
1
  import type { schema } from '../../platform/schema/index.js';
2
2
  import type { ResolvedDomainOf } from '../action/index.js';
3
+ import type { DeclaredErrorOptions, DeclaredErrors, NoDeclaredErrors } from '../error/index.js';
3
4
  import type { Integrations } from '../integration/index.js';
4
5
  import type { CallableAtWorkflowAddress, Workflow, WorkflowAddress, WorkflowDefinition } from './workflow.js';
5
6
  /** Define one authenticated multi-step value-output implementation by its SDK Action address. */
6
- export declare function defineWorkflow<Schema extends schema.DomainSchema, Definitions extends Integrations = Readonly<Record<never, never>>>(): <const Address extends WorkflowAddress<Schema>>(address: Address, run: Workflow<CallableAtWorkflowAddress<Schema, Address>, Definitions, ResolvedDomainOf<Schema>>) => WorkflowDefinition<Schema, Address, Definitions>;
7
+ export declare function defineWorkflow<Schema extends schema.DomainSchema, Definitions extends Integrations = Readonly<Record<never, never>>>(): {
8
+ <const Address extends WorkflowAddress<Schema>>(address: Address, run: Workflow<CallableAtWorkflowAddress<Schema, Address>, Definitions, ResolvedDomainOf<Schema>, NoDeclaredErrors>): WorkflowDefinition<Schema, Address, Definitions, NoDeclaredErrors>;
9
+ <const Address extends WorkflowAddress<Schema>, const Errors extends DeclaredErrors>(address: Address, options: DeclaredErrorOptions<Errors>, run: Workflow<CallableAtWorkflowAddress<Schema, Address>, Definitions, ResolvedDomainOf<Schema>, Errors>): WorkflowDefinition<Schema, Address, Definitions, Errors>;
10
+ };
7
11
  export declare function isWorkflow(input: unknown): input is WorkflowDefinition;
@@ -1,9 +1,12 @@
1
1
  import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
2
+ import { rememberDeclaredErrors } from '../error/index.js';
2
3
  const admittedWorkflows = new WeakSet();
3
4
  /** Define one authenticated multi-step value-output implementation by its SDK Action address. */
4
5
  export function defineWorkflow() {
5
- return function define(address, run) {
6
+ return function define(address, optionsOrRun, possibleRun) {
6
7
  acceptWorkflowAddress(address);
8
+ const options = possibleRun === undefined ? undefined : optionsOrRun;
9
+ const run = possibleRun ?? optionsOrRun;
7
10
  if (typeof run !== 'function')
8
11
  throw new TypeError('Workflow run must be a function.');
9
12
  const workflow = Object.freeze({
@@ -11,6 +14,8 @@ export function defineWorkflow() {
11
14
  address,
12
15
  run,
13
16
  });
17
+ if (options !== undefined)
18
+ rememberDeclaredErrors(workflow, options);
14
19
  admittedWorkflows.add(workflow);
15
20
  return workflow;
16
21
  };
@@ -3,3 +3,4 @@ export type { WorkflowContext } from './context.js';
3
3
  export type { CallableAtWorkflowAddress, Workflow, WorkflowAddress, WorkflowCallable, WorkflowDefinition, } from './workflow.js';
4
4
  export * as step from './step/index.js';
5
5
  export * as runner from './runner/index.js';
6
+ export type { DeclaredErrorDefinition, DeclaredErrorFactory, DeclaredErrorFamily, DeclaredErrorOptions, DeclaredErrors, } from '../error/index.js';
@@ -1,9 +1,10 @@
1
1
  import type { Domain, schema } from '../../../platform/schema/index.js';
2
2
  import type { ActionOutputOf, ResolvedCallable, ResolvedDomainOf } from '../../action/index.js';
3
+ import type { DeclaredErrors, NoDeclaredErrors } from '../../error/index.js';
3
4
  import type { Integrations } from '../../integration/index.js';
4
5
  import type { WorkflowContext } from '../context.js';
5
6
  import type { CallableAtWorkflowAddress, WorkflowAddress, WorkflowDefinition } from '../workflow.js';
6
- export type WorkflowExecutionContext<Callable extends ResolvedCallable, Definitions extends Integrations, DomainValue extends Domain = Domain> = Omit<WorkflowContext<Callable, DomainValue, Definitions>, 'step'>;
7
+ export type WorkflowExecutionContext<Callable extends ResolvedCallable, Definitions extends Integrations, DomainValue extends Domain = Domain, Errors extends DeclaredErrors = NoDeclaredErrors> = Omit<WorkflowContext<Callable, DomainValue, Definitions, Errors>, 'step'>;
7
8
  export interface WorkflowRunner {
8
- run<Schema extends schema.DomainSchema, Address extends WorkflowAddress<Schema>, Definitions extends Integrations, Callable extends CallableAtWorkflowAddress<Schema, Address> = CallableAtWorkflowAddress<Schema, Address>>(workflow: WorkflowDefinition<Schema, Address, Definitions>, context: WorkflowExecutionContext<Callable, Definitions, ResolvedDomainOf<Schema>>): Promise<ActionOutputOf<Callable>>;
9
+ run<Schema extends schema.DomainSchema, Address extends WorkflowAddress<Schema>, Definitions extends Integrations, Errors extends DeclaredErrors, Callable extends CallableAtWorkflowAddress<Schema, Address> = CallableAtWorkflowAddress<Schema, Address>>(workflow: WorkflowDefinition<Schema, Address, Definitions, Errors>, context: WorkflowExecutionContext<Callable, Definitions, ResolvedDomainOf<Schema>, Errors>): Promise<ActionOutputOf<Callable>>;
9
10
  }
@@ -1,5 +1,6 @@
1
1
  import type { CallableOutputOf, Domain, schema } from '../../platform/schema/index.js';
2
2
  import type { ActionAddressOf, ActionOutputOf, CallableAtAddress, LocalCallable, ResolvedCallable, ResolvedDomainOf } from '../action/index.js';
3
+ import type { DeclaredErrors, NoDeclaredErrors } from '../error/index.js';
3
4
  import type { Integrations } from '../integration/index.js';
4
5
  import type { WorkflowContext } from './context.js';
5
6
  export type WorkflowCallable<Callable> = Callable extends ResolvedCallable ? Callable extends {
@@ -9,13 +10,13 @@ export type WorkflowCallable<Callable> = Callable extends ResolvedCallable ? Cal
9
10
  } ? Callable : never : never;
10
11
  export type WorkflowAddress<Schema extends schema.DomainSchema> = ActionAddressOf<WorkflowCallable<LocalCallable<ResolvedDomainOf<Schema>>>>;
11
12
  export type CallableAtWorkflowAddress<Schema extends schema.DomainSchema, Address extends WorkflowAddress<Schema>> = WorkflowCallable<Extract<CallableAtAddress<Schema, Address>, ResolvedCallable>>;
12
- export type Workflow<Callable extends ResolvedCallable, Definitions extends Integrations = Readonly<Record<never, never>>, DomainValue extends Domain = Domain> = (context: WorkflowContext<Callable, DomainValue, Definitions>) => Promise<ActionOutputOf<Callable>>;
13
+ export type Workflow<Callable extends ResolvedCallable, Definitions extends Integrations = Readonly<Record<never, never>>, DomainValue extends Domain = Domain, Errors extends DeclaredErrors = NoDeclaredErrors> = (context: WorkflowContext<Callable, DomainValue, Definitions, Errors>) => Promise<ActionOutputOf<Callable>>;
13
14
  declare const WORKFLOW_SCHEMA: unique symbol;
14
15
  /** Sealed multi-step Workflow awaiting canonical callable association by Runtime admission. */
15
- export interface WorkflowDefinition<Schema extends schema.DomainSchema = schema.DomainSchema, Address extends WorkflowAddress<Schema> = WorkflowAddress<Schema>, Definitions extends Integrations = Readonly<Record<never, never>>> {
16
+ export interface WorkflowDefinition<Schema extends schema.DomainSchema = schema.DomainSchema, Address extends WorkflowAddress<Schema> = WorkflowAddress<Schema>, Definitions extends Integrations = Readonly<Record<never, never>>, Errors extends DeclaredErrors = NoDeclaredErrors> {
16
17
  readonly kind: 'workflow';
17
18
  readonly address: Address;
18
- readonly run: Workflow<CallableAtWorkflowAddress<Schema, Address>, Definitions, ResolvedDomainOf<Schema>>;
19
+ readonly run: Workflow<CallableAtWorkflowAddress<Schema, Address>, Definitions, ResolvedDomainOf<Schema>, Errors>;
19
20
  /** Invariant type-only Schema witness; absent from emitted JavaScript. */
20
21
  readonly [WORKFLOW_SCHEMA]: (schema: Schema) => Schema;
21
22
  }
@@ -1,22 +1,27 @@
1
1
  import type { DeployContext, DeployResult } from './deploy/index.js';
2
- import type { DevelopmentContext, DevelopmentSession } from './development/index.js';
3
2
  import type { ArtifactSource, PrepareContext } from './prepare/index.js';
4
- export interface Adapter<Parameters = unknown> {
3
+ export interface InstallationTarget {
4
+ readonly instance: string;
5
+ readonly identity?: string;
6
+ }
7
+ export interface AdapterEnvironmentContext {
8
+ readonly environment: string;
9
+ readonly installation?: InstallationTarget;
10
+ }
11
+ export interface Adapter<Parameters extends object = object> {
5
12
  readonly kind: 'adapter';
6
13
  readonly name: string;
7
14
  readonly version: string;
8
- parameters(environment: string): Parameters;
15
+ admit?(parameters: Parameters, context: AdapterEnvironmentContext): void;
9
16
  prepare(parameters: Parameters, context: PrepareContext): Promise<ArtifactSource>;
10
- develop(parameters: Parameters, context: DevelopmentContext): Promise<DevelopmentSession>;
11
17
  deploy(parameters: Parameters, context: DeployContext): Promise<DeployResult>;
12
18
  readonly secretsFile?: (parameters: Parameters) => string | undefined;
13
19
  }
14
- export interface AdapterInput<Parameters> {
20
+ export interface AdapterInput<Parameters extends object> {
15
21
  readonly name: string;
16
22
  readonly version: string;
17
- readonly environments: Readonly<Record<string, Parameters>>;
23
+ admit?(parameters: Parameters, context: AdapterEnvironmentContext): void;
18
24
  prepare(parameters: Parameters, context: PrepareContext): Promise<ArtifactSource>;
19
- develop(parameters: Parameters, context: DevelopmentContext): Promise<DevelopmentSession>;
20
25
  deploy(parameters: Parameters, context: DeployContext): Promise<DeployResult>;
21
26
  readonly secretsFile?: (parameters: Parameters) => string | undefined;
22
27
  }
@@ -1,4 +1,7 @@
1
+ import type { Deployment } from '../deployment.js';
1
2
  import type { Adapter, AdapterInput } from './adapter.js';
2
- /** Capture one receiver-bound provider adapter and its environment parameters. */
3
- export declare function defineAdapter<Parameters>(input: AdapterInput<Parameters>): Adapter<Parameters>;
3
+ /** Capture one receiver-bound provider adapter. */
4
+ export declare function defineAdapter<Parameters extends object>(input: AdapterInput<Parameters>): Adapter<Parameters>;
5
+ /** Bind one provider adapter to the parameters of one Project Environment. */
6
+ export declare function defineDeployment<const Parameters extends object>(adapter: Adapter<Parameters>, parameters: Parameters): Deployment<Parameters>;
4
7
  export declare function isAdapter(input: unknown): input is Adapter;
@@ -1,39 +1,37 @@
1
+ import { captureDeployment } from '../deployment.js';
1
2
  const admittedAdapters = new WeakSet();
2
- /** Capture one receiver-bound provider adapter and its environment parameters. */
3
+ /** Capture one receiver-bound provider adapter. */
3
4
  export function defineAdapter(input) {
4
5
  const value = record(input, 'Adapter definition');
5
- exact(value, ['name', 'version', 'environments', 'prepare', 'develop', 'deploy'], ['secretsFile']);
6
+ exact(value, ['name', 'version', 'prepare', 'deploy'], ['admit', 'secretsFile']);
6
7
  const name = stableName(input.name);
7
8
  const version = stableName(input.version);
8
- const environments = record(input.environments, 'Adapter environments');
9
- if (Reflect.ownKeys(environments).some((key) => typeof key !== 'string')) {
10
- throw new TypeError('Adapter environment names must be strings.');
11
- }
12
- const capturedEnvironments = Object.freeze({ ...environments });
13
- const names = Object.keys(capturedEnvironments).sort();
14
- const receiver = Object.freeze({ ...input, environments: capturedEnvironments });
9
+ const receiver = Object.freeze({ ...input });
10
+ const admit = optional(receiver, 'admit');
15
11
  const prepare = capture(receiver, 'prepare');
16
- const develop = capture(receiver, 'develop');
17
12
  const deploy = capture(receiver, 'deploy');
18
13
  const secretsFile = optional(receiver, 'secretsFile');
19
14
  const adapter = Object.freeze({
20
15
  kind: 'adapter',
21
16
  name,
22
17
  version,
23
- parameters(environment) {
24
- if (Object.hasOwn(capturedEnvironments, environment)) {
25
- return capturedEnvironments[environment];
26
- }
27
- throw new TypeError(`Adapter ${name} has no environment ${environment}; known environments: ${names.length === 0 ? '(none)' : names.join(', ')}.`);
28
- },
18
+ ...(admit === undefined ? {} : { admit }),
29
19
  prepare,
30
- develop,
31
20
  deploy,
32
21
  ...(secretsFile === undefined ? {} : { secretsFile }),
33
22
  });
34
23
  admittedAdapters.add(adapter);
35
24
  return adapter;
36
25
  }
26
+ /** Bind one provider adapter to the parameters of one Project Environment. */
27
+ export function defineDeployment(adapter, parameters) {
28
+ if (!isAdapter(adapter))
29
+ throw new TypeError('Deployment Adapter is not admitted.');
30
+ if (parameters === null || typeof parameters !== 'object' || Array.isArray(parameters)) {
31
+ throw new TypeError('Deployment parameters must be an object.');
32
+ }
33
+ return captureDeployment(adapter, Object.freeze({ ...parameters }));
34
+ }
37
35
  export function isAdapter(input) {
38
36
  return input !== null && typeof input === 'object' && admittedAdapters.has(input);
39
37
  }
@@ -1,7 +1,13 @@
1
+ import type { InstallationTarget } from '../adapter.js';
1
2
  import type { PreparedArtifact } from '../prepare/index.js';
2
3
  export interface DeployContext {
3
4
  readonly projectDir: string;
4
5
  readonly environment: string;
6
+ readonly installation?: InstallationTarget;
7
+ /** Optional command-scoped identity override (`--as`). */
8
+ readonly identity?: string;
9
+ /** Optional command-scoped credential; trusted adapters must neither retain nor disclose it. */
10
+ readonly credential?: string;
5
11
  readonly secrets: Readonly<Record<string, string>>;
6
12
  readonly artifact: PreparedArtifact;
7
13
  /** Parent-owned lifecycle cancellation shared by every provider process/effect. */
@@ -17,6 +17,8 @@ export interface ProviderDeploymentEvidence {
17
17
  readonly deployment: string;
18
18
  readonly artifact: Digest;
19
19
  readonly issuer?: Addressing['issuer'];
20
+ /** Optional provider-side check before promotion; distinct from public readiness. */
21
+ readonly preflight?: 'passed' | 'unavailable';
20
22
  }
21
23
  export type AppliedProviderDeployment = {
22
24
  readonly kind: 'applied';