pi-readseek 0.4.20 → 0.4.21
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 +2 -2
- package/src/read.ts +1 -1
- package/src/readseek-client.ts +37 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-readseek",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.21",
|
|
4
4
|
"description": "Pi extension for readseek-backed hash-anchored read/edit/grep, structural code maps, structural search, and file exploration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=20.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jarkkojs/readseek": "^0.4.
|
|
42
|
+
"@jarkkojs/readseek": "^0.4.22",
|
|
43
43
|
"diff": "^8.0.3",
|
|
44
44
|
"xxhash-wasm": "^1.1.0"
|
|
45
45
|
},
|
package/src/read.ts
CHANGED
|
@@ -165,7 +165,7 @@ export async function executeRead(opts: ExecuteReadOptions): Promise<AgentToolRe
|
|
|
165
165
|
} catch {
|
|
166
166
|
// detect unavailable — fall through to binary-as-text handling below
|
|
167
167
|
}
|
|
168
|
-
if (detection?.
|
|
168
|
+
if (detection?.kind === "image") {
|
|
169
169
|
const builtinRead = createReadTool(cwd);
|
|
170
170
|
const builtinResult = await builtinRead.execute(toolCallId, p, signal, onUpdate);
|
|
171
171
|
const transcript = detection.transcribe?.text?.trim();
|
package/src/readseek-client.ts
CHANGED
|
@@ -120,7 +120,8 @@ export interface ReadSeekTranscript {
|
|
|
120
120
|
|
|
121
121
|
export type ReadSeekDetection =
|
|
122
122
|
| {
|
|
123
|
-
|
|
123
|
+
kind: "source";
|
|
124
|
+
type: string;
|
|
124
125
|
file: string;
|
|
125
126
|
language: string;
|
|
126
127
|
engine?: string;
|
|
@@ -129,7 +130,8 @@ export type ReadSeekDetection =
|
|
|
129
130
|
syntax?: string;
|
|
130
131
|
}
|
|
131
132
|
| {
|
|
132
|
-
|
|
133
|
+
kind: "image";
|
|
134
|
+
type: string;
|
|
133
135
|
file: string;
|
|
134
136
|
mime?: string;
|
|
135
137
|
format: string;
|
|
@@ -139,12 +141,8 @@ export type ReadSeekDetection =
|
|
|
139
141
|
transcribe?: ReadSeekTranscript;
|
|
140
142
|
}
|
|
141
143
|
| {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
mime?: string;
|
|
145
|
-
}
|
|
146
|
-
| {
|
|
147
|
-
type: "text";
|
|
144
|
+
kind: "text";
|
|
145
|
+
type: string;
|
|
148
146
|
file: string;
|
|
149
147
|
mime?: string;
|
|
150
148
|
};
|
|
@@ -667,34 +665,38 @@ function parseDetectOutput(value: unknown): ReadSeekDetection {
|
|
|
667
665
|
const type = requireString(output.type, "type");
|
|
668
666
|
const file = requireString(output.file, "file");
|
|
669
667
|
const mime = optionalString(output.mime, "mime");
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
668
|
+
|
|
669
|
+
// readseek 0.4.22 made the detect enum untagged and repurposed `type` to
|
|
670
|
+
// carry the actual MIME type. Discriminate structurally: image detections
|
|
671
|
+
// carry `format`/`width`/`height`/`animated`; source detections carry
|
|
672
|
+
// `language`. Text and binary are byte-identical on the wire and collapse
|
|
673
|
+
// to the text variant.
|
|
674
|
+
if (output.format !== undefined || output.width !== undefined || output.height !== undefined) {
|
|
675
|
+
return {
|
|
676
|
+
kind: "image",
|
|
677
|
+
type,
|
|
678
|
+
file,
|
|
679
|
+
mime,
|
|
680
|
+
format: requireString(output.format, "format"),
|
|
681
|
+
width: requireNumber(output.width, "width"),
|
|
682
|
+
height: requireNumber(output.height, "height"),
|
|
683
|
+
animated: requireBoolean(output.animated, "animated"),
|
|
684
|
+
transcribe: parseTranscript(output.transcribe),
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
if (output.language !== undefined) {
|
|
688
|
+
return {
|
|
689
|
+
kind: "source",
|
|
690
|
+
type,
|
|
691
|
+
file,
|
|
692
|
+
language: requireString(output.language, "language"),
|
|
693
|
+
engine: optionalString(output.engine, "engine"),
|
|
694
|
+
supported: requireBoolean(output.supported, "supported"),
|
|
695
|
+
mime,
|
|
696
|
+
syntax: optionalString(output.syntax, "syntax"),
|
|
697
|
+
};
|
|
697
698
|
}
|
|
699
|
+
return { kind: "text", type, file, mime };
|
|
698
700
|
}
|
|
699
701
|
|
|
700
702
|
export async function readseekDetect(
|