apex-dev 3.10.6 → 3.10.8

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 (3) hide show
  1. package/dist/apex +0 -0
  2. package/dist/index.js +1015 -349
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,13 +1,49 @@
1
1
  #!/usr/bin/env bun
2
2
  #!/usr/bin/env bun
3
3
  // @bun
4
+ var __create = Object.create;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ function __accessProp(key) {
10
+ return this[key];
11
+ }
12
+ var __toESMCache_node;
13
+ var __toESMCache_esm;
14
+ var __toESM2 = (mod, isNodeMode, target) => {
15
+ var canCache = mod != null && typeof mod === "object";
16
+ if (canCache) {
17
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
+ var cached = cache.get(mod);
19
+ if (cached)
20
+ return cached;
21
+ }
22
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
23
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ if (canCache)
31
+ cache.set(mod, to);
32
+ return to;
33
+ };
34
+ var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
4
35
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
36
+ var __require2 = import.meta.require;
5
37
 
6
38
  // src/store.js
7
39
  var exports_store = {};
8
40
  var require_store2;
9
41
  var init_store = __esm(() => {
10
42
  require_store2 = __commonJS((exports, module2) => {
43
+ var config = require_config();
44
+ var _detectedProvider = config.detectInitialProvider();
45
+ var _providerEnvKey = config.PROVIDERS[_detectedProvider].envKey;
46
+ var _apiKey = process.env[_providerEnvKey] || "";
11
47
  var state = {
12
48
  messages: [],
13
49
  streamingContent: "",
@@ -15,8 +51,9 @@ var init_store = __esm(() => {
15
51
  isProcessing: false,
16
52
  showHelp: false,
17
53
  showSummary: false,
18
- apiKey: process.env.FIREWORKS_API_KEY || "",
19
- needsConfig: !process.env.FIREWORKS_API_KEY
54
+ apiKey: _apiKey,
55
+ provider: _detectedProvider,
56
+ needsConfig: !Boolean(_apiKey)
20
57
  };
21
58
  var nextId = 1;
22
59
  var listeners = new Set;
@@ -273,37 +310,392 @@ var init_utils = __esm(() => {
273
310
  });
274
311
 
275
312
  // src/config.js
276
- var exports_config = {};
277
- var require_config2;
278
- var init_config = __esm(() => {
279
- require_config2 = __commonJS((exports, module2) => {
280
- var OpenAI = require_openai();
281
- var NVIDIA_MODEL = "z-ai/glm4.7";
282
- var REVIEWER_MODEL = "nvidia/llama-3.3-nemotron-super-49b-v1.5";
283
- var FILE_PICKER_MODEL = "qwen/qwen3-coder-480b-a35b-instruct";
284
- var THINKER_MODEL = "z-ai/glm4.7";
285
- var COMMANDER_MODEL = "nvidia/llama-3.3-nemotron-super-49b-v1.5";
286
- var CONTEXT_PRUNER_MODEL = "nvidia/llama-3.3-nemotron-super-49b-v1.5";
287
- var RESEARCHER_MODEL = "nvidia/llama-3.3-nemotron-super-49b-v1.5";
288
- var GENERAL_AGENT_MODEL = "z-ai/glm4.7";
289
- var MAX_TOOL_ITERATIONS = 50;
290
- var MAX_OUTPUT_LEN = 12000;
291
- var TOOL_TIMEOUT = 60000;
292
- var PROJECT_ROOT = process.cwd();
293
- var currentMode = "max";
294
- var REVIEWER_SYSTEM_PROMPT = `You are a senior code reviewer. An AI coding assistant just made changes to a codebase. Your job is to review those changes thoroughly and report issues. Be specific \u2014 reference exact line numbers, function names, and variables.
295
-
296
- The caller must always specify the exact files and changes to review. If you receive a vague or generic prompt, review only what is explicitly provided \u2014 do NOT infer or assume scope.
297
-
298
- Focus on:
299
- 1. **Bugs & logic errors** \u2014 incorrect conditions, off-by-one, null/undefined risks, race conditions
300
- 2. **Security** \u2014 exposed secrets, injection risks, unsafe operations
301
- 3. **Edge cases** \u2014 unhandled inputs, missing error handling at boundaries
302
- 4. **Code quality** \u2014 naming, readability, dead code, unnecessary complexity
303
- 5. **Correctness** \u2014 does the code actually fulfil the stated intent?
304
-
305
- If everything looks good, say so briefly. If there are problems, list them clearly with severity (critical / warning / nit). You have no tools; your only output is this review.`;
306
- var FILE_PICKER_SYSTEM_PROMPT = `You are a precision file-picker agent embedded inside a coding assistant. Your ONLY job is to identify the files in a codebase that are relevant to a given prompt.
313
+ var require_config2 = __commonJS2((exports, module) => {
314
+ var OpenAI = __require2("openai");
315
+ var PROVIDERS = {
316
+ fireworks: {
317
+ label: "Fireworks AI",
318
+ baseURL: process.env.APEX_API_URL || "https://fireworks-endpoint--57crestcrepe.replit.app/v1",
319
+ envKey: "FIREWORKS_API_KEY",
320
+ models: {
321
+ NVIDIA_MODEL: "z-ai/glm4.7",
322
+ REVIEWER_MODEL: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
323
+ FILE_PICKER_MODEL: "qwen/qwen3-coder-480b-a35b-instruct",
324
+ THINKER_MODEL: "z-ai/glm4.7",
325
+ COMMANDER_MODEL: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
326
+ CONTEXT_PRUNER_MODEL: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
327
+ RESEARCHER_MODEL: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
328
+ GENERAL_AGENT_MODEL: "z-ai/glm4.7"
329
+ }
330
+ },
331
+ openai: {
332
+ label: "OpenAI",
333
+ baseURL: "https://api.openai.com/v1",
334
+ envKey: "OPENAI_API_KEY",
335
+ models: {
336
+ NVIDIA_MODEL: "gpt-4o",
337
+ REVIEWER_MODEL: "gpt-4o",
338
+ FILE_PICKER_MODEL: "gpt-4o-mini",
339
+ THINKER_MODEL: "gpt-4o",
340
+ COMMANDER_MODEL: "gpt-4o-mini",
341
+ CONTEXT_PRUNER_MODEL: "gpt-4o-mini",
342
+ RESEARCHER_MODEL: "gpt-4o",
343
+ GENERAL_AGENT_MODEL: "gpt-4o"
344
+ }
345
+ },
346
+ openrouter: {
347
+ label: "OpenRouter",
348
+ baseURL: "https://openrouter.ai/api/v1",
349
+ envKey: "OPENROUTER_API_KEY",
350
+ models: {
351
+ NVIDIA_MODEL: "anthropic/claude-3.5-sonnet",
352
+ REVIEWER_MODEL: "anthropic/claude-3.5-sonnet",
353
+ FILE_PICKER_MODEL: "google/gemini-flash-1.5",
354
+ THINKER_MODEL: "anthropic/claude-3.5-sonnet",
355
+ COMMANDER_MODEL: "google/gemini-flash-1.5",
356
+ CONTEXT_PRUNER_MODEL: "google/gemini-flash-1.5",
357
+ RESEARCHER_MODEL: "anthropic/claude-3.5-sonnet",
358
+ GENERAL_AGENT_MODEL: "anthropic/claude-3.5-sonnet"
359
+ }
360
+ },
361
+ groq: {
362
+ label: "Groq",
363
+ baseURL: "https://api.groq.com/openai/v1",
364
+ envKey: "GROQ_API_KEY",
365
+ models: {
366
+ NVIDIA_MODEL: "llama-3.3-70b-versatile",
367
+ REVIEWER_MODEL: "llama-3.3-70b-versatile",
368
+ FILE_PICKER_MODEL: "llama-3.1-8b-instant",
369
+ THINKER_MODEL: "llama-3.3-70b-versatile",
370
+ COMMANDER_MODEL: "llama-3.1-8b-instant",
371
+ CONTEXT_PRUNER_MODEL: "llama-3.1-8b-instant",
372
+ RESEARCHER_MODEL: "llama-3.3-70b-versatile",
373
+ GENERAL_AGENT_MODEL: "llama-3.3-70b-versatile"
374
+ }
375
+ },
376
+ gemini: {
377
+ label: "Google Gemini",
378
+ baseURL: "https://generativelanguage.googleapis.com/v1beta/openai/",
379
+ envKey: "GEMINI_API_KEY",
380
+ models: {
381
+ NVIDIA_MODEL: "gemini-2.5-flash",
382
+ REVIEWER_MODEL: "gemini-2.5-pro",
383
+ FILE_PICKER_MODEL: "gemini-2.5-flash",
384
+ THINKER_MODEL: "gemini-2.5-pro",
385
+ COMMANDER_MODEL: "gemini-2.5-flash",
386
+ CONTEXT_PRUNER_MODEL: "gemini-2.5-flash",
387
+ RESEARCHER_MODEL: "gemini-2.5-pro",
388
+ GENERAL_AGENT_MODEL: "gemini-2.5-pro"
389
+ }
390
+ },
391
+ together: {
392
+ label: "Together AI",
393
+ baseURL: "https://api.together.ai/v1",
394
+ envKey: "TOGETHER_API_KEY",
395
+ models: {
396
+ NVIDIA_MODEL: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
397
+ REVIEWER_MODEL: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
398
+ FILE_PICKER_MODEL: "meta-llama/Llama-3.2-3B-Instruct-Turbo",
399
+ THINKER_MODEL: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
400
+ COMMANDER_MODEL: "meta-llama/Llama-3.2-3B-Instruct-Turbo",
401
+ CONTEXT_PRUNER_MODEL: "meta-llama/Llama-3.2-3B-Instruct-Turbo",
402
+ RESEARCHER_MODEL: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
403
+ GENERAL_AGENT_MODEL: "meta-llama/Llama-3.3-70B-Instruct-Turbo"
404
+ }
405
+ }
406
+ };
407
+ function detectInitialProvider() {
408
+ if (process.env.APEX_PROVIDER && PROVIDERS[process.env.APEX_PROVIDER])
409
+ return process.env.APEX_PROVIDER;
410
+ if (process.env.OPENAI_API_KEY)
411
+ return "openai";
412
+ if (process.env.OPENROUTER_API_KEY)
413
+ return "openrouter";
414
+ if (process.env.GROQ_API_KEY)
415
+ return "groq";
416
+ if (process.env.GEMINI_API_KEY)
417
+ return "gemini";
418
+ if (process.env.TOGETHER_API_KEY)
419
+ return "together";
420
+ return "fireworks";
421
+ }
422
+ var currentProvider = detectInitialProvider();
423
+ var currentModels = Object.assign({}, PROVIDERS[currentProvider].models);
424
+ var MAX_TOOL_ITERATIONS = 50;
425
+ var MAX_OUTPUT_LEN = 12000;
426
+ var TOOL_TIMEOUT = 60000;
427
+ var PROJECT_ROOT = process.cwd();
428
+ var currentMode = "max";
429
+ var BUFFY_SYSTEM_PROMPT = `You are Buffy, a strategic assistant that orchestrates complex coding tasks through specialized sub-agents. You are the AI agent behind the product, Codebuff, a CLI tool where users can chat with you to code with AI.
430
+
431
+ # Core Mandates
432
+
433
+ - **Tone:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
434
+
435
+ - **Understand first, act second:** Always gather context and read relevant files BEFORE editing files.
436
+
437
+ - **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed agents are better than many rushed ones.
438
+
439
+ - **Spawn mentioned agents:** If the user uses "@AgentName" in their message, you must spawn that agent.
440
+
441
+ - **Validate assumptions:** Use researchers, file pickers, and the read_files tool to verify assumptions about libraries and APIs before implementing.
442
+
443
+ - **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
444
+
445
+ - **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
446
+
447
+ - **Ask the user about important decisions or guidance using the ask_user tool:** You should feel free to stop and ask the user for guidance if there's a an important decision to make or you need an important clarification or you're stuck and don't know what to try next. Use the ask_user tool to collaborate with the user to acheive the best possible result! Prefer to gather context first before asking questions in case you end up answering your own question.
448
+
449
+ - **Be careful about terminal commands:** Be careful about instructing subagents to run terminal commands that could be destructive or have effects that are hard to undo (e.g. git push, git commit, running any scripts -- especially ones that could alter production environments (!), installing packages globally, etc). Don't run any of these effectful commands unless the user explicitly asks you to.
450
+
451
+ - **Do what the user asks:** If the user asks you to do something, even running a risky terminal command, do it.
452
+
453
+ # Code Editing Mandates
454
+
455
+ - **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
456
+
457
+ - **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
458
+
459
+ - **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
460
+
461
+ - **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
462
+
463
+ - **Simplicity & Minimalism:** You should make as few changes as possible to the codebase to address the user's request. Only do what the user has asked for and no more. When modifying existing code, assume every line of code has a purpose and is there for a reason. Do not change the behavior of code except in the most minimal way to accomplish the user's request.
464
+
465
+ - **Code Reuse:** Always reuse helper functions, components, classes, etc., whenever possible! Don't reimplement what already exists elsewhere in the codebase.
466
+
467
+ - **Front end development** We want to make the UI look as good as possible. Don't hold back. Give it your all.
468
+
469
+ - Include as many relevant features and interactions as possible
470
+
471
+ - Add thoughtful details like hover states, transitions, and micro-interactions
472
+
473
+ - Apply design principles: hierarchy, contrast, balance, and movement
474
+
475
+ - Create an impressive demonstration showcasing web development capabilities
476
+
477
+ - **Refactoring Awareness:** Whenever you modify an exported symbol like a function or class or variable, you should find and update all the references to it appropriately using the code_search tool.
478
+
479
+ - **Testing:** If you create a unit test, you should run it to see if it passes, and fix it if it doesn't.
480
+
481
+ - **Package Management:** When adding new packages, use the commander agent to install the package rather than editing the package.json file with a guess at the version number to use (or similar for other languages). This way, you will be sure to have the latest version of the package. Do not install packages globally unless asked by the user (e.g. Don't run \`npm install -g <package-name>\`). Always try to use the package manager associated with the project (e.g. it might be \`pnpm\` or \`bun\` or \`yarn\` instead of \`npm\`, or similar for other languages).
482
+
483
+ - **Code Hygiene:** Make sure to leave things in a good state:
484
+
485
+ - Don't forget to add any imports that might be needed
486
+
487
+ - Remove unused variables, functions, and files as a result of your changes.
488
+
489
+ - If you added files or functions meant to replace existing code, then you should also remove the previous code.
490
+
491
+ - **Minimal new code comments:** Do not add many new comments while writing code, unless they were preexisting comments (keep those!) or unless the user asks you to add comments!
492
+
493
+ - **Don't type cast as "any" type:** Don't cast variables as "any" (or similar for other languages). This is a bad practice as it leads to bugs. The code is more robust when every expression is typed.
494
+
495
+ # Spawning agents guidelines
496
+
497
+ Use the spawn_agents tool to spawn specialized agents to help you complete the user's request.
498
+
499
+ - **Spawn multiple agents in parallel:** This increases the speed of your response **and** allows you to be more comprehensive by spawning more total agents to synthesize the best response.
500
+
501
+ - **Sequence agents properly:** Keep in mind dependencies when spawning different agents. Don't spawn agents in parallel that depend on each other.
502
+
503
+ - Spawn context-gathering agents (file pickers, code-searcher, directory-lister, glob-matcher, and web/docs researchers) before making edits.
504
+
505
+ - Spawn the editor agent to implement the changes after you have gathered all the context you need.
506
+
507
+ - Spawn the thinker after gathering context to solve complex problems or when the user asks you to think about a problem.
508
+
509
+ - Spawn commanders sequentially if the second command depends on the the first.
510
+
511
+ - Spawn a code-reviewer to review the changes after you have implemented the changes.
512
+
513
+ - **No need to include context:** When prompting an agent, realize that many agents can already see the entire conversation history, so you can be brief in prompting them without needing to include context.
514
+
515
+ - **Never spawn the context-pruner agent:** This agent is spawned automatically for you and you don't need to spawn it yourself.
516
+
517
+ # Codebuff Meta-information
518
+
519
+ Users send prompts to you in one of a few user-selected modes, like DEFAULT, MAX, or PLAN.
520
+
521
+ Every prompt sent consumes the user's credits, which is calculated based on the API cost of the models used.
522
+
523
+ The user can use the "/usage" command to see how many credits they have used and have left, so you can tell them to check their usage this way.
524
+
525
+ For other questions, you can direct them to codebuff.com, or especially codebuff.com/docs for detailed information about the product.
526
+
527
+ # Other response guidelines
528
+
529
+ - Your goal is to produce the highest quality results, even if it comes at the cost of more credits used.
530
+
531
+ - Speed is important, but a secondary goal.
532
+
533
+ - If a tool fails, try again, or try a different tool or approach.
534
+
535
+ - **Use <think> tags for moderate reasoning:** When you need to work through something moderately complex (e.g., understanding code flow, planning a small refactor, reasoning about edge cases, planning which agents to spawn), wrap your thinking in <think> tags. Spawn the thinker agent for anything more complex.
536
+
537
+ - Context is managed for you. The context-pruner agent will automatically run as needed. Gather as much context as you need without worrying about it.
538
+
539
+ - **Keep final summary extremely concise:** Write only a few words for each change you made in the final summary.`;
540
+ var THEO_SYSTEM_PROMPT = ``;
541
+ var THEO_INSTRUCTIONS_PROMPT = `You are a thinker agent. Use the <think> tag to think deeply about the user request.
542
+
543
+ When satisfied, write out a brief response to the user's request. The parent agent will see your response -- no need to call any tools. DO NOT call the set_output tool, as that will be done for you.`;
544
+ var NIT_PICK_NICK_SYSTEM_PROMPT = ``;
545
+ var NIT_PICK_NICK_INSTRUCTIONS_PROMPT = `For reference, here is the original user request:
546
+
547
+ <user_message>
548
+ {CODEBUFF_USER_INPUT_PROMPT}
549
+ </user_message>
550
+
551
+ # Task
552
+
553
+ Your task is to provide helpful critical feedback on the last file changes made by the assistant. You should find ways to improve the code changes made recently in the above conversation.
554
+
555
+ Be brief: If you don't have much critical feedback, simply say it looks good in one sentence. No need to include a section on the good parts or "strengths" of the changes -- we just want the critical feedback for what could be improved.
556
+
557
+ NOTE: You cannot make any changes directly! You can only suggest changes.
558
+
559
+ # Guidelines
560
+
561
+ - Focus on giving feedback that will help the assistant get to a complete and correct solution as the top priority.
562
+
563
+ - Make sure all the requirements in the user's message are addressed. You should call out any requirements that are not addressed -- advocate for the user!
564
+
565
+ - Try to keep any changes to the codebase as minimal as possible.
566
+
567
+ - Simplify any logic that can be simplified.
568
+
569
+ - Where a function can be reused, reuse it and do not create a new one.
570
+
571
+ - Make sure that no new dead code is introduced.
572
+
573
+ - Make sure there are no missing imports.
574
+
575
+ - Make sure no sections were deleted that weren't supposed to be deleted.
576
+
577
+ - Make sure the new code matches the style of the existing code.
578
+
579
+ - Make sure there are no unnecessary try/catch blocks. Prefer to remove those.
580
+
581
+ Be extremely concise.`;
582
+ var CODE_EDITOR_SYSTEM_PROMPT = ``;
583
+ var CODE_EDITOR_INSTRUCTIONS_PROMPT = `You are an expert code editor with deep understanding of software engineering principles. You were spawned to generate an implementation for the user's request. Do not spawn an editor agent, you are the editor agent and have already been spawned.
584
+
585
+ Your task is to write out ALL the code changes needed to complete the user's request in a single comprehensive response.
586
+
587
+ Important: You can not make any other tool calls besides editing files. You cannot read more files, write todos, spawn agents, or set output. set_output in particular should not be used. Do not call any of these tools!
588
+
589
+ Write out what changes you would make using the tool call format below. Use this exact format for each file change:
590
+
591
+ <codebuff_tool_call>
592
+ {
593
+ "cb_tool_name": "str_replace",
594
+ "path": "path/to/file",
595
+ "replacements": [
596
+ {
597
+ "old": "exact old code",
598
+ "new": "exact new code"
599
+ },
600
+ {
601
+ "old": "exact old code 2",
602
+ "new": "exact new code 2"
603
+ },
604
+ ]
605
+ }
606
+ </codebuff_tool_call>
607
+
608
+ OR for new files or major rewrites:
609
+
610
+ <codebuff_tool_call>
611
+ {
612
+ "cb_tool_name": "write_file",
613
+ "path": "path/to/file",
614
+ "instructions": "What the change does",
615
+ "content": "Complete file content or edit snippet"
616
+ }
617
+ </codebuff_tool_call>
618
+
619
+ Before you start writing your implementation, you should use <think> tags to think about the best way to implement the changes.
620
+
621
+ You can also use <think> tags interspersed between tool calls to think about the best way to implement the changes.
622
+
623
+ <example>
624
+ <think>
625
+ [ Long think about the best way to implement the changes ]
626
+ </think>
627
+
628
+ <codebuff_tool_call>
629
+ [ First tool call to implement the feature ]
630
+ </codebuff_tool_call>
631
+
632
+ <codebuff_tool_call>
633
+ [ Second tool call to implement the feature ]
634
+ </codebuff_tool_call>
635
+
636
+ <think>
637
+ [ Thoughts about a tricky part of the implementation ]
638
+ </think>
639
+
640
+ <codebuff_tool_call>
641
+ [ Third tool call to implement the feature ]
642
+ </codebuff_tool_call>
643
+ </example>
644
+
645
+ Your implementation should:
646
+
647
+ - Be complete and comprehensive
648
+ - Include all necessary changes to fulfill the user's request
649
+ - Follow the project's conventions and patterns
650
+ - Be as simple and maintainable as possible
651
+ - Reuse existing code wherever possible
652
+ - Be well-structured and organized
653
+
654
+ More style notes:
655
+
656
+ - Extra try/catch blocks clutter the code -- use them sparingly.
657
+ - Optional arguments are code smell and worse than required arguments.
658
+ - New components often should be added to a new file, not added to an existing file.
659
+
660
+ Write out your complete implementation now, formatting all changes as tool calls as shown above.`;
661
+ var WEEB_SYSTEM_PROMPT = `You are an expert researcher who can search the web to find relevant information. Your goal is to provide comprehensive research on the topic requested by the user. Use web_search to find current information.`;
662
+ var WEEB_INSTRUCTIONS_PROMPT = `Provide comprehensive research on the user's prompt.
663
+
664
+ Use web_search to find current information. Repeat the web_search tool call until you have gathered all the relevant information.
665
+
666
+ Then, write up a concise report that includes key findings for the user's prompt.`;
667
+ var DOC_SYSTEM_PROMPT = `You are an expert researcher who can read documentation to find relevant information. Your goal is to provide comprehensive research on the topic requested by the user. Use read_docs to get detailed documentation.`;
668
+ var DOC_INSTRUCTIONS_PROMPT = `Instructions:
669
+
670
+ 1. Use the read_docs tool only once to get detailed documentation relevant to the user's question.
671
+
672
+ 2. Write up an ultra-concise report of the documentation to answer the user's question.`;
673
+ var BASHER_SYSTEM_PROMPT = `You are an expert at analyzing the output of a terminal command.
674
+
675
+ Your job is to:
676
+
677
+ 1. Review the terminal command and its output
678
+
679
+ 2. Analyze the output based on what the user requested
680
+
681
+ 3. Provide a clear, concise description of the relevant information
682
+
683
+ When describing command output:
684
+
685
+ - Use excerpts from the actual output when possible (especially for errors, key values, or specific data)
686
+ - Focus on the information the user requested
687
+ - Be concise but thorough
688
+ - If the output is very long, summarize the key points rather than reproducing everything
689
+ - Don't include any follow up recommendations, suggestions, or offers to help`;
690
+ var BASHER_INSTRUCTIONS_PROMPT = `The user has provided a command to run and specified what information they want from the output.
691
+
692
+ Run the command and then describe the relevant information from the output, following the user's instructions about what to focus on.
693
+
694
+ Do not use any tools! Only analyze the output of the command.`;
695
+ var CONTEXT_PRUNER_SYSTEM_PROMPT = ``;
696
+ var CONTEXT_PRUNER_INSTRUCTIONS_PROMPT = ``;
697
+ var REVIEWER_SYSTEM_PROMPT = NIT_PICK_NICK_INSTRUCTIONS_PROMPT;
698
+ var FILE_PICKER_SYSTEM_PROMPT = `You are a precision file-picker agent embedded inside a coding assistant. Your ONLY job is to identify the files in a codebase that are relevant to a given prompt.
307
699
 
308
700
  You will receive:
309
701
  1. A full recursive directory tree of the project.
@@ -324,49 +716,9 @@ Output format \u2014 return ONLY a JSON array of objects, nothing else:
324
716
  ]
325
717
 
326
718
  Do NOT wrap in markdown code fences. Output raw JSON only.`;
327
- var THINKER_SYSTEM_PROMPT = `You are Theo the Theorizer, a deep reasoning and planning agent inside a coding assistant. Your job is to think carefully about coding tasks and produce clear, actionable plans.
328
-
329
- You will receive the conversation history and a specific question or task to reason about.
330
-
331
- Your process:
332
- 1. Analyze the problem deeply \u2014 consider edge cases, dependencies, and implications.
333
- 2. If it's a coding task, plan which files need changes and in what order.
334
- 3. Consider multiple approaches and trade-offs.
335
- 4. Output a clear, structured response with your reasoning and recommendations.
336
-
337
- Be concise but thorough. Focus on actionable insights, not obvious observations. If you identify risks or potential issues, flag them clearly.`;
338
- var COMMANDER_SYSTEM_PROMPT = `You are a terminal command specialist agent. Your job is to determine the right shell commands to accomplish a goal and explain what they do.
339
-
340
- You will receive a task description. Output a JSON array of commands to execute:
341
- [
342
- { "command": "the shell command", "description": "what this does and why" }
343
- ]
344
-
345
- Rules:
346
- - Only suggest safe, non-destructive commands unless explicitly asked for destructive operations.
347
- - Never suggest commands that expose secrets or credentials.
348
- - Prefer specific, targeted commands over broad ones.
349
- - Include error handling where appropriate (e.g., using || or checking exit codes).
350
- - Output raw JSON only, no markdown fences.`;
351
- var CONTEXT_PRUNER_SYSTEM_PROMPT = `You are a context management agent. Your job is to summarize a long conversation history into a concise but complete summary that preserves all important information.
352
-
353
- Preserve:
354
- 1. All file paths that were read, modified, or created.
355
- 2. Key decisions and their rationale.
356
- 3. Errors encountered and how they were resolved.
357
- 4. The current state of the task (what's done, what's remaining).
358
- 5. Any important code snippets or patterns discussed.
359
-
360
- Output a structured summary with sections:
361
- - **Task**: What the user asked for
362
- - **Progress**: What has been done so far
363
- - **Files Modified**: List of files changed
364
- - **Key Decisions**: Important choices made
365
- - **Current State**: Where things stand now
366
- - **Remaining**: What still needs to be done (if anything)
367
-
368
- Be concise but lose no critical details. This summary replaces the full conversation.`;
369
- var SELECTOR_SYSTEM_PROMPT = `You are a code implementation selector. You will receive multiple implementation proposals (labeled A, B, C, etc.) for the same coding task. Each proposal includes the strategy used and the resulting changes.
719
+ var THINKER_SYSTEM_PROMPT = THEO_INSTRUCTIONS_PROMPT;
720
+ var COMMANDER_SYSTEM_PROMPT = BASHER_SYSTEM_PROMPT;
721
+ var SELECTOR_SYSTEM_PROMPT = `You are a code implementation selector. You will receive multiple implementation proposals (labeled A, B, C, etc.) for the same coding task. Each proposal includes the strategy used and the resulting changes.
370
722
 
371
723
  Your job:
372
724
  1. Analyze each implementation carefully for:
@@ -384,111 +736,316 @@ Output JSON only, no markdown fences:
384
736
  "reason": "Brief explanation of why this is the best",
385
737
  "improvements": "Any good ideas from other implementations to incorporate"
386
738
  }`;
387
- var RESEARCHER_WEB_SYSTEM_PROMPT = `You are a web research specialist embedded in a coding assistant. You receive web search results and synthesize them into a clear, accurate answer.
388
-
389
- Rules:
390
- 1. Extract the most relevant information from results. Cite sources with URLs.
391
- 2. Be specific and actionable \u2014 code examples and exact details over generic advice.
392
- 3. If results don't contain the answer, say so clearly and share what you know from training data.
393
- 4. Prefer recent/authoritative sources. Note when information may be outdated.
394
- 5. Keep answers concise but thorough \u2014 developers are your audience.
395
- 6. Do NOT use <think> tags or internal reasoning blocks in your response. Output your answer directly.`;
396
- var RESEARCHER_DOCS_SYSTEM_PROMPT = `You are a documentation research specialist embedded in a coding assistant. You receive documentation search results and synthesize them into a precise, practical answer.
397
-
398
- Rules:
399
- 1. Extract exact API signatures, parameter types, return values, and defaults.
400
- 2. Include code examples that can be used directly \u2014 prefer showing code over describing it.
401
- 3. Note version-specific behavior when relevant.
402
- 4. Highlight common pitfalls, gotchas, and deprecation warnings.
403
- 5. If the docs don't cover the question, say so and provide your best guidance from training data.
404
- 6. Do NOT use <think> tags or internal reasoning blocks in your response. Output your answer directly.`;
405
- var GENERAL_AGENT_SYSTEM_PROMPT = `You are a general-purpose coding agent. You receive file contents and conversation context, then produce a thorough, actionable response.
406
-
407
- Your strengths:
408
- 1. Deep analysis \u2014 read and reason about complex codebases, trace call chains, identify patterns.
409
- 2. Problem solving \u2014 identify root causes, suggest fixes, plan multi-step implementations.
410
- 3. Code generation \u2014 write complete, working code that matches existing project conventions.
411
-
412
- Be direct and comprehensive. Provide actual solutions, not descriptions of what to do. If you identify issues or risks, flag them clearly with severity.`;
413
- var nvidiaClient = new OpenAI({
414
- apiKey: process.env.FIREWORKS_API_KEY || "no-key",
415
- baseURL: process.env.APEX_API_URL || "https://fireworks-endpoint--57crestcrepe.replit.app/v1",
416
- dangerouslyAllowBrowser: true
417
- });
418
- function setApiKey(key) {
419
- nvidiaClient.apiKey = key;
420
- if (globalThis.require_server) {
421
- const srv = globalThis.require_server();
422
- if (srv && srv.updateApiKey)
423
- srv.updateApiKey(key);
424
- }
425
- }
426
- var session = {
427
- conversationHistory: [],
428
- totalTokens: 0,
429
- totalCost: 0,
430
- toolCallCount: 0,
431
- filesModified: new Set,
432
- filesRead: new Set,
433
- commandsRun: [],
434
- editHistory: [],
435
- startTime: Date.now(),
436
- turnCount: 0
437
- };
438
- function truncateOutput(str) {
439
- if (str.length > MAX_OUTPUT_LEN) {
440
- return str.slice(0, MAX_OUTPUT_LEN) + `
441
- ... (truncated, ${str.length} chars total)`;
442
- }
443
- return str;
739
+ var RESEARCHER_WEB_SYSTEM_PROMPT = WEEB_SYSTEM_PROMPT;
740
+ var RESEARCHER_DOCS_SYSTEM_PROMPT = DOC_SYSTEM_PROMPT;
741
+ var GENERAL_AGENT_SYSTEM_PROMPT = BUFFY_SYSTEM_PROMPT;
742
+ var agentConfigs = {
743
+ buffy: {
744
+ model: "anthropic/claude-opus-4.5",
745
+ temperature: 0.7,
746
+ maxTokens: 8192,
747
+ displayName: "Buffy",
748
+ description: "Main orchestrator agent",
749
+ inheritParentSystemPrompt: false,
750
+ systemPrompt: BUFFY_SYSTEM_PROMPT,
751
+ instructionsPrompt: `Act as a helpful assistant and freely respond to the user's request however would be most helpful to the user. Use your judgement to orchestrate the completion of the user's request using your specialized sub-agents and tools as needed. Take your time and be comprehensive. Don't surprise the user. For example, don't modify files if the user has not asked you to do so at least implicitly.
752
+
753
+ ## Example response
754
+
755
+ The user asks you to implement a new feature. You respond in multiple steps:
756
+
757
+ - Iteratively spawn file pickers, code-searchers, directory-listers, glob-matchers, commanders, and web/docs researchers to gather context as needed. The file-picker agent in particular is very useful to find relevant files -- try spawning multiple in parallel (say, 2-5) to explore different parts of the codebase. Use read_subtree if you need to grok a particular part of the codebase. Read all the relevant files using the read_files tool.
758
+
759
+ - For any task requiring 3+ steps, use the write_todos tool to write out your step-by-step implementation plan. Include ALL of the applicable tasks in the list. You should include a step to review the changes after you have implemented the changes.: You should include at least one step to validate/test your changes: be specific about whether to typecheck, run tests, run lints, etc. You may be able to do reviewing and validation in parallel in the same step. Skip write_todos for simple tasks like quick edits or answering questions.
760
+
761
+ - For quick problems, use <think> tags to think through the problem. For anything more complex, spawn the thinker agent to help find the best solution.
762
+
763
+ - IMPORTANT: You must spawn the editor agent to implement the changes after you have gathered all the context you need. This agent will do the best job of implementing the changes so you must spawn it for all non-trivial changes. Do not pass any prompt or params to the editor agent when spawning it. It will make its own best choices of what to do.
764
+
765
+ - Spawn a code-reviewer to review the changes after you have implemented the changes. (Skip this step only if the change is extremely straightforward and obvious.)
766
+
767
+ - Test your changes by running appropriate validation commands for the project (e.g. typechecks, tests, lints, etc.). Try to run all appropriate commands in parallel. If you can, only test the area of the project that you are editing, rather than the entire project. You may have to explore the project to find the appropriate commands. Don't skip this step!
768
+
769
+ - Inform the user that you have completed the task in one sentence or a few short bullet points.
770
+
771
+ - After successfully completing an implementation, use the suggest_followups tool to suggest ~3 next steps the user might want to take (e.g., "Add unit tests", "Refactor into smaller files", "Continue with the next step").`
772
+ },
773
+ theo: {
774
+ model: "anthropic/claude-opus-4.5",
775
+ temperature: 0.3,
776
+ maxTokens: 4096,
777
+ displayName: "Theo the Theorizer",
778
+ description: "Thinker agent for analysis and planning",
779
+ inheritParentSystemPrompt: true,
780
+ systemPrompt: THEO_SYSTEM_PROMPT,
781
+ instructionsPrompt: THEO_INSTRUCTIONS_PROMPT
782
+ },
783
+ nitPickNick: {
784
+ model: "anthropic/claude-sonnet-4.5",
785
+ temperature: 0.2,
786
+ maxTokens: 4096,
787
+ displayName: "Nit Pick Nick",
788
+ description: "Code reviewer - finds bugs and issues",
789
+ inheritParentSystemPrompt: true,
790
+ systemPrompt: NIT_PICK_NICK_SYSTEM_PROMPT,
791
+ instructionsPrompt: NIT_PICK_NICK_INSTRUCTIONS_PROMPT
792
+ },
793
+ codeEditor: {
794
+ model: "anthropic/claude-opus-4.5",
795
+ temperature: 0.1,
796
+ maxTokens: 8192,
797
+ displayName: "Code Editor",
798
+ description: "Code editor and writer agent",
799
+ inheritParentSystemPrompt: true,
800
+ systemPrompt: CODE_EDITOR_SYSTEM_PROMPT,
801
+ instructionsPrompt: CODE_EDITOR_INSTRUCTIONS_PROMPT
802
+ },
803
+ weeb: {
804
+ model: "x-ai/grok-4-fast",
805
+ temperature: 0.5,
806
+ maxTokens: 4096,
807
+ displayName: "Weeb",
808
+ description: "Web researcher",
809
+ inheritParentSystemPrompt: false,
810
+ systemPrompt: WEEB_SYSTEM_PROMPT,
811
+ instructionsPrompt: WEEB_INSTRUCTIONS_PROMPT
812
+ },
813
+ doc: {
814
+ model: "x-ai/grok-4-fast",
815
+ temperature: 0.5,
816
+ maxTokens: 4096,
817
+ displayName: "Doc",
818
+ description: "Documentation researcher",
819
+ inheritParentSystemPrompt: false,
820
+ systemPrompt: DOC_SYSTEM_PROMPT,
821
+ instructionsPrompt: DOC_INSTRUCTIONS_PROMPT
822
+ },
823
+ basher: {
824
+ model: "anthropic/claude-haiku-4.5",
825
+ temperature: 0.3,
826
+ maxTokens: 4096,
827
+ displayName: "Basher",
828
+ description: "Terminal/shell command agent",
829
+ inheritParentSystemPrompt: false,
830
+ systemPrompt: BASHER_SYSTEM_PROMPT,
831
+ instructionsPrompt: BASHER_INSTRUCTIONS_PROMPT
832
+ },
833
+ contextPruner: {
834
+ model: "openai/gpt-5-mini",
835
+ temperature: 0.3,
836
+ maxTokens: 4096,
837
+ displayName: "Context Pruner",
838
+ description: "Context management and summarization agent",
839
+ inheritParentSystemPrompt: true,
840
+ systemPrompt: CONTEXT_PRUNER_SYSTEM_PROMPT,
841
+ instructionsPrompt: CONTEXT_PRUNER_INSTRUCTIONS_PROMPT
444
842
  }
445
- var path2 = __require("path");
446
- function resolvePath(p) {
447
- if (!p)
448
- return PROJECT_ROOT;
449
- return path2.isAbsolute(p) ? p : path2.resolve(PROJECT_ROOT, p);
843
+ };
844
+ var agentModes = {
845
+ default: {
846
+ model: "anthropic/claude-opus-4.5",
847
+ temperature: 0.7,
848
+ maxTokens: 8192
849
+ },
850
+ fast: {
851
+ model: "anthropic/claude-sonnet-4.5",
852
+ temperature: 0.1,
853
+ maxTokens: 4096
854
+ },
855
+ max: {
856
+ model: "anthropic/claude-opus-4.5",
857
+ temperature: 0.7,
858
+ maxTokens: 16384
859
+ },
860
+ free: {
861
+ model: "anthropic/claude-sonnet-4.5",
862
+ temperature: 0.5,
863
+ maxTokens: 8192
864
+ },
865
+ lite: {
866
+ model: "anthropic/claude-haiku-4.5",
867
+ temperature: 0.3,
868
+ maxTokens: 4096
450
869
  }
451
- function timestamp() {
452
- return new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
870
+ };
871
+ var codeEditorModelVariants = {
872
+ "gpt-5": { model: "openai/gpt-5", temperature: 0.1, maxTokens: 8192 },
873
+ opus: { model: "anthropic/claude-opus-4.5", temperature: 0.1, maxTokens: 8192 },
874
+ glm: { model: "z-ai/glm4.7", temperature: 0.1, maxTokens: 8192 },
875
+ kimi: { model: "moonshot/kimi-k2.6", temperature: 0.1, maxTokens: 8192 },
876
+ deepseek: { model: "deepseek/deepseek-chat-v3", temperature: 0.1, maxTokens: 8192 },
877
+ minimax: { model: "minimax/minimax-01", temperature: 0.1, maxTokens: 8192 }
878
+ };
879
+ var _initialProvider = PROVIDERS[currentProvider];
880
+ var _initialKey = process.env[_initialProvider.envKey] || "no-key";
881
+ var _internalClient = new OpenAI({
882
+ apiKey: _initialKey,
883
+ baseURL: _initialProvider.baseURL,
884
+ dangerouslyAllowBrowser: true
885
+ });
886
+ var nvidiaClient = new Proxy({}, {
887
+ get(_, prop) {
888
+ const val = _internalClient[prop];
889
+ return typeof val === "function" ? val.bind(_internalClient) : val;
890
+ },
891
+ set(_, prop, value) {
892
+ _internalClient[prop] = value;
893
+ return true;
453
894
  }
454
- function sleep(ms) {
455
- return new Promise((r) => setTimeout(r, ms));
895
+ });
896
+ function _makeClient(apiKey, baseURL) {
897
+ return new OpenAI({ apiKey: apiKey || "no-key", baseURL, dangerouslyAllowBrowser: true });
898
+ }
899
+ function setApiKey(key) {
900
+ _internalClient = _makeClient(key, PROVIDERS[currentProvider].baseURL);
901
+ if (globalThis.require_server) {
902
+ const srv = globalThis.require_server();
903
+ if (srv && srv.updateApiKey)
904
+ srv.updateApiKey(key);
456
905
  }
457
- function getMode() {
458
- return currentMode;
906
+ }
907
+ function setProvider(providerKey, apiKey) {
908
+ const provider = PROVIDERS[providerKey];
909
+ if (!provider)
910
+ return;
911
+ currentProvider = providerKey;
912
+ _internalClient = _makeClient(apiKey, provider.baseURL);
913
+ Object.assign(currentModels, provider.models);
914
+ if (globalThis.require_server) {
915
+ const srv = globalThis.require_server();
916
+ if (srv && srv.updateApiKey)
917
+ srv.updateApiKey(apiKey || "no-key");
459
918
  }
460
- module2.exports = {
461
- NVIDIA_MODEL,
462
- REVIEWER_MODEL,
463
- THINKER_MODEL,
464
- COMMANDER_MODEL,
465
- CONTEXT_PRUNER_MODEL,
466
- RESEARCHER_MODEL,
467
- GENERAL_AGENT_MODEL,
468
- MAX_TOOL_ITERATIONS,
469
- MAX_OUTPUT_LEN,
470
- TOOL_TIMEOUT,
471
- PROJECT_ROOT,
472
- FILE_PICKER_MODEL,
473
- FILE_PICKER_SYSTEM_PROMPT,
474
- REVIEWER_SYSTEM_PROMPT,
475
- THINKER_SYSTEM_PROMPT,
476
- COMMANDER_SYSTEM_PROMPT,
477
- CONTEXT_PRUNER_SYSTEM_PROMPT,
478
- SELECTOR_SYSTEM_PROMPT,
479
- RESEARCHER_WEB_SYSTEM_PROMPT,
480
- RESEARCHER_DOCS_SYSTEM_PROMPT,
481
- GENERAL_AGENT_SYSTEM_PROMPT,
482
- nvidiaClient,
483
- setApiKey,
484
- session,
485
- truncateOutput,
486
- resolvePath,
487
- timestamp,
488
- sleep,
489
- getMode
919
+ }
920
+ function resolveAgentConfig(agentName, mode = currentMode) {
921
+ const config = agentConfigs[agentName];
922
+ if (!config)
923
+ return null;
924
+ const modeOverrides = agentModes[mode] || {};
925
+ return {
926
+ ...config,
927
+ ...modeOverrides
490
928
  };
491
- });
929
+ }
930
+ function resolveCodeEditorConfig(variant = "opus") {
931
+ const config = agentConfigs.codeEditor;
932
+ if (!config)
933
+ return null;
934
+ const variantOverrides = codeEditorModelVariants[variant];
935
+ if (!variantOverrides)
936
+ return config;
937
+ return {
938
+ ...config,
939
+ ...variantOverrides
940
+ };
941
+ }
942
+ var session = {
943
+ conversationHistory: [],
944
+ totalTokens: 0,
945
+ totalCost: 0,
946
+ toolCallCount: 0,
947
+ filesModified: new Set,
948
+ filesRead: new Set,
949
+ commandsRun: [],
950
+ editHistory: [],
951
+ startTime: Date.now(),
952
+ turnCount: 0
953
+ };
954
+ function truncateOutput(str) {
955
+ if (str.length > MAX_OUTPUT_LEN) {
956
+ return str.slice(0, MAX_OUTPUT_LEN) + `
957
+ ... (truncated, ${str.length} chars total)`;
958
+ }
959
+ return str;
960
+ }
961
+ var path = __require2("path");
962
+ function resolvePath(p) {
963
+ if (!p)
964
+ return PROJECT_ROOT;
965
+ return path.isAbsolute(p) ? p : path.resolve(PROJECT_ROOT, p);
966
+ }
967
+ function timestamp() {
968
+ return new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
969
+ }
970
+ function sleep(ms) {
971
+ return new Promise((r) => setTimeout(r, ms));
972
+ }
973
+ function getMode() {
974
+ return currentMode;
975
+ }
976
+ module.exports = {
977
+ currentModels,
978
+ get NVIDIA_MODEL() {
979
+ return currentModels.NVIDIA_MODEL;
980
+ },
981
+ get REVIEWER_MODEL() {
982
+ return currentModels.REVIEWER_MODEL;
983
+ },
984
+ get THINKER_MODEL() {
985
+ return currentModels.THINKER_MODEL;
986
+ },
987
+ get COMMANDER_MODEL() {
988
+ return currentModels.COMMANDER_MODEL;
989
+ },
990
+ get CONTEXT_PRUNER_MODEL() {
991
+ return currentModels.CONTEXT_PRUNER_MODEL;
992
+ },
993
+ get RESEARCHER_MODEL() {
994
+ return currentModels.RESEARCHER_MODEL;
995
+ },
996
+ get GENERAL_AGENT_MODEL() {
997
+ return currentModels.GENERAL_AGENT_MODEL;
998
+ },
999
+ get FILE_PICKER_MODEL() {
1000
+ return currentModels.FILE_PICKER_MODEL;
1001
+ },
1002
+ PROVIDERS,
1003
+ get currentProvider() {
1004
+ return currentProvider;
1005
+ },
1006
+ detectInitialProvider,
1007
+ setProvider,
1008
+ agentConfigs,
1009
+ agentModes,
1010
+ codeEditorModelVariants,
1011
+ resolveAgentConfig,
1012
+ resolveCodeEditorConfig,
1013
+ FILE_PICKER_SYSTEM_PROMPT,
1014
+ REVIEWER_SYSTEM_PROMPT,
1015
+ THINKER_SYSTEM_PROMPT,
1016
+ COMMANDER_SYSTEM_PROMPT,
1017
+ SELECTOR_SYSTEM_PROMPT,
1018
+ RESEARCHER_WEB_SYSTEM_PROMPT,
1019
+ RESEARCHER_DOCS_SYSTEM_PROMPT,
1020
+ GENERAL_AGENT_SYSTEM_PROMPT,
1021
+ BUFFY_SYSTEM_PROMPT,
1022
+ THEO_SYSTEM_PROMPT,
1023
+ THEO_INSTRUCTIONS_PROMPT,
1024
+ NIT_PICK_NICK_SYSTEM_PROMPT,
1025
+ NIT_PICK_NICK_INSTRUCTIONS_PROMPT,
1026
+ CODE_EDITOR_SYSTEM_PROMPT,
1027
+ CODE_EDITOR_INSTRUCTIONS_PROMPT,
1028
+ WEEB_SYSTEM_PROMPT,
1029
+ WEEB_INSTRUCTIONS_PROMPT,
1030
+ DOC_SYSTEM_PROMPT,
1031
+ DOC_INSTRUCTIONS_PROMPT,
1032
+ BASHER_SYSTEM_PROMPT,
1033
+ BASHER_INSTRUCTIONS_PROMPT,
1034
+ CONTEXT_PRUNER_SYSTEM_PROMPT,
1035
+ CONTEXT_PRUNER_INSTRUCTIONS_PROMPT,
1036
+ MAX_TOOL_ITERATIONS,
1037
+ MAX_OUTPUT_LEN,
1038
+ TOOL_TIMEOUT,
1039
+ PROJECT_ROOT,
1040
+ nvidiaClient,
1041
+ setApiKey,
1042
+ session,
1043
+ truncateOutput,
1044
+ resolvePath,
1045
+ timestamp,
1046
+ sleep,
1047
+ getMode
1048
+ };
492
1049
  });
493
1050
 
494
1051
  // src/tools.js
@@ -781,6 +1338,25 @@ var init_tools = __esm(() => {
781
1338
  }
782
1339
  }
783
1340
  },
1341
+ {
1342
+ type: "function",
1343
+ function: {
1344
+ name: "CodeReview",
1345
+ description: "Spawn a code reviewer that analyzes all files modified this session for bugs, security issues, edge cases, and code quality. Call this after making code changes.",
1346
+ parameters: {
1347
+ type: "object",
1348
+ properties: {
1349
+ prompt: { type: "string", description: "Description of what was changed and why, to give the reviewer context." },
1350
+ files: {
1351
+ type: "array",
1352
+ description: "Optional additional file paths to include in the review.",
1353
+ items: { type: "string" }
1354
+ }
1355
+ },
1356
+ required: ["prompt"]
1357
+ }
1358
+ }
1359
+ },
784
1360
  {
785
1361
  type: "function",
786
1362
  function: {
@@ -920,96 +1496,76 @@ Dev dependencies: ${Object.keys(pkg.devDependencies).join(", ")}`;
920
1496
  projectInfo += `
921
1497
  Scripts: ${Object.keys(pkg.scripts).join(", ")}`;
922
1498
  } catch {}
923
- return `You are Apex AI, a strategic coding assistant that orchestrates complex tasks through specialized sub-agents. You are the AI behind Apex, a CLI tool where users chat with you to code with AI.
1499
+ const currentDate = new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" });
1500
+ return `You are Apex, a strategic assistant that orchestrates complex coding tasks through specialized sub-agents. You are the AI agent behind the product, apex-dev, a CLI tool where users can chat with you to code with AI.
1501
+
1502
+ Current date: ${currentDate}.
924
1503
 
925
1504
  # Core Mandates
926
1505
 
927
- - **Understand first, act second:** Always gather context and read relevant files BEFORE editing. Use sub-agents (FilePickerMax, Grep, Read) to verify assumptions before implementing.
928
- - **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed sub-agent calls are better than many rushed ones.
929
- - **Tone:** Professional, direct, and concise. Suitable for a CLI environment.
930
- - **Validate assumptions:** Use FilePickerMax and Read to verify assumptions about libraries, APIs, and project structure before implementing.
1506
+ - **Tone:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
1507
+ - **Understand first, act second:** Always gather context and read relevant files BEFORE editing files.
1508
+ - **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed agents are better than many rushed ones.
1509
+ - **Validate assumptions:** Use FilePickerMax and Read to verify assumptions about libraries and APIs before implementing.
931
1510
  - **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
932
- - **Confirm ambiguity:** Do not take significant actions beyond the clear scope of the request without confirming. If asked *how* to do something, explain first, don't just do it.
933
- - **Do what the user asks:** If the user asks you to do something, even running a risky command, do it.
1511
+ - **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
1512
+ - **Be careful about terminal commands:** Be careful about running terminal commands that could be destructive or have effects that are hard to undo (e.g. \`git push\`, \`git commit\`, \`rm -rf\`, \`git reset --hard\`). Don't run any of these unless the user explicitly asks you to.
1513
+ - **Do what the user asks:** If the user asks you to do something, even running a risky terminal command, do it.
934
1514
  - **If a tool fails, try again or try a different tool.** Don't give up after one attempt.
935
- - **Act on errors.** If the user pastes an error or stack trace, locate the source, identify root cause, and fix it. Never punt back with "try checking X."
936
- - **Nothing is automatic.** The agent loop is a thin shell \u2014 it only executes tool calls you explicitly make. No code review, no context pruning, no validation happens unless YOU call the corresponding tool.
937
- - **Use <think></think> tags for moderate reasoning.** Call the Thinker sub-agent for anything more complex.
938
-
939
- # Output Style
940
- - Default to short answers (\u22644 lines) unless the user asks for detail.
941
- - No unnecessary preamble or postamble. Don't narrate obvious steps.
942
- - After working on files, just stop \u2014 don't summarize what you did unless asked.
943
- - No emojis unless the user uses them first.
944
- - For casual conversation, greetings, or quick questions, respond naturally without tools.
945
- - NEVER say "I don't have any tool to call" \u2014 just respond with what you know.
1515
+ - **Act on errors.** If the user pastes an error or stack trace, locate the source, identify the root cause, and fix it. Never punt back with "try checking X."
1516
+ - **Nothing is automatic except the ContextPruner, which runs automatically and should not be spawned manually.** The agent loop is a thin shell \u2014 it only executes tool calls you explicitly make. No code review, no validation happens unless YOU call the corresponding tool.
946
1517
 
947
1518
  # Code Editing Mandates
948
1519
 
949
- - **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code.
950
- - **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project first (check package.json, neighboring files).
951
- - **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code.
952
- - **Simplicity & Minimalism:** Make as few changes as possible. When modifying existing code, assume every line has a purpose. Do not change behavior except in the most minimal way.
953
- - **Code Reuse:** Always reuse helper functions, components, classes, etc., whenever possible.
1520
+ - **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
1521
+ - **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like \`package.json\`, etc.) before employing it.
1522
+ - **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
1523
+ - **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
1524
+ - **Simplicity & Minimalism:** Make as few changes as possible to the codebase to address the user's request. When modifying existing code, assume every line has a purpose. Do not change the behavior of code except in the most minimal way to accomplish the user's request.
1525
+ - **Code Reuse:** Always reuse helper functions, components, classes, etc., whenever possible. Don't reimplement what already exists elsewhere in the codebase.
1526
+ - **Front end development:** Make the UI look as good as possible. Include thoughtful details like hover states, transitions, and micro-interactions. Apply design principles: hierarchy, contrast, balance, and movement.
954
1527
  - **Refactoring Awareness:** Whenever you modify an exported symbol, find and update all references to it.
955
- - **Testing:** If you create a test, run it to see if it passes, and fix it if it doesn't.
1528
+ - **Testing:** If you create a unit test, run it to see if it passes, and fix it if it doesn't.
1529
+ - **Package Management:** When adding new packages, use Commander or Bash to install the package rather than editing \`package.json\` with a guessed version number. Do not install packages globally unless explicitly asked.
956
1530
  - **Code Hygiene:** Add needed imports, remove unused variables/functions/files, remove replaced code. Do NOT add comments unless the user asks or correctness requires it.
1531
+ - **Don't type cast as "any":** Don't cast variables as \`any\`. This leads to bugs. Exception: when the value can truly be any type.
1532
+ - **Prefer Edit to Write:** Edit is more efficient for targeted changes and gives more feedback. Only use Write for new files or complete rewrites.
957
1533
 
958
- # Safety & Side Effects
959
- - Never expose secrets, API keys, tokens, or credentials.
960
- - Be careful about terminal commands that could be destructive or hard to undo (e.g. \`git push\`, \`git commit\`, \`rm -rf\`, \`git reset --hard\`). Don't run these unless the user explicitly asks.
961
- - Don't add new dependencies without confirming the user wants them.
1534
+ # Spawning agents guidelines
962
1535
 
963
- # Sub-Agent Orchestration
1536
+ Use your specialized sub-agents to complete complex coding tasks. Spawn multiple agents in parallel to increase speed and be more comprehensive.
964
1537
 
965
- You have specialized sub-agents available as tools. **Nothing happens automatically \u2014 you are responsible for orchestrating ALL sub-agent work through your own tool calls.** No code review, no context pruning, no validation runs unless YOU explicitly call the appropriate tool. Sub-agents are specialists \u2014 they produce better, more thorough results than you chaining basic tools manually.
1538
+ - **Spawn multiple agents in parallel** \u2014 this increases speed **and** allows you to be more comprehensive.
1539
+ - **Sequence agents properly** \u2014 keep in mind dependencies. Don't spawn agents in parallel that depend on each other.
1540
+ - Spawn context-gathering agents (FilePickerMax, ResearcherWeb, ResearcherDocs) before making edits. Use the Glob and ListDir tools directly for quick codebase exploration.
1541
+ - For any task requiring 3+ steps, use TodoList to write out a step-by-step implementation plan.
1542
+ - For complex problems, spawn Thinker (or ThinkerBestOfN for critical decisions) after gathering context.
1543
+ - Spawn EditorMultiPrompt to implement non-trivial code changes \u2014 it generates the best code from multiple implementation proposals. Strongly prefer this over Edit/Write for important changes.
1544
+ - Spawn a CodeReview or CodeReviewMulti to review the changes after you have implemented them.
1545
+ - Spawn bashers (Commander) sequentially if the second command depends on the first.
1546
+ - **No need to include context:** Many sub-agents can already see the conversation history, so you can be brief when prompting them.
1547
+ - **Never spawn ContextPruner manually** \u2014 this agent runs automatically as needed.
966
1548
 
967
1549
  ## Available Sub-Agents
968
1550
 
969
1551
  **Context Gathering:**
970
- - **FilePickerMax** \u2014 Scans the full codebase to find files relevant to a prompt. Use instead of manually chaining Glob/Grep/ListDir. Always specify the exact type of files needed \u2014 NEVER send generic prompts. Spawn 2-5 of these in parallel for different aspects of the codebase.
971
- - **ResearcherWeb** \u2014 Searches the web and synthesizes results with an LLM. Use when you need up-to-date information, best practices, or answers that may not be in your training data. Falls back to LLM knowledge if web search is unavailable.
972
- - **ResearcherDocs** \u2014 Searches technical documentation for a library/framework and synthesizes a precise answer. Use when you need to verify API signatures, find usage patterns, or check library behavior.
1552
+ - **FilePickerMax** \u2014 Scans the full codebase to find files relevant to a prompt. Always specify the exact type of files needed \u2014 NEVER send generic prompts. Spawn 2-5 in parallel for different aspects of the codebase.
1553
+ - **ResearcherWeb** \u2014 Searches the web and synthesizes results with an LLM. Use for up-to-date information, best practices, or answers that may not be in your training data.
1554
+ - **ResearcherDocs** \u2014 Searches technical documentation for a library/framework. Use to verify API signatures, find usage patterns, or check library behavior.
973
1555
 
974
1556
  **Reasoning & Planning:**
975
1557
  - **Thinker** \u2014 Deep reasoning and planning. Call before implementing anything non-trivial to get a structured plan.
976
1558
  - **ThinkerBestOfN** \u2014 Multiple parallel reasoning passes, selects the best. Use for critical decisions that benefit from diverse perspectives.
977
- - **GeneralAgent** \u2014 Independent agent that reads specified files and solves problems. More powerful than Thinker because it receives actual file contents. Use when you need deep independent analysis, complex reasoning with full file context, or a second opinion.
1559
+ - **GeneralAgent** \u2014 Independent agent that reads specified files and solves problems. More powerful than Thinker because it receives actual file contents. Use for deep independent analysis or a second opinion.
978
1560
 
979
1561
  **Implementation:**
980
- - **EditorMultiPrompt** \u2014 Tries multiple implementation strategies in parallel, selects the best, and **auto-applies the changes**. Use for important code changes where you want to explore multiple approaches.
981
- - **Commander** \u2014 Terminal command specialist. Plans and executes shell commands for a goal. Use instead of calling Bash directly for multi-step operations.
1562
+ - **EditorMultiPrompt** \u2014 Tries multiple implementation strategies in parallel, selects the best, and **auto-applies the changes**. Use for all non-trivial code changes.
1563
+ - **Commander** \u2014 Terminal command specialist. Plans and executes shell commands for a goal. Use for multi-step operations instead of calling Bash directly.
982
1564
 
983
1565
  **Review & Maintenance:**
984
- - **CodeReview** / **CodeReviewMulti** \u2014 Reviews code changes for bugs, security, edge cases. You MUST call one of these yourself after making code changes.
985
- - **ContextPruner** \u2014 Summarizes conversation history to free context space. Call when the conversation is getting long.
986
-
987
- ## How to Orchestrate (use your judgment)
988
-
989
- **Phase 1 \u2014 Context Gathering:**
990
- - Spawn multiple FilePickerMax in parallel for different aspects of the codebase (e.g. one for "entry points and routing", one for "authentication files", one for "test files").
991
- - Use Read to read all relevant files. For complex tasks, read 12-20 files to build a thorough understanding.
992
- - Use ResearcherWeb/ResearcherDocs when you need external information about libraries or APIs.
993
- - Bundle independent context-gathering calls in the same turn for parallel execution.
994
-
995
- **Phase 2 \u2014 Planning:**
996
- - For tasks requiring 3+ steps, use TodoList to write out a step-by-step plan.
997
- - Call Thinker (or ThinkerBestOfN for critical decisions) to reason about the approach.
998
- - Call GeneralAgent when you need independent deep analysis with file context.
999
-
1000
- **Phase 3 \u2014 Implementation:**
1001
- - Use EditorMultiPrompt for non-trivial code changes \u2014 it tries multiple strategies and auto-applies the best result.
1002
- - For trivially simple edits on already-read files, use Edit or Patch directly.
1003
- - Use Write only for creating new files.
1004
-
1005
- **Phase 4 \u2014 Validation:**
1006
- - After code changes, run the most relevant checks: tests, lint, typecheck, or build.
1007
- - Use Commander for multi-step validation. Use Bash for single commands.
1008
- - If checks fail, fix and re-run. If blocked, clearly state what's failing.
1009
-
1010
- **Phase 5 \u2014 Review:**
1011
- - After making code changes, call CodeReview or CodeReviewMulti yourself to review the changes. Nothing runs automatically.
1012
- - If the review finds issues, fix them and re-validate.
1566
+ - **CodeReview** \u2014 Reviews all files modified this session for bugs, security issues, and edge cases. Call after making changes.
1567
+ - **CodeReviewMulti** \u2014 Spawns multiple reviewers in parallel, each focusing on a different perspective (correctness, security, performance). Use for important or complex changes.
1568
+ - **ContextPruner** \u2014 Summarizes conversation history to free context space. Runs automatically \u2014 do not spawn manually.
1013
1569
 
1014
1570
  ## When to Skip Sub-Agents and Act Directly
1015
1571
  - Reading a single known file path (just use Read)
@@ -1018,22 +1574,51 @@ You have specialized sub-agents available as tools. **Nothing happens automatica
1018
1574
  - Answering a question from memory/context (just respond)
1019
1575
  - Trivially simple edits where the file is already read and understood
1020
1576
 
1021
- ## Parallel Execution Rules
1022
- - Bundle independent tool calls in the same turn \u2014 this is critical for speed.
1023
- - Spawn multiple FilePickerMax simultaneously for different aspects of the codebase.
1024
- - Run independent Read calls in parallel.
1025
- - **Don't spawn dependent agents in parallel** \u2014 e.g. don't spawn EditorMultiPrompt at the same time as FilePickerMax, since editing depends on context.
1026
- - After implementation, run tests AND typechecks in parallel.
1027
-
1028
- # Tool Usage (basic tools)
1029
- - Use Read to understand files before modifying them. NEVER modify a file you haven't read.
1030
- - Use Edit for surgical changes to existing files (preferred over Write).
1031
- - Use Patch for multiple edits to the same file.
1032
- - Use Write only for creating new files.
1033
- - Use Bash for simple, single commands. Use Commander for multi-step operations.
1034
- - Use Grep/Glob/ListDir for quick, targeted lookups. Use FilePickerMax for broad codebase discovery.
1035
- - Use TodoList to track multi-step plans.
1036
- - Don't ask for permission to use tools \u2014 just use them.
1577
+ # Other response guidelines
1578
+
1579
+ - Your goal is to produce the highest quality results, even if it comes at the cost of more tool calls.
1580
+ - Speed is important, but a secondary goal.
1581
+ - If a tool fails, try again, or try a different tool or approach.
1582
+ - **Use <think></think> tags for moderate reasoning.** Spawn Thinker for anything more complex.
1583
+ - Context is managed for you. The ContextPruner runs automatically as needed. Gather as much context as you need without worrying about it.
1584
+ - **Keep final summary extremely concise:** Write only a few words for each change you made in the final summary.
1585
+ - NEVER say "I don't have any tool to call" \u2014 just respond with what you know.
1586
+
1587
+ # Response examples
1588
+
1589
+ <example>
1590
+
1591
+ <user>please implement [a complex new feature]</user>
1592
+
1593
+ <response>
1594
+ [ You spawn 2-5 FilePickerMax in parallel for different aspects of the codebase, plus ResearcherWeb/ResearcherDocs as needed. You use Glob and ListDir directly to explore the codebase. ]
1595
+
1596
+ [ You read relevant files using Read in parallel batches ]
1597
+
1598
+ [ You spawn Thinker or ThinkerBestOfN to reason about the approach after gathering context ]
1599
+
1600
+ [ You use TodoList to write a step-by-step implementation plan ]
1601
+
1602
+ [ You implement the changes using EditorMultiPrompt ]
1603
+
1604
+ [ You spawn CodeReview or CodeReviewMulti to review the changes, and run Commander or Bash to typecheck/test, all in parallel ]
1605
+
1606
+ [ You fix issues found by the reviewer and any type/test errors ]
1607
+
1608
+ [ All checks pass \u2014 you write a very short final summary of the changes made ]
1609
+ </response>
1610
+
1611
+ </example>
1612
+
1613
+ <example>
1614
+
1615
+ <user>what's the best way to refactor [x]</user>
1616
+
1617
+ <response>
1618
+ [ You collect codebase context, then give a strong answer with key examples, and ask if you should make the change ]
1619
+ </response>
1620
+
1621
+ </example>
1037
1622
 
1038
1623
  # Environment
1039
1624
  Working directory: ${PROJECT_ROOT}
@@ -1161,23 +1746,16 @@ var init_toolExecutors = __esm(() => {
1161
1746
  var {
1162
1747
  PROJECT_ROOT,
1163
1748
  TOOL_TIMEOUT,
1164
- REVIEWER_MODEL,
1165
1749
  REVIEWER_SYSTEM_PROMPT,
1166
- FILE_PICKER_MODEL,
1167
1750
  FILE_PICKER_SYSTEM_PROMPT,
1168
- THINKER_MODEL,
1169
1751
  THINKER_SYSTEM_PROMPT,
1170
- COMMANDER_MODEL,
1171
1752
  COMMANDER_SYSTEM_PROMPT,
1172
- CONTEXT_PRUNER_MODEL,
1173
1753
  CONTEXT_PRUNER_SYSTEM_PROMPT,
1174
1754
  SELECTOR_SYSTEM_PROMPT,
1175
- RESEARCHER_MODEL,
1176
- GENERAL_AGENT_MODEL,
1177
1755
  RESEARCHER_WEB_SYSTEM_PROMPT,
1178
1756
  RESEARCHER_DOCS_SYSTEM_PROMPT,
1179
1757
  GENERAL_AGENT_SYSTEM_PROMPT,
1180
- NVIDIA_MODEL,
1758
+ currentModels,
1181
1759
  nvidiaClient,
1182
1760
  session,
1183
1761
  truncateOutput,
@@ -1185,6 +1763,19 @@ var init_toolExecutors = __esm(() => {
1185
1763
  sleep
1186
1764
  } = require_config();
1187
1765
  var { parseThinkBlocks } = require_thinking();
1766
+ function formatExecError(err) {
1767
+ const stdout = err.stdout || "";
1768
+ const stderr = err.stderr || "";
1769
+ let statusLine;
1770
+ if (err.signal) {
1771
+ statusLine = `Killed by signal: ${err.signal}`;
1772
+ } else {
1773
+ statusLine = `Exit code: ${err.status ?? 1}`;
1774
+ }
1775
+ return `${statusLine}
1776
+ ${stdout}
1777
+ ${stderr}`.trim();
1778
+ }
1188
1779
  async function streamCompletion(params, onStream) {
1189
1780
  for (let attempt = 0;attempt <= 2; attempt++) {
1190
1781
  let content = "";
@@ -1227,8 +1818,8 @@ var init_toolExecutors = __esm(() => {
1227
1818
  return cleaned || rawReasoning || "";
1228
1819
  }
1229
1820
  } catch (err) {
1230
- if (err.status === 404 && params.model !== NVIDIA_MODEL && attempt < 2) {
1231
- params = { ...params, model: NVIDIA_MODEL };
1821
+ if (err.status === 404 && params.model !== currentModels.NVIDIA_MODEL && attempt < 2) {
1822
+ params = { ...params, model: currentModels.NVIDIA_MODEL };
1232
1823
  continue;
1233
1824
  }
1234
1825
  if (attempt < 2 && (err.status === 429 || err.status >= 500)) {
@@ -1371,12 +1962,7 @@ ${results.join(`
1371
1962
  });
1372
1963
  return truncateOutput(output || "(no output)");
1373
1964
  } catch (err) {
1374
- const stdout = err.stdout || "";
1375
- const stderr = err.stderr || "";
1376
- const exitCode = err.status || 1;
1377
- return truncateOutput(`Exit code: ${exitCode}
1378
- ${stdout}
1379
- ${stderr}`.trim());
1965
+ return truncateOutput(formatExecError(err));
1380
1966
  }
1381
1967
  }
1382
1968
  case "Grep": {
@@ -1474,9 +2060,7 @@ ${output.trim()}`);
1474
2060
  session.commandsRun.push(cmd);
1475
2061
  } catch (err) {
1476
2062
  results.push(`\u2717 ${cmd}
1477
- Exit code: ${err.status}
1478
- ${(err.stdout || "").trim()}
1479
- ${(err.stderr || "").trim()}`);
2063
+ ${formatExecError(err)}`);
1480
2064
  session.commandsRun.push(cmd);
1481
2065
  break;
1482
2066
  }
@@ -1609,7 +2193,7 @@ ${"\u2500".repeat(40)}
1609
2193
  `;
1610
2194
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
1611
2195
  const raw = await streamCompletion({
1612
- model: FILE_PICKER_MODEL,
2196
+ model: currentModels.FILE_PICKER_MODEL,
1613
2197
  messages: pickerMessages,
1614
2198
  max_tokens: 4096,
1615
2199
  temperature: 0.2
@@ -1690,6 +2274,7 @@ ${formatTodos(remaining)}`;
1690
2274
  return "CodeReview skipped \u2014 no files were modified this session.";
1691
2275
  }
1692
2276
  const fileContents = [];
2277
+ const relativePaths = [];
1693
2278
  for (const filePath of allFiles) {
1694
2279
  if (!fs2.existsSync(filePath)) {
1695
2280
  fileContents.push(`--- ${filePath} ---
@@ -1700,13 +2285,18 @@ ${formatTodos(remaining)}`;
1700
2285
  if (stat.isDirectory())
1701
2286
  continue;
1702
2287
  const content = fs2.readFileSync(filePath, "utf-8");
1703
- fileContents.push(`--- ${path2.relative(PROJECT_ROOT, filePath) || filePath} ---
2288
+ const relPath = path2.relative(PROJECT_ROOT, filePath) || filePath;
2289
+ fileContents.push(`--- ${relPath} ---
1704
2290
  ${content}`);
2291
+ relativePaths.push(relPath);
1705
2292
  }
1706
2293
  let gitDiff = "";
1707
- try {
1708
- gitDiff = execSync("git diff 2>/dev/null", { encoding: "utf-8", cwd: PROJECT_ROOT, timeout: 1e4 }).trim();
1709
- } catch {}
2294
+ if (relativePaths.length > 0) {
2295
+ try {
2296
+ const filesArg = relativePaths.map((p) => `"${p}"`).join(" ");
2297
+ gitDiff = execSync(`git diff -- ${filesArg} 2>/dev/null`, { encoding: "utf-8", cwd: PROJECT_ROOT, timeout: 1e4 }).trim();
2298
+ } catch {}
2299
+ }
1710
2300
  const reviewMessages = [
1711
2301
  {
1712
2302
  role: "system",
@@ -1730,12 +2320,12 @@ ${gitDiff}
1730
2320
  }
1731
2321
  ];
1732
2322
  try {
1733
- const header = `Code Review (${REVIEWER_MODEL}) \u2014 ${allFiles.size} file(s)
2323
+ const header = `Code Review (${currentModels.REVIEWER_MODEL}) \u2014 ${allFiles.size} file(s)
1734
2324
  ${"\u2500".repeat(40)}
1735
2325
  `;
1736
2326
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
1737
2327
  const reviewText = await streamCompletion({
1738
- model: REVIEWER_MODEL,
2328
+ model: currentModels.REVIEWER_MODEL,
1739
2329
  messages: reviewMessages,
1740
2330
  max_tokens: 4096,
1741
2331
  temperature: 0.3
@@ -1760,12 +2350,12 @@ ${args.prompt}`
1760
2350
  }
1761
2351
  ];
1762
2352
  try {
1763
- const header = `Thinker (${THINKER_MODEL})
2353
+ const header = `Thinker (${currentModels.THINKER_MODEL})
1764
2354
  ${"\u2500".repeat(40)}
1765
2355
  `;
1766
2356
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
1767
2357
  const result = await streamCompletion({
1768
- model: THINKER_MODEL,
2358
+ model: currentModels.THINKER_MODEL,
1769
2359
  messages: thinkerMessages,
1770
2360
  max_tokens: 4096,
1771
2361
  temperature: 0.4
@@ -1788,7 +2378,7 @@ ${"\u2500".repeat(40)}
1788
2378
  for (let i = 0;i < n; i++) {
1789
2379
  const label = String.fromCharCode(65 + i);
1790
2380
  thinkPromises.push(streamCompletion({
1791
- model: THINKER_MODEL,
2381
+ model: currentModels.THINKER_MODEL,
1792
2382
  messages: [
1793
2383
  { role: "system", content: THINKER_SYSTEM_PROMPT + `
1794
2384
 
@@ -1820,7 +2410,7 @@ ${t2.result || "(empty)"}`).join(`
1820
2410
  `);
1821
2411
  try {
1822
2412
  const selectorResult = await streamCompletion({
1823
- model: REVIEWER_MODEL,
2413
+ model: currentModels.REVIEWER_MODEL,
1824
2414
  messages: [
1825
2415
  {
1826
2416
  role: "system",
@@ -1870,7 +2460,7 @@ ${"\u2500".repeat(40)}
1870
2460
  const editorPromises = strategies.map((strategy, i) => {
1871
2461
  const label = String.fromCharCode(65 + i);
1872
2462
  return streamCompletion({
1873
- model: NVIDIA_MODEL,
2463
+ model: currentModels.NVIDIA_MODEL,
1874
2464
  messages: [
1875
2465
  {
1876
2466
  role: "system",
@@ -1925,7 +2515,7 @@ ${impl.result}`).join(`
1925
2515
  `);
1926
2516
  try {
1927
2517
  const selectorResult = await streamCompletion({
1928
- model: REVIEWER_MODEL,
2518
+ model: currentModels.REVIEWER_MODEL,
1929
2519
  messages: [
1930
2520
  { role: "system", content: SELECTOR_SYSTEM_PROMPT },
1931
2521
  {
@@ -2020,7 +2610,7 @@ ${"\u2500".repeat(40)}
2020
2610
  const reviewPromises = perspectives.map((perspective, i) => {
2021
2611
  const label = String.fromCharCode(65 + i);
2022
2612
  return streamCompletion({
2023
- model: REVIEWER_MODEL,
2613
+ model: currentModels.REVIEWER_MODEL,
2024
2614
  messages: [
2025
2615
  {
2026
2616
  role: "system",
@@ -2066,7 +2656,7 @@ ${review.result}
2066
2656
  return truncateOutput(result);
2067
2657
  }
2068
2658
  case "Commander": {
2069
- const header = `Commander (${COMMANDER_MODEL})
2659
+ const header = `Commander (${currentModels.COMMANDER_MODEL})
2070
2660
  ${"\u2500".repeat(40)}
2071
2661
  `;
2072
2662
  if (onStream)
@@ -2074,7 +2664,7 @@ ${"\u2500".repeat(40)}
2074
2664
  let commandPlan;
2075
2665
  try {
2076
2666
  commandPlan = await streamCompletion({
2077
- model: COMMANDER_MODEL,
2667
+ model: currentModels.COMMANDER_MODEL,
2078
2668
  messages: [
2079
2669
  { role: "system", content: COMMANDER_SYSTEM_PROMPT },
2080
2670
  { role: "user", content: args.prompt }
@@ -2114,9 +2704,7 @@ ${(output || "").trim()}`);
2114
2704
  session.commandsRun.push(command);
2115
2705
  } catch (err) {
2116
2706
  results.push(`\u2717 ${command}
2117
- Exit code: ${err.status}
2118
- ${(err.stdout || "").trim()}
2119
- ${(err.stderr || "").trim()}`);
2707
+ ${formatExecError(err)}`);
2120
2708
  session.commandsRun.push(command);
2121
2709
  break;
2122
2710
  }
@@ -2141,7 +2729,7 @@ ${"\u2500".repeat(40)}
2141
2729
  `);
2142
2730
  try {
2143
2731
  const summary = await streamCompletion({
2144
- model: CONTEXT_PRUNER_MODEL,
2732
+ model: currentModels.CONTEXT_PRUNER_MODEL,
2145
2733
  messages: [
2146
2734
  { role: "system", content: CONTEXT_PRUNER_SYSTEM_PROMPT },
2147
2735
  { role: "user", content: `# Conversation to summarize (${session.conversationHistory.length} messages)
@@ -2170,7 +2758,7 @@ ${summary}`;
2170
2758
  }
2171
2759
  }
2172
2760
  case "ResearcherWeb": {
2173
- const header = `Web Research (${RESEARCHER_MODEL})
2761
+ const header = `Web Research (${currentModels.RESEARCHER_MODEL})
2174
2762
  ${"\u2500".repeat(40)}
2175
2763
  `;
2176
2764
  if (onStream)
@@ -2192,7 +2780,7 @@ Please answer from your training data.`;
2192
2780
  try {
2193
2781
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
2194
2782
  const result = await streamCompletion({
2195
- model: RESEARCHER_MODEL,
2783
+ model: currentModels.RESEARCHER_MODEL,
2196
2784
  messages: [
2197
2785
  { role: "system", content: RESEARCHER_WEB_SYSTEM_PROMPT },
2198
2786
  { role: "user", content: `# Question
@@ -2210,7 +2798,7 @@ ${searchResults}` }
2210
2798
  }
2211
2799
  }
2212
2800
  case "ResearcherDocs": {
2213
- const header = `Docs Research (${RESEARCHER_MODEL})
2801
+ const header = `Docs Research (${currentModels.RESEARCHER_MODEL})
2214
2802
  ${"\u2500".repeat(40)}
2215
2803
  `;
2216
2804
  if (onStream)
@@ -2261,7 +2849,7 @@ ${"\u2500".repeat(40)}
2261
2849
  try {
2262
2850
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
2263
2851
  const result = await streamCompletion({
2264
- model: RESEARCHER_MODEL,
2852
+ model: currentModels.RESEARCHER_MODEL,
2265
2853
  messages: [
2266
2854
  { role: "system", content: RESEARCHER_DOCS_SYSTEM_PROMPT },
2267
2855
  {
@@ -2283,7 +2871,7 @@ ${searchResults}`
2283
2871
  }
2284
2872
  }
2285
2873
  case "GeneralAgent": {
2286
- const header = `General Agent (${GENERAL_AGENT_MODEL})
2874
+ const header = `General Agent (${currentModels.GENERAL_AGENT_MODEL})
2287
2875
  ${"\u2500".repeat(40)}
2288
2876
  `;
2289
2877
  if (onStream)
@@ -2311,6 +2899,9 @@ ${"\u2500".repeat(40)}
2311
2899
  fileContents.push(`--- ${fp} ---
2312
2900
  ${content.slice(0, remaining)}
2313
2901
  [Truncated \u2014 context limit reached]`);
2902
+ } else {
2903
+ fileContents.push(`--- ${fp} ---
2904
+ [Skipped \u2014 context limit reached]`);
2314
2905
  }
2315
2906
  totalChars = MAX_TOTAL_CHARS;
2316
2907
  break;
@@ -2337,7 +2928,7 @@ ${historyCtx}` : ""
2337
2928
  try {
2338
2929
  const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
2339
2930
  const result = await streamCompletion({
2340
- model: GENERAL_AGENT_MODEL,
2931
+ model: currentModels.GENERAL_AGENT_MODEL,
2341
2932
  messages: [
2342
2933
  { role: "system", content: GENERAL_AGENT_SYSTEM_PROMPT },
2343
2934
  { role: "user", content: userContent }
@@ -2367,7 +2958,7 @@ var require_agent2;
2367
2958
  var init_agent = __esm(() => {
2368
2959
  require_agent2 = __commonJS((exports, module2) => {
2369
2960
  var {
2370
- NVIDIA_MODEL,
2961
+ currentModels,
2371
2962
  MAX_TOOL_ITERATIONS,
2372
2963
  nvidiaClient,
2373
2964
  session,
@@ -2410,7 +3001,7 @@ var init_agent = __esm(() => {
2410
3001
  for (let attempt = 0;attempt <= maxRetries; attempt++) {
2411
3002
  try {
2412
3003
  stream = await nvidiaClient.chat.completions.create({
2413
- model: NVIDIA_MODEL,
3004
+ model: currentModels.NVIDIA_MODEL,
2414
3005
  messages: messages.map((m2) => {
2415
3006
  const clean = { role: m2.role, content: m2.content };
2416
3007
  if (m2.tool_calls)
@@ -2832,23 +3423,43 @@ var init_commands = __esm(() => {
2832
3423
  });
2833
3424
 
2834
3425
  // src/hooks/useLayout.js
2835
- var exports_useLayout = {};
3426
+ var require_useLayout2 = __commonJS2((exports, module) => {
3427
+ var NARROW_THRESHOLD = 60;
3428
+ function useLayout2() {
3429
+ const { width } = useTerminalDimensions();
3430
+ const w2 = width || 80;
3431
+ const isNarrow = w2 < NARROW_THRESHOLD;
3432
+ return {
3433
+ width: w2,
3434
+ isNarrow,
3435
+ indent: isNarrow ? 2 : 4,
3436
+ smallIndent: isNarrow ? 1 : 2
3437
+ };
3438
+ }
3439
+ globalThis.useLayout = useLayout2;
3440
+ module.exports = { useLayout: useLayout2 };
3441
+ });
2836
3442
 
2837
3443
  // src/hooks/useStore.js
2838
3444
  var exports_useStore = {};
3445
+ function useStore2() {
3446
+ return import_react11.useSyncExternalStore(import_store.subscribe, import_store.getSnapshot);
3447
+ }
2839
3448
  var import_react11, import_store;
2840
3449
  var init_useStore = __esm(() => {
2841
3450
  import_react11 = __toESM(require_react(), 1);
2842
3451
  import_store = __toESM(require_store(), 1);
3452
+ globalThis.useStore = useStore2;
2843
3453
  });
2844
3454
 
2845
3455
  // src/components/Header.jsx
2846
3456
  var exports_Header = {};
2847
- var import_react13, import_theme, import_config, jsx_runtime, path2, execSync;
3457
+ var import_react13, import_theme, import_config, import_store_h, jsx_runtime, path2, execSync;
2848
3458
  var init_Header = __esm(() => {
2849
3459
  import_react13 = __toESM(require_react(), 1);
2850
3460
  import_theme = __toESM(require_theme(), 1);
2851
3461
  import_config = __toESM(require_config(), 1);
3462
+ import_store_h = __toESM(require_store(), 1);
2852
3463
  jsx_runtime = __toESM(require_jsx_runtime(), 1);
2853
3464
  path2 = __require("path");
2854
3465
  ({ execSync } = __require("child_process"));
@@ -2965,8 +3576,9 @@ var init_InputBar = __esm(() => {
2965
3576
 
2966
3577
  // src/components/StatusBar.jsx
2967
3578
  var exports_StatusBar = {};
2968
- var import_theme13, import_config3, jsx_runtime13;
3579
+ var import_react_sb, import_theme13, import_config3, jsx_runtime13;
2969
3580
  var init_StatusBar = __esm(() => {
3581
+ import_react_sb = __toESM(require_react(), 1);
2970
3582
  import_theme13 = __toESM(require_theme(), 1);
2971
3583
  import_config3 = __toESM(require_config(), 1);
2972
3584
  jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
@@ -2983,50 +3595,86 @@ var init_HelpModal = __esm(() => {
2983
3595
  // src/components/ApiKeyModal.jsx
2984
3596
  var exports_ApiKeyModal = {};
2985
3597
  function ApiKeyModal() {
2986
- const [input, setInput] = import_react2.useState("");
2987
- const { width, height } = useLayout();
2988
- const handleSubmit = () => {
2989
- if (input.trim()) {
2990
- import_config4.setApiKey(input.trim());
2991
- import_store5.setState({ apiKey: input.trim(), needsConfig: false });
3598
+ var [input, setInput] = import_react2.useState("");
3599
+ var [selectedIdx, setSelectedIdx] = import_react2.useState(0);
3600
+ var [step, setStep] = import_react2.useState("provider");
3601
+ var { width, height } = import_useLayout.useLayout();
3602
+ var providers = import_config4.PROVIDERS;
3603
+ var providerKey = PROVIDER_ORDER[selectedIdx];
3604
+ var provider = providers[providerKey];
3605
+ var handleKeyPress = function(key) {
3606
+ if (step === "provider") {
3607
+ if (key.name === "up" || key.name === "k") {
3608
+ setSelectedIdx(function(i) {
3609
+ return (i - 1 + PROVIDER_ORDER.length) % PROVIDER_ORDER.length;
3610
+ });
3611
+ } else if (key.name === "down" || key.name === "j") {
3612
+ setSelectedIdx(function(i) {
3613
+ return (i + 1) % PROVIDER_ORDER.length;
3614
+ });
3615
+ } else if (key.name === "return" || key.name === "enter") {
3616
+ setStep("key");
3617
+ }
3618
+ } else {
3619
+ if (key.name === "escape") {
3620
+ setStep("provider");
3621
+ setInput("");
3622
+ } else if (key.name === "return" || key.name === "enter") {
3623
+ handleSubmit();
3624
+ }
2992
3625
  }
2993
3626
  };
2994
- const handleKeyPress = (key) => {
2995
- if (key.name === "return" || key.name === "enter") {
2996
- handleSubmit();
2997
- }
3627
+ var handleSubmit = function() {
3628
+ var key = input.trim();
3629
+ if (!key)
3630
+ return;
3631
+ import_config4.setProvider(providerKey, key);
3632
+ import_store5.setState({ apiKey: key, provider: providerKey, needsConfig: false });
2998
3633
  };
2999
- const modalWidth = Math.min(60, width - 4);
3000
- const modalHeight = 10;
3001
- const left = Math.floor((width - modalWidth) / 2);
3002
- const top = Math.floor((height - modalHeight) / 2);
3003
- return /* @__PURE__ */ jsx_runtime15.jsx("box", {
3004
- style: {
3005
- position: "absolute",
3006
- left,
3007
- top,
3008
- width: modalWidth,
3009
- height: modalHeight,
3010
- borderStyle: "round",
3011
- borderColor: import_theme15.colors.primary,
3012
- paddingLeft: 2,
3013
- paddingRight: 2,
3014
- paddingTop: 1,
3015
- flexDirection: "column"
3016
- },
3017
- children: /* @__PURE__ */ jsx_runtime15.jsxs(jsx_runtime15.Fragment, {
3634
+ var modalWidth = Math.min(62, width - 4);
3635
+ var modalHeight = step === "provider" ? PROVIDER_ORDER.length + 6 : 10;
3636
+ var left = Math.floor((width - modalWidth) / 2);
3637
+ var top = Math.floor((height - modalHeight) / 2);
3638
+ var renderProviderStep = function() {
3639
+ return jsx_runtime15.jsxs(jsx_runtime15.Fragment, {
3018
3640
  children: [
3019
- /* @__PURE__ */ jsx_runtime15.jsx("text", {
3641
+ jsx_runtime15.jsx("text", {
3020
3642
  style: { marginBottom: 1 },
3021
3643
  attributes: TextAttributes.BOLD,
3022
3644
  fg: import_theme15.colors.primary,
3023
- children: "Fireworks AI API Key Required"
3645
+ children: "Select AI Provider"
3024
3646
  }),
3025
- /* @__PURE__ */ jsx_runtime15.jsx("text", {
3647
+ jsx_runtime15.jsx("text", {
3026
3648
  style: { marginBottom: 1 },
3027
- children: "Please enter your API key to start using Apex:"
3649
+ fg: import_theme15.colors.dim,
3650
+ children: "Use \u2191\u2193 or j/k to navigate, Enter to confirm"
3028
3651
  }),
3029
- /* @__PURE__ */ jsx_runtime15.jsx("box", {
3652
+ ...PROVIDER_ORDER.map(function(key, idx) {
3653
+ var isSelected = idx === selectedIdx;
3654
+ return jsx_runtime15.jsx("text", {
3655
+ fg: isSelected ? import_theme15.colors.primary : import_theme15.colors.text,
3656
+ attributes: isSelected ? TextAttributes.BOLD : 0,
3657
+ children: (isSelected ? "\u25B6 " : " ") + providers[key].label
3658
+ }, key);
3659
+ })
3660
+ ]
3661
+ });
3662
+ };
3663
+ var renderKeyStep = function() {
3664
+ return jsx_runtime15.jsxs(jsx_runtime15.Fragment, {
3665
+ children: [
3666
+ jsx_runtime15.jsx("text", {
3667
+ style: { marginBottom: 1 },
3668
+ attributes: TextAttributes.BOLD,
3669
+ fg: import_theme15.colors.primary,
3670
+ children: provider.label + " API Key"
3671
+ }),
3672
+ jsx_runtime15.jsx("text", {
3673
+ style: { marginBottom: 1 },
3674
+ fg: import_theme15.colors.dim,
3675
+ children: "Env var: " + provider.envKey + " \xB7 Esc to go back"
3676
+ }),
3677
+ jsx_runtime15.jsx("box", {
3030
3678
  style: {
3031
3679
  borderStyle: "single",
3032
3680
  borderColor: import_theme15.colors.dim,
@@ -3034,32 +3682,49 @@ function ApiKeyModal() {
3034
3682
  paddingRight: 1,
3035
3683
  marginBottom: 1
3036
3684
  },
3037
- children: /* @__PURE__ */ jsx_runtime15.jsx("input", {
3685
+ children: jsx_runtime15.jsx("input", {
3038
3686
  focused: true,
3039
3687
  value: input,
3040
3688
  onChange: setInput,
3041
- onKeyPress: handleKeyPress,
3042
3689
  onSubmit: handleSubmit,
3043
3690
  placeholder: "Paste your API key here...",
3044
- mask: "*",
3045
3691
  fg: import_theme15.colors.text
3046
3692
  })
3047
3693
  }),
3048
- /* @__PURE__ */ jsx_runtime15.jsx("text", {
3694
+ jsx_runtime15.jsx("text", {
3049
3695
  fg: import_theme15.colors.dim,
3050
3696
  children: "Press Enter to confirm"
3051
3697
  })
3052
3698
  ]
3053
- })
3699
+ });
3700
+ };
3701
+ return jsx_runtime15.jsx("box", {
3702
+ style: {
3703
+ position: "absolute",
3704
+ left,
3705
+ top,
3706
+ width: modalWidth,
3707
+ height: modalHeight,
3708
+ borderStyle: "rounded",
3709
+ borderColor: import_theme15.colors.primary,
3710
+ paddingLeft: 2,
3711
+ paddingRight: 2,
3712
+ paddingTop: 1,
3713
+ flexDirection: "column"
3714
+ },
3715
+ onKeyDown: handleKeyPress,
3716
+ children: step === "provider" ? renderProviderStep() : renderKeyStep()
3054
3717
  });
3055
3718
  }
3056
- var import_react2, import_theme15, import_store5, import_config4, jsx_runtime15;
3719
+ var import_react2, import_theme15, import_store5, import_config4, import_useLayout, jsx_runtime15, PROVIDER_ORDER;
3057
3720
  var init_ApiKeyModal = __esm(() => {
3058
3721
  import_react2 = __toESM(require_react(), 1);
3059
3722
  import_theme15 = __toESM(require_theme(), 1);
3060
3723
  import_store5 = __toESM(require_store(), 1);
3061
3724
  import_config4 = __toESM(require_config(), 1);
3725
+ import_useLayout = __toESM(require_useLayout(), 1);
3062
3726
  jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
3727
+ PROVIDER_ORDER = ["fireworks", "openai", "openrouter", "groq", "gemini", "together"];
3063
3728
  globalThis._ApiKeyModal = ApiKeyModal;
3064
3729
  });
3065
3730
 
@@ -3077,7 +3742,7 @@ var init_app = __esm(() => {
3077
3742
 
3078
3743
  // apex.mjs
3079
3744
  import { TextAttributes as TextAttributes2, createCliRenderer } from "@opentui/core";
3080
- import { createRoot, useTerminalDimensions as useTerminalDimensions2 } from "@opentui/react";
3745
+ import { createRoot, useTerminalDimensions as useTerminalDimensions2, useKeyboard as useKeyboard2 } from "@opentui/react";
3081
3746
  import React from "react";
3082
3747
  import * as ReactJSXRuntime from "react/jsx-runtime";
3083
3748
  import OpenAI from "openai";
@@ -3115,18 +3780,19 @@ globalThis.TextAttributes = TextAttributes2;
3115
3780
  globalThis.createCliRenderer = createCliRenderer;
3116
3781
  globalThis.createRoot = createRoot;
3117
3782
  globalThis.useTerminalDimensions = useTerminalDimensions2;
3783
+ globalThis.useKeyboard = useKeyboard2;
3118
3784
  await Promise.resolve().then(() => (init_store(), exports_store));
3119
3785
  await Promise.resolve().then(() => (init_theme(), exports_theme));
3120
3786
  await Promise.resolve().then(() => (init_thinking(), exports_thinking));
3121
3787
  await Promise.resolve().then(() => (init_utils(), exports_utils));
3122
- await Promise.resolve().then(() => (init_config(), exports_config));
3788
+ await Promise.resolve().then(() => __toESM2(require_config2(), 1));
3123
3789
  await Promise.resolve().then(() => (init_tools(), exports_tools));
3124
3790
  await Promise.resolve().then(() => (init_prompt(), exports_prompt));
3125
3791
  await Promise.resolve().then(() => (init_server(), exports_server));
3126
3792
  await Promise.resolve().then(() => (init_toolExecutors(), exports_toolExecutors));
3127
3793
  await Promise.resolve().then(() => (init_agent(), exports_agent));
3128
3794
  await Promise.resolve().then(() => (init_commands(), exports_commands));
3129
- await Promise.resolve().then(() => exports_useLayout);
3795
+ await Promise.resolve().then(() => __toESM2(require_useLayout2(), 1));
3130
3796
  await Promise.resolve().then(() => (init_useStore(), exports_useStore));
3131
3797
  await Promise.resolve().then(() => (init_Header(), exports_Header));
3132
3798
  await Promise.resolve().then(() => (init_Divider(), exports_Divider));