apex-dev 3.0.3 → 3.1.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 (2) hide show
  1. package/dist/index.js +128 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31932,15 +31932,24 @@ Scripts: ${Object.keys(pkg.scripts).join(", ")}`;
31932
31932
  - Don't ask for permission to use tools \u2014 just use them.
31933
31933
  - When using FilePickerMax, ALWAYS specify the exact type of files you need (e.g. "show me the main entry point and config files", "files handling authentication"). NEVER send generic prompts like "give me an overview of the codebase".
31934
31934
 
31935
- # Sub-Agents
31936
- You have access to specialized sub-agents that handle specific tasks:
31937
- - **FilePickerMax**: Scans the codebase to find files relevant to a prompt. Always specify the exact type of files needed.
31938
- - **Thinker**: Deep reasoning and planning for complex tasks. Use when you need to analyze a problem carefully before acting.
31939
- - **ThinkerBestOfN**: (MAX mode only) Spawns N parallel thinkers and picks the best reasoning. Use for critical decisions.
31940
- - **EditorMultiPrompt**: (MAX mode only) Tries multiple implementation strategies in parallel and picks the best one.
31941
- - **CodeReviewMulti**: (MAX mode only) Multiple reviewers analyze code from different perspectives (correctness, security, performance).
31942
- - **Commander**: Plans and executes terminal commands for a specific goal.
31943
- - **ContextPruner**: Summarizes conversation history to free context space.
31935
+ # Sub-Agents \u2014 ALWAYS DELEGATE FIRST
31936
+ You have specialized sub-agents. **Your default behavior is to delegate work to sub-agents FIRST.** Only do the work yourself if the sub-agent fails or for trivially simple operations (e.g. reading a single file, a quick grep).
31937
+
31938
+ **Delegation rules (follow strictly):**
31939
+ 1. **Planning & reasoning** \u2192 Call **Thinker** BEFORE implementing anything non-trivial. Let it analyze the problem and produce a plan, then follow that plan.
31940
+ 2. **Finding files** \u2192 Call **FilePickerMax** to locate relevant files instead of manually running Glob/Grep/ListDir chains. Always specify the exact type of files needed.
31941
+ 3. **Shell commands** \u2192 Call **Commander** to plan and execute terminal commands (builds, tests, installs, git ops) instead of calling Bash directly.
31942
+ 4. **Critical decisions** \u2192 Call **ThinkerBestOfN** (MAX mode) to get multiple perspectives before deciding.
31943
+ 5. **Important code changes** \u2192 Call **EditorMultiPrompt** (MAX mode) to try multiple implementation strategies.
31944
+ 6. **Code review** \u2192 **CodeReviewMulti** (MAX mode) runs automatically; don't duplicate its work.
31945
+ 7. **Context management** \u2192 **ContextPruner** summarizes long conversations automatically.
31946
+
31947
+ **Fallback rule:** If a sub-agent call fails or returns an error, THEN do the work yourself using basic tools (Read, Edit, Bash, Grep, etc.). Never give up \u2014 always fall back to manual if delegation fails.
31948
+
31949
+ **Do NOT skip delegation** just because you think you can do it faster. Sub-agents provide better results through specialization. The only exceptions are:
31950
+ - Reading a single known file path (just use Read)
31951
+ - A single targeted grep for a known pattern (just use Grep)
31952
+ - Answering a question from memory/context (just respond)
31944
31953
 
31945
31954
  # Modes
31946
31955
  Current mode: ${getMode()}
@@ -33437,7 +33446,7 @@ var require_agent = __commonJS((exports, module2) => {
33437
33446
  const lower = text.toLowerCase();
33438
33447
  return EXPLORATION_KEYWORDS.some((keyword) => lower.includes(keyword));
33439
33448
  }
33440
- var COMPLEX_TASK_KEYWORDS = [
33449
+ var CODING_TASK_KEYWORDS = [
33441
33450
  "refactor",
33442
33451
  "redesign",
33443
33452
  "architect",
@@ -33445,8 +33454,8 @@ var require_agent = __commonJS((exports, module2) => {
33445
33454
  "overhaul",
33446
33455
  "implement",
33447
33456
  "build",
33448
- "create a system",
33449
- "design pattern",
33457
+ "create",
33458
+ "design",
33450
33459
  "add feature",
33451
33460
  "new feature",
33452
33461
  "integrate",
@@ -33454,19 +33463,93 @@ var require_agent = __commonJS((exports, module2) => {
33454
33463
  "multiple files",
33455
33464
  "across files",
33456
33465
  "full stack",
33457
- "database schema",
33458
- "api endpoint",
33466
+ "database",
33467
+ "api",
33468
+ "endpoint",
33459
33469
  "authentication",
33460
33470
  "complex",
33461
33471
  "tricky",
33462
33472
  "challenging",
33463
- "difficult"
33473
+ "difficult",
33474
+ "fix",
33475
+ "bug",
33476
+ "error",
33477
+ "broken",
33478
+ "crash",
33479
+ "issue",
33480
+ "problem",
33481
+ "update",
33482
+ "change",
33483
+ "modify",
33484
+ "edit",
33485
+ "write",
33486
+ "rewrite",
33487
+ "add",
33488
+ "remove",
33489
+ "delete",
33490
+ "move",
33491
+ "rename",
33492
+ "replace",
33493
+ "optimize",
33494
+ "improve",
33495
+ "enhance",
33496
+ "extend",
33497
+ "upgrade",
33498
+ "set up",
33499
+ "setup",
33500
+ "configure",
33501
+ "install",
33502
+ "connect",
33503
+ "debug",
33504
+ "troubleshoot",
33505
+ "investigate",
33506
+ "diagnose",
33507
+ "test",
33508
+ "spec",
33509
+ "coverage"
33464
33510
  ];
33465
- function isComplexTask(text) {
33511
+ function isCodingTask(text) {
33466
33512
  const lower = text.toLowerCase();
33467
33513
  const wordCount = text.split(/\s+/).length;
33468
- const keywordMatch = COMPLEX_TASK_KEYWORDS.some((kw) => lower.includes(kw));
33469
- return keywordMatch || wordCount > 40;
33514
+ const keywordMatch = CODING_TASK_KEYWORDS.some((kw) => lower.includes(kw));
33515
+ return keywordMatch || wordCount > 20;
33516
+ }
33517
+ var COMMAND_TASK_KEYWORDS = [
33518
+ "run",
33519
+ "execute",
33520
+ "start",
33521
+ "stop",
33522
+ "restart",
33523
+ "deploy",
33524
+ "build",
33525
+ "compile",
33526
+ "bundle",
33527
+ "test",
33528
+ "lint",
33529
+ "format",
33530
+ "install",
33531
+ "uninstall",
33532
+ "upgrade",
33533
+ "npm",
33534
+ "bun",
33535
+ "yarn",
33536
+ "git commit",
33537
+ "git push",
33538
+ "git pull",
33539
+ "git merge",
33540
+ "git rebase",
33541
+ "docker",
33542
+ "container",
33543
+ "serve",
33544
+ "dev server",
33545
+ "check status",
33546
+ "disk space",
33547
+ "process",
33548
+ "kill"
33549
+ ];
33550
+ function isCommandTask(text) {
33551
+ const lower = text.toLowerCase();
33552
+ return COMMAND_TASK_KEYWORDS.some((kw) => lower.includes(kw)) && !isCodingTask(text);
33470
33553
  }
33471
33554
  async function handleUserInput(userInput) {
33472
33555
  isProcessing = true;
@@ -33492,23 +33575,42 @@ ${pickerResult}`
33492
33575
  }
33493
33576
  }
33494
33577
  const mode = getMode();
33495
- if (mode === "max" && isComplexTask(userInput)) {
33496
- const thinkId = store.addMessage({ role: "system", content: "Deep thinking...", label: "\uD83E\uDDE0 Thinker" });
33578
+ if (isCommandTask(userInput)) {
33579
+ const cmdId = store.addMessage({ role: "system", content: "Delegating to Commander...", label: "\u26A1 Commander" });
33580
+ try {
33581
+ const cmdResult = await executeTool("Commander", { prompt: userInput }, (partial) => {
33582
+ store.updateMessage(cmdId, { content: partial, label: "\u26A1 Commander" });
33583
+ });
33584
+ store.updateMessage(cmdId, { content: cmdResult, label: "\u26A1 Commander" });
33585
+ session.conversationHistory.push({
33586
+ role: "assistant",
33587
+ content: `[Commander result]
33588
+ ${cmdResult}`
33589
+ });
33590
+ } catch (err) {
33591
+ store.updateMessage(cmdId, { content: `Commander failed (falling back to main agent): ${err.message}` });
33592
+ }
33593
+ }
33594
+ if (isCodingTask(userInput) && !isCommandTask(userInput)) {
33595
+ const thinkLabel = mode === "max" ? "\uD83E\uDDE0 Deep Thinker (MAX)" : "\uD83E\uDDE0 Thinker";
33596
+ const thinkId = store.addMessage({ role: "system", content: "Planning approach...", label: thinkLabel });
33497
33597
  try {
33498
- const thinkerResult = await executeTool("Thinker", { prompt: userInput }, (partial) => {
33499
- store.updateMessage(thinkId, { content: partial, label: "\uD83E\uDDE0 Thinker" });
33598
+ const toolName = mode === "max" ? "ThinkerBestOfN" : "Thinker";
33599
+ const toolArgs = mode === "max" ? { prompt: userInput, n: 3 } : { prompt: userInput };
33600
+ const thinkerResult = await executeTool(toolName, toolArgs, (partial) => {
33601
+ store.updateMessage(thinkId, { content: partial, label: thinkLabel });
33500
33602
  });
33501
- store.updateMessage(thinkId, { content: thinkerResult, label: "\uD83E\uDDE0 Thinker" });
33603
+ store.updateMessage(thinkId, { content: thinkerResult, label: thinkLabel });
33502
33604
  session.conversationHistory.push({
33503
33605
  role: "assistant",
33504
- content: `[Thinker analysis]
33606
+ content: `[Thinker analysis \u2014 follow this plan]
33505
33607
  ${thinkerResult}`
33506
33608
  });
33507
33609
  } catch (err) {
33508
- store.updateMessage(thinkId, { content: `Thinker failed: ${err.message}` });
33610
+ store.updateMessage(thinkId, { content: `Thinker failed (falling back to main agent): ${err.message}` });
33509
33611
  }
33510
33612
  }
33511
- if (mode === "max" && session.conversationHistory.length > 20) {
33613
+ if (session.conversationHistory.length > 20) {
33512
33614
  try {
33513
33615
  await executeTool("ContextPruner", {}, null);
33514
33616
  } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apex-dev",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "description": "Apex AI - a friendly agentic coding assistant for the terminal",
5
5
  "main": "dist/index.js",
6
6
  "bin": {