@guuey/chat 0.9.0 → 0.11.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +62 -9
- package/dist/policy.d.ts +9 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +1 -1
- package/dist/react/components.d.ts.map +1 -1
- package/dist/react/components.js +3 -2
- package/dist/react/guuey-chat.d.ts +14 -1
- package/dist/react/guuey-chat.d.ts.map +1 -1
- package/dist/react/guuey-chat.js +76 -15
- package/dist/react/structural-identity.d.ts +3 -0
- package/dist/react/structural-identity.d.ts.map +1 -0
- package/dist/react/structural-identity.js +45 -0
- package/dist/react/use-transcript.d.ts.map +1 -1
- package/dist/react/use-transcript.js +5 -3
- package/dist/strings.d.ts +4 -0
- package/dist/strings.d.ts.map +1 -1
- package/dist/strings.js +2 -0
- package/dist/types.d.ts +52 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/corpus/__snapshots__/corpus.test.ts.snap +269 -0
- package/src/index.ts +1 -0
- package/src/plan.ts +62 -9
- package/src/policy.ts +10 -3
- package/src/react/components.tsx +6 -2
- package/src/react/guuey-chat.tsx +103 -12
- package/src/react/structural-identity.ts +47 -0
- package/src/react/use-transcript.ts +5 -2
- package/src/strings.ts +6 -0
- package/src/types.ts +53 -4
- package/styles.css +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ export { transcriptInputsFromHistory } from "./history-inputs.js";
|
|
|
17
17
|
export { buildHitlAnswer, grantModeDisplay, hitlPromptsFromFold, type HitlAnswerRecord, type HitlPromptAction, } from "./hitl.js";
|
|
18
18
|
export { OAUTH_LINK_PARAMS, OAUTH_RETURN_PARAMS, OAUTH_SCHEME, oauthAuthorizeAsk, oauthAuthorizeHref, parseOAuthReturn, stripOAuthReturn, type OAuthAuthorizeAsk, type OAuthReturn, } from "./oauth.js";
|
|
19
19
|
export { DEFAULT_CHAT_THEME, GUUEY_CHAT_THEME, GuueyChatPalette, GuueyChatTheme, resolveTheme, } from "./theme.js";
|
|
20
|
-
export type { ChatDebugEvent, CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, HitlPromptInput, HitlPromptItem, MediaItem, NoticeItem, ProfilePromptInput, ProfilePromptItem, PromptItem, PromptItemInput, ReasoningItem, StatusLineItem, TextItem, ToolGroupItem, ToolItem, TranscriptInputs, TranscriptMessage, TranscriptOverrides, TranscriptPlan, UnknownItem, UserMessageItem, ViewMountItem, ViewRefItem, } from "./types.js";
|
|
20
|
+
export type { ChatDebugEvent, CitationsItem, CodeItem, CompactionItem, DataResultItem, DisplayItem, ErrorItem, HistoryBoundaryItem, ItemKey, HitlPromptInput, HitlPromptItem, MediaItem, NoticeItem, ProfilePromptInput, ProfilePromptItem, PromptItem, PromptItemInput, ReasoningItem, StatusLineItem, TextItem, ToolGroupItem, ToolItem, TranscriptInputs, TranscriptMessage, TranscriptOverrides, TranscriptPlan, PlanViewSummary, UnknownItem, UserMessageItem, ViewMountItem, ViewRefItem, } from "./types.js";
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,cAAc,EACd,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAkCA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAkCA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAUV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAIf,MAAM,YAAY,CAAC;AA0mBpB,uCAAuC;AACvC,wBAAgB,cAAc,CAC5B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,gBAAgB,EACxB,SAAS,GAAE,mBAAwB,GAClC,cAAc,CAiUhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,cAAc,CAAC,GACxD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GAAG,SAAS,CAiB5D"}
|
package/dist/plan.js
CHANGED
|
@@ -789,27 +789,79 @@ export function planTranscript(inputs, policy, overrides = {}) {
|
|
|
789
789
|
verbatim: policy.error.verbatim ? `${code ?? "uncoded"}: ${inputs.error.message}` : null,
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
//
|
|
795
|
-
//
|
|
796
|
-
|
|
797
|
-
|
|
792
|
+
// The host-canvas contract (guuey#301): every view the plan saw, with
|
|
793
|
+
// its mount material — collected BEFORE any chips/promotion pass, so a
|
|
794
|
+
// stage can render the selected mount even when the transcript shows
|
|
795
|
+
// only chips.
|
|
796
|
+
const views = [];
|
|
797
|
+
for (const item of items) {
|
|
798
|
+
if (item.kind !== "view")
|
|
799
|
+
continue;
|
|
800
|
+
views.push({
|
|
801
|
+
key: item.key,
|
|
802
|
+
title: item.toolTitle ?? policy.strings.viewRefFallbackTitle,
|
|
803
|
+
phase: item.phase,
|
|
804
|
+
channel: item.channel,
|
|
805
|
+
mount: item.mount,
|
|
806
|
+
actionScope: item.actionScope,
|
|
807
|
+
// The kit's own key scheme is authoritative here: `card.{seq}` is
|
|
808
|
+
// exactly the history-card emission (this file builds both).
|
|
809
|
+
origin: item.key.startsWith("card.") ? "history" : "live",
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
// Two composable behaviors over the assembled items:
|
|
813
|
+
//
|
|
814
|
+
// guuey#204 "promote and reference" (inline presentation): the ONE mount
|
|
815
|
+
// a host-owned stage shows (`inputs.promotedViewKey`) renders as a
|
|
816
|
+
// compact reference chip instead of a second live app instance. A key
|
|
817
|
+
// matching nothing (stale host state) or an expired mount promotes
|
|
818
|
+
// nothing — the honest no-op; the next render's key corrects it.
|
|
819
|
+
//
|
|
820
|
+
// guuey#301 chips presentation (`policy.view.presentation === "chips"`):
|
|
821
|
+
// EVERY view plans as a chip — the full render belongs to the host's
|
|
822
|
+
// stage; the promoted key marks the SELECTED chip (browser-history
|
|
823
|
+
// mechanic), and expired/dead views chip with their honest state.
|
|
824
|
+
//
|
|
825
|
+
// Either way a chip keeps the mount's key, so overrides and phase
|
|
826
|
+
// reports survive a swap back to the full mount.
|
|
798
827
|
const promoted = inputs.promotedViewKey;
|
|
799
|
-
const
|
|
828
|
+
const chips = policy.view.presentation === "chips";
|
|
829
|
+
const finalItems = !chips && promoted === undefined
|
|
800
830
|
? items
|
|
801
831
|
: items.map((item) => {
|
|
802
|
-
if (item.kind !== "view"
|
|
832
|
+
if (item.kind !== "view")
|
|
833
|
+
return item;
|
|
834
|
+
const title = item.toolTitle ?? policy.strings.viewRefFallbackTitle;
|
|
835
|
+
if (chips) {
|
|
836
|
+
const mountable = item.phase !== "expired" && item.mount !== null;
|
|
837
|
+
const selected = mountable && item.key === promoted;
|
|
838
|
+
const ref = {
|
|
839
|
+
kind: "viewRef",
|
|
840
|
+
key: item.key,
|
|
841
|
+
expanded: false,
|
|
842
|
+
title,
|
|
843
|
+
label: selected
|
|
844
|
+
? policy.strings.viewPromoted(title)
|
|
845
|
+
: mountable
|
|
846
|
+
? policy.strings.viewChip(title)
|
|
847
|
+
: policy.strings.viewChipExpired(title),
|
|
848
|
+
selected,
|
|
849
|
+
phase: item.phase,
|
|
850
|
+
};
|
|
851
|
+
return ref;
|
|
852
|
+
}
|
|
853
|
+
if (item.key !== promoted)
|
|
803
854
|
return item;
|
|
804
855
|
if (item.phase === "expired" || item.mount === null)
|
|
805
856
|
return item;
|
|
806
|
-
const title = item.toolTitle ?? policy.strings.viewRefFallbackTitle;
|
|
807
857
|
const ref = {
|
|
808
858
|
kind: "viewRef",
|
|
809
859
|
key: item.key,
|
|
810
860
|
expanded: false,
|
|
811
861
|
title,
|
|
812
862
|
label: policy.strings.viewPromoted(title),
|
|
863
|
+
selected: true,
|
|
864
|
+
phase: item.phase,
|
|
813
865
|
};
|
|
814
866
|
return ref;
|
|
815
867
|
});
|
|
@@ -817,6 +869,7 @@ export function planTranscript(inputs, policy, overrides = {}) {
|
|
|
817
869
|
items: finalItems,
|
|
818
870
|
status: deriveStatus(inputs, policy),
|
|
819
871
|
recovery: inputs.adopted === true && policy.debugDetail ? policy.strings.recoveredFromHistory : null,
|
|
872
|
+
views,
|
|
820
873
|
};
|
|
821
874
|
}
|
|
822
875
|
/**
|
package/dist/policy.d.ts
CHANGED
|
@@ -48,9 +48,17 @@ export interface TranscriptPolicy {
|
|
|
48
48
|
/** Preview bound — the plan never carries a full giant payload (fixture 6). */
|
|
49
49
|
previewChars: number;
|
|
50
50
|
};
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* R6 (sandbox overrides pass through to `<GuueyView>` in 3b).
|
|
53
|
+
* `presentation` (guuey#301): `"inline"` = every mount renders as a live
|
|
54
|
+
* view in the transcript (the default, unchanged); `"chips"` = EVERY
|
|
55
|
+
* view plans as a compact {@link ViewRefItem} — the full render belongs
|
|
56
|
+
* to a host-owned stage fed by `TranscriptPlan.views` + the selection
|
|
57
|
+
* input `promotedViewKey`.
|
|
58
|
+
*/
|
|
52
59
|
view: {
|
|
53
60
|
timeoutMs: number;
|
|
61
|
+
presentation: "inline" | "chips";
|
|
54
62
|
};
|
|
55
63
|
/** R7. */
|
|
56
64
|
media: {
|
package/dist/policy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAwC,KAAK,W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AAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAC7C,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;KAC1C,CAAC;IACF,oFAAoF;IACpF,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,4EAA4E;IAC5E,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAC1B,WAAW;IACX,UAAU,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9B,WAAW;IACX,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1C;AAoDD,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAElF;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAcnF"}
|
package/dist/policy.js
CHANGED
|
@@ -43,7 +43,7 @@ function calmBase() {
|
|
|
43
43
|
tool: { expandByDefault: false, argsVisible: false, humanizeTitle: humanizeToolName },
|
|
44
44
|
toolGroup: { threshold: 2 },
|
|
45
45
|
dataResult: { capRem: 16, prettyPrint: true, alwaysShowBytes: false, previewChars: 2048 },
|
|
46
|
-
view: { timeoutMs: 8000 },
|
|
46
|
+
view: { timeoutMs: 8000, presentation: "inline" },
|
|
47
47
|
media: { inlineImageCapRem: 20, chipOnly: false },
|
|
48
48
|
code: { capRem: 16, wrap: false },
|
|
49
49
|
citations: { style: "chips" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/react/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;G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ACnD,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACvD,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,2BAA2B,EAAE,oBAmBzC,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,oBAAoB,EAChC,GAAG,EAAE,qBAAqB,GACzB,SAAS,CAuEX"}
|
package/dist/react/components.js
CHANGED
|
@@ -109,11 +109,12 @@ export function DefaultView({ item, ctx }) {
|
|
|
109
109
|
* `onViewRef` (keyboard-accessible for free); a plain label otherwise.
|
|
110
110
|
*/
|
|
111
111
|
export function DefaultViewRef({ item, ctx }) {
|
|
112
|
+
const stateClasses = `${item.selected ? " guuey-chat-view-ref-selected" : ""}${item.phase === "expired" ? " guuey-chat-view-ref-expired" : ""}`;
|
|
112
113
|
if (ctx.onViewRef === undefined) {
|
|
113
|
-
return (_jsx("p", { className:
|
|
114
|
+
return (_jsx("p", { className: `guuey-chat-view-ref${stateClasses}`, role: "note", children: item.label }));
|
|
114
115
|
}
|
|
115
116
|
const onViewRef = ctx.onViewRef;
|
|
116
|
-
return (_jsx("button", { type: "button", className:
|
|
117
|
+
return (_jsx("button", { type: "button", className: `guuey-chat-view-ref guuey-chat-view-ref-button${stateClasses}`, "aria-pressed": item.selected, onClick: () => onViewRef(item), children: item.label }));
|
|
117
118
|
}
|
|
118
119
|
// ─── R7 ────────────────────────────────────────────────────────────────────
|
|
119
120
|
/** Inline images allow https URLs and image/* base64 data — nothing else. */
|
|
@@ -51,7 +51,7 @@ import type { UiResourceReader } from "@guuey/mcp-apps-host";
|
|
|
51
51
|
import { type TranscriptPolicy } from "../policy.js";
|
|
52
52
|
import { type ChatStrings } from "../strings.js";
|
|
53
53
|
import { type GuueyChatTheme } from "../theme.js";
|
|
54
|
-
import type { ChatDebugEvent, ErrorItem, PromptItem } from "../types.js";
|
|
54
|
+
import type { ChatDebugEvent, ErrorItem, PlanViewSummary, PromptItem, ViewRefItem } from "../types.js";
|
|
55
55
|
import type { ThemeMode } from "./theme-css.js";
|
|
56
56
|
import { type TranscriptWindowing } from "./transcript.js";
|
|
57
57
|
import type { TranscriptComponents, TranscriptItemContext } from "./components.js";
|
|
@@ -193,6 +193,19 @@ export interface GuueyChatProps {
|
|
|
193
193
|
* {@link GuueyChatHandle.threadId} for the pull-style read.
|
|
194
194
|
*/
|
|
195
195
|
onThread?: (threadId: string) => void;
|
|
196
|
+
/**
|
|
197
|
+
* guuey#301's host-stage trio (all optional; absent = today's inline
|
|
198
|
+
* behavior). `promotedViewKey` = the mount key the host's stage/canvas
|
|
199
|
+
* currently shows (chips it in the transcript — with
|
|
200
|
+
* `policy.view.presentation: "chips"` EVERY view chips and this key
|
|
201
|
+
* marks the selected one). `onViewRef` fires on chip click — set the
|
|
202
|
+
* key from it for the browser-history mechanic. `onViewsChange`
|
|
203
|
+
* delivers the plan's view roster (key/title/phase/channel/mount) so
|
|
204
|
+
* the host can render the selected mount with `<GuueyView>`.
|
|
205
|
+
*/
|
|
206
|
+
promotedViewKey?: string;
|
|
207
|
+
onViewRef?: (item: ViewRefItem) => void;
|
|
208
|
+
onViewsChange?: (views: PlanViewSummary[]) => void;
|
|
196
209
|
className?: string;
|
|
197
210
|
style?: CSSProperties;
|
|
198
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guuey-chat.d.ts","sourceRoot":"","sources":["../../src/react/guuey-chat.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"guuey-chat.d.ts","sourceRoot":"","sources":["../../src/react/guuey-chat.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EASL,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,UAAU,EAEV,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAInF;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,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AC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C;;;;OAIG;IACH,cAAc,CAAC,EAAE,CACf,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAC/D,IAAI,CAAC;IACV;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;IAChE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5D,qDAAqD;IACrD,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAC1C;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAQD,eAAO,MAAM,SAAS,4GAkXpB,CAAC"}
|
package/dist/react/guuey-chat.js
CHANGED
|
@@ -45,10 +45,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
45
45
|
* Web-only for now: the native tier ships `<NativeTranscript>` without a
|
|
46
46
|
* native GuueyChat, so there is no native surface to put a handle on yet.
|
|
47
47
|
*/
|
|
48
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
48
|
+
import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
49
49
|
import { createUiResourceReader, createWebAdapters, } from "@guuey/agent-client";
|
|
50
50
|
import { useAgentInvoke } from "@guuey/agent-client/react";
|
|
51
51
|
import { calmPolicy, debugPolicy } from "../policy.js";
|
|
52
|
+
import { useStructuralIdentity } from "./structural-identity.js";
|
|
52
53
|
import { defaultChatStrings } from "../strings.js";
|
|
53
54
|
import { DEFAULT_CHAT_THEME } from "../theme.js";
|
|
54
55
|
import { Transcript } from "./transcript.js";
|
|
@@ -60,13 +61,33 @@ const PROMPT_STATE = {
|
|
|
60
61
|
dismiss: "dismissed",
|
|
61
62
|
};
|
|
62
63
|
export const GuueyChat = forwardRef(function GuueyChat(props, ref) {
|
|
63
|
-
const { endpointUrl, appId, apiBaseUrl, getAccessToken, getGuestSecret, adapters: adaptersProp, preset = "calm", policy: policyOverrides, components, strings: stringOverrides, theme = DEFAULT_CHAT_THEME, mode = "light", window: windowing, reader, onDebugEvent, viewProps, onPromptAction, onHitlAnswer, oauthReturnTo, onOAuthAuthorize, onErrorAction, onReady, onThread, className, style, } = props;
|
|
64
|
+
const { endpointUrl, appId, apiBaseUrl, getAccessToken, getGuestSecret, adapters: adaptersProp, preset = "calm", policy: policyOverrides, components, strings: stringOverrides, theme = DEFAULT_CHAT_THEME, mode = "light", window: windowing, reader, onDebugEvent, viewProps, promotedViewKey, onViewRef, onViewsChange, onPromptAction, onHitlAnswer, oauthReturnTo, onOAuthAuthorize, onErrorAction, onReady, onThread, className, style, } = props;
|
|
65
|
+
// Identity stabilization (guuey#303 QA — the template's own chat-rail
|
|
66
|
+
// shipped the failure): hosts pass inline literals and arrows, so prop
|
|
67
|
+
// IDENTITY is noise. The getter props route through refs (presence, not
|
|
68
|
+
// identity, is the re-mint trigger — flipping guest↔bearer is a real
|
|
69
|
+
// change; a fresh arrow per render is not), and the policy/strings
|
|
70
|
+
// overrides stabilize structurally below. Without this, every host
|
|
71
|
+
// re-render re-minted the plan, whose views-emission effect calls the
|
|
72
|
+
// host back → setState → re-render → "Maximum update depth exceeded".
|
|
73
|
+
const getAccessTokenRef = useRef(getAccessToken);
|
|
74
|
+
getAccessTokenRef.current = getAccessToken;
|
|
75
|
+
const getGuestSecretRef = useRef(getGuestSecret);
|
|
76
|
+
getGuestSecretRef.current = getGuestSecret;
|
|
77
|
+
const hasAccessToken = getAccessToken !== undefined;
|
|
78
|
+
const hasGuestSecret = getGuestSecret !== undefined;
|
|
64
79
|
const adapters = useMemo(() => adaptersProp ??
|
|
65
80
|
createWebAdapters({
|
|
66
81
|
...(apiBaseUrl !== undefined ? { apiBaseUrl } : {}),
|
|
67
|
-
...(
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
...(hasAccessToken
|
|
83
|
+
? {
|
|
84
|
+
getAccessToken: (opts) => getAccessTokenRef.current?.(opts) ?? Promise.resolve(null),
|
|
85
|
+
}
|
|
86
|
+
: {}),
|
|
87
|
+
...(hasGuestSecret
|
|
88
|
+
? { getGuestSecret: () => getGuestSecretRef.current?.() ?? null }
|
|
89
|
+
: {}),
|
|
90
|
+
}), [adaptersProp, apiBaseUrl, hasAccessToken, hasGuestSecret]);
|
|
70
91
|
const invoke = useAgentInvoke({ endpointUrl, ...(appId !== undefined ? { appId } : {}), adapters, preserveBlocks: true });
|
|
71
92
|
// Default reader (guuey#221): built over the SAME identity as the
|
|
72
93
|
// transport/history, targeting the pod door (live turns) then the
|
|
@@ -90,36 +111,76 @@ export const GuueyChat = forwardRef(function GuueyChat(props, ref) {
|
|
|
90
111
|
// the guest secret is re-resolved each call so a rotation takes
|
|
91
112
|
// effect immediately — the same per-request property
|
|
92
113
|
// `createWebAdapters` documents for its own resolvers.
|
|
114
|
+
// Getters read through the refs at CALL time — the reader's identity
|
|
115
|
+
// survives a host re-render handing in fresh arrows, and a rotated
|
|
116
|
+
// getter takes effect on the next read (the same per-request property
|
|
117
|
+
// `createWebAdapters` documents).
|
|
118
|
+
const getToken = getAccessTokenRef.current;
|
|
119
|
+
const getGuest = getGuestSecretRef.current;
|
|
93
120
|
const read = createUiResourceReader({
|
|
94
121
|
apiBaseUrl,
|
|
95
122
|
threadId,
|
|
96
123
|
endpointUrl,
|
|
97
|
-
...(
|
|
98
|
-
guestSecret:
|
|
124
|
+
...(getToken !== undefined ? { getAccessToken: getToken } : {}),
|
|
125
|
+
guestSecret: getGuest !== undefined ? getGuest() : null,
|
|
99
126
|
});
|
|
100
127
|
return read(resourceUri);
|
|
101
128
|
};
|
|
102
|
-
}, [apiBaseUrl, endpointUrl
|
|
129
|
+
}, [apiBaseUrl, endpointUrl]);
|
|
103
130
|
const effectiveReader = reader ?? defaultReader;
|
|
131
|
+
// Structurally-stable overrides: `policy={{ view: { … } }}` inline
|
|
132
|
+
// literals keep ONE identity while their contents hold still, so the
|
|
133
|
+
// policy (and through it the plan) does not re-mint per host render.
|
|
134
|
+
const stablePolicyOverrides = useStructuralIdentity(policyOverrides);
|
|
135
|
+
const stableStringOverrides = useStructuralIdentity(stringOverrides);
|
|
104
136
|
const policy = useMemo(() => {
|
|
105
137
|
const factory = preset === "debug" ? debugPolicy : calmPolicy;
|
|
106
138
|
const strings = {
|
|
107
139
|
...defaultChatStrings,
|
|
108
|
-
...
|
|
109
|
-
...
|
|
140
|
+
...stablePolicyOverrides?.strings,
|
|
141
|
+
...stableStringOverrides,
|
|
110
142
|
};
|
|
111
|
-
return factory({ ...
|
|
112
|
-
}, [preset,
|
|
143
|
+
return factory({ ...stablePolicyOverrides, strings });
|
|
144
|
+
}, [preset, stablePolicyOverrides, stableStringOverrides]);
|
|
113
145
|
const { inputs, resolvePrompt, answerHitlPrompt } = useTranscriptInputs(invoke);
|
|
146
|
+
// Memoized: once a chip is selected (`promotedViewKey` set) this object
|
|
147
|
+
// is on the plan's identity path — a per-render fresh spread here was the
|
|
148
|
+
// second leg of the render loop the template surfaced.
|
|
149
|
+
const transcriptInputs = useMemo(() => (promotedViewKey !== undefined ? { ...inputs, promotedViewKey } : inputs), [inputs, promotedViewKey]);
|
|
114
150
|
const { plan, toggle, resolvedMounts, onViewPhase, onViewDiagnosis } = useTranscript({
|
|
115
|
-
inputs,
|
|
151
|
+
inputs: transcriptInputs,
|
|
116
152
|
policy,
|
|
117
153
|
...(effectiveReader !== undefined ? { reader: effectiveReader } : {}),
|
|
118
154
|
...(onDebugEvent !== undefined ? { onDebugEvent } : {}),
|
|
119
155
|
});
|
|
156
|
+
// guuey#301: hand the host the plan's view roster whenever it changes —
|
|
157
|
+
// the stage renders the selected mount from it. Locator entries carry
|
|
158
|
+
// the RESOLUTION overlay (a stage mounts material, not identities):
|
|
159
|
+
// resolved material replaces the locator mount, a failed read surfaces
|
|
160
|
+
// as the expired phase. Ref'd callback so a host passing a fresh
|
|
161
|
+
// closure each render doesn't loop the effect.
|
|
162
|
+
const onViewsChangeRef = useRef(onViewsChange);
|
|
163
|
+
onViewsChangeRef.current = onViewsChange;
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (onViewsChangeRef.current === undefined)
|
|
166
|
+
return;
|
|
167
|
+
const overlaid = plan.views.map((view) => {
|
|
168
|
+
const resolved = resolvedMounts.get(view.key);
|
|
169
|
+
if (resolved === undefined)
|
|
170
|
+
return view;
|
|
171
|
+
if (resolved === "expired")
|
|
172
|
+
return { ...view, phase: "expired" };
|
|
173
|
+
return { ...view, mount: resolved };
|
|
174
|
+
});
|
|
175
|
+
onViewsChangeRef.current(overlaid);
|
|
176
|
+
}, [plan.views, resolvedMounts]);
|
|
120
177
|
// ── Composer ─────────────────────────────────────────────────────────
|
|
121
178
|
const [input, setInput] = useState("");
|
|
122
179
|
const inputRef = useRef(null);
|
|
180
|
+
// Browser form-field heuristics (a11y/autofill lints) flag a field with
|
|
181
|
+
// neither id nor name on every embedding site. useId keeps the id unique
|
|
182
|
+
// when several chats mount on one page — a static id would collide.
|
|
183
|
+
const composerId = useId();
|
|
123
184
|
const busy = invoke.status !== "ready";
|
|
124
185
|
const available = endpointUrl !== null;
|
|
125
186
|
const canSend = available && !busy && input.trim() !== "";
|
|
@@ -229,12 +290,12 @@ export const GuueyChat = forwardRef(function GuueyChat(props, ref) {
|
|
|
229
290
|
onPromptAction?.(item, action);
|
|
230
291
|
}, [resolvePrompt, answerHitlPrompt, onHitlAnswer, onPromptAction, oauthReturnTo, onOAuthAuthorize]);
|
|
231
292
|
const strings = policy.strings;
|
|
232
|
-
return (_jsxs("div", { className: `guuey-chat-surface${className !== undefined ? ` ${className}` : ""}`, style: style, children: [_jsx(Transcript, { plan: plan, strings: strings, theme: theme, mode: mode, ...(windowing !== undefined ? { window: windowing } : {}), ...(components !== undefined ? { components } : {}), onToggle: toggle, onRetry: handleRetry, onPromptAction: handlePromptAction, ...(onErrorAction !== undefined ? { onErrorAction } : {}), resolvedMounts: resolvedMounts, onViewPhase: onViewPhase, onViewDiagnosis: onViewDiagnosis, ...(viewProps !== undefined ? { viewProps } : {}) }), oauthReturn.notice !== null && (_jsxs("p", { role: "status", className: `guuey-chat-oauth-notice guuey-chat-oauth-${oauthReturn.notice.kind}`, children: [oauthReturn.notice.kind === "connected"
|
|
293
|
+
return (_jsxs("div", { className: `guuey-chat-surface${className !== undefined ? ` ${className}` : ""}`, style: style, children: [_jsx(Transcript, { plan: plan, strings: strings, theme: theme, mode: mode, ...(windowing !== undefined ? { window: windowing } : {}), ...(components !== undefined ? { components } : {}), onToggle: toggle, onRetry: handleRetry, onPromptAction: handlePromptAction, ...(onErrorAction !== undefined ? { onErrorAction } : {}), resolvedMounts: resolvedMounts, onViewPhase: onViewPhase, onViewDiagnosis: onViewDiagnosis, ...(onViewRef !== undefined ? { onViewRef } : {}), ...(viewProps !== undefined ? { viewProps } : {}) }), oauthReturn.notice !== null && (_jsxs("p", { role: "status", className: `guuey-chat-oauth-notice guuey-chat-oauth-${oauthReturn.notice.kind}`, children: [oauthReturn.notice.kind === "connected"
|
|
233
294
|
? strings.oauthConnected(oauthReturn.notice.serverName)
|
|
234
295
|
: strings.oauthFailed(oauthReturn.notice.reason), _jsx("button", { type: "button", className: "guuey-chat-oauth-dismiss", onClick: oauthReturn.dismiss, children: strings.promptDismissed })] })), _jsxs("form", { className: "guuey-chat-composer", onSubmit: (e) => {
|
|
235
296
|
e.preventDefault();
|
|
236
297
|
submit();
|
|
237
|
-
}, children: [_jsx("textarea", { ref: inputRef, className: "guuey-chat-composer-input", rows: 1, value: input, onChange: (e) => setInput(e.target.value), onKeyDown: (e) => {
|
|
298
|
+
}, children: [_jsx("textarea", { ref: inputRef, id: composerId, name: "message", className: "guuey-chat-composer-input", rows: 1, value: input, onChange: (e) => setInput(e.target.value), onKeyDown: (e) => {
|
|
238
299
|
// `isComposing` guards IME input: an Enter that commits a
|
|
239
300
|
// candidate must not also send the message.
|
|
240
301
|
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-identity.d.ts","sourceRoot":"","sources":["../../src/react/structural-identity.ts"],"names":[],"mappings":"AAwBA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAgBjE;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAIpD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity stabilization for host-supplied prop OBJECTS (guuey#303 QA).
|
|
3
|
+
*
|
|
4
|
+
* Hosts write `<GuueyChat policy={{ view: { presentation: "chips" } }}>` —
|
|
5
|
+
* a fresh object identity every render. Anything memo-keyed on that
|
|
6
|
+
* identity would re-mint per render, and anything the re-mint feeds into a
|
|
7
|
+
* `useEffect` → host `setState` edge becomes an infinite render loop (the
|
|
8
|
+
* template's chat-rail shipped exactly that). Identity is not a contract
|
|
9
|
+
* hosts signed up for; structure is.
|
|
10
|
+
*
|
|
11
|
+
* `useStructuralIdentity` returns the PREVIOUS reference while the new
|
|
12
|
+
* value is structurally equal, so downstream memos see one identity per
|
|
13
|
+
* structural value. Functions (and anything else non-plain) compare by
|
|
14
|
+
* reference — a policy override carrying an inline closure (for example
|
|
15
|
+
* `strings.humanizeTitle`) still churns; hoist such overrides.
|
|
16
|
+
*/
|
|
17
|
+
import { useRef } from "react";
|
|
18
|
+
function isPlainObject(value) {
|
|
19
|
+
if (typeof value !== "object" || value === null)
|
|
20
|
+
return false;
|
|
21
|
+
const proto = Object.getPrototypeOf(value);
|
|
22
|
+
return proto === Object.prototype || proto === null;
|
|
23
|
+
}
|
|
24
|
+
export function structurallyEqual(a, b) {
|
|
25
|
+
if (Object.is(a, b))
|
|
26
|
+
return true;
|
|
27
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
28
|
+
return a.length === b.length && a.every((item, i) => structurallyEqual(item, b[i]));
|
|
29
|
+
}
|
|
30
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
31
|
+
const aKeys = Object.keys(a);
|
|
32
|
+
const bKeys = Object.keys(b);
|
|
33
|
+
return (aKeys.length === bKeys.length &&
|
|
34
|
+
aKeys.every((key) => Object.hasOwn(b, key) && structurallyEqual(a[key], b[key])));
|
|
35
|
+
}
|
|
36
|
+
// Functions, class instances, Maps, … — reference identity only (already
|
|
37
|
+
// handled by Object.is above).
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
export function useStructuralIdentity(value) {
|
|
41
|
+
const ref = useRef(value);
|
|
42
|
+
if (!structurallyEqual(ref.current, value))
|
|
43
|
+
ref.current = value;
|
|
44
|
+
return ref.current;
|
|
45
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-transcript.d.ts","sourceRoot":"","sources":["../../src/react/use-transcript.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB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iB,GAAG,SAAS,CAAC,CAAC;CACrE;AAED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,MAAM,EACN,YAAY,GACb,EAAE,iBAAiB,GAAG,mBAAmB,CAsIzC;AAID,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,gBAAgB,CAAC;IACzB;;;;;OAKG;IACH,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,KAAK,IAAI,CAAC;IAClF;;;;;;;;OAQG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,KAAK,YAAY,CAAC;CAChF;AAKD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,yBAAyB,CAsH3F"}
|
|
@@ -109,13 +109,15 @@ export function useTranscript({ inputs, policy, reader, onDebugEvent, }) {
|
|
|
109
109
|
}
|
|
110
110
|
}, [plan]);
|
|
111
111
|
// Locator resolution — one read per locator key, misses become "expired".
|
|
112
|
+
// Walks the plan's VIEWS roster, not the display items: under the chips
|
|
113
|
+
// presentation (guuey#301) no inline mount renders, but the host's canvas
|
|
114
|
+
// still needs every locator resolved — the roster is presentation-
|
|
115
|
+
// independent, so resolution is too.
|
|
112
116
|
const readerRef = useRef(reader);
|
|
113
117
|
readerRef.current = reader;
|
|
114
118
|
const inFlight = useRef(new Set());
|
|
115
119
|
useEffect(() => {
|
|
116
|
-
for (const item of plan.
|
|
117
|
-
if (item.kind !== "view")
|
|
118
|
-
continue;
|
|
120
|
+
for (const item of plan.views) {
|
|
119
121
|
if (item.mount === null || item.mount.channel !== "locator")
|
|
120
122
|
continue;
|
|
121
123
|
if (resolvedMounts.has(item.key) || inFlight.current.has(item.key))
|
package/dist/strings.d.ts
CHANGED
|
@@ -60,6 +60,10 @@ export interface ChatStrings {
|
|
|
60
60
|
}) => string;
|
|
61
61
|
/** guuey#204: the chip text for a mount promoted to a host stage/canvas. */
|
|
62
62
|
viewPromoted: (title: string) => string;
|
|
63
|
+
/** guuey#301 chips presentation: an unselected, mountable view's chip text. */
|
|
64
|
+
viewChip: (title: string) => string;
|
|
65
|
+
/** guuey#301 chips presentation: an expired/dead view's chip text (honest state). */
|
|
66
|
+
viewChipExpired: (title: string) => string;
|
|
63
67
|
/** Chip title when the mount has no producing-call title (history cards). */
|
|
64
68
|
viewRefFallbackTitle: string;
|
|
65
69
|
/** #192 debug-preset marker (calm never shows it — spec §3, F10). */
|
package/dist/strings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAEhB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IAErB,aAAa;IACb,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,eAAe,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAEvC,UAAU;IACV,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU;IACV,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAErC,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AkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IAEf,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAExC,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IAEpB,uCAAuC;IACvC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,eAAO,MAAM,kBAAkB,EAAE,WAwEhC,CAAC"}
|
package/dist/strings.js
CHANGED
|
@@ -30,6 +30,8 @@ export const defaultChatStrings = {
|
|
|
30
30
|
viewSandboxUnavailable: "Interactive view unavailable",
|
|
31
31
|
viewCspBlocked: (d) => `This page's Content-Security-Policy blocks ${d.blockedUri} — add "${d.violatedDirective} ${d.suggestedEntry}" to the policy so the view can start`,
|
|
32
32
|
viewPromoted: (title) => `${title} — on canvas`,
|
|
33
|
+
viewChip: (title) => title,
|
|
34
|
+
viewChipExpired: (title) => `${title} — expired`,
|
|
33
35
|
viewRefFallbackTitle: "Card",
|
|
34
36
|
recoveredFromHistory: "recovered from history",
|
|
35
37
|
noOutput: "no output",
|
package/dist/types.d.ts
CHANGED
|
@@ -138,9 +138,11 @@ export interface TranscriptInputs {
|
|
|
138
138
|
* {@link ViewMountItem}, so an interactive surface exists exactly ONCE.
|
|
139
139
|
* Absent (or matching nothing / an expired mount) = today's behavior —
|
|
140
140
|
* every mount renders inline. Hosts derive the key with
|
|
141
|
-
* {@link newestViewKey} rather than hand-building it
|
|
142
|
-
*
|
|
143
|
-
*
|
|
141
|
+
* {@link newestViewKey} rather than hand-building it. Set per host
|
|
142
|
+
* click (via `onViewRef`) this is the SELECTION half of guuey#301's
|
|
143
|
+
* browser-history mechanic; the collapse-ALL-views half is the policy
|
|
144
|
+
* knob `view.presentation: "chips"` — the two compose, this field alone
|
|
145
|
+
* never chips more than the one promoted view.
|
|
144
146
|
*/
|
|
145
147
|
promotedViewKey?: string;
|
|
146
148
|
/** The last turn ended by user abort (R1 aborted-partial + "Stopped."). */
|
|
@@ -269,8 +271,23 @@ export interface ViewRefItem extends BaseItem {
|
|
|
269
271
|
kind: "viewRef";
|
|
270
272
|
/** The display title (the producing call's, or the strings fallback). */
|
|
271
273
|
title: string;
|
|
272
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* The full resolved chip text — `strings.viewPromoted(title)` for the
|
|
276
|
+
* selected chip, `strings.viewChip(title)` / `viewChipExpired(title)`
|
|
277
|
+
* for the rest under chips presentation (guuey#301).
|
|
278
|
+
*/
|
|
273
279
|
label: string;
|
|
280
|
+
/**
|
|
281
|
+
* True when this chip's mount is the one the host's stage currently
|
|
282
|
+
* shows (`key === promotedViewKey` and mountable). Renderers style it
|
|
283
|
+
* as the active history entry (guuey#301).
|
|
284
|
+
*/
|
|
285
|
+
selected: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* The underlying mount's phase — chips presentation keeps expired /
|
|
288
|
+
* unresolved views honest instead of hiding their state (guuey#301).
|
|
289
|
+
*/
|
|
290
|
+
phase: ViewHostPhase | "expired";
|
|
274
291
|
}
|
|
275
292
|
/** R7 — media blocks. */
|
|
276
293
|
export interface MediaItem extends BaseItem {
|
|
@@ -436,6 +453,31 @@ export type ChatDebugEvent = {
|
|
|
436
453
|
type: "turn-recovered";
|
|
437
454
|
marker: string;
|
|
438
455
|
};
|
|
456
|
+
/**
|
|
457
|
+
* One renderable view the plan saw, BEFORE any chips/promotion pass —
|
|
458
|
+
* the host-canvas contract (guuey#301): everything a stage needs to
|
|
459
|
+
* render the selected mount and label a history rail, in transcript
|
|
460
|
+
* order (history cards first, live mounts after — the same order the
|
|
461
|
+
* items carry).
|
|
462
|
+
*/
|
|
463
|
+
export interface PlanViewSummary {
|
|
464
|
+
key: ItemKey;
|
|
465
|
+
/** The display title (the producing call's, or the strings fallback). */
|
|
466
|
+
title: string;
|
|
467
|
+
phase: ViewHostPhase | "expired";
|
|
468
|
+
channel: ViewMountChannel | null;
|
|
469
|
+
/** Null when the locator is dead (the R13 expired path). */
|
|
470
|
+
mount: ViewMount | null;
|
|
471
|
+
/** The persisted `ui://` locator actions bind to (guuey#158), or null. */
|
|
472
|
+
actionScope: string | null;
|
|
473
|
+
/**
|
|
474
|
+
* Provenance: a LIVE fold mount vs a persisted HISTORY card. The roster
|
|
475
|
+
* is in transcript order (history cards sit with the settled prefix), so
|
|
476
|
+
* "newest" recency needs this — live outranks history, exactly
|
|
477
|
+
* {@link newestViewKey}'s walk.
|
|
478
|
+
*/
|
|
479
|
+
origin: "live" | "history";
|
|
480
|
+
}
|
|
439
481
|
export interface TranscriptPlan {
|
|
440
482
|
/** Ordered, stable keys (spec §7's determinism contract). */
|
|
441
483
|
items: DisplayItem[];
|
|
@@ -447,6 +489,12 @@ export interface TranscriptPlan {
|
|
|
447
489
|
* byte-identical to a streamed turn's (fixture 17).
|
|
448
490
|
*/
|
|
449
491
|
recovery: string | null;
|
|
492
|
+
/**
|
|
493
|
+
* Every view the plan saw (guuey#301's host-canvas contract) — present
|
|
494
|
+
* regardless of `view.presentation`, so a stage can render the selected
|
|
495
|
+
* mount even when the transcript shows only chips.
|
|
496
|
+
*/
|
|
497
|
+
views: PlanViewSummary[];
|
|
450
498
|
}
|
|
451
499
|
export {};
|
|
452
500
|
//# sourceMappingURL=types.d.ts.map
|