Files
openwork/packages/server
ben 28b1ff39e4 feat: host mode prefers OpenWork server for skills/plugins management (#304)
* feat: host mode prefers OpenWork server for skills/plugins management

- Add hostToken support to OpenWork server client (X-OpenWork-Host-Token header)
- Add includeGlobal query param to listSkills and listPlugins
- Host mode now uses OpenWork server first for:
  - refreshSkills (with includeGlobal for global skills)
  - refreshPlugins (project scope)
  - addPlugin (project scope)
  - installSkillCreator
- Falls back to local filesystem if OpenWork server unavailable
- Fix missing WorkspaceInfo import in dashboard.tsx

* feat: add server binary build script and prefer opencode.jsonc

- Add packages/server/script/build.ts for compiling standalone server binary
- Add build:bin and build:bin:all scripts to server package.json
- Update workspace-files.ts to prefer opencode.jsonc over opencode.json

* fix: compile openwork-server as standalone binary on all platforms

Replace shell launcher script with bun build --compile to create
a standalone binary that doesn't require Bun at runtime.

* feat: host mode uses OpenWork server for commands, MCP, and default model

- Prefer OpenWork server for command save/delete/list in host mode
- Use OpenWork server for Notion MCP setup and MCP refresh/connect when available
- Resolve host workspace id via OpenWork server in host mode
- Fetch host capabilities and pass host token to server client
- Read/write default model via OpenWork server when connected

* fix: rebuild openwork-server sidecar reliably

- Use bun build CLI for compiled server binary
- Detect and replace stub launcher before building

* fix: create target-specific openwork-server sidecar

- Copy compiled openwork-server to platform triple name
- Regenerate stub targets when needed
2026-01-28 19:11:03 -08:00
..

OpenWork Server

Filesystem-backed API for OpenWork remote clients. This package provides the OpenWork server layer described in packages/app/pr/openwork-server.md and is intentionally independent from the desktop app.

Quick start

pnpm --filter @different-ai/openwork-server dev -- \
  --workspace /path/to/workspace \
  --approval auto

The server logs the client token and host token on boot when they are auto-generated.

Config file

Defaults to ~/.config/openwork/server.json (override with OPENWORK_SERVER_CONFIG or --config).

{
  "host": "127.0.0.1",
  "port": 8787,
  "approval": { "mode": "manual", "timeoutMs": 30000 },
  "workspaces": [
    { "path": "/Users/susan/Finance", "name": "Finance", "workspaceType": "local" }
  ],
  "corsOrigins": ["http://localhost:5173"]
}

Environment variables

  • OPENWORK_SERVER_CONFIG path to config JSON
  • OPENWORK_HOST / OPENWORK_PORT
  • OPENWORK_TOKEN client bearer token
  • OPENWORK_HOST_TOKEN host approval token
  • OPENWORK_APPROVAL_MODE (manual | auto)
  • OPENWORK_APPROVAL_TIMEOUT_MS
  • OPENWORK_WORKSPACES (JSON array or comma-separated list of paths)
  • OPENWORK_CORS_ORIGINS (comma-separated list or *)

Endpoints (initial)

  • GET /health
  • GET /capabilities
  • GET /workspaces
  • GET /workspace/:id/config
  • PATCH /workspace/:id/config
  • GET /workspace/:id/plugins
  • POST /workspace/:id/plugins
  • DELETE /workspace/:id/plugins/:name
  • GET /workspace/:id/skills
  • POST /workspace/:id/skills
  • GET /workspace/:id/mcp
  • POST /workspace/:id/mcp
  • DELETE /workspace/:id/mcp/:name
  • GET /workspace/:id/commands
  • POST /workspace/:id/commands
  • DELETE /workspace/:id/commands/:name
  • GET /workspace/:id/audit
  • GET /workspace/:id/export
  • POST /workspace/:id/import

Approvals

All writes are gated by host approval. Host APIs require X-OpenWork-Host-Token:

  • GET /approvals
  • POST /approvals/:id with { "reply": "allow" | "deny" }

Set OPENWORK_APPROVAL_MODE=auto to auto-approve during local development.