@ggui-ai/mcp-server-handlers 0.6.2 → 0.7.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/ops-apps/delete-app.d.ts +26 -9
- package/dist/ops-apps/delete-app.d.ts.map +1 -1
- package/dist/ops-apps/delete-app.js +34 -11
- package/dist/ops-apps/index.d.ts +1 -1
- package/dist/ops-apps/index.d.ts.map +1 -1
- package/dist/ops-apps/index.js +1 -1
- package/dist/ops-apps/types.d.ts +32 -1
- package/dist/ops-apps/types.d.ts.map +1 -1
- package/dist/ops-apps/types.js +16 -0
- package/dist/ops-blueprint/generate.d.ts.map +1 -1
- package/dist/ops-blueprint/generate.js +6 -2
- package/dist/ops-blueprint/register.d.ts.map +1 -1
- package/dist/ops-blueprint/register.js +7 -2
- package/dist/ops-connector-keys/types.d.ts +7 -0
- package/dist/ops-connector-keys/types.d.ts.map +1 -1
- package/dist/renders/blueprint-durability.d.ts +111 -0
- package/dist/renders/blueprint-durability.d.ts.map +1 -0
- package/dist/renders/blueprint-durability.js +85 -0
- package/dist/renders/blueprint-registry.d.ts +24 -0
- package/dist/renders/blueprint-registry.d.ts.map +1 -1
- package/dist/renders/blueprint-registry.js +9 -0
- package/dist/renders/code-delivery-events.d.ts +76 -0
- package/dist/renders/code-delivery-events.d.ts.map +1 -0
- package/dist/renders/code-delivery-events.js +60 -0
- package/dist/renders/fetch-gadget-types.d.ts +7 -3
- package/dist/renders/fetch-gadget-types.d.ts.map +1 -1
- package/dist/renders/fetch-gadget-types.js +7 -3
- package/dist/renders/generation-cache.d.ts +9 -0
- package/dist/renders/generation-cache.d.ts.map +1 -1
- package/dist/renders/handshake.d.ts +5 -3
- package/dist/renders/handshake.d.ts.map +1 -1
- package/dist/renders/handshake.js +9 -4
- package/dist/renders/index.d.ts +3 -0
- package/dist/renders/index.d.ts.map +1 -1
- package/dist/renders/index.js +13 -0
- package/dist/renders/render-identity.d.ts +178 -0
- package/dist/renders/render-identity.d.ts.map +1 -0
- package/dist/renders/render-identity.js +136 -0
- package/dist/renders/render.d.ts +39 -5
- package/dist/renders/render.d.ts.map +1 -1
- package/dist/renders/render.js +198 -83
- package/dist/renders/sync-context.d.ts +13 -1
- package/dist/renders/sync-context.d.ts.map +1 -1
- package/dist/renders/sync-context.js +6 -1
- package/dist/renders/update.d.ts +15 -1
- package/dist/renders/update.d.ts.map +1 -1
- package/dist/renders/update.js +6 -1
- package/package.json +7 -7
|
@@ -45,6 +45,7 @@ import { blueprintSourceToFlat, flatToBlueprintSource, summarizeContract, } from
|
|
|
45
45
|
// can't bundle.
|
|
46
46
|
import { blueprintKey, variantKey } from '@ggui-ai/protocol/blueprint-key';
|
|
47
47
|
import { validateContractRedundancy, } from '@ggui-ai/negotiator';
|
|
48
|
+
import { writeBlueprintDurably, } from './blueprint-durability.js';
|
|
48
49
|
/**
|
|
49
50
|
* Thrown by {@link registerBlueprint} when the structural validator
|
|
50
51
|
* emits one or more `severity: 'error'` findings. Carries the full
|
|
@@ -361,6 +362,14 @@ export async function registerBlueprint(deps, scope, input, options = {}) {
|
|
|
361
362
|
metadata: blueprintToMetadata(blueprint),
|
|
362
363
|
});
|
|
363
364
|
await deps.index.putId(scope, exactKey, id);
|
|
365
|
+
// Durable write-through for the fresh mint only. The dedup return
|
|
366
|
+
// above skips it deliberately: that row was written through when it
|
|
367
|
+
// was first minted, and re-writing it would fail the durable store's
|
|
368
|
+
// already-exists guard on every cache hit.
|
|
369
|
+
//
|
|
370
|
+
// `scope` is the appId at every call site — the registry's tenancy
|
|
371
|
+
// unit and the durable record's are the same thing.
|
|
372
|
+
await writeBlueprintDurably(deps.durability, scope, blueprint, input.createdBy ?? 'agent');
|
|
364
373
|
return blueprint;
|
|
365
374
|
}
|
|
366
375
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named events for the content-addressable code-delivery channel.
|
|
3
|
+
*
|
|
4
|
+
* `codeUrl` is the only STATIC delivery surface a COMPILED-COMPONENT
|
|
5
|
+
* envelope has. Nothing sits behind it: a bootstrap mounts on
|
|
6
|
+
* `codeUrl`, on a system-card `kind`, or on the live trio (`wsUrl` +
|
|
7
|
+
* `wsToken`); `kind` is static too, but it belongs to system cards,
|
|
8
|
+
* which never reach this channel. An envelope carrying none of the
|
|
9
|
+
* three reads to a host as "not a mountable ggui render". So a failed
|
|
10
|
+
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
+
* happens next is deployment-shaped:
|
|
12
|
+
*
|
|
13
|
+
* - A deployment that mints live-channel credentials still mounts.
|
|
14
|
+
* The slice keeps `wsUrl` + `wsToken`, the iframe subscribes, and
|
|
15
|
+
* the WS delivers the render body. The cost is the
|
|
16
|
+
* zero-round-trip first paint, not the render.
|
|
17
|
+
* - A host that resolves the render's `resourceUri` re-mints
|
|
18
|
+
* `codeUrl` against the same store at READ time, so a transient
|
|
19
|
+
* fault costs it nothing and a persistent one surfaces there as a
|
|
20
|
+
* read error rather than a blank card.
|
|
21
|
+
* - A deployment with neither loses the mount for that one
|
|
22
|
+
* envelope.
|
|
23
|
+
*
|
|
24
|
+
* None of the three is distinguishable from the wire — the render
|
|
25
|
+
* reports success either way — which is why the failure is emitted
|
|
26
|
+
* under a name instead of swallowed. The event carries whether a live
|
|
27
|
+
* channel is wired, because that is the difference between "slower
|
|
28
|
+
* first paint" and "this envelope cannot mount".
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Every event this module can emit. Closed union — a new emitter picks
|
|
32
|
+
* from these or extends the type, which is what makes a rename a
|
|
33
|
+
* compile error rather than an alert filter that quietly stops
|
|
34
|
+
* matching.
|
|
35
|
+
*/
|
|
36
|
+
export type CodeDeliveryEvent = 'render_code_write_failed';
|
|
37
|
+
/**
|
|
38
|
+
* The event names as values, so every emitter — in this package or a
|
|
39
|
+
* storage backend elsewhere — spells them from one place.
|
|
40
|
+
*/
|
|
41
|
+
export declare const CODE_DELIVERY_EVENTS: {
|
|
42
|
+
/**
|
|
43
|
+
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
44
|
+
* carries no static delivery channel; see the module docstring for
|
|
45
|
+
* what survives.
|
|
46
|
+
*/
|
|
47
|
+
readonly renderCodeWriteFailed: "render_code_write_failed";
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* What an emitter knows at the point the mint failed.
|
|
51
|
+
*/
|
|
52
|
+
export interface RenderCodeWriteFailure {
|
|
53
|
+
/** Render whose envelope lost its static channel. */
|
|
54
|
+
readonly sessionId: string;
|
|
55
|
+
/** Owning app, so the event joins the rest of a deployment's logs. */
|
|
56
|
+
readonly appId: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether this deployment mints live-channel credentials.
|
|
59
|
+
*
|
|
60
|
+
* `true` ⇒ the render still mounts over the WS subscribe; the loss
|
|
61
|
+
* is the instant first paint. `false` ⇒ this envelope has no mount
|
|
62
|
+
* mode at all, and only a host that resolves `resourceUri` will
|
|
63
|
+
* still produce a card.
|
|
64
|
+
*/
|
|
65
|
+
readonly liveChannelWired: boolean;
|
|
66
|
+
/** Whatever the store threw. Unshaped by construction. */
|
|
67
|
+
readonly cause: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
|
|
71
|
+
*
|
|
72
|
+
* Never throws: a render that already produced valid code and already
|
|
73
|
+
* committed must not fail because its delivery-channel telemetry did.
|
|
74
|
+
*/
|
|
75
|
+
export declare function reportRenderCodeWriteFailed(failure: RenderCodeWriteFailure): void;
|
|
76
|
+
//# sourceMappingURL=code-delivery-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-delivery-events.d.ts","sourceRoot":"","sources":["../../src/renders/code-delivery-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;OAIG;;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;;;;;;;OAOG;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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named events for the content-addressable code-delivery channel.
|
|
3
|
+
*
|
|
4
|
+
* `codeUrl` is the only STATIC delivery surface a COMPILED-COMPONENT
|
|
5
|
+
* envelope has. Nothing sits behind it: a bootstrap mounts on
|
|
6
|
+
* `codeUrl`, on a system-card `kind`, or on the live trio (`wsUrl` +
|
|
7
|
+
* `wsToken`); `kind` is static too, but it belongs to system cards,
|
|
8
|
+
* which never reach this channel. An envelope carrying none of the
|
|
9
|
+
* three reads to a host as "not a mountable ggui render". So a failed
|
|
10
|
+
* `codeUrl` mint is not absorbed by a second static channel; what
|
|
11
|
+
* happens next is deployment-shaped:
|
|
12
|
+
*
|
|
13
|
+
* - A deployment that mints live-channel credentials still mounts.
|
|
14
|
+
* The slice keeps `wsUrl` + `wsToken`, the iframe subscribes, and
|
|
15
|
+
* the WS delivers the render body. The cost is the
|
|
16
|
+
* zero-round-trip first paint, not the render.
|
|
17
|
+
* - A host that resolves the render's `resourceUri` re-mints
|
|
18
|
+
* `codeUrl` against the same store at READ time, so a transient
|
|
19
|
+
* fault costs it nothing and a persistent one surfaces there as a
|
|
20
|
+
* read error rather than a blank card.
|
|
21
|
+
* - A deployment with neither loses the mount for that one
|
|
22
|
+
* envelope.
|
|
23
|
+
*
|
|
24
|
+
* None of the three is distinguishable from the wire — the render
|
|
25
|
+
* reports success either way — which is why the failure is emitted
|
|
26
|
+
* under a name instead of swallowed. The event carries whether a live
|
|
27
|
+
* channel is wired, because that is the difference between "slower
|
|
28
|
+
* first paint" and "this envelope cannot mount".
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The event names as values, so every emitter — in this package or a
|
|
32
|
+
* storage backend elsewhere — spells them from one place.
|
|
33
|
+
*/
|
|
34
|
+
export const CODE_DELIVERY_EVENTS = {
|
|
35
|
+
/**
|
|
36
|
+
* The `codeUrl` mint failed for a render envelope. That envelope
|
|
37
|
+
* carries no static delivery channel; see the module docstring for
|
|
38
|
+
* what survives.
|
|
39
|
+
*/
|
|
40
|
+
renderCodeWriteFailed: 'render_code_write_failed',
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Emit {@link CODE_DELIVERY_EVENTS.renderCodeWriteFailed}.
|
|
44
|
+
*
|
|
45
|
+
* Never throws: a render that already produced valid code and already
|
|
46
|
+
* committed must not fail because its delivery-channel telemetry did.
|
|
47
|
+
*/
|
|
48
|
+
export function reportRenderCodeWriteFailed(failure) {
|
|
49
|
+
// eslint-disable-next-line no-console -- structured single-line event for log-pipeline pickup
|
|
50
|
+
console.warn(JSON.stringify({
|
|
51
|
+
msg: CODE_DELIVERY_EVENTS.renderCodeWriteFailed,
|
|
52
|
+
sessionId: failure.sessionId,
|
|
53
|
+
appId: failure.appId,
|
|
54
|
+
liveChannelWired: failure.liveChannelWired,
|
|
55
|
+
error: failure.cause instanceof Error
|
|
56
|
+
? failure.cause.message
|
|
57
|
+
: String(failure.cause),
|
|
58
|
+
errorName: failure.cause instanceof Error ? failure.cause.name : undefined,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
@@ -14,9 +14,13 @@
|
|
|
14
14
|
* Behavior:
|
|
15
15
|
* - Stdlib (`@ggui-ai/gadgets`) is skipped — the sandbox VFS already
|
|
16
16
|
* carries its types directly.
|
|
17
|
-
* - Descriptors without a `typesUrl` are skipped
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
17
|
+
* - Descriptors without a `typesUrl` are skipped — the catalog's
|
|
18
|
+
* `strict` posture keeps `typesUrl` optional (nothing in the
|
|
19
|
+
* publish→install chain stamps it yet), so generation degrades
|
|
20
|
+
* gracefully to no-types codegen for such packages. The
|
|
21
|
+
* types-pipeline follow-up (publish stamps `typesUrl` + `typesSri`;
|
|
22
|
+
* `registeredGadgetDescriptorSchema` becomes the registration
|
|
23
|
+
* posture again) turns this skip back into a rare case.
|
|
20
24
|
* - Unique `typesUrl`s are fetched in parallel (`Promise.all`).
|
|
21
25
|
* - Each fetched body is SHA-384-verified against the descriptor's
|
|
22
26
|
* `typesSri` when present — a CDN-compromise defense symmetric
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-gadget-types.d.ts","sourceRoot":"","sources":["../../src/renders/fetch-gadget-types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fetch-gadget-types.d.ts","sourceRoot":"","sources":["../../src/renders/fetch-gadget-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAG,2BAA2B,CAAU;IACrD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC,CAAC;gBAED,QAAQ,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB,CAAC;CAaL;AAOD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,SAAS,gBAAgB,EAAE,EACxC,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkEjC"}
|
|
@@ -14,9 +14,13 @@
|
|
|
14
14
|
* Behavior:
|
|
15
15
|
* - Stdlib (`@ggui-ai/gadgets`) is skipped — the sandbox VFS already
|
|
16
16
|
* carries its types directly.
|
|
17
|
-
* - Descriptors without a `typesUrl` are skipped
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
17
|
+
* - Descriptors without a `typesUrl` are skipped — the catalog's
|
|
18
|
+
* `strict` posture keeps `typesUrl` optional (nothing in the
|
|
19
|
+
* publish→install chain stamps it yet), so generation degrades
|
|
20
|
+
* gracefully to no-types codegen for such packages. The
|
|
21
|
+
* types-pipeline follow-up (publish stamps `typesUrl` + `typesSri`;
|
|
22
|
+
* `registeredGadgetDescriptorSchema` becomes the registration
|
|
23
|
+
* posture again) turns this skip back into a rare case.
|
|
20
24
|
* - Unique `typesUrl`s are fetched in parallel (`Promise.all`).
|
|
21
25
|
* - Each fetched body is SHA-384-verified against the descriptor's
|
|
22
26
|
* `typesSri` when present — a CDN-compromise defense symmetric
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* live cache rows.
|
|
23
23
|
*/
|
|
24
24
|
import type { BlueprintIndex, EmbeddingProvider, EnumerableVectorStore, VectorStore } from '@ggui-ai/mcp-server-core';
|
|
25
|
+
import type { BlueprintDurabilityDeps } from './blueprint-durability.js';
|
|
25
26
|
/**
|
|
26
27
|
* Blueprint-cache storage bundle. Threaded into the
|
|
27
28
|
* `BlueprintRegistryDeps` the render handler composes so the matcher +
|
|
@@ -35,6 +36,14 @@ export interface GenerationCacheDeps {
|
|
|
35
36
|
* {@link BlueprintIndex}.
|
|
36
37
|
*/
|
|
37
38
|
readonly index: BlueprintIndex;
|
|
39
|
+
/**
|
|
40
|
+
* Durable write-through target for fresh registrations (#430 slice
|
|
41
|
+
* 2). Threaded alongside the cache seams because registration is
|
|
42
|
+
* where it fires; absent ⇒ the registry stays the only home for a
|
|
43
|
+
* blueprint, which is this deployment's existing behavior.
|
|
44
|
+
* See `blueprint-durability.ts`.
|
|
45
|
+
*/
|
|
46
|
+
readonly durability?: BlueprintDurabilityDeps;
|
|
38
47
|
}
|
|
39
48
|
/** A cache hit the render handler can reconstruct a {@link ComponentGguiSession} from. */
|
|
40
49
|
export interface GenerationCacheHit {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation-cache.d.ts","sourceRoot":"","sources":["../../src/renders/generation-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACZ,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"generation-cache.d.ts","sourceRoot":"","sources":["../../src/renders/generation-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,uBAAuB,CAAC;CAC/C;AAED,0FAA0F;AAC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wBAAsB,mBAAmB,CACvC,IAAI,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAAE,EACrD,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAAC,CAsB1C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,EAC3C,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAAE,EACrD,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CASnC"}
|
|
@@ -206,9 +206,11 @@ export interface GguiHandshakeHandlerDeps {
|
|
|
206
206
|
readonly kvStore: KeyValueStore;
|
|
207
207
|
/**
|
|
208
208
|
* Optional per-app metadata resolver. When bound, the handler reads
|
|
209
|
-
* `app.gadgets` for the resolved `ctx.appId
|
|
210
|
-
*
|
|
211
|
-
*
|
|
209
|
+
* `app.gadgets` for the resolved `ctx.appId`, resolves the effective
|
|
210
|
+
* catalog via `resolveAppGadgets` (stdlib floor + declared overlay —
|
|
211
|
+
* the same resolution the render gate and `ggui_list_gadgets` apply),
|
|
212
|
+
* and threads it to the negotiator so synth can teach the LLM which
|
|
213
|
+
* gadget bindings the produced UI may use.
|
|
212
214
|
*/
|
|
213
215
|
readonly appMetadataStore?: AppMetadataStore;
|
|
214
216
|
/**
|
|
@@ -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,EAQ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AGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aAEnB,WAAW,EAAE,MAAM;IAD/C,QAAQ,CAAC,IAAI,EAAG,qBAAqB,CAAU;gBACnB,WAAW,EAAE,MAAM;CAMhD;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,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"}
|
|
@@ -39,7 +39,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
39
39
|
import { z } from 'zod';
|
|
40
40
|
import { isGeneratorRegistered } from './assert-generator.js';
|
|
41
41
|
import { blueprintKey } from '@ggui-ai/protocol/blueprint-key';
|
|
42
|
-
import {
|
|
42
|
+
import { resolveAppGadgets, blueprintSourceToFlat, validateContract, lintContract, summarizeContract, dataContractSchema, handshakeSuggestionSchema, } from '@ggui-ai/protocol';
|
|
43
43
|
/** Default TTL (seconds). 10 minutes — same as the KV-store docstring. */
|
|
44
44
|
export const HANDSHAKE_RECORD_TTL_SEC = 600;
|
|
45
45
|
/** Default generator slug — matches the `GeneratorRegistry` default. */
|
|
@@ -179,10 +179,15 @@ export function createGguiHandshakeHandler(deps) {
|
|
|
179
179
|
// (ensureConformingContract) and returns a contract that passes the
|
|
180
180
|
// deterministic gate. This is the forgiving-handshake posture: a
|
|
181
181
|
// malformed draft is a TRIGGER into repair, not a thrown error.
|
|
182
|
-
// Per-app gadget catalog
|
|
182
|
+
// Per-app gadget catalog — resolved via `resolveAppGadgets`
|
|
183
|
+
// (stdlib floor + declared overlay, declared wins per-package),
|
|
184
|
+
// the SAME resolution the render gate (render.ts) and
|
|
185
|
+
// `ggui_list_gadgets` apply. The negotiator MUST see the catalog
|
|
186
|
+
// the render gate will accept; a store that returns raw declared
|
|
187
|
+
// rows must not drop the floor here. Idempotent over stores that
|
|
188
|
+
// pre-floor on read (e.g. the cloud DDB adapter).
|
|
183
189
|
const gadgets = deps.appMetadataStore
|
|
184
|
-
? ((await deps.appMetadataStore.get(ctx.appId))?.gadgets
|
|
185
|
-
STDLIB_GADGETS)
|
|
190
|
+
? resolveAppGadgets((await deps.appMetadataStore.get(ctx.appId))?.gadgets)
|
|
186
191
|
: undefined;
|
|
187
192
|
// Delegate suggestion production to the negotiator. Absent
|
|
188
193
|
// negotiator → default `origin: 'agent'` suggestion using the
|
package/dist/renders/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export { createGguiDeclareToolCatalogHandler, type GguiDeclareToolCatalogDeps, }
|
|
|
47
47
|
export { InMemoryToolIdentityCatalogStore, type ToolIdentityCatalogStore, } from "./tool-identity-catalog-store.js";
|
|
48
48
|
export { ChannelNotDeclaredError, InvalidCompleteError, GguiSessionNotFoundError } from "./errors.js";
|
|
49
49
|
export { clearGenerationCache, invalidateGenerationCache, listGenerationCache, type GenerationCacheDeps, type GenerationCacheEntry, type GenerationCacheHit, } from "./generation-cache.js";
|
|
50
|
+
export { BLUEPRINT_DURABILITY_EVENTS, projectDurableBlueprint, writeBlueprintDurably, type BlueprintDurabilityDeps, type BlueprintDurabilityEvent, } from "./blueprint-durability.js";
|
|
51
|
+
export { CODE_DELIVERY_EVENTS, reportRenderCodeWriteFailed, type CodeDeliveryEvent, type RenderCodeWriteFailure, } from "./code-delivery-events.js";
|
|
50
52
|
export { createGguiGetSessionHandler, type GetSessionHeartbeatResult, type GguiGetSessionHandlerDeps, } from "./get-session.js";
|
|
51
53
|
export { handleStream, type HandleStreamDeps, type HandleStreamEnvelope, type GguiSessionStreamTarget, type SendEnvelopeFn, type SendEnvelopeResult, } from "./handle-stream.js";
|
|
52
54
|
export { createGguiListSessionsHandler, type GguiListSessionsHandlerDeps, type GguiSessionSummaryWire, } from "./list-sessions.js";
|
|
@@ -70,4 +72,5 @@ export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriv
|
|
|
70
72
|
export type { SeedPoolSource } from "./seed-pool-source.js";
|
|
71
73
|
export { buildSeedPool, type BuildSeedPoolOptions } from "./build-seed-pool.js";
|
|
72
74
|
export { listRegistryBlueprintsForExport, type ExportableBlueprint } from './export-registry.js';
|
|
75
|
+
export { RENDER_IDENTITY_EVENTS, type RenderIdentityCapacityEvent, type RenderIdentityEvent, type RenderIdentityFailureEvent, type RenderIdentityFailureSource, type RenderIdentitySkipReason, type RenderIdentityUnreadableReason, } from './render-identity.js';
|
|
73
76
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,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a,CAAC;AACtG,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;
|
|
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,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,KAAK,aAAa,EAClB,K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sB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAKjG,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
|
@@ -47,6 +47,14 @@ export { createGguiDeclareToolCatalogHandler, } from "./declare-tool-catalog.js"
|
|
|
47
47
|
export { InMemoryToolIdentityCatalogStore, } from "./tool-identity-catalog-store.js";
|
|
48
48
|
export { ChannelNotDeclaredError, InvalidCompleteError, GguiSessionNotFoundError } from "./errors.js";
|
|
49
49
|
export { clearGenerationCache, invalidateGenerationCache, listGenerationCache, } from "./generation-cache.js";
|
|
50
|
+
// #430 slice 2 — durable blueprint write-through. The event registry is
|
|
51
|
+
// exported so storage backends emit the same names from one place.
|
|
52
|
+
export { BLUEPRINT_DURABILITY_EVENTS, projectDurableBlueprint, writeBlueprintDurably, } from "./blueprint-durability.js";
|
|
53
|
+
// Content-addressable code-delivery channel. The event registry is
|
|
54
|
+
// exported so every emitter of a lost `codeUrl` — here or in a
|
|
55
|
+
// transport that mints one on its own read path — spells the name
|
|
56
|
+
// from one place.
|
|
57
|
+
export { CODE_DELIVERY_EVENTS, reportRenderCodeWriteFailed, } from "./code-delivery-events.js";
|
|
50
58
|
export { createGguiGetSessionHandler, } from "./get-session.js";
|
|
51
59
|
export { handleStream, } from "./handle-stream.js";
|
|
52
60
|
export { createGguiListSessionsHandler, } from "./list-sessions.js";
|
|
@@ -78,3 +86,8 @@ export { createInMemoryProvisionalPreviewRegistry, evaluateProvisionalPreviewGat
|
|
|
78
86
|
export { assembleRenderSliceBase, deriveBundleOrigins, deriveContextSlots, deriveContractBundle, derivePropsJson, derivePublicEnvProjection, deriveRenderMeta, resolveGadgetUrls, } from "./slice-meta-derivation.js";
|
|
79
87
|
export { buildSeedPool } from "./build-seed-pool.js";
|
|
80
88
|
export { listRegistryBlueprintsForExport } from './export-registry.js';
|
|
89
|
+
// The render-identity event registry. Exported because storage backends
|
|
90
|
+
// live outside this package and must emit the SAME names — importing
|
|
91
|
+
// them is what keeps the set enumerable from one type and turns a
|
|
92
|
+
// rename into a compile error rather than a silently-dead alert filter.
|
|
93
|
+
export { RENDER_IDENTITY_EVENTS, } from './render-identity.js';
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render-identity write-through — the best-effort side write that
|
|
3
|
+
* accompanies every render commit.
|
|
4
|
+
*
|
|
5
|
+
* The record it produces is what lets a
|
|
6
|
+
* `ui://ggui/render/{sessionId}/{blueprintKey}` locator re-create a
|
|
7
|
+
* render after the render row itself is gone (the locator's segment is
|
|
8
|
+
* named for its domain; the record's field is `contractKey`). Writing it is optional
|
|
9
|
+
* everywhere: with no {@link RenderIdentityStore} bound, every helper
|
|
10
|
+
* here is a no-op and the render path is byte-for-byte what it was.
|
|
11
|
+
*
|
|
12
|
+
* Failure posture — a write here can NEVER fail a render. The row is
|
|
13
|
+
* already committed and is the source of truth; the identity record is
|
|
14
|
+
* a durability optimization on top of it. Every failure is caught and
|
|
15
|
+
* surfaced as a named structured log event, never rethrown.
|
|
16
|
+
*
|
|
17
|
+
* Shared by `ggui_render` (write-through at each commit site) and the
|
|
18
|
+
* mutation tools that later refresh the same record.
|
|
19
|
+
*/
|
|
20
|
+
import type { RenderIdentityStore, StoredGguiSession } from '@ggui-ai/mcp-server-core';
|
|
21
|
+
/**
|
|
22
|
+
* The identity slice a caller must supply — the three fields that
|
|
23
|
+
* cannot be read off the committed row. Everything else on the record
|
|
24
|
+
* (tenancy, props, sequence, timestamps) comes from the row itself, so
|
|
25
|
+
* the record can never disagree with what was actually persisted.
|
|
26
|
+
*/
|
|
27
|
+
export interface RenderIdentityFields {
|
|
28
|
+
/**
|
|
29
|
+
* Registered blueprint id, or `null` when registration did not
|
|
30
|
+
* resolve one for this commit (no cache bound, registration failed
|
|
31
|
+
* or was fail-closed rejected, or a probe/placeholder/error commit).
|
|
32
|
+
* #460: cold generation resolves the id BEFORE its success commit,
|
|
33
|
+
* so records are written complete once — `null` is a terminal state
|
|
34
|
+
* (#445: structurally non-remintable), never a pending one.
|
|
35
|
+
*/
|
|
36
|
+
readonly blueprintId: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* MUST be `blueprintKey(contract)` — the 16-char key the blueprint
|
|
39
|
+
* registry addresses a contract by. NEVER the validators-bundle
|
|
40
|
+
* contract hash: they are different lengths and different domains,
|
|
41
|
+
* and a record carrying the wrong one points a locator at nothing.
|
|
42
|
+
*/
|
|
43
|
+
readonly contractKey: string;
|
|
44
|
+
/** MUST be `variantKey(variance)` for the same render. */
|
|
45
|
+
readonly variantKey: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Named structured events this module emits, as a closed set.
|
|
49
|
+
*
|
|
50
|
+
* Each is emitted as one JSON line so log pipelines can filter on
|
|
51
|
+
* `msg` without parsing prose (same shape as this package's other
|
|
52
|
+
* best-effort write events). Operators alert on these names, so they
|
|
53
|
+
* are a union rather than a bare `string`: a typo would produce a
|
|
54
|
+
* plausible-looking event that no alert ever matches, and nothing
|
|
55
|
+
* downstream could tell it from the write simply never failing.
|
|
56
|
+
*
|
|
57
|
+
* - `render_identity_write_failed` — a first write could not be
|
|
58
|
+
* persisted.
|
|
59
|
+
* - `render_identity_refresh_failed` — a mutation path could not
|
|
60
|
+
* refresh an existing record.
|
|
61
|
+
*/
|
|
62
|
+
export type RenderIdentityFailureEvent = 'render_identity_write_failed' | 'render_identity_refresh_failed';
|
|
63
|
+
/**
|
|
64
|
+
* The registry: every named event emitted about a render-identity
|
|
65
|
+
* record, by ANY writer — including storage backends outside this
|
|
66
|
+
* package, which import these rather than restating the literals.
|
|
67
|
+
* Enumerable from this one type is the property that makes it a
|
|
68
|
+
* registry; a backend that spells its own string loses it.
|
|
69
|
+
*
|
|
70
|
+
* Two members sit outside {@link RenderIdentityFailureEvent} on
|
|
71
|
+
* purpose, because neither carries a caught error:
|
|
72
|
+
*
|
|
73
|
+
* - `render_identity_refresh_skipped` — nothing went wrong; there
|
|
74
|
+
* was simply nothing to refresh. Carries a
|
|
75
|
+
* {@link RenderIdentitySkipReason}.
|
|
76
|
+
* - `render_identity_row_unreadable` — a stored record exists but
|
|
77
|
+
* cannot be read back as a valid one. Not a failed operation and
|
|
78
|
+
* not a miss: a data-integrity signal, carrying a
|
|
79
|
+
* {@link RenderIdentityUnreadableReason}.
|
|
80
|
+
*
|
|
81
|
+
* Folding either into the failure union would let a caller pass it
|
|
82
|
+
* where an error is expected, and would tell an operator reading the
|
|
83
|
+
* type that both are things to page on.
|
|
84
|
+
*/
|
|
85
|
+
export type RenderIdentityEvent = RenderIdentityFailureEvent | 'render_identity_refresh_skipped' | 'render_identity_row_unreadable' | RenderIdentityCapacityEvent;
|
|
86
|
+
/**
|
|
87
|
+
* A record written successfully but at a size worth watching. Neither a
|
|
88
|
+
* failure nor a skip — the write HAPPENED — so it sits in its own
|
|
89
|
+
* category: a sizing signal for the offload threshold, not something to
|
|
90
|
+
* page on.
|
|
91
|
+
*/
|
|
92
|
+
export type RenderIdentityCapacityEvent = 'render_props_over_cap';
|
|
93
|
+
/**
|
|
94
|
+
* Why a refresh wrote nothing. Closed for the same reason the event
|
|
95
|
+
* names are: it is a filterable field on a structured event.
|
|
96
|
+
*
|
|
97
|
+
* `no-record-or-not-advanced` is the honest reason for a backend whose
|
|
98
|
+
* refresh is a single conditional write: the condition covers both
|
|
99
|
+
* "no record" and "sequence already at/past this value", and the store
|
|
100
|
+
* does not report which one rejected it.
|
|
101
|
+
*/
|
|
102
|
+
export type RenderIdentitySkipReason = 'no-record' | 'no-record-or-not-advanced';
|
|
103
|
+
/**
|
|
104
|
+
* Why a stored row could not be projected back into a record. Distinct
|
|
105
|
+
* from {@link RenderIdentitySkipReason}: a skip means there was
|
|
106
|
+
* nothing to act on, this means there WAS something and it was
|
|
107
|
+
* malformed.
|
|
108
|
+
*/
|
|
109
|
+
export type RenderIdentityUnreadableReason = 'unparseable-timestamp';
|
|
110
|
+
/**
|
|
111
|
+
* WHICH store a failure came from, on paths that touch two of them.
|
|
112
|
+
*
|
|
113
|
+
* A refresh reads the render's own sequence and then writes the
|
|
114
|
+
* identity record; both can fail, and the same event name covers both.
|
|
115
|
+
* Without this, a responder reading `render_identity_refresh_failed`
|
|
116
|
+
* cannot tell whether the render store or the identity store
|
|
117
|
+
* misbehaved, and starts in the wrong place. Closed, because it is a
|
|
118
|
+
* filterable field like the names themselves.
|
|
119
|
+
*/
|
|
120
|
+
export type RenderIdentityFailureSource = 'render-row-seq-read' | 'identity-record-write';
|
|
121
|
+
/**
|
|
122
|
+
* The event names as values, so every emitter — in this package or a
|
|
123
|
+
* storage backend elsewhere — spells them from one place. Importing
|
|
124
|
+
* these is what turns a future rename into a compile error instead of
|
|
125
|
+
* an alert filter that silently stops matching.
|
|
126
|
+
*/
|
|
127
|
+
export declare const RENDER_IDENTITY_EVENTS: {
|
|
128
|
+
readonly writeFailed: "render_identity_write_failed";
|
|
129
|
+
readonly refreshFailed: "render_identity_refresh_failed";
|
|
130
|
+
readonly refreshSkipped: "render_identity_refresh_skipped";
|
|
131
|
+
readonly rowUnreadable: "render_identity_row_unreadable";
|
|
132
|
+
readonly propsOverCap: "render_props_over_cap";
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Write the identity record for a just-committed render. Best-effort:
|
|
136
|
+
* an absent store is a no-op, and a rejecting store logs
|
|
137
|
+
* `render_identity_write_failed` and returns normally.
|
|
138
|
+
*
|
|
139
|
+
* The caller awaits this, so it adds exactly one store round-trip to
|
|
140
|
+
* the render — never a retry loop, never a background task that
|
|
141
|
+
* outlives the response.
|
|
142
|
+
*
|
|
143
|
+
* `failureEvent` overrides the logged event name for callers whose
|
|
144
|
+
* failure is a distinct operational signal (a refresh on a mutation
|
|
145
|
+
* path is not a first write, and operators alert on them separately).
|
|
146
|
+
*/
|
|
147
|
+
export declare function writeRenderIdentity(store: RenderIdentityStore | undefined, session: StoredGguiSession, identity: RenderIdentityFields, failureEvent?: RenderIdentityFailureEvent): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Refresh an EXISTING record after a tool re-committed the render row
|
|
150
|
+
* — `ggui_update` mutating props, `ggui_runtime_sync_context`
|
|
151
|
+
* mirroring a context snapshot.
|
|
152
|
+
*
|
|
153
|
+
* Refreshes only what the row can answer for: props, the sequence at
|
|
154
|
+
* this commit, and `updatedAt`. The identity slice
|
|
155
|
+
* (`blueprintId` / `contractKey` / `variantKey`) is carried forward
|
|
156
|
+
* from the existing record VERBATIM, never recomputed. That is not
|
|
157
|
+
* caution — it is the only correct behaviour available here:
|
|
158
|
+
* `contractKey` is `blueprintKey(agreed contract)`, and the agreed
|
|
159
|
+
* contract lived in the handshake these tools never see. A render row
|
|
160
|
+
* carries its projected specs, not the contract that keyed it, so any
|
|
161
|
+
* key recomputed here would address a different blueprint (or none).
|
|
162
|
+
*
|
|
163
|
+
* For the same reason a MISSING record is skipped rather than
|
|
164
|
+
* created: a record needs an identity, and inventing one would write a
|
|
165
|
+
* locator that points at nothing — strictly worse than no record,
|
|
166
|
+
* because a re-mint would trust it. The skip is announced as
|
|
167
|
+
* `render_identity_refresh_skipped` so an operator who wired a store
|
|
168
|
+
* mid-flight can see which renders predate it.
|
|
169
|
+
*
|
|
170
|
+
* Best-effort throughout, like every write in this module: the tool
|
|
171
|
+
* call succeeds regardless. A consequence worth knowing: because the
|
|
172
|
+
* write rebuilds the WHOLE record from the current row rather than
|
|
173
|
+
* patching fields, any refresh self-heals drift left by an earlier one
|
|
174
|
+
* that failed — a later context sync repairs props and sequence a
|
|
175
|
+
* dropped update-refresh had gone stale on.
|
|
176
|
+
*/
|
|
177
|
+
export declare function refreshRenderIdentity(store: RenderIdentityStore | undefined, session: StoredGguiSession): Promise<void>;
|
|
178
|
+
//# sourceMappingURL=render-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-identity.d.ts","sourceRoot":"","sources":["../../src/renders/render-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,0BAA0B,GAClC,8BAA8B,GAC9B,gCAAgC,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,mBAAmB,GAC3B,0BAA0B,GAC1B,iCAAiC,GACjC,gCAAgC,GACh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