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/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// <define:__COGITATOR_EXAMPLES__>
|
|
4
|
-
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" }];
|
|
4
|
+
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" }];
|
|
5
5
|
|
|
6
6
|
// <define:__COGITATOR_VERSIONS__>
|
|
7
|
-
var define_COGITATOR_VERSIONS_default = { "@cogitator-ai/a2a": "0.8.
|
|
7
|
+
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" };
|
|
8
8
|
|
|
9
9
|
// src/cli/main.ts
|
|
10
10
|
import { relative as relative2 } from "path";
|
|
@@ -259,6 +259,7 @@ function compatibilityIssues(spec) {
|
|
|
259
259
|
return issues;
|
|
260
260
|
}
|
|
261
261
|
var IncompatibleSpecError = class extends Error {
|
|
262
|
+
code = "INCOMPATIBLE_SPEC";
|
|
262
263
|
issues;
|
|
263
264
|
constructor(issues) {
|
|
264
265
|
super(
|
|
@@ -416,6 +417,8 @@ async function pullOllamaModel(baseUrl, model, onStatus) {
|
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
// src/kit/package-manager.ts
|
|
420
|
+
import { existsSync } from "fs";
|
|
421
|
+
import { basename, dirname, join } from "path";
|
|
419
422
|
function detectPackageManager(userAgent = process.env.npm_config_user_agent) {
|
|
420
423
|
const name = userAgent?.split("/")[0];
|
|
421
424
|
return PACKAGE_MANAGERS.find((pm) => pm === name) ?? "pnpm";
|
|
@@ -435,9 +438,117 @@ function execCommand(pm, bin) {
|
|
|
435
438
|
if (pm === "bun") return `bunx ${bin}`;
|
|
436
439
|
return `${pm} exec ${bin}`;
|
|
437
440
|
}
|
|
441
|
+
function launchingPackageManager(pm, env) {
|
|
442
|
+
const execPath = env.npm_execpath;
|
|
443
|
+
if (!execPath || env.npm_config_user_agent?.split("/")[0] !== pm) return void 0;
|
|
444
|
+
const path = pm === "npm" && basename(execPath) === "npx-cli.js" ? join(dirname(execPath), "npm-cli.js") : execPath;
|
|
445
|
+
return existsSync(path) ? path : void 0;
|
|
446
|
+
}
|
|
447
|
+
function packageManagerInvocation(pm, args, env = process.env) {
|
|
448
|
+
const launcher = launchingPackageManager(pm, env);
|
|
449
|
+
if (!launcher) return { command: pm, args, fromPath: true };
|
|
450
|
+
return /\.[cm]?js$/.test(launcher) ? { command: process.execPath, args: [launcher, ...args], fromPath: false } : { command: launcher, args, fromPath: false };
|
|
451
|
+
}
|
|
438
452
|
function installCommand(pm) {
|
|
439
453
|
return `${pm} install`;
|
|
440
454
|
}
|
|
455
|
+
var SYSTEM_CODES = [
|
|
456
|
+
"ECONNREFUSED",
|
|
457
|
+
"ECONNRESET",
|
|
458
|
+
"ENOTFOUND",
|
|
459
|
+
"EAI_AGAIN",
|
|
460
|
+
"ETIMEDOUT",
|
|
461
|
+
"ENETUNREACH",
|
|
462
|
+
"EHOSTUNREACH",
|
|
463
|
+
"EPROTO",
|
|
464
|
+
"EACCES",
|
|
465
|
+
"EPERM",
|
|
466
|
+
"ENOSPC",
|
|
467
|
+
"ENOENT",
|
|
468
|
+
"EINTEGRITY",
|
|
469
|
+
"ELIFECYCLE"
|
|
470
|
+
];
|
|
471
|
+
var PNPM_CODES = /* @__PURE__ */ new Set([
|
|
472
|
+
"NO_MATCHING_VERSION",
|
|
473
|
+
"NO_MATURE_MATCHING_VERSION",
|
|
474
|
+
"NO_VERSIONS",
|
|
475
|
+
"META_FETCH_FAIL",
|
|
476
|
+
"TARBALL_INTEGRITY",
|
|
477
|
+
"BAD_TARBALL_SIZE",
|
|
478
|
+
"PEER_DEP_ISSUES",
|
|
479
|
+
"UNSUPPORTED_ENGINE",
|
|
480
|
+
"UNSUPPORTED_PLATFORM",
|
|
481
|
+
"OUTDATED_LOCKFILE",
|
|
482
|
+
"BROKEN_LOCKFILE",
|
|
483
|
+
"LOCKFILE_BREAKING_CHANGE",
|
|
484
|
+
"LOCKFILE_MISSING_DEPENDENCY",
|
|
485
|
+
"NO_OFFLINE_META",
|
|
486
|
+
"NO_OFFLINE_TARBALL",
|
|
487
|
+
"LINKING_FAILED",
|
|
488
|
+
"UNEXPECTED_STORE",
|
|
489
|
+
"STORE_BREAKING_CHANGE",
|
|
490
|
+
"SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER",
|
|
491
|
+
"IGNORED_BUILDS",
|
|
492
|
+
"INVALID_PACKAGE_NAME",
|
|
493
|
+
"PREPARE_PACKAGE",
|
|
494
|
+
...SYSTEM_CODES
|
|
495
|
+
]);
|
|
496
|
+
var NPM_CODES = /* @__PURE__ */ new Set([
|
|
497
|
+
"ETARGET",
|
|
498
|
+
"ENOVERSIONS",
|
|
499
|
+
"ERESOLVE",
|
|
500
|
+
"EBADENGINE",
|
|
501
|
+
"EBADPLATFORM",
|
|
502
|
+
"ENOTSUP",
|
|
503
|
+
"EJSONPARSE",
|
|
504
|
+
"EUNSUPPORTEDPROTOCOL",
|
|
505
|
+
...SYSTEM_CODES
|
|
506
|
+
]);
|
|
507
|
+
var BUN_ERRORS = {
|
|
508
|
+
ConnectionRefused: "ECONNREFUSED",
|
|
509
|
+
ConnectionResetByPeer: "ECONNRESET",
|
|
510
|
+
ConnectionClosed: "ECONNRESET",
|
|
511
|
+
ConnectionTimedOut: "ETIMEDOUT",
|
|
512
|
+
Timeout: "ETIMEDOUT",
|
|
513
|
+
NetworkUnreachable: "ENETUNREACH",
|
|
514
|
+
HostUnreachable: "EHOSTUNREACH"
|
|
515
|
+
};
|
|
516
|
+
var HTTP_ERROR = /^[45]\d\d$/;
|
|
517
|
+
var READERS = [
|
|
518
|
+
(output) => {
|
|
519
|
+
const code2 = /\bERR_PNPM_([A-Z0-9_]+)/.exec(output)?.[1];
|
|
520
|
+
if (code2 === void 0) return void 0;
|
|
521
|
+
const known = PNPM_CODES.has(code2) || /^FETCH_[45]\d\d$/.test(code2);
|
|
522
|
+
return known ? `ERR_PNPM_${code2}` : "ERR_PNPM_OTHER";
|
|
523
|
+
},
|
|
524
|
+
(output) => {
|
|
525
|
+
const code2 = /^npm (?:ERR!|error) code (\S+)/m.exec(output)?.[1];
|
|
526
|
+
if (code2 === void 0) return void 0;
|
|
527
|
+
if (NPM_CODES.has(code2)) return code2;
|
|
528
|
+
if (/^E[45]\d\d$/.test(code2)) return code2;
|
|
529
|
+
return /^npm (?:ERR!|error) command failed/m.test(output) ? "ELIFECYCLE" : "NPM_OTHER";
|
|
530
|
+
},
|
|
531
|
+
(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),
|
|
532
|
+
(output) => /^error:? (?:No version matching |Couldn't find any versions for )/m.test(output) ? "NO_MATCHING_VERSION" : void 0,
|
|
533
|
+
(output) => {
|
|
534
|
+
const status = /^error: GET \S+ - (\d{3})$/m.exec(output)?.[1];
|
|
535
|
+
return status && HTTP_ERROR.test(status) ? `HTTP_${status}` : void 0;
|
|
536
|
+
},
|
|
537
|
+
(output) => /^error Error: https?:\/\/\S+: Not found/m.test(output) ? "HTTP_404" : void 0,
|
|
538
|
+
(output) => /^error:? (?:\S+ script from .* exited with|Command failed with exit code) \d+/m.test(output) ? "ELIFECYCLE" : void 0,
|
|
539
|
+
(output) => {
|
|
540
|
+
const name = /^error: ([A-Za-z]+) /m.exec(output)?.[1];
|
|
541
|
+
return name !== void 0 && Object.hasOwn(BUN_ERRORS, name) ? BUN_ERRORS[name] : void 0;
|
|
542
|
+
},
|
|
543
|
+
(output) => SYSTEM_CODES.find((code2) => new RegExp(`\\b${code2}\\b`).test(output))
|
|
544
|
+
];
|
|
545
|
+
function installErrorCode(output, exitCode) {
|
|
546
|
+
for (const read of READERS) {
|
|
547
|
+
const code2 = read(output);
|
|
548
|
+
if (code2 !== void 0) return code2;
|
|
549
|
+
}
|
|
550
|
+
return /\bYN0001:/.test(output) ? "YN0001" : `EXIT_${exitCode}`;
|
|
551
|
+
}
|
|
441
552
|
function ciInstallCommand(pm, packageManagerSpec) {
|
|
442
553
|
switch (pm) {
|
|
443
554
|
case "pnpm":
|
|
@@ -529,7 +640,7 @@ function yamlString(value) {
|
|
|
529
640
|
|
|
530
641
|
// src/kit/versions.ts
|
|
531
642
|
function scaffolderVersion() {
|
|
532
|
-
return false ? "0.0.0" : "0.
|
|
643
|
+
return false ? "0.0.0" : "0.6.1";
|
|
533
644
|
}
|
|
534
645
|
function workspaceVersions() {
|
|
535
646
|
return typeof define_COGITATOR_VERSIONS_default === "undefined" ? {} : define_COGITATOR_VERSIONS_default;
|
|
@@ -641,7 +752,7 @@ function emitPackageJson(project, extras) {
|
|
|
641
752
|
};
|
|
642
753
|
project.file("package.json", JSON.stringify(pkg, null, 2) + "\n");
|
|
643
754
|
}
|
|
644
|
-
var SKIPPED_BUILDS = ["cpu-features", "protobufjs", "ssh2"];
|
|
755
|
+
var SKIPPED_BUILDS = ["better-sqlite3", "cpu-features", "protobufjs", "ssh2"];
|
|
645
756
|
function pnpmWorkspaceYaml(nativeBuilds) {
|
|
646
757
|
const allowed = new Set(nativeBuilds);
|
|
647
758
|
const entries = [
|
|
@@ -1593,7 +1704,7 @@ function emitAssistant(project) {
|
|
|
1593
1704
|
// src/kit/features/deploy.ts
|
|
1594
1705
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs";
|
|
1595
1706
|
import { tmpdir } from "os";
|
|
1596
|
-
import { dirname, join } from "path";
|
|
1707
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
1597
1708
|
import { ArtifactGenerator, ProjectAnalyzer } from "@cogitator-ai/deploy";
|
|
1598
1709
|
var ROOT_ARTIFACTS = {
|
|
1599
1710
|
Dockerfile: "Dockerfile",
|
|
@@ -1603,14 +1714,14 @@ var ROOT_ARTIFACTS = {
|
|
|
1603
1714
|
function emitDeployArtifacts(project) {
|
|
1604
1715
|
const { spec } = project;
|
|
1605
1716
|
if (spec.deploy === "none") return;
|
|
1606
|
-
const dir = mkdtempSync(
|
|
1717
|
+
const dir = mkdtempSync(join2(tmpdir(), "cogitator-deploy-plan-"));
|
|
1607
1718
|
try {
|
|
1608
1719
|
for (const file of project.files.values()) {
|
|
1609
|
-
const target =
|
|
1610
|
-
mkdirSync(
|
|
1720
|
+
const target = join2(dir, file.path);
|
|
1721
|
+
mkdirSync(dirname2(target), { recursive: true });
|
|
1611
1722
|
writeFileSync(target, file.content);
|
|
1612
1723
|
}
|
|
1613
|
-
writeFileSync(
|
|
1724
|
+
writeFileSync(join2(dir, LOCKFILES[spec.packageManager]), "");
|
|
1614
1725
|
const analysis = new ProjectAnalyzer().analyze(dir, { target: spec.deploy }, { env: {} });
|
|
1615
1726
|
const { files } = new ArtifactGenerator().generate(analysis.deployConfig, analysis);
|
|
1616
1727
|
for (const artifact of files) {
|
|
@@ -5927,9 +6038,22 @@ function planProject(input, options = {}) {
|
|
|
5927
6038
|
|
|
5928
6039
|
// src/kit/scaffold.ts
|
|
5929
6040
|
import { createHash } from "crypto";
|
|
5930
|
-
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
6041
|
+
import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
|
|
5931
6042
|
import { chmod, mkdir, readFile, writeFile } from "fs/promises";
|
|
5932
|
-
import { dirname as
|
|
6043
|
+
import { dirname as dirname3, join as join3, resolve } from "path";
|
|
6044
|
+
|
|
6045
|
+
// src/kit/errors.ts
|
|
6046
|
+
var CodedError = class extends Error {
|
|
6047
|
+
code;
|
|
6048
|
+
constructor(code2, message, options) {
|
|
6049
|
+
super(message, options);
|
|
6050
|
+
this.name = "CodedError";
|
|
6051
|
+
this.code = code2;
|
|
6052
|
+
}
|
|
6053
|
+
};
|
|
6054
|
+
function constantCase(name) {
|
|
6055
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
6056
|
+
}
|
|
5933
6057
|
|
|
5934
6058
|
// src/kit/process.ts
|
|
5935
6059
|
import { spawn } from "child_process";
|
|
@@ -5942,7 +6066,7 @@ function runCommand(command, args, options) {
|
|
|
5942
6066
|
cwd: options.cwd,
|
|
5943
6067
|
env: options.env ?? process.env,
|
|
5944
6068
|
stdio: options.inherit ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
5945
|
-
shell: process.platform === "win32",
|
|
6069
|
+
shell: options.shell ?? process.platform === "win32",
|
|
5946
6070
|
timeout: options.timeoutMs
|
|
5947
6071
|
});
|
|
5948
6072
|
let output = "";
|
|
@@ -5979,8 +6103,8 @@ function failure(error) {
|
|
|
5979
6103
|
}
|
|
5980
6104
|
async function writeFiles(directory, files) {
|
|
5981
6105
|
for (const file of files) {
|
|
5982
|
-
const target =
|
|
5983
|
-
await mkdir(
|
|
6106
|
+
const target = join3(directory, file.path);
|
|
6107
|
+
await mkdir(dirname3(target), { recursive: true });
|
|
5984
6108
|
await writeFile(
|
|
5985
6109
|
target,
|
|
5986
6110
|
file.content,
|
|
@@ -5995,15 +6119,15 @@ async function saveLock(directory, files) {
|
|
|
5995
6119
|
generator: `create-cogitator-app@${scaffolderVersion()}`,
|
|
5996
6120
|
files: Object.fromEntries(Object.entries(files).sort(([a], [b]) => a.localeCompare(b)))
|
|
5997
6121
|
};
|
|
5998
|
-
await mkdir(
|
|
5999
|
-
await writeFile(
|
|
6122
|
+
await mkdir(join3(directory, dirname3(LOCK_PATH)), { recursive: true });
|
|
6123
|
+
await writeFile(join3(directory, LOCK_PATH), JSON.stringify(lock, null, 2) + "\n");
|
|
6000
6124
|
}
|
|
6001
6125
|
async function hashFiles(directory, paths) {
|
|
6002
6126
|
const hashes = /* @__PURE__ */ new Map();
|
|
6003
6127
|
for (const path of paths) {
|
|
6004
6128
|
if (UNTRACKED.has(path) || path === LOCK_PATH) continue;
|
|
6005
|
-
const full =
|
|
6006
|
-
hashes.set(path,
|
|
6129
|
+
const full = join3(directory, path);
|
|
6130
|
+
hashes.set(path, existsSync2(full) ? hashContent(await readFile(full, "utf-8")) : void 0);
|
|
6007
6131
|
}
|
|
6008
6132
|
return hashes;
|
|
6009
6133
|
}
|
|
@@ -6014,8 +6138,8 @@ async function writeLock(directory, paths) {
|
|
|
6014
6138
|
}
|
|
6015
6139
|
function biomeBinary(directory) {
|
|
6016
6140
|
const name = process.platform === "win32" ? "biome.cmd" : "biome";
|
|
6017
|
-
const path =
|
|
6018
|
-
return
|
|
6141
|
+
const path = join3(directory, "node_modules", ".bin", name);
|
|
6142
|
+
return existsSync2(path) ? path : void 0;
|
|
6019
6143
|
}
|
|
6020
6144
|
async function formatProject(directory, paths = ["."]) {
|
|
6021
6145
|
const biome = biomeBinary(directory);
|
|
@@ -6033,7 +6157,7 @@ ${tail(result.output)}`));
|
|
|
6033
6157
|
}
|
|
6034
6158
|
async function enclosingGitRepo(directory) {
|
|
6035
6159
|
let dir = resolve(directory);
|
|
6036
|
-
while (!
|
|
6160
|
+
while (!existsSync2(dir)) dir = dirname3(dir);
|
|
6037
6161
|
try {
|
|
6038
6162
|
const result = await runCommand("git", ["rev-parse", "--show-toplevel"], { cwd: dir });
|
|
6039
6163
|
return result.code === 0 ? result.output.trim() : void 0;
|
|
@@ -6042,11 +6166,11 @@ async function enclosingGitRepo(directory) {
|
|
|
6042
6166
|
}
|
|
6043
6167
|
}
|
|
6044
6168
|
function enclosingWorkspace(directory) {
|
|
6045
|
-
let dir =
|
|
6169
|
+
let dir = dirname3(resolve(directory));
|
|
6046
6170
|
for (; ; ) {
|
|
6047
|
-
if (
|
|
6048
|
-
const manifest =
|
|
6049
|
-
if (
|
|
6171
|
+
if (existsSync2(join3(dir, "pnpm-workspace.yaml"))) return dir;
|
|
6172
|
+
const manifest = join3(dir, "package.json");
|
|
6173
|
+
if (existsSync2(manifest)) {
|
|
6050
6174
|
try {
|
|
6051
6175
|
const parsed = JSON.parse(readFileSync(manifest, "utf-8"));
|
|
6052
6176
|
if (typeof parsed === "object" && parsed !== null && "workspaces" in parsed) return dir;
|
|
@@ -6054,7 +6178,7 @@ function enclosingWorkspace(directory) {
|
|
|
6054
6178
|
return void 0;
|
|
6055
6179
|
}
|
|
6056
6180
|
}
|
|
6057
|
-
const parent =
|
|
6181
|
+
const parent = dirname3(dir);
|
|
6058
6182
|
if (parent === dir) return void 0;
|
|
6059
6183
|
dir = parent;
|
|
6060
6184
|
}
|
|
@@ -6097,15 +6221,28 @@ ${tail(commit.output)}`));
|
|
|
6097
6221
|
return { status: "done" };
|
|
6098
6222
|
}
|
|
6099
6223
|
async function installDependencies(directory, pm, inherit) {
|
|
6100
|
-
|
|
6101
|
-
|
|
6224
|
+
const invocation = packageManagerInvocation(pm, ["install"]);
|
|
6225
|
+
if (invocation.fromPath && !await hasCommand(pm, directory)) {
|
|
6226
|
+
return failure(
|
|
6227
|
+
new CodedError(
|
|
6228
|
+
"PM_NOT_FOUND",
|
|
6229
|
+
`${pm} is not installed, install it or pick another one with --pm`
|
|
6230
|
+
)
|
|
6231
|
+
);
|
|
6102
6232
|
}
|
|
6103
6233
|
try {
|
|
6104
|
-
const result = await runCommand(
|
|
6234
|
+
const result = await runCommand(invocation.command, invocation.args, {
|
|
6235
|
+
cwd: directory,
|
|
6236
|
+
inherit,
|
|
6237
|
+
...!invocation.fromPath && { shell: false }
|
|
6238
|
+
});
|
|
6105
6239
|
if (result.code !== 0) {
|
|
6106
6240
|
return failure(
|
|
6107
|
-
new
|
|
6108
|
-
|
|
6241
|
+
new CodedError(
|
|
6242
|
+
installErrorCode(result.output, result.code),
|
|
6243
|
+
`${installCommand(pm)} exited with ${result.code}:
|
|
6244
|
+
${tail(result.output)}`
|
|
6245
|
+
)
|
|
6109
6246
|
);
|
|
6110
6247
|
}
|
|
6111
6248
|
return { status: "done" };
|
|
@@ -6114,8 +6251,8 @@ ${tail(result.output)}`)
|
|
|
6114
6251
|
}
|
|
6115
6252
|
}
|
|
6116
6253
|
function assertEmptyDirectory(directory) {
|
|
6117
|
-
if (
|
|
6118
|
-
throw new
|
|
6254
|
+
if (existsSync2(directory) && readdirSync(directory).length > 0) {
|
|
6255
|
+
throw new CodedError("DIRECTORY_NOT_EMPTY", `${directory} already exists and is not empty`);
|
|
6119
6256
|
}
|
|
6120
6257
|
}
|
|
6121
6258
|
async function scaffold(spec, options) {
|
|
@@ -6173,16 +6310,47 @@ async function scaffold(spec, options) {
|
|
|
6173
6310
|
}
|
|
6174
6311
|
|
|
6175
6312
|
// src/kit/telemetry.ts
|
|
6176
|
-
import { existsSync as
|
|
6313
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
6177
6314
|
import { homedir } from "os";
|
|
6178
|
-
import { join as
|
|
6315
|
+
import { join as join4 } from "path";
|
|
6316
|
+
import { z as z2 } from "zod";
|
|
6179
6317
|
var TELEMETRY_HOST = "https://analytics.el1fe.com";
|
|
6180
6318
|
var TELEMETRY_DOCS = "https://cogitator.app/docs/getting-started/telemetry";
|
|
6181
6319
|
var SEND_TIMEOUT_MS = 1500;
|
|
6182
6320
|
function telemetryWebsiteId() {
|
|
6183
6321
|
return false ? "" : "ef978a40-6d7f-4332-81ba-e6d86e9d4b38";
|
|
6184
6322
|
}
|
|
6185
|
-
|
|
6323
|
+
var VALUE = z2.string().regex(/^[\w.,-]{0,100}$/);
|
|
6324
|
+
var PAYLOAD_SCHEMA = z2.strictObject({
|
|
6325
|
+
version: VALUE,
|
|
6326
|
+
preset: VALUE,
|
|
6327
|
+
provider: VALUE,
|
|
6328
|
+
memory: VALUE,
|
|
6329
|
+
features: VALUE,
|
|
6330
|
+
packageManager: VALUE,
|
|
6331
|
+
node: VALUE,
|
|
6332
|
+
os: VALUE,
|
|
6333
|
+
outcome: z2.enum(["success", "failure"]),
|
|
6334
|
+
failedStep: z2.enum(["none", "create", "install"]),
|
|
6335
|
+
errorCode: VALUE
|
|
6336
|
+
});
|
|
6337
|
+
var SAFE_CODE = /^[A-Z][A-Z0-9_]{1,63}$/;
|
|
6338
|
+
function telemetryErrorCode(error) {
|
|
6339
|
+
let kind;
|
|
6340
|
+
let current = error;
|
|
6341
|
+
for (let depth = 0; depth < 5 && typeof current === "object" && current !== null; depth++) {
|
|
6342
|
+
if ("code" in current && typeof current.code === "string" && SAFE_CODE.test(current.code))
|
|
6343
|
+
return current.code;
|
|
6344
|
+
if (!kind && current instanceof Error && current.name !== "Error" && /^[A-Za-z]+$/.test(current.name))
|
|
6345
|
+
kind = constantCase(current.name);
|
|
6346
|
+
current = "cause" in current ? current.cause : void 0;
|
|
6347
|
+
}
|
|
6348
|
+
return kind ?? "UNKNOWN";
|
|
6349
|
+
}
|
|
6350
|
+
function installFailure(result) {
|
|
6351
|
+
return result.install.status === "failed" ? { step: "install", error: result.install.error } : void 0;
|
|
6352
|
+
}
|
|
6353
|
+
function payloadFor(spec, failure2, kind = "generated") {
|
|
6186
6354
|
return {
|
|
6187
6355
|
version: scaffolderVersion(),
|
|
6188
6356
|
preset: kind !== "generated" ? kind : spec?.preset ?? "custom",
|
|
@@ -6192,7 +6360,9 @@ function payloadFor(spec, outcome, kind = "generated") {
|
|
|
6192
6360
|
packageManager: spec?.packageManager ?? "unknown",
|
|
6193
6361
|
node: process.versions.node.split(".")[0],
|
|
6194
6362
|
os: process.platform,
|
|
6195
|
-
outcome
|
|
6363
|
+
outcome: failure2 ? "failure" : "success",
|
|
6364
|
+
failedStep: failure2?.step ?? "none",
|
|
6365
|
+
errorCode: failure2 ? telemetryErrorCode(failure2.error) : "none"
|
|
6196
6366
|
};
|
|
6197
6367
|
}
|
|
6198
6368
|
function telemetryDisabledReason(options) {
|
|
@@ -6210,12 +6380,12 @@ function telemetryDisabledReason(options) {
|
|
|
6210
6380
|
return void 0;
|
|
6211
6381
|
}
|
|
6212
6382
|
function configDir(env) {
|
|
6213
|
-
if (process.platform === "win32" && env.APPDATA) return
|
|
6214
|
-
return
|
|
6383
|
+
if (process.platform === "win32" && env.APPDATA) return join4(env.APPDATA, "cogitator");
|
|
6384
|
+
return join4(env.XDG_CONFIG_HOME || join4(homedir(), ".config"), "cogitator");
|
|
6215
6385
|
}
|
|
6216
6386
|
function firstRunNotice(env = process.env) {
|
|
6217
|
-
const marker =
|
|
6218
|
-
if (
|
|
6387
|
+
const marker = join4(configDir(env), "telemetry-notice");
|
|
6388
|
+
if (existsSync3(marker)) return void 0;
|
|
6219
6389
|
try {
|
|
6220
6390
|
mkdirSync2(configDir(env), { recursive: true });
|
|
6221
6391
|
writeFileSync2(marker, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
@@ -6223,7 +6393,7 @@ function firstRunNotice(env = process.env) {
|
|
|
6223
6393
|
} catch {
|
|
6224
6394
|
return void 0;
|
|
6225
6395
|
}
|
|
6226
|
-
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}`;
|
|
6396
|
+
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}`;
|
|
6227
6397
|
}
|
|
6228
6398
|
var UA_PLATFORMS = {
|
|
6229
6399
|
darwin: "Macintosh; Intel Mac OS X 10_15_7",
|
|
@@ -6236,14 +6406,17 @@ function telemetryUserAgent(payload) {
|
|
|
6236
6406
|
async function sendTelemetry(payload, options = {}) {
|
|
6237
6407
|
const website = options.websiteId ?? telemetryWebsiteId();
|
|
6238
6408
|
if (!website) return false;
|
|
6409
|
+
const parsed = PAYLOAD_SCHEMA.safeParse(payload);
|
|
6410
|
+
if (!parsed.success) return false;
|
|
6411
|
+
const data = parsed.data;
|
|
6239
6412
|
const body = {
|
|
6240
6413
|
type: "event",
|
|
6241
6414
|
payload: {
|
|
6242
6415
|
website,
|
|
6243
6416
|
hostname: "create-cogitator-app",
|
|
6244
|
-
url: `/scaffold/${
|
|
6417
|
+
url: `/scaffold/${data.preset}`,
|
|
6245
6418
|
name: "scaffold",
|
|
6246
|
-
data
|
|
6419
|
+
data
|
|
6247
6420
|
}
|
|
6248
6421
|
};
|
|
6249
6422
|
try {
|
|
@@ -6251,7 +6424,7 @@ async function sendTelemetry(payload, options = {}) {
|
|
|
6251
6424
|
method: "POST",
|
|
6252
6425
|
headers: {
|
|
6253
6426
|
"content-type": "application/json",
|
|
6254
|
-
"user-agent": telemetryUserAgent(
|
|
6427
|
+
"user-agent": telemetryUserAgent(data)
|
|
6255
6428
|
},
|
|
6256
6429
|
body: JSON.stringify(body),
|
|
6257
6430
|
signal: AbortSignal.timeout(options.timeoutMs ?? SEND_TIMEOUT_MS)
|
|
@@ -6312,14 +6485,16 @@ function findExample(query, index = examples()) {
|
|
|
6312
6485
|
const short = index.filter((example) => example.name.split("/")[1] === normalized);
|
|
6313
6486
|
if (short.length === 1) return short[0];
|
|
6314
6487
|
if (short.length > 1) {
|
|
6315
|
-
throw new
|
|
6488
|
+
throw new CodedError(
|
|
6489
|
+
"AMBIGUOUS_EXAMPLE",
|
|
6316
6490
|
`"${query}" is in more than one category: ${short.map((example) => example.name).join(", ")}`
|
|
6317
6491
|
);
|
|
6318
6492
|
}
|
|
6319
6493
|
const names = index.map((example) => example.name);
|
|
6320
6494
|
const match = closest(normalized, [...names, ...names.map((name) => name.split("/")[1])]);
|
|
6321
6495
|
const suggestion2 = match ? ` Did you mean "${names.find((name) => name.endsWith(match)) ?? match}"?` : "";
|
|
6322
|
-
throw new
|
|
6496
|
+
throw new CodedError(
|
|
6497
|
+
"UNKNOWN_EXAMPLE",
|
|
6323
6498
|
`There is no example "${query}".${suggestion2} Run with --list-examples to see them all.`
|
|
6324
6499
|
);
|
|
6325
6500
|
}
|
|
@@ -6481,20 +6656,26 @@ async function fetchExampleFiles(plan, fetchImpl = fetch) {
|
|
|
6481
6656
|
const url = exampleFileUrl(plan.ref, path);
|
|
6482
6657
|
const response = await fetchImpl(url, { signal: AbortSignal.timeout(3e4) });
|
|
6483
6658
|
if (response.status === 404) {
|
|
6484
|
-
throw new
|
|
6659
|
+
throw new CodedError(
|
|
6660
|
+
"HTTP_404",
|
|
6485
6661
|
`examples/${path} is not at ${plan.ref} of ${EXAMPLES_REPO.owner}/${EXAMPLES_REPO.repo}. Pass --example ${plan.example.name}#main for the main branch.`
|
|
6486
6662
|
);
|
|
6487
6663
|
}
|
|
6488
|
-
if (!response.ok)
|
|
6664
|
+
if (!response.ok) {
|
|
6665
|
+
throw new CodedError(
|
|
6666
|
+
`HTTP_${response.status}`,
|
|
6667
|
+
`Could not download ${url}: HTTP ${response.status}`
|
|
6668
|
+
);
|
|
6669
|
+
}
|
|
6489
6670
|
return { path: exampleTarget(path), content: await response.text() };
|
|
6490
6671
|
})
|
|
6491
6672
|
);
|
|
6492
6673
|
}
|
|
6493
6674
|
|
|
6494
6675
|
// src/kit/remote.ts
|
|
6495
|
-
import { existsSync as
|
|
6676
|
+
import { existsSync as existsSync4, readFileSync as readFileSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
6496
6677
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
6497
|
-
import { join as
|
|
6678
|
+
import { join as join5 } from "path";
|
|
6498
6679
|
import { Readable } from "stream";
|
|
6499
6680
|
import { pipeline } from "stream/promises";
|
|
6500
6681
|
import { x as extract } from "tar";
|
|
@@ -6522,22 +6703,28 @@ async function downloadTemplate(template, directory, options = {}) {
|
|
|
6522
6703
|
signal: AbortSignal.timeout(12e4)
|
|
6523
6704
|
});
|
|
6524
6705
|
if (response.status === 404) {
|
|
6525
|
-
throw new
|
|
6706
|
+
throw new CodedError(
|
|
6707
|
+
"HTTP_404",
|
|
6526
6708
|
`${describeTemplate(template)} was not found: check the repository and the ref${options.token ? "" : ", and set GITHUB_TOKEN for a private repository"}`
|
|
6527
6709
|
);
|
|
6528
6710
|
}
|
|
6529
6711
|
if (!response.ok) {
|
|
6530
|
-
throw new
|
|
6712
|
+
throw new CodedError(
|
|
6713
|
+
`HTTP_${response.status}`,
|
|
6714
|
+
`Could not download ${describeTemplate(template)}: HTTP ${response.status}`
|
|
6715
|
+
);
|
|
6531
6716
|
}
|
|
6532
6717
|
const length = Number(response.headers.get("content-length") ?? 0);
|
|
6533
6718
|
if (length > MAX_ARCHIVE_BYTES) {
|
|
6534
|
-
throw new
|
|
6719
|
+
throw new CodedError(
|
|
6720
|
+
"TEMPLATE_TOO_LARGE",
|
|
6535
6721
|
`${describeTemplate(template)} is larger than ${MAX_ARCHIVE_BYTES / 1024 / 1024} MB`
|
|
6536
6722
|
);
|
|
6537
6723
|
}
|
|
6538
6724
|
const archive = Buffer.from(await response.arrayBuffer());
|
|
6539
6725
|
if (archive.length > MAX_ARCHIVE_BYTES) {
|
|
6540
|
-
throw new
|
|
6726
|
+
throw new CodedError(
|
|
6727
|
+
"TEMPLATE_TOO_LARGE",
|
|
6541
6728
|
`${describeTemplate(template)} is larger than ${MAX_ARCHIVE_BYTES / 1024 / 1024} MB`
|
|
6542
6729
|
);
|
|
6543
6730
|
}
|
|
@@ -6567,17 +6754,19 @@ async function downloadTemplate(template, directory, options = {}) {
|
|
|
6567
6754
|
})
|
|
6568
6755
|
);
|
|
6569
6756
|
if (files.length === 0) {
|
|
6570
|
-
throw new
|
|
6757
|
+
throw new CodedError(
|
|
6758
|
+
"TEMPLATE_EMPTY",
|
|
6571
6759
|
template.path ? `${describeTemplate(template)} has no files under ${template.path}` : `${describeTemplate(template)} is empty`
|
|
6572
6760
|
);
|
|
6573
6761
|
}
|
|
6574
6762
|
return { files: files.sort(), skipped: skipped.sort() };
|
|
6575
6763
|
}
|
|
6576
6764
|
function prepareTemplate(directory, options) {
|
|
6577
|
-
const lockfile = PACKAGE_MANAGERS.find((pm) =>
|
|
6578
|
-
const manifestPath =
|
|
6579
|
-
if (!
|
|
6580
|
-
throw new
|
|
6765
|
+
const lockfile = PACKAGE_MANAGERS.find((pm) => existsSync4(join5(directory, LOCKFILES[pm])));
|
|
6766
|
+
const manifestPath = join5(directory, "package.json");
|
|
6767
|
+
if (!existsSync4(manifestPath)) {
|
|
6768
|
+
throw new CodedError(
|
|
6769
|
+
"TEMPLATE_NO_MANIFEST",
|
|
6581
6770
|
`The template has no package.json at its root (it has ${readdirSync2(directory).slice(0, 8).join(", ")}): point --template at the project directory`
|
|
6582
6771
|
);
|
|
6583
6772
|
}
|
|
@@ -6605,7 +6794,8 @@ function prepareTemplate(directory, options) {
|
|
|
6605
6794
|
}
|
|
6606
6795
|
}
|
|
6607
6796
|
if (unresolvable.length > 0) {
|
|
6608
|
-
throw new
|
|
6797
|
+
throw new CodedError(
|
|
6798
|
+
"TEMPLATE_WORKSPACE_DEPENDENCIES",
|
|
6609
6799
|
`The template depends on packages of its own monorepo, which cannot be installed outside it: ${unresolvable.join(", ")}`
|
|
6610
6800
|
);
|
|
6611
6801
|
}
|
|
@@ -6614,9 +6804,9 @@ function prepareTemplate(directory, options) {
|
|
|
6614
6804
|
}
|
|
6615
6805
|
|
|
6616
6806
|
// src/kit/starter.ts
|
|
6617
|
-
import { existsSync as
|
|
6807
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
6618
6808
|
import { mkdir as mkdir3, readdir, rm } from "fs/promises";
|
|
6619
|
-
import { join as
|
|
6809
|
+
import { join as join6, relative, resolve as resolve2 } from "path";
|
|
6620
6810
|
async function finish2(directory, packageManager, options) {
|
|
6621
6811
|
const log2 = options.log ?? silentLogger;
|
|
6622
6812
|
let install = { status: "skipped", reason: "install was turned off" };
|
|
@@ -6687,7 +6877,7 @@ async function createFromTemplate(template, options) {
|
|
|
6687
6877
|
const log2 = options.log ?? silentLogger;
|
|
6688
6878
|
const directory = resolve2(options.directory);
|
|
6689
6879
|
assertEmptyDirectory(directory);
|
|
6690
|
-
const existed =
|
|
6880
|
+
const existed = existsSync5(directory);
|
|
6691
6881
|
log2.start(`Downloading ${describeTemplate(template)}`);
|
|
6692
6882
|
let downloaded;
|
|
6693
6883
|
let prepared;
|
|
@@ -6701,7 +6891,7 @@ async function createFromTemplate(template, options) {
|
|
|
6701
6891
|
log2.fail(`Could not use ${describeTemplate(template)}`);
|
|
6702
6892
|
if (existed) {
|
|
6703
6893
|
for (const entry of await readdir(directory)) {
|
|
6704
|
-
await rm(
|
|
6894
|
+
await rm(join6(directory, entry), { recursive: true, force: true });
|
|
6705
6895
|
}
|
|
6706
6896
|
} else {
|
|
6707
6897
|
await rm(directory, { recursive: true, force: true });
|
|
@@ -6720,7 +6910,7 @@ async function createFromTemplate(template, options) {
|
|
|
6720
6910
|
...downloaded.skipped.length > 0 ? [`Left out links and special files: ${downloaded.skipped.join(", ")}`] : []
|
|
6721
6911
|
];
|
|
6722
6912
|
const { install, git } = await finish2(directory, packageManager, options);
|
|
6723
|
-
const manifest = JSON.parse(readFileSync3(
|
|
6913
|
+
const manifest = JSON.parse(readFileSync3(join6(directory, "package.json"), "utf-8"));
|
|
6724
6914
|
return {
|
|
6725
6915
|
directory,
|
|
6726
6916
|
source: describeTemplate(template),
|
|
@@ -6733,7 +6923,7 @@ async function createFromTemplate(template, options) {
|
|
|
6733
6923
|
packageManager,
|
|
6734
6924
|
manifest.scripts ?? {},
|
|
6735
6925
|
install.status === "done",
|
|
6736
|
-
|
|
6926
|
+
existsSync5(join6(directory, ".env.example"))
|
|
6737
6927
|
),
|
|
6738
6928
|
notes
|
|
6739
6929
|
};
|
|
@@ -6742,6 +6932,7 @@ async function createFromTemplate(template, options) {
|
|
|
6742
6932
|
// src/cli/args.ts
|
|
6743
6933
|
import { parseArgs } from "util";
|
|
6744
6934
|
var CliError = class extends Error {
|
|
6935
|
+
code = "INVALID_ARGS";
|
|
6745
6936
|
constructor(message) {
|
|
6746
6937
|
super(message);
|
|
6747
6938
|
this.name = "CliError";
|
|
@@ -7074,9 +7265,9 @@ function exampleList() {
|
|
|
7074
7265
|
}
|
|
7075
7266
|
|
|
7076
7267
|
// src/cli/interactive.ts
|
|
7077
|
-
import { existsSync as
|
|
7268
|
+
import { existsSync as existsSync6 } from "fs";
|
|
7078
7269
|
import { homedir as homedir2 } from "os";
|
|
7079
|
-
import { join as
|
|
7270
|
+
import { join as join7 } from "path";
|
|
7080
7271
|
import * as p from "@clack/prompts";
|
|
7081
7272
|
|
|
7082
7273
|
// src/kit/models.ts
|
|
@@ -7168,10 +7359,10 @@ function modelChoices(provider) {
|
|
|
7168
7359
|
}
|
|
7169
7360
|
|
|
7170
7361
|
// src/cli/resolve.ts
|
|
7171
|
-
import { basename, resolve as resolve3 } from "path";
|
|
7362
|
+
import { basename as basename2, resolve as resolve3 } from "path";
|
|
7172
7363
|
var DEFAULT_DIRECTORY = "my-agents";
|
|
7173
7364
|
function projectNameFromDirectory(directory, cwd = process.cwd()) {
|
|
7174
|
-
return
|
|
7365
|
+
return basename2(resolve3(cwd, directory.trim()));
|
|
7175
7366
|
}
|
|
7176
7367
|
function resolveDirectory(directory, cwd = process.cwd()) {
|
|
7177
7368
|
const name = projectNameFromDirectory(directory, cwd);
|
|
@@ -7227,7 +7418,7 @@ function detectCodingAgents(home = homedir2()) {
|
|
|
7227
7418
|
codex: ".codex"
|
|
7228
7419
|
};
|
|
7229
7420
|
return CODING_AGENT_CHOICES.map((choice) => choice.value).filter(
|
|
7230
|
-
(agent) =>
|
|
7421
|
+
(agent) => existsSync6(join7(home, markers[agent]))
|
|
7231
7422
|
);
|
|
7232
7423
|
}
|
|
7233
7424
|
async function askDirectory() {
|
|
@@ -7596,24 +7787,21 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
7596
7787
|
if (args.example !== void 0 || args.remote) {
|
|
7597
7788
|
const kind = args.example !== void 0 ? "example" : "template";
|
|
7598
7789
|
try {
|
|
7599
|
-
const
|
|
7600
|
-
if (
|
|
7601
|
-
await report(
|
|
7602
|
-
|
|
7603
|
-
deps,
|
|
7604
|
-
payloadFor(void 0, code2 === 0 ? "success" : "failure", kind)
|
|
7605
|
-
);
|
|
7606
|
-
return code2;
|
|
7790
|
+
const created = await runStarter(args, interactive, io, deps);
|
|
7791
|
+
if (created)
|
|
7792
|
+
await report(telemetry, deps, payloadFor(void 0, installFailure(created), kind));
|
|
7793
|
+
return 0;
|
|
7607
7794
|
} catch (error) {
|
|
7608
7795
|
if (error instanceof CancelledError) {
|
|
7609
7796
|
p2.cancel("Cancelled, nothing was created.");
|
|
7610
7797
|
return 1;
|
|
7611
7798
|
}
|
|
7612
|
-
await report(telemetry, deps, payloadFor(void 0, "
|
|
7799
|
+
await report(telemetry, deps, payloadFor(void 0, { step: "create", error }, kind));
|
|
7613
7800
|
return reportError(error, args.json, io);
|
|
7614
7801
|
}
|
|
7615
7802
|
}
|
|
7616
7803
|
let resolvedSpec;
|
|
7804
|
+
let reported = false;
|
|
7617
7805
|
try {
|
|
7618
7806
|
if (interactive) {
|
|
7619
7807
|
io.stderr(banner(version));
|
|
@@ -7647,11 +7835,8 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
7647
7835
|
git: args.git ?? true,
|
|
7648
7836
|
log: args.json ? void 0 : clackLogger()
|
|
7649
7837
|
});
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
deps,
|
|
7653
|
-
payloadFor(result.plan.spec, result.install.status === "failed" ? "failure" : "success")
|
|
7654
|
-
);
|
|
7838
|
+
reported = true;
|
|
7839
|
+
await report(telemetry, deps, payloadFor(result.plan.spec, installFailure(result)));
|
|
7655
7840
|
const modelReady = result.plan.spec.provider === "ollama" ? await prepareOllama(result.plan, interactive) : true;
|
|
7656
7841
|
const key = envKey ? args.apiKey ?? process.env[envKey] : void 0;
|
|
7657
7842
|
const provider = result.plan.spec.provider;
|
|
@@ -7698,7 +7883,8 @@ async function run(argv, io = defaultIo, deps = {}) {
|
|
|
7698
7883
|
p2.cancel("Cancelled, nothing was created.");
|
|
7699
7884
|
return 1;
|
|
7700
7885
|
}
|
|
7701
|
-
if (resolvedSpec
|
|
7886
|
+
if (resolvedSpec && !reported)
|
|
7887
|
+
await report(telemetry, deps, payloadFor(resolvedSpec, { step: "create", error }));
|
|
7702
7888
|
return reportError(error, args.json, io);
|
|
7703
7889
|
}
|
|
7704
7890
|
}
|
|
@@ -7777,7 +7963,7 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
7777
7963
|
].join("\n")
|
|
7778
7964
|
);
|
|
7779
7965
|
}
|
|
7780
|
-
return 0;
|
|
7966
|
+
return void 0;
|
|
7781
7967
|
}
|
|
7782
7968
|
result = await createFromExample(plan, options);
|
|
7783
7969
|
} else if (args.remote) {
|
|
@@ -7788,7 +7974,7 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
7788
7974
|
` : `${pc2.bold("Dry run:")} nothing was written. ${message}.
|
|
7789
7975
|
`
|
|
7790
7976
|
);
|
|
7791
|
-
return 0;
|
|
7977
|
+
return void 0;
|
|
7792
7978
|
}
|
|
7793
7979
|
result = await createFromTemplate(args.remote, {
|
|
7794
7980
|
...options,
|
|
@@ -7816,13 +8002,13 @@ async function runStarter(args, interactive, io, deps) {
|
|
|
7816
8002
|
)}
|
|
7817
8003
|
`
|
|
7818
8004
|
);
|
|
7819
|
-
return
|
|
8005
|
+
return result;
|
|
7820
8006
|
}
|
|
7821
8007
|
for (const note of result.notes) p2.log.info(note);
|
|
7822
8008
|
if (interactive) p2.outro(starterOutro(result));
|
|
7823
8009
|
else io.stderr(`${starterOutro(result)}
|
|
7824
8010
|
`);
|
|
7825
|
-
return
|
|
8011
|
+
return result;
|
|
7826
8012
|
}
|
|
7827
8013
|
function reportError(error, json, io) {
|
|
7828
8014
|
const message = error instanceof Error ? error.message : String(error);
|