create-bk-agent 0.18.0 → 0.19.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/README.md CHANGED
@@ -11,7 +11,7 @@ npx create-bk-agent my-project
11
11
  The CLI asks three questions and generates a production-ready project:
12
12
 
13
13
  ```
14
- ✨ create-bk-agent v0.18.0
14
+ ✨ create-bk-agent v0.19.1
15
15
 
16
16
  ? Project name: my-project
17
17
  ? Architecture: Multi-agent (orchestrator + specialists)
@@ -54,6 +54,39 @@ Available for `multi-agent` and `single` architectures:
54
54
 
55
55
  Anthropic (Claude), OpenAI, DeepSeek / any OpenAI-compatible endpoint, and Ollama (local).
56
56
 
57
+ ## Model configuration
58
+
59
+ Generated projects read three env vars for model selection:
60
+
61
+ | Variable | Default | Description |
62
+ |---|---|---|
63
+ | `LLM_MODEL` | `gpt-4o` | Base model — used by all agents unless overridden |
64
+ | `LLM_MODEL_FAST` | `LLM_MODEL` | Execution agents (specialists, tool-calling loops) |
65
+ | `LLM_MODEL_SMART` | `LLM_MODEL` | Routing agents (orchestrator, reasoning-heavy tasks) |
66
+
67
+ If `LLM_MODEL_FAST` and `LLM_MODEL_SMART` are not set, all agents use `LLM_MODEL` — fully backwards compatible.
68
+
69
+ Example `.env` for DeepSeek with smart/fast split:
70
+
71
+ ```env
72
+ LLM_API_KEY=sk-...
73
+ LLM_BASE_URL=https://api.deepseek.com/v1
74
+ LLM_MODEL=deepseek-chat
75
+ LLM_MODEL_FAST=deepseek-chat
76
+ LLM_MODEL_SMART=deepseek-reasoner
77
+ ```
78
+
79
+ The split is wired in `src/engine.ts` — specialists get `llmModelFast`, orchestrator gets `llmModelSmart`. To assign a model directly on a profile instead of via env vars, uncomment the `model:` field in the agent file:
80
+
81
+ ```ts
82
+ // src/agents/orchestrator.ts
83
+ export const ORCHESTRATOR_PROFILE: AgentProfile = {
84
+ id: 'orchestrator',
85
+ model: 'deepseek-reasoner', // uncomment and set explicitly
86
+ ...
87
+ };
88
+ ```
89
+
57
90
  ---
58
91
 
59
92
  ## Add capabilities to an existing project
@@ -6,6 +6,7 @@ const server_1 = require("./modules/server");
6
6
  const specialist_1 = require("./modules/specialist");
7
7
  const tools_1 = require("./modules/tools");
8
8
  const mcp_client_1 = require("./modules/mcp-client");
9
+ const plugin_1 = require("./modules/plugin");
9
10
  const HELP = `
10
11
  Usage: npx create-bk-agent add <module> [options]
11
12
 
@@ -23,11 +24,16 @@ Modules:
23
24
  mcp-client <url> Add a remote MCP server to the engine
24
25
  --name <s> Name for the mcpServers entry (default: last URL segment)
25
26
 
27
+ plugin <name> Install a backendkit agent as a stdio MCP plugin
28
+ Available: docker, k8s
29
+
26
30
  Examples:
27
31
  npx create-bk-agent add server --port 4000
28
32
  npx create-bk-agent add specialist data-analyst
29
33
  npx create-bk-agent add tools github
30
34
  npx create-bk-agent add mcp-client http://localhost:3001/mcp --name billing
35
+ npx create-bk-agent add plugin docker
36
+ npx create-bk-agent add plugin k8s
31
37
  `;
32
38
  function runAdd(args, cwd) {
33
39
  const [module, ...rest] = args;
@@ -59,6 +65,9 @@ function runAdd(args, cwd) {
59
65
  case 'mcp-client':
60
66
  (0, mcp_client_1.addMcpClient)(info, rest);
61
67
  break;
68
+ case 'plugin':
69
+ (0, plugin_1.addPlugin)(info, rest);
70
+ break;
62
71
  default:
63
72
  console.error(`\n✗ Unknown module: "${module}"\n`);
64
73
  console.log(HELP);
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.addPlugin = addPlugin;
37
+ const fs = __importStar(require("fs"));
38
+ const child_process_1 = require("child_process");
39
+ const patcher_1 = require("../patcher");
40
+ const PLUGINS = {
41
+ docker: {
42
+ npm: '@backendkit-labs/docker-agent',
43
+ tools: ['docker_execute', 'docker_deploy', 'docker_status'],
44
+ envHint: 'Requires: OPENAI_API_KEY (or LLM_API_KEY) and Docker daemon running.',
45
+ },
46
+ k8s: {
47
+ npm: '@backendkit-labs/k8s-agent',
48
+ tools: ['k8s_execute', 'k8s_deploy', 'k8s_status'],
49
+ envHint: 'Requires: OPENAI_API_KEY (or LLM_API_KEY) and kubectl configured.',
50
+ },
51
+ };
52
+ function addPlugin(info, args) {
53
+ const pluginName = args[0];
54
+ if (!pluginName) {
55
+ console.log('\nUsage: npx create-bk-agent add plugin <name>\n');
56
+ console.log('Available plugins:');
57
+ for (const [name, def] of Object.entries(PLUGINS)) {
58
+ console.log(` ${name.padEnd(10)} ${def.npm}`);
59
+ }
60
+ console.log('');
61
+ process.exit(0);
62
+ }
63
+ const plugin = PLUGINS[pluginName];
64
+ if (!plugin) {
65
+ console.error(`\n✗ Unknown plugin: "${pluginName}"`);
66
+ console.error(` Available: ${Object.keys(PLUGINS).join(', ')}\n`);
67
+ process.exit(1);
68
+ }
69
+ if (!fs.existsSync(info.engineFile)) {
70
+ console.error('\n✗ src/engine.ts not found.\n');
71
+ process.exit(1);
72
+ }
73
+ console.log(`\n Installing ${plugin.npm}...`);
74
+ const added = (0, patcher_1.addPackageDependency)(info.pkgFile, plugin.npm, 'latest');
75
+ if (added) {
76
+ (0, child_process_1.execSync)('npm install', { cwd: info.cwd, stdio: 'inherit' });
77
+ }
78
+ console.log(` Patching src/engine.ts...`);
79
+ const ok = (0, patcher_1.addMcpStdioEntry)(info.engineFile, pluginName, plugin.npm);
80
+ if (!ok) {
81
+ console.error('\n✗ Could not locate AgentEngine constructor in src/engine.ts.\n');
82
+ process.exit(1);
83
+ }
84
+ console.log(`\n ✅ Plugin "${pluginName}" added.\n`);
85
+ console.log(` MCP tools exposed:`);
86
+ for (const tool of plugin.tools)
87
+ console.log(` ${tool}`);
88
+ if (plugin.envHint)
89
+ console.log(`\n ${plugin.envHint}`);
90
+ console.log('');
91
+ }
@@ -39,6 +39,7 @@ exports.insertBeforePattern = insertBeforePattern;
39
39
  exports.addPackageScript = addPackageScript;
40
40
  exports.addPackageDependency = addPackageDependency;
41
41
  exports.addMcpServerEntry = addMcpServerEntry;
42
+ exports.addMcpStdioEntry = addMcpStdioEntry;
42
43
  const fs = __importStar(require("fs"));
43
44
  // ── Import block ──────────────────────────────────────────────────────────────
44
45
  /** Adds `importLine` after the last import statement. No-op if already present. */
@@ -166,3 +167,43 @@ function addMcpServerEntry(file, name, url) {
166
167
  fs.writeFileSync(file, lines.join('\n'));
167
168
  return true;
168
169
  }
170
+ /**
171
+ * Adds a stdio MCP entry `{ name, transport: 'stdio', command, args }` to AgentEngine.
172
+ * If mcpServers already exists, appends. Returns true on success.
173
+ */
174
+ function addMcpStdioEntry(file, name, npmPackage) {
175
+ const content = fs.readFileSync(file, 'utf-8');
176
+ const entry = ` { name: '${name}', transport: 'stdio' as const, command: 'npx', args: ['-y', '${npmPackage}'] },`;
177
+ if (content.includes(`'${npmPackage}'`))
178
+ return true; // already registered
179
+ if (content.includes('mcpServers:')) {
180
+ const updated = content.replace(/(mcpServers:\s*\[)/, `$1\n${entry}`);
181
+ if (updated === content)
182
+ return false;
183
+ fs.writeFileSync(file, updated);
184
+ return true;
185
+ }
186
+ const lines = content.split('\n');
187
+ let depth = 0;
188
+ let engineStart = -1;
189
+ let closeIdx = -1;
190
+ for (let i = 0; i < lines.length; i++) {
191
+ if (lines[i].includes('new AgentEngine({')) {
192
+ engineStart = i;
193
+ depth = 0;
194
+ }
195
+ if (engineStart !== -1) {
196
+ depth += (lines[i].match(/\{/g) ?? []).length;
197
+ depth -= (lines[i].match(/\}/g) ?? []).length;
198
+ if (depth === 0 && i > engineStart) {
199
+ closeIdx = i;
200
+ break;
201
+ }
202
+ }
203
+ }
204
+ if (closeIdx === -1)
205
+ return false;
206
+ lines.splice(closeIdx, 0, ` mcpServers: [\n${entry}\n ],`);
207
+ fs.writeFileSync(file, lines.join('\n'));
208
+ return true;
209
+ }
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "create-bk-agent",
3
- "version": "0.18.0",
4
- "description": "Create a new BackendKit agent project",
5
- "main": "dist/src/index.js",
6
- "bin": {
7
- "create-bk-agent": "./dist/bin/create-bk-agent.js"
8
- },
9
- "files": [
10
- "dist/",
11
- "templates/"
12
- ],
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/BackendKit-labs/backendkit-agent-framework.git",
16
- "directory": "packages/create-bk-agent"
17
- },
18
- "publishConfig": { "access": "public" },
19
- "engines": { "node": ">=20.0.0" },
20
- "scripts": {
21
- "build": "tsc",
22
- "prepack": "node scripts/copy-templates.js && npm run build",
23
- "typecheck": "tsc --noEmit"
24
- },
25
- "dependencies": {
26
- "prompts": "^2.4.2"
27
- },
28
- "devDependencies": {
29
- "@types/node": "^20.0.0",
30
- "@types/prompts": "^2.4.9",
31
- "typescript": "^5.4.0"
32
- }
33
- }
1
+ {
2
+ "name": "create-bk-agent",
3
+ "version": "0.19.1",
4
+ "description": "Create a new BackendKit agent project",
5
+ "main": "dist/src/index.js",
6
+ "bin": {
7
+ "create-bk-agent": "./dist/bin/create-bk-agent.js"
8
+ },
9
+ "files": [
10
+ "dist/",
11
+ "templates/"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/BackendKit-labs/backendkit-agent-framework.git",
16
+ "directory": "packages/create-bk-agent"
17
+ },
18
+ "publishConfig": { "access": "public" },
19
+ "engines": { "node": ">=20.0.0" },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "prepack": "node scripts/copy-templates.js && npm run build",
23
+ "typecheck": "tsc --noEmit"
24
+ },
25
+ "dependencies": {
26
+ "prompts": "^2.4.2"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^20.0.0",
30
+ "@types/prompts": "^2.4.9",
31
+ "typescript": "^5.4.0"
32
+ }
33
+ }