@agimon-ai/po-edit 0.0.0-alpha.29 → 0.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { defineNativePlugin, defineToolRenderer } from "@agimon-ai/po-core/native";
2
2
  import { View } from "react-native-unistyles/components/native/View";
3
3
  import { Text } from "react-native-unistyles/components/native/Text";
4
- import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SyntaxLine, ToolPathLink, collapseLines, fontOf, toolTone, useSyntaxLines } from "@agimon-ai/po-native-components";
4
+ import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SyntaxLine, ToolPathLink, fontOf, toolTone, useSyntaxLines } from "@agimon-ai/po-native-components";
5
5
  import { StyleSheet } from "react-native-unistyles";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts
@@ -59,8 +59,6 @@ function resultTextLines(result, output) {
59
59
  }
60
60
  //#endregion
61
61
  //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.native.tsx
62
- /** Diff rows shown until the item expands, as the web card. */
63
- const COLLAPSED_ROWS = 24;
64
62
  /**
65
63
  * The banded rows and the grammar over them, as the web's DiffRows: parsed as
66
64
  * one document, so a replaced line is seen twice and may colour oddly, and the
@@ -106,7 +104,7 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
106
104
  running,
107
105
  isError
108
106
  }),
109
- expandable: view !== void 0 && view.rows.length > COLLAPSED_ROWS,
107
+ expandable: true,
110
108
  children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
111
109
  title: "edit",
112
110
  children: /* @__PURE__ */ jsxs(View, {
@@ -121,7 +119,7 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
121
119
  children: ["· ", call.ranges]
122
120
  })]
123
121
  })
124
- }), isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
122
+ }), !expanded ? null : isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
125
123
  testID: "tool-result-edit",
126
124
  children: [/* @__PURE__ */ jsx(MessageItemStatus, {
127
125
  tone: "error",
@@ -137,20 +135,14 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
137
135
  tone: "running",
138
136
  children: "running"
139
137
  })
140
- }) : null : (() => {
141
- const { shown, hidden } = collapseLines(view.rows, COLLAPSED_ROWS, expanded);
142
- return /* @__PURE__ */ jsxs(MessageItemBody, {
143
- testID: "tool-result-edit",
144
- children: [/* @__PURE__ */ jsx(DiffRows, {
145
- rows: shown,
146
- gutter: view.gutter,
147
- path: call.path
148
- }), hidden > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
149
- expands: true,
150
- children: [hidden, " more rows"]
151
- }) : null]
152
- });
153
- })()] })
138
+ }) : null : /* @__PURE__ */ jsx(MessageItemBody, {
139
+ testID: "tool-result-edit",
140
+ children: /* @__PURE__ */ jsx(DiffRows, {
141
+ rows: view.rows,
142
+ gutter: view.gutter,
143
+ path: call.path
144
+ })
145
+ })] })
154
146
  });
155
147
  }
156
148
  const styles = StyleSheet.create((theme) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"native.mjs","names":["ToolMessageRenderProps","collapseLines","fontOf","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","SyntaxLine","ToolPathLink","toolTone","useSyntaxLines","PoNativeTheme","StyleSheet","DiffMarker","DiffRow","editCallView","editResultView","resultTextLines","COLLAPSED_ROWS","DiffRows","rows","gutter","path","spans","map","row","content","join","index","String","lineNumber","styles","marker","mono","padStart","ink","EditToolMessage","args","result","output","running","isError","fileTabFor","openTransientTab","call","view","undefined","tab","length","expanded","summary","onOpen","detail","ranges","line","error","shown","hidden","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","flexShrink","color","colors","faint","fontFamily","sans","fontSize","base","lineHeight","red","backgroundColor","sm","lineHeightRelaxed","green","dim","toolEdit"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/edit.native.tsx","../../generated/native.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** Pi emits `+12 text`, `-12 text`, ` 12 text`, and a blank-numbered ` ... ` elision between hunks. */\nconst DIFF_ROW_PATTERN = /^([+\\- ])( *\\d*) (.*)$/u;\nconst CONTEXT_MARKER = ' ';\n\nexport type DiffMarker = '+' | '-' | typeof CONTEXT_MARKER;\n\nexport interface DiffRow {\n readonly marker: DiffMarker;\n readonly lineNumber: string;\n readonly content: string;\n}\n\nexport interface EditCallView {\n readonly path: string;\n /** `N range` or `N ranges`, the count the TUI's call heading shows. */\n readonly ranges: string;\n}\n\nexport interface EditResultView {\n readonly rows: readonly DiffRow[];\n /** Widest line number among the rows, in characters, sizing the gutter. */\n readonly gutter: number;\n}\n\n/** What the edit call heading shows: the path and how many ranges the call touches. */\nexport function editCallView(args: Readonly<Record<string, unknown>>): EditCallView {\n const count = Array.isArray(args.edits) ? args.edits.length : 0;\n return {\n path: typeof args.path === 'string' ? args.path : '',\n ranges: `${count} ${count === 1 ? 'range' : 'ranges'}`,\n };\n}\n\nfunction toDiffMarker(value: string | undefined): DiffMarker {\n return value === '+' || value === '-' ? value : CONTEXT_MARKER;\n}\n\n/** Pi's display diff as rows; a line that is not a diff row reads as unnumbered context. */\nexport function parseDiffRows(diff: string): DiffRow[] {\n return diff.split('\\n').map((line) => {\n const expanded = line.replaceAll('\\t', ' ');\n const match = DIFF_ROW_PATTERN.exec(expanded);\n if (!match) return { marker: CONTEXT_MARKER, lineNumber: '', content: expanded };\n return { marker: toDiffMarker(match[1]), lineNumber: (match[2] ?? '').trim(), content: match[3] ?? '' };\n });\n}\n\n/** The diff a successful edit carries in its details; undefined when the details never arrived. */\nexport function editResultView(result: ToolResultView | null): EditResultView | undefined {\n const details = result?.details;\n if (typeof details !== 'object' || details === null) return undefined;\n const diff = (details as { diff?: unknown }).diff;\n if (typeof diff !== 'string' || diff.length === 0) return undefined;\n const rows = parseDiffRows(diff);\n return { rows, gutter: rows.reduce((widest, row) => Math.max(widest, row.lineNumber.length), 1) };\n}\n\n/** The result's text lines, for the error case where the diff never happened. */\nexport function resultTextLines(result: ToolResultView | null, output: string): string[] {\n const text =\n result === null\n ? output\n : result.content\n .flatMap((block) => {\n const record =\n typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n const lines = text.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n return lines;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n collapseLines,\n fontOf,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\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 { type DiffMarker, type DiffRow, editCallView, editResultView, resultTextLines } from '../_lib/editToolView';\n\n/** Diff rows shown until the item expands, as the web card. */\nconst COLLAPSED_ROWS = 24;\n\n/**\n * The banded rows and the grammar over them, as the web's DiffRows: parsed as\n * one document, so a replaced line is seen twice and may colour oddly, and the\n * `+`/`-` wash stays underneath so what changed is still legible.\n */\nfunction DiffRows({ rows, gutter, path }: { rows: readonly DiffRow[]; gutter: number; path: string }) {\n const spans = useSyntaxLines(rows.map((row) => row.content).join('\\n'), { path });\n return (\n <View>\n {rows.map((row, index) => (\n <View key={`${String(index)}-${row.lineNumber}`} style={styles.row(row.marker)}>\n <Text style={[styles.mono, styles.gutter]}>{row.lineNumber.padStart(gutter)}</Text>\n <Text style={[styles.mono, styles.ink(row.marker)]}>{row.marker}</Text>\n <SyntaxLine\n selectable\n spans={spans?.[index]}\n text={row.content}\n style={[styles.mono, styles.content, styles.ink(row.marker)]}\n />\n </View>\n ))}\n </View>\n );\n}\n\n/**\n * The edit tool's timeline item on native, as the web's EditToolMessage:\n * `path · N ranges` in the header, the display diff banded by row in the body,\n * and the tool's message in red when the edit failed.\n */\nexport function EditToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const call = editCallView(args);\n const view = result === null || isError ? undefined : editResultView(result);\n const tab = fileTabFor(call.path);\n return (\n <MessageItem\n tone={toolTone({ running, isError })}\n expandable={view !== undefined && view.rows.length > COLLAPSED_ROWS}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"edit\">\n <View testID=\"tool-call-edit\" style={styles.summary}>\n <ToolPathLink path={call.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n <Text numberOfLines={1} style={styles.detail}>\n · {call.ranges}\n </Text>\n </View>\n </MessageItemHeader>\n {isError ? (\n <MessageItemBody testID=\"tool-result-edit\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={styles.error}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : view === undefined ? (\n running ? (\n <MessageItemBody testID=\"tool-result-edit\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n (() => {\n const { shown, hidden } = collapseLines(view.rows, COLLAPSED_ROWS, expanded);\n return (\n <MessageItemBody testID=\"tool-result-edit\">\n <DiffRows rows={shown} gutter={view.gutter} path={call.path} />\n {hidden > 0 ? <MessageItemStatus expands>{hidden} more rows</MessageItemStatus> : null}\n </MessageItemBody>\n );\n })()\n )}\n </>\n )}\n </MessageItem>\n );\n}\n\n// Po carries a diff on the background the way Magit does: a green wash on\n// added rows, a red wash on removed ones, and the foreground left to the text.\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n detail: {\n flexShrink: 0,\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n error: {\n color: theme.colors.red,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n row: (marker: DiffMarker) => ({\n flexDirection: 'row',\n gap: theme.spacing(2),\n backgroundColor:\n marker === '+' ? theme.colors['tint-green'] : marker === '-' ? theme.colors['tint-red'] : undefined,\n }),\n mono: {\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n gutter: { color: theme.colors.faint },\n ink: (marker: DiffMarker) => ({\n color: marker === '+' ? theme.colors.green : marker === '-' ? theme.colors.red : theme.colors.dim,\n }),\n content: { flex: 1, minWidth: 0 },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { EditToolMessage } from './_components/EditToolMessage.native';\n\nexport default defineToolRenderer({ message: EditToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolEdit from '../src/extensions/workspaces/sessions/(frontend)/tool/edit.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: 'edit',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['edit'] }, toolEdit)]; },\n },\n});\n"],"mappings":";;;;;;;;AAGA,MAAM,mBAAmB;AACzB,MAAM,i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M2B,MAAMU,OAAOW,QAAQhD,WAAW,MAAM2B,MAAMU,OAAOO,MAAMjB,MAAMU,OAAOY;EAAGf,mBAAA,CAAA,CAAA;CACnG;CACAxC,SAAS;EAAEkC,MAAM;EAAGK,UAAU;CAAE;AAClC,EAAE;;;AC5IF,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,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGiB,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
1
+ {"version":3,"file":"native.mjs","names":["ToolMessageRenderProps","fontOf","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","SyntaxLine","ToolPathLink","toolTone","useSyntaxLines","PoNativeTheme","StyleSheet","DiffMarker","DiffRow","editCallView","editResultView","resultTextLines","DiffRows","rows","gutter","path","spans","map","row","content","join","index","String","lineNumber","styles","marker","mono","padStart","ink","EditToolMessage","args","result","output","running","isError","fileTabFor","openTransientTab","call","view","undefined","tab","expanded","summary","onOpen","detail","ranges","line","error","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","flexShrink","color","colors","faint","fontFamily","sans","fontSize","base","lineHeight","red","backgroundColor","sm","lineHeightRelaxed","green","dim","toolEdit"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/edit.native.tsx","../../generated/native.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** Pi emits `+12 text`, `-12 text`, ` 12 text`, and a blank-numbered ` ... ` elision between hunks. */\nconst DIFF_ROW_PATTERN = /^([+\\- ])( *\\d*) (.*)$/u;\nconst CONTEXT_MARKER = ' ';\n\nexport type DiffMarker = '+' | '-' | typeof CONTEXT_MARKER;\n\nexport interface DiffRow {\n readonly marker: DiffMarker;\n readonly lineNumber: string;\n readonly content: string;\n}\n\nexport interface EditCallView {\n readonly path: string;\n /** `N range` or `N ranges`, the count the TUI's call heading shows. */\n readonly ranges: string;\n}\n\nexport interface EditResultView {\n readonly rows: readonly DiffRow[];\n /** Widest line number among the rows, in characters, sizing the gutter. */\n readonly gutter: number;\n}\n\n/** What the edit call heading shows: the path and how many ranges the call touches. */\nexport function editCallView(args: Readonly<Record<string, unknown>>): EditCallView {\n const count = Array.isArray(args.edits) ? args.edits.length : 0;\n return {\n path: typeof args.path === 'string' ? args.path : '',\n ranges: `${count} ${count === 1 ? 'range' : 'ranges'}`,\n };\n}\n\nfunction toDiffMarker(value: string | undefined): DiffMarker {\n return value === '+' || value === '-' ? value : CONTEXT_MARKER;\n}\n\n/** Pi's display diff as rows; a line that is not a diff row reads as unnumbered context. */\nexport function parseDiffRows(diff: string): DiffRow[] {\n return diff.split('\\n').map((line) => {\n const expanded = line.replaceAll('\\t', ' ');\n const match = DIFF_ROW_PATTERN.exec(expanded);\n if (!match) return { marker: CONTEXT_MARKER, lineNumber: '', content: expanded };\n return { marker: toDiffMarker(match[1]), lineNumber: (match[2] ?? '').trim(), content: match[3] ?? '' };\n });\n}\n\n/** The diff a successful edit carries in its details; undefined when the details never arrived. */\nexport function editResultView(result: ToolResultView | null): EditResultView | undefined {\n const details = result?.details;\n if (typeof details !== 'object' || details === null) return undefined;\n const diff = (details as { diff?: unknown }).diff;\n if (typeof diff !== 'string' || diff.length === 0) return undefined;\n const rows = parseDiffRows(diff);\n return { rows, gutter: rows.reduce((widest, row) => Math.max(widest, row.lineNumber.length), 1) };\n}\n\n/** The result's text lines, for the error case where the diff never happened. */\nexport function resultTextLines(result: ToolResultView | null, output: string): string[] {\n const text =\n result === null\n ? output\n : result.content\n .flatMap((block) => {\n const record =\n typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n const lines = text.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n return lines;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\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 { type DiffMarker, type DiffRow, editCallView, editResultView, resultTextLines } from '../_lib/editToolView';\n\n/**\n * The banded rows and the grammar over them, as the web's DiffRows: parsed as\n * one document, so a replaced line is seen twice and may colour oddly, and the\n * `+`/`-` wash stays underneath so what changed is still legible.\n */\nfunction DiffRows({ rows, gutter, path }: { rows: readonly DiffRow[]; gutter: number; path: string }) {\n const spans = useSyntaxLines(rows.map((row) => row.content).join('\\n'), { path });\n return (\n <View>\n {rows.map((row, index) => (\n <View key={`${String(index)}-${row.lineNumber}`} style={styles.row(row.marker)}>\n <Text style={[styles.mono, styles.gutter]}>{row.lineNumber.padStart(gutter)}</Text>\n <Text style={[styles.mono, styles.ink(row.marker)]}>{row.marker}</Text>\n <SyntaxLine\n selectable\n spans={spans?.[index]}\n text={row.content}\n style={[styles.mono, styles.content, styles.ink(row.marker)]}\n />\n </View>\n ))}\n </View>\n );\n}\n\n/**\n * The edit tool's timeline item on native, as the web's EditToolMessage:\n * `path · N ranges` in the header, the display diff banded by row in the body,\n * and the tool's message in red when the edit failed.\n */\nexport function EditToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const call = editCallView(args);\n const view = result === null || isError ? undefined : editResultView(result);\n const tab = fileTabFor(call.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"edit\">\n <View testID=\"tool-call-edit\" style={styles.summary}>\n <ToolPathLink path={call.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n <Text numberOfLines={1} style={styles.detail}>\n · {call.ranges}\n </Text>\n </View>\n </MessageItemHeader>\n {!expanded ? null : isError ? (\n <MessageItemBody testID=\"tool-result-edit\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={styles.error}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : view === undefined ? (\n running ? (\n <MessageItemBody testID=\"tool-result-edit\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody testID=\"tool-result-edit\">\n <DiffRows rows={view.rows} gutter={view.gutter} path={call.path} />\n </MessageItemBody>\n )}\n </>\n )}\n </MessageItem>\n );\n}\n\n// Po carries a diff on the background the way Magit does: a green wash on\n// added rows, a red wash on removed ones, and the foreground left to the text.\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n detail: {\n flexShrink: 0,\n color: theme.colors.faint,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n error: {\n color: theme.colors.red,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n row: (marker: DiffMarker) => ({\n flexDirection: 'row',\n gap: theme.spacing(2),\n backgroundColor:\n marker === '+' ? theme.colors['tint-green'] : marker === '-' ? theme.colors['tint-red'] : undefined,\n }),\n mono: {\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeightRelaxed.sm,\n },\n gutter: { color: theme.colors.faint },\n ink: (marker: DiffMarker) => ({\n color: marker === '+' ? theme.colors.green : marker === '-' ? theme.colors.red : theme.colors.dim,\n }),\n content: { flex: 1, minWidth: 0 },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { EditToolMessage } from './_components/EditToolMessage.native';\n\nexport default defineToolRenderer({ message: EditToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolEdit from '../src/extensions/workspaces/sessions/(frontend)/tool/edit.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: 'edit',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['edit'] }, toolEdit)]; },\n },\n});\n"],"mappings":";;;;;;;;AAGA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;;AAuBvB,SAAgB,aAAa,MAAuD;CAClF,MAAM,QAAQ,MAAM,QAAQ,KAAK,KAAK,IAAI,KAAK,MAAM,SAAS;CAC9D,OAAO;EACL,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;EAClD,QAAQ,GAAG,MAAM,GAAG,UAAU,IAAI,UAAU;CAC9C;AACF;AAEA,SAAS,aAAa,OAAuC;CAC3D,OAAO,UAAU,OAAO,UAAU,MAAM,QAAQ;AAClD;;AAGA,SAAgB,cAAc,MAAyB;CACrD,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,KAAK,SAAS;EACpC,MAAM,WAAW,KAAK,WAAW,KAAM,IAAI;EAC3C,MAAM,QAAQ,iBAAiB,KAAK,QAAQ;EAC5C,IAAI,CAAC,OAAO,OAAO;GAAE,QAAQ;GAAgB,YAAY;GAAI,SAAS;EA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E,KAAKJ,MAAMK,QAAQ,CAAC;EACpBa,iBACE1C,WAAW,MAAMwB,MAAMU,OAAO,gBAAgBlC,WAAW,MAAMwB,MAAMU,OAAO,cAAcpB,KAAAA;EAASiB,mBAAA,CAAA,CAAA;CACvG;CACA9B,MAAM;EACJmC,YAAYjE,OAAOqD,MAAMY,WAAWnC,IAAI;EACxCqC,UAAUd,MAAMc,SAASK;EACzBH,YAAYhB,MAAMoB,kBAAkBD;EAAEZ,mBAAA,CAAA,CAAA;CACxC;CACA1C,QAAQ;EAAE4C,OAAOT,MAAMU,OAAOC;EAAKJ,mBAAA,CAAA,CAAA;CAAC;CACpC5B,MAAMH,YAAwB;EAC5BiC,OAAOjC,WAAW,MAAMwB,MAAMU,OAAOW,QAAQ7C,WAAW,MAAMwB,MAAMU,OAAOO,MAAMjB,MAAMU,OAAOY;EAAGf,mBAAA,CAAA,CAAA;CACnG;CACArC,SAAS;EAAE+B,MAAM;EAAGK,UAAU;CAAE;AAClC,EAAE;;;AC/HF,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,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGiB,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { defineToolRenderer, defineWebPlugin } from "@agimon-ai/po-core/web";
2
- import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SyntaxLine, ToolPathLink, collapseLines, toolTone, useSyntaxLines } from "@agimon-ai/po-web-components";
2
+ import { MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SyntaxLine, ToolPathLink, toolTone, useSyntaxLines } from "@agimon-ai/po-web-components";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts
5
5
  /** Pi emits `+12 text`, `-12 text`, ` 12 text`, and a blank-numbered ` ... ` elision between hunks. */
@@ -56,8 +56,6 @@ function resultTextLines(result, output) {
56
56
  }
57
57
  //#endregion
58
58
  //#region src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.tsx
59
- /** Diff rows shown until the item expands; about what the old scroll box held. */
60
- const COLLAPSED_ROWS = 24;
61
59
  const ROW_TONE = {
62
60
  "+": "bg-po-tint-green text-po-green",
63
61
  "-": "bg-po-tint-red text-po-red",
@@ -110,7 +108,7 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
110
108
  running,
111
109
  isError
112
110
  }),
113
- expandable: view !== void 0 && view.rows.length > COLLAPSED_ROWS,
111
+ expandable: true,
114
112
  children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
115
113
  title: "edit",
116
114
  children: /* @__PURE__ */ jsxs("span", {
@@ -124,7 +122,7 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
124
122
  children: ["· ", call.ranges]
125
123
  })]
126
124
  })
127
- }), isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
125
+ }), !expanded ? null : isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
128
126
  "data-testid": "tool-result-edit",
129
127
  className: "flex flex-col",
130
128
  children: [/* @__PURE__ */ jsx(MessageItemStatus, {
@@ -140,22 +138,15 @@ function EditToolMessage({ args, result, output, running, isError, fileTabFor, o
140
138
  tone: "running",
141
139
  children: "running"
142
140
  })
143
- }) : null : (() => {
144
- const { shown, hidden } = collapseLines(view.rows, COLLAPSED_ROWS, expanded);
145
- return /* @__PURE__ */ jsxs(MessageItemBody, {
146
- "data-testid": "tool-result-edit",
147
- className: "flex flex-col font-mono",
148
- children: [/* @__PURE__ */ jsx(DiffRows, {
149
- rows: shown,
150
- gutter: view.gutter,
151
- path: call.path
152
- }), hidden > 0 ? /* @__PURE__ */ jsxs(MessageItemStatus, {
153
- expands: true,
154
- className: "pt-1",
155
- children: [hidden, " more rows"]
156
- }) : null]
157
- });
158
- })()] })
141
+ }) : null : /* @__PURE__ */ jsx(MessageItemBody, {
142
+ "data-testid": "tool-result-edit",
143
+ className: "flex flex-col font-mono",
144
+ children: /* @__PURE__ */ jsx(DiffRows, {
145
+ rows: view.rows,
146
+ gutter: view.gutter,
147
+ path: call.path
148
+ })
149
+ })] })
159
150
  });
160
151
  }
161
152
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"web.mjs","names":["toolEdit"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/edit.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** Pi emits `+12 text`, `-12 text`, ` 12 text`, and a blank-numbered ` ... ` elision between hunks. */\nconst DIFF_ROW_PATTERN = /^([+\\- ])( *\\d*) (.*)$/u;\nconst CONTEXT_MARKER = ' ';\n\nexport type DiffMarker = '+' | '-' | typeof CONTEXT_MARKER;\n\nexport interface DiffRow {\n readonly marker: DiffMarker;\n readonly lineNumber: string;\n readonly content: string;\n}\n\nexport interface EditCallView {\n readonly path: string;\n /** `N range` or `N ranges`, the count the TUI's call heading shows. */\n readonly ranges: string;\n}\n\nexport interface EditResultView {\n readonly rows: readonly DiffRow[];\n /** Widest line number among the rows, in characters, sizing the gutter. */\n readonly gutter: number;\n}\n\n/** What the edit call heading shows: the path and how many ranges the call touches. */\nexport function editCallView(args: Readonly<Record<string, unknown>>): EditCallView {\n const count = Array.isArray(args.edits) ? args.edits.length : 0;\n return {\n path: typeof args.path === 'string' ? args.path : '',\n ranges: `${count} ${count === 1 ? 'range' : 'ranges'}`,\n };\n}\n\nfunction toDiffMarker(value: string | undefined): DiffMarker {\n return value === '+' || value === '-' ? value : CONTEXT_MARKER;\n}\n\n/** Pi's display diff as rows; a line that is not a diff row reads as unnumbered context. */\nexport function parseDiffRows(diff: string): DiffRow[] {\n return diff.split('\\n').map((line) => {\n const expanded = line.replaceAll('\\t', ' ');\n const match = DIFF_ROW_PATTERN.exec(expanded);\n if (!match) return { marker: CONTEXT_MARKER, lineNumber: '', content: expanded };\n return { marker: toDiffMarker(match[1]), lineNumber: (match[2] ?? '').trim(), content: match[3] ?? '' };\n });\n}\n\n/** The diff a successful edit carries in its details; undefined when the details never arrived. */\nexport function editResultView(result: ToolResultView | null): EditResultView | undefined {\n const details = result?.details;\n if (typeof details !== 'object' || details === null) return undefined;\n const diff = (details as { diff?: unknown }).diff;\n if (typeof diff !== 'string' || diff.length === 0) return undefined;\n const rows = parseDiffRows(diff);\n return { rows, gutter: rows.reduce((widest, row) => Math.max(widest, row.lineNumber.length), 1) };\n}\n\n/** The result's text lines, for the error case where the diff never happened. */\nexport function resultTextLines(result: ToolResultView | null, output: string): string[] {\n const text =\n result === null\n ? output\n : result.content\n .flatMap((block) => {\n const record =\n typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n const lines = text.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n return lines;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n collapseLines,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { type DiffRow, editCallView, editResultView, resultTextLines } from '../_lib/editToolView';\n\n/** Diff rows shown until the item expands; about what the old scroll box held. */\nconst COLLAPSED_ROWS = 24;\n\n// Po carries a diff on the background the way Magit does: a green wash on\n// added rows, a red wash on removed ones, and the foreground left to the text.\nconst ROW_TONE: Readonly<Record<DiffRow['marker'], string>> = {\n '+': 'bg-po-tint-green text-po-green',\n '-': 'bg-po-tint-red text-po-red',\n ' ': 'text-po-dim',\n};\n\n/**\n * The banded rows, and the grammar over them.\n *\n * Its own component because the colours come from a hook, and the body that\n * renders these rows is chosen inside a render prop. The rows are parsed as\n * one document: a diff is not a file, so a replaced line is seen twice and a\n * split string can colour oddly, which costs a token here and there and never\n * costs the reader the text. The `+` and `-` wash stays underneath, so what\n * changed is still legible when the grammar has coloured the foreground.\n */\nfunction DiffRows({ rows, gutter, path }: { rows: readonly DiffRow[]; gutter: number; path: string }) {\n const spans = useSyntaxLines(rows.map((row) => row.content).join('\\n'), { path });\n return (\n <>\n {rows.map((row, index) => (\n <span key={`${String(index)}-${row.lineNumber}`} className={`flex gap-2 ${ROW_TONE[row.marker]}`}>\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(gutter)}ch` }}>\n {row.lineNumber}\n </span>\n <span className=\"w-2 shrink-0\">{row.marker === ' ' ? '' : row.marker}</span>\n <SyntaxLine spans={spans?.[index]} text={row.content} className=\"min-w-0 whitespace-pre-wrap break-words\" />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The edit tool's timeline item: `path · N ranges` in the header; the display\n * diff from the result's details, banded by row, in the body. A successful\n * edit whose details never arrived shows nothing, and a failed one shows the\n * tool's message in red.\n */\nexport function EditToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const call = editCallView(args);\n const view = result === null || isError ? undefined : editResultView(result);\n // The file this edit lands in, opened from the header rather than found\n // again in a file list; plain text when nothing installed can show it.\n const tab = fileTabFor(call.path);\n return (\n <MessageItem\n tone={toolTone({ running, isError })}\n expandable={view !== undefined && view.rows.length > COLLAPSED_ROWS}\n >\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"edit\">\n <span data-testid=\"tool-call-edit\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink path={call.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n <span className=\"shrink-0 text-po-faint\">· {call.ranges}</span>\n </span>\n </MessageItemHeader>\n {isError ? (\n <MessageItemBody data-testid=\"tool-result-edit\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">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 ) : view === undefined ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-edit\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n (() => {\n const { shown, hidden } = collapseLines(view.rows, COLLAPSED_ROWS, expanded);\n return (\n <MessageItemBody data-testid=\"tool-result-edit\" className=\"flex flex-col font-mono\">\n <DiffRows rows={shown} gutter={view.gutter} path={call.path} />\n {hidden > 0 ? (\n <MessageItemStatus expands className=\"pt-1\">\n {hidden} more rows\n </MessageItemStatus>\n ) : null}\n </MessageItemBody>\n );\n })()\n )}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { EditToolMessage } from './_components/EditToolMessage';\n\nexport default defineToolRenderer({ message: EditToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolEdit from '../src/extensions/workspaces/sessions/(frontend)/tool/edit.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: 'edit',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['edit'] }, toolEdit)]; },\n },\n});\n"],"mappings":";;;;;AAGA,MAAM,mBAAmB;AACzB,MA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ACpHA,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,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":["toolEdit"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/editToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/EditToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/edit.web.tsx","../../generated/web.ts"],"sourcesContent":["import type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** Pi emits `+12 text`, `-12 text`, ` 12 text`, and a blank-numbered ` ... ` elision between hunks. */\nconst DIFF_ROW_PATTERN = /^([+\\- ])( *\\d*) (.*)$/u;\nconst CONTEXT_MARKER = ' ';\n\nexport type DiffMarker = '+' | '-' | typeof CONTEXT_MARKER;\n\nexport interface DiffRow {\n readonly marker: DiffMarker;\n readonly lineNumber: string;\n readonly content: string;\n}\n\nexport interface EditCallView {\n readonly path: string;\n /** `N range` or `N ranges`, the count the TUI's call heading shows. */\n readonly ranges: string;\n}\n\nexport interface EditResultView {\n readonly rows: readonly DiffRow[];\n /** Widest line number among the rows, in characters, sizing the gutter. */\n readonly gutter: number;\n}\n\n/** What the edit call heading shows: the path and how many ranges the call touches. */\nexport function editCallView(args: Readonly<Record<string, unknown>>): EditCallView {\n const count = Array.isArray(args.edits) ? args.edits.length : 0;\n return {\n path: typeof args.path === 'string' ? args.path : '',\n ranges: `${count} ${count === 1 ? 'range' : 'ranges'}`,\n };\n}\n\nfunction toDiffMarker(value: string | undefined): DiffMarker {\n return value === '+' || value === '-' ? value : CONTEXT_MARKER;\n}\n\n/** Pi's display diff as rows; a line that is not a diff row reads as unnumbered context. */\nexport function parseDiffRows(diff: string): DiffRow[] {\n return diff.split('\\n').map((line) => {\n const expanded = line.replaceAll('\\t', ' ');\n const match = DIFF_ROW_PATTERN.exec(expanded);\n if (!match) return { marker: CONTEXT_MARKER, lineNumber: '', content: expanded };\n return { marker: toDiffMarker(match[1]), lineNumber: (match[2] ?? '').trim(), content: match[3] ?? '' };\n });\n}\n\n/** The diff a successful edit carries in its details; undefined when the details never arrived. */\nexport function editResultView(result: ToolResultView | null): EditResultView | undefined {\n const details = result?.details;\n if (typeof details !== 'object' || details === null) return undefined;\n const diff = (details as { diff?: unknown }).diff;\n if (typeof diff !== 'string' || diff.length === 0) return undefined;\n const rows = parseDiffRows(diff);\n return { rows, gutter: rows.reduce((widest, row) => Math.max(widest, row.lineNumber.length), 1) };\n}\n\n/** The result's text lines, for the error case where the diff never happened. */\nexport function resultTextLines(result: ToolResultView | null, output: string): string[] {\n const text =\n result === null\n ? output\n : result.content\n .flatMap((block) => {\n const record =\n typeof block === 'object' && block !== null ? (block as { type?: unknown; text?: unknown }) : {};\n return record.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n');\n const lines = text.replaceAll('\\t', ' ').replaceAll('\\r\\n', '\\n').split('\\n');\n while (lines.at(-1) === '') lines.pop();\n return lines;\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n SyntaxLine,\n ToolPathLink,\n toolTone,\n useSyntaxLines,\n} from '@agimon-ai/po-web-components';\n\nimport { type DiffRow, editCallView, editResultView, resultTextLines } from '../_lib/editToolView';\n\n// Po carries a diff on the background the way Magit does: a green wash on\n// added rows, a red wash on removed ones, and the foreground left to the text.\nconst ROW_TONE: Readonly<Record<DiffRow['marker'], string>> = {\n '+': 'bg-po-tint-green text-po-green',\n '-': 'bg-po-tint-red text-po-red',\n ' ': 'text-po-dim',\n};\n\n/**\n * The banded rows, and the grammar over them.\n *\n * Its own component because the colours come from a hook, and the body that\n * renders these rows is chosen inside a render prop. The rows are parsed as\n * one document: a diff is not a file, so a replaced line is seen twice and a\n * split string can colour oddly, which costs a token here and there and never\n * costs the reader the text. The `+` and `-` wash stays underneath, so what\n * changed is still legible when the grammar has coloured the foreground.\n */\nfunction DiffRows({ rows, gutter, path }: { rows: readonly DiffRow[]; gutter: number; path: string }) {\n const spans = useSyntaxLines(rows.map((row) => row.content).join('\\n'), { path });\n return (\n <>\n {rows.map((row, index) => (\n <span key={`${String(index)}-${row.lineNumber}`} className={`flex gap-2 ${ROW_TONE[row.marker]}`}>\n <span className=\"shrink-0 text-right text-po-faint\" style={{ width: `${String(gutter)}ch` }}>\n {row.lineNumber}\n </span>\n <span className=\"w-2 shrink-0\">{row.marker === ' ' ? '' : row.marker}</span>\n <SyntaxLine spans={spans?.[index]} text={row.content} className=\"min-w-0 whitespace-pre-wrap break-words\" />\n </span>\n ))}\n </>\n );\n}\n\n/**\n * The edit tool's timeline item: `path · N ranges` in the header; the display\n * diff from the result's details, banded by row, in the body. A successful\n * edit whose details never arrived shows nothing, and a failed one shows the\n * tool's message in red.\n */\nexport function EditToolMessage({\n args,\n result,\n output,\n running,\n isError,\n fileTabFor,\n openTransientTab,\n}: ToolMessageRenderProps) {\n const call = editCallView(args);\n const view = result === null || isError ? undefined : editResultView(result);\n // The file this edit lands in, opened from the header rather than found\n // again in a file list; plain text when nothing installed can show it.\n const tab = fileTabFor(call.path);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"edit\">\n <span data-testid=\"tool-call-edit\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <ToolPathLink path={call.path} {...(tab === undefined ? {} : { onOpen: () => openTransientTab(tab) })} />\n <span className=\"shrink-0 text-po-faint\">· {call.ranges}</span>\n </span>\n </MessageItemHeader>\n {!expanded ? null : isError ? (\n <MessageItemBody data-testid=\"tool-result-edit\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">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 ) : view === undefined ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-edit\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : (\n <MessageItemBody data-testid=\"tool-result-edit\" className=\"flex flex-col font-mono\">\n <DiffRows rows={view.rows} gutter={view.gutter} path={call.path} />\n </MessageItemBody>\n )}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { EditToolMessage } from './_components/EditToolMessage';\n\nexport default defineToolRenderer({ message: EditToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolEdit from '../src/extensions/workspaces/sessions/(frontend)/tool/edit.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: 'edit',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['edit'] }, toolEdit)]; },\n },\n});\n"],"mappings":";;;;;AAGA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;;AAuBvB,SAAgB,aAAa,MAAuD;CAClF,MAAM,QAAQ,MAAM,QAAQ,KAAK,KAAK,IAAI,KAAK,MAAM,SAAS;CAC9D,OAAO;EACL,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO;EAClD,QAAQ,GAAG,MAAM,GAAG,UAAU,IAAI,UAAU;CAC9C;AACF;AAEA,SAAS,aAAa,OAAuC;CAC3D,OAAO,UAAU,OAAO,UAAU,MAAM,QAAQ;AAClD;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C,MAAG,KAAK,MAAa;IAC1D,CAAA,CAAA;;EACW,CAAA,GAClB,CAAC,WAAW,OAAO,UAClB,qBAAC,iBAAD;GAAiB,eAAY;GAAmB,WAAU;GAA1D,UAAA,CACE,oBAAC,mBAAD;IAAmB,MAAK;IAAQ,UAAA;GAAyB,CAAA,GACxD,gBAAgB,QAAQ,MAAM,CAAC,CAAC,KAAK,MAAM,UAC1C,oBAAC,QAAD;IAAuC,WAAU;IAC9C,UAAA;GACG,GAFK,GAAG,OAAO,KAAK,EAAE,GAAG,MAEzB,CACP,CACc;EACf,CAAA,IAAA,SAAS,KAAA,IACX,UACE,oBAAC,iBAAD;GAAiB,eAAY;GAC3B,UAAA,oBAAC,mBAAD;IAAmB,MAAK;IAAU,UAAA;GAA0B,CAAA;EAC7C,CAAA,IACf,OAEJ,oBAAC,iBAAD;GAAiB,eAAY;GAAmB,WAAU;GACxD,UAAA,oBAAC,UAAD;IAAU,MAAM,KAAK;IAAM,QAAQ,KAAK;IAAQ,MAAM,KAAK;GAAO,CAAA;EACnD,CAAA,CAEnB,EAAA,CAAA;CAEO,CAAA;AAEjB;;;ACnGA,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,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGA,gBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-edit",
3
- "version": "0.0.0-alpha.29",
3
+ "version": "0.0.0-alpha.30",
4
4
  "description": "Snapshot-bound hashline edit tool for Pi and Po.",
5
5
  "keywords": [
6
6
  "ai",
@@ -59,16 +59,16 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@agimon-ai/po-core": "0.0.0-alpha.29",
63
- "@agimon-ai/po-hashline": "0.0.0-alpha.29",
64
- "@agimon-ai/po-ui": "0.0.0-alpha.29",
65
- "@agimon-ai/po-web-components": "0.0.0-alpha.29",
62
+ "@agimon-ai/po-core": "0.0.0-alpha.30",
63
+ "@agimon-ai/po-hashline": "0.0.0-alpha.30",
64
+ "@agimon-ai/po-ui": "0.0.0-alpha.30",
65
+ "@agimon-ai/po-web-components": "0.0.0-alpha.30",
66
66
  "@deepseek-ai/cordis": "4.0.5",
67
67
  "typebox": "1.3.37"
68
68
  },
69
69
  "devDependencies": {
70
- "@agimon-ai/po-build": "0.0.0-alpha.29",
71
- "@agimon-ai/po-native-components": "0.0.0-alpha.29",
70
+ "@agimon-ai/po-build": "0.0.0-alpha.30",
71
+ "@agimon-ai/po-native-components": "0.0.0-alpha.30",
72
72
  "@earendil-works/pi-coding-agent": "1.3.0",
73
73
  "@tanstack/react-store": "0.11.2",
74
74
  "@tanstack/store": "0.11.2",
@@ -84,7 +84,7 @@
84
84
  "vitest": "5.0.4"
85
85
  },
86
86
  "peerDependencies": {
87
- "@agimon-ai/po-native-components": "0.0.0-alpha.29",
87
+ "@agimon-ai/po-native-components": "0.0.0-alpha.30",
88
88
  "@earendil-works/pi-coding-agent": "1.3.0",
89
89
  "react-native": "0.86.3",
90
90
  "react-native-unistyles": "^3.5.3"