@agimon-ai/doompi-read 0.0.1-alpha.25 → 0.0.1-alpha.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-read",
3
- "version": "0.0.1-alpha.25",
3
+ "version": "0.0.1-alpha.26",
4
4
  "description": "Snapshot-bound hashline read tool for Pi and DoomPi.",
5
5
  "keywords": [
6
6
  "ai",
@@ -52,12 +52,12 @@
52
52
  "dependencies": {
53
53
  "@deepseek-ai/cordis": "4.0.1",
54
54
  "typebox": "1.3.19",
55
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.52",
56
- "@agimon-ai/doompi-config": "0.0.1-alpha.52",
57
- "@agimon-ai/doompi-hashline": "0.0.1-alpha.24",
58
- "@agimon-ai/doompi-ui": "0.0.1-alpha.53",
59
- "@agimon-ai/doompi-web-components": "0.0.1-alpha.13",
60
- "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.16"
55
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.53",
56
+ "@agimon-ai/doompi-hashline": "0.0.1-alpha.25",
57
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.54",
58
+ "@agimon-ai/doompi-web-contracts": "0.0.1-alpha.17",
59
+ "@agimon-ai/doompi-config": "0.0.1-alpha.53",
60
+ "@agimon-ai/doompi-web-components": "0.0.1-alpha.14"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@earendil-works/pi-coding-agent": "0.84.4",
@@ -28,9 +28,9 @@ function resultImages(content: readonly unknown[]): Array<{ data: string; mimeTy
28
28
  }
29
29
  /**
30
30
  * The read tool's timeline item, the web half of its renderCall and
31
- * renderResult: the call summary in the header and the anchored lines with
32
- * a line-number gutter in the body, collapsed to the TUI's budget until the
33
- * item expands. A failure shows the tool's message in red instead.
31
+ * renderResult: the call summary in the header and, when expanded, the
32
+ * anchored lines with a line-number gutter in the body. A failure shows the
33
+ * tool's message in red inside the expanded body instead.
34
34
  */
35
35
  export function ReadToolMessage({
36
36
  args,
@@ -46,12 +46,10 @@ export function ReadToolMessage({
46
46
  // A read is the one call whose file the session usually has not changed, so
47
47
  // this is the link that opens it read-only rather than in its history.
48
48
  const tab = fileTabFor(view.path);
49
- const collapsed = result === null || isError ? null : hashlineBody(result, output, 'read', false);
49
+ const body = result === null || isError ? null : hashlineBody(result, output, 'read', true);
50
50
  return (
51
- <MessageItem tone={toolTone({ running, isError })} expandable={collapsed !== null && collapsed.hidden > 0}>
51
+ <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>
52
52
  {({ expanded }) => {
53
- const body =
54
- result === null || isError ? null : expanded ? hashlineBody(result, output, 'read', true) : collapsed;
55
53
  return (
56
54
  <>
57
55
  <MessageItemHeader title="read">
@@ -65,49 +63,50 @@ export function ReadToolMessage({
65
63
  ) : null}
66
64
  </span>
67
65
  </MessageItemHeader>
68
- {isError ? (
69
- <MessageItemBody data-testid="tool-result-read" className="flex flex-col">
70
- <MessageItemStatus tone="error">failed</MessageItemStatus>
71
- {resultTextLines(result, output).map((line, index) => (
72
- <span key={`${String(index)}-${line}`} className="whitespace-pre-wrap break-words text-doom-red">
73
- {line}
74
- </span>
75
- ))}
76
- </MessageItemBody>
77
- ) : body === null ? (
78
- running ? (
79
- <MessageItemBody data-testid="tool-result-read">
80
- <MessageItemStatus tone="running">running</MessageItemStatus>
66
+ {expanded ? (
67
+ isError ? (
68
+ <MessageItemBody data-testid="tool-result-read" className="flex flex-col">
69
+ <MessageItemStatus tone="error">failed</MessageItemStatus>
70
+ {resultTextLines(result, output).map((line, index) => (
71
+ <span key={`${String(index)}-${line}`} className="whitespace-pre-wrap break-words text-doom-red">
72
+ {line}
73
+ </span>
74
+ ))}
81
75
  </MessageItemBody>
82
- ) : null
83
- ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (
84
- <MessageItemBody data-testid="tool-result-read" className="flex flex-col gap-1">
85
- {/* A read body is one file with no heading of its own, so the
86
- call's path is what names the grammar for it. */}
87
- <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />
88
- {images.map((image, index) => {
89
- const url = `data:${image.mimeType};base64,${image.data}`;
90
- return (
91
- <a
92
- key={`${image.mimeType}:${String(index)}`}
93
- href={url}
94
- target="_blank"
95
- rel="noreferrer"
96
- className="self-start"
97
- >
98
- <img
99
- src={url}
100
- alt={`Read result ${String(index + 1)}`}
101
- data-testid="tool-result-read-image"
102
- className="h-auto max-h-96 max-w-full rounded-md border border-doom-border-soft object-contain"
103
- />
104
- </a>
105
- );
106
- })}
107
- {body.hidden > 0 ? <MessageItemStatus expands>{body.hidden} more lines</MessageItemStatus> : null}
108
- {body.notice !== undefined ? <span className="text-doom-faint">{body.notice}</span> : null}
109
- </MessageItemBody>
110
- )}
76
+ ) : body === null ? (
77
+ running ? (
78
+ <MessageItemBody data-testid="tool-result-read">
79
+ <MessageItemStatus tone="running">running</MessageItemStatus>
80
+ </MessageItemBody>
81
+ ) : null
82
+ ) : body.shown.length === 0 && body.notice === undefined && images.length === 0 ? null : (
83
+ <MessageItemBody data-testid="tool-result-read" className="flex flex-col gap-1">
84
+ {/* A read body is one file with no heading of its own, so the
85
+ call's path is what names the grammar for it. */}
86
+ <HashlineLines lines={body.shown} gutter={body.gutter} path={view.path} />
87
+ {images.map((image, index) => {
88
+ const url = `data:${image.mimeType};base64,${image.data}`;
89
+ return (
90
+ <a
91
+ key={`${image.mimeType}:${String(index)}`}
92
+ href={url}
93
+ target="_blank"
94
+ rel="noreferrer"
95
+ className="self-start"
96
+ >
97
+ <img
98
+ src={url}
99
+ alt={`Read result ${String(index + 1)}`}
100
+ data-testid="tool-result-read-image"
101
+ className="h-auto max-h-96 max-w-full rounded-md border border-doom-border-soft object-contain"
102
+ />
103
+ </a>
104
+ );
105
+ })}
106
+ {body.notice !== undefined ? <span className="text-doom-faint">{body.notice}</span> : null}
107
+ </MessageItemBody>
108
+ )
109
+ ) : null}
111
110
  </>
112
111
  );
113
112
  }}