@osovv/vv-opencode 1.2.7 → 1.2.10
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/CHANGELOG.md +29 -0
- package/README.md +63 -3
- package/dist/commands/patch-provider.js +2 -0
- package/dist/commands/patch-provider.js.map +1 -1
- package/dist/commands/plugin-list.js +8 -3
- package/dist/commands/plugin-list.js.map +1 -1
- package/dist/commands/plugin-toggle.js +8 -1
- package/dist/commands/plugin-toggle.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/opencode.js +3 -0
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/plugin-toggle-config.d.ts +44 -2
- package/dist/lib/plugin-toggle-config.js +132 -11
- package/dist/lib/plugin-toggle-config.js.map +1 -1
- package/dist/lib/vvoc-config.d.ts +80 -2
- package/dist/lib/vvoc-config.js +62 -1
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/plugins/hashline-edit/diff-summary.d.ts +7 -0
- package/dist/plugins/hashline-edit/diff-summary.js +79 -0
- package/dist/plugins/hashline-edit/diff-summary.js.map +1 -0
- package/dist/plugins/hashline-edit/edit-operation-primitives.js +22 -3
- package/dist/plugins/hashline-edit/edit-operation-primitives.js.map +1 -1
- package/dist/plugins/hashline-edit/index.js +315 -76
- package/dist/plugins/hashline-edit/index.js.map +1 -1
- package/dist/plugins/hashline-edit/normalize-edits.js +29 -25
- package/dist/plugins/hashline-edit/normalize-edits.js.map +1 -1
- package/dist/plugins/hashline-edit/replace-engine.d.ts +24 -0
- package/dist/plugins/hashline-edit/replace-engine.js +246 -0
- package/dist/plugins/hashline-edit/replace-engine.js.map +1 -0
- package/dist/plugins/hashline-edit/routing.d.ts +21 -0
- package/dist/plugins/hashline-edit/routing.js +105 -0
- package/dist/plugins/hashline-edit/routing.js.map +1 -0
- package/dist/plugins/hashline-edit/session-state.d.ts +23 -0
- package/dist/plugins/hashline-edit/session-state.js +70 -0
- package/dist/plugins/hashline-edit/session-state.js.map +1 -0
- package/dist/plugins/hashline-edit/str-replace-editor.d.ts +50 -0
- package/dist/plugins/hashline-edit/str-replace-editor.js +285 -0
- package/dist/plugins/hashline-edit/str-replace-editor.js.map +1 -0
- package/dist/plugins/hashline-edit/tool-description.d.ts +2 -1
- package/dist/plugins/hashline-edit/tool-description.js +31 -10
- package/dist/plugins/hashline-edit/tool-description.js.map +1 -1
- package/dist/plugins/hashline-edit/validation.d.ts +1 -0
- package/dist/plugins/hashline-edit/validation.js +13 -3
- package/dist/plugins/hashline-edit/validation.js.map +1 -1
- package/dist/plugins/tool-history-compaction/config.d.ts +28 -0
- package/dist/plugins/tool-history-compaction/config.js +133 -0
- package/dist/plugins/tool-history-compaction/config.js.map +1 -0
- package/dist/plugins/tool-history-compaction/index.d.ts +2 -0
- package/dist/plugins/tool-history-compaction/index.js +35 -0
- package/dist/plugins/tool-history-compaction/index.js.map +1 -0
- package/dist/plugins/tool-history-compaction/prune.d.ts +22 -0
- package/dist/plugins/tool-history-compaction/prune.js +70 -0
- package/dist/plugins/tool-history-compaction/prune.js.map +1 -0
- package/dist/plugins/tool-history-compaction/read-slim.d.ts +27 -0
- package/dist/plugins/tool-history-compaction/read-slim.js +91 -0
- package/dist/plugins/tool-history-compaction/read-slim.js.map +1 -0
- package/dist/plugins/tool-history-compaction/retention.d.ts +10 -0
- package/dist/plugins/tool-history-compaction/retention.js +45 -0
- package/dist/plugins/tool-history-compaction/retention.js.map +1 -0
- package/dist/plugins/tool-history-compaction/transform.d.ts +15 -0
- package/dist/plugins/tool-history-compaction/transform.js +93 -0
- package/dist/plugins/tool-history-compaction/transform.js.map +1 -0
- package/package.json +5 -1
- package/schemas/vvoc/v3.json +43 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// FILE: src/plugins/tool-history-compaction/transform.ts
|
|
2
|
+
// VERSION: 0.1.0
|
|
3
|
+
// START_MODULE_CONTRACT
|
|
4
|
+
// PURPOSE: Apply tool-history compaction to the in-memory message list the model is about to receive: walk messages newest-first, protect the recent tail, dispatch retained/read/other tools to the right compaction layer, and mutate only completed tool part outputs.
|
|
5
|
+
// SCOPE: Completed-tool-part detection, protected-tail accounting, retention dispatch, read-slim and prune application, and idempotent in-place output rewrites.
|
|
6
|
+
// DEPENDS: [src/plugins/tool-history-compaction/config.ts, src/plugins/tool-history-compaction/retention.ts, src/plugins/tool-history-compaction/prune.ts, src/plugins/tool-history-compaction/read-slim.ts]
|
|
7
|
+
// LINKS: [M-PLUGIN-TOOL-HISTORY-COMPACTION]
|
|
8
|
+
// ROLE: RUNTIME
|
|
9
|
+
// MAP_MODE: EXPORTS
|
|
10
|
+
// END_MODULE_CONTRACT
|
|
11
|
+
//
|
|
12
|
+
// START_MODULE_MAP
|
|
13
|
+
// TransformMessage - One message entry in the transform hook output.
|
|
14
|
+
// compactMessages - Deterministically rewrite eligible tool part outputs in place.
|
|
15
|
+
// END_MODULE_MAP
|
|
16
|
+
//
|
|
17
|
+
// START_CHANGE_SUMMARY
|
|
18
|
+
// LAST_CHANGE: [v0.1.0 - Established the transform core with protected tail, retention dispatch, and idempotence.]
|
|
19
|
+
// END_CHANGE_SUMMARY
|
|
20
|
+
import { pruneOutput } from "./prune.js";
|
|
21
|
+
import { slimReadOutput } from "./read-slim.js";
|
|
22
|
+
import { isRetainedTool } from "./retention.js";
|
|
23
|
+
function isCompletedToolPart(part) {
|
|
24
|
+
return part.type === "tool" && part.state.status === "completed";
|
|
25
|
+
}
|
|
26
|
+
function isCompactedByOpencode(part) {
|
|
27
|
+
const time = part.state.time;
|
|
28
|
+
return (typeof time === "object" && time !== null && "compacted" in time && time.compacted !== undefined);
|
|
29
|
+
}
|
|
30
|
+
function isReadTool(tool) {
|
|
31
|
+
return tool.toLowerCase() === "read";
|
|
32
|
+
}
|
|
33
|
+
// END_BLOCK_GUARDS
|
|
34
|
+
// START_BLOCK_COMPACT
|
|
35
|
+
/**
|
|
36
|
+
* Deterministically rewrite eligible tool part outputs in place.
|
|
37
|
+
* Model-agnostic: the current model is not needed. Non-destructive to inputs,
|
|
38
|
+
* part structure, and ordering. Idempotent: already-compacted parts are skipped
|
|
39
|
+
* by their markers, so a second pass is a no-op.
|
|
40
|
+
* @param messages - the transform hook's in-memory message list.
|
|
41
|
+
* @param config - resolved compaction config.
|
|
42
|
+
*/
|
|
43
|
+
export function compactMessages(messages, config) {
|
|
44
|
+
let remainingProtection = config.protectLastCalls;
|
|
45
|
+
let firstMessage = true;
|
|
46
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
47
|
+
const message = messages[i];
|
|
48
|
+
if (!message)
|
|
49
|
+
continue;
|
|
50
|
+
for (let j = message.parts.length - 1; j >= 0; j--) {
|
|
51
|
+
const part = message.parts[j];
|
|
52
|
+
if (!part || part.type !== "tool")
|
|
53
|
+
continue;
|
|
54
|
+
if (!isCompletedToolPart(part))
|
|
55
|
+
continue;
|
|
56
|
+
if (isCompactedByOpencode(part))
|
|
57
|
+
continue;
|
|
58
|
+
const withinTail = firstMessage || remainingProtection > 0;
|
|
59
|
+
if (withinTail) {
|
|
60
|
+
if (!firstMessage)
|
|
61
|
+
remainingProtection -= 1;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (isRetainedTool(part.tool, config.retainTools))
|
|
65
|
+
continue;
|
|
66
|
+
const output = part.state.output;
|
|
67
|
+
let rewritten;
|
|
68
|
+
if (config.readSlim && isReadTool(part.tool)) {
|
|
69
|
+
const slim = slimReadOutput(part.state.input, output, config);
|
|
70
|
+
if (slim) {
|
|
71
|
+
rewritten = slim.output;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const pruned = pruneOutput(output, config);
|
|
75
|
+
if (pruned)
|
|
76
|
+
rewritten = pruned.output;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const pruned = pruneOutput(output, config);
|
|
81
|
+
if (pruned)
|
|
82
|
+
rewritten = pruned.output;
|
|
83
|
+
}
|
|
84
|
+
if (rewritten !== undefined && rewritten !== output) {
|
|
85
|
+
part.state.output = rewritten;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (firstMessage)
|
|
89
|
+
firstMessage = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// END_BLOCK_COMPACT
|
|
93
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/plugins/tool-history-compaction/transform.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,iBAAiB;AACjB,wBAAwB;AACxB,4QAA4Q;AAC5Q,mKAAmK;AACnK,+MAA+M;AAC/M,8CAA8C;AAC9C,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,uEAAuE;AACvE,qFAAqF;AACrF,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,qHAAqH;AACrH,qBAAqB;AAIrB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAoBhD,SAAS,mBAAmB,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC;AACnE,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAuB;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IAC7B,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,WAAW,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CACjG,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,WAAW,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AAC,EAAE,CAAC;gBAC7C,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC9D,IAAI,IAAI,EAAE,CAAC;oBACT,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACN,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBAC3C,IAAI,MAAM;wBAAE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;gBACxC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC3C,IAAI,MAAM;oBAAE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;YACxC,CAAC;YAED,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;gBACpD,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;YAChC,CAAC;QACH,CAAC;QAED,IAAI,YAAY;YAAE,YAAY,GAAG,KAAK,CAAC;IACzC,CAAC;AACH,CAAC;AACD,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osovv/vv-opencode",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "A curated, opinionated set of OpenCode plugins for spec-first, review-driven, safer agentic development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
"./plugins/web-tools": {
|
|
74
74
|
"types": "./dist/plugins/web-tools/index.d.ts",
|
|
75
75
|
"import": "./dist/plugins/web-tools/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./plugins/tool-history-compaction": {
|
|
78
|
+
"types": "./dist/plugins/tool-history-compaction/index.d.ts",
|
|
79
|
+
"import": "./dist/plugins/tool-history-compaction/index.js"
|
|
76
80
|
}
|
|
77
81
|
},
|
|
78
82
|
"scripts": {
|
package/schemas/vvoc/v3.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@1.2.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@1.2.10/schemas/vvoc/v3.json",
|
|
4
4
|
"title": "vvoc config",
|
|
5
5
|
"description": "Canonical vvoc configuration document.",
|
|
6
6
|
"type": "object",
|
|
@@ -136,7 +136,48 @@
|
|
|
136
136
|
"type": "object",
|
|
137
137
|
"propertyNames": { "minLength": 1 },
|
|
138
138
|
"additionalProperties": {
|
|
139
|
-
"
|
|
139
|
+
"anyOf": [
|
|
140
|
+
{ "type": "boolean" },
|
|
141
|
+
{
|
|
142
|
+
"type": "object",
|
|
143
|
+
"additionalProperties": false,
|
|
144
|
+
"properties": {
|
|
145
|
+
"enabled": { "type": "boolean" },
|
|
146
|
+
"routing": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"additionalProperties": false,
|
|
149
|
+
"properties": {
|
|
150
|
+
"default": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"enum": ["hashline", "replace", "str_replace_editor", "passthrough"]
|
|
153
|
+
},
|
|
154
|
+
"rules": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"propertyNames": { "minLength": 1 },
|
|
157
|
+
"additionalProperties": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"enum": ["hashline", "replace", "str_replace_editor", "passthrough"]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"type": "object",
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"properties": {
|
|
170
|
+
"enabled": { "type": "boolean" },
|
|
171
|
+
"protectLastCalls": { "type": "integer", "minimum": 0 },
|
|
172
|
+
"minSavingsChars": { "type": "integer", "minimum": 0 },
|
|
173
|
+
"outputMaxChars": { "type": "integer", "minimum": 0 },
|
|
174
|
+
"headChars": { "type": "integer", "minimum": 0 },
|
|
175
|
+
"tailChars": { "type": "integer", "minimum": 0 },
|
|
176
|
+
"readSlim": { "type": "boolean" },
|
|
177
|
+
"retainTools": { "type": "array", "items": { "type": "string", "minLength": 1 } }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
140
181
|
}
|
|
141
182
|
},
|
|
142
183
|
"web": {
|