@agimon-ai/po-ui 0.0.0-alpha.29 → 0.0.0-alpha.30
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/extensions/web.mjs +11 -17
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{index-2GW2dj0I.d.mts → index-DJvl27YF.d.mts} +2 -2
- package/dist/{index-2GW2dj0I.d.mts.map → index-DJvl27YF.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/logSinkTelemetry.cjs +1 -1
- package/dist/logSinkTelemetry.d.mts +1 -1
- package/dist/logSinkTelemetry.mjs +1 -1
- package/dist/{telemetry-RiFqd0cg.mjs → telemetry-BvCR35jo.mjs} +2 -2
- package/dist/telemetry-BvCR35jo.mjs.map +1 -0
- package/dist/{telemetry-EXlQc9s0.cjs → telemetry-DZXeC4kO.cjs} +3 -3
- package/dist/telemetry-DZXeC4kO.cjs.map +1 -0
- package/package.json +10 -11
- package/dist/telemetry-EXlQc9s0.cjs.map +0 -1
- package/dist/telemetry-RiFqd0cg.mjs.map +0 -1
package/dist/extensions/web.mjs
CHANGED
|
@@ -135,11 +135,6 @@ function ListingBody({ tool, limitKey, limitUnit, expanded, props }) {
|
|
|
135
135
|
]
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */
|
|
139
|
-
function listingExpandable(props, limitKey, limitUnit) {
|
|
140
|
-
if (props.result === null || props.isError) return false;
|
|
141
|
-
return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;
|
|
142
|
-
}
|
|
143
138
|
//#endregion
|
|
144
139
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx
|
|
145
140
|
const LIMIT_KEY$1 = "resultLimitReached";
|
|
@@ -152,7 +147,7 @@ function FindToolMessage(props) {
|
|
|
152
147
|
running: props.running,
|
|
153
148
|
isError: props.isError
|
|
154
149
|
}),
|
|
155
|
-
expandable:
|
|
150
|
+
expandable: true,
|
|
156
151
|
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
157
152
|
title: "find",
|
|
158
153
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -166,13 +161,13 @@ function FindToolMessage(props) {
|
|
|
166
161
|
children: ["· ", view.details.join(" · ")]
|
|
167
162
|
}) : null]
|
|
168
163
|
})
|
|
169
|
-
}), /* @__PURE__ */ jsx(ListingBody, {
|
|
164
|
+
}), expanded ? /* @__PURE__ */ jsx(ListingBody, {
|
|
170
165
|
tool: "find",
|
|
171
166
|
limitKey: LIMIT_KEY$1,
|
|
172
167
|
limitUnit: LIMIT_UNIT$1,
|
|
173
|
-
expanded,
|
|
168
|
+
expanded: true,
|
|
174
169
|
props
|
|
175
|
-
})] })
|
|
170
|
+
}) : null] })
|
|
176
171
|
});
|
|
177
172
|
}
|
|
178
173
|
//#endregion
|
|
@@ -190,7 +185,7 @@ function LsToolMessage(props) {
|
|
|
190
185
|
running: props.running,
|
|
191
186
|
isError: props.isError
|
|
192
187
|
}),
|
|
193
|
-
expandable:
|
|
188
|
+
expandable: true,
|
|
194
189
|
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
195
190
|
title: "ls",
|
|
196
191
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -204,13 +199,13 @@ function LsToolMessage(props) {
|
|
|
204
199
|
children: ["· ", view.details.join(" · ")]
|
|
205
200
|
}) : null]
|
|
206
201
|
})
|
|
207
|
-
}), /* @__PURE__ */ jsx(ListingBody, {
|
|
202
|
+
}), expanded ? /* @__PURE__ */ jsx(ListingBody, {
|
|
208
203
|
tool: "ls",
|
|
209
204
|
limitKey: LIMIT_KEY,
|
|
210
205
|
limitUnit: LIMIT_UNIT,
|
|
211
|
-
expanded,
|
|
206
|
+
expanded: true,
|
|
212
207
|
props
|
|
213
|
-
})] })
|
|
208
|
+
}) : null] })
|
|
214
209
|
});
|
|
215
210
|
}
|
|
216
211
|
//#endregion
|
|
@@ -242,8 +237,7 @@ function WritePreview({ view, path }) {
|
|
|
242
237
|
}
|
|
243
238
|
/**
|
|
244
239
|
* The write tool's timeline item: `path · N chars` in the header. Pi's write
|
|
245
|
-
* result is silent on success, so
|
|
246
|
-
* TUI folds into its call: ten lines, or all of them once the item expands.
|
|
240
|
+
* result is silent on success, so expanding shows the numbered file content.
|
|
247
241
|
* A failure shows the tool's message in red instead.
|
|
248
242
|
*/
|
|
249
243
|
function WriteToolMessage({ args, result, output, running, isError, fileTabFor, openTransientTab }) {
|
|
@@ -254,7 +248,7 @@ function WriteToolMessage({ args, result, output, running, isError, fileTabFor,
|
|
|
254
248
|
running,
|
|
255
249
|
isError
|
|
256
250
|
}),
|
|
257
|
-
expandable:
|
|
251
|
+
expandable: true,
|
|
258
252
|
children: ({ expanded }) => {
|
|
259
253
|
const view = expanded ? writeCallView(args, true) : collapsed;
|
|
260
254
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
@@ -270,7 +264,7 @@ function WriteToolMessage({ args, result, output, running, isError, fileTabFor,
|
|
|
270
264
|
children: ["· ", view.size]
|
|
271
265
|
})]
|
|
272
266
|
})
|
|
273
|
-
}), isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
267
|
+
}), !expanded ? null : isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
274
268
|
"data-testid": "tool-result-write",
|
|
275
269
|
className: "flex flex-col",
|
|
276
270
|
children: [/* @__PURE__ */ jsx(MessageItemStatus, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":["LIMIT_KEY","LIMIT_UNIT","toolFind","toolLs","toolWrite"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/builtinToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ListingBody.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/find.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/LsToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WriteToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** The TUI's collapsed budgets: ten preview lines for a write, twenty for a listing. */\nexport const WRITE_COLLAPSED_LINES = 10;\nexport const LIST_COLLAPSED_LINES = 20;\n/** Pi's default output cap, the size its truncation warning names when details omit one. */\nconst DEFAULT_MAX_BYTES = 50 * 1024;\nconst KIBIBYTE = 1024;\n\nexport interface NumberedLine {\n readonly number: number;\n readonly text: string;\n}\n\nexport interface WriteCallView {\n readonly path: string;\n /** `N chars`, the size the TUI's call heading shows. */\n readonly size: string;\n readonly preview: readonly NumberedLine[];\n readonly hidden: number;\n /** Widest shown line number, in characters. */\n readonly gutter: number;\n}\n\nexport interface SearchCallView {\n readonly primary: string;\n readonly details: readonly string[];\n}\n\nexport interface ListResultView {\n readonly lines: readonly string[];\n readonly hidden: number;\n /** Pi's `[Truncated: ...]` warning, when the listing hit a limit. */\n readonly truncated: string | undefined;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nfunction optionalCount(value: unknown, unit: string): string | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? `${value} ${unit}` : undefined;\n}\n\nfunction pathOrDot(value: unknown): string {\n return typeof value === 'string' && value.length > 0 ? value : '.';\n}\n\n/** Pi's size formatter, so the web warning names the same figure the TUI does. */\nexport function formatSize(bytes: number): string {\n if (bytes < KIBIBYTE) return `${bytes}B`;\n if (bytes < KIBIBYTE * KIBIBYTE) return `${(bytes / KIBIBYTE).toFixed(1)}KB`;\n return `${(bytes / (KIBIBYTE * KIBIBYTE)).toFixed(1)}MB`;\n}\n\n/** What the write call shows: the path, the content size, and a numbered preview of the file. */\nexport function writeCallView(args: Readonly<Record<string, unknown>>, expanded: boolean): WriteCallView {\n const content = typeof args.content === 'string' ? args.content : '';\n const path = typeof args.path === 'string' ? args.path : '';\n const size = `${content.length.toLocaleString('en-US')} chars`;\n if (content.length === 0) return { path, size, preview: [], hidden: 0, gutter: 1 };\n const lines = content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n const visible = expanded ? lines : lines.slice(0, WRITE_COLLAPSED_LINES);\n const preview = visible.map((text, index) => ({ number: index + 1, text }));\n return { path, size, preview, hidden: lines.length - visible.length, gutter: String(visible.length).length };\n}\n\n/** `pattern · path · N results`, as the find call heading lists them. */\nexport function findCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return {\n primary: typeof args.pattern === 'string' ? args.pattern : '',\n details: compactDetails([pathOrDot(args.path), optionalCount(args.limit, 'results')]),\n };\n}\n\n/** `path · N entries`, as the ls call heading lists them. */\nexport function lsCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return { primary: pathOrDot(args.path), details: compactDetails([optionalCount(args.limit, 'entries')]) };\n}\n\n/** The result's text, from its blocks when the view exists and from the joined output otherwise. */\nexport function resultText(result: ToolResultView | null, output: string): string {\n if (result === null) return output;\n return result.content\n .flatMap((block) => {\n const record = typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n}\n\n/**\n * A find or ls listing the way Pi's own renderer shows it: the lines,\n * collapsed to twenty, and the limit warning its details carry. `limitKey`\n * names the per-tool counter (resultLimitReached, entryLimitReached).\n */\nexport function listResultView(\n result: ToolResultView | null,\n output: string,\n expanded: boolean,\n limitKey: string,\n limitUnit: string,\n): ListResultView {\n const text = resultText(result, output).trim();\n const all = text.length === 0 ? [] : text.split('\\n');\n const lines = expanded ? all : all.slice(0, LIST_COLLAPSED_LINES);\n const details =\n typeof result?.details === 'object' && result.details !== null ? (result.details as Record<string, unknown>) : {};\n const limit = details[limitKey];\n const truncation =\n typeof details.truncation === 'object' && details.truncation !== null\n ? (details.truncation as Record<string, unknown>)\n : undefined;\n const warnings: string[] = [];\n if (typeof limit === 'number' && limit > 0) warnings.push(`${limit} ${limitUnit} limit`);\n if (truncation?.truncated === true) {\n warnings.push(\n `${formatSize(typeof truncation.maxBytes === 'number' ? truncation.maxBytes : DEFAULT_MAX_BYTES)} limit`,\n );\n }\n return {\n lines,\n hidden: all.length - lines.length,\n truncated: warnings.length > 0 ? `[Truncated: ${warnings.join(', ')}]` : undefined,\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItemBody, MessageItemStatus } from '@agimon-ai/po-web-components';\n\nimport { listResultView, resultText } from '../_lib/builtinToolView';\n\n/**\n * The body shared by find and ls: Pi's listing lines, collapsed to twenty\n * until the item expands, with the limit warning its details carry.\n */\nexport function ListingBody({\n tool,\n limitKey,\n limitUnit,\n expanded,\n props,\n}: {\n tool: string;\n limitKey: string;\n limitUnit: string;\n expanded: boolean;\n props: ToolMessageRenderProps;\n}) {\n const { result, output, running, isError } = props;\n if (isError) {\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n );\n }\n if (result === null) {\n return running ? (\n <MessageItemBody data-testid={`tool-result-${tool}`}>\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null;\n }\n const view = listResultView(result, output, expanded, limitKey, limitUnit);\n if (view.lines.length === 0 && view.truncated === undefined) return null;\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col font-mono\">\n {view.lines.map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-text\">\n {line}\n </span>\n ))}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {view.truncated !== undefined ? <span className=\"text-po-yellow\">{view.truncated}</span> : null}\n </MessageItemBody>\n );\n}\n\n/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */\nexport function listingExpandable(props: ToolMessageRenderProps, limitKey: string, limitUnit: string): boolean {\n if (props.result === null || props.isError) return false;\n return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { findCallView } from '../_lib/builtinToolView';\nimport { ListingBody, listingExpandable } from './ListingBody';\n\nconst LIMIT_KEY = 'resultLimitReached';\nconst LIMIT_UNIT = 'results';\n\n/** The find tool's timeline item: `pattern · path · N results` over Pi's listing lines. */\nexport function FindToolMessage(props: ToolMessageRenderProps) {\n const view = findCallView(props.args);\n return (\n <MessageItem\n tone={toolTone({ running: props.running, isError: props.isError })}\n expandable={listingExpandable(props, LIMIT_KEY, LIMIT_UNIT)}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"find\">\n <span data-testid=\"tool-call-find\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n <ListingBody tool=\"find\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded={expanded} props={props} />\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { FindToolMessage } from './_components/FindToolMessage';\n\nexport default defineToolRenderer({ message: FindToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { lsCallView } from '../_lib/builtinToolView';\nimport { ListingBody, listingExpandable } from './ListingBody';\n\nconst LIMIT_KEY = 'entryLimitReached';\nconst LIMIT_UNIT = 'entries';\n\n/** The ls tool's timeline item: `path · N entries` over Pi's listing lines. */\nexport function LsToolMessage(props: ToolMessageRenderProps) {\n const view = lsCallView(props.args);\n return (\n <MessageItem\n tone={toolTone({ running: props.running, isError: props.isError })}\n expandable={listingExpandable(props, LIMIT_KEY, LIMIT_UNIT)}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"ls\">\n <span data-testid=\"tool-call-ls\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n <ListingBody tool=\"ls\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded={expanded} props={props} />\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { LsToolMessage } from './_components/LsToolMessage';\n\nexport default defineToolRenderer({ message: LsToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { resultText, type WriteCallView, writeCallView } from '../_lib/builtinToolView';\n\n/**\n * The numbered preview, coloured as the file it is about to become.\n *\n * Its own component so the highlighting hook has somewhere to live: the body\n * around it is picked inside a render prop. The preview is a prefix of the\n * content, so it parses as the file it came from up to wherever it was cut.\n */\nfunction WritePreview({ view, path }: { view: WriteCallView; path: string }) {\n const spans = useSyntaxLines(view.preview.map((line) => line.text).join('\\n'), { path });\n return (\n <>\n {view.preview.map((line, index) => (\n <span key={line.number} className=\"flex gap-2\">\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(view.gutter)}ch` }}>\n {line.number}\n </span>\n <SyntaxLine\n spans={spans?.[index]}\n text={line.text}\n className=\"min-w-0 whitespace-pre-wrap break-words text-po-text\"\n />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The write tool's timeline item: `path · N chars` in the header. Pi's write\n * result is silent on success, so the body shows the numbered preview the\n * TUI folds into its call: ten lines, or all of them once the item expands.\n * A failure shows the tool's message in red instead.\n */\nexport function WriteToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const collapsed = writeCallView(args, false);\n // The header names a file the tool is writing, so the reader can open it\n // rather than hunt for it; nothing installed to show files leaves it as text.\n const tab = fileTabFor(collapsed.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={collapsed.hidden > 0}>\n {({ expanded }) => {\n const view = expanded ? writeCallView(args, true) : collapsed;\n return (\n <>\n <MessageItemHeader title=\"write\">\n <span data-testid=\"tool-call-write\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink\n path={view.path}\n {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })}\n />\n <span className=\"shrink-0 text-po-faint\">· {view.size}</span>\n </span>\n </MessageItemHeader>\n {isError ? (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n ) : view.preview.length === 0 ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-write\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col font-mono\">\n <WritePreview view={view} path={view.path} />\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n </MessageItemBody>\n )}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { WriteToolMessage } from './_components/WriteToolMessage';\n\nexport default defineToolRenderer({ message: WriteToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolFind from '../src/extensions/workspaces/sessions/(frontend)/tool/find.web';\nimport toolLs from '../src/extensions/workspaces/sessions/(frontend)/tool/ls.web';\nimport toolWrite from '../src/extensions/workspaces/sessions/(frontend)/tool/write.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'builtin-tools',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['find'] }, toolFind), via({ tools: ['ls'] }, toolLs), via({ tools: ['write'] }, toolWrite)]; },\n },\n});\n"],"mappings":";;;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,WAAW;AA6BjB,SAAS,eAAe,QAAqD;CAC3E,OAAO,OAAO,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;AAC1F;AAEA,SAAS,cAAc,OAAgB,MAAkC;CACvE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,KAAA;AACpF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AACjE;;AAGA,SAAgB,WAAW,OAAuB;CAChD,IAAI,QAAQ,UAAU,OAAO,GAAG,MAAM;CACtC,IAAI,QAAQ,WAAW,UAAU,OA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workspaces/sessions/(frontend)/tool/_lib/builtinToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ListingBody.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/FindToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/find.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/LsToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/ls.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WriteToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/write.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** The TUI's collapsed budgets: ten preview lines for a write, twenty for a listing. */\nexport const WRITE_COLLAPSED_LINES = 10;\nexport const LIST_COLLAPSED_LINES = 20;\n/** Pi's default output cap, the size its truncation warning names when details omit one. */\nconst DEFAULT_MAX_BYTES = 50 * 1024;\nconst KIBIBYTE = 1024;\n\nexport interface NumberedLine {\n readonly number: number;\n readonly text: string;\n}\n\nexport interface WriteCallView {\n readonly path: string;\n /** `N chars`, the size the TUI's call heading shows. */\n readonly size: string;\n readonly preview: readonly NumberedLine[];\n readonly hidden: number;\n /** Widest shown line number, in characters. */\n readonly gutter: number;\n}\n\nexport interface SearchCallView {\n readonly primary: string;\n readonly details: readonly string[];\n}\n\nexport interface ListResultView {\n readonly lines: readonly string[];\n readonly hidden: number;\n /** Pi's `[Truncated: ...]` warning, when the listing hit a limit. */\n readonly truncated: string | undefined;\n}\n\nfunction compactDetails(values: ReadonlyArray<string | undefined>): string[] {\n return values.filter((value): value is string => value !== undefined && value.length > 0);\n}\n\nfunction optionalCount(value: unknown, unit: string): string | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? `${value} ${unit}` : undefined;\n}\n\nfunction pathOrDot(value: unknown): string {\n return typeof value === 'string' && value.length > 0 ? value : '.';\n}\n\n/** Pi's size formatter, so the web warning names the same figure the TUI does. */\nexport function formatSize(bytes: number): string {\n if (bytes < KIBIBYTE) return `${bytes}B`;\n if (bytes < KIBIBYTE * KIBIBYTE) return `${(bytes / KIBIBYTE).toFixed(1)}KB`;\n return `${(bytes / (KIBIBYTE * KIBIBYTE)).toFixed(1)}MB`;\n}\n\n/** What the write call shows: the path, the content size, and a numbered preview of the file. */\nexport function writeCallView(args: Readonly<Record<string, unknown>>, expanded: boolean): WriteCallView {\n const content = typeof args.content === 'string' ? args.content : '';\n const path = typeof args.path === 'string' ? args.path : '';\n const size = `${content.length.toLocaleString('en-US')} chars`;\n if (content.length === 0) return { path, size, preview: [], hidden: 0, gutter: 1 };\n const lines = content.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n const visible = expanded ? lines : lines.slice(0, WRITE_COLLAPSED_LINES);\n const preview = visible.map((text, index) => ({ number: index + 1, text }));\n return { path, size, preview, hidden: lines.length - visible.length, gutter: String(visible.length).length };\n}\n\n/** `pattern · path · N results`, as the find call heading lists them. */\nexport function findCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return {\n primary: typeof args.pattern === 'string' ? args.pattern : '',\n details: compactDetails([pathOrDot(args.path), optionalCount(args.limit, 'results')]),\n };\n}\n\n/** `path · N entries`, as the ls call heading lists them. */\nexport function lsCallView(args: Readonly<Record<string, unknown>>): SearchCallView {\n return { primary: pathOrDot(args.path), details: compactDetails([optionalCount(args.limit, 'entries')]) };\n}\n\n/** The result's text, from its blocks when the view exists and from the joined output otherwise. */\nexport function resultText(result: ToolResultView | null, output: string): string {\n if (result === null) return output;\n return result.content\n .flatMap((block) => {\n const record = typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n}\n\n/**\n * A find or ls listing the way Pi's own renderer shows it: the lines,\n * collapsed to twenty, and the limit warning its details carry. `limitKey`\n * names the per-tool counter (resultLimitReached, entryLimitReached).\n */\nexport function listResultView(\n result: ToolResultView | null,\n output: string,\n expanded: boolean,\n limitKey: string,\n limitUnit: string,\n): ListResultView {\n const text = resultText(result, output).trim();\n const all = text.length === 0 ? [] : text.split('\\n');\n const lines = expanded ? all : all.slice(0, LIST_COLLAPSED_LINES);\n const details =\n typeof result?.details === 'object' && result.details !== null ? (result.details as Record<string, unknown>) : {};\n const limit = details[limitKey];\n const truncation =\n typeof details.truncation === 'object' && details.truncation !== null\n ? (details.truncation as Record<string, unknown>)\n : undefined;\n const warnings: string[] = [];\n if (typeof limit === 'number' && limit > 0) warnings.push(`${limit} ${limitUnit} limit`);\n if (truncation?.truncated === true) {\n warnings.push(\n `${formatSize(typeof truncation.maxBytes === 'number' ? truncation.maxBytes : DEFAULT_MAX_BYTES)} limit`,\n );\n }\n return {\n lines,\n hidden: all.length - lines.length,\n truncated: warnings.length > 0 ? `[Truncated: ${warnings.join(', ')}]` : undefined,\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItemBody, MessageItemStatus } from '@agimon-ai/po-web-components';\n\nimport { listResultView, resultText } from '../_lib/builtinToolView';\n\n/**\n * The body shared by find and ls: Pi's listing lines, collapsed to twenty\n * until the item expands, with the limit warning its details carry.\n */\nexport function ListingBody({\n tool,\n limitKey,\n limitUnit,\n expanded,\n props,\n}: {\n tool: string;\n limitKey: string;\n limitUnit: string;\n expanded: boolean;\n props: ToolMessageRenderProps;\n}) {\n const { result, output, running, isError } = props;\n if (isError) {\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n );\n }\n if (result === null) {\n return running ? (\n <MessageItemBody data-testid={`tool-result-${tool}`}>\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null;\n }\n const view = listResultView(result, output, expanded, limitKey, limitUnit);\n if (view.lines.length === 0 && view.truncated === undefined) return null;\n return (\n <MessageItemBody data-testid={`tool-result-${tool}`} className=\"flex flex-col font-mono\">\n {view.lines.map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-text\">\n {line}\n </span>\n ))}\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {view.truncated !== undefined ? <span className=\"text-po-yellow\">{view.truncated}</span> : null}\n </MessageItemBody>\n );\n}\n\n/** Whether the listing hides lines while collapsed, so the item can offer its toggle. */\nexport function listingExpandable(props: ToolMessageRenderProps, limitKey: string, limitUnit: string): boolean {\n if (props.result === null || props.isError) return false;\n return listResultView(props.result, props.output, false, limitKey, limitUnit).hidden > 0;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { findCallView } from '../_lib/builtinToolView';\nimport { ListingBody } from './ListingBody';\n\nconst LIMIT_KEY = 'resultLimitReached';\nconst LIMIT_UNIT = 'results';\n\n/** The find tool's timeline item: `pattern · path · N results` over Pi's listing lines. */\nexport function FindToolMessage(props: ToolMessageRenderProps) {\n const view = findCallView(props.args);\n return (\n <MessageItem tone={toolTone({ running: props.running, isError: props.isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"find\">\n <span data-testid=\"tool-call-find\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n {expanded ? (\n <ListingBody tool=\"find\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded props={props} />\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { FindToolMessage } from './_components/FindToolMessage';\n\nexport default defineToolRenderer({ message: FindToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemHeader, toolTone } from '@agimon-ai/po-web-components';\n\nimport { lsCallView } from '../_lib/builtinToolView';\nimport { ListingBody } from './ListingBody';\n\nconst LIMIT_KEY = 'entryLimitReached';\nconst LIMIT_UNIT = 'entries';\n\n/** The ls tool's timeline item: `path · N entries` over Pi's listing lines. */\nexport function LsToolMessage(props: ToolMessageRenderProps) {\n const view = lsCallView(props.args);\n return (\n <MessageItem tone={toolTone({ running: props.running, isError: props.isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"ls\">\n <span data-testid=\"tool-call-ls\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.primary}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n {expanded ? (\n <ListingBody tool=\"ls\" limitKey={LIMIT_KEY} limitUnit={LIMIT_UNIT} expanded props={props} />\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { LsToolMessage } from './_components/LsToolMessage';\n\nexport default defineToolRenderer({ message: LsToolMessage });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { resultText, type WriteCallView, writeCallView } from '../_lib/builtinToolView';\n\n/**\n * The numbered preview, coloured as the file it is about to become.\n *\n * Its own component so the highlighting hook has somewhere to live: the body\n * around it is picked inside a render prop. The preview is a prefix of the\n * content, so it parses as the file it came from up to wherever it was cut.\n */\nfunction WritePreview({ view, path }: { view: WriteCallView; path: string }) {\n const spans = useSyntaxLines(view.preview.map((line) => line.text).join('\\n'), { path });\n return (\n <>\n {view.preview.map((line, index) => (\n <span key={line.number} className=\"flex gap-2\">\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(view.gutter)}ch` }}>\n {line.number}\n </span>\n <SyntaxLine\n spans={spans?.[index]}\n text={line.text}\n className=\"min-w-0 whitespace-pre-wrap break-words text-po-text\"\n />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The write tool's timeline item: `path · N chars` in the header. Pi's write\n * result is silent on success, so expanding shows the numbered file content.\n * A failure shows the tool's message in red instead.\n */\nexport function WriteToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const collapsed = writeCallView(args, false);\n // The header names a file the tool is writing, so the reader can open it\n // rather than hunt for it; nothing installed to show files leaves it as text.\n const tab = fileTabFor(collapsed.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable>\n {({ expanded }) => {\n const view = expanded ? writeCallView(args, true) : collapsed;\n return (\n <>\n <MessageItemHeader title=\"write\">\n <span data-testid=\"tool-call-write\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink\n path={view.path}\n {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })}\n />\n <span className=\"shrink-0 text-po-faint\">· {view.size}</span>\n </span>\n </MessageItemHeader>\n {!expanded ? null : isError ? (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n <span className=\"whitespace-pre-wrap break-words text-po-red\">{resultText(result, output)}</span>\n </MessageItemBody>\n ) : view.preview.length === 0 ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-write\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody data-testid=\"tool-result-write\" className=\"flex flex-col font-mono\">\n <WritePreview view={view} path={view.path} />\n {view.hidden > 0 ? <MessageItemStatus expands>{view.hidden} more lines</MessageItemStatus> : null}\n {running ? <MessageItemStatus tone=\"running\">running</MessageItemStatus> : null}\n </MessageItemBody>\n )}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { WriteToolMessage } from './_components/WriteToolMessage';\n\nexport default defineToolRenderer({ message: WriteToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolFind from '../src/extensions/workspaces/sessions/(frontend)/tool/find.web';\nimport toolLs from '../src/extensions/workspaces/sessions/(frontend)/tool/ls.web';\nimport toolWrite from '../src/extensions/workspaces/sessions/(frontend)/tool/write.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'builtin-tools',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['find'] }, toolFind), via({ tools: ['ls'] }, toolLs), via({ tools: ['write'] }, toolWrite)]; },\n },\n});\n"],"mappings":";;;;AAMA,MAAM,oBAAoB;AAC1B,MAAM,WAAW;AA6BjB,SAAS,eAAe,QAAqD;CAC3E,OAAO,OAAO,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;AAC1F;AAEA,SAAS,cAAc,OAAgB,MAAkC;CACvE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,KAAA;AACpF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AACjE;;AAGA,SAAgB,WAAW,OAAuB;CAChD,IAAI,QAAQ,UAAU,OAAO,GAAG,MAAM;CACtC,IAAI,QAAQ,WAAW,UAAU,OAAO,IAAI,QAAQ,SAAA,CAAU,QAAQ,CAAC,EAAE;CACzE,OAAO,IAAI,SAAS,WAAW,UAAA,CAAW,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B,MAAK;KAAU,UAAA;IAA0B,CAAA;GAC7C,CAAA,IACf,OAEJ,qBAAC,iBAAD;IAAiB,eAAY;IAAoB,WAAU;IAA3D,UAAA;KACE,oBAAC,cAAD;MAAoB;MAAM,MAAM,KAAK;KAAO,CAAA;KAC3C,KAAK,SAAS,IAAI,qBAAC,mBAAD;MAAmB,SAAA;MAAnB,UAAA,CAA4B,KAAK,QAAO,aAA8B;KAAI,CAAA,IAAA;KAC5F,UAAU,oBAAC,mBAAD;MAAmB,MAAK;MAAU,UAAA;KAA0B,CAAA,IAAI;IAC5D;GAEnB,CAAA,CAAA,EAAA,CAAA;EAEN;CACW,CAAA;AAEjB;;;AC7FA,IAAA,oBAAe,mBAAmB,EAAE,SAAS,iBAAiB,CAAC;;;ACG/D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO;GAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGC,gBAAQ;GAAG,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAGC,cAAM;GAAG,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAGC,iBAAS;EAAC;CAAG,EACpL;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PoTelemetryOptions } from "@agimon-ai/po-telemetry";
|
|
1
|
+
import { PoTelemetryOptions } from "@agimon-ai/po-core/telemetry";
|
|
2
2
|
//#region src/services/telemetry/index.d.ts
|
|
3
3
|
declare const UI_EVENT: {
|
|
4
4
|
readonly leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected';
|
|
@@ -27,4 +27,4 @@ interface UiTelemetry {
|
|
|
27
27
|
declare function createUiTelemetry(options?: UiTelemetryOptions): UiTelemetry;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { UiTelemetryOptions as a, UiTelemetry as i, UiEventAttributes as n, createUiTelemetry as o, UiEventName as r, UI_EVENT as t };
|
|
30
|
-
//# sourceMappingURL=index-
|
|
30
|
+
//# sourceMappingURL=index-DJvl27YF.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DJvl27YF.d.mts","names":[],"sources":["../src/services/telemetry/index.ts"],"mappings":";;cAKa;WACX;WACA;WACA;WACA;WACA;WACA;;KAGU,sBAAsB,uBAAuB;KAC7C,oBAAoB;UAEf;EACf;EACA;EACA,MAAM,OAAO;EACb,mBAAmB,YAAY;EAC/B,QAAQ;;UAGO;EACf,YAAY,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACjF,cAAc,OAAO,aAAa,gBAAgB,aAAa,oBAAoB;EACnF,YAAY,OAAO,aAAa,aAAa,oBAAoB;EACjE,SAAS;EACT,YAAY;;iBAGE,kBAAkB,UAAS,qBAA0B"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_harnessMetadata = require("./harnessMetadata-B3mBGrS3.cjs");
|
|
3
|
-
const require_telemetry = require("./telemetry-
|
|
3
|
+
const require_telemetry = require("./telemetry-DZXeC4kO.cjs");
|
|
4
4
|
const require_uiState = require("./uiState-CCytmxyX.cjs");
|
|
5
5
|
const require_theme = require("./theme-BfC_GGQ4.cjs");
|
|
6
6
|
exports.DEFAULT_THEME = require_theme.DEFAULT_THEME;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as readPoHarnessMetadata, t as PoHarnessMetadata } from "./harnessMetadata-BzMgOB0W.mjs";
|
|
2
|
-
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-
|
|
2
|
+
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-DJvl27YF.mjs";
|
|
3
3
|
import { n as LeaderSnapshot, r as PoUiState, t as LeaderOption } from "./uiState-DbjaVyxl.mjs";
|
|
4
4
|
import { a as DEFAULT_THEME, i as writeDefaultTheme, o as DEFAULT_THEME_NAME } from "./index-DFSkSBBh.mjs";
|
|
5
5
|
import { ConfigChoice, ConfigField, ConfigSection, ConfigStep, PoConfigActionInput, PoConfigContributionHandle, PoConfigContributionOptions } from "@agimon-ai/po-core/config";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as readPoHarnessMetadata } from "./harnessMetadata-Ccv_j7WP.mjs";
|
|
2
|
-
import { n as createUiTelemetry, t as UI_EVENT } from "./telemetry-
|
|
2
|
+
import { n as createUiTelemetry, t as UI_EVENT } from "./telemetry-BvCR35jo.mjs";
|
|
3
3
|
import { t as PoUiState } from "./uiState-C7I5WcMl.mjs";
|
|
4
4
|
import { a as DEFAULT_THEME, i as writeDefaultTheme, o as DEFAULT_THEME_NAME } from "./theme-BX_hfErv.mjs";
|
|
5
5
|
export { DEFAULT_THEME, DEFAULT_THEME_NAME, PoUiState, UI_EVENT, createUiTelemetry, readPoHarnessMetadata, writeDefaultTheme };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_telemetry = require("./telemetry-
|
|
2
|
+
const require_telemetry = require("./telemetry-DZXeC4kO.cjs");
|
|
3
3
|
exports.UI_EVENT = require_telemetry.UI_EVENT;
|
|
4
4
|
exports.createUiTelemetry = require_telemetry.createUiTelemetry;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-
|
|
1
|
+
import { a as UiTelemetryOptions, i as UiTelemetry, n as UiEventAttributes, o as createUiTelemetry, r as UiEventName, t as UI_EVENT } from "./index-DJvl27YF.mjs";
|
|
2
2
|
export { UI_EVENT, type UiEventAttributes, type UiEventName, type UiTelemetry, type UiTelemetryOptions, createUiTelemetry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as UI_EVENT, n as createUiTelemetry } from "./telemetry-
|
|
1
|
+
export { t as UI_EVENT, n as createUiTelemetry } from "./telemetry-BvCR35jo.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPoTelemetry } from "@agimon-ai/po-telemetry";
|
|
1
|
+
import { createPoTelemetry } from "@agimon-ai/po-core/telemetry";
|
|
2
2
|
//#region src/services/telemetry/index.ts
|
|
3
3
|
const SERVICE_NAME = "po-ui";
|
|
4
4
|
const PACKAGE_NAME = "@agimon-ai/po-ui";
|
|
@@ -33,4 +33,4 @@ function createUiTelemetry(options = {}) {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { createUiTelemetry as n, UI_EVENT as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=telemetry-
|
|
36
|
+
//# sourceMappingURL=telemetry-BvCR35jo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-BvCR35jo.mjs","names":[],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-core/telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,YAAyB,kBAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _agimon_ai_po_core_telemetry = require("@agimon-ai/po-core/telemetry");
|
|
2
2
|
//#region src/services/telemetry/index.ts
|
|
3
3
|
const SERVICE_NAME = "po-ui";
|
|
4
4
|
const PACKAGE_NAME = "@agimon-ai/po-ui";
|
|
@@ -11,7 +11,7 @@ const UI_EVENT = {
|
|
|
11
11
|
eventLoopStalled: "po_pi_ui.event_loop_stalled"
|
|
12
12
|
};
|
|
13
13
|
function createUiTelemetry(options = {}) {
|
|
14
|
-
const telemetry = (0,
|
|
14
|
+
const telemetry = (0, _agimon_ai_po_core_telemetry.createPoTelemetry)({
|
|
15
15
|
serviceName: SERVICE_NAME,
|
|
16
16
|
packageName: PACKAGE_NAME,
|
|
17
17
|
cwd: options.cwd,
|
|
@@ -44,4 +44,4 @@ Object.defineProperty(exports, "createUiTelemetry", {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=telemetry-
|
|
47
|
+
//# sourceMappingURL=telemetry-DZXeC4kO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-DZXeC4kO.cjs","names":["createPoTelemetry"],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-core/telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,aAAA,GAAyBA,6BAAAA,kBAAAA,CAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-ui",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.30",
|
|
4
4
|
"description": "Leader-key menus, themes, and TUI components for Po and Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -110,18 +110,17 @@
|
|
|
110
110
|
"access": "public"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
114
|
-
"@agimon-ai/po-hashline": "0.0.0-alpha.
|
|
115
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.
|
|
116
|
-
"@agimon-ai/po-
|
|
117
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.29",
|
|
113
|
+
"@agimon-ai/po-core": "0.0.0-alpha.30",
|
|
114
|
+
"@agimon-ai/po-hashline": "0.0.0-alpha.30",
|
|
115
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.30",
|
|
116
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.30",
|
|
118
117
|
"@deepseek-ai/cordis": "4.0.5",
|
|
119
118
|
"yaml": "2.9.1"
|
|
120
119
|
},
|
|
121
120
|
"devDependencies": {
|
|
122
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
123
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
124
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
121
|
+
"@agimon-ai/po-build": "0.0.0-alpha.30",
|
|
122
|
+
"@agimon-ai/po-core": "0.0.0-alpha.30",
|
|
123
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.30",
|
|
125
124
|
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
126
125
|
"@tanstack/react-store": "0.11.2",
|
|
127
126
|
"@tanstack/store": "0.11.2",
|
|
@@ -135,8 +134,8 @@
|
|
|
135
134
|
"vitest": "5.0.4"
|
|
136
135
|
},
|
|
137
136
|
"peerDependencies": {
|
|
138
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
139
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
137
|
+
"@agimon-ai/po-core": "0.0.0-alpha.30",
|
|
138
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.30",
|
|
140
139
|
"@earendil-works/pi-coding-agent": "1.3.0"
|
|
141
140
|
},
|
|
142
141
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-EXlQc9s0.cjs","names":["createPoTelemetry"],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,aAAA,GAAyBA,wBAAAA,kBAAAA,CAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-RiFqd0cg.mjs","names":[],"sources":["../src/services/telemetry/index.ts"],"sourcesContent":["import { createPoTelemetry, type PoTelemetry, type PoTelemetryOptions } from '@agimon-ai/po-telemetry';\n\nconst SERVICE_NAME = 'po-ui';\nconst PACKAGE_NAME = '@agimon-ai/po-ui';\n\nexport const UI_EVENT = {\n leaderContributionRejected: 'po_pi_ui.leader_contribution_rejected',\n leaderCommandUnavailable: 'po_pi_ui.leader_command_unavailable',\n leaderActionUnavailable: 'po_pi_ui.leader_action_unavailable',\n themeApplyFailed: 'po_pi_ui.theme_apply_failed',\n shellInstalled: 'po_pi_ui.shell_installed',\n eventLoopStalled: 'po_pi_ui.event_loop_stalled',\n} as const;\n\nexport type UiEventName = (typeof UI_EVENT)[keyof typeof UI_EVENT];\nexport type UiEventAttributes = Record<string, string | number | boolean>;\n\nexport interface UiTelemetryOptions {\n cwd?: string;\n workspaceRoot?: string;\n env?: NodeJS.ProcessEnv;\n telemetryFactory?: NonNullable<PoTelemetryOptions['telemetryFactory']>;\n warn?: (message: string) => void;\n}\n\nexport interface UiTelemetry {\n recordError(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordWarning(event: UiEventName, error: unknown, attributes?: UiEventAttributes): Promise<void>;\n recordEvent(event: UiEventName, attributes?: UiEventAttributes): Promise<void>;\n flush(): Promise<void>;\n shutdown(): Promise<void>;\n}\n\nexport function createUiTelemetry(options: UiTelemetryOptions = {}): UiTelemetry {\n const telemetry: PoTelemetry = createPoTelemetry({\n serviceName: SERVICE_NAME,\n packageName: PACKAGE_NAME,\n cwd: options.cwd,\n workspaceRoot: options.workspaceRoot,\n env: options.env,\n telemetryFactory: options.telemetryFactory,\n warn: options.warn,\n enableLogs: true,\n enableTraces: true,\n });\n return {\n recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n flush: () => telemetry.flush(),\n shutdown: () => telemetry.shutdown(),\n };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,WAAW;CACtB,4BAA4B;CAC5B,0BAA0B;CAC1B,yBAAyB;CACzB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;AACpB;AAqBA,SAAgB,kBAAkB,UAA8B,CAAC,GAAgB;CAC/E,MAAM,YAAyB,kBAAkB;EAC/C,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}
|