@tangle-network/agent-app 4.0.38 → 4.0.40
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/assistant/index.js +4 -18
- package/dist/assistant/index.js.map +1 -1
- package/dist/assistant/usePanelPrefs.d.ts +1 -7
- package/dist/chat-routes/index.js +3 -3
- package/dist/{chunk-77UNTK66.js → chunk-FCW5NJ4M.js} +2 -2
- package/dist/{chunk-23FH5TF5.js → chunk-M2NKUZYV.js} +16 -1
- package/dist/chunk-M2NKUZYV.js.map +1 -0
- package/dist/{chunk-DPD7LY3T.js → chunk-N6EWZGTH.js} +37 -34
- package/dist/chunk-N6EWZGTH.js.map +1 -0
- package/dist/{chunk-4YBNKXUE.js → chunk-ORC66WNJ.js} +4 -7
- package/dist/chunk-ORC66WNJ.js.map +1 -0
- package/dist/{chunk-BMRKOPL6.js → chunk-UQIPRKW4.js} +2 -2
- package/dist/hub-approvals-react/index.js +4 -14
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +2 -2
- package/dist/web-react/chat-message-body.d.ts +8 -4
- package/dist/web-react/index.js +2 -2
- package/dist/web-react/media-query.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-23FH5TF5.js.map +0 -1
- package/dist/chunk-4YBNKXUE.js.map +0 -1
- package/dist/chunk-DPD7LY3T.js.map +0 -1
- /package/dist/{chunk-77UNTK66.js.map → chunk-FCW5NJ4M.js.map} +0 -0
- /package/dist/{chunk-BMRKOPL6.js.map → chunk-UQIPRKW4.js.map} +0 -0
|
@@ -57,13 +57,7 @@ export interface PanelPrefs {
|
|
|
57
57
|
* changes, so a narrow window never overwrites the choice.
|
|
58
58
|
*/
|
|
59
59
|
export declare function usePanelPrefs(userId: string | null, geometry?: PanelGeometry): PanelPrefs;
|
|
60
|
-
|
|
61
|
-
* Whether a media query matches, read synchronously on first render so the
|
|
62
|
-
* panel never first-paints in the wrong layout. A runtime without matchMedia
|
|
63
|
-
* (jsdom, some webviews) keeps `fallback` instead of throwing; the panel lives
|
|
64
|
-
* in the always-mounted shell.
|
|
65
|
-
*/
|
|
66
|
-
export declare function useMediaQuery(query: string, fallback?: boolean): boolean;
|
|
60
|
+
export { useMediaQuery } from "../web-react/media-query.js";
|
|
67
61
|
/** The viewport's width, tracked across resizes. Without a window it is
|
|
68
62
|
* unbounded, so server renders lay the panel out as docked. */
|
|
69
63
|
export declare function useViewportWidth(): number;
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
observeNativeCompletion,
|
|
41
41
|
readCompletedSandboxTurn,
|
|
42
42
|
recoverSandboxAssistantMessage
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-UQIPRKW4.js";
|
|
44
44
|
import {
|
|
45
45
|
runProtectedRouterTurn
|
|
46
46
|
} from "../chunk-725RZ5JQ.js";
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
turnPromptText,
|
|
75
75
|
valueRedactor,
|
|
76
76
|
withProducerStream
|
|
77
|
-
} from "../chunk-
|
|
77
|
+
} from "../chunk-FCW5NJ4M.js";
|
|
78
78
|
import "../chunk-SBHFMDR7.js";
|
|
79
79
|
import "../chunk-H6BRJU5M.js";
|
|
80
80
|
import "../chunk-4DBHC63F.js";
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
streamWithModelFailover,
|
|
109
109
|
summarizeFailoverReason,
|
|
110
110
|
transformVisibleTextParts
|
|
111
|
-
} from "../chunk-
|
|
111
|
+
} from "../chunk-ORC66WNJ.js";
|
|
112
112
|
import "../chunk-QUV5M7SZ.js";
|
|
113
113
|
import {
|
|
114
114
|
assistantRowIdForTurn
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
turnControlResponse,
|
|
66
66
|
withStreamHeartbeat,
|
|
67
67
|
withoutToolList
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-ORC66WNJ.js";
|
|
69
69
|
import {
|
|
70
70
|
assistantRowIdForTurn,
|
|
71
71
|
turnTraceUrl
|
|
@@ -3814,4 +3814,4 @@ export {
|
|
|
3814
3814
|
createChatTurnRoutes,
|
|
3815
3815
|
streamChatRouteAsSandboxEvents
|
|
3816
3816
|
};
|
|
3817
|
-
//# sourceMappingURL=chunk-
|
|
3817
|
+
//# sourceMappingURL=chunk-FCW5NJ4M.js.map
|
|
@@ -187,8 +187,23 @@ function HubPreviewFeedback({ item, onFeedback, drafts }) {
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
// src/web-react/media-query.ts
|
|
191
|
+
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
192
|
+
function useMediaQuery(query, fallback = true) {
|
|
193
|
+
const media = useMemo(
|
|
194
|
+
() => query && typeof window !== "undefined" ? window.matchMedia?.(query) : void 0,
|
|
195
|
+
[query]
|
|
196
|
+
);
|
|
197
|
+
const subscribe = useCallback((notify) => {
|
|
198
|
+
media?.addEventListener("change", notify);
|
|
199
|
+
return () => media?.removeEventListener("change", notify);
|
|
200
|
+
}, [media]);
|
|
201
|
+
return useSyncExternalStore(subscribe, () => media?.matches ?? fallback, () => fallback);
|
|
202
|
+
}
|
|
203
|
+
|
|
190
204
|
export {
|
|
205
|
+
useMediaQuery,
|
|
191
206
|
ReviewFeedbackForm,
|
|
192
207
|
HubPreviewFeedback
|
|
193
208
|
};
|
|
194
|
-
//# sourceMappingURL=chunk-
|
|
209
|
+
//# sourceMappingURL=chunk-M2NKUZYV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hub-approvals-react/feedback.tsx","../src/web-react/media-query.ts"],"sourcesContent":["import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from 'react'\nimport { Button, Input, Label, Textarea } from '@tangle-network/ui/primitives'\nimport { presentHubAction, type HubActionPreview, type HubApprovalFeedback, type HubApprovalItem } from '../hub-approvals'\n\nexport interface HubPreviewFeedbackProps {\n item: HubApprovalItem\n onFeedback: (item: HubApprovalItem, feedback: HubApprovalFeedback) => Promise<void>\n /** Owner-local drafts survive collapsing/switching previews, never another viewer. */\n drafts?: Map<string, ReviewFeedbackDraft>\n}\n\nexport interface ReviewFeedbackDraft { score: string; comment: string; editing: boolean; edited: boolean; subject: string; body: string; payload: string; saved: boolean }\nexport type ReviewVerdict = 'approve' | 'reject' | 'request_changes'\nexport interface ReviewFeedbackFormHandle {\n focusScore: () => void\n focusComment: () => void\n submitVerdict: (verdict: ReviewVerdict) => Promise<void>\n}\nexport interface ReviewFeedbackFormProps {\n input: unknown\n preview?: HubActionPreview\n feedback?: HubApprovalFeedback\n draftKey: string\n drafts?: Map<string, ReviewFeedbackDraft>\n onFeedback?: (feedback: HubApprovalFeedback) => Promise<void>\n onVerdict?: (verdict: ReviewVerdict, feedback: HubApprovalFeedback) => Promise<void>\n allowedVerdicts?: readonly ReviewVerdict[]\n approveLabel?: string\n disabled?: boolean\n editNote?: string\n}\n\n/** One form for Hub previews, assets and work products. Hosts own storage and authority. */\nexport const ReviewFeedbackForm = forwardRef<ReviewFeedbackFormHandle, ReviewFeedbackFormProps>(function ReviewFeedbackForm({\n input, preview, feedback: saved, draftKey, drafts, onFeedback, onVerdict,\n allowedVerdicts = ['approve', 'reject', 'request_changes'], approveLabel = 'Approve', disabled = false,\n editNote = 'Your edit is saved as a teaching example.',\n}, ref) {\n const id = useId()\n const scoreInput = useRef<HTMLInputElement>(null)\n const commentInput = useRef<HTMLTextAreaElement>(null)\n const original = input && typeof input === 'object' && !Array.isArray(input) ? input as Record<string, unknown> : {}\n const priorInput = saved?.editedInput !== undefined ? saved.editedInput : input\n const prior = priorInput && typeof priorInput === 'object' && !Array.isArray(priorInput) ? priorInput as Record<string, unknown> : {}\n const kind = preview?.kind\n const container = kind === 'post' && original.container && typeof original.container === 'object' && !Array.isArray(original.container)\n ? original.container as Record<string, unknown> : null\n const nestedCaption = container && typeof container.caption === 'string'\n const copyField = ['text', 'commentary', 'caption', 'message', 'title'].find((key) => typeof original[key] === 'string')\n const editablePost = kind === 'post' && (nestedCaption || copyField)\n const field = kind === 'email'\n ? typeof original.html === 'string' ? 'html' : typeof original.body === 'string' ? 'body' : 'text'\n : nestedCaption ? 'caption' : copyField ?? 'text'\n const priorText = nestedCaption && prior.container && typeof prior.container === 'object'\n ? (prior.container as Record<string, unknown>)[field] : prior[field]\n const draft = drafts?.get(draftKey)\n const [score, setScore] = useState(draft?.score ?? (saved ? String(saved.score) : ''))\n const [comment, setComment] = useState(draft?.comment ?? saved?.comment ?? '')\n const [editing, setEditing] = useState(draft?.editing ?? false)\n const [edited, setEdited] = useState(draft?.edited ?? saved?.editedInput !== undefined)\n const [subject, setSubject] = useState(draft?.subject ?? String(prior.subject ?? ''))\n const [body, setBody] = useState(draft?.body ?? String(priorText ?? ''))\n const [payload, setPayload] = useState(draft?.payload ?? JSON.stringify(priorInput ?? null, null, 2))\n const [busy, setBusy] = useState(false)\n const [status, setStatus] = useState((draft ? draft.saved : saved) ? 'Feedback saved' : '')\n const [error, setError] = useState('')\n\n useEffect(() => {\n drafts?.set(draftKey, { score, comment, editing, edited, subject, body, payload, saved: status === 'Feedback saved' })\n }, [drafts, draftKey, score, comment, editing, edited, subject, body, payload, status])\n\n async function save(verdict?: ReviewVerdict) {\n if (busy || disabled || (verdict ? !onVerdict || !allowedVerdicts.includes(verdict) : !onFeedback)) return\n if (verdict && verdict !== 'approve' && !comment.trim()) {\n setError('Add a note before rejecting or requesting changes.'); commentInput.current?.focus(); return\n }\n if (score.trim() === '' || !Number.isInteger(Number(score)) || Number(score) < 0 || Number(score) > 100) {\n setError('Enter a score from 0 to 100.'); scoreInput.current?.focus(); return\n }\n setBusy(true); setError(''); setStatus('')\n try {\n const editedInput: unknown = edited\n ? kind === 'email' ? { ...original, subject, [field]: body }\n : editablePost ? nestedCaption ? { ...original, container: { ...container, [field]: body } } : { ...original, [field]: body } : JSON.parse(payload)\n : saved?.editedInput\n const value: HubApprovalFeedback = { score: Number(score), comment,\n ...(editedInput !== undefined && JSON.stringify(editedInput) !== JSON.stringify(input) ? { editedInput } : {}) }\n if (verdict) await onVerdict!(verdict, value)\n else await onFeedback!(value)\n setStatus('Feedback saved')\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : 'Feedback could not be saved. Your edits are kept here.')\n } finally { setBusy(false) }\n }\n useImperativeHandle(ref, () => ({ focusScore: () => { scoreInput.current?.focus(); scoreInput.current?.select() },\n focusComment: () => commentInput.current?.focus(), submitVerdict: (verdict) => save(verdict) }))\n\n return (\n <form aria-label=\"Preview feedback\" className=\"space-y-3 border-t border-border pt-3\" onSubmit={(event) => { event.preventDefault(); void save() }}>\n <fieldset disabled={busy || disabled} className=\"min-w-0 space-y-3\">\n <div className=\"flex flex-wrap items-end gap-3\">\n <div className=\"w-36 space-y-1\">\n <Label htmlFor={`${id}-score`}>Score (0–100)</Label>\n <Input ref={scoreInput} id={`${id}-score`} type=\"number\" inputMode=\"numeric\" min={0} max={100} step={1} required value={score}\n placeholder=\"Unscored\" disabled={busy} onChange={(event) => { setScore(event.target.value); setStatus('') }} />\n </div>\n <Button type=\"button\" variant=\"outline\" aria-expanded={editing} disabled={busy} onClick={() => { setEditing((value) => !value); setStatus('') }}>Edit to teach</Button>\n </div>\n <div className=\"space-y-1\">\n <Label htmlFor={`${id}-comment`}>Comment</Label>\n <Textarea ref={commentInput} id={`${id}-comment`} value={comment} rows={2} disabled={busy} onChange={(event) => { setComment(event.target.value); setStatus('') }} />\n </div>\n {editing && <div className=\"space-y-3\">\n <p className=\"text-sm text-muted-foreground\">{editNote}</p>\n {kind === 'email' && <div className=\"space-y-1\"><Label htmlFor={`${id}-subject`}>Subject</Label><Input id={`${id}-subject`} value={subject} disabled={busy} onChange={(event) => { setSubject(event.target.value); setEdited(true); setStatus('') }} /></div>}\n {kind === 'email' || editablePost\n ? <div className=\"space-y-1\"><Label htmlFor={`${id}-body`}>{kind === 'email' ? 'Body' : 'Post text'}</Label><Textarea id={`${id}-body`} value={body} rows={6} disabled={busy} onChange={(event) => { setBody(event.target.value); setEdited(true); setStatus('') }} /></div>\n : <div className=\"space-y-1\"><Label htmlFor={`${id}-payload`}>Payload</Label><Textarea id={`${id}-payload`} value={payload} rows={6} disabled={busy} onChange={(event) => { setPayload(event.target.value); setEdited(true); setStatus('') }} /></div>}\n </div>}\n {error && <p role=\"alert\" className=\"text-sm text-[var(--surface-danger-text)]\">{error}</p>}\n <div className=\"flex flex-wrap items-center gap-3\">\n {onVerdict && allowedVerdicts.map(verdict => <Button key={verdict} type=\"button\" variant={verdict === 'approve' ? 'default' : 'outline'} disabled={busy}\n aria-keyshortcuts={verdict === 'approve' ? 'A' : verdict === 'request_changes' ? 'R' : undefined}\n onClick={() => void save(verdict)}>{verdict === 'approve' ? approveLabel : verdict === 'reject' ? 'Reject' : 'Request changes'}</Button>)}\n {onFeedback && <Button type=\"submit\" variant=\"outline\" disabled={busy}>{busy ? 'Saving feedback…' : 'Save feedback'}</Button>}\n <p role=\"status\" className=\"text-sm text-muted-foreground\">{busy && !onFeedback ? 'Saving review…' : status}</p>\n </div>\n </fieldset>\n </form>\n )\n})\n\n/** Existing Hub adapter: teaching never calls the effect transport. */\nexport function HubPreviewFeedback({ item, onFeedback, drafts }: HubPreviewFeedbackProps) {\n const draftKey = JSON.stringify([item.id, item.actionPath, item.input])\n return <ReviewFeedbackForm key={draftKey} input={item.input} preview={presentHubAction(item).preview} feedback={item.feedback} draftKey={draftKey} drafts={drafts}\n onFeedback={(feedback) => onFeedback(item, feedback)} editNote=\"Your edit is saved as a teaching example. Live approval applies to the original held payload.\" />\n}\n","import { useCallback, useMemo, useSyncExternalStore } from 'react'\n\n/** An inactive query uses its fallback without registering a listener. */\nexport function useMediaQuery(query: string | undefined, fallback = true): boolean {\n const media = useMemo(\n () => query && typeof window !== 'undefined' ? window.matchMedia?.(query) : undefined,\n [query],\n )\n const subscribe = useCallback((notify: () => void) => {\n media?.addEventListener('change', notify)\n return () => media?.removeEventListener('change', notify)\n }, [media])\n return useSyncExternalStore(subscribe, () => media?.matches ?? fallback, () => fallback)\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,WAAW,OAAO,qBAAqB,QAAQ,gBAAgB;AACpF,SAAS,QAAQ,OAAO,OAAO,gBAAgB;AAoGvC,SACE,KADF;AApED,IAAM,qBAAqB,WAA8D,SAASA,oBAAmB;AAAA,EAC1H;AAAA,EAAO;AAAA,EAAS,UAAU;AAAA,EAAO;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAY;AAAA,EAC/D,kBAAkB,CAAC,WAAW,UAAU,iBAAiB;AAAA,EAAG,eAAe;AAAA,EAAW,WAAW;AAAA,EACjG,WAAW;AACb,GAAG,KAAK;AACN,QAAM,KAAK,MAAM;AACjB,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,eAAe,OAA4B,IAAI;AACrD,QAAM,WAAW,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,CAAC;AACnH,QAAM,aAAa,OAAO,gBAAgB,SAAY,MAAM,cAAc;AAC1E,QAAM,QAAQ,cAAc,OAAO,eAAe,YAAY,CAAC,MAAM,QAAQ,UAAU,IAAI,aAAwC,CAAC;AACpI,QAAM,OAAO,SAAS;AACtB,QAAM,YAAY,SAAS,UAAU,SAAS,aAAa,OAAO,SAAS,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,SAAS,IAClI,SAAS,YAAuC;AACpD,QAAM,gBAAgB,aAAa,OAAO,UAAU,YAAY;AAChE,QAAM,YAAY,CAAC,QAAQ,cAAc,WAAW,WAAW,OAAO,EAAE,KAAK,CAAC,QAAQ,OAAO,SAAS,GAAG,MAAM,QAAQ;AACvH,QAAM,eAAe,SAAS,WAAW,iBAAiB;AAC1D,QAAM,QAAQ,SAAS,UACnB,OAAO,SAAS,SAAS,WAAW,SAAS,OAAO,SAAS,SAAS,WAAW,SAAS,SAC1F,gBAAgB,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import {
|
|
48
|
-
ReviewFeedbackForm
|
|
49
|
-
|
|
48
|
+
ReviewFeedbackForm,
|
|
49
|
+
useMediaQuery
|
|
50
|
+
} from "./chunk-M2NKUZYV.js";
|
|
50
51
|
import {
|
|
51
52
|
AsyncView
|
|
52
53
|
} from "./chunk-AVP5SNIG.js";
|
|
@@ -3081,16 +3082,18 @@ function nextRevealCount(shown, targetLength, dtMs, opts = {}) {
|
|
|
3081
3082
|
return Math.min(targetLength, shown + rate * dtMs / 1e3);
|
|
3082
3083
|
}
|
|
3083
3084
|
function useSmoothText(target, enabled, opts) {
|
|
3085
|
+
const reducedMotion = useMediaQuery(enabled ? "(prefers-reduced-motion: reduce)" : void 0, false);
|
|
3086
|
+
const animate = enabled && !reducedMotion;
|
|
3084
3087
|
const [, force] = useState15(0);
|
|
3085
3088
|
const shownRef = useRef11(0);
|
|
3086
3089
|
const lastTargetRef = useRef11("");
|
|
3087
|
-
if (!
|
|
3090
|
+
if (!animate) shownRef.current = target.length;
|
|
3091
|
+
else if (target !== lastTargetRef.current && !target.startsWith(lastTargetRef.current.slice(0, Math.floor(shownRef.current)))) {
|
|
3088
3092
|
shownRef.current = 0;
|
|
3089
3093
|
}
|
|
3090
3094
|
lastTargetRef.current = target;
|
|
3091
|
-
if (!enabled) shownRef.current = target.length;
|
|
3092
3095
|
useEffect9(() => {
|
|
3093
|
-
if (!
|
|
3096
|
+
if (!animate || shownRef.current >= target.length) return;
|
|
3094
3097
|
let raf = 0;
|
|
3095
3098
|
let last = null;
|
|
3096
3099
|
const tick = (t) => {
|
|
@@ -3098,14 +3101,15 @@ function useSmoothText(target, enabled, opts) {
|
|
|
3098
3101
|
last = t;
|
|
3099
3102
|
const targetLen = lastTargetRef.current.length;
|
|
3100
3103
|
if (shownRef.current < targetLen) {
|
|
3104
|
+
const visible = Math.floor(shownRef.current);
|
|
3101
3105
|
shownRef.current = nextRevealCount(shownRef.current, targetLen, dt, opts);
|
|
3102
|
-
force((n) => n + 1);
|
|
3103
|
-
raf = requestAnimationFrame(tick);
|
|
3106
|
+
if (Math.floor(shownRef.current) !== visible) force((n) => n + 1);
|
|
3107
|
+
if (shownRef.current < targetLen) raf = requestAnimationFrame(tick);
|
|
3104
3108
|
}
|
|
3105
3109
|
};
|
|
3106
3110
|
raf = requestAnimationFrame(tick);
|
|
3107
3111
|
return () => cancelAnimationFrame(raf);
|
|
3108
|
-
}, [
|
|
3112
|
+
}, [animate, target]);
|
|
3109
3113
|
return target.slice(0, Math.floor(shownRef.current));
|
|
3110
3114
|
}
|
|
3111
3115
|
|
|
@@ -7978,7 +7982,7 @@ function StreamingCaret() {
|
|
|
7978
7982
|
}
|
|
7979
7983
|
);
|
|
7980
7984
|
}
|
|
7981
|
-
function
|
|
7985
|
+
function AnswerText({
|
|
7982
7986
|
content,
|
|
7983
7987
|
streaming,
|
|
7984
7988
|
showCaret,
|
|
@@ -7987,18 +7991,10 @@ function SegmentText({
|
|
|
7987
7991
|
}) {
|
|
7988
7992
|
const text = useSmoothText(content, streaming);
|
|
7989
7993
|
const body = useMemo10(() => renderBody(text), [renderBody, text]);
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
// the container on top of that makes the paragraph shimmer while it types.
|
|
7995
|
-
// The distinction is what separates "the answer materialised" from "the
|
|
7996
|
-
// log was appended to".
|
|
7997
|
-
/* @__PURE__ */ jsxs27("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
7998
|
-
body,
|
|
7999
|
-
showCaret && /* @__PURE__ */ jsx29(StreamingCaret, {})
|
|
8000
|
-
] })
|
|
8001
|
-
);
|
|
7994
|
+
return /* @__PURE__ */ jsxs27("div", { className: messageClassName, children: [
|
|
7995
|
+
body,
|
|
7996
|
+
showCaret && /* @__PURE__ */ jsx29(StreamingCaret, {})
|
|
7997
|
+
] });
|
|
8002
7998
|
}
|
|
8003
7999
|
var COLLAPSE_TOOL_RUN_AT = 3;
|
|
8004
8000
|
function isImportantTool(call, streaming) {
|
|
@@ -8055,15 +8051,17 @@ function SegmentedBody({
|
|
|
8055
8051
|
continue;
|
|
8056
8052
|
}
|
|
8057
8053
|
if (g.kind === "text") {
|
|
8054
|
+
const live = streaming && g.index === lastIndex;
|
|
8055
|
+
if (!g.content.trim() && !(showCaret && live)) continue;
|
|
8058
8056
|
children.push(
|
|
8059
8057
|
/* @__PURE__ */ jsx29(
|
|
8060
|
-
|
|
8058
|
+
AnswerText,
|
|
8061
8059
|
{
|
|
8062
8060
|
content: g.content,
|
|
8063
|
-
streaming:
|
|
8064
|
-
showCaret: showCaret &&
|
|
8061
|
+
streaming: live,
|
|
8062
|
+
showCaret: showCaret && live,
|
|
8065
8063
|
renderBody,
|
|
8066
|
-
messageClassName
|
|
8064
|
+
messageClassName: live ? messageClassName : `${messageClassName} agent-stream-in`
|
|
8067
8065
|
},
|
|
8068
8066
|
`text-${g.index}`
|
|
8069
8067
|
)
|
|
@@ -8112,6 +8110,7 @@ function SegmentNotice({ tone, content }) {
|
|
|
8112
8110
|
|
|
8113
8111
|
// src/web-react/chat-messages.tsx
|
|
8114
8112
|
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8113
|
+
var EMPTY_MODELS = [];
|
|
8115
8114
|
function splitBySpeaker(rows) {
|
|
8116
8115
|
return rows.flatMap((row) => {
|
|
8117
8116
|
const sections = row.role === "assistant" && row.parts ? partitionBySpeaker(row.parts) : [];
|
|
@@ -8194,10 +8193,8 @@ function AssistantMessageImpl({
|
|
|
8194
8193
|
messageClassName,
|
|
8195
8194
|
chrome
|
|
8196
8195
|
}) {
|
|
8197
|
-
const content = useSmoothText(msg.content, streaming);
|
|
8198
|
-
const body = useMemo11(() => renderBody(content), [renderBody, content]);
|
|
8199
8196
|
const segments = msg.segments;
|
|
8200
|
-
const hasAnswerText = Boolean(content || segments?.some(
|
|
8197
|
+
const hasAnswerText = Boolean(msg.content || segments?.some(
|
|
8201
8198
|
(s) => (s.kind === "text" || s.kind === "notice") && s.content.trim()
|
|
8202
8199
|
));
|
|
8203
8200
|
const answerScroll = useChatScroll();
|
|
@@ -8243,10 +8240,16 @@ function AssistantMessageImpl({
|
|
|
8243
8240
|
messageClassName
|
|
8244
8241
|
}
|
|
8245
8242
|
) : /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
8246
|
-
/* @__PURE__ */
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8243
|
+
/* @__PURE__ */ jsx30(
|
|
8244
|
+
AnswerText,
|
|
8245
|
+
{
|
|
8246
|
+
content: msg.content,
|
|
8247
|
+
streaming,
|
|
8248
|
+
showCaret: !msg.speaker && streaming && !!msg.content && !msg.toolCalls?.length,
|
|
8249
|
+
renderBody,
|
|
8250
|
+
messageClassName
|
|
8251
|
+
}
|
|
8252
|
+
),
|
|
8250
8253
|
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx30("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx30(
|
|
8251
8254
|
ToolCallCard,
|
|
8252
8255
|
{
|
|
@@ -8359,7 +8362,7 @@ function ChatMessages({
|
|
|
8359
8362
|
messages: storedMessages,
|
|
8360
8363
|
messageSize = "default",
|
|
8361
8364
|
chrome = "labeled",
|
|
8362
|
-
models =
|
|
8365
|
+
models = EMPTY_MODELS,
|
|
8363
8366
|
renderMarkdown,
|
|
8364
8367
|
renderExtras,
|
|
8365
8368
|
durableCards,
|
|
@@ -9007,4 +9010,4 @@ export {
|
|
|
9007
9010
|
AgentProfileChoices,
|
|
9008
9011
|
ComposerProfilePill
|
|
9009
9012
|
};
|
|
9010
|
-
//# sourceMappingURL=chunk-
|
|
9013
|
+
//# sourceMappingURL=chunk-N6EWZGTH.js.map
|