learning_ai_common_plat/services/cowork-service/src/lib/config.ts
saravanakumardb1 a87c533fd3 feat(cowork-service): scaffold Fastify bridge + seed clawcowork feature flags (H.1 + H.2)
H.1: Product registration
- Added 12 clawcowork feature flags to platform-service flags/seed.ts
  (sandbox, plugins, mcp, scheduling, computer_use, parallel_agents,
   marketplace, wasm, llm_multi_model, audit, platform_auth, dispatch_api)

H.2: cowork-service scaffold (services/cowork-service/)
- @lysnrai/cowork-service on port 4009, productId clawcowork
- createServiceApp + startService from @bytelyst/fastify-core
- Modules: health (dependency check), tasks (submit/list/get/cancel)
- Zod-validated config, Swagger, readiness endpoint
- 8 tests passing (1 bootstrap + 7 task routes), typecheck clean
2026-04-02 20:39:22 -07:00

30 lines
965 B
TypeScript

/**
* Cowork Service configuration — Zod-validated environment variables.
*
* Port: 4009 (default)
* Product: clawcowork
*/
import { z } from 'zod';
const envSchema = z.object({
PORT: z.coerce.number().default(4009),
HOST: z.string().default('0.0.0.0'),
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
CORS_ORIGIN: z.string().optional(),
SERVICE_NAME: z.string().default('cowork-service'),
// Platform-service connection (for auth, flags, audit, etc.)
PLATFORM_SERVICE_URL: z.string().default('http://localhost:4003'),
PRODUCT_ID: z.string().default('clawcowork'),
// Rust runtime IPC — path to the cowork-orchestrator binary
RUST_RUNTIME_BIN: z.string().default('cowork-orchestrator'),
RUST_RUNTIME_TIMEOUT_MS: z.coerce.number().default(300_000),
// Anthropic (passed through to Rust runtime)
ANTHROPIC_API_KEY: z.string().optional(),
});
export const config = envSchema.parse(process.env);