oh-my-openagent 4.5.12 → 4.7.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.
- package/.agents/skills/opencode-qa/SKILL.md +194 -0
- package/.agents/skills/opencode-qa/references/cli-commands.md +188 -0
- package/.agents/skills/opencode-qa/references/db-investigation.md +197 -0
- package/.agents/skills/opencode-qa/references/events-hooks.md +110 -0
- package/.agents/skills/opencode-qa/references/sdk.md +96 -0
- package/.agents/skills/opencode-qa/references/server-api.md +200 -0
- package/.agents/skills/opencode-qa/references/testing-harness.md +218 -0
- package/.agents/skills/opencode-qa/references/tui-tmux.md +52 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-id.sh +53 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-name.sh +57 -0
- package/.agents/skills/opencode-qa/scripts/db-session-by-text.sh +158 -0
- package/.agents/skills/opencode-qa/scripts/export-roundtrip.sh +57 -0
- package/.agents/skills/opencode-qa/scripts/lib/common.sh +216 -0
- package/.agents/skills/opencode-qa/scripts/server-smoke.sh +64 -0
- package/.agents/skills/opencode-qa/scripts/sse-hook-probe.sh +106 -0
- package/.agents/skills/opencode-qa/scripts/tui-smoke.sh +89 -0
- package/README.ja.md +13 -3
- package/README.ko.md +13 -3
- package/README.md +24 -14
- package/README.ru.md +13 -3
- package/README.zh-cn.md +13 -3
- package/bin/oh-my-opencode.js +4 -3
- package/bin/oh-my-opencode.test.ts +36 -8
- package/bin/platform.d.ts +1 -1
- package/bin/platform.js +5 -5
- package/bin/platform.test.ts +35 -13
- package/bin/version-mismatch.js +47 -0
- package/bin/version-mismatch.test.ts +120 -0
- package/dist/cli/cleanup-command.d.ts +4 -0
- package/dist/cli/cleanup.d.ts +11 -0
- package/dist/cli/cli-program.d.ts +2 -1
- package/dist/cli/codex-ulw-loop.d.ts +12 -0
- package/dist/cli/doctor/checks/tui-plugin-config.d.ts +2 -0
- package/dist/cli/index.js +2440 -665
- package/dist/cli/install-codex/codex-cache.d.ts +1 -0
- package/dist/cli/install-codex/codex-cleanup-config.d.ts +6 -0
- package/dist/cli/install-codex/codex-cleanup.d.ts +21 -0
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-reasoning.d.ts +2 -0
- package/dist/cli/install-codex/codex-config-toml.d.ts +2 -1
- package/dist/cli/install-codex/codex-installation-detection.d.ts +36 -0
- package/dist/cli/install-codex/codex-model-catalog.d.ts +13 -0
- package/dist/cli/install-codex/codex-package-layout.d.ts +1 -0
- package/dist/cli/install-codex/codex-project-local-cleanup-best-effort.d.ts +7 -0
- package/dist/cli/install-codex/codex-project-local-cleanup.d.ts +35 -0
- package/dist/cli/install-codex/git-bash.d.ts +35 -0
- package/dist/cli/install-codex/index.d.ts +4 -0
- package/dist/cli/install-codex/toml-section-editor.d.ts +2 -0
- package/dist/cli/install-codex/types.d.ts +20 -0
- package/dist/cli/run/event-state.d.ts +1 -0
- package/dist/cli/run/poll-for-completion.d.ts +1 -0
- package/dist/cli/run/prompt-start.d.ts +7 -0
- package/dist/cli/star-request.d.ts +9 -0
- package/dist/config/schema/agent-names.d.ts +2 -0
- package/dist/config/schema/hooks.d.ts +0 -1
- package/dist/config/schema/oh-my-opencode-config.d.ts +2 -0
- package/dist/create-hooks.d.ts +0 -1
- package/dist/create-managers.d.ts +1 -0
- package/dist/features/background-agent/concurrency.d.ts +1 -0
- package/dist/features/background-agent/process-cleanup.d.ts +6 -0
- package/dist/features/builtin-skills/skills/debugging.d.ts +2 -0
- package/dist/features/builtin-skills/skills/index.d.ts +3 -0
- package/dist/features/builtin-skills/skills/security-research.d.ts +2 -0
- package/dist/features/builtin-skills/skills/security-review.d.ts +2 -0
- package/dist/features/claude-code-session-state/state.d.ts +1 -0
- package/dist/features/opencode-runtime-skills/index.d.ts +2 -0
- package/dist/features/opencode-runtime-skills/runtime-skill-config.d.ts +17 -0
- package/dist/features/opencode-runtime-skills/skill-markdown.d.ts +7 -0
- package/dist/features/opencode-runtime-skills/source-server.d.ts +8 -0
- package/dist/features/opencode-skill-loader/index.d.ts +1 -0
- package/dist/features/opencode-skill-loader/opencode-config-skills-reader.d.ts +5 -0
- package/dist/features/tmux-subagent/attachable-session-status.d.ts +1 -1
- package/dist/features/tmux-subagent/session-status-parser.d.ts +1 -0
- package/dist/hooks/comment-checker/cli.d.ts +1 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/tasks-todowrite-disabler/constants.d.ts +1 -1
- package/dist/index.js +1737 -764
- package/dist/oh-my-opencode.schema.json +2 -0
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +1 -2
- package/dist/plugin/messages-transform.d.ts +8 -1
- package/dist/plugin/user-abort-interrupted-recovery-guard.d.ts +6 -0
- package/dist/plugin-handlers/config-handler.d.ts +2 -1
- package/dist/shared/command-executor/execute-hook-command.d.ts +2 -0
- package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +14 -0
- package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +7 -0
- package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +1 -0
- package/dist/shared/prompt-async-gate/timing.d.ts +1 -0
- package/dist/shared/prompt-async-gate/types.d.ts +2 -0
- package/dist/shared/prompt-async-gate.d.ts +1 -1
- package/dist/testing/create-plugin-module.d.ts +2 -0
- package/dist/tools/skill/description-formatter.d.ts +5 -1
- package/dist/tools/skill/types.d.ts +1 -0
- package/package.json +22 -18
- package/packages/ast-grep-mcp/dist/cli.js +53 -9
- package/packages/git-bash-mcp/dist/cli.js +367 -0
- package/packages/lsp-tools-mcp/dist/cli.js +1 -8
- package/packages/lsp-tools-mcp/dist/lsp/process.js +1 -1
- package/packages/lsp-tools-mcp/dist/mcp.d.ts +1 -8
- package/packages/lsp-tools-mcp/dist/mcp.js +16 -88
- package/packages/omo-codex/plugin/.mcp.json +11 -0
- package/packages/omo-codex/plugin/components/comment-checker/README.md +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +29 -0
- package/packages/omo-codex/plugin/components/git-bash/package.json +23 -0
- package/packages/omo-codex/plugin/components/git-bash/src/cli.ts +33 -0
- package/packages/omo-codex/plugin/components/git-bash/src/codex-hook.ts +180 -0
- package/packages/omo-codex/plugin/components/git-bash/src/index.ts +10 -0
- package/packages/omo-codex/plugin/components/git-bash/test/codex-hook.test.ts +195 -0
- package/packages/omo-codex/plugin/components/git-bash/tsconfig.build.json +13 -0
- package/packages/omo-codex/plugin/components/git-bash/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/lsp/README.md +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +5 -5
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +33 -0
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +18 -26
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-cli.test.ts +28 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-errors.test.ts +55 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +8 -2
- package/packages/omo-codex/plugin/components/rules/README.md +1 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +6 -4
- package/packages/omo-codex/plugin/components/rules/bundled-rules/windows-git-bash.md +10 -0
- package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +3 -1
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +97 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +6 -5
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +22 -0
- package/packages/omo-codex/plugin/components/ultrawork/CHANGELOG.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/README.md +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +4 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +8 -7
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +9 -8
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +32 -6
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +27 -4
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +25 -0
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +28 -205
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +231 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +12 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +19 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +103 -6
- package/packages/omo-codex/plugin/hooks/hooks.json +35 -2
- package/packages/omo-codex/plugin/model-catalog.json +49 -0
- package/packages/omo-codex/plugin/package-lock.json +33 -29
- package/packages/omo-codex/plugin/package.json +3 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +159 -0
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +16 -1
- package/packages/omo-codex/plugin/scripts/build-components.mjs +2 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +269 -0
- package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +89 -0
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +6 -6
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +127 -0
- package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +9 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +6 -6
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +33 -8
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +25 -5
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +28 -205
- package/packages/omo-codex/plugin/skills/ulw-loop/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +231 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +17 -17
- package/packages/omo-codex/plugin/test/aggregate.test.mjs +188 -20
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +129 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +60 -12
- package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +34 -0
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +21 -0
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +146 -0
- package/packages/omo-codex/plugin/test/node-install-surface.test.mjs +48 -0
- package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +76 -0
- package/packages/omo-codex/plugin/test/sync-hook-status-messages.test.mjs +67 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +57 -5
- package/packages/omo-codex/scripts/install/cache.mjs +5 -3
- package/packages/omo-codex/scripts/install/cli-args.mjs +112 -0
- package/packages/omo-codex/scripts/install/config.mjs +23 -1
- package/packages/omo-codex/scripts/install/delegated-command.mjs +25 -0
- package/packages/omo-codex/scripts/install/git-bash.mjs +99 -0
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +174 -0
- package/packages/omo-codex/scripts/install/legacy-bins.mjs +1 -0
- package/packages/omo-codex/scripts/install/mcp-runtime-cache.mjs +5 -1
- package/packages/omo-codex/scripts/install/model-catalog.mjs +66 -0
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +7 -1
- package/packages/omo-codex/scripts/install/permissions.d.mts +1 -0
- package/packages/omo-codex/scripts/install/permissions.mjs +26 -0
- package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +229 -0
- package/packages/omo-codex/scripts/install/reasoning-config.mjs +72 -0
- package/packages/omo-codex/scripts/install/source-package-build.mjs +20 -0
- package/packages/omo-codex/scripts/install/toml-editor.mjs +19 -2
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +23 -0
- package/packages/omo-codex/scripts/install-cli-args.test.mjs +146 -0
- package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +48 -0
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +141 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +205 -0
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +157 -0
- package/packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs +145 -0
- package/packages/omo-codex/scripts/install-local.mjs +91 -8
- package/packages/omo-codex/scripts/install-local.test.mjs +22 -6
- package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +60 -0
- package/packages/omo-codex/scripts/install-packaged-local.test.mjs +67 -0
- package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +277 -0
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +127 -0
- package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +9 -0
- package/packages/shared-skills/skills/review-work/SKILL.md +33 -8
- package/packages/shared-skills/skills/start-work/SKILL.md +25 -5
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +11 -11
- package/postinstall.mjs +36 -3
- package/dist/cli/install-codex/detect-omx-conflict.d.ts +0 -26
- package/dist/cli/lazycodex-feature-flag.d.ts +0 -7
- package/dist/features/builtin-commands/templates/init-deep.d.ts +0 -1
- package/dist/hooks/context-window-monitor.d.ts +0 -19
- package/packages/lsp-tools-mcp/dist/mcp-lifecycle-log.d.ts +0 -4
- package/packages/lsp-tools-mcp/dist/mcp-lifecycle-log.js +0 -32
- package/packages/lsp-tools-mcp/dist/mcp-stdio-transport.d.ts +0 -13
- package/packages/lsp-tools-mcp/dist/mcp-stdio-transport.js +0 -111
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +0 -10
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +0 -22
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +0 -165
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +0 -52
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +0 -294
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +0 -26
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +0 -144
- package/packages/omo-codex/plugin/components/lsp/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +0 -38
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.d.ts +0 -11
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +0 -247
- package/packages/omo-codex/plugin/components/rules/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +0 -118
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +0 -47
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +0 -125
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/config.js +0 -93
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +0 -26
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +0 -36
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +0 -72
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +0 -2
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +0 -24
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +0 -169
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +0 -77
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +0 -29
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +0 -9
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +0 -58
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +0 -98
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +0 -37
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +0 -354
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +0 -12
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +0 -51
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +0 -33
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +0 -45
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +0 -26
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +0 -137
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +0 -7
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +0 -89
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +0 -18
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +0 -93
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +0 -27
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +0 -288
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +0 -48
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +0 -1
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +0 -23
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +0 -14
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +0 -111
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +0 -17
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +0 -45
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +0 -122
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +0 -8
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +0 -19
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +0 -41
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +0 -35
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +0 -168
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +0 -3
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +0 -31
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +0 -4
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +0 -91
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +0 -16
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +0 -146
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +0 -49
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +0 -58
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +0 -5
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +0 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +0 -20
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +0 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/package-lock.json +0 -1409
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plans/complete-plan.md +0 -8
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plans/incomplete-plan.md +0 -13
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plans/mixed-sections-plan.md +0 -13
- package/packages/omo-codex/plugin/components/start-work-continuation/test/fixtures/plans/no-todos-plan.md +0 -7
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +0 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +0 -18
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +0 -62
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +0 -15
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +0 -24
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +0 -10
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +0 -35
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +0 -4
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +0 -31
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +0 -57
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +0 -21
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +0 -128
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +0 -8
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +0 -29
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +0 -48
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +0 -7
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +0 -66
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +0 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +0 -16
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +0 -186
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.d.ts +0 -17
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.js +0 -97
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +0 -175
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +0 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +0 -55
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.d.ts +0 -12
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +0 -145
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +0 -37
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +0 -14
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +0 -100
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +0 -26
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +0 -97
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +0 -28
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +0 -145
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +0 -31
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +0 -119
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +0 -12
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +0 -69
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +0 -16
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +0 -59
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +0 -48
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +0 -108
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.d.ts +0 -8
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +0 -89
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +0 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +0 -94
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.d.ts +0 -16
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +0 -70
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.d.ts +0 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.js +0 -292
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.d.ts +0 -213
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.js +0 -54
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opencode-qa
|
|
3
|
+
description: "QA opencode itself, per case: verify the CLI/terminal (opencode run, db, serve, export), prove a specific plugin hook/action/event fired via the SSE event stream, smoke-test the TUI under tmux, and investigate sessions in opencode's SQLite DB by id, title/name, or message text. Ships tested helper scripts (each with a --self-test) plus per-domain references. Use whenever someone wants to QA, smoke-test, verify, or debug opencode's CLI, HTTP server, plugin hooks/events, or TUI, or to find/inspect opencode sessions in the database. Triggers: opencode qa, qa opencode, test opencode, verify opencode hook, opencode session db, find opencode session by id/name/text, opencode tui test, opencode server health, opencode event stream."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# opencode QA
|
|
7
|
+
|
|
8
|
+
QA the opencode coding agent itself. This skill maps each QA need to a tested
|
|
9
|
+
helper script and a deep reference. Every script ships a `--self-test` that
|
|
10
|
+
asserts its scenario against the live machine, so the scripts are both the QA
|
|
11
|
+
tools and their own regression checks.
|
|
12
|
+
|
|
13
|
+
Verified against opencode v1.15.13 (bun 1.3.12, macOS). Confirm the installed
|
|
14
|
+
version with `opencode --version`; the surface is stable but always sanity
|
|
15
|
+
check a flag with `opencode <cmd> --help`.
|
|
16
|
+
|
|
17
|
+
## Golden rules (read before running anything)
|
|
18
|
+
|
|
19
|
+
- READS of the live DB are safe and intended. Investigating sessions (Case D)
|
|
20
|
+
only reads `~/.local/share/opencode/opencode.db`.
|
|
21
|
+
- Anything that SPAWNS opencode (serve, run, the TUI) must use an isolated XDG
|
|
22
|
+
sandbox so QA never writes junk sessions into the real DB. The bundled
|
|
23
|
+
scripts already do this; if you run opencode by hand for QA, set
|
|
24
|
+
`XDG_DATA_HOME` / `XDG_CONFIG_HOME` / `XDG_STATE_HOME` / `XDG_CACHE_HOME` to
|
|
25
|
+
temp dirs first.
|
|
26
|
+
- Global text search over the `part` table is a multi-GB scan. Always scope it
|
|
27
|
+
(`--session`, `--recent`, or `--since`). The text script refuses an
|
|
28
|
+
unbounded scan on purpose.
|
|
29
|
+
- The opencode source repo (`packages/opencode`) tests itself with `bun test`
|
|
30
|
+
and CANNOT run tests from the repo root. See `references/testing-harness.md`.
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
Scripts live next to this file under `scripts/`. Invoke them from this skill
|
|
35
|
+
directory (or with their absolute path):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd <this-skill-dir> # .agents/skills/opencode-qa
|
|
39
|
+
bash scripts/lib/common.sh --self-check # confirm the harness + deps
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`common.sh` provides the shared harness (DB path, SQL escaping, isolated XDG
|
|
43
|
+
sandbox, free port, server start/stop, and an EXIT-trap cleanup). It requires
|
|
44
|
+
`opencode`, `sqlite3`, `curl`, `jq`, and `tmux` on PATH.
|
|
45
|
+
|
|
46
|
+
## Router: pick your case
|
|
47
|
+
|
|
48
|
+
| You want to... | Case | Script | Reference |
|
|
49
|
+
|---|---|---|---|
|
|
50
|
+
| Run opencode non-interactively / check a CLI command | A | `opencode run --format json` (inline) | `references/cli-commands.md` |
|
|
51
|
+
| Find a session by its id | D | `scripts/db-session-by-id.sh <ses_id>` | `references/db-investigation.md` |
|
|
52
|
+
| Find sessions by title/name | D | `scripts/db-session-by-name.sh "<text>"` | `references/db-investigation.md` |
|
|
53
|
+
| Find sessions by message text | D | `scripts/db-session-by-text.sh --recent N "<text>"` | `references/db-investigation.md` |
|
|
54
|
+
| Export a whole session as JSON | D | `scripts/export-roundtrip.sh <ses_id>` | `references/db-investigation.md` |
|
|
55
|
+
| Check the HTTP server / an endpoint | B | `scripts/server-smoke.sh` | `references/server-api.md` |
|
|
56
|
+
| Prove a hook / action / event fired | B | `scripts/sse-hook-probe.sh` | `references/events-hooks.md` |
|
|
57
|
+
| Smoke-test the TUI | C | `scripts/tui-smoke.sh` | `references/tui-tmux.md` |
|
|
58
|
+
| Write/run a test in the opencode source | - | (bun test) | `references/testing-harness.md` |
|
|
59
|
+
| Drive opencode from a Bun/TS script | - | (SDK) | `references/sdk.md` |
|
|
60
|
+
|
|
61
|
+
## Case A: CLI / terminal works
|
|
62
|
+
|
|
63
|
+
The canonical scriptable, non-interactive entry is `opencode run`. JSON mode
|
|
64
|
+
emits one event per line so you can assert on it.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# stream structured events (types: text, tool_use, step_start, step_finish, reasoning, error)
|
|
68
|
+
opencode run "list files in src" --format json
|
|
69
|
+
# run a slash command
|
|
70
|
+
opencode run --command commit
|
|
71
|
+
# resume the last session
|
|
72
|
+
opencode run -c "continue"
|
|
73
|
+
# target an already-running server instead of booting one
|
|
74
|
+
opencode run "explain auth" --attach http://127.0.0.1:4096 -p "$OPENCODE_SERVER_PASSWORD"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Other QA-useful commands: `opencode db path`, `opencode debug paths`,
|
|
78
|
+
`opencode session list --format json`, `opencode models --verbose`. Full flag
|
|
79
|
+
detail in `references/cli-commands.md`.
|
|
80
|
+
|
|
81
|
+
## Case B: a specific hook, action, or event
|
|
82
|
+
|
|
83
|
+
opencode publishes lifecycle events over Server-Sent Events at `GET /event`.
|
|
84
|
+
Plugins observe the same events via the `event` hook, so seeing an event on the
|
|
85
|
+
wire proves a hook would fire.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# prove the SSE plumbing works (isolated server, asserts server.connected)
|
|
89
|
+
bash scripts/sse-hook-probe.sh --self-test
|
|
90
|
+
|
|
91
|
+
# watch a REAL server for a specific event while you trigger an action
|
|
92
|
+
bash scripts/sse-hook-probe.sh --attach http://127.0.0.1:4096 \
|
|
93
|
+
--password "$OPENCODE_SERVER_PASSWORD" --directory "$PWD" \
|
|
94
|
+
--event message.part.updated --timeout 30
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Trigger an action over HTTP (fire-and-forget so the stream is not blocked):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
curl -X POST -u opencode:$OPENCODE_SERVER_PASSWORD -H 'Content-Type: application/json' \
|
|
101
|
+
-d '{"parts":[{"type":"text","text":"say hi"}]}' \
|
|
102
|
+
"http://127.0.0.1:4096/session/<ses_id>/prompt_async?directory=$PWD"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
A real prompt needs a configured provider, so run the watch-and-trigger pattern
|
|
106
|
+
against your real server, not the isolated sandbox. Event-type catalog, the 21
|
|
107
|
+
plugin hook points, and how to load a local plugin: `references/events-hooks.md`.
|
|
108
|
+
Server start, auth, and routes: `references/server-api.md`.
|
|
109
|
+
|
|
110
|
+
## Case C: the TUI
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
bash scripts/tui-smoke.sh --self-test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This launches the TUI under tmux in an isolated sandbox, confirms it renders
|
|
117
|
+
(`capture-pane`), confirms `send-keys` reaches the composer, tears the tmux
|
|
118
|
+
session down, and verifies the real DB session count is unchanged.
|
|
119
|
+
|
|
120
|
+
Honest verdict: tmux is fine for SMOKE (did it boot, render, accept a key) but
|
|
121
|
+
fragile for asserting conversation output (the TUI is a 60fps full-screen app).
|
|
122
|
+
For real behavior assertions use Case A (`opencode run`), Case B (server API +
|
|
123
|
+
SSE), or the TUI control HTTP API (`POST /tui/append-prompt`,
|
|
124
|
+
`POST /tui/submit-prompt`, `POST /tui/execute-command`). Details and the manual
|
|
125
|
+
tmux recipe: `references/tui-tmux.md`.
|
|
126
|
+
|
|
127
|
+
## Case D: investigate sessions in the DB
|
|
128
|
+
|
|
129
|
+
Read-only against the live SQLite DB. The `session` table is small (title and
|
|
130
|
+
id lookups are instant); message text lives in the multi-GB `part` table, so
|
|
131
|
+
text search must be scoped.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# by id
|
|
135
|
+
bash scripts/db-session-by-id.sh ses_3a4ee6335ffedFB8f76BPU1Eb3
|
|
136
|
+
# by title / name (newest first; second arg = limit)
|
|
137
|
+
bash scripts/db-session-by-name.sh "auth refactor" 20
|
|
138
|
+
# by message text - scope with --session, --recent N, or --since "<window>"
|
|
139
|
+
bash scripts/db-session-by-text.sh --session ses_3a4e... "ULTRAWORK"
|
|
140
|
+
bash scripts/db-session-by-text.sh --recent 50 "permission denied"
|
|
141
|
+
bash scripts/db-session-by-text.sh --since "7 days" --limit 50 "TODO"
|
|
142
|
+
# export an entire session as clean JSON
|
|
143
|
+
bash scripts/export-roundtrip.sh ses_3a4e... > session.json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Ad hoc queries: `opencode db "<SQL>" --format json`. Schema, tested query
|
|
147
|
+
shapes with timings, the legacy `message`/`part` vs V2 `session_message`
|
|
148
|
+
distinction, and the 25 GB caveat: `references/db-investigation.md`.
|
|
149
|
+
|
|
150
|
+
## Scripts index
|
|
151
|
+
|
|
152
|
+
Run any script with `--self-test` to verify it against the live machine, or
|
|
153
|
+
`-h` for usage. DB-read scripts are read-only; serve/sse/tui scripts use an
|
|
154
|
+
isolated sandbox and clean up on exit.
|
|
155
|
+
|
|
156
|
+
| Script | Case | Self-test asserts |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `scripts/lib/common.sh --self-check` | - | deps present, DB path resolves, SQL escaping, free port, sandbox auto-removed |
|
|
159
|
+
| `scripts/db-session-by-id.sh` | D | id round-trips for a real session |
|
|
160
|
+
| `scripts/db-session-by-name.sh` | D | a derived title needle returns >=1 row |
|
|
161
|
+
| `scripts/db-session-by-text.sh` | D | scoped search hits; unbounded scan refused; bounded search <30s |
|
|
162
|
+
| `scripts/export-roundtrip.sh` | D | export stdout is valid JSON and `.info.id` round-trips |
|
|
163
|
+
| `scripts/server-smoke.sh` | B | `/global/health` healthy, `/doc` >=100 paths, no-auth -> 401 |
|
|
164
|
+
| `scripts/sse-hook-probe.sh` | B | `/event` opens and delivers `server.connected` |
|
|
165
|
+
| `scripts/tui-smoke.sh` | C | TUI renders under tmux, tears down, real DB untouched |
|
|
166
|
+
|
|
167
|
+
## Risks and caveats
|
|
168
|
+
|
|
169
|
+
- 25 GB part table: never run an unbounded text scan. Use `--session`,
|
|
170
|
+
`--recent`, or `--since`. A naive `JOIN ... WHERE session.time_created >= X`
|
|
171
|
+
scans oldest-first and can take ~50s; the scripts use an `IN`-subquery on the
|
|
172
|
+
newest sessions (~20ms).
|
|
173
|
+
- `opencode export` writes its banner to STDERR; pipe with `2>/dev/null` before
|
|
174
|
+
`jq` or you will get a parse error.
|
|
175
|
+
- The server enforces auth only when `OPENCODE_SERVER_PASSWORD` is set;
|
|
176
|
+
otherwise it runs unsecured. Authenticated calls use `-u opencode:$PASS`.
|
|
177
|
+
Unauthenticated calls to a secured server return HTTP 401.
|
|
178
|
+
- Installed binary vs dev source: cite dev source paths for internals but
|
|
179
|
+
verify flags against the installed `opencode <cmd> --help`.
|
|
180
|
+
- Isolation: any QA that spawns opencode must use an isolated XDG sandbox so it
|
|
181
|
+
never pollutes the real DB. Prove it by comparing
|
|
182
|
+
`sqlite3 "$(opencode db path)" "SELECT count(*) FROM session"` before and
|
|
183
|
+
after.
|
|
184
|
+
- TUI output assertions are fragile; use the API for real assertions.
|
|
185
|
+
|
|
186
|
+
## References
|
|
187
|
+
|
|
188
|
+
- `references/cli-commands.md` - every QA-relevant opencode subcommand and flag
|
|
189
|
+
- `references/db-investigation.md` - DB schema, tested queries, the 25 GB caveat
|
|
190
|
+
- `references/server-api.md` - server start, auth, route catalog, /doc
|
|
191
|
+
- `references/events-hooks.md` - SSE endpoints, event types, plugin hooks
|
|
192
|
+
- `references/tui-tmux.md` - tmux recipe, isolation, TUI control API
|
|
193
|
+
- `references/testing-harness.md` - how opencode tests itself (bun test)
|
|
194
|
+
- `references/sdk.md` - the @opencode-ai/sdk client (reference only)
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# opencode CLI for QA (Case A: terminal works)
|
|
2
|
+
|
|
3
|
+
The installed binary is `opencode` (v1.15.13). From the source repo you can also run `bun run --conditions=browser ./src/index.ts <cmd>` inside `packages/opencode`. The canonical non-interactive QA entry is `opencode run --format json`.
|
|
4
|
+
|
|
5
|
+
## Global flags
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
--print-logs
|
|
9
|
+
--log-level DEBUG|INFO|WARN|ERROR
|
|
10
|
+
--pure (run without external plugins)
|
|
11
|
+
-h, --help
|
|
12
|
+
-v, --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## `opencode run` (non-interactive QA core)
|
|
16
|
+
|
|
17
|
+
Positional message. Key flags:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
-m, --model <provider/model>
|
|
21
|
+
--agent <name>
|
|
22
|
+
-s, --session <ses_...>
|
|
23
|
+
-c, --continue
|
|
24
|
+
--fork
|
|
25
|
+
--format default|json
|
|
26
|
+
-f, --file <path>
|
|
27
|
+
--title
|
|
28
|
+
--attach <url>
|
|
29
|
+
-p, --password
|
|
30
|
+
-u, --username
|
|
31
|
+
--dir
|
|
32
|
+
--variant
|
|
33
|
+
--thinking
|
|
34
|
+
-i, --interactive
|
|
35
|
+
--dangerously-skip-permissions
|
|
36
|
+
--command <slash-cmd>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`--format json` emits NDJSON, one JSON object per line, each shaped like:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{"type":"...", "timestamp":<ms>, "sessionID":"ses_...", ...}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`type` is one of: `text`, `tool_use`, `step_start`, `step_finish`, `reasoning`, `error`. The process exits when the session goes idle.
|
|
46
|
+
|
|
47
|
+
Validation rules:
|
|
48
|
+
|
|
49
|
+
- `-i` cannot combine with `--command` or `--format json`
|
|
50
|
+
- `--fork` needs `-c` or `-s`
|
|
51
|
+
|
|
52
|
+
Examples:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
opencode run "list the files in src" --format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
opencode run --command commit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
opencode run -c "continue the previous task"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
opencode run "explain auth" --attach http://127.0.0.1:4096 -p "$OPENCODE_SERVER_PASSWORD"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## `opencode db` (database tools)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
opencode db path
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Prints the active DB file path.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
opencode db "<SQL>" --format json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Runs a query and prints JSON rows. Use `--format tsv` (default) for TSV output.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
opencode db
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Opens an interactive sqlite3 shell.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
opencode db migrate
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Migrates legacy JSON storage into SQLite.
|
|
95
|
+
|
|
96
|
+
Bundled scripts for session investigation:
|
|
97
|
+
|
|
98
|
+
- `scripts/db-session-by-id.sh`
|
|
99
|
+
- `scripts/db-session-by-name.sh`
|
|
100
|
+
- `scripts/db-session-by-text.sh`
|
|
101
|
+
- `scripts/export-roundtrip.sh`
|
|
102
|
+
|
|
103
|
+
Full detail in `references/db-investigation.md`.
|
|
104
|
+
|
|
105
|
+
## `opencode session`
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
opencode session list --format json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Lists sessions as JSON.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
opencode session delete <ses_id>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Deletes one session.
|
|
118
|
+
|
|
119
|
+
## `opencode export [sessionID]`
|
|
120
|
+
|
|
121
|
+
Prints "Exporting session: ..." to STDERR and a clean JSON document `{info:{...}, messages:[...]}` to STDOUT. Always redirect STDERR before piping to jq.
|
|
122
|
+
|
|
123
|
+
Example:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
opencode export ses_3a4e... 2>/dev/null | jq '.info.id'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Bundled wrapper:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
scripts/export-roundtrip.sh <ses_id>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## `opencode serve`
|
|
136
|
+
|
|
137
|
+
Starts a headless HTTP server.
|
|
138
|
+
|
|
139
|
+
Flags:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
--port (0 = pick 4096 then a free port)
|
|
143
|
+
--hostname (default 127.0.0.1)
|
|
144
|
+
--mdns
|
|
145
|
+
--mdns-domain
|
|
146
|
+
--cors
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
On start it prints:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
opencode server listening on http://<host>:<port>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Set `OPENCODE_SERVER_PASSWORD` to require auth. See `references/server-api.md`.
|
|
156
|
+
|
|
157
|
+
Bundled smoke test:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
scripts/server-smoke.sh
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## `opencode debug`
|
|
164
|
+
|
|
165
|
+
Useful subcommands:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
opencode debug paths # data/config/cache/state dirs
|
|
169
|
+
opencode debug info # version, OS, terminal, plugins
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Others: `config`, `lsp`, `ripgrep`, `file`, `skill`, `snapshot`, `agent`, `v2`, `wait`.
|
|
173
|
+
|
|
174
|
+
## Other commands
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
opencode models [provider] --verbose
|
|
178
|
+
opencode stats
|
|
179
|
+
opencode providers list # alias: auth
|
|
180
|
+
opencode mcp list
|
|
181
|
+
opencode generate # prints the OpenAPI JSON spec
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Installed binary vs dev source (IMPORTANT note box)
|
|
185
|
+
|
|
186
|
+
The installed `opencode` (v1.15.13) matches the dev source in `packages/opencode`. When citing internals, cite dev source paths but always verify a flag against `opencode <cmd> --help` on the installed binary, since the dev branch can drift ahead.
|
|
187
|
+
|
|
188
|
+
For DB internals see `references/db-investigation.md`; for the HTTP server see `references/server-api.md`.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Investigating opencode sessions in the DB (Case D)
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Where the data lives](#where-the-data-lives)
|
|
6
|
+
- [Access methods](#access-methods)
|
|
7
|
+
- [Schema (the tables that matter)](#schema-the-tables-that-matter)
|
|
8
|
+
- [Time conversion](#time-conversion)
|
|
9
|
+
- [Tested query patterns](#tested-query-patterns)
|
|
10
|
+
- [The 25 GB caveat](#the-25-gb-caveat)
|
|
11
|
+
- [Verifying read-only](#verifying-read-only)
|
|
12
|
+
|
|
13
|
+
## Where the data lives
|
|
14
|
+
|
|
15
|
+
Active DB path: `opencode db path` (on this machine `~/.local/share/opencode/opencode.db`).
|
|
16
|
+
|
|
17
|
+
Derived from XDG data dir + "opencode" + "opencode.db" (or "opencode-<channel>.db" on non-stable channels). Override via env `OPENCODE_DB` (`:memory:`, absolute, or relative-to-data).
|
|
18
|
+
|
|
19
|
+
It is large (tens of GB) because the `part` table stores tool output. The `session` table is small (~21k rows; full scans are milliseconds).
|
|
20
|
+
|
|
21
|
+
## Access methods
|
|
22
|
+
|
|
23
|
+
Preferred: `opencode db "<SQL>" --format json` (WAL-safe; resolves the active DB). `--format tsv` default. Bare `opencode db` opens an interactive sqlite3 shell. `opencode db path` prints the file.
|
|
24
|
+
|
|
25
|
+
Raw fallback for EXPLAIN/perf: `sqlite3 "$(opencode db path)" "<SQL>"`. Reads are safe alongside a running opencode (WAL allows concurrent readers).
|
|
26
|
+
|
|
27
|
+
## Schema (the tables that matter)
|
|
28
|
+
|
|
29
|
+
Note the ACTIVE storage in v1.15.13 is the LEGACY pair `message` + `part`; the V2 `session_message` table exists but is EMPTY in this version (a recent session showed 43 message rows, 169 part rows, 0 session_message). Document both but make clear `message`/`part` is what holds current data.
|
|
30
|
+
|
|
31
|
+
### `session`
|
|
32
|
+
|
|
33
|
+
| Column | Notes |
|
|
34
|
+
|--------|-------|
|
|
35
|
+
| id | PK, 'ses_' prefix |
|
|
36
|
+
| project_id | FK |
|
|
37
|
+
| parent_id | |
|
|
38
|
+
| slug | |
|
|
39
|
+
| directory | |
|
|
40
|
+
| title | NOT NULL |
|
|
41
|
+
| version | |
|
|
42
|
+
| agent | |
|
|
43
|
+
| model | JSON {providerID, modelID} |
|
|
44
|
+
| cost | |
|
|
45
|
+
| tokens_input | |
|
|
46
|
+
| tokens_output | |
|
|
47
|
+
| tokens_reasoning | |
|
|
48
|
+
| tokens_cache_read | |
|
|
49
|
+
| tokens_cache_write | |
|
|
50
|
+
| metadata | JSON |
|
|
51
|
+
| time_created | epoch MILLISECONDS |
|
|
52
|
+
| time_updated | epoch MILLISECONDS |
|
|
53
|
+
| time_archived | |
|
|
54
|
+
|
|
55
|
+
Indexes: project_id, parent_id, workspace_id. NO index on title or time_created.
|
|
56
|
+
|
|
57
|
+
### `message` (legacy)
|
|
58
|
+
|
|
59
|
+
| Column | Notes |
|
|
60
|
+
|--------|-------|
|
|
61
|
+
| id | 'msg_' prefix |
|
|
62
|
+
| session_id | FK -> session, cascade |
|
|
63
|
+
| time_created | |
|
|
64
|
+
| time_updated | |
|
|
65
|
+
| data | JSON: {role, time:{created}, summary:{title}, agent, model:{providerID,modelID}, variant} |
|
|
66
|
+
|
|
67
|
+
### `part` (legacy)
|
|
68
|
+
|
|
69
|
+
| Column | Notes |
|
|
70
|
+
|--------|-------|
|
|
71
|
+
| id | 'prt_' prefix |
|
|
72
|
+
| message_id | FK -> message, cascade |
|
|
73
|
+
| session_id | denormalized; index part_session_idx |
|
|
74
|
+
| data | JSON |
|
|
75
|
+
|
|
76
|
+
Part types seen: text, reasoning, tool, step-start, step-finish. A text part is `{"type":"text","text":"..."}`.
|
|
77
|
+
|
|
78
|
+
### Other tables
|
|
79
|
+
|
|
80
|
+
`session_message` (V2, currently empty), `todo`, `project`, `permission`, `session_share`, `workspace`, `event`.
|
|
81
|
+
|
|
82
|
+
## Time conversion
|
|
83
|
+
|
|
84
|
+
`time_created`/`time_updated` are epoch milliseconds. Convert:
|
|
85
|
+
|
|
86
|
+
```sql
|
|
87
|
+
datetime(time_created/1000,'unixepoch')
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Tested query patterns
|
|
91
|
+
|
|
92
|
+
### 1. By id (instant)
|
|
93
|
+
|
|
94
|
+
Script: `scripts/db-session-by-id.sh <ses_id>`
|
|
95
|
+
|
|
96
|
+
```sql
|
|
97
|
+
SELECT
|
|
98
|
+
id,
|
|
99
|
+
slug,
|
|
100
|
+
title,
|
|
101
|
+
directory,
|
|
102
|
+
agent,
|
|
103
|
+
json_extract(model,'$.modelID') AS model,
|
|
104
|
+
json_extract(model,'$.providerID') AS provider,
|
|
105
|
+
cost,
|
|
106
|
+
tokens_input,
|
|
107
|
+
tokens_output,
|
|
108
|
+
datetime(time_created/1000,'unixepoch') AS created,
|
|
109
|
+
datetime(time_updated/1000,'unixepoch') AS updated
|
|
110
|
+
FROM session
|
|
111
|
+
WHERE id='<ses_id>'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2. By name/title (0.006s over 21k rows)
|
|
115
|
+
|
|
116
|
+
Script: `scripts/db-session-by-name.sh "<substr>" [limit]`
|
|
117
|
+
|
|
118
|
+
```sql
|
|
119
|
+
SELECT
|
|
120
|
+
id,
|
|
121
|
+
title,
|
|
122
|
+
datetime(time_created/1000,'unixepoch') AS created
|
|
123
|
+
FROM session
|
|
124
|
+
WHERE title LIKE '%<substr>%'
|
|
125
|
+
ORDER BY time_created DESC
|
|
126
|
+
LIMIT <N>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 3. By message text
|
|
130
|
+
|
|
131
|
+
Script: `scripts/db-session-by-text.sh (--session <id>|--recent <N>|--since "<window>") [--limit N] "<text>"`
|
|
132
|
+
|
|
133
|
+
CRITICAL performance note: text lives in `part.data` JSON, and `part` is the multi-GB table, so an UNBOUNDED text scan is refused by the script. Always scope it.
|
|
134
|
+
|
|
135
|
+
#### Scoped within one session (indexed, ~0.017s)
|
|
136
|
+
|
|
137
|
+
```sql
|
|
138
|
+
SELECT
|
|
139
|
+
p.session_id,
|
|
140
|
+
p.id,
|
|
141
|
+
substr(json_extract(p.data,'$.text'),1,120)
|
|
142
|
+
FROM part p
|
|
143
|
+
WHERE p.session_id='<id>'
|
|
144
|
+
AND json_extract(p.data,'$.type')='text'
|
|
145
|
+
AND json_extract(p.data,'$.text') LIKE '%<text>%'
|
|
146
|
+
LIMIT 50
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Bounded to the N most-recent sessions (worst-case ~0.02s)
|
|
150
|
+
|
|
151
|
+
```sql
|
|
152
|
+
SELECT
|
|
153
|
+
p.session_id,
|
|
154
|
+
p.id,
|
|
155
|
+
substr(json_extract(p.data,'$.text'),1,120)
|
|
156
|
+
FROM part p
|
|
157
|
+
WHERE p.session_id IN (
|
|
158
|
+
SELECT id FROM session ORDER BY time_created DESC LIMIT <N>
|
|
159
|
+
)
|
|
160
|
+
AND json_extract(p.data,'$.type')='text'
|
|
161
|
+
AND json_extract(p.data,'$.text') LIKE '%<text>%'
|
|
162
|
+
LIMIT 50
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### AVOID this naive form (took ~50s)
|
|
166
|
+
|
|
167
|
+
A JOIN `FROM session s JOIN part p ON p.session_id=s.id WHERE s.time_created >= X ...` scans oldest sessions first. The IN-subquery (newest-first, drives `part_session_idx`) is the right shape because it lets SQLite use the index on `part.session_id` with a small, ordered set of recent session IDs, rather than scanning the entire `part` table from the oldest sessions upward.
|
|
168
|
+
|
|
169
|
+
### 4. Full export
|
|
170
|
+
|
|
171
|
+
Script: `scripts/export-roundtrip.sh <ses_id>` wraps `opencode export <id> 2>/dev/null` -> clean JSON `{info:{id,slug,projectID,directory,title,tokens,time,...}, messages:[...]}` (banner goes to stderr).
|
|
172
|
+
|
|
173
|
+
### 5. Listing recent sessions
|
|
174
|
+
|
|
175
|
+
```sql
|
|
176
|
+
SELECT
|
|
177
|
+
id,
|
|
178
|
+
title,
|
|
179
|
+
datetime(time_created/1000,'unixepoch') created
|
|
180
|
+
FROM session
|
|
181
|
+
ORDER BY time_created DESC
|
|
182
|
+
LIMIT 100
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## The 25 GB caveat
|
|
186
|
+
|
|
187
|
+
Global text search over all parts is a full scan of the largest table and can take a long time. The bundled script refuses it; you must pass `--session`, `--recent`, or `--since`. Title search (`session` table) is always cheap.
|
|
188
|
+
|
|
189
|
+
## Verifying read-only
|
|
190
|
+
|
|
191
|
+
All Case D operations are reads. To prove a QA pass did not mutate the DB, compare before and after:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
sqlite3 "$(opencode db path)" "SELECT count(*) FROM session"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
These queries are exactly what the `scripts/db-*.sh` helpers run; each ships a `--self-test`.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# QAing opencode hooks, actions, and events (Case B)
|
|
2
|
+
|
|
3
|
+
opencode publishes lifecycle events over Server-Sent Events. Plugins observe the SAME events via the `event` hook, so confirming an event on the wire proves a hook would fire. The bundled probe is `scripts/sse-hook-probe.sh`.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [The two SSE endpoints](#the-two-sse-endpoints)
|
|
8
|
+
- [Watch the stream](#watch-the-stream)
|
|
9
|
+
- [Important event types](#important-event-types)
|
|
10
|
+
- [Hook-fired recipe (watch + trigger + assert)](#hook-fired-recipe-watch--trigger--assert)
|
|
11
|
+
- [Plugin hooks (the 21 hook points a plugin can implement)](#plugin-hooks-the-21-hook-points-a-plugin-can-implement)
|
|
12
|
+
- [Loading a local plugin for QA](#loading-a-local-plugin-for-qa)
|
|
13
|
+
|
|
14
|
+
## The two SSE endpoints
|
|
15
|
+
|
|
16
|
+
- GET /event?directory=<dir> - per-instance stream; the FIRST event is `server.connected`, a `server.heartbeat` arrives every 10s, and the stream ends on `server.instance.disposed`.
|
|
17
|
+
- GET /global/event - all events, no instance filter.
|
|
18
|
+
- Frames look like `data: {"type":"...","properties":{...}}` (one per line). Consume with `curl -N`.
|
|
19
|
+
|
|
20
|
+
## Watch the stream
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
curl -N -u opencode:$PASS "http://127.0.0.1:4096/event?directory=$PWD"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Bundled, with assertions + auto-teardown:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
scripts/sse-hook-probe.sh --self-test
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
(spawns an isolated server, asserts server.connected)
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
scripts/sse-hook-probe.sh --attach http://127.0.0.1:4096 --password "$PASS" --directory "$PWD" --event message.part.updated --timeout 30
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
(watch your real server for a specific event)
|
|
39
|
+
|
|
40
|
+
## Important event types (type - properties)
|
|
41
|
+
|
|
42
|
+
- `session.created` / `session.updated` / `session.deleted` (sessionID, info)
|
|
43
|
+
- `message.updated` (sessionID, info)
|
|
44
|
+
- `message.removed` (sessionID, messageID)
|
|
45
|
+
- `message.part.updated` (sessionID, part, time)
|
|
46
|
+
- `message.part.delta` (sessionID, messageID, partID, field, delta)
|
|
47
|
+
- `message.part.removed`
|
|
48
|
+
- `permission.asked` (id, sessionID, permission, tool?)
|
|
49
|
+
- `permission.replied`
|
|
50
|
+
- `session.error` (sessionID?, error)
|
|
51
|
+
- `session.diff` (sessionID, diff)
|
|
52
|
+
- `question.asked` / `question.replied` / `question.rejected`
|
|
53
|
+
- `file.watcher.updated` (file, event)
|
|
54
|
+
- `project.updated`
|
|
55
|
+
- `lsp.updated`
|
|
56
|
+
- `pty.created` / `pty.updated` / `pty.exited` / `pty.deleted`
|
|
57
|
+
- `server.connected`
|
|
58
|
+
- `server.heartbeat`
|
|
59
|
+
- `server.instance.disposed`
|
|
60
|
+
- `global.disposed`
|
|
61
|
+
- `plugin.added`
|
|
62
|
+
|
|
63
|
+
## Hook-fired recipe (watch + trigger + assert)
|
|
64
|
+
|
|
65
|
+
Two-shell pattern (or use the script):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
# shell 1: watch (kill with Ctrl-C when done)
|
|
69
|
+
curl -N -u opencode:$PASS "http://127.0.0.1:4096/event?directory=$PWD" \
|
|
70
|
+
| grep --line-buffered '"type":"message.part.updated"'
|
|
71
|
+
|
|
72
|
+
# shell 2: trigger an action (fire-and-forget)
|
|
73
|
+
curl -X POST -u opencode:$PASS -H 'Content-Type: application/json' \
|
|
74
|
+
-d '{"parts":[{"type":"text","text":"say hi"}]}' \
|
|
75
|
+
"http://127.0.0.1:4096/session/<ses_id>/prompt_async?directory=$PWD"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A `message.part.updated` (text/tool) confirms the prompt action drove the model and any tool/permission hook path. Note: a real prompt requires a configured provider/auth, so this runs against your real server, not the isolated sandbox (the sandbox only proves the SSE plumbing via server.connected).
|
|
79
|
+
|
|
80
|
+
## Plugin hooks (the 21 hook points a plugin can implement)
|
|
81
|
+
|
|
82
|
+
`event`, `config`, `tool`, `auth`, `provider`, `chat.message`, `chat.params`, `chat.headers`, `permission.ask`, `command.execute.before`, `tool.execute.before`, `tool.execute.after`, `tool.definition`, `shell.env`, `experimental.chat.messages.transform`, `experimental.chat.system.transform`, `experimental.session.compacting`, `experimental.compaction.autocontinue`, `experimental.text.complete`.
|
|
83
|
+
|
|
84
|
+
- A plugin is a module default-exporting `{ id?, server: (input, options) => Promise<Hooks> }`.
|
|
85
|
+
- Minimal example implementing `event` and `tool.execute.before` that console.log the activity:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
export default {
|
|
89
|
+
id: "qa-logger",
|
|
90
|
+
async server(input, options) {
|
|
91
|
+
return {
|
|
92
|
+
event: async (event) => {
|
|
93
|
+
console.log("[event]", event.type, event.properties);
|
|
94
|
+
},
|
|
95
|
+
"tool.execute.before": async (tool, args, context) => {
|
|
96
|
+
console.log("[tool.before]", tool.name, args);
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Loading a local plugin for QA
|
|
104
|
+
|
|
105
|
+
- Add an absolute path or npm spec to the opencode config `plugin` / `plugin_origins` array (project `.opencode/` config or user config), then restart opencode. On load it emits `plugin.added`.
|
|
106
|
+
- To QA a hook: load the plugin, watch /event (or the plugin's own logging), trigger the relevant action, and assert.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
Pair this with references/server-api.md (how to start the server, auth, prompt routes).
|