@happyvertical/smrt-web 0.51.32 → 0.51.33
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.
- package/dist/__typechecks__/webmcp-tool-definition.d.ts +2 -0
- package/dist/__typechecks__/webmcp-tool-definition.d.ts.map +1 -0
- package/dist/ai.d.ts +330 -358
- package/dist/ai.d.ts.map +1 -0
- package/dist/capability-classification.d.ts +89 -0
- package/dist/capability-classification.d.ts.map +1 -0
- package/dist/capability.d.ts +191 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/data-query.d.ts +121 -0
- package/dist/data-query.d.ts.map +1 -0
- package/dist/data-surface-actions.d.ts +118 -0
- package/dist/data-surface-actions.d.ts.map +1 -0
- package/dist/durable-store.d.ts +88 -0
- package/dist/durable-store.d.ts.map +1 -0
- package/dist/index.d.ts +468 -2245
- package/dist/index.d.ts.map +1 -0
- package/dist/intents.d.ts +273 -300
- package/dist/intents.d.ts.map +1 -0
- package/dist/internal.d.ts +15 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/offline/durable-queue.d.ts +171 -0
- package/dist/offline/durable-queue.d.ts.map +1 -0
- package/dist/offline/engine.d.ts +359 -0
- package/dist/offline/engine.d.ts.map +1 -0
- package/dist/offline/leader.d.ts +57 -0
- package/dist/offline/leader.d.ts.map +1 -0
- package/dist/offline/types.d.ts +232 -0
- package/dist/offline/types.d.ts.map +1 -0
- package/dist/offline.d.ts +258 -0
- package/dist/offline.d.ts.map +1 -0
- package/dist/persistence/snapshot-store.d.ts +121 -0
- package/dist/persistence/snapshot-store.d.ts.map +1 -0
- package/dist/persistence.d.ts +157 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/remote-query.d.ts +61 -0
- package/dist/remote-query.d.ts.map +1 -0
- package/dist/sse-client.d.ts +182 -0
- package/dist/sse-client.d.ts.map +1 -0
- package/dist/update-state/meta-store.d.ts +66 -0
- package/dist/update-state/meta-store.d.ts.map +1 -0
- package/dist/update-state.d.ts +115 -0
- package/dist/update-state.d.ts.map +1 -0
- package/dist/webmcp-tool-names.d.ts +106 -112
- package/dist/webmcp-tool-names.d.ts.map +1 -0
- package/dist/webmcp.d.ts +193 -653
- package/dist/webmcp.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1,112 +1,106 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* the
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* the
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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"}
|