Opencode plugin to allow an agent to indicate success status and exit opencode
  • TypeScript 83.5%
  • JavaScript 16.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Troed Sångberg d1449ce6bf rename done -> exit tool, use input.exit() API
- Tool renamed from done to exit
- Uses PluginInput.exit() API instead of process.kill(SIGHUP)
- Takes optional code argument (default 0)
- Updated README with requirements note
2026-07-24 18:56:56 +02:00
src rename done -> exit tool, use input.exit() API 2026-07-24 18:56:56 +02:00
tests test: add edge case tests for empty message and explicit success 2026-07-24 10:19:30 +02:00
.gitignore chore: initialize project structure 2026-07-24 09:48:39 +02:00
jest.config.js test: add tests for done tool 2026-07-24 10:13:33 +02:00
package-lock.json test: add tests for done tool 2026-07-24 10:13:33 +02:00
package.json rename done -> exit tool, use input.exit() API 2026-07-24 18:56:56 +02:00
README.md rename done -> exit tool, use input.exit() API 2026-07-24 18:56:56 +02:00
tsconfig.json feat: implement done tool plugin 2026-07-24 10:03:40 +02:00

oc-done

A plugin for OpenCode that registers an exit() tool to signal agent completion.

When an agent finishes its tasks, it calls exit() to exit opencode with a status code. This allows parent shell scripts or orchestration to detect completion and handle the result accordingly.

The tool uses the opencode plugin API's input.exit() method for clean shutdown, rather than killing processes externally.

Requirements

This plugin requires an opencode fork that exposes the exit() method on PluginInput. The official opencode release does not yet include this API.

Installation

opencode plugin @troed/oc-done@latest --global

Usage

The plugin registers a single tool: exit().

await exit({
  code?: number,  // exit code (default: 0)
});

Examples

// Exit with code 0 (success)
await exit();

// Exit with code 1 (failure)
await exit({ code: 1 });

Exit Codes

  • 0 — success (default)
  • Any non-zero value — failure (the shell can inspect $?)

Source code repo

For known issues, posting new ones, forking or contributing:

https://git.sync.wtf/troed/oc-done

License

Creative Commons Zero (CC0 1.0 Universal) — https://creativecommons.org/publicdomain/zero/1.0/