create-cogitator-app 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +277 -91
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +61 -3
- package/dist/lib.js +296 -102
- package/dist/lib.js.map +1 -1
- package/package.json +2 -2
package/dist/lib.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
// <define:__COGITATOR_EXAMPLES__>
|
|
2
|
-
var define_COGITATOR_EXAMPLES_default = [{ name: "a2a/a2a-server", title: "A2A Server", entry: "a2a/01-a2a-server.ts", files: ["_shared/setup.ts", "a2a/01-a2a-server.ts"], dependencies: { "@cogitator-ai/a2a": "^0.8.2", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", express: "^5.2.1" }, devDependencies: { "@types/express": "^5.0.6", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "a2a/a2a-client", title: "A2A Client", entry: "a2a/02-a2a-client.ts", files: ["_shared/setup.ts", "a2a/02-a2a-client.ts"], dependencies: { "@cogitator-ai/a2a": "^0.8.2", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/self-modifying", title: "Self-Modifying Agent", entry: "advanced/01-self-modifying.ts", files: ["_shared/setup.ts", "advanced/01-self-modifying.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/self-modifying": "^19.4.2", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/neuro-symbolic", title: "Neuro-Symbolic Reasoning", entry: "advanced/02-neuro-symbolic.ts", files: ["_shared/setup.ts", "advanced/02-neuro-symbolic.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/neuro-symbolic": "^17.0.22", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/wasm-tools", title: "WASM-Sandboxed Tools", entry: "advanced/03-wasm-tools.ts", files: ["_shared/setup.ts", "advanced/03-wasm-tools.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/wasm-tools": "^0.7.16", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/web-scraping", title: "Web Scraping with Browser Agent", entry: "browser/01-web-scraping.ts", files: ["_shared/setup.ts", "browser/01-web-scraping.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.12", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/form-automation", title: "Form Automation with Browser Agent", entry: "browser/02-form-automation.ts", files: ["_shared/setup.ts", "browser/02-form-automation.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.12", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/stealth-agent", title: "Stealth Browser Agent", entry: "browser/03-stealth-agent.ts", files: ["_shared/setup.ts", "browser/03-stealth-agent.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.12", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/bitcoin-price-scraper", title: "Bitcoin Price Scraper (Binance)", entry: "browser/04-bitcoin-price-scraper.ts", files: ["_shared/setup.ts", "browser/04-bitcoin-price-scraper.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.12", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "channels/telegram-assistant", title: "Telegram assistant", entry: "channels/01-telegram-assistant.ts", files: ["channels/01-telegram-assistant.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.2", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", grammy: "^1.46.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY", "OWNER_TG_ID", "TG_TOKEN"], runtime: "node" }, { name: "channels/super-assistant", title: "Super assistant", entry: "channels/02-super-assistant.ts", files: ["channels/02-super-assistant.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.2", "better-sqlite3": "^13.0.3", dotenv: "^18.0.5", grammy: "^1.46.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["OWNER_TG_ID", "TG_TOKEN"], runtime: "node" }, { name: "channels/webchat-bot", title: "Webchat bot", entry: "channels/03-webchat-bot.ts", files: ["channels/03-webchat-bot.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.2", "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", ws: "^8.22.0", zod: "^4.6.5" }, devDependencies: { "@types/ws": "^8.18.2", tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY", "WEBCHAT_PORT", "WEBCHAT_TOKEN"], runtime: "node" }, { name: "core/basic-agent", title: "Basic Agent with Custom Tools", entry: "core/01-basic-agent.ts", files: ["_shared/setup.ts", "core/01-basic-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/built-in-tools", title: "Built-in Tools", entry: "core/02-built-in-tools.ts", files: ["_shared/setup.ts", "core/02-built-in-tools.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/tool-caching", title: "Tool Caching with withCache", entry: "core/03-tool-caching.ts", files: ["_shared/setup.ts", "core/03-tool-caching.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/context-manager", title: "Context Manager", entry: "core/04-context-manager.ts", files: ["_shared/setup.ts", "core/04-context-manager.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/tree-of-thought", title: "Tree of Thought", entry: "core/05-tree-of-thought.ts", files: ["_shared/setup.ts", "core/05-tree-of-thought.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/reflection", title: "Reflection", entry: "core/06-reflection.ts", files: ["_shared/setup.ts", "core/06-reflection.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/agent-optimizer", title: "Agent Optimizer", entry: "core/07-agent-optimizer.ts", files: ["_shared/setup.ts", "core/07-agent-optimizer.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/time-travel", title: "Time Travel", entry: "core/08-time-travel.ts", files: ["_shared/setup.ts", "core/08-time-travel.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/cost-routing", title: "Cost-Aware Routing", entry: "core/09-cost-routing.ts", files: ["_shared/setup.ts", "core/09-cost-routing.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/constitutional-ai", title: "Constitutional AI", entry: "core/10-constitutional-ai.ts", files: ["_shared/setup.ts", "core/10-constitutional-ai.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/prompt-injection", title: "Prompt Injection Detection", entry: "core/11-prompt-injection.ts", files: ["_shared/setup.ts", "core/11-prompt-injection.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/causal-reasoning", title: "Causal Reasoning", entry: "core/12-causal-reasoning.ts", files: ["_shared/setup.ts", "core/12-causal-reasoning.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/model-registry", title: "Model Registry", entry: "core/13-model-registry.ts", files: ["_shared/setup.ts", "core/13-model-registry.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/models": "^18.3.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/approvals", title: "Approvals: pause before a sensitive tool, resume later", entry: "core/14-approvals.ts", files: ["_shared/setup.ts", "core/14-approvals.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/handoffs", title: "Handoffs: a triage agent passes the conversation on", entry: "core/15-handoffs.ts", files: ["_shared/setup.ts", "core/15-handoffs.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "device-tools/screenshot", title: "Screenshot", entry: "device-tools/01-screenshot.ts", files: ["device-tools/01-screenshot.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/clipboard", title: "Clipboard", entry: "device-tools/02-clipboard.ts", files: ["device-tools/02-clipboard.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/notify", title: "Notify", entry: "device-tools/03-notify.ts", files: ["device-tools/03-notify.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/open-url", title: "Open url", entry: "device-tools/04-open-url.ts", files: ["device-tools/04-open-url.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/shell-exec", title: "Shell exec", entry: "device-tools/05-shell-exec.ts", files: ["device-tools/05-shell-exec.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "evals/basic-eval", title: "Basic Evaluation", entry: "evals/01-basic-eval.ts", files: ["_shared/setup.ts", "evals/01-basic-eval.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "evals/llm-judge", title: "LLM-as-Judge Evaluation", entry: "evals/02-llm-judge.ts", files: ["_shared/setup.ts", "evals/02-llm-judge.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "evals/ab-comparison", title: "A/B Comparison", entry: "evals/03-ab-comparison.ts", files: ["_shared/setup.ts", "evals/03-ab-comparison.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/redis-memory", title: "Redis Memory: Persistent Conversations", entry: "infrastructure/01-redis-memory.ts", files: ["_shared/setup.ts", "infrastructure/01-redis-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY", "REDIS_URL"], runtime: "node" }, { name: "infrastructure/postgres-memory", title: "PostgreSQL Memory: Long-Term Persistence", entry: "infrastructure/02-postgres-memory.ts", files: ["_shared/setup.ts", "infrastructure/02-postgres-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "DATABASE_URL", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/worker-queue", title: "Worker Queue: Distributed Agent Execution", entry: "infrastructure/03-worker-queue.ts", files: ["_shared/setup.ts", "infrastructure/03-worker-queue.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/worker": "^0.9.2", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY", "REDIS_URL"], runtime: "node" }, { name: "infrastructure/deploy-docker", title: "Deploy: Docker Deployment Planning", entry: "infrastructure/04-deploy-docker.ts", files: ["_shared/setup.ts", "infrastructure/04-deploy-docker.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/deploy": "^0.6.1", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/sandbox-execution", title: "Sandbox Execution: Docker, WASM & Native", entry: "infrastructure/05-sandbox-execution.ts", files: ["_shared/setup.ts", "infrastructure/05-sandbox-execution.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/sandbox": "^0.5.11", "@extism/extism": "^2.0.0-rc13", dockerode: "^4.0.0 || ^5.0.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/express-server", title: "Express Server Integration", entry: "integrations/01-express-server.ts", files: ["_shared/arithmetic.ts", "_shared/setup.ts", "integrations/01-express-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/express": "^0.8.2", dotenv: "^18.0.5", express: "^5.2.1", zod: "^4.6.5" }, devDependencies: { "@types/express": "^5.0.6", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/fastify-server", title: "Fastify Server Integration", entry: "integrations/02-fastify-server.ts", files: ["_shared/arithmetic.ts", "_shared/setup.ts", "integrations/02-fastify-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/fastify": "^0.7.2", dotenv: "^18.0.5", fastify: "^5.12.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/hono-server", title: "Hono Server Integration", entry: "integrations/03-hono-server.ts", files: ["_shared/setup.ts", "integrations/03-hono-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/hono": "^0.7.2", "@hono/node-server": "^2.1.3", dotenv: "^18.0.5", hono: "^4.13.12" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/koa-server", title: "Koa Server Integration", entry: "integrations/04-koa-server.ts", files: ["_shared/setup.ts", "integrations/04-koa-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/koa": "^0.7.2", "@koa/router": "^15.7.0", dotenv: "^18.0.5", koa: "^3.2.1" }, devDependencies: { "@types/koa": "^3.0.3", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/nextjs-handler", title: "Nextjs handler", entry: "integrations/05-nextjs-handler.ts", files: ["integrations/05-nextjs-handler.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/next": "^0.8.2", next: "^14.0.0 || ^15.0.0 || ^16.0.0", react: "^18.2.0 || ^19.0.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY"], runtime: "node" }, { name: "integrations/openai-compat", title: "OpenAI-Compatible Server", entry: "integrations/06-openai-compat.ts", files: ["_shared/setup.ts", "integrations/06-openai-compat.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/openai-compat": "^21.2.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5", openai: "^7.25.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/ai-sdk-adapter", title: "Vercel AI SDK Adapter", entry: "integrations/07-ai-sdk-adapter.ts", files: ["_shared/setup.ts", "integrations/07-ai-sdk-adapter.ts"], dependencies: { "@cogitator-ai/ai-sdk": "^0.6.0", "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/types": "^0.38.0", ai: "^7.0.127", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/tetsu-server", title: "Tetsu Server on Bun: an app with its own MCP server and agent", entry: "integrations/08-tetsu-server.ts", files: ["_shared/setup.ts", "integrations/08-tetsu-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/mcp": "^19.3.2", "@cogitator-ai/tetsu": "^0.5.2", "@cogitator-ai/types": "^0.38.0", "@tetsujs/core": "^0.6.1", "@tetsujs/openapi": "^0.6.1", "@tetsujs/sse": "^0.6.1", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "bun" }, { name: "mcp/mcp-client", title: "MCP Client: Filesystem Server", entry: "mcp/01-mcp-client.ts", files: ["_shared/setup.ts", "mcp/01-mcp-client.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/mcp": "^19.3.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/mcp-server", title: "MCP Server: Expose Cogitator Tools over HTTP", entry: "mcp/02-mcp-server.ts", files: ["_shared/setup.ts", "mcp/02-mcp-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/mcp": "^19.3.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/per-user-mcp", title: "An Agent on Your Own MCP Server, per User", entry: "mcp/03-per-user-mcp.ts", files: ["_shared/setup.ts", "mcp/03-per-user-mcp.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/mcp": "^19.3.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/agent-as-mcp-server", title: "A Cogitator Agent as an MCP Server", entry: "mcp/04-agent-as-mcp-server.ts", files: ["_shared/setup.ts", "mcp/04-agent-as-mcp-server.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/mcp": "^19.3.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/basic-memory", title: "Basic Memory: Threads & Multi-Turn Conversations", entry: "memory/01-basic-memory.ts", files: ["_shared/setup.ts", "memory/01-basic-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/context-builder", title: "Context Builder: Token-Aware Context Windows", entry: "memory/02-context-builder.ts", files: ["_shared/setup.ts", "memory/02-context-builder.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/semantic-search", title: "Semantic Search: Hybrid BM25 + Vector Search", entry: "memory/03-semantic-search.ts", files: ["_shared/setup.ts", "memory/03-semantic-search.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", "@qdrant/js-client-rest": "^1.10.0", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/knowledge-graph", title: "Knowledge Graph: Entity Extraction & Graph Traversal", entry: "memory/04-knowledge-graph.ts", files: ["_shared/setup.ts", "memory/04-knowledge-graph.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", "@cogitator-ai/types": "^0.38.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/basic-retrieval", title: "Basic RAG Retrieval", entry: "rag/01-basic-retrieval.ts", files: ["_shared/setup.ts", "rag/01-basic-retrieval.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", "@cogitator-ai/rag": "^0.6.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/chunking-strategies", title: "Chunking Strategies Comparison", entry: "rag/02-chunking-strategies.ts", files: ["_shared/setup.ts", "rag/02-chunking-strategies.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", "@cogitator-ai/rag": "^0.6.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/agent-with-rag", title: "Agent with RAG Tools", entry: "rag/03-agent-with-rag.ts", files: ["_shared/setup.ts", "rag/03-agent-with-rag.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/memory": "^0.12.2", "@cogitator-ai/rag": "^0.6.2", "@qdrant/js-client-rest": "^1.10.0", "better-sqlite3": "^13.0.3", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0", mongodb: "^6.0.0 || ^7.0.0", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/debate-swarm", title: "Debate Swarm", entry: "swarms/01-debate-swarm.ts", files: ["_shared/setup.ts", "swarms/01-debate-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/swarms": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/pipeline-swarm", title: "Pipeline Swarm", entry: "swarms/02-pipeline-swarm.ts", files: ["_shared/setup.ts", "swarms/02-pipeline-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/swarms": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/hierarchical-swarm", title: "Hierarchical Swarm", entry: "swarms/03-hierarchical-swarm.ts", files: ["_shared/setup.ts", "swarms/03-hierarchical-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/swarms": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/negotiation-swarm", title: "Negotiation Swarm", entry: "swarms/04-negotiation-swarm.ts", files: ["_shared/setup.ts", "swarms/04-negotiation-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/swarms": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/pipeline", title: "Voice Pipeline", entry: "voice/01-pipeline.ts", files: ["_shared/setup.ts", "voice/01-pipeline.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/voice": "^0.5.2", dotenv: "^18.0.5", openai: "^7.25.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/realtime", title: "Realtime Voice Session", entry: "voice/02-realtime.ts", files: ["_shared/setup.ts", "voice/02-realtime.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/voice": "^0.5.2", dotenv: "^18.0.5", openai: "^7.25.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/voice-agent", title: "Voice Agent (WebSocket Server)", entry: "voice/03-voice-agent.ts", files: ["_shared/setup.ts", "voice/03-voice-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/voice": "^0.5.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "DEEPGRAM_API_KEY", "ELEVENLABS_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/realtime-voice-agent", title: "Realtime Voice Agent (Gemini Live over WebSocket)", entry: "voice/04-realtime-voice-agent.ts", files: ["_shared/setup.ts", "voice/04-realtime-voice-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/voice": "^0.5.2", dotenv: "^18.0.5", ws: "^8.22.0" }, devDependencies: { "@types/ws": "^8.18.2", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/basic-workflow", title: "Basic Workflow: Code Review Pipeline", entry: "workflows/01-basic-workflow.ts", files: ["_shared/setup.ts", "workflows/01-basic-workflow.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/workflows": "^0.12.2", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/human-in-loop", title: "Human-in-the-Loop: Content Publishing Workflow", entry: "workflows/02-human-in-loop.ts", files: ["_shared/setup.ts", "workflows/02-human-in-loop.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/workflows": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/map-reduce", title: "Map-Reduce: Parallel Document Analysis", entry: "workflows/03-map-reduce.ts", files: ["_shared/setup.ts", "workflows/03-map-reduce.ts"], dependencies: { "@cogitator-ai/core": "^0.36.0", "@cogitator-ai/workflows": "^0.12.2", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }];
|
|
2
|
+
var define_COGITATOR_EXAMPLES_default = [{ name: "a2a/a2a-server", title: "A2A Server", entry: "a2a/01-a2a-server.ts", files: ["_shared/setup.ts", "a2a/01-a2a-server.ts"], dependencies: { "@cogitator-ai/a2a": "^0.8.3", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", express: "^5.2.1" }, devDependencies: { "@types/express": "^5.0.6", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "a2a/a2a-client", title: "A2A Client", entry: "a2a/02-a2a-client.ts", files: ["_shared/setup.ts", "a2a/02-a2a-client.ts"], dependencies: { "@cogitator-ai/a2a": "^0.8.3", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/self-modifying", title: "Self-Modifying Agent", entry: "advanced/01-self-modifying.ts", files: ["_shared/setup.ts", "advanced/01-self-modifying.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/self-modifying": "^19.4.3", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/neuro-symbolic", title: "Neuro-Symbolic Reasoning", entry: "advanced/02-neuro-symbolic.ts", files: ["_shared/setup.ts", "advanced/02-neuro-symbolic.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/neuro-symbolic": "^17.0.23", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "advanced/wasm-tools", title: "WASM-Sandboxed Tools", entry: "advanced/03-wasm-tools.ts", files: ["_shared/setup.ts", "advanced/03-wasm-tools.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/wasm-tools": "^0.7.17", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/web-scraping", title: "Web Scraping with Browser Agent", entry: "browser/01-web-scraping.ts", files: ["_shared/setup.ts", "browser/01-web-scraping.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.13", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/form-automation", title: "Form Automation with Browser Agent", entry: "browser/02-form-automation.ts", files: ["_shared/setup.ts", "browser/02-form-automation.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.13", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/stealth-agent", title: "Stealth Browser Agent", entry: "browser/03-stealth-agent.ts", files: ["_shared/setup.ts", "browser/03-stealth-agent.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.13", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "browser/bitcoin-price-scraper", title: "Bitcoin Price Scraper (Binance)", entry: "browser/04-bitcoin-price-scraper.ts", files: ["_shared/setup.ts", "browser/04-bitcoin-price-scraper.ts"], dependencies: { "@cogitator-ai/browser": "^0.4.13", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "channels/telegram-assistant", title: "Telegram assistant", entry: "channels/01-telegram-assistant.ts", files: ["channels/01-telegram-assistant.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.3", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", grammy: "^1.46.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY", "OWNER_TG_ID", "TG_TOKEN"], runtime: "node" }, { name: "channels/super-assistant", title: "Super assistant", entry: "channels/02-super-assistant.ts", files: ["channels/02-super-assistant.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.3", "better-sqlite3": "^13.0.3", dotenv: "^18.0.5", grammy: "^1.46.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["OWNER_TG_ID", "TG_TOKEN"], runtime: "node" }, { name: "channels/webchat-bot", title: "Webchat bot", entry: "channels/03-webchat-bot.ts", files: ["channels/03-webchat-bot.ts", "channels/cogitator.yml", "channels/webchat-client.html"], dependencies: { "@cogitator-ai/channels": "^0.9.3", "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", ws: "^8.22.0", zod: "^4.6.5" }, devDependencies: { "@types/ws": "^8.18.2", tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY", "WEBCHAT_PORT", "WEBCHAT_TOKEN"], runtime: "node" }, { name: "core/basic-agent", title: "Basic Agent with Custom Tools", entry: "core/01-basic-agent.ts", files: ["_shared/setup.ts", "core/01-basic-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/built-in-tools", title: "Built-in Tools", entry: "core/02-built-in-tools.ts", files: ["_shared/setup.ts", "core/02-built-in-tools.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/tool-caching", title: "Tool Caching with withCache", entry: "core/03-tool-caching.ts", files: ["_shared/setup.ts", "core/03-tool-caching.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/context-manager", title: "Context Manager", entry: "core/04-context-manager.ts", files: ["_shared/setup.ts", "core/04-context-manager.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/tree-of-thought", title: "Tree of Thought", entry: "core/05-tree-of-thought.ts", files: ["_shared/setup.ts", "core/05-tree-of-thought.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/reflection", title: "Reflection", entry: "core/06-reflection.ts", files: ["_shared/setup.ts", "core/06-reflection.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/agent-optimizer", title: "Agent Optimizer", entry: "core/07-agent-optimizer.ts", files: ["_shared/setup.ts", "core/07-agent-optimizer.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/time-travel", title: "Time Travel", entry: "core/08-time-travel.ts", files: ["_shared/setup.ts", "core/08-time-travel.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/cost-routing", title: "Cost-Aware Routing", entry: "core/09-cost-routing.ts", files: ["_shared/setup.ts", "core/09-cost-routing.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/constitutional-ai", title: "Constitutional AI", entry: "core/10-constitutional-ai.ts", files: ["_shared/setup.ts", "core/10-constitutional-ai.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/prompt-injection", title: "Prompt Injection Detection", entry: "core/11-prompt-injection.ts", files: ["_shared/setup.ts", "core/11-prompt-injection.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/causal-reasoning", title: "Causal Reasoning", entry: "core/12-causal-reasoning.ts", files: ["_shared/setup.ts", "core/12-causal-reasoning.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/model-registry", title: "Model Registry", entry: "core/13-model-registry.ts", files: ["_shared/setup.ts", "core/13-model-registry.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/models": "^18.3.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/approvals", title: "Approvals: pause before a sensitive tool, resume later", entry: "core/14-approvals.ts", files: ["_shared/setup.ts", "core/14-approvals.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "core/handoffs", title: "Handoffs: a triage agent passes the conversation on", entry: "core/15-handoffs.ts", files: ["_shared/setup.ts", "core/15-handoffs.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "device-tools/screenshot", title: "Screenshot", entry: "device-tools/01-screenshot.ts", files: ["device-tools/01-screenshot.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/clipboard", title: "Clipboard", entry: "device-tools/02-clipboard.ts", files: ["device-tools/02-clipboard.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/notify", title: "Notify", entry: "device-tools/03-notify.ts", files: ["device-tools/03-notify.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/open-url", title: "Open url", entry: "device-tools/04-open-url.ts", files: ["device-tools/04-open-url.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "device-tools/shell-exec", title: "Shell exec", entry: "device-tools/05-shell-exec.ts", files: ["device-tools/05-shell-exec.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: [], runtime: "node" }, { name: "evals/basic-eval", title: "Basic Evaluation", entry: "evals/01-basic-eval.ts", files: ["_shared/setup.ts", "evals/01-basic-eval.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "evals/llm-judge", title: "LLM-as-Judge Evaluation", entry: "evals/02-llm-judge.ts", files: ["_shared/setup.ts", "evals/02-llm-judge.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "evals/ab-comparison", title: "A/B Comparison", entry: "evals/03-ab-comparison.ts", files: ["_shared/setup.ts", "evals/03-ab-comparison.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/evals": "^0.6.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/redis-memory", title: "Redis Memory: Persistent Conversations", entry: "infrastructure/01-redis-memory.ts", files: ["_shared/setup.ts", "infrastructure/01-redis-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY", "REDIS_URL"], runtime: "node" }, { name: "infrastructure/postgres-memory", title: "PostgreSQL Memory: Long-Term Persistence", entry: "infrastructure/02-postgres-memory.ts", files: ["_shared/setup.ts", "infrastructure/02-postgres-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "DATABASE_URL", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/worker-queue", title: "Worker Queue: Distributed Agent Execution", entry: "infrastructure/03-worker-queue.ts", files: ["_shared/setup.ts", "infrastructure/03-worker-queue.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/worker": "^0.9.3", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY", "REDIS_URL"], runtime: "node" }, { name: "infrastructure/deploy-docker", title: "Deploy: Docker Deployment Planning", entry: "infrastructure/04-deploy-docker.ts", files: ["_shared/setup.ts", "infrastructure/04-deploy-docker.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/deploy": "^0.6.2", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "infrastructure/sandbox-execution", title: "Sandbox Execution: Docker, WASM & Native", entry: "infrastructure/05-sandbox-execution.ts", files: ["_shared/setup.ts", "infrastructure/05-sandbox-execution.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/sandbox": "^0.5.12", "@extism/extism": "^2.0.0-rc13", dockerode: "^4.0.0 || ^5.0.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/express-server", title: "Express Server Integration", entry: "integrations/01-express-server.ts", files: ["_shared/arithmetic.ts", "_shared/setup.ts", "integrations/01-express-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/express": "^0.8.3", dotenv: "^18.0.5", express: "^5.2.1", zod: "^4.6.5" }, devDependencies: { "@types/express": "^5.0.6", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/fastify-server", title: "Fastify Server Integration", entry: "integrations/02-fastify-server.ts", files: ["_shared/arithmetic.ts", "_shared/setup.ts", "integrations/02-fastify-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/fastify": "^0.7.3", dotenv: "^18.0.5", fastify: "^5.12.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/hono-server", title: "Hono Server Integration", entry: "integrations/03-hono-server.ts", files: ["_shared/setup.ts", "integrations/03-hono-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/hono": "^0.7.3", "@hono/node-server": "^2.1.3", dotenv: "^18.0.5", hono: "^4.13.12" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/koa-server", title: "Koa Server Integration", entry: "integrations/04-koa-server.ts", files: ["_shared/setup.ts", "integrations/04-koa-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/koa": "^0.7.3", "@koa/router": "^15.7.0", dotenv: "^18.0.5", koa: "^3.2.1" }, devDependencies: { "@types/koa": "^3.0.3", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/nextjs-handler", title: "Nextjs handler", entry: "integrations/05-nextjs-handler.ts", files: ["integrations/05-nextjs-handler.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/next": "^0.8.3", next: "^14.0.0 || ^15.0.0 || ^16.0.0", react: "^18.2.0 || ^19.0.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["GOOGLE_API_KEY"], runtime: "node" }, { name: "integrations/openai-compat", title: "OpenAI-Compatible Server", entry: "integrations/06-openai-compat.ts", files: ["_shared/setup.ts", "integrations/06-openai-compat.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/openai-compat": "^21.2.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5", openai: "^7.25.0", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/ai-sdk-adapter", title: "Vercel AI SDK Adapter", entry: "integrations/07-ai-sdk-adapter.ts", files: ["_shared/setup.ts", "integrations/07-ai-sdk-adapter.ts"], dependencies: { "@cogitator-ai/ai-sdk": "^0.6.0", "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/types": "^0.39.0", ai: "^7.0.127", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "integrations/tetsu-server", title: "Tetsu Server on Bun: an app with its own MCP server and agent", entry: "integrations/08-tetsu-server.ts", files: ["_shared/setup.ts", "integrations/08-tetsu-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/mcp": "^19.3.3", "@cogitator-ai/tetsu": "^0.5.3", "@cogitator-ai/types": "^0.39.0", "@tetsujs/core": "^0.6.1", "@tetsujs/openapi": "^0.6.1", "@tetsujs/sse": "^0.6.1", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "bun" }, { name: "mcp/mcp-client", title: "MCP Client: Filesystem Server", entry: "mcp/01-mcp-client.ts", files: ["_shared/setup.ts", "mcp/01-mcp-client.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/mcp": "^19.3.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/mcp-server", title: "MCP Server: Expose Cogitator Tools over HTTP", entry: "mcp/02-mcp-server.ts", files: ["_shared/setup.ts", "mcp/02-mcp-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/mcp": "^19.3.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/per-user-mcp", title: "An Agent on Your Own MCP Server, per User", entry: "mcp/03-per-user-mcp.ts", files: ["_shared/setup.ts", "mcp/03-per-user-mcp.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/mcp": "^19.3.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "mcp/agent-as-mcp-server", title: "A Cogitator Agent as an MCP Server", entry: "mcp/04-agent-as-mcp-server.ts", files: ["_shared/setup.ts", "mcp/04-agent-as-mcp-server.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/mcp": "^19.3.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/basic-memory", title: "Basic Memory: Threads & Multi-Turn Conversations", entry: "memory/01-basic-memory.ts", files: ["_shared/setup.ts", "memory/01-basic-memory.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/context-builder", title: "Context Builder: Token-Aware Context Windows", entry: "memory/02-context-builder.ts", files: ["_shared/setup.ts", "memory/02-context-builder.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/semantic-search", title: "Semantic Search: Hybrid BM25 + Vector Search", entry: "memory/03-semantic-search.ts", files: ["_shared/setup.ts", "memory/03-semantic-search.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", "@qdrant/js-client-rest": "^1.10.0", dotenv: "^18.0.5", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "memory/knowledge-graph", title: "Knowledge Graph: Entity Extraction & Graph Traversal", entry: "memory/04-knowledge-graph.ts", files: ["_shared/setup.ts", "memory/04-knowledge-graph.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", "@cogitator-ai/types": "^0.39.0", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/basic-retrieval", title: "Basic RAG Retrieval", entry: "rag/01-basic-retrieval.ts", files: ["_shared/setup.ts", "rag/01-basic-retrieval.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", "@cogitator-ai/rag": "^0.6.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/chunking-strategies", title: "Chunking Strategies Comparison", entry: "rag/02-chunking-strategies.ts", files: ["_shared/setup.ts", "rag/02-chunking-strategies.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", "@cogitator-ai/rag": "^0.6.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "rag/agent-with-rag", title: "Agent with RAG Tools", entry: "rag/03-agent-with-rag.ts", files: ["_shared/setup.ts", "rag/03-agent-with-rag.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/memory": "^0.12.3", "@cogitator-ai/rag": "^0.6.3", "@qdrant/js-client-rest": "^1.10.0", "better-sqlite3": "^13.0.3", dotenv: "^18.0.5", ioredis: "^5.0.0 || ^6.0.0", mongodb: "^6.0.0 || ^7.0.0", pg: "^8.23.1" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/debate-swarm", title: "Debate Swarm", entry: "swarms/01-debate-swarm.ts", files: ["_shared/setup.ts", "swarms/01-debate-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/swarms": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/pipeline-swarm", title: "Pipeline Swarm", entry: "swarms/02-pipeline-swarm.ts", files: ["_shared/setup.ts", "swarms/02-pipeline-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/swarms": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/hierarchical-swarm", title: "Hierarchical Swarm", entry: "swarms/03-hierarchical-swarm.ts", files: ["_shared/setup.ts", "swarms/03-hierarchical-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/swarms": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "swarms/negotiation-swarm", title: "Negotiation Swarm", entry: "swarms/04-negotiation-swarm.ts", files: ["_shared/setup.ts", "swarms/04-negotiation-swarm.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/swarms": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/pipeline", title: "Voice Pipeline", entry: "voice/01-pipeline.ts", files: ["_shared/setup.ts", "voice/01-pipeline.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/voice": "^0.5.3", dotenv: "^18.0.5", openai: "^7.25.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/realtime", title: "Realtime Voice Session", entry: "voice/02-realtime.ts", files: ["_shared/setup.ts", "voice/02-realtime.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/voice": "^0.5.3", dotenv: "^18.0.5", openai: "^7.25.0" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/voice-agent", title: "Voice Agent (WebSocket Server)", entry: "voice/03-voice-agent.ts", files: ["_shared/setup.ts", "voice/03-voice-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/voice": "^0.5.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "DEEPGRAM_API_KEY", "ELEVENLABS_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "voice/realtime-voice-agent", title: "Realtime Voice Agent (Gemini Live over WebSocket)", entry: "voice/04-realtime-voice-agent.ts", files: ["_shared/setup.ts", "voice/04-realtime-voice-agent.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/voice": "^0.5.3", dotenv: "^18.0.5", ws: "^8.22.0" }, devDependencies: { "@types/ws": "^8.18.2", tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/basic-workflow", title: "Basic Workflow: Code Review Pipeline", entry: "workflows/01-basic-workflow.ts", files: ["_shared/setup.ts", "workflows/01-basic-workflow.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/workflows": "^0.12.3", dotenv: "^18.0.5", zod: "^4.6.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/human-in-loop", title: "Human-in-the-Loop: Content Publishing Workflow", entry: "workflows/02-human-in-loop.ts", files: ["_shared/setup.ts", "workflows/02-human-in-loop.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/workflows": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }, { name: "workflows/map-reduce", title: "Map-Reduce: Parallel Document Analysis", entry: "workflows/03-map-reduce.ts", files: ["_shared/setup.ts", "workflows/03-map-reduce.ts"], dependencies: { "@cogitator-ai/core": "^0.37.0", "@cogitator-ai/workflows": "^0.12.3", dotenv: "^18.0.5" }, devDependencies: { tsx: "^4.23.15" }, env: ["ANTHROPIC_API_KEY", "GOOGLE_API_KEY", "OLLAMA_URL", "OPENAI_API_KEY"], runtime: "node" }];
|
|
3
3
|
|
|
4
4
|
// <define:__COGITATOR_VERSIONS__>
|
|
5
|
-
var define_COGITATOR_VERSIONS_default = { "@cogitator-ai/a2a": "0.8.
|
|
5
|
+
var define_COGITATOR_VERSIONS_default = { "@cogitator-ai/a2a": "0.8.3", "@cogitator-ai/ai-sdk": "0.6.0", "@cogitator-ai/browser": "0.4.13", "@cogitator-ai/channels": "0.9.3", "@cogitator-ai/cli": "0.6.4", "@cogitator-ai/config": "0.13.0", "@cogitator-ai/core": "0.37.0", "@cogitator-ai/deploy": "0.6.2", "@cogitator-ai/evals": "0.6.0", "@cogitator-ai/express": "0.8.3", "@cogitator-ai/fastify": "0.7.3", "@cogitator-ai/hono": "0.7.3", "@cogitator-ai/koa": "0.7.3", "@cogitator-ai/mcp": "19.3.3", "@cogitator-ai/memory": "0.12.3", "@cogitator-ai/models": "18.3.0", "@cogitator-ai/neuro-symbolic": "17.0.23", "@cogitator-ai/next": "0.8.3", "@cogitator-ai/openai-compat": "21.2.3", "@cogitator-ai/rag": "0.6.3", "@cogitator-ai/redis": "0.5.2", "@cogitator-ai/sandbox": "0.5.12", "@cogitator-ai/self-modifying": "19.4.3", "@cogitator-ai/server-shared": "0.5.3", "@cogitator-ai/studio": "0.1.2", "@cogitator-ai/swarms": "0.12.3", "@cogitator-ai/test-utils": "0.2.17", "@cogitator-ai/tetsu": "0.5.3", "@cogitator-ai/types": "0.39.0", "@cogitator-ai/voice": "0.5.3", "@cogitator-ai/wasm-tools": "0.7.17", "@cogitator-ai/worker": "0.9.3", "@cogitator-ai/workflows": "0.12.3" };
|
|
6
6
|
|
|
7
7
|
// src/kit/scaffold.ts
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
|
-
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
9
|
+
import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
|
|
10
10
|
import { chmod, mkdir, readFile, writeFile } from "fs/promises";
|
|
11
|
-
import { dirname as
|
|
11
|
+
import { dirname as dirname3, join as join3, resolve } from "path";
|
|
12
|
+
|
|
13
|
+
// src/kit/errors.ts
|
|
14
|
+
var CodedError = class extends Error {
|
|
15
|
+
code;
|
|
16
|
+
constructor(code2, message, options) {
|
|
17
|
+
super(message, options);
|
|
18
|
+
this.name = "CodedError";
|
|
19
|
+
this.code = code2;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function constantCase(name) {
|
|
23
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/kit/package-manager.ts
|
|
27
|
+
import { existsSync } from "fs";
|
|
28
|
+
import { basename, dirname, join } from "path";
|
|
12
29
|
|
|
13
30
|
// src/kit/spec.ts
|
|
14
31
|
import { z } from "zod";
|
|
@@ -120,9 +137,117 @@ function execCommand(pm, bin) {
|
|
|
120
137
|
if (pm === "bun") return `bunx ${bin}`;
|
|
121
138
|
return `${pm} exec ${bin}`;
|
|
122
139
|
}
|
|
140
|
+
function launchingPackageManager(pm, env) {
|
|
141
|
+
const execPath = env.npm_execpath;
|
|
142
|
+
if (!execPath || env.npm_config_user_agent?.split("/")[0] !== pm) return void 0;
|
|
143
|
+
const path = pm === "npm" && basename(execPath) === "npx-cli.js" ? join(dirname(execPath), "npm-cli.js") : execPath;
|
|
144
|
+
return existsSync(path) ? path : void 0;
|
|
145
|
+
}
|
|
146
|
+
function packageManagerInvocation(pm, args, env = process.env) {
|
|
147
|
+
const launcher = launchingPackageManager(pm, env);
|
|
148
|
+
if (!launcher) return { command: pm, args, fromPath: true };
|
|
149
|
+
return /\.[cm]?js$/.test(launcher) ? { command: process.execPath, args: [launcher, ...args], fromPath: false } : { command: launcher, args, fromPath: false };
|
|
150
|
+
}
|
|
123
151
|
function installCommand(pm) {
|
|
124
152
|
return `${pm} install`;
|
|
125
153
|
}
|
|
154
|
+
var SYSTEM_CODES = [
|
|
155
|
+
"ECONNREFUSED",
|
|
156
|
+
"ECONNRESET",
|
|
157
|
+
"ENOTFOUND",
|
|
158
|
+
"EAI_AGAIN",
|
|
159
|
+
"ETIMEDOUT",
|
|
160
|
+
"ENETUNREACH",
|
|
161
|
+
"EHOSTUNREACH",
|
|
162
|
+
"EPROTO",
|
|
163
|
+
"EACCES",
|
|
164
|
+
"EPERM",
|
|
165
|
+
"ENOSPC",
|
|
166
|
+
"ENOENT",
|
|
167
|
+
"EINTEGRITY",
|
|
168
|
+
"ELIFECYCLE"
|
|
169
|
+
];
|
|
170
|
+
var PNPM_CODES = /* @__PURE__ */ new Set([
|
|
171
|
+
"NO_MATCHING_VERSION",
|
|
172
|
+
"NO_MATURE_MATCHING_VERSION",
|
|
173
|
+
"NO_VERSIONS",
|
|
174
|
+
"META_FETCH_FAIL",
|
|
175
|
+
"TARBALL_INTEGRITY",
|
|
176
|
+
"BAD_TARBALL_SIZE",
|
|
177
|
+
"PEER_DEP_ISSUES",
|
|
178
|
+
"UNSUPPORTED_ENGINE",
|
|
179
|
+
"UNSUPPORTED_PLATFORM",
|
|
180
|
+
"OUTDATED_LOCKFILE",
|
|
181
|
+
"BROKEN_LOCKFILE",
|
|
182
|
+
"LOCKFILE_BREAKING_CHANGE",
|
|
183
|
+
"LOCKFILE_MISSING_DEPENDENCY",
|
|
184
|
+
"NO_OFFLINE_META",
|
|
185
|
+
"NO_OFFLINE_TARBALL",
|
|
186
|
+
"LINKING_FAILED",
|
|
187
|
+
"UNEXPECTED_STORE",
|
|
188
|
+
"STORE_BREAKING_CHANGE",
|
|
189
|
+
"SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER",
|
|
190
|
+
"IGNORED_BUILDS",
|
|
191
|
+
"INVALID_PACKAGE_NAME",
|
|
192
|
+
"PREPARE_PACKAGE",
|
|
193
|
+
...SYSTEM_CODES
|
|
194
|
+
]);
|
|
195
|
+
var NPM_CODES = /* @__PURE__ */ new Set([
|
|
196
|
+
"ETARGET",
|
|
197
|
+
"ENOVERSIONS",
|
|
198
|
+
"ERESOLVE",
|
|
199
|
+
"EBADENGINE",
|
|
200
|
+
"EBADPLATFORM",
|
|
201
|
+
"ENOTSUP",
|
|
202
|
+
"EJSONPARSE",
|
|
203
|
+
"EUNSUPPORTEDPROTOCOL",
|
|
204
|
+
...SYSTEM_CODES
|
|
205
|
+
]);
|
|
206
|
+
var BUN_ERRORS = {
|
|
207
|
+
ConnectionRefused: "ECONNREFUSED",
|
|
208
|
+
ConnectionResetByPeer: "ECONNRESET",
|
|
209
|
+
ConnectionClosed: "ECONNRESET",
|
|
210
|
+
ConnectionTimedOut: "ETIMEDOUT",
|
|
211
|
+
Timeout: "ETIMEDOUT",
|
|
212
|
+
NetworkUnreachable: "ENETUNREACH",
|
|
213
|
+
HostUnreachable: "EHOSTUNREACH"
|
|
214
|
+
};
|
|
215
|
+
var HTTP_ERROR = /^[45]\d\d$/;
|
|
216
|
+
var READERS = [
|
|
217
|
+
(output) => {
|
|
218
|
+
const code2 = /\bERR_PNPM_([A-Z0-9_]+)/.exec(output)?.[1];
|
|
219
|
+
if (code2 === void 0) return void 0;
|
|
220
|
+
const known = PNPM_CODES.has(code2) || /^FETCH_[45]\d\d$/.test(code2);
|
|
221
|
+
return known ? `ERR_PNPM_${code2}` : "ERR_PNPM_OTHER";
|
|
222
|
+
},
|
|
223
|
+
(output) => {
|
|
224
|
+
const code2 = /^npm (?:ERR!|error) code (\S+)/m.exec(output)?.[1];
|
|
225
|
+
if (code2 === void 0) return void 0;
|
|
226
|
+
if (NPM_CODES.has(code2)) return code2;
|
|
227
|
+
if (/^E[45]\d\d$/.test(code2)) return code2;
|
|
228
|
+
return /^npm (?:ERR!|error) command failed/m.test(output) ? "ELIFECYCLE" : "NPM_OTHER";
|
|
229
|
+
},
|
|
230
|
+
(output) => [...output.matchAll(/\bYN(\d{4}):/g)].map((match) => Number(match[1])).filter((code2) => code2 > 1 && code2 < 100).map((code2) => `YN${String(code2).padStart(4, "0")}`).at(-1),
|
|
231
|
+
(output) => /^error:? (?:No version matching |Couldn't find any versions for )/m.test(output) ? "NO_MATCHING_VERSION" : void 0,
|
|
232
|
+
(output) => {
|
|
233
|
+
const status = /^error: GET \S+ - (\d{3})$/m.exec(output)?.[1];
|
|
234
|
+
return status && HTTP_ERROR.test(status) ? `HTTP_${status}` : void 0;
|
|
235
|
+
},
|
|
236
|
+
(output) => /^error Error: https?:\/\/\S+: Not found/m.test(output) ? "HTTP_404" : void 0,
|
|
237
|
+
(output) => /^error:? (?:\S+ script from .* exited with|Command failed with exit code) \d+/m.test(output) ? "ELIFECYCLE" : void 0,
|
|
238
|
+
(output) => {
|
|
239
|
+
const name = /^error: ([A-Za-z]+) /m.exec(output)?.[1];
|
|
240
|
+
return name !== void 0 && Object.hasOwn(BUN_ERRORS, name) ? BUN_ERRORS[name] : void 0;
|
|
241
|
+
},
|
|
242
|
+
(output) => SYSTEM_CODES.find((code2) => new RegExp(`\\b${code2}\\b`).test(output))
|
|
243
|
+
];
|
|
244
|
+
function installErrorCode(output, exitCode) {
|
|
245
|
+
for (const read of READERS) {
|
|
246
|
+
const code2 = read(output);
|
|
247
|
+
if (code2 !== void 0) return code2;
|
|
248
|
+
}
|
|
249
|
+
return /\bYN0001:/.test(output) ? "YN0001" : `EXIT_${exitCode}`;
|
|
250
|
+
}
|
|
126
251
|
function ciInstallCommand(pm, packageManagerSpec) {
|
|
127
252
|
switch (pm) {
|
|
128
253
|
case "pnpm":
|
|
@@ -305,6 +430,7 @@ function compatibilityIssues(spec) {
|
|
|
305
430
|
return issues;
|
|
306
431
|
}
|
|
307
432
|
var IncompatibleSpecError = class extends Error {
|
|
433
|
+
code = "INCOMPATIBLE_SPEC";
|
|
308
434
|
issues;
|
|
309
435
|
constructor(issues) {
|
|
310
436
|
super(
|
|
@@ -392,7 +518,7 @@ function yamlString(value) {
|
|
|
392
518
|
|
|
393
519
|
// src/kit/versions.ts
|
|
394
520
|
function scaffolderVersion() {
|
|
395
|
-
return false ? "0.0.0" : "0.
|
|
521
|
+
return false ? "0.0.0" : "0.6.1";
|
|
396
522
|
}
|
|
397
523
|
function workspaceVersions() {
|
|
398
524
|
return typeof define_COGITATOR_VERSIONS_default === "undefined" ? {} : define_COGITATOR_VERSIONS_default;
|
|
@@ -507,7 +633,7 @@ function emitPackageJson(project, extras) {
|
|
|
507
633
|
};
|
|
508
634
|
project.file("package.json", JSON.stringify(pkg, null, 2) + "\n");
|
|
509
635
|
}
|
|
510
|
-
var SKIPPED_BUILDS = ["cpu-features", "protobufjs", "ssh2"];
|
|
636
|
+
var SKIPPED_BUILDS = ["better-sqlite3", "cpu-features", "protobufjs", "ssh2"];
|
|
511
637
|
function pnpmWorkspaceYaml(nativeBuilds) {
|
|
512
638
|
const allowed = new Set(nativeBuilds);
|
|
513
639
|
const entries = [
|
|
@@ -1459,7 +1585,7 @@ function emitAssistant(project) {
|
|
|
1459
1585
|
// src/kit/features/deploy.ts
|
|
1460
1586
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs";
|
|
1461
1587
|
import { tmpdir } from "os";
|
|
1462
|
-
import { dirname, join } from "path";
|
|
1588
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
1463
1589
|
import { ArtifactGenerator, ProjectAnalyzer } from "@cogitator-ai/deploy";
|
|
1464
1590
|
var ROOT_ARTIFACTS = {
|
|
1465
1591
|
Dockerfile: "Dockerfile",
|
|
@@ -1469,14 +1595,14 @@ var ROOT_ARTIFACTS = {
|
|
|
1469
1595
|
function emitDeployArtifacts(project) {
|
|
1470
1596
|
const { spec } = project;
|
|
1471
1597
|
if (spec.deploy === "none") return;
|
|
1472
|
-
const dir = mkdtempSync(
|
|
1598
|
+
const dir = mkdtempSync(join2(tmpdir(), "cogitator-deploy-plan-"));
|
|
1473
1599
|
try {
|
|
1474
1600
|
for (const file of project.files.values()) {
|
|
1475
|
-
const target =
|
|
1476
|
-
mkdirSync(
|
|
1601
|
+
const target = join2(dir, file.path);
|
|
1602
|
+
mkdirSync(dirname2(target), { recursive: true });
|
|
1477
1603
|
writeFileSync(target, file.content);
|
|
1478
1604
|
}
|
|
1479
|
-
writeFileSync(
|
|
1605
|
+
writeFileSync(join2(dir, LOCKFILES[spec.packageManager]), "");
|
|
1480
1606
|
const analysis = new ProjectAnalyzer().analyze(dir, { target: spec.deploy }, { env: {} });
|
|
1481
1607
|
const { files } = new ArtifactGenerator().generate(analysis.deployConfig, analysis);
|
|
1482
1608
|
for (const artifact of files) {
|
|
@@ -5803,7 +5929,7 @@ function runCommand(command, args, options) {
|
|
|
5803
5929
|
cwd: options.cwd,
|
|
5804
5930
|
env: options.env ?? process.env,
|
|
5805
5931
|
stdio: options.inherit ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
5806
|
-
shell: process.platform === "win32",
|
|
5932
|
+
shell: options.shell ?? process.platform === "win32",
|
|
5807
5933
|
timeout: options.timeoutMs
|
|
5808
5934
|
});
|
|
5809
5935
|
let output = "";
|
|
@@ -5840,8 +5966,8 @@ function failure(error) {
|
|
|
5840
5966
|
}
|
|
5841
5967
|
async function writeFiles(directory, files) {
|
|
5842
5968
|
for (const file of files) {
|
|
5843
|
-
const target =
|
|
5844
|
-
await mkdir(
|
|
5969
|
+
const target = join3(directory, file.path);
|
|
5970
|
+
await mkdir(dirname3(target), { recursive: true });
|
|
5845
5971
|
await writeFile(
|
|
5846
5972
|
target,
|
|
5847
5973
|
file.content,
|
|
@@ -5856,15 +5982,15 @@ async function saveLock(directory, files) {
|
|
|
5856
5982
|
generator: `create-cogitator-app@${scaffolderVersion()}`,
|
|
5857
5983
|
files: Object.fromEntries(Object.entries(files).sort(([a], [b]) => a.localeCompare(b)))
|
|
5858
5984
|
};
|
|
5859
|
-
await mkdir(
|
|
5860
|
-
await writeFile(
|
|
5985
|
+
await mkdir(join3(directory, dirname3(LOCK_PATH)), { recursive: true });
|
|
5986
|
+
await writeFile(join3(directory, LOCK_PATH), JSON.stringify(lock, null, 2) + "\n");
|
|
5861
5987
|
}
|
|
5862
5988
|
async function hashFiles(directory, paths) {
|
|
5863
5989
|
const hashes = /* @__PURE__ */ new Map();
|
|
5864
5990
|
for (const path of paths) {
|
|
5865
5991
|
if (UNTRACKED.has(path) || path === LOCK_PATH) continue;
|
|
5866
|
-
const full =
|
|
5867
|
-
hashes.set(path,
|
|
5992
|
+
const full = join3(directory, path);
|
|
5993
|
+
hashes.set(path, existsSync2(full) ? hashContent(await readFile(full, "utf-8")) : void 0);
|
|
5868
5994
|
}
|
|
5869
5995
|
return hashes;
|
|
5870
5996
|
}
|
|
@@ -5882,8 +6008,8 @@ async function updateLock(directory, paths) {
|
|
|
5882
6008
|
await saveLock(directory, files);
|
|
5883
6009
|
}
|
|
5884
6010
|
function readLock(directory) {
|
|
5885
|
-
const path =
|
|
5886
|
-
if (!
|
|
6011
|
+
const path = join3(directory, LOCK_PATH);
|
|
6012
|
+
if (!existsSync2(path)) return void 0;
|
|
5887
6013
|
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
5888
6014
|
if (typeof parsed !== "object" || parsed === null || !("files" in parsed) || typeof parsed.files !== "object" || parsed.files === null) {
|
|
5889
6015
|
throw new Error(`${LOCK_PATH} is not a scaffold lock`);
|
|
@@ -5897,8 +6023,8 @@ function readLock(directory) {
|
|
|
5897
6023
|
}
|
|
5898
6024
|
function biomeBinary(directory) {
|
|
5899
6025
|
const name = process.platform === "win32" ? "biome.cmd" : "biome";
|
|
5900
|
-
const path =
|
|
5901
|
-
return
|
|
6026
|
+
const path = join3(directory, "node_modules", ".bin", name);
|
|
6027
|
+
return existsSync2(path) ? path : void 0;
|
|
5902
6028
|
}
|
|
5903
6029
|
async function formatProject(directory, paths = ["."]) {
|
|
5904
6030
|
const biome = biomeBinary(directory);
|
|
@@ -5916,7 +6042,7 @@ ${tail(result.output)}`));
|
|
|
5916
6042
|
}
|
|
5917
6043
|
async function enclosingGitRepo(directory) {
|
|
5918
6044
|
let dir = resolve(directory);
|
|
5919
|
-
while (!
|
|
6045
|
+
while (!existsSync2(dir)) dir = dirname3(dir);
|
|
5920
6046
|
try {
|
|
5921
6047
|
const result = await runCommand("git", ["rev-parse", "--show-toplevel"], { cwd: dir });
|
|
5922
6048
|
return result.code === 0 ? result.output.trim() : void 0;
|
|
@@ -5925,11 +6051,11 @@ async function enclosingGitRepo(directory) {
|
|
|
5925
6051
|
}
|
|
5926
6052
|
}
|
|
5927
6053
|
function enclosingWorkspace(directory) {
|
|
5928
|
-
let dir =
|
|
6054
|
+
let dir = dirname3(resolve(directory));
|
|
5929
6055
|
for (; ; ) {
|
|
5930
|
-
if (
|
|
5931
|
-
const manifest =
|
|
5932
|
-
if (
|
|
6056
|
+
if (existsSync2(join3(dir, "pnpm-workspace.yaml"))) return dir;
|
|
6057
|
+
const manifest = join3(dir, "package.json");
|
|
6058
|
+
if (existsSync2(manifest)) {
|
|
5933
6059
|
try {
|
|
5934
6060
|
const parsed = JSON.parse(readFileSync(manifest, "utf-8"));
|
|
5935
6061
|
if (typeof parsed === "object" && parsed !== null && "workspaces" in parsed) return dir;
|
|
@@ -5937,7 +6063,7 @@ function enclosingWorkspace(directory) {
|
|
|
5937
6063
|
return void 0;
|
|
5938
6064
|
}
|
|
5939
6065
|
}
|
|
5940
|
-
const parent =
|
|
6066
|
+
const parent = dirname3(dir);
|
|
5941
6067
|
if (parent === dir) return void 0;
|
|
5942
6068
|
dir = parent;
|
|
5943
6069
|
}
|
|
@@ -5980,15 +6106,28 @@ ${tail(commit.output)}`));
|
|
|
5980
6106
|
return { status: "done" };
|
|
5981
6107
|
}
|
|
5982
6108
|
async function installDependencies(directory, pm, inherit) {
|
|
5983
|
-
|
|
5984
|
-
|
|
6109
|
+
const invocation = packageManagerInvocation(pm, ["install"]);
|
|
6110
|
+
if (invocation.fromPath && !await hasCommand(pm, directory)) {
|
|
6111
|
+
return failure(
|
|
6112
|
+
new CodedError(
|
|
6113
|
+
"PM_NOT_FOUND",
|
|
6114
|
+
`${pm} is not installed, install it or pick another one with --pm`
|
|
6115
|
+
)
|
|
6116
|
+
);
|
|
5985
6117
|
}
|
|
5986
6118
|
try {
|
|
5987
|
-
const result = await runCommand(
|
|
6119
|
+
const result = await runCommand(invocation.command, invocation.args, {
|
|
6120
|
+
cwd: directory,
|
|
6121
|
+
inherit,
|
|
6122
|
+
...!invocation.fromPath && { shell: false }
|
|
6123
|
+
});
|
|
5988
6124
|
if (result.code !== 0) {
|
|
5989
6125
|
return failure(
|
|
5990
|
-
new
|
|
5991
|
-
|
|
6126
|
+
new CodedError(
|
|
6127
|
+
installErrorCode(result.output, result.code),
|
|
6128
|
+
`${installCommand(pm)} exited with ${result.code}:
|
|
6129
|
+
${tail(result.output)}`
|
|
6130
|
+
)
|
|
5992
6131
|
);
|
|
5993
6132
|
}
|
|
5994
6133
|
return { status: "done" };
|
|
@@ -5997,8 +6136,8 @@ ${tail(result.output)}`)
|
|
|
5997
6136
|
}
|
|
5998
6137
|
}
|
|
5999
6138
|
function assertEmptyDirectory(directory) {
|
|
6000
|
-
if (
|
|
6001
|
-
throw new
|
|
6139
|
+
if (existsSync2(directory) && readdirSync(directory).length > 0) {
|
|
6140
|
+
throw new CodedError("DIRECTORY_NOT_EMPTY", `${directory} already exists and is not empty`);
|
|
6002
6141
|
}
|
|
6003
6142
|
}
|
|
6004
6143
|
async function scaffold(spec, options) {
|
|
@@ -6056,9 +6195,9 @@ async function scaffold(spec, options) {
|
|
|
6056
6195
|
}
|
|
6057
6196
|
|
|
6058
6197
|
// src/kit/add.ts
|
|
6059
|
-
import { existsSync as
|
|
6198
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
6060
6199
|
import { mkdir as mkdir2, rm, writeFile as writeFile2 } from "fs/promises";
|
|
6061
|
-
import { dirname as
|
|
6200
|
+
import { dirname as dirname4, join as join4, resolve as resolve2 } from "path";
|
|
6062
6201
|
import { parseDocument as parseDocument2 } from "yaml";
|
|
6063
6202
|
|
|
6064
6203
|
// src/kit/diff.ts
|
|
@@ -6284,8 +6423,8 @@ var AddConflictError = class extends Error {
|
|
|
6284
6423
|
}
|
|
6285
6424
|
};
|
|
6286
6425
|
function readProject(directory) {
|
|
6287
|
-
const manifestPath =
|
|
6288
|
-
if (!
|
|
6426
|
+
const manifestPath = join4(directory, "package.json");
|
|
6427
|
+
if (!existsSync3(manifestPath)) {
|
|
6289
6428
|
throw new NotAScaffoldedProjectError(
|
|
6290
6429
|
`There is no package.json in ${directory}: run cogitator add in the root of the project`
|
|
6291
6430
|
);
|
|
@@ -6486,8 +6625,8 @@ function decide(inputs) {
|
|
|
6486
6625
|
return structuredDecision(inputs) ?? textDecision(inputs);
|
|
6487
6626
|
}
|
|
6488
6627
|
function readText(directory, path) {
|
|
6489
|
-
const full =
|
|
6490
|
-
return
|
|
6628
|
+
const full = join4(directory, path);
|
|
6629
|
+
return existsSync3(full) ? readFileSync2(full, "utf-8") : void 0;
|
|
6491
6630
|
}
|
|
6492
6631
|
function fileMap(plan) {
|
|
6493
6632
|
return new Map(
|
|
@@ -6587,12 +6726,12 @@ async function addToProject(directory, changes, options = {}) {
|
|
|
6587
6726
|
const written = [];
|
|
6588
6727
|
const deleted = [];
|
|
6589
6728
|
for (const change of plan.changes) {
|
|
6590
|
-
const target =
|
|
6729
|
+
const target = join4(plan.directory, change.path);
|
|
6591
6730
|
if (change.kind === "delete") {
|
|
6592
6731
|
await rm(target, { force: true });
|
|
6593
6732
|
deleted.push(change.path);
|
|
6594
6733
|
} else {
|
|
6595
|
-
await mkdir2(
|
|
6734
|
+
await mkdir2(dirname4(target), { recursive: true });
|
|
6596
6735
|
await writeFile2(target, change.content ?? "");
|
|
6597
6736
|
written.push(change.path);
|
|
6598
6737
|
}
|
|
@@ -6669,14 +6808,16 @@ function findExample(query, index = examples()) {
|
|
|
6669
6808
|
const short = index.filter((example) => example.name.split("/")[1] === normalized);
|
|
6670
6809
|
if (short.length === 1) return short[0];
|
|
6671
6810
|
if (short.length > 1) {
|
|
6672
|
-
throw new
|
|
6811
|
+
throw new CodedError(
|
|
6812
|
+
"AMBIGUOUS_EXAMPLE",
|
|
6673
6813
|
`"${query}" is in more than one category: ${short.map((example) => example.name).join(", ")}`
|
|
6674
6814
|
);
|
|
6675
6815
|
}
|
|
6676
6816
|
const names = index.map((example) => example.name);
|
|
6677
6817
|
const match = closest(normalized, [...names, ...names.map((name) => name.split("/")[1])]);
|
|
6678
6818
|
const suggestion2 = match ? ` Did you mean "${names.find((name) => name.endsWith(match)) ?? match}"?` : "";
|
|
6679
|
-
throw new
|
|
6819
|
+
throw new CodedError(
|
|
6820
|
+
"UNKNOWN_EXAMPLE",
|
|
6680
6821
|
`There is no example "${query}".${suggestion2} Run with --list-examples to see them all.`
|
|
6681
6822
|
);
|
|
6682
6823
|
}
|
|
@@ -6838,20 +6979,26 @@ async function fetchExampleFiles(plan, fetchImpl = fetch) {
|
|
|
6838
6979
|
const url = exampleFileUrl(plan.ref, path);
|
|
6839
6980
|
const response = await fetchImpl(url, { signal: AbortSignal.timeout(3e4) });
|
|
6840
6981
|
if (response.status === 404) {
|
|
6841
|
-
throw new
|
|
6982
|
+
throw new CodedError(
|
|
6983
|
+
"HTTP_404",
|
|
6842
6984
|
`examples/${path} is not at ${plan.ref} of ${EXAMPLES_REPO.owner}/${EXAMPLES_REPO.repo}. Pass --example ${plan.example.name}#main for the main branch.`
|
|
6843
6985
|
);
|
|
6844
6986
|
}
|
|
6845
|
-
if (!response.ok)
|
|
6987
|
+
if (!response.ok) {
|
|
6988
|
+
throw new CodedError(
|
|
6989
|
+
`HTTP_${response.status}`,
|
|
6990
|
+
`Could not download ${url}: HTTP ${response.status}`
|
|
6991
|
+
);
|
|
6992
|
+
}
|
|
6846
6993
|
return { path: exampleTarget(path), content: await response.text() };
|
|
6847
6994
|
})
|
|
6848
6995
|
);
|
|
6849
6996
|
}
|
|
6850
6997
|
|
|
6851
6998
|
// src/kit/remote.ts
|
|
6852
|
-
import { existsSync as
|
|
6999
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
6853
7000
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
6854
|
-
import { join as
|
|
7001
|
+
import { join as join5 } from "path";
|
|
6855
7002
|
import { Readable } from "stream";
|
|
6856
7003
|
import { pipeline } from "stream/promises";
|
|
6857
7004
|
import { x as extract } from "tar";
|
|
@@ -6879,22 +7026,28 @@ async function downloadTemplate(template, directory, options = {}) {
|
|
|
6879
7026
|
signal: AbortSignal.timeout(12e4)
|
|
6880
7027
|
});
|
|
6881
7028
|
if (response.status === 404) {
|
|
6882
|
-
throw new
|
|
7029
|
+
throw new CodedError(
|
|
7030
|
+
"HTTP_404",
|
|
6883
7031
|
`${describeTemplate(template)} was not found: check the repository and the ref${options.token ? "" : ", and set GITHUB_TOKEN for a private repository"}`
|
|
6884
7032
|
);
|
|
6885
7033
|
}
|
|
6886
7034
|
if (!response.ok) {
|
|
6887
|
-
throw new
|
|
7035
|
+
throw new CodedError(
|
|
7036
|
+
`HTTP_${response.status}`,
|
|
7037
|
+
`Could not download ${describeTemplate(template)}: HTTP ${response.status}`
|
|
7038
|
+
);
|
|
6888
7039
|
}
|
|
6889
7040
|
const length = Number(response.headers.get("content-length") ?? 0);
|
|
6890
7041
|
if (length > MAX_ARCHIVE_BYTES) {
|
|
6891
|
-
throw new
|
|
7042
|
+
throw new CodedError(
|
|
7043
|
+
"TEMPLATE_TOO_LARGE",
|
|
6892
7044
|
`${describeTemplate(template)} is larger than ${MAX_ARCHIVE_BYTES / 1024 / 1024} MB`
|
|
6893
7045
|
);
|
|
6894
7046
|
}
|
|
6895
7047
|
const archive = Buffer.from(await response.arrayBuffer());
|
|
6896
7048
|
if (archive.length > MAX_ARCHIVE_BYTES) {
|
|
6897
|
-
throw new
|
|
7049
|
+
throw new CodedError(
|
|
7050
|
+
"TEMPLATE_TOO_LARGE",
|
|
6898
7051
|
`${describeTemplate(template)} is larger than ${MAX_ARCHIVE_BYTES / 1024 / 1024} MB`
|
|
6899
7052
|
);
|
|
6900
7053
|
}
|
|
@@ -6924,17 +7077,19 @@ async function downloadTemplate(template, directory, options = {}) {
|
|
|
6924
7077
|
})
|
|
6925
7078
|
);
|
|
6926
7079
|
if (files.length === 0) {
|
|
6927
|
-
throw new
|
|
7080
|
+
throw new CodedError(
|
|
7081
|
+
"TEMPLATE_EMPTY",
|
|
6928
7082
|
template.path ? `${describeTemplate(template)} has no files under ${template.path}` : `${describeTemplate(template)} is empty`
|
|
6929
7083
|
);
|
|
6930
7084
|
}
|
|
6931
7085
|
return { files: files.sort(), skipped: skipped.sort() };
|
|
6932
7086
|
}
|
|
6933
7087
|
function prepareTemplate(directory, options) {
|
|
6934
|
-
const lockfile = PACKAGE_MANAGERS.find((pm) =>
|
|
6935
|
-
const manifestPath =
|
|
6936
|
-
if (!
|
|
6937
|
-
throw new
|
|
7088
|
+
const lockfile = PACKAGE_MANAGERS.find((pm) => existsSync4(join5(directory, LOCKFILES[pm])));
|
|
7089
|
+
const manifestPath = join5(directory, "package.json");
|
|
7090
|
+
if (!existsSync4(manifestPath)) {
|
|
7091
|
+
throw new CodedError(
|
|
7092
|
+
"TEMPLATE_NO_MANIFEST",
|
|
6938
7093
|
`The template has no package.json at its root (it has ${readdirSync2(directory).slice(0, 8).join(", ")}): point --template at the project directory`
|
|
6939
7094
|
);
|
|
6940
7095
|
}
|
|
@@ -6962,7 +7117,8 @@ function prepareTemplate(directory, options) {
|
|
|
6962
7117
|
}
|
|
6963
7118
|
}
|
|
6964
7119
|
if (unresolvable.length > 0) {
|
|
6965
|
-
throw new
|
|
7120
|
+
throw new CodedError(
|
|
7121
|
+
"TEMPLATE_WORKSPACE_DEPENDENCIES",
|
|
6966
7122
|
`The template depends on packages of its own monorepo, which cannot be installed outside it: ${unresolvable.join(", ")}`
|
|
6967
7123
|
);
|
|
6968
7124
|
}
|
|
@@ -6971,9 +7127,9 @@ function prepareTemplate(directory, options) {
|
|
|
6971
7127
|
}
|
|
6972
7128
|
|
|
6973
7129
|
// src/kit/starter.ts
|
|
6974
|
-
import { existsSync as
|
|
7130
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
|
|
6975
7131
|
import { mkdir as mkdir4, readdir, rm as rm2 } from "fs/promises";
|
|
6976
|
-
import { join as
|
|
7132
|
+
import { join as join6, relative, resolve as resolve3 } from "path";
|
|
6977
7133
|
async function finish2(directory, packageManager, options) {
|
|
6978
7134
|
const log2 = options.log ?? silentLogger;
|
|
6979
7135
|
let install = { status: "skipped", reason: "install was turned off" };
|
|
@@ -7044,7 +7200,7 @@ async function createFromTemplate(template, options) {
|
|
|
7044
7200
|
const log2 = options.log ?? silentLogger;
|
|
7045
7201
|
const directory = resolve3(options.directory);
|
|
7046
7202
|
assertEmptyDirectory(directory);
|
|
7047
|
-
const existed =
|
|
7203
|
+
const existed = existsSync5(directory);
|
|
7048
7204
|
log2.start(`Downloading ${describeTemplate(template)}`);
|
|
7049
7205
|
let downloaded;
|
|
7050
7206
|
let prepared;
|
|
@@ -7058,7 +7214,7 @@ async function createFromTemplate(template, options) {
|
|
|
7058
7214
|
log2.fail(`Could not use ${describeTemplate(template)}`);
|
|
7059
7215
|
if (existed) {
|
|
7060
7216
|
for (const entry of await readdir(directory)) {
|
|
7061
|
-
await rm2(
|
|
7217
|
+
await rm2(join6(directory, entry), { recursive: true, force: true });
|
|
7062
7218
|
}
|
|
7063
7219
|
} else {
|
|
7064
7220
|
await rm2(directory, { recursive: true, force: true });
|
|
@@ -7077,7 +7233,7 @@ async function createFromTemplate(template, options) {
|
|
|
7077
7233
|
...downloaded.skipped.length > 0 ? [`Left out links and special files: ${downloaded.skipped.join(", ")}`] : []
|
|
7078
7234
|
];
|
|
7079
7235
|
const { install, git } = await finish2(directory, packageManager, options);
|
|
7080
|
-
const manifest = JSON.parse(readFileSync4(
|
|
7236
|
+
const manifest = JSON.parse(readFileSync4(join6(directory, "package.json"), "utf-8"));
|
|
7081
7237
|
return {
|
|
7082
7238
|
directory,
|
|
7083
7239
|
source: describeTemplate(template),
|
|
@@ -7090,7 +7246,7 @@ async function createFromTemplate(template, options) {
|
|
|
7090
7246
|
packageManager,
|
|
7091
7247
|
manifest.scripts ?? {},
|
|
7092
7248
|
install.status === "done",
|
|
7093
|
-
|
|
7249
|
+
existsSync5(join6(directory, ".env.example"))
|
|
7094
7250
|
),
|
|
7095
7251
|
notes
|
|
7096
7252
|
};
|
|
@@ -7393,9 +7549,10 @@ function describeKeyCheck(envKey, check) {
|
|
|
7393
7549
|
}
|
|
7394
7550
|
|
|
7395
7551
|
// src/kit/telemetry.ts
|
|
7396
|
-
import { existsSync as
|
|
7552
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
7397
7553
|
import { homedir } from "os";
|
|
7398
|
-
import { join as
|
|
7554
|
+
import { join as join7 } from "path";
|
|
7555
|
+
import { z as z2 } from "zod";
|
|
7399
7556
|
var TELEMETRY_HOST = "https://analytics.el1fe.com";
|
|
7400
7557
|
var TELEMETRY_DOCS = "https://cogitator.app/docs/getting-started/telemetry";
|
|
7401
7558
|
var SEND_TIMEOUT_MS = 1500;
|
|
@@ -7411,9 +7568,41 @@ var PAYLOAD_FIELDS = [
|
|
|
7411
7568
|
"packageManager",
|
|
7412
7569
|
"node",
|
|
7413
7570
|
"os",
|
|
7414
|
-
"outcome"
|
|
7571
|
+
"outcome",
|
|
7572
|
+
"failedStep",
|
|
7573
|
+
"errorCode"
|
|
7415
7574
|
];
|
|
7416
|
-
|
|
7575
|
+
var VALUE = z2.string().regex(/^[\w.,-]{0,100}$/);
|
|
7576
|
+
var PAYLOAD_SCHEMA = z2.strictObject({
|
|
7577
|
+
version: VALUE,
|
|
7578
|
+
preset: VALUE,
|
|
7579
|
+
provider: VALUE,
|
|
7580
|
+
memory: VALUE,
|
|
7581
|
+
features: VALUE,
|
|
7582
|
+
packageManager: VALUE,
|
|
7583
|
+
node: VALUE,
|
|
7584
|
+
os: VALUE,
|
|
7585
|
+
outcome: z2.enum(["success", "failure"]),
|
|
7586
|
+
failedStep: z2.enum(["none", "create", "install"]),
|
|
7587
|
+
errorCode: VALUE
|
|
7588
|
+
});
|
|
7589
|
+
var SAFE_CODE = /^[A-Z][A-Z0-9_]{1,63}$/;
|
|
7590
|
+
function telemetryErrorCode(error) {
|
|
7591
|
+
let kind;
|
|
7592
|
+
let current = error;
|
|
7593
|
+
for (let depth = 0; depth < 5 && typeof current === "object" && current !== null; depth++) {
|
|
7594
|
+
if ("code" in current && typeof current.code === "string" && SAFE_CODE.test(current.code))
|
|
7595
|
+
return current.code;
|
|
7596
|
+
if (!kind && current instanceof Error && current.name !== "Error" && /^[A-Za-z]+$/.test(current.name))
|
|
7597
|
+
kind = constantCase(current.name);
|
|
7598
|
+
current = "cause" in current ? current.cause : void 0;
|
|
7599
|
+
}
|
|
7600
|
+
return kind ?? "UNKNOWN";
|
|
7601
|
+
}
|
|
7602
|
+
function installFailure(result) {
|
|
7603
|
+
return result.install.status === "failed" ? { step: "install", error: result.install.error } : void 0;
|
|
7604
|
+
}
|
|
7605
|
+
function payloadFor(spec, failure2, kind = "generated") {
|
|
7417
7606
|
return {
|
|
7418
7607
|
version: scaffolderVersion(),
|
|
7419
7608
|
preset: kind !== "generated" ? kind : spec?.preset ?? "custom",
|
|
@@ -7423,7 +7612,9 @@ function payloadFor(spec, outcome, kind = "generated") {
|
|
|
7423
7612
|
packageManager: spec?.packageManager ?? "unknown",
|
|
7424
7613
|
node: process.versions.node.split(".")[0],
|
|
7425
7614
|
os: process.platform,
|
|
7426
|
-
outcome
|
|
7615
|
+
outcome: failure2 ? "failure" : "success",
|
|
7616
|
+
failedStep: failure2?.step ?? "none",
|
|
7617
|
+
errorCode: failure2 ? telemetryErrorCode(failure2.error) : "none"
|
|
7427
7618
|
};
|
|
7428
7619
|
}
|
|
7429
7620
|
function telemetryDisabledReason(options) {
|
|
@@ -7441,12 +7632,12 @@ function telemetryDisabledReason(options) {
|
|
|
7441
7632
|
return void 0;
|
|
7442
7633
|
}
|
|
7443
7634
|
function configDir(env) {
|
|
7444
|
-
if (process.platform === "win32" && env.APPDATA) return
|
|
7445
|
-
return
|
|
7635
|
+
if (process.platform === "win32" && env.APPDATA) return join7(env.APPDATA, "cogitator");
|
|
7636
|
+
return join7(env.XDG_CONFIG_HOME || join7(homedir(), ".config"), "cogitator");
|
|
7446
7637
|
}
|
|
7447
7638
|
function firstRunNotice(env = process.env) {
|
|
7448
|
-
const marker =
|
|
7449
|
-
if (
|
|
7639
|
+
const marker = join7(configDir(env), "telemetry-notice");
|
|
7640
|
+
if (existsSync6(marker)) return void 0;
|
|
7450
7641
|
try {
|
|
7451
7642
|
mkdirSync2(configDir(env), { recursive: true });
|
|
7452
7643
|
writeFileSync3(marker, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
@@ -7454,7 +7645,7 @@ function firstRunNotice(env = process.env) {
|
|
|
7454
7645
|
} catch {
|
|
7455
7646
|
return void 0;
|
|
7456
7647
|
}
|
|
7457
|
-
return `Cogitator sends one anonymous event per scaffolded project (version, preset, provider, memory, add-ons, package manager, Node major, OS). Turn it off with --no-telemetry or COGITATOR_TELEMETRY_DISABLED=1: ${TELEMETRY_DOCS}`;
|
|
7648
|
+
return `Cogitator sends one anonymous event per scaffolded project (version, preset, provider, memory, add-ons, package manager, Node major, OS, and where and why it failed if it did). Turn it off with --no-telemetry or COGITATOR_TELEMETRY_DISABLED=1: ${TELEMETRY_DOCS}`;
|
|
7458
7649
|
}
|
|
7459
7650
|
var UA_PLATFORMS = {
|
|
7460
7651
|
darwin: "Macintosh; Intel Mac OS X 10_15_7",
|
|
@@ -7467,14 +7658,17 @@ function telemetryUserAgent(payload) {
|
|
|
7467
7658
|
async function sendTelemetry(payload, options = {}) {
|
|
7468
7659
|
const website = options.websiteId ?? telemetryWebsiteId();
|
|
7469
7660
|
if (!website) return false;
|
|
7661
|
+
const parsed = PAYLOAD_SCHEMA.safeParse(payload);
|
|
7662
|
+
if (!parsed.success) return false;
|
|
7663
|
+
const data = parsed.data;
|
|
7470
7664
|
const body = {
|
|
7471
7665
|
type: "event",
|
|
7472
7666
|
payload: {
|
|
7473
7667
|
website,
|
|
7474
7668
|
hostname: "create-cogitator-app",
|
|
7475
|
-
url: `/scaffold/${
|
|
7669
|
+
url: `/scaffold/${data.preset}`,
|
|
7476
7670
|
name: "scaffold",
|
|
7477
|
-
data
|
|
7671
|
+
data
|
|
7478
7672
|
}
|
|
7479
7673
|
};
|
|
7480
7674
|
try {
|
|
@@ -7482,7 +7676,7 @@ async function sendTelemetry(payload, options = {}) {
|
|
|
7482
7676
|
method: "POST",
|
|
7483
7677
|
headers: {
|
|
7484
7678
|
"content-type": "application/json",
|
|
7485
|
-
"user-agent": telemetryUserAgent(
|
|
7679
|
+
"user-agent": telemetryUserAgent(data)
|
|
7486
7680
|
},
|
|
7487
7681
|
body: JSON.stringify(body),
|
|
7488
7682
|
signal: AbortSignal.timeout(options.timeoutMs ?? SEND_TIMEOUT_MS)
|
|
@@ -7501,6 +7695,7 @@ import pc2 from "picocolors";
|
|
|
7501
7695
|
// src/cli/args.ts
|
|
7502
7696
|
import { parseArgs } from "util";
|
|
7503
7697
|
var CliError = class extends Error {
|
|
7698
|
+
code = "INVALID_ARGS";
|
|
7504
7699
|
constructor(message) {
|
|
7505
7700
|
super(message);
|
|
7506
7701
|
this.name = "CliError";
|
|
@@ -7764,16 +7959,16 @@ function exampleList() {
|
|
|
7764
7959
|
}
|
|
7765
7960
|
|
|
7766
7961
|
// src/cli/interactive.ts
|
|
7767
|
-
import { existsSync as
|
|
7962
|
+
import { existsSync as existsSync7 } from "fs";
|
|
7768
7963
|
import { homedir as homedir2 } from "os";
|
|
7769
|
-
import { join as
|
|
7964
|
+
import { join as join8 } from "path";
|
|
7770
7965
|
import * as p from "@clack/prompts";
|
|
7771
7966
|
|
|
7772
7967
|
// src/cli/resolve.ts
|
|
7773
|
-
import { basename, resolve as resolve4 } from "path";
|
|
7968
|
+
import { basename as basename2, resolve as resolve4 } from "path";
|
|
7774
7969
|
var DEFAULT_DIRECTORY = "my-agents";
|
|
7775
7970
|
function projectNameFromDirectory(directory, cwd = process.cwd()) {
|
|
7776
|
-
return
|
|
7971
|
+
return basename2(resolve4(cwd, directory.trim()));
|
|
7777
7972
|
}
|
|
7778
7973
|
function resolveDirectory(directory, cwd = process.cwd()) {
|
|
7779
7974
|
const name = projectNameFromDirectory(directory, cwd);
|
|
@@ -7829,7 +8024,7 @@ function detectCodingAgents(home = homedir2()) {
|
|
|
7829
8024
|
codex: ".codex"
|
|
7830
8025
|
};
|
|
7831
8026
|
return CODING_AGENT_CHOICES.map((choice) => choice.value).filter(
|
|
7832
|
-
(agent) =>
|
|
8027
|
+
(agent) => existsSync7(join8(home, markers[agent]))
|
|
7833
8028
|
);
|
|
7834
8029
|
}
|
|
7835
8030
|
async function askDirectory() {
|
|
@@ -8198,24 +8393,21 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
8198
8393
|
if (args.example !== void 0 || args.remote) {
|
|
8199
8394
|
const kind = args.example !== void 0 ? "example" : "template";
|
|
8200
8395
|
try {
|
|
8201
|
-
const
|
|
8202
|
-
if (
|
|
8203
|
-
await report(
|
|
8204
|
-
|
|
8205
|
-
deps,
|
|
8206
|
-
payloadFor(void 0, code2 === 0 ? "success" : "failure", kind)
|
|
8207
|
-
);
|
|
8208
|
-
return code2;
|
|
8396
|
+
const created = await runStarter(args, interactive, io, deps);
|
|
8397
|
+
if (created)
|
|
8398
|
+
await report(telemetry, deps, payloadFor(void 0, installFailure(created), kind));
|
|
8399
|
+
return 0;
|
|
8209
8400
|
} catch (error) {
|
|
8210
8401
|
if (error instanceof CancelledError) {
|
|
8211
8402
|
p2.cancel("Cancelled, nothing was created.");
|
|
8212
8403
|
return 1;
|
|
8213
8404
|
}
|
|
8214
|
-
await report(telemetry, deps, payloadFor(void 0, "
|
|
8405
|
+
await report(telemetry, deps, payloadFor(void 0, { step: "create", error }, kind));
|
|
8215
8406
|
return reportError(error, args.json, io);
|
|
8216
8407
|
}
|
|
8217
8408
|
}
|
|
8218
8409
|
let resolvedSpec;
|
|
8410
|
+
let reported = false;
|
|
8219
8411
|
try {
|
|
8220
8412
|
if (interactive) {
|
|
8221
8413
|
io.stderr(banner(version));
|
|
@@ -8249,11 +8441,8 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
8249
8441
|
git: args.git ?? true,
|
|
8250
8442
|
log: args.json ? void 0 : clackLogger()
|
|
8251
8443
|
});
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
deps,
|
|
8255
|
-
payloadFor(result.plan.spec, result.install.status === "failed" ? "failure" : "success")
|
|
8256
|
-
);
|
|
8444
|
+
reported = true;
|
|
8445
|
+
await report(telemetry, deps, payloadFor(result.plan.spec, installFailure(result)));
|
|
8257
8446
|
const modelReady = result.plan.spec.provider === "ollama" ? await prepareOllama(result.plan, interactive) : true;
|
|
8258
8447
|
const key = envKey ? args.apiKey ?? process.env[envKey] : void 0;
|
|
8259
8448
|
const provider = result.plan.spec.provider;
|
|
@@ -8300,7 +8489,8 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
8300
8489
|
p2.cancel("Cancelled, nothing was created.");
|
|
8301
8490
|
return 1;
|
|
8302
8491
|
}
|
|
8303
|
-
if (resolvedSpec
|
|
8492
|
+
if (resolvedSpec && !reported)
|
|
8493
|
+
await report(telemetry, deps, payloadFor(resolvedSpec, { step: "create", error }));
|
|
8304
8494
|
return reportError(error, args.json, io);
|
|
8305
8495
|
}
|
|
8306
8496
|
}
|
|
@@ -8379,7 +8569,7 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
8379
8569
|
].join("\n")
|
|
8380
8570
|
);
|
|
8381
8571
|
}
|
|
8382
|
-
return 0;
|
|
8572
|
+
return void 0;
|
|
8383
8573
|
}
|
|
8384
8574
|
result = await createFromExample(plan, options);
|
|
8385
8575
|
} else if (args.remote) {
|
|
@@ -8390,7 +8580,7 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
8390
8580
|
` : `${pc2.bold("Dry run:")} nothing was written. ${message}.
|
|
8391
8581
|
`
|
|
8392
8582
|
);
|
|
8393
|
-
return 0;
|
|
8583
|
+
return void 0;
|
|
8394
8584
|
}
|
|
8395
8585
|
result = await createFromTemplate(args.remote, {
|
|
8396
8586
|
...options,
|
|
@@ -8418,13 +8608,13 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
8418
8608
|
)}
|
|
8419
8609
|
`
|
|
8420
8610
|
);
|
|
8421
|
-
return
|
|
8611
|
+
return result;
|
|
8422
8612
|
}
|
|
8423
8613
|
for (const note of result.notes) p2.log.info(note);
|
|
8424
8614
|
if (interactive) p2.outro(starterOutro(result));
|
|
8425
8615
|
else io.stderr(`${starterOutro(result)}
|
|
8426
8616
|
`);
|
|
8427
|
-
return
|
|
8617
|
+
return result;
|
|
8428
8618
|
}
|
|
8429
8619
|
function reportError(error, json, io) {
|
|
8430
8620
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8453,6 +8643,7 @@ export {
|
|
|
8453
8643
|
CHANNEL_CHOICES,
|
|
8454
8644
|
CODING_AGENTS,
|
|
8455
8645
|
CODING_AGENT_CHOICES,
|
|
8646
|
+
CodedError,
|
|
8456
8647
|
DEFAULT_OLLAMA_URL,
|
|
8457
8648
|
DEFAULT_PRESET,
|
|
8458
8649
|
DEPLOY_CHOICES,
|
|
@@ -8510,6 +8701,8 @@ export {
|
|
|
8510
8701
|
hasOllamaModel,
|
|
8511
8702
|
hashContent,
|
|
8512
8703
|
installCommand,
|
|
8704
|
+
installErrorCode,
|
|
8705
|
+
installFailure,
|
|
8513
8706
|
knownCogitatorVersions,
|
|
8514
8707
|
listOllamaModels,
|
|
8515
8708
|
modelChoices,
|
|
@@ -8536,6 +8729,7 @@ export {
|
|
|
8536
8729
|
sendTelemetry,
|
|
8537
8730
|
silentLogger,
|
|
8538
8731
|
telemetryDisabledReason,
|
|
8732
|
+
telemetryErrorCode,
|
|
8539
8733
|
telemetryWebsiteId,
|
|
8540
8734
|
templateArchive,
|
|
8541
8735
|
unifiedDiff,
|