From 8bd8510156bc49b28ee794bf1b5afba0aedb532e Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Sat, 14 Feb 2026 18:48:41 +0200 Subject: [PATCH] fix: agency container --- {.openclaw => .agency}/.gitkeep | 0 .claude/settings.local.json | 41 ----------- .env.example | 21 +++--- .gitignore | 16 ++--- .prettierignore | 2 +- CLAUDE.md | 6 +- README.md | 30 ++++---- apps/watcher/.env.example | 4 +- apps/watcher/Dockerfile | 2 +- apps/watcher/README.md | 16 ++--- apps/watcher/src/config.spec.ts | 24 +++---- apps/watcher/src/config.ts | 6 +- apps/watcher/src/index.ts | 12 ++-- apps/web/CLAUDE.md | 8 +-- .../_components/telegram-integration-card.tsx | 2 +- .../_components/telegram-remove-dialog.tsx | 4 +- .../_components/telegram-setup-dialog.tsx | 10 +-- apps/web/src/app/api/agency/health/route.ts | 2 +- apps/web/src/app/api/agency/pairing/route.ts | 2 +- .../web/src/app/api/business/context/route.ts | 10 +-- apps/web/src/app/api/chat/abort/route.spec.ts | 4 +- apps/web/src/app/api/chat/abort/route.ts | 2 +- .../src/app/api/chat/history/route.spec.ts | 4 +- apps/web/src/app/api/chat/history/route.ts | 4 +- apps/web/src/app/api/chat/route.ts | 16 ++--- apps/web/src/app/setup/telegram/page.tsx | 14 ++-- apps/web/src/app/setup/welcome/page.tsx | 10 +-- apps/web/src/components/agency-status.tsx | 4 +- .../components/chat/chat-input-textarea.tsx | 33 ++++----- apps/web/src/components/chat/chat-message.tsx | 2 +- .../lib/{openclaw => agency}/actions.spec.ts | 12 ++-- .../src/lib/{openclaw => agency}/actions.ts | 8 +-- apps/web/vitest.config.ts | 4 ++ docker-compose.override.yml | 6 +- docker-compose.yml | 27 ++++---- docker/{openclaw => agency}/Dockerfile | 7 +- docker/{openclaw => agency}/entrypoint.sh | 16 +++-- .../scripts/init-agents.sh | 0 docker/agency/scripts/pair-device.js | 68 +++++++++++++++++++ .../templates/config.template.json | 0 .../templates/shared/CLAWE-CLI.md | 0 .../templates/shared/WORKFLOW.md | 0 .../templates/shared/WORKING.md | 0 .../templates/workspaces/clawe/AGENTS.md | 0 .../templates/workspaces/clawe/BOOTSTRAP.md | 0 .../templates/workspaces/clawe/HEARTBEAT.md | 0 .../templates/workspaces/clawe/MEMORY.md | 0 .../templates/workspaces/clawe/SOUL.md | 0 .../templates/workspaces/clawe/TOOLS.md | 0 .../templates/workspaces/clawe/USER.md | 0 .../templates/workspaces/inky/AGENTS.md | 0 .../templates/workspaces/inky/HEARTBEAT.md | 0 .../templates/workspaces/inky/MEMORY.md | 0 .../templates/workspaces/inky/SOUL.md | 0 .../templates/workspaces/inky/TOOLS.md | 0 .../templates/workspaces/inky/USER.md | 0 .../templates/workspaces/pixel/AGENTS.md | 0 .../templates/workspaces/pixel/HEARTBEAT.md | 0 .../templates/workspaces/pixel/MEMORY.md | 0 .../templates/workspaces/pixel/SOUL.md | 0 .../templates/workspaces/pixel/TOOLS.md | 0 .../templates/workspaces/pixel/USER.md | 0 .../templates/workspaces/scout/AGENTS.md | 0 .../templates/workspaces/scout/HEARTBEAT.md | 0 .../templates/workspaces/scout/MEMORY.md | 0 .../templates/workspaces/scout/SOUL.md | 0 .../templates/workspaces/scout/TOOLS.md | 0 .../templates/workspaces/scout/USER.md | 0 package.json | 4 +- packages/backend/convex/schema.ts | 2 +- packages/cli/src/commands/business-set.ts | 6 +- packages/shared/package.json | 6 +- .../src/{openclaw => agency}/client.spec.ts | 2 +- .../shared/src/{openclaw => agency}/client.ts | 36 ++++++---- .../gateway-client.spec.ts | 8 +-- .../{openclaw => agency}/gateway-client.ts | 8 +-- .../src/{openclaw => agency}/gateway-types.ts | 0 .../shared/src/{openclaw => agency}/index.ts | 0 .../src/{openclaw => agency}/pairing.ts | 8 +-- .../src/{openclaw => agency}/shared-client.ts | 0 .../shared/src/{openclaw => agency}/types.ts | 6 +- scripts/start.sh | 6 +- turbo.json | 6 +- 83 files changed, 295 insertions(+), 262 deletions(-) rename {.openclaw => .agency}/.gitkeep (100%) delete mode 100644 .claude/settings.local.json rename apps/web/src/lib/{openclaw => agency}/actions.spec.ts (91%) rename apps/web/src/lib/{openclaw => agency}/actions.ts (83%) rename docker/{openclaw => agency}/Dockerfile (81%) rename docker/{openclaw => agency}/entrypoint.sh (77%) rename docker/{openclaw => agency}/scripts/init-agents.sh (100%) create mode 100644 docker/agency/scripts/pair-device.js rename docker/{openclaw => agency}/templates/config.template.json (100%) rename docker/{openclaw => agency}/templates/shared/CLAWE-CLI.md (100%) rename docker/{openclaw => agency}/templates/shared/WORKFLOW.md (100%) rename docker/{openclaw => agency}/templates/shared/WORKING.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/AGENTS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/BOOTSTRAP.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/HEARTBEAT.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/MEMORY.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/SOUL.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/TOOLS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/clawe/USER.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/AGENTS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/HEARTBEAT.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/MEMORY.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/SOUL.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/TOOLS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/inky/USER.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/AGENTS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/HEARTBEAT.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/MEMORY.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/SOUL.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/TOOLS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/pixel/USER.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/AGENTS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/HEARTBEAT.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/MEMORY.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/SOUL.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/TOOLS.md (100%) rename docker/{openclaw => agency}/templates/workspaces/scout/USER.md (100%) rename packages/shared/src/{openclaw => agency}/client.spec.ts (99%) rename packages/shared/src/{openclaw => agency}/client.ts (88%) rename packages/shared/src/{openclaw => agency}/gateway-client.spec.ts (92%) rename packages/shared/src/{openclaw => agency}/gateway-client.ts (96%) rename packages/shared/src/{openclaw => agency}/gateway-types.ts (100%) rename packages/shared/src/{openclaw => agency}/index.ts (100%) rename packages/shared/src/{openclaw => agency}/pairing.ts (95%) rename packages/shared/src/{openclaw => agency}/shared-client.ts (100%) rename packages/shared/src/{openclaw => agency}/types.ts (87%) diff --git a/.openclaw/.gitkeep b/.agency/.gitkeep similarity index 100% rename from .openclaw/.gitkeep rename to .agency/.gitkeep diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 0524676..0000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(pnpm --version:*)", - "Bash(docker:*)", - "Bash(node:*)", - "Bash(echo:*)", - "Bash(pnpm install:*)", - "Bash(curl:*)", - "Bash(sudo sh:*)", - "Bash(sudo usermod:*)", - "Bash(npx convex deploy)", - "Bash(pnpm dev)", - "Bash(sudo docker compose ps:*)", - "Bash(python3:*)", - "Bash(git commit:*)", - "Bash(openclaw:*)", - "Bash(dpkg:*)", - "Bash(snap list:*)", - "Bash(apt list:*)", - "Bash(pnpm --filter @clawe/shared test:*)", - "Bash(pnpm check:*)", - "Bash(pnpm prettier:*)", - "Bash(pnpm build:*)", - "Bash(pnpm test:*)", - "Bash(npx convex run:*)", - "Bash(npx convex dev:*)", - "Bash(pnpm add:*)", - "Bash(pnpm run format:check:*)", - "Bash(git -C /home/ubuntu/clawe config user.name)", - "Bash(git -C /home/ubuntu/clawe config user.email)", - "Bash(git -C /home/ubuntu/clawe config:*)", - "Bash(git -C /home/ubuntu/clawe log:*)", - "Bash(pnpm --filter web test:*)", - "Bash(npx prettier:*)", - "Bash(pnpm --filter @clawe/cli test:*)", - "Bash(pnpm ls:*)", - "Bash(pnpm fix:*)" - ] - } -} diff --git a/.env.example b/.env.example index d5c2435..135c037 100644 --- a/.env.example +++ b/.env.example @@ -13,9 +13,9 @@ ANTHROPIC_API_KEY=sk-ant-... # Apps reference this as NEXT_PUBLIC_CONVEX_URL CONVEX_URL=https://your-deployment.convex.cloud -# OpenClaw gateway authentication token +# Agency gateway authentication token # Auto-generated by scripts/start.sh, or set your own secure random string -OPENCLAW_TOKEN=your-secure-token-here +AGENCY_TOKEN=your-secure-token-here # ============================================================================= # OPTIONAL @@ -27,19 +27,16 @@ OPENCLAW_TOKEN=your-secure-token-here # Environment: dev or prod ENVIRONMENT=dev -# OpenClaw gateway URL +# Agency gateway URL # Development: http://localhost:18790 (Docker exposed on host) -# Production: http://openclaw:18789 (Docker internal network) -OPENCLAW_URL=http://localhost:18790 +# Production: http://agency:18789 (Docker internal network) +AGENCY_URL=http://localhost:18790 # ============================================================================= # ADVANCED (usually don't need to change) # ============================================================================= -# OpenClaw gateway port (default: 18789) -# OPENCLAW_PORT=18789 - -# OpenClaw state directory (path to OpenClaw's config dir, mounted from Docker) -# Development: ./.openclaw/config (relative to project root) -# Production: /openclaw-data/config (shared Docker volume) -OPENCLAW_STATE_DIR=./.openclaw/config +# Agency state directory (path to config dir, mounted from Docker) +# Development: ./.agency/config (relative to project root) +# Production: /agency-data/config (shared Docker volume) +AGENCY_STATE_DIR=./.agency/config diff --git a/.gitignore b/.gitignore index d7f1edd..9885419 100644 --- a/.gitignore +++ b/.gitignore @@ -41,16 +41,16 @@ yarn-error.log* .DS_Store *.pem -convex/_generated +# Claude Code local settings (personal permissions) +.claude/settings.local.json -# Docker -docker/openclaw/data/ +convex/_generated # Local data directory (Clawe config) .data/ -# OpenClaw state directory (shared with Docker in dev) -.openclaw/* -!.openclaw/.gitkeep -.openclaw/logs/* -!.openclaw/logs/.gitkeep \ No newline at end of file +# Agency state directory (shared with Docker in dev) +.agency/* +!.agency/.gitkeep +.agency/logs/* +!.agency/logs/.gitkeep \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 9980c27..f76797d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,2 @@ # Template files with shell variable substitution -docker/openclaw/templates/*.json +docker/agency/templates/*.json diff --git a/CLAUDE.md b/CLAUDE.md index 3193501..772beab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,9 +54,9 @@ Core models: `agents`, `tasks`, `messages` (see `packages/backend/convex/schema. ## Environment Variables - `NEXT_PUBLIC_CONVEX_URL`: Convex deployment URL (required) -- `ANTHROPIC_API_KEY`: Anthropic API key for AI operations (required, passed to OpenClaw) -- `OPENCLAW_TOKEN`: Authentication token for OpenClaw (required) -- `OPENCLAW_URL`: OpenClaw gateway URL (set in `.env.development` / `.env.production`) +- `ANTHROPIC_API_KEY`: Anthropic API key for AI operations (required, passed to agency) +- `AGENCY_TOKEN`: Authentication token for agency gateway (required) +- `AGENCY_URL`: Agency gateway URL (set in `.env.development` / `.env.production`) - `NODE_ENV`: local (`development`) vs deployed (`production`) — controls dev tooling - `ENVIRONMENT`: deployment target (`dev` / `prod`) — controls feature flags diff --git a/README.md b/README.md index d71f0ac..8446e71 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Edit `.env`: ```bash # Required ANTHROPIC_API_KEY=sk-ant-... -OPENCLAW_TOKEN=your-secure-token +AGENCY_TOKEN=your-secure-token CONVEX_URL=https://your-deployment.convex.cloud # Optional @@ -64,7 +64,7 @@ npx convex deploy This script will: - Create `.env` from `.env.example` if missing -- Auto-generate a secure `OPENCLAW_TOKEN` +- Auto-generate a secure `AGENCY_TOKEN` - Validate all required environment variables - Build necessary packages - Start the Docker containers @@ -72,7 +72,7 @@ This script will: **Development:** ```bash -# Start OpenClaw gateway only (use local web dev server) +# Start agency gateway only (use local web dev server) pnpm dev:docker # In another terminal, start web + Convex @@ -81,7 +81,7 @@ pnpm dev The production stack starts: -- **openclaw**: Gateway running all agents +- **agency**: Gateway running all agents - **watcher**: Notification delivery + cron setup - **clawe**: Web dashboard at http://localhost:3000 @@ -113,11 +113,11 @@ Schedule recurring tasks that automatically create inbox items: ┌─────────────────────────────────────────────────────────────┐ │ DOCKER COMPOSE │ ├─────────────────┬─────────────────────┬─────────────────────┤ -│ openclaw │ watcher │ clawe │ +│ agency │ watcher │ clawe │ │ │ │ │ -│ OpenClaw │ • Register agents │ Web Dashboard │ -│ Gateway with │ • Setup crons │ • Squad status │ -│ 4 agents │ • Deliver notifs │ • Task board │ +│ Agent Gateway │ • Register agents │ Web Dashboard │ +│ with 4 agents │ • Setup crons │ • Squad status │ +│ │ • Deliver notifs │ • Task board │ │ │ │ • Agent chat │ └────────┬────────┴──────────┬──────────┴──────────┬──────────┘ │ │ │ @@ -144,10 +144,10 @@ clawe/ ├── packages/ │ ├── backend/ # Convex schema & functions │ ├── cli/ # `clawe` CLI for agents -│ ├── shared/ # Shared OpenClaw client +│ ├── shared/ # Shared agency client │ └── ui/ # UI components └── docker/ - └── openclaw/ + └── agency/ ├── Dockerfile ├── entrypoint.sh ├── scripts/ # init-agents.sh @@ -214,8 +214,8 @@ Each agent has an isolated workspace with: ### Adding New Agents -1. Create workspace template in `docker/openclaw/templates/workspaces/{name}/` -2. Add agent to `docker/openclaw/templates/config.template.json` +1. Create workspace template in `docker/agency/templates/workspaces/{name}/` +2. Add agent to `docker/agency/templates/config.template.json` 3. Add agent to watcher's `AGENTS` array in `apps/watcher/src/index.ts` 4. Rebuild: `docker compose build && docker compose up -d` @@ -245,13 +245,13 @@ pnpm install # Terminal 1: Start Convex dev server pnpm convex:dev -# Terminal 2: Start OpenClaw gateway in Docker +# Terminal 2: Start agency gateway in Docker pnpm dev:docker # Terminal 3: Start web dashboard pnpm dev:web -# Or run everything together (Convex + web, but not OpenClaw) +# Or run everything together (Convex + web, but not agency) pnpm dev ``` @@ -277,6 +277,6 @@ pnpm convex:deploy | Variable | Required | Description | | ------------------- | -------- | --------------------------------- | | `ANTHROPIC_API_KEY` | Yes | Anthropic API key for Claude | -| `OPENCLAW_TOKEN` | Yes | Auth token for OpenClaw gateway | +| `AGENCY_TOKEN` | Yes | Auth token for agency gateway | | `CONVEX_URL` | Yes | Convex deployment URL | | `OPENAI_API_KEY` | No | OpenAI key (for image generation) | diff --git a/apps/watcher/.env.example b/apps/watcher/.env.example index 06c1f46..34d504a 100644 --- a/apps/watcher/.env.example +++ b/apps/watcher/.env.example @@ -4,5 +4,5 @@ # Required variables (from root .env): # - CONVEX_URL -# - OPENCLAW_URL -# - OPENCLAW_TOKEN +# - AGENCY_URL +# - AGENCY_TOKEN diff --git a/apps/watcher/Dockerfile b/apps/watcher/Dockerfile index 4a9218c..32158e8 100644 --- a/apps/watcher/Dockerfile +++ b/apps/watcher/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /app # Watcher COPY apps/watcher/dist/ ./dist/ -# Shared package (OpenClaw client) +# Shared package (agency client) COPY packages/shared/package.json ./node_modules/@clawe/shared/package.json COPY packages/shared/dist/ ./node_modules/@clawe/shared/dist/ diff --git a/apps/watcher/README.md b/apps/watcher/README.md index 2d55701..fba4570 100644 --- a/apps/watcher/README.md +++ b/apps/watcher/README.md @@ -15,11 +15,11 @@ This enables: ## Environment Variables -| Variable | Required | Description | -| ---------------- | -------- | ----------------------------- | -| `CONVEX_URL` | Yes | Convex deployment URL | -| `OPENCLAW_URL` | Yes | OpenClaw gateway URL | -| `OPENCLAW_TOKEN` | Yes | OpenClaw authentication token | +| Variable | Required | Description | +| -------------- | -------- | --------------------------- | +| `CONVEX_URL` | Yes | Convex deployment URL | +| `AGENCY_URL` | Yes | Agency gateway URL | +| `AGENCY_TOKEN` | Yes | Agency authentication token | ## Running @@ -53,7 +53,7 @@ Schedules are staggered to avoid rate limits. │ │ │ ┌─────────────┐ │ │ │ On Startup │──> Check/create heartbeat crons │ -│ └─────────────┘ via OpenClaw cron API │ +│ └─────────────┘ via agency cron API │ │ │ │ ┌─────────────┐ ┌─────────────────────────┐ │ │ │ Poll Loop │───────>│ convex.query( │ │ @@ -62,13 +62,13 @@ Schedules are staggered to avoid rate limits. │ │ └─────────────────────────┘ │ │ │ │ │ │ ┌─────────────────────────┐ │ -│ └──────────────>│ openclaw.sessionsSend() │ │ +│ └──────────────>│ agency.sessionsSend() │ │ │ └─────────────────────────┘ │ └─────────────────────────────────────────────────────────┘ │ │ ▼ ▼ ┌───────────┐ ┌───────────────┐ - │ CONVEX │ │ OPENCLAW │ + │ CONVEX │ │ AGENCY │ │ (data) │ │ (delivery) │ └───────────┘ └───────────────┘ ``` diff --git a/apps/watcher/src/config.spec.ts b/apps/watcher/src/config.spec.ts index 96c46e1..89e9d1b 100644 --- a/apps/watcher/src/config.spec.ts +++ b/apps/watcher/src/config.spec.ts @@ -15,8 +15,8 @@ describe("config", () => { describe("validateEnv", () => { it("exits when CONVEX_URL is missing", async () => { delete process.env.CONVEX_URL; - process.env.OPENCLAW_URL = "http://localhost:18789"; - process.env.OPENCLAW_TOKEN = "test-token"; + process.env.AGENCY_URL = "http://localhost:18789"; + process.env.AGENCY_TOKEN = "test-token"; const mockExit = vi .spyOn(process, "exit") @@ -35,10 +35,10 @@ describe("config", () => { mockError.mockRestore(); }); - it("exits when OPENCLAW_URL is missing", async () => { + it("exits when AGENCY_URL is missing", async () => { process.env.CONVEX_URL = "https://test.convex.cloud"; - delete process.env.OPENCLAW_URL; - process.env.OPENCLAW_TOKEN = "test-token"; + delete process.env.AGENCY_URL; + process.env.AGENCY_TOKEN = "test-token"; const mockExit = vi .spyOn(process, "exit") @@ -49,7 +49,7 @@ describe("config", () => { validateEnv(); expect(mockError).toHaveBeenCalledWith( - expect.stringContaining("OPENCLAW_URL"), + expect.stringContaining("AGENCY_URL"), ); expect(mockExit).toHaveBeenCalledWith(1); @@ -59,8 +59,8 @@ describe("config", () => { it("does not exit when all required vars are set", async () => { process.env.CONVEX_URL = "https://test.convex.cloud"; - process.env.OPENCLAW_URL = "http://localhost:18789"; - process.env.OPENCLAW_TOKEN = "test-token"; + process.env.AGENCY_URL = "http://localhost:18789"; + process.env.AGENCY_TOKEN = "test-token"; const mockExit = vi .spyOn(process, "exit") @@ -78,14 +78,14 @@ describe("config", () => { describe("config object", () => { it("has correct default values", async () => { process.env.CONVEX_URL = "https://test.convex.cloud"; - process.env.OPENCLAW_URL = "http://custom:8080"; - process.env.OPENCLAW_TOKEN = "my-token"; + process.env.AGENCY_URL = "http://custom:8080"; + process.env.AGENCY_TOKEN = "my-token"; const { config } = await import("./config.js"); expect(config.convexUrl).toBe("https://test.convex.cloud"); - expect(config.openclawUrl).toBe("http://custom:8080"); - expect(config.openclawToken).toBe("my-token"); + expect(config.agencyUrl).toBe("http://custom:8080"); + expect(config.agencyToken).toBe("my-token"); }); }); diff --git a/apps/watcher/src/config.ts b/apps/watcher/src/config.ts index 536652d..871275c 100644 --- a/apps/watcher/src/config.ts +++ b/apps/watcher/src/config.ts @@ -4,7 +4,7 @@ export const POLL_INTERVAL_MS = 2000; // Check every 2 seconds // Environment validation export function validateEnv(): void { - const required = ["CONVEX_URL", "OPENCLAW_URL", "OPENCLAW_TOKEN"]; + const required = ["CONVEX_URL", "AGENCY_URL", "AGENCY_TOKEN"]; const missing = required.filter((key) => !process.env[key]); if (missing.length > 0) { @@ -17,7 +17,7 @@ export function validateEnv(): void { export const config = { convexUrl: process.env.CONVEX_URL || "", - openclawUrl: process.env.OPENCLAW_URL || "http://localhost:18789", - openclawToken: process.env.OPENCLAW_TOKEN || "", + agencyUrl: process.env.AGENCY_URL || "http://localhost:18789", + agencyToken: process.env.AGENCY_TOKEN || "", pollIntervalMs: POLL_INTERVAL_MS, }; diff --git a/apps/watcher/src/index.ts b/apps/watcher/src/index.ts index 0f701e9..2323f9e 100644 --- a/apps/watcher/src/index.ts +++ b/apps/watcher/src/index.ts @@ -6,8 +6,8 @@ * * Environment variables: * CONVEX_URL - Convex deployment URL - * OPENCLAW_URL - OpenClaw gateway URL - * OPENCLAW_TOKEN - OpenClaw authentication token + * AGENCY_URL - Agency gateway URL + * AGENCY_TOKEN - Agency authentication token */ import { ConvexHttpClient } from "convex/browser"; @@ -19,7 +19,7 @@ import { cronAdd, type CronAddJob, type CronJob, -} from "@clawe/shared/openclaw"; +} from "@clawe/shared/agency"; import { getTimeInZone, DEFAULT_TIMEZONE } from "@clawe/shared/timezone"; import { validateEnv, config, POLL_INTERVAL_MS } from "./config.js"; @@ -202,14 +202,14 @@ async function registerAgents(): Promise { async function setupCrons(): Promise { console.log("[watcher] Checking heartbeat crons..."); - // Retry getting cron list (waits for OpenClaw to be ready) + // Retry getting cron list (waits for agency to be ready) const result = await withRetry(async () => { const res = await cronList(); if (!res.ok) { throw new Error(res.error?.message ?? "Failed to list crons"); } return res; - }, "OpenClaw connection"); + }, "Agency connection"); const existingNames = new Set( result.result.details.jobs.map((j: CronJob) => j.name), @@ -476,7 +476,7 @@ async function startDeliveryLoop(): Promise { async function main(): Promise { console.log("[watcher] 🦞 Clawe Watcher starting..."); console.log(`[watcher] Convex: ${config.convexUrl}`); - console.log(`[watcher] OpenClaw: ${config.openclawUrl}`); + console.log(`[watcher] Agency: ${config.agencyUrl}`); console.log(`[watcher] Notification poll interval: ${POLL_INTERVAL_MS}ms`); console.log( `[watcher] Routine check interval: ${ROUTINE_CHECK_INTERVAL_MS}ms\n`, diff --git a/apps/web/CLAUDE.md b/apps/web/CLAUDE.md index 20daa8a..ae7a8d8 100644 --- a/apps/web/CLAUDE.md +++ b/apps/web/CLAUDE.md @@ -76,9 +76,9 @@ Or infer from query results (preferred when using the data directly). **Environment variables:** - `NEXT_PUBLIC_CONVEX_URL` → Convex deployment URL (required) -- `ANTHROPIC_API_KEY` → Anthropic API key (passed to OpenClaw container) -- `OPENCLAW_URL` → OpenClaw gateway URL -- `OPENCLAW_TOKEN` → OpenClaw authentication token (from root `.env`) +- `ANTHROPIC_API_KEY` → Anthropic API key (passed to agency container) +- `AGENCY_URL` → Agency gateway URL +- `AGENCY_TOKEN` → Agency authentication token (from root `.env`) ## Adding Routes @@ -173,7 +173,7 @@ Dark: text-pink-400, hover bg-pink-400/5 ``` src/ ├── lib/ -│ └── openclaw/ +│ └── agency/ │ ├── client.ts │ ├── client.spec.ts # Unit tests for client │ ├── actions.ts diff --git a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-integration-card.tsx b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-integration-card.tsx index e5faa61..f8f50e2 100644 --- a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-integration-card.tsx +++ b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-integration-card.tsx @@ -94,7 +94,7 @@ export const TelegramIntegrationCard = () => { )} {isOffline && (

- OpenClaw is offline + Agency is offline

)} diff --git a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-remove-dialog.tsx b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-remove-dialog.tsx index 0b11e69..bd8d498 100644 --- a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-remove-dialog.tsx +++ b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-remove-dialog.tsx @@ -14,7 +14,7 @@ import { AlertDialogHeader, AlertDialogTitle, } from "@clawe/ui/components/alert-dialog"; -import { removeTelegramBot } from "@/lib/openclaw/actions"; +import { removeTelegramBot } from "@/lib/agency/actions"; export interface TelegramRemoveDialogProps { open: boolean; @@ -33,7 +33,7 @@ export const TelegramRemoveDialog = ({ const handleRemove = async () => { setIsRemoving(true); try { - // Remove token from OpenClaw config + // Remove token from agency config const result = await removeTelegramBot(); if (!result.ok) { throw new Error("Failed to remove bot token"); diff --git a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-setup-dialog.tsx b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-setup-dialog.tsx index df532e8..1dd61cd 100644 --- a/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-setup-dialog.tsx +++ b/apps/web/src/app/(dashboard)/settings/integrations/_components/telegram-setup-dialog.tsx @@ -24,7 +24,7 @@ import { validateTelegramToken, saveTelegramBotToken, approvePairingCode, -} from "@/lib/openclaw/actions"; +} from "@/lib/agency/actions"; type Step = "token" | "pairing" | "success"; @@ -214,10 +214,10 @@ export const TelegramSetupDialog = ({

- OpenClaw is offline + Agency is offline

- The agent service needs to be running to verify pairing. + The agency service needs to be running to verify pairing.

@@ -354,10 +354,10 @@ export const TelegramSetupDialog = ({

- OpenClaw is offline + Agency is offline

- The agent service needs to be running to connect Telegram. + The agency service needs to be running to connect Telegram.

diff --git a/apps/web/src/app/api/agency/health/route.ts b/apps/web/src/app/api/agency/health/route.ts index 1ecefab..4872258 100644 --- a/apps/web/src/app/api/agency/health/route.ts +++ b/apps/web/src/app/api/agency/health/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { checkHealth } from "@clawe/shared/openclaw"; +import { checkHealth } from "@clawe/shared/agency"; export async function POST() { const result = await checkHealth(); diff --git a/apps/web/src/app/api/agency/pairing/route.ts b/apps/web/src/app/api/agency/pairing/route.ts index b7c78f2..76c098f 100644 --- a/apps/web/src/app/api/agency/pairing/route.ts +++ b/apps/web/src/app/api/agency/pairing/route.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; import { listChannelPairingRequests, approveChannelPairingCode, -} from "@clawe/shared/openclaw"; +} from "@clawe/shared/agency"; // GET /api/agency/pairing?channel=telegram - List pending pairing requests export async function GET(request: Request) { diff --git a/apps/web/src/app/api/business/context/route.ts b/apps/web/src/app/api/business/context/route.ts index b9d1536..217200c 100644 --- a/apps/web/src/app/api/business/context/route.ts +++ b/apps/web/src/app/api/business/context/route.ts @@ -6,7 +6,7 @@ export const runtime = "nodejs"; export const dynamic = "force-dynamic"; const convexUrl = process.env.NEXT_PUBLIC_CONVEX_URL; -const openclawToken = process.env.OPENCLAW_TOKEN; +const agencyToken = process.env.AGENCY_TOKEN; /** * GET /api/business/context @@ -14,14 +14,14 @@ const openclawToken = process.env.OPENCLAW_TOKEN; * Returns the current business context. * Used by agents to understand what business they're working for. * - * Requires: Authorization header with OPENCLAW_TOKEN + * Requires: Authorization header with AGENCY_TOKEN */ export const GET = async (request: Request) => { // Validate token const authHeader = request.headers.get("Authorization"); const token = authHeader?.replace("Bearer ", ""); - if (!token || token !== openclawToken) { + if (!token || token !== agencyToken) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } @@ -63,14 +63,14 @@ export const GET = async (request: Request) => { * Saves or updates the business context. * Used by Clawe CLI during onboarding. * - * Requires: Authorization header with OPENCLAW_TOKEN + * Requires: Authorization header with AGENCY_TOKEN */ export const POST = async (request: Request) => { // Validate token const authHeader = request.headers.get("Authorization"); const token = authHeader?.replace("Bearer ", ""); - if (!token || token !== openclawToken) { + if (!token || token !== agencyToken) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } diff --git a/apps/web/src/app/api/chat/abort/route.spec.ts b/apps/web/src/app/api/chat/abort/route.spec.ts index 8e5b28e..e2399cf 100644 --- a/apps/web/src/app/api/chat/abort/route.spec.ts +++ b/apps/web/src/app/api/chat/abort/route.spec.ts @@ -5,7 +5,7 @@ import { POST } from "./route"; // Mock the shared client const mockRequest = vi.fn(); -vi.mock("@clawe/shared/openclaw", () => ({ +vi.mock("@clawe/shared/agency", () => ({ getSharedClient: vi.fn(async () => ({ request: mockRequest, isConnected: vi.fn().mockReturnValue(true), @@ -95,7 +95,7 @@ describe("POST /api/chat/abort", () => { }); it("returns 500 when getSharedClient fails", async () => { - const { getSharedClient } = await import("@clawe/shared/openclaw"); + const { getSharedClient } = await import("@clawe/shared/agency"); vi.mocked(getSharedClient).mockRejectedValueOnce( new Error("Connection failed"), ); diff --git a/apps/web/src/app/api/chat/abort/route.ts b/apps/web/src/app/api/chat/abort/route.ts index 284436a..fc75509 100644 --- a/apps/web/src/app/api/chat/abort/route.ts +++ b/apps/web/src/app/api/chat/abort/route.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; -import { getSharedClient } from "@clawe/shared/openclaw"; +import { getSharedClient } from "@clawe/shared/agency"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; diff --git a/apps/web/src/app/api/chat/history/route.spec.ts b/apps/web/src/app/api/chat/history/route.spec.ts index 045c75d..7b80f56 100644 --- a/apps/web/src/app/api/chat/history/route.spec.ts +++ b/apps/web/src/app/api/chat/history/route.spec.ts @@ -5,7 +5,7 @@ import { GET } from "./route"; // Mock the shared client const mockRequest = vi.fn(); -vi.mock("@clawe/shared/openclaw", () => ({ +vi.mock("@clawe/shared/agency", () => ({ getSharedClient: vi.fn(async () => ({ request: mockRequest, isConnected: vi.fn().mockReturnValue(true), @@ -87,7 +87,7 @@ describe("GET /api/chat/history", () => { }); it("returns 500 when getSharedClient fails", async () => { - const { getSharedClient } = await import("@clawe/shared/openclaw"); + const { getSharedClient } = await import("@clawe/shared/agency"); vi.mocked(getSharedClient).mockRejectedValueOnce( new Error("Connection failed"), ); diff --git a/apps/web/src/app/api/chat/history/route.ts b/apps/web/src/app/api/chat/history/route.ts index ad05ee0..f8e1bc4 100644 --- a/apps/web/src/app/api/chat/history/route.ts +++ b/apps/web/src/app/api/chat/history/route.ts @@ -1,6 +1,6 @@ import { NextRequest, NextResponse } from "next/server"; -import { getSharedClient } from "@clawe/shared/openclaw"; -import type { ChatHistoryResponse } from "@clawe/shared/openclaw"; +import { getSharedClient } from "@clawe/shared/agency"; +import type { ChatHistoryResponse } from "@clawe/shared/agency"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; diff --git a/apps/web/src/app/api/chat/route.ts b/apps/web/src/app/api/chat/route.ts index 90e82cf..93ccbbb 100644 --- a/apps/web/src/app/api/chat/route.ts +++ b/apps/web/src/app/api/chat/route.ts @@ -4,12 +4,12 @@ import { streamText } from "ai"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; -const openclawUrl = process.env.OPENCLAW_URL || "http://localhost:18789"; -const openclawToken = process.env.OPENCLAW_TOKEN || ""; +const agencyUrl = process.env.AGENCY_URL || "http://localhost:18789"; +const agencyToken = process.env.AGENCY_TOKEN || ""; /** * POST /api/chat - * Proxy chat requests to OpenClaw's OpenAI-compatible endpoint. + * Proxy chat requests to the agency's OpenAI-compatible endpoint. */ export async function POST(request: Request) { try { @@ -30,16 +30,16 @@ export async function POST(request: Request) { }); } - // Create OpenAI-compatible client pointing to OpenClaw - const openclaw = createOpenAI({ - baseURL: `${openclawUrl}/v1`, - apiKey: openclawToken, + // Create OpenAI-compatible client pointing to agency gateway + const agency = createOpenAI({ + baseURL: `${agencyUrl}/v1`, + apiKey: agencyToken, }); // Stream response using Vercel AI SDK // Use .chat() to force Chat Completions API instead of Responses API const result = streamText({ - model: openclaw.chat("openclaw"), + model: agency.chat("openclaw"), messages, headers: { "X-OpenClaw-Session-Key": sessionKey, diff --git a/apps/web/src/app/setup/telegram/page.tsx b/apps/web/src/app/setup/telegram/page.tsx index 492f212..f12228c 100644 --- a/apps/web/src/app/setup/telegram/page.tsx +++ b/apps/web/src/app/setup/telegram/page.tsx @@ -28,7 +28,7 @@ import { validateTelegramToken, saveTelegramBotToken, approvePairingCode, -} from "@/lib/openclaw/actions"; +} from "@/lib/agency/actions"; import { SetupRightPanelContent } from "../_components/setup-right-panel"; import { DemoVideo } from "./_components/demo-video"; @@ -252,10 +252,10 @@ export default function TelegramPage() {

- OpenClaw is offline + Agency is offline

- The agent service needs to be running to verify pairing. + The agency service needs to be running to verify pairing.

@@ -322,7 +322,7 @@ export default function TelegramPage() { {isOffline && ( -

Start OpenClaw to continue

+

Start agency to continue

)} @@ -424,10 +424,10 @@ export default function TelegramPage() {

- OpenClaw is offline + Agency is offline

- The agent service needs to be running to connect Telegram. + The agency service needs to be running to connect Telegram.

@@ -488,7 +488,7 @@ export default function TelegramPage() { {isOffline && ( -

Start OpenClaw to continue

+

Start agency to continue

)} diff --git a/apps/web/src/app/setup/welcome/page.tsx b/apps/web/src/app/setup/welcome/page.tsx index 94a35aa..50aa048 100644 --- a/apps/web/src/app/setup/welcome/page.tsx +++ b/apps/web/src/app/setup/welcome/page.tsx @@ -71,14 +71,14 @@ export default function WelcomePage() {

- OpenClaw service is offline + Agency service is offline

- The agent service needs to be running before you can continue. - Start it with: + The agency service needs to be running before you can + continue. Start it with:

-                  sudo docker compose up -d openclaw
+                  sudo docker compose up -d agency
                 

This status will update automatically once the service is @@ -107,7 +107,7 @@ export default function WelcomePage() { {isOffline && ( -

Start OpenClaw to continue

+

Start agency to continue

)} diff --git a/apps/web/src/components/agency-status.tsx b/apps/web/src/components/agency-status.tsx index e01633f..4baadfd 100644 --- a/apps/web/src/components/agency-status.tsx +++ b/apps/web/src/components/agency-status.tsx @@ -40,8 +40,8 @@ export const AgencyStatus = ({ className }: AgencyStatusProps) => { const tooltipText = isLoading ? "Checking connection..." : status === "active" - ? "Agent service is online and ready" - : "Unable to connect to agent service"; + ? "Agency service is online and ready" + : "Unable to connect to agency service"; const shouldAnimate = isLoading || status === "active"; diff --git a/apps/web/src/components/chat/chat-input-textarea.tsx b/apps/web/src/components/chat/chat-input-textarea.tsx index 4abfb0c..45bf01d 100644 --- a/apps/web/src/components/chat/chat-input-textarea.tsx +++ b/apps/web/src/components/chat/chat-input-textarea.tsx @@ -10,7 +10,6 @@ export type ChatInputTextareaProps = { placeholder?: string; disabled?: boolean; className?: string; - maxRows?: number; }; export const ChatInputTextarea = ({ @@ -20,37 +19,29 @@ export const ChatInputTextarea = ({ placeholder, disabled, className, - maxRows = 6, }: ChatInputTextareaProps) => { const textareaRef = useRef(null); const resize = useCallback(() => { - const textarea = textareaRef.current; - if (!textarea) return; + const el = textareaRef.current; + if (!el) return; + if (!el.value) { + el.style.height = ""; + return; + } + el.style.height = "auto"; + el.style.height = `${el.scrollHeight}px`; + }, []); - // Reset to single row to get accurate scrollHeight - textarea.style.height = "auto"; - - const style = getComputedStyle(textarea); - const lineHeight = parseFloat(style.lineHeight); - const paddingTop = parseFloat(style.paddingTop); - const paddingBottom = parseFloat(style.paddingBottom); - const maxHeight = lineHeight * maxRows + paddingTop + paddingBottom; - - textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`; - }, [maxRows]); - - // Reset height when value is cleared externally (e.g. after send) useEffect(() => { - if (!value) resize(); + resize(); }, [value, resize]); const handleChange = useCallback( (e: React.ChangeEvent) => { onChange(e.target.value); - resize(); }, - [onChange, resize], + [onChange], ); return ( @@ -63,7 +54,7 @@ export const ChatInputTextarea = ({ disabled={disabled} rows={1} className={cn( - "border-input bg-background w-full resize-none overflow-y-auto rounded-lg border px-3 py-2", + "border-input bg-background max-h-40 w-full resize-none overflow-y-auto rounded-lg border px-3 py-2", "placeholder:text-muted-foreground text-sm leading-relaxed", "focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none", "disabled:cursor-not-allowed disabled:opacity-50", diff --git a/apps/web/src/components/chat/chat-message.tsx b/apps/web/src/components/chat/chat-message.tsx index f240145..cc81163 100644 --- a/apps/web/src/components/chat/chat-message.tsx +++ b/apps/web/src/components/chat/chat-message.tsx @@ -8,7 +8,7 @@ import remarkGfm from "remark-gfm"; import type { Message } from "@/hooks/use-chat"; /** - * Context message patterns - messages injected by OpenClaw for context. + * Context message patterns - messages injected by agency for context. */ const CONTEXT_MESSAGE_PATTERNS = [ /^\[Chat messages since your last reply/i, diff --git a/apps/web/src/lib/openclaw/actions.spec.ts b/apps/web/src/lib/agency/actions.spec.ts similarity index 91% rename from apps/web/src/lib/openclaw/actions.spec.ts rename to apps/web/src/lib/agency/actions.spec.ts index f389867..55f332c 100644 --- a/apps/web/src/lib/openclaw/actions.spec.ts +++ b/apps/web/src/lib/agency/actions.spec.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; // Mock the shared package -vi.mock("@clawe/shared/openclaw", () => ({ +vi.mock("@clawe/shared/agency", () => ({ checkHealth: vi.fn(), getConfig: vi.fn(), saveTelegramBotToken: vi.fn(), @@ -12,15 +12,15 @@ vi.mock("@clawe/shared/openclaw", () => ({ import { saveTelegramBotToken, validateTelegramToken, - checkOpenClawHealth, + checkAgencyHealth, } from "./actions"; import { checkHealth, saveTelegramBotToken as saveTelegramBotTokenClient, probeTelegramToken, -} from "@clawe/shared/openclaw"; +} from "@clawe/shared/agency"; -describe("OpenClaw Actions", () => { +describe("Agency Actions", () => { beforeEach(() => { vi.clearAllMocks(); }); @@ -75,7 +75,7 @@ describe("OpenClaw Actions", () => { }); }); - describe("checkOpenClawHealth", () => { + describe("checkAgencyHealth", () => { it("returns health status", async () => { vi.mocked(checkHealth).mockResolvedValueOnce({ ok: true, @@ -85,7 +85,7 @@ describe("OpenClaw Actions", () => { }, }); - const result = await checkOpenClawHealth(); + const result = await checkAgencyHealth(); expect(result.ok).toBe(true); }); }); diff --git a/apps/web/src/lib/openclaw/actions.ts b/apps/web/src/lib/agency/actions.ts similarity index 83% rename from apps/web/src/lib/openclaw/actions.ts rename to apps/web/src/lib/agency/actions.ts index d011721..b3ffbfe 100644 --- a/apps/web/src/lib/openclaw/actions.ts +++ b/apps/web/src/lib/agency/actions.ts @@ -6,14 +6,14 @@ import { saveTelegramBotToken as saveTelegramBotTokenClient, removeTelegramBotToken as removeTelegramBotTokenClient, probeTelegramToken, -} from "@clawe/shared/openclaw"; -import { approveChannelPairingCode } from "@clawe/shared/openclaw"; +} from "@clawe/shared/agency"; +import { approveChannelPairingCode } from "@clawe/shared/agency"; -export async function checkOpenClawHealth() { +export async function checkAgencyHealth() { return checkHealth(); } -export async function getOpenClawConfig() { +export async function getAgencyConfig() { return getConfig(); } diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts index 63c1e67..59226b4 100644 --- a/apps/web/vitest.config.ts +++ b/apps/web/vitest.config.ts @@ -17,6 +17,10 @@ export default defineConfig({ __dirname, "../../packages/backend/convex/_generated/api", ), + "@clawe/shared/agency": path.resolve( + __dirname, + "../../packages/shared/src/agency/index.ts", + ), }, }, }); diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 7bb09f1..f8368ce 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,10 +1,10 @@ services: - openclaw: + agency: ports: - "18790:18789" volumes: - - ./.openclaw:/data - - ./.openclaw/logs:/tmp/openclaw + - ./.agency:/data + - ./.agency/logs:/tmp/openclaw - .:/home/ubuntu/clawe extra_hosts: - "host.docker.internal:host-gateway" diff --git a/docker-compose.yml b/docker-compose.yml index 00dd753..dd87565 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,29 +8,28 @@ services: environment: - NODE_ENV=production - NEXT_PUBLIC_CONVEX_URL=${CONVEX_URL} - - OPENCLAW_URL=http://openclaw:18789 - - OPENCLAW_TOKEN=${OPENCLAW_TOKEN} - - OPENCLAW_STATE_DIR=/openclaw-data/config + - AGENCY_URL=http://agency:18789 + - AGENCY_TOKEN=${AGENCY_TOKEN} + - AGENCY_STATE_DIR=/agency-data/config volumes: - - openclaw-data:/openclaw-data:ro + - agency-data:/agency-data:ro depends_on: - openclaw: + agency: condition: service_healthy restart: unless-stopped - openclaw: + agency: build: context: . - dockerfile: docker/openclaw/Dockerfile + dockerfile: docker/agency/Dockerfile user: "${UID:-1000}:${GID:-1000}" environment: - - OPENCLAW_TOKEN=${OPENCLAW_TOKEN} - - OPENCLAW_PORT=18789 + - AGENCY_TOKEN=${AGENCY_TOKEN} - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} - OPENAI_API_KEY=${OPENAI_API_KEY:-} - CONVEX_URL=${CONVEX_URL} volumes: - - openclaw-data:/data + - agency-data:/data healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://localhost:18789/health"] interval: 5s @@ -44,13 +43,13 @@ services: dockerfile: apps/watcher/Dockerfile environment: - CONVEX_URL=${CONVEX_URL} - - OPENCLAW_URL=http://openclaw:18789 - - OPENCLAW_TOKEN=${OPENCLAW_TOKEN} + - AGENCY_URL=http://agency:18789 + - AGENCY_TOKEN=${AGENCY_TOKEN} depends_on: - openclaw: + agency: condition: service_healthy restart: unless-stopped volumes: - openclaw-data: + agency-data: driver: local diff --git a/docker/openclaw/Dockerfile b/docker/agency/Dockerfile similarity index 81% rename from docker/openclaw/Dockerfile rename to docker/agency/Dockerfile index 735fb68..7596759 100644 --- a/docker/openclaw/Dockerfile +++ b/docker/agency/Dockerfile @@ -16,8 +16,8 @@ RUN npm install -g openclaw@latest RUN mkdir -p /data/config /data/workspace # Copy templates and scripts -COPY docker/openclaw/templates/ /opt/clawe/templates/ -COPY docker/openclaw/scripts/ /opt/clawe/scripts/ +COPY docker/agency/templates/ /opt/clawe/templates/ +COPY docker/agency/scripts/ /opt/clawe/scripts/ RUN chmod +x /opt/clawe/scripts/*.sh # Copy bundled CLI (single file with all deps included) @@ -26,8 +26,9 @@ RUN chmod +x /usr/local/bin/clawe ENV OPENCLAW_STATE_DIR=/data/config ENV OPENCLAW_PORT=18789 +ENV OPENCLAW_SKIP_GMAIL_WATCHER=1 -COPY docker/openclaw/entrypoint.sh /entrypoint.sh +COPY docker/agency/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh HEALTHCHECK --interval=5s --timeout=3s --retries=10 \ diff --git a/docker/openclaw/entrypoint.sh b/docker/agency/entrypoint.sh similarity index 77% rename from docker/openclaw/entrypoint.sh rename to docker/agency/entrypoint.sh index 8100551..10032ed 100644 --- a/docker/openclaw/entrypoint.sh +++ b/docker/agency/entrypoint.sh @@ -3,11 +3,14 @@ set -e CONFIG_FILE="${OPENCLAW_STATE_DIR}/openclaw.json" PORT="${OPENCLAW_PORT:-18789}" -TOKEN="${OPENCLAW_TOKEN:-}" +TOKEN="${AGENCY_TOKEN:-}" TEMPLATES_DIR="/opt/clawe/templates" +# Map to OPENCLAW_TOKEN for the openclaw CLI +export OPENCLAW_TOKEN="$TOKEN" + if [ -z "$TOKEN" ]; then - echo "ERROR: OPENCLAW_TOKEN environment variable is required" + echo "ERROR: AGENCY_TOKEN environment variable is required" exit 1 fi @@ -41,7 +44,6 @@ if [ ! -f "$CONFIG_FILE" ]; then # 3. Patch the config with our agent setup echo "==> Patching config with agent setup..." export OPENCLAW_PORT="${PORT}" - export OPENCLAW_TOKEN="${TOKEN}" export CONVEX_URL="${CONVEX_URL:-}" envsubst '$OPENCLAW_PORT $OPENCLAW_TOKEN $CONVEX_URL' < "$TEMPLATES_DIR/config.template.json" > "$CONFIG_FILE" @@ -51,9 +53,15 @@ else echo "==> Config exists. Skipping initialization." fi +# Ensure the local CLI device is paired with the gateway. +# On container recreation the CLI generates a new keypair, but the old +# paired.json from the volume is stale. Re-register every startup. +node /opt/clawe/scripts/pair-device.js + echo "==> Starting OpenClaw gateway on port $PORT..." exec openclaw gateway run \ --port "$PORT" \ --bind 0.0.0.0 \ - --token "$TOKEN" + --token "$TOKEN" \ + --allow-unconfigured diff --git a/docker/openclaw/scripts/init-agents.sh b/docker/agency/scripts/init-agents.sh similarity index 100% rename from docker/openclaw/scripts/init-agents.sh rename to docker/agency/scripts/init-agents.sh diff --git a/docker/agency/scripts/pair-device.js b/docker/agency/scripts/pair-device.js new file mode 100644 index 0000000..130657e --- /dev/null +++ b/docker/agency/scripts/pair-device.js @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +/** + * Auto-pair the local CLI device with the gateway. + * + * When the Docker container is recreated, the openclaw CLI generates a new + * keypair (identity/device.json) but the volume still has the old + * devices/paired.json. The gateway then rejects all connections with + * "pairing required". This script reads the current device identity and + * registers it as a paired operator device — the automated equivalent of + * clicking "approve" in the openclaw Control UI. + */ + +const fs = require("fs"); +const crypto = require("crypto"); +const path = require("path"); + +const stateDir = process.env.OPENCLAW_STATE_DIR || "/data/config"; +const identityFile = path.join(stateDir, "identity", "device.json"); +const devicesDir = path.join(stateDir, "devices"); +const pairedFile = path.join(devicesDir, "paired.json"); + +if (!fs.existsSync(identityFile)) { + console.log("==> No device identity found, skipping device registration."); + process.exit(0); +} + +const identity = JSON.parse(fs.readFileSync(identityFile, "utf8")); + +// Extract the raw Ed25519 public key from the SPKI-encoded PEM (skip 12-byte header) +const spki = crypto + .createPublicKey(identity.publicKeyPem) + .export({ type: "spki", format: "der" }); +const publicKey = spki.subarray(12).toString("base64url"); + +const now = Date.now(); +const token = crypto.randomBytes(16).toString("hex"); + +const entry = { + deviceId: identity.deviceId, + publicKey, + displayName: "agent", + platform: "linux", + clientId: "gateway-client", + clientMode: "backend", + role: "operator", + roles: ["operator"], + scopes: ["operator.admin", "operator.approvals", "operator.pairing"], + tokens: { + operator: { + token, + role: "operator", + scopes: ["operator.admin", "operator.approvals", "operator.pairing"], + createdAtMs: now, + lastUsedAtMs: now, + }, + }, + createdAtMs: now, + approvedAtMs: now, +}; + +fs.mkdirSync(devicesDir, { recursive: true }); +fs.writeFileSync( + pairedFile, + JSON.stringify({ [identity.deviceId]: entry }, null, 2), +); + +console.log(`==> Device ${identity.deviceId.substring(0, 12)}... registered.`); diff --git a/docker/openclaw/templates/config.template.json b/docker/agency/templates/config.template.json similarity index 100% rename from docker/openclaw/templates/config.template.json rename to docker/agency/templates/config.template.json diff --git a/docker/openclaw/templates/shared/CLAWE-CLI.md b/docker/agency/templates/shared/CLAWE-CLI.md similarity index 100% rename from docker/openclaw/templates/shared/CLAWE-CLI.md rename to docker/agency/templates/shared/CLAWE-CLI.md diff --git a/docker/openclaw/templates/shared/WORKFLOW.md b/docker/agency/templates/shared/WORKFLOW.md similarity index 100% rename from docker/openclaw/templates/shared/WORKFLOW.md rename to docker/agency/templates/shared/WORKFLOW.md diff --git a/docker/openclaw/templates/shared/WORKING.md b/docker/agency/templates/shared/WORKING.md similarity index 100% rename from docker/openclaw/templates/shared/WORKING.md rename to docker/agency/templates/shared/WORKING.md diff --git a/docker/openclaw/templates/workspaces/clawe/AGENTS.md b/docker/agency/templates/workspaces/clawe/AGENTS.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/AGENTS.md rename to docker/agency/templates/workspaces/clawe/AGENTS.md diff --git a/docker/openclaw/templates/workspaces/clawe/BOOTSTRAP.md b/docker/agency/templates/workspaces/clawe/BOOTSTRAP.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/BOOTSTRAP.md rename to docker/agency/templates/workspaces/clawe/BOOTSTRAP.md diff --git a/docker/openclaw/templates/workspaces/clawe/HEARTBEAT.md b/docker/agency/templates/workspaces/clawe/HEARTBEAT.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/HEARTBEAT.md rename to docker/agency/templates/workspaces/clawe/HEARTBEAT.md diff --git a/docker/openclaw/templates/workspaces/clawe/MEMORY.md b/docker/agency/templates/workspaces/clawe/MEMORY.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/MEMORY.md rename to docker/agency/templates/workspaces/clawe/MEMORY.md diff --git a/docker/openclaw/templates/workspaces/clawe/SOUL.md b/docker/agency/templates/workspaces/clawe/SOUL.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/SOUL.md rename to docker/agency/templates/workspaces/clawe/SOUL.md diff --git a/docker/openclaw/templates/workspaces/clawe/TOOLS.md b/docker/agency/templates/workspaces/clawe/TOOLS.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/TOOLS.md rename to docker/agency/templates/workspaces/clawe/TOOLS.md diff --git a/docker/openclaw/templates/workspaces/clawe/USER.md b/docker/agency/templates/workspaces/clawe/USER.md similarity index 100% rename from docker/openclaw/templates/workspaces/clawe/USER.md rename to docker/agency/templates/workspaces/clawe/USER.md diff --git a/docker/openclaw/templates/workspaces/inky/AGENTS.md b/docker/agency/templates/workspaces/inky/AGENTS.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/AGENTS.md rename to docker/agency/templates/workspaces/inky/AGENTS.md diff --git a/docker/openclaw/templates/workspaces/inky/HEARTBEAT.md b/docker/agency/templates/workspaces/inky/HEARTBEAT.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/HEARTBEAT.md rename to docker/agency/templates/workspaces/inky/HEARTBEAT.md diff --git a/docker/openclaw/templates/workspaces/inky/MEMORY.md b/docker/agency/templates/workspaces/inky/MEMORY.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/MEMORY.md rename to docker/agency/templates/workspaces/inky/MEMORY.md diff --git a/docker/openclaw/templates/workspaces/inky/SOUL.md b/docker/agency/templates/workspaces/inky/SOUL.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/SOUL.md rename to docker/agency/templates/workspaces/inky/SOUL.md diff --git a/docker/openclaw/templates/workspaces/inky/TOOLS.md b/docker/agency/templates/workspaces/inky/TOOLS.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/TOOLS.md rename to docker/agency/templates/workspaces/inky/TOOLS.md diff --git a/docker/openclaw/templates/workspaces/inky/USER.md b/docker/agency/templates/workspaces/inky/USER.md similarity index 100% rename from docker/openclaw/templates/workspaces/inky/USER.md rename to docker/agency/templates/workspaces/inky/USER.md diff --git a/docker/openclaw/templates/workspaces/pixel/AGENTS.md b/docker/agency/templates/workspaces/pixel/AGENTS.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/AGENTS.md rename to docker/agency/templates/workspaces/pixel/AGENTS.md diff --git a/docker/openclaw/templates/workspaces/pixel/HEARTBEAT.md b/docker/agency/templates/workspaces/pixel/HEARTBEAT.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/HEARTBEAT.md rename to docker/agency/templates/workspaces/pixel/HEARTBEAT.md diff --git a/docker/openclaw/templates/workspaces/pixel/MEMORY.md b/docker/agency/templates/workspaces/pixel/MEMORY.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/MEMORY.md rename to docker/agency/templates/workspaces/pixel/MEMORY.md diff --git a/docker/openclaw/templates/workspaces/pixel/SOUL.md b/docker/agency/templates/workspaces/pixel/SOUL.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/SOUL.md rename to docker/agency/templates/workspaces/pixel/SOUL.md diff --git a/docker/openclaw/templates/workspaces/pixel/TOOLS.md b/docker/agency/templates/workspaces/pixel/TOOLS.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/TOOLS.md rename to docker/agency/templates/workspaces/pixel/TOOLS.md diff --git a/docker/openclaw/templates/workspaces/pixel/USER.md b/docker/agency/templates/workspaces/pixel/USER.md similarity index 100% rename from docker/openclaw/templates/workspaces/pixel/USER.md rename to docker/agency/templates/workspaces/pixel/USER.md diff --git a/docker/openclaw/templates/workspaces/scout/AGENTS.md b/docker/agency/templates/workspaces/scout/AGENTS.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/AGENTS.md rename to docker/agency/templates/workspaces/scout/AGENTS.md diff --git a/docker/openclaw/templates/workspaces/scout/HEARTBEAT.md b/docker/agency/templates/workspaces/scout/HEARTBEAT.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/HEARTBEAT.md rename to docker/agency/templates/workspaces/scout/HEARTBEAT.md diff --git a/docker/openclaw/templates/workspaces/scout/MEMORY.md b/docker/agency/templates/workspaces/scout/MEMORY.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/MEMORY.md rename to docker/agency/templates/workspaces/scout/MEMORY.md diff --git a/docker/openclaw/templates/workspaces/scout/SOUL.md b/docker/agency/templates/workspaces/scout/SOUL.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/SOUL.md rename to docker/agency/templates/workspaces/scout/SOUL.md diff --git a/docker/openclaw/templates/workspaces/scout/TOOLS.md b/docker/agency/templates/workspaces/scout/TOOLS.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/TOOLS.md rename to docker/agency/templates/workspaces/scout/TOOLS.md diff --git a/docker/openclaw/templates/workspaces/scout/USER.md b/docker/agency/templates/workspaces/scout/USER.md similarity index 100% rename from docker/openclaw/templates/workspaces/scout/USER.md rename to docker/agency/templates/workspaces/scout/USER.md diff --git a/package.json b/package.json index 52e5cf8..257ab7f 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "scripts": { "build": "dotenv -e .env -- turbo run build", "dev": "dotenv -e .env -- turbo run dev", - "dev:docker": "pnpm --filter @clawe/cli build && docker compose up --build openclaw", - "build:docker": "pnpm --filter @clawe/cli build && docker compose build --no-cache openclaw", + "dev:docker": "pnpm --filter @clawe/cli build && docker compose up --build agency", + "build:docker": "pnpm --filter @clawe/cli build && docker compose build --no-cache agency", "debug": "dotenv -e .env -- turbo run debug", "dev:web": "dotenv -e .env -- turbo run dev --filter=web", "convex:dev": "dotenv -e .env -- turbo run dev --filter=@clawe/backend", diff --git a/packages/backend/convex/schema.ts b/packages/backend/convex/schema.ts index 2127e36..34da711 100644 --- a/packages/backend/convex/schema.ts +++ b/packages/backend/convex/schema.ts @@ -7,7 +7,7 @@ export default defineSchema({ name: v.string(), role: v.string(), // "Squad Lead", "Content Writer", etc. emoji: v.optional(v.string()), // "🦞", "✍️", etc. - sessionKey: v.string(), // "agent:main:main" - OpenClaw session key + sessionKey: v.string(), // "agent:main:main" - agency session key status: v.union(v.literal("online"), v.literal("offline")), currentTaskId: v.optional(v.id("tasks")), config: v.optional(v.any()), // Agent-specific configuration diff --git a/packages/cli/src/commands/business-set.ts b/packages/cli/src/commands/business-set.ts index ee3d5fb..86a850c 100644 --- a/packages/cli/src/commands/business-set.ts +++ b/packages/cli/src/commands/business-set.ts @@ -59,10 +59,10 @@ export async function businessSet( // Remove BOOTSTRAP.md if requested if (options.removeBootstrap) { - const openclawStateDir = - process.env.OPENCLAW_STATE_DIR || path.join(os.homedir(), ".openclaw"); + const agencyStateDir = + process.env.AGENCY_STATE_DIR || path.join(os.homedir(), ".agency"); const bootstrapPath = path.join( - openclawStateDir, + agencyStateDir, "workspaces", "clawe", "BOOTSTRAP.md", diff --git a/packages/shared/package.json b/packages/shared/package.json index 8ee80b9..97f8415 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -4,9 +4,9 @@ "private": true, "type": "module", "exports": { - "./openclaw": { - "types": "./dist/openclaw/index.d.ts", - "default": "./dist/openclaw/index.js" + "./agency": { + "types": "./dist/agency/index.d.ts", + "default": "./dist/agency/index.js" }, "./agents": { "types": "./dist/agents/index.d.ts", diff --git a/packages/shared/src/openclaw/client.spec.ts b/packages/shared/src/agency/client.spec.ts similarity index 99% rename from packages/shared/src/openclaw/client.spec.ts rename to packages/shared/src/agency/client.spec.ts index eb24135..3a70df8 100644 --- a/packages/shared/src/openclaw/client.spec.ts +++ b/packages/shared/src/agency/client.spec.ts @@ -33,7 +33,7 @@ import { patchConfig, } from "./client"; -describe("OpenClaw Client", () => { +describe("Agency Client", () => { beforeEach(() => { vi.clearAllMocks(); }); diff --git a/packages/shared/src/openclaw/client.ts b/packages/shared/src/agency/client.ts similarity index 88% rename from packages/shared/src/openclaw/client.ts rename to packages/shared/src/agency/client.ts index ff443b9..ae6a186 100644 --- a/packages/shared/src/openclaw/client.ts +++ b/packages/shared/src/agency/client.ts @@ -8,16 +8,22 @@ import type { TelegramProbeResult, } from "./types"; -const OPENCLAW_URL = process.env.OPENCLAW_URL || "http://localhost:18789"; -const OPENCLAW_TOKEN = process.env.OPENCLAW_TOKEN || ""; +let _agencyClient: ReturnType | null = null; -const openclawClient = axios.create({ - baseURL: OPENCLAW_URL, - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${OPENCLAW_TOKEN}`, - }, -}); +function getAgencyClient() { + if (!_agencyClient) { + const url = process.env.AGENCY_URL || "http://localhost:18789"; + const token = process.env.AGENCY_TOKEN || ""; + _agencyClient = axios.create({ + baseURL: url, + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }); + } + return _agencyClient; +} async function invokeTool( tool: string, @@ -25,7 +31,7 @@ async function invokeTool( args?: Record, ): Promise> { try { - const { data } = await openclawClient.post("/tools/invoke", { + const { data } = await getAgencyClient().post("/tools/invoke", { tool, action, args, @@ -51,12 +57,12 @@ async function invokeTool( } } -// Health check - uses /tools/invoke with gateway config.get to verify connectivity +// Health check - uses sessions_list to verify gateway connectivity export async function checkHealth(): Promise> { try { - const { data } = await openclawClient.post("/tools/invoke", { - tool: "gateway", - action: "config.get", + const { data } = await getAgencyClient().post("/tools/invoke", { + tool: "sessions_list", + action: "json", }); if (data.ok) { @@ -180,7 +186,7 @@ export async function sessionsSend( }); } -// Cron types (matching OpenClaw src/cron/types.ts) +// Cron types (matching agency src/cron/types.ts) export type CronSchedule = | { kind: "at"; at: string } | { kind: "every"; everyMs: number; anchorMs?: number } diff --git a/packages/shared/src/openclaw/gateway-client.spec.ts b/packages/shared/src/agency/gateway-client.spec.ts similarity index 92% rename from packages/shared/src/openclaw/gateway-client.spec.ts rename to packages/shared/src/agency/gateway-client.spec.ts index 9078de8..014f40d 100644 --- a/packages/shared/src/openclaw/gateway-client.spec.ts +++ b/packages/shared/src/agency/gateway-client.spec.ts @@ -68,8 +68,8 @@ describe("createGatewayClient", () => { }); it("creates client with default URL when env not set", () => { - delete process.env.OPENCLAW_URL; - delete process.env.OPENCLAW_TOKEN; + delete process.env.AGENCY_URL; + delete process.env.AGENCY_TOKEN; const client = createGatewayClient(); expect(client).toBeInstanceOf(GatewayClient); @@ -77,8 +77,8 @@ describe("createGatewayClient", () => { }); it("creates client with env URL and token", () => { - process.env.OPENCLAW_URL = "http://custom:8080"; - process.env.OPENCLAW_TOKEN = "custom-token"; + process.env.AGENCY_URL = "http://custom:8080"; + process.env.AGENCY_TOKEN = "custom-token"; const client = createGatewayClient(); expect(client).toBeInstanceOf(GatewayClient); diff --git a/packages/shared/src/openclaw/gateway-client.ts b/packages/shared/src/agency/gateway-client.ts similarity index 96% rename from packages/shared/src/openclaw/gateway-client.ts rename to packages/shared/src/agency/gateway-client.ts index 1235e6b..7a148cb 100644 --- a/packages/shared/src/openclaw/gateway-client.ts +++ b/packages/shared/src/agency/gateway-client.ts @@ -24,8 +24,8 @@ export type GatewayClientOptions = { const PROTOCOL_VERSION = 3; /** - * Server-side WebSocket client for OpenClaw Gateway. - * Used by API routes to communicate with OpenClaw. + * Server-side WebSocket client for agency gateway. + * Used by API routes to communicate with the agency. */ export class GatewayClient { private ws: WebSocket | null = null; @@ -247,8 +247,8 @@ export class GatewayClient { export function createGatewayClient( options?: Partial, ): GatewayClient { - const url = process.env.OPENCLAW_URL || "http://localhost:18789"; - const token = process.env.OPENCLAW_TOKEN || ""; + const url = process.env.AGENCY_URL || "http://localhost:18789"; + const token = process.env.AGENCY_TOKEN || ""; return new GatewayClient({ url, diff --git a/packages/shared/src/openclaw/gateway-types.ts b/packages/shared/src/agency/gateway-types.ts similarity index 100% rename from packages/shared/src/openclaw/gateway-types.ts rename to packages/shared/src/agency/gateway-types.ts diff --git a/packages/shared/src/openclaw/index.ts b/packages/shared/src/agency/index.ts similarity index 100% rename from packages/shared/src/openclaw/index.ts rename to packages/shared/src/agency/index.ts diff --git a/packages/shared/src/openclaw/pairing.ts b/packages/shared/src/agency/pairing.ts similarity index 95% rename from packages/shared/src/openclaw/pairing.ts rename to packages/shared/src/agency/pairing.ts index 8cbe925..e5a7cbf 100644 --- a/packages/shared/src/openclaw/pairing.ts +++ b/packages/shared/src/agency/pairing.ts @@ -9,9 +9,9 @@ import type { } from "./types"; import { getConfig, patchConfig } from "./client"; -const OPENCLAW_STATE_DIR = - process.env.OPENCLAW_STATE_DIR || path.join(os.homedir(), ".openclaw"); -const CREDENTIALS_DIR = path.join(OPENCLAW_STATE_DIR, "credentials"); +const AGENCY_STATE_DIR = + process.env.AGENCY_STATE_DIR || path.join(os.homedir(), ".agency"); +const CREDENTIALS_DIR = path.join(AGENCY_STATE_DIR, "credentials"); type PairingStore = { version: 1; @@ -98,7 +98,7 @@ export async function approveChannelPairingCode( const normalizedCode = code.trim().toUpperCase(); const pairingPath = resolvePairingPath(channel); - // Read current pairing requests (file-based - OpenClaw writes these) + // Read current pairing requests (file-based - agency writes these) const store = await readJsonFile(pairingPath, { version: 1, requests: [], diff --git a/packages/shared/src/openclaw/shared-client.ts b/packages/shared/src/agency/shared-client.ts similarity index 100% rename from packages/shared/src/openclaw/shared-client.ts rename to packages/shared/src/agency/shared-client.ts diff --git a/packages/shared/src/openclaw/types.ts b/packages/shared/src/agency/types.ts similarity index 87% rename from packages/shared/src/openclaw/types.ts rename to packages/shared/src/agency/types.ts index 0973723..7091921 100644 --- a/packages/shared/src/openclaw/types.ts +++ b/packages/shared/src/agency/types.ts @@ -1,4 +1,4 @@ -// AgentToolResult matches OpenClaw's tool execution result structure +// AgentToolResult matches agency's tool execution result structure export type AgentToolResult = { content: Array<{ type: string; @@ -9,12 +9,12 @@ export type AgentToolResult = { details: T; }; -// ToolResult for OpenClaw tool invocations (result contains content + details) +// ToolResult for agency tool invocations (result contains content + details) export type ToolResult = | { ok: true; result: AgentToolResult } | { ok: false; error: { type: string; message: string } }; -// DirectResult for operations that don't go through OpenClaw tools +// DirectResult for operations that don't go through agency tools export type DirectResult = | { ok: true; result: T } | { ok: false; error: { type: string; message: string } }; diff --git a/scripts/start.sh b/scripts/start.sh index 681a9fc..a19ba7c 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -31,7 +31,7 @@ if [ ! -f .env ]; then sed -i "s/your-secure-token-here/$TOKEN/" .env fi - echo_info "Generated OPENCLAW_TOKEN: ${TOKEN:0:8}..." + echo_info "Generated AGENCY_TOKEN: ${TOKEN:0:8}..." echo_warn "Please edit .env and set your ANTHROPIC_API_KEY and CONVEX_URL" fi @@ -51,8 +51,8 @@ if [ -z "$CONVEX_URL" ] || [ "$CONVEX_URL" = "https://your-deployment.convex.clo MISSING_VARS+=("CONVEX_URL") fi -if [ -z "$OPENCLAW_TOKEN" ] || [ "$OPENCLAW_TOKEN" = "your-secure-token-here" ]; then - MISSING_VARS+=("OPENCLAW_TOKEN") +if [ -z "$AGENCY_TOKEN" ] || [ "$AGENCY_TOKEN" = "your-secure-token-here" ]; then + MISSING_VARS+=("AGENCY_TOKEN") fi if [ ${#MISSING_VARS[@]} -gt 0 ]; then diff --git a/turbo.json b/turbo.json index d96252b..45c727c 100644 --- a/turbo.json +++ b/turbo.json @@ -6,10 +6,10 @@ "CONVEX_URL", "ANTHROPIC_API_KEY", "OPENAI_API_KEY", - "OPENCLAW_URL", - "OPENCLAW_TOKEN", + "AGENCY_URL", + "AGENCY_TOKEN", "CLAWE_DATA_DIR", - "OPENCLAW_STATE_DIR" + "AGENCY_STATE_DIR" ], "tasks": { "build": {