@ggui-ai/mcp-server-handlers 0.7.0 → 0.9.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.
- package/dist/blueprints/index.d.ts +2 -2
- package/dist/blueprints/index.d.ts.map +1 -1
- package/dist/blueprints/index.js +1 -1
- package/dist/blueprints/search-blueprints.d.ts +64 -12
- package/dist/blueprints/search-blueprints.d.ts.map +1 -1
- package/dist/blueprints/search-blueprints.js +166 -16
- package/dist/renders/amend.d.ts +57 -0
- package/dist/renders/amend.d.ts.map +1 -0
- package/dist/renders/amend.js +64 -0
- package/dist/renders/apply-ggui-session-patch.d.ts +4 -0
- package/dist/renders/apply-ggui-session-patch.d.ts.map +1 -1
- package/dist/renders/apply-ggui-session-patch.js +1 -1
- package/dist/renders/assert-props-contract.d.ts +5 -4
- package/dist/renders/assert-props-contract.d.ts.map +1 -1
- package/dist/renders/assert-props-contract.js +6 -5
- package/dist/renders/code-delivery-events.d.ts +45 -29
- package/dist/renders/code-delivery-events.d.ts.map +1 -1
- package/dist/renders/code-delivery-events.js +42 -25
- package/dist/renders/consume.js +1 -1
- package/dist/renders/decide-handshake.d.ts +15 -0
- package/dist/renders/decide-handshake.d.ts.map +1 -1
- package/dist/renders/decide-handshake.js +18 -0
- package/dist/renders/declare-tool-catalog.js +1 -1
- package/dist/renders/handshake.d.ts.map +1 -1
- package/dist/renders/handshake.js +58 -12
- package/dist/renders/index.d.ts +5 -1
- package/dist/renders/index.d.ts.map +1 -1
- package/dist/renders/index.js +5 -1
- package/dist/renders/props-mutation-core.d.ts +60 -0
- package/dist/renders/props-mutation-core.d.ts.map +1 -0
- package/dist/renders/props-mutation-core.js +339 -0
- package/dist/renders/render.d.ts +2 -0
- package/dist/renders/render.d.ts.map +1 -1
- package/dist/renders/render.js +61 -32
- package/dist/renders/runtime-pull.d.ts +122 -0
- package/dist/renders/runtime-pull.d.ts.map +1 -0
- package/dist/renders/runtime-pull.js +178 -0
- package/dist/renders/runtime-telemetry.d.ts +60 -0
- package/dist/renders/runtime-telemetry.d.ts.map +1 -0
- package/dist/renders/runtime-telemetry.js +76 -0
- package/dist/renders/slice-meta-derivation.d.ts +146 -6
- package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
- package/dist/renders/slice-meta-derivation.js +190 -8
- package/dist/renders/submit-action.d.ts +9 -0
- package/dist/renders/submit-action.d.ts.map +1 -1
- package/dist/renders/submit-action.js +70 -1
- package/dist/renders/update.d.ts +33 -42
- package/dist/renders/update.d.ts.map +1 -1
- package/dist/renders/update.js +99 -230
- package/package.json +7 -7
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Named events for the content-addressable code-delivery channel.
|
|
3
3
|
*
|
|
4
|
-
* `codeUrl` is the
|
|
5
|
-
* envelope
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
-
* happens next is deployment-shaped:
|
|
4
|
+
* `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
|
|
5
|
+
* COMPILED-COMPONENT envelope — since #471 it is no longer the only
|
|
6
|
+
* static one: `deriveRenderMeta` also stamps the size-capped inline
|
|
7
|
+
* `codeB64` twin, independent of this channel's store. A failed
|
|
8
|
+
* `codeUrl` mint therefore usually IS absorbed by the inline channel;
|
|
9
|
+
* what it still costs is deployment-shaped:
|
|
12
10
|
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* - A deployment with neither loses the mount for that one
|
|
22
|
-
* envelope.
|
|
11
|
+
* - Every under-cap compiled render keeps mounting via `codeB64`
|
|
12
|
+
* (and, when minted, the live trio). The loss is the browser-
|
|
13
|
+
* cacheable content-addressable URL — repeat renders of the same
|
|
14
|
+
* bytes re-ship them inline instead of hitting HTTP cache.
|
|
15
|
+
* - An OVER-CAP render (no `codeB64`) falls back to exactly the
|
|
16
|
+
* pre-#471 posture: live trio mounts it; a host that resolves
|
|
17
|
+
* `resourceUri` re-mints `codeUrl` at READ time; a deployment
|
|
18
|
+
* with neither loses the mount for that one envelope.
|
|
23
19
|
*
|
|
24
|
-
* None of
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* None of this is distinguishable from the wire — the render reports
|
|
21
|
+
* success either way — which is why the failure is emitted under a
|
|
22
|
+
* name instead of swallowed. The event carries whether a live channel
|
|
23
|
+
* is wired; combined with the render's size class it separates
|
|
24
|
+
* "slower / uncacheable delivery" from "this envelope cannot mount".
|
|
29
25
|
*/
|
|
30
26
|
/**
|
|
31
27
|
* Every event this module can emit. Closed union — a new emitter picks
|
|
@@ -33,7 +29,7 @@
|
|
|
33
29
|
* compile error rather than an alert filter that quietly stops
|
|
34
30
|
* matching.
|
|
35
31
|
*/
|
|
36
|
-
export type CodeDeliveryEvent = 'render_code_write_failed';
|
|
32
|
+
export type CodeDeliveryEvent = 'render_code_write_failed' | 'render_code_b64_over_cap';
|
|
37
33
|
/**
|
|
38
34
|
* The event names as values, so every emitter — in this package or a
|
|
39
35
|
* storage backend elsewhere — spells them from one place.
|
|
@@ -41,10 +37,17 @@ export type CodeDeliveryEvent = 'render_code_write_failed';
|
|
|
41
37
|
export declare const CODE_DELIVERY_EVENTS: {
|
|
42
38
|
/**
|
|
43
39
|
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
44
|
-
*
|
|
45
|
-
* what survives.
|
|
40
|
+
* loses the cache-addressable static channel; see the module
|
|
41
|
+
* docstring for what survives.
|
|
46
42
|
*/
|
|
47
43
|
readonly renderCodeWriteFailed: "render_code_write_failed";
|
|
44
|
+
/**
|
|
45
|
+
* A compiled render's source exceeded the inline `codeB64` cap, so
|
|
46
|
+
* the slice was emitted WITHOUT the fetch-free channel. On hosts
|
|
47
|
+
* whose iframe CSP blocks fetches AND WebSockets, that render
|
|
48
|
+
* cannot paint — the omission must be visible, not silent.
|
|
49
|
+
*/
|
|
50
|
+
readonly renderCodeB64OverCap: "render_code_b64_over_cap";
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
53
|
* What an emitter knows at the point the mint failed.
|
|
@@ -58,9 +61,11 @@ export interface RenderCodeWriteFailure {
|
|
|
58
61
|
* Whether this deployment mints live-channel credentials.
|
|
59
62
|
*
|
|
60
63
|
* `true` ⇒ the render still mounts over the WS subscribe; the loss
|
|
61
|
-
* is the instant first paint. `false` ⇒
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
+
* is the instant first paint. `false` ⇒ the envelope mounts only
|
|
65
|
+
* through the inline `codeB64` channel (present for every under-cap
|
|
66
|
+
* compiled render, independent of this store); an OVER-CAP render
|
|
67
|
+
* with `false` here truly has no mount mode, and only a host that
|
|
68
|
+
* resolves `resourceUri` will still produce a card.
|
|
64
69
|
*/
|
|
65
70
|
readonly liveChannelWired: boolean;
|
|
66
71
|
/** Whatever the store threw. Unshaped by construction. */
|
|
@@ -73,4 +78,15 @@ export interface RenderCodeWriteFailure {
|
|
|
73
78
|
* committed must not fail because its delivery-channel telemetry did.
|
|
74
79
|
*/
|
|
75
80
|
export declare function reportRenderCodeWriteFailed(failure: RenderCodeWriteFailure): void;
|
|
81
|
+
/**
|
|
82
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
|
|
83
|
+
*
|
|
84
|
+
* Never throws — same posture as the write-failure emitter above.
|
|
85
|
+
*/
|
|
86
|
+
export declare function reportRenderCodeB64OverCap(over: {
|
|
87
|
+
readonly sessionId: string;
|
|
88
|
+
readonly appId: string;
|
|
89
|
+
/** UTF-8 byte length of the compiled source that exceeded the cap. */
|
|
90
|
+
readonly sourceBytes: number;
|
|
91
|
+
}): void;
|
|
76
92
|
//# sourceMappingURL=code-delivery-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;OAIG;;IAEH;;;;;OAKG;;CAEiD,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,GAAG,IAAI,CAUP"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Named events for the content-addressable code-delivery channel.
|
|
3
3
|
*
|
|
4
|
-
* `codeUrl` is the
|
|
5
|
-
* envelope
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
-
* happens next is deployment-shaped:
|
|
4
|
+
* `codeUrl` is the CACHE-ADDRESSABLE static delivery surface of a
|
|
5
|
+
* COMPILED-COMPONENT envelope — since #471 it is no longer the only
|
|
6
|
+
* static one: `deriveRenderMeta` also stamps the size-capped inline
|
|
7
|
+
* `codeB64` twin, independent of this channel's store. A failed
|
|
8
|
+
* `codeUrl` mint therefore usually IS absorbed by the inline channel;
|
|
9
|
+
* what it still costs is deployment-shaped:
|
|
12
10
|
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* - A deployment with neither loses the mount for that one
|
|
22
|
-
* envelope.
|
|
11
|
+
* - Every under-cap compiled render keeps mounting via `codeB64`
|
|
12
|
+
* (and, when minted, the live trio). The loss is the browser-
|
|
13
|
+
* cacheable content-addressable URL — repeat renders of the same
|
|
14
|
+
* bytes re-ship them inline instead of hitting HTTP cache.
|
|
15
|
+
* - An OVER-CAP render (no `codeB64`) falls back to exactly the
|
|
16
|
+
* pre-#471 posture: live trio mounts it; a host that resolves
|
|
17
|
+
* `resourceUri` re-mints `codeUrl` at READ time; a deployment
|
|
18
|
+
* with neither loses the mount for that one envelope.
|
|
23
19
|
*
|
|
24
|
-
* None of
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* None of this is distinguishable from the wire — the render reports
|
|
21
|
+
* success either way — which is why the failure is emitted under a
|
|
22
|
+
* name instead of swallowed. The event carries whether a live channel
|
|
23
|
+
* is wired; combined with the render's size class it separates
|
|
24
|
+
* "slower / uncacheable delivery" from "this envelope cannot mount".
|
|
29
25
|
*/
|
|
30
26
|
/**
|
|
31
27
|
* The event names as values, so every emitter — in this package or a
|
|
@@ -34,10 +30,17 @@
|
|
|
34
30
|
export const CODE_DELIVERY_EVENTS = {
|
|
35
31
|
/**
|
|
36
32
|
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
37
|
-
*
|
|
38
|
-
* what survives.
|
|
33
|
+
* loses the cache-addressable static channel; see the module
|
|
34
|
+
* docstring for what survives.
|
|
39
35
|
*/
|
|
40
36
|
renderCodeWriteFailed: 'render_code_write_failed',
|
|
37
|
+
/**
|
|
38
|
+
* A compiled render's source exceeded the inline `codeB64` cap, so
|
|
39
|
+
* the slice was emitted WITHOUT the fetch-free channel. On hosts
|
|
40
|
+
* whose iframe CSP blocks fetches AND WebSockets, that render
|
|
41
|
+
* cannot paint — the omission must be visible, not silent.
|
|
42
|
+
*/
|
|
43
|
+
renderCodeB64OverCap: 'render_code_b64_over_cap',
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
46
|
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
|
|
@@ -58,3 +61,17 @@ export function reportRenderCodeWriteFailed(failure) {
|
|
|
58
61
|
errorName: failure.cause instanceof Error ? failure.cause.name : undefined,
|
|
59
62
|
}));
|
|
60
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeB64OverCap}.
|
|
66
|
+
*
|
|
67
|
+
* Never throws — same posture as the write-failure emitter above.
|
|
68
|
+
*/
|
|
69
|
+
export function reportRenderCodeB64OverCap(over) {
|
|
70
|
+
// eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
|
|
71
|
+
console.warn(JSON.stringify({
|
|
72
|
+
msg: CODE_DELIVERY_EVENTS.renderCodeB64OverCap,
|
|
73
|
+
sessionId: over.sessionId,
|
|
74
|
+
appId: over.appId,
|
|
75
|
+
sourceBytes: over.sourceBytes,
|
|
76
|
+
}));
|
|
77
|
+
}
|
package/dist/renders/consume.js
CHANGED
|
@@ -75,7 +75,7 @@ export function createGguiConsumeHandler(deps) {
|
|
|
75
75
|
name: 'ggui_consume',
|
|
76
76
|
title: 'Consume',
|
|
77
77
|
audience: ['agent'],
|
|
78
|
-
description: 'Long-poll for buffered events on a GguiSession. CALL THIS RIGHT AFTER EVERY `ggui_render` THAT RETURNS `nextStep.tool === "ggui_consume"` — that hint is your cue to start listening for the user\'s gesture. Keyed by sessionId (global UUID); tenancy-checked via ctx.appId. Inline long-poll: `timeout` is an integer in [0, 25] seconds (values outside reject INVALID_PARAMS — host MCP clients abort longer tool calls; pick 5-15s typical, 25 max). Returns `{events, status}` — each event carries `{intent, actionData, uiContext, actionId, firedAt}`: `actionData` is WHAT the user did, `uiContext` is the iframe-local snapshot of the contract\'s contextSpec slots AT THE MOMENT they did it. Both inform your reaction without a second round trip. Returns immediately when an action event arrives OR the render completes OR the timeout elapses. On timeout with no event, re-call ggui_consume to keep waiting. THE LOOP: when `events` is non-empty, REACT, then re-call `ggui_consume` to wait for the next event. Exit only when status:"expired". IMPORTANT — the iframe state is independent of your backend state: after you mutate via domain tools (todo_toggle, cart_add, etc.), the UI still shows the OLD props until you call `
|
|
78
|
+
description: 'Long-poll for buffered events on a GguiSession. CALL THIS RIGHT AFTER EVERY `ggui_render` THAT RETURNS `nextStep.tool === "ggui_consume"` — that hint is your cue to start listening for the user\'s gesture. Keyed by sessionId (global UUID); tenancy-checked via ctx.appId. Inline long-poll: `timeout` is an integer in [0, 25] seconds (values outside reject INVALID_PARAMS — host MCP clients abort longer tool calls; pick 5-15s typical, 25 max). Returns `{events, status}` — each event carries `{intent, actionData, uiContext, actionId, firedAt}`: `actionData` is WHAT the user did, `uiContext` is the iframe-local snapshot of the contract\'s contextSpec slots AT THE MOMENT they did it. Both inform your reaction without a second round trip. Returns immediately when an action event arrives OR the render completes OR the timeout elapses. On timeout with no event, re-call ggui_consume to keep waiting. THE LOOP: when `events` is non-empty, REACT, then re-call `ggui_consume` to wait for the next event. Exit only when status:"expired". IMPORTANT — the iframe state is independent of your backend state: after you mutate via domain tools (todo_toggle, cart_add, etc.), the UI still shows the OLD props until you call `ggui_amend`. If the events caused observable state changes the user is looking at, your reaction MUST include `ggui_amend` somewhere before re-consuming; otherwise the user sees stale props (the #1 wire compliance bug). Pure-info events that don\'t change displayed state can skip it. `ggui_amend` repaints the SAME card in place (the default move in this loop); `ggui_update` instead renders the state as a NEW card and advances the history number — reserve it for milestones worth a card in the transcript. HOSTS WITH PROGRESSIVE TOOL DISCOVERY (claude.ai-style connectors): if a call here errors with "tool not loaded yet" or "wrong parameter names," call `tool_search({query:"ggui_consume"})` once to warm the tool, then retry with the same args. DO NOT skip the consume — silent gesture drops are the worst protocol failure.',
|
|
79
79
|
inputSchema,
|
|
80
80
|
outputSchema,
|
|
81
81
|
async handler(rawInput, ctx) {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
import { type BlueprintSource, type BlueprintVariance, type DataContract } from '@ggui-ai/protocol';
|
|
44
44
|
import { type LLMCaller } from '@ggui-ai/negotiator';
|
|
45
45
|
import type { HandlerContext } from '../types.js';
|
|
46
|
+
import { type BlueprintMatchResult } from './blueprint-matcher.js';
|
|
46
47
|
import type { BlueprintRegistryDeps } from './blueprint-registry.js';
|
|
47
48
|
import type { HandshakeNegotiator, HandshakeNegotiatorResult } from './handshake.js';
|
|
48
49
|
import type { InstalledBlueprintsProvider } from './installed-blueprints-provider.js';
|
|
@@ -116,6 +117,20 @@ export interface HandshakeDecisionAdapter {
|
|
|
116
117
|
* passes its structured logger. Absent ⇒ silent.
|
|
117
118
|
*/
|
|
118
119
|
warn?(message: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Optional observer for every blueprint-match OUTCOME (hit or miss),
|
|
122
|
+
* called once per pool probed in the Tier-1 find-similar loop.
|
|
123
|
+
* Non-error, non-blocking — purely for cache-hit-ratio observability.
|
|
124
|
+
* Absent ⇒ no-op. OSS ships no default observer; a host MAY wire
|
|
125
|
+
* this to its own structured logger. Enforced non-blocking: a
|
|
126
|
+
* throwing observer is caught, reported via `warn` if present, and
|
|
127
|
+
* never breaks the handshake.
|
|
128
|
+
*/
|
|
129
|
+
onBlueprintMatch?(input: {
|
|
130
|
+
readonly pool: string;
|
|
131
|
+
readonly scope: string;
|
|
132
|
+
readonly result: BlueprintMatchResult;
|
|
133
|
+
}): void;
|
|
119
134
|
/** Optional per-app tool-identity catalog (bare tool → canonical serverInfo).
|
|
120
135
|
* Present ⇒ run the canonicalization step before keying (Tier 1); absent ⇒
|
|
121
136
|
* no-op (Tier 2). Resolved by ctx.appId. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decide-handshake.d.ts","sourceRoot":"","sources":["../../src/renders/decide-handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAGlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"decide-handshake.d.ts","sourceRoot":"","sources":["../../src/renders/decide-handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAGlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAEL,KAAK,mBAAmB,EACz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,KAChB,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,GAAG,mBAAmB,GAAG,SAAS,CAAC;CACjF;AAED,0FAA0F;AAC1F,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AA8HhF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE;IACT,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;CAClC,EACD,MAAM,EAAE,MAAM,GACb,yBAAyB,CAwC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,iBAAiB,GAClC,yBAAyB,CAiC3B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,yBAAyB,CAAC,CA4QpC"}
|
|
@@ -377,6 +377,24 @@ export async function decideHandshake(adapter, input) {
|
|
|
377
377
|
contract: parsedDraft.data,
|
|
378
378
|
...(variance !== undefined ? { variance } : {}),
|
|
379
379
|
});
|
|
380
|
+
// Isolated in its OWN try/catch, separate from the outer
|
|
381
|
+
// pool-probe catch below: onBlueprintMatch's contract promises
|
|
382
|
+
// non-blocking observation, so a throwing observer must never
|
|
383
|
+
// lose an otherwise-successful matchResult (falling into the
|
|
384
|
+
// outer catch would either rethrow a non-operational error or
|
|
385
|
+
// misreport "matchBlueprint probe failed" for a probe that
|
|
386
|
+
// actually succeeded). Observer failures are surfaced via warn
|
|
387
|
+
// and the request proceeds — never rethrown.
|
|
388
|
+
try {
|
|
389
|
+
adapter.onBlueprintMatch?.({
|
|
390
|
+
pool: pool.label ?? scope,
|
|
391
|
+
scope,
|
|
392
|
+
result: matchResult,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
catch (err) {
|
|
396
|
+
adapter.warn?.(`[decideHandshake] onBlueprintMatch observer threw for pool ${pool.label ?? scope}; ignoring: ${errMessage(err)}`);
|
|
397
|
+
}
|
|
380
398
|
// exact-key is a perfect canonical match — it wins immediately over
|
|
381
399
|
// any semantic hit from any pool, but ONLY when the requesting agent
|
|
382
400
|
// can fulfill it: its declared tools must superset the blueprint's
|
|
@@ -57,7 +57,7 @@ const declareOutputSchema = declareToolCatalogOutputSchema.shape;
|
|
|
57
57
|
export function createGguiDeclareToolCatalogHandler(deps) {
|
|
58
58
|
return {
|
|
59
59
|
name: "ggui_runtime_declare_tool_catalog",
|
|
60
|
-
title: "Declare
|
|
60
|
+
title: "[runtime] Declare Tool Catalog",
|
|
61
61
|
audience: ["runtime"],
|
|
62
62
|
// `_meta.ui.visibility: ['app']` keeps this tool off the LLM's
|
|
63
63
|
// `tools/list` (spec-compliant hosts filter `app`-visible tools out
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/renders/handshake.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAExB,KAAK,kBAAkB,EAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACzB,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CAAC;IACtC,QAAQ,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,GAAG,SAAS,CAOpB"}
|
|
@@ -278,7 +278,7 @@ export function createGguiHandshakeHandler(deps) {
|
|
|
278
278
|
});
|
|
279
279
|
const nextStep = buildNextStepHint({
|
|
280
280
|
handshakeId,
|
|
281
|
-
|
|
281
|
+
contract: negotiated.effectiveContract,
|
|
282
282
|
});
|
|
283
283
|
const serverCapabilities = deps.serverCapabilities?.();
|
|
284
284
|
// Truncate `reason` to the wire-output cap (280 chars).
|
|
@@ -405,10 +405,15 @@ function isJsonObject(v) {
|
|
|
405
405
|
* `nextStep.example` verbatim into its next `ggui_render` call.
|
|
406
406
|
*/
|
|
407
407
|
function buildNextStepHint(input) {
|
|
408
|
-
const { handshakeId,
|
|
409
|
-
// `props` is REQUIRED on the
|
|
410
|
-
//
|
|
411
|
-
|
|
408
|
+
const { handshakeId, contract } = input;
|
|
409
|
+
// `props` is REQUIRED on the renderInputSchema, and the proposed
|
|
410
|
+
// contract's REQUIRED prop entries must appear in it — a bare `{}`
|
|
411
|
+
// example against such a contract fails validation when followed
|
|
412
|
+
// verbatim (a live agent flagged exactly that, 2026-08-12). Derive
|
|
413
|
+
// the example from the effective contract: required entries keyed
|
|
414
|
+
// with their declared `example`/`default` when present, else a
|
|
415
|
+
// type-shaped placeholder. No required props → `{}` stays honest.
|
|
416
|
+
const propsExample = buildPropsExample(contract) ?? '{}';
|
|
412
417
|
// ACCEPT shape: omit `override` entirely — the agent reuses the
|
|
413
418
|
// proposed contract. (Re-aim via `override:{variance}` / `override:
|
|
414
419
|
// {contract}` is taught in the description, not the default hint.)
|
|
@@ -419,14 +424,55 @@ function buildNextStepHint(input) {
|
|
|
419
424
|
};
|
|
420
425
|
}
|
|
421
426
|
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
+
* JSON example for the REQUIRED entries of the contract's propsSpec.
|
|
428
|
+
* Prefers each entry's declared `example`, then `default`, then a
|
|
429
|
+
* type-shaped placeholder from its JSON Schema (first enum member,
|
|
430
|
+
* else '' / 0 / false / [] / {}). Returns undefined when the contract
|
|
431
|
+
* has no required props — the caller's `{}` fallback is then valid
|
|
432
|
+
* verbatim.
|
|
427
433
|
*/
|
|
428
|
-
function buildPropsExample(
|
|
429
|
-
|
|
434
|
+
function buildPropsExample(contract) {
|
|
435
|
+
const properties = contract.propsSpec?.properties;
|
|
436
|
+
if (properties === undefined)
|
|
437
|
+
return undefined;
|
|
438
|
+
const out = {};
|
|
439
|
+
for (const [name, entry] of Object.entries(properties)) {
|
|
440
|
+
if (entry.required !== true)
|
|
441
|
+
continue;
|
|
442
|
+
out[name] =
|
|
443
|
+
entry.example ?? entry.default ?? placeholderForSchema(entry.schema);
|
|
444
|
+
}
|
|
445
|
+
if (Object.keys(out).length === 0)
|
|
446
|
+
return undefined;
|
|
447
|
+
try {
|
|
448
|
+
return JSON.stringify(out);
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
return undefined;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/** Minimal type-shaped placeholder for a JSON Schema. */
|
|
455
|
+
function placeholderForSchema(schema) {
|
|
456
|
+
if (schema === null || typeof schema !== 'object' || Array.isArray(schema)) {
|
|
457
|
+
return '';
|
|
458
|
+
}
|
|
459
|
+
const s = schema;
|
|
460
|
+
if (Array.isArray(s.enum) && s.enum.length > 0) {
|
|
461
|
+
return s.enum[0];
|
|
462
|
+
}
|
|
463
|
+
switch (s.type) {
|
|
464
|
+
case 'number':
|
|
465
|
+
case 'integer':
|
|
466
|
+
return 0;
|
|
467
|
+
case 'boolean':
|
|
468
|
+
return false;
|
|
469
|
+
case 'array':
|
|
470
|
+
return [];
|
|
471
|
+
case 'object':
|
|
472
|
+
return {};
|
|
473
|
+
default:
|
|
474
|
+
return '';
|
|
475
|
+
}
|
|
430
476
|
}
|
|
431
477
|
/**
|
|
432
478
|
* Typed error thrown by `ggui_render` when the supplied handshakeId
|
package/dist/renders/index.d.ts
CHANGED
|
@@ -59,8 +59,12 @@ export { createGguiRenderHandler, type ChannelNotifier, type GenerationCredentia
|
|
|
59
59
|
export { applyRecordOp, DEFAULT_REPLAY_MAX_PER_SESSION, DEFAULT_REPLAY_MAX_RETRIES, EMPTY_BUFFER_STATE, normalizeBufferState, ReplayConflictError, replayFromBufferOp, ReplayMaxRetriesExceededError, ReplayGguiSessionNotFoundError, runSequencedRecord, type ApplyRecordResult, type BufferedReplayEnvelope, type BufferState, type FetchedReplayState, type ReplayResult, type ReplaySequencerDeps, type RunSequencedRecordOptions, type StreamReplayInput, } from "./stream-replay-ops.js";
|
|
60
60
|
export { createGguiEmitHandler, type GguiEmitHandlerDeps, type StreamObserverNotifier, } from "./stream.js";
|
|
61
61
|
export { createGguiSubmitActionHandler } from "./submit-action.js";
|
|
62
|
+
export { createGguiRuntimePullHandler, type GguiRuntimePullHandlerDeps, } from "./runtime-pull.js";
|
|
63
|
+
export { createGguiRuntimeTelemetryHandler, type GguiRuntimeTelemetryHandlerDeps, type RuntimeTelemetryLogger, } from "./runtime-telemetry.js";
|
|
62
64
|
export { createGguiSyncContextHandler, type CreateGguiSyncContextHandlerDeps, } from "./sync-context.js";
|
|
63
65
|
export { createGguiUpdateHandler, type BillingGate, type GguiUpdateHandlerDeps, type PropsUpdateNotifier, } from "./update.js";
|
|
66
|
+
export { createGguiAmendHandler, type GguiAmendHandlerDeps, } from "./amend.js";
|
|
67
|
+
export { mutationInputSchema, runPropsMutation, type PropsMutationResult, } from "./props-mutation-core.js";
|
|
64
68
|
export { matchBlueprint, type BlueprintMatchHit, type BlueprintMatchMiss, type BlueprintMatchResult, type MatchBlueprintDeps, type MatchBlueprintOptions, } from "./blueprint-matcher.js";
|
|
65
69
|
export { BlueprintRejectedError, composeEmbeddingInput, composeExactKey, deleteBlueprint, findBlueprintExact, findBlueprintsByEmbedding, listBlueprints, recordBlueprintHit, registerBlueprint, type Blueprint, type BlueprintCandidate, type BlueprintIndex, type BlueprintKind, type BlueprintRegistryDeps, type ContractValidator, type RegisterBlueprintInput, type RegisterBlueprintOptions, } from "./blueprint-registry.js";
|
|
66
70
|
export { consumeHandshakeRecord, createGguiHandshakeHandler, DEFAULT_GENERATOR_SLUG, HANDSHAKE_RECORD_TTL_SEC, HandshakeNotFoundError, handshakeRecordKey, peekHandshakeRecord, type GguiHandshakeHandlerDeps, type HandshakeNegotiator, type HandshakeNegotiatorResult, type HandshakeRecord, type HandshakeStoredInput, type HandshakeStoredTarget, } from "./handshake.js";
|
|
@@ -68,7 +72,7 @@ export { buildCacheReuseResult, buildCreateFallback, decideHandshake, type Bluep
|
|
|
68
72
|
export { installToCache, type InstallToCacheInput } from "./install-to-cache.js";
|
|
69
73
|
export { createInstalledBlueprintsProvider, type CreateInstalledBlueprintsProviderOptions, type InstalledBlueprintCacheIssue, type CompileResult as InstalledBlueprintCompileResult, type InstalledBlueprintEntry, type InstalledBlueprintsProvider, } from "./installed-blueprints-provider.js";
|
|
70
74
|
export { createInMemoryProvisionalPreviewRegistry, evaluateProvisionalPreviewGate, finalizeProvisionalPreview, kickoffProvisionalPreview, PreviewAbortError, PROVISIONAL_PREVIEW_CHANNEL, runProvisionalPreview, type ProvisionalPreviewConfig, type ProvisionalPreviewContext, type ProvisionalPreviewDeps, type ProvisionalPreviewEmit, type ProvisionalPreviewEmitter, type ProvisionalPreviewGate, type ProvisionalPreviewGateInput, type ProvisionalPreviewHandle, type ProvisionalPreviewOutcome, type ProvisionalPreviewRegistry, type ProvisionalPreviewRunContext, type ProvisionalPreviewSkipReason, } from "./provisional-preview.js";
|
|
71
|
-
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, resolveGadgetUrls, type RenderMetaView, type RenderSliceBase, type RenderSliceMetaDeps, } from "./slice-meta-derivation.js";
|
|
75
|
+
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, spreadRenderMetaViewOntoSlice, rewritePrivateBundleUrls, wsOriginToHttpOrigin, PRIVATE_BUNDLE_PREFIX, resolveGadgetUrls, type RenderMetaView, type RenderSliceBase, type RenderSliceMetaDeps, } from "./slice-meta-derivation.js";
|
|
72
76
|
export type { SeedPoolSource } from "./seed-pool-source.js";
|
|
73
77
|
export { buildSeedPool, type BuildSeedPoolOptions } from "./build-seed-pool.js";
|
|
74
78
|
export { listRegistryBlueprintsForExport, type ExportableBlueprint } from './export-registry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,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AKjG,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,GACpC,MAAM,sBAAsB,CAAC"}
|
package/dist/renders/index.js
CHANGED
|
@@ -65,8 +65,12 @@ export { createGguiRenderHandler, } from "./render.js";
|
|
|
65
65
|
export { applyRecordOp, DEFAULT_REPLAY_MAX_PER_SESSION, DEFAULT_REPLAY_MAX_RETRIES, EMPTY_BUFFER_STATE, normalizeBufferState, ReplayConflictError, replayFromBufferOp, ReplayMaxRetriesExceededError, ReplayGguiSessionNotFoundError, runSequencedRecord, } from "./stream-replay-ops.js";
|
|
66
66
|
export { createGguiEmitHandler, } from "./stream.js";
|
|
67
67
|
export { createGguiSubmitActionHandler } from "./submit-action.js";
|
|
68
|
+
export { createGguiRuntimePullHandler, } from "./runtime-pull.js";
|
|
69
|
+
export { createGguiRuntimeTelemetryHandler, } from "./runtime-telemetry.js";
|
|
68
70
|
export { createGguiSyncContextHandler, } from "./sync-context.js";
|
|
69
71
|
export { createGguiUpdateHandler, } from "./update.js";
|
|
72
|
+
export { createGguiAmendHandler, } from "./amend.js";
|
|
73
|
+
export { mutationInputSchema, runPropsMutation, } from "./props-mutation-core.js";
|
|
70
74
|
// The handshake handler owns suggestion orchestration directly, via
|
|
71
75
|
// `HandshakeNegotiator.decide` returning a `HandshakeSuggestion`.
|
|
72
76
|
// The LLM-backed negotiator in `@ggui-ai/mcp-server` is the
|
|
@@ -83,7 +87,7 @@ export { createInMemoryProvisionalPreviewRegistry, evaluateProvisionalPreviewGat
|
|
|
83
87
|
// Exported so any server can run the same projections off the
|
|
84
88
|
// resolved render without duplicating the actionSpec / contextSpec
|
|
85
89
|
// walks.
|
|
86
|
-
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, resolveGadgetUrls, } from "./slice-meta-derivation.js";
|
|
90
|
+
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, spreadRenderMetaViewOntoSlice, rewritePrivateBundleUrls, wsOriginToHttpOrigin, PRIVATE_BUNDLE_PREFIX, resolveGadgetUrls, } from "./slice-meta-derivation.js";
|
|
87
91
|
export { buildSeedPool } from "./build-seed-pool.js";
|
|
88
92
|
export { listRegistryBlueprintsForExport } from './export-registry.js';
|
|
89
93
|
// The render-identity event registry. Exported because storage backends
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PROPS-MUTATION CORE — the single flow behind BOTH mutation tools
|
|
3
|
+
* (#483 tool split): `ggui_update` (advances the history epoch,
|
|
4
|
+
* mints a new record) and `ggui_amend` (in-place, epoch untouched).
|
|
5
|
+
* Extracted verbatim from the pre-split ggui_update handler; the
|
|
6
|
+
* per-tool deltas are parameterized on `tool`, everything else is
|
|
7
|
+
* byte-identical behavior.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import type { HandlerContext } from '../types.js';
|
|
11
|
+
import type { GguiUpdateHandlerDeps } from './update.js';
|
|
12
|
+
/**
|
|
13
|
+
* Input raw-shape shared by BOTH mutation tools — discriminated on
|
|
14
|
+
* `kind` (`'replace'` + `props` | `'merge'` + `patch`); identical wire
|
|
15
|
+
* grammar for `ggui_update` and `ggui_amend` (#483). Both validate the
|
|
16
|
+
* FINAL props (post-merge for `merge`) against the render's
|
|
17
|
+
* `propsSpec`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const mutationInputSchema: {
|
|
20
|
+
/**
|
|
21
|
+
* Globally-unique render id. Optional on the wire so an in-process
|
|
22
|
+
* dispatcher (live-channel dispatch / threaded mount) can populate it
|
|
23
|
+
* via `HandlerContext.sessionId` instead. Required at the core
|
|
24
|
+
* level — see the resolve step inside `runPropsMutation`.
|
|
25
|
+
*/
|
|
26
|
+
readonly sessionId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
/**
|
|
28
|
+
* Mode discriminator. `'replace'` requires `props`; `'merge'`
|
|
29
|
+
* requires `patch`. The narrowing step inside the core enforces
|
|
30
|
+
* both presence + mutual exclusion.
|
|
31
|
+
*/
|
|
32
|
+
readonly kind: z.ZodEnum<{
|
|
33
|
+
replace: "replace";
|
|
34
|
+
merge: "merge";
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Full new props map. Required when `kind === 'replace'`; rejected
|
|
38
|
+
* otherwise. Validated against the GguiSession's `propsSpec` after
|
|
39
|
+
* applying.
|
|
40
|
+
*/
|
|
41
|
+
readonly props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
42
|
+
/**
|
|
43
|
+
* RFC 7396 JSON Merge Patch. Required when `kind === 'merge'`;
|
|
44
|
+
* rejected otherwise. The core applies the patch to the existing
|
|
45
|
+
* props, then validates the merged result against `propsSpec`.
|
|
46
|
+
* `null` values in the patch DELETE the corresponding key.
|
|
47
|
+
*/
|
|
48
|
+
readonly patch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
49
|
+
};
|
|
50
|
+
export interface PropsMutationResult {
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
readonly updated: boolean;
|
|
53
|
+
/** Bare mount URI (no epoch pin) — callers compose pinned forms. */
|
|
54
|
+
readonly mountResourceUri: string;
|
|
55
|
+
/** Head epoch AFTER the call (row-authoritative; 0 when absent). */
|
|
56
|
+
readonly epoch: number;
|
|
57
|
+
readonly warning?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function runPropsMutation(deps: GguiUpdateHandlerDeps, tool: 'ggui_update' | 'ggui_amend', input: unknown, ctx: HandlerContext): Promise<PropsMutationResult>;
|
|
60
|
+
//# sourceMappingURL=props-mutation-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-mutation-core.d.ts","sourceRoot":"","sources":["../../src/renders/props-mutation-core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;OAKG;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;CAEK,CAAC;AAwBX,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,qBAAqB,EAC3B,IAAI,EAAE,aAAa,GAAG,YAAY,EAClC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,mBAAmB,CAAC,CAsS9B"}
|