@agimon-ai/po-read 0.0.0-alpha.206 → 0.0.0-alpha.207
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/mcp.cjs +11 -3
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts.map +1 -1
- package/dist/extensions/mcp.mjs +11 -3
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/native.mjs +11 -3
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +11 -3
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +11 -3
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +11 -3
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +9 -9
package/dist/extensions/mcp.cjs
CHANGED
|
@@ -173,9 +173,17 @@ var read_mcp_default = (0, _agimon_ai_po_core_mcpFacet.defineMcpTool)((context)
|
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region generated/mcp.ts
|
|
175
175
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
176
|
-
const via = (identity, value) =>
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
const via = (identity, value) => {
|
|
177
|
+
if (value === void 0) return void 0;
|
|
178
|
+
const declaration = value;
|
|
179
|
+
return {
|
|
180
|
+
...identity,
|
|
181
|
+
...declaration,
|
|
182
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
183
|
+
evidence: "declared",
|
|
184
|
+
...relation
|
|
185
|
+
})) }
|
|
186
|
+
};
|
|
179
187
|
};
|
|
180
188
|
const withWidget = (key, value) => value === void 0 ? value : {
|
|
181
189
|
...value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.cjs","names":["Type","resizeImage","formatDimensionNote","loadPiImageSettings","resolveReadInputPath","withAbortSignal","BACKGROUND_CONTEXT","readBoundedFile","FileTooLargeError","displayPath","isWritableFile","decodeUtf8","splitLines","formatFileHeader","computeFileTag","formatTaggedLine","DEFAULT_MAX_BYTES","truncateLine","truncateHead","formatSize","defineMcpTool","PO_FS_SERVICE","defineMcpPlugin","toolRead"],"sources":["../../src/schemas/readTool.ts","../../src/services/readHost/index.ts","../../src/services/readImage/index.ts","../../src/services/readTool/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n","import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/po-config/piConfig';\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n DEFAULT_MAX_BYTES,\n formatDimensionNote,\n formatSize,\n resizeImage,\n truncateHead,\n truncateLine,\n} from '@earendil-works/pi-coding-agent';\n\nimport type { ReadImageResizeOperations } from '../readImage';\nimport type { ReadHostContext } from './type';\n\n// The Node form of the read tool's host seam: Pi's own limits and resizer, and the image settings Pi keeps under the\n// user's home. ./index.edge replaces this module in the Worker build, where Pi cannot load.\nexport { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateLine };\n\nexport const resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport async function readImageLimits(_filesystem: FileSystem, _context: ReadHostContext): Promise<PiImageSettings> {\n return loadPiImageSettings();\n}\n","import type { PiImageSettings } from '@agimon-ai/po-config/piConfig';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n","import type { PoHeadlessExecutionContext, PoHeadlessTool, PoHeadlessToolResult } from '@agimon-ai/po-core/headless';\nimport {\n BACKGROUND_CONTEXT,\n FileTooLargeError,\n readBoundedFile,\n withAbortSignal,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/po-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/po-hashline/files';\nimport type { ReadToolDetails } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n readImageLimits,\n resizeOperations,\n truncateHead,\n truncateLine,\n} from '../readHost';\nimport { applyImageLimits, type ReadContentPart, type ReadTextPart } from '../readImage';\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n filesystem: FileSystem,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;\n let bytes: Buffer;\n try {\n bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8 * 1024 * 1024, context));\n } catch (error) {\n if (error instanceof FileTooLargeError) {\n throw new Error('File is over 8 MiB, hashline read refuses; use runner log tools for logs.', { cause: error });\n }\n throw error;\n }\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, await readImageLimits(filesystem, context), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(\n filesystem: FileSystem | (() => FileSystem),\n): PoHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: PoHeadlessToolResult) => void) | undefined,\n context: PoHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === 'function' ? filesystem() : filesystem),\n };\n}\n","import { defineMcpTool, type PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport { PO_FS_SERVICE, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineMcpTool((context: PoMcpPluginContext) => {\n const filesystem = context.services.get<FileSystem>(PO_FS_SERVICE);\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return {\n ...createHeadlessReadTool(filesystem),\n description:\n \"Read a text file from the Po session's repository on the host machine (open, view, cat). Returns a file hash and line anchors such as 5#abc that this server's edit tool requires. Use offset and limit for large files; files over 8 MiB are refused; text is truncated at 2000 lines or 50KB.\",\n };\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return [withWidget(\"@agimon-ai/po-read/read\", via({ name: 'read' }, at(toolRead, context)))]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;;;;;;AAEA,MAAa,mBAAmBA,QAAAA,KAAK,OAAO;CAC1C,MAAMA,QAAAA,KAAK,OAAO,EAAE,aAAa,4BAA4B,CAAC;CAC9D,QAAQA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAyB,CAAC,CAAC;CACzF,OAAOA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAqC,CAAC,CAAC;AACtG,CAAC;;;ACYD,MAAa,mBAA8C;CACzD,QAAQC,gCAAAA;CACR,sBAAsB,YAAA,GAAWC,gCAAAA,oBAAAA,CAAoB,MAAM;AAC7D;AAEA,eAAsB,gBAAgB,aAAyB,UAAqD;CAClH,QAAA,GAAOC,8BAAAA,oBAAAA,CAAoB;AAC7B;;;ACvBA,MAAM,eAAe;AAkCrB,eAAsB,iBACpB,SACA,QACA,YAC4B;CAC5B,IAAI,CAAC,OAAO,cAAc,CAAC,QAAQ,MAAM,SAAS,KAAK,SAAS,OAAO,GAAG,OAAO;CACjF,MAAM,WAA8B,CAAC;CACrC,KAAK,MAAM,QAAQ,SAAS;EAC1B,IAAI,KAAK,SAAS,SAAS;GACzB,SAAS,KAAK,IAAI;GAClB;EACF;EACA,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,KAAK,KAAK,MAAM,QAAQ,GAAG,KAAK,UAAU;GACvF,U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A,YACG,oBAAoB,QAAQ,QAAQ,KAAK,QAAQ,OAAO,eAAe,aAAa,WAAW,IAAI,UAAU;CACpH;AACF;;;AC3JA,IAAA,oBAAA,GAAeI,4BAAAA,cAAAA,EAAe,YAAgC;CAC5D,MAAM,aAAa,QAAQ,SAAS,IAAgBC,4BAAAA,aAAa;CACjE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,yCAAyC;CAC1E,OAAO;EACL,GAAG,uBAAuB,UAAU;EACpC,aACE;CACJ;AACF,CAAC;;;ACPD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAM,cAAiB,KAAa,UAAgB,UAAU,KAAA,IAAY,QAAS;CACjF,GAAG;CAAO,OAAO;EAAE,GAAI,MAA6B;GAAQ,cAAc;CAAI;AAChF;AAEA,MAAa,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAqC;EAAE,OAAO,CAAC,WAAW,2BAA2B,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,OAAO,CAAC,CAAC,CAAC;CAAG,EAC3I;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp.cjs","names":["Type","resizeImage","formatDimensionNote","loadPiImageSettings","resolveReadInputPath","withAbortSignal","BACKGROUND_CONTEXT","readBoundedFile","FileTooLargeError","displayPath","isWritableFile","decodeUtf8","splitLines","formatFileHeader","computeFileTag","formatTaggedLine","DEFAULT_MAX_BYTES","truncateLine","truncateHead","formatSize","defineMcpTool","PO_FS_SERVICE","defineMcpPlugin","toolRead"],"sources":["../../src/schemas/readTool.ts","../../src/services/readHost/index.ts","../../src/services/readImage/index.ts","../../src/services/readTool/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n","import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/po-config/piConfig';\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n DEFAULT_MAX_BYTES,\n formatDimensionNote,\n formatSize,\n resizeImage,\n truncateHead,\n truncateLine,\n} from '@earendil-works/pi-coding-agent';\n\nimport type { ReadImageResizeOperations } from '../readImage';\nimport type { ReadHostContext } from './type';\n\n// The Node form of the read tool's host seam: Pi's own limits and resizer, and the image settings Pi keeps under the\n// user's home. ./index.edge replaces this module in the Worker build, where Pi cannot load.\nexport { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateLine };\n\nexport const resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport async function readImageLimits(_filesystem: FileSystem, _context: ReadHostContext): Promise<PiImageSettings> {\n return loadPiImageSettings();\n}\n","import type { PiImageSettings } from '@agimon-ai/po-config/piConfig';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n","import type { PoHeadlessExecutionContext, PoHeadlessTool, PoHeadlessToolResult } from '@agimon-ai/po-core/headless';\nimport {\n BACKGROUND_CONTEXT,\n FileTooLargeError,\n readBoundedFile,\n withAbortSignal,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/po-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/po-hashline/files';\nimport type { ReadToolDetails } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n readImageLimits,\n resizeOperations,\n truncateHead,\n truncateLine,\n} from '../readHost';\nimport { applyImageLimits, type ReadContentPart, type ReadTextPart } from '../readImage';\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n filesystem: FileSystem,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;\n let bytes: Buffer;\n try {\n bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8 * 1024 * 1024, context));\n } catch (error) {\n if (error instanceof FileTooLargeError) {\n throw new Error('File is over 8 MiB, hashline read refuses; use runner log tools for logs.', { cause: error });\n }\n throw error;\n }\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, await readImageLimits(filesystem, context), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(\n filesystem: FileSystem | (() => FileSystem),\n): PoHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: PoHeadlessToolResult) => void) | undefined,\n context: PoHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === 'function' ? filesystem() : filesystem),\n };\n}\n","import { defineMcpTool, type PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport { PO_FS_SERVICE, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineMcpTool((context: PoMcpPluginContext) => {\n const filesystem = context.services.get<FileSystem>(PO_FS_SERVICE);\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return {\n ...createHeadlessReadTool(filesystem),\n description:\n \"Read a text file from the Po session's repository on the host machine (open, view, cat). Returns a file hash and line anchors such as 5#abc that this server's edit tool requires. Use offset and limit for large files; files over 8 MiB are refused; text is truncated at 2000 lines or 50KB.\",\n };\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return [withWidget(\"@agimon-ai/po-read/read\", via({ name: 'read' }, at(toolRead, context)))]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;;;;;;AAEA,MAAa,mBAAmBA,QAAAA,KAAK,OAAO;CAC1C,MAAMA,QAAAA,KAAK,OAAO,EAAE,aAAa,4BAA4B,CAAC;CAC9D,QAAQA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAyB,CAAC,CAAC;CACzF,OAAOA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAqC,CAAC,CAAC;AACtG,CAAC;;;ACYD,MAAa,mBAA8C;CACzD,QAAQC,gCAAAA;CACR,sBAAsB,YAAA,GAAWC,gCAAAA,oBAAAA,CAAoB,MAAM;AAC7D;AAEA,eAAsB,gBAAgB,aAAyB,UAAqD;CAClH,QAAA,GAAOC,8BAAAA,oBAAAA,CAAoB;AAC7B;;;ACvBA,MAAM,eAAe;AAkCrB,eAAsB,iBACpB,SACA,QACA,YAC4B;CAC5B,IAAI,CAAC,OAAO,cAAc,CAAC,QAAQ,MAAM,SAAS,KAAK,SAAS,OAAO,GAAG,OAAO;CACjF,MAAM,WAA8B,CAAC;CACrC,KAAK,MAAM,QAAQ,SAAS;EAC1B,IAAI,KAAK,SAAS,SAAS;GACzB,SAAS,KAAK,IAAI;GAClB;EACF;EACA,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,KAAK,KAAK,MAAM,QAAQ,GAAG,KAAK,UAAU;GACvF,UAAU,OAAO;GACjB,WAAW,OAAO;EACpB,CAAC;EACD,IAAI,CAAC,SAAS;GACZ,SAAS,KAAK;IAAE,MAAM;IAAQ,MAAM;GAAa,CAAC;GAClD;EACF;EACA,SAAS,KAAK;GAAE,MAAM;GAAS,MAAM,QAAQ;GAAM,UAAU,QAAQ;EAAS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a;CACjE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,yCAAyC;CAC1E,OAAO;EACL,GAAG,uBAAuB,UAAU;EACpC,aACE;CACJ;AACF,CAAC;;;ACPD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAAsB;CACvE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,MAAM,cAAc;CACpB,OAAO;EAAE,GAAG;EAAU,GAAG;EAAa,GAAI,YAAY,cAAc,KAAA,IAAY,CAAC,IAAI,EACnF,WAAW,YAAY,UAAU,KAAK,cAAc;GAAE,UAAU;GAAY,GAAG;EAAS,EAAE,EAC5F;CAAG;AACL;AAEA,MAAM,cAAiB,KAAa,UAAgB,UAAU,KAAA,IAAY,QAAS;CACjF,GAAG;CAAO,OAAO;EAAE,GAAI,MAA6B;GAAQ,cAAc;CAAI;AAChF;AAEA,MAAa,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAqC;EAAE,OAAO,CAAC,WAAW,2BAA2B,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,kBAAU,OAAO,CAAC,CAAC,CAAC;CAAG,EAC3I;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"mcp.d.mts","names":[],"sources":["../../generated/mcp.ts"],"mappings":";qBAoBa,2CAAG"}
|
package/dist/extensions/mcp.mjs
CHANGED
|
@@ -169,9 +169,17 @@ var read_mcp_default = defineMcpTool((context) => {
|
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region generated/mcp.ts
|
|
171
171
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
172
|
-
const via = (identity, value) =>
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
const via = (identity, value) => {
|
|
173
|
+
if (value === void 0) return void 0;
|
|
174
|
+
const declaration = value;
|
|
175
|
+
return {
|
|
176
|
+
...identity,
|
|
177
|
+
...declaration,
|
|
178
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
179
|
+
evidence: "declared",
|
|
180
|
+
...relation
|
|
181
|
+
})) }
|
|
182
|
+
};
|
|
175
183
|
};
|
|
176
184
|
const withWidget = (key, value) => value === void 0 ? value : {
|
|
177
185
|
...value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.mjs","names":["toolRead"],"sources":["../../src/schemas/readTool.ts","../../src/services/readHost/index.ts","../../src/services/readImage/index.ts","../../src/services/readTool/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n","import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/po-config/piConfig';\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n DEFAULT_MAX_BYTES,\n formatDimensionNote,\n formatSize,\n resizeImage,\n truncateHead,\n truncateLine,\n} from '@earendil-works/pi-coding-agent';\n\nimport type { ReadImageResizeOperations } from '../readImage';\nimport type { ReadHostContext } from './type';\n\n// The Node form of the read tool's host seam: Pi's own limits and resizer, and the image settings Pi keeps under the\n// user's home. ./index.edge replaces this module in the Worker build, where Pi cannot load.\nexport { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateLine };\n\nexport const resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport async function readImageLimits(_filesystem: FileSystem, _context: ReadHostContext): Promise<PiImageSettings> {\n return loadPiImageSettings();\n}\n","import type { PiImageSettings } from '@agimon-ai/po-config/piConfig';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n","import type { PoHeadlessExecutionContext, PoHeadlessTool, PoHeadlessToolResult } from '@agimon-ai/po-core/headless';\nimport {\n BACKGROUND_CONTEXT,\n FileTooLargeError,\n readBoundedFile,\n withAbortSignal,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/po-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/po-hashline/files';\nimport type { ReadToolDetails } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n readImageLimits,\n resizeOperations,\n truncateHead,\n truncateLine,\n} from '../readHost';\nimport { applyImageLimits, type ReadContentPart, type ReadTextPart } from '../readImage';\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n filesystem: FileSystem,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;\n let bytes: Buffer;\n try {\n bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8 * 1024 * 1024, context));\n } catch (error) {\n if (error instanceof FileTooLargeError) {\n throw new Error('File is over 8 MiB, hashline read refuses; use runner log tools for logs.', { cause: error });\n }\n throw error;\n }\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, await readImageLimits(filesystem, context), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(\n filesystem: FileSystem | (() => FileSystem),\n): PoHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: PoHeadlessToolResult) => void) | undefined,\n context: PoHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === 'function' ? filesystem() : filesystem),\n };\n}\n","import { defineMcpTool, type PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport { PO_FS_SERVICE, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineMcpTool((context: PoMcpPluginContext) => {\n const filesystem = context.services.get<FileSystem>(PO_FS_SERVICE);\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return {\n ...createHeadlessReadTool(filesystem),\n description:\n \"Read a text file from the Po session's repository on the host machine (open, view, cat). Returns a file hash and line anchors such as 5#abc that this server's edit tool requires. Use offset and limit for large files; files over 8 MiB are refused; text is truncated at 2000 lines or 50KB.\",\n };\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return [withWidget(\"@agimon-ai/po-read/read\", via({ name: 'read' }, at(toolRead, context)))]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;;AAEA,MAAa,mBAAmB,KAAK,OAAO;CAC1C,MAAM,KAAK,OAAO,EAAE,aAAa,4BAA4B,CAAC;CAC9D,QAAQ,KAAK,SAAS,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAyB,CAAC,CAAC;CACzF,OAAO,KAAK,SAAS,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAqC,CAAC,CAAC;AACtG,CAAC;;;ACYD,MAAa,mBAA8C;CACzD,QAAQ;CACR,sBAAsB,WAAW,oBAAoB,MAAM;AAC7D;AAEA,eAAsB,gBAAgB,aAAyB,UAAqD;CAClH,OAAO,oBAAoB;AAC7B;;;ACvBA,MAAM,eAAe;AAkCrB,eAAsB,iBACpB,SACA,QACA,YAC4B;CAC5B,IAAI,CAAC,OAAO,cAAc,CAAC,QAAQ,MAAM,SAAS,KAAK,SAAS,OAAO,GAAG,OAAO;CACjF,MAAM,WAA8B,CAAC;CACrC,KAAK,MAAM,QAAQ,SAAS;EAC1B,IAAI,KAAK,SAAS,SAAS;GACzB,SAAS,KAAK,IAAI;GAClB;EACF;EACA,MAAM,UAAU,MA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ACpE,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAM,cAAiB,KAAa,UAAgB,UAAU,KAAA,IAAY,QAAS;CACjF,GAAG;CAAO,OAAO;EAAE,GAAI,MAA6B;GAAQ,cAAc;CAAI;AAChF;AAEA,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAqC;EAAE,OAAO,CAAC,WAAW,2BAA2B,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGA,kBAAU,OAAO,CAAC,CAAC,CAAC;CAAG,EAC3I;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":["toolRead"],"sources":["../../src/schemas/readTool.ts","../../src/services/readHost/index.ts","../../src/services/readImage/index.ts","../../src/services/readTool/index.ts","../../src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","../../generated/mcp.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\nexport const ReadParamsSchema = Type.Object({\n path: Type.String({ description: 'Path to the file to read.' }),\n offset: Type.Optional(Type.Integer({ minimum: 1, description: 'One-based line offset.' })),\n limit: Type.Optional(Type.Integer({ minimum: 1, description: 'Maximum number of lines to return.' })),\n});\n\nexport type ReadParams = Static<typeof ReadParamsSchema>;\n","import { loadPiImageSettings, type PiImageSettings } from '@agimon-ai/po-config/piConfig';\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\nimport {\n DEFAULT_MAX_BYTES,\n formatDimensionNote,\n formatSize,\n resizeImage,\n truncateHead,\n truncateLine,\n} from '@earendil-works/pi-coding-agent';\n\nimport type { ReadImageResizeOperations } from '../readImage';\nimport type { ReadHostContext } from './type';\n\n// The Node form of the read tool's host seam: Pi's own limits and resizer, and the image settings Pi keeps under the\n// user's home. ./index.edge replaces this module in the Worker build, where Pi cannot load.\nexport { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateLine };\n\nexport const resizeOperations: ReadImageResizeOperations = {\n resize: resizeImage,\n formatDimensionNote: (result) => formatDimensionNote(result),\n};\n\nexport async function readImageLimits(_filesystem: FileSystem, _context: ReadHostContext): Promise<PiImageSettings> {\n return loadPiImageSettings();\n}\n","import type { PiImageSettings } from '@agimon-ai/po-config/piConfig';\n\nconst OMITTED_NOTE = '[Image omitted: could not be resized below the inline image size limit.]';\n\nexport interface ReadTextPart {\n type: 'text';\n text: string;\n}\n\nexport interface ReadImagePart {\n type: 'image';\n data: string;\n mimeType: string;\n}\n\nexport type ReadContentPart = ReadTextPart | ReadImagePart;\n\nexport interface ReadImageResizeResult {\n readonly data: string;\n readonly mimeType: string;\n readonly originalWidth: number;\n readonly originalHeight: number;\n readonly width: number;\n readonly height: number;\n readonly wasResized: boolean;\n}\n\nexport interface ReadImageResizeOperations {\n resize(\n inputBytes: Uint8Array,\n mimeType: string,\n options: { readonly maxWidth: number; readonly maxHeight: number },\n ): Promise<ReadImageResizeResult | null>;\n formatDimensionNote(result: ReadImageResizeResult): string | undefined;\n}\n\nexport async function applyImageLimits(\n content: ReadContentPart[],\n limits: PiImageSettings,\n operations: ReadImageResizeOperations,\n): Promise<ReadContentPart[]> {\n if (!limits.autoResize || !content.some((part) => part.type === 'image')) return content;\n const resolved: ReadContentPart[] = [];\n for (const part of content) {\n if (part.type !== 'image') {\n resolved.push(part);\n continue;\n }\n const resized = await operations.resize(Buffer.from(part.data, 'base64'), part.mimeType, {\n maxWidth: limits.maxDimension,\n maxHeight: limits.maxDimension,\n });\n if (!resized) {\n resolved.push({ type: 'text', text: OMITTED_NOTE });\n continue;\n }\n resolved.push({ type: 'image', data: resized.data, mimeType: resized.mimeType });\n const note = operations.formatDimensionNote(resized);\n if (note) resolved.push({ type: 'text', text: note });\n }\n return resolved;\n}\n","import type { PoHeadlessExecutionContext, PoHeadlessTool, PoHeadlessToolResult } from '@agimon-ai/po-core/headless';\nimport {\n BACKGROUND_CONTEXT,\n FileTooLargeError,\n readBoundedFile,\n withAbortSignal,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\nimport { formatFileHeader, formatTaggedLine, splitLines } from '@agimon-ai/po-hashline';\nimport {\n computeFileTag,\n decodeUtf8,\n displayPath,\n isWritableFile,\n resolveReadInputPath,\n} from '@agimon-ai/po-hashline/files';\nimport type { ReadToolDetails } from '@earendil-works/pi-coding-agent';\n\nimport { ReadParamsSchema, type ReadParams } from '../../schemas/readTool';\nimport {\n DEFAULT_MAX_BYTES,\n formatSize,\n readImageLimits,\n resizeOperations,\n truncateHead,\n truncateLine,\n} from '../readHost';\nimport { applyImageLimits, type ReadContentPart, type ReadTextPart } from '../readImage';\n\nexport interface ReadToolResult {\n content: ReadContentPart[];\n details?: ReadToolDetails;\n}\n\ninterface ReadTextToolResult {\n content: ReadTextPart[];\n details?: ReadToolDetails;\n}\n\nexport function assertNotAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw new Error('Operation aborted');\n}\n\nexport function isImagePath(filePath: string): string | undefined {\n const extension = filePath.toLowerCase().match(/\\.([a-z0-9]+)$/u)?.[1];\n if (!extension) return undefined;\n const mimeTypes: Record<string, string> = {\n avif: 'image/avif',\n gif: 'image/gif',\n jpeg: 'image/jpeg',\n jpg: 'image/jpeg',\n png: 'image/png',\n webp: 'image/webp',\n };\n return mimeTypes[extension];\n}\n\nexport async function executeHeadlessRead(\n params: ReadParams,\n cwd: string,\n signal: AbortSignal | undefined,\n filesystem: FileSystem,\n): Promise<ReadToolResult> {\n assertNotAborted(signal);\n const absolutePath = await resolveReadInputPath(params.path, cwd);\n const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;\n let bytes: Buffer;\n try {\n bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8 * 1024 * 1024, context));\n } catch (error) {\n if (error instanceof FileTooLargeError) {\n throw new Error('File is over 8 MiB, hashline read refuses; use runner log tools for logs.', { cause: error });\n }\n throw error;\n }\n assertNotAborted(signal);\n const mimeType = isImagePath(absolutePath);\n if (mimeType) {\n const content: ReadContentPart[] = [\n { type: 'text', text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]` },\n { type: 'image', data: bytes.toString('base64'), mimeType },\n ];\n return { content: await applyImageLimits(content, await readImageLimits(filesystem, context), resizeOperations) };\n }\n if (!(await isWritableFile(absolutePath))) {\n return { content: [{ type: 'text', text: decodeUtf8(bytes, displayPath(absolutePath, cwd)) }] };\n }\n return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);\n}\n\nexport function createTaggedReadResult(bytes: Buffer, path: string, params: ReadParams): ReadTextToolResult {\n const lines = splitLines(decodeUtf8(bytes, path));\n const startIndex = params.offset === undefined ? 0 : params.offset - 1;\n if (startIndex >= lines.length) {\n throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);\n }\n\n const endIndex = params.limit === undefined ? lines.length : Math.min(lines.length, startIndex + params.limit);\n const selected = lines.slice(startIndex, endIndex);\n const header = formatFileHeader(path, computeFileTag(bytes));\n const compactedLines: number[] = [];\n const headerBytes = Buffer.byteLength(header, 'utf8') + 1;\n const tagged = selected.map((line, index) => {\n const lineNumber = startIndex + index + 1;\n const full = formatTaggedLine(line, lineNumber);\n if (Buffer.byteLength(full, 'utf8') <= DEFAULT_MAX_BYTES - headerBytes) return full;\n compactedLines.push(lineNumber);\n return formatTaggedLine(truncateLine(line).text, lineNumber, '', line);\n });\n const truncation = truncateHead([header, ...tagged].join('\\n'));\n let text = truncation.content;\n let details: ReadToolDetails | undefined;\n\n if (truncation.truncated) {\n const shownLines = Math.max(0, truncation.outputLines - 1);\n const nextOffset = startIndex + shownLines + 1;\n const reason = truncation.truncatedBy === 'bytes' ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : '';\n text += `\\n\\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;\n details = { truncation };\n } else {\n const notices: string[] = [];\n if (compactedLines.length > 0) {\n notices.push(`Lines ${compactedLines.join(', ')} shown compactly. Their anchors hash the full original lines`);\n }\n if (endIndex < lines.length) {\n notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);\n }\n if (notices.length > 0) text += `\\n\\n[${notices.join('. ')}.]`;\n }\n\n return { content: [{ type: 'text', text }], details };\n}\n\nexport function isImageRead(content: readonly { readonly type: string; readonly text?: string }[]): boolean {\n return content.some((part) => part.type === 'image' || part.text?.startsWith('Read image file') === true);\n}\n\nexport function createHeadlessReadTool(\n filesystem: FileSystem | (() => FileSystem),\n): PoHeadlessTool<typeof ReadParamsSchema> {\n return {\n name: 'read',\n label: 'read',\n description:\n 'Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.',\n promptSnippet: 'Read file contents with snapshot-bound line anchors',\n promptGuidelines: [\n 'Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.',\n 'Continue large reads with offset until the required anchored lines are visible.',\n ],\n parameters: ReadParamsSchema,\n executionMode: 'parallel',\n execute: async (\n _toolCallId: string,\n params: ReadParams,\n signal: AbortSignal | undefined,\n _onUpdate: ((result: PoHeadlessToolResult) => void) | undefined,\n context: PoHeadlessExecutionContext,\n ) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === 'function' ? filesystem() : filesystem),\n };\n}\n","import { defineMcpTool, type PoMcpPluginContext } from '@agimon-ai/po-core/mcpFacet';\nimport { PO_FS_SERVICE, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineMcpTool((context: PoMcpPluginContext) => {\n const filesystem = context.services.get<FileSystem>(PO_FS_SERVICE);\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return {\n ...createHeadlessReadTool(filesystem),\n description:\n \"Read a text file from the Po session's repository on the host machine (open, view, cat). Returns a file hash and line anchors such as 5#abc that this server's edit tool requires. Use offset and limit for large files; files over 8 MiB are refused; text is truncated at 2000 lines or 50KB.\",\n };\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineMcpPlugin, type PoMcpSessionPlugin } from '@agimon-ai/po-core/mcpFacet';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.mcp';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nconst withWidget = <T>(key: string, value: T): T => value === undefined ? value : ({\n ...value, _meta: { ...(value as { _meta?: object })._meta, [\"po/widget\"]: key },\n});\n\nexport const mcp = defineMcpPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoMcpSessionPlugin['tools'] { return [withWidget(\"@agimon-ai/po-read/read\", via({ name: 'read' }, at(toolRead, context)))]; },\n }) satisfies PoMcpSessionPlugin,\n});\n\nexport default mcp;\n"],"mappings":";;;;;;;;AAEA,MAAa,mBAAmB,KAAK,OAAO;CAC1C,MAAM,KAAK,OAAO,EAAE,aAAa,4BAA4B,CAAC;CAC9D,QAAQ,KAAK,SAAS,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAyB,CAAC,CAAC;CACzF,OAAO,KAAK,SAAS,KAAK,QAAQ;EAAE,SAAS;EAAG,aAAa;CAAqC,CAAC,CAAC;AACtG,CAAC;;;ACYD,MAAa,mBAA8C;CACzD,QAAQ;CACR,sBAAsB,WAAW,oBAAoB,MAAM;AAC7D;AAEA,eAAsB,gBAAgB,aAAyB,UAAqD;CAClH,OAAO,oBAAoB;AAC7B;;;ACvBA,MAAM,eAAe;AAkCrB,eAAsB,iBACpB,SACA,QACA,YAC4B;CAC5B,IAAI,CAAC,OAA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S,IAAgB,aAAa;CACjE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,yCAAyC;CAC1E,OAAO;EACL,GAAG,uBAAuB,UAAU;EACpC,aACE;CACJ;AACF,CAAC;;;ACPD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAAsB;CACvE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,MAAM,cAAc;CACpB,OAAO;EAAE,GAAG;EAAU,GAAG;EAAa,GAAI,YAAY,cAAc,KAAA,IAAY,CAAC,IAAI,EACnF,WAAW,YAAY,UAAU,KAAK,cAAc;GAAE,UAAU;GAAY,GAAG;EAAS,EAAE,EAC5F;CAAG;AACL;AAEA,MAAM,cAAiB,KAAa,UAAgB,UAAU,KAAA,IAAY,QAAS;CACjF,GAAG;CAAO,OAAO;EAAE,GAAI,MAA6B;GAAQ,cAAc;CAAI;AAChF;AAEA,MAAa,MAAM,gBAAgB;CACjC,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAqC;EAAE,OAAO,CAAC,WAAW,2BAA2B,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGA,kBAAU,OAAO,CAAC,CAAC,CAAC;CAAG,EAC3I;AACF,CAAC"}
|
|
@@ -151,9 +151,17 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
151
151
|
var read_native_default = defineToolRenderer({ message: ReadToolMessage });
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region generated/native.ts
|
|
154
|
-
const via = (identity, value) =>
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
const via = (identity, value) => {
|
|
155
|
+
if (value === void 0) return void 0;
|
|
156
|
+
const declaration = value;
|
|
157
|
+
return {
|
|
158
|
+
...identity,
|
|
159
|
+
...declaration,
|
|
160
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
161
|
+
evidence: "declared",
|
|
162
|
+
...relation
|
|
163
|
+
})) }
|
|
164
|
+
};
|
|
157
165
|
};
|
|
158
166
|
const nativePlugin = defineNativePlugin({
|
|
159
167
|
id: "read",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.mjs","names":["useT","ToolMessageRenderProps","fontOf","HashlineLines","hashlineBody","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","ToolPathLink","toolTone","ToolResultImage","PoNativeTheme","StyleSheet","readCallView","resultImages","IMAGE_HEIGHT","ReadToolMessage","props","args","result","output","running","isError","fileTabFor","openTransientTab","t","view","images","content","tab","path","body","expanded","styles","summary","undefined","onOpen","details","length","sans","detail","join","map","line","index","String","error","shown","notice","gutter","image","mimeType","data","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","fontFamily","fontSize","base","lineHeight","flexShrink","color","colors","faint","red","width","height","borderRadius","md","borderWidth","borderColor","toolRead"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/read.native.tsx","../../generated/native.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\ntype Translate = (key: string, fallback: string, vars?: Readonly<Record<string, string | number>>) => string;\n\nexport interface ReadCallView {\n readonly path: string;\n /** `from N` and `N lines`, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\nfunction optionalNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** What the read call heading shows: the path, then the offset and limit when given. */\nexport function readCallView(args: Readonly<Record<string, unknown>>, t?: Translate): ReadCallView {\n const offset = optionalNumber(args.offset);\n const limit = optionalNumber(args.limit);\n return {\n path: typeof args.path === 'string' ? args.path : '',\n details: [\n offset === undefined ? undefined : (t?.('read.ui.fromLine', 'from {line}', { line: offset }) ?? `from ${offset}`),\n limit === undefined ? undefined : (t?.('read.ui.lines', '{count} lines', { count: limit }) ?? `${limit} lines`),\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n\nconst IMAGE_MIME_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);\n\n/** The image blocks a read returned, limited to the formats both cards can draw. */\nexport function resultImages(content: readonly unknown[]): Array<{ data: string; mimeType: string }> {\n return content.flatMap((block) => {\n if (typeof block !== 'object' || block === null || Array.isArray(block)) return [];\n const value = block as Record<string, unknown>;\n return value.type === 'image' &&\n typeof value.data === 'string' &&\n typeof value.mimeType === 'string' &&\n IMAGE_MIME_TYPES.has(value.mimeType)\n ? [{ data: value.data, mimeType: value.mimeType }]\n : [];\n });\n}\n","import { useT } from '@agimon-ai/po-core/native';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n ToolPathLink,\n toolTone,\n ToolResultImage,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { readCallView, resultImages } from '../_lib/readToolView';\n\n/** Height an image result gets in the card; the web caps it at 24rem. */\nconst IMAGE_HEIGHT = 240;\n\n/**\n * The read tool's timeline item on native, as the web's ReadToolMessage: the\n * path and range in the header and, once expanded, the anchored lines with a\n * line-number gutter and any image the read returned, or the tool's message\n * in red when the read failed.\n */\nexport function ReadToolMessage(props: ToolMessageRenderProps) {\n const { args, result, output, running, isError, fileTabFor, openTransientTab } = props;\n const t = useT();\n const view = readCallView(args, t);\n const images = resultImages(result?.content ?? []);\n const tab = fileTabFor(view.path);\n const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => (\n <>\n {/* no-untranslated-jsx: ignore - Tool identifier matches the invocation. */}\n <MessageItemHeader title=\"read\">\n <View testID=\"tool-call-read\" style={styles.summary}>\n <ToolPathLink path={view.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n {view.details.length > 0 ? (\n <Text numberOfLines={1} style={[styles.sans, styles.detail]}>\n · {view.details.join(' · ')}\n </Text>\n ) : null}\n </View>\n </MessageItemHeader>\n {expanded ? (\n isError ? (\n <MessageItemBody testID=\"tool-result-read\">\n <MessageItemStatus tone=\"error\">{t('read.ui.failed', 'failed')}</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={[styles.sans, styles.error]}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody testID=\"tool-result-read\">\n <MessageItemStatus tone=\"running\">{t('read.ui.running', 'running')}</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (\n <MessageItemBody testID=\"tool-result-read\">\n <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />\n {images.map((image, index) => (\n <ToolResultImage\n key={`${image.mimeType}:${String(index)}`}\n host={props}\n data={image.data}\n mimeType={image.mimeType}\n accessibilityLabel={t('read.ui.resultImage', 'Read result {index}', { index: index + 1 })}\n testID=\"tool-result-read-image\"\n resizeMode=\"contain\"\n style={styles.image}\n />\n ))}\n {body.notice !== undefined ? <Text style={[styles.sans, styles.detail]}>{body.notice}</Text> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n detail: { flexShrink: 1, color: theme.colors.faint },\n error: { color: theme.colors.red },\n image: {\n width: '100%',\n height: IMAGE_HEIGHT,\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { ReadToolMessage } from './_components/ReadToolMessage.native';\n\nexport default defineToolRenderer({ message: ReadToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(frontend)/tool/read.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'read',\n packageName: '@agimon-ai/po-read',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['read'] }, toolRead)]; },\n },\n});\n"],"mappings":";;;;;;;AAWA,SAAS,eAAe,OAAoC;CAC1D,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;;AAGA,SAAgB,aAAa,MAAyC,GAA6B;CACjG,MAAM,SAAS,eAAe,KAAK,MAAM;CACzC,MAAM,QAAQ,eAAe,KAAK,KAAK;CACvC,OAAO;EACL,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;EAClD,SAAS,CACP,WAAW,KAAA,IAAY,KAAA,IAAa,IAAI,oBAAoB,eAAe,EAAE,MAAM,OAAO,CAAC,KAAK,QAAQ,UACxG,UAAU,KAAA,IAAY,KAAA,IAAa,IAAI,iBAAiB,iBAAiB,EAAE,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,OACzG,CAAC,CAAC,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;CAC9E;AACF;AAEA,MAAM,mCAAmB,IAAI,IAAI;CAAC;CAAa;CAAc;CAAa;AAAY,CAAC;;AAGvF,SAAgB,aAAa,SAAwE;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A,IAAI;GAChF;EAEjB,CAAA,IAAA,IACN,EAAA,CAAA;CAES,CAAA;AAEjB;AAEA,MAAMf,SAASrB,WAAWyC,QAAQC,WAA0B;CAC1DpB,SAAS;EAAEqB,MAAM;EAAGC,eAAe;EAAOC,YAAY;EAAUC,KAAKJ,MAAMK,QAAQ,CAAC;EAAGC,UAAU;EAACC,mBAAA,CAAA,CAAA;CAAC;CACnGtB,MAAM;EACJuB,YAAY9D,OAAOsD,MAAMQ,WAAWvB,IAAI;EACxCwB,UAAUT,MAAMS,SAASC;EACzBC,YAAYX,MAAMW,WAAWD;EAAIH,mBAAA,CAAA,CAAA;CACnC;CACArB,QAAQ;EAAE0B,YAAY;EAAGC,OAAOb,MAAMc,OAAOC;EAAKR,mBAAA,CAAA,CAAA;CAAC;CACnDf,OAAO;EAAEqB,OAAOb,MAAMc,OAAOE;EAAGT,mBAAA,CAAA,CAAA;CAAC;CACjCX,OAAO;EACLqB,OAAO;EACPC,QAAQzD;EACR0D,cAAcnB,MAAMmB,aAAaC;EACjCC,aAAa;EACbC,aAAatB,MAAMc,OAAO;EAAcP,mBAAA,CAAA,CAAA;CAC1C;AACF,EAAE;;;ACzGF,IAAA,sBAAe,mBAAmB,EAAE,SAAS,gBAAgB,CAAC;;;ACC9D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,aAAa;CACb,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGgB,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["useT","ToolMessageRenderProps","fontOf","HashlineLines","hashlineBody","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","ToolPathLink","toolTone","ToolResultImage","PoNativeTheme","StyleSheet","readCallView","resultImages","IMAGE_HEIGHT","ReadToolMessage","props","args","result","output","running","isError","fileTabFor","openTransientTab","t","view","images","content","tab","path","body","expanded","styles","summary","undefined","onOpen","details","length","sans","detail","join","map","line","index","String","error","shown","notice","gutter","image","mimeType","data","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","fontFamily","fontSize","base","lineHeight","flexShrink","color","colors","faint","red","width","height","borderRadius","md","borderWidth","borderColor","toolRead"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/read.native.tsx","../../generated/native.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\ntype Translate = (key: string, fallback: string, vars?: Readonly<Record<string, string | number>>) => string;\n\nexport interface ReadCallView {\n readonly path: string;\n /** `from N` and `N lines`, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\nfunction optionalNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** What the read call heading shows: the path, then the offset and limit when given. */\nexport function readCallView(args: Readonly<Record<string, unknown>>, t?: Translate): ReadCallView {\n const offset = optionalNumber(args.offset);\n const limit = optionalNumber(args.limit);\n return {\n path: typeof args.path === 'string' ? args.path : '',\n details: [\n offset === undefined ? undefined : (t?.('read.ui.fromLine', 'from {line}', { line: offset }) ?? `from ${offset}`),\n limit === undefined ? undefined : (t?.('read.ui.lines', '{count} lines', { count: limit }) ?? `${limit} lines`),\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n\nconst IMAGE_MIME_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);\n\n/** The image blocks a read returned, limited to the formats both cards can draw. */\nexport function resultImages(content: readonly unknown[]): Array<{ data: string; mimeType: string }> {\n return content.flatMap((block) => {\n if (typeof block !== 'object' || block === null || Array.isArray(block)) return [];\n const value = block as Record<string, unknown>;\n return value.type === 'image' &&\n typeof value.data === 'string' &&\n typeof value.mimeType === 'string' &&\n IMAGE_MIME_TYPES.has(value.mimeType)\n ? [{ data: value.data, mimeType: value.mimeType }]\n : [];\n });\n}\n","import { useT } from '@agimon-ai/po-core/native';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n ToolPathLink,\n toolTone,\n ToolResultImage,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { readCallView, resultImages } from '../_lib/readToolView';\n\n/** Height an image result gets in the card; the web caps it at 24rem. */\nconst IMAGE_HEIGHT = 240;\n\n/**\n * The read tool's timeline item on native, as the web's ReadToolMessage: the\n * path and range in the header and, once expanded, the anchored lines with a\n * line-number gutter and any image the read returned, or the tool's message\n * in red when the read failed.\n */\nexport function ReadToolMessage(props: ToolMessageRenderProps) {\n const { args, result, output, running, isError, fileTabFor, openTransientTab } = props;\n const t = useT();\n const view = readCallView(args, t);\n const images = resultImages(result?.content ?? []);\n const tab = fileTabFor(view.path);\n const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => (\n <>\n {/* no-untranslated-jsx: ignore - Tool identifier matches the invocation. */}\n <MessageItemHeader title=\"read\">\n <View testID=\"tool-call-read\" style={styles.summary}>\n <ToolPathLink path={view.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n {view.details.length > 0 ? (\n <Text numberOfLines={1} style={[styles.sans, styles.detail]}>\n · {view.details.join(' · ')}\n </Text>\n ) : null}\n </View>\n </MessageItemHeader>\n {expanded ? (\n isError ? (\n <MessageItemBody testID=\"tool-result-read\">\n <MessageItemStatus tone=\"error\">{t('read.ui.failed', 'failed')}</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={[styles.sans, styles.error]}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody testID=\"tool-result-read\">\n <MessageItemStatus tone=\"running\">{t('read.ui.running', 'running')}</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (\n <MessageItemBody testID=\"tool-result-read\">\n <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />\n {images.map((image, index) => (\n <ToolResultImage\n key={`${image.mimeType}:${String(index)}`}\n host={props}\n data={image.data}\n mimeType={image.mimeType}\n accessibilityLabel={t('read.ui.resultImage', 'Read result {index}', { index: index + 1 })}\n testID=\"tool-result-read-image\"\n resizeMode=\"contain\"\n style={styles.image}\n />\n ))}\n {body.notice !== undefined ? <Text style={[styles.sans, styles.detail]}>{body.notice}</Text> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n detail: { flexShrink: 1, color: theme.colors.faint },\n error: { color: theme.colors.red },\n image: {\n width: '100%',\n height: IMAGE_HEIGHT,\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { ReadToolMessage } from './_components/ReadToolMessage.native';\n\nexport default defineToolRenderer({ message: ReadToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(frontend)/tool/read.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nexport const nativePlugin = defineNativePlugin({\n id: 'read',\n packageName: '@agimon-ai/po-read',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['read'] }, toolRead)]; },\n },\n});\n"],"mappings":";;;;;;;AAWA,SAAS,eAAe,OAAoC;CAC1D,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;;AAGA,SAAgB,aAAa,MAAyC,GAA6B;CACjG,MAAM,SAAS,eAAe,KAAK,MAAM;CACzC,MAAM,QAAQ,eAAe,KAAK,KAAK;CACvC,OAAO;EACL,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;EAClD,SAAS,CACP,WAAW,KAAA,IAAY,KAAA,IAAa,IAAI,oBAAoB,eAAe,EAAE,MAAM,OAAO,CAAC,KAAK,QAAQ,UACxG,UAAU,KAAA,IAAY,KAAA,IAAa,IAAI,iBAAiB,iBAAiB,EAAE,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,OACzG,CAAC,CAAC,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;CAC9E;AACF;AAEA,MAAM,mCAAmB,IAAI,IAAI;CAAC;CAAa;CAAc;CAAa;AAAY,CAAC;;AAGvF,SAAgB,aAAa,SAAwE;CACnG,OAAO,QAAQ,SAAS,UAAU;EAChC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;EACjF,MAAM,QAAQ;EACd,OAAO,MAAM,SAAS,WACpB,O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,YAAY;EAAUC,KAAKJ,MAAMK,QAAQ,CAAC;EAAGC,UAAU;EAACC,mBAAA,CAAA,CAAA;CAAC;CACnGtB,MAAM;EACJuB,YAAY9D,OAAOsD,MAAMQ,WAAWvB,IAAI;EACxCwB,UAAUT,MAAMS,SAASC;EACzBC,YAAYX,MAAMW,WAAWD;EAAIH,mBAAA,CAAA,CAAA;CACnC;CACArB,QAAQ;EAAE0B,YAAY;EAAGC,OAAOb,MAAMc,OAAOC;EAAKR,mBAAA,CAAA,CAAA;CAAC;CACnDf,OAAO;EAAEqB,OAAOb,MAAMc,OAAOE;EAAGT,mBAAA,CAAA,CAAA;CAAC;CACjCX,OAAO;EACLqB,OAAO;EACPC,QAAQzD;EACR0D,cAAcnB,MAAMmB,aAAaC;EACjCC,aAAa;EACbC,aAAatB,MAAMc,OAAO;EAAcP,mBAAA,CAAA,CAAA;CAC1C;AACF,EAAE;;;ACzGF,IAAA,sBAAe,mBAAmB,EAAE,SAAS,gBAAgB,CAAC;;;ACC9D,MAAM,OAAU,UAAmC,UAAsB;CACvE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,MAAM,cAAc;CACpB,OAAO;EAAE,GAAG;EAAU,GAAG;EAAa,GAAI,YAAY,cAAc,KAAA,IAAY,CAAC,IAAI,EACnF,WAAW,YAAY,UAAU,KAAK,cAAc;GAAE,UAAU;GAAY,GAAG;EAAS,EAAE,EAC5F;CAAG;AACL;AAEA,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,aAAa;CACb,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGgB,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
|
@@ -23,9 +23,17 @@ var read_server_default = (0, require("@agimon-ai/po-core/extensionFile").define
|
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region generated/server.ts
|
|
25
25
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
26
|
-
const via = (identity, value) =>
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const via = (identity, value) => {
|
|
27
|
+
if (value === void 0) return void 0;
|
|
28
|
+
const declaration = value;
|
|
29
|
+
return {
|
|
30
|
+
...identity,
|
|
31
|
+
...declaration,
|
|
32
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
33
|
+
evidence: "declared",
|
|
34
|
+
...relation
|
|
35
|
+
})) }
|
|
36
|
+
};
|
|
29
37
|
};
|
|
30
38
|
const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
|
|
31
39
|
name: "@agimon-ai/po-read",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["defineServerTool","PO_FS_SERVICE","requirePoFs","createHeadlessReadTool","defineServerPlugin","toolRead"],"sources":["../../src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport { PO_FS_SERVICE, requirePoFs, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineServerTool(({ context }: PoServerPluginContext) => {\n let filesystem: FileSystem | undefined;\n context.inject([PO_FS_SERVICE], (scoped) => {\n const bound = requirePoFs(scoped);\n filesystem = bound;\n return () => {\n if (filesystem === bound) filesystem = undefined;\n };\n });\n return createHeadlessReadTool(() => {\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return filesystem;\n });\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["defineServerTool","PO_FS_SERVICE","requirePoFs","createHeadlessReadTool","defineServerPlugin","toolRead"],"sources":["../../src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport { PO_FS_SERVICE, requirePoFs, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineServerTool(({ context }: PoServerPluginContext) => {\n let filesystem: FileSystem | undefined;\n context.inject([PO_FS_SERVICE], (scoped) => {\n const bound = requirePoFs(scoped);\n filesystem = bound;\n return () => {\n if (filesystem === bound) filesystem = undefined;\n };\n });\n return createHeadlessReadTool(() => {\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return filesystem;\n });\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'read' }, at(toolRead, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;AAMA,IAAA,uBAAA,G,0CAAeA,CAAAA,CAAAA,iBAAAA,EAAkB,EAAE,cAAqC;CACtE,IAAI;CACJ,QAAQ,OAAO,CAACC,4BAAAA,aAAa,IAAI,WAAW;EAC1C,MAAM,SAAA,GAAQC,4BAAAA,YAAAA,CAAY,MAAM;EAChC,aAAa;EACb,aAAa;GACX,IAAI,eAAe,OAAO,aAAa,KAAA;EACzC;CACF,CAAC;CACD,OAAOC,iBAAAA,6BAA6B;EAClC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,yCAAyC;EAC1E,OAAO;CACT,CAAC;AACH,CAAC;;;ACbD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAAsB;CACvE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,MAAM,cAAc;CACpB,OAAO;EAAE,GAAG;EAAU,GAAG;EAAa,GAAI,YAAY,cAAc,KAAA,IAAY,CAAC,IAAI,EACnF,WAAW,YAAY,UAAU,KAAK,cAAc;GAAE,UAAU;GAAY,GAAG;EAAS,EAAE,EAC5F;CAAG;AACL;AAEA,MAAa,gBAAA,GAAeC,gCAAAA,mBAAAA,CAAmB;CAC7C,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAwC;EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGC,qBAAU,OAAO,CAAC,CAAC;CAAG,EACvG;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.mts","names":[],"sources":["../../generated/server.ts"],"mappings":";qBAgBa,wDAAY"}
|
|
@@ -20,9 +20,17 @@ var read_server_default = defineServerTool(({ context }) => {
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region generated/server.ts
|
|
22
22
|
const at = (value, context) => typeof value === "function" ? value(context) : value;
|
|
23
|
-
const via = (identity, value) =>
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const via = (identity, value) => {
|
|
24
|
+
if (value === void 0) return void 0;
|
|
25
|
+
const declaration = value;
|
|
26
|
+
return {
|
|
27
|
+
...identity,
|
|
28
|
+
...declaration,
|
|
29
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
30
|
+
evidence: "declared",
|
|
31
|
+
...relation
|
|
32
|
+
})) }
|
|
33
|
+
};
|
|
26
34
|
};
|
|
27
35
|
const serverPlugin = defineServerPlugin({
|
|
28
36
|
name: "@agimon-ai/po-read",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["toolRead"],"sources":["../../src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport { PO_FS_SERVICE, requirePoFs, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineServerTool(({ context }: PoServerPluginContext) => {\n let filesystem: FileSystem | undefined;\n context.inject([PO_FS_SERVICE], (scoped) => {\n const bound = requirePoFs(scoped);\n filesystem = bound;\n return () => {\n if (filesystem === bound) filesystem = undefined;\n };\n });\n return createHeadlessReadTool(() => {\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return filesystem;\n });\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["toolRead"],"sources":["../../src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineServerTool } from '@agimon-ai/po-core/extensionFile';\nimport { PO_FS_SERVICE, requirePoFs, type FileSystem } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createHeadlessReadTool } from '../../../../../services/readTool';\n\nexport default defineServerTool(({ context }: PoServerPluginContext) => {\n let filesystem: FileSystem | undefined;\n context.inject([PO_FS_SERVICE], (scoped) => {\n const bound = requirePoFs(scoped);\n filesystem = bound;\n return () => {\n if (filesystem === bound) filesystem = undefined;\n };\n });\n return createHeadlessReadTool(() => {\n if (!filesystem) throw new Error('Read filesystem service is unavailable.');\n return filesystem;\n });\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(backend)/tool/read.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-read',\n session: (context) => ({\n get tools(): PoServerSessionPlugin['tools'] { return [via({ name: 'read' }, at(toolRead, context))]; },\n }),\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;AAMA,IAAA,sBAAe,kBAAkB,EAAE,cAAqC;CACtE,IAAI;CACJ,QAAQ,OAAO,CAAC,aAAa,IAAI,WAAW;EAC1C,MAAM,QAAQ,YAAY,MAAM;EAChC,aAAa;EACb,aAAa;GACX,IAAI,eAAe,OAAO,aAAa,KAAA;EACzC;CACF,CAAC;CACD,OAAO,6BAA6B;EAClC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,yCAAyC;EAC1E,OAAO;CACT,CAAC;AACH,CAAC;;;ACbD,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AACpE,MAAM,OAAU,UAAmC,UAAsB;CACvE,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,MAAM,cAAc;CACpB,OAAO;EAAE,GAAG;EAAU,GAAG;EAAa,GAAI,YAAY,cAAc,KAAA,IAAY,CAAC,IAAI,EACnF,WAAW,YAAY,UAAU,KAAK,cAAc;GAAE,UAAU;GAAY,GAAG;EAAS,EAAE,EAC5F;CAAG;AACL;AAEA,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,UAAU,aAAa,EACrB,IAAI,QAAwC;EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,GAAG,GAAGA,qBAAU,OAAO,CAAC,CAAC;CAAG,EACvG;AACF,CAAC"}
|
package/dist/extensions/web.mjs
CHANGED
|
@@ -111,9 +111,17 @@ function ReadToolMessage({ args, result, output, running, isError, fileTabFor, o
|
|
|
111
111
|
var read_web_default = defineToolRenderer({ message: ReadToolMessage });
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region generated/web.ts
|
|
114
|
-
const via = (identity, value) =>
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const via = (identity, value) => {
|
|
115
|
+
if (value === void 0) return void 0;
|
|
116
|
+
const declaration = value;
|
|
117
|
+
return {
|
|
118
|
+
...identity,
|
|
119
|
+
...declaration,
|
|
120
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
121
|
+
evidence: "declared",
|
|
122
|
+
...relation
|
|
123
|
+
})) }
|
|
124
|
+
};
|
|
117
125
|
};
|
|
118
126
|
const webPlugin = defineWebPlugin({
|
|
119
127
|
id: "read",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":["toolRead"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/read.web.tsx","../../generated/web.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\ntype Translate = (key: string, fallback: string, vars?: Readonly<Record<string, string | number>>) => string;\n\nexport interface ReadCallView {\n readonly path: string;\n /** `from N` and `N lines`, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\nfunction optionalNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** What the read call heading shows: the path, then the offset and limit when given. */\nexport function readCallView(args: Readonly<Record<string, unknown>>, t?: Translate): ReadCallView {\n const offset = optionalNumber(args.offset);\n const limit = optionalNumber(args.limit);\n return {\n path: typeof args.path === 'string' ? args.path : '',\n details: [\n offset === undefined ? undefined : (t?.('read.ui.fromLine', 'from {line}', { line: offset }) ?? `from ${offset}`),\n limit === undefined ? undefined : (t?.('read.ui.lines', '{count} lines', { count: limit }) ?? `${limit} lines`),\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n\nconst IMAGE_MIME_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);\n\n/** The image blocks a read returned, limited to the formats both cards can draw. */\nexport function resultImages(content: readonly unknown[]): Array<{ data: string; mimeType: string }> {\n return content.flatMap((block) => {\n if (typeof block !== 'object' || block === null || Array.isArray(block)) return [];\n const value = block as Record<string, unknown>;\n return value.type === 'image' &&\n typeof value.data === 'string' &&\n typeof value.mimeType === 'string' &&\n IMAGE_MIME_TYPES.has(value.mimeType)\n ? [{ data: value.data, mimeType: value.mimeType }]\n : [];\n });\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n ToolPathLink,\n toolTone,\n ViewableImage,\n} from '@agimon-ai/po-web-components';\n\nimport { readCallView, resultImages } from '../_lib/readToolView';\n\n/**\n * The read tool's timeline item, the web half of its renderCall and\n * renderResult: the call summary in the header and, when expanded, the\n * anchored lines with a line-number gutter in the body. A failure shows the\n * tool's message in red inside the expanded body instead.\n */\nexport function ReadToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const t = useT();\n const view = readCallView(args, t);\n const images = resultImages(result?.content ?? []);\n // A read is the one call whose file the session usually has not changed, so\n // this is the link that opens it read-only rather than in its history.\n const tab = fileTabFor(view.path);\n const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => {\n return (\n <>\n {/* no-untranslated-jsx: ignore - Tool identifier matches the invocation. */}\n <MessageItemHeader title=\"read\">\n <span data-testid=\"tool-call-read\" 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 {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 isError ? (\n <MessageItemBody data-testid=\"tool-result-read\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">{t('read.ui.failed', 'failed')}</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-red\">\n {line}\n </span>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-read\">\n <MessageItemStatus tone=\"running\">{t('read.ui.running', 'running')}</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (\n <MessageItemBody data-testid=\"tool-result-read\" className=\"flex flex-col gap-1\">\n {/* A read body is one file with no heading of its own, so the\n call's path is what names the grammar for it. */}\n <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />\n {images.map((image, index) => (\n <ViewableImage\n key={`${image.mimeType}:${String(index)}`}\n src={`data:${image.mimeType};base64,${image.data}`}\n alt={t('read.ui.resultImage', 'Read result {index}', { index: index + 1 })}\n data-testid=\"tool-result-read-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n ))}\n {body.notice !== undefined ? <span className=\"text-po-faint\">{body.notice}</span> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { ReadToolMessage } from './_components/ReadToolMessage';\n\nexport default defineToolRenderer({ message: ReadToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(frontend)/tool/read.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: 'read',\n packageName: '@agimon-ai/po-read',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['read'] }, toolRead)]; },\n },\n});\n"],"mappings":";;;;AAWA,SAAS,eAAe,OAAoC;CAC1D,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;;AAGA,SAAgB,aAAa,MAAyC,GAA6B;CACjG,MAAM,SAAS,eAAe,KAAK,MAAM;CACzC,MAAM,QAAQ,eAAe,KAAK,KAAK;CACvC,OAA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MAAM,SAAS,GAAG,OAAO,KAAK,GAKvC,CACF;KACA,KAAK,WAAW,KAAA,IAAY,oBAAC,QAAD;MAAM,WAAU;MAAiB,UAAA,KAAK;KAAa,CAAA,IAAI;IACrE;GAEjB,CAAA,IAAA,IACJ,EAAA,CAAA;EAEN;CACW,CAAA;AAEjB;;;AC3FA,IAAA,mBAAe,mBAAmB,EAAE,SAAS,gBAAgB,CAAC;;;ACC9D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,aAAa;CACb,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGA,gBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["toolRead"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/read.web.tsx","../../generated/web.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\ntype Translate = (key: string, fallback: string, vars?: Readonly<Record<string, string | number>>) => string;\n\nexport interface ReadCallView {\n readonly path: string;\n /** `from N` and `N lines`, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\nfunction optionalNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n/** What the read call heading shows: the path, then the offset and limit when given. */\nexport function readCallView(args: Readonly<Record<string, unknown>>, t?: Translate): ReadCallView {\n const offset = optionalNumber(args.offset);\n const limit = optionalNumber(args.limit);\n return {\n path: typeof args.path === 'string' ? args.path : '',\n details: [\n offset === undefined ? undefined : (t?.('read.ui.fromLine', 'from {line}', { line: offset }) ?? `from ${offset}`),\n limit === undefined ? undefined : (t?.('read.ui.lines', '{count} lines', { count: limit }) ?? `${limit} lines`),\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n\nconst IMAGE_MIME_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);\n\n/** The image blocks a read returned, limited to the formats both cards can draw. */\nexport function resultImages(content: readonly unknown[]): Array<{ data: string; mimeType: string }> {\n return content.flatMap((block) => {\n if (typeof block !== 'object' || block === null || Array.isArray(block)) return [];\n const value = block as Record<string, unknown>;\n return value.type === 'image' &&\n typeof value.data === 'string' &&\n typeof value.mimeType === 'string' &&\n IMAGE_MIME_TYPES.has(value.mimeType)\n ? [{ data: value.data, mimeType: value.mimeType }]\n : [];\n });\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n ToolPathLink,\n toolTone,\n ViewableImage,\n} from '@agimon-ai/po-web-components';\n\nimport { readCallView, resultImages } from '../_lib/readToolView';\n\n/**\n * The read tool's timeline item, the web half of its renderCall and\n * renderResult: the call summary in the header and, when expanded, the\n * anchored lines with a line-number gutter in the body. A failure shows the\n * tool's message in red inside the expanded body instead.\n */\nexport function ReadToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const t = useT();\n const view = readCallView(args, t);\n const images = resultImages(result?.content ?? []);\n // A read is the one call whose file the session usually has not changed, so\n // this is the link that opens it read-only rather than in its history.\n const tab = fileTabFor(view.path);\n const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => {\n return (\n <>\n {/* no-untranslated-jsx: ignore - Tool identifier matches the invocation. */}\n <MessageItemHeader title=\"read\">\n <span data-testid=\"tool-call-read\" 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 {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 isError ? (\n <MessageItemBody data-testid=\"tool-result-read\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">{t('read.ui.failed', 'failed')}</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-red\">\n {line}\n </span>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-read\">\n <MessageItemStatus tone=\"running\">{t('read.ui.running', 'running')}</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (\n <MessageItemBody data-testid=\"tool-result-read\" className=\"flex flex-col gap-1\">\n {/* A read body is one file with no heading of its own, so the\n call's path is what names the grammar for it. */}\n <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />\n {images.map((image, index) => (\n <ViewableImage\n key={`${image.mimeType}:${String(index)}`}\n src={`data:${image.mimeType};base64,${image.data}`}\n alt={t('read.ui.resultImage', 'Read result {index}', { index: index + 1 })}\n data-testid=\"tool-result-read-image\"\n className=\"h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain\"\n />\n ))}\n {body.notice !== undefined ? <span className=\"text-po-faint\">{body.notice}</span> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { ReadToolMessage } from './_components/ReadToolMessage';\n\nexport default defineToolRenderer({ message: ReadToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolRead from '../src/extensions/workspaces/sessions/(frontend)/tool/read.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nexport const webPlugin = defineWebPlugin({\n id: 'read',\n packageName: '@agimon-ai/po-read',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['read'] }, toolRead)]; },\n },\n});\n"],"mappings":";;;;AAWA,SAAS,eAAe,OAAoC;CAC1D,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACvE;;AAGA,SAAgB,aAAa,MAAyC,GAA6B;CACjG,MAAM,SAAS,eAAe,KAAK,MAAM;CACzC,MAAM,QAAQ,eAAe,KAAK,KAAK;CACvC,OAAO;EACL,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;EAClD,SAAS,CACP,WAAW,KAAA,IAAY,KAAA,IAAa,IAAI,oBAAoB,eAAe,EAAE,MAAM,OAAO,CAAC,KAAK,QAAQ,UACxG,UAAU,KAAA,IAAY,KAAA,IAAa,IAAI,iBAAiB,iBAAiB,EAAE,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,OACzG,CAAC,CAAC,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;CAC9E;AACF;AAEA,MAAM,mCAAmB,IAAI,IAAI;CAAC;CAAa;CAAc;CAAa;AAAY,CAAC;;AAGvF,SAAgB,aAAa,SAAwE;CACnG,OAAO,QAAQ,SAAS,UAAU;EAChC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;EACjF,MAAM,QAAQ;EACd,OAAO,MAAM,SAAS,WACpB,OAAO,MAAM,SAAS,YACtB,OAAO,M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AC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGA,gBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"platformRequirements":{},"sourceFiles":["NOTICE","generated/mcp-ui.ts","generated/mcp.ts","generated/native.ts","generated/server.ts","generated/web.ts","package.json","src/constants/package.ts","src/exports/apiContracts.ts","src/exports/index.ts","src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.stories.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.stories.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","src/extensions/workspaces/sessions/(frontend)/tool/read.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/read.native.tsx","src/extensions/workspaces/sessions/(frontend)/tool/read.web.tsx","src/schemas/apiContracts.ts","src/schemas/readTool.ts","src/services/readHost/index.edge.ts","src/services/readHost/index.ts","src/services/readHost/type.ts","src/services/readImage/index.ts","src/services/readTool/index.ts","tsdown.config.ts"],"sourceRevision":"
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["NOTICE","generated/mcp-ui.ts","generated/mcp.ts","generated/native.ts","generated/server.ts","generated/web.ts","package.json","src/constants/package.ts","src/exports/apiContracts.ts","src/exports/index.ts","src/extensions/workspaces/sessions/(backend)/tool/read.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/read.server.ts","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.stories.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.native.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.stories.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_components/ReadToolMessage.tsx","src/extensions/workspaces/sessions/(frontend)/tool/_lib/readToolView.ts","src/extensions/workspaces/sessions/(frontend)/tool/read.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/read.native.tsx","src/extensions/workspaces/sessions/(frontend)/tool/read.web.tsx","src/schemas/apiContracts.ts","src/schemas/readTool.ts","src/services/readHost/index.edge.ts","src/services/readHost/index.ts","src/services/readHost/type.ts","src/services/readImage/index.ts","src/services/readTool/index.ts","tsdown.config.ts"],"sourceRevision":"eb82f22f86a6c6471bba4b8b32e673fe","manifestRevision":"275082f5bf62c5eda6bd52eacbef7f28","outputFiles":["NOTICE","dist/apiContracts.cjs","dist/apiContracts.mjs","dist/extensions/mcp-ui.mjs","dist/extensions/mcp.cjs","dist/extensions/mcp.mjs","dist/extensions/native.mjs","dist/extensions/server.cjs","dist/extensions/server.mjs","dist/extensions/web.mjs","dist/index.cjs","dist/index.mjs","dist/readTool-CCyLjl3E.mjs","dist/readTool-DQSyk5NY.cjs"],"outputRevision":"70a0d1f6d67d78e4622d603759fe52c5"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-read",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.207",
|
|
4
4
|
"description": "Snapshot-bound hashline read tool for Pi and Po.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@agimon-ai/po-config": "0.0.0-alpha.
|
|
65
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
66
|
-
"@agimon-ai/po-hashline": "0.0.0-alpha.
|
|
67
|
-
"@agimon-ai/po-ui": "0.0.0-alpha.
|
|
68
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
64
|
+
"@agimon-ai/po-config": "0.0.0-alpha.207",
|
|
65
|
+
"@agimon-ai/po-core": "0.0.0-alpha.207",
|
|
66
|
+
"@agimon-ai/po-hashline": "0.0.0-alpha.207",
|
|
67
|
+
"@agimon-ai/po-ui": "0.0.0-alpha.207",
|
|
68
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.207",
|
|
69
69
|
"@deepseek-ai/cordis": "4.0.5",
|
|
70
70
|
"typebox": "1.4.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
74
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
73
|
+
"@agimon-ai/po-build": "0.0.0-alpha.207",
|
|
74
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.207",
|
|
75
75
|
"@earendil-works/pi-coding-agent": "1.6.1",
|
|
76
76
|
"@earendil-works/pi-durable": "1.6.1",
|
|
77
77
|
"@tanstack/react-store": "0.11.2",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"vitest": "5.0.4"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
91
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.207",
|
|
92
92
|
"@earendil-works/pi-coding-agent": "1.6.1",
|
|
93
93
|
"react-native": "0.88.1",
|
|
94
94
|
"react-native-unistyles": "^3.5.3"
|