openslimedit 1.0.2 → 1.0.3
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 +1 -1
- package/src/index.ts +0 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openslimedit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "OpenCode plugin that reduces token usage by up to 33% — compresses tool descriptions, compacts read output, adds line-range edit support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/index.ts
CHANGED
|
@@ -1,42 +1,8 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin"
|
|
2
2
|
import * as fs from "fs"
|
|
3
3
|
import * as path from "path"
|
|
4
|
-
import { z } from "zod"
|
|
5
|
-
|
|
6
4
|
const LINE_RANGE_RE = /^(\d+)(?:\s*-\s*(\d+))?$/
|
|
7
5
|
|
|
8
|
-
// Minimal parameter schemas (no .describe() calls = no descriptions in JSON schema)
|
|
9
|
-
const SLIM_PARAMS: Record<string, any> = {
|
|
10
|
-
read: z.object({
|
|
11
|
-
filePath: z.string(),
|
|
12
|
-
offset: z.coerce.number().optional(),
|
|
13
|
-
limit: z.coerce.number().optional(),
|
|
14
|
-
}),
|
|
15
|
-
edit: z.object({
|
|
16
|
-
filePath: z.string(),
|
|
17
|
-
oldString: z.string(),
|
|
18
|
-
newString: z.string(),
|
|
19
|
-
replaceAll: z.boolean().optional(),
|
|
20
|
-
}),
|
|
21
|
-
write: z.object({
|
|
22
|
-
filePath: z.string(),
|
|
23
|
-
content: z.string(),
|
|
24
|
-
}),
|
|
25
|
-
bash: z.object({
|
|
26
|
-
command: z.string(),
|
|
27
|
-
timeout: z.number().optional(),
|
|
28
|
-
}),
|
|
29
|
-
glob: z.object({
|
|
30
|
-
pattern: z.string(),
|
|
31
|
-
path: z.string().optional(),
|
|
32
|
-
}),
|
|
33
|
-
grep: z.object({
|
|
34
|
-
pattern: z.string(),
|
|
35
|
-
path: z.string().optional(),
|
|
36
|
-
include: z.string().optional(),
|
|
37
|
-
}),
|
|
38
|
-
}
|
|
39
|
-
|
|
40
6
|
export const OpenSlimeditPlugin: Plugin = async ({ directory }) => {
|
|
41
7
|
function resolvePath(filePath: string): string {
|
|
42
8
|
if (path.isAbsolute(filePath)) return path.normalize(filePath)
|
|
@@ -59,10 +25,6 @@ export const OpenSlimeditPlugin: Plugin = async ({ directory }) => {
|
|
|
59
25
|
if (SLIM[input.toolID]) {
|
|
60
26
|
output.description = SLIM[input.toolID]
|
|
61
27
|
}
|
|
62
|
-
// Parameter schema compression disabled — hurts large-file-edit on minimax
|
|
63
|
-
// if (SLIM_PARAMS[input.toolID]) {
|
|
64
|
-
// output.parameters = SLIM_PARAMS[input.toolID]
|
|
65
|
-
// }
|
|
66
28
|
},
|
|
67
29
|
|
|
68
30
|
// Compact tool output: shorten read paths, strip footer, compress edit results
|