pi-readseek 0.5.3 → 0.5.4
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/README.md +2 -2
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/readseek-settings.ts +9 -9
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ optional (defaults shown):
|
|
|
48
48
|
```json
|
|
49
49
|
{
|
|
50
50
|
"readseek": {
|
|
51
|
-
"
|
|
51
|
+
"replacedTools": [],
|
|
52
52
|
"imageMode": "force",
|
|
53
53
|
"syntaxValidation": "warn",
|
|
54
54
|
"timeoutMs": 120000,
|
|
@@ -60,7 +60,7 @@ optional (defaults shown):
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
- **
|
|
63
|
+
- **replacedTools:** built-in tool names to replace with their `readSeek_*` equivalents.
|
|
64
64
|
Valid values are `"read"`, `"edit"`, `"write"`, and `"grep"`. For a
|
|
65
65
|
readseek-only file surface, use `["read", "edit", "write", "grep"]`.
|
|
66
66
|
- **imageMode:** image OCR/caption/object analysis in `readSeek_read`: `"force"`
|
package/index.ts
CHANGED
|
@@ -45,7 +45,7 @@ export default function piReadSeekExtension(pi: ExtensionAPI): void {
|
|
|
45
45
|
|
|
46
46
|
pi.on("session_start", (_event, ctx) => {
|
|
47
47
|
const { settings, warnings } = resolveReadSeekJsonSettings();
|
|
48
|
-
const
|
|
48
|
+
const replacedTools = new Set<string>(settings.replacedTools ?? []);
|
|
49
49
|
const problems = warnings.map(formatSettingsWarning);
|
|
50
50
|
|
|
51
51
|
const availability = readSeekBinaryAvailability();
|
|
@@ -61,7 +61,7 @@ export default function piReadSeekExtension(pi: ExtensionAPI): void {
|
|
|
61
61
|
if (!availability.available) return;
|
|
62
62
|
|
|
63
63
|
const activeTools = [...pi.getActiveTools(), ...READSEEK_TOOL_NAMES]
|
|
64
|
-
.filter((name) => !
|
|
64
|
+
.filter((name) => !replacedTools.has(name));
|
|
65
65
|
pi.setActiveTools([...new Set(activeTools)]);
|
|
66
66
|
});
|
|
67
67
|
}
|
package/package.json
CHANGED
package/src/readseek-settings.ts
CHANGED
|
@@ -19,7 +19,7 @@ const READSEEK_TOOL_REPLACEMENTS = {
|
|
|
19
19
|
type ReadSeekReplacementTool = keyof typeof READSEEK_TOOL_REPLACEMENTS;
|
|
20
20
|
|
|
21
21
|
interface ReadSeekJsonSettings {
|
|
22
|
-
|
|
22
|
+
replacedTools?: ReadSeekReplacementTool[];
|
|
23
23
|
imageMode?: ReadSeekImageAnalysisMode;
|
|
24
24
|
syntaxValidation?: ReadSeekSyntaxValidationMode;
|
|
25
25
|
timeoutMs?: number;
|
|
@@ -37,7 +37,7 @@ export interface ReadSeekSettingsResult {
|
|
|
37
37
|
warnings: ReadSeekSettingsWarning[];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const READSEEK_KEYS = ["
|
|
40
|
+
const READSEEK_KEYS = ["replacedTools", "imageMode", "syntaxValidation", "timeoutMs", "grep"];
|
|
41
41
|
const READSEEK_GREP_KEYS = ["maxLines", "maxBytes"];
|
|
42
42
|
|
|
43
43
|
function globalSettingsPath(): string {
|
|
@@ -112,15 +112,15 @@ function readImageMode(
|
|
|
112
112
|
return undefined;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
function
|
|
115
|
+
function readReplacedTools(
|
|
116
116
|
raw: Record<string, unknown>,
|
|
117
117
|
source: string,
|
|
118
118
|
warnings: ReadSeekSettingsWarning[],
|
|
119
119
|
): ReadSeekReplacementTool[] | undefined {
|
|
120
|
-
if (!("
|
|
121
|
-
const value = raw.
|
|
120
|
+
if (!("replacedTools" in raw)) return undefined;
|
|
121
|
+
const value = raw.replacedTools;
|
|
122
122
|
if (!Array.isArray(value)) {
|
|
123
|
-
warnings.push(invalid(source, "readseek.
|
|
123
|
+
warnings.push(invalid(source, "readseek.replacedTools"));
|
|
124
124
|
return undefined;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -129,7 +129,7 @@ function readReplaceTools(
|
|
|
129
129
|
if (typeof tool === "string" && Object.hasOwn(READSEEK_TOOL_REPLACEMENTS, tool)) {
|
|
130
130
|
tools.push(tool as ReadSeekReplacementTool);
|
|
131
131
|
} else {
|
|
132
|
-
warnings.push(invalid(source, `readseek.
|
|
132
|
+
warnings.push(invalid(source, `readseek.replacedTools[${index}]`));
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
return tools;
|
|
@@ -156,8 +156,8 @@ function validateSettings(raw: unknown, source: string): ReadSeekSettingsResult
|
|
|
156
156
|
const section = raw.readseek;
|
|
157
157
|
warnUnknownKeys(section, READSEEK_KEYS, "readseek", source, warnings);
|
|
158
158
|
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
159
|
+
const replacedTools = readReplacedTools(section, source, warnings);
|
|
160
|
+
if (replacedTools !== undefined) settings.replacedTools = replacedTools;
|
|
161
161
|
|
|
162
162
|
const imageMode = readImageMode(section, source, warnings);
|
|
163
163
|
if (imageMode !== undefined) settings.imageMode = imageMode;
|