opencode-fold-tools 0.1.0 → 0.1.1
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 +1 -8
- package/README.zh-CN.md +1 -8
- package/index.js +9 -1
- package/package.json +28 -7
package/README.md
CHANGED
|
@@ -4,14 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Compact, expandable tool output for the OpenCode TUI. Each tool call keeps its own input summary in conversation order. Click the summary to reveal its output underneath; only the arrow changes on the input line.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
▸ Read src/example.ts
|
|
9
|
-
▸ Shell npm test
|
|
10
|
-
|
|
11
|
-
▾ Shell npm test
|
|
12
|
-
│ ✓ tests passed
|
|
13
|
-
│ …output continues here…
|
|
14
|
-
```
|
|
7
|
+

|
|
15
8
|
|
|
16
9
|
The expanded output has a theme-colored background and a left border. Collapsing it removes the output panel and its background. Consecutive reads and searches are not grouped.
|
|
17
10
|
|
package/README.zh-CN.md
CHANGED
|
@@ -4,14 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
为 OpenCode TUI 提供紧凑、可展开的工具输出。每次工具调用按原顺序保留一行输入摘要,点击后在下方展开输出;输入行只改变箭头。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
▸ Read src/example.ts
|
|
9
|
-
▸ Shell npm test
|
|
10
|
-
|
|
11
|
-
▾ Shell npm test
|
|
12
|
-
│ ✓ tests passed
|
|
13
|
-
│ …后续输出…
|
|
14
|
-
```
|
|
7
|
+

|
|
15
8
|
|
|
16
9
|
展开的输出区域使用主题背景色和左侧边线,收起后输出及背景一起消失。连续的读取和搜索不会合并分组。
|
|
17
10
|
|
package/index.js
CHANGED
|
@@ -99,7 +99,7 @@ export default {
|
|
|
99
99
|
id: 'opencode-fold-tools',
|
|
100
100
|
async tui(api) {
|
|
101
101
|
let sessionID, allOpen = false, serial = 0
|
|
102
|
-
const opened = new Set(), widgets = new Map(), hidden = new Map(), owned = new WeakSet(), nativeHeaders = new Map()
|
|
102
|
+
const opened = new Set(), widgets = new Map(), hidden = new Map(), owned = new WeakSet(), nativeHeaders = new Map(), separate = new WeakSet()
|
|
103
103
|
let disposed = false
|
|
104
104
|
// The host must create tool rows before this plugin can replace them.
|
|
105
105
|
if (api.kv?.get('tool_details_visibility', true) === false) api.kv.set('tool_details_visibility', true)
|
|
@@ -199,6 +199,14 @@ export default {
|
|
|
199
199
|
if (!widget) {
|
|
200
200
|
const root = new anchor.host.constructor(api.renderer, { id: `fold-tools-${++serial}`, flexDirection: 'column', paddingLeft: 3, flexShrink: 0 })
|
|
201
201
|
owned.add(root)
|
|
202
|
+
if (group.parts[0].tool === 'task') separate.add(root)
|
|
203
|
+
// Match native inline spacing, skipping the original tool hosts we hide.
|
|
204
|
+
root.onLifecyclePass = () => {
|
|
205
|
+
const siblings = children(root.parent)
|
|
206
|
+
const previous = siblings.slice(0, siblings.indexOf(root)).findLast(node => node.visible !== false && !node.isDestroyed)
|
|
207
|
+
const margin = separate.has(root) || previous && (previous.height > 1 || separate.has(previous)) ? 1 : 0
|
|
208
|
+
if (root.marginTop !== margin) root.marginTop = margin
|
|
209
|
+
}
|
|
202
210
|
const header = text(anchor.node.constructor, '', { maxHeight: 1, overflow: 'hidden', selectable: false })
|
|
203
211
|
const body = new transcript.constructor(api.renderer, { id: `fold-tools-${++serial}`, height: 14, width: '100%', border: ['left'], borderColor: api.theme.current.borderSubtle, backgroundColor: api.theme.current.backgroundPanel, padding: 1, stickyScroll: false, flexShrink: 0 })
|
|
204
212
|
owned.add(body)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-fold-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "One row per OpenCode tool call. Click to reveal its output, with native file diffs and no exploration grouping.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,15 +11,36 @@
|
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/ningzimu/opencode-fold-tools#readme",
|
|
13
13
|
"bugs": "https://github.com/ningzimu/opencode-fold-tools/issues",
|
|
14
|
-
"keywords": [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
"keywords": [
|
|
15
|
+
"opencode",
|
|
16
|
+
"opencode-plugin",
|
|
17
|
+
"tui",
|
|
18
|
+
"fold",
|
|
19
|
+
"tool-output"
|
|
20
|
+
],
|
|
21
|
+
"oc-plugin": [
|
|
22
|
+
"tui"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
"./tui": "./index.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"index.js",
|
|
29
|
+
"scripts",
|
|
30
|
+
"README.md",
|
|
31
|
+
"README.zh-CN.md",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"THIRD_PARTY_NOTICES.md"
|
|
34
|
+
],
|
|
18
35
|
"scripts": {
|
|
19
36
|
"test": "node --test",
|
|
20
37
|
"install:plugin": "node scripts/configure.mjs install",
|
|
21
38
|
"uninstall:plugin": "node scripts/configure.mjs uninstall"
|
|
22
39
|
},
|
|
23
|
-
"engines": {
|
|
24
|
-
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=22"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"jsonc-parser": "3.3.1"
|
|
45
|
+
}
|
|
25
46
|
}
|