@astrale-os/sdk 0.1.1 → 0.1.2

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 (193) hide show
  1. package/dist/auth/authenticate.d.ts +24 -0
  2. package/dist/auth/authenticate.d.ts.map +1 -0
  3. package/dist/auth/authenticate.js +29 -0
  4. package/dist/auth/authenticate.js.map +1 -0
  5. package/dist/auth/check.d.ts +39 -0
  6. package/dist/auth/check.d.ts.map +1 -0
  7. package/dist/auth/check.js +54 -0
  8. package/dist/auth/check.js.map +1 -0
  9. package/dist/auth/compose.d.ts +22 -0
  10. package/dist/auth/compose.d.ts.map +1 -0
  11. package/dist/auth/compose.js +23 -0
  12. package/dist/auth/compose.js.map +1 -0
  13. package/dist/auth/errors.d.ts +16 -0
  14. package/dist/auth/errors.d.ts.map +1 -0
  15. package/dist/auth/errors.js +26 -0
  16. package/dist/auth/errors.js.map +1 -0
  17. package/dist/auth/identity.d.ts +16 -0
  18. package/dist/auth/identity.d.ts.map +1 -0
  19. package/dist/auth/identity.js +2 -0
  20. package/dist/auth/identity.js.map +1 -0
  21. package/dist/auth/index.d.ts +12 -0
  22. package/dist/auth/index.d.ts.map +1 -0
  23. package/dist/auth/index.js +9 -0
  24. package/dist/auth/index.js.map +1 -0
  25. package/dist/auth/kernel-client.d.ts +28 -0
  26. package/dist/auth/kernel-client.d.ts.map +1 -0
  27. package/dist/auth/kernel-client.js +84 -0
  28. package/dist/auth/kernel-client.js.map +1 -0
  29. package/dist/auth/resolve.d.ts +19 -0
  30. package/dist/auth/resolve.d.ts.map +1 -0
  31. package/dist/auth/resolve.js +43 -0
  32. package/dist/auth/resolve.js.map +1 -0
  33. package/dist/auth/sign.d.ts +15 -0
  34. package/dist/auth/sign.d.ts.map +1 -0
  35. package/dist/auth/sign.js +24 -0
  36. package/dist/auth/sign.js.map +1 -0
  37. package/dist/auth/verify.d.ts +26 -0
  38. package/dist/auth/verify.d.ts.map +1 -0
  39. package/dist/auth/verify.js +96 -0
  40. package/dist/auth/verify.js.map +1 -0
  41. package/dist/define/index.d.ts +5 -0
  42. package/dist/define/index.d.ts.map +1 -0
  43. package/dist/define/index.js +3 -0
  44. package/dist/define/index.js.map +1 -0
  45. package/dist/define/remote-function.d.ts +86 -0
  46. package/dist/define/remote-function.d.ts.map +1 -0
  47. package/dist/define/remote-function.js +25 -0
  48. package/dist/define/remote-function.js.map +1 -0
  49. package/dist/define/view.d.ts +86 -0
  50. package/dist/define/view.d.ts.map +1 -0
  51. package/dist/define/view.js +28 -0
  52. package/dist/define/view.js.map +1 -0
  53. package/dist/deploy/check.d.ts +30 -0
  54. package/dist/deploy/check.d.ts.map +1 -0
  55. package/dist/deploy/check.js +82 -0
  56. package/dist/deploy/check.js.map +1 -0
  57. package/dist/deploy/hash-spec.d.ts +9 -0
  58. package/dist/deploy/hash-spec.d.ts.map +1 -0
  59. package/dist/deploy/hash-spec.js +29 -0
  60. package/dist/deploy/hash-spec.js.map +1 -0
  61. package/dist/deploy/index.d.ts +4 -0
  62. package/dist/deploy/index.d.ts.map +1 -0
  63. package/dist/deploy/index.js +4 -0
  64. package/dist/deploy/index.js.map +1 -0
  65. package/dist/deploy/meta.d.ts +18 -0
  66. package/dist/deploy/meta.d.ts.map +1 -0
  67. package/dist/deploy/meta.js +22 -0
  68. package/dist/deploy/meta.js.map +1 -0
  69. package/dist/dispatch/authorize.d.ts +14 -0
  70. package/dist/dispatch/authorize.d.ts.map +1 -0
  71. package/dist/dispatch/authorize.js +24 -0
  72. package/dist/dispatch/authorize.js.map +1 -0
  73. package/dist/dispatch/call-remote.d.ts +35 -0
  74. package/dist/dispatch/call-remote.d.ts.map +1 -0
  75. package/dist/dispatch/call-remote.js +37 -0
  76. package/dist/dispatch/call-remote.js.map +1 -0
  77. package/dist/dispatch/dispatcher.d.ts +60 -0
  78. package/dist/dispatch/dispatcher.d.ts.map +1 -0
  79. package/dist/dispatch/dispatcher.js +177 -0
  80. package/dist/dispatch/dispatcher.js.map +1 -0
  81. package/dist/dispatch/errors.d.ts +47 -0
  82. package/dist/dispatch/errors.d.ts.map +1 -0
  83. package/dist/dispatch/errors.js +76 -0
  84. package/dist/dispatch/errors.js.map +1 -0
  85. package/dist/dispatch/execute.d.ts +33 -0
  86. package/dist/dispatch/execute.d.ts.map +1 -0
  87. package/dist/dispatch/execute.js +24 -0
  88. package/dist/dispatch/execute.js.map +1 -0
  89. package/dist/dispatch/identity.d.ts +73 -0
  90. package/dist/dispatch/identity.d.ts.map +1 -0
  91. package/dist/dispatch/identity.js +106 -0
  92. package/dist/dispatch/identity.js.map +1 -0
  93. package/dist/dispatch/index.d.ts +8 -0
  94. package/dist/dispatch/index.d.ts.map +1 -0
  95. package/dist/dispatch/index.js +8 -0
  96. package/dist/dispatch/index.js.map +1 -0
  97. package/dist/dispatch/resolve.d.ts +27 -0
  98. package/dist/dispatch/resolve.d.ts.map +1 -0
  99. package/dist/dispatch/resolve.js +65 -0
  100. package/dist/dispatch/resolve.js.map +1 -0
  101. package/dist/dispatch/self.d.ts +27 -0
  102. package/dist/dispatch/self.d.ts.map +1 -0
  103. package/dist/dispatch/self.js +25 -0
  104. package/dist/dispatch/self.js.map +1 -0
  105. package/dist/dispatch/validate.d.ts +35 -0
  106. package/dist/dispatch/validate.d.ts.map +1 -0
  107. package/dist/dispatch/validate.js +27 -0
  108. package/dist/dispatch/validate.js.map +1 -0
  109. package/dist/domain/build-spec.d.ts +37 -0
  110. package/dist/domain/build-spec.d.ts.map +1 -0
  111. package/dist/domain/build-spec.js +95 -0
  112. package/dist/domain/build-spec.js.map +1 -0
  113. package/dist/domain/contract.d.ts +17 -0
  114. package/dist/domain/contract.d.ts.map +1 -0
  115. package/dist/domain/contract.js +26 -0
  116. package/dist/domain/contract.js.map +1 -0
  117. package/dist/domain/define.d.ts +82 -0
  118. package/dist/domain/define.d.ts.map +1 -0
  119. package/dist/domain/define.js +99 -0
  120. package/dist/domain/define.js.map +1 -0
  121. package/dist/domain/extend-core.d.ts +49 -0
  122. package/dist/domain/extend-core.d.ts.map +1 -0
  123. package/dist/domain/extend-core.js +182 -0
  124. package/dist/domain/extend-core.js.map +1 -0
  125. package/dist/domain/index.d.ts +5 -0
  126. package/dist/domain/index.d.ts.map +1 -0
  127. package/dist/domain/index.js +4 -0
  128. package/dist/domain/index.js.map +1 -0
  129. package/dist/index.d.ts +19 -0
  130. package/dist/index.d.ts.map +1 -0
  131. package/dist/index.js +32 -0
  132. package/dist/index.js.map +1 -0
  133. package/dist/method/class.d.ts +70 -0
  134. package/dist/method/class.d.ts.map +1 -0
  135. package/dist/method/class.js +26 -0
  136. package/dist/method/class.js.map +1 -0
  137. package/dist/method/context.d.ts +43 -0
  138. package/dist/method/context.d.ts.map +1 -0
  139. package/dist/method/context.js +10 -0
  140. package/dist/method/context.js.map +1 -0
  141. package/dist/method/index.d.ts +6 -0
  142. package/dist/method/index.d.ts.map +1 -0
  143. package/dist/method/index.js +3 -0
  144. package/dist/method/index.js.map +1 -0
  145. package/dist/method/single.d.ts +88 -0
  146. package/dist/method/single.d.ts.map +1 -0
  147. package/dist/method/single.js +18 -0
  148. package/dist/method/single.js.map +1 -0
  149. package/dist/server/auxiliary-routes.d.ts +44 -0
  150. package/dist/server/auxiliary-routes.d.ts.map +1 -0
  151. package/dist/server/auxiliary-routes.js +237 -0
  152. package/dist/server/auxiliary-routes.js.map +1 -0
  153. package/dist/server/config.d.ts +83 -0
  154. package/dist/server/config.d.ts.map +1 -0
  155. package/dist/server/config.js +8 -0
  156. package/dist/server/config.js.map +1 -0
  157. package/dist/server/create.d.ts +21 -0
  158. package/dist/server/create.d.ts.map +1 -0
  159. package/dist/server/create.js +210 -0
  160. package/dist/server/create.js.map +1 -0
  161. package/dist/server/handle.d.ts +35 -0
  162. package/dist/server/handle.d.ts.map +1 -0
  163. package/dist/server/handle.js +9 -0
  164. package/dist/server/handle.js.map +1 -0
  165. package/dist/server/index.d.ts +11 -0
  166. package/dist/server/index.d.ts.map +1 -0
  167. package/dist/server/index.js +8 -0
  168. package/dist/server/index.js.map +1 -0
  169. package/dist/server/jwks.d.ts +11 -0
  170. package/dist/server/jwks.d.ts.map +1 -0
  171. package/dist/server/jwks.js +15 -0
  172. package/dist/server/jwks.js.map +1 -0
  173. package/dist/server/require-env.d.ts +15 -0
  174. package/dist/server/require-env.d.ts.map +1 -0
  175. package/dist/server/require-env.js +21 -0
  176. package/dist/server/require-env.js.map +1 -0
  177. package/dist/server/serving-url.d.ts +14 -0
  178. package/dist/server/serving-url.d.ts.map +1 -0
  179. package/dist/server/serving-url.js +28 -0
  180. package/dist/server/serving-url.js.map +1 -0
  181. package/dist/server/start.d.ts +11 -0
  182. package/dist/server/start.d.ts.map +1 -0
  183. package/dist/server/start.js +30 -0
  184. package/dist/server/start.js.map +1 -0
  185. package/dist/server/worker-entry.d.ts +60 -0
  186. package/dist/server/worker-entry.d.ts.map +1 -0
  187. package/dist/server/worker-entry.js +79 -0
  188. package/dist/server/worker-entry.js.map +1 -0
  189. package/dist/server/worker-meta.d.ts +6 -0
  190. package/dist/server/worker-meta.d.ts.map +1 -0
  191. package/dist/server/worker-meta.js +10 -0
  192. package/dist/server/worker-meta.js.map +1 -0
  193. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/method/class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiGH,MAAM,UAAU,kBAAkB,CAAC,GAAG,IAAe;IACnD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC;AA0BD,MAAM,UAAU,sBAAsB,CAAC,GAAG,IAAe;IACvD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `RemoteContext` — what every remote method handler receives at runtime.
3
+ *
4
+ * Assembled by the dispatch pipeline before calling `execute`. Carries the
5
+ * validated params, the resolved auth context, the bound node instance (for
6
+ * non-static methods), the typed dependency container, and a
7
+ * `BoundClientSessionView` to call back into the parent kernel.
8
+ */
9
+ import type { FnMap } from '@astrale-os/kernel-client';
10
+ import type { BoundClientSessionView } from '@astrale-os/kernel-client/session';
11
+ import type { AuthContext } from '@astrale-os/kernel-core';
12
+ import type { CallRemoteFn } from '../dispatch/call-remote';
13
+ export type RemoteContext<TParams, TSelf, TDeps> = {
14
+ /** Validated params (Zod-checked against the method's `inputSchema`). */
15
+ params: TParams;
16
+ /** Auth context resolved from the inbound delegation credential. `null` for public or unauthenticated optional methods. */
17
+ auth: AuthContext | null;
18
+ /** Bound node instance — `undefined` for static methods. */
19
+ self: TSelf;
20
+ /** Typed dependency container injected at server startup. */
21
+ deps: TDeps;
22
+ /** The worker's own serving URL */
23
+ url: string;
24
+ /**
25
+ * `BoundClientSessionView` to the parent kernel, bound to the composed
26
+ * credential `union(delegation, self)`. `null` when `auth: 'public'`, or
27
+ * `auth: 'optional'` with no inbound credential. Use for kernel syscalls +
28
+ * same-domain methods. For ANOTHER worker's remote method use
29
+ * {@link RemoteContext.callRemote} — `kernel.call` to a remote method fails
30
+ * the audience check.
31
+ */
32
+ kernel: BoundClientSessionView<FnMap> | null;
33
+ /**
34
+ * Call another worker's remote method (a Function with `binding.remoteUrl`),
35
+ * re-minting the credential for the target's audience so it isn't rejected at
36
+ * authentication. Throws on a public/unauthenticated request (no credential
37
+ * to mint from). The calling Function's identity must hold `USE` on
38
+ * `Identity.mintDelegationCredential` AND the target method's own grants —
39
+ * `callRemote` fixes the audience, not authorization.
40
+ */
41
+ callRemote: CallRemoteFn;
42
+ };
43
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/method/context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI;IACjD,yEAAyE;IACzE,MAAM,EAAE,OAAO,CAAA;IACf,2HAA2H;IAC3H,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACxB,4DAA4D;IAC5D,IAAI,EAAE,KAAK,CAAA;IACX,6DAA6D;IAC7D,IAAI,EAAE,KAAK,CAAA;IACX,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,MAAM,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAC5C;;;;;;;OAOG;IACH,UAAU,EAAE,YAAY,CAAA;CACzB,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `RemoteContext` — what every remote method handler receives at runtime.
3
+ *
4
+ * Assembled by the dispatch pipeline before calling `execute`. Carries the
5
+ * validated params, the resolved auth context, the bound node instance (for
6
+ * non-static methods), the typed dependency container, and a
7
+ * `BoundClientSessionView` to call back into the parent kernel.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/method/context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,6 @@
1
+ export type { RemoteContext } from './context';
2
+ export type { RemoteHandler, AnyRemoteHandler, MethodImpl } from './single';
3
+ export { remoteMethod } from './single';
4
+ export type { ClassMethodsImpl, InterfaceMethodsImpl, SchemaMethodsImpl } from './class';
5
+ export { remoteClassMethods, remoteInterfaceMethods } from './class';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/method/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { remoteMethod } from './single';
2
+ export { remoteClassMethods, remoteInterfaceMethods } from './class';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/method/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Authoring a single remote method.
3
+ *
4
+ * `RemoteHandler` is the typed shape an author writes for ONE method:
5
+ * an `execute` body plus optional REST `route` (using the kernel's
6
+ * canonical `RouteBinding`) and optional anchor `remoteUrl`.
7
+ *
8
+ * `MethodImpl` resolves params/result/self from a schema for a given
9
+ * `(class, method)` pair. `remoteMethod` is the identity helper an author
10
+ * calls per method to get full inference without writing generics by hand.
11
+ */
12
+ import type { AuthPolicy, RouteBinding } from '@astrale-os/kernel-api/routed';
13
+ import type { MethodClassKeys, ClassMethodConfig, NonSealedMethodKeys, OwnMethodKeys } from '@astrale-os/kernel-core/domain';
14
+ import type { Schema } from '@astrale-os/kernel-dsl';
15
+ import type { SelfResult } from '../dispatch/self';
16
+ import type { RemoteContext } from './context';
17
+ /**
18
+ * Remote function handler — execute with full typed context.
19
+ *
20
+ * `execute` is **optional** at the type level: a handler may be a pure
21
+ * binding stub (only `remoteUrl` / `route` set) when authored as a spec-side
22
+ * declaration that never runs locally — the kernel resolver short-circuits
23
+ * via `binding.remoteUrl` before reaching the handler body. The worker-side
24
+ * declaration that actually serves the call MUST provide `execute`.
25
+ *
26
+ * Runtime guard: if dispatch routes to a handler that has no `execute`, the
27
+ * dispatcher throws — that's a programmer error indicating a stub leaked into
28
+ * a code path that was supposed to execute it.
29
+ */
30
+ export type RemoteHandler<TParams, TResult, TSelf, TDeps> = {
31
+ /** The handler body. May be async or an async generator (for `output: 'stream'`). */
32
+ execute?: (ctx: RemoteContext<TParams, TSelf, TDeps>) => TResult | Promise<TResult> | AsyncGenerator<TResult>;
33
+ /**
34
+ * Optional REST binding — attaches a native HTTP route to this method.
35
+ * Uses the kernel's canonical `RouteBinding` type directly.
36
+ */
37
+ route?: RouteBinding;
38
+ /**
39
+ * Optional anchor URL — marks this method as anchored to a specific host.
40
+ * May contain `{name}` placeholders matching fields in the input schema.
41
+ * If absent, the method is ambient (mounts on whatever server loads the domain).
42
+ */
43
+ remoteUrl?: string;
44
+ /** Optional human-readable description. Appears in generated docs. */
45
+ description?: string;
46
+ /** Authentication policy. Defaults to `'required'` when absent. */
47
+ auth?: AuthPolicy;
48
+ /**
49
+ * Optional pre-execute authorization check. Runs after auth resolution and
50
+ * `_self` resolution, before `execute`. Throw any error to deny the call —
51
+ * the SDK wraps it as `AuthorizationDeniedError` (mapped to wire-level
52
+ * `PERMISSION_DENIED`).
53
+ *
54
+ * Use for fine-grained checks the kernel's bit-level perms can't express
55
+ * (e.g. "only the project lead can addMember"). For straight bit-level
56
+ * checks, prefer the helpers in `@astrale-os/sdk` (`assertPerm`,
57
+ * `requireOwnership`).
58
+ *
59
+ * The kernel still enforces `has_perm` independently — `authorize` is
60
+ * additive ergonomic gating on top, not a replacement.
61
+ */
62
+ authorize?: (ctx: RemoteContext<TParams, TSelf, TDeps>) => void | Promise<void>;
63
+ };
64
+ export type AnyRemoteHandler = RemoteHandler<any, any, any, any>;
65
+ /**
66
+ * Fully typed method implementation — resolves params/result/self from the
67
+ * schema, wraps in `RemoteHandler` with deps.
68
+ */
69
+ export type MethodImpl<S extends Schema, K extends MethodClassKeys<S> & string, M extends string, TDeps = unknown> = ClassMethodConfig<S, K, M> extends {
70
+ params: infer P;
71
+ result: infer R;
72
+ self: unknown;
73
+ isStatic: infer St;
74
+ } ? RemoteHandler<P, R, St extends true ? undefined : SelfResult, TDeps> : never;
75
+ type ImplementableMethodName<S extends Schema, K extends MethodClassKeys<S> & string> = (OwnMethodKeys<S, K> | NonSealedMethodKeys<S, K>) & string;
76
+ /**
77
+ * Identity helper for authoring one remote method with full schema-driven typing.
78
+ *
79
+ * Two-form calling convention:
80
+ * - `remoteMethod<TDeps>()` — curried form; captures deps type, returns a
81
+ * per-schema helper. Use when you want deps typed.
82
+ * - `remoteMethod(schema, className, methodName, impl)` — direct form with
83
+ * `unknown` deps.
84
+ */
85
+ export declare function remoteMethod<TDeps>(): <S extends Schema, K extends MethodClassKeys<S> & string, M extends ImplementableMethodName<S, K>>(schema: S, className: K, methodName: M, impl: MethodImpl<S, K, M, TDeps>) => MethodImpl<S, K, M, TDeps>;
86
+ export declare function remoteMethod<S extends Schema, K extends MethodClassKeys<S> & string, M extends ImplementableMethodName<S, K>>(schema: S, className: K, methodName: M, impl: MethodImpl<S, K, M>): MethodImpl<S, K, M>;
87
+ export {};
88
+ //# sourceMappingURL=single.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/method/single.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OA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AAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Authoring a single remote method.
3
+ *
4
+ * `RemoteHandler` is the typed shape an author writes for ONE method:
5
+ * an `execute` body plus optional REST `route` (using the kernel's
6
+ * canonical `RouteBinding`) and optional anchor `remoteUrl`.
7
+ *
8
+ * `MethodImpl` resolves params/result/self from a schema for a given
9
+ * `(class, method)` pair. `remoteMethod` is the identity helper an author
10
+ * calls per method to get full inference without writing generics by hand.
11
+ */
12
+ export function remoteMethod(...args) {
13
+ if (args.length === 0) {
14
+ return (...innerArgs) => innerArgs[3];
15
+ }
16
+ return args[3];
17
+ }
18
+ //# sourceMappingURL=single.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single.js","sourceRoot":"","sources":["../../src/method/single.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoHH,MAAM,UAAU,YAAY,CAAC,GAAG,IAAe;IAC7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Mount worker-side routes for `defineView` and `defineRemoteFunction` entries.
3
+ *
4
+ * Each entry's effective `FunctionBinding` is resolved once at boot (host
5
+ * pattern, path, http verb) and a Hono route is registered that runs the
6
+ * shared SDK auth pipeline (verify inbound credential, optionally enforce /
7
+ * optional / public), Zod validation of input AND output (RemoteFunction
8
+ * only — Views are transport-only), the author's `authorize` hook, and
9
+ * finally `render` / `execute`.
10
+ *
11
+ * Bindings whose host is not a sub-domain of this worker's host are skipped
12
+ * (the graph node was still materialized; the route lives elsewhere).
13
+ */
14
+ import type { Hono } from 'hono';
15
+ import { type FunctionBinding } from '@astrale-os/kernel-api/routed';
16
+ import { type CorsConfig } from '@astrale-os/kernel-server';
17
+ import type { AnyRemoteFunctionDef } from '../define/remote-function';
18
+ import type { ViewDef } from '../define/view';
19
+ import type { AuxIdentityMap } from '../dispatch/identity';
20
+ export type AuxiliaryRoutesConfig<TDeps> = {
21
+ app: Hono;
22
+ /** This worker's serving URL — used to filter bindings that point elsewhere. */
23
+ url: string;
24
+ views?: Record<string, ViewDef<TDeps>>;
25
+ viewBindings?: Record<string, FunctionBinding>;
26
+ remoteFunctions?: Record<string, AnyRemoteFunctionDef>;
27
+ remoteFunctionBindings?: Record<string, FunctionBinding>;
28
+ deps: TDeps;
29
+ /**
30
+ * Per-route identity configs (keyed by slug) — one entry per View and
31
+ * one per RemoteFunction. Build via `buildAuxIdentityMap(compiled, key, issuer)`
32
+ * from `sdk/src/dispatch/identity.ts`.
33
+ */
34
+ identities: AuxIdentityMap;
35
+ /**
36
+ * CORS policy applied to every mounted route: per-route `app.options(...)`
37
+ * preflight and `Access-Control-Allow-*` headers on success + error
38
+ * responses. Required so callers (always `createRemoteServer`) keep the
39
+ * kernel-envelope and aux-route policies in sync.
40
+ */
41
+ cors: CorsConfig;
42
+ };
43
+ export declare function mountAuxiliaryRoutes<TDeps>(config: AuxiliaryRoutesConfig<TDeps>): void;
44
+ //# sourceMappingURL=auxiliary-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auxiliary-routes.d.ts","sourceRoot":"","sources":["../../src/server/auxiliary-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAA;AAQzC,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAQ1D,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC,GAAG,EAAE,IAAI,CAAA;IACT,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IACtD,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACxD,IAAI,EAAE,KAAK,CAAA;IACX;;;;OAIG;IACH,UAAU,EAAE,cAAc,CAAA;IAC1B;;;;;OAKG;IACH,IAAI,EAAE,UAAU,CAAA;CACjB,CAAA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI,CA2EtF"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Mount worker-side routes for `defineView` and `defineRemoteFunction` entries.
3
+ *
4
+ * Each entry's effective `FunctionBinding` is resolved once at boot (host
5
+ * pattern, path, http verb) and a Hono route is registered that runs the
6
+ * shared SDK auth pipeline (verify inbound credential, optionally enforce /
7
+ * optional / public), Zod validation of input AND output (RemoteFunction
8
+ * only — Views are transport-only), the author's `authorize` hook, and
9
+ * finally `render` / `execute`.
10
+ *
11
+ * Bindings whose host is not a sub-domain of this worker's host are skipped
12
+ * (the graph node was still materialized; the route lives elsewhere).
13
+ */
14
+ import { isKernelErrorClassifiable, KERNEL_ERROR_CODES, kernelErrorHttpStatus, } from '@astrale-os/kernel-api';
15
+ import { isSubdomainOf, matchHost, compileHostMatcher, parseUrlTemplate, } from '@astrale-os/kernel-api/routed';
16
+ import { buildCorsHeaders } from '@astrale-os/kernel-server';
17
+ import { resolveInboundAuth } from '../auth/resolve';
18
+ import { runAuthorize } from '../dispatch/authorize';
19
+ import { makeCallRemote } from '../dispatch/call-remote';
20
+ import { SdkResultValidationError, SdkValidationError } from '../dispatch/errors';
21
+ import { validateParams, validateResult } from '../dispatch/validate';
22
+ export function mountAuxiliaryRoutes(config) {
23
+ const { app, url, views, viewBindings, remoteFunctions, remoteFunctionBindings, deps, identities, cors, } = config;
24
+ const workerHost = parseUrlTemplate(url).hostPattern;
25
+ const corsHeaders = buildCorsHeaders(cors);
26
+ if (views && viewBindings) {
27
+ for (const [slug, def] of Object.entries(views)) {
28
+ const binding = viewBindings[slug];
29
+ if (!binding || !def.render)
30
+ continue;
31
+ const identity = requireAuxIdentity('view', slug, identities.views[slug]);
32
+ mountEntry({
33
+ app,
34
+ binding,
35
+ workerHost,
36
+ defaultMethod: 'GET',
37
+ auth: def.auth,
38
+ identity,
39
+ corsHeaders,
40
+ // Views are transport-only (iframe HTML/redirect) — the kernel client
41
+ // built by `resolveInboundAuth` is intentionally NOT forwarded. Code
42
+ // inside the loaded iframe talks back to the kernel via the shell
43
+ // (WebSocket), not via this worker route.
44
+ run: async ({ c, params, auth }) => {
45
+ if (def.authorize)
46
+ await runAuthorize(def.authorize, { c, params, auth, deps });
47
+ return def.render({ c, params, auth, deps });
48
+ },
49
+ });
50
+ }
51
+ }
52
+ if (remoteFunctions && remoteFunctionBindings) {
53
+ for (const [slug, def] of Object.entries(remoteFunctions)) {
54
+ const binding = remoteFunctionBindings[slug];
55
+ if (!binding)
56
+ continue;
57
+ const identity = requireAuxIdentity('remote function', slug, identities.remoteFunctions[slug]);
58
+ mountEntry({
59
+ app,
60
+ binding,
61
+ workerHost,
62
+ defaultMethod: 'POST',
63
+ auth: def.auth,
64
+ identity,
65
+ corsHeaders,
66
+ run: async ({ c, auth, kernel, callRemote }) => {
67
+ const rawBody = await c.req.json().catch(() => ({}));
68
+ const validation = validateParams(def.inputSchema, rawBody);
69
+ if (!validation.ok) {
70
+ throw new SdkValidationError(validation.issues);
71
+ }
72
+ const ctx = { params: validation.data, c, auth, deps, kernel, callRemote };
73
+ if (def.authorize)
74
+ await runAuthorize(def.authorize, ctx);
75
+ const result = await def.execute(ctx);
76
+ const outValidation = validateResult(def.outputSchema, result);
77
+ if (!outValidation.ok) {
78
+ throw new SdkResultValidationError(outValidation.issues, def.ref);
79
+ }
80
+ return c.json({ result: outValidation.data });
81
+ },
82
+ });
83
+ }
84
+ }
85
+ }
86
+ // ── Internal ───────────────────────────────────────────────────────────────
87
+ /**
88
+ * Every materialized aux callable must have an identity in the install-time
89
+ * `subs` claim — a missing one means the build pipeline passed a compiled
90
+ * domain that doesn't include this callable to `buildAuxIdentityMap()`.
91
+ */
92
+ function requireAuxIdentity(kind, slug, identity) {
93
+ if (identity)
94
+ return identity;
95
+ throw new Error(`mountAuxiliaryRoutes: no identity registered for ${kind} "${slug}". ` +
96
+ `Pass a compiled domain that includes this ${kind} to buildAuxIdentityMap().`);
97
+ }
98
+ const PLACEHOLDER_RE = /\{(\w+)([+*])?\}/g;
99
+ function mountEntry(args) {
100
+ const { app, binding, workerHost, defaultMethod, run, auth, identity, corsHeaders } = args;
101
+ const remoteUrl = binding.remoteUrl;
102
+ if (!remoteUrl)
103
+ return;
104
+ const parsed = parseUrlTemplate(remoteUrl);
105
+ if (parsed.hostPattern && !isSubdomainOf(parsed.hostPattern, workerHost))
106
+ return;
107
+ const fullPath = joinPath(parsed.basePath, binding.route?.path ?? '');
108
+ const honoPath = toHonoPath(fullPath);
109
+ const httpMethod = binding.route?.method ?? defaultMethod;
110
+ // `route.method` can be any `HttpMethod` (PUT/PATCH/DELETE/*), but only GET
111
+ // and POST are wired below. Fail loudly at mount time rather than silently
112
+ // registering no handler (which would 404 the real request while the OPTIONS
113
+ // preflight still reports the route exists).
114
+ if (httpMethod !== 'GET' && httpMethod !== 'POST') {
115
+ throw new Error(`mountAuxiliaryRoutes: unsupported HTTP method "${httpMethod}" for route "${honoPath}". ` +
116
+ `Aux routes (views / remote functions) support only GET and POST.`);
117
+ }
118
+ // Local-dev requests target literal `localhost`, but bindings reference a
119
+ // logical host (`dist.localhost`) — so only enforce a Host-header match
120
+ // when the binding has actual placeholders to extract.
121
+ const hostMatcher = parsed.hostPlaceholders.length > 0 ? compileHostMatcher(parsed.hostPattern) : null;
122
+ const pathParamNames = collectPlaceholderNames(fullPath);
123
+ const handler = async (c) => {
124
+ // Apply CORS to every response. `c.json(...)` / `c.body(...)` pick up the
125
+ // headers via the Hono context; raw `Response` objects — a View's `render`
126
+ // return, and `errorResponse` in the catch — do NOT, so the final returned
127
+ // Response is also passed through `applyCorsToResponse`.
128
+ applyCorsToContext(c, corsHeaders);
129
+ try {
130
+ let hostParams = {};
131
+ if (hostMatcher) {
132
+ const match = matchHost(hostMatcher, c.req.header('host') ?? '');
133
+ if (!match)
134
+ return c.notFound();
135
+ hostParams = match;
136
+ }
137
+ const pathParams = {};
138
+ for (const name of pathParamNames) {
139
+ const value = c.req.param(name);
140
+ if (value !== undefined)
141
+ pathParams[name] = decodeURIComponent(value);
142
+ }
143
+ const { auth: resolvedAuth, kernel } = await resolveInboundAuth(stripBearerPrefix(c.req.header('authorization') ?? ''), auth, identity);
144
+ const response = await run({
145
+ c,
146
+ params: { ...hostParams, ...pathParams },
147
+ auth: resolvedAuth,
148
+ kernel,
149
+ callRemote: makeCallRemote(kernel),
150
+ });
151
+ return applyCorsToResponse(response, corsHeaders);
152
+ }
153
+ catch (err) {
154
+ return applyCorsToResponse(errorResponse(err), corsHeaders);
155
+ }
156
+ };
157
+ if (httpMethod === 'GET')
158
+ app.get(honoPath, handler);
159
+ else if (httpMethod === 'POST')
160
+ app.post(honoPath, handler);
161
+ // Per-route preflight — mirrors `createKernelApp`'s per-route
162
+ // `app.options(...)` pattern (kernel/server/app/create.ts:112,145). Avoid
163
+ // a wildcard `app.options('*', ...)`: it would intercept the kernel
164
+ // envelope's own preflights mounted later on this same Hono instance.
165
+ app.options(honoPath, (c) => {
166
+ applyCorsToContext(c, corsHeaders);
167
+ return c.body(null, 204);
168
+ });
169
+ }
170
+ function applyCorsToContext(c, headers) {
171
+ for (const [name, value] of Object.entries(headers))
172
+ c.header(name, value);
173
+ }
174
+ function applyCorsToResponse(response, headers) {
175
+ try {
176
+ for (const [name, value] of Object.entries(headers))
177
+ response.headers.set(name, value);
178
+ return response;
179
+ }
180
+ catch {
181
+ // Some Responses have immutable headers — notably `Response.redirect(...)`,
182
+ // which a View's `render` is documented to return. Rebuild with a mutable
183
+ // header copy so CORS still applies (status / body / location preserved).
184
+ const merged = new Headers(response.headers);
185
+ for (const [name, value] of Object.entries(headers))
186
+ merged.set(name, value);
187
+ return new Response(response.body, {
188
+ status: response.status,
189
+ statusText: response.statusText,
190
+ headers: merged,
191
+ });
192
+ }
193
+ }
194
+ function collectPlaceholderNames(path) {
195
+ return [...path.matchAll(PLACEHOLDER_RE)].map((m) => m[1]);
196
+ }
197
+ /**
198
+ * Serialize an error as the canonical kernel error envelope
199
+ * `{ error: { code, message, data } }` with the matching HTTP status. This is
200
+ * the exact shape the routed client (`kernel-client` HttpRoutedTransport.
201
+ * decodeError) parses — it routes on `error.code` and reads `error.data` for
202
+ * field-level detail (a flat `{ error: '<string>' }` body silently degrades to
203
+ * a generic INTERNAL_ERROR client-side). Every SDK error class (AuthMissingError,
204
+ * SdkValidationError, SdkResultValidationError, AuthorizationDeniedError, …) plus
205
+ * the kernel-core errors `resolveInboundAuth` rethrows all implement
206
+ * `toKernelErrorPayload`, so one branch covers them; only a raw non-classifiable
207
+ * Error falls back to 500.
208
+ */
209
+ function errorResponse(err) {
210
+ const payload = isKernelErrorClassifiable(err)
211
+ ? err.toKernelErrorPayload()
212
+ : {
213
+ code: KERNEL_ERROR_CODES.INTERNAL_ERROR,
214
+ message: err instanceof Error ? err.message : 'Internal error',
215
+ };
216
+ return Response.json({ error: payload }, { status: kernelErrorHttpStatus(payload.code) });
217
+ }
218
+ function joinPath(a, b) {
219
+ if (!b)
220
+ return a;
221
+ if (!a)
222
+ return b;
223
+ const left = a.endsWith('/') ? a.slice(0, -1) : a;
224
+ const right = b.startsWith('/') ? b : `/${b}`;
225
+ return `${left}${right}` || '/';
226
+ }
227
+ /** Convert `/foo/{id}` / `/{name+}` / `/{name*}` to Hono syntax. */
228
+ function toHonoPath(path) {
229
+ return path
230
+ .replace(/\{(\w+)\+\}/g, ':$1{.+}')
231
+ .replace(/\{(\w+)\*\}/g, ':$1{.*}')
232
+ .replace(/\{(\w+)\}/g, ':$1');
233
+ }
234
+ function stripBearerPrefix(value) {
235
+ return value.trim().replace(/^Bearer\s+/i, '');
236
+ }
237
+ //# sourceMappingURL=auxiliary-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auxiliary-routes.js","sourceRoot":"","sources":["../../src/server/auxiliary-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,gBAAgB,GAGjB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,2BAA2B,CAAA;AAQ7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AA0BrE,MAAM,UAAU,oBAAoB,CAAQ,MAAoC;IAC9E,MAAM,EACJ,GAAG,EACH,GAAG,EACH,KAAK,EACL,YAAY,EACZ,eAAe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
3
+ *
4
+ * Identity is per-function: `iss` = the worker's serving URL (`config.url`),
5
+ * `sub` = the function path, signed on each dispatch. No single `subject`.
6
+ */
7
+ import type { CorsConfig, WsAdapter } from '@astrale-os/kernel-server';
8
+ import type { Context } from 'hono';
9
+ import type { Hono } from 'hono';
10
+ import type { RemoteDomain } from '../domain/define';
11
+ export type RemoteServerConfig<TDeps> = {
12
+ /** Domain produced by `defineRemoteDomain(...)`. */
13
+ domain: RemoteDomain;
14
+ /** Dependency container passed to every handler as `ctx.deps`. */
15
+ deps: TDeps;
16
+ /**
17
+ * Server URL — the serving location AND the worker's JWT issuer identity
18
+ * (`iss`), decoupled from the addressing `origin` slug.
19
+ *
20
+ * The server's public key is published at `<url>/.well-known/jwks.json`
21
+ * so downstream verifiers can validate credentials signed by this server.
22
+ */
23
+ url: string;
24
+ /** Private key used to sign outbound credentials. Public form is exposed via JWKS. */
25
+ privateKey: JsonWebKey;
26
+ /** Allowed transports. `'http'` is mandatory. `'ws'` is opt-in. Defaults to `['http']`. */
27
+ transports?: readonly ('http' | 'ws')[];
28
+ /**
29
+ * Runtime-specific WS adapter (from `hono/bun`, `@hono/node-ws`, `hono/deno`).
30
+ * Required when `transports` includes `'ws'`.
31
+ */
32
+ ws?: WsAdapter;
33
+ /** CORS configuration. Defaults to `{ origin: '*' }`. */
34
+ cors?: CorsConfig;
35
+ /** Optional health endpoint path (defaults to `/health`; `false` disables). */
36
+ health?: string | false;
37
+ /** Pre-existing Hono app to attach to (for nesting the SDK under a parent router). */
38
+ app?: Hono;
39
+ /**
40
+ * Provenance stamped onto the auto-mounted `/meta` endpoint. Typically
41
+ * injected at build time by the bundler so downstream tooling can detect
42
+ * version drift between deployed server and expected schema.
43
+ */
44
+ meta?: {
45
+ sdkCommit?: string;
46
+ schemaHash?: string;
47
+ domainName?: string;
48
+ };
49
+ /**
50
+ * Typed colon-path to a callable the installing kernel calls ONCE as the
51
+ * system identity, immediately after the domain installs. Use it to seed
52
+ * nodes and self-grant. Must be a semantic domain path under this domain's
53
+ * own origin (`/:origin:class.X:seed` / `/:origin:interface.Ops:seed`) — the
54
+ * kernel's origin guard refuses absolute tree paths, which cannot prove
55
+ * their origin from the string alone. Returned verbatim in the install
56
+ * bundle (a routing hint — the signed `graph_hash` already constrains what
57
+ * the callable can be).
58
+ *
59
+ * Example: `/:crm.acme.dev:class.Note:seed`
60
+ */
61
+ postInstall?: string;
62
+ /**
63
+ * Cross-domain dependencies by origin. Returned in the install bundle; the
64
+ * kernel verifies each origin is already present on the instance before
65
+ * installing, and refuses with a clear error if one is missing.
66
+ */
67
+ requires?: readonly string[];
68
+ /**
69
+ * Optional private install hook. Throw to deny the install request.
70
+ * The public URL install contract still receives no caller kernel
71
+ * credential; private installs use the bearer token only.
72
+ */
73
+ install?: {
74
+ authorize?: (args: {
75
+ c: Context;
76
+ token?: string;
77
+ kernelIssuer: string;
78
+ nonce: string;
79
+ deps: TDeps;
80
+ }) => void | Promise<void>;
81
+ };
82
+ };
83
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,MAAM,kBAAkB,CAAC,KAAK,IAAI;IACtC,oDAAoD;IACpD,MAAM,EAAE,YAAY,CAAA;IACpB,kEAAkE;IAClE,IAAI,EAAE,KAAK,CAAA;IACX;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAA;IACX,sFAAsF;IACtF,UAAU,EAAE,UAAU,CAAA;IACtB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAA;IACvC;;;OAGG;IACH,EAAE,CAAC,EAAE,SAAS,CAAA;IACd,yDAAyD;IACzD,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACvB,sFAAsF;IACtF,GAAG,CAAC,EAAE,IAAI,CAAA;IACV;;;;OAIG;IACH,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;YACjB,CAAC,EAAE,OAAO,CAAA;YACV,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,YAAY,EAAE,MAAM,CAAA;YACpB,KAAK,EAAE,MAAM,CAAA;YACb,IAAI,EAAE,KAAK,CAAA;SACZ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;KAC3B,CAAA;CACF,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `RemoteServerConfig` — input shape for `createRemoteServer`.
3
+ *
4
+ * Identity is per-function: `iss` = the worker's serving URL (`config.url`),
5
+ * `sub` = the function path, signed on each dispatch. No single `subject`.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `createRemoteServer` — the SDK's entry point for running a remote domain.
3
+ *
4
+ * Identity is per-function: the dispatcher signs `iss` = the worker's serving
5
+ * URL (`effectiveIssuer`, decoupled from the addressing `origin`) and `sub` =
6
+ * the origin-addressed function path on each dispatch.
7
+ *
8
+ * Composes:
9
+ * methods ← Map keyed by BoundMethod.ref (built by dispatch/resolve)
10
+ * effectiveIssuer ← config.issuer ?? config.url
11
+ * dispatcher ← SdkDispatcher(compiled, methods, deps, privateKey)
12
+ * jwks ← derivePublicJwk(privateKey), keyed by effectiveIssuer
13
+ * /meta ← provenance endpoint (sdkCommit, schemaHash, domainName)
14
+ * auxiliary routes ← view / remote-function handlers from defineRemoteDomain
15
+ * app ← createKernelApp(dispatcher, contracts, host, jwks, transports, ...)
16
+ * start ← startNodeServer(app, port)
17
+ */
18
+ import type { RemoteServerConfig } from './config';
19
+ import type { RemoteServer } from './handle';
20
+ export declare function createRemoteServer<TDeps>(config: RemoteServerConfig<TDeps>): RemoteServer;
21
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/server/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAeH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,UAAU,CAAA;AAahE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,YAAY,CA+JzF"}