@tangle-network/agent-app 0.43.17 → 0.43.19
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.d.ts +62 -5
- package/dist/assistant/index.js +54 -23
- package/dist/assistant/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -176,6 +176,27 @@ type ToolOutcome = {
|
|
|
176
176
|
message: string;
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* The result of a CONFIRMED mutating tool, retained on the resolving `status`
|
|
181
|
+
* message so a host can render it prominently (e.g. a one-time API-key reveal).
|
|
182
|
+
*
|
|
183
|
+
* SECURITY: `output` may carry a one-time secret (e.g. a freshly minted API
|
|
184
|
+
* key). It lives ONLY in the in-memory transcript for the session — the message
|
|
185
|
+
* transcript is deliberately never cached (see `persistence.ts`) and is never
|
|
186
|
+
* sent back to the model (a turn request carries only the new user text, see
|
|
187
|
+
* {@link ChatRequest}). So the secret is shown once and is gone on reload,
|
|
188
|
+
* matching how a dedicated create-key page reveals a key exactly once. A host
|
|
189
|
+
* renderer must uphold the same contract: reveal-on-demand, never persist it.
|
|
190
|
+
*/
|
|
191
|
+
interface ConfirmedResult {
|
|
192
|
+
/** The confirmed tool's name (e.g. "create_api_key"). */
|
|
193
|
+
name: string;
|
|
194
|
+
/** The tool's raw output. May contain a one-time secret — see the type doc. */
|
|
195
|
+
output: unknown;
|
|
196
|
+
/** The arguments the action was confirmed with, for a renderer that needs them
|
|
197
|
+
* (e.g. the key's name). */
|
|
198
|
+
args?: unknown;
|
|
199
|
+
}
|
|
179
200
|
interface ChatMessage {
|
|
180
201
|
id: string;
|
|
181
202
|
role: ChatRole;
|
|
@@ -188,6 +209,11 @@ interface ChatMessage {
|
|
|
188
209
|
args?: Record<string, unknown>;
|
|
189
210
|
outcome?: ToolOutcome;
|
|
190
211
|
};
|
|
212
|
+
/** Present only on a `status` message that resolved a confirmed mutating tool
|
|
213
|
+
* which returned a renderable result — carries that result so the transcript
|
|
214
|
+
* can render a host-supplied card (e.g. a one-time key reveal) next to the
|
|
215
|
+
* status line. See {@link ConfirmedResult} for the one-time-secret contract. */
|
|
216
|
+
result?: ConfirmedResult;
|
|
191
217
|
}
|
|
192
218
|
/** A mutating action the assistant proposed, awaiting the user's confirmation. */
|
|
193
219
|
interface PendingProposal {
|
|
@@ -548,6 +574,10 @@ interface AssistantDockProps {
|
|
|
548
574
|
formatMoney?: (usd: number | null) => string;
|
|
549
575
|
/** Render workflow YAML as a node graph in a proposal card. */
|
|
550
576
|
renderGraph?: (yaml: string) => ReactNode;
|
|
577
|
+
/** Render the brand icon for a proposal requirement's integration provider.
|
|
578
|
+
* The host owns the provider→icon mapping (its integrations catalog); when
|
|
579
|
+
* absent, the card falls back to its built-in provider mark. */
|
|
580
|
+
renderProviderIcon?: (provider: string) => ReactNode;
|
|
551
581
|
/** Called after a workflow-mutating tool is confirmed (host re-fetches its list). */
|
|
552
582
|
onWorkflowMutation?: () => void;
|
|
553
583
|
/** In-place connect handler for a proposal's integration requirements. The host
|
|
@@ -560,12 +590,17 @@ interface AssistantDockProps {
|
|
|
560
590
|
renderMarkdown?: (content: string) => ReactNode;
|
|
561
591
|
/** Per-tool custom detail renderers for expanded tool cards in the transcript. */
|
|
562
592
|
toolRenderers?: ToolDetailRenderers;
|
|
593
|
+
/** Render a prominent card for a CONFIRMED tool's result (e.g. a one-time
|
|
594
|
+
* API-key reveal for `create_api_key`), shown inline after the action's status
|
|
595
|
+
* line. The result's `output` may carry a one-time secret — see
|
|
596
|
+
* {@link ConfirmedResult} for the never-persist/never-to-model contract. */
|
|
597
|
+
renderConfirmedResult?: (result: ConfirmedResult) => ReactNode;
|
|
563
598
|
/** Swap the conversation rendering for a host-supplied renderer (see
|
|
564
599
|
* {@link AssistantPanelProps.renderTranscript}); the dock chrome, composer,
|
|
565
600
|
* transport, and proposal flow stay owned by the panel. */
|
|
566
601
|
renderTranscript?: (view: AssistantTranscriptView) => ReactNode;
|
|
567
602
|
}
|
|
568
|
-
declare function AssistantDock({ userId, navigate, balanceUsd, formatMoney, renderGraph, onWorkflowMutation, onConnectRequirement, renderMarkdown, toolRenderers, renderTranscript, }: AssistantDockProps): react.JSX.Element;
|
|
603
|
+
declare function AssistantDock({ userId, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon, onWorkflowMutation, onConnectRequirement, renderMarkdown, toolRenderers, renderConfirmedResult, renderTranscript, }: AssistantDockProps): react.JSX.Element;
|
|
569
604
|
|
|
570
605
|
interface AssistantPanelProps {
|
|
571
606
|
chat: AssistantChat;
|
|
@@ -580,11 +615,18 @@ interface AssistantPanelProps {
|
|
|
580
615
|
/** Render workflow YAML as a node graph in a proposal card (the `./workflows`
|
|
581
616
|
* WorkflowGraph). When absent, proposals show YAML as text. */
|
|
582
617
|
renderGraph?: (yaml: string) => ReactNode;
|
|
618
|
+
/** Render the brand icon for a proposal requirement's integration provider.
|
|
619
|
+
* When absent, the card falls back to its built-in provider mark. */
|
|
620
|
+
renderProviderIcon?: (provider: string) => ReactNode;
|
|
583
621
|
/** Markdown renderer for assistant message content. When absent, content
|
|
584
622
|
* renders as plain pre-wrapped text. */
|
|
585
623
|
renderMarkdown?: (content: string) => ReactNode;
|
|
586
624
|
/** Per-tool custom detail renderers for expanded tool cards in the transcript. */
|
|
587
625
|
toolRenderers?: ToolDetailRenderers;
|
|
626
|
+
/** Render a prominent card for a CONFIRMED tool's result (e.g. a one-time
|
|
627
|
+
* API-key reveal for `create_api_key`), shown inline after the action's status
|
|
628
|
+
* line. Ignored when a host swaps the whole transcript via `renderTranscript`. */
|
|
629
|
+
renderConfirmedResult?: (result: ConfirmedResult) => ReactNode;
|
|
588
630
|
/** Swap ONLY the conversation rendering for a host-supplied renderer (e.g. a
|
|
589
631
|
* different chat-message component), while the panel keeps owning the header,
|
|
590
632
|
* composer, model picker, history, transport, and proposal orchestration.
|
|
@@ -593,7 +635,7 @@ interface AssistantPanelProps {
|
|
|
593
635
|
* conversation. */
|
|
594
636
|
renderTranscript?: (view: AssistantTranscriptView) => ReactNode;
|
|
595
637
|
}
|
|
596
|
-
declare function AssistantPanel({ chat, userId, onClose, navigate, balanceUsd, formatMoney, renderGraph, renderMarkdown, toolRenderers, renderTranscript, }: AssistantPanelProps): react.JSX.Element;
|
|
638
|
+
declare function AssistantPanel({ chat, userId, onClose, navigate, balanceUsd, formatMoney, renderGraph, renderProviderIcon, renderMarkdown, toolRenderers, renderConfirmedResult, renderTranscript, }: AssistantPanelProps): react.JSX.Element;
|
|
597
639
|
|
|
598
640
|
/**
|
|
599
641
|
* True while a turn is streaming but the model hasn't emitted its first answer
|
|
@@ -609,6 +651,10 @@ interface AdaptedTranscript {
|
|
|
609
651
|
/** The current/most-recent turn's assistant message — where the turn cost line
|
|
610
652
|
* renders (it carries the turn's metrics), or null when there is none. */
|
|
611
653
|
metricsHostId: string | null;
|
|
654
|
+
/** Confirmed-tool results to render under their (system) message, keyed by that
|
|
655
|
+
* message's id — carried from a `status` message's retained `result` so a host
|
|
656
|
+
* card (e.g. a one-time API-key reveal) renders inline right after the action. */
|
|
657
|
+
confirmedResults: Map<string, ConfirmedResult>;
|
|
612
658
|
}
|
|
613
659
|
/**
|
|
614
660
|
* Fold the transcript view into web-react `ChatUiMessage[]`: each user message is
|
|
@@ -627,6 +673,12 @@ interface AssistantTranscriptProps {
|
|
|
627
673
|
renderMarkdown?: (content: string) => ReactNode;
|
|
628
674
|
/** Per-tool custom detail renderers for expanded tool cards. */
|
|
629
675
|
toolRenderers?: ToolDetailRenderers;
|
|
676
|
+
/** Render a prominent card for a CONFIRMED tool's result, inline after its
|
|
677
|
+
* status line (e.g. a one-time API-key reveal for `create_api_key`). Return
|
|
678
|
+
* null to fall back to just the status line. Unlike `toolRenderers` (collapsed
|
|
679
|
+
* detail for a read-only tool chip), this is shown expanded, so a one-time
|
|
680
|
+
* secret is visible without a click. See {@link ConfirmedResult}. */
|
|
681
|
+
renderConfirmedResult?: (result: ConfirmedResult) => ReactNode;
|
|
630
682
|
/** Zero-state shown for a fresh, non-streaming thread. */
|
|
631
683
|
emptyState?: ReactNode;
|
|
632
684
|
}
|
|
@@ -636,7 +688,7 @@ interface AssistantTranscriptProps {
|
|
|
636
688
|
* after the proposing turn through `renderExtras`; the settled turn cost renders
|
|
637
689
|
* once under its assistant bubble.
|
|
638
690
|
*/
|
|
639
|
-
declare function AssistantTranscript({ view, renderMarkdown, toolRenderers, emptyState, }: AssistantTranscriptProps): react.JSX.Element;
|
|
691
|
+
declare function AssistantTranscript({ view, renderMarkdown, toolRenderers, renderConfirmedResult, emptyState, }: AssistantTranscriptProps): react.JSX.Element;
|
|
640
692
|
|
|
641
693
|
interface ProposalCardProps {
|
|
642
694
|
proposal: PendingProposal;
|
|
@@ -655,8 +707,13 @@ interface ProposalCardProps {
|
|
|
655
707
|
/** Render the workflow YAML as a node graph (the `./workflows` WorkflowGraph).
|
|
656
708
|
* When absent, the YAML is shown as text. */
|
|
657
709
|
renderGraph?: (yaml: string) => ReactNode;
|
|
710
|
+
/** Render the brand icon for an integration requirement's provider. The host
|
|
711
|
+
* owns the provider→icon mapping (its integrations catalog); when absent, or
|
|
712
|
+
* when it returns a nullish node for a provider it doesn't recognize, the row
|
|
713
|
+
* falls back to the built-in {@link ProviderLogo} mark. */
|
|
714
|
+
renderProviderIcon?: (provider: string) => ReactNode;
|
|
658
715
|
}
|
|
659
|
-
declare function ProposalCard({ proposal, confirming, onConfirm, onCancel, navigate, onConnect, renderGraph, }: ProposalCardProps): react.JSX.Element;
|
|
716
|
+
declare function ProposalCard({ proposal, confirming, onConfirm, onCancel, navigate, onConnect, renderGraph, renderProviderIcon, }: ProposalCardProps): react.JSX.Element;
|
|
660
717
|
|
|
661
718
|
interface AssistantLauncher {
|
|
662
719
|
/** Whether the assistant drawer is open. */
|
|
@@ -674,4 +731,4 @@ declare function AssistantLauncherProvider({ children, }: {
|
|
|
674
731
|
}): react.JSX.Element;
|
|
675
732
|
declare function useAssistantLauncher(): AssistantLauncher;
|
|
676
733
|
|
|
677
|
-
export { type AssistantChat, type AssistantClient, type AssistantClientConfig, AssistantClientInputError, AssistantClientProvider, type AssistantDeliveryMode, AssistantDock, type AssistantDockProps, type AssistantLauncher, AssistantLauncherProvider, type AssistantModelOption, type AssistantModels, type AssistantModelsResult, AssistantPanel, type AssistantPanelProps, type AssistantSendOptions, type AssistantStreamEvent, type AssistantThreadSummary, type AssistantThreads, AssistantTranscript, type AssistantTranscriptProps, type AssistantTranscriptView, type ChatMessage, type ChatRequest, type ChatRole, type ConfirmResult, type ConnectRequirementResult, type ConnectionRequirement, type ConnectionRequirementKind, type DeltaEventData, type DoneEventData, type ErrorEventData, type PendingProposal, ProposalCard, type ProposalCardProps, type ReasoningEventData, type ThreadEventData, type ThreadHistoryResult, type ToolActivityStatus, type ToolCallEventData, type ToolOutcome, type ToolProposalEventData, type ToolResultEventData, type UsageEventData, type UsageInfo, type UseAssistantChatOptions, adaptTranscript, assistantIsThinking, createAssistantClient, useAssistantChat, useAssistantClient, useAssistantLauncher, useAssistantModels, useAssistantThreads };
|
|
734
|
+
export { type AssistantChat, type AssistantClient, type AssistantClientConfig, AssistantClientInputError, AssistantClientProvider, type AssistantDeliveryMode, AssistantDock, type AssistantDockProps, type AssistantLauncher, AssistantLauncherProvider, type AssistantModelOption, type AssistantModels, type AssistantModelsResult, AssistantPanel, type AssistantPanelProps, type AssistantSendOptions, type AssistantStreamEvent, type AssistantThreadSummary, type AssistantThreads, AssistantTranscript, type AssistantTranscriptProps, type AssistantTranscriptView, type ChatMessage, type ChatRequest, type ChatRole, type ConfirmResult, type ConfirmedResult, type ConnectRequirementResult, type ConnectionRequirement, type ConnectionRequirementKind, type DeltaEventData, type DoneEventData, type ErrorEventData, type PendingProposal, ProposalCard, type ProposalCardProps, type ReasoningEventData, type ThreadEventData, type ThreadHistoryResult, type ToolActivityStatus, type ToolCallEventData, type ToolOutcome, type ToolProposalEventData, type ToolResultEventData, type UsageEventData, type UsageInfo, type UseAssistantChatOptions, adaptTranscript, assistantIsThinking, createAssistantClient, useAssistantChat, useAssistantClient, useAssistantLauncher, useAssistantModels, useAssistantThreads };
|
package/dist/assistant/index.js
CHANGED
|
@@ -733,7 +733,7 @@ function describeOutcome(name, output) {
|
|
|
733
733
|
return wf.enabled ? "Workflow enabled." : "Workflow disabled.";
|
|
734
734
|
}
|
|
735
735
|
case "create_api_key":
|
|
736
|
-
return o.prefix ? `Created API key (${str(o.prefix)}\u2026)
|
|
736
|
+
return o.prefix ? `Created API key (${str(o.prefix)}\u2026).` : "API key created.";
|
|
737
737
|
case "revoke_api_key":
|
|
738
738
|
return "API key revoked.";
|
|
739
739
|
case "invoke_integration":
|
|
@@ -1345,10 +1345,19 @@ function useAssistantChat(userId, options) {
|
|
|
1345
1345
|
return;
|
|
1346
1346
|
}
|
|
1347
1347
|
const { statusText, error } = resolveConfirmation(proposal.name, result);
|
|
1348
|
+
const status = statusText ? statusMessage(statusText) : null;
|
|
1349
|
+
if (status && result.ok && !error) {
|
|
1350
|
+
const confirmed = {
|
|
1351
|
+
name: proposal.name,
|
|
1352
|
+
output: result.output,
|
|
1353
|
+
args: proposal.args
|
|
1354
|
+
};
|
|
1355
|
+
status.result = confirmed;
|
|
1356
|
+
}
|
|
1348
1357
|
dispatch({
|
|
1349
1358
|
type: "proposal_resolved",
|
|
1350
1359
|
callId: proposal.callId,
|
|
1351
|
-
status
|
|
1360
|
+
status,
|
|
1352
1361
|
error
|
|
1353
1362
|
});
|
|
1354
1363
|
if (!error && WORKFLOW_MUTATING_TOOLS.has(proposal.name)) {
|
|
@@ -1789,7 +1798,7 @@ function providerLabel(provider) {
|
|
|
1789
1798
|
}
|
|
1790
1799
|
|
|
1791
1800
|
// src/assistant/ProposalCard.tsx
|
|
1792
|
-
import {
|
|
1801
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1793
1802
|
function ProposalCard({
|
|
1794
1803
|
proposal,
|
|
1795
1804
|
confirming,
|
|
@@ -1797,7 +1806,8 @@ function ProposalCard({
|
|
|
1797
1806
|
onCancel,
|
|
1798
1807
|
navigate,
|
|
1799
1808
|
onConnect,
|
|
1800
|
-
renderGraph
|
|
1809
|
+
renderGraph,
|
|
1810
|
+
renderProviderIcon
|
|
1801
1811
|
}) {
|
|
1802
1812
|
const view = describeProposal(proposal);
|
|
1803
1813
|
const [tab, setTab] = useState4("graph");
|
|
@@ -1853,7 +1863,8 @@ function ProposalCard({
|
|
|
1853
1863
|
{
|
|
1854
1864
|
req: r,
|
|
1855
1865
|
navigate,
|
|
1856
|
-
onConnect
|
|
1866
|
+
onConnect,
|
|
1867
|
+
renderProviderIcon
|
|
1857
1868
|
},
|
|
1858
1869
|
`${r.provider}-${r.kind ?? "integration"}`
|
|
1859
1870
|
)) }),
|
|
@@ -1904,7 +1915,8 @@ function openConnect(target, navigate) {
|
|
|
1904
1915
|
function RequirementRow({
|
|
1905
1916
|
req,
|
|
1906
1917
|
navigate,
|
|
1907
|
-
onConnect
|
|
1918
|
+
onConnect,
|
|
1919
|
+
renderProviderIcon
|
|
1908
1920
|
}) {
|
|
1909
1921
|
const [connecting, setConnecting] = useState4(false);
|
|
1910
1922
|
const mountedRef = useRef3(true);
|
|
@@ -1938,9 +1950,15 @@ function RequirementRow({
|
|
|
1938
1950
|
if (mountedRef.current) setConnecting(false);
|
|
1939
1951
|
});
|
|
1940
1952
|
};
|
|
1953
|
+
let providerIcon;
|
|
1954
|
+
try {
|
|
1955
|
+
providerIcon = renderProviderIcon?.(req.provider) ?? null;
|
|
1956
|
+
} catch {
|
|
1957
|
+
providerIcon = null;
|
|
1958
|
+
}
|
|
1941
1959
|
return /* @__PURE__ */ jsxs2("li", { className: "flex items-center justify-between gap-2 text-xs", children: [
|
|
1942
1960
|
/* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1943
|
-
/* @__PURE__ */ jsx3(ProviderLogo, { provider: req.provider, size: 16 }),
|
|
1961
|
+
providerIcon ?? /* @__PURE__ */ jsx3(ProviderLogo, { provider: req.provider, size: 16 }),
|
|
1944
1962
|
/* @__PURE__ */ jsx3("span", { className: "truncate text-foreground", children: kindLabel }),
|
|
1945
1963
|
/* @__PURE__ */ jsxs2("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1946
1964
|
/* @__PURE__ */ jsx3(
|
|
@@ -1965,11 +1983,8 @@ function RequirementRow({
|
|
|
1965
1983
|
type: "button",
|
|
1966
1984
|
onClick: handleConnect,
|
|
1967
1985
|
disabled: connecting,
|
|
1968
|
-
className: "shrink-0 text-primary disabled:opacity-50",
|
|
1969
|
-
children: connecting ? isApp ? "Installing\u2026" : "Connecting\u2026" :
|
|
1970
|
-
isApp ? "Install" : "Connect",
|
|
1971
|
-
" \u2192"
|
|
1972
|
-
] })
|
|
1986
|
+
className: "shrink-0 rounded border border-primary px-2 py-0.5 font-medium text-primary transition-colors hover:bg-primary/10 disabled:opacity-50",
|
|
1987
|
+
children: connecting ? isApp ? "Installing\u2026" : "Connecting\u2026" : isApp ? "Install" : "Connect"
|
|
1973
1988
|
}
|
|
1974
1989
|
)
|
|
1975
1990
|
] });
|
|
@@ -1977,7 +1992,7 @@ function RequirementRow({
|
|
|
1977
1992
|
|
|
1978
1993
|
// src/assistant/transcript.tsx
|
|
1979
1994
|
import { useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
1980
|
-
import { Fragment
|
|
1995
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1981
1996
|
function assistantIsThinking(state) {
|
|
1982
1997
|
if (state.status !== "streaming") return false;
|
|
1983
1998
|
const streaming = state.streamingId ? state.messages.find((m) => m.id === state.streamingId) : void 0;
|
|
@@ -1994,6 +2009,7 @@ function adaptToolResult(outcome) {
|
|
|
1994
2009
|
}
|
|
1995
2010
|
function adaptTranscript(view) {
|
|
1996
2011
|
const messages = [];
|
|
2012
|
+
const confirmedResults = /* @__PURE__ */ new Map();
|
|
1997
2013
|
let turn = null;
|
|
1998
2014
|
let currentTurnAssistant = null;
|
|
1999
2015
|
const openTurn = (id) => {
|
|
@@ -2037,6 +2053,7 @@ ${text}` : text;
|
|
|
2037
2053
|
});
|
|
2038
2054
|
} else {
|
|
2039
2055
|
messages.push({ id: msg.id, role: "system", content: msg.text });
|
|
2056
|
+
if (msg.result) confirmedResults.set(msg.id, msg.result);
|
|
2040
2057
|
turn = null;
|
|
2041
2058
|
}
|
|
2042
2059
|
}
|
|
@@ -2065,7 +2082,8 @@ ${text}` : text;
|
|
|
2065
2082
|
return {
|
|
2066
2083
|
messages: messages.filter((m) => !isEmptyShell(m)),
|
|
2067
2084
|
proposalHostId,
|
|
2068
|
-
metricsHostId: currentTurnAssistant && !isEmptyShell(currentTurnAssistant) ? currentTurnAssistant.id : null
|
|
2085
|
+
metricsHostId: currentTurnAssistant && !isEmptyShell(currentTurnAssistant) ? currentTurnAssistant.id : null,
|
|
2086
|
+
confirmedResults
|
|
2069
2087
|
};
|
|
2070
2088
|
}
|
|
2071
2089
|
function formatTurnCost(costUsd) {
|
|
@@ -2075,15 +2093,16 @@ function ProposalSlot({
|
|
|
2075
2093
|
proposal,
|
|
2076
2094
|
render
|
|
2077
2095
|
}) {
|
|
2078
|
-
return /* @__PURE__ */ jsx4(
|
|
2096
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: render(proposal) });
|
|
2079
2097
|
}
|
|
2080
2098
|
function AssistantTranscript({
|
|
2081
2099
|
view,
|
|
2082
2100
|
renderMarkdown,
|
|
2083
2101
|
toolRenderers,
|
|
2102
|
+
renderConfirmedResult,
|
|
2084
2103
|
emptyState
|
|
2085
2104
|
}) {
|
|
2086
|
-
const { messages, proposalHostId, metricsHostId } = useMemo2(
|
|
2105
|
+
const { messages, proposalHostId, metricsHostId, confirmedResults } = useMemo2(
|
|
2087
2106
|
() => adaptTranscript(view),
|
|
2088
2107
|
[view]
|
|
2089
2108
|
);
|
|
@@ -2092,7 +2111,7 @@ function AssistantTranscript({
|
|
|
2092
2111
|
[renderMarkdown]
|
|
2093
2112
|
);
|
|
2094
2113
|
if (messages.length === 0 && !view.isStreaming) {
|
|
2095
|
-
return /* @__PURE__ */ jsx4(
|
|
2114
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: emptyState });
|
|
2096
2115
|
}
|
|
2097
2116
|
return /* @__PURE__ */ jsx4(
|
|
2098
2117
|
ChatMessages,
|
|
@@ -2102,7 +2121,7 @@ function AssistantTranscript({
|
|
|
2102
2121
|
agentLabel: "Assistant",
|
|
2103
2122
|
renderMarkdown: markdown,
|
|
2104
2123
|
toolRenderers,
|
|
2105
|
-
renderEmpty: () => /* @__PURE__ */ jsx4(
|
|
2124
|
+
renderEmpty: () => /* @__PURE__ */ jsx4(Fragment, { children: emptyState }),
|
|
2106
2125
|
renderExtras: (message) => {
|
|
2107
2126
|
const proposals = message.id === proposalHostId && view.pendingProposals.length > 0 ? /* @__PURE__ */ jsx4("div", { className: "mt-3 flex flex-col gap-3", children: view.pendingProposals.map((proposal) => /* @__PURE__ */ jsx4(
|
|
2108
2127
|
ProposalSlot,
|
|
@@ -2112,12 +2131,16 @@ function AssistantTranscript({
|
|
|
2112
2131
|
},
|
|
2113
2132
|
proposal.callId
|
|
2114
2133
|
)) }) : null;
|
|
2134
|
+
const confirmed = confirmedResults.get(message.id);
|
|
2135
|
+
const confirmedNode = confirmed && renderConfirmedResult ? renderConfirmedResult(confirmed) : null;
|
|
2136
|
+
const confirmedCard = confirmedNode ? /* @__PURE__ */ jsx4("div", { className: "mt-3", children: confirmedNode }) : null;
|
|
2115
2137
|
const cost = message.id === metricsHostId && !view.isStreaming && view.usage?.costUsd != null && !view.usage.replayed ? /* @__PURE__ */ jsxs3("p", { className: "mt-1 text-[11px] text-muted-foreground", children: [
|
|
2116
2138
|
formatTurnCost(view.usage.costUsd),
|
|
2117
2139
|
" this turn"
|
|
2118
2140
|
] }) : null;
|
|
2119
|
-
if (!proposals && !cost) return null;
|
|
2120
|
-
return /* @__PURE__ */ jsxs3(
|
|
2141
|
+
if (!proposals && !cost && !confirmedCard) return null;
|
|
2142
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
2143
|
+
confirmedCard,
|
|
2121
2144
|
proposals,
|
|
2122
2145
|
cost
|
|
2123
2146
|
] });
|
|
@@ -2318,8 +2341,10 @@ function AssistantPanel({
|
|
|
2318
2341
|
balanceUsd = null,
|
|
2319
2342
|
formatMoney = defaultFormatMoney,
|
|
2320
2343
|
renderGraph,
|
|
2344
|
+
renderProviderIcon,
|
|
2321
2345
|
renderMarkdown,
|
|
2322
2346
|
toolRenderers,
|
|
2347
|
+
renderConfirmedResult,
|
|
2323
2348
|
renderTranscript
|
|
2324
2349
|
}) {
|
|
2325
2350
|
const models = useAssistantModels();
|
|
@@ -2394,7 +2419,8 @@ function AssistantPanel({
|
|
|
2394
2419
|
onCancel: () => chat.cancel(proposal),
|
|
2395
2420
|
navigate,
|
|
2396
2421
|
onConnect: chat.canConnectRequirement ? (requirement) => chat.connectRequirement(proposal, requirement) : void 0,
|
|
2397
|
-
renderGraph
|
|
2422
|
+
renderGraph,
|
|
2423
|
+
renderProviderIcon
|
|
2398
2424
|
}
|
|
2399
2425
|
);
|
|
2400
2426
|
const isThinking = assistantIsThinking(state);
|
|
@@ -2560,6 +2586,7 @@ function AssistantPanel({
|
|
|
2560
2586
|
view: transcriptView,
|
|
2561
2587
|
renderMarkdown,
|
|
2562
2588
|
toolRenderers,
|
|
2589
|
+
renderConfirmedResult,
|
|
2563
2590
|
emptyState: /* @__PURE__ */ jsx5("p", { className: "px-4 py-8 text-center text-muted-foreground text-sm", children: EMPTY_STATE })
|
|
2564
2591
|
}
|
|
2565
2592
|
) })
|
|
@@ -2772,7 +2799,7 @@ function ResizeHandle({
|
|
|
2772
2799
|
}
|
|
2773
2800
|
|
|
2774
2801
|
// src/assistant/AssistantDock.tsx
|
|
2775
|
-
import { Fragment as
|
|
2802
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2776
2803
|
function focusableWithin(container) {
|
|
2777
2804
|
const selector = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
2778
2805
|
return Array.from(container.querySelectorAll(selector)).filter(
|
|
@@ -2785,10 +2812,12 @@ function AssistantDock({
|
|
|
2785
2812
|
balanceUsd = null,
|
|
2786
2813
|
formatMoney,
|
|
2787
2814
|
renderGraph,
|
|
2815
|
+
renderProviderIcon,
|
|
2788
2816
|
onWorkflowMutation,
|
|
2789
2817
|
onConnectRequirement,
|
|
2790
2818
|
renderMarkdown,
|
|
2791
2819
|
toolRenderers,
|
|
2820
|
+
renderConfirmedResult,
|
|
2792
2821
|
renderTranscript
|
|
2793
2822
|
}) {
|
|
2794
2823
|
const { open, openAssistant, closeAssistant } = useAssistantLauncher();
|
|
@@ -2866,7 +2895,7 @@ function AssistantDock({
|
|
|
2866
2895
|
first.focus();
|
|
2867
2896
|
}
|
|
2868
2897
|
};
|
|
2869
|
-
return /* @__PURE__ */ jsxs5(
|
|
2898
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2870
2899
|
/* @__PURE__ */ jsx8(
|
|
2871
2900
|
"div",
|
|
2872
2901
|
{
|
|
@@ -2897,8 +2926,10 @@ function AssistantDock({
|
|
|
2897
2926
|
balanceUsd,
|
|
2898
2927
|
formatMoney,
|
|
2899
2928
|
renderGraph,
|
|
2929
|
+
renderProviderIcon,
|
|
2900
2930
|
renderMarkdown,
|
|
2901
2931
|
toolRenderers,
|
|
2932
|
+
renderConfirmedResult,
|
|
2902
2933
|
renderTranscript
|
|
2903
2934
|
},
|
|
2904
2935
|
userId ?? "anon"
|