mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(sandbox): route notifications through a host-side manager tool
This commit is contained in:
1 parent
098816f7cc
commit
f6c368265f
8 files changed
+517
-51
No files matched your search
@@ -14,13 +14,28 @@ Include the token in requests:
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
## The `ocm` Tool
|
||||
|
||||
The Manager installs a generated plugin (`ocm-manager.js`) that gives every agent an `ocm` tool. The tool calls this API from inside the Manager's own OpenCode process, so it needs no token, no base URL, and no network access from the agent shell.
|
||||
|
||||
That makes it the only path that works everywhere: a scheduled run executes in a throwaway worktree with no `.opencode/internal-token`, and a sandboxed `bash` call runs in a microVM where `localhost` is the guest, not the Manager.
|
||||
|
||||
```ts
|
||||
{
|
||||
action: 'send_notification',
|
||||
params: { title: string, body: string, url?: string, tag?: string, priority?: 'normal' | 'high' }
|
||||
}
|
||||
```
|
||||
|
||||
The bearer-token endpoints below remain available for agents running in the assistant workspace without sandboxing.
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Notifications
|
||||
|
||||
**POST `/api/internal/notifications/send`**
|
||||
|
||||
Send push notifications to the user's registered devices.
|
||||
Send push notifications to the user's registered devices. Prefer the `ocm` tool with the `send_notification` action.
|
||||
|
||||
**Request Body:**
|
||||
```ts
|
||||
|
||||
@@ -21,7 +21,7 @@ Four skills are provisioned automatically when assistant mode is initialized:
|
||||
| Skill | What it teaches |
|
||||
|-------|----------------|
|
||||
| `schedule-management` | Create, list, update, delete, and run scheduled jobs |
|
||||
| `notifications` | Send push notifications to registered user devices |
|
||||
| `notifications` | Send push notifications to registered user devices with the `ocm` tool |
|
||||
| `manager-settings` | Read and patch user preferences, and reload the assistant workspace |
|
||||
| `repo-management` | List all managed repositories |
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ The microVM sees repositories through bind mounts at the same paths used by the
|
||||
| OpenCode file tools | No |
|
||||
| Manager-side git operations | No |
|
||||
| Plugins and custom tools | No; normal OpenCode behavior |
|
||||
| The `ocm` tool (`ocm-manager.js`) | No; runs in the Manager's OpenCode process |
|
||||
| Local MCP servers | No; normal OpenCode behavior |
|
||||
| Formatters, LSP servers, and hooks | No; normal OpenCode behavior |
|
||||
| Custom provider modules | No; normal OpenCode behavior |
|
||||
@@ -89,6 +90,8 @@ The microVM receives writable bind mounts for:
|
||||
|
||||
The assistant workspace's `repos/assistant/.opencode` directory falls beneath the repository mount but is hidden in the guest behind a `tmpfs` mask so its internal API token cannot be read by agent commands.
|
||||
|
||||
Because of that mask, and because `localhost` inside the microVM is the guest rather than the Manager, an agent command cannot call the internal API with `curl`. Agents reach the Manager through the `ocm` tool instead, which executes in the Manager's own OpenCode process and never exposes the token to the guest.
|
||||
|
||||
The microVM also mounts a runtime-owned tmpfs at `/tmp`. It is sized to one quarter of the microVM memory, clamped to 1-512 MiB, so agent commands get writable scratch space that is not backed by a host filesystem.
|
||||
|
||||
The following remain outside the microVM:
|
||||
|
||||
Reference in new issue
Block a user