@agimon-ai/po-web-dashboard 0.0.0-alpha.69 → 0.0.0-alpha.70
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/web/features/session/ToolCard.cjs +5 -11
- package/dist/web/features/session/ToolCard.cjs.map +1 -1
- package/dist/web/features/session/ToolCard.d.mts.map +1 -1
- package/dist/web/features/session/ToolCard.mjs +6 -12
- package/dist/web/features/session/ToolCard.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -70,17 +70,11 @@ function HostAttachmentView({ attachment, index }) {
|
|
|
70
70
|
className: "max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2",
|
|
71
71
|
children: attachment.text
|
|
72
72
|
});
|
|
73
|
-
if (url !== void 0 && attachment.kind === "image") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className: "
|
|
78
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
79
|
-
src: url,
|
|
80
|
-
alt: attachment.name,
|
|
81
|
-
"data-testid": "tool-output-image",
|
|
82
|
-
className: "h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain"
|
|
83
|
-
})
|
|
73
|
+
if (url !== void 0 && attachment.kind === "image") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_agimon_ai_po_web_components.ViewableImage, {
|
|
74
|
+
src: url,
|
|
75
|
+
alt: attachment.name,
|
|
76
|
+
"data-testid": "tool-output-image",
|
|
77
|
+
className: "h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain"
|
|
84
78
|
});
|
|
85
79
|
if (url !== void 0 && attachment.kind === "video") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("video", {
|
|
86
80
|
src: url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.cjs","names":["imagesFromContent","MessageItem","collapseLines","MessageItemHeader","MessageItemBody","PathText","MessageItemStatus","pluginToolRenderer","textFromContent","ToolRendererBoundary","memo","useImageRefs","useMemo","toolMessageProps","StatusBadge","MessageItemHeaderAccessoryContext"],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"sourcesContent":["import type { ToolMessageRenderProps, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemHeaderAccessoryContext,\n StatusBadge,\n MessageItemStatus,\n PathText,\n type StatusTone,\n} from '@agimon-ai/po-web-components';\nimport { memo, type ReactNode, useMemo } from 'react';\n\nimport { pluginToolRenderer } from '../../lib/pluginRegistry';\nimport { imagesFromContent, textFromContent, type ToolEntry } from '../../lib/sessionModel';\nimport { toolMessageProps } from '../../lib/toolMessageProps';\nimport { ToolRendererBoundary } from '../../lib/ToolRendererBoundary';\nimport { useImageRefs } from '../../stores/imageRefStore';\n\nconst MAX_PREVIEW_LINES = 12;\n\ntype AttachmentKind = 'image' | 'audio' | 'video' | 'pdf' | 'text' | 'file';\n\ninterface HostAttachment {\n kind: AttachmentKind;\n mimeType: string;\n name: string;\n data?: string;\n text?: string;\n uri?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction attachmentKind(mimeType: string): AttachmentKind {\n if (mimeType.startsWith('image/')) return 'image';\n if (mimeType.startsWith('audio/')) return 'audio';\n if (mimeType.startsWith('video/')) return 'video';\n if (mimeType === 'application/pdf') return 'pdf';\n if (mimeType.startsWith('text/')) return 'text';\n return 'file';\n}\n\nfunction attachmentName(block: Record<string, unknown>, index: number): string {\n for (const key of ['title', 'name', 'filename', 'fileName']) {\n if (typeof block[key] === 'string' && block[key].length > 0) return block[key];\n }\n if (typeof block.uri === 'string' && block.uri.length > 0) return block.uri.split('/').at(-1) || block.uri;\n return `attachment-${String(index + 1)}`;\n}\n\n/** Binary and linked result blocks a tool returned outside its ordinary text. */\nfunction hostAttachments(entry: ToolEntry): HostAttachment[] {\n const content = entry.result?.content ?? [];\n // An image sent by reference shows once its entry is read; until then it has no data to draw.\n const images = imagesFromContent(content).flatMap((image, index): HostAttachment[] =>\n image.data === undefined\n ? []\n : [\n {\n kind: 'image',\n mimeType: image.mimeType,\n name: `${entry.name}-result-${String(index + 1)}`,\n data: image.data,\n },\n ],\n );\n const details = isRecord(entry.result?.details) ? entry.result.details : undefined;\n const blocks = [...content, ...(Array.isArray(details?.blocks) ? details.blocks : [])];\n const other = blocks.flatMap((candidate, index): HostAttachment[] => {\n if (!isRecord(candidate) || candidate.type === 'text' || candidate.type === 'image') return [];\n const resource = candidate.type === 'resource' && isRecord(candidate.resource) ? candidate.resource : candidate;\n const mimeType = typeof resource.mimeType === 'string' ? resource.mimeType : 'application/octet-stream';\n const data =\n typeof resource.data === 'string' ? resource.data : typeof resource.blob === 'string' ? resource.blob : undefined;\n const text = typeof resource.text === 'string' ? resource.text : undefined;\n const uri = typeof resource.uri === 'string' ? resource.uri : undefined;\n if (data === undefined && text === undefined && uri === undefined) return [];\n return [{ kind: attachmentKind(mimeType), mimeType, name: attachmentName(resource, index), data, text, uri }];\n });\n return [...images, ...other];\n}\n\nfunction attachmentUrl(attachment: HostAttachment): string | undefined {\n if (attachment.data !== undefined) return `data:${attachment.mimeType};base64,${attachment.data}`;\n if (attachment.uri === undefined) return undefined;\n return /^(?:https?):\\/\\//u.test(attachment.uri) ? attachment.uri : undefined;\n}\n\nfunction HostAttachmentView({ attachment, index }: { attachment: HostAttachment; index: number }) {\n const url = attachmentUrl(attachment);\n if (attachment.kind === 'text' && attachment.text !== undefined) {\n return (\n <pre\n data-testid=\"tool-output-text-file\"\n className=\"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2\"\n >\n {attachment.text}\n </pre>\n );\n }\n if (url !== undefined && attachment.kind === 'image') {\n return (\n <a href={url} target=\"_blank\" rel=\"noreferrer\" className=\"self-start\">\n <img\n src={url}\n alt={attachment.name}\n data-testid=\"tool-output-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n </a>\n );\n }\n if (url !== undefined && attachment.kind === 'video') {\n return (\n <video\n src={url}\n controls\n preload=\"metadata\"\n data-testid=\"tool-output-video\"\n className=\"max-h-96 max-w-full self-start rounded-md border border-po-border-soft\"\n >\n <track kind=\"captions\" />\n </video>\n );\n }\n if (url !== undefined && attachment.kind === 'audio') {\n return (\n <audio src={url} controls preload=\"metadata\" data-testid=\"tool-output-audio\" className=\"w-full\">\n <track kind=\"captions\" />\n </audio>\n );\n }\n if (url !== undefined && attachment.kind === 'pdf') {\n return (\n <iframe\n src={url}\n title={attachment.name}\n data-testid=\"tool-output-pdf\"\n className=\"h-[480px] w-full rounded-md border border-po-border-soft bg-po-deep\"\n />\n );\n }\n return url !== undefined ? (\n <a\n href={url}\n download={attachment.name}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-po-blue hover:border-po-blue/60\"\n >\n {attachment.name} · {attachment.mimeType}\n </a>\n ) : (\n <span\n key={index}\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-base text-po-dim\"\n >\n {attachment.name} · {attachment.mimeType}\n </span>\n );\n}\n\nfunction toneOf(entry: ToolEntry): StatusTone {\n return entry.running ? 'running' : entry.isError ? 'error' : 'ok';\n}\n\n/**\n * The host's own item for a tool no plugin claims: the argument summary in\n * the header and the result's text and safe browser previews, with long text\n * clipped until expanded, on the same shell every plugin message is built from.\n */\nfunction HostToolMessage({ entry, slotProps }: { entry: ToolEntry; slotProps: WebPluginSlotProps }) {\n const lines = entry.output.length > 0 ? entry.output.split('\\n') : [];\n const attachments = hostAttachments(entry);\n return (\n <MessageItem tone={toneOf(entry)} expandable={lines.length > MAX_PREVIEW_LINES}>\n {({ expanded }) => {\n const { shown, hidden } = collapseLines(lines, MAX_PREVIEW_LINES, expanded);\n return (\n <>\n <MessageItemHeader title={entry.name}>\n <span className=\"min-w-0 flex-1 truncate\">{entry.argSummary}</span>\n </MessageItemHeader>\n {shown.length > 0 || attachments.length > 0 ? (\n <MessageItemBody className=\"flex flex-col gap-2\">\n {shown.length > 0 ? (\n <pre data-testid=\"tool-output\" className=\"whitespace-pre-wrap break-words\">\n <PathText\n text={shown.join('\\n')}\n onFileLink={(path) => {\n const tab = slotProps.fileTabFor(path);\n return tab && (() => slotProps.openTransientTab(tab));\n }}\n />\n </pre>\n ) : null}\n {attachments.map((attachment, index) => (\n <HostAttachmentView\n key={`${attachment.mimeType}:${attachment.name}:${String(index)}`}\n attachment={attachment}\n index={index}\n />\n ))}\n {hidden > 0 ? <MessageItemStatus expands>show {hidden} more line(s)</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n\n/**\n * Another tool's own card for a call made on its behalf, with the call's recorded args and result. Null when no\n * plugin claims the tool. It gets no `renderTool` itself, so a card inside a card cannot nest further.\n */\nexport function nestedToolCard(\n parent: ToolEntry,\n call: Parameters<NonNullable<ToolMessageRenderProps['renderTool']>>[0],\n slotProps: WebPluginSlotProps,\n statuses: Readonly<Record<string, string>>,\n): ReactNode {\n const renderer = pluginToolRenderer(call.toolName, statuses, call.result?.details);\n if (!renderer) return null;\n const props: ToolMessageRenderProps = {\n ...slotProps,\n toolCallId: `${parent.toolCallId}:${call.toolName}`,\n toolName: call.toolName,\n args: call.args,\n statuses,\n result: call.result,\n output: textFromContent(call.result?.content),\n running: false,\n isError: call.isError,\n };\n return (\n <ToolRendererBoundary toolName={call.toolName}>\n {(failed) =>\n failed ? (\n <pre className=\"whitespace-pre-wrap break-words text-sm\">{props.output}</pre>\n ) : (\n <renderer.message {...props} />\n )\n }\n </ToolRendererBoundary>\n );\n}\n\n/**\n * One tool call in the timeline. The plugin that registered the tool owns\n * the whole item through its `message` renderer, the web half of the TUI's\n * renderShell 'self'; the host only marks the row, catches a renderer that\n * throws, and stands in for a tool nobody claims.\n */\nexport const ToolCard = memo(function ToolCard({\n entry: shown,\n slotProps,\n statuses,\n}: {\n entry: ToolEntry;\n slotProps: WebPluginSlotProps;\n statuses: Readonly<Record<string, string>>;\n}) {\n // Renderers read result images inline, so one the transcript sent by reference is filled in once read.\n const result = useImageRefs(shown.result);\n const entry = useMemo(() => (result === shown.result ? shown : { ...shown, result }), [shown, result]);\n const renderer = pluginToolRenderer(entry.name, statuses, entry.result?.details);\n const state = toneOf(entry);\n const props: ToolMessageRenderProps = {\n ...toolMessageProps(slotProps, entry, statuses),\n renderTool: (call) => nestedToolCard(entry, call, slotProps, statuses),\n };\n // ponytail: mirrors po-hook's status key; share a constant if another consumer needs it.\n const hookStatus = statuses[`repository-hooks:${entry.toolCallId}:post`]?.trim();\n const hookBadge = hookStatus ? (\n <StatusBadge tone=\"running\" title={hookStatus} aria-label={hookStatus} data-testid=\"tool-hook-status\">\n HOOK\n </StatusBadge>\n ) : null;\n return (\n <ToolRendererBoundary key={entry.toolCallId} toolName={entry.name}>\n {(failed) => (\n <div\n data-testid=\"entry-tool\"\n data-tool-name={entry.name}\n data-tool-state={state}\n data-tool-renderer={failed ? 'failed' : renderer ? 'plugin' : 'host'}\n >\n <MessageItemHeaderAccessoryContext value={hookBadge}>\n {renderer && !failed ? (\n <renderer.message {...props} />\n ) : (\n <HostToolMessage entry={entry} slotProps={slotProps} />\n )}\n </MessageItemHeaderAccessoryContext>\n </div>\n )}\n </ToolRendererBoundary>\n );\n});\n"],"mappings":";;;;;;;;;AAoBA,MAAM,oBAAoB;AAa1B,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,eAAe,UAAkC;CACxD,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW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BAAA,GAAA,kBAAA,IAAA,CAACL,6BAAAA,sBAAD;EAA6C,UAAU,MAAM;EACzD,WAAA,WACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,eAAY;GACZ,kBAAgB,MAAM;GACtB,mBAAiB;GACjB,sBAAoB,SAAS,WAAW,WAAW,WAAW;GAE9D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACM,6BAAAA,mCAAD;IAAmC,OAAO;IACvC,UAAA,YAAY,CAAC,SACZ,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAS,SAAV,EAAkB,GAAI,MAAQ,CAAA,IAE9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;KAAwB;KAAkB;IAAY,CAAA;GAEvB,CAAA;EAChC,CAAA;CAEa,GAjBK,MAAM,UAiBX;AAE1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"ToolCard.cjs","names":["imagesFromContent","ViewableImage","MessageItem","collapseLines","MessageItemHeader","MessageItemBody","PathText","MessageItemStatus","pluginToolRenderer","textFromContent","ToolRendererBoundary","memo","useImageRefs","useMemo","toolMessageProps","StatusBadge","MessageItemHeaderAccessoryContext"],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"sourcesContent":["import type { ToolMessageRenderProps, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemHeaderAccessoryContext,\n StatusBadge,\n MessageItemStatus,\n PathText,\n type StatusTone,\n ViewableImage,\n} from '@agimon-ai/po-web-components';\nimport { memo, type ReactNode, useMemo } from 'react';\n\nimport { pluginToolRenderer } from '../../lib/pluginRegistry';\nimport { imagesFromContent, textFromContent, type ToolEntry } from '../../lib/sessionModel';\nimport { toolMessageProps } from '../../lib/toolMessageProps';\nimport { ToolRendererBoundary } from '../../lib/ToolRendererBoundary';\nimport { useImageRefs } from '../../stores/imageRefStore';\n\nconst MAX_PREVIEW_LINES = 12;\n\ntype AttachmentKind = 'image' | 'audio' | 'video' | 'pdf' | 'text' | 'file';\n\ninterface HostAttachment {\n kind: AttachmentKind;\n mimeType: string;\n name: string;\n data?: string;\n text?: string;\n uri?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction attachmentKind(mimeType: string): AttachmentKind {\n if (mimeType.startsWith('image/')) return 'image';\n if (mimeType.startsWith('audio/')) return 'audio';\n if (mimeType.startsWith('video/')) return 'video';\n if (mimeType === 'application/pdf') return 'pdf';\n if (mimeType.startsWith('text/')) return 'text';\n return 'file';\n}\n\nfunction attachmentName(block: Record<string, unknown>, index: number): string {\n for (const key of ['title', 'name', 'filename', 'fileName']) {\n if (typeof block[key] === 'string' && block[key].length > 0) return block[key];\n }\n if (typeof block.uri === 'string' && block.uri.length > 0) return block.uri.split('/').at(-1) || block.uri;\n return `attachment-${String(index + 1)}`;\n}\n\n/** Binary and linked result blocks a tool returned outside its ordinary text. */\nfunction hostAttachments(entry: ToolEntry): HostAttachment[] {\n const content = entry.result?.content ?? [];\n // An image sent by reference shows once its entry is read; until then it has no data to draw.\n const images = imagesFromContent(content).flatMap((image, index): HostAttachment[] =>\n image.data === undefined\n ? []\n : [\n {\n kind: 'image',\n mimeType: image.mimeType,\n name: `${entry.name}-result-${String(index + 1)}`,\n data: image.data,\n },\n ],\n );\n const details = isRecord(entry.result?.details) ? entry.result.details : undefined;\n const blocks = [...content, ...(Array.isArray(details?.blocks) ? details.blocks : [])];\n const other = blocks.flatMap((candidate, index): HostAttachment[] => {\n if (!isRecord(candidate) || candidate.type === 'text' || candidate.type === 'image') return [];\n const resource = candidate.type === 'resource' && isRecord(candidate.resource) ? candidate.resource : candidate;\n const mimeType = typeof resource.mimeType === 'string' ? resource.mimeType : 'application/octet-stream';\n const data =\n typeof resource.data === 'string' ? resource.data : typeof resource.blob === 'string' ? resource.blob : undefined;\n const text = typeof resource.text === 'string' ? resource.text : undefined;\n const uri = typeof resource.uri === 'string' ? resource.uri : undefined;\n if (data === undefined && text === undefined && uri === undefined) return [];\n return [{ kind: attachmentKind(mimeType), mimeType, name: attachmentName(resource, index), data, text, uri }];\n });\n return [...images, ...other];\n}\n\nfunction attachmentUrl(attachment: HostAttachment): string | undefined {\n if (attachment.data !== undefined) return `data:${attachment.mimeType};base64,${attachment.data}`;\n if (attachment.uri === undefined) return undefined;\n return /^(?:https?):\\/\\//u.test(attachment.uri) ? attachment.uri : undefined;\n}\n\nfunction HostAttachmentView({ attachment, index }: { attachment: HostAttachment; index: number }) {\n const url = attachmentUrl(attachment);\n if (attachment.kind === 'text' && attachment.text !== undefined) {\n return (\n <pre\n data-testid=\"tool-output-text-file\"\n className=\"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2\"\n >\n {attachment.text}\n </pre>\n );\n }\n if (url !== undefined && attachment.kind === 'image') {\n return (\n <ViewableImage\n src={url}\n alt={attachment.name}\n data-testid=\"tool-output-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n );\n }\n if (url !== undefined && attachment.kind === 'video') {\n return (\n <video\n src={url}\n controls\n preload=\"metadata\"\n data-testid=\"tool-output-video\"\n className=\"max-h-96 max-w-full self-start rounded-md border border-po-border-soft\"\n >\n <track kind=\"captions\" />\n </video>\n );\n }\n if (url !== undefined && attachment.kind === 'audio') {\n return (\n <audio src={url} controls preload=\"metadata\" data-testid=\"tool-output-audio\" className=\"w-full\">\n <track kind=\"captions\" />\n </audio>\n );\n }\n if (url !== undefined && attachment.kind === 'pdf') {\n return (\n <iframe\n src={url}\n title={attachment.name}\n data-testid=\"tool-output-pdf\"\n className=\"h-[480px] w-full rounded-md border border-po-border-soft bg-po-deep\"\n />\n );\n }\n return url !== undefined ? (\n <a\n href={url}\n download={attachment.name}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-po-blue hover:border-po-blue/60\"\n >\n {attachment.name} · {attachment.mimeType}\n </a>\n ) : (\n <span\n key={index}\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-base text-po-dim\"\n >\n {attachment.name} · {attachment.mimeType}\n </span>\n );\n}\n\nfunction toneOf(entry: ToolEntry): StatusTone {\n return entry.running ? 'running' : entry.isError ? 'error' : 'ok';\n}\n\n/**\n * The host's own item for a tool no plugin claims: the argument summary in\n * the header and the result's text and safe browser previews, with long text\n * clipped until expanded, on the same shell every plugin message is built from.\n */\nfunction HostToolMessage({ entry, slotProps }: { entry: ToolEntry; slotProps: WebPluginSlotProps }) {\n const lines = entry.output.length > 0 ? entry.output.split('\\n') : [];\n const attachments = hostAttachments(entry);\n return (\n <MessageItem tone={toneOf(entry)} expandable={lines.length > MAX_PREVIEW_LINES}>\n {({ expanded }) => {\n const { shown, hidden } = collapseLines(lines, MAX_PREVIEW_LINES, expanded);\n return (\n <>\n <MessageItemHeader title={entry.name}>\n <span className=\"min-w-0 flex-1 truncate\">{entry.argSummary}</span>\n </MessageItemHeader>\n {shown.length > 0 || attachments.length > 0 ? (\n <MessageItemBody className=\"flex flex-col gap-2\">\n {shown.length > 0 ? (\n <pre data-testid=\"tool-output\" className=\"whitespace-pre-wrap break-words\">\n <PathText\n text={shown.join('\\n')}\n onFileLink={(path) => {\n const tab = slotProps.fileTabFor(path);\n return tab && (() => slotProps.openTransientTab(tab));\n }}\n />\n </pre>\n ) : null}\n {attachments.map((attachment, index) => (\n <HostAttachmentView\n key={`${attachment.mimeType}:${attachment.name}:${String(index)}`}\n attachment={attachment}\n index={index}\n />\n ))}\n {hidden > 0 ? <MessageItemStatus expands>show {hidden} more line(s)</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n\n/**\n * Another tool's own card for a call made on its behalf, with the call's recorded args and result. Null when no\n * plugin claims the tool. It gets no `renderTool` itself, so a card inside a card cannot nest further.\n */\nexport function nestedToolCard(\n parent: ToolEntry,\n call: Parameters<NonNullable<ToolMessageRenderProps['renderTool']>>[0],\n slotProps: WebPluginSlotProps,\n statuses: Readonly<Record<string, string>>,\n): ReactNode {\n const renderer = pluginToolRenderer(call.toolName, statuses, call.result?.details);\n if (!renderer) return null;\n const props: ToolMessageRenderProps = {\n ...slotProps,\n toolCallId: `${parent.toolCallId}:${call.toolName}`,\n toolName: call.toolName,\n args: call.args,\n statuses,\n result: call.result,\n output: textFromContent(call.result?.content),\n running: false,\n isError: call.isError,\n };\n return (\n <ToolRendererBoundary toolName={call.toolName}>\n {(failed) =>\n failed ? (\n <pre className=\"whitespace-pre-wrap break-words text-sm\">{props.output}</pre>\n ) : (\n <renderer.message {...props} />\n )\n }\n </ToolRendererBoundary>\n );\n}\n\n/**\n * One tool call in the timeline. The plugin that registered the tool owns\n * the whole item through its `message` renderer, the web half of the TUI's\n * renderShell 'self'; the host only marks the row, catches a renderer that\n * throws, and stands in for a tool nobody claims.\n */\nexport const ToolCard = memo(function ToolCard({\n entry: shown,\n slotProps,\n statuses,\n}: {\n entry: ToolEntry;\n slotProps: WebPluginSlotProps;\n statuses: Readonly<Record<string, string>>;\n}) {\n // Renderers read result images inline, so one the transcript sent by reference is filled in once read.\n const result = useImageRefs(shown.result);\n const entry = useMemo(() => (result === shown.result ? shown : { ...shown, result }), [shown, result]);\n const renderer = pluginToolRenderer(entry.name, statuses, entry.result?.details);\n const state = toneOf(entry);\n const props: ToolMessageRenderProps = {\n ...toolMessageProps(slotProps, entry, statuses),\n renderTool: (call) => nestedToolCard(entry, call, slotProps, statuses),\n };\n // ponytail: mirrors po-hook's status key; share a constant if another consumer needs it.\n const hookStatus = statuses[`repository-hooks:${entry.toolCallId}:post`]?.trim();\n const hookBadge = hookStatus ? (\n <StatusBadge tone=\"running\" title={hookStatus} aria-label={hookStatus} data-testid=\"tool-hook-status\">\n HOOK\n </StatusBadge>\n ) : null;\n return (\n <ToolRendererBoundary key={entry.toolCallId} toolName={entry.name}>\n {(failed) => (\n <div\n data-testid=\"entry-tool\"\n data-tool-name={entry.name}\n data-tool-state={state}\n data-tool-renderer={failed ? 'failed' : renderer ? 'plugin' : 'host'}\n >\n <MessageItemHeaderAccessoryContext value={hookBadge}>\n {renderer && !failed ? (\n <renderer.message {...props} />\n ) : (\n <HostToolMessage entry={entry} slotProps={slotProps} />\n )}\n </MessageItemHeaderAccessoryContext>\n </div>\n )}\n </ToolRendererBoundary>\n );\n});\n"],"mappings":";;;;;;;;;AAqBA,MAAM,oBAAoB;AAa1B,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,eAAe,UAAkC;CACxD,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,aAAa,mBAAmB,OAAO;CAC3C,IAAI,SAAS,WAAW,OAAO,GAAG,OAAO;CACzC,OAAO;AACT;AAEA,SAAS,eAAe,OAAgC,OAAuB;CAC7E,KAAK,MAAM,OAAO;EAAC;EAAS;EAAQ;EAAY;CAAU,GACxD,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,IAAI,CAAC,SAAS,GAAG,OAAO,MAAM;CAE5E,IAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,IAAI,SAAS,GAAG,OAAO,MAAM,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,MAAM;CACvG,OAAO,cAAc,OAAO,QAAQ,CAAC;AACvC;;AAGA,SAAS,gBAAgB,OAAoC;CAC3D,MAAM,UAAU,MAAM,QAAQ,WAAW,CAAC;CAE1C,MAAM,SAASA,qBAAAA,kBAAkB,OAAO,CAAC,CAAC,SAAS,OAAO,UACxD,MAAM,SAAS,KAAA,IACX,CAAC,IACD,CACE;EACE,MAAM;EACN,UAAU,MAAM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M,CAAC;CACrG,MAAM,WAAWL,uBAAAA,mBAAmB,MAAM,MAAM,UAAU,MAAM,QAAQ,OAAO;CAC/E,MAAM,QAAQ,OAAO,KAAK;CAC1B,MAAM,QAAgC;EACpC,GAAGM,yBAAAA,iBAAiB,WAAW,OAAO,QAAQ;EAC9C,aAAa,SAAS,eAAe,OAAO,MAAM,WAAW,QAAQ;CACvE;CAEA,MAAM,aAAa,SAAS,oBAAoB,MAAM,WAAW,OAAO,EAAE,KAAK;CAC/E,MAAM,YAAY,aAChB,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,aAAD;EAAa,MAAK;EAAU,OAAO;EAAY,cAAY;EAAY,eAAY;EAAmB,UAAA;CAEzF,CAAA,IACX;CACJ,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACL,6BAAAA,sBAAD;EAA6C,UAAU,MAAM;EACzD,WAAA,WACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,eAAY;GACZ,kBAAgB,MAAM;GACtB,mBAAiB;GACjB,sBAAoB,SAAS,WAAW,WAAW,WAAW;GAE9D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACM,6BAAAA,mCAAD;IAAmC,OAAO;IACvC,UAAA,YAAY,CAAC,SACZ,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAS,SAAV,EAAkB,GAAI,MAAQ,CAAA,IAE9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;KAAwB;KAAkB;IAAY,CAAA;GAEvB,CAAA;EAChC,CAAA;CAEa,GAjBK,MAAM,UAiBX;AAE1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.d.mts","names":[],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"ToolCard.d.mts","names":[],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"mappings":";;;;;;;;wBA8NgB,eACd,QAAQ,WACR,MAAM,WAAW,YAAY,2CAC7B,WAAW,oBACX,UAAU,SAAS,0BAClB;;;;;;;qBAiCU,0BAAQ,uBAAA,OAAA,OAAA,WAAA;EAKnB,OAAO;EACP,WAAW;EACX,UAAU,SAAS;sBACpB,IAAA"}
|
|
@@ -4,7 +4,7 @@ import { imagesFromContent, textFromContent } from "../../lib/sessionModel.mjs";
|
|
|
4
4
|
import { toolMessageProps } from "../../lib/toolMessageProps.mjs";
|
|
5
5
|
import { useImageRefs } from "../../stores/imageRefStore.mjs";
|
|
6
6
|
import { memo, useMemo } from "react";
|
|
7
|
-
import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemHeaderAccessoryContext, MessageItemStatus, PathText, StatusBadge, collapseLines } from "@agimon-ai/po-web-components";
|
|
7
|
+
import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemHeaderAccessoryContext, MessageItemStatus, PathText, StatusBadge, ViewableImage, collapseLines } from "@agimon-ai/po-web-components";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/web/features/session/ToolCard.tsx
|
|
10
10
|
const MAX_PREVIEW_LINES = 12;
|
|
@@ -70,17 +70,11 @@ function HostAttachmentView({ attachment, index }) {
|
|
|
70
70
|
className: "max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2",
|
|
71
71
|
children: attachment.text
|
|
72
72
|
});
|
|
73
|
-
if (url !== void 0 && attachment.kind === "image") return /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className: "
|
|
78
|
-
children: /* @__PURE__ */ jsx("img", {
|
|
79
|
-
src: url,
|
|
80
|
-
alt: attachment.name,
|
|
81
|
-
"data-testid": "tool-output-image",
|
|
82
|
-
className: "h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain"
|
|
83
|
-
})
|
|
73
|
+
if (url !== void 0 && attachment.kind === "image") return /* @__PURE__ */ jsx(ViewableImage, {
|
|
74
|
+
src: url,
|
|
75
|
+
alt: attachment.name,
|
|
76
|
+
"data-testid": "tool-output-image",
|
|
77
|
+
className: "h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain"
|
|
84
78
|
});
|
|
85
79
|
if (url !== void 0 && attachment.kind === "video") return /* @__PURE__ */ jsx("video", {
|
|
86
80
|
src: url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.mjs","names":[],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"sourcesContent":["import type { ToolMessageRenderProps, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemHeaderAccessoryContext,\n StatusBadge,\n MessageItemStatus,\n PathText,\n type StatusTone,\n} from '@agimon-ai/po-web-components';\nimport { memo, type ReactNode, useMemo } from 'react';\n\nimport { pluginToolRenderer } from '../../lib/pluginRegistry';\nimport { imagesFromContent, textFromContent, type ToolEntry } from '../../lib/sessionModel';\nimport { toolMessageProps } from '../../lib/toolMessageProps';\nimport { ToolRendererBoundary } from '../../lib/ToolRendererBoundary';\nimport { useImageRefs } from '../../stores/imageRefStore';\n\nconst MAX_PREVIEW_LINES = 12;\n\ntype AttachmentKind = 'image' | 'audio' | 'video' | 'pdf' | 'text' | 'file';\n\ninterface HostAttachment {\n kind: AttachmentKind;\n mimeType: string;\n name: string;\n data?: string;\n text?: string;\n uri?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction attachmentKind(mimeType: string): AttachmentKind {\n if (mimeType.startsWith('image/')) return 'image';\n if (mimeType.startsWith('audio/')) return 'audio';\n if (mimeType.startsWith('video/')) return 'video';\n if (mimeType === 'application/pdf') return 'pdf';\n if (mimeType.startsWith('text/')) return 'text';\n return 'file';\n}\n\nfunction attachmentName(block: Record<string, unknown>, index: number): string {\n for (const key of ['title', 'name', 'filename', 'fileName']) {\n if (typeof block[key] === 'string' && block[key].length > 0) return block[key];\n }\n if (typeof block.uri === 'string' && block.uri.length > 0) return block.uri.split('/').at(-1) || block.uri;\n return `attachment-${String(index + 1)}`;\n}\n\n/** Binary and linked result blocks a tool returned outside its ordinary text. */\nfunction hostAttachments(entry: ToolEntry): HostAttachment[] {\n const content = entry.result?.content ?? [];\n // An image sent by reference shows once its entry is read; until then it has no data to draw.\n const images = imagesFromContent(content).flatMap((image, index): HostAttachment[] =>\n image.data === undefined\n ? []\n : [\n {\n kind: 'image',\n mimeType: image.mimeType,\n name: `${entry.name}-result-${String(index + 1)}`,\n data: image.data,\n },\n ],\n );\n const details = isRecord(entry.result?.details) ? entry.result.details : undefined;\n const blocks = [...content, ...(Array.isArray(details?.blocks) ? details.blocks : [])];\n const other = blocks.flatMap((candidate, index): HostAttachment[] => {\n if (!isRecord(candidate) || candidate.type === 'text' || candidate.type === 'image') return [];\n const resource = candidate.type === 'resource' && isRecord(candidate.resource) ? candidate.resource : candidate;\n const mimeType = typeof resource.mimeType === 'string' ? resource.mimeType : 'application/octet-stream';\n const data =\n typeof resource.data === 'string' ? resource.data : typeof resource.blob === 'string' ? resource.blob : undefined;\n const text = typeof resource.text === 'string' ? resource.text : undefined;\n const uri = typeof resource.uri === 'string' ? resource.uri : undefined;\n if (data === undefined && text === undefined && uri === undefined) return [];\n return [{ kind: attachmentKind(mimeType), mimeType, name: attachmentName(resource, index), data, text, uri }];\n });\n return [...images, ...other];\n}\n\nfunction attachmentUrl(attachment: HostAttachment): string | undefined {\n if (attachment.data !== undefined) return `data:${attachment.mimeType};base64,${attachment.data}`;\n if (attachment.uri === undefined) return undefined;\n return /^(?:https?):\\/\\//u.test(attachment.uri) ? attachment.uri : undefined;\n}\n\nfunction HostAttachmentView({ attachment, index }: { attachment: HostAttachment; index: number }) {\n const url = attachmentUrl(attachment);\n if (attachment.kind === 'text' && attachment.text !== undefined) {\n return (\n <pre\n data-testid=\"tool-output-text-file\"\n className=\"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2\"\n >\n {attachment.text}\n </pre>\n );\n }\n if (url !== undefined && attachment.kind === 'image') {\n return (\n <a href={url} target=\"_blank\" rel=\"noreferrer\" className=\"self-start\">\n <img\n src={url}\n alt={attachment.name}\n data-testid=\"tool-output-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n </a>\n );\n }\n if (url !== undefined && attachment.kind === 'video') {\n return (\n <video\n src={url}\n controls\n preload=\"metadata\"\n data-testid=\"tool-output-video\"\n className=\"max-h-96 max-w-full self-start rounded-md border border-po-border-soft\"\n >\n <track kind=\"captions\" />\n </video>\n );\n }\n if (url !== undefined && attachment.kind === 'audio') {\n return (\n <audio src={url} controls preload=\"metadata\" data-testid=\"tool-output-audio\" className=\"w-full\">\n <track kind=\"captions\" />\n </audio>\n );\n }\n if (url !== undefined && attachment.kind === 'pdf') {\n return (\n <iframe\n src={url}\n title={attachment.name}\n data-testid=\"tool-output-pdf\"\n className=\"h-[480px] w-full rounded-md border border-po-border-soft bg-po-deep\"\n />\n );\n }\n return url !== undefined ? (\n <a\n href={url}\n download={attachment.name}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-po-blue hover:border-po-blue/60\"\n >\n {attachment.name} · {attachment.mimeType}\n </a>\n ) : (\n <span\n key={index}\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-base text-po-dim\"\n >\n {attachment.name} · {attachment.mimeType}\n </span>\n );\n}\n\nfunction toneOf(entry: ToolEntry): StatusTone {\n return entry.running ? 'running' : entry.isError ? 'error' : 'ok';\n}\n\n/**\n * The host's own item for a tool no plugin claims: the argument summary in\n * the header and the result's text and safe browser previews, with long text\n * clipped until expanded, on the same shell every plugin message is built from.\n */\nfunction HostToolMessage({ entry, slotProps }: { entry: ToolEntry; slotProps: WebPluginSlotProps }) {\n const lines = entry.output.length > 0 ? entry.output.split('\\n') : [];\n const attachments = hostAttachments(entry);\n return (\n <MessageItem tone={toneOf(entry)} expandable={lines.length > MAX_PREVIEW_LINES}>\n {({ expanded }) => {\n const { shown, hidden } = collapseLines(lines, MAX_PREVIEW_LINES, expanded);\n return (\n <>\n <MessageItemHeader title={entry.name}>\n <span className=\"min-w-0 flex-1 truncate\">{entry.argSummary}</span>\n </MessageItemHeader>\n {shown.length > 0 || attachments.length > 0 ? (\n <MessageItemBody className=\"flex flex-col gap-2\">\n {shown.length > 0 ? (\n <pre data-testid=\"tool-output\" className=\"whitespace-pre-wrap break-words\">\n <PathText\n text={shown.join('\\n')}\n onFileLink={(path) => {\n const tab = slotProps.fileTabFor(path);\n return tab && (() => slotProps.openTransientTab(tab));\n }}\n />\n </pre>\n ) : null}\n {attachments.map((attachment, index) => (\n <HostAttachmentView\n key={`${attachment.mimeType}:${attachment.name}:${String(index)}`}\n attachment={attachment}\n index={index}\n />\n ))}\n {hidden > 0 ? <MessageItemStatus expands>show {hidden} more line(s)</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n\n/**\n * Another tool's own card for a call made on its behalf, with the call's recorded args and result. Null when no\n * plugin claims the tool. It gets no `renderTool` itself, so a card inside a card cannot nest further.\n */\nexport function nestedToolCard(\n parent: ToolEntry,\n call: Parameters<NonNullable<ToolMessageRenderProps['renderTool']>>[0],\n slotProps: WebPluginSlotProps,\n statuses: Readonly<Record<string, string>>,\n): ReactNode {\n const renderer = pluginToolRenderer(call.toolName, statuses, call.result?.details);\n if (!renderer) return null;\n const props: ToolMessageRenderProps = {\n ...slotProps,\n toolCallId: `${parent.toolCallId}:${call.toolName}`,\n toolName: call.toolName,\n args: call.args,\n statuses,\n result: call.result,\n output: textFromContent(call.result?.content),\n running: false,\n isError: call.isError,\n };\n return (\n <ToolRendererBoundary toolName={call.toolName}>\n {(failed) =>\n failed ? (\n <pre className=\"whitespace-pre-wrap break-words text-sm\">{props.output}</pre>\n ) : (\n <renderer.message {...props} />\n )\n }\n </ToolRendererBoundary>\n );\n}\n\n/**\n * One tool call in the timeline. The plugin that registered the tool owns\n * the whole item through its `message` renderer, the web half of the TUI's\n * renderShell 'self'; the host only marks the row, catches a renderer that\n * throws, and stands in for a tool nobody claims.\n */\nexport const ToolCard = memo(function ToolCard({\n entry: shown,\n slotProps,\n statuses,\n}: {\n entry: ToolEntry;\n slotProps: WebPluginSlotProps;\n statuses: Readonly<Record<string, string>>;\n}) {\n // Renderers read result images inline, so one the transcript sent by reference is filled in once read.\n const result = useImageRefs(shown.result);\n const entry = useMemo(() => (result === shown.result ? shown : { ...shown, result }), [shown, result]);\n const renderer = pluginToolRenderer(entry.name, statuses, entry.result?.details);\n const state = toneOf(entry);\n const props: ToolMessageRenderProps = {\n ...toolMessageProps(slotProps, entry, statuses),\n renderTool: (call) => nestedToolCard(entry, call, slotProps, statuses),\n };\n // ponytail: mirrors po-hook's status key; share a constant if another consumer needs it.\n const hookStatus = statuses[`repository-hooks:${entry.toolCallId}:post`]?.trim();\n const hookBadge = hookStatus ? (\n <StatusBadge tone=\"running\" title={hookStatus} aria-label={hookStatus} data-testid=\"tool-hook-status\">\n HOOK\n </StatusBadge>\n ) : null;\n return (\n <ToolRendererBoundary key={entry.toolCallId} toolName={entry.name}>\n {(failed) => (\n <div\n data-testid=\"entry-tool\"\n data-tool-name={entry.name}\n data-tool-state={state}\n data-tool-renderer={failed ? 'failed' : renderer ? 'plugin' : 'host'}\n >\n <MessageItemHeaderAccessoryContext value={hookBadge}>\n {renderer && !failed ? (\n <renderer.message {...props} />\n ) : (\n <HostToolMessage entry={entry} slotProps={slotProps} />\n )}\n </MessageItemHeaderAccessoryContext>\n </div>\n )}\n </ToolRendererBoundary>\n );\n});\n"],"mappings":";;;;;;;;;AAoBA,MAAM,oBAAoB;AAa1B,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM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AAE1B;;;;;;;AAQA,MAAa,WAAW,KAAK,SAAS,SAAS,EAC7C,OAAO,OACP,WACA,YAKC;CAED,MAAM,SAAS,aAAa,MAAM,MAAM;CACxC,MAAM,QAAQ,cAAe,WAAW,MAAM,SAAS,QAAQ;EAAE,GAAG;EAAO;CAAO,GAAI,CAAC,OAAO,MAAM,CAAC;CACrG,MAAM,WAAW,mBAAmB,MAAM,MAAM,UAAU,MAAM,QAAQ,OAAO;CAC/E,MAAM,QAAQ,OAAO,KAAK;CAC1B,MAAM,QAAgC;EACpC,GAAG,iBAAiB,WAAW,OAAO,QAAQ;EAC9C,aAAa,SAAS,eAAe,OAAO,MAAM,WAAW,QAAQ;CACvE;CAEA,MAAM,aAAa,SAAS,oBAAoB,MAAM,WAAW,OAAO,EAAE,KAAK;CAC/E,MAAM,YAAY,aAChB,oBAAC,aAAD;EAAa,MAAK;EAAU,OAAO;EAAY,cAAY;EAAY,eAAY;EAAmB,UAAA;CAEzF,CAAA,IACX;CACJ,OACE,oBAAC,sBAAD;EAA6C,UAAU,MAAM;EACzD,WAAA,WACA,oBAAC,OAAD;GACE,eAAY;GACZ,kBAAgB,MAAM;GACtB,mBAAiB;GACjB,sBAAoB,SAAS,WAAW,WAAW,WAAW;GAE9D,UAAA,oBAAC,mCAAD;IAAmC,OAAO;IACvC,UAAA,YAAY,CAAC,SACZ,oBAAC,SAAS,SAAV,EAAkB,GAAI,MAAQ,CAAA,IAE9B,oBAAC,iBAAD;KAAwB;KAAkB;IAAY,CAAA;GAEvB,CAAA;EAChC,CAAA;CAEa,GAjBK,MAAM,UAiBX;AAE1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"ToolCard.mjs","names":[],"sources":["../../../../src/web/features/session/ToolCard.tsx"],"sourcesContent":["import type { ToolMessageRenderProps, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemHeaderAccessoryContext,\n StatusBadge,\n MessageItemStatus,\n PathText,\n type StatusTone,\n ViewableImage,\n} from '@agimon-ai/po-web-components';\nimport { memo, type ReactNode, useMemo } from 'react';\n\nimport { pluginToolRenderer } from '../../lib/pluginRegistry';\nimport { imagesFromContent, textFromContent, type ToolEntry } from '../../lib/sessionModel';\nimport { toolMessageProps } from '../../lib/toolMessageProps';\nimport { ToolRendererBoundary } from '../../lib/ToolRendererBoundary';\nimport { useImageRefs } from '../../stores/imageRefStore';\n\nconst MAX_PREVIEW_LINES = 12;\n\ntype AttachmentKind = 'image' | 'audio' | 'video' | 'pdf' | 'text' | 'file';\n\ninterface HostAttachment {\n kind: AttachmentKind;\n mimeType: string;\n name: string;\n data?: string;\n text?: string;\n uri?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction attachmentKind(mimeType: string): AttachmentKind {\n if (mimeType.startsWith('image/')) return 'image';\n if (mimeType.startsWith('audio/')) return 'audio';\n if (mimeType.startsWith('video/')) return 'video';\n if (mimeType === 'application/pdf') return 'pdf';\n if (mimeType.startsWith('text/')) return 'text';\n return 'file';\n}\n\nfunction attachmentName(block: Record<string, unknown>, index: number): string {\n for (const key of ['title', 'name', 'filename', 'fileName']) {\n if (typeof block[key] === 'string' && block[key].length > 0) return block[key];\n }\n if (typeof block.uri === 'string' && block.uri.length > 0) return block.uri.split('/').at(-1) || block.uri;\n return `attachment-${String(index + 1)}`;\n}\n\n/** Binary and linked result blocks a tool returned outside its ordinary text. */\nfunction hostAttachments(entry: ToolEntry): HostAttachment[] {\n const content = entry.result?.content ?? [];\n // An image sent by reference shows once its entry is read; until then it has no data to draw.\n const images = imagesFromContent(content).flatMap((image, index): HostAttachment[] =>\n image.data === undefined\n ? []\n : [\n {\n kind: 'image',\n mimeType: image.mimeType,\n name: `${entry.name}-result-${String(index + 1)}`,\n data: image.data,\n },\n ],\n );\n const details = isRecord(entry.result?.details) ? entry.result.details : undefined;\n const blocks = [...content, ...(Array.isArray(details?.blocks) ? details.blocks : [])];\n const other = blocks.flatMap((candidate, index): HostAttachment[] => {\n if (!isRecord(candidate) || candidate.type === 'text' || candidate.type === 'image') return [];\n const resource = candidate.type === 'resource' && isRecord(candidate.resource) ? candidate.resource : candidate;\n const mimeType = typeof resource.mimeType === 'string' ? resource.mimeType : 'application/octet-stream';\n const data =\n typeof resource.data === 'string' ? resource.data : typeof resource.blob === 'string' ? resource.blob : undefined;\n const text = typeof resource.text === 'string' ? resource.text : undefined;\n const uri = typeof resource.uri === 'string' ? resource.uri : undefined;\n if (data === undefined && text === undefined && uri === undefined) return [];\n return [{ kind: attachmentKind(mimeType), mimeType, name: attachmentName(resource, index), data, text, uri }];\n });\n return [...images, ...other];\n}\n\nfunction attachmentUrl(attachment: HostAttachment): string | undefined {\n if (attachment.data !== undefined) return `data:${attachment.mimeType};base64,${attachment.data}`;\n if (attachment.uri === undefined) return undefined;\n return /^(?:https?):\\/\\//u.test(attachment.uri) ? attachment.uri : undefined;\n}\n\nfunction HostAttachmentView({ attachment, index }: { attachment: HostAttachment; index: number }) {\n const url = attachmentUrl(attachment);\n if (attachment.kind === 'text' && attachment.text !== undefined) {\n return (\n <pre\n data-testid=\"tool-output-text-file\"\n className=\"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2\"\n >\n {attachment.text}\n </pre>\n );\n }\n if (url !== undefined && attachment.kind === 'image') {\n return (\n <ViewableImage\n src={url}\n alt={attachment.name}\n data-testid=\"tool-output-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n );\n }\n if (url !== undefined && attachment.kind === 'video') {\n return (\n <video\n src={url}\n controls\n preload=\"metadata\"\n data-testid=\"tool-output-video\"\n className=\"max-h-96 max-w-full self-start rounded-md border border-po-border-soft\"\n >\n <track kind=\"captions\" />\n </video>\n );\n }\n if (url !== undefined && attachment.kind === 'audio') {\n return (\n <audio src={url} controls preload=\"metadata\" data-testid=\"tool-output-audio\" className=\"w-full\">\n <track kind=\"captions\" />\n </audio>\n );\n }\n if (url !== undefined && attachment.kind === 'pdf') {\n return (\n <iframe\n src={url}\n title={attachment.name}\n data-testid=\"tool-output-pdf\"\n className=\"h-[480px] w-full rounded-md border border-po-border-soft bg-po-deep\"\n />\n );\n }\n return url !== undefined ? (\n <a\n href={url}\n download={attachment.name}\n target=\"_blank\"\n rel=\"noreferrer\"\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-po-blue hover:border-po-blue/60\"\n >\n {attachment.name} · {attachment.mimeType}\n </a>\n ) : (\n <span\n key={index}\n data-testid=\"tool-output-file\"\n className=\"self-start rounded-md border border-po-border px-3 py-2 text-base text-po-dim\"\n >\n {attachment.name} · {attachment.mimeType}\n </span>\n );\n}\n\nfunction toneOf(entry: ToolEntry): StatusTone {\n return entry.running ? 'running' : entry.isError ? 'error' : 'ok';\n}\n\n/**\n * The host's own item for a tool no plugin claims: the argument summary in\n * the header and the result's text and safe browser previews, with long text\n * clipped until expanded, on the same shell every plugin message is built from.\n */\nfunction HostToolMessage({ entry, slotProps }: { entry: ToolEntry; slotProps: WebPluginSlotProps }) {\n const lines = entry.output.length > 0 ? entry.output.split('\\n') : [];\n const attachments = hostAttachments(entry);\n return (\n <MessageItem tone={toneOf(entry)} expandable={lines.length > MAX_PREVIEW_LINES}>\n {({ expanded }) => {\n const { shown, hidden } = collapseLines(lines, MAX_PREVIEW_LINES, expanded);\n return (\n <>\n <MessageItemHeader title={entry.name}>\n <span className=\"min-w-0 flex-1 truncate\">{entry.argSummary}</span>\n </MessageItemHeader>\n {shown.length > 0 || attachments.length > 0 ? (\n <MessageItemBody className=\"flex flex-col gap-2\">\n {shown.length > 0 ? (\n <pre data-testid=\"tool-output\" className=\"whitespace-pre-wrap break-words\">\n <PathText\n text={shown.join('\\n')}\n onFileLink={(path) => {\n const tab = slotProps.fileTabFor(path);\n return tab && (() => slotProps.openTransientTab(tab));\n }}\n />\n </pre>\n ) : null}\n {attachments.map((attachment, index) => (\n <HostAttachmentView\n key={`${attachment.mimeType}:${attachment.name}:${String(index)}`}\n attachment={attachment}\n index={index}\n />\n ))}\n {hidden > 0 ? <MessageItemStatus expands>show {hidden} more line(s)</MessageItemStatus> : null}\n </MessageItemBody>\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n\n/**\n * Another tool's own card for a call made on its behalf, with the call's recorded args and result. Null when no\n * plugin claims the tool. It gets no `renderTool` itself, so a card inside a card cannot nest further.\n */\nexport function nestedToolCard(\n parent: ToolEntry,\n call: Parameters<NonNullable<ToolMessageRenderProps['renderTool']>>[0],\n slotProps: WebPluginSlotProps,\n statuses: Readonly<Record<string, string>>,\n): ReactNode {\n const renderer = pluginToolRenderer(call.toolName, statuses, call.result?.details);\n if (!renderer) return null;\n const props: ToolMessageRenderProps = {\n ...slotProps,\n toolCallId: `${parent.toolCallId}:${call.toolName}`,\n toolName: call.toolName,\n args: call.args,\n statuses,\n result: call.result,\n output: textFromContent(call.result?.content),\n running: false,\n isError: call.isError,\n };\n return (\n <ToolRendererBoundary toolName={call.toolName}>\n {(failed) =>\n failed ? (\n <pre className=\"whitespace-pre-wrap break-words text-sm\">{props.output}</pre>\n ) : (\n <renderer.message {...props} />\n )\n }\n </ToolRendererBoundary>\n );\n}\n\n/**\n * One tool call in the timeline. The plugin that registered the tool owns\n * the whole item through its `message` renderer, the web half of the TUI's\n * renderShell 'self'; the host only marks the row, catches a renderer that\n * throws, and stands in for a tool nobody claims.\n */\nexport const ToolCard = memo(function ToolCard({\n entry: shown,\n slotProps,\n statuses,\n}: {\n entry: ToolEntry;\n slotProps: WebPluginSlotProps;\n statuses: Readonly<Record<string, string>>;\n}) {\n // Renderers read result images inline, so one the transcript sent by reference is filled in once read.\n const result = useImageRefs(shown.result);\n const entry = useMemo(() => (result === shown.result ? shown : { ...shown, result }), [shown, result]);\n const renderer = pluginToolRenderer(entry.name, statuses, entry.result?.details);\n const state = toneOf(entry);\n const props: ToolMessageRenderProps = {\n ...toolMessageProps(slotProps, entry, statuses),\n renderTool: (call) => nestedToolCard(entry, call, slotProps, statuses),\n };\n // ponytail: mirrors po-hook's status key; share a constant if another consumer needs it.\n const hookStatus = statuses[`repository-hooks:${entry.toolCallId}:post`]?.trim();\n const hookBadge = hookStatus ? (\n <StatusBadge tone=\"running\" title={hookStatus} aria-label={hookStatus} data-testid=\"tool-hook-status\">\n HOOK\n </StatusBadge>\n ) : null;\n return (\n <ToolRendererBoundary key={entry.toolCallId} toolName={entry.name}>\n {(failed) => (\n <div\n data-testid=\"entry-tool\"\n data-tool-name={entry.name}\n data-tool-state={state}\n data-tool-renderer={failed ? 'failed' : renderer ? 'plugin' : 'host'}\n >\n <MessageItemHeaderAccessoryContext value={hookBadge}>\n {renderer && !failed ? (\n <renderer.message {...props} />\n ) : (\n <HostToolMessage entry={entry} slotProps={slotProps} />\n )}\n </MessageItemHeaderAccessoryContext>\n </div>\n )}\n </ToolRendererBoundary>\n );\n});\n"],"mappings":";;;;;;;;;AAqBA,MAAM,oBAAoB;AAa1B,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,eAAe,UAAkC;CACxD,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,SAAS,WAAW,QAAQ,GAAG,OAAO;CAC1C,IAAI,aAAa,mBAAmB,OAAO;CAC3C,IAAI,SAAS,WAAW,OAAO,GAAG,OAAO;CACzC,OAAO;AACT;AAEA,SAAS,eAAe,OAAgC,OAAuB;CAC7E,KAAK,MAAM,OAAO;EAAC;EAAS;EAAQ;EAAY;CAAU,GACxD,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,IAAI,CAAC,SAAS,GAAG,OAAO,MAAM;CAE5E,IAAI,OAAO,MAAM,QAAQ,YAAY,MAAM,IAAI,SAAS,GA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AmB,UAAA;CAEzF,CAAA,IACX;CACJ,OACE,oBAAC,sBAAD;EAA6C,UAAU,MAAM;EACzD,WAAA,WACA,oBAAC,OAAD;GACE,eAAY;GACZ,kBAAgB,MAAM;GACtB,mBAAiB;GACjB,sBAAoB,SAAS,WAAW,WAAW,WAAW;GAE9D,UAAA,oBAAC,mCAAD;IAAmC,OAAO;IACvC,UAAA,YAAY,CAAC,SACZ,oBAAC,SAAS,SAAV,EAAkB,GAAI,MAAQ,CAAA,IAE9B,oBAAC,iBAAD;KAAwB;KAAkB;IAAY,CAAA;GAEvB,CAAA;EAChC,CAAA;CAEa,GAjBK,MAAM,UAiBX;AAE1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-web-dashboard",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.70",
|
|
4
4
|
"description": "Shared browser state, actions and optional views for Po dashboard templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
65
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
66
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
64
|
+
"@agimon-ai/po-core": "0.0.0-alpha.70",
|
|
65
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.70",
|
|
66
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.70",
|
|
67
67
|
"@earendil-works/chord": "1.4.0",
|
|
68
68
|
"@simplewebauthn/browser": "^14.0.0",
|
|
69
69
|
"@tanstack/react-router": "1.170.45",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"qrcode-generator": "^2.0.4"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.
|
|
76
|
+
"@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.70",
|
|
77
77
|
"@types/node": "26.6.5",
|
|
78
78
|
"@types/react": "19.3.0",
|
|
79
79
|
"@types/react-dom": "19.3.0",
|