{"id":49407291,"url":"https://github.com/marcusrbrown/opencode-copilot-delegate","last_synced_at":"2026-05-13T07:12:28.055Z","repository":{"id":353272862,"uuid":"1218587089","full_name":"marcusrbrown/opencode-copilot-delegate","owner":"marcusrbrown","description":"OpenCode plugin that spawns GitHub Copilot CLI (copilot -p) as a background subprocess","archived":false,"fork":false,"pushed_at":"2026-04-28T22:00:38.000Z","size":255,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-28T22:29:31.108Z","etag":null,"topics":["bun","copilot","github-copilot","opencode","plugin","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/opencode-copilot-delegate","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcusrbrown.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"marcusrbrown"}},"created_at":"2026-04-23T02:49:44.000Z","updated_at":"2026-04-28T22:00:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/marcusrbrown/opencode-copilot-delegate","commit_stats":null,"previous_names":["marcusrbrown/opencode-copilot-delegate"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/marcusrbrown/opencode-copilot-delegate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusrbrown%2Fopencode-copilot-delegate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusrbrown%2Fopencode-copilot-delegate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusrbrown%2Fopencode-copilot-delegate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusrbrown%2Fopencode-copilot-delegate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcusrbrown","download_url":"https://codeload.github.com/marcusrbrown/opencode-copilot-delegate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusrbrown%2Fopencode-copilot-delegate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32481587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","copilot","github-copilot","opencode","plugin","typescript"],"created_at":"2026-04-28T22:00:38.045Z","updated_at":"2026-05-02T11:01:58.752Z","avatar_url":"https://github.com/marcusrbrown.png","language":"TypeScript","funding_links":["https://github.com/sponsors/marcusrbrown"],"categories":[],"sub_categories":[],"readme":"# opencode-copilot-delegate\n\nAn [OpenCode](https://opencode.ai) plugin that delegates tasks to [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli) as background subprocesses.\n\n## Overview\n\nThis plugin registers three tools in OpenCode:\n\n- **`copilot_delegate`** — Spawn `copilot -p` as a background subprocess. Returns a `task_id` immediately so the parent agent never blocks.\n- **`copilot_output`** — Retrieve the structured result envelope for a completed or running delegation.\n- **`copilot_cancel`** — Cancel a running delegation with SIGTERM → SIGKILL escalation.\n\nWhen the subprocess completes, a `\u003csystem-reminder\u003e` notification is injected into the parent session via `client.session.prompt` with `noReply: false` for the first notification per session and `noReply: true` for subsequent ones, so the agent sees the result without an unbounded reply chain.\n\n## Installation\n\n```json\n// opencode.json\n{\n  \"plugin\": [\"opencode-copilot-delegate\"]\n}\n```\n\n### Optional: install the TUI half\n\nThe server plugin works by itself. To enable the `/copilot-status` terminal UI, also install the TUI half in OpenCode's TUI config:\n\n```jsonc\n// tui.jsonc\n{\n  \"plugin\": [\"opencode-copilot-delegate/tui\"]\n}\n```\n\nRequires the `copilot` CLI to be on `PATH`. Install via:\n\n```sh\n# npm (recommended)\nnpm install -g @github/copilot\n\n# Homebrew\nbrew install copilot-cli\n\n# Install script (CI-friendly)\ncurl -fsSL https://gh.io/copilot-install | bash\n```\n\n## Authentication\n\nThe plugin passes through your existing Copilot CLI auth. Token precedence:\n\n```\nCOPILOT_GITHUB_TOKEN \u003e GH_TOKEN \u003e GITHUB_TOKEN \u003e ~/.copilot/auth\n```\n\nThe plugin logs the resolved auth source (not the token value) at delegation start.\n\n## Tools\n\n### `copilot_delegate`\n\n| Arg | Type | Description |\n|-----|------|-------------|\n| `prompt` | `string` | Required. The prompt to send to Copilot. |\n| `agent` | `string?` | Optional. Copilot agent name (see tool description for available agents). |\n| `model` | `string?` | Optional. Model override (e.g. `claude-haiku-4.5`). |\n| `add_dir` | `string[]?` | Optional. Additional directories to allow Copilot to read. |\n| `allow_tool` | `string[]?` | Optional. Tool patterns to allow. |\n| `deny_tool` | `string[]?` | Optional. Tool patterns to deny. |\n\nReturns `{ task_id: string }` — a `cpl_`-prefixed UUID.\n\n### `copilot_output`\n\n| Arg | Type | Description |\n|-----|------|-------------|\n| `task_id` | `string` | Required. Task ID from `copilot_delegate`. |\n| `block` | `boolean?` | Optional. Wait for completion before returning. Default `false`. |\n| `timeout_ms` | `number?` | Optional. Max wait ms when `block: true`. Default `30000`, max `120000`. |\n\nReturns a structured envelope with `status`, `final_message`, `tokens`, `tool_calls_summary`, and more.\n\n### `copilot_cancel`\n\n| Arg | Type | Description |\n|-----|------|-------------|\n| `task_id` | `string` | Required. Task ID to cancel. |\n\nReturns `{ cancelled: boolean; was_running: boolean }`.\n\n## Scope Boundary\n\nTask state is in-memory inside a single OpenCode process. Calling `copilot_output` from a different OpenCode process returns `{ status: 'unknown', error: 'task_id not found in this OpenCode process' }`. Cross-process sharing is deferred to a future version.\n\n## Known Limitations\n\n- **Orphaned subprocesses (mitigated since v0.2.0):** If OpenCode crashes mid-delegation, the `copilot` subprocess becomes orphaned. A PID-file reaper now scans `\u003cXDG_STATE_HOME\u003e/opencode-copilot-delegate/orphans/` at every plugin init, probes the owning plugin's liveness, and reaps subprocesses whose plugin has exited. A strict identity gate (kernel-tracked `comm` + start time) prevents PID-reuse misfires.\n- **Prompt visibility in `ps`:** The `copilot` CLI accepts the prompt as a command-line argument, which means the full prompt text appears in `ps` output for any user on the host. This is an upstream Copilot CLI behavior. Avoid delegating prompts that contain secrets or PII; pass sensitive material via files, env vars, or `--secret-env-vars` instead.\n- **No subprocess lifetime cap:** A hung `copilot` subprocess stays in the registry as `running` indefinitely. Cancel manually via `copilot_cancel`. A configurable timeout is planned for v1.x.\n- **TUI half is opt-in:** The package ships server and TUI entrypoints. Existing server-only installs continue to register the three tools; `/copilot-status` only appears when the TUI entrypoint is installed.\n- **RPC server cleanup is best-effort:** The server half exposes a localhost-only RPC listener for the TUI and writes a per-session authenticated port file under `\u003cXDG_CACHE_HOME or ~/.cache\u003e/opencode/copilot-delegate/`. OpenCode's server plugin API has no dispose hook today, so cleanup is tied to process exit signals and the orphan-reaper posture covers missed shutdowns.\n\n## Versioning\n\nReleases under `0.x` are unstable and may include breaking changes between minor versions. Pin to an exact version in production:\n\n```json\n\"dependencies\": {\n  \"opencode-copilot-delegate\": \"0.1.0\"\n}\n```\n\n`1.0.0` will be cut once the public surface stabilizes.\n\n## Privacy\n\nThis plugin collects **zero telemetry**. It does not phone home, track usage, or log to remote services. All logging goes through `client.app.log(...)`, which OpenCode handles locally per its own settings. The resolved auth token value is never logged — only the auth source name.\n\n## License\n\nMIT © [Marcus R. Brown](https://mrbro.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusrbrown%2Fopencode-copilot-delegate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcusrbrown%2Fopencode-copilot-delegate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusrbrown%2Fopencode-copilot-delegate/lists"}