@syntrologie/adapt-chatbot 2.8.0-canary.621 → 2.8.0-canary.623
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/AdaptiveChatBar.js +2 -2
- package/dist/AdaptiveChatTrail.js +2 -2
- package/dist/AdaptiveChipsStrip.js +2 -2
- package/dist/ChatAssistantLit.js +3 -3
- package/dist/ChatTransport.d.ts +10 -2
- package/dist/ChatTransport.d.ts.map +1 -1
- package/dist/{chunk-HV52LYST.js → chunk-7U5IUZFB.js} +2 -2
- package/dist/{chunk-VIRIVP7H.js → chunk-AUDMWXVZ.js} +79 -18
- package/dist/chunk-AUDMWXVZ.js.map +7 -0
- package/dist/{chunk-HD2NXGYO.js → chunk-NA6NGAEC.js} +3 -3
- package/dist/{chunk-4V5L7IRV.js → chunk-RTPSG3PY.js} +55 -5
- package/dist/{chunk-4V5L7IRV.js.map → chunk-RTPSG3PY.js.map} +2 -2
- package/dist/{chunk-UFTSEIQP.js → chunk-UTRDR2PJ.js} +2 -2
- package/dist/consent.d.ts +8 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.test.d.ts +2 -0
- package/dist/consent.test.d.ts.map +1 -0
- package/dist/element-session.js +2 -2
- package/dist/elements/ElementInstanceStore.d.ts +4 -2
- package/dist/elements/ElementInstanceStore.d.ts.map +1 -1
- package/dist/elements/ElementSessionController.d.ts.map +1 -1
- package/dist/elements/ElementTypeHandler.d.ts +5 -1
- package/dist/elements/ElementTypeHandler.d.ts.map +1 -1
- package/dist/elements/TileHandler.d.ts +2 -2
- package/dist/elements/TileHandler.d.ts.map +1 -1
- package/dist/elements/tileLifecycleProps.d.ts +2 -1
- package/dist/elements/tileLifecycleProps.d.ts.map +1 -1
- package/dist/hostAgentController.d.ts.map +1 -1
- package/dist/runtime.js +111 -28
- package/dist/runtime.js.map +3 -3
- package/dist/schema.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-VIRIVP7H.js.map +0 -7
- /package/dist/{chunk-HV52LYST.js.map → chunk-7U5IUZFB.js.map} +0 -0
- /package/dist/{chunk-HD2NXGYO.js.map → chunk-NA6NGAEC.js.map} +0 -0
- /package/dist/{chunk-UFTSEIQP.js.map → chunk-UTRDR2PJ.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
IMAGE_STANDIN_BACKGROUND,
|
|
6
6
|
standinInitial
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RTPSG3PY.js";
|
|
8
8
|
|
|
9
9
|
// src/AdaptiveChatTrail.ts
|
|
10
10
|
import { css, html, LitElement, nothing } from "lit";
|
|
@@ -1874,4 +1874,4 @@ export {
|
|
|
1874
1874
|
AdaptiveChatTrail,
|
|
1875
1875
|
looksLikeSerializedModelResponse
|
|
1876
1876
|
};
|
|
1877
|
-
//# sourceMappingURL=chunk-
|
|
1877
|
+
//# sourceMappingURL=chunk-UTRDR2PJ.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visitor's consent status, read from the SDK's consent service at the
|
|
3
|
+
* moment of use. Anything unreadable (no SDK, no service, a throwing
|
|
4
|
+
* accessor, an unknown value) is `pending`: consent is never assumed.
|
|
5
|
+
*/
|
|
6
|
+
export type ConsentStatus = 'granted' | 'denied' | 'pending';
|
|
7
|
+
export declare function readConsentStatus(): ConsentStatus;
|
|
8
|
+
//# sourceMappingURL=consent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE7D,wBAAgB,iBAAiB,IAAI,aAAa,CAWjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.test.d.ts","sourceRoot":"","sources":["../src/consent.test.ts"],"names":[],"mappings":""}
|
package/dist/element-session.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* and the dispatch logic.
|
|
27
27
|
*/
|
|
28
28
|
import type { ActionEngine } from '../types';
|
|
29
|
-
import type { ElementTypeHandler } from './ElementTypeHandler';
|
|
29
|
+
import type { ElementMountOptions, ElementTypeHandler } from './ElementTypeHandler';
|
|
30
30
|
import type { ElementMutation, MountedElement } from './types';
|
|
31
31
|
/**
|
|
32
32
|
* Slot name reserved for tiles the backend wants rendered INLINE IN THE
|
|
@@ -136,6 +136,8 @@ export declare class ElementInstanceStore {
|
|
|
136
136
|
* so a dismissed tile never silently reappears on replay/broadcast. */
|
|
137
137
|
private readonly _dismissedIds;
|
|
138
138
|
constructor(options: ElementInstanceStoreOptions);
|
|
139
|
+
/** `publish` as a closure that calls the method on the bus (EventBus.publish reads `this`). */
|
|
140
|
+
private _boundPublish;
|
|
139
141
|
/**
|
|
140
142
|
* Listen for `element.compositional_replay_request` from container
|
|
141
143
|
* widgets and re-publish `element.compositional_append` for every
|
|
@@ -200,7 +202,7 @@ export declare class ElementInstanceStore {
|
|
|
200
202
|
* version-checked (mount: must not conflict with existing instance;
|
|
201
203
|
* patch: resulting_version must be > current; unmount: idempotent).
|
|
202
204
|
*/
|
|
203
|
-
apply(mutations: ElementMutation[]): Promise<void>;
|
|
205
|
+
apply(mutations: ElementMutation[], opts?: ElementMountOptions): Promise<void>;
|
|
204
206
|
applyWithReport(mutations: ElementMutation[]): Promise<ApplyReport>;
|
|
205
207
|
private _applyWithReport;
|
|
206
208
|
/** Read-only snapshot of currently-known instances. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementInstanceStore.d.ts","sourceRoot":"","sources":["../../src/elements/ElementInstanceStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,
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AQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAuDzE,6EAA6E;IAC7E,OAAO,CAAC,OAAO,UAAQ,GAAG,IAAI;IAqB9B;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;YAwB5C,oBAAoB;YAkBpB,SAAS;YAiJT,MAAM;IA6BpB,OAAO,CAAC,IAAI;CAUb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementSessionController.d.ts","sourceRoot":"","sources":["../../src/elements/ElementSessionController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ElementSessionController.d.ts","sourceRoot":"","sources":["../../src/elements/ElementSessionController.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEzF,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,mBAAmB,CAAA;CAAE,CAAC;AAEjG,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IACzE,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACzD,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,aAAa,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7F,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iFAAiF;IACjF,SAAS,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB;IACnE,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,WAAW,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI,CAAC;CAChF;AAiGD,4EAA4E;AAC5E,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qBAAqB,GAC7B,mBAAmB,CAiKrB"}
|
|
@@ -26,6 +26,10 @@ import type { ActionEngine } from '../types';
|
|
|
26
26
|
import type { ElementMutation, MountedElement } from './types';
|
|
27
27
|
/** Lifecycle classification used to decide whether to apply on boot rehydrate. */
|
|
28
28
|
export type ElementLifecycle = 'stateful' | 'imperative' | 'ephemeral';
|
|
29
|
+
/** How a mount arrived. `live` is true only for the live reply stream. */
|
|
30
|
+
export interface ElementMountOptions {
|
|
31
|
+
live?: boolean;
|
|
32
|
+
}
|
|
29
33
|
export interface ElementHandlerContext {
|
|
30
34
|
/** Runtime's ActionEngine — handlers use `applyBatch` to drive DOM
|
|
31
35
|
* changes via existing executors (`core:mountWidget`, etc.). */
|
|
@@ -61,7 +65,7 @@ export interface ElementTypeHandler {
|
|
|
61
65
|
/** Apply a new mount to the DOM. Called once per mount; the store
|
|
62
66
|
* passes the instance object so the handler can read `placement`,
|
|
63
67
|
* `content`, `template_id`, etc. */
|
|
64
|
-
mount(instance: MountedElement, ctx: ElementHandlerContext): Promise<void>;
|
|
68
|
+
mount(instance: MountedElement, ctx: ElementHandlerContext, opts?: ElementMountOptions): Promise<void>;
|
|
65
69
|
/** Apply a patch — typically by re-mounting the widget with merged
|
|
66
70
|
* content. v1 has no fine-grained reactivity; full re-mount is
|
|
67
71
|
* expected. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTypeHandler.d.ts","sourceRoot":"","sources":["../../src/elements/ElementTypeHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;AAEvE,MAAM,WAAW,qBAAqB;IACpC;qEACiE;IACjE,OAAO,EAAE,YAAY,CAAC;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;CACH;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAClB;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,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kB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAE9C;2EACuE;IACvE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAErC;;;qEAGiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,GAAG,cAAc,CAAC;IAE/E;;yCAEqC;IACrC,KAAK,CACH,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,qBAAqB,EAC1B,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;oBAEgB;IAChB,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E;6DACyD;IACzD,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,mEAAmE;IACnE,QAAQ,EAAE,eAAe,CAAC;CAC3B"}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* both packages share the contract. Renaming a field there is a TS
|
|
26
26
|
* error here and in the runtime subscriber — no silent drift.
|
|
27
27
|
*/
|
|
28
|
-
import type { ElementHandlerContext, ElementTypeHandler, ValidateResult } from './ElementTypeHandler';
|
|
28
|
+
import type { ElementHandlerContext, ElementMountOptions, ElementTypeHandler, ValidateResult } from './ElementTypeHandler';
|
|
29
29
|
import type { MountedElement } from './types';
|
|
30
30
|
export { TILE_MOUNTED_EVENT, TILE_PATCHED_EVENT, TILE_UNMOUNTED_EVENT, } from '@syntrologie/sdk-contracts';
|
|
31
31
|
/**
|
|
@@ -45,7 +45,7 @@ export declare class TileHandler implements ElementTypeHandler {
|
|
|
45
45
|
constructor(resolveWidget?: TileTemplateWidgetResolver | undefined);
|
|
46
46
|
private _widgetFor;
|
|
47
47
|
validate(instance: MountedElement, _ctx: ElementHandlerContext): ValidateResult;
|
|
48
|
-
mount(instance: MountedElement, ctx: ElementHandlerContext): Promise<void>;
|
|
48
|
+
mount(instance: MountedElement, ctx: ElementHandlerContext, opts?: ElementMountOptions): Promise<void>;
|
|
49
49
|
patch(instance: MountedElement, ctx: ElementHandlerContext): Promise<void>;
|
|
50
50
|
unmount(instance: MountedElement, ctx: ElementHandlerContext): Promise<void>;
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileHandler.d.ts","sourceRoot":"","sources":["../../src/elements/TileHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASH,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAEpF,qBAAa,WAAY,YAAW,kBAAkB;IAIxC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAH3C,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAU;IACpC,QAAQ,CAAC,SAAS,EAAG,UAAU,CAAU;gBAEZ,aAAa,CAAC,EAAE,0BAA0B,YAAA;IAEvE,OAAO,CAAC,UAAU;IAIlB,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,qBAAqB,GAAG,cAAc;IA2BzE,KAAK,
|
|
1
|
+
{"version":3,"file":"TileHandler.d.ts","sourceRoot":"","sources":["../../src/elements/TileHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASH,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAEpF,qBAAa,WAAY,YAAW,kBAAkB;IAIxC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAH3C,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAU;IACpC,QAAQ,CAAC,SAAS,EAAG,UAAU,CAAU;gBAEZ,aAAa,CAAC,EAAE,0BAA0B,YAAA;IAEvE,OAAO,CAAC,UAAU;IAIlB,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,qBAAqB,GAAG,cAAc;IA2BzE,KAAK,CACT,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,qBAAqB,EAC1B,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,IAAI,CAAC;IAOV,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1E,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CASnF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TileLifecycleMountProps } from '@syntrologie/sdk-contracts';
|
|
2
|
+
import type { ElementMountOptions } from './ElementTypeHandler';
|
|
2
3
|
import type { MountedElement, SlotPlacement } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* The one builder for an `element.tile_mounted` / `element.tile_patched`
|
|
@@ -9,5 +10,5 @@ import type { MountedElement, SlotPlacement } from './types';
|
|
|
9
10
|
*/
|
|
10
11
|
export declare function tileMountProps(instance: MountedElement & {
|
|
11
12
|
placement: SlotPlacement;
|
|
12
|
-
}, widget: string): TileLifecycleMountProps;
|
|
13
|
+
}, widget: string, opts?: ElementMountOptions): TileLifecycleMountProps;
|
|
13
14
|
//# sourceMappingURL=tileLifecycleProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileLifecycleProps.d.ts","sourceRoot":"","sources":["../../src/elements/tileLifecycleProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,cAAc,GAAG;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,EACvD,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tileLifecycleProps.d.ts","sourceRoot":"","sources":["../../src/elements/tileLifecycleProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,cAAc,GAAG;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,EACvD,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,mBAAmB,GACzB,uBAAuB,CAczB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostAgentController.d.ts","sourceRoot":"","sources":["../src/hostAgentController.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAA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AED,qFAAqF;AACrF,wBAAgB,YAAY,CAC1B,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,EACtD,OAAO,EAAE,OAAO,GACf,IAAI,CAEN"}
|
package/dist/runtime.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
decodeMutationEnvelope,
|
|
6
6
|
fetchMountedElements,
|
|
7
7
|
renderFallbackHtml
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NA6NGAEC.js";
|
|
9
9
|
import {
|
|
10
10
|
ElementInstanceStore,
|
|
11
11
|
TileHandler,
|
|
12
12
|
createElementSessionController,
|
|
13
13
|
createTemplateWidgetResolver
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AUDMWXVZ.js";
|
|
15
15
|
import {
|
|
16
16
|
pickPersona
|
|
17
17
|
} from "./chunk-T6VEDUXD.js";
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
getElementInstanceStore,
|
|
20
20
|
setElementInstanceStore
|
|
21
21
|
} from "./chunk-EWPPVPJ4.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-UTRDR2PJ.js";
|
|
23
23
|
import "./chunk-YFZCMLV6.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-7U5IUZFB.js";
|
|
25
25
|
import {
|
|
26
26
|
DIVE_DEEPER_EVENT,
|
|
27
27
|
TELEMETRY_DOM_EVENT,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
isCanonicalBusEvent,
|
|
31
31
|
reportCardStage,
|
|
32
32
|
stripMountPlumbing
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RTPSG3PY.js";
|
|
34
34
|
import "./chunk-LY5AGXVD.js";
|
|
35
35
|
|
|
36
36
|
// src/ChatSession.ts
|
|
@@ -402,6 +402,16 @@ var ChatSession = class {
|
|
|
402
402
|
};
|
|
403
403
|
var chatSession = new ChatSession();
|
|
404
404
|
|
|
405
|
+
// src/consent.ts
|
|
406
|
+
function readConsentStatus() {
|
|
407
|
+
try {
|
|
408
|
+
const status = window.SynOS?.consent?.getStatus?.();
|
|
409
|
+
return status === "granted" || status === "denied" ? status : "pending";
|
|
410
|
+
} catch {
|
|
411
|
+
return "pending";
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
405
415
|
// src/editorToken.ts
|
|
406
416
|
function readEditorToken() {
|
|
407
417
|
if (typeof window === "undefined") return void 0;
|
|
@@ -541,8 +551,14 @@ var ChatTransport = class {
|
|
|
541
551
|
this._runTurn = 0;
|
|
542
552
|
this._runStartedAt = 0;
|
|
543
553
|
this._firstDeltaAt = null;
|
|
544
|
-
this.
|
|
545
|
-
this.
|
|
554
|
+
/** The user message id of this run: the `turn_id` on both chat events. */
|
|
555
|
+
this._runTurnId = null;
|
|
556
|
+
/** Every element instance this run mounted, by instance id. A tool call's mount also arrives as an envelope; the id makes it one. */
|
|
557
|
+
this._runMountedIds = /* @__PURE__ */ new Set();
|
|
558
|
+
/** The subset of those whose template or widget is a card. */
|
|
559
|
+
this._runCardIds = /* @__PURE__ */ new Set();
|
|
560
|
+
/** When the first mount envelope of this run arrived, for `first_tile_ms`. */
|
|
561
|
+
this._firstTileAt = null;
|
|
546
562
|
/** The mount_* tool of every mount this run fired, in order — which surfaces
|
|
547
563
|
* the concierge chose (a carousel on one turn, separate cards on another). */
|
|
548
564
|
this._runMountTools = [];
|
|
@@ -727,8 +743,10 @@ var ChatTransport = class {
|
|
|
727
743
|
this._runTurn = 0;
|
|
728
744
|
this._runStartedAt = 0;
|
|
729
745
|
this._firstDeltaAt = null;
|
|
730
|
-
this.
|
|
731
|
-
this.
|
|
746
|
+
this._runTurnId = null;
|
|
747
|
+
this._runMountedIds = /* @__PURE__ */ new Set();
|
|
748
|
+
this._runCardIds = /* @__PURE__ */ new Set();
|
|
749
|
+
this._firstTileAt = null;
|
|
732
750
|
this._runMountTools = [];
|
|
733
751
|
this._pendingSuppressedFinishes = 0;
|
|
734
752
|
}
|
|
@@ -978,8 +996,23 @@ var ChatTransport = class {
|
|
|
978
996
|
const raw = this._config?.forwardedProps;
|
|
979
997
|
const base = typeof raw === "function" ? raw() : raw;
|
|
980
998
|
const pending = this._pendingForwardedProps;
|
|
981
|
-
|
|
982
|
-
|
|
999
|
+
return { ...base ?? {}, ...pending ?? {}, consent: readConsentStatus() };
|
|
1000
|
+
}
|
|
1001
|
+
/** Count each mounted instance once per run, and time the first one. */
|
|
1002
|
+
_countMounts(mutations) {
|
|
1003
|
+
for (const m of mutations) {
|
|
1004
|
+
const mutation = m;
|
|
1005
|
+
if (mutation.op !== "mount") continue;
|
|
1006
|
+
const instance = mutation.instance;
|
|
1007
|
+
const id = instance?.instance_id;
|
|
1008
|
+
if (typeof id !== "string" || id === "") continue;
|
|
1009
|
+
if (this._firstTileAt === null) this._firstTileAt = this._now();
|
|
1010
|
+
this._runMountedIds.add(id);
|
|
1011
|
+
const template = instance?.template_id;
|
|
1012
|
+
const widget = instance?.content?.widget;
|
|
1013
|
+
if (typeof template === "string" && /card/i.test(template) || typeof widget === "string" && /card/i.test(widget))
|
|
1014
|
+
this._runCardIds.add(id);
|
|
1015
|
+
}
|
|
983
1016
|
}
|
|
984
1017
|
_wireSession() {
|
|
985
1018
|
this._sessionUnsubSend = chatSession.onSend(
|
|
@@ -989,10 +1022,17 @@ var ChatTransport = class {
|
|
|
989
1022
|
this._runTurn = turn;
|
|
990
1023
|
this._runStartedAt = this._now();
|
|
991
1024
|
this._firstDeltaAt = null;
|
|
992
|
-
this.
|
|
993
|
-
this.
|
|
1025
|
+
this._runTurnId = id;
|
|
1026
|
+
this._runMountedIds = /* @__PURE__ */ new Set();
|
|
1027
|
+
this._runCardIds = /* @__PURE__ */ new Set();
|
|
1028
|
+
this._firstTileAt = null;
|
|
994
1029
|
this._runMountTools = [];
|
|
995
|
-
this._reportAtom("syntro_chat_message_sent", {
|
|
1030
|
+
this._reportAtom("syntro_chat_message_sent", {
|
|
1031
|
+
turn,
|
|
1032
|
+
chars: text.length,
|
|
1033
|
+
via,
|
|
1034
|
+
turn_id: id
|
|
1035
|
+
});
|
|
996
1036
|
void this._forwardUserMessage(text, id);
|
|
997
1037
|
}
|
|
998
1038
|
);
|
|
@@ -1098,6 +1138,7 @@ var ChatTransport = class {
|
|
|
1098
1138
|
if (!runtime2) return;
|
|
1099
1139
|
const mutations = decodeMutationEnvelope(payload);
|
|
1100
1140
|
if (mutations !== null) {
|
|
1141
|
+
this._countMounts(mutations);
|
|
1101
1142
|
const config = this._config;
|
|
1102
1143
|
if (config?.onElementEnvelope) {
|
|
1103
1144
|
void config.onElementEnvelope({
|
|
@@ -1331,8 +1372,6 @@ var ChatTransport = class {
|
|
|
1331
1372
|
case "tool-call": {
|
|
1332
1373
|
const existing = this._findToolCallStatus(event.toolCall.id);
|
|
1333
1374
|
if (!existing && event.toolCall.name.startsWith("mount_")) {
|
|
1334
|
-
this._runMounts += 1;
|
|
1335
|
-
if (/card/i.test(event.toolCall.name)) this._runCards += 1;
|
|
1336
1375
|
this._runMountTools.push(event.toolCall.name);
|
|
1337
1376
|
}
|
|
1338
1377
|
if (!existing) {
|
|
@@ -1430,9 +1469,11 @@ var ChatTransport = class {
|
|
|
1430
1469
|
turn: this._runTurn,
|
|
1431
1470
|
ttft_ms: (this._firstDeltaAt ?? end) - this._runStartedAt,
|
|
1432
1471
|
total_ms: end - this._runStartedAt,
|
|
1433
|
-
mounts: this.
|
|
1434
|
-
cards: this.
|
|
1435
|
-
mount_tools: [...this._runMountTools]
|
|
1472
|
+
mounts: this._runMountedIds.size,
|
|
1473
|
+
cards: this._runCardIds.size,
|
|
1474
|
+
mount_tools: [...this._runMountTools],
|
|
1475
|
+
turn_id: this._runTurnId,
|
|
1476
|
+
first_tile_ms: this._firstTileAt === null ? null : this._firstTileAt - this._runStartedAt
|
|
1436
1477
|
});
|
|
1437
1478
|
}
|
|
1438
1479
|
this._runStartedAt = 0;
|
|
@@ -3522,6 +3563,7 @@ var heartbeatPrefix = (sessionRef) => `${CARD_HEARTBEAT_PREFIX}${sessionRef}:`;
|
|
|
3522
3563
|
var CARD_HEARTBEAT_INTERVAL_MS = 2e3;
|
|
3523
3564
|
var CARD_SIBLING_WINDOW_MS = 6e3;
|
|
3524
3565
|
var CARD_HEARTBEAT_STALE_MS = 6e4;
|
|
3566
|
+
var FOLLOW_MAX_ATTEMPTS = 3;
|
|
3525
3567
|
var CARD_SUPERSEDED = "canvas:superseded";
|
|
3526
3568
|
var DOCKED_PREFIX = "syntro:mcp-docked:";
|
|
3527
3569
|
var DOCKED_FOR_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -3648,6 +3690,10 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3648
3690
|
let answerIssuedAt;
|
|
3649
3691
|
let heartbeatSession;
|
|
3650
3692
|
let folded = false;
|
|
3693
|
+
let followBaseline;
|
|
3694
|
+
let followTarget;
|
|
3695
|
+
let followAttempts = 0;
|
|
3696
|
+
let followInFlight = false;
|
|
3651
3697
|
function hostSurface() {
|
|
3652
3698
|
try {
|
|
3653
3699
|
return runtime2.context?.get().surface ?? {};
|
|
@@ -3681,6 +3727,7 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3681
3727
|
} catch {
|
|
3682
3728
|
}
|
|
3683
3729
|
considerFold();
|
|
3730
|
+
considerFollow();
|
|
3684
3731
|
}
|
|
3685
3732
|
function considerFold() {
|
|
3686
3733
|
if (folded || disposed || !heartbeatSession || born === void 0) return;
|
|
@@ -3692,6 +3739,31 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3692
3739
|
folded = true;
|
|
3693
3740
|
runtime2.events.publish(CARD_SUPERSEDED, { superseded: true });
|
|
3694
3741
|
}
|
|
3742
|
+
function considerFollow() {
|
|
3743
|
+
if (disposed || !heartbeatSession || born === void 0) return;
|
|
3744
|
+
const surface = hostSurface();
|
|
3745
|
+
if (surface.type !== "mcp-app" || surface.displayMode !== "fullscreen") {
|
|
3746
|
+
followBaseline = void 0;
|
|
3747
|
+
return;
|
|
3748
|
+
}
|
|
3749
|
+
const newest = Math.max(0, ...freshSiblings(heartbeatSession).map((beat) => beat.born ?? 0));
|
|
3750
|
+
if (followBaseline === void 0) {
|
|
3751
|
+
followBaseline = Math.max(born, newest);
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
if (followInFlight || newest <= followBaseline) return;
|
|
3755
|
+
if (followTarget !== newest) {
|
|
3756
|
+
followTarget = newest;
|
|
3757
|
+
followAttempts = 0;
|
|
3758
|
+
}
|
|
3759
|
+
if (followAttempts >= FOLLOW_MAX_ATTEMPTS) return;
|
|
3760
|
+
followAttempts++;
|
|
3761
|
+
followInFlight = true;
|
|
3762
|
+
scheduleHostRead(heartbeatSession, "follow", (landed) => {
|
|
3763
|
+
followInFlight = false;
|
|
3764
|
+
if (landed && followBaseline !== void 0) followBaseline = Math.max(followBaseline, newest);
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3695
3767
|
function pruneHeartbeats() {
|
|
3696
3768
|
try {
|
|
3697
3769
|
const store = cardStorage();
|
|
@@ -3838,8 +3910,11 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3838
3910
|
}
|
|
3839
3911
|
});
|
|
3840
3912
|
}
|
|
3841
|
-
function scheduleHostRead(sessionRef, why = "reload") {
|
|
3842
|
-
if (disposed || readRequested || typeof bridge.callServerTool !== "function")
|
|
3913
|
+
function scheduleHostRead(sessionRef, why = "reload", settled) {
|
|
3914
|
+
if (disposed || readRequested && why !== "follow" || typeof bridge.callServerTool !== "function") {
|
|
3915
|
+
settled?.(false);
|
|
3916
|
+
return;
|
|
3917
|
+
}
|
|
3843
3918
|
const call = bridge.callServerTool.bind(bridge);
|
|
3844
3919
|
readRequested = true;
|
|
3845
3920
|
const expected = generation;
|
|
@@ -3849,20 +3924,27 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3849
3924
|
if (session) scheduleHostRead(session.session_ref);
|
|
3850
3925
|
};
|
|
3851
3926
|
void Promise.resolve().then(() => {
|
|
3852
|
-
if (disposed) return;
|
|
3853
|
-
if (expected !== generation)
|
|
3927
|
+
if (disposed) return settled?.(false);
|
|
3928
|
+
if (expected !== generation) {
|
|
3929
|
+
settled?.(false);
|
|
3930
|
+
return readAgain();
|
|
3931
|
+
}
|
|
3854
3932
|
queue(async () => {
|
|
3855
3933
|
const appliedAtIssue = applied;
|
|
3856
3934
|
reportCardStage("read_brand_view_called", { why });
|
|
3857
|
-
void call({ name: READ_TOOL, arguments: { sessionRef } }).then((result) => {
|
|
3935
|
+
void call({ name: READ_TOOL, arguments: { sessionRef } }).then(async (result) => {
|
|
3858
3936
|
reportReadAnswer(why, result);
|
|
3859
|
-
if (disposed) return;
|
|
3860
|
-
if (expected !== generation)
|
|
3937
|
+
if (disposed) return settled?.(false);
|
|
3938
|
+
if (expected !== generation) {
|
|
3939
|
+
settled?.(false);
|
|
3940
|
+
return readAgain();
|
|
3941
|
+
}
|
|
3861
3942
|
if (applied !== appliedAtIssue) {
|
|
3862
3943
|
reportCardStage("tool_result_rejected", { reason: "stale" });
|
|
3863
|
-
return;
|
|
3944
|
+
return settled?.(false);
|
|
3864
3945
|
}
|
|
3865
|
-
|
|
3946
|
+
await consumeToolResult(result, { earlyRead: why === "turn_started" });
|
|
3947
|
+
settled?.(decodeAgentTurn(result) !== void 0);
|
|
3866
3948
|
}).catch((error) => {
|
|
3867
3949
|
reportCardStage("read_brand_view_answered", {
|
|
3868
3950
|
why,
|
|
@@ -3873,6 +3955,7 @@ function activateHostAgentController(runtime2, bridge, hostUi, options = {}) {
|
|
|
3873
3955
|
reason: readFailureReason(error instanceof Error ? error.message : String(error))
|
|
3874
3956
|
});
|
|
3875
3957
|
if (why === "turn_started") return readAgain();
|
|
3958
|
+
if (why === "follow") return settled?.(false);
|
|
3876
3959
|
if (!disposed && expected === generation)
|
|
3877
3960
|
runtime2.events.publish("host.ui_error", { reason: "refresh_required" });
|
|
3878
3961
|
});
|