apex-dev 3.1.0 → 3.6.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.
- package/dist/index.js +1096 -573
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -29,8 +29,8 @@ var __export = (target, all) => {
|
|
|
29
29
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
30
30
|
var __require = import.meta.require;
|
|
31
31
|
|
|
32
|
-
// node_modules/@opentui/react/chunk-
|
|
33
|
-
var
|
|
32
|
+
// node_modules/@opentui/react/chunk-eecw9x2f.js
|
|
33
|
+
var init_chunk_eecw9x2f = () => {};
|
|
34
34
|
|
|
35
35
|
// node_modules/react/cjs/react.production.js
|
|
36
36
|
var exports_react_production = {};
|
|
@@ -24044,11 +24044,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24044
24044
|
});
|
|
24045
24045
|
});
|
|
24046
24046
|
|
|
24047
|
-
// node_modules/@opentui/react/chunk-
|
|
24048
|
-
var
|
|
24047
|
+
// node_modules/@opentui/react/chunk-pm1hna8x.js
|
|
24048
|
+
var exports_chunk_pm1hna8x = {};
|
|
24049
24049
|
var import_react_devtools_core, g;
|
|
24050
|
-
var
|
|
24051
|
-
|
|
24050
|
+
var init_chunk_pm1hna8x = __esm(async () => {
|
|
24051
|
+
init_chunk_eecw9x2f();
|
|
24052
24052
|
import_react_devtools_core = __toESM(require_backend(), 1);
|
|
24053
24053
|
g = globalThis;
|
|
24054
24054
|
if (typeof g.WebSocket === "undefined") {
|
|
@@ -31679,11 +31679,13 @@ var require_config = __commonJS((exports, module2) => {
|
|
|
31679
31679
|
var THINKER_MODEL = "z-ai/glm4.7";
|
|
31680
31680
|
var COMMANDER_MODEL = "nvidia/llama-3.3-nemotron-70b-instruct";
|
|
31681
31681
|
var CONTEXT_PRUNER_MODEL = "nvidia/llama-3.3-nemotron-70b-instruct";
|
|
31682
|
+
var RESEARCHER_MODEL = "nvidia/llama-3.3-nemotron-70b-instruct";
|
|
31683
|
+
var GENERAL_AGENT_MODEL = "z-ai/glm4.7";
|
|
31682
31684
|
var MAX_TOOL_ITERATIONS = 50;
|
|
31683
31685
|
var MAX_OUTPUT_LEN = 12000;
|
|
31684
31686
|
var TOOL_TIMEOUT = 60000;
|
|
31685
31687
|
var PROJECT_ROOT = process.cwd();
|
|
31686
|
-
var currentMode = "
|
|
31688
|
+
var currentMode = "max";
|
|
31687
31689
|
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.
|
|
31688
31690
|
|
|
31689
31691
|
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.
|
|
@@ -31777,6 +31779,30 @@ Output JSON only, no markdown fences:
|
|
|
31777
31779
|
"reason": "Brief explanation of why this is the best",
|
|
31778
31780
|
"improvements": "Any good ideas from other implementations to incorporate"
|
|
31779
31781
|
}`;
|
|
31782
|
+
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.
|
|
31783
|
+
|
|
31784
|
+
Rules:
|
|
31785
|
+
1. Extract the most relevant information from results. Cite sources with URLs.
|
|
31786
|
+
2. Be specific and actionable \u2014 code examples and exact details over generic advice.
|
|
31787
|
+
3. If results don't contain the answer, say so clearly and share what you know from training data.
|
|
31788
|
+
4. Prefer recent/authoritative sources. Note when information may be outdated.
|
|
31789
|
+
5. Keep answers concise but thorough \u2014 developers are your audience.`;
|
|
31790
|
+
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.
|
|
31791
|
+
|
|
31792
|
+
Rules:
|
|
31793
|
+
1. Extract exact API signatures, parameter types, return values, and defaults.
|
|
31794
|
+
2. Include code examples that can be used directly \u2014 prefer showing code over describing it.
|
|
31795
|
+
3. Note version-specific behavior when relevant.
|
|
31796
|
+
4. Highlight common pitfalls, gotchas, and deprecation warnings.
|
|
31797
|
+
5. If the docs don't cover the question, say so and provide your best guidance from training data.`;
|
|
31798
|
+
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.
|
|
31799
|
+
|
|
31800
|
+
Your strengths:
|
|
31801
|
+
1. Deep analysis \u2014 read and reason about complex codebases, trace call chains, identify patterns.
|
|
31802
|
+
2. Problem solving \u2014 identify root causes, suggest fixes, plan multi-step implementations.
|
|
31803
|
+
3. Code generation \u2014 write complete, working code that matches existing project conventions.
|
|
31804
|
+
|
|
31805
|
+
Be direct and comprehensive. Provide actual solutions, not descriptions of what to do. If you identify issues or risks, flag them clearly with severity.`;
|
|
31780
31806
|
var nvidiaClient = new OpenAI({
|
|
31781
31807
|
apiKey: process.env.NVIDIA_API_KEY || "",
|
|
31782
31808
|
baseURL: "https://integrate.api.nvidia.com/v1"
|
|
@@ -31815,19 +31841,14 @@ Output JSON only, no markdown fences:
|
|
|
31815
31841
|
function getMode() {
|
|
31816
31842
|
return currentMode;
|
|
31817
31843
|
}
|
|
31818
|
-
function setMode(mode) {
|
|
31819
|
-
if (["default", "max", "lite"].includes(mode)) {
|
|
31820
|
-
currentMode = mode;
|
|
31821
|
-
return true;
|
|
31822
|
-
}
|
|
31823
|
-
return false;
|
|
31824
|
-
}
|
|
31825
31844
|
module2.exports = {
|
|
31826
31845
|
NVIDIA_MODEL,
|
|
31827
31846
|
REVIEWER_MODEL,
|
|
31828
31847
|
THINKER_MODEL,
|
|
31829
31848
|
COMMANDER_MODEL,
|
|
31830
31849
|
CONTEXT_PRUNER_MODEL,
|
|
31850
|
+
RESEARCHER_MODEL,
|
|
31851
|
+
GENERAL_AGENT_MODEL,
|
|
31831
31852
|
MAX_TOOL_ITERATIONS,
|
|
31832
31853
|
MAX_OUTPUT_LEN,
|
|
31833
31854
|
TOOL_TIMEOUT,
|
|
@@ -31839,14 +31860,16 @@ Output JSON only, no markdown fences:
|
|
|
31839
31860
|
COMMANDER_SYSTEM_PROMPT,
|
|
31840
31861
|
CONTEXT_PRUNER_SYSTEM_PROMPT,
|
|
31841
31862
|
SELECTOR_SYSTEM_PROMPT,
|
|
31863
|
+
RESEARCHER_WEB_SYSTEM_PROMPT,
|
|
31864
|
+
RESEARCHER_DOCS_SYSTEM_PROMPT,
|
|
31865
|
+
GENERAL_AGENT_SYSTEM_PROMPT,
|
|
31842
31866
|
nvidiaClient,
|
|
31843
31867
|
session,
|
|
31844
31868
|
truncateOutput,
|
|
31845
31869
|
resolvePath,
|
|
31846
31870
|
timestamp,
|
|
31847
31871
|
sleep,
|
|
31848
|
-
getMode
|
|
31849
|
-
setMode
|
|
31872
|
+
getMode
|
|
31850
31873
|
};
|
|
31851
31874
|
});
|
|
31852
31875
|
|
|
@@ -31855,7 +31878,7 @@ var require_prompt = __commonJS((exports, module2) => {
|
|
|
31855
31878
|
var fs2 = __require("fs");
|
|
31856
31879
|
var path2 = __require("path");
|
|
31857
31880
|
var { execSync } = __require("child_process");
|
|
31858
|
-
var { PROJECT_ROOT, MAX_TOOL_ITERATIONS
|
|
31881
|
+
var { PROJECT_ROOT, MAX_TOOL_ITERATIONS } = require_config();
|
|
31859
31882
|
function buildSystemPrompt() {
|
|
31860
31883
|
let gitInfo = "";
|
|
31861
31884
|
try {
|
|
@@ -31883,82 +31906,119 @@ Dev dependencies: ${Object.keys(pkg.devDependencies).join(", ")}`;
|
|
|
31883
31906
|
projectInfo += `
|
|
31884
31907
|
Scripts: ${Object.keys(pkg.scripts).join(", ")}`;
|
|
31885
31908
|
} catch {}
|
|
31886
|
-
return `You are Apex AI,
|
|
31909
|
+
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.
|
|
31910
|
+
|
|
31911
|
+
# Core Mandates
|
|
31912
|
+
|
|
31913
|
+
- **Understand first, act second:** Always gather context and read relevant files BEFORE editing. Use sub-agents (FilePickerMax, Grep, Read) to verify assumptions before implementing.
|
|
31914
|
+
- **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed sub-agent calls are better than many rushed ones.
|
|
31915
|
+
- **Tone:** Professional, direct, and concise. Suitable for a CLI environment.
|
|
31916
|
+
- **Validate assumptions:** Use FilePickerMax and Read to verify assumptions about libraries, APIs, and project structure before implementing.
|
|
31917
|
+
- **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
|
|
31918
|
+
- **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.
|
|
31919
|
+
- **Do what the user asks:** If the user asks you to do something, even running a risky command, do it.
|
|
31920
|
+
- **If a tool fails, try again or try a different tool.** Don't give up after one attempt.
|
|
31921
|
+
- **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."
|
|
31922
|
+
- **Use <think></think> tags for moderate reasoning.** Call the Thinker sub-agent for anything more complex.
|
|
31887
31923
|
|
|
31888
31924
|
# Output Style
|
|
31889
31925
|
- Default to short answers (\u22644 lines) unless the user asks for detail.
|
|
31890
|
-
- No unnecessary preamble or postamble. Don't narrate obvious steps
|
|
31926
|
+
- No unnecessary preamble or postamble. Don't narrate obvious steps.
|
|
31891
31927
|
- After working on files, just stop \u2014 don't summarize what you did unless asked.
|
|
31892
|
-
- Use bullets and monospace for commands, file paths, and code identifiers.
|
|
31893
31928
|
- No emojis unless the user uses them first.
|
|
31894
|
-
- For casual conversation, greetings, or quick questions, respond naturally without tools
|
|
31895
|
-
- NEVER say
|
|
31896
|
-
|
|
31897
|
-
#
|
|
31898
|
-
|
|
31899
|
-
|
|
31900
|
-
|
|
31901
|
-
|
|
31902
|
-
|
|
31903
|
-
|
|
31904
|
-
|
|
31929
|
+
- For casual conversation, greetings, or quick questions, respond naturally without tools.
|
|
31930
|
+
- NEVER say "I don't have any tool to call" \u2014 just respond with what you know.
|
|
31931
|
+
|
|
31932
|
+
# Code Editing Mandates
|
|
31933
|
+
|
|
31934
|
+
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code.
|
|
31935
|
+
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project first (check package.json, neighboring files).
|
|
31936
|
+
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code.
|
|
31937
|
+
- **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.
|
|
31938
|
+
- **Code Reuse:** Always reuse helper functions, components, classes, etc., whenever possible.
|
|
31939
|
+
- **Refactoring Awareness:** Whenever you modify an exported symbol, find and update all references to it.
|
|
31940
|
+
- **Testing:** If you create a test, run it to see if it passes, and fix it if it doesn't.
|
|
31941
|
+
- **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.
|
|
31905
31942
|
|
|
31906
31943
|
# Safety & Side Effects
|
|
31907
|
-
- Never expose secrets, API keys, tokens, or credentials.
|
|
31908
|
-
-
|
|
31909
|
-
- Never \`git commit\` or \`git push\` unless the user explicitly asks.
|
|
31944
|
+
- Never expose secrets, API keys, tokens, or credentials.
|
|
31945
|
+
- 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.
|
|
31910
31946
|
- Don't add new dependencies without confirming the user wants them.
|
|
31911
|
-
- NEVER assume a library is available. Check package.json or neighboring files first.
|
|
31912
|
-
|
|
31913
|
-
# Code Hygiene
|
|
31914
|
-
- Do NOT add code comments or docstrings unless the user asks or correctness requires it.
|
|
31915
|
-
- Match existing code style, naming conventions, frameworks, and patterns.
|
|
31916
|
-
- When creating new files or components, look at existing ones first to follow conventions.
|
|
31917
|
-
- Follow security best practices. Never introduce code that exposes or logs secrets.
|
|
31918
|
-
|
|
31919
|
-
# Validation
|
|
31920
|
-
- After code changes, run the most relevant checks: tests, lint, typecheck, or build. Prefer scripts from package.json.
|
|
31921
|
-
- If checks fail, fix and re-run. If blocked, clearly state what's failing and why.
|
|
31922
|
-
- Start with targeted tests for what you changed, then broaden if needed.
|
|
31923
|
-
|
|
31924
|
-
# Tool Usage
|
|
31925
|
-
- Use Grep/Glob/ListDir to explore and locate code.
|
|
31926
|
-
- Use Read to understand files before modifying them.
|
|
31927
|
-
- Use Edit for surgical changes to existing files (preferred over Write).
|
|
31928
|
-
- Use Patch for multiple edits to the same file.
|
|
31929
|
-
- Use Write only for creating new files.
|
|
31930
|
-
- Use Bash for running commands (tests, builds, linters, git).
|
|
31931
|
-
- Bundle independent tool calls in the same turn for parallel execution.
|
|
31932
|
-
- Don't ask for permission to use tools \u2014 just use them.
|
|
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
31947
|
|
|
31935
|
-
# Sub-
|
|
31936
|
-
|
|
31948
|
+
# Sub-Agent Orchestration
|
|
31949
|
+
|
|
31950
|
+
You have specialized sub-agents available as tools. **Your strong default should be to delegate to sub-agents** for anything beyond trivially simple operations. Sub-agents are specialists \u2014 they produce better, more thorough results than you chaining basic tools manually.
|
|
31951
|
+
|
|
31952
|
+
## Available Sub-Agents
|
|
31953
|
+
|
|
31954
|
+
**Context Gathering:**
|
|
31955
|
+
- **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.
|
|
31956
|
+
- **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.
|
|
31957
|
+
- **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.
|
|
31958
|
+
|
|
31959
|
+
**Reasoning & Planning:**
|
|
31960
|
+
- **Thinker** \u2014 Deep reasoning and planning. Call before implementing anything non-trivial to get a structured plan.
|
|
31961
|
+
- **ThinkerBestOfN** \u2014 Multiple parallel reasoning passes, selects the best. Use for critical decisions that benefit from diverse perspectives.
|
|
31962
|
+
- **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.
|
|
31963
|
+
|
|
31964
|
+
**Implementation:**
|
|
31965
|
+
- **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.
|
|
31966
|
+
- **Commander** \u2014 Terminal command specialist. Plans and executes shell commands for a goal. Use instead of calling Bash directly for multi-step operations.
|
|
31967
|
+
|
|
31968
|
+
**Review & Maintenance:**
|
|
31969
|
+
- **CodeReview** / **CodeReviewMulti** \u2014 Reviews code changes for bugs, security, edge cases. CodeReviewMulti runs automatically after edits.
|
|
31970
|
+
- **ContextPruner** \u2014 Summarizes conversation history to free context space.
|
|
31971
|
+
|
|
31972
|
+
## How to Orchestrate (use your judgment)
|
|
31937
31973
|
|
|
31938
|
-
**
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
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.
|
|
31974
|
+
**Phase 1 \u2014 Context Gathering:**
|
|
31975
|
+
- 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").
|
|
31976
|
+
- Use Read to read all relevant files. For complex tasks, read 12-20 files to build a thorough understanding.
|
|
31977
|
+
- Use ResearcherWeb/ResearcherDocs when you need external information about libraries or APIs.
|
|
31978
|
+
- Bundle independent context-gathering calls in the same turn for parallel execution.
|
|
31946
31979
|
|
|
31947
|
-
**
|
|
31980
|
+
**Phase 2 \u2014 Planning:**
|
|
31981
|
+
- For tasks requiring 3+ steps, use TodoList to write out a step-by-step plan.
|
|
31982
|
+
- Call Thinker (or ThinkerBestOfN for critical decisions) to reason about the approach.
|
|
31983
|
+
- Call GeneralAgent when you need independent deep analysis with file context.
|
|
31948
31984
|
|
|
31949
|
-
**
|
|
31985
|
+
**Phase 3 \u2014 Implementation:**
|
|
31986
|
+
- Use EditorMultiPrompt for non-trivial code changes \u2014 it tries multiple strategies and auto-applies the best result.
|
|
31987
|
+
- For trivially simple edits on already-read files, use Edit or Patch directly.
|
|
31988
|
+
- Use Write only for creating new files.
|
|
31989
|
+
|
|
31990
|
+
**Phase 4 \u2014 Validation:**
|
|
31991
|
+
- After code changes, run the most relevant checks: tests, lint, typecheck, or build.
|
|
31992
|
+
- Use Commander for multi-step validation. Use Bash for single commands.
|
|
31993
|
+
- If checks fail, fix and re-run. If blocked, clearly state what's failing.
|
|
31994
|
+
|
|
31995
|
+
**Phase 5 \u2014 Review:**
|
|
31996
|
+
- CodeReviewMulti runs automatically after edits \u2014 don't duplicate its work.
|
|
31997
|
+
- If the review finds issues, fix them and re-validate.
|
|
31998
|
+
|
|
31999
|
+
## When to Skip Sub-Agents and Act Directly
|
|
31950
32000
|
- Reading a single known file path (just use Read)
|
|
31951
32001
|
- A single targeted grep for a known pattern (just use Grep)
|
|
32002
|
+
- A quick one-line bash command (just use Bash)
|
|
31952
32003
|
- Answering a question from memory/context (just respond)
|
|
32004
|
+
- Trivially simple edits where the file is already read and understood
|
|
31953
32005
|
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
-
|
|
31957
|
-
-
|
|
31958
|
-
- **
|
|
32006
|
+
## Parallel Execution Rules
|
|
32007
|
+
- Bundle independent tool calls in the same turn \u2014 this is critical for speed.
|
|
32008
|
+
- Spawn multiple FilePickerMax simultaneously for different aspects of the codebase.
|
|
32009
|
+
- Run independent Read calls in parallel.
|
|
32010
|
+
- **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.
|
|
32011
|
+
- After implementation, run tests AND typechecks in parallel.
|
|
31959
32012
|
|
|
31960
|
-
#
|
|
31961
|
-
|
|
32013
|
+
# Tool Usage (basic tools)
|
|
32014
|
+
- Use Read to understand files before modifying them. NEVER modify a file you haven't read.
|
|
32015
|
+
- Use Edit for surgical changes to existing files (preferred over Write).
|
|
32016
|
+
- Use Patch for multiple edits to the same file.
|
|
32017
|
+
- Use Write only for creating new files.
|
|
32018
|
+
- Use Bash for simple, single commands. Use Commander for multi-step operations.
|
|
32019
|
+
- Use Grep/Glob/ListDir for quick, targeted lookups. Use FilePickerMax for broad codebase discovery.
|
|
32020
|
+
- Use TodoList to track multi-step plans.
|
|
32021
|
+
- Don't ask for permission to use tools \u2014 just use them.
|
|
31962
32022
|
|
|
31963
32023
|
# Environment
|
|
31964
32024
|
Working directory: ${PROJECT_ROOT}
|
|
@@ -32214,7 +32274,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32214
32274
|
type: "function",
|
|
32215
32275
|
function: {
|
|
32216
32276
|
name: "ThinkerBestOfN",
|
|
32217
|
-
description: "Spawn N parallel thinking agents that each independently reason about the same problem, then a selector picks the best response. Use for critical decisions that benefit from multiple perspectives.
|
|
32277
|
+
description: "Spawn N parallel thinking agents that each independently reason about the same problem, then a selector picks the best response. Use for critical decisions that benefit from multiple perspectives.",
|
|
32218
32278
|
parameters: {
|
|
32219
32279
|
type: "object",
|
|
32220
32280
|
properties: {
|
|
@@ -32229,7 +32289,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32229
32289
|
type: "function",
|
|
32230
32290
|
function: {
|
|
32231
32291
|
name: "EditorMultiPrompt",
|
|
32232
|
-
description: "Spawn multiple editor agents in parallel, each with a different implementation strategy, then a selector picks the best result and applies it.
|
|
32292
|
+
description: "Spawn multiple editor agents in parallel, each with a different implementation strategy, then a selector picks the best result and applies it. Use for important code changes where you want to explore multiple approaches.",
|
|
32233
32293
|
parameters: {
|
|
32234
32294
|
type: "object",
|
|
32235
32295
|
properties: {
|
|
@@ -32260,7 +32320,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32260
32320
|
type: "function",
|
|
32261
32321
|
function: {
|
|
32262
32322
|
name: "CodeReviewMulti",
|
|
32263
|
-
description: "Spawn multiple code reviewers in parallel, each analyzing from a different perspective (correctness, security, performance, etc.).
|
|
32323
|
+
description: "Spawn multiple code reviewers in parallel, each analyzing from a different perspective (correctness, security, performance, etc.).",
|
|
32264
32324
|
parameters: {
|
|
32265
32325
|
type: "object",
|
|
32266
32326
|
properties: {
|
|
@@ -32300,6 +32360,59 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32300
32360
|
required: []
|
|
32301
32361
|
}
|
|
32302
32362
|
}
|
|
32363
|
+
},
|
|
32364
|
+
{
|
|
32365
|
+
type: "function",
|
|
32366
|
+
function: {
|
|
32367
|
+
name: "ResearcherWeb",
|
|
32368
|
+
description: "Search the web and synthesize results into a clear answer using 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.",
|
|
32369
|
+
parameters: {
|
|
32370
|
+
type: "object",
|
|
32371
|
+
properties: {
|
|
32372
|
+
prompt: { type: "string", description: "The question to research. Be specific for better results." },
|
|
32373
|
+
domains: {
|
|
32374
|
+
type: "array",
|
|
32375
|
+
description: 'Optional list of domains to restrict search to (e.g. ["stackoverflow.com", "github.com"]).',
|
|
32376
|
+
items: { type: "string" }
|
|
32377
|
+
}
|
|
32378
|
+
},
|
|
32379
|
+
required: ["prompt"]
|
|
32380
|
+
}
|
|
32381
|
+
}
|
|
32382
|
+
},
|
|
32383
|
+
{
|
|
32384
|
+
type: "function",
|
|
32385
|
+
function: {
|
|
32386
|
+
name: "ResearcherDocs",
|
|
32387
|
+
description: "Search technical documentation for a library or framework and synthesize a precise answer with API details and code examples. Use when you need to verify API signatures, find usage patterns, or check library behavior.",
|
|
32388
|
+
parameters: {
|
|
32389
|
+
type: "object",
|
|
32390
|
+
properties: {
|
|
32391
|
+
prompt: { type: "string", description: "The documentation question. Include the library/framework name and version if relevant." },
|
|
32392
|
+
library: { type: "string", description: 'The library or framework name (e.g. "React", "Express", "Prisma").' }
|
|
32393
|
+
},
|
|
32394
|
+
required: ["prompt"]
|
|
32395
|
+
}
|
|
32396
|
+
}
|
|
32397
|
+
},
|
|
32398
|
+
{
|
|
32399
|
+
type: "function",
|
|
32400
|
+
function: {
|
|
32401
|
+
name: "GeneralAgent",
|
|
32402
|
+
description: "Spawn an independent general-purpose agent that reads specified files and solves a problem. Use when you need deep independent analysis, complex reasoning with full file context, or a second opinion. More powerful than Thinker because it receives actual file contents.",
|
|
32403
|
+
parameters: {
|
|
32404
|
+
type: "object",
|
|
32405
|
+
properties: {
|
|
32406
|
+
prompt: { type: "string", description: "The problem to solve. Be specific about what analysis or output you need." },
|
|
32407
|
+
filePaths: {
|
|
32408
|
+
type: "array",
|
|
32409
|
+
description: "File paths to read and provide as context. The agent will analyze these files to solve the problem.",
|
|
32410
|
+
items: { type: "string" }
|
|
32411
|
+
}
|
|
32412
|
+
},
|
|
32413
|
+
required: ["prompt"]
|
|
32414
|
+
}
|
|
32415
|
+
}
|
|
32303
32416
|
}
|
|
32304
32417
|
];
|
|
32305
32418
|
module2.exports = { toolDefs };
|
|
@@ -32325,13 +32438,17 @@ var require_toolExecutors = __commonJS((exports, module2) => {
|
|
|
32325
32438
|
CONTEXT_PRUNER_MODEL,
|
|
32326
32439
|
CONTEXT_PRUNER_SYSTEM_PROMPT,
|
|
32327
32440
|
SELECTOR_SYSTEM_PROMPT,
|
|
32441
|
+
RESEARCHER_MODEL,
|
|
32442
|
+
GENERAL_AGENT_MODEL,
|
|
32443
|
+
RESEARCHER_WEB_SYSTEM_PROMPT,
|
|
32444
|
+
RESEARCHER_DOCS_SYSTEM_PROMPT,
|
|
32445
|
+
GENERAL_AGENT_SYSTEM_PROMPT,
|
|
32328
32446
|
NVIDIA_MODEL,
|
|
32329
32447
|
nvidiaClient,
|
|
32330
32448
|
session,
|
|
32331
32449
|
truncateOutput,
|
|
32332
32450
|
resolvePath,
|
|
32333
|
-
sleep
|
|
32334
|
-
getMode
|
|
32451
|
+
sleep
|
|
32335
32452
|
} = require_config();
|
|
32336
32453
|
async function streamCompletion(params, onStream) {
|
|
32337
32454
|
for (let attempt = 0;attempt <= 2; attempt++) {
|
|
@@ -32365,6 +32482,35 @@ var require_toolExecutors = __commonJS((exports, module2) => {
|
|
|
32365
32482
|
}
|
|
32366
32483
|
}
|
|
32367
32484
|
}
|
|
32485
|
+
function parseEditorOps(text) {
|
|
32486
|
+
const ops = [];
|
|
32487
|
+
const editRe = /---\s*EDIT:\s*(.+?)\s*---[\s\S]*?OLD:\s*\n```[^\n]*\n([\s\S]*?)\n```[\s\S]*?NEW:\s*\n```[^\n]*\n([\s\S]*?)\n```/g;
|
|
32488
|
+
let m2;
|
|
32489
|
+
while ((m2 = editRe.exec(text)) !== null) {
|
|
32490
|
+
ops.push({ type: "edit", path: m2[1].trim(), old_str: m2[2], new_str: m2[3] });
|
|
32491
|
+
}
|
|
32492
|
+
const createRe = /---\s*CREATE:\s*(.+?)\s*---\s*\n```[^\n]*\n([\s\S]*?)\n```/g;
|
|
32493
|
+
while ((m2 = createRe.exec(text)) !== null) {
|
|
32494
|
+
const p = m2[1].trim();
|
|
32495
|
+
if (!ops.some((o) => o.path === p && o.type === "edit")) {
|
|
32496
|
+
ops.push({ type: "create", path: p, content: m2[2] });
|
|
32497
|
+
}
|
|
32498
|
+
}
|
|
32499
|
+
return ops;
|
|
32500
|
+
}
|
|
32501
|
+
async function applyEditorOps(ops, executeFn) {
|
|
32502
|
+
const results = [];
|
|
32503
|
+
for (const op of ops) {
|
|
32504
|
+
if (op.type === "edit") {
|
|
32505
|
+
const r = await executeFn("Edit", { path: op.path, old_str: op.old_str, new_str: op.new_str });
|
|
32506
|
+
results.push(r.startsWith("Error") ? `\u2717 Edit ${op.path}: ${r}` : `\u2713 Edit ${op.path}`);
|
|
32507
|
+
} else if (op.type === "create") {
|
|
32508
|
+
const r = await executeFn("Write", { path: op.path, content: op.content });
|
|
32509
|
+
results.push(r.startsWith("Error") ? `\u2717 Create ${op.path}: ${r}` : `\u2713 Create ${op.path}`);
|
|
32510
|
+
}
|
|
32511
|
+
}
|
|
32512
|
+
return results;
|
|
32513
|
+
}
|
|
32368
32514
|
async function executeTool(name, args, onStream) {
|
|
32369
32515
|
try {
|
|
32370
32516
|
switch (name) {
|
|
@@ -32873,10 +33019,6 @@ ${"\u2500".repeat(40)}
|
|
|
32873
33019
|
}
|
|
32874
33020
|
}
|
|
32875
33021
|
case "ThinkerBestOfN": {
|
|
32876
|
-
const mode = getMode();
|
|
32877
|
-
if (mode !== "max") {
|
|
32878
|
-
return "ThinkerBestOfN is only available in MAX mode. Use /mode max to enable it, or use Thinker instead.";
|
|
32879
|
-
}
|
|
32880
33022
|
const n = Math.min(5, Math.max(2, args.n || 3));
|
|
32881
33023
|
const historyCtx = session.conversationHistory.slice(-10).map((m2) => `[${m2.role}]: ${(m2.content || "").slice(0, 500)}`).join(`
|
|
32882
33024
|
`);
|
|
@@ -32958,10 +33100,6 @@ ${thoughts[0].result}`;
|
|
|
32958
33100
|
}
|
|
32959
33101
|
}
|
|
32960
33102
|
case "EditorMultiPrompt": {
|
|
32961
|
-
const mode = getMode();
|
|
32962
|
-
if (mode !== "max") {
|
|
32963
|
-
return "EditorMultiPrompt is only available in MAX mode. Use /mode max to enable it.";
|
|
32964
|
-
}
|
|
32965
33103
|
const strategies = args.strategies || ["straightforward implementation", "alternative approach"];
|
|
32966
33104
|
const filesCtx = (args.files || []).map((f) => `--- ${f.path} ---
|
|
32967
33105
|
${f.content}`).join(`
|
|
@@ -33061,24 +33199,40 @@ Reason: ${reason}`;
|
|
|
33061
33199
|
if (improvements)
|
|
33062
33200
|
result += `
|
|
33063
33201
|
Improvements to consider: ${improvements}`;
|
|
33064
|
-
|
|
33202
|
+
const ops = parseEditorOps(winning.result);
|
|
33203
|
+
if (ops.length > 0) {
|
|
33204
|
+
if (onStream)
|
|
33205
|
+
onStream(truncateOutput(result + `
|
|
33206
|
+
|
|
33207
|
+
Applying ${ops.length} change(s)...`));
|
|
33208
|
+
const applyResults = await applyEditorOps(ops, executeTool);
|
|
33209
|
+
result += `
|
|
33210
|
+
|
|
33211
|
+
--- Applied Changes ---
|
|
33212
|
+
${applyResults.join(`
|
|
33213
|
+
`)}`;
|
|
33214
|
+
} else {
|
|
33215
|
+
result += `
|
|
33065
33216
|
|
|
33066
33217
|
${winning.result}`;
|
|
33218
|
+
}
|
|
33067
33219
|
if (onStream)
|
|
33068
33220
|
onStream(truncateOutput(result));
|
|
33069
33221
|
return truncateOutput(result);
|
|
33070
33222
|
} catch (apiErr) {
|
|
33071
|
-
const
|
|
33223
|
+
const fallbackOps = parseEditorOps(implementations[0].result);
|
|
33224
|
+
if (fallbackOps.length > 0) {
|
|
33225
|
+
const applyResults = await applyEditorOps(fallbackOps, executeTool);
|
|
33226
|
+
return truncateOutput(`${header}Selector failed, applied Implementation A:
|
|
33227
|
+
${applyResults.join(`
|
|
33228
|
+
`)}`);
|
|
33229
|
+
}
|
|
33230
|
+
return truncateOutput(`${header}Selector failed, using Implementation A:
|
|
33072
33231
|
|
|
33073
|
-
${implementations[0].result}
|
|
33074
|
-
return truncateOutput(result);
|
|
33232
|
+
${implementations[0].result}`);
|
|
33075
33233
|
}
|
|
33076
33234
|
}
|
|
33077
33235
|
case "CodeReviewMulti": {
|
|
33078
|
-
const mode = getMode();
|
|
33079
|
-
if (mode !== "max") {
|
|
33080
|
-
return "CodeReviewMulti is only available in MAX mode. Use /mode max to enable it, or use CodeReview for a single review.";
|
|
33081
|
-
}
|
|
33082
33236
|
const perspectives = args.perspectives || [
|
|
33083
33237
|
"correctness, logic errors, and edge cases",
|
|
33084
33238
|
"security vulnerabilities and data safety",
|
|
@@ -33258,6 +33412,187 @@ ${summary}`;
|
|
|
33258
33412
|
return `Error: Context pruning failed \u2014 ${apiErr.message}`;
|
|
33259
33413
|
}
|
|
33260
33414
|
}
|
|
33415
|
+
case "ResearcherWeb": {
|
|
33416
|
+
const header = `Web Research (${RESEARCHER_MODEL})
|
|
33417
|
+
${"\u2500".repeat(40)}
|
|
33418
|
+
`;
|
|
33419
|
+
if (onStream)
|
|
33420
|
+
onStream(header + "Searching the web...");
|
|
33421
|
+
let searchResults = "";
|
|
33422
|
+
const searchArgs = { query: args.prompt, num_results: 5 };
|
|
33423
|
+
if (args.domains && args.domains.length)
|
|
33424
|
+
searchArgs.include_domains = args.domains;
|
|
33425
|
+
try {
|
|
33426
|
+
searchResults = await executeTool("WebSearch", searchArgs);
|
|
33427
|
+
} catch {
|
|
33428
|
+
searchResults = "(Web search unavailable \u2014 answering from knowledge)";
|
|
33429
|
+
}
|
|
33430
|
+
if (searchResults.startsWith("Error")) {
|
|
33431
|
+
searchResults = `(Web search failed: ${searchResults.slice(0, 200)})
|
|
33432
|
+
|
|
33433
|
+
Please answer from your training data.`;
|
|
33434
|
+
}
|
|
33435
|
+
try {
|
|
33436
|
+
const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
|
|
33437
|
+
const result = await streamCompletion({
|
|
33438
|
+
model: RESEARCHER_MODEL,
|
|
33439
|
+
messages: [
|
|
33440
|
+
{ role: "system", content: RESEARCHER_WEB_SYSTEM_PROMPT },
|
|
33441
|
+
{ role: "user", content: `# Question
|
|
33442
|
+
${args.prompt}
|
|
33443
|
+
|
|
33444
|
+
# Web Search Results
|
|
33445
|
+
${searchResults}` }
|
|
33446
|
+
],
|
|
33447
|
+
max_tokens: 4096,
|
|
33448
|
+
temperature: 0.3
|
|
33449
|
+
}, streamCb) || "(No response from researcher)";
|
|
33450
|
+
return truncateOutput(header + result);
|
|
33451
|
+
} catch (apiErr) {
|
|
33452
|
+
return `Error: ResearcherWeb failed \u2014 ${apiErr.message}`;
|
|
33453
|
+
}
|
|
33454
|
+
}
|
|
33455
|
+
case "ResearcherDocs": {
|
|
33456
|
+
const header = `Docs Research (${RESEARCHER_MODEL})
|
|
33457
|
+
${"\u2500".repeat(40)}
|
|
33458
|
+
`;
|
|
33459
|
+
if (onStream)
|
|
33460
|
+
onStream(header + "Searching documentation...");
|
|
33461
|
+
const docDomains = [
|
|
33462
|
+
"developer.mozilla.org",
|
|
33463
|
+
"react.dev",
|
|
33464
|
+
"nodejs.org",
|
|
33465
|
+
"docs.python.org",
|
|
33466
|
+
"doc.rust-lang.org",
|
|
33467
|
+
"pkg.go.dev",
|
|
33468
|
+
"learn.microsoft.com",
|
|
33469
|
+
"typescriptlang.org",
|
|
33470
|
+
"expressjs.com",
|
|
33471
|
+
"nextjs.org",
|
|
33472
|
+
"vuejs.org",
|
|
33473
|
+
"angular.io",
|
|
33474
|
+
"svelte.dev",
|
|
33475
|
+
"docs.rs",
|
|
33476
|
+
"rubydoc.info",
|
|
33477
|
+
"docs.oracle.com",
|
|
33478
|
+
"npmjs.com"
|
|
33479
|
+
];
|
|
33480
|
+
const query = args.library ? `${args.library} ${args.prompt}` : args.prompt;
|
|
33481
|
+
let searchResults = "";
|
|
33482
|
+
try {
|
|
33483
|
+
searchResults = await executeTool("WebSearch", {
|
|
33484
|
+
query: `${query} documentation`,
|
|
33485
|
+
num_results: 8,
|
|
33486
|
+
include_domains: docDomains
|
|
33487
|
+
});
|
|
33488
|
+
} catch {
|
|
33489
|
+
searchResults = "";
|
|
33490
|
+
}
|
|
33491
|
+
if (!searchResults || searchResults === "No results found.") {
|
|
33492
|
+
try {
|
|
33493
|
+
searchResults = await executeTool("WebSearch", {
|
|
33494
|
+
query: `${query} documentation API reference`,
|
|
33495
|
+
num_results: 5
|
|
33496
|
+
});
|
|
33497
|
+
} catch {
|
|
33498
|
+
searchResults = "(Documentation search unavailable \u2014 answering from knowledge)";
|
|
33499
|
+
}
|
|
33500
|
+
}
|
|
33501
|
+
if (!searchResults || searchResults.startsWith("Error")) {
|
|
33502
|
+
searchResults = "(No documentation results found \u2014 answering from knowledge)";
|
|
33503
|
+
}
|
|
33504
|
+
try {
|
|
33505
|
+
const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
|
|
33506
|
+
const result = await streamCompletion({
|
|
33507
|
+
model: RESEARCHER_MODEL,
|
|
33508
|
+
messages: [
|
|
33509
|
+
{ role: "system", content: RESEARCHER_DOCS_SYSTEM_PROMPT },
|
|
33510
|
+
{
|
|
33511
|
+
role: "user",
|
|
33512
|
+
content: `# Question
|
|
33513
|
+
${args.prompt}${args.library ? `
|
|
33514
|
+
Library: ${args.library}` : ""}
|
|
33515
|
+
|
|
33516
|
+
# Documentation Search Results
|
|
33517
|
+
${searchResults}`
|
|
33518
|
+
}
|
|
33519
|
+
],
|
|
33520
|
+
max_tokens: 4096,
|
|
33521
|
+
temperature: 0.2
|
|
33522
|
+
}, streamCb) || "(No response from researcher)";
|
|
33523
|
+
return truncateOutput(header + result);
|
|
33524
|
+
} catch (apiErr) {
|
|
33525
|
+
return `Error: ResearcherDocs failed \u2014 ${apiErr.message}`;
|
|
33526
|
+
}
|
|
33527
|
+
}
|
|
33528
|
+
case "GeneralAgent": {
|
|
33529
|
+
const header = `General Agent (${GENERAL_AGENT_MODEL})
|
|
33530
|
+
${"\u2500".repeat(40)}
|
|
33531
|
+
`;
|
|
33532
|
+
if (onStream)
|
|
33533
|
+
onStream(header + "Reading files and analyzing...");
|
|
33534
|
+
const MAX_TOTAL_CHARS = 50000;
|
|
33535
|
+
let totalChars = 0;
|
|
33536
|
+
const fileContents = [];
|
|
33537
|
+
for (const fp of args.filePaths || []) {
|
|
33538
|
+
const absPath = resolvePath(fp);
|
|
33539
|
+
const stat = fs2.statSync(absPath, { throwIfNoEntry: false });
|
|
33540
|
+
if (!stat || stat.isDirectory()) {
|
|
33541
|
+
fileContents.push(`--- ${fp} ---
|
|
33542
|
+
[Not found or is a directory]`);
|
|
33543
|
+
continue;
|
|
33544
|
+
}
|
|
33545
|
+
if (stat.size > 256 * 1024) {
|
|
33546
|
+
fileContents.push(`--- ${fp} ---
|
|
33547
|
+
[File too large: ${(stat.size / 1024).toFixed(0)}KB \u2014 skipped]`);
|
|
33548
|
+
continue;
|
|
33549
|
+
}
|
|
33550
|
+
const content = fs2.readFileSync(absPath, "utf-8");
|
|
33551
|
+
if (totalChars + content.length > MAX_TOTAL_CHARS) {
|
|
33552
|
+
const remaining = MAX_TOTAL_CHARS - totalChars;
|
|
33553
|
+
if (remaining > 500) {
|
|
33554
|
+
fileContents.push(`--- ${fp} ---
|
|
33555
|
+
${content.slice(0, remaining)}
|
|
33556
|
+
[Truncated \u2014 context limit reached]`);
|
|
33557
|
+
}
|
|
33558
|
+
totalChars = MAX_TOTAL_CHARS;
|
|
33559
|
+
break;
|
|
33560
|
+
}
|
|
33561
|
+
fileContents.push(`--- ${fp} ---
|
|
33562
|
+
${content}`);
|
|
33563
|
+
totalChars += content.length;
|
|
33564
|
+
}
|
|
33565
|
+
const historyCtx = session.conversationHistory.slice(-8).map((m2) => `[${m2.role}]: ${(m2.content || "").slice(0, 400)}`).join(`
|
|
33566
|
+
`);
|
|
33567
|
+
const userContent = [
|
|
33568
|
+
`# Task
|
|
33569
|
+
${args.prompt}`,
|
|
33570
|
+
fileContents.length > 0 ? `
|
|
33571
|
+
# Files (${fileContents.length})
|
|
33572
|
+
${fileContents.join(`
|
|
33573
|
+
|
|
33574
|
+
`)}` : "",
|
|
33575
|
+
historyCtx ? `
|
|
33576
|
+
# Recent conversation
|
|
33577
|
+
${historyCtx}` : ""
|
|
33578
|
+
].filter(Boolean).join(`
|
|
33579
|
+
`);
|
|
33580
|
+
try {
|
|
33581
|
+
const streamCb = onStream ? (text) => onStream(truncateOutput(header + text)) : null;
|
|
33582
|
+
const result = await streamCompletion({
|
|
33583
|
+
model: GENERAL_AGENT_MODEL,
|
|
33584
|
+
messages: [
|
|
33585
|
+
{ role: "system", content: GENERAL_AGENT_SYSTEM_PROMPT },
|
|
33586
|
+
{ role: "user", content: userContent }
|
|
33587
|
+
],
|
|
33588
|
+
max_tokens: 4096,
|
|
33589
|
+
temperature: 0.4
|
|
33590
|
+
}, streamCb) || "(No response from agent)";
|
|
33591
|
+
return truncateOutput(header + result);
|
|
33592
|
+
} catch (apiErr) {
|
|
33593
|
+
return `Error: GeneralAgent failed \u2014 ${apiErr.message}`;
|
|
33594
|
+
}
|
|
33595
|
+
}
|
|
33261
33596
|
default:
|
|
33262
33597
|
return `Unknown tool: ${name}`;
|
|
33263
33598
|
}
|
|
@@ -33314,6 +33649,16 @@ var require_utils3 = __commonJS((exports, module2) => {
|
|
|
33314
33649
|
return args.prompt ? args.prompt.slice(0, 40) : "running commands";
|
|
33315
33650
|
case "ContextPruner":
|
|
33316
33651
|
return "pruning context";
|
|
33652
|
+
case "ResearcherWeb":
|
|
33653
|
+
return args.prompt ? args.prompt.slice(0, 40) : "web research";
|
|
33654
|
+
case "ResearcherDocs":
|
|
33655
|
+
return args.prompt ? `${args.library ? args.library + ": " : ""}${args.prompt.slice(0, 30)}` : "docs research";
|
|
33656
|
+
case "GeneralAgent":
|
|
33657
|
+
return args.prompt ? args.prompt.slice(0, 40) : "analyzing";
|
|
33658
|
+
case "WebSearch":
|
|
33659
|
+
return args.query ? args.query.slice(0, 40) : "searching";
|
|
33660
|
+
case "TodoList":
|
|
33661
|
+
return args.action || "";
|
|
33317
33662
|
default:
|
|
33318
33663
|
return JSON.stringify(args).slice(0, 60);
|
|
33319
33664
|
}
|
|
@@ -33395,8 +33740,7 @@ var require_agent = __commonJS((exports, module2) => {
|
|
|
33395
33740
|
MAX_TOOL_ITERATIONS,
|
|
33396
33741
|
nvidiaClient,
|
|
33397
33742
|
session,
|
|
33398
|
-
sleep
|
|
33399
|
-
getMode
|
|
33743
|
+
sleep
|
|
33400
33744
|
} = require_config();
|
|
33401
33745
|
var { buildSystemPrompt } = require_prompt();
|
|
33402
33746
|
var { toolDefs } = require_tools();
|
|
@@ -33413,208 +33757,12 @@ var require_agent = __commonJS((exports, module2) => {
|
|
|
33413
33757
|
function getIsProcessing() {
|
|
33414
33758
|
return isProcessing;
|
|
33415
33759
|
}
|
|
33416
|
-
var EXPLORATION_KEYWORDS = [
|
|
33417
|
-
"explore",
|
|
33418
|
-
"find files",
|
|
33419
|
-
"where is",
|
|
33420
|
-
"search for",
|
|
33421
|
-
"locate",
|
|
33422
|
-
"what files",
|
|
33423
|
-
"which files",
|
|
33424
|
-
"show me all",
|
|
33425
|
-
"list all",
|
|
33426
|
-
"find code",
|
|
33427
|
-
"search code",
|
|
33428
|
-
"find function",
|
|
33429
|
-
"find class",
|
|
33430
|
-
"find module",
|
|
33431
|
-
"find component",
|
|
33432
|
-
"find endpoint",
|
|
33433
|
-
"find route",
|
|
33434
|
-
"find api",
|
|
33435
|
-
"find service",
|
|
33436
|
-
"find model",
|
|
33437
|
-
"find controller",
|
|
33438
|
-
"where can i find",
|
|
33439
|
-
"how do i find",
|
|
33440
|
-
"look for",
|
|
33441
|
-
"codebase structure",
|
|
33442
|
-
"project structure",
|
|
33443
|
-
"directory structure"
|
|
33444
|
-
];
|
|
33445
|
-
function isExplorationTask(text) {
|
|
33446
|
-
const lower = text.toLowerCase();
|
|
33447
|
-
return EXPLORATION_KEYWORDS.some((keyword) => lower.includes(keyword));
|
|
33448
|
-
}
|
|
33449
|
-
var CODING_TASK_KEYWORDS = [
|
|
33450
|
-
"refactor",
|
|
33451
|
-
"redesign",
|
|
33452
|
-
"architect",
|
|
33453
|
-
"migrate",
|
|
33454
|
-
"overhaul",
|
|
33455
|
-
"implement",
|
|
33456
|
-
"build",
|
|
33457
|
-
"create",
|
|
33458
|
-
"design",
|
|
33459
|
-
"add feature",
|
|
33460
|
-
"new feature",
|
|
33461
|
-
"integrate",
|
|
33462
|
-
"convert",
|
|
33463
|
-
"multiple files",
|
|
33464
|
-
"across files",
|
|
33465
|
-
"full stack",
|
|
33466
|
-
"database",
|
|
33467
|
-
"api",
|
|
33468
|
-
"endpoint",
|
|
33469
|
-
"authentication",
|
|
33470
|
-
"complex",
|
|
33471
|
-
"tricky",
|
|
33472
|
-
"challenging",
|
|
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"
|
|
33510
|
-
];
|
|
33511
|
-
function isCodingTask(text) {
|
|
33512
|
-
const lower = text.toLowerCase();
|
|
33513
|
-
const wordCount = text.split(/\s+/).length;
|
|
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);
|
|
33553
|
-
}
|
|
33554
33760
|
async function handleUserInput(userInput) {
|
|
33555
33761
|
isProcessing = true;
|
|
33556
33762
|
store.setState({ isProcessing: true });
|
|
33557
33763
|
session.turnCount++;
|
|
33558
33764
|
store.addMessage({ role: "user", content: userInput });
|
|
33559
33765
|
session.conversationHistory.push({ role: "user", content: userInput });
|
|
33560
|
-
if (isExplorationTask(userInput)) {
|
|
33561
|
-
const exploreId = store.addMessage({ role: "system", content: "Exploring codebase...", label: "\uD83D\uDD0D Exploring" });
|
|
33562
|
-
try {
|
|
33563
|
-
const pickerResult = await executeTool("FilePickerMax", { prompt: userInput }, (partial) => {
|
|
33564
|
-
store.updateMessage(exploreId, { content: partial, label: "\uD83D\uDD0D Exploring" });
|
|
33565
|
-
});
|
|
33566
|
-
store.updateMessage(exploreId, { content: pickerResult, label: "\uD83D\uDD0D Codebase Exploration Results" });
|
|
33567
|
-
session.conversationHistory.push({
|
|
33568
|
-
role: "assistant",
|
|
33569
|
-
content: `I've explored the codebase and found the following relevant files:
|
|
33570
|
-
|
|
33571
|
-
${pickerResult}`
|
|
33572
|
-
});
|
|
33573
|
-
} catch (err) {
|
|
33574
|
-
store.updateMessage(exploreId, { content: `Exploration failed: ${err.message}` });
|
|
33575
|
-
}
|
|
33576
|
-
}
|
|
33577
|
-
const mode = getMode();
|
|
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 });
|
|
33597
|
-
try {
|
|
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 });
|
|
33602
|
-
});
|
|
33603
|
-
store.updateMessage(thinkId, { content: thinkerResult, label: thinkLabel });
|
|
33604
|
-
session.conversationHistory.push({
|
|
33605
|
-
role: "assistant",
|
|
33606
|
-
content: `[Thinker analysis \u2014 follow this plan]
|
|
33607
|
-
${thinkerResult}`
|
|
33608
|
-
});
|
|
33609
|
-
} catch (err) {
|
|
33610
|
-
store.updateMessage(thinkId, { content: `Thinker failed (falling back to main agent): ${err.message}` });
|
|
33611
|
-
}
|
|
33612
|
-
}
|
|
33613
|
-
if (session.conversationHistory.length > 20) {
|
|
33614
|
-
try {
|
|
33615
|
-
await executeTool("ContextPruner", {}, null);
|
|
33616
|
-
} catch {}
|
|
33617
|
-
}
|
|
33618
33766
|
const startTime2 = Date.now();
|
|
33619
33767
|
let turnTokens = 0;
|
|
33620
33768
|
let turnToolCalls = 0;
|
|
@@ -33934,40 +34082,21 @@ ${thinkerResult}`
|
|
|
33934
34082
|
const reviewPrompt = `User request: ${userInput}
|
|
33935
34083
|
|
|
33936
34084
|
${turnTokens > 0 ? `Processed with ${turnTokens} tokens and ${turnToolCalls} tool calls.` : ""}`;
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
|
|
33940
|
-
|
|
33941
|
-
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
content: `
|
|
33947
|
-
|
|
33948
|
-
--- Multi-Perspective Code Review ---
|
|
33949
|
-
${reviewResult}`
|
|
33950
|
-
});
|
|
33951
|
-
} catch (err) {
|
|
33952
|
-
store.updateMessage(reviewId, { content: `Multi-review failed: ${err.message}` });
|
|
33953
|
-
}
|
|
33954
|
-
} else if (mode !== "lite") {
|
|
33955
|
-
const reviewId = store.addMessage({ role: "system", content: "Reviewing code changes...", label: "\uD83D\uDCCB Code Review" });
|
|
33956
|
-
try {
|
|
33957
|
-
const reviewResult = await executeTool("CodeReview", { prompt: reviewPrompt }, (partial) => {
|
|
33958
|
-
store.updateMessage(reviewId, { content: partial, label: "\uD83D\uDCCB Code Review" });
|
|
33959
|
-
});
|
|
33960
|
-
store.updateMessage(reviewId, { content: reviewResult, label: "\uD83D\uDCCB Code Review" });
|
|
33961
|
-
session.conversationHistory.push({
|
|
33962
|
-
role: "assistant",
|
|
33963
|
-
content: `
|
|
34085
|
+
const reviewId = store.addMessage({ role: "system", content: "Multi-perspective code review...", label: "\uD83D\uDCCB Code Review" });
|
|
34086
|
+
try {
|
|
34087
|
+
const reviewResult = await executeTool("CodeReviewMulti", { prompt: reviewPrompt }, (partial) => {
|
|
34088
|
+
store.updateMessage(reviewId, { content: partial, label: "\uD83D\uDCCB Code Review" });
|
|
34089
|
+
});
|
|
34090
|
+
store.updateMessage(reviewId, { content: reviewResult, label: "\uD83D\uDCCB Code Review" });
|
|
34091
|
+
session.conversationHistory.push({
|
|
34092
|
+
role: "assistant",
|
|
34093
|
+
content: `
|
|
33964
34094
|
|
|
33965
34095
|
--- Code Review ---
|
|
33966
34096
|
${reviewResult}`
|
|
33967
|
-
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
}
|
|
34097
|
+
});
|
|
34098
|
+
} catch (err) {
|
|
34099
|
+
store.updateMessage(reviewId, { content: `Code review failed: ${err.message}` });
|
|
33971
34100
|
}
|
|
33972
34101
|
}
|
|
33973
34102
|
} catch (err) {
|
|
@@ -33998,7 +34127,7 @@ var require_commands = __commonJS((exports, module2) => {
|
|
|
33998
34127
|
var fs2 = __require("fs");
|
|
33999
34128
|
var path2 = __require("path");
|
|
34000
34129
|
var { execSync } = __require("child_process");
|
|
34001
|
-
var { PROJECT_ROOT, session, resolvePath
|
|
34130
|
+
var { PROJECT_ROOT, session, resolvePath } = require_config();
|
|
34002
34131
|
var { executeTool } = require_toolExecutors();
|
|
34003
34132
|
var store = require_store();
|
|
34004
34133
|
async function handleSlashCommand(input) {
|
|
@@ -34072,30 +34201,6 @@ var require_commands = __commonJS((exports, module2) => {
|
|
|
34072
34201
|
}
|
|
34073
34202
|
break;
|
|
34074
34203
|
}
|
|
34075
|
-
case "/mode": {
|
|
34076
|
-
if (!arg) {
|
|
34077
|
-
const current = getMode();
|
|
34078
|
-
const modes = ["default", "max", "lite"];
|
|
34079
|
-
const modeDescriptions = {
|
|
34080
|
-
default: "Single agent pass with auto code review",
|
|
34081
|
-
max: "Multi-strategy editing, best-of-N thinking, multi-perspective review, auto context pruning",
|
|
34082
|
-
lite: "Fast mode \u2014 skips validation and review steps"
|
|
34083
|
-
};
|
|
34084
|
-
const lines = modes.map((m2) => `${m2 === current ? "\u2192 " : " "}${m2.padEnd(10)} ${modeDescriptions[m2]}`);
|
|
34085
|
-
store.addMessage({ role: "system", content: `Current mode: ${current}
|
|
34086
|
-
|
|
34087
|
-
${lines.join(`
|
|
34088
|
-
`)}`, label: "Mode" });
|
|
34089
|
-
} else {
|
|
34090
|
-
const success = setMode(arg.trim());
|
|
34091
|
-
if (success) {
|
|
34092
|
-
store.addMessage({ role: "system", content: `Mode set to: ${arg.trim()}`, label: "Mode" });
|
|
34093
|
-
} else {
|
|
34094
|
-
store.addMessage({ role: "system", content: `Invalid mode: ${arg}. Use default, max, or lite.` });
|
|
34095
|
-
}
|
|
34096
|
-
}
|
|
34097
|
-
break;
|
|
34098
|
-
}
|
|
34099
34204
|
case "/compact": {
|
|
34100
34205
|
const pruneId = store.addMessage({ role: "system", content: "Compacting conversation...", label: "Context Pruner" });
|
|
34101
34206
|
try {
|
|
@@ -34181,7 +34286,7 @@ var require_jsx_runtime = __commonJS((exports, module2) => {
|
|
|
34181
34286
|
} else {}
|
|
34182
34287
|
});
|
|
34183
34288
|
|
|
34184
|
-
// node_modules/@opentui/core/index-
|
|
34289
|
+
// node_modules/@opentui/core/index-a215gqtt.js
|
|
34185
34290
|
import { Buffer as Buffer2 } from "buffer";
|
|
34186
34291
|
import { EventEmitter } from "events";
|
|
34187
34292
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
@@ -34222,7 +34327,7 @@ var highlights_default5 = "./highlights-hk7bwhj4.scm";
|
|
|
34222
34327
|
// node_modules/@opentui/core/assets/zig/tree-sitter-zig.wasm
|
|
34223
34328
|
var tree_sitter_zig_default = "./tree-sitter-zig-e78zbjpm.wasm";
|
|
34224
34329
|
|
|
34225
|
-
// node_modules/@opentui/core/index-
|
|
34330
|
+
// node_modules/@opentui/core/index-a215gqtt.js
|
|
34226
34331
|
import { resolve as resolve2, isAbsolute, parse } from "path";
|
|
34227
34332
|
import { existsSync } from "fs";
|
|
34228
34333
|
import { basename, join } from "path";
|
|
@@ -34246,17 +34351,13 @@ import { Writable } from "stream";
|
|
|
34246
34351
|
import { EventEmitter as EventEmitter7 } from "events";
|
|
34247
34352
|
import { EventEmitter as EventEmitter9 } from "events";
|
|
34248
34353
|
var __defProp2 = Object.defineProperty;
|
|
34249
|
-
var __returnValue = (v) => v;
|
|
34250
|
-
function __exportSetter(name, newValue) {
|
|
34251
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
34252
|
-
}
|
|
34253
34354
|
var __export2 = (target, all) => {
|
|
34254
34355
|
for (var name in all)
|
|
34255
34356
|
__defProp2(target, name, {
|
|
34256
34357
|
get: all[name],
|
|
34257
34358
|
enumerable: true,
|
|
34258
34359
|
configurable: true,
|
|
34259
|
-
set:
|
|
34360
|
+
set: (newValue) => all[name] = () => newValue
|
|
34260
34361
|
});
|
|
34261
34362
|
};
|
|
34262
34363
|
var exports_src = {};
|
|
@@ -53665,6 +53766,604 @@ class LineNumberRenderable extends Renderable {
|
|
|
53665
53766
|
}
|
|
53666
53767
|
}
|
|
53667
53768
|
}
|
|
53769
|
+
|
|
53770
|
+
class Diff {
|
|
53771
|
+
diff(oldStr, newStr, options = {}) {
|
|
53772
|
+
let callback;
|
|
53773
|
+
if (typeof options === "function") {
|
|
53774
|
+
callback = options;
|
|
53775
|
+
options = {};
|
|
53776
|
+
} else if ("callback" in options) {
|
|
53777
|
+
callback = options.callback;
|
|
53778
|
+
}
|
|
53779
|
+
const oldString = this.castInput(oldStr, options);
|
|
53780
|
+
const newString = this.castInput(newStr, options);
|
|
53781
|
+
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
53782
|
+
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
53783
|
+
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
53784
|
+
}
|
|
53785
|
+
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
53786
|
+
var _a;
|
|
53787
|
+
const done = (value) => {
|
|
53788
|
+
value = this.postProcess(value, options);
|
|
53789
|
+
if (callback) {
|
|
53790
|
+
setTimeout(function() {
|
|
53791
|
+
callback(value);
|
|
53792
|
+
}, 0);
|
|
53793
|
+
return;
|
|
53794
|
+
} else {
|
|
53795
|
+
return value;
|
|
53796
|
+
}
|
|
53797
|
+
};
|
|
53798
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
53799
|
+
let editLength = 1;
|
|
53800
|
+
let maxEditLength = newLen + oldLen;
|
|
53801
|
+
if (options.maxEditLength != null) {
|
|
53802
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
53803
|
+
}
|
|
53804
|
+
const maxExecutionTime = (_a = options.timeout) !== null && _a !== undefined ? _a : Infinity;
|
|
53805
|
+
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
53806
|
+
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
53807
|
+
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
53808
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
53809
|
+
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
53810
|
+
}
|
|
53811
|
+
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
53812
|
+
const execEditLength = () => {
|
|
53813
|
+
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
53814
|
+
let basePath;
|
|
53815
|
+
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
53816
|
+
if (removePath) {
|
|
53817
|
+
bestPath[diagonalPath - 1] = undefined;
|
|
53818
|
+
}
|
|
53819
|
+
let canAdd = false;
|
|
53820
|
+
if (addPath) {
|
|
53821
|
+
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
53822
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
53823
|
+
}
|
|
53824
|
+
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
53825
|
+
if (!canAdd && !canRemove) {
|
|
53826
|
+
bestPath[diagonalPath] = undefined;
|
|
53827
|
+
continue;
|
|
53828
|
+
}
|
|
53829
|
+
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
53830
|
+
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
53831
|
+
} else {
|
|
53832
|
+
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
53833
|
+
}
|
|
53834
|
+
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
53835
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
53836
|
+
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
53837
|
+
} else {
|
|
53838
|
+
bestPath[diagonalPath] = basePath;
|
|
53839
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
53840
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
53841
|
+
}
|
|
53842
|
+
if (newPos + 1 >= newLen) {
|
|
53843
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
53844
|
+
}
|
|
53845
|
+
}
|
|
53846
|
+
}
|
|
53847
|
+
editLength++;
|
|
53848
|
+
};
|
|
53849
|
+
if (callback) {
|
|
53850
|
+
(function exec() {
|
|
53851
|
+
setTimeout(function() {
|
|
53852
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
53853
|
+
return callback(undefined);
|
|
53854
|
+
}
|
|
53855
|
+
if (!execEditLength()) {
|
|
53856
|
+
exec();
|
|
53857
|
+
}
|
|
53858
|
+
}, 0);
|
|
53859
|
+
})();
|
|
53860
|
+
} else {
|
|
53861
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
53862
|
+
const ret = execEditLength();
|
|
53863
|
+
if (ret) {
|
|
53864
|
+
return ret;
|
|
53865
|
+
}
|
|
53866
|
+
}
|
|
53867
|
+
}
|
|
53868
|
+
}
|
|
53869
|
+
addToPath(path2, added, removed, oldPosInc, options) {
|
|
53870
|
+
const last = path2.lastComponent;
|
|
53871
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
53872
|
+
return {
|
|
53873
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
53874
|
+
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
53875
|
+
};
|
|
53876
|
+
} else {
|
|
53877
|
+
return {
|
|
53878
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
53879
|
+
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
53880
|
+
};
|
|
53881
|
+
}
|
|
53882
|
+
}
|
|
53883
|
+
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
53884
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
53885
|
+
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
53886
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
53887
|
+
newPos++;
|
|
53888
|
+
oldPos++;
|
|
53889
|
+
commonCount++;
|
|
53890
|
+
if (options.oneChangePerToken) {
|
|
53891
|
+
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
53892
|
+
}
|
|
53893
|
+
}
|
|
53894
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
53895
|
+
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
53896
|
+
}
|
|
53897
|
+
basePath.oldPos = oldPos;
|
|
53898
|
+
return newPos;
|
|
53899
|
+
}
|
|
53900
|
+
equals(left, right, options) {
|
|
53901
|
+
if (options.comparator) {
|
|
53902
|
+
return options.comparator(left, right);
|
|
53903
|
+
} else {
|
|
53904
|
+
return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
53905
|
+
}
|
|
53906
|
+
}
|
|
53907
|
+
removeEmpty(array) {
|
|
53908
|
+
const ret = [];
|
|
53909
|
+
for (let i = 0;i < array.length; i++) {
|
|
53910
|
+
if (array[i]) {
|
|
53911
|
+
ret.push(array[i]);
|
|
53912
|
+
}
|
|
53913
|
+
}
|
|
53914
|
+
return ret;
|
|
53915
|
+
}
|
|
53916
|
+
castInput(value, options) {
|
|
53917
|
+
return value;
|
|
53918
|
+
}
|
|
53919
|
+
tokenize(value, options) {
|
|
53920
|
+
return Array.from(value);
|
|
53921
|
+
}
|
|
53922
|
+
join(chars) {
|
|
53923
|
+
return chars.join("");
|
|
53924
|
+
}
|
|
53925
|
+
postProcess(changeObjects, options) {
|
|
53926
|
+
return changeObjects;
|
|
53927
|
+
}
|
|
53928
|
+
get useLongestToken() {
|
|
53929
|
+
return false;
|
|
53930
|
+
}
|
|
53931
|
+
buildValues(lastComponent, newTokens, oldTokens) {
|
|
53932
|
+
const components = [];
|
|
53933
|
+
let nextComponent;
|
|
53934
|
+
while (lastComponent) {
|
|
53935
|
+
components.push(lastComponent);
|
|
53936
|
+
nextComponent = lastComponent.previousComponent;
|
|
53937
|
+
delete lastComponent.previousComponent;
|
|
53938
|
+
lastComponent = nextComponent;
|
|
53939
|
+
}
|
|
53940
|
+
components.reverse();
|
|
53941
|
+
const componentLen = components.length;
|
|
53942
|
+
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
53943
|
+
for (;componentPos < componentLen; componentPos++) {
|
|
53944
|
+
const component = components[componentPos];
|
|
53945
|
+
if (!component.removed) {
|
|
53946
|
+
if (!component.added && this.useLongestToken) {
|
|
53947
|
+
let value = newTokens.slice(newPos, newPos + component.count);
|
|
53948
|
+
value = value.map(function(value2, i) {
|
|
53949
|
+
const oldValue = oldTokens[oldPos + i];
|
|
53950
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
53951
|
+
});
|
|
53952
|
+
component.value = this.join(value);
|
|
53953
|
+
} else {
|
|
53954
|
+
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
53955
|
+
}
|
|
53956
|
+
newPos += component.count;
|
|
53957
|
+
if (!component.added) {
|
|
53958
|
+
oldPos += component.count;
|
|
53959
|
+
}
|
|
53960
|
+
} else {
|
|
53961
|
+
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
53962
|
+
oldPos += component.count;
|
|
53963
|
+
}
|
|
53964
|
+
}
|
|
53965
|
+
return components;
|
|
53966
|
+
}
|
|
53967
|
+
}
|
|
53968
|
+
|
|
53969
|
+
class CharacterDiff extends Diff {
|
|
53970
|
+
}
|
|
53971
|
+
var characterDiff = new CharacterDiff;
|
|
53972
|
+
function longestCommonPrefix(str1, str2) {
|
|
53973
|
+
let i;
|
|
53974
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
53975
|
+
if (str1[i] != str2[i]) {
|
|
53976
|
+
return str1.slice(0, i);
|
|
53977
|
+
}
|
|
53978
|
+
}
|
|
53979
|
+
return str1.slice(0, i);
|
|
53980
|
+
}
|
|
53981
|
+
function longestCommonSuffix(str1, str2) {
|
|
53982
|
+
let i;
|
|
53983
|
+
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
53984
|
+
return "";
|
|
53985
|
+
}
|
|
53986
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
53987
|
+
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
53988
|
+
return str1.slice(-i);
|
|
53989
|
+
}
|
|
53990
|
+
}
|
|
53991
|
+
return str1.slice(-i);
|
|
53992
|
+
}
|
|
53993
|
+
function replacePrefix(string, oldPrefix, newPrefix) {
|
|
53994
|
+
if (string.slice(0, oldPrefix.length) != oldPrefix) {
|
|
53995
|
+
throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
|
|
53996
|
+
}
|
|
53997
|
+
return newPrefix + string.slice(oldPrefix.length);
|
|
53998
|
+
}
|
|
53999
|
+
function replaceSuffix(string, oldSuffix, newSuffix) {
|
|
54000
|
+
if (!oldSuffix) {
|
|
54001
|
+
return string + newSuffix;
|
|
54002
|
+
}
|
|
54003
|
+
if (string.slice(-oldSuffix.length) != oldSuffix) {
|
|
54004
|
+
throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
|
|
54005
|
+
}
|
|
54006
|
+
return string.slice(0, -oldSuffix.length) + newSuffix;
|
|
54007
|
+
}
|
|
54008
|
+
function removePrefix(string, oldPrefix) {
|
|
54009
|
+
return replacePrefix(string, oldPrefix, "");
|
|
54010
|
+
}
|
|
54011
|
+
function removeSuffix(string, oldSuffix) {
|
|
54012
|
+
return replaceSuffix(string, oldSuffix, "");
|
|
54013
|
+
}
|
|
54014
|
+
function maximumOverlap(string1, string2) {
|
|
54015
|
+
return string2.slice(0, overlapCount(string1, string2));
|
|
54016
|
+
}
|
|
54017
|
+
function overlapCount(a, b) {
|
|
54018
|
+
let startA = 0;
|
|
54019
|
+
if (a.length > b.length) {
|
|
54020
|
+
startA = a.length - b.length;
|
|
54021
|
+
}
|
|
54022
|
+
let endB = b.length;
|
|
54023
|
+
if (a.length < b.length) {
|
|
54024
|
+
endB = a.length;
|
|
54025
|
+
}
|
|
54026
|
+
const map = Array(endB);
|
|
54027
|
+
let k = 0;
|
|
54028
|
+
map[0] = 0;
|
|
54029
|
+
for (let j = 1;j < endB; j++) {
|
|
54030
|
+
if (b[j] == b[k]) {
|
|
54031
|
+
map[j] = map[k];
|
|
54032
|
+
} else {
|
|
54033
|
+
map[j] = k;
|
|
54034
|
+
}
|
|
54035
|
+
while (k > 0 && b[j] != b[k]) {
|
|
54036
|
+
k = map[k];
|
|
54037
|
+
}
|
|
54038
|
+
if (b[j] == b[k]) {
|
|
54039
|
+
k++;
|
|
54040
|
+
}
|
|
54041
|
+
}
|
|
54042
|
+
k = 0;
|
|
54043
|
+
for (let i = startA;i < a.length; i++) {
|
|
54044
|
+
while (k > 0 && a[i] != b[k]) {
|
|
54045
|
+
k = map[k];
|
|
54046
|
+
}
|
|
54047
|
+
if (a[i] == b[k]) {
|
|
54048
|
+
k++;
|
|
54049
|
+
}
|
|
54050
|
+
}
|
|
54051
|
+
return k;
|
|
54052
|
+
}
|
|
54053
|
+
function trailingWs(string) {
|
|
54054
|
+
let i;
|
|
54055
|
+
for (i = string.length - 1;i >= 0; i--) {
|
|
54056
|
+
if (!string[i].match(/\s/)) {
|
|
54057
|
+
break;
|
|
54058
|
+
}
|
|
54059
|
+
}
|
|
54060
|
+
return string.substring(i + 1);
|
|
54061
|
+
}
|
|
54062
|
+
function leadingWs(string) {
|
|
54063
|
+
const match = string.match(/^\s*/);
|
|
54064
|
+
return match ? match[0] : "";
|
|
54065
|
+
}
|
|
54066
|
+
var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
|
|
54067
|
+
var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
|
|
54068
|
+
|
|
54069
|
+
class WordDiff extends Diff {
|
|
54070
|
+
equals(left, right, options) {
|
|
54071
|
+
if (options.ignoreCase) {
|
|
54072
|
+
left = left.toLowerCase();
|
|
54073
|
+
right = right.toLowerCase();
|
|
54074
|
+
}
|
|
54075
|
+
return left.trim() === right.trim();
|
|
54076
|
+
}
|
|
54077
|
+
tokenize(value, options = {}) {
|
|
54078
|
+
let parts;
|
|
54079
|
+
if (options.intlSegmenter) {
|
|
54080
|
+
const segmenter = options.intlSegmenter;
|
|
54081
|
+
if (segmenter.resolvedOptions().granularity != "word") {
|
|
54082
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
54083
|
+
}
|
|
54084
|
+
parts = Array.from(segmenter.segment(value), (segment) => segment.segment);
|
|
54085
|
+
} else {
|
|
54086
|
+
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
54087
|
+
}
|
|
54088
|
+
const tokens = [];
|
|
54089
|
+
let prevPart = null;
|
|
54090
|
+
parts.forEach((part) => {
|
|
54091
|
+
if (/\s/.test(part)) {
|
|
54092
|
+
if (prevPart == null) {
|
|
54093
|
+
tokens.push(part);
|
|
54094
|
+
} else {
|
|
54095
|
+
tokens.push(tokens.pop() + part);
|
|
54096
|
+
}
|
|
54097
|
+
} else if (prevPart != null && /\s/.test(prevPart)) {
|
|
54098
|
+
if (tokens[tokens.length - 1] == prevPart) {
|
|
54099
|
+
tokens.push(tokens.pop() + part);
|
|
54100
|
+
} else {
|
|
54101
|
+
tokens.push(prevPart + part);
|
|
54102
|
+
}
|
|
54103
|
+
} else {
|
|
54104
|
+
tokens.push(part);
|
|
54105
|
+
}
|
|
54106
|
+
prevPart = part;
|
|
54107
|
+
});
|
|
54108
|
+
return tokens;
|
|
54109
|
+
}
|
|
54110
|
+
join(tokens) {
|
|
54111
|
+
return tokens.map((token, i) => {
|
|
54112
|
+
if (i == 0) {
|
|
54113
|
+
return token;
|
|
54114
|
+
} else {
|
|
54115
|
+
return token.replace(/^\s+/, "");
|
|
54116
|
+
}
|
|
54117
|
+
}).join("");
|
|
54118
|
+
}
|
|
54119
|
+
postProcess(changes, options) {
|
|
54120
|
+
if (!changes || options.oneChangePerToken) {
|
|
54121
|
+
return changes;
|
|
54122
|
+
}
|
|
54123
|
+
let lastKeep = null;
|
|
54124
|
+
let insertion = null;
|
|
54125
|
+
let deletion = null;
|
|
54126
|
+
changes.forEach((change) => {
|
|
54127
|
+
if (change.added) {
|
|
54128
|
+
insertion = change;
|
|
54129
|
+
} else if (change.removed) {
|
|
54130
|
+
deletion = change;
|
|
54131
|
+
} else {
|
|
54132
|
+
if (insertion || deletion) {
|
|
54133
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
54134
|
+
}
|
|
54135
|
+
lastKeep = change;
|
|
54136
|
+
insertion = null;
|
|
54137
|
+
deletion = null;
|
|
54138
|
+
}
|
|
54139
|
+
});
|
|
54140
|
+
if (insertion || deletion) {
|
|
54141
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
54142
|
+
}
|
|
54143
|
+
return changes;
|
|
54144
|
+
}
|
|
54145
|
+
}
|
|
54146
|
+
var wordDiff = new WordDiff;
|
|
54147
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
54148
|
+
if (deletion && insertion) {
|
|
54149
|
+
const oldWsPrefix = leadingWs(deletion.value);
|
|
54150
|
+
const oldWsSuffix = trailingWs(deletion.value);
|
|
54151
|
+
const newWsPrefix = leadingWs(insertion.value);
|
|
54152
|
+
const newWsSuffix = trailingWs(insertion.value);
|
|
54153
|
+
if (startKeep) {
|
|
54154
|
+
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
54155
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
54156
|
+
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
54157
|
+
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
54158
|
+
}
|
|
54159
|
+
if (endKeep) {
|
|
54160
|
+
const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
54161
|
+
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
54162
|
+
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
54163
|
+
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
54164
|
+
}
|
|
54165
|
+
} else if (insertion) {
|
|
54166
|
+
if (startKeep) {
|
|
54167
|
+
const ws = leadingWs(insertion.value);
|
|
54168
|
+
insertion.value = insertion.value.substring(ws.length);
|
|
54169
|
+
}
|
|
54170
|
+
if (endKeep) {
|
|
54171
|
+
const ws = leadingWs(endKeep.value);
|
|
54172
|
+
endKeep.value = endKeep.value.substring(ws.length);
|
|
54173
|
+
}
|
|
54174
|
+
} else if (startKeep && endKeep) {
|
|
54175
|
+
const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
|
|
54176
|
+
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
54177
|
+
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
54178
|
+
const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
54179
|
+
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
54180
|
+
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
54181
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
54182
|
+
} else if (endKeep) {
|
|
54183
|
+
const endKeepWsPrefix = leadingWs(endKeep.value);
|
|
54184
|
+
const deletionWsSuffix = trailingWs(deletion.value);
|
|
54185
|
+
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
54186
|
+
deletion.value = removeSuffix(deletion.value, overlap);
|
|
54187
|
+
} else if (startKeep) {
|
|
54188
|
+
const startKeepWsSuffix = trailingWs(startKeep.value);
|
|
54189
|
+
const deletionWsPrefix = leadingWs(deletion.value);
|
|
54190
|
+
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
54191
|
+
deletion.value = removePrefix(deletion.value, overlap);
|
|
54192
|
+
}
|
|
54193
|
+
}
|
|
54194
|
+
|
|
54195
|
+
class WordsWithSpaceDiff extends Diff {
|
|
54196
|
+
tokenize(value) {
|
|
54197
|
+
const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
|
|
54198
|
+
return value.match(regex) || [];
|
|
54199
|
+
}
|
|
54200
|
+
}
|
|
54201
|
+
var wordsWithSpaceDiff = new WordsWithSpaceDiff;
|
|
54202
|
+
|
|
54203
|
+
class LineDiff extends Diff {
|
|
54204
|
+
constructor() {
|
|
54205
|
+
super(...arguments);
|
|
54206
|
+
this.tokenize = tokenize;
|
|
54207
|
+
}
|
|
54208
|
+
equals(left, right, options) {
|
|
54209
|
+
if (options.ignoreWhitespace) {
|
|
54210
|
+
if (!options.newlineIsToken || !left.includes(`
|
|
54211
|
+
`)) {
|
|
54212
|
+
left = left.trim();
|
|
54213
|
+
}
|
|
54214
|
+
if (!options.newlineIsToken || !right.includes(`
|
|
54215
|
+
`)) {
|
|
54216
|
+
right = right.trim();
|
|
54217
|
+
}
|
|
54218
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
54219
|
+
if (left.endsWith(`
|
|
54220
|
+
`)) {
|
|
54221
|
+
left = left.slice(0, -1);
|
|
54222
|
+
}
|
|
54223
|
+
if (right.endsWith(`
|
|
54224
|
+
`)) {
|
|
54225
|
+
right = right.slice(0, -1);
|
|
54226
|
+
}
|
|
54227
|
+
}
|
|
54228
|
+
return super.equals(left, right, options);
|
|
54229
|
+
}
|
|
54230
|
+
}
|
|
54231
|
+
var lineDiff = new LineDiff;
|
|
54232
|
+
function tokenize(value, options) {
|
|
54233
|
+
if (options.stripTrailingCr) {
|
|
54234
|
+
value = value.replace(/\r\n/g, `
|
|
54235
|
+
`);
|
|
54236
|
+
}
|
|
54237
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
54238
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
54239
|
+
linesAndNewlines.pop();
|
|
54240
|
+
}
|
|
54241
|
+
for (let i = 0;i < linesAndNewlines.length; i++) {
|
|
54242
|
+
const line = linesAndNewlines[i];
|
|
54243
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
54244
|
+
retLines[retLines.length - 1] += line;
|
|
54245
|
+
} else {
|
|
54246
|
+
retLines.push(line);
|
|
54247
|
+
}
|
|
54248
|
+
}
|
|
54249
|
+
return retLines;
|
|
54250
|
+
}
|
|
54251
|
+
function isSentenceEndPunct(char) {
|
|
54252
|
+
return char == "." || char == "!" || char == "?";
|
|
54253
|
+
}
|
|
54254
|
+
|
|
54255
|
+
class SentenceDiff extends Diff {
|
|
54256
|
+
tokenize(value) {
|
|
54257
|
+
var _a;
|
|
54258
|
+
const result = [];
|
|
54259
|
+
let tokenStartI = 0;
|
|
54260
|
+
for (let i = 0;i < value.length; i++) {
|
|
54261
|
+
if (i == value.length - 1) {
|
|
54262
|
+
result.push(value.slice(tokenStartI));
|
|
54263
|
+
break;
|
|
54264
|
+
}
|
|
54265
|
+
if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
|
|
54266
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
54267
|
+
i = tokenStartI = i + 1;
|
|
54268
|
+
while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
|
|
54269
|
+
i++;
|
|
54270
|
+
}
|
|
54271
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
54272
|
+
tokenStartI = i + 1;
|
|
54273
|
+
}
|
|
54274
|
+
}
|
|
54275
|
+
return result;
|
|
54276
|
+
}
|
|
54277
|
+
}
|
|
54278
|
+
var sentenceDiff = new SentenceDiff;
|
|
54279
|
+
|
|
54280
|
+
class CssDiff extends Diff {
|
|
54281
|
+
tokenize(value) {
|
|
54282
|
+
return value.split(/([{}:;,]|\s+)/);
|
|
54283
|
+
}
|
|
54284
|
+
}
|
|
54285
|
+
var cssDiff = new CssDiff;
|
|
54286
|
+
|
|
54287
|
+
class JsonDiff extends Diff {
|
|
54288
|
+
constructor() {
|
|
54289
|
+
super(...arguments);
|
|
54290
|
+
this.tokenize = tokenize;
|
|
54291
|
+
}
|
|
54292
|
+
get useLongestToken() {
|
|
54293
|
+
return true;
|
|
54294
|
+
}
|
|
54295
|
+
castInput(value, options) {
|
|
54296
|
+
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
|
|
54297
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
|
|
54298
|
+
}
|
|
54299
|
+
equals(left, right, options) {
|
|
54300
|
+
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
54301
|
+
}
|
|
54302
|
+
}
|
|
54303
|
+
var jsonDiff = new JsonDiff;
|
|
54304
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
54305
|
+
stack = stack || [];
|
|
54306
|
+
replacementStack = replacementStack || [];
|
|
54307
|
+
if (replacer) {
|
|
54308
|
+
obj = replacer(key === undefined ? "" : key, obj);
|
|
54309
|
+
}
|
|
54310
|
+
let i;
|
|
54311
|
+
for (i = 0;i < stack.length; i += 1) {
|
|
54312
|
+
if (stack[i] === obj) {
|
|
54313
|
+
return replacementStack[i];
|
|
54314
|
+
}
|
|
54315
|
+
}
|
|
54316
|
+
let canonicalizedObj;
|
|
54317
|
+
if (Object.prototype.toString.call(obj) === "[object Array]") {
|
|
54318
|
+
stack.push(obj);
|
|
54319
|
+
canonicalizedObj = new Array(obj.length);
|
|
54320
|
+
replacementStack.push(canonicalizedObj);
|
|
54321
|
+
for (i = 0;i < obj.length; i += 1) {
|
|
54322
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
54323
|
+
}
|
|
54324
|
+
stack.pop();
|
|
54325
|
+
replacementStack.pop();
|
|
54326
|
+
return canonicalizedObj;
|
|
54327
|
+
}
|
|
54328
|
+
if (obj && obj.toJSON) {
|
|
54329
|
+
obj = obj.toJSON();
|
|
54330
|
+
}
|
|
54331
|
+
if (typeof obj === "object" && obj !== null) {
|
|
54332
|
+
stack.push(obj);
|
|
54333
|
+
canonicalizedObj = {};
|
|
54334
|
+
replacementStack.push(canonicalizedObj);
|
|
54335
|
+
const sortedKeys = [];
|
|
54336
|
+
let key2;
|
|
54337
|
+
for (key2 in obj) {
|
|
54338
|
+
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
54339
|
+
sortedKeys.push(key2);
|
|
54340
|
+
}
|
|
54341
|
+
}
|
|
54342
|
+
sortedKeys.sort();
|
|
54343
|
+
for (i = 0;i < sortedKeys.length; i += 1) {
|
|
54344
|
+
key2 = sortedKeys[i];
|
|
54345
|
+
canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
|
|
54346
|
+
}
|
|
54347
|
+
stack.pop();
|
|
54348
|
+
replacementStack.pop();
|
|
54349
|
+
} else {
|
|
54350
|
+
canonicalizedObj = obj;
|
|
54351
|
+
}
|
|
54352
|
+
return canonicalizedObj;
|
|
54353
|
+
}
|
|
54354
|
+
|
|
54355
|
+
class ArrayDiff extends Diff {
|
|
54356
|
+
tokenize(value) {
|
|
54357
|
+
return value.slice();
|
|
54358
|
+
}
|
|
54359
|
+
join(value) {
|
|
54360
|
+
return value;
|
|
54361
|
+
}
|
|
54362
|
+
removeEmpty(value) {
|
|
54363
|
+
return value;
|
|
54364
|
+
}
|
|
54365
|
+
}
|
|
54366
|
+
var arrayDiff = new ArrayDiff;
|
|
53668
54367
|
function parsePatch(uniDiff) {
|
|
53669
54368
|
const diffstr = uniDiff.split(/\n/), list = [];
|
|
53670
54369
|
let i = 0;
|
|
@@ -56077,7 +56776,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56077
56776
|
_content;
|
|
56078
56777
|
_wrapMode;
|
|
56079
56778
|
_columnWidthMode;
|
|
56080
|
-
_columnFitter;
|
|
56081
56779
|
_cellPadding;
|
|
56082
56780
|
_showBorders;
|
|
56083
56781
|
_border;
|
|
@@ -56105,9 +56803,8 @@ class TextTableRenderable extends Renderable {
|
|
|
56105
56803
|
_cachedMeasureWidth = undefined;
|
|
56106
56804
|
_defaultOptions = {
|
|
56107
56805
|
content: [],
|
|
56108
|
-
wrapMode: "
|
|
56109
|
-
columnWidthMode: "
|
|
56110
|
-
columnFitter: "proportional",
|
|
56806
|
+
wrapMode: "none",
|
|
56807
|
+
columnWidthMode: "content",
|
|
56111
56808
|
cellPadding: 0,
|
|
56112
56809
|
showBorders: true,
|
|
56113
56810
|
border: true,
|
|
@@ -56124,11 +56821,10 @@ class TextTableRenderable extends Renderable {
|
|
|
56124
56821
|
attributes: 0
|
|
56125
56822
|
};
|
|
56126
56823
|
constructor(ctx, options = {}) {
|
|
56127
|
-
super(ctx, { ...options,
|
|
56824
|
+
super(ctx, { ...options, buffered: true });
|
|
56128
56825
|
this._content = options.content ?? this._defaultOptions.content;
|
|
56129
56826
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
56130
56827
|
this._columnWidthMode = options.columnWidthMode ?? this._defaultOptions.columnWidthMode;
|
|
56131
|
-
this._columnFitter = this.resolveColumnFitter(options.columnFitter);
|
|
56132
56828
|
this._cellPadding = this.resolveCellPadding(options.cellPadding);
|
|
56133
56829
|
this._showBorders = options.showBorders ?? this._defaultOptions.showBorders;
|
|
56134
56830
|
this._border = options.border ?? this._defaultOptions.border;
|
|
@@ -56177,16 +56873,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56177
56873
|
this._columnWidthMode = value;
|
|
56178
56874
|
this.invalidateLayoutAndRaster();
|
|
56179
56875
|
}
|
|
56180
|
-
get columnFitter() {
|
|
56181
|
-
return this._columnFitter;
|
|
56182
|
-
}
|
|
56183
|
-
set columnFitter(value) {
|
|
56184
|
-
const next = this.resolveColumnFitter(value);
|
|
56185
|
-
if (this._columnFitter === next)
|
|
56186
|
-
return;
|
|
56187
|
-
this._columnFitter = next;
|
|
56188
|
-
this.invalidateLayoutAndRaster();
|
|
56189
|
-
}
|
|
56190
56876
|
get cellPadding() {
|
|
56191
56877
|
return this._cellPadding;
|
|
56192
56878
|
}
|
|
@@ -56340,7 +57026,7 @@ class TextTableRenderable extends Renderable {
|
|
|
56340
57026
|
super.destroySelf();
|
|
56341
57027
|
}
|
|
56342
57028
|
setupMeasureFunc() {
|
|
56343
|
-
const measureFunc = (width, widthMode,
|
|
57029
|
+
const measureFunc = (width, widthMode, height, heightMode) => {
|
|
56344
57030
|
const hasWidthConstraint = widthMode !== MeasureMode.Undefined && Number.isFinite(width);
|
|
56345
57031
|
const rawWidthConstraint = hasWidthConstraint ? Math.max(1, Math.floor(width)) : undefined;
|
|
56346
57032
|
const widthConstraint = this.resolveLayoutWidthConstraint(rawWidthConstraint);
|
|
@@ -56352,6 +57038,9 @@ class TextTableRenderable extends Renderable {
|
|
|
56352
57038
|
if (widthMode === MeasureMode.AtMost && rawWidthConstraint !== undefined && this._positionType !== "absolute") {
|
|
56353
57039
|
measuredWidth = Math.min(rawWidthConstraint, measuredWidth);
|
|
56354
57040
|
}
|
|
57041
|
+
if (heightMode === MeasureMode.AtMost && Number.isFinite(height) && this._positionType !== "absolute") {
|
|
57042
|
+
measuredHeight = Math.min(Math.max(1, Math.floor(height)), measuredHeight);
|
|
57043
|
+
}
|
|
56355
57044
|
return {
|
|
56356
57045
|
width: measuredWidth,
|
|
56357
57046
|
height: measuredHeight
|
|
@@ -56523,9 +57212,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56523
57212
|
tableHeight: (rowOffsets[rowOffsets.length - 1] ?? 0) + 1
|
|
56524
57213
|
};
|
|
56525
57214
|
}
|
|
56526
|
-
isFullWidthMode() {
|
|
56527
|
-
return this._columnWidthMode === "full";
|
|
56528
|
-
}
|
|
56529
57215
|
computeColumnWidths(maxTableWidth, borderLayout) {
|
|
56530
57216
|
const horizontalPadding = this.getHorizontalCellPadding();
|
|
56531
57217
|
const intrinsicWidths = new Array(this._columnCount).fill(1 + horizontalPadding);
|
|
@@ -56548,7 +57234,7 @@ class TextTableRenderable extends Renderable {
|
|
|
56548
57234
|
return intrinsicWidths;
|
|
56549
57235
|
}
|
|
56550
57236
|
if (currentWidth < maxContentWidth) {
|
|
56551
|
-
if (this.
|
|
57237
|
+
if (this._columnWidthMode === "fill") {
|
|
56552
57238
|
return this.expandColumnWidths(intrinsicWidths, maxContentWidth);
|
|
56553
57239
|
}
|
|
56554
57240
|
return intrinsicWidths;
|
|
@@ -56578,12 +57264,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56578
57264
|
return expanded;
|
|
56579
57265
|
}
|
|
56580
57266
|
fitColumnWidths(widths, targetContentWidth) {
|
|
56581
|
-
if (this._columnFitter === "balanced") {
|
|
56582
|
-
return this.fitColumnWidthsBalanced(widths, targetContentWidth);
|
|
56583
|
-
}
|
|
56584
|
-
return this.fitColumnWidthsProportional(widths, targetContentWidth);
|
|
56585
|
-
}
|
|
56586
|
-
fitColumnWidthsProportional(widths, targetContentWidth) {
|
|
56587
57267
|
const minWidth = 1 + this.getHorizontalCellPadding();
|
|
56588
57268
|
const hardMinWidths = new Array(widths.length).fill(minWidth);
|
|
56589
57269
|
const baseWidths = widths.map((width) => Math.max(1, Math.floor(width)));
|
|
@@ -56634,80 +57314,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56634
57314
|
}
|
|
56635
57315
|
return baseWidths.map((width, idx) => Math.max(floorWidths[idx], width - integerShrink[idx]));
|
|
56636
57316
|
}
|
|
56637
|
-
fitColumnWidthsBalanced(widths, targetContentWidth) {
|
|
56638
|
-
const minWidth = 1 + this.getHorizontalCellPadding();
|
|
56639
|
-
const hardMinWidths = new Array(widths.length).fill(minWidth);
|
|
56640
|
-
const baseWidths = widths.map((width) => Math.max(1, Math.floor(width)));
|
|
56641
|
-
const totalBaseWidth = baseWidths.reduce((sum, width) => sum + width, 0);
|
|
56642
|
-
const columns = baseWidths.length;
|
|
56643
|
-
if (columns === 0 || totalBaseWidth <= targetContentWidth) {
|
|
56644
|
-
return baseWidths;
|
|
56645
|
-
}
|
|
56646
|
-
const evenShare = Math.max(minWidth, Math.floor(targetContentWidth / columns));
|
|
56647
|
-
const preferredMinWidths = baseWidths.map((width) => Math.min(width, evenShare));
|
|
56648
|
-
const preferredMinTotal = preferredMinWidths.reduce((sum, width) => sum + width, 0);
|
|
56649
|
-
const floorWidths = preferredMinTotal <= targetContentWidth ? preferredMinWidths : hardMinWidths;
|
|
56650
|
-
const floorTotal = floorWidths.reduce((sum, width) => sum + width, 0);
|
|
56651
|
-
const clampedTarget = Math.max(floorTotal, targetContentWidth);
|
|
56652
|
-
if (totalBaseWidth <= clampedTarget) {
|
|
56653
|
-
return baseWidths;
|
|
56654
|
-
}
|
|
56655
|
-
const shrinkable = baseWidths.map((width, idx) => width - floorWidths[idx]);
|
|
56656
|
-
const totalShrinkable = shrinkable.reduce((sum, value) => sum + value, 0);
|
|
56657
|
-
if (totalShrinkable <= 0) {
|
|
56658
|
-
return [...floorWidths];
|
|
56659
|
-
}
|
|
56660
|
-
const targetShrink = totalBaseWidth - clampedTarget;
|
|
56661
|
-
const shrink = this.allocateShrinkByWeight(shrinkable, targetShrink, "sqrt");
|
|
56662
|
-
return baseWidths.map((width, idx) => Math.max(floorWidths[idx], width - shrink[idx]));
|
|
56663
|
-
}
|
|
56664
|
-
allocateShrinkByWeight(shrinkable, targetShrink, mode) {
|
|
56665
|
-
const shrink = new Array(shrinkable.length).fill(0);
|
|
56666
|
-
if (targetShrink <= 0) {
|
|
56667
|
-
return shrink;
|
|
56668
|
-
}
|
|
56669
|
-
const weights = shrinkable.map((value) => {
|
|
56670
|
-
if (value <= 0) {
|
|
56671
|
-
return 0;
|
|
56672
|
-
}
|
|
56673
|
-
return mode === "sqrt" ? Math.sqrt(value) : value;
|
|
56674
|
-
});
|
|
56675
|
-
const totalWeight = weights.reduce((sum, value) => sum + value, 0);
|
|
56676
|
-
if (totalWeight <= 0) {
|
|
56677
|
-
return shrink;
|
|
56678
|
-
}
|
|
56679
|
-
const fractions = new Array(shrinkable.length).fill(0);
|
|
56680
|
-
let usedShrink = 0;
|
|
56681
|
-
for (let idx = 0;idx < shrinkable.length; idx++) {
|
|
56682
|
-
if (shrinkable[idx] <= 0 || weights[idx] <= 0)
|
|
56683
|
-
continue;
|
|
56684
|
-
const exact = weights[idx] / totalWeight * targetShrink;
|
|
56685
|
-
const whole = Math.min(shrinkable[idx], Math.floor(exact));
|
|
56686
|
-
shrink[idx] = whole;
|
|
56687
|
-
fractions[idx] = exact - whole;
|
|
56688
|
-
usedShrink += whole;
|
|
56689
|
-
}
|
|
56690
|
-
let remainingShrink = targetShrink - usedShrink;
|
|
56691
|
-
while (remainingShrink > 0) {
|
|
56692
|
-
let bestIdx = -1;
|
|
56693
|
-
let bestFraction = -1;
|
|
56694
|
-
for (let idx = 0;idx < shrinkable.length; idx++) {
|
|
56695
|
-
if (shrinkable[idx] - shrink[idx] <= 0)
|
|
56696
|
-
continue;
|
|
56697
|
-
if (bestIdx === -1 || fractions[idx] > bestFraction || fractions[idx] === bestFraction && shrinkable[idx] > shrinkable[bestIdx]) {
|
|
56698
|
-
bestIdx = idx;
|
|
56699
|
-
bestFraction = fractions[idx];
|
|
56700
|
-
}
|
|
56701
|
-
}
|
|
56702
|
-
if (bestIdx === -1) {
|
|
56703
|
-
break;
|
|
56704
|
-
}
|
|
56705
|
-
shrink[bestIdx] += 1;
|
|
56706
|
-
fractions[bestIdx] = 0;
|
|
56707
|
-
remainingShrink -= 1;
|
|
56708
|
-
}
|
|
56709
|
-
return shrink;
|
|
56710
|
-
}
|
|
56711
57317
|
computeRowHeights(columnWidths) {
|
|
56712
57318
|
const horizontalPadding = this.getHorizontalCellPadding();
|
|
56713
57319
|
const verticalPadding = this.getVerticalCellPadding();
|
|
@@ -57031,7 +57637,7 @@ class TextTableRenderable extends Renderable {
|
|
|
57031
57637
|
if (width === undefined || !Number.isFinite(width) || width <= 0) {
|
|
57032
57638
|
return;
|
|
57033
57639
|
}
|
|
57034
|
-
if (this._wrapMode !== "none" || this.
|
|
57640
|
+
if (this._wrapMode !== "none" || this._columnWidthMode === "fill") {
|
|
57035
57641
|
return Math.max(1, Math.floor(width));
|
|
57036
57642
|
}
|
|
57037
57643
|
return;
|
|
@@ -57042,12 +57648,6 @@ class TextTableRenderable extends Renderable {
|
|
|
57042
57648
|
getVerticalCellPadding() {
|
|
57043
57649
|
return this._cellPadding * 2;
|
|
57044
57650
|
}
|
|
57045
|
-
resolveColumnFitter(value) {
|
|
57046
|
-
if (value === undefined) {
|
|
57047
|
-
return this._defaultOptions.columnFitter;
|
|
57048
|
-
}
|
|
57049
|
-
return value === "balanced" ? "balanced" : "proportional";
|
|
57050
|
-
}
|
|
57051
57651
|
resolveCellPadding(value) {
|
|
57052
57652
|
if (value === undefined || !Number.isFinite(value)) {
|
|
57053
57653
|
return this._defaultOptions.cellPadding;
|
|
@@ -58823,9 +59423,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
58823
59423
|
resolveTableRenderableOptions() {
|
|
58824
59424
|
const borders = this._tableOptions?.borders ?? true;
|
|
58825
59425
|
return {
|
|
58826
|
-
columnWidthMode: this._tableOptions?.widthMode ?? "
|
|
58827
|
-
|
|
58828
|
-
wrapMode: this._tableOptions?.wrapMode ?? "word",
|
|
59426
|
+
columnWidthMode: this._tableOptions?.widthMode ?? "content",
|
|
59427
|
+
wrapMode: this._tableOptions?.wrapMode ?? "none",
|
|
58829
59428
|
cellPadding: this._tableOptions?.cellPadding ?? 0,
|
|
58830
59429
|
border: borders,
|
|
58831
59430
|
outerBorder: this._tableOptions?.outerBorder ?? borders,
|
|
@@ -58837,7 +59436,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
58837
59436
|
}
|
|
58838
59437
|
applyTableRenderableOptions(tableRenderable, options) {
|
|
58839
59438
|
tableRenderable.columnWidthMode = options.columnWidthMode;
|
|
58840
|
-
tableRenderable.columnFitter = options.columnFitter;
|
|
58841
59439
|
tableRenderable.wrapMode = options.wrapMode;
|
|
58842
59440
|
tableRenderable.cellPadding = options.cellPadding;
|
|
58843
59441
|
tableRenderable.border = options.border;
|
|
@@ -58868,7 +59466,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
58868
59466
|
width: "100%",
|
|
58869
59467
|
marginBottom,
|
|
58870
59468
|
columnWidthMode: options.columnWidthMode,
|
|
58871
|
-
columnFitter: options.columnFitter,
|
|
58872
59469
|
wrapMode: options.wrapMode,
|
|
58873
59470
|
cellPadding: options.cellPadding,
|
|
58874
59471
|
border: options.border,
|
|
@@ -59728,34 +60325,6 @@ class ContentRenderable extends BoxRenderable {
|
|
|
59728
60325
|
return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
|
|
59729
60326
|
}
|
|
59730
60327
|
}
|
|
59731
|
-
var SCROLLBOX_PADDING_KEYS = [
|
|
59732
|
-
"padding",
|
|
59733
|
-
"paddingX",
|
|
59734
|
-
"paddingY",
|
|
59735
|
-
"paddingTop",
|
|
59736
|
-
"paddingRight",
|
|
59737
|
-
"paddingBottom",
|
|
59738
|
-
"paddingLeft"
|
|
59739
|
-
];
|
|
59740
|
-
function pickScrollBoxPadding(options) {
|
|
59741
|
-
if (!options)
|
|
59742
|
-
return {};
|
|
59743
|
-
const picked = {};
|
|
59744
|
-
for (const key of SCROLLBOX_PADDING_KEYS) {
|
|
59745
|
-
const value = options[key];
|
|
59746
|
-
if (value !== undefined) {
|
|
59747
|
-
picked[key] = value;
|
|
59748
|
-
}
|
|
59749
|
-
}
|
|
59750
|
-
return picked;
|
|
59751
|
-
}
|
|
59752
|
-
function stripScrollBoxPadding(options) {
|
|
59753
|
-
const sanitized = { ...options };
|
|
59754
|
-
for (const key of SCROLLBOX_PADDING_KEYS) {
|
|
59755
|
-
delete sanitized[key];
|
|
59756
|
-
}
|
|
59757
|
-
return sanitized;
|
|
59758
|
-
}
|
|
59759
60328
|
|
|
59760
60329
|
class ScrollBoxRenderable extends BoxRenderable {
|
|
59761
60330
|
static idCounter = 0;
|
|
@@ -59903,38 +60472,27 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
59903
60472
|
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
59904
60473
|
}
|
|
59905
60474
|
}
|
|
59906
|
-
constructor(ctx,
|
|
59907
|
-
|
|
59908
|
-
|
|
59909
|
-
|
|
59910
|
-
|
|
59911
|
-
|
|
59912
|
-
|
|
59913
|
-
|
|
59914
|
-
|
|
59915
|
-
|
|
59916
|
-
|
|
59917
|
-
|
|
59918
|
-
|
|
59919
|
-
|
|
59920
|
-
|
|
59921
|
-
|
|
59922
|
-
} = options;
|
|
59923
|
-
const forwardedContentPadding = {
|
|
59924
|
-
...pickScrollBoxPadding(rootBoxOptions),
|
|
59925
|
-
...pickScrollBoxPadding(rootOptions)
|
|
59926
|
-
};
|
|
59927
|
-
const sanitizedRootBoxOptions = stripScrollBoxPadding(rootBoxOptions);
|
|
59928
|
-
const sanitizedRootOptions = rootOptions ? stripScrollBoxPadding(rootOptions) : undefined;
|
|
59929
|
-
const mergedContentOptions = {
|
|
59930
|
-
...forwardedContentPadding,
|
|
59931
|
-
...contentOptions
|
|
59932
|
-
};
|
|
60475
|
+
constructor(ctx, {
|
|
60476
|
+
wrapperOptions,
|
|
60477
|
+
viewportOptions,
|
|
60478
|
+
contentOptions,
|
|
60479
|
+
rootOptions,
|
|
60480
|
+
scrollbarOptions,
|
|
60481
|
+
verticalScrollbarOptions,
|
|
60482
|
+
horizontalScrollbarOptions,
|
|
60483
|
+
stickyScroll = false,
|
|
60484
|
+
stickyStart,
|
|
60485
|
+
scrollX = false,
|
|
60486
|
+
scrollY = true,
|
|
60487
|
+
scrollAcceleration,
|
|
60488
|
+
viewportCulling = true,
|
|
60489
|
+
...options
|
|
60490
|
+
}) {
|
|
59933
60491
|
super(ctx, {
|
|
59934
60492
|
flexDirection: "row",
|
|
59935
60493
|
alignItems: "stretch",
|
|
59936
|
-
...
|
|
59937
|
-
...
|
|
60494
|
+
...options,
|
|
60495
|
+
...rootOptions
|
|
59938
60496
|
});
|
|
59939
60497
|
this.internalId = ScrollBoxRenderable.idCounter++;
|
|
59940
60498
|
this._stickyScroll = stickyScroll;
|
|
@@ -59966,7 +60524,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
59966
60524
|
onSizeChange: () => {
|
|
59967
60525
|
this.recalculateBarProps();
|
|
59968
60526
|
},
|
|
59969
|
-
...
|
|
60527
|
+
...contentOptions,
|
|
59970
60528
|
id: `scroll-box-content-${this.internalId}`
|
|
59971
60529
|
});
|
|
59972
60530
|
this.viewport.add(this.content);
|
|
@@ -60282,34 +60840,6 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
60282
60840
|
this.requestRender();
|
|
60283
60841
|
});
|
|
60284
60842
|
}
|
|
60285
|
-
set padding(value) {
|
|
60286
|
-
this.content.padding = value;
|
|
60287
|
-
this.requestRender();
|
|
60288
|
-
}
|
|
60289
|
-
set paddingX(value) {
|
|
60290
|
-
this.content.paddingX = value;
|
|
60291
|
-
this.requestRender();
|
|
60292
|
-
}
|
|
60293
|
-
set paddingY(value) {
|
|
60294
|
-
this.content.paddingY = value;
|
|
60295
|
-
this.requestRender();
|
|
60296
|
-
}
|
|
60297
|
-
set paddingTop(value) {
|
|
60298
|
-
this.content.paddingTop = value;
|
|
60299
|
-
this.requestRender();
|
|
60300
|
-
}
|
|
60301
|
-
set paddingRight(value) {
|
|
60302
|
-
this.content.paddingRight = value;
|
|
60303
|
-
this.requestRender();
|
|
60304
|
-
}
|
|
60305
|
-
set paddingBottom(value) {
|
|
60306
|
-
this.content.paddingBottom = value;
|
|
60307
|
-
this.requestRender();
|
|
60308
|
-
}
|
|
60309
|
-
set paddingLeft(value) {
|
|
60310
|
-
this.content.paddingLeft = value;
|
|
60311
|
-
this.requestRender();
|
|
60312
|
-
}
|
|
60313
60843
|
set rootOptions(options) {
|
|
60314
60844
|
Object.assign(this, options);
|
|
60315
60845
|
this.requestRender();
|
|
@@ -61071,8 +61601,8 @@ class TabSelectRenderable extends Renderable {
|
|
|
61071
61601
|
}
|
|
61072
61602
|
}
|
|
61073
61603
|
|
|
61074
|
-
// node_modules/@opentui/react/chunk-
|
|
61075
|
-
|
|
61604
|
+
// node_modules/@opentui/react/chunk-9gg102mq.js
|
|
61605
|
+
init_chunk_eecw9x2f();
|
|
61076
61606
|
var import_react = __toESM(require_react(), 1);
|
|
61077
61607
|
var import_react2 = __toESM(require_react(), 1);
|
|
61078
61608
|
var import_react3 = __toESM(require_react(), 1);
|
|
@@ -61199,7 +61729,7 @@ class ErrorBoundary extends import_react3.default.Component {
|
|
|
61199
61729
|
}
|
|
61200
61730
|
var package_default = {
|
|
61201
61731
|
name: "@opentui/react",
|
|
61202
|
-
version: "0.1.
|
|
61732
|
+
version: "0.1.83",
|
|
61203
61733
|
description: "React renderer for building terminal user interfaces using OpenTUI core",
|
|
61204
61734
|
license: "MIT",
|
|
61205
61735
|
repository: {
|
|
@@ -61534,7 +62064,7 @@ var hostConfig = {
|
|
|
61534
62064
|
var reconciler = import_react_reconciler.default(hostConfig);
|
|
61535
62065
|
if (process.env["DEV"] === "true") {
|
|
61536
62066
|
try {
|
|
61537
|
-
await
|
|
62067
|
+
await init_chunk_pm1hna8x().then(() => exports_chunk_pm1hna8x);
|
|
61538
62068
|
} catch (error) {
|
|
61539
62069
|
if (error.code === "ERR_MODULE_NOT_FOUND") {
|
|
61540
62070
|
console.warn(`
|
|
@@ -61579,7 +62109,7 @@ function createRoot(renderer) {
|
|
|
61579
62109
|
}
|
|
61580
62110
|
|
|
61581
62111
|
// node_modules/@opentui/react/index.js
|
|
61582
|
-
|
|
62112
|
+
init_chunk_eecw9x2f();
|
|
61583
62113
|
var import_react5 = __toESM(require_react(), 1);
|
|
61584
62114
|
var import_react6 = __toESM(require_react(), 1);
|
|
61585
62115
|
var import_react7 = __toESM(require_react(), 1);
|
|
@@ -61689,8 +62219,6 @@ function Header() {
|
|
|
61689
62219
|
const [branch, setBranch] = import_react13.useState("");
|
|
61690
62220
|
const { isNarrow } = useLayout();
|
|
61691
62221
|
const cwd = path2.basename(import_config.PROJECT_ROOT);
|
|
61692
|
-
const mode = import_config.getMode();
|
|
61693
|
-
const modeColors = { default: import_theme.colors.dim, max: import_theme.colors.accent, lite: import_theme.colors.muted };
|
|
61694
62222
|
import_react13.useEffect(() => {
|
|
61695
62223
|
try {
|
|
61696
62224
|
const b2 = execSync("git rev-parse --abbrev-ref HEAD 2>/dev/null", {
|
|
@@ -61713,13 +62241,9 @@ function Header() {
|
|
|
61713
62241
|
fg: import_theme.colors.dim,
|
|
61714
62242
|
children: " "
|
|
61715
62243
|
}),
|
|
61716
|
-
/* @__PURE__ */ jsx_runtime.
|
|
61717
|
-
fg:
|
|
61718
|
-
children: [
|
|
61719
|
-
"[",
|
|
61720
|
-
mode,
|
|
61721
|
-
"]"
|
|
61722
|
-
]
|
|
62244
|
+
/* @__PURE__ */ jsx_runtime.jsx("span", {
|
|
62245
|
+
fg: import_theme.colors.accent,
|
|
62246
|
+
children: "[max]"
|
|
61723
62247
|
}),
|
|
61724
62248
|
/* @__PURE__ */ jsx_runtime.jsx("span", {
|
|
61725
62249
|
fg: import_theme.colors.dim,
|
|
@@ -62369,8 +62893,7 @@ var import_theme14 = __toESM(require_theme(), 1);
|
|
|
62369
62893
|
var jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
62370
62894
|
var COMMANDS = [
|
|
62371
62895
|
{ cmd: "/help", desc: "Show this menu" },
|
|
62372
|
-
{ cmd: "/
|
|
62373
|
-
{ cmd: "/compact", desc: "Compact conversation context" },
|
|
62896
|
+
{ cmd: "/compact", desc: "Compact/summarize conversation context" },
|
|
62374
62897
|
{ cmd: "/files", desc: "Show project file tree" },
|
|
62375
62898
|
{ cmd: "/clear", desc: "Clear conversation" },
|
|
62376
62899
|
{ cmd: "/cost", desc: "Show session stats" },
|