@earendil-works/chord 1.0.4 → 1.2.0

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 (186) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +77 -194
  3. package/dist/cell.d.ts +101 -0
  4. package/dist/cell.d.ts.map +1 -0
  5. package/dist/cell.js +316 -0
  6. package/dist/cell.js.map +1 -0
  7. package/dist/cluster.d.ts +26 -0
  8. package/dist/cluster.d.ts.map +1 -0
  9. package/dist/cluster.js +214 -0
  10. package/dist/cluster.js.map +1 -0
  11. package/dist/connection.d.ts +157 -0
  12. package/dist/connection.d.ts.map +1 -0
  13. package/dist/connection.js +757 -0
  14. package/dist/connection.js.map +1 -0
  15. package/dist/context/index.d.ts +12 -1
  16. package/dist/context/index.d.ts.map +1 -1
  17. package/dist/context/index.js.map +1 -1
  18. package/dist/contract.d.ts +133 -0
  19. package/dist/contract.d.ts.map +1 -0
  20. package/dist/contract.js +157 -0
  21. package/dist/contract.js.map +1 -0
  22. package/dist/declare.d.ts +70 -0
  23. package/dist/declare.d.ts.map +1 -0
  24. package/dist/declare.js +22 -0
  25. package/dist/declare.js.map +1 -0
  26. package/dist/delta/apply-immutable-trusted.js.map +1 -1
  27. package/dist/delta/diff.d.ts +1 -1
  28. package/dist/delta/diff.d.ts.map +1 -1
  29. package/dist/delta/diff.js.map +1 -1
  30. package/dist/delta/index.d.ts +2 -2
  31. package/dist/delta/index.d.ts.map +1 -1
  32. package/dist/delta/index.js +41 -0
  33. package/dist/delta/index.js.map +1 -1
  34. package/dist/delta/revision-validator.d.ts +1 -1
  35. package/dist/delta/revision-validator.d.ts.map +1 -1
  36. package/dist/delta/revision-validator.js.map +1 -1
  37. package/dist/delta/tracker.d.ts +1 -1
  38. package/dist/delta/tracker.d.ts.map +1 -1
  39. package/dist/delta/tracker.js +40 -4
  40. package/dist/delta/tracker.js.map +1 -1
  41. package/dist/errors.d.ts +27 -0
  42. package/dist/errors.d.ts.map +1 -0
  43. package/dist/errors.js +44 -0
  44. package/dist/errors.js.map +1 -0
  45. package/dist/host.d.ts +254 -0
  46. package/dist/host.d.ts.map +1 -0
  47. package/dist/host.js +795 -0
  48. package/dist/host.js.map +1 -0
  49. package/dist/index.d.ts +17 -10
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +8 -8
  52. package/dist/index.js.map +1 -1
  53. package/dist/json.d.ts +9 -1
  54. package/dist/json.d.ts.map +1 -1
  55. package/dist/json.js.map +1 -1
  56. package/dist/link.d.ts +72 -0
  57. package/dist/link.d.ts.map +1 -0
  58. package/dist/link.js +169 -0
  59. package/dist/link.js.map +1 -0
  60. package/dist/loader.d.ts +4 -0
  61. package/dist/loader.d.ts.map +1 -0
  62. package/dist/loader.js +68 -0
  63. package/dist/loader.js.map +1 -0
  64. package/dist/manager.d.ts +115 -0
  65. package/dist/manager.d.ts.map +1 -0
  66. package/dist/manager.js +319 -0
  67. package/dist/manager.js.map +1 -0
  68. package/dist/node.d.ts +3 -4
  69. package/dist/node.d.ts.map +1 -1
  70. package/dist/node.js +3 -2
  71. package/dist/node.js.map +1 -1
  72. package/dist/publish.d.ts +5 -0
  73. package/dist/publish.d.ts.map +1 -0
  74. package/dist/publish.js +40 -0
  75. package/dist/publish.js.map +1 -0
  76. package/dist/record.d.ts +320 -0
  77. package/dist/record.d.ts.map +1 -0
  78. package/dist/record.js +1292 -0
  79. package/dist/record.js.map +1 -0
  80. package/dist/registry.d.ts +25 -0
  81. package/dist/registry.d.ts.map +1 -0
  82. package/dist/registry.js +6 -0
  83. package/dist/registry.js.map +1 -0
  84. package/dist/reload.d.ts +118 -0
  85. package/dist/reload.d.ts.map +1 -0
  86. package/dist/reload.js +589 -0
  87. package/dist/reload.js.map +1 -0
  88. package/dist/remote.d.ts +70 -0
  89. package/dist/remote.d.ts.map +1 -0
  90. package/dist/remote.js +308 -0
  91. package/dist/remote.js.map +1 -0
  92. package/dist/schema.d.ts +21 -0
  93. package/dist/schema.d.ts.map +1 -0
  94. package/dist/schema.js +228 -0
  95. package/dist/schema.js.map +1 -0
  96. package/dist/state.d.ts +92 -0
  97. package/dist/state.d.ts.map +1 -0
  98. package/dist/{services/state.js → state.js} +28 -138
  99. package/dist/state.js.map +1 -0
  100. package/dist/types.d.ts +62 -262
  101. package/dist/types.d.ts.map +1 -1
  102. package/dist/types.js.map +1 -1
  103. package/dist/websocket.d.ts +16 -0
  104. package/dist/websocket.d.ts.map +1 -0
  105. package/dist/websocket.js +15 -0
  106. package/dist/websocket.js.map +1 -0
  107. package/dist/wire.d.ts +135 -0
  108. package/dist/wire.d.ts.map +1 -0
  109. package/dist/wire.js +112 -0
  110. package/dist/wire.js.map +1 -0
  111. package/docs/guide.md +750 -0
  112. package/docs/spec.md +261 -0
  113. package/docs/tutorial.md +909 -0
  114. package/package.json +10 -11
  115. package/src/delta/README.md +5 -3
  116. package/dist/api.d.ts +0 -20
  117. package/dist/api.d.ts.map +0 -1
  118. package/dist/api.js +0 -77
  119. package/dist/api.js.map +0 -1
  120. package/dist/bundler.d.ts +0 -6
  121. package/dist/bundler.d.ts.map +0 -1
  122. package/dist/bundler.js +0 -3
  123. package/dist/bundler.js.map +0 -1
  124. package/dist/facets/host.d.ts +0 -12
  125. package/dist/facets/host.d.ts.map +0 -1
  126. package/dist/facets/host.js +0 -763
  127. package/dist/facets/host.js.map +0 -1
  128. package/dist/facets/loader.d.ts +0 -3
  129. package/dist/facets/loader.d.ts.map +0 -1
  130. package/dist/facets/loader.js +0 -5
  131. package/dist/facets/loader.js.map +0 -1
  132. package/dist/node/bundle-loader.d.ts +0 -30
  133. package/dist/node/bundle-loader.d.ts.map +0 -1
  134. package/dist/node/bundle-loader.js +0 -377
  135. package/dist/node/bundle-loader.js.map +0 -1
  136. package/dist/node/bundle.d.ts +0 -26
  137. package/dist/node/bundle.d.ts.map +0 -1
  138. package/dist/node/bundle.js +0 -183
  139. package/dist/node/bundle.js.map +0 -1
  140. package/dist/node/manifest.d.ts +0 -36
  141. package/dist/node/manifest.d.ts.map +0 -1
  142. package/dist/node/manifest.js +0 -6
  143. package/dist/node/manifest.js.map +0 -1
  144. package/dist/node/package.d.ts +0 -15
  145. package/dist/node/package.d.ts.map +0 -1
  146. package/dist/node/package.js +0 -199
  147. package/dist/node/package.js.map +0 -1
  148. package/dist/services/consumer.d.ts +0 -11
  149. package/dist/services/consumer.d.ts.map +0 -1
  150. package/dist/services/consumer.js +0 -585
  151. package/dist/services/consumer.js.map +0 -1
  152. package/dist/services/errors.d.ts +0 -8
  153. package/dist/services/errors.d.ts.map +0 -1
  154. package/dist/services/errors.js +0 -22
  155. package/dist/services/errors.js.map +0 -1
  156. package/dist/services/handle.d.ts +0 -15
  157. package/dist/services/handle.d.ts.map +0 -1
  158. package/dist/services/handle.js +0 -101
  159. package/dist/services/handle.js.map +0 -1
  160. package/dist/services/instances.d.ts +0 -26
  161. package/dist/services/instances.d.ts.map +0 -1
  162. package/dist/services/instances.js +0 -140
  163. package/dist/services/instances.js.map +0 -1
  164. package/dist/services/loopback.d.ts +0 -5
  165. package/dist/services/loopback.d.ts.map +0 -1
  166. package/dist/services/loopback.js +0 -15
  167. package/dist/services/loopback.js.map +0 -1
  168. package/dist/services/provider.d.ts +0 -37
  169. package/dist/services/provider.d.ts.map +0 -1
  170. package/dist/services/provider.js +0 -521
  171. package/dist/services/provider.js.map +0 -1
  172. package/dist/services/state-codec.d.ts +0 -15
  173. package/dist/services/state-codec.d.ts.map +0 -1
  174. package/dist/services/state-codec.js +0 -133
  175. package/dist/services/state-codec.js.map +0 -1
  176. package/dist/services/state-internals.d.ts +0 -13
  177. package/dist/services/state-internals.d.ts.map +0 -1
  178. package/dist/services/state-internals.js +0 -10
  179. package/dist/services/state-internals.js.map +0 -1
  180. package/dist/services/state.d.ts +0 -28
  181. package/dist/services/state.d.ts.map +0 -1
  182. package/dist/services/state.js.map +0 -1
  183. package/dist/services/wire.d.ts +0 -63
  184. package/dist/services/wire.d.ts.map +0 -1
  185. package/dist/services/wire.js +0 -186
  186. package/dist/services/wire.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ /** Error codes callers see (guide table). A refused or aborted reload keeps the code of its cause. */
2
+ export type ChordErrorCode = "aborted" | "contract_mismatch" | "forbidden" | "gone" | "invalid" | "not_in_variant" | "not_ready" | "released" | "superseded" | "unavailable" | "upgrade_conflict" | "upgrade_required";
3
+ /**
4
+ * Finer cause inside a code, for logs and tests: e.g. `invalid` + `args`, `result`, `state`, `input`, `behavior`,
5
+ * `duplicate`, `cycle`, `read_only`, `not_eager`, `registry_conflict`; `unavailable` + `unknown_type`.
6
+ */
7
+ export type ChordErrorReason = string;
8
+ export declare class ChordError extends Error {
9
+ readonly code: ChordErrorCode;
10
+ readonly reason: ChordErrorReason | undefined;
11
+ readonly retryable: boolean;
12
+ readonly details: unknown;
13
+ constructor(code: ChordErrorCode, message: string, options?: {
14
+ cause?: unknown;
15
+ details?: unknown;
16
+ reason?: ChordErrorReason;
17
+ });
18
+ }
19
+ export declare const isChordError: (error: unknown, code?: ChordErrorCode) => error is ChordError;
20
+ /** For factories and methods refusing a principal: `throw forbidden()`. */
21
+ export declare const forbidden: (message?: string) => ChordError;
22
+ export declare const invalid: (reason: ChordErrorReason, message: string, details?: unknown) => ChordError;
23
+ /** Keeps a ChordError's code; anything else becomes `unavailable` with the original as cause. */
24
+ export declare const asChordError: (error: unknown, context: string) => ChordError;
25
+ /** Runs every step, then throws one error, or an AggregateError when several failed. */
26
+ export declare function runAll(steps: readonly (() => unknown)[], message: string): Promise<void>;
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,MAAM,cAAc,GACvB,SAAS,GACT,mBAAmB,GACnB,WAAW,GACX,MAAM,GACN,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,kBAAkB,CAAC;AAEtB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAItC,qBAAa,UAAW,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,YACC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAAE,EAU3E;CACD;AAED,eAAO,MAAM,YAAY,UAAW,OAAO,SAAS,cAAc,KAAG,KAAK,IAAI,UACH,CAAC;AAE5E,2EAA2E;AAC3E,eAAO,MAAM,SAAS,wBAA4B,UAAkD,CAAC;AAErG,eAAO,MAAM,OAAO,WAAY,gBAAgB,WAAW,MAAM,YAAY,OAAO,KAAG,UAC/B,CAAC;AAEzD,iGAAiG;AACjG,eAAO,MAAM,YAAY,UAAW,OAAO,WAAW,MAAM,KAAG,UAK1D,CAAC;AAEN,wFAAwF;AACxF,wBAAsB,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9F"}
package/dist/errors.js ADDED
@@ -0,0 +1,44 @@
1
+ const RETRYABLE = new Set(["superseded", "upgrade_conflict"]);
2
+ export class ChordError extends Error {
3
+ code;
4
+ reason;
5
+ retryable;
6
+ details;
7
+ constructor(code, message, options) {
8
+ super(`${code}${options?.reason ? `/${options.reason}` : ""}: ${message}`, {
9
+ cause: options?.cause,
10
+ });
11
+ this.name = "ChordError";
12
+ this.code = code;
13
+ this.reason = options?.reason;
14
+ this.retryable = RETRYABLE.has(code);
15
+ this.details = options?.details;
16
+ }
17
+ }
18
+ export const isChordError = (error, code) => error instanceof ChordError && (code === undefined || error.code === code);
19
+ /** For factories and methods refusing a principal: `throw forbidden()`. */
20
+ export const forbidden = (message = "forbidden") => new ChordError("forbidden", message);
21
+ export const invalid = (reason, message, details) => new ChordError("invalid", message, { reason, details });
22
+ /** Keeps a ChordError's code; anything else becomes `unavailable` with the original as cause. */
23
+ export const asChordError = (error, context) => error instanceof ChordError
24
+ ? error
25
+ : new ChordError("unavailable", `${context}: ${error instanceof Error ? error.message : String(error)}`, {
26
+ cause: error,
27
+ });
28
+ /** Runs every step, then throws one error, or an AggregateError when several failed. */
29
+ export async function runAll(steps, message) {
30
+ const errors = [];
31
+ for (const step of steps) {
32
+ try {
33
+ await step();
34
+ }
35
+ catch (error) {
36
+ errors.push(error);
37
+ }
38
+ }
39
+ if (errors.length === 1)
40
+ throw errors[0];
41
+ if (errors.length > 1)
42
+ throw new AggregateError(errors, message);
43
+ }
44
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA,MAAM,SAAS,GAAgC,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAE3F,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,IAAI,CAAiB;IACrB,MAAM,CAA+B;IACrC,SAAS,CAAU;IACnB,OAAO,CAAU;IAC1B,YACC,IAAoB,EACpB,OAAe,EACf,OAA2E;QAE3E,KAAK,CAAC,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,EAAE,EAAE;YAC1E,KAAK,EAAE,OAAO,EAAE,KAAK;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,IAAI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AAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC;YACJ,MAAM,IAAI,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACF,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/** Error codes callers see (guide table). A refused or aborted reload keeps the code of its cause. */\nexport type ChordErrorCode =\n\t| \"aborted\"\n\t| \"contract_mismatch\"\n\t| \"forbidden\"\n\t| \"gone\"\n\t| \"invalid\"\n\t| \"not_in_variant\"\n\t| \"not_ready\"\n\t| \"released\"\n\t| \"superseded\"\n\t| \"unavailable\"\n\t| \"upgrade_conflict\"\n\t| \"upgrade_required\";\n\n/**\n * Finer cause inside a code, for logs and tests: e.g. `invalid` + `args`, `result`, `state`, `input`, `behavior`,\n * `duplicate`, `cycle`, `read_only`, `not_eager`, `registry_conflict`; `unavailable` + `unknown_type`.\n */\nexport type ChordErrorReason = string;\n\nconst RETRYABLE: ReadonlySet<ChordErrorCode> = new Set([\"superseded\", \"upgrade_conflict\"]);\n\nexport class ChordError extends Error {\n\treadonly code: ChordErrorCode;\n\treadonly reason: ChordErrorReason | undefined;\n\treadonly retryable: boolean;\n\treadonly details: unknown;\n\tconstructor(\n\t\tcode: ChordErrorCode,\n\t\tmessage: string,\n\t\toptions?: { cause?: unknown; details?: unknown; reason?: ChordErrorReason },\n\t) {\n\t\tsuper(`${code}${options?.reason ? `/${options.reason}` : \"\"}: ${message}`, {\n\t\t\tcause: options?.cause,\n\t\t});\n\t\tthis.name = \"ChordError\";\n\t\tthis.code = code;\n\t\tthis.reason = options?.reason;\n\t\tthis.retryable = RETRYABLE.has(code);\n\t\tthis.details = options?.details;\n\t}\n}\n\nexport const isChordError = (error: unknown, code?: ChordErrorCode): error is ChordError =>\n\terror instanceof ChordError && (code === undefined || error.code === code);\n\n/** For factories and methods refusing a principal: `throw forbidden()`. */\nexport const forbidden = (message = \"forbidden\"): ChordError => new ChordError(\"forbidden\", message);\n\nexport const invalid = (reason: ChordErrorReason, message: string, details?: unknown): ChordError =>\n\tnew ChordError(\"invalid\", message, { reason, details });\n\n/** Keeps a ChordError's code; anything else becomes `unavailable` with the original as cause. */\nexport const asChordError = (error: unknown, context: string): ChordError =>\n\terror instanceof ChordError\n\t\t? error\n\t\t: new ChordError(\"unavailable\", `${context}: ${error instanceof Error ? error.message : String(error)}`, {\n\t\t\t\tcause: error,\n\t\t\t});\n\n/** Runs every step, then throws one error, or an AggregateError when several failed. */\nexport async function runAll(steps: readonly (() => unknown)[], message: string): Promise<void> {\n\tconst errors: unknown[] = [];\n\tfor (const step of steps) {\n\t\ttry {\n\t\t\tawait step();\n\t\t} catch (error) {\n\t\t\terrors.push(error);\n\t\t}\n\t}\n\tif (errors.length === 1) throw errors[0];\n\tif (errors.length > 1) throw new AggregateError(errors, message);\n}\n"]}
package/dist/host.d.ts ADDED
@@ -0,0 +1,254 @@
1
+ import { type AcceptOptions, Connection, type LinkOptions, type RelayHold } from "./connection.ts";
2
+ import { type AnyContract, type Handle, type InputOf, type LocalContract, type LocalDef, type RemoteContract, type RemoteDef } from "./contract.ts";
3
+ import type { Link } from "./link.ts";
4
+ import { type Decls, type Factory, type Hold, type HoldOwner, type HostCore, RecordImpl, type ServeOptions, type Service } from "./record.ts";
5
+ import type { Registry, RegistryTable, RegistryView } from "./registry.ts";
6
+ import { type ReloadOptions, type ReloadReport } from "./reload.ts";
7
+ import { RemoteHandle } from "./remote.ts";
8
+ import type { Ctx, GetOptions, Principal } from "./types.ts";
9
+ import type { Frame } from "./wire.ts";
10
+ /** The principal of in-host code. */
11
+ export declare const hostPrincipal: Principal;
12
+ /**
13
+ * Registers a factory for a type. Overloaded on the contract's definition (not the contract type) so TypeScript
14
+ * keeps literal `kind`s in factory returns.
15
+ */
16
+ export interface Serve {
17
+ <D extends RemoteDef>(type: RemoteContract<D>, factory: Factory<RemoteContract<D>>, options?: ServeOptions<RemoteContract<D>>): void;
18
+ <D extends LocalDef>(type: LocalContract<D>, factory: Factory<LocalContract<D>>, options?: ServeOptions<LocalContract<D>>): void;
19
+ }
20
+ /**
21
+ * What a facet's `setup` gets. `serve` registers types; `root` and `registry` give the facet's code that is not a
22
+ * Chord method, listener or task (Durable tools and hooks, callbacks of native libraries) access to its own host,
23
+ * so plugins never need a process-global host. Both may be kept and used after `setup` returns.
24
+ */
25
+ export interface FacetApi {
26
+ readonly serve: Serve;
27
+ /** The host's name (`server`, `session:S1`, ...). */
28
+ readonly name: string;
29
+ /** Starts a root on the facet's host (in its current epoch at call time). */
30
+ root<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: RootOptions): Promise<T>;
31
+ /** The facet's host's registry view (`get(key, ctx)` reads the table of `ctx.epoch`). */
32
+ registry<V>(registry: Registry<V>): RegistryView<V>;
33
+ }
34
+ /** What a facet module exports (default export): the code that serves its types on one host kind. */
35
+ export interface FacetDefinition {
36
+ /** Contract tokens this facet consumes; checked against providers at reload. */
37
+ readonly uses?: readonly AnyContract[];
38
+ setup(api: FacetApi): void;
39
+ }
40
+ /** A named facet. Modules are named by their URL; reloading a facet replaces everything it served. */
41
+ export interface Facet extends FacetDefinition {
42
+ readonly name: string;
43
+ }
44
+ export declare const defineFacet: (setup: (api: FacetApi) => void, options?: {
45
+ readonly uses?: readonly AnyContract[];
46
+ }) => FacetDefinition;
47
+ /** Imports facet modules (fresh copies on every call) and names them by module URL. */
48
+ export type FacetLoader = (modules: readonly (string | URL)[]) => Promise<Facet[]>;
49
+ /** A facet object, or a module (path or URL) whose default export is a FacetDefinition. */
50
+ export type PluginRef = Facet | string | URL;
51
+ export interface HostOptions {
52
+ readonly name?: string;
53
+ /** Maps a principal to its record key (should include connection provenance and grant revision). */
54
+ readonly principalKey?: (principal: Principal) => string;
55
+ /** Validates every cell write and exposed state value against its schemas. */
56
+ readonly dev?: boolean;
57
+ /** Errors from background work (disposal, listeners, tasks). Defaults to console.error. */
58
+ readonly onError?: (error: unknown) => void;
59
+ /** Needed for `load`/`reload` with modules; `nodeLoader` from loader.ts in Node. */
60
+ readonly loader?: FacetLoader;
61
+ /** `client` (browser): never a reload participant, never carries roots or epochs. Default `host`. */
62
+ readonly kind?: "host" | "client";
63
+ /** The link to this host's parent (server). Can also be set later with `connect`. */
64
+ readonly upstream?: Link;
65
+ readonly upstreamOptions?: LinkOptions;
66
+ }
67
+ /** Where requests for hosts named `prefix…` go (on the server). */
68
+ export interface Route {
69
+ /** Checked before resolving (or spawning) and again after: grants may change meanwhile. */
70
+ authorize(principal: Principal, hostName: string): boolean | Promise<boolean>;
71
+ /** A link to the host, spawned if needed. */
72
+ resolve(hostName: string): Promise<Link>;
73
+ /** Principal the resolved host acts as when it calls back (default `{ host: hostName }`). */
74
+ readonly principal?: (hostName: string) => Principal;
75
+ }
76
+ /** `invalidatePrincipal` matches: a predicate (this host only), or a pattern (fields that must be equal; propagates). */
77
+ export type PrincipalMatch = ((principal: Principal) => boolean) | Readonly<Record<string, unknown>>;
78
+ export interface RootOptions {
79
+ readonly principal?: Principal;
80
+ readonly signal?: AbortSignal;
81
+ /** Start the root in a retained epoch (links carry epochs). Defaults to the current epoch. */
82
+ readonly epoch?: number;
83
+ }
84
+ export interface LoadOptions {
85
+ /** Await eager activation (default true). False starts it but leaves readiness to `host.ready()`. */
86
+ readonly awaitEager?: boolean;
87
+ }
88
+ export interface Host {
89
+ readonly name: string;
90
+ readonly epoch: number;
91
+ readonly previousEpoch: number | undefined;
92
+ readonly serve: Serve;
93
+ /** Installs synchronously, then awaits this facet's eager objects unless `awaitEager` is false. */
94
+ install(facet: Facet, options?: LoadOptions): Promise<void>;
95
+ /** Installs all facets before awaiting their eager objects; lazy objects stay lazy. */
96
+ load(plugins: readonly PluginRef[], options?: LoadOptions): Promise<void>;
97
+ /** Awaits the eager holds present at call time, including those started by `serve` or deferred loads. */
98
+ ready(): Promise<void>;
99
+ get<C extends AnyContract>(type: C, input: InputOf<C>, options?: GetOptions): Handle<C>;
100
+ root<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: RootOptions): Promise<T>;
101
+ registry<V>(registry: Registry<V>): RegistryView<V>;
102
+ /**
103
+ * Force-disposes every record whose principal matches (never the host principal), re-stamps or closes matching
104
+ * links, and propagates pattern matches to child hosts.
105
+ */
106
+ invalidatePrincipal(match: PrincipalMatch): Promise<void>;
107
+ /** Accepts a child link (a worker or a browser); requests on it act as `options.principal`. */
108
+ accept(link: Link, options: AcceptOptions): void;
109
+ /** Sets (or replaces, after a reconnect) the link to this host's parent; remote handles re-hold over it. */
110
+ connect(link: Link, options?: LinkOptions): void;
111
+ route(prefix: string, route: Route): void;
112
+ /** Reloads the given facets (modules are re-imported); facets not listed keep running unchanged. */
113
+ reload(plugins: readonly PluginRef[], options?: ReloadOptions): Promise<ReloadReport>;
114
+ close(): Promise<void>;
115
+ }
116
+ export interface EpochState {
117
+ readonly id: number;
118
+ readonly services: Map<string, Service>;
119
+ tables: ReadonlyMap<string, RegistryTable<unknown>>;
120
+ /** Running roots with the number of their calls running here. */
121
+ readonly roots: Map<string, number>;
122
+ }
123
+ export declare function createHost(options?: HostOptions): Host;
124
+ export declare class HostImpl implements Host, HostCore {
125
+ #private;
126
+ readonly name: string;
127
+ readonly dev: boolean;
128
+ readonly principal: Principal;
129
+ inFactory: number;
130
+ failed: unknown;
131
+ readonly records: Map<string, RecordImpl>;
132
+ readonly epochs: Map<number, EpochState>;
133
+ readonly facets: Map<string, Facet>;
134
+ readonly eager: Map<string, Hold>;
135
+ readonly kind: "host" | "client";
136
+ readonly connections: Set<Connection>;
137
+ upstream: Connection | undefined;
138
+ /** Remote handles this host holds (re-held after an upstream reconnect). */
139
+ readonly remotes: Set<RemoteHandle>;
140
+ /** Child facet modules by host-name prefix, from every committed cluster reload (for reconciling children). */
141
+ remoteModules: Record<string, string[]>;
142
+ /** Removal tombstones also reconcile children that connected during a transaction. */
143
+ remoteRemoved: Record<string, string[]>;
144
+ current: EpochState;
145
+ previous: EpochState | undefined;
146
+ /** The epoch a running reload will commit; new types activated during prepare install their behavior for it. */
147
+ pending: EpochState | undefined;
148
+ /** Activations of these types wait (reload gate). */
149
+ /** Types behind a reload gate: new records of these types are rejected `upgrade_conflict` until commit/abort. */
150
+ gating: ReadonlySet<string> | undefined;
151
+ reloading: boolean;
152
+ retired: () => void;
153
+ constructor(options: HostOptions);
154
+ get epoch(): number;
155
+ get previousEpoch(): number | undefined;
156
+ /** Allocates the next epoch id, or adopts one issued by the coordinating server. */
157
+ nextEpochId(given?: number): number;
158
+ report(error: unknown): void;
159
+ readonly serve: Serve;
160
+ install(facet: Facet, options?: LoadOptions): Promise<void>;
161
+ load(plugins: readonly PluginRef[], options?: LoadOptions): Promise<void>;
162
+ ready(): Promise<void>;
163
+ /** Turns plugin references into facets, importing modules through the loader. */
164
+ resolve(plugins: readonly PluginRef[]): Promise<Facet[]>;
165
+ facetApi(serve: Serve): FacetApi;
166
+ serveInto(services: Map<string, Service>, service: Service): void;
167
+ startEager(service: Service): Hold;
168
+ currentEpoch(): number;
169
+ hasEpoch(epoch: number): boolean;
170
+ retainedEpochs(): Iterable<readonly [number, ReadonlyMap<string, Service>]>;
171
+ pendingEpoch(): number | undefined;
172
+ /** The current code for a type; a type a running reload adds is served from the pending epoch. */
173
+ service(typeName: string): Service | undefined;
174
+ addressOf(type: AnyContract, input: unknown, principal: Principal, at?: string, candidate?: boolean): string;
175
+ acquire(type: AnyContract, input: unknown, options: GetOptions | undefined, owner: HoldOwner, from?: RecordImpl, candidate?: boolean): Hold;
176
+ forget(record: RecordImpl): void;
177
+ touch(rootId: string, record: RecordImpl): void;
178
+ root<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: RootOptions): Promise<T>;
179
+ /**
180
+ * Runs `fn` inside root `rootId` of `epoch`. A root counts as running here (for retirement) while any of its calls
181
+ * runs here. A root that started here ends when its last call here settles, even if it went out and came back
182
+ * over a link meanwhile. A foreign root (started elsewhere, arriving `from` a link) keeps its leases on records
183
+ * until every link it came over announced its end (`root_end`) or closed, so its re-entry stays grandfathered.
184
+ */
185
+ joinRoot<T>(rootId: string, epochId: number, fn: (ctx: Ctx) => T | Promise<T>, options?: {
186
+ readonly principal?: Principal;
187
+ readonly signal?: AbortSignal;
188
+ readonly from?: Connection;
189
+ }): Promise<T>;
190
+ /** Remembers that calls of `rootId` went out on `connection`, which must hear when the root ends. */
191
+ rootSent(rootId: string, connection: Connection): void;
192
+ /** A root ended (here, or announced by its origin): end its leases and tell the links it went out on. */
193
+ endRoot(rootId: string): void;
194
+ /**
195
+ * `from` announced the end of a foreign root (or closed). Honored only if the root came over `from`: a peer cannot
196
+ * end leases of roots it never carried. The root ends when no link that brought it remains.
197
+ */
198
+ foreignRootEnded(rootId: string, from: Connection): void;
199
+ /**
200
+ * Retires the previous epoch once no local roots of it remain. A child also waits for its parent to retire it:
201
+ * roots span hosts, and an old root on the server may still call in.
202
+ */
203
+ maybeRetire(): void;
204
+ allowRetire(epoch: number): void;
205
+ /** Drops the previous epoch: its behaviors and the declarations only it used. */
206
+ retire(): void;
207
+ /**
208
+ * Drops a record's behavior for `epoch` and what only that behavior declared, in disposal order: resources close
209
+ * (reverse open order) before its holds are released.
210
+ */
211
+ retireBehavior(record: RecordImpl, epoch: number): void;
212
+ registry<V>(registry: Registry<V>): RegistryView<V>;
213
+ /** Builds registry tables from (record, declarations) pairs. Throws registry_conflict. */
214
+ buildTables(entries: Iterable<readonly [RecordImpl, Decls]>): Map<string, RegistryTable<unknown>>;
215
+ /** Live records with their current declarations; records waiting for a reload's commit only with `candidates`. */
216
+ liveDecls(candidates?: boolean): [RecordImpl, Decls][];
217
+ checkRegistrations(record: RecordImpl, decls: Decls): void;
218
+ registriesChanged(including?: RecordImpl): void;
219
+ /** A commit failed midway: from now on this host admits no work (calls fail `unavailable/host_failed`). */
220
+ fail(error: unknown): void;
221
+ /** Installs tables for `epoch`; subscribers hear about changed tables of the current epoch (all tables when `all`). */
222
+ installTables(epoch: EpochState, tables: Map<string, RegistryTable<unknown>>, all?: boolean): void;
223
+ get<C extends AnyContract>(type: C, input: InputOf<C>, options?: GetOptions): Handle<C>;
224
+ invalidatePrincipal(match: PrincipalMatch): Promise<void>;
225
+ accept(link: Link, options: AcceptOptions): void;
226
+ connect(link: Link, options?: LinkOptions): void;
227
+ route(prefix: string, route: Route): void;
228
+ /**
229
+ * A child host announced its epoch. In step: usable. Behind: fenced (nothing is routed to it) and reconciled by a
230
+ * reload of its modules to this host's epoch, never by renumbering what it runs. Ahead: impossible, refused.
231
+ */
232
+ peerHello(connection: Connection, epoch: number): void;
233
+ connectionClosed(connection: Connection): void;
234
+ forgetRemote(handle: RemoteHandle): void;
235
+ /**
236
+ * Relays a hold from `relay.origin` to the host it names. Relaying needs a route: it is where authorization
237
+ * lives. The origin's authorization generation is re-checked after every await and right before forwarding, so a
238
+ * revocation during resolution wins.
239
+ */
240
+ relay(relay: RelayHold): Promise<void>;
241
+ reload(plugins: readonly PluginRef[], options?: ReloadOptions): Promise<ReloadReport>;
242
+ onReloadFrame(connection: Connection, frame: Extract<Frame, {
243
+ t: "prepare" | "commit" | "abort";
244
+ }>): void;
245
+ rememberRemoteModules(remote: Readonly<Record<string, readonly string[]>> | undefined, remove: Readonly<Record<string, readonly string[]>> | undefined): void;
246
+ /** The epoch id the next reload would commit. */
247
+ peekNextEpoch(): number;
248
+ /**
249
+ * Disposes every record, holders before what they hold (a resource's `close` may still use the objects its record
250
+ * holds, local or remote), then closes the links.
251
+ */
252
+ close(): Promise<void>;
253
+ }
254
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AACA,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