{"_id":"@0xsero/opencode-queue","name":"@0xsero/opencode-queue","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@0xsero/opencode-queue","version":"0.1.0","description":"Message queue plugin for OpenCode - control message flow with hold/immediate modes","keywords":["opencode","plugin","queue","message-queue"],"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","clean":"rm -rf dist"},"license":"MIT","engines":{"node":">=20"},"peerDependencies":{"@opencode-ai/plugin":">=1.0.0"},"devDependencies":{"@opencode-ai/plugin":"^1.0.150","@opencode-ai/sdk":"^1.0.150","@types/node":"^20.14.10","typescript":"^5.9.3"},"gitHead":"b6bbad8ba08c3c00a684b0823abdba6b36e50f56","_id":"@0xsero/opencode-queue@0.1.0","_nodeVersion":"23.6.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-r/Zm7LnUiDSA3VqFIfRMdPjqvUNWRl5HMdHDTCN4A8PRlICXtfFo8KRvA42ibZBU57ry86oZwR7M8QKZJBbslw==","shasum":"7c81363a5f4136c86f8c3041f37fdf140b4f1181","tarball":"https://registry.npmjs.org/@0xsero/opencode-queue/-/opencode-queue-0.1.0.tgz","fileCount":5,"unpackedSize":14013,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDd8XRwaMMaEfUk8K95k48Vxs0bFqMXFE8h0m8WTcI9wQIgKtPx5z6qk2NTh29eUb8Ubtt6jznQeieb7Yw5rSd0S/o="}]},"_npmUser":{"name":"0xsero","email":"admin+ser@serotonindesigns.com"},"directories":{},"maintainers":[{"name":"0xsero","email":"admin+ser@serotonindesigns.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-queue_0.1.0_1766939758315_0.9243882621132768"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-28T16:35:58.228Z","0.1.0":"2025-12-28T16:35:58.463Z","modified":"2025-12-28T16:35:58.807Z"},"maintainers":[{"name":"0xsero","email":"admin+ser@serotonindesigns.com"}],"description":"Message queue plugin for OpenCode - control message flow with hold/immediate modes","keywords":["opencode","plugin","queue","message-queue"],"license":"MIT","readme":"# OpenCode Message Queue Plugin\n\n![queue-power.svg](assets/queue-power.svg)\n\n[![npm version](https://img.shields.io/npm/v/@0xsero/open-queue.svg)](https://www.npmjs.com/package/@0xsero/open-queue)\n\nControl how messages behave while a session is running. Queue them up or send them immediately.\n\n## NOTE\n\nBe aware that when a message is sent while model is running it looks like it's sent, then when the model is really done it gets sent again.\n\nI can't fix that yet, but the functionality does work the model won't see the 2nd message until after it's done\n\n## Modes\n\n| Mode | Behavior |\n|------|----------|\n| `immediate` | Messages are sent right away (default) |\n| `hold` | Messages are queued until the current run finishes, then sent in order |\n\n## Installation\n\n```bash\ncd .opencode\nbun add @0xsero/open-queue\n```\n\nThen add to your `.opencode/opencode.jsonc`:\n\n```jsonc\n{\n  \"plugin\": [\"@0xsero/open-queue\"]\n}\n```\n\nOptionally, copy the slash command to your project:\n\n```bash\ncp node_modules/@0xsero/open-queue/command/queue.md .opencode/command/\n```\n\n## Usage\n\n### Slash Command\n\nThe easiest way to control the queue is with the `/queue` command:\n\n```\n/queue status     # Check current mode and queue size\n/queue hold       # Start queueing messages\n/queue immediate  # Send messages immediately (drains any queued)\n```\n\n### Environment Variable\n\nSet the initial mode via environment variable:\n\n```bash\n# Start in hold mode\nOPENCODE_MESSAGE_QUEUE_MODE=hold opencode\n\n# Start in immediate mode (default)\nOPENCODE_MESSAGE_QUEUE_MODE=immediate opencode\n```\n\n### Programmatic (via LLM)\n\nThe plugin exposes a `queue` tool that the LLM can invoke directly:\n\n- \"Set queue mode to hold\"\n- \"Check queue status\"\n- \"Switch to immediate mode\"\n\n## How It Works\n\n### Hold Mode\n\nWhen in `hold` mode:\n\n1. Incoming messages are intercepted by the `chat.message` hook\n2. Message parts are converted and stored in a per-session queue\n3. Text parts are marked as `ignored` to hide them from the current run\n4. When the session becomes idle (`session.status` or `session.idle` events), queued messages are drained in order via `client.session.prompt()`\n\n### Immediate Mode\n\nWhen in `immediate` mode:\n\n1. Messages pass through without modification\n2. Any existing queued messages are drained when switching from hold to immediate\n\n## API\n\n### Tool: `queue`\n\n| Action | Description |\n|--------|-------------|\n| `status` | Returns current mode, queue size, and session busy state |\n| `hold` | Sets mode to hold (queue messages) |\n| `immediate` | Sets mode to immediate and drains any queued messages |\n\n### Events Handled\n\n- `session.status` - Tracks busy/idle state, drains queue when idle\n- `session.idle` - Alternative idle detection, drains queue\n\n### Hooks Used\n\n- `chat.message` - Intercepts messages in hold mode, queues them, marks text as ignored\n\n## Limitations\n\n- **Best-effort queueing**: OpenCode does not yet allow plugins to fully defer message creation. The plugin hides text content but non-text attachments may still be sent.\n- **Global mode**: The mode is global across all sessions. Per-session mode could be added if needed.\n- **Plugin scope**: Queued messages are lost if OpenCode restarts.\n\n## Links\n\n- [GitHub Repository](https://github.com/0xSero/open-queue)\n- [npm Package](https://www.npmjs.com/package/@0xsero/open-queue)\n- [Report Issues](https://github.com/0xSero/open-queue/issues)\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-f66e0287c15d2fc491519d98d721bd5c"}