{"_id":"@aidalinfo/oc-internal-schedule","name":"@aidalinfo/oc-internal-schedule","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aidalinfo/oc-internal-schedule","version":"0.1.0","description":"OpenCode plugin that schedules self-messages back into the current session.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/aidalinfo/oc-internal-schedule.git"},"homepage":"https://github.com/aidalinfo/oc-internal-schedule","bugs":{"url":"https://github.com/aidalinfo/oc-internal-schedule/issues"},"type":"module","main":"./index.js","exports":{".":"./index.js","./server":"./index.js"},"publishConfig":{"access":"public"},"scripts":{"test":"node --test"},"keywords":["opencode","plugin","scheduler","reminder","agent"],"dependencies":{"@opencode-ai/plugin":"^1.4.6"},"_id":"@aidalinfo/oc-internal-schedule@0.1.0","gitHead":"b1ffca2945e2ad67f71c4183d7af5eb576634637","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-eng5xVbqaXw8aTWY10U3L331hOnah1CGEO+bRhK9nyGq3Lb9CuL2rgHwGtfY0q1vxRtEgaRLKcU5bP2umMHBjQ==","shasum":"5528d1c4e79e672427f0de2bb15036361020115a","tarball":"https://registry.npmjs.org/@aidalinfo/oc-internal-schedule/-/oc-internal-schedule-0.1.0.tgz","fileCount":14,"unpackedSize":33768,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aidalinfo%2foc-internal-schedule@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHJoIud3iXK2BdRYmdzn8GsWWIIuv7A6hc1KLuV+KimNAiBAABqH2x8pHZ7w9BODSwYB17cPUnsxs4Xjt64tLCox7w=="}]},"_npmUser":{"name":"aidalinfo","email":"dev@pulsemyit.fr"},"directories":{},"maintainers":[{"name":"aidalinfo","email":"dev@pulsemyit.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/oc-internal-schedule_0.1.0_1776262396686_0.0052339108440979665"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-15T14:13:16.613Z","0.1.0":"2026-04-15T14:13:16.842Z","modified":"2026-04-15T14:13:17.194Z"},"maintainers":[{"name":"aidalinfo","email":"dev@pulsemyit.fr"}],"description":"OpenCode plugin that schedules self-messages back into the current session.","homepage":"https://github.com/aidalinfo/oc-internal-schedule","keywords":["opencode","plugin","scheduler","reminder","agent"],"repository":{"type":"git","url":"git+https://github.com/aidalinfo/oc-internal-schedule.git"},"bugs":{"url":"https://github.com/aidalinfo/oc-internal-schedule/issues"},"license":"MIT","readme":"# oc-internal-schedule\n\nOpenCode plugin that adds real scheduling tools capable of sending deferred prompts back into an existing session via `POST /session/:sessionID/prompt_async`.\n\n## What it does\n\n- stores scheduled jobs in a local JSON file\n- supports one-shot jobs and recurring jobs\n- dispatches prompts to an existing OpenCode session\n- exposes actual OpenCode tools usable by an agent\n\n## Added tools\n\n- `schedule_self_message`\n- `list_scheduled_self_messages`\n- `cancel_scheduled_self_message`\n\nThese tools automatically use the current OpenCode `sessionID`.\n\n## Install into OpenCode\n\nOpenCode can load the plugin directly from npm by package name.\n\nExample `opencode.json`:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\"@aidalinfo/oc-internal-schedule\"]\n}\n```\n\nRestart OpenCode after updating the config.\n\n### Verify that OpenCode now exposes:\n\n- plugin tools:\n  - `schedule_self_message`\n  - `list_scheduled_self_messages`\n  - `cancel_scheduled_self_message`\n\nThe plugin also injects native usage guidance into the agent prompt, so the agent can often learn to use the tools even without the optional skill.\n\n## Skill (Optional)\n\nThe companion skill is optional. The plugin already teaches the agent the core usage rules through native plugin hooks.\n\nUse the skill only if you want extra examples and more explicit teaching material.\n\nThe companion skill teaches the agent:\n\n- when a delayed self-reminder is useful\n- when a recurring reminder is better than a one-shot reminder\n- when to list existing reminders before creating a new one\n- how to cancel an obsolete reminder\n\nSkill name:\n\n- `oc-internal-schedule`\n\nSkill setup details are documented in:\n\n- `skill/README.md`\n\n## Test Prompts\n\n### Quick access check\n\n```text\nVérifie si tu as accès aux tools `list_scheduled_self_messages`, `schedule_self_message` et `cancel_scheduled_self_message`, puis utilise `list_scheduled_self_messages`.\n```\n\n### Skill loading check\n\n```text\nCharge le skill `oc-internal-schedule` puis explique quand tu utiliserais `schedule_self_message` plutôt qu'un simple rappel textuel.\n```\n\n### One-shot reminder test\n\n```text\nCharge le skill `oc-internal-schedule`, puis utilise `schedule_self_message` pour te rappeler dans 2 minutes de relire les logs du run courant et m'en faire un retour ici.\n```\n\n### Recurring reminder test\n\n```text\nCharge le skill `oc-internal-schedule`, puis utilise `schedule_self_message` pour te rappeler toutes les 10 minutes de vérifier l'état du scheduler et me résumer la situation.\n```\n\n### Cancel test\n\n```text\nUtilise `list_scheduled_self_messages` pour trouver le dernier rappel planifié dans cette session, puis annule-le avec `cancel_scheduled_self_message`.\n```\n\n### Minimal direct prompt\n\n```text\nUtilise le tool `schedule_self_message` pour te rappeler dans 2 minutes de relire les logs du run courant et m'en faire un retour ici.\n```\n\n## Persistence model\n\n- jobs are stored in `~/.local/share/opencode/internal-schedule/jobs.json`\n- if OpenCode stays running, timers fire at the planned time\n- if OpenCode restarts, jobs are reloaded and re-armed on plugin init\n\nCurrent limitation:\n\n- if OpenCode is completely stopped at the scheduled time, the message cannot be injected until OpenCode is started again and the plugin reloads\n\n## Why this matters\n\nOpenCode already exposes the key primitives needed for a real internal reminder tool:\n\n- `POST /session/:sessionID/message`\n- `POST /session/:sessionID/prompt_async`\n\nThis prototype proves the missing layer:\n\n- schedule something for a session\n- wake up later\n- inject a prompt back into that same session\n\n## CLI\n\nSchedule a one-shot message 5 minutes from now:\n\n```bash\nnode src/cli.js schedule \\\n  --api-base-url http://127.0.0.1:4096 \\\n  --session session_123 \\\n  --in 5m \\\n  --message \"Check the scheduler logs and summarize what happened.\"\n```\n\nRun due jobs once:\n\n```bash\nnode src/cli.js run-due --api-base-url http://127.0.0.1:4096\n```\n\nStart a polling worker:\n\n```bash\nnode src/cli.js daemon --api-base-url http://127.0.0.1:4096 --poll-ms 5000\n```\n\nList jobs:\n\n```bash\nnode src/cli.js list\n```\n\nCancel a job:\n\n```bash\nnode src/cli.js cancel --id job_abc123\n```\n\n## Tool behavior\n\n`schedule_self_message` accepts:\n\n- `message`\n- `in` or `at`\n- optional `every`\n- optional `agent`\n- optional `variant`\n- optional `system`\n- optional `noReply`\n\nDefault behavior:\n\n- `noReply` defaults to `false`\n- scheduled reminders should therefore generate a normal visible assistant reply in the session\n- visible reminders now use the normal `session.prompt` route instead of `prompt_async`\n- set `noReply: true` only if you want a silent/internal reminder without visible reply\n\nExamples:\n\n```text\nPlanifie un self-message dans 1 minutes avec `schedule_self_message` pour vérifier mes conteneurs qui tourne stp.\n```\n\n```text\nPlanifie un rappel toutes les 10 minutes avec `schedule_self_message` pour surveiller l'état du scheduler.\n```\n\n## Tests\n\nRun:\n\n```bash\nnpm test\n```\n\nThe tests cover:\n\n- the standalone scheduler prototype against a mock HTTP server\n- the real OpenCode plugin tool flow with a mocked OpenCode client\n\n## npm Publishing\n\nThis package is intended to be published as:\n\n- `@aidalinfo/oc-internal-schedule`\n\nThe repository includes a GitHub Actions workflow that publishes to npm using the `NPM_TOKEN` secret.\n","readmeFilename":"README.md","_rev":"1-1c34b6cd5f5ecba2dc68d93a55e11d6f"}