dots: public mirror (history reset after licence cleanup)

This commit is contained in:
Coja committed 2026-11-09 18:19:14 +01:00
commit 693822ad5f
226 files changed
+22502

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
# opencode config
Config tree for [opencode](https://opencode.ai) (2.x), tuned for **small local models** behind a
llama.cpp router. Stowed into `~/.config/opencode/` as per-file symlinks; editing here edits the live
config (restart opencode, or `opencode service restart`, to pick changes up — the 2.x background
service caches config).
## Layout
| Path | What |
|---|---|
| `opencode.json` | Providers, permissions, primary agents, defaults. Written in the v1 schema, which 2.x still accepts. |
| `openai-gpt.jsonc` | Optional GPT/Codex OAuth overlay (OpenAI provider + `opencode-openai-codex-auth` plugin). Not loaded by itself — see *GPT overlay*. |
| `AGENTS.md` | Global rules prepended to every session. Same text as the pi config's `AGENTS.md`: terse, verify-before-asserting, small-model friendly. |
| `agents/*.md` | Four subagents with real prompts and scoped permissions: `code-reviewer`, `test-runner` (hidden), `doc-writer` (edits docs only), `security-auditor` (hidden). |
| `commands/*.md` | `/commit` (Conventional Commits message, never commits) and `/review` (read-only diff review), both on the `plan` agent. |
| `plugins/verbose/` | 2.x TUI plugin: `<leader>v`, `/verbose`, or the palette entry toggles the *verbose view* — thinking blocks expanded and tool calls ungrouped — reading the live state from the built-in toggles so a mixed state converges. `server.ts` is a no-op half required by the loader. |
| `plugins/agent-state.ts` | Server-side plugin: mirrors the session state (`message.updated` user → busy, `permission.asked` → input, `session.idle` → done, `session.error` → error) into the tmux pane opencode runs in via `~/.config/tmux/scripts/agent-state.sh`, for the status-bar agent badges. Skips child sessions; only right when the TUI in the pane spawned the server (not `serve`/`attach`); under `opencodes` (bwrap) the tmux socket dir must be bound in. |
| `themes/catppuccin-mocha.json` | Catppuccin Mocha (dark) / Latte (light) theme following the pi theme's semantic mapping. Built-in `catppuccin` exists too; this one matches pi. |
| `tui.json` | TUI settings in the v1 schema (2.x compat): theme, leader timeout, stacked diffs, block cursor, attention notifications, a few extra keybinds. |
The sandbox wrapper lives in `../fish/functions/opencodes.fish`: `opencodes` runs opencode under
bwrap with the stowed config dirs, `~/.cache/opencode`, state and data bound, and only the needed
environment passed through. Extra arguments go to opencode.
## Providers and models
Two OpenAI-compatible providers point at the same llama.cpp router: `llama.cpp` on the LAN and
`duskadiy` through the public hostname (`apiKey` from `$DUSKADIY_API_KEY`). Model ids are the preset
section names in `fl/.config/llamacpp/config.ini`; keep the lists in sync with it and with the pi and
aichat configs. Both providers use a one-hour request timeout — the default five minutes cut off
long local replies.
Decisions that look odd but are deliberate:
- **No `small_model`.** The router runs `--models-max 1`; any second model id evicts the resident one.
With `small_model` unset, title generation falls back to the session's model. Subagents carry no
pinned model for the same reason — the task tool uses the caller's model.
- **No `temperature` / `top_p` from opencode.** Verified by capturing request bodies: only
`max_tokens` is sent, so the router presets own sampling.
- **`reasoning: true`** only on the presets that actually think (no `reasoning-budget = 0`);
GLM also replays `reasoning_content` in history because its preset sets `reasoning-preserve`.
- **`snapshot: false`** — file-change undo is not used. **`tool_output`** capped at 200 lines /
16 KiB for 24k-context models. **`compaction.reserved`/`prune`** are inert at this context size.
- **`question: allow`** everywhere so agents ask instead of guessing.
## Agents
`auto` is the default agent and cycles with `build` and `plan` on Tab. It runs without prompts except
for the serious set — git history rewriting and pushing, `rm`, killing processes, `systemctl`,
network transfers, package installs — which ask, and `sudo`/`dd`/`mkfs`/secret-file reads, which are
denied. Colors: build primary, plan info, auto yellow. All three cap agentic iterations at 30.
Permission rules resolve **global first, agent rules appended, last match wins**, so an agent that
wants a blanket rule must restate its own denies after it (the `auto` block does).
## GPT overlay
`openai-gpt.jsonc` is a template. opencode 2.x ignores `OPENCODE_CONFIG`, but it merges a second
global file named `opencode.jsonc`. `fish/config.fish` links `opencode.jsonc → openai-gpt.jsonc`
only on a host whose `~/.local/share/opencode/auth.json` holds an OpenAI credential (from
`opencode auth login`), and removes the link again when the login is gone.
## Host overlays
`lw/.config/opencode/opencode.json` is a fork of the common file that adds the laptop's local CPU
llama.cpp provider (`lwcpp`). Mirror every edit between the two.
## Lifting pieces into a stock opencode
Everything is plain files: copy `agents/`, `commands/`, `plugins/verbose/` or the theme into your own
`~/.config/opencode/`. The plugin needs 2.x (it uses the `keymap.layer` / `dispatch` API and is
discovered as a directory under `plugins/`). The permission blocks in `opencode.json` are independent
of the providers and can be pasted as-is.
@@ -0,0 +1,11 @@
---
description: Write a Conventional Commits message for the staged changes (does not commit)
agent: plan
---
Inspect the staged changes with `git diff --cached` (and `git status` for context). Then write a single Conventional Commits message:
- A `<type>(<scope>): <subject>` summary line, imperative mood, ≤72 chars (types: feat, fix, refactor, docs, chore, test, perf, build).
- An optional short body explaining the *why* only when it isn't obvious from the diff.
- Do NOT run `git commit`. Output only the message inside a code block so I can review it.
Extra context from me, if any: $ARGUMENTS
@@ -0,0 +1,14 @@
---
description: Review the current diff (staged + unstaged) for bugs and issues, read-only
agent: plan
---
Review the current changes. Check both `git diff` (unstaged) and `git diff --cached` (staged). Focus on:
- Correctness and logic bugs
- Error handling and missing edge cases
- Security issues (injection, secrets, unsafe input)
- Anything that doesn't match the surrounding code's conventions
List concrete findings as `file:line — issue — suggested fix`, ordered by severity. Be concise; skip praise. If nothing is wrong, say so.
Extra focus this round, if any (default: general correctness): $ARGUMENTS
+247
View File
@@ -0,0 +1,247 @@
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-openai-codex-auth"
],
"provider": {
"openai": {
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
},
"whitelist": [
"gpt-5.2",
"gpt-5.2-codex",
"gpt-5.1-codex-max",
"gpt-5.1-codex",
"gpt-5.1-codex-mini",
"gpt-5.1"
],
"models": {
"gpt-5.2": {
"name": "GPT 5.2 (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"none": {
"reasoningEffort": "none",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.2-codex": {
"name": "GPT 5.2 Codex (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex-max": {
"name": "GPT 5.1 Codex Max (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex": {
"name": "GPT 5.1 Codex (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex-mini": {
"name": "GPT 5.1 Codex Mini (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1": {
"name": "GPT 5.1 (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"none": {
"reasoningEffort": "none",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "low"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "high"
}
}
}
}
}
}
}
+313
View File
@@ -0,0 +1,313 @@
{
"$schema": "https://opencode.ai/config.json",
"model": "llama.cpp/Qwen3.6-35B-A3B-Thinking",
"default_agent": "auto",
"instructions": ["CLAUDE.md", "AGENTS.md"],
"share": "disabled",
"autoupdate": "notify",
"tool_output": { "max_lines": 200, "max_bytes": 16384 },
"snapshot": false,
"disabled_providers": [
"gemini",
"anthropic",
"groq",
"openrouter",
"opencode"
],
"permission": {
"edit": "deny",
"webfetch": "ask",
"websearch": "ask",
"external_directory": "ask",
"question": "allow",
"read": {
"*": "allow",
"**/.env*": "deny",
"**/*.env": "deny",
"**/*.pem": "deny",
"**/*.key": "deny",
"**/*.p12": "deny",
"**/*.pfx": "deny",
"**/*.keystore": "deny",
"**/id_rsa*": "deny",
"**/.ssh/**": "deny",
"**/.aws/**": "deny",
"**/.npmrc": "deny",
"**/.netrc": "deny"
},
"bash": {
"*": "ask",
"ls *": "allow",
"cat *": "allow",
"grep *": "allow",
"rg *": "allow",
"find *": "allow",
"fd *": "allow",
"which *": "allow",
"file *": "allow",
"stat *": "allow",
"wc *": "allow",
"tree *": "allow",
"diff *": "allow",
"sort *": "allow",
"uniq *": "allow",
"echo *": "ask",
"pwd": "allow",
"date": "allow",
"whoami": "allow",
"jq *": "allow",
"tsc *": "allow",
"mkdir *": "ask",
"touch *": "ask",
"git *": "ask",
"git status": "allow",
"git status *": "allow",
"git diff": "allow",
"git diff *": "allow",
"git log": "allow",
"git log *": "allow",
"git show *": "allow",
"git branch": "allow",
"git remote -v": "allow",
"npm *": "ask",
"pnpm *": "ask",
"npx *": "ask",
"npm list": "allow",
"npm help": "allow",
"npm version": "allow",
"pnpm list": "allow",
"pnpm help": "allow",
"npx --version": "allow",
"curl *": "ask",
"wget *": "ask",
"rm *": "deny",
"rmdir *": "deny",
"dd *": "deny",
"mkfs*": "deny",
"shred *": "deny",
"chmod -R *": "deny",
"sudo *": "deny",
"doas *": "deny",
"npm install*": "deny",
"npm i": "deny",
"npm i *": "deny",
"npm ci*": "deny",
"pnpm install*": "deny",
"pnpm i": "deny",
"pnpm i *": "deny",
"pnpm add*": "deny",
"yarn add*": "deny",
"yarn install*": "deny",
"pip install*": "deny",
"pip3 install*": "deny",
"pipx install*": "deny",
"cargo install*": "deny",
"go install*": "deny",
"gem install*": "deny",
"brew install*": "deny",
"pacman *": "deny",
"yay *": "deny",
"apt *": "deny",
"apt-get *": "deny",
"dnf *": "deny",
"cat .env*": "deny",
"cat *.env": "deny",
"cat *.pem": "deny",
"cat *.key": "deny",
"cat *id_rsa*": "deny",
"cat *secret*": "deny",
"cat *credential*": "deny",
"cat ~/.ssh/*": "deny",
"cat ~/.aws/*": "deny",
"grep .env*": "deny",
"grep * .env*": "deny"
}
},
"provider": {
"duskadiy": {
"npm": "@ai-sdk/openai-compatible",
"name": "DuskaDIY",
"options": {
"baseURL": "https://llm.duskadiy.com/api/v1",
"apiKey": "{env:DUSKADIY_API_KEY}",
"timeout": 3600000
},
"models": {
"Qwen3-Coder-30B-Instruct-UD-Q3_K_XL": { "name": "Qwen3 Coder 30B · 32k — main agent coder (~30 t/s, remote)", "limit": { "context": 32768, "output": 4096 } },
"Qwen3-Coder-Next-UD-IQ3_XXS": { "name": "Qwen3 Coder Next 80B · 128k — long sessions (~16 t/s, remote)", "limit": { "context": 131072, "output": 16384 } },
"Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS": { "name": "Qwen3.6 35B · 24k · vision — daily driver (~36 t/s, remote)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"Qwen3.6-35B-A3B-Thinking": { "reasoning": true, "name": "Qwen3.6 35B Thinking · 24k · vision — hard problems (~39 t/s, remote)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"Qwen3.5-9B-UD-Q6_K_XL": { "reasoning": true, "name": "Qwen3.5 9B · 32k · vision — quick tasks (~32 t/s, remote)", "attachment": true, "limit": { "context": 32768, "output": 8192 } },
"Qwen3.8-27B-UD-IQ3_XXS": { "reasoning": true, "name": "Qwen3.8 27B · 24k · vision — hybrid reasoner, quiet desktop only (~15 t/s, remote)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"gemma-4-26B-A4B-it-UD-IQ4_XS": { "name": "Gemma 4 26B · 24k · vision — quality generalist (~34 t/s, remote)", "attachment": true, "limit": { "context": 24576, "output": 4096 } },
"gemma-4-E4B-it-UD-Q8_K_XL": { "name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs (~57 t/s, remote)", "attachment": true, "limit": { "context": 65536, "output": 16384 } },
"GLM-4.7-Flash-UD-Q4_K_XL": { "reasoning": true, "interleaved": "reasoning_content", "name": "GLM-4.7 Flash · 24k — quality coder (~21 t/s, remote)", "limit": { "context": 24576, "output": 8192 } },
"GLM-4.7-Flash-UD-Q3_K_XL": { "reasoning": true, "interleaved": "reasoning_content", "name": "GLM-4.7 Flash Q3 · 24k — fast coder (~28 t/s, remote)", "limit": { "context": 24576, "output": 8192 } },
"Ornith-1.5-35B-A3B-IQ3_XXS": { "reasoning": true, "name": "Ornith 1.5 35B · 32k · vision — agentic coder, thinking (~32 t/s, remote)", "attachment": true, "limit": { "context": 32768, "output": 8192 } },
"gpt-oss-20b": { "reasoning": true, "name": "gpt-oss 20B · 64k — fast reasoning + tools (~38 t/s, remote)", "limit": { "context": 65536, "output": 8192 } },
"gpt-oss-20b-low": { "reasoning": true, "name": "gpt-oss 20B low · 64k — snappy answers (~37 t/s, remote)", "limit": { "context": 65536, "output": 8192 } }
}
},
"llama.cpp": {
"npm": "@ai-sdk/openai-compatible",
"name": "llamacpp",
"options": {
"baseURL": "http://192.168.0.204:11343/v1",
"timeout": 3600000
},
"models": {
"Qwen3-Coder-Next-UD-IQ3_XXS": { "name": "Qwen3 Coder Next 80B · 128k — long sessions (~16 t/s)", "limit": { "context": 131072, "output": 16384 } },
"Qwen3-Coder-30B-Instruct-UD-Q3_K_XL": { "name": "Qwen3 Coder 30B · 32k — main agent coder (~30 t/s)", "limit": { "context": 32768, "output": 4096 } },
"Qwen3.6-35B-A3B-MTP-UD-IQ3_XXS": { "name": "Qwen3.6 35B · 24k · vision — daily driver (~36 t/s)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"Qwen3.6-35B-A3B-Thinking": { "reasoning": true, "name": "Qwen3.6 35B Thinking · 24k · vision — hard problems (~39 t/s)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"Qwen3.5-9B-UD-Q6_K_XL": { "reasoning": true, "name": "Qwen3.5 9B · 32k · vision — quick tasks (~32 t/s)", "attachment": true, "limit": { "context": 32768, "output": 8192 } },
"Qwen3.8-27B-UD-IQ3_XXS": { "reasoning": true, "name": "Qwen3.8 27B · 24k · vision — hybrid reasoner, quiet desktop only (~15 t/s)", "attachment": true, "limit": { "context": 24576, "output": 8192 } },
"gemma-4-26B-A4B-it-UD-IQ4_XS": { "name": "Gemma 4 26B · 24k · vision — quality generalist (~34 t/s)", "attachment": true, "limit": { "context": 24576, "output": 4096 } },
"gemma-4-E4B-it-UD-Q8_K_XL": { "name": "Gemma 4 E4B · 64k · vision — fast generalist, long docs (~57 t/s)", "attachment": true, "limit": { "context": 65536, "output": 16384 } },
"GLM-4.7-Flash-UD-Q4_K_XL": { "reasoning": true, "interleaved": "reasoning_content", "name": "GLM-4.7 Flash · 24k — quality coder (~21 t/s)", "limit": { "context": 24576, "output": 8192 } },
"GLM-4.7-Flash-UD-Q3_K_XL": { "reasoning": true, "interleaved": "reasoning_content", "name": "GLM-4.7 Flash Q3 · 24k — fast coder (~28 t/s)", "limit": { "context": 24576, "output": 8192 } },
"Ornith-1.5-35B-A3B-IQ3_XXS": { "reasoning": true, "name": "Ornith 1.5 35B · 32k · vision — agentic coder, thinking (~32 t/s)", "attachment": true, "limit": { "context": 32768, "output": 8192 } },
"gpt-oss-20b": { "reasoning": true, "name": "gpt-oss 20B · 64k — fast reasoning + tools (~38 t/s)", "limit": { "context": 65536, "output": 8192 } },
"gpt-oss-20b-low": { "reasoning": true, "name": "gpt-oss 20B low · 64k — snappy answers (~37 t/s)", "limit": { "context": 65536, "output": 8192 } }
}
}
},
"agent": {
"plan": {
"mode": "primary",
"color": "info",
"steps": 30,
"model": "llama.cpp/Qwen3.6-35B-A3B-Thinking",
"permission": {
"edit": "deny"
}
},
"build": {
"mode": "primary",
"color": "primary",
"steps": 30,
"model": "llama.cpp/Qwen3.6-35B-A3B-Thinking",
"permission": {
"edit": {
"*": "allow",
"**/.env*": "deny",
"**/*.env": "deny",
"**/*.pem": "deny",
"**/*.key": "deny",
"**/id_rsa*": "deny",
"**/.ssh/**": "deny",
"**/.aws/**": "deny",
"**/.git/**": "deny",
"**/.npmrc": "deny",
"**/.netrc": "deny"
}
}
},
"auto": {
"description": "Auto mode: acts without asking; only irreversible or outward-facing actions ask",
"mode": "primary",
"color": "#f9e2af",
"steps": 30,
"model": "llama.cpp/Qwen3.6-35B-A3B-Thinking",
"permission": {
"edit": {
"*": "allow",
"**/.env*": "deny",
"**/*.env": "deny",
"**/*.pem": "deny",
"**/*.key": "deny",
"**/id_rsa*": "deny",
"**/.ssh/**": "deny",
"**/.aws/**": "deny",
"**/.git/**": "deny",
"**/.npmrc": "deny",
"**/.netrc": "deny"
},
"webfetch": "allow",
"websearch": "allow",
"external_directory": "ask",
"question": "allow",
"bash": {
"*": "allow",
"git *": "allow",
"git commit*": "ask",
"git push*": "ask",
"git reset*": "ask",
"git checkout*": "ask",
"git switch*": "ask",
"git restore*": "ask",
"git rebase*": "ask",
"git merge*": "ask",
"git cherry-pick*": "ask",
"git stash*": "ask",
"git clean*": "ask",
"git branch -*": "ask",
"git tag*": "ask",
"git remote add*": "ask",
"git remote remove*": "ask",
"git remote set-url*": "ask",
"rm *": "ask",
"rmdir *": "ask",
"kill *": "ask",
"pkill *": "ask",
"killall *": "ask",
"systemctl *": "ask",
"curl *": "ask",
"wget *": "ask",
"ssh *": "ask",
"scp *": "ask",
"rsync *": "ask",
"npm install*": "ask",
"npm i": "ask",
"npm i *": "ask",
"npm ci*": "ask",
"pnpm install*": "ask",
"pnpm i": "ask",
"pnpm i *": "ask",
"pnpm add*": "ask",
"yarn add*": "ask",
"yarn install*": "ask",
"pip install*": "ask",
"pip3 install*": "ask",
"pipx install*": "ask",
"cargo install*": "ask",
"go install*": "ask",
"gem install*": "ask",
"yay *": "ask",
"sudo *": "deny",
"doas *": "deny",
"dd *": "deny",
"mkfs*": "deny",
"shred *": "deny",
"chmod -R *": "deny",
"rm -rf /*": "deny",
"rm -rf ~*": "deny",
"cat .env*": "deny",
"cat *.env": "deny",
"cat *.pem": "deny",
"cat *.key": "deny",
"cat *id_rsa*": "deny",
"cat *secret*": "deny",
"cat *credential*": "deny",
"cat ~/.ssh/*": "deny",
"cat ~/.aws/*": "deny",
"grep .env*": "deny",
"grep * .env*": "deny"
}
}
}
}
}
@@ -0,0 +1,53 @@
// opencode agent-state plugin: mirrors the session state into the tmux pane opencode runs in via
// ~/.config/tmux/scripts/agent-state.sh (oc busy|done|input|error). No-op outside tmux.
//
// Runs in the SERVER process, so TMUX_PANE is only right when the TUI in the pane spawned the
// server (plain `opencode`), not for `opencode serve` / `opencode attach`. Under the bwrap
// `opencodes` wrapper the tmux socket dir must be bound in, or the script gives up quietly.
// Child (subagent) sessions are skipped so a subagent finishing does not flag "done".
import type { Plugin } from "@opencode-ai/plugin"
export const AgentState: Plugin = async ({ client, $ }) => {
const script = `${process.env.HOME}/.config/tmux/scripts/agent-state.sh`
const set = async (state: string) => {
if (!process.env.TMUX_PANE) return
try {
await $`${script} oc ${state}`.quiet().nothrow()
} catch {}
}
const childCache = new Map<string, boolean>()
const isChild = async (sessionID?: string) => {
if (!sessionID) return false
if (!childCache.has(sessionID)) {
try {
const r = await client.session.get({ path: { id: sessionID } })
childCache.set(sessionID, Boolean(r.data?.parentID))
} catch {
childCache.set(sessionID, false)
}
}
return childCache.get(sessionID) ?? false
}
return {
event: async ({ event }) => {
const p = (event as { properties?: Record<string, any> }).properties ?? {}
switch (event.type) {
case "message.updated": // a new user message = a prompt went in
if (p.info?.role === "user" && !(await isChild(p.info?.sessionID))) await set("busy")
break
case "permission.asked":
if (!(await isChild(p.sessionID))) await set("input")
break
case "permission.replied":
if (!(await isChild(p.sessionID))) await set("busy")
break
case "session.idle":
if (!(await isChild(p.sessionID))) await set("done")
break
case "session.error":
if (!(await isChild(p.sessionID))) await set("error")
break
}
},
}
}
@@ -0,0 +1,8 @@
// opencode v2 plugin "coja.verbose" — server half. Intentionally empty: all behaviour is in ./tui.ts.
// A local plugin is a DIRECTORY under ~/.config/opencode/plugins/ whose `server`/`index` and `tui`
// modules are resolved by name (packages/plugin/src/host.ts resolve()). No imports on purpose:
// `define()` is an identity helper, and a dependency-free module needs no node_modules.
export default {
id: "coja.verbose",
setup() {},
}
@@ -0,0 +1,62 @@
// opencode v2 TUI plugin: one key toggles the "verbose view".
//
// v2 dropped the v1 tool-details / timestamps / generic-output toggles. The session view now has two
// display toggles that matter: thinking blocks (session.thinking show|hide) and exploration grouping
// (session.grouping auto|none — "auto" folds read/glob/grep tool calls into one collapsed group).
// Verbose = thinking expanded AND tool calls shown individually. Both settings persist in the TUI config.
//
// State is read from the built-in commands' live titles (the only plugin-visible signal):
// session.toggle.thinking → "Collapse thinking" while expanded, else "Expand thinking"
// session.toggle.exploration_grouping → "Show tool calls individually" while grouped, else "Group related tool calls"
// then only the toggles that differ from the target are dispatched, so a mixed state converges.
//
// Auto-discovered from ~/.config/opencode/plugins/verbose/ (server.ts + this file). Key configurable
// via plugin options; default <leader>v. Also /verbose and a command-palette entry.
const THINKING = "session.toggle.thinking"
const GROUPING = "session.toggle.exploration_grouping"
type Command = { readonly id?: string; readonly title?: string }
type Context = {
readonly options?: Readonly<Record<string, unknown>>
readonly keymap: {
layer(input: () => { readonly commands?: readonly unknown[] }): void
dispatch(id: string, input?: string): void
commands(): readonly Command[]
}
readonly ui: { readonly toast: { show(o: { message: string; variant?: string; duration?: number }): void } }
}
export default {
id: "coja.verbose",
setup(context: Context) {
const key = typeof context.options?.key === "string" && context.options.key ? (context.options.key as string) : "<leader>v"
const title = (id: string) => context.keymap.commands().find((c) => c.id === id)?.title ?? ""
context.keymap.layer(() => ({
commands: [
{
id: "verbose.toggle",
title: "Toggle verbose view (expand thinking, ungroup tool calls)",
group: "Session",
bind: key,
palette: true,
slash: { name: "verbose" },
run() {
const thinkingTitle = title(THINKING)
const groupingTitle = title(GROUPING)
if (!thinkingTitle && !groupingTitle) {
context.ui.toast.show({ message: "Verbose view: open a session first", variant: "warning", duration: 2000 })
return
}
const thinkingVerbose = thinkingTitle.startsWith("Collapse")
const groupingVerbose = groupingTitle.startsWith("Group")
const on = !(thinkingVerbose && groupingVerbose)
if (thinkingTitle && thinkingVerbose !== on) context.keymap.dispatch(THINKING)
if (groupingTitle && groupingVerbose !== on) context.keymap.dispatch(GROUPING)
context.ui.toast.show({ message: on ? "Verbose view on" : "Verbose view off", variant: "info", duration: 1500 })
},
},
],
}))
},
}
@@ -0,0 +1,262 @@
{
"defs": {
"mocha_rosewater": "#f5e0dc",
"mocha_flamingo": "#f2cdcd",
"mocha_pink": "#f5c2e7",
"mocha_mauve": "#cba6f7",
"mocha_red": "#f38ba8",
"mocha_maroon": "#eba0ac",
"mocha_peach": "#fab387",
"mocha_yellow": "#f9e2af",
"mocha_green": "#a6e3a1",
"mocha_teal": "#94e2d5",
"mocha_sky": "#89dceb",
"mocha_sapphire": "#74c7ec",
"mocha_blue": "#89b4fa",
"mocha_lavender": "#b4befe",
"mocha_text": "#cdd6f4",
"mocha_subtext1": "#bac2de",
"mocha_subtext0": "#a6adc8",
"mocha_overlay2": "#9399b2",
"mocha_overlay1": "#7f849c",
"mocha_overlay0": "#6c7086",
"mocha_surface2": "#585b70",
"mocha_surface1": "#45475a",
"mocha_surface0": "#313244",
"mocha_base": "#1e1e2e",
"mocha_mantle": "#181825",
"mocha_crust": "#11111b",
"mocha_diffAddBg": "#1e2b22",
"mocha_diffDelBg": "#2b1e22",
"latte_rosewater": "#dc8a78",
"latte_flamingo": "#dd7878",
"latte_pink": "#ea76cb",
"latte_mauve": "#8839ef",
"latte_red": "#d20f39",
"latte_maroon": "#e64553",
"latte_peach": "#fe640b",
"latte_yellow": "#df8e1d",
"latte_green": "#40a02b",
"latte_teal": "#179299",
"latte_sky": "#04a5e5",
"latte_sapphire": "#209fb5",
"latte_blue": "#1e66f5",
"latte_lavender": "#7287fd",
"latte_text": "#4c4f69",
"latte_subtext1": "#5c5f77",
"latte_subtext0": "#6c6f85",
"latte_overlay2": "#7c7f93",
"latte_overlay1": "#8c8fa1",
"latte_overlay0": "#9ca0b0",
"latte_surface2": "#acb0be",
"latte_surface1": "#bcc0cc",
"latte_surface0": "#ccd0da",
"latte_base": "#eff1f5",
"latte_mantle": "#e6e9ef",
"latte_crust": "#dce0e8",
"latte_diffAddBg": "#e4f3e6",
"latte_diffDelBg": "#f9e1e6"
},
"theme": {
"primary": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"secondary": {
"dark": "mocha_blue",
"light": "latte_blue"
},
"accent": {
"dark": "mocha_peach",
"light": "latte_peach"
},
"error": {
"dark": "mocha_red",
"light": "latte_red"
},
"warning": {
"dark": "mocha_yellow",
"light": "latte_yellow"
},
"success": {
"dark": "mocha_green",
"light": "latte_green"
},
"info": {
"dark": "mocha_sapphire",
"light": "latte_sapphire"
},
"text": {
"dark": "mocha_text",
"light": "latte_text"
},
"textMuted": {
"dark": "mocha_subtext0",
"light": "latte_subtext0"
},
"background": {
"dark": "mocha_base",
"light": "latte_base"
},
"backgroundPanel": {
"dark": "mocha_mantle",
"light": "latte_mantle"
},
"backgroundElement": {
"dark": "mocha_surface0",
"light": "latte_surface0"
},
"border": {
"dark": "mocha_surface1",
"light": "latte_surface1"
},
"borderActive": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"borderSubtle": {
"dark": "mocha_surface0",
"light": "latte_surface0"
},
"diffAdded": {
"dark": "mocha_green",
"light": "latte_green"
},
"diffRemoved": {
"dark": "mocha_red",
"light": "latte_red"
},
"diffContext": {
"dark": "mocha_overlay0",
"light": "latte_overlay0"
},
"diffHunkHeader": {
"dark": "mocha_overlay1",
"light": "latte_overlay1"
},
"diffHighlightAdded": {
"dark": "mocha_green",
"light": "latte_green"
},
"diffHighlightRemoved": {
"dark": "mocha_red",
"light": "latte_red"
},
"diffAddedBg": {
"dark": "mocha_diffAddBg",
"light": "latte_diffAddBg"
},
"diffRemovedBg": {
"dark": "mocha_diffDelBg",
"light": "latte_diffDelBg"
},
"diffContextBg": {
"dark": "mocha_base",
"light": "latte_base"
},
"diffLineNumber": {
"dark": "mocha_overlay0",
"light": "latte_overlay0"
},
"diffAddedLineNumberBg": {
"dark": "mocha_diffAddBg",
"light": "latte_diffAddBg"
},
"diffRemovedLineNumberBg": {
"dark": "mocha_diffDelBg",
"light": "latte_diffDelBg"
},
"markdownText": {
"dark": "mocha_text",
"light": "latte_text"
},
"markdownHeading": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"markdownLink": {
"dark": "mocha_sapphire",
"light": "latte_sapphire"
},
"markdownLinkText": {
"dark": "mocha_blue",
"light": "latte_blue"
},
"markdownCode": {
"dark": "mocha_green",
"light": "latte_green"
},
"markdownBlockQuote": {
"dark": "mocha_subtext0",
"light": "latte_subtext0"
},
"markdownEmph": {
"dark": "mocha_yellow",
"light": "latte_yellow"
},
"markdownStrong": {
"dark": "mocha_peach",
"light": "latte_peach"
},
"markdownHorizontalRule": {
"dark": "mocha_surface1",
"light": "latte_surface1"
},
"markdownListItem": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"markdownListEnumeration": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"markdownImage": {
"dark": "mocha_sapphire",
"light": "latte_sapphire"
},
"markdownImageText": {
"dark": "mocha_blue",
"light": "latte_blue"
},
"markdownCodeBlock": {
"dark": "mocha_text",
"light": "latte_text"
},
"syntaxComment": {
"dark": "mocha_overlay0",
"light": "latte_overlay0"
},
"syntaxKeyword": {
"dark": "mocha_mauve",
"light": "latte_mauve"
},
"syntaxFunction": {
"dark": "mocha_blue",
"light": "latte_blue"
},
"syntaxVariable": {
"dark": "mocha_text",
"light": "latte_text"
},
"syntaxString": {
"dark": "mocha_green",
"light": "latte_green"
},
"syntaxNumber": {
"dark": "mocha_peach",
"light": "latte_peach"
},
"syntaxType": {
"dark": "mocha_yellow",
"light": "latte_yellow"
},
"syntaxOperator": {
"dark": "mocha_sky",
"light": "latte_sky"
},
"syntaxPunctuation": {
"dark": "mocha_overlay2",
"light": "latte_overlay2"
}
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://opencode.ai/tui.json",
"theme": "lucent-orng",
"leader_timeout": 1500,
"diff_style": "stacked",
"cursor": { "style": "block", "blinking": false },
"attention": { "enabled": true, "notifications": true, "sound": false },
"keybinds": {
"prompt_stash": "<leader>p",
"prompt_stash_pop": "<leader>o",
"session_fork": "<leader>f",
"messages_last_user": "<leader>k",
"display_thinking": "<leader>i"
}
}