time-send
v0.1.4
Published
OpenCode plugin that delays provider calls until a configured local send window.
Maintainers
Readme
time-send
Publishable OpenCode plugin that delays provider calls until a configured local send window. It is built as an external plugin package with separate server and TUI targets.
Default behavior:
- Send window:
02:00 <= now < 09:00local time. - Before
02:00: wait until today's02:00. - From
02:00through08:59: send immediately. - At or after
09:00: wait until the next local02:00. - Malformed JSON or invalid times fail closed before any provider call.
The wait is process-local: if OpenCode exits while waiting, the request is not durable-rescheduled.
Install
Local development config:
{
"plugin": [
"file:///C:/Users/Zhang/opencode-timed-send"
]
}After npm view time-send@latest version succeeds, replace the local file URL with the published package name in both opencode.json and tui.json:
{
"plugin": [
"time-send@latest"
]
}Keep the local file:///C:/Users/Zhang/opencode-timed-send entry active until the npm lookup succeeds. Switching active config to time-send@latest before publish will make OpenCode fail to load the plugin on restart.
The same package-name plugin entry is needed in opencode.json for server gating and tui.json for the TUI indicator. Do not use time-send/tui in tui.json: OpenCode installs the configured package spec first, then resolves the package's ./tui export from that installed package.
No plugin option is required. time-send looks for opencode-timed-send.json by default: it first checks the active directory OpenCode provides, then falls back to OPENCODE_CONFIG_DIR or $XDG_CONFIG_HOME/opencode, so the JSON can live next to your active OpenCode config files without being referenced from opencode.json or tui.json.
JSON Config
Create opencode-timed-send.json in the OpenCode config directory:
{
"$schema": "C:/Users/Zhang/opencode-timed-send/schema.json",
"enabled": true,
"start": "01:30",
"end": "09:30",
"statusFile": "opencode-timed-send.status.json",
"display": {
"promptRight": true,
"appBottom": true
}
}Fields:
enabled: setfalseto bypass waiting while keeping the plugin installed.start: localHH:mmwindow start.end: localHH:mmwindow end. The window is[start,end).statusFile: relative to the JSON config directory, or absolute.display.promptRight/display.appBottom: legacy display toggles. If either istrue, the TUI shows the indicator in the publicsidebar_contentslot.
Example waiting indicator:
01:30 in 4h 12mExample open-window indicator:
window open until 09:30Status UI
The TUI target uses only public OpenCode TUI plugin APIs:
sidebar_contentfor a sidebar indicator alongside the built-in sidebar blocks./timed-send-statusfor a plugin-owned status command./time-send-nowto release the current timed-send wait through the shared status file.
OpenCode does not currently expose a public plugin slot for replacing the built-in lower-right progress spinner or injecting custom rows into the built-in /status dialog. This plugin therefore provides a supported external-plugin indicator instead of patching OpenCode core.
Package Exports
The package exposes target-only OpenCode modules:
time-send/server: default export{ id, server }.time-send/tui: default export{ id, tui }.time-send/schema.json: JSON schema for config editors.
The package root defaults to the server target for OpenCode package detection. The TUI target stays available through the ./tui export while tui.json still points at the package name.
Development
bun install
bun test
bun run typecheck
bun run buildThe tests cover config parsing, malformed JSON fail-closed behavior, [02:00,09:00) window semantics, DST-safe next-start calculation, status file read/write, server chat.params gating, TUI slot/command registration, and target-only package exports.
Publish Checklist
- Run
bun test,bun run typecheck, andbun run build. - Verify
dist/server.js,dist/tui.js,schema.json,README.md, andLICENSEare included by thefileslist. - Log in with
npm login, confirm withnpm whoami, then runnpm publish --dry-run. - Publish with
npm publishonly after the dry run reports package[email protected]and the expected files. - Verify the network package with
npm view time-send@latest version, then replace the local plugin entries withtime-send@latestand restart OpenCode.
GitHub Checklist
- Initialize and commit the repository locally.
- Create an empty GitHub repository named
time-send. - Add the SSH remote, for example
git remote add origin [email protected]:<owner>/time-send.git. - Push with
git push -u origin main.
License
MIT. See LICENSE.
