@happyvertical/smrt-web 0.51.32 → 0.51.34

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 (47) hide show
  1. package/dist/__typechecks__/webmcp-tool-definition.d.ts +2 -0
  2. package/dist/__typechecks__/webmcp-tool-definition.d.ts.map +1 -0
  3. package/dist/ai.d.ts +330 -358
  4. package/dist/ai.d.ts.map +1 -0
  5. package/dist/capability-classification.d.ts +89 -0
  6. package/dist/capability-classification.d.ts.map +1 -0
  7. package/dist/capability.d.ts +191 -0
  8. package/dist/capability.d.ts.map +1 -0
  9. package/dist/data-query.d.ts +121 -0
  10. package/dist/data-query.d.ts.map +1 -0
  11. package/dist/data-surface-actions.d.ts +118 -0
  12. package/dist/data-surface-actions.d.ts.map +1 -0
  13. package/dist/durable-store.d.ts +88 -0
  14. package/dist/durable-store.d.ts.map +1 -0
  15. package/dist/index.d.ts +468 -2245
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/intents.d.ts +273 -300
  18. package/dist/intents.d.ts.map +1 -0
  19. package/dist/internal.d.ts +15 -0
  20. package/dist/internal.d.ts.map +1 -0
  21. package/dist/offline/durable-queue.d.ts +171 -0
  22. package/dist/offline/durable-queue.d.ts.map +1 -0
  23. package/dist/offline/engine.d.ts +359 -0
  24. package/dist/offline/engine.d.ts.map +1 -0
  25. package/dist/offline/leader.d.ts +57 -0
  26. package/dist/offline/leader.d.ts.map +1 -0
  27. package/dist/offline/types.d.ts +232 -0
  28. package/dist/offline/types.d.ts.map +1 -0
  29. package/dist/offline.d.ts +258 -0
  30. package/dist/offline.d.ts.map +1 -0
  31. package/dist/persistence/snapshot-store.d.ts +121 -0
  32. package/dist/persistence/snapshot-store.d.ts.map +1 -0
  33. package/dist/persistence.d.ts +157 -0
  34. package/dist/persistence.d.ts.map +1 -0
  35. package/dist/remote-query.d.ts +61 -0
  36. package/dist/remote-query.d.ts.map +1 -0
  37. package/dist/sse-client.d.ts +182 -0
  38. package/dist/sse-client.d.ts.map +1 -0
  39. package/dist/update-state/meta-store.d.ts +66 -0
  40. package/dist/update-state/meta-store.d.ts.map +1 -0
  41. package/dist/update-state.d.ts +115 -0
  42. package/dist/update-state.d.ts.map +1 -0
  43. package/dist/webmcp-tool-names.d.ts +106 -112
  44. package/dist/webmcp-tool-names.d.ts.map +1 -0
  45. package/dist/webmcp.d.ts +193 -653
  46. package/dist/webmcp.d.ts.map +1 -0
  47. package/package.json +4 -4
@@ -1,112 +1,106 @@
1
- /**
2
- * Reserve `names` for `owner` against the document's WebMCP registry.
3
- *
4
- * Reservation is ALL-OR-NOTHING: if any name is already held — by this path
5
- * or another — nothing is reserved and a {@link WebMcpToolNameCollisionError}
6
- * naming the colliding name and its current owner is thrown synchronously,
7
- * before any tool reaches `document.modelContext`. Duplicates within `names`
8
- * itself collide the same way.
9
- *
10
- * Off-WebMCP (no document) the call is a no-op returning an inert
11
- * reservation, matching every registrar's own no-op guarantee.
12
- *
13
- * A reservation releases only the names it took: `release()` never drops a
14
- * name a later reservation has since acquired, so a dispose that lands after
15
- * a same-name re-registration cannot revoke the new holder's claim.
16
- */
17
- export declare function reserveWebMcpToolNames(names: readonly string[], owner: WebMcpToolNameOwner, options?: ReserveWebMcpToolNamesOptions): WebMcpToolNameReservation;
18
-
19
- export declare interface ReserveWebMcpToolNamesOptions {
20
- /**
21
- * The document whose `modelContext` the names are registered against.
22
- * Defaults to `globalThis.document`. Registrars that accept an injectable
23
- * document (tests, non-window hosts) must pass the SAME object they read
24
- * `modelContext` from, or their reservations land in a different table.
25
- */
26
- document?: unknown;
27
- }
28
-
29
- /**
30
- * Thrown synchronously when a name is already held. Carries the colliding
31
- * name and the owner that holds it so a host can report both without parsing
32
- * the message.
33
- */
34
- export declare class WebMcpToolNameCollisionError extends Error {
35
- readonly toolName: string;
36
- /** The path that already holds {@link toolName}. */
37
- readonly owner: WebMcpToolNameOwner;
38
- /** The path that tried to take it. */
39
- readonly requestedBy: WebMcpToolNameOwner;
40
- constructor(toolName: string,
41
- /** The path that already holds {@link toolName}. */
42
- owner: WebMcpToolNameOwner,
43
- /** The path that tried to take it. */
44
- requestedBy: WebMcpToolNameOwner);
45
- }
46
-
47
- /**
48
- * Document-global WebMCP tool-name lock (#2613).
49
- *
50
- * A browser tool name is derived independently on three paths that all end at
51
- * the same `document.modelContext`:
52
- *
53
- * 1. **generated** model tools — `<namespace>_<model>_<action>`, built by
54
- * `registerWebMcpTools` from the exposure policy;
55
- * 2. **ui** — the six fixed `smrt_ui_*` tools a UI layer registers under a
56
- * configurable prefix (`registerWebMcpUiTools` in `@happyvertical/smrt-svelte`);
57
- * 3. **intent** / **bespoke** — declared view intents (#2588) and hand-written
58
- * `useWebMcpTool` tools, whose names come from the declaration `id` or the
59
- * spec `name`.
60
- *
61
- * None of the three can see the others at declaration time: a namespace and a
62
- * UI prefix are runtime values a declaration never sees. `registerWebMcpTools`
63
- * rejects duplicates WITHIN its own prospective set, but nothing checked
64
- * ACROSS the paths, so a collision reached the host — which rejects the later
65
- * registration and leaves the tool silently absent.
66
- *
67
- * This module is the shared reservation table those paths coordinate through.
68
- * It is an AVAILABILITY guard, not a trust boundary: every path stays
69
- * fail-closed and browser-only regardless, and a collision loses a tool rather
70
- * than granting one. The authenticated REST surface remains the auth, tenant,
71
- * and field-write boundary.
72
- *
73
- * ## Why the table lives on the document, not in this module
74
- *
75
- * The lock must be shared by every registrar reachable from one page, which
76
- * spans package boundaries (`smrt-web` and a UI layer) and therefore possibly
77
- * more than one copy of this module — a second bundle chunk, a duplicated
78
- * dependency, or an HMR reload that replaces module state while the host
79
- * registry keeps every tool it already accepted. Module-level state loses the
80
- * reservations in all of those cases, and a lost reservation is worse than no
81
- * lock: it lets a duplicate through, or (on the release side) strands a name
82
- * forever. The table is therefore stored on the `document` object itself under
83
- * a cross-realm `Symbol.for` key, which every copy of this module resolves to
84
- * the same slot.
85
- *
86
- * The table is additionally stamped with the `modelContext` it was built for.
87
- * When a host installs a NEW model context on the same document — a fresh
88
- * origin-trial registry, or a test harness swapping the double — every tool
89
- * the old registry held is gone, so the table resets rather than stranding
90
- * those names.
91
- *
92
- * This module is dependency-free by design (see the package's dependency-DAG
93
- * guardrails) and ships as the `@happyvertical/smrt-web/webmcp-tool-names`
94
- * entry so a UI layer can reserve its fixed tool names without pulling in the
95
- * client-data engine.
96
- */
97
- /** Which registration path holds a reserved WebMCP tool name. */
98
- export declare type WebMcpToolNameOwner = 'generated' | 'ui' | 'intent' | 'bespoke';
99
-
100
- /**
101
- * The owner currently holding `name` on this document, or undefined. For
102
- * diagnostics and tests; registration paths use
103
- * {@link reserveWebMcpToolNames}, which is atomic.
104
- */
105
- export declare function webMcpToolNameOwner(name: string, options?: ReserveWebMcpToolNamesOptions): WebMcpToolNameOwner | undefined;
106
-
107
- /** Releases every name one reservation holds. Idempotent. */
108
- export declare interface WebMcpToolNameReservation {
109
- release(): void;
110
- }
111
-
112
- export { }
1
+ /**
2
+ * Document-global WebMCP tool-name lock (#2613).
3
+ *
4
+ * A browser tool name is derived independently on three paths that all end at
5
+ * the same `document.modelContext`:
6
+ *
7
+ * 1. **generated** model tools — `<namespace>_<model>_<action>`, built by
8
+ * `registerWebMcpTools` from the exposure policy;
9
+ * 2. **ui** — the six fixed `smrt_ui_*` tools a UI layer registers under a
10
+ * configurable prefix (`registerWebMcpUiTools` in `@happyvertical/smrt-svelte`);
11
+ * 3. **intent** / **bespoke** — declared view intents (#2588) and hand-written
12
+ * `useWebMcpTool` tools, whose names come from the declaration `id` or the
13
+ * spec `name`.
14
+ *
15
+ * None of the three can see the others at declaration time: a namespace and a
16
+ * UI prefix are runtime values a declaration never sees. `registerWebMcpTools`
17
+ * rejects duplicates WITHIN its own prospective set, but nothing checked
18
+ * ACROSS the paths, so a collision reached the host — which rejects the later
19
+ * registration and leaves the tool silently absent.
20
+ *
21
+ * This module is the shared reservation table those paths coordinate through.
22
+ * It is an AVAILABILITY guard, not a trust boundary: every path stays
23
+ * fail-closed and browser-only regardless, and a collision loses a tool rather
24
+ * than granting one. The authenticated REST surface remains the auth, tenant,
25
+ * and field-write boundary.
26
+ *
27
+ * ## Why the table lives on the document, not in this module
28
+ *
29
+ * The lock must be shared by every registrar reachable from one page, which
30
+ * spans package boundaries (`smrt-web` and a UI layer) and therefore possibly
31
+ * more than one copy of this module — a second bundle chunk, a duplicated
32
+ * dependency, or an HMR reload that replaces module state while the host
33
+ * registry keeps every tool it already accepted. Module-level state loses the
34
+ * reservations in all of those cases, and a lost reservation is worse than no
35
+ * lock: it lets a duplicate through, or (on the release side) strands a name
36
+ * forever. The table is therefore stored on the `document` object itself under
37
+ * a cross-realm `Symbol.for` key, which every copy of this module resolves to
38
+ * the same slot.
39
+ *
40
+ * The table is additionally stamped with the `modelContext` it was built for.
41
+ * When a host installs a NEW model context on the same document — a fresh
42
+ * origin-trial registry, or a test harness swapping the double — every tool
43
+ * the old registry held is gone, so the table resets rather than stranding
44
+ * those names.
45
+ *
46
+ * This module is dependency-free by design (see the package's dependency-DAG
47
+ * guardrails) and ships as the `@happyvertical/smrt-web/webmcp-tool-names`
48
+ * entry so a UI layer can reserve its fixed tool names without pulling in the
49
+ * client-data engine.
50
+ */
51
+ /** Which registration path holds a reserved WebMCP tool name. */
52
+ export type WebMcpToolNameOwner = 'generated' | 'ui' | 'intent' | 'bespoke';
53
+ /**
54
+ * Thrown synchronously when a name is already held. Carries the colliding
55
+ * name and the owner that holds it so a host can report both without parsing
56
+ * the message.
57
+ */
58
+ export declare class WebMcpToolNameCollisionError extends Error {
59
+ readonly toolName: string;
60
+ /** The path that already holds {@link toolName}. */
61
+ readonly owner: WebMcpToolNameOwner;
62
+ /** The path that tried to take it. */
63
+ readonly requestedBy: WebMcpToolNameOwner;
64
+ constructor(toolName: string,
65
+ /** The path that already holds {@link toolName}. */
66
+ owner: WebMcpToolNameOwner,
67
+ /** The path that tried to take it. */
68
+ requestedBy: WebMcpToolNameOwner);
69
+ }
70
+ /** Releases every name one reservation holds. Idempotent. */
71
+ export interface WebMcpToolNameReservation {
72
+ release(): void;
73
+ }
74
+ export interface ReserveWebMcpToolNamesOptions {
75
+ /**
76
+ * The document whose `modelContext` the names are registered against.
77
+ * Defaults to `globalThis.document`. Registrars that accept an injectable
78
+ * document (tests, non-window hosts) must pass the SAME object they read
79
+ * `modelContext` from, or their reservations land in a different table.
80
+ */
81
+ document?: unknown;
82
+ }
83
+ /**
84
+ * Reserve `names` for `owner` against the document's WebMCP registry.
85
+ *
86
+ * Reservation is ALL-OR-NOTHING: if any name is already held — by this path
87
+ * or another — nothing is reserved and a {@link WebMcpToolNameCollisionError}
88
+ * naming the colliding name and its current owner is thrown synchronously,
89
+ * before any tool reaches `document.modelContext`. Duplicates within `names`
90
+ * itself collide the same way.
91
+ *
92
+ * Off-WebMCP (no document) the call is a no-op returning an inert
93
+ * reservation, matching every registrar's own no-op guarantee.
94
+ *
95
+ * A reservation releases only the names it took: `release()` never drops a
96
+ * name a later reservation has since acquired, so a dispose that lands after
97
+ * a same-name re-registration cannot revoke the new holder's claim.
98
+ */
99
+ export declare function reserveWebMcpToolNames(names: readonly string[], owner: WebMcpToolNameOwner, options?: ReserveWebMcpToolNamesOptions): WebMcpToolNameReservation;
100
+ /**
101
+ * The owner currently holding `name` on this document, or undefined. For
102
+ * diagnostics and tests; registration paths use
103
+ * {@link reserveWebMcpToolNames}, which is atomic.
104
+ */
105
+ export declare function webMcpToolNameOwner(name: string, options?: ReserveWebMcpToolNamesOptions): WebMcpToolNameOwner | undefined;
106
+ //# sourceMappingURL=webmcp-tool-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp-tool-names.d.ts","sourceRoot":"","sources":["../src/webmcp-tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IAEnD,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,mBAAmB;IACnC,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,mBAAmB;gBAJhC,QAAQ,EAAE,MAAM;IACzB,oDAAoD;IAC3C,KAAK,EAAE,mBAAmB;IACnC,sCAAsC;IAC7B,WAAW,EAAE,mBAAmB;CAO5C;AAED,6DAA6D;AAC7D,MAAM,WAAW,yBAAyB;IACxC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2CD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE,6BAAkC,GAC1C,yBAAyB,CAqC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,6BAAkC,GAC1C,mBAAmB,GAAG,SAAS,CAIjC"}