@reforma/components 0.4.1 → 0.6.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/RichInput/RichInput.d.ts +1 -1
- package/dist/RichInput/RichInput.d.ts.map +1 -1
- package/dist/RichInput/RichInput.js +126 -123
- package/dist/RichInput/RichInput.js.map +1 -1
- package/dist/SortableList/SortableList.d.ts +9 -3
- package/dist/SortableList/SortableList.d.ts.map +1 -1
- package/dist/SortableList/SortableList.js +178 -163
- package/dist/SortableList/SortableList.js.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.d.ts +6 -1
- package/dist/chat/ComposerBanner/ComposerBanner.d.ts.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.js +60 -40
- package/dist/chat/ComposerBanner/ComposerBanner.js.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.module.css +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.module.css.js +13 -9
- package/dist/chat/ComposerBanner/ComposerBanner.module.css.js.map +1 -1
- package/dist/chat/Conversation/ConversationPendingLoader.d.ts.map +1 -1
- package/dist/chat/Conversation/ConversationPendingLoader.js +1 -1
- package/dist/chat/Conversation/ConversationPendingLoader.js.map +1 -1
- package/dist/chat/Message/normalize/normalizeMessageParts.d.ts +1 -1
- package/dist/chat/Message/normalize/normalizeMessageParts.d.ts.map +1 -1
- package/dist/chat/Message/normalize/normalizeMessageParts.js +1 -1
- package/dist/chat/Message/normalize/normalizeMessageParts.js.map +1 -1
- package/dist/chat/Message/parts/MessagePart.d.ts.map +1 -1
- package/dist/chat/Message/parts/MessagePart.js +1 -1
- package/dist/chat/Message/parts/MessagePart.js.map +1 -1
- package/dist/chat/Message/parts/backgroundResultPart.js +1 -1
- package/dist/chat/Message/parts/backgroundResultPart.js.map +1 -1
- package/dist/chat/Message/parts/collectMessageSources.d.ts +1 -1
- package/dist/chat/Message/parts/collectMessageSources.d.ts.map +1 -1
- package/dist/chat/Message/parts/collectMessageSources.js +1 -1
- package/dist/chat/Message/parts/collectMessageSources.js.map +1 -1
- package/dist/chat/Message/parts/contextCompactionPart.js +1 -1
- package/dist/chat/Message/parts/contextCompactionPart.js.map +1 -1
- package/dist/chat/Message/segments/analyzeGroupedSegment.js +5 -5
- package/dist/chat/Message/segments/analyzeGroupedSegment.js.map +1 -1
- package/dist/chat/Message/segments/recentStreamingPhaseToolGroups.js +1 -1
- package/dist/chat/Message/segments/recentStreamingPhaseToolGroups.js.map +1 -1
- package/dist/chat/Message/turn/workedCollapse.js +1 -1
- package/dist/chat/Message/turn/workedCollapse.js.map +1 -1
- package/dist/chat/Tool/Tool.js +1 -1
- package/dist/chat/Tool/Tool.js.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.d.ts.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.js +73 -73
- package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
- package/dist/chat/Tool/bash/BashTool.d.ts.map +1 -1
- package/dist/chat/Tool/bash/BashTool.js +42 -48
- package/dist/chat/Tool/bash/BashTool.js.map +1 -1
- package/dist/chat/Tool/bash/BashTool.module.css +1 -1
- package/dist/chat/Tool/bash/BashTool.module.css.js +6 -8
- package/dist/chat/Tool/bash/BashTool.module.css.js.map +1 -1
- package/dist/chat/Tool/create-directory/CreateDirectoryTool.js +1 -1
- package/dist/chat/Tool/create-directory/CreateDirectoryTool.js.map +1 -1
- package/dist/chat/Tool/default/Default.d.ts.map +1 -1
- package/dist/chat/Tool/default/Default.js +1 -1
- package/dist/chat/Tool/default/Default.js.map +1 -1
- package/dist/chat/Tool/dev-server/DevServerRestartTool.js +1 -1
- package/dist/chat/Tool/dev-server/DevServerRestartTool.js.map +1 -1
- package/dist/chat/Tool/dev-server/DevServerStatusTool.js +1 -1
- package/dist/chat/Tool/dev-server/DevServerStatusTool.js.map +1 -1
- package/dist/chat/Tool/edit/EditTool.js +1 -1
- package/dist/chat/Tool/edit/EditTool.js.map +1 -1
- package/dist/chat/Tool/fetch/FetchTool.js +1 -1
- package/dist/chat/Tool/fetch/FetchTool.js.map +1 -1
- package/dist/chat/Tool/fileChangesFromToolParts.js +1 -1
- package/dist/chat/Tool/fileChangesFromToolParts.js.map +1 -1
- package/dist/chat/Tool/get-background-result/GetBackgroundResultTool.js +1 -1
- package/dist/chat/Tool/get-background-result/GetBackgroundResultTool.js.map +1 -1
- package/dist/chat/Tool/get-errors/GetErrorsTool.js +1 -1
- package/dist/chat/Tool/get-errors/GetErrorsTool.js.map +1 -1
- package/dist/chat/Tool/glob/GlobTool.js +1 -1
- package/dist/chat/Tool/glob/GlobTool.js.map +1 -1
- package/dist/chat/Tool/grep/GrepTool.js +1 -1
- package/dist/chat/Tool/grep/GrepTool.js.map +1 -1
- package/dist/chat/Tool/helpers.d.ts +1 -1
- package/dist/chat/Tool/helpers.d.ts.map +1 -1
- package/dist/chat/Tool/helpers.js +1 -1
- package/dist/chat/Tool/helpers.js.map +1 -1
- package/dist/chat/Tool/image-asset/ImageAssetTool.js +1 -1
- package/dist/chat/Tool/image-asset/ImageAssetTool.js.map +1 -1
- package/dist/chat/Tool/install-dependencies/InstallDependenciesTool.js +1 -1
- package/dist/chat/Tool/install-dependencies/InstallDependenciesTool.js.map +1 -1
- package/dist/chat/Tool/install-plugin/InstallPlugin.js +1 -1
- package/dist/chat/Tool/install-plugin/InstallPlugin.js.map +1 -1
- package/dist/chat/Tool/integration-card/IntegrationActionCard.d.ts +3 -1
- package/dist/chat/Tool/integration-card/IntegrationActionCard.d.ts.map +1 -1
- package/dist/chat/Tool/integration-card/IntegrationActionCard.js +88 -82
- package/dist/chat/Tool/integration-card/IntegrationActionCard.js.map +1 -1
- package/dist/chat/Tool/list-directory/normalizeListDirectoryTools.js +1 -1
- package/dist/chat/Tool/list-directory/normalizeListDirectoryTools.js.map +1 -1
- package/dist/chat/Tool/mcp-tools/CallDynamicTool.js +1 -1
- package/dist/chat/Tool/mcp-tools/CallDynamicTool.js.map +1 -1
- package/dist/chat/Tool/mcp-tools/GetDynamicToolsTool.js +1 -1
- package/dist/chat/Tool/mcp-tools/GetDynamicToolsTool.js.map +1 -1
- package/dist/chat/Tool/mcp-tools/GetMcpResourcesTool.js +1 -1
- package/dist/chat/Tool/mcp-tools/GetMcpResourcesTool.js.map +1 -1
- package/dist/chat/Tool/mcp-tools/McpAuth.js +1 -1
- package/dist/chat/Tool/mcp-tools/McpAuth.js.map +1 -1
- package/dist/chat/Tool/memory/MemoryTool.js +1 -1
- package/dist/chat/Tool/memory/MemoryTool.js.map +1 -1
- package/dist/chat/Tool/move-file/MoveFileTool.js +1 -1
- package/dist/chat/Tool/move-file/MoveFileTool.js.map +1 -1
- package/dist/chat/Tool/plan/CreatePlanTool.js +1 -1
- package/dist/chat/Tool/plan/CreatePlanTool.js.map +1 -1
- package/dist/chat/Tool/preamble/PreambleTool.js +1 -1
- package/dist/chat/Tool/preamble/PreambleTool.js.map +1 -1
- package/dist/chat/Tool/project-build/BuildTool.js +1 -1
- package/dist/chat/Tool/project-build/BuildTool.js.map +1 -1
- package/dist/chat/Tool/project-env/ProjectEnvTool.js +1 -1
- package/dist/chat/Tool/project-env/ProjectEnvTool.js.map +1 -1
- package/dist/chat/Tool/read/normalizeReadTools.js +1 -1
- package/dist/chat/Tool/read/normalizeReadTools.js.map +1 -1
- package/dist/chat/Tool/read-lints/ReadLintsTool.js +1 -1
- package/dist/chat/Tool/read-lints/ReadLintsTool.js.map +1 -1
- package/dist/chat/Tool/remove-file/RemoveFileTool.js +1 -1
- package/dist/chat/Tool/remove-file/RemoveFileTool.js.map +1 -1
- package/dist/chat/Tool/scaffold-project/ScaffoldProjectTool.js +1 -1
- package/dist/chat/Tool/scaffold-project/ScaffoldProjectTool.js.map +1 -1
- package/dist/chat/Tool/screenshot/CaptureScreenshotTool.js +3 -3
- package/dist/chat/Tool/screenshot/CaptureScreenshotTool.js.map +1 -1
- package/dist/chat/Tool/skill/SkillTool.js +1 -1
- package/dist/chat/Tool/skill/SkillTool.js.map +1 -1
- package/dist/chat/Tool/waiting/WaitingTool.js +1 -1
- package/dist/chat/Tool/waiting/WaitingTool.js.map +1 -1
- package/dist/chat/Tool/web-search/WebSearchTool.js +1 -1
- package/dist/chat/Tool/web-search/WebSearchTool.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isTextUIPart as o, isReasoningUIPart as m, isFileUIPart as l, isToolUIPart as u } from "
|
|
1
|
+
import { isTextUIPart as o, isReasoningUIPart as m, isFileUIPart as l, isToolUIPart as u } from "@reforma/types";
|
|
2
2
|
import { memo as n } from "react";
|
|
3
3
|
import { Tool as f } from "../../Tool/Tool.js";
|
|
4
4
|
import { GetBackgroundResultTool as g } from "../../Tool/get-background-result/GetBackgroundResultTool.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagePart.js","sources":["../../../../src/chat/Message/parts/MessagePart.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"MessagePart.js","sources":["../../../../src/chat/Message/parts/MessagePart.tsx"],"sourcesContent":["import { isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from '@reforma/types';\nimport { memo } from 'react';\n\nimport { Tool } from '../../Tool';\nimport { GetBackgroundResultTool } from '../../Tool/get-background-result';\nimport { uiMessagePartEqual } from '../normalize/normalizeMessageParts';\nimport { MessageText } from '../streamdown/MessageText';\nimport { isBackgroundResultUIPart } from './backgroundResultPart';\nimport { MessageFileParts } from './MessageFileParts';\nimport { MessagePartFallback } from './MessagePartFallback';\nimport { MessageReasoningParts } from './MessageReasoningParts';\nimport { isRedactedReasoningUIPart } from './redactedReasoningPart';\n\nimport type { ReformaUIMessagePart } from '../types';\n\nexport type MessagePartProps = {\n part: ReformaUIMessagePart;\n /** Stable key for this part (e.g. `${message.id}-${index}`), used for file part DOM ids. */\n partKey: string;\n isStreaming?: boolean;\n /** Live assistant slot in the thread (memo while streaming). */\n isLiveMessage?: boolean;\n /** Last render row in the live message. */\n isMessageTail?: boolean;\n};\n\nfunction messagePartPropsEqual(prev: MessagePartProps, next: MessagePartProps): boolean {\n if (prev.partKey !== next.partKey\n || prev.isMessageTail !== next.isMessageTail\n || prev.isStreaming !== next.isStreaming\n || prev.isLiveMessage !== next.isLiveMessage) {\n return false;\n }\n\n if (next.isStreaming && next.isLiveMessage) {\n return uiMessagePartEqual(prev.part, next.part);\n }\n\n return prev.part === next.part;\n}\n\n/**\n * One assistant/system `Message` part (text, reasoning, or tool). Memoized so frozen\n * siblings skip rerender; the streaming tail uses semantic part equality.\n */\nfunction MessagePartView({\n part,\n partKey,\n isStreaming,\n isLiveMessage: _isLiveMessage,\n isMessageTail,\n}: MessagePartProps) {\n const streamText = Boolean(isStreaming && isMessageTail);\n\n if (isTextUIPart(part)) {\n return (\n <MessageText mode={ streamText ? 'streaming' : 'static' }>{ part.text }</MessageText>\n );\n }\n\n if (isReasoningUIPart(part)) {\n return (\n <MessageReasoningParts\n parts={ [part] }\n isStreaming={ Boolean(isStreaming) }\n />\n );\n }\n\n if (isFileUIPart(part)) {\n return (\n <MessageFileParts fileParts={ [part] } idPrefix={ partKey } />\n );\n }\n\n if (isBackgroundResultUIPart(part)) {\n return (\n <GetBackgroundResultTool\n part={ {\n type: 'tool-GetBackgroundResult',\n toolCallId: part.id ?? part.data.id,\n state: 'output-available',\n input: {},\n output: part.data.results,\n } }\n />\n );\n }\n\n if (isToolUIPart(part)) {\n return <Tool part={ part } />;\n }\n\n if (isRedactedReasoningUIPart(part)) {\n return null;\n }\n\n return <MessagePartFallback part={ part } />;\n}\n\nexport const MessagePart = memo(MessagePartView, messagePartPropsEqual);\n"],"names":["messagePartPropsEqual","prev","next","uiMessagePartEqual","MessagePartView","part","partKey","isStreaming","_isLiveMessage","isMessageTail","streamText","isTextUIPart","MessageText","isReasoningUIPart","MessageReasoningParts","isFileUIPart","MessageFileParts","isBackgroundResultUIPart","GetBackgroundResultTool","isToolUIPart","Tool","isRedactedReasoningUIPart","MessagePartFallback","MessagePart","memo"],"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version":3,"file":"backgroundResultPart.js","sources":["../../../../src/chat/Message/parts/backgroundResultPart.ts"],"sourcesContent":["import { isDataUIPart } from '
|
|
1
|
+
{"version":3,"file":"backgroundResultPart.js","sources":["../../../../src/chat/Message/parts/backgroundResultPart.ts"],"sourcesContent":["import { isDataUIPart } from '@reforma/types';\n\nimport type { BackgroundResultNoticeData } from '@reforma/types';\nimport type { ReformaUIMessagePart } from '../types';\n\nexport type BackgroundResultUIPart = {\n type: 'data-background-result';\n id?: string;\n data: BackgroundResultNoticeData;\n};\n\nexport function isBackgroundResultUIPart(\n part: ReformaUIMessagePart\n): part is BackgroundResultUIPart {\n return isDataUIPart(part) && part.type === 'data-background-result';\n}\n"],"names":["isBackgroundResultUIPart","part","isDataUIPart"],"mappings":";AACO,SAASA,EAAyBC,GAAM;AAC7C,SAAOC,EAAaD,CAAI,KAAKA,EAAK,SAAS;AAC7C;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SourceDocumentUIPart, SourceUrlUIPart } from 'ai';
|
|
2
2
|
import type { ReformaUIMessagePart } from '../types';
|
|
3
3
|
export type MessageSourcePart = SourceUrlUIPart | SourceDocumentUIPart;
|
|
4
4
|
/** Unique source parts for the message footer (first occurrence wins). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectMessageSources.d.ts","sourceRoot":"","sources":["../../../../src/chat/Message/parts/collectMessageSources.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collectMessageSources.d.ts","sourceRoot":"","sources":["../../../../src/chat/Message/parts/collectMessageSources.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAiBvE,0EAA0E;AAC1E,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,SAAS,oBAAoB,EAAE,GACvC,iBAAiB,EAAE,CA6BrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isToolUIPart as s, getToolName as l } from "
|
|
1
|
+
import { isToolUIPart as s, getToolName as l } from "@reforma/types";
|
|
2
2
|
import { isWebSearchToolName as n, webSearchSourcesFromOutput as i } from "../../Tool/web-search/parseWebSearchTool.js";
|
|
3
3
|
function c(t, u, e) {
|
|
4
4
|
const o = e.type === "source-url" ? `url:${e.url}` : `doc:${e.sourceId}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectMessageSources.js","sources":["../../../../src/chat/Message/parts/collectMessageSources.ts"],"sourcesContent":["import { getToolName, isToolUIPart
|
|
1
|
+
{"version":3,"file":"collectMessageSources.js","sources":["../../../../src/chat/Message/parts/collectMessageSources.ts"],"sourcesContent":["import { getToolName, isToolUIPart } from '@reforma/types';\n\nimport {\n isWebSearchToolName,\n webSearchSourcesFromOutput,\n} from '../../Tool/web-search/parseWebSearchTool';\n\nimport type { SourceDocumentUIPart, SourceUrlUIPart } from 'ai';\nimport type { ReformaUIMessagePart } from '../types';\n\nexport type MessageSourcePart = SourceUrlUIPart | SourceDocumentUIPart;\n\nfunction pushUnique(\n seen: Set<string>,\n out: MessageSourcePart[],\n part: MessageSourcePart\n): void {\n const key = part.type === 'source-url' ? `url:${ part.url }` : `doc:${ part.sourceId }`;\n\n if (seen.has(key)) {\n return;\n }\n\n seen.add(key);\n out.push(part);\n}\n\n/** Unique source parts for the message footer (first occurrence wins). */\nexport function collectMessageSources(\n parts: readonly ReformaUIMessagePart[]\n): MessageSourcePart[] {\n const seen = new Set<string>();\n const out: MessageSourcePart[] = [];\n\n for (const part of parts) {\n if (part.type === 'source-url' || part.type === 'source-document') {\n pushUnique(seen, out, part);\n\n continue;\n }\n\n // Provider WebSearch embeds `{ type: 'url', url }` in tool output — not top-level source-* parts.\n if (\n isToolUIPart(part)\n && part.state === 'output-available'\n && isWebSearchToolName(getToolName(part))\n ) {\n for (const source of webSearchSourcesFromOutput(part.output)) {\n pushUnique(seen, out, {\n type: 'source-url',\n sourceId: source.url,\n url: source.url,\n title: source.title,\n });\n }\n }\n }\n\n return out;\n}\n"],"names":["pushUnique","seen","out","part","key","collectMessageSources","parts","isToolUIPart","isWebSearchToolName","getToolName","source","webSearchSourcesFromOutput"],"mappings":";;AAEA,SAASA,EAAWC,GAAMC,GAAKC,GAAM;AACnC,QAAMC,IAAMD,EAAK,SAAS,eAAe,OAAOA,EAAK,GAAG,KAAK,OAAOA,EAAK,QAAQ;AACjF,EAAIF,EAAK,IAAIG,CAAG,MAGhBH,EAAK,IAAIG,CAAG,GACZF,EAAI,KAAKC,CAAI;AACf;AAGO,SAASE,EAAsBC,GAAO;AAC3C,QAAML,wBAAW,IAAA,GACXC,IAAM,CAAA;AACZ,aAAWC,KAAQG,GAAO;AACxB,QAAIH,EAAK,SAAS,gBAAgBA,EAAK,SAAS,mBAAmB;AACjE,MAAAH,EAAWC,GAAMC,GAAKC,CAAI;AAC1B;AAAA,IACF;AAGA,QAAII,EAAaJ,CAAI,KAAKA,EAAK,UAAU,sBAAsBK,EAAoBC,EAAYN,CAAI,CAAC;AAClG,iBAAWO,KAAUC,EAA2BR,EAAK,MAAM;AACzD,QAAAH,EAAWC,GAAMC,GAAK;AAAA,UACpB,MAAM;AAAA,UACN,UAAUQ,EAAO;AAAA,UACjB,KAAKA,EAAO;AAAA,UACZ,OAAOA,EAAO;AAAA,QAAA,CACf;AAAA,EAGP;AACA,SAAOR;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextCompactionPart.js","sources":["../../../../src/chat/Message/parts/contextCompactionPart.ts"],"sourcesContent":["import { isDataUIPart } from '
|
|
1
|
+
{"version":3,"file":"contextCompactionPart.js","sources":["../../../../src/chat/Message/parts/contextCompactionPart.ts"],"sourcesContent":["import { isDataUIPart } from '@reforma/types';\n\nimport type { ReformaChatDataContextCompactionPayload } from '@reforma/types';\nimport type { ReformaUIMessagePart } from '../types';\n\nexport type ContextCompactionUIPart = {\n type: 'data-context-compaction';\n data: ReformaChatDataContextCompactionPayload;\n};\n\nexport function isContextCompactionUIPart(\n part: ReformaUIMessagePart\n): part is ContextCompactionUIPart {\n return isDataUIPart(part) && part.type === 'data-context-compaction';\n}\n"],"names":["isContextCompactionUIPart","part","isDataUIPart"],"mappings":";AACO,SAASA,EAA0BC,GAAM;AAC9C,SAAOC,EAAaD,CAAI,KAAKA,EAAK,SAAS;AAC7C;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { plural as a } from "@reforma/lib";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isToolUIPart as g, getToolName as S } from "@reforma/types";
|
|
3
|
+
import { isScreenshotTool as T } from "@reforma/types/sandbox";
|
|
4
4
|
import { parseCallDynamicToolInput as E, parsePrefixedMcpToolName as x } from "../../Tool/mcp-tools/parseCallDynamicToolInput.js";
|
|
5
5
|
import { readPathsFromPart as y } from "../../Tool/read/normalizeReadTools.js";
|
|
6
6
|
import { mcpGroupedSegmentRole as G } from "./groupedSegmentMcpTools.js";
|
|
@@ -58,9 +58,9 @@ function H(s, t) {
|
|
|
58
58
|
const {
|
|
59
59
|
part: n
|
|
60
60
|
} = p;
|
|
61
|
-
if (!
|
|
61
|
+
if (!g(n))
|
|
62
62
|
continue;
|
|
63
|
-
const r =
|
|
63
|
+
const r = S(n);
|
|
64
64
|
if (r === "CallDynamicTool") {
|
|
65
65
|
const {
|
|
66
66
|
namespace: i,
|
|
@@ -91,7 +91,7 @@ function H(s, t) {
|
|
|
91
91
|
e.hasCommands = !0, e.commandCount++;
|
|
92
92
|
else if (R(r))
|
|
93
93
|
e.hasExplore = !0, e.searchCount++;
|
|
94
|
-
else if (
|
|
94
|
+
else if (T(r))
|
|
95
95
|
e.hasExplore = !0, e.screenshotCount++;
|
|
96
96
|
else if (d(r)) {
|
|
97
97
|
const i = c(n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeGroupedSegment.js","sources":["../../../../src/chat/Message/segments/analyzeGroupedSegment.ts"],"sourcesContent":["import { plural } from '@reforma/lib';\nimport { isScreenshotTool } from '@reforma/types/sandbox';\nimport { getToolName, isToolUIPart } from 'ai';\n\nimport { parseCallDynamicToolInput, parsePrefixedMcpToolName } from '../../Tool/mcp-tools/parseCallDynamicToolInput';\nimport { readPathsFromPart } from '../../Tool/read/normalizeReadTools';\nimport { mcpGroupedSegmentRole } from './groupedSegmentMcpTools';\nimport {\n GROUPED_SEGMENT_EDIT_TOOLS,\n isGroupedSegmentBuildTool,\n isGroupedSegmentCommandTool,\n isGroupedSegmentFilePathTool,\n isGroupedSegmentImageTool,\n isGroupedSegmentInstallTool,\n isGroupedSegmentLintTool,\n isGroupedSegmentRestartTool,\n isGroupedSegmentSearchTool,\n} from './groupedSegmentTools';\n\nimport type { ReadToolUIPart } from '../../Tool/read/normalizeReadTools';\nimport type { MessagePartGroup } from '../normalize/normalizeMessageParts';\n\nexport type GroupedSegmentKind = 'edit' | 'setup' | 'explore' | 'run' | 'other';\n\nexport type LineCounts = {\n added: number;\n removed: number;\n};\n\nexport type PhaseFileStats = {\n editCount: number;\n lineCounts?: LineCounts;\n};\n\nexport type GroupedSegmentActivity = {\n kind: GroupedSegmentKind;\n summary: string;\n label?: string;\n streamLabel?: string;\n};\n\nfunction groupedSegmentKind(\n hasEdits: boolean,\n hasSetup: boolean,\n hasExplore: boolean,\n hasCommands: boolean\n): GroupedSegmentKind {\n if (hasEdits) {\n return 'edit';\n }\n\n if (hasExplore) {\n return 'explore';\n }\n\n if (hasCommands) {\n return 'run';\n }\n\n if (hasSetup) {\n return 'setup';\n }\n\n return 'other';\n}\n\nfunction addToSet(set: Set<string>, paths: readonly string[]) {\n for (const path of paths) {\n if (path) {\n set.add(path);\n }\n }\n}\n\n/** Directory listed by ListDirectory (`path` input; root when omitted). */\nfunction listDirectoryPathsFromPart(part: { input?: unknown }): string[] {\n if (part.input == null || typeof part.input !== 'object') {\n return ['.'];\n }\n\n const path = (part.input as { path?: unknown }).path;\n\n if (typeof path !== 'string' || !path.trim()) {\n return ['.'];\n }\n\n return [path.trim()];\n}\n\n/** Images in successful ImageGen / SearchImage `images[]` output. */\nfunction imageCountFromPart(part: { state: string; output?: unknown }): number {\n if (part.state === 'output-available') {\n const output = part.output;\n\n if (typeof output === 'object' && output != null && 'images' in output && Array.isArray(output.images)) {\n return output.images.length;\n }\n }\n\n return 0;\n}\n\nfunction formatGroupedSegmentSummary(\n kind: GroupedSegmentKind,\n counts: {\n readCount: number;\n searchCount: number;\n commandCount: number;\n screenshotCount: number;\n imageCount: number;\n editCount: number;\n subagentCount: number;\n hasInstall: boolean;\n hasRestart: boolean;\n hasBuild: boolean;\n }\n): string {\n const parts: string[] = [];\n\n if (kind === 'edit') {\n if (counts.editCount) {\n parts.push(plural(counts.editCount, 'file', 'files'));\n }\n\n if (counts.readCount) {\n parts.push(plural(counts.readCount, 'explored', 'explored'));\n }\n }\n else if (kind === 'explore' || kind === 'setup' || kind === 'run') {\n if (counts.readCount) {\n parts.push(plural(counts.readCount, 'file', 'files'));\n }\n }\n\n if (counts.subagentCount) {\n parts.push(plural(counts.subagentCount, 'subagent', 'subagents'));\n }\n\n if (counts.screenshotCount) {\n parts.push(plural(counts.screenshotCount, 'screenshot', 'screenshots'));\n }\n\n if (counts.imageCount) {\n parts.push(plural(counts.imageCount, 'image', 'images'));\n }\n\n if (counts.searchCount) {\n parts.push(plural(counts.searchCount, 'search', 'searches'));\n }\n\n if (counts.commandCount) {\n parts.push(plural(counts.commandCount, 'command', 'commands'));\n }\n\n if (counts.hasInstall) {\n parts.push('installed deps');\n }\n\n if (counts.hasRestart) {\n parts.push('restarted server');\n }\n\n if (counts.hasBuild) {\n parts.push('built project');\n }\n\n return parts.join(', ');\n}\n\nfunction applyMcpGroupedSegmentRole(\n server: string | undefined,\n tool: string,\n state: {\n hasExplore: boolean;\n hasSetup: boolean;\n searchCount: number;\n }\n): void {\n const role = mcpGroupedSegmentRole(server, tool);\n\n if (role === 'lint') {\n state.hasSetup = true;\n\n return;\n }\n\n state.hasExplore = true;\n state.searchCount++;\n}\n\n/** Rolls up grouped workspace tools into Explored/Edited/Setup summary lines. */\nexport function analyzeGroupedSegment(\n groups: readonly MessagePartGroup[],\n fileStats?: PhaseFileStats\n): GroupedSegmentActivity {\n const readPaths = new Set<string>();\n const state = {\n searchCount: 0,\n commandCount: 0,\n screenshotCount: 0,\n imageCount: 0,\n subagentCount: 0,\n hasEdits: false,\n hasSetup: false,\n hasInstall: false,\n hasRestart: false,\n hasBuild: false,\n hasExplore: false,\n hasCommands: false,\n };\n\n for (const group of groups) {\n if (group.kind !== 'single') {\n continue;\n }\n\n const { part } = group;\n\n if (!isToolUIPart(part)) {\n continue;\n }\n\n const name = getToolName(part);\n\n if (name === 'CallDynamicTool') {\n const { namespace, toolName } = parseCallDynamicToolInput(part.input);\n\n if (isGroupedSegmentImageTool(toolName)) {\n const images = imageCountFromPart(part);\n\n if (images > 0) {\n state.hasExplore = true;\n state.imageCount += images;\n }\n\n continue;\n }\n\n applyMcpGroupedSegmentRole(namespace, toolName, state);\n\n continue;\n }\n\n const prefixedMcp = parsePrefixedMcpToolName(name);\n\n if (prefixedMcp) {\n applyMcpGroupedSegmentRole(prefixedMcp.namespace, prefixedMcp.tool, state);\n\n continue;\n }\n\n if (GROUPED_SEGMENT_EDIT_TOOLS.has(name)) {\n state.hasEdits = true;\n }\n else if (isGroupedSegmentFilePathTool(name)) {\n state.hasExplore = true;\n\n const paths = name === 'ListDirectory'\n ? listDirectoryPathsFromPart(part)\n : readPathsFromPart(part as ReadToolUIPart);\n\n addToSet(readPaths, paths);\n }\n else if (name === 'Agent') {\n state.hasExplore = true;\n state.subagentCount++;\n }\n else if (isGroupedSegmentCommandTool(name)) {\n state.hasCommands = true;\n state.commandCount++;\n }\n else if (isGroupedSegmentSearchTool(name)) {\n state.hasExplore = true;\n state.searchCount++;\n }\n else if (isScreenshotTool(name)) {\n state.hasExplore = true;\n state.screenshotCount++;\n }\n else if (isGroupedSegmentImageTool(name)) {\n const images = imageCountFromPart(part);\n\n if (images > 0) {\n state.hasExplore = true;\n state.imageCount += images;\n }\n }\n else if (isGroupedSegmentLintTool(name)) {\n state.hasSetup = true;\n }\n else if (isGroupedSegmentInstallTool(name)) {\n state.hasSetup = true;\n state.hasInstall = true;\n }\n else if (isGroupedSegmentRestartTool(name)) {\n state.hasSetup = true;\n state.hasRestart = true;\n }\n else if (isGroupedSegmentBuildTool(name)) {\n state.hasSetup = true;\n state.hasBuild = true;\n }\n }\n\n const editCount = fileStats?.editCount ?? 0;\n\n if (editCount > 0) {\n state.hasEdits = true;\n }\n\n const kind = groupedSegmentKind(state.hasEdits, state.hasSetup, state.hasExplore, state.hasCommands);\n\n const activity: GroupedSegmentActivity = {\n kind,\n summary: formatGroupedSegmentSummary(kind, {\n readCount: readPaths.size,\n searchCount: state.searchCount,\n commandCount: state.commandCount,\n screenshotCount: state.screenshotCount,\n imageCount: state.imageCount,\n editCount,\n subagentCount: state.subagentCount,\n hasInstall: state.hasInstall,\n hasRestart: state.hasRestart,\n hasBuild: state.hasBuild,\n }),\n };\n\n return activity;\n}\n"],"names":["groupedSegmentKind","hasEdits","hasSetup","hasExplore","hasCommands","addToSet","set","paths","path","listDirectoryPathsFromPart","part","imageCountFromPart","output","formatGroupedSegmentSummary","kind","counts","parts","plural","applyMcpGroupedSegmentRole","server","tool","state","mcpGroupedSegmentRole","analyzeGroupedSegment","groups","fileStats","readPaths","group","isToolUIPart","name","getToolName","namespace","toolName","parseCallDynamicToolInput","isGroupedSegmentImageTool","images","prefixedMcp","parsePrefixedMcpToolName","GROUPED_SEGMENT_EDIT_TOOLS","isGroupedSegmentFilePathTool","readPathsFromPart","isGroupedSegmentCommandTool","isGroupedSegmentSearchTool","isScreenshotTool","isGroupedSegmentLintTool","isGroupedSegmentInstallTool","isGroupedSegmentRestartTool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SAfiB;AAAA,IACf,MAAAP;AAAA,IACA,SAASD,EAA4BC,GAAM;AAAA,MACzC,WAAWY,EAAU;AAAA,MACrB,aAAaL,EAAM;AAAA,MACnB,cAAcA,EAAM;AAAA,MACpB,iBAAiBA,EAAM;AAAA,MACvB,YAAYA,EAAM;AAAA,MAClB,WAAA2B;AAAA,MACA,eAAe3B,EAAM;AAAA,MACrB,YAAYA,EAAM;AAAA,MAClB,YAAYA,EAAM;AAAA,MAClB,UAAUA,EAAM;AAAA,IAAA,CACjB;AAAA,EAAA;AAGL;"}
|
|
1
|
+
{"version":3,"file":"analyzeGroupedSegment.js","sources":["../../../../src/chat/Message/segments/analyzeGroupedSegment.ts"],"sourcesContent":["import { plural } from '@reforma/lib';\nimport { getToolName, isToolUIPart } from '@reforma/types';\nimport { isScreenshotTool } from '@reforma/types/sandbox';\n\nimport { parseCallDynamicToolInput, parsePrefixedMcpToolName } from '../../Tool/mcp-tools/parseCallDynamicToolInput';\nimport { readPathsFromPart } from '../../Tool/read/normalizeReadTools';\nimport { mcpGroupedSegmentRole } from './groupedSegmentMcpTools';\nimport {\n GROUPED_SEGMENT_EDIT_TOOLS,\n isGroupedSegmentBuildTool,\n isGroupedSegmentCommandTool,\n isGroupedSegmentFilePathTool,\n isGroupedSegmentImageTool,\n isGroupedSegmentInstallTool,\n isGroupedSegmentLintTool,\n isGroupedSegmentRestartTool,\n isGroupedSegmentSearchTool,\n} from './groupedSegmentTools';\n\nimport type { ReadToolUIPart } from '../../Tool/read/normalizeReadTools';\nimport type { MessagePartGroup } from '../normalize/normalizeMessageParts';\n\nexport type GroupedSegmentKind = 'edit' | 'setup' | 'explore' | 'run' | 'other';\n\nexport type LineCounts = {\n added: number;\n removed: number;\n};\n\nexport type PhaseFileStats = {\n editCount: number;\n lineCounts?: LineCounts;\n};\n\nexport type GroupedSegmentActivity = {\n kind: GroupedSegmentKind;\n summary: string;\n label?: string;\n streamLabel?: string;\n};\n\nfunction groupedSegmentKind(\n hasEdits: boolean,\n hasSetup: boolean,\n hasExplore: boolean,\n hasCommands: boolean\n): GroupedSegmentKind {\n if (hasEdits) {\n return 'edit';\n }\n\n if (hasExplore) {\n return 'explore';\n }\n\n if (hasCommands) {\n return 'run';\n }\n\n if (hasSetup) {\n return 'setup';\n }\n\n return 'other';\n}\n\nfunction addToSet(set: Set<string>, paths: readonly string[]) {\n for (const path of paths) {\n if (path) {\n set.add(path);\n }\n }\n}\n\n/** Directory listed by ListDirectory (`path` input; root when omitted). */\nfunction listDirectoryPathsFromPart(part: { input?: unknown }): string[] {\n if (part.input == null || typeof part.input !== 'object') {\n return ['.'];\n }\n\n const path = (part.input as { path?: unknown }).path;\n\n if (typeof path !== 'string' || !path.trim()) {\n return ['.'];\n }\n\n return [path.trim()];\n}\n\n/** Images in successful ImageGen / SearchImage `images[]` output. */\nfunction imageCountFromPart(part: { state: string; output?: unknown }): number {\n if (part.state === 'output-available') {\n const output = part.output;\n\n if (typeof output === 'object' && output != null && 'images' in output && Array.isArray(output.images)) {\n return output.images.length;\n }\n }\n\n return 0;\n}\n\nfunction formatGroupedSegmentSummary(\n kind: GroupedSegmentKind,\n counts: {\n readCount: number;\n searchCount: number;\n commandCount: number;\n screenshotCount: number;\n imageCount: number;\n editCount: number;\n subagentCount: number;\n hasInstall: boolean;\n hasRestart: boolean;\n hasBuild: boolean;\n }\n): string {\n const parts: string[] = [];\n\n if (kind === 'edit') {\n if (counts.editCount) {\n parts.push(plural(counts.editCount, 'file', 'files'));\n }\n\n if (counts.readCount) {\n parts.push(plural(counts.readCount, 'explored', 'explored'));\n }\n }\n else if (kind === 'explore' || kind === 'setup' || kind === 'run') {\n if (counts.readCount) {\n parts.push(plural(counts.readCount, 'file', 'files'));\n }\n }\n\n if (counts.subagentCount) {\n parts.push(plural(counts.subagentCount, 'subagent', 'subagents'));\n }\n\n if (counts.screenshotCount) {\n parts.push(plural(counts.screenshotCount, 'screenshot', 'screenshots'));\n }\n\n if (counts.imageCount) {\n parts.push(plural(counts.imageCount, 'image', 'images'));\n }\n\n if (counts.searchCount) {\n parts.push(plural(counts.searchCount, 'search', 'searches'));\n }\n\n if (counts.commandCount) {\n parts.push(plural(counts.commandCount, 'command', 'commands'));\n }\n\n if (counts.hasInstall) {\n parts.push('installed deps');\n }\n\n if (counts.hasRestart) {\n parts.push('restarted server');\n }\n\n if (counts.hasBuild) {\n parts.push('built project');\n }\n\n return parts.join(', ');\n}\n\nfunction applyMcpGroupedSegmentRole(\n server: string | undefined,\n tool: string,\n state: {\n hasExplore: boolean;\n hasSetup: boolean;\n searchCount: number;\n }\n): void {\n const role = mcpGroupedSegmentRole(server, tool);\n\n if (role === 'lint') {\n state.hasSetup = true;\n\n return;\n }\n\n state.hasExplore = true;\n state.searchCount++;\n}\n\n/** Rolls up grouped workspace tools into Explored/Edited/Setup summary lines. */\nexport function analyzeGroupedSegment(\n groups: readonly MessagePartGroup[],\n fileStats?: PhaseFileStats\n): GroupedSegmentActivity {\n const readPaths = new Set<string>();\n const state = {\n searchCount: 0,\n commandCount: 0,\n screenshotCount: 0,\n imageCount: 0,\n subagentCount: 0,\n hasEdits: false,\n hasSetup: false,\n hasInstall: false,\n hasRestart: false,\n hasBuild: false,\n hasExplore: false,\n hasCommands: false,\n };\n\n for (const group of groups) {\n if (group.kind !== 'single') {\n continue;\n }\n\n const { part } = group;\n\n if (!isToolUIPart(part)) {\n continue;\n }\n\n const name = getToolName(part);\n\n if (name === 'CallDynamicTool') {\n const { namespace, toolName } = parseCallDynamicToolInput(part.input);\n\n if (isGroupedSegmentImageTool(toolName)) {\n const images = imageCountFromPart(part);\n\n if (images > 0) {\n state.hasExplore = true;\n state.imageCount += images;\n }\n\n continue;\n }\n\n applyMcpGroupedSegmentRole(namespace, toolName, state);\n\n continue;\n }\n\n const prefixedMcp = parsePrefixedMcpToolName(name);\n\n if (prefixedMcp) {\n applyMcpGroupedSegmentRole(prefixedMcp.namespace, prefixedMcp.tool, state);\n\n continue;\n }\n\n if (GROUPED_SEGMENT_EDIT_TOOLS.has(name)) {\n state.hasEdits = true;\n }\n else if (isGroupedSegmentFilePathTool(name)) {\n state.hasExplore = true;\n\n const paths = name === 'ListDirectory'\n ? listDirectoryPathsFromPart(part)\n : readPathsFromPart(part as ReadToolUIPart);\n\n addToSet(readPaths, paths);\n }\n else if (name === 'Agent') {\n state.hasExplore = true;\n state.subagentCount++;\n }\n else if (isGroupedSegmentCommandTool(name)) {\n state.hasCommands = true;\n state.commandCount++;\n }\n else if (isGroupedSegmentSearchTool(name)) {\n state.hasExplore = true;\n state.searchCount++;\n }\n else if (isScreenshotTool(name)) {\n state.hasExplore = true;\n state.screenshotCount++;\n }\n else if (isGroupedSegmentImageTool(name)) {\n const images = imageCountFromPart(part);\n\n if (images > 0) {\n state.hasExplore = true;\n state.imageCount += images;\n }\n }\n else if (isGroupedSegmentLintTool(name)) {\n state.hasSetup = true;\n }\n else if (isGroupedSegmentInstallTool(name)) {\n state.hasSetup = true;\n state.hasInstall = true;\n }\n else if (isGroupedSegmentRestartTool(name)) {\n state.hasSetup = true;\n state.hasRestart = true;\n }\n else if (isGroupedSegmentBuildTool(name)) {\n state.hasSetup = true;\n state.hasBuild = true;\n }\n }\n\n const editCount = fileStats?.editCount ?? 0;\n\n if (editCount > 0) {\n state.hasEdits = true;\n }\n\n const kind = groupedSegmentKind(state.hasEdits, state.hasSetup, state.hasExplore, state.hasCommands);\n\n const activity: GroupedSegmentActivity = {\n kind,\n summary: formatGroupedSegmentSummary(kind, {\n readCount: readPaths.size,\n searchCount: state.searchCount,\n commandCount: state.commandCount,\n screenshotCount: state.screenshotCount,\n imageCount: state.imageCount,\n editCount,\n subagentCount: state.subagentCount,\n hasInstall: state.hasInstall,\n hasRestart: state.hasRestart,\n hasBuild: state.hasBuild,\n }),\n };\n\n return activity;\n}\n"],"names":["groupedSegmentKind","hasEdits","hasSetup","hasExplore","hasCommands","addToSet","set","paths","path","listDirectoryPathsFromPart","part","imageCountFromPart","output","formatGroupedSegmentSummary","kind","counts","parts","plural","applyMcpGroupedSegmentRole","server","tool","state","mcpGroupedSegmentRole","analyzeGroupedSegment","groups","fileStats","readPaths","group","isToolUIPart","name","getToolName","namespace","toolName","parseCallDynamicToolInput","isGroupedSegmentImageTool","images","prefixedMcp","parsePrefixedMcpToolName","GROUPED_SEGMENT_EDIT_TOOLS","isGroupedSegmentFilePathTool","readPathsFromPart","isGroupedSegmentCommandTool","isGroupedSegmentSearchTool","isScreenshotTool","isGroupedSegmentLintTool","isGroupedSegmentInstallTool","isGroupedSegmentRestartTool","isGroupedSegmentBuildTool","editCount"],"mappings":";;;;;;;AAOA,SAASA,EAAmBC,GAAUC,GAAUC,GAAYC,GAAa;AACvE,SAAIH,IACK,SAELE,IACK,YAELC,IACK,QAELF,IACK,UAEF;AACT;AACA,SAASG,EAASC,GAAKC,GAAO;AAC5B,aAAWC,KAAQD;AACjB,IAAIC,KACFF,EAAI,IAAIE,CAAI;AAGlB;AAGA,SAASC,EAA2BC,GAAM;AACxC,MAAIA,EAAK,SAAS,QAAQ,OAAOA,EAAK,SAAU;AAC9C,WAAO,CAAC,GAAG;AAEb,QAAMF,IAAOE,EAAK,MAAM;AACxB,SAAI,OAAOF,KAAS,YAAY,CAACA,EAAK,SAC7B,CAAC,GAAG,IAEN,CAACA,EAAK,MAAM;AACrB;AAGA,SAASG,EAAmBD,GAAM;AAChC,MAAIA,EAAK,UAAU,oBAAoB;AACrC,UAAME,IAASF,EAAK;AACpB,QAAI,OAAOE,KAAW,YAAYA,KAAU,QAAQ,YAAYA,KAAU,MAAM,QAAQA,EAAO,MAAM;AACnG,aAAOA,EAAO,OAAO;AAAA,EAEzB;AACA,SAAO;AACT;AACA,SAASC,EAA4BC,GAAMC,GAAQ;AACjD,QAAMC,IAAQ,CAAA;AACd,SAAIF,MAAS,UACPC,EAAO,aACTC,EAAM,KAAKC,EAAOF,EAAO,WAAW,QAAQ,OAAO,CAAC,GAElDA,EAAO,aACTC,EAAM,KAAKC,EAAOF,EAAO,WAAW,YAAY,UAA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AAW,IACjBA,EAAM,aAAa,MACVyB,EAA4BjB,CAAI,KACzCR,EAAM,WAAW,IACjBA,EAAM,aAAa,MACV0B,EAA0BlB,CAAI,MACvCR,EAAM,WAAW,IACjBA,EAAM,WAAW;AAAA,EAErB;AACA,QAAM2B,IAAYvB,GAAW,aAAa;AAC1C,EAAIuB,IAAY,MACd3B,EAAM,WAAW;AAEnB,QAAMP,IAAOd,EAAmBqB,EAAM,UAAUA,EAAM,UAAUA,EAAM,YAAYA,EAAM,WAAW;AAgBnG,SAfiB;AAAA,IACf,MAAAP;AAAA,IACA,SAASD,EAA4BC,GAAM;AAAA,MACzC,WAAWY,EAAU;AAAA,MACrB,aAAaL,EAAM;AAAA,MACnB,cAAcA,EAAM;AAAA,MACpB,iBAAiBA,EAAM;AAAA,MACvB,YAAYA,EAAM;AAAA,MAClB,WAAA2B;AAAA,MACA,eAAe3B,EAAM;AAAA,MACrB,YAAYA,EAAM;AAAA,MAClB,YAAYA,EAAM;AAAA,MAClB,UAAUA,EAAM;AAAA,IAAA,CACjB;AAAA,EAAA;AAGL;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recentStreamingPhaseToolGroups.js","sources":["../../../../src/chat/Message/segments/recentStreamingPhaseToolGroups.ts"],"sourcesContent":["import { isToolUIPart } from '
|
|
1
|
+
{"version":3,"file":"recentStreamingPhaseToolGroups.js","sources":["../../../../src/chat/Message/segments/recentStreamingPhaseToolGroups.ts"],"sourcesContent":["import { isToolUIPart } from '@reforma/types';\n\nimport { isToolInvocationInProgress } from '../../Tool/helpers';\n\nimport type { MessagePartGroup } from '../normalize/normalizeMessageParts';\n\nfunction isWorkspaceToolGroup(group: MessagePartGroup): boolean {\n return group.kind === 'single' && isToolUIPart(group.part);\n}\n\n/** Visible streaming row: tool, commentary text, or reasoning. */\nfunction isStreamingPhaseRow(group: MessagePartGroup): boolean {\n return group.kind === 'reasoning' || group.kind === 'single';\n}\n\n/** Outside suffix start (`groups.length` = none). In-progress peels last 2 rows; else last tool. */\nfunction streamingOutsidePhaseStart(groups: readonly MessagePartGroup[]): number {\n let lastTool = -1;\n let lastRow = -1;\n let prevRow = -1;\n\n for (let i = 0; i < groups.length; i++) {\n if (isWorkspaceToolGroup(groups[i])) {\n lastTool = i;\n }\n\n if (isStreamingPhaseRow(groups[i])) {\n prevRow = lastRow;\n lastRow = i;\n }\n }\n\n if (lastTool < 0) {\n return groups.length;\n }\n\n const tail = groups[lastTool];\n const inProgress = tail.kind === 'single'\n && isToolUIPart(tail.part)\n && isToolInvocationInProgress(tail.part.state);\n\n if (inProgress) {\n return prevRow < 0 ? lastRow : prevRow;\n }\n\n return lastTool;\n}\n\n/** Panel prefix + outside suffix; outside stays put when the phase expands. */\nexport function splitStreamingPhaseGroups(\n groups: readonly MessagePartGroup[],\n streamActive: boolean\n) {\n const outsideStart = streamActive ? streamingOutsidePhaseStart(groups) : groups.length;\n\n return {\n panelGroups: groups.slice(0, outsideStart),\n outsideGroups: groups.slice(outsideStart),\n outsideStart,\n };\n}\n\n/** React key that stays put when groups insert/reorder ahead of a tool. */\nexport function phaseGroupKey(group: MessagePartGroup, index: number): string {\n if (group.kind === 'single' && isToolUIPart(group.part)) {\n return group.part.toolCallId;\n }\n\n return `${ group.kind }-${ index }`;\n}\n"],"names":["isWorkspaceToolGroup","group","isToolUIPart","isStreamingPhaseRow","streamingOutsidePhaseStart","groups","lastTool","lastRow","prevRow","tail","isToolInvocationInProgress","splitStreamingPhaseGroups","streamActive","outsideStart","phaseGroupKey","index"],"mappings":";;AAEA,SAASA,EAAqBC,GAAO;AACnC,SAAOA,EAAM,SAAS,YAAYC,EAAaD,EAAM,IAAI;AAC3D;AAGA,SAASE,EAAoBF,GAAO;AAClC,SAAOA,EAAM,SAAS,eAAeA,EAAM,SAAS;AACtD;AAGA,SAASG,EAA2BC,GAAQ;AAC1C,MAAIC,IAAW,IACXC,IAAU,IACVC,IAAU;AACd,WAAS,IAAI,GAAG,IAAIH,EAAO,QAAQ;AACjC,IAAIL,EAAqBK,EAAO,CAAC,CAAC,MAChCC,IAAW,IAETH,EAAoBE,EAAO,CAAC,CAAC,MAC/BG,IAAUD,GACVA,IAAU;AAGd,MAAID,IAAW;AACb,WAAOD,EAAO;AAEhB,QAAMI,IAAOJ,EAAOC,CAAQ;AAE5B,SADmBG,EAAK,SAAS,YAAYP,EAAaO,EAAK,IAAI,KAAKC,EAA2BD,EAAK,KAAK,KAAK,IAEzGD,IAAU,IAAID,IAAUC,IAE1BF;AACT;AAGO,SAASK,EAA0BN,GAAQO,GAAc;AAC9D,QAAMC,IAAeD,IAAeR,EAA2BC,CAAM,IAAIA,EAAO;AAChF,SAAO;AAAA,IACL,aAAaA,EAAO,MAAM,GAAGQ,CAAY;AAAA,IACzC,eAAeR,EAAO,MAAMQ,CAAY;AAAA,IACxC,cAAAA;AAAA,EAAA;AAEJ;AAGO,SAASC,EAAcb,GAAOc,GAAO;AAC1C,SAAId,EAAM,SAAS,YAAYC,EAAaD,EAAM,IAAI,IAC7CA,EAAM,KAAK,aAEb,GAAGA,EAAM,IAAI,IAAIc,CAAK;AAC/B;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isTextUIPart as l } from "
|
|
1
|
+
import { isTextUIPart as l } from "@reforma/types";
|
|
2
2
|
import { segmentRequiresUserAction as s, lastVisiblePartFromGroups as f } from "../normalize/normalizeMessageParts.js";
|
|
3
3
|
function a(r, e) {
|
|
4
4
|
if (e.streaming || e.cancelled || r.length < 2 || r.some((i) => s(i.groups)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workedCollapse.js","sources":["../../../../src/chat/Message/turn/workedCollapse.ts"],"sourcesContent":["import { isTextUIPart } from '
|
|
1
|
+
{"version":3,"file":"workedCollapse.js","sources":["../../../../src/chat/Message/turn/workedCollapse.ts"],"sourcesContent":["import { isTextUIPart } from '@reforma/types';\n\nimport {\n lastVisiblePartFromGroups,\n segmentRequiresUserAction,\n} from '../normalize/normalizeMessageParts';\n\nimport type { MessageSegment } from '../normalize/normalizeMessageParts';\n\nexport type FinishedWorkSplit = {\n work: readonly MessageSegment[];\n answer: MessageSegment;\n};\n\n/**\n * Finished turn whose last visible part is text: tuck every segment before that\n * answer under one disclosure. Streaming, cancelled, and \"still waiting\" turns stay open.\n */\nexport function splitFinishedWork(\n segments: readonly MessageSegment[],\n flags: { streaming: boolean; cancelled: boolean }\n): FinishedWorkSplit | null {\n if (flags.streaming || flags.cancelled || segments.length < 2) {\n return null;\n }\n\n if (segments.some(segment => segmentRequiresUserAction(segment.groups))) {\n return null;\n }\n\n const answer = segments[segments.length - 1];\n\n if (!answer || answer.layout !== 'ungrouped') {\n return null;\n }\n\n const tail = lastVisiblePartFromGroups(answer.groups);\n\n if (!tail || !isTextUIPart(tail) || tail.state === 'streaming' || !tail.text.trim()) {\n return null;\n }\n\n return {\n work: segments.slice(0, -1),\n answer,\n };\n}\n\n/** \"Worked for 25s\" / \"Worked for 2m\". \"Worked\" when the turn has no timestamps. */\nexport function workedForLabel(startedAt: number | undefined, endedAt: number | undefined): string {\n if (\n startedAt == null\n || endedAt == null\n || !Number.isFinite(startedAt)\n || !Number.isFinite(endedAt)\n || endedAt < startedAt\n ) {\n return 'Worked';\n }\n\n const seconds = Math.max(1, Math.round((endedAt - startedAt) / 1000));\n\n if (seconds < 60) {\n return `Worked for ${ seconds }s`;\n }\n\n const minutes = Math.floor(seconds / 60);\n const remSeconds = seconds % 60;\n\n if (minutes < 60) {\n return remSeconds === 0\n ? `Worked for ${ minutes }m`\n : `Worked for ${ minutes }m ${ remSeconds }s`;\n }\n\n const hours = Math.floor(minutes / 60);\n const remMinutes = minutes % 60;\n\n return remMinutes === 0\n ? `Worked for ${ hours }h`\n : `Worked for ${ hours }h ${ remMinutes }m`;\n}\n"],"names":["splitFinishedWork","segments","flags","segment","segmentRequiresUserAction","answer","tail","lastVisiblePartFromGroups","isTextUIPart","workedForLabel","startedAt","endedAt","seconds","minutes","remSeconds","hours","remMinutes"],"mappings":";;AAMO,SAASA,EAAkBC,GAAUC,GAAO;AAIjD,MAHIA,EAAM,aAAaA,EAAM,aAAaD,EAAS,SAAS,KAGxDA,EAAS,KAAK,CAAAE,MAAWC,EAA0BD,EAAQ,MAAM,CAAC;AACpE,WAAO;AAET,QAAME,IAASJ,EAASA,EAAS,SAAS,CAAC;AAC3C,MAAI,CAACI,KAAUA,EAAO,WAAW;AAC/B,WAAO;AAET,QAAMC,IAAOC,EAA0BF,EAAO,MAAM;AACpD,SAAI,CAACC,KAAQ,CAACE,EAAaF,CAAI,KAAKA,EAAK,UAAU,eAAe,CAACA,EAAK,KAAK,SACpE,OAEF;AAAA,IACL,MAAML,EAAS,MAAM,GAAG,EAAE;AAAA,IAC1B,QAAAI;AAAA,EAAA;AAEJ;AAGO,SAASI,EAAeC,GAAWC,GAAS;AACjD,MAAID,KAAa,QAAQC,KAAW,QAAQ,CAAC,OAAO,SAASD,CAAS,KAAK,CAAC,OAAO,SAASC,CAAO,KAAKA,IAAUD;AAChH,WAAO;AAET,QAAME,IAAU,KAAK,IAAI,GAAG,KAAK,OAAOD,IAAUD,KAAa,GAAI,CAAC;AACpE,MAAIE,IAAU;AACZ,WAAO,cAAcA,CAAO;AAE9B,QAAMC,IAAU,KAAK,MAAMD,IAAU,EAAE,GACjCE,IAAaF,IAAU;AAC7B,MAAIC,IAAU;AACZ,WAAOC,MAAe,IAAI,cAAcD,CAAO,MAAM,cAAcA,CAAO,KAAKC,CAAU;AAE3F,QAAMC,IAAQ,KAAK,MAAMF,IAAU,EAAE,GAC/BG,IAAaH,IAAU;AAC7B,SAAOG,MAAe,IAAI,cAAcD,CAAK,MAAM,cAAcA,CAAK,KAAKC,CAAU;AACvF;"}
|
package/dist/chat/Tool/Tool.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isToolUIPart as g, getToolName as s } from "
|
|
1
|
+
import { isToolUIPart as g, getToolName as s } from "@reforma/types";
|
|
2
2
|
import { useChatHandlers as h } from "../ChatContext.js";
|
|
3
3
|
import { AgentTool as S } from "./agent/AgentTool.js";
|
|
4
4
|
import { AskUserQuestionTool as P } from "./ask-user-question/AskUserQuestionTool.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sources":["../../../src/chat/Tool/Tool.tsx"],"sourcesContent":["import { getToolName, isToolUIPart } from '
|
|
1
|
+
{"version":3,"file":"Tool.js","sources":["../../../src/chat/Tool/Tool.tsx"],"sourcesContent":["import { getToolName, isToolUIPart } from '@reforma/types';\n\nimport { useChatHandlers } from '../ChatContext';\nimport { AgentTool } from './agent';\nimport { AskUserQuestionTool } from './ask-user-question';\nimport { BashTool } from './bash';\nimport { CheckPageTool } from './check-page';\nimport { ChooseDesignDirectionTool } from './choose-design-direction';\nimport { CreateDirectoryTool } from './create-directory';\nimport { DefaultTool } from './default/Default';\nimport { DevServerRestartTool, DevServerStatusTool } from './dev-server';\nimport { EditTool } from './edit';\nimport { FetchTool } from './fetch';\nimport { GetBackgroundResultTool } from './get-background-result';\nimport { GET_ERRORS_TOOL_NAME, GetErrorsTool, isGetErrorsToolName } from './get-errors';\nimport { GlobTool } from './glob';\nimport { GrepTool } from './grep';\nimport { ImageAssetTool } from './image-asset';\nimport { InstallDepsTool } from './install-dependencies';\nimport { InstallPlugin } from './install-plugin/InstallPlugin';\nimport { ListDirectoryTool } from './list-directory';\nimport { CallDynamicTool, GetDynamicToolsTool, GetMcpResourcesTool, McpAuth, parseCallDynamicToolInput, parsePrefixedMcpToolName } from './mcp-tools';\nimport { MemoryTool } from './memory';\nimport { MoveFileTool } from './move-file';\nimport { CreatePlanTool } from './plan/CreatePlanTool';\nimport { PreambleTool } from './preamble';\nimport { BuildTool } from './project-build';\nimport { ProjectEnvTool } from './project-env';\nimport { ReadFilesTool } from './read';\nimport { ReadLintsTool } from './read-lints';\nimport { RemoveFileTool } from './remove-file';\nimport { ScaffoldProjectTool } from './scaffold-project/ScaffoldProjectTool';\nimport { CaptureScreenshotTool } from './screenshot';\nimport { SkillTool } from './skill';\nimport { WaitingTool } from './waiting/WaitingTool';\nimport { WebSearchTool } from './web-search';\n\nimport type { ToolRendererProps } from './types';\n\ntype ToolRenderer = (props: ToolRendererProps) => ReturnType<typeof DefaultTool>;\n\nconst TOOL_RENDERERS: Record<string, ToolRenderer> = {\n default: DefaultTool,\n Agent: AgentTool,\n CreatePlan: CreatePlanTool,\n EditPlan: EditTool,\n ReadPlan: CreatePlanTool,\n WebSearch: WebSearchTool,\n // Vendor stream / legacy names (canonical local name is `WebSearch`).\n web_search: WebSearchTool,\n google_search: WebSearchTool,\n PageScreenshot: CaptureScreenshotTool,\n CheckPage: CheckPageTool,\n ImageGen: ImageAssetTool,\n SearchImage: ImageAssetTool,\n ImportAsset: ImageAssetTool,\n Fetch: FetchTool,\n Read: ReadFilesTool,\n ReadLints: ReadLintsTool,\n RemoveFile: RemoveFileTool,\n DevServerRestart: DevServerRestartTool,\n DevServerStatus: DevServerStatusTool,\n ScaffoldProject: ScaffoldProjectTool,\n CreateDirectory: CreateDirectoryTool,\n MoveFile: MoveFileTool,\n Preamble: PreambleTool,\n ProjectEnv: ProjectEnvTool,\n GetDynamicTools: GetDynamicToolsTool,\n GetMcpResources: GetMcpResourcesTool,\n CallDynamicTool,\n McpAuth,\n InstallPlugin,\n Glob: GlobTool,\n Grep: GrepTool,\n InstallDeps: InstallDepsTool,\n Skill: SkillTool,\n Remember: MemoryTool,\n Forget: MemoryTool,\n Waiting: WaitingTool,\n ListDirectory: ListDirectoryTool,\n Write: EditTool,\n Edit: EditTool,\n Bash: BashTool,\n Build: BuildTool,\n GetBackgroundResult: GetBackgroundResultTool,\n AskUserQuestion: AskUserQuestionTool,\n ChooseDesignDirection: ChooseDesignDirectionTool,\n [GET_ERRORS_TOOL_NAME]: GetErrorsTool,\n};\n\n/**\n * Deferred builtins arrive as `CallDynamicTool`. Use that tool's own card when one exists.\n * @internal\n */\nexport function renderedToolName(part: ToolRendererProps['part']): string {\n const name = getToolName(part);\n\n if (name !== 'CallDynamicTool') {\n return name;\n }\n\n const { toolName } = parseCallDynamicToolInput(part.input);\n const renderer = TOOL_RENDERERS[toolName];\n\n if (!renderer || renderer === CallDynamicTool) {\n return name;\n }\n\n return toolName;\n}\n\nfunction partForRenderer(part: ToolRendererProps['part']): ToolRendererProps['part'] {\n const name = renderedToolName(part);\n\n if (name === getToolName(part)) {\n return part;\n }\n\n return {\n ...part,\n type: `tool-${ name }`,\n input: parseCallDynamicToolInput(part.input).mcpInput,\n } as ToolRendererProps['part'];\n}\n\n/** Renders one AI SDK tool UI part: routes to a compact tool UI or the default collapsible shell. */\nexport function Tool({\n part,\n onToolApprovalResponse,\n onToolOutput,\n onOpenPath,\n}: ToolRendererProps) {\n const handlers = useChatHandlers({ onToolApprovalResponse, onToolOutput, onOpenPath });\n\n if (!isToolUIPart(part)) {\n return null;\n }\n\n const presented = partForRenderer(part);\n const name = getToolName(presented);\n const ToolRenderer = isGetErrorsToolName(name)\n ? GetErrorsTool\n : TOOL_RENDERERS[name]\n ?? (parsePrefixedMcpToolName(name) ? CallDynamicTool : TOOL_RENDERERS.default);\n\n return (\n <ToolRenderer\n part={ presented }\n { ...handlers }\n />\n );\n}\n"],"names":["TOOL_RENDERERS","DefaultTool","AgentTool","CreatePlanTool","EditTool","WebSearchTool","CaptureScreenshotTool","CheckPageTool","ImageAssetTool","FetchTool","ReadFilesTool","ReadLintsTool","RemoveFileTool","DevServerRestartTool","DevServerStatusTool","ScaffoldProjectTool","CreateDirectoryTool","MoveFileTool","PreambleTool","ProjectEnvTool","GetDynamicToolsTool","GetMcpResourcesTool","CallDynamicTool","McpAuth","InstallPlugin","GlobTool","GrepTool","InstallDepsTool","SkillTool","MemoryTool","WaitingTool","ListDirectoryTool","BashTool","BuildTool","GetBackgroundResultTool","AskUserQuestionTool","ChooseDesignDirectionTool","GET_ERRORS_TOOL_NAME","GetErrorsTool","renderedToolName","part","name","getToolName","toolName","parseCallDynamicToolInput","renderer","partForRenderer","Tool","onToolApprovalResponse","onToolOutput","onOpenPath","handlers","useChatHandlers","isToolUIPart","presented","ToolRenderer","isGetErrorsToolName","parsePrefixedMcpToolName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,IAAiB;AAAA,EACrB,SAASC;AAAA,EACT,OAAOC;AAAA,EACP,YAAYC;AAAA,EACZ,UAAUC;AAAA,EACV,UAAUD;AAAA,EACV,WAAWE;AAAA;AAAA,EAEX,YAAYA;AAAA,EACZ,eAAeA;AAAA,EACf,gBAAgBC;AAAA,EAChB,WAAWC;AAAA,EACX,UAAUC;AAAA,EACV,aAAaA;AAAA,EACb,aAAaA;AAAA,EACb,OAAOC;AAAA,EACP,MAAMC;AAAA,EACN,WAAWC;AAAA,EACX,YAAYC;AAAA,EACZ,kBAAkBC;AAAA,EAClB,iBAAiBC;AAAA,EACjB,iBAAiBC;AAAA,EACjB,iBAAiBC;AAAA,EACjB,UAAUC;AAAA,EACV,UAAUC;AAAA,EACV,YAAYC;AAAA,EACZ,iBAAiBC;AAAA,EACjB,iBAAiBC;AAAA,EACjB,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAMC;AAAA,EACN,MAAMC;AAAA,EACN,aAAaC;AAAA,EACb,OAAOC;AAAA,EACP,UAAUC;AAAA,EACV,QAAQA;AAAA,EACR,SAASC;AAAA,EACT,eAAeC;AAAA,EACf,OAAO3B;AAAA,EACP,MAAMA;AAAA,EACN,MAAM4B;AAAA,EACN,OAAOC;AAAA,EACP,qBAAqBC;AAAA,EACrB,iBAAiBC;AAAA,EACjB,uBAAuBC;AAAA,EACvB,CAACC,CAAoB,GAAGC;AAC1B;AAMO,SAASC,GAAiBC,GAAM;AACrC,QAAMC,IAAOC,EAAYF,CAAI;AAC7B,MAAIC,MAAS;AACX,WAAOA;AAET,QAAM;AAAA,IACJ,UAAAE;AAAA,EAAA,IACEC,EAA0BJ,EAAK,KAAK,GAClCK,IA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AgB,eAAe,CAAC,KAAK,EAAE;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,GAAG,SAAS,CAcrB;AAiFD,mDAAmD;AACnD,eAAO,MAAM,SAAS,cAAuB,iBAAiB;8BAAjB,iBAAiB;CA8C5D,CAAC"}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Message as
|
|
2
|
-
import { ProgressLoader as
|
|
3
|
-
import { humanizeString as
|
|
4
|
-
import { isToolUIPart as
|
|
1
|
+
import { Message as I } from "@reforma/icons/14";
|
|
2
|
+
import { ProgressLoader as x } from "@reforma/icons/assets";
|
|
3
|
+
import { humanizeString as w, basename as T, plural as N } from "@reforma/lib";
|
|
4
|
+
import { isToolUIPart as B, getToolName as F } from "@reforma/types";
|
|
5
5
|
import { observer as U } from "mobx-react-lite";
|
|
6
6
|
import { Box as C } from "../../../Box/Box.js";
|
|
7
|
-
import { Pressable as
|
|
8
|
-
import { Shimmer as
|
|
7
|
+
import { Pressable as G } from "react-aria-components";
|
|
8
|
+
import { Shimmer as M } from "../../../Shimmer/Shimmer.js";
|
|
9
9
|
import { Show as g } from "../../../Show/Show.js";
|
|
10
10
|
import { Text as m } from "../../../Text/Text.js";
|
|
11
|
-
import { useChat as
|
|
12
|
-
import { useMessageTurn as
|
|
13
|
-
import { getToolFailureRowState as
|
|
14
|
-
import { ToolShellCard as
|
|
15
|
-
import { useToolProgress as
|
|
16
|
-
import
|
|
11
|
+
import { useChat as O } from "../../ChatContext.js";
|
|
12
|
+
import { useMessageTurn as j } from "../../Message/turn/messageTurnContext.js";
|
|
13
|
+
import { getToolFailureRowState as W, TOOL_INTERRUPTED_MESSAGE as _ } from "../helpers.js";
|
|
14
|
+
import { ToolShellCard as D } from "../shell/ToolShellCard.js";
|
|
15
|
+
import { useToolProgress as V } from "../shell/toolProgress.js";
|
|
16
|
+
import z from "../shell/ToolShellCard.module.css.js";
|
|
17
17
|
import h from "./AgentTool.module.css.js";
|
|
18
18
|
import { jsx as o, jsxs as S } from "react/jsx-runtime";
|
|
19
|
-
const
|
|
19
|
+
const Y = {
|
|
20
20
|
research: "Explore",
|
|
21
21
|
shell: "Shell",
|
|
22
22
|
verify: "Verify",
|
|
23
23
|
plan: "Plan"
|
|
24
|
-
},
|
|
24
|
+
}, q = {
|
|
25
25
|
research: "Exploring",
|
|
26
26
|
shell: "Running",
|
|
27
27
|
verify: "Verifying",
|
|
28
28
|
plan: "Planning"
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function H(e) {
|
|
31
31
|
if (e == null || typeof e != "object")
|
|
32
32
|
return;
|
|
33
33
|
const t = e.error;
|
|
@@ -37,20 +37,20 @@ function R(e) {
|
|
|
37
37
|
for (const t of [e.output, e.input]) {
|
|
38
38
|
if (t == null || typeof t != "object")
|
|
39
39
|
continue;
|
|
40
|
-
const
|
|
41
|
-
if (typeof
|
|
42
|
-
return
|
|
40
|
+
const n = t.name;
|
|
41
|
+
if (typeof n == "string" && n.trim().length > 0)
|
|
42
|
+
return n.trim();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function p(e) {
|
|
46
|
-
const t = e?.trim() || "research",
|
|
47
|
-
return
|
|
46
|
+
const t = e?.trim() || "research", n = Y[t];
|
|
47
|
+
return n || t.charAt(0).toUpperCase() + t.slice(1);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
49
|
+
function J(e, t) {
|
|
50
|
+
const n = e?.trim() || "research", r = p(e);
|
|
51
51
|
return {
|
|
52
|
-
live:
|
|
53
|
-
done: `Ran ${r} agent`
|
|
52
|
+
live: q[n] ?? `Running ${r}`,
|
|
53
|
+
done: t ? `Started ${r} agent in background` : `Ran ${r} agent`
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
function i(e) {
|
|
@@ -59,22 +59,22 @@ function i(e) {
|
|
|
59
59
|
const t = e.trim();
|
|
60
60
|
return t.length > 0 ? t : void 0;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function K(e) {
|
|
63
63
|
const t = i(e.path);
|
|
64
64
|
if (t)
|
|
65
65
|
return T(t);
|
|
66
66
|
if (!Array.isArray(e.paths))
|
|
67
67
|
return;
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return T(
|
|
71
|
-
if (
|
|
72
|
-
return
|
|
68
|
+
const n = e.paths.filter((r) => typeof r == "string" && r.trim().length > 0);
|
|
69
|
+
if (n.length === 1)
|
|
70
|
+
return T(n[0]);
|
|
71
|
+
if (n.length > 1)
|
|
72
|
+
return N(n.length, "file", "files");
|
|
73
73
|
}
|
|
74
74
|
function d(e, t) {
|
|
75
|
-
return (
|
|
75
|
+
return (n) => `${e} ${K(n) ?? t}`;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Q = {
|
|
78
78
|
Read: d("Reading", "file"),
|
|
79
79
|
Write: d("Writing", "file"),
|
|
80
80
|
Edit: d("Editing", "file"),
|
|
@@ -105,16 +105,16 @@ const K = {
|
|
|
105
105
|
EditPlan: () => "Editing plan",
|
|
106
106
|
ReadPlan: () => "Reading plan"
|
|
107
107
|
};
|
|
108
|
-
function
|
|
109
|
-
const
|
|
108
|
+
function Te(e, t) {
|
|
109
|
+
const n = R(e), r = p(n), a = t?.needsUser === !0, c = i(e.output?.childThreadId) ?? i(t?.childThreadId);
|
|
110
110
|
return {
|
|
111
|
-
text: a ? `${
|
|
112
|
-
label:
|
|
111
|
+
text: a ? `${r} · Waiting for you` : `${r} Agent working`,
|
|
112
|
+
label: r,
|
|
113
113
|
childThreadId: c,
|
|
114
114
|
waiting: a
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function X(e) {
|
|
118
118
|
if (!e)
|
|
119
119
|
return;
|
|
120
120
|
if (e.type === "text")
|
|
@@ -124,10 +124,10 @@ function Q(e) {
|
|
|
124
124
|
const t = i(e.toolName);
|
|
125
125
|
if (!t)
|
|
126
126
|
return;
|
|
127
|
-
const
|
|
128
|
-
return
|
|
127
|
+
const n = e.input, r = n != null && typeof n == "object" && !Array.isArray(n) ? n : {};
|
|
128
|
+
return Q[t]?.(r) ?? `Using ${i(e.title) ?? w(t)}`;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Z(e) {
|
|
131
131
|
if (!(e.failed || e.stalled)) {
|
|
132
132
|
if (e.needsUser)
|
|
133
133
|
return "Waiting for you";
|
|
@@ -135,26 +135,26 @@ function X(e) {
|
|
|
135
135
|
return e.activity ?? "Starting…";
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ee({
|
|
139
139
|
title: e,
|
|
140
140
|
activity: t,
|
|
141
|
-
errorText:
|
|
142
|
-
running:
|
|
141
|
+
errorText: n,
|
|
142
|
+
running: r,
|
|
143
143
|
stalled: a,
|
|
144
144
|
onOpen: c
|
|
145
145
|
}) {
|
|
146
|
-
const l = a ?
|
|
146
|
+
const l = a ? _ : e, u = /* @__PURE__ */ S(C, {
|
|
147
147
|
align: "center",
|
|
148
148
|
direction: "row",
|
|
149
149
|
fullWidth: !0,
|
|
150
150
|
gap: "md",
|
|
151
151
|
padding: "md",
|
|
152
152
|
children: [/* @__PURE__ */ o(g, {
|
|
153
|
-
when:
|
|
154
|
-
fallback: /* @__PURE__ */ o(
|
|
153
|
+
when: r,
|
|
154
|
+
fallback: /* @__PURE__ */ o(I, {
|
|
155
155
|
"aria-hidden": !0
|
|
156
156
|
}),
|
|
157
|
-
children: /* @__PURE__ */ o(
|
|
157
|
+
children: /* @__PURE__ */ o(x, {
|
|
158
158
|
"aria-hidden": !0,
|
|
159
159
|
size: 14
|
|
160
160
|
})
|
|
@@ -162,20 +162,20 @@ function Z({
|
|
|
162
162
|
gap: "xxs",
|
|
163
163
|
grow: !0,
|
|
164
164
|
children: [/* @__PURE__ */ o(g, {
|
|
165
|
-
when:
|
|
165
|
+
when: r,
|
|
166
166
|
fallback: /* @__PURE__ */ o(m, {
|
|
167
167
|
className: h.title,
|
|
168
168
|
color: a ? "danger" : void 0,
|
|
169
169
|
children: l
|
|
170
170
|
}),
|
|
171
|
-
children: /* @__PURE__ */ o(
|
|
171
|
+
children: /* @__PURE__ */ o(M, {
|
|
172
172
|
as: "span",
|
|
173
173
|
className: h.title,
|
|
174
174
|
duration: 1,
|
|
175
175
|
children: l
|
|
176
176
|
})
|
|
177
177
|
}), /* @__PURE__ */ o(g, {
|
|
178
|
-
when:
|
|
178
|
+
when: r ? t : void 0,
|
|
179
179
|
children: (s) => /* @__PURE__ */ o(m, {
|
|
180
180
|
color: "secondary",
|
|
181
181
|
truncate: !0,
|
|
@@ -183,7 +183,7 @@ function Z({
|
|
|
183
183
|
children: s
|
|
184
184
|
})
|
|
185
185
|
}), /* @__PURE__ */ o(g, {
|
|
186
|
-
when:
|
|
186
|
+
when: n,
|
|
187
187
|
children: (s) => /* @__PURE__ */ o(m, {
|
|
188
188
|
color: "danger",
|
|
189
189
|
variant: "xs",
|
|
@@ -192,15 +192,15 @@ function Z({
|
|
|
192
192
|
})]
|
|
193
193
|
})]
|
|
194
194
|
});
|
|
195
|
-
return /* @__PURE__ */ o(
|
|
196
|
-
"aria-busy":
|
|
197
|
-
className:
|
|
195
|
+
return /* @__PURE__ */ o(D, {
|
|
196
|
+
"aria-busy": r || void 0,
|
|
197
|
+
className: z.tool,
|
|
198
198
|
collapsible: !1,
|
|
199
199
|
"data-slot": "agent-tool",
|
|
200
200
|
children: /* @__PURE__ */ o(g, {
|
|
201
201
|
when: c,
|
|
202
202
|
fallback: u,
|
|
203
|
-
children: (s) => /* @__PURE__ */ o(
|
|
203
|
+
children: (s) => /* @__PURE__ */ o(G, {
|
|
204
204
|
"aria-label": t ? `${l}. ${t}` : l,
|
|
205
205
|
className: h.hit,
|
|
206
206
|
onPress: s,
|
|
@@ -209,37 +209,37 @@ function Z({
|
|
|
209
209
|
})
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
const
|
|
212
|
+
const Ce = U(({
|
|
213
213
|
part: e
|
|
214
214
|
}) => {
|
|
215
|
-
const t =
|
|
216
|
-
onOpenSubagent:
|
|
217
|
-
} =
|
|
215
|
+
const t = j(), {
|
|
216
|
+
onOpenSubagent: n
|
|
217
|
+
} = O(), r = t?.getToolMeta?.(e.toolCallId)?.patch, a = r?.needsUser === !0, {
|
|
218
218
|
live: c,
|
|
219
219
|
stalled: l
|
|
220
|
-
} =
|
|
221
|
-
if (!
|
|
220
|
+
} = V(e.state, a);
|
|
221
|
+
if (!B(e) || F(e) !== "Agent")
|
|
222
222
|
return null;
|
|
223
|
-
const u =
|
|
223
|
+
const u = W(e), s = e.state === "output-available" ? H(e.output) : void 0, f = u.useFailureLabel || !!s, v = R(e), A = p(v), L = e.state === "output-available" && !!e.output?.jobId, b = J(v, L), P = X(r), $ = Z({
|
|
224
224
|
live: c,
|
|
225
225
|
failed: f,
|
|
226
226
|
stalled: l,
|
|
227
227
|
needsUser: a,
|
|
228
|
-
activity:
|
|
229
|
-
}),
|
|
230
|
-
return /* @__PURE__ */ o(
|
|
231
|
-
activity:
|
|
232
|
-
errorText:
|
|
233
|
-
onOpen:
|
|
228
|
+
activity: P
|
|
229
|
+
}), y = i(e.output?.childThreadId) ?? i(r?.childThreadId), k = !!(y && n && !f), E = s ?? u.problemText ?? u.tooltip;
|
|
230
|
+
return /* @__PURE__ */ o(ee, {
|
|
231
|
+
activity: $,
|
|
232
|
+
errorText: E,
|
|
233
|
+
onOpen: k ? () => n?.(y, A) : void 0,
|
|
234
234
|
running: c && !f && !l,
|
|
235
235
|
stalled: l,
|
|
236
|
-
title: c && !f && !l ?
|
|
236
|
+
title: c && !f && !l ? b.live : b.done
|
|
237
237
|
});
|
|
238
238
|
});
|
|
239
239
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
Ce as AgentTool,
|
|
241
|
+
Z as agentStatusLine,
|
|
242
|
+
X as subagentActivityLabel,
|
|
243
|
+
Te as subagentComposerCopy
|
|
244
244
|
};
|
|
245
245
|
//# sourceMappingURL=AgentTool.js.map
|