cortex-agents 1.1.0 → 2.2.0

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.
Files changed (49) hide show
  1. package/.opencode/agents/build.md +97 -11
  2. package/.opencode/agents/debug.md +24 -2
  3. package/.opencode/agents/devops.md +1 -2
  4. package/.opencode/agents/fullstack.md +1 -2
  5. package/.opencode/agents/plan.md +16 -7
  6. package/.opencode/agents/security.md +1 -2
  7. package/.opencode/agents/testing.md +1 -2
  8. package/.opencode/skills/api-design/SKILL.md +348 -0
  9. package/.opencode/skills/architecture-patterns/SKILL.md +323 -0
  10. package/.opencode/skills/backend-development/SKILL.md +329 -0
  11. package/.opencode/skills/code-quality/SKILL.md +12 -0
  12. package/.opencode/skills/database-design/SKILL.md +347 -0
  13. package/.opencode/skills/deployment-automation/SKILL.md +7 -0
  14. package/.opencode/skills/design-patterns/SKILL.md +295 -0
  15. package/.opencode/skills/desktop-development/SKILL.md +295 -0
  16. package/.opencode/skills/frontend-development/SKILL.md +210 -0
  17. package/.opencode/skills/mobile-development/SKILL.md +407 -0
  18. package/.opencode/skills/performance-optimization/SKILL.md +330 -0
  19. package/.opencode/skills/testing-strategies/SKILL.md +33 -0
  20. package/README.md +309 -111
  21. package/dist/cli.js +264 -36
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +43 -0
  24. package/dist/plugin.js +3 -2
  25. package/dist/registry.d.ts +45 -0
  26. package/dist/registry.d.ts.map +1 -0
  27. package/dist/registry.js +140 -0
  28. package/dist/tools/cortex.d.ts.map +1 -1
  29. package/dist/tools/cortex.js +3 -4
  30. package/dist/tools/docs.d.ts +52 -0
  31. package/dist/tools/docs.d.ts.map +1 -0
  32. package/dist/tools/docs.js +328 -0
  33. package/dist/tools/task.d.ts +20 -0
  34. package/dist/tools/task.d.ts.map +1 -0
  35. package/dist/tools/task.js +302 -0
  36. package/dist/tools/worktree.d.ts +32 -0
  37. package/dist/tools/worktree.d.ts.map +1 -1
  38. package/dist/tools/worktree.js +403 -2
  39. package/dist/utils/plan-extract.d.ts +37 -0
  40. package/dist/utils/plan-extract.d.ts.map +1 -0
  41. package/dist/utils/plan-extract.js +137 -0
  42. package/dist/utils/propagate.d.ts +22 -0
  43. package/dist/utils/propagate.d.ts.map +1 -0
  44. package/dist/utils/propagate.js +64 -0
  45. package/dist/utils/worktree-detect.d.ts +20 -0
  46. package/dist/utils/worktree-detect.d.ts.map +1 -0
  47. package/dist/utils/worktree-detect.js +42 -0
  48. package/package.json +17 -7
  49. package/.opencode/skills/web-development/SKILL.md +0 -122
package/dist/cli.js CHANGED
@@ -2,12 +2,15 @@
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  import { fileURLToPath } from "url";
5
- const VERSION = "1.1.0";
5
+ import prompts from "prompts";
6
+ import { PRIMARY_AGENTS, SUBAGENTS, ALL_AGENTS, getPrimaryChoices, getSubagentChoices, } from "./registry.js";
7
+ const VERSION = "2.2.0";
6
8
  const PLUGIN_NAME = "cortex-agents";
7
9
  const __filename = fileURLToPath(import.meta.url);
8
10
  const __dirname = path.dirname(__filename);
9
11
  // The .opencode directory shipped with the package (adjacent to dist/)
10
12
  const PACKAGE_OPENCODE_DIR = path.resolve(__dirname, "..", ".opencode");
13
+ // ─── Config Helpers ──────────────────────────────────────────────────────────
11
14
  function getGlobalDir() {
12
15
  const homeDir = process.env.HOME || process.env.USERPROFILE || "";
13
16
  return path.join(homeDir, ".config", "opencode");
@@ -32,8 +35,10 @@ function readConfig(configPath) {
32
35
  }
33
36
  }
34
37
  function writeConfig(configPath, config) {
38
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
35
39
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
36
40
  }
41
+ // ─── File Copy Helpers ───────────────────────────────────────────────────────
37
42
  function copyDirRecursive(src, dest) {
38
43
  fs.mkdirSync(dest, { recursive: true });
39
44
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
@@ -58,14 +63,18 @@ function installAgentsAndSkills(targetDir) {
58
63
  if (fs.existsSync(agentsSrc)) {
59
64
  const agentsDest = path.join(targetDir, "agents");
60
65
  copyDirRecursive(agentsSrc, agentsDest);
61
- const count = fs.readdirSync(agentsSrc).filter((f) => f.endsWith(".md")).length;
66
+ const count = fs
67
+ .readdirSync(agentsSrc)
68
+ .filter((f) => f.endsWith(".md")).length;
62
69
  console.log(` Installed ${count} agents -> ${agentsDest}`);
63
70
  }
64
71
  // Copy skills
65
72
  if (fs.existsSync(skillsSrc)) {
66
73
  const skillsDest = path.join(targetDir, "skills");
67
74
  copyDirRecursive(skillsSrc, skillsDest);
68
- const count = fs.readdirSync(skillsSrc).filter((f) => !f.startsWith(".")).length;
75
+ const count = fs
76
+ .readdirSync(skillsSrc)
77
+ .filter((f) => !f.startsWith(".")).length;
69
78
  console.log(` Installed ${count} skills -> ${skillsDest}`);
70
79
  }
71
80
  }
@@ -93,8 +102,9 @@ function removeAgentsAndSkills(targetDir) {
93
102
  }
94
103
  }
95
104
  }
105
+ // ─── Commands ────────────────────────────────────────────────────────────────
96
106
  function install() {
97
- console.log(`Installing ${PLUGIN_NAME} v${VERSION}...\n`);
107
+ console.log(`\nInstalling ${PLUGIN_NAME} v${VERSION}...\n`);
98
108
  const globalDir = getGlobalDir();
99
109
  const configInfo = findOpencodeConfig();
100
110
  if (!configInfo) {
@@ -127,33 +137,206 @@ function install() {
127
137
  // Copy agents and skills into the global opencode config dir
128
138
  console.log("Installing agents and skills...");
129
139
  installAgentsAndSkills(globalDir);
130
- console.log("\nDone! Restart OpenCode to load the plugin.");
140
+ console.log("\nDone! Next steps:");
141
+ console.log(` 1. Run 'npx ${PLUGIN_NAME} configure' to select your models`);
142
+ console.log(" 2. Restart OpenCode to load the plugin\n");
131
143
  }
132
144
  function uninstall() {
133
- console.log(`Uninstalling ${PLUGIN_NAME}...\n`);
145
+ console.log(`\nUninstalling ${PLUGIN_NAME}...\n`);
134
146
  const configInfo = findOpencodeConfig();
135
147
  if (!configInfo) {
136
148
  console.log("No OpenCode config found. Nothing to uninstall.");
137
149
  return;
138
150
  }
139
151
  const config = readConfig(configInfo.path);
152
+ // Remove plugin entry
140
153
  if (config.plugin?.includes(PLUGIN_NAME)) {
141
154
  config.plugin = config.plugin.filter((p) => p !== PLUGIN_NAME);
142
- writeConfig(configInfo.path, config);
143
155
  console.log(`Removed plugin from config: ${configInfo.path}\n`);
144
156
  }
157
+ // Remove agent model configs that we set
158
+ if (config.agent) {
159
+ for (const name of ALL_AGENTS) {
160
+ if (config.agent[name]) {
161
+ delete config.agent[name].model;
162
+ // Clean up empty agent entries
163
+ if (Object.keys(config.agent[name]).length === 0) {
164
+ delete config.agent[name];
165
+ }
166
+ }
167
+ }
168
+ // Clean up empty agent object
169
+ if (Object.keys(config.agent).length === 0) {
170
+ delete config.agent;
171
+ }
172
+ }
173
+ writeConfig(configInfo.path, config);
145
174
  // Remove agents and skills
146
175
  const globalDir = getGlobalDir();
147
176
  console.log("Removing agents and skills...");
148
177
  removeAgentsAndSkills(globalDir);
149
- console.log("\nDone! Restart OpenCode to apply changes.");
178
+ console.log("\nDone! Restart OpenCode to apply changes.\n");
179
+ }
180
+ async function configure() {
181
+ const args = process.argv.slice(3);
182
+ const isReset = args.includes("--reset");
183
+ // Handle --reset flag
184
+ if (isReset) {
185
+ return configureReset();
186
+ }
187
+ console.log(`\n🔧 Cortex Agents — Model Configuration\n`);
188
+ // Ensure plugin is installed first
189
+ const configInfo = findOpencodeConfig();
190
+ const config = configInfo
191
+ ? readConfig(configInfo.path)
192
+ : { $schema: "https://opencode.ai/config.json" };
193
+ if (!config.plugin?.includes(PLUGIN_NAME)) {
194
+ console.log(`⚠ Plugin not installed. Adding '${PLUGIN_NAME}' to config first.\n`);
195
+ if (!config.plugin)
196
+ config.plugin = [];
197
+ config.plugin.push(PLUGIN_NAME);
198
+ }
199
+ // ── Primary model selection ────────────────────────────────
200
+ const primaryChoices = getPrimaryChoices();
201
+ primaryChoices.push({
202
+ title: "Enter custom model ID",
203
+ description: "provider/model format",
204
+ value: "__custom__",
205
+ });
206
+ console.log("Primary agents (build, plan, debug) handle complex tasks.\nUse your best available model.\n");
207
+ const { primaryModel } = await prompts({
208
+ type: "select",
209
+ name: "primaryModel",
210
+ message: "Select model for PRIMARY agents:",
211
+ choices: primaryChoices,
212
+ hint: "Use arrow keys, Enter to confirm",
213
+ });
214
+ // User cancelled (Ctrl+C)
215
+ if (primaryModel === undefined) {
216
+ console.log("\nConfiguration cancelled.\n");
217
+ process.exit(0);
218
+ }
219
+ let primary = primaryModel;
220
+ if (primary === "__custom__") {
221
+ const { custom } = await prompts({
222
+ type: "text",
223
+ name: "custom",
224
+ message: "Enter model ID (provider/model):",
225
+ validate: (v) => v.includes("/") ? true : "Format: provider/model-name",
226
+ });
227
+ if (!custom) {
228
+ console.log("\nConfiguration cancelled.\n");
229
+ process.exit(0);
230
+ }
231
+ primary = custom;
232
+ }
233
+ console.log(`\n✓ Primary model: ${primary}\n`);
234
+ // ── Subagent model selection ───────────────────────────────
235
+ const subagentChoices = getSubagentChoices(primary);
236
+ subagentChoices.push({
237
+ title: "Enter custom model ID",
238
+ description: "provider/model format",
239
+ value: "__custom__",
240
+ });
241
+ console.log("Subagents (fullstack, testing, security, devops) handle focused tasks.\nA faster/cheaper model works great here.\n");
242
+ const { subagentModel } = await prompts({
243
+ type: "select",
244
+ name: "subagentModel",
245
+ message: "Select model for SUBAGENTS:",
246
+ choices: subagentChoices,
247
+ hint: "Use arrow keys, Enter to confirm",
248
+ });
249
+ if (subagentModel === undefined) {
250
+ console.log("\nConfiguration cancelled.\n");
251
+ process.exit(0);
252
+ }
253
+ let subagent = subagentModel === "__same__" ? primary : subagentModel;
254
+ if (subagent === "__custom__") {
255
+ const { custom } = await prompts({
256
+ type: "text",
257
+ name: "custom",
258
+ message: "Enter model ID (provider/model):",
259
+ validate: (v) => v.includes("/") ? true : "Format: provider/model-name",
260
+ });
261
+ if (!custom) {
262
+ console.log("\nConfiguration cancelled.\n");
263
+ process.exit(0);
264
+ }
265
+ subagent = custom;
266
+ }
267
+ console.log(`✓ Subagent model: ${subagent}\n`);
268
+ // ── Write to opencode.json ─────────────────────────────────
269
+ if (!config.agent)
270
+ config.agent = {};
271
+ for (const name of PRIMARY_AGENTS) {
272
+ if (!config.agent[name])
273
+ config.agent[name] = {};
274
+ config.agent[name].model = primary;
275
+ }
276
+ for (const name of SUBAGENTS) {
277
+ if (!config.agent[name])
278
+ config.agent[name] = {};
279
+ config.agent[name].model = subagent;
280
+ }
281
+ const targetPath = configInfo?.path || path.join(getGlobalDir(), "opencode.json");
282
+ writeConfig(targetPath, config);
283
+ // ── Print summary ──────────────────────────────────────────
284
+ console.log("━".repeat(50));
285
+ console.log(`✓ Configuration saved to ${targetPath}\n`);
286
+ console.log(" Primary agents:");
287
+ for (const name of PRIMARY_AGENTS) {
288
+ console.log(` ${name.padEnd(10)} → ${primary}`);
289
+ }
290
+ console.log("\n Subagents:");
291
+ for (const name of SUBAGENTS) {
292
+ console.log(` ${name.padEnd(10)} → ${subagent}`);
293
+ }
294
+ console.log("\nRestart OpenCode to apply changes.\n");
295
+ }
296
+ function configureReset() {
297
+ console.log(`\n🔧 Cortex Agents — Reset Model Configuration\n`);
298
+ const configInfo = findOpencodeConfig();
299
+ if (!configInfo) {
300
+ console.log("No OpenCode config found. Nothing to reset.\n");
301
+ return;
302
+ }
303
+ const config = readConfig(configInfo.path);
304
+ if (!config.agent) {
305
+ console.log("No agent configuration found. Nothing to reset.\n");
306
+ return;
307
+ }
308
+ let resetCount = 0;
309
+ for (const name of ALL_AGENTS) {
310
+ if (config.agent[name]?.model) {
311
+ delete config.agent[name].model;
312
+ resetCount++;
313
+ // Clean up empty agent entries
314
+ if (Object.keys(config.agent[name]).length === 0) {
315
+ delete config.agent[name];
316
+ }
317
+ }
318
+ }
319
+ // Clean up empty agent object
320
+ if (Object.keys(config.agent).length === 0) {
321
+ delete config.agent;
322
+ }
323
+ if (resetCount === 0) {
324
+ console.log("No model configuration found for cortex agents. Nothing to reset.\n");
325
+ return;
326
+ }
327
+ writeConfig(configInfo.path, config);
328
+ console.log(`✓ Reset ${resetCount} agent model configurations.`);
329
+ console.log(` Config: ${configInfo.path}`);
330
+ console.log("\nAgents will now use OpenCode's default model.");
331
+ console.log("Restart OpenCode to apply changes.\n");
332
+ console.log(`Run 'npx ${PLUGIN_NAME} configure' to select new models.\n`);
150
333
  }
151
334
  function status() {
152
- console.log(`${PLUGIN_NAME} v${VERSION}\n`);
335
+ console.log(`\n${PLUGIN_NAME} v${VERSION}\n`);
153
336
  const configInfo = findOpencodeConfig();
154
337
  if (!configInfo) {
155
338
  console.log("Status: NOT INSTALLED");
156
- console.log(`\nRun 'npx ${PLUGIN_NAME} install' to set up.`);
339
+ console.log(`\nRun 'npx ${PLUGIN_NAME} install' to set up.\n`);
157
340
  return;
158
341
  }
159
342
  const config = readConfig(configInfo.path);
@@ -172,55 +355,100 @@ function status() {
172
355
  : 0;
173
356
  console.log(`\nAgents installed: ${agentCount}`);
174
357
  console.log(`Skills installed: ${skillCount}`);
358
+ // Show model configuration
359
+ if (config.agent) {
360
+ const primaryModels = PRIMARY_AGENTS.map((n) => config.agent?.[n]?.model).filter(Boolean);
361
+ const subagentModels = SUBAGENTS.map((n) => config.agent?.[n]?.model).filter(Boolean);
362
+ if (primaryModels.length > 0 || subagentModels.length > 0) {
363
+ console.log("\nModel Configuration:");
364
+ if (primaryModels.length > 0) {
365
+ const unique = [...new Set(primaryModels)];
366
+ console.log(` Primary agents: ${unique.join(", ")}`);
367
+ }
368
+ if (subagentModels.length > 0) {
369
+ const unique = [...new Set(subagentModels)];
370
+ console.log(` Subagents: ${unique.join(", ")}`);
371
+ }
372
+ }
373
+ else {
374
+ console.log("\nModels: Not configured (using OpenCode defaults)");
375
+ console.log(` Run 'npx ${PLUGIN_NAME} configure' to select models.`);
376
+ }
377
+ }
378
+ else {
379
+ console.log("\nModels: Not configured (using OpenCode defaults)");
380
+ console.log(` Run 'npx ${PLUGIN_NAME} configure' to select models.`);
381
+ }
175
382
  if (!isInstalled) {
176
383
  console.log(`\nRun 'npx ${PLUGIN_NAME} install' to add to config.`);
177
384
  }
385
+ console.log();
178
386
  }
179
387
  function help() {
180
388
  console.log(`${PLUGIN_NAME} v${VERSION}
181
389
 
182
- Cortex agents for OpenCode - worktree workflow, plan persistence, and session management.
390
+ Supercharge OpenCode with structured workflows, intelligent agents,
391
+ and automated development practices.
183
392
 
184
393
  USAGE:
185
- npx ${PLUGIN_NAME} <command>
394
+ npx ${PLUGIN_NAME} <command> [options]
186
395
 
187
396
  COMMANDS:
188
- install Install plugin, agents, and skills into OpenCode config
189
- uninstall Remove plugin, agents, and skills from OpenCode config
190
- status Show installation status
191
- help Show this help message
397
+ install Install plugin, agents, and skills into OpenCode config
398
+ configure Interactive model selection for all agents
399
+ configure --reset Reset model configuration to OpenCode defaults
400
+ uninstall Remove plugin, agents, skills, and model config
401
+ status Show installation and model configuration status
402
+ help Show this help message
192
403
 
193
404
  EXAMPLES:
194
- npx ${PLUGIN_NAME} install # Full install
195
- npx ${PLUGIN_NAME} status # Check status
405
+ npx ${PLUGIN_NAME} install # Install plugin
406
+ npx ${PLUGIN_NAME} configure # Select models interactively
407
+ npx ${PLUGIN_NAME} configure --reset # Reset to default models
408
+ npx ${PLUGIN_NAME} status # Check status
196
409
 
197
- INCLUDED TOOLS:
198
- cortex_init, cortex_status - .cortex directory management
199
- worktree_create, worktree_list, worktree_remove, worktree_open
200
- branch_create, branch_status, branch_switch
201
- plan_save, plan_list, plan_load, plan_delete
202
- session_save, session_list, session_load
410
+ AGENTS:
411
+ Primary (build, plan, debug):
412
+ Handle complex tasks — select your best model.
203
413
 
204
- INCLUDED AGENTS:
205
- build - Pre-implementation workflow with branch/worktree prompts
206
- plan - Create and save implementation plans with mermaid diagrams
207
- debug - Pre-fix workflow with hotfix worktree support
208
- fullstack - End-to-end feature implementation
209
- testing - Test writing and coverage analysis
210
- security - Security audit and vulnerability detection
211
- devops - CI/CD and deployment automation
414
+ Subagents (fullstack, testing, security, devops):
415
+ Handle focused tasks a fast/cheap model works great.
212
416
 
213
- INCLUDED SKILLS:
214
- web-development, testing-strategies, security-hardening,
215
- deployment-automation, code-quality, git-workflow
417
+ TOOLS (22):
418
+ cortex_init, cortex_status .cortex directory management
419
+ worktree_create, worktree_list Git worktree management
420
+ worktree_remove, worktree_open
421
+ worktree_launch Launch worktree (terminal/PTY/background)
422
+ branch_create, branch_status Git branch operations
423
+ branch_switch
424
+ plan_save, plan_list Plan persistence
425
+ plan_load, plan_delete
426
+ session_save, session_list Session management
427
+ session_load
428
+ docs_init, docs_save Mermaid documentation
429
+ docs_list, docs_index
430
+ task_finalize Commit, push, and create PR
431
+
432
+ SKILLS (14):
433
+ web-development, frontend-development, backend-development,
434
+ mobile-development, desktop-development, database-design,
435
+ api-design, architecture-patterns, design-patterns,
436
+ testing-strategies, security-hardening, deployment-automation,
437
+ performance-optimization, code-quality, git-workflow
216
438
  `);
217
439
  }
218
- // Parse command
440
+ // ─── CLI Entry Point ─────────────────────────────────────────────────────────
219
441
  const command = process.argv[2] || "help";
220
442
  switch (command) {
221
443
  case "install":
222
444
  install();
223
445
  break;
446
+ case "configure":
447
+ configure().catch((err) => {
448
+ console.error("Configuration failed:", err.message);
449
+ process.exit(1);
450
+ });
451
+ break;
224
452
  case "uninstall":
225
453
  uninstall();
226
454
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AASlD,eAAO,MAAM,YAAY,EAAE,MA8B1B,CAAC;AAGF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAsBlD,eAAO,MAAM,YAAY,EAAE,MAmE1B,CAAC;AAGF,eAAe,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,18 @@ import * as worktree from "./tools/worktree";
4
4
  import * as branch from "./tools/branch";
5
5
  import * as plan from "./tools/plan";
6
6
  import * as session from "./tools/session";
7
+ import * as docs from "./tools/docs";
8
+ import * as task from "./tools/task";
9
+ // Agent descriptions for handover toast notifications
10
+ const AGENT_DESCRIPTIONS = {
11
+ build: "Development mode — ready to implement",
12
+ plan: "Planning mode — read-only analysis",
13
+ debug: "Debug mode — troubleshooting and fixes",
14
+ fullstack: "Fullstack subagent — end-to-end implementation",
15
+ testing: "Testing subagent — writing tests",
16
+ security: "Security subagent — vulnerability audit",
17
+ devops: "DevOps subagent — CI/CD and deployment",
18
+ };
7
19
  export const CortexPlugin = async (ctx) => {
8
20
  return {
9
21
  tool: {
@@ -15,6 +27,8 @@ export const CortexPlugin = async (ctx) => {
15
27
  worktree_list: worktree.list,
16
28
  worktree_remove: worktree.remove,
17
29
  worktree_open: worktree.open,
30
+ // Dynamic tool: needs client + shell via factory (closure injection)
31
+ worktree_launch: worktree.createLaunch(ctx.client, ctx.$),
18
32
  // Branch tools - git branch operations
19
33
  branch_create: branch.create,
20
34
  branch_status: branch.status,
@@ -28,6 +42,35 @@ export const CortexPlugin = async (ctx) => {
28
42
  session_save: session.save,
29
43
  session_list: session.list,
30
44
  session_load: session.load,
45
+ // Documentation tools - mermaid docs for decisions, features, flows
46
+ docs_init: docs.init,
47
+ docs_save: docs.save,
48
+ docs_list: docs.list,
49
+ docs_index: docs.index,
50
+ // Task tools - finalize workflow (commit, push, PR)
51
+ task_finalize: task.finalize,
52
+ },
53
+ // Agent handover toast notifications
54
+ async event({ event }) {
55
+ try {
56
+ if (event.type === "message.part.updated" &&
57
+ "part" in event.properties &&
58
+ event.properties.part.type === "agent") {
59
+ const agentName = event.properties.part.name;
60
+ const description = AGENT_DESCRIPTIONS[agentName] || `Switched to ${agentName}`;
61
+ await ctx.client.tui.showToast({
62
+ body: {
63
+ title: `Agent: ${agentName}`,
64
+ message: description,
65
+ variant: "info",
66
+ duration: 4000,
67
+ },
68
+ });
69
+ }
70
+ }
71
+ catch {
72
+ // Toast failure is non-fatal — silently ignore
73
+ }
31
74
  },
32
75
  };
33
76
  };
package/dist/plugin.js CHANGED
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
- // Plugin configuration logic can be added here if needed
3
- // The agents and skills are auto-discovered from .opencode/ directory
2
+ // Plugin configuration logic can be added here if needed.
3
+ // Agents and skills are auto-discovered from the .opencode/ directory.
4
+ // Model configuration is handled by the CLI: npx cortex-agents configure
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Static model registry for cortex-agents.
3
+ *
4
+ * A curated list of well-known providers and their popular models.
5
+ * Used by the `configure` CLI command to present interactive selection.
6
+ * Users can always enter a custom model ID for unlisted providers.
7
+ */
8
+ export interface ModelEntry {
9
+ /** Full model identifier in "provider/model" format */
10
+ id: string;
11
+ /** Human-friendly display name */
12
+ name: string;
13
+ /** Provider display name */
14
+ provider: string;
15
+ /** Model tier for categorised selection */
16
+ tier: "premium" | "standard" | "fast";
17
+ /** Short description shown in the selection menu */
18
+ description: string;
19
+ }
20
+ export declare const MODEL_REGISTRY: ModelEntry[];
21
+ /** Primary agents receive the best available model */
22
+ export declare const PRIMARY_AGENTS: readonly ["build", "plan", "debug"];
23
+ /** Subagents receive a fast/cost-effective model */
24
+ export declare const SUBAGENTS: readonly ["fullstack", "testing", "security", "devops"];
25
+ /** All agent names combined */
26
+ export declare const ALL_AGENTS: readonly ["build", "plan", "debug", "fullstack", "testing", "security", "devops"];
27
+ /**
28
+ * Build the interactive choices list for primary model selection.
29
+ * Shows premium and standard tier models (excluding fast).
30
+ */
31
+ export declare function getPrimaryChoices(): {
32
+ title: string;
33
+ description: string;
34
+ value: string;
35
+ }[];
36
+ /**
37
+ * Build the interactive choices list for subagent model selection.
38
+ * Shows fast tier models plus a "Same as primary" option.
39
+ */
40
+ export declare function getSubagentChoices(primaryModelId: string): {
41
+ title: string;
42
+ description: string;
43
+ value: string;
44
+ }[];
45
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtC,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,UAAU,EAuGtC,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,cAAc,qCAAsC,CAAC;AAElE,oDAAoD;AACpD,eAAO,MAAM,SAAS,yDAA0D,CAAC;AAEjF,+BAA+B;AAC/B,eAAO,MAAM,UAAU,mFAA6C,CAAC;AAErE;;;GAGG;AACH,wBAAgB,iBAAiB;;;;IAMhC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,MAAM;;;;IAcxD"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Static model registry for cortex-agents.
3
+ *
4
+ * A curated list of well-known providers and their popular models.
5
+ * Used by the `configure` CLI command to present interactive selection.
6
+ * Users can always enter a custom model ID for unlisted providers.
7
+ */
8
+ export const MODEL_REGISTRY = [
9
+ // ── Anthropic ──────────────────────────────────────────────
10
+ {
11
+ id: "anthropic/claude-sonnet-4-20250514",
12
+ name: "Claude Sonnet 4",
13
+ provider: "Anthropic",
14
+ tier: "standard",
15
+ description: "Best balance of intelligence and speed",
16
+ },
17
+ {
18
+ id: "anthropic/claude-opus-4-20250514",
19
+ name: "Claude Opus 4",
20
+ provider: "Anthropic",
21
+ tier: "premium",
22
+ description: "Most capable, best for complex architecture",
23
+ },
24
+ {
25
+ id: "anthropic/claude-haiku-3.5",
26
+ name: "Claude 3.5 Haiku",
27
+ provider: "Anthropic",
28
+ tier: "fast",
29
+ description: "Fast and cost-effective for focused tasks",
30
+ },
31
+ // ── OpenAI ─────────────────────────────────────────────────
32
+ {
33
+ id: "openai/o3",
34
+ name: "o3",
35
+ provider: "OpenAI",
36
+ tier: "premium",
37
+ description: "Advanced reasoning model",
38
+ },
39
+ {
40
+ id: "openai/gpt-4.1",
41
+ name: "GPT-4.1",
42
+ provider: "OpenAI",
43
+ tier: "standard",
44
+ description: "Fast multimodal model",
45
+ },
46
+ {
47
+ id: "openai/o4-mini",
48
+ name: "o4 Mini",
49
+ provider: "OpenAI",
50
+ tier: "fast",
51
+ description: "Fast reasoning, cost-effective",
52
+ },
53
+ // ── Google ─────────────────────────────────────────────────
54
+ {
55
+ id: "google/gemini-2.5-pro",
56
+ name: "Gemini 2.5 Pro",
57
+ provider: "Google",
58
+ tier: "premium",
59
+ description: "Large context window, strong reasoning",
60
+ },
61
+ {
62
+ id: "google/gemini-2.5-flash",
63
+ name: "Gemini 2.5 Flash",
64
+ provider: "Google",
65
+ tier: "fast",
66
+ description: "Fast and efficient",
67
+ },
68
+ // ── Kimi ───────────────────────────────────────────────────
69
+ {
70
+ id: "kimi-for-coding/k2p5",
71
+ name: "Kimi K2P5",
72
+ provider: "Kimi",
73
+ tier: "standard",
74
+ description: "Optimized for code generation",
75
+ },
76
+ // ── xAI ────────────────────────────────────────────────────
77
+ {
78
+ id: "xai/grok-3",
79
+ name: "Grok 3",
80
+ provider: "xAI",
81
+ tier: "premium",
82
+ description: "Powerful general-purpose model",
83
+ },
84
+ {
85
+ id: "xai/grok-3-mini",
86
+ name: "Grok 3 Mini",
87
+ provider: "xAI",
88
+ tier: "fast",
89
+ description: "Lightweight and fast",
90
+ },
91
+ // ── DeepSeek ───────────────────────────────────────────────
92
+ {
93
+ id: "deepseek/deepseek-r1",
94
+ name: "DeepSeek R1",
95
+ provider: "DeepSeek",
96
+ tier: "premium",
97
+ description: "Strong reasoning, open-source foundation",
98
+ },
99
+ {
100
+ id: "deepseek/deepseek-chat",
101
+ name: "DeepSeek Chat",
102
+ provider: "DeepSeek",
103
+ tier: "fast",
104
+ description: "Fast general-purpose chat model",
105
+ },
106
+ ];
107
+ /** Primary agents receive the best available model */
108
+ export const PRIMARY_AGENTS = ["build", "plan", "debug"];
109
+ /** Subagents receive a fast/cost-effective model */
110
+ export const SUBAGENTS = ["fullstack", "testing", "security", "devops"];
111
+ /** All agent names combined */
112
+ export const ALL_AGENTS = [...PRIMARY_AGENTS, ...SUBAGENTS];
113
+ /**
114
+ * Build the interactive choices list for primary model selection.
115
+ * Shows premium and standard tier models (excluding fast).
116
+ */
117
+ export function getPrimaryChoices() {
118
+ return MODEL_REGISTRY.filter((m) => m.tier !== "fast").map((m) => ({
119
+ title: `${m.name} (${m.provider.toLowerCase()})`,
120
+ description: m.description,
121
+ value: m.id,
122
+ }));
123
+ }
124
+ /**
125
+ * Build the interactive choices list for subagent model selection.
126
+ * Shows fast tier models plus a "Same as primary" option.
127
+ */
128
+ export function getSubagentChoices(primaryModelId) {
129
+ const choices = MODEL_REGISTRY.filter((m) => m.tier === "fast").map((m) => ({
130
+ title: `${m.name} (${m.provider.toLowerCase()})`,
131
+ description: m.description,
132
+ value: m.id,
133
+ }));
134
+ choices.push({
135
+ title: "Same as primary",
136
+ description: primaryModelId,
137
+ value: "__same__",
138
+ });
139
+ return choices;
140
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"cortex.d.ts","sourceRoot":"","sources":["../../src/tools/cortex.ts"],"names":[],"mappings":"AAmEA,eAAO,MAAM,IAAI;;;;CAkDf,CAAC;AAEH,eAAO,MAAM,MAAM;;;;CAyDjB,CAAC"}
1
+ {"version":3,"file":"cortex.d.ts","sourceRoot":"","sources":["../../src/tools/cortex.ts"],"names":[],"mappings":"AAkEA,eAAO,MAAM,IAAI;;;;CAkDf,CAAC;AAEH,eAAO,MAAM,MAAM;;;;CAyDjB,CAAC"}