@lyl-build/occo 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,83 @@
1
+ # Contributing
2
+
3
+ Use Bun 1.4.3 and the pinned OpenCode 2.3.0 / OpenTUI 0.8.4 baseline. Keep fixes within the plugin; do not introduce a host fork or a compatibility layer for older APIs.
4
+
5
+ ## Set up and check a change
6
+
7
+ From the repository root:
8
+
9
+ ```sh
10
+ bun install --frozen-lockfile
11
+ cd packages/occo
12
+ bun test
13
+ bun typecheck
14
+ bun run build
15
+ ```
16
+
17
+ Run tests and type checking from `packages/occo`, not the repository root. For input, rendering, storage, or lifecycle changes, also run `bun run test:host` with official OpenCode 2.3.0 available. See [VALIDATION.md](VALIDATION.md) for setup and coverage.
18
+
19
+ Work on a short-lived branch from `main`. A pull request should explain the user-visible problem, the change, and how it was tested. Include a minimal reproduction for bug fixes. Use synthetic prompt text in fixtures; remove private paths, credentials, and conversation content from reports and screenshots.
20
+
21
+ ## Code boundaries
22
+
23
+ - `composer.ts` is the only production module that writes to the native prompt. Preserve native undo, attachment marks, and stale-draft protection.
24
+ - `library.ts` is the only production module that changes persistent prompt-library state. Keep conflict checks and failure recovery intact.
25
+ - `extract.ts` walks Marked nodes into plain strings for readable prose, table cells, code, and literal HTML. Display metadata does not belong in extraction.
26
+ - `search.ts` prepares Unicode search projections, ranks matches, and creates completion edits; query evaluation stays in memory. Completion edits are the single source of preview and insertion text.
27
+ - `history.ts` loads all message pages for the active session and combines them with live transcript updates, owns loading/failure/retry state, and cancels outdated requests.
28
+ - `suggestions.tsx` owns display-row folding, timestamps, its eight-row viewport, theme-derived stripes and the one-row footer. The viewport measures preview heights only. Symmetric side markers use existing padding and close around the visible previews; empty states, filler and footer have no markers. The pieces belong to their candidate rows so mouse selection works on both sides. Alternating stripes adjust the dialog background's HSL lightness by +8 percentage points in dark mode or -8 in light mode, clamped to 0–100%, preserving hue, saturation and alpha. The host's `themeMode` determines the direction; text colors do not affect the stripe. The footer layout is pure; rendering owns colors and action handlers. `library-dialog.tsx` owns library interfaces; `tui.tsx` registers and disposes them.
29
+
30
+ Candidate rows place the left marker, two-column emoji and preview text directly next to each other. Only the timestamp has a one-column left margin; footer and empty-state padding are independent.
31
+
32
+ Prefer inferred types, early returns, and small functions with clear responsibilities. Avoid `any`, unnecessary destructuring, and single-use abstractions. Comment on non-obvious host constraints rather than restating code. Test the implementation using real OpenTUI components where practical.
33
+
34
+ ## Prepare release artifacts
35
+
36
+ Keep the root and package copies of both READMEs (English and Simplified Chinese), their images, both usage guides, CONTRIBUTING, VALIDATION, LICENSE, and THIRD_PARTY_NOTICES identical. Update both languages when behavior or installation instructions change. Update `release-files.json` when adding public files.
37
+
38
+ From `packages/occo`:
39
+
40
+ ```sh
41
+ bun run pack
42
+ bun run release:source
43
+ ```
44
+
45
+ The first command builds the installable archive. The second checks its inventory, scans release contents for local paths, common credential formats, and non-default package registries, checks documentation copies, and creates a source archive using the explicit file list. Both archives are written to `artifacts/`. Review their contents before publishing; automated checks cannot identify every kind of sensitive information.
46
+
47
+ Retain the MIT license and third-party notices in every distribution.
48
+
49
+ ## Releasing
50
+
51
+ Publishing to npm is automated by the `Release` GitHub Actions workflow, which runs when a tag matching `v*` is pushed:
52
+
53
+ 1. Update `version` in `packages/occo/package.json` and the archive name in both README languages, run the checks above plus `bun run pack` and `bun run release:source`, and fast-forward `main`.
54
+ 2. Tag the release commit as `vX.Y.Z` matching the package version and push the tag.
55
+ 3. CI reruns the gates on the tagged commit, verifies the tag matches the package version, and publishes to npm with provenance using the `NPM_TOKEN` repository secret (a granular npm access token).
56
+
57
+ The archives in `artifacts/` are local validation copies; npm receives a fresh pack built by CI from the tagged commit.
58
+
59
+ ## Refresh the README screenshots
60
+
61
+ On Windows, with Windows Terminal and its PowerShell profile available, and official OpenCode 2.3.0 on PATH (or its executable path in `OPENCODE_BIN`), run from `packages/occo`:
62
+
63
+ ```powershell
64
+ bun run screenshots
65
+ ```
66
+
67
+ The command opens a separate Windows Terminal window with `pwsh.exe`. It uses the `PowerShell` profile by default; set `OCCO_TERMINAL_PROFILE` to use another profile. The window keeps its default startup size, font and zoom; the script does not resize, maximize or position it, and needs no reference window. It records the actual viewport and pixel dimensions. Subsequent inputs and captures must match that recorded layout, so all scenes in one run use the same size. A mismatch stops capture rather than resizing the image.
68
+
69
+ Keep the demonstration window in the foreground while the command types into it. Windows native window capture reads the complete terminal content even when the taskbar overlaps the window. Only native window chrome, such as the title bar, is excluded. PNG files retain the original pixel dimensions. Text is not redrawn, and the OpenCode layout is not cropped or rearranged.
70
+
71
+ Each run uses a fresh configuration and data directory under `tmp/occo-readme-*`. It creates English and Chinese examples with three suggestions each: regression tests from a conversation table, and saved prompts with one-, two- and folded three-row previews. It checks source visibility, automatic menu opening and insertion without sending, then copies the four images to both documentation directories. It types only into its own window and does not press F12 or change the clipboard. The window closes when the run ends. Normal host tests keep their existing fixtures and directories.
72
+
73
+ Review all four images before packaging, including the full interface and any visible paths. Runtime files and window measurements stay in the temporary directory.
74
+
75
+ ### Frame the existing captures
76
+
77
+ `bun run screenshots` also creates framed display copies. To refresh only the frames without opening a terminal, run `bun run screenshots:frame` from `packages/occo`.
78
+
79
+ The frame uses an 80px transparent margin, 10px padding, a 24px corner radius and a `#15181D` shell. A 2px white outline at 15% opacity and a 1px black inner line at 30% opacity define its edges. Two black shadows provide depth: a 16% ambient shadow offset 16px down with three 14px-radius box-blur passes, and a 12% contact shadow offset 4px down with three 3px-radius passes. Each pass blurs both axes. All measurements refer to the original image pixels.
80
+
81
+ The generator copies the original screenshot at its native size without clipping its corners. It checks every decoded pixel in the copied region, shadow falloff and transparent canvas edges. Review the results on light and dark backgrounds at full size and around 900px display width. To check existing display copies without rewriting them, run `powershell -NoProfile -File script/frame-screenshots.ps1 -CheckOnly`.
82
+
83
+ README images use the `*-framed.png` files and link to the original PNGs. Keep both versions in the source and installable archives.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 opencode
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ <h1>
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/brand/header-dark.svg">
4
+ <img src="docs/brand/header-light.svg" width="560" alt="OCCO — Empower OpenCode with autocomplete.">
5
+ </picture>
6
+ </h1>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ English · [简体中文](README.zh-CN.md)
9
+
10
+ Tired of scrolling back to copy a reply?<br>
11
+ Tired of retyping the same prompts?
12
+
13
+ **OCCO adds autocomplete to OpenCode, with suggestions from your current conversation and saved prompts.** Type a few characters, choose a suggestion, and press Enter to insert it.
14
+
15
+ ## Reuse the conversation
16
+
17
+ Type a few characters from an earlier reply—even inside a Markdown table—to continue from the match to the end of that sentence or cell fragment. Code completes from the matched character to the end of its block.
18
+
19
+ [![Typing “Start with this: Add” offers three regression-test suggestions from the conversation table.](docs/conversation-en-framed.png)](docs/conversation-en.png)
20
+
21
+ ## Reuse your prompts
22
+
23
+ Save prompts you reuse often. Next time, type the first few letters to autocomplete the full prompt.
24
+
25
+ [![Typing “review” offers three saved prompts with single-line, multiline and folded previews.](docs/library-en-framed.png)](docs/library-en.png)
26
+
27
+ ## Install
28
+
29
+ For **OpenCode 2.3.0+**.
30
+
31
+ With Bun 1.4.3, run from the repository root:
32
+
33
+ ```sh
34
+ bun install --frozen-lockfile
35
+ cd packages/occo
36
+ bun run build
37
+ ```
38
+
39
+ Or install `@lyl-build/occo` from npm and use the installed directory—no build needed. Run `npm pack @lyl-build/occo` to produce `lyl-build-occo-0.2.0.tgz` with the same files for offline use.
40
+
41
+ From the plugin directory (`packages/occo`, `node_modules/@lyl-build/occo`, or the extracted `package`), generate its configuration:
42
+
43
+ ```sh
44
+ bun -e "console.log(JSON.stringify({plugins:[require('node:url').pathToFileURL(process.cwd()).href]},null,2))"
45
+ ```
46
+
47
+ Add the file URL to `plugins` in your OpenCode configuration environment's `cli.json`, keeping existing entries. Use the **package directory**, not `dist/tui.js`, then restart OpenCode. Remove the entry to disable OCCO.
48
+
49
+ ## Use
50
+
51
+ Type three English letters or two Chinese characters to get matching suggestions. 💬 completes conversation text from the match; ⭐ inserts a saved prompt in full. Use ↑/↓ to browse every match, within an eight-row viewport, with up to three preview rows per match.
52
+
53
+ | Action | How |
54
+ | --- | --- |
55
+ | Choose and insert | ↑/↓, then Enter |
56
+ | Close suggestions | Esc |
57
+ | Open or close the menu manually | F12 |
58
+ | Save your draft | Command palette → occo → **Save current prompt**, then Ctrl+S |
59
+ | Reuse a saved prompt | Command palette → occo → **Open prompt library**, then Ctrl+R |
60
+
61
+ **Enter inserts while the menu is open. Press Esc first if you want to send.** Saved prompts need no title. Insertion takes one undo step; replacement takes two.
62
+
63
+ Prompts are stored locally. Conversation suggestions use all completed user and assistant messages in the current session, appearing as history pages load.
64
+
65
+ [Usage details](docs/usage.md) · [Contributing](CONTRIBUTING.md) · [Tests and limitations](VALIDATION.md)
66
+
67
+ [MIT License](LICENSE) · [Third-party notices](THIRD_PARTY_NOTICES.md)
@@ -0,0 +1,67 @@
1
+ <h1>
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/brand/header-dark.svg">
4
+ <img src="docs/brand/header-light.svg" width="560" alt="OCCO — Empower OpenCode with autocomplete.">
5
+ </picture>
6
+ </h1>
7
+
8
+ [English](README.md) · 简体中文
9
+
10
+ 厌倦了为了复制一段回复而来回翻找?<br>
11
+ 厌倦了一遍遍输入同样的提示词?
12
+
13
+ **OCCO 为 OpenCode 提供自动补全,建议来自当前对话和已保存的提示词。** 输入几个字,选中建议,按 Enter 插入。
14
+
15
+ ## 复用对话
16
+
17
+ 输入之前回复中的几个字,即可从命中处补全到当前句子或表格单元格片段的末尾,不必回头翻找复制。代码从命中字符补全到代码块末尾。
18
+
19
+ [![输入“先做这个:补一个”,列出对话表格中的三条回归测试建议。](docs/conversation-zh-framed.png)](docs/conversation-zh.png)
20
+
21
+ ## 复用提示词
22
+
23
+ 将经常复用的提示词保存起来,下次只需输入前两字,就能自动补全完整提示词。
24
+
25
+ [![输入“审查”,列出三条已保存提示词,展示单行、多行和折叠预览。](docs/library-zh-framed.png)](docs/library-zh.png)
26
+
27
+ ## 安装
28
+
29
+ 适用于 **OpenCode 2.3.0+**。
30
+
31
+ 安装 Bun 1.4.3 后,在仓库根目录运行:
32
+
33
+ ```sh
34
+ bun install --frozen-lockfile
35
+ cd packages/occo
36
+ bun run build
37
+ ```
38
+
39
+ 也可以从 npm 安装 `@lyl-build/occo`,直接使用安装目录,无需构建。运行 `npm pack @lyl-build/occo` 可生成 `lyl-build-occo-0.2.0.tgz`,内容相同,适合离线使用。
40
+
41
+ 在插件目录(`packages/occo`、`node_modules/@lyl-build/occo` 或解压后的 `package`)生成配置:
42
+
43
+ ```sh
44
+ bun -e "console.log(JSON.stringify({plugins:[require('node:url').pathToFileURL(process.cwd()).href]},null,2))"
45
+ ```
46
+
47
+ 将文件 URL 加入当前 OpenCode 配置环境的 `cli.json` 中的 `plugins` 数组,保留已有条目。路径应指向**包目录**,不是 `dist/tui.js`。重启 OpenCode 即可加载,删除该条目即可禁用。
48
+
49
+ ## 使用
50
+
51
+ 输入三个英文字母或两个汉字,即可查找匹配建议。💬 从命中处补全对话片段;⭐ 插入完整的已保存提示词。↑/↓ 可以浏览全部结果,候选区最多占八行,每条预览最多三行。
52
+
53
+ | 操作 | 方式 |
54
+ | --- | --- |
55
+ | 选择并插入 | ↑/↓,然后 Enter |
56
+ | 关闭建议 | Esc |
57
+ | 手动开关菜单 | F12 |
58
+ | 保存当前草稿 | 命令面板 → occo → **Save current prompt**,再按 Ctrl+S |
59
+ | 插入已保存的提示词 | 命令面板 → occo → **Open prompt library**,再按 Ctrl+R |
60
+
61
+ **菜单打开时,Enter 用于插入。想发送草稿,请先按 Esc。** 保存提示词不用起标题;插入只需一步撤销,替换需要两步。
62
+
63
+ 提示词保存在本地。对话建议检索当前会话中所有已完成的用户消息和助手回复,历史每加载一页就提供对应结果。
64
+
65
+ [使用细节](docs/usage.zh-CN.md) · [参与贡献](CONTRIBUTING.md) · [测试与限制](VALIDATION.md)
66
+
67
+ [MIT 许可证](LICENSE) · [第三方声明](THIRD_PARTY_NOTICES.md)
@@ -0,0 +1,102 @@
1
+ # Third-party notices
2
+
3
+ The plugin distribution includes the following libraries. Their copyright and license texts are reproduced below.
4
+
5
+ ## fuzzysort 3.1.0
6
+
7
+ Fuzzy matching. [Project source](https://github.com/farzher/fuzzysort).
8
+
9
+ ```text
10
+ MIT License
11
+
12
+ Copyright (c) 2018 Stephen Kamenar
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ ```
32
+
33
+ ## marked 17.0.1
34
+
35
+ Markdown parsing. [Project source](https://github.com/markedjs/marked).
36
+
37
+ The following is marked's complete license file, including its Markdown notice.
38
+
39
+ ```text
40
+ # License information
41
+
42
+ ## Contribution License Agreement
43
+
44
+ If you contribute code to this project, you are implicitly allowing your code
45
+ to be distributed under the MIT license. You are also implicitly verifying that
46
+ all code is your original work. `</legalese>`
47
+
48
+ ## Marked
49
+
50
+ Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
51
+ Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a copy
54
+ of this software and associated documentation files (the "Software"), to deal
55
+ in the Software without restriction, including without limitation the rights
56
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
57
+ copies of the Software, and to permit persons to whom the Software is
58
+ furnished to do so, subject to the following conditions:
59
+
60
+ The above copyright notice and this permission notice shall be included in
61
+ all copies or substantial portions of the Software.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
69
+ THE SOFTWARE.
70
+
71
+ ## Markdown
72
+
73
+ Copyright © 2004, John Gruber
74
+ http://daringfireball.net/
75
+ All rights reserved.
76
+
77
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
78
+
79
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
80
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
81
+ * Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
82
+
83
+ This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
84
+ ```
85
+
86
+ ## entities 6.0.1
87
+
88
+ HTML entity decoding in Markdown text. [Project source](https://github.com/fb55/entities).
89
+
90
+ ```text
91
+ Copyright (c) Felix Böhm
92
+ All rights reserved.
93
+
94
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
95
+
96
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
97
+
98
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
99
+
100
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
101
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
102
+ ```
package/VALIDATION.md ADDED
@@ -0,0 +1,67 @@
1
+ # Validation
2
+
3
+ Verified baseline: OpenCode 2.3.0, OpenTUI 0.8.4, Solid 1.9.17, Bun 1.4.3, Windows x64. Run tests from `packages/occo`.
4
+
5
+ ## Unit and native-editor tests
6
+
7
+ ```sh
8
+ bun test
9
+ bun typecheck
10
+ ```
11
+
12
+ The tests exercise the search implementation and real OpenTUI text editors:
13
+
14
+ - Completed-message filtering; headings, nested lists, quotes, table cells, inline formatting, entities, hard breaks, literal HTML, code indentation, and sentence boundaries.
15
+ - English and Chinese queries; full-phrase ranking, final-draft deduplication, preserved right-hand text, complete saved-body insertion, and NFKC/grapheme-safe offsets.
16
+ - Insertion-text previews, direct original-text highlights, grapheme-safe wrapping, first-two/last-row folding, display-only line counts, absolute local timestamps and height-based viewports. Preview-height budgeting covers eight single-row entries, exact fits, low heights and complete selection visibility.
17
+ - Footer action/state separation, single-result counter omission, failure recovery hints, and every width from 0 to 100 columns with empty, single, multiple and large result counts. Labels stay whole and actions retain their order.
18
+ - Alternate-background HSL lightness changes of ±8 percentage points, hue and saturation preservation across mid-lightness, grayscale, black/white clamping, unchanged alpha and input colors. Native rendered stripes follow the host theme mode; both side markers always use the dialog base background.
19
+ - Stale drafts, cursor and session changes, protected attachment marks, and expanded pasted text.
20
+ - Native undo/redo: one step for insertion, two for replacement. OpenTUI 0.8.4 records replacement as deletion followed by insertion.
21
+
22
+ Search benchmarks use 1,000 fragments (200,000 UTF-8 bytes) and 10,000 fragments (2,000,000 bytes). After 30 warm-up queries, each measures 100 queries and checks p95 against budgets of 20ms and 100ms respectively. Extraction, index preparation, and query p95 are printed separately with the runtime; timings depend on the machine.
23
+
24
+ Measured on the baseline above on 2026-11-15:
25
+
26
+ | Fragments | Extraction | Index preparation | Query p95 | Query budget |
27
+ | --- | --- | --- | --- | --- |
28
+ | 1,000 | 12.74 ms | 38.58 ms | 0.61 ms | 20 ms |
29
+ | 10,000 | 111.77 ms | 347.19 ms | 10.62 ms | 100 ms |
30
+
31
+ ## Official-host integration
32
+
33
+ ```sh
34
+ bun run test:host
35
+ ```
36
+
37
+ Use official OpenCode 2.3.0 on PATH, or set `OPENCODE_BIN` to the executable. The harness launches two terminals in isolated projects and configuration directories. Its fixture provider points at a closed localhost port.
38
+
39
+ Coverage includes:
40
+
41
+ - Automatic suggestions, arrow selection, mouse selection, insertion without sending, and Esc followed by native sending.
42
+ - Empty results, native slash/mention priority, and menu alignment after resizing. Candidate markers, two-column emoji and preview text are contiguous; timestamps retain one separating column and their right alignment.
43
+ - Browsing beyond eight results, position/total display, selection retention after library updates, and preserving text to the right of phrase completions.
44
+ - Opening prose, table and code suggestions in a 242-message session, beyond the host's initial page; session isolation and cancellation on navigation.
45
+ - A test-only fault boundary around the real message client verifies partial-page availability, retry from the failed cursor, unchanged extraction identity, and cancelled-response isolation. A committed revert in a synthetic session verifies that removed messages leave the index.
46
+ - Body-only creation, editing, preview, duplicates, legacy records, and stale insertion rejection.
47
+ - Conflicting writes, concurrent additions across projects, unsaved-edit recovery, and a real filesystem write failure.
48
+ - Dialog-derived stripes and footer semantic surfaces, complete selected-row backgrounds, adjacent previews, symmetric markers enclosing the visible list across scrolling and resizing, unmarked empty states, filler and footer, left alignment, one-row footer geometry and theme changes with the menu open.
49
+ - Plugin disposal and removal of commands and menu renderables.
50
+
51
+ Frames, rendered cell colors, state snapshots, and the completion marker are written under `tmp/occo-integration`. These are local diagnostic artifacts, not release files.
52
+
53
+ Run `node script/integration.cjs --ui` after building the integration observer for focused UI checks. It uses `tmp/occo-ui-integration` and covers direct-save return, duplicate-submit prevention, readable summaries versus original previews, edit cancellation, list selection restoration, neighboring selection after deletion, and dialogs at 100×30, 60×20 and 40×16. It also checks conflict recovery, management without an insertion target, and a real-client fault boundary for loading, failure, stable menu height and retry.
54
+
55
+ Run `node script/integration.cjs --multiline` for mixed-height suggestions, timestamps, first-two/last-row folding, clicks on both side markers and on continuation text, full insertion and width/height changes. It checks default dark/light, Dracula and a real custom theme with identical ordinary surfaces, without rebuilding the menu's search state. Its isolated evidence is written under `tmp/occo-multiline-integration`.
56
+
57
+ `bun run screenshots` captures four documented scenes at Windows Terminal's default startup size, without resizing, maximizing or copying another window's geometry. It records the actual rows, columns, pixel dimensions, font, DPI and character dimensions; the layout stays fixed throughout the run. Concise examples keep three candidates visible: conversation tables retain all three source suggestions; saved prompts show one-, two- and folded three-row previews above an unchanged draft. Source isolation and insertion without sending are checked for both languages. The same run also captures mixed-height suggestions in four theme configurations, plus library, preview, edit and validation-error screens. Additional UI captures stay in the diagnostic directory printed by the harness.
58
+
59
+ Framed images preserve every source pixel, use the expected canvas dimensions, and have a fading two-layer shadow with fully transparent outer edges. Check the frame at full size and 900px width on light and dark backgrounds.
60
+
61
+ To exercise the packaged plugin after the integration suite, extract the current archive into `tmp/occo-packed` and run `script/integration.cjs` with `OCCO_DIRECT=1`. This check uses the library seeded by the integration suite and adds collapsed-paste saving, long-body preview, deletion, selection replacement, and Chinese multiline input at 40×20.
62
+
63
+ ## Manual checks and platform limits
64
+
65
+ Physical IME composition in Windows Terminal remains a manual check: compose Chinese text, cancel or commit it, and verify that candidate selection does not accept an occo suggestion or send the draft. Unicode insertion and bracketed-paste tests do not exercise a physical IME.
66
+
67
+ Check mouse selection and text contrast with the terminal/font settings used for a release. Linux and macOS behavior has not been validated.