apex-dev 3.1.0 → 3.4.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 +732 -570
- 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") {
|
|
@@ -31683,7 +31683,7 @@ var require_config = __commonJS((exports, module2) => {
|
|
|
31683
31683
|
var MAX_OUTPUT_LEN = 12000;
|
|
31684
31684
|
var TOOL_TIMEOUT = 60000;
|
|
31685
31685
|
var PROJECT_ROOT = process.cwd();
|
|
31686
|
-
var currentMode = "
|
|
31686
|
+
var currentMode = "max";
|
|
31687
31687
|
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
31688
|
|
|
31689
31689
|
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.
|
|
@@ -31815,13 +31815,6 @@ Output JSON only, no markdown fences:
|
|
|
31815
31815
|
function getMode() {
|
|
31816
31816
|
return currentMode;
|
|
31817
31817
|
}
|
|
31818
|
-
function setMode(mode) {
|
|
31819
|
-
if (["default", "max", "lite"].includes(mode)) {
|
|
31820
|
-
currentMode = mode;
|
|
31821
|
-
return true;
|
|
31822
|
-
}
|
|
31823
|
-
return false;
|
|
31824
|
-
}
|
|
31825
31818
|
module2.exports = {
|
|
31826
31819
|
NVIDIA_MODEL,
|
|
31827
31820
|
REVIEWER_MODEL,
|
|
@@ -31845,8 +31838,7 @@ Output JSON only, no markdown fences:
|
|
|
31845
31838
|
resolvePath,
|
|
31846
31839
|
timestamp,
|
|
31847
31840
|
sleep,
|
|
31848
|
-
getMode
|
|
31849
|
-
setMode
|
|
31841
|
+
getMode
|
|
31850
31842
|
};
|
|
31851
31843
|
});
|
|
31852
31844
|
|
|
@@ -31855,7 +31847,7 @@ var require_prompt = __commonJS((exports, module2) => {
|
|
|
31855
31847
|
var fs2 = __require("fs");
|
|
31856
31848
|
var path2 = __require("path");
|
|
31857
31849
|
var { execSync } = __require("child_process");
|
|
31858
|
-
var { PROJECT_ROOT, MAX_TOOL_ITERATIONS
|
|
31850
|
+
var { PROJECT_ROOT, MAX_TOOL_ITERATIONS } = require_config();
|
|
31859
31851
|
function buildSystemPrompt() {
|
|
31860
31852
|
let gitInfo = "";
|
|
31861
31853
|
try {
|
|
@@ -31883,82 +31875,87 @@ Dev dependencies: ${Object.keys(pkg.devDependencies).join(", ")}`;
|
|
|
31883
31875
|
projectInfo += `
|
|
31884
31876
|
Scripts: ${Object.keys(pkg.scripts).join(", ")}`;
|
|
31885
31877
|
} catch {}
|
|
31886
|
-
return `You are Apex AI,
|
|
31878
|
+
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.
|
|
31879
|
+
|
|
31880
|
+
# Core Mandates
|
|
31881
|
+
|
|
31882
|
+
- **Tone:** Professional, direct, and concise. Suitable for a CLI environment.
|
|
31883
|
+
- **Understand first, act second:** Always gather context and read relevant files BEFORE editing. Use sub-agents (FilePickerMax, Grep, Read) to verify assumptions before implementing.
|
|
31884
|
+
- **Quality over speed:** Prioritize correctness over appearing productive. Fewer, well-informed sub-agent calls are better than many rushed ones.
|
|
31885
|
+
- **Validate assumptions:** Use FilePickerMax and Read to verify assumptions about libraries, APIs, and project structure before implementing.
|
|
31886
|
+
- **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
|
|
31887
|
+
- **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.
|
|
31888
|
+
- **Do what the user asks:** If the user asks you to do something, even running a risky command, do it.
|
|
31889
|
+
- **If a tool fails, try again or try a different tool.** Don't give up after one attempt.
|
|
31890
|
+
- **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."
|
|
31887
31891
|
|
|
31888
31892
|
# Output Style
|
|
31889
31893
|
- Default to short answers (\u22644 lines) unless the user asks for detail.
|
|
31890
|
-
- No unnecessary preamble or postamble. Don't narrate obvious steps
|
|
31894
|
+
- No unnecessary preamble or postamble. Don't narrate obvious steps.
|
|
31891
31895
|
- 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
31896
|
- 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
|
-
|
|
31897
|
+
- For casual conversation, greetings, or quick questions, respond naturally without tools.
|
|
31898
|
+
- NEVER say "I don't have any tool to call" \u2014 just respond with what you know.
|
|
31899
|
+
- Use <think></think> tags for moderate reasoning. Call the Thinker sub-agent for anything more complex.
|
|
31900
|
+
|
|
31901
|
+
# Code Editing Mandates
|
|
31902
|
+
|
|
31903
|
+
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code.
|
|
31904
|
+
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project first (check package.json, neighboring files).
|
|
31905
|
+
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code.
|
|
31906
|
+
- **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.
|
|
31907
|
+
- **Code Reuse:** Always reuse helper functions, components, classes, etc., whenever possible.
|
|
31908
|
+
- **Refactoring Awareness:** Whenever you modify an exported symbol, find and update all references to it.
|
|
31909
|
+
- **Testing:** If you create a test, run it to see if it passes, and fix it if it doesn't.
|
|
31910
|
+
- **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
31911
|
|
|
31906
31912
|
# 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.
|
|
31913
|
+
- Never expose secrets, API keys, tokens, or credentials.
|
|
31914
|
+
- 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
31915
|
- 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
31916
|
|
|
31913
|
-
#
|
|
31914
|
-
|
|
31915
|
-
-
|
|
31916
|
-
|
|
31917
|
-
-
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
-
|
|
31921
|
-
-
|
|
31922
|
-
-
|
|
31917
|
+
# Sub-Agent Orchestration
|
|
31918
|
+
|
|
31919
|
+
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.
|
|
31920
|
+
|
|
31921
|
+
**Available sub-agents:**
|
|
31922
|
+
- **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.
|
|
31923
|
+
- **Thinker** \u2014 Deep reasoning and planning. Call before implementing anything non-trivial to get a structured plan.
|
|
31924
|
+
- **ThinkerBestOfN** \u2014 Multiple parallel reasoning passes, selects the best. Use for critical decisions.
|
|
31925
|
+
- **Commander** \u2014 Terminal command specialist. Plans and executes shell commands for a goal. Use instead of calling Bash directly for multi-step operations.
|
|
31926
|
+
- **EditorMultiPrompt** \u2014 Tries multiple implementation strategies in parallel, selects the best.
|
|
31927
|
+
- **CodeReview** \u2014 Reviews code changes for bugs, security, edge cases. Runs automatically after edits.
|
|
31928
|
+
- **CodeReviewMulti** \u2014 Multiple reviewers analyze from different perspectives.
|
|
31929
|
+
- **ContextPruner** \u2014 Summarizes conversation history to free context space.
|
|
31930
|
+
|
|
31931
|
+
**How to orchestrate (use your judgment):**
|
|
31932
|
+
1. Spawn context-gathering sub-agents first (FilePickerMax, Read) to understand the codebase before making edits.
|
|
31933
|
+
2. For complex problems, call Thinker to reason and plan before implementing.
|
|
31934
|
+
3. Call Commander for shell operations (builds, tests, installs, git) instead of Bash directly.
|
|
31935
|
+
4. After implementing changes, validate by running tests/builds/lints via Commander.
|
|
31936
|
+
5. A code reviewer runs automatically after edits (skipped in lite mode, multi-perspective in max mode).
|
|
31937
|
+
6. If a sub-agent fails, fall back to doing the work yourself with basic tools (Read, Edit, Bash, Grep, etc.).
|
|
31938
|
+
7. Bundle independent sub-agent calls in the same turn for parallel execution.
|
|
31939
|
+
|
|
31940
|
+
**When to skip sub-agents and act directly:**
|
|
31941
|
+
- Reading a single known file path (just use Read)
|
|
31942
|
+
- A single targeted grep for a known pattern (just use Grep)
|
|
31943
|
+
- A quick one-line bash command (just use Bash)
|
|
31944
|
+
- Answering a question from memory/context (just respond)
|
|
31945
|
+
- Trivially simple edits where the file is already read and understood
|
|
31923
31946
|
|
|
31924
|
-
# Tool Usage
|
|
31925
|
-
- Use Grep/Glob/ListDir to explore and locate code.
|
|
31947
|
+
# Tool Usage (basic tools)
|
|
31926
31948
|
- Use Read to understand files before modifying them.
|
|
31927
31949
|
- Use Edit for surgical changes to existing files (preferred over Write).
|
|
31928
31950
|
- Use Patch for multiple edits to the same file.
|
|
31929
31951
|
- Use Write only for creating new files.
|
|
31930
|
-
- Use Bash for
|
|
31931
|
-
-
|
|
31952
|
+
- Use Bash for simple, single commands. Use Commander for multi-step operations.
|
|
31953
|
+
- Use Grep/Glob/ListDir for quick, targeted lookups. Use FilePickerMax for broad codebase discovery.
|
|
31932
31954
|
- 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
|
-
|
|
31935
|
-
# Sub-Agents \u2014 ALWAYS DELEGATE FIRST
|
|
31936
|
-
You have specialized sub-agents. **Your default behavior is to delegate work to sub-agents FIRST.** Only do the work yourself if the sub-agent fails or for trivially simple operations (e.g. reading a single file, a quick grep).
|
|
31937
|
-
|
|
31938
|
-
**Delegation rules (follow strictly):**
|
|
31939
|
-
1. **Planning & reasoning** \u2192 Call **Thinker** BEFORE implementing anything non-trivial. Let it analyze the problem and produce a plan, then follow that plan.
|
|
31940
|
-
2. **Finding files** \u2192 Call **FilePickerMax** to locate relevant files instead of manually running Glob/Grep/ListDir chains. Always specify the exact type of files needed.
|
|
31941
|
-
3. **Shell commands** \u2192 Call **Commander** to plan and execute terminal commands (builds, tests, installs, git ops) instead of calling Bash directly.
|
|
31942
|
-
4. **Critical decisions** \u2192 Call **ThinkerBestOfN** (MAX mode) to get multiple perspectives before deciding.
|
|
31943
|
-
5. **Important code changes** \u2192 Call **EditorMultiPrompt** (MAX mode) to try multiple implementation strategies.
|
|
31944
|
-
6. **Code review** \u2192 **CodeReviewMulti** (MAX mode) runs automatically; don't duplicate its work.
|
|
31945
|
-
7. **Context management** \u2192 **ContextPruner** summarizes long conversations automatically.
|
|
31946
|
-
|
|
31947
|
-
**Fallback rule:** If a sub-agent call fails or returns an error, THEN do the work yourself using basic tools (Read, Edit, Bash, Grep, etc.). Never give up \u2014 always fall back to manual if delegation fails.
|
|
31948
|
-
|
|
31949
|
-
**Do NOT skip delegation** just because you think you can do it faster. Sub-agents provide better results through specialization. The only exceptions are:
|
|
31950
|
-
- Reading a single known file path (just use Read)
|
|
31951
|
-
- A single targeted grep for a known pattern (just use Grep)
|
|
31952
|
-
- Answering a question from memory/context (just respond)
|
|
31953
31955
|
|
|
31954
|
-
#
|
|
31955
|
-
|
|
31956
|
-
-
|
|
31957
|
-
- **max**: Best-of-N thinking, multi-strategy editing, multi-perspective review, auto context pruning. Higher quality, more API calls.
|
|
31958
|
-
- **lite**: Fast mode \u2014 skips validation and review steps.
|
|
31959
|
-
|
|
31960
|
-
# Note
|
|
31961
|
-
A separate code reviewer runs automatically after edits (skipped in lite mode, multi-perspective in max mode).
|
|
31956
|
+
# Validation
|
|
31957
|
+
- After code changes, run the most relevant checks: tests, lint, typecheck, or build. Prefer Commander or scripts from package.json.
|
|
31958
|
+
- If checks fail, fix and re-run. If blocked, clearly state what's failing and why.
|
|
31962
31959
|
|
|
31963
31960
|
# Environment
|
|
31964
31961
|
Working directory: ${PROJECT_ROOT}
|
|
@@ -32214,7 +32211,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32214
32211
|
type: "function",
|
|
32215
32212
|
function: {
|
|
32216
32213
|
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.
|
|
32214
|
+
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
32215
|
parameters: {
|
|
32219
32216
|
type: "object",
|
|
32220
32217
|
properties: {
|
|
@@ -32229,7 +32226,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32229
32226
|
type: "function",
|
|
32230
32227
|
function: {
|
|
32231
32228
|
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.
|
|
32229
|
+
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
32230
|
parameters: {
|
|
32234
32231
|
type: "object",
|
|
32235
32232
|
properties: {
|
|
@@ -32260,7 +32257,7 @@ var require_tools = __commonJS((exports, module2) => {
|
|
|
32260
32257
|
type: "function",
|
|
32261
32258
|
function: {
|
|
32262
32259
|
name: "CodeReviewMulti",
|
|
32263
|
-
description: "Spawn multiple code reviewers in parallel, each analyzing from a different perspective (correctness, security, performance, etc.).
|
|
32260
|
+
description: "Spawn multiple code reviewers in parallel, each analyzing from a different perspective (correctness, security, performance, etc.).",
|
|
32264
32261
|
parameters: {
|
|
32265
32262
|
type: "object",
|
|
32266
32263
|
properties: {
|
|
@@ -32330,8 +32327,7 @@ var require_toolExecutors = __commonJS((exports, module2) => {
|
|
|
32330
32327
|
session,
|
|
32331
32328
|
truncateOutput,
|
|
32332
32329
|
resolvePath,
|
|
32333
|
-
sleep
|
|
32334
|
-
getMode
|
|
32330
|
+
sleep
|
|
32335
32331
|
} = require_config();
|
|
32336
32332
|
async function streamCompletion(params, onStream) {
|
|
32337
32333
|
for (let attempt = 0;attempt <= 2; attempt++) {
|
|
@@ -32873,10 +32869,6 @@ ${"\u2500".repeat(40)}
|
|
|
32873
32869
|
}
|
|
32874
32870
|
}
|
|
32875
32871
|
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
32872
|
const n = Math.min(5, Math.max(2, args.n || 3));
|
|
32881
32873
|
const historyCtx = session.conversationHistory.slice(-10).map((m2) => `[${m2.role}]: ${(m2.content || "").slice(0, 500)}`).join(`
|
|
32882
32874
|
`);
|
|
@@ -32958,10 +32950,6 @@ ${thoughts[0].result}`;
|
|
|
32958
32950
|
}
|
|
32959
32951
|
}
|
|
32960
32952
|
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
32953
|
const strategies = args.strategies || ["straightforward implementation", "alternative approach"];
|
|
32966
32954
|
const filesCtx = (args.files || []).map((f) => `--- ${f.path} ---
|
|
32967
32955
|
${f.content}`).join(`
|
|
@@ -33075,10 +33063,6 @@ ${implementations[0].result}`;
|
|
|
33075
33063
|
}
|
|
33076
33064
|
}
|
|
33077
33065
|
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
33066
|
const perspectives = args.perspectives || [
|
|
33083
33067
|
"correctness, logic errors, and edge cases",
|
|
33084
33068
|
"security vulnerabilities and data safety",
|
|
@@ -33395,8 +33379,7 @@ var require_agent = __commonJS((exports, module2) => {
|
|
|
33395
33379
|
MAX_TOOL_ITERATIONS,
|
|
33396
33380
|
nvidiaClient,
|
|
33397
33381
|
session,
|
|
33398
|
-
sleep
|
|
33399
|
-
getMode
|
|
33382
|
+
sleep
|
|
33400
33383
|
} = require_config();
|
|
33401
33384
|
var { buildSystemPrompt } = require_prompt();
|
|
33402
33385
|
var { toolDefs } = require_tools();
|
|
@@ -33413,208 +33396,12 @@ var require_agent = __commonJS((exports, module2) => {
|
|
|
33413
33396
|
function getIsProcessing() {
|
|
33414
33397
|
return isProcessing;
|
|
33415
33398
|
}
|
|
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
33399
|
async function handleUserInput(userInput) {
|
|
33555
33400
|
isProcessing = true;
|
|
33556
33401
|
store.setState({ isProcessing: true });
|
|
33557
33402
|
session.turnCount++;
|
|
33558
33403
|
store.addMessage({ role: "user", content: userInput });
|
|
33559
33404
|
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
33405
|
const startTime2 = Date.now();
|
|
33619
33406
|
let turnTokens = 0;
|
|
33620
33407
|
let turnToolCalls = 0;
|
|
@@ -33934,40 +33721,21 @@ ${thinkerResult}`
|
|
|
33934
33721
|
const reviewPrompt = `User request: ${userInput}
|
|
33935
33722
|
|
|
33936
33723
|
${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: `
|
|
33724
|
+
const reviewId = store.addMessage({ role: "system", content: "Multi-perspective code review...", label: "\uD83D\uDCCB Code Review" });
|
|
33725
|
+
try {
|
|
33726
|
+
const reviewResult = await executeTool("CodeReviewMulti", { prompt: reviewPrompt }, (partial) => {
|
|
33727
|
+
store.updateMessage(reviewId, { content: partial, label: "\uD83D\uDCCB Code Review" });
|
|
33728
|
+
});
|
|
33729
|
+
store.updateMessage(reviewId, { content: reviewResult, label: "\uD83D\uDCCB Code Review" });
|
|
33730
|
+
session.conversationHistory.push({
|
|
33731
|
+
role: "assistant",
|
|
33732
|
+
content: `
|
|
33964
33733
|
|
|
33965
33734
|
--- Code Review ---
|
|
33966
33735
|
${reviewResult}`
|
|
33967
|
-
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
}
|
|
33736
|
+
});
|
|
33737
|
+
} catch (err) {
|
|
33738
|
+
store.updateMessage(reviewId, { content: `Code review failed: ${err.message}` });
|
|
33971
33739
|
}
|
|
33972
33740
|
}
|
|
33973
33741
|
} catch (err) {
|
|
@@ -33998,7 +33766,7 @@ var require_commands = __commonJS((exports, module2) => {
|
|
|
33998
33766
|
var fs2 = __require("fs");
|
|
33999
33767
|
var path2 = __require("path");
|
|
34000
33768
|
var { execSync } = __require("child_process");
|
|
34001
|
-
var { PROJECT_ROOT, session, resolvePath
|
|
33769
|
+
var { PROJECT_ROOT, session, resolvePath } = require_config();
|
|
34002
33770
|
var { executeTool } = require_toolExecutors();
|
|
34003
33771
|
var store = require_store();
|
|
34004
33772
|
async function handleSlashCommand(input) {
|
|
@@ -34072,30 +33840,6 @@ var require_commands = __commonJS((exports, module2) => {
|
|
|
34072
33840
|
}
|
|
34073
33841
|
break;
|
|
34074
33842
|
}
|
|
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
33843
|
case "/compact": {
|
|
34100
33844
|
const pruneId = store.addMessage({ role: "system", content: "Compacting conversation...", label: "Context Pruner" });
|
|
34101
33845
|
try {
|
|
@@ -34181,7 +33925,7 @@ var require_jsx_runtime = __commonJS((exports, module2) => {
|
|
|
34181
33925
|
} else {}
|
|
34182
33926
|
});
|
|
34183
33927
|
|
|
34184
|
-
// node_modules/@opentui/core/index-
|
|
33928
|
+
// node_modules/@opentui/core/index-a215gqtt.js
|
|
34185
33929
|
import { Buffer as Buffer2 } from "buffer";
|
|
34186
33930
|
import { EventEmitter } from "events";
|
|
34187
33931
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
@@ -34222,7 +33966,7 @@ var highlights_default5 = "./highlights-hk7bwhj4.scm";
|
|
|
34222
33966
|
// node_modules/@opentui/core/assets/zig/tree-sitter-zig.wasm
|
|
34223
33967
|
var tree_sitter_zig_default = "./tree-sitter-zig-e78zbjpm.wasm";
|
|
34224
33968
|
|
|
34225
|
-
// node_modules/@opentui/core/index-
|
|
33969
|
+
// node_modules/@opentui/core/index-a215gqtt.js
|
|
34226
33970
|
import { resolve as resolve2, isAbsolute, parse } from "path";
|
|
34227
33971
|
import { existsSync } from "fs";
|
|
34228
33972
|
import { basename, join } from "path";
|
|
@@ -34246,17 +33990,13 @@ import { Writable } from "stream";
|
|
|
34246
33990
|
import { EventEmitter as EventEmitter7 } from "events";
|
|
34247
33991
|
import { EventEmitter as EventEmitter9 } from "events";
|
|
34248
33992
|
var __defProp2 = Object.defineProperty;
|
|
34249
|
-
var __returnValue = (v) => v;
|
|
34250
|
-
function __exportSetter(name, newValue) {
|
|
34251
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
34252
|
-
}
|
|
34253
33993
|
var __export2 = (target, all) => {
|
|
34254
33994
|
for (var name in all)
|
|
34255
33995
|
__defProp2(target, name, {
|
|
34256
33996
|
get: all[name],
|
|
34257
33997
|
enumerable: true,
|
|
34258
33998
|
configurable: true,
|
|
34259
|
-
set:
|
|
33999
|
+
set: (newValue) => all[name] = () => newValue
|
|
34260
34000
|
});
|
|
34261
34001
|
};
|
|
34262
34002
|
var exports_src = {};
|
|
@@ -53665,6 +53405,604 @@ class LineNumberRenderable extends Renderable {
|
|
|
53665
53405
|
}
|
|
53666
53406
|
}
|
|
53667
53407
|
}
|
|
53408
|
+
|
|
53409
|
+
class Diff {
|
|
53410
|
+
diff(oldStr, newStr, options = {}) {
|
|
53411
|
+
let callback;
|
|
53412
|
+
if (typeof options === "function") {
|
|
53413
|
+
callback = options;
|
|
53414
|
+
options = {};
|
|
53415
|
+
} else if ("callback" in options) {
|
|
53416
|
+
callback = options.callback;
|
|
53417
|
+
}
|
|
53418
|
+
const oldString = this.castInput(oldStr, options);
|
|
53419
|
+
const newString = this.castInput(newStr, options);
|
|
53420
|
+
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
53421
|
+
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
53422
|
+
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
53423
|
+
}
|
|
53424
|
+
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
53425
|
+
var _a;
|
|
53426
|
+
const done = (value) => {
|
|
53427
|
+
value = this.postProcess(value, options);
|
|
53428
|
+
if (callback) {
|
|
53429
|
+
setTimeout(function() {
|
|
53430
|
+
callback(value);
|
|
53431
|
+
}, 0);
|
|
53432
|
+
return;
|
|
53433
|
+
} else {
|
|
53434
|
+
return value;
|
|
53435
|
+
}
|
|
53436
|
+
};
|
|
53437
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
53438
|
+
let editLength = 1;
|
|
53439
|
+
let maxEditLength = newLen + oldLen;
|
|
53440
|
+
if (options.maxEditLength != null) {
|
|
53441
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
53442
|
+
}
|
|
53443
|
+
const maxExecutionTime = (_a = options.timeout) !== null && _a !== undefined ? _a : Infinity;
|
|
53444
|
+
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
53445
|
+
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
53446
|
+
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
53447
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
53448
|
+
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
53449
|
+
}
|
|
53450
|
+
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
53451
|
+
const execEditLength = () => {
|
|
53452
|
+
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
53453
|
+
let basePath;
|
|
53454
|
+
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
53455
|
+
if (removePath) {
|
|
53456
|
+
bestPath[diagonalPath - 1] = undefined;
|
|
53457
|
+
}
|
|
53458
|
+
let canAdd = false;
|
|
53459
|
+
if (addPath) {
|
|
53460
|
+
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
53461
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
53462
|
+
}
|
|
53463
|
+
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
53464
|
+
if (!canAdd && !canRemove) {
|
|
53465
|
+
bestPath[diagonalPath] = undefined;
|
|
53466
|
+
continue;
|
|
53467
|
+
}
|
|
53468
|
+
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
53469
|
+
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
53470
|
+
} else {
|
|
53471
|
+
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
53472
|
+
}
|
|
53473
|
+
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
53474
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
53475
|
+
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
53476
|
+
} else {
|
|
53477
|
+
bestPath[diagonalPath] = basePath;
|
|
53478
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
53479
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
53480
|
+
}
|
|
53481
|
+
if (newPos + 1 >= newLen) {
|
|
53482
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
53483
|
+
}
|
|
53484
|
+
}
|
|
53485
|
+
}
|
|
53486
|
+
editLength++;
|
|
53487
|
+
};
|
|
53488
|
+
if (callback) {
|
|
53489
|
+
(function exec() {
|
|
53490
|
+
setTimeout(function() {
|
|
53491
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
53492
|
+
return callback(undefined);
|
|
53493
|
+
}
|
|
53494
|
+
if (!execEditLength()) {
|
|
53495
|
+
exec();
|
|
53496
|
+
}
|
|
53497
|
+
}, 0);
|
|
53498
|
+
})();
|
|
53499
|
+
} else {
|
|
53500
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
53501
|
+
const ret = execEditLength();
|
|
53502
|
+
if (ret) {
|
|
53503
|
+
return ret;
|
|
53504
|
+
}
|
|
53505
|
+
}
|
|
53506
|
+
}
|
|
53507
|
+
}
|
|
53508
|
+
addToPath(path2, added, removed, oldPosInc, options) {
|
|
53509
|
+
const last = path2.lastComponent;
|
|
53510
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
53511
|
+
return {
|
|
53512
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
53513
|
+
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
53514
|
+
};
|
|
53515
|
+
} else {
|
|
53516
|
+
return {
|
|
53517
|
+
oldPos: path2.oldPos + oldPosInc,
|
|
53518
|
+
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
53519
|
+
};
|
|
53520
|
+
}
|
|
53521
|
+
}
|
|
53522
|
+
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
53523
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
53524
|
+
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
53525
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
53526
|
+
newPos++;
|
|
53527
|
+
oldPos++;
|
|
53528
|
+
commonCount++;
|
|
53529
|
+
if (options.oneChangePerToken) {
|
|
53530
|
+
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
53531
|
+
}
|
|
53532
|
+
}
|
|
53533
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
53534
|
+
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
53535
|
+
}
|
|
53536
|
+
basePath.oldPos = oldPos;
|
|
53537
|
+
return newPos;
|
|
53538
|
+
}
|
|
53539
|
+
equals(left, right, options) {
|
|
53540
|
+
if (options.comparator) {
|
|
53541
|
+
return options.comparator(left, right);
|
|
53542
|
+
} else {
|
|
53543
|
+
return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
53544
|
+
}
|
|
53545
|
+
}
|
|
53546
|
+
removeEmpty(array) {
|
|
53547
|
+
const ret = [];
|
|
53548
|
+
for (let i = 0;i < array.length; i++) {
|
|
53549
|
+
if (array[i]) {
|
|
53550
|
+
ret.push(array[i]);
|
|
53551
|
+
}
|
|
53552
|
+
}
|
|
53553
|
+
return ret;
|
|
53554
|
+
}
|
|
53555
|
+
castInput(value, options) {
|
|
53556
|
+
return value;
|
|
53557
|
+
}
|
|
53558
|
+
tokenize(value, options) {
|
|
53559
|
+
return Array.from(value);
|
|
53560
|
+
}
|
|
53561
|
+
join(chars) {
|
|
53562
|
+
return chars.join("");
|
|
53563
|
+
}
|
|
53564
|
+
postProcess(changeObjects, options) {
|
|
53565
|
+
return changeObjects;
|
|
53566
|
+
}
|
|
53567
|
+
get useLongestToken() {
|
|
53568
|
+
return false;
|
|
53569
|
+
}
|
|
53570
|
+
buildValues(lastComponent, newTokens, oldTokens) {
|
|
53571
|
+
const components = [];
|
|
53572
|
+
let nextComponent;
|
|
53573
|
+
while (lastComponent) {
|
|
53574
|
+
components.push(lastComponent);
|
|
53575
|
+
nextComponent = lastComponent.previousComponent;
|
|
53576
|
+
delete lastComponent.previousComponent;
|
|
53577
|
+
lastComponent = nextComponent;
|
|
53578
|
+
}
|
|
53579
|
+
components.reverse();
|
|
53580
|
+
const componentLen = components.length;
|
|
53581
|
+
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
53582
|
+
for (;componentPos < componentLen; componentPos++) {
|
|
53583
|
+
const component = components[componentPos];
|
|
53584
|
+
if (!component.removed) {
|
|
53585
|
+
if (!component.added && this.useLongestToken) {
|
|
53586
|
+
let value = newTokens.slice(newPos, newPos + component.count);
|
|
53587
|
+
value = value.map(function(value2, i) {
|
|
53588
|
+
const oldValue = oldTokens[oldPos + i];
|
|
53589
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
53590
|
+
});
|
|
53591
|
+
component.value = this.join(value);
|
|
53592
|
+
} else {
|
|
53593
|
+
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
53594
|
+
}
|
|
53595
|
+
newPos += component.count;
|
|
53596
|
+
if (!component.added) {
|
|
53597
|
+
oldPos += component.count;
|
|
53598
|
+
}
|
|
53599
|
+
} else {
|
|
53600
|
+
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
53601
|
+
oldPos += component.count;
|
|
53602
|
+
}
|
|
53603
|
+
}
|
|
53604
|
+
return components;
|
|
53605
|
+
}
|
|
53606
|
+
}
|
|
53607
|
+
|
|
53608
|
+
class CharacterDiff extends Diff {
|
|
53609
|
+
}
|
|
53610
|
+
var characterDiff = new CharacterDiff;
|
|
53611
|
+
function longestCommonPrefix(str1, str2) {
|
|
53612
|
+
let i;
|
|
53613
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
53614
|
+
if (str1[i] != str2[i]) {
|
|
53615
|
+
return str1.slice(0, i);
|
|
53616
|
+
}
|
|
53617
|
+
}
|
|
53618
|
+
return str1.slice(0, i);
|
|
53619
|
+
}
|
|
53620
|
+
function longestCommonSuffix(str1, str2) {
|
|
53621
|
+
let i;
|
|
53622
|
+
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
53623
|
+
return "";
|
|
53624
|
+
}
|
|
53625
|
+
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
53626
|
+
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
53627
|
+
return str1.slice(-i);
|
|
53628
|
+
}
|
|
53629
|
+
}
|
|
53630
|
+
return str1.slice(-i);
|
|
53631
|
+
}
|
|
53632
|
+
function replacePrefix(string, oldPrefix, newPrefix) {
|
|
53633
|
+
if (string.slice(0, oldPrefix.length) != oldPrefix) {
|
|
53634
|
+
throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
|
|
53635
|
+
}
|
|
53636
|
+
return newPrefix + string.slice(oldPrefix.length);
|
|
53637
|
+
}
|
|
53638
|
+
function replaceSuffix(string, oldSuffix, newSuffix) {
|
|
53639
|
+
if (!oldSuffix) {
|
|
53640
|
+
return string + newSuffix;
|
|
53641
|
+
}
|
|
53642
|
+
if (string.slice(-oldSuffix.length) != oldSuffix) {
|
|
53643
|
+
throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
|
|
53644
|
+
}
|
|
53645
|
+
return string.slice(0, -oldSuffix.length) + newSuffix;
|
|
53646
|
+
}
|
|
53647
|
+
function removePrefix(string, oldPrefix) {
|
|
53648
|
+
return replacePrefix(string, oldPrefix, "");
|
|
53649
|
+
}
|
|
53650
|
+
function removeSuffix(string, oldSuffix) {
|
|
53651
|
+
return replaceSuffix(string, oldSuffix, "");
|
|
53652
|
+
}
|
|
53653
|
+
function maximumOverlap(string1, string2) {
|
|
53654
|
+
return string2.slice(0, overlapCount(string1, string2));
|
|
53655
|
+
}
|
|
53656
|
+
function overlapCount(a, b) {
|
|
53657
|
+
let startA = 0;
|
|
53658
|
+
if (a.length > b.length) {
|
|
53659
|
+
startA = a.length - b.length;
|
|
53660
|
+
}
|
|
53661
|
+
let endB = b.length;
|
|
53662
|
+
if (a.length < b.length) {
|
|
53663
|
+
endB = a.length;
|
|
53664
|
+
}
|
|
53665
|
+
const map = Array(endB);
|
|
53666
|
+
let k = 0;
|
|
53667
|
+
map[0] = 0;
|
|
53668
|
+
for (let j = 1;j < endB; j++) {
|
|
53669
|
+
if (b[j] == b[k]) {
|
|
53670
|
+
map[j] = map[k];
|
|
53671
|
+
} else {
|
|
53672
|
+
map[j] = k;
|
|
53673
|
+
}
|
|
53674
|
+
while (k > 0 && b[j] != b[k]) {
|
|
53675
|
+
k = map[k];
|
|
53676
|
+
}
|
|
53677
|
+
if (b[j] == b[k]) {
|
|
53678
|
+
k++;
|
|
53679
|
+
}
|
|
53680
|
+
}
|
|
53681
|
+
k = 0;
|
|
53682
|
+
for (let i = startA;i < a.length; i++) {
|
|
53683
|
+
while (k > 0 && a[i] != b[k]) {
|
|
53684
|
+
k = map[k];
|
|
53685
|
+
}
|
|
53686
|
+
if (a[i] == b[k]) {
|
|
53687
|
+
k++;
|
|
53688
|
+
}
|
|
53689
|
+
}
|
|
53690
|
+
return k;
|
|
53691
|
+
}
|
|
53692
|
+
function trailingWs(string) {
|
|
53693
|
+
let i;
|
|
53694
|
+
for (i = string.length - 1;i >= 0; i--) {
|
|
53695
|
+
if (!string[i].match(/\s/)) {
|
|
53696
|
+
break;
|
|
53697
|
+
}
|
|
53698
|
+
}
|
|
53699
|
+
return string.substring(i + 1);
|
|
53700
|
+
}
|
|
53701
|
+
function leadingWs(string) {
|
|
53702
|
+
const match = string.match(/^\s*/);
|
|
53703
|
+
return match ? match[0] : "";
|
|
53704
|
+
}
|
|
53705
|
+
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}";
|
|
53706
|
+
var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
|
|
53707
|
+
|
|
53708
|
+
class WordDiff extends Diff {
|
|
53709
|
+
equals(left, right, options) {
|
|
53710
|
+
if (options.ignoreCase) {
|
|
53711
|
+
left = left.toLowerCase();
|
|
53712
|
+
right = right.toLowerCase();
|
|
53713
|
+
}
|
|
53714
|
+
return left.trim() === right.trim();
|
|
53715
|
+
}
|
|
53716
|
+
tokenize(value, options = {}) {
|
|
53717
|
+
let parts;
|
|
53718
|
+
if (options.intlSegmenter) {
|
|
53719
|
+
const segmenter = options.intlSegmenter;
|
|
53720
|
+
if (segmenter.resolvedOptions().granularity != "word") {
|
|
53721
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
53722
|
+
}
|
|
53723
|
+
parts = Array.from(segmenter.segment(value), (segment) => segment.segment);
|
|
53724
|
+
} else {
|
|
53725
|
+
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
53726
|
+
}
|
|
53727
|
+
const tokens = [];
|
|
53728
|
+
let prevPart = null;
|
|
53729
|
+
parts.forEach((part) => {
|
|
53730
|
+
if (/\s/.test(part)) {
|
|
53731
|
+
if (prevPart == null) {
|
|
53732
|
+
tokens.push(part);
|
|
53733
|
+
} else {
|
|
53734
|
+
tokens.push(tokens.pop() + part);
|
|
53735
|
+
}
|
|
53736
|
+
} else if (prevPart != null && /\s/.test(prevPart)) {
|
|
53737
|
+
if (tokens[tokens.length - 1] == prevPart) {
|
|
53738
|
+
tokens.push(tokens.pop() + part);
|
|
53739
|
+
} else {
|
|
53740
|
+
tokens.push(prevPart + part);
|
|
53741
|
+
}
|
|
53742
|
+
} else {
|
|
53743
|
+
tokens.push(part);
|
|
53744
|
+
}
|
|
53745
|
+
prevPart = part;
|
|
53746
|
+
});
|
|
53747
|
+
return tokens;
|
|
53748
|
+
}
|
|
53749
|
+
join(tokens) {
|
|
53750
|
+
return tokens.map((token, i) => {
|
|
53751
|
+
if (i == 0) {
|
|
53752
|
+
return token;
|
|
53753
|
+
} else {
|
|
53754
|
+
return token.replace(/^\s+/, "");
|
|
53755
|
+
}
|
|
53756
|
+
}).join("");
|
|
53757
|
+
}
|
|
53758
|
+
postProcess(changes, options) {
|
|
53759
|
+
if (!changes || options.oneChangePerToken) {
|
|
53760
|
+
return changes;
|
|
53761
|
+
}
|
|
53762
|
+
let lastKeep = null;
|
|
53763
|
+
let insertion = null;
|
|
53764
|
+
let deletion = null;
|
|
53765
|
+
changes.forEach((change) => {
|
|
53766
|
+
if (change.added) {
|
|
53767
|
+
insertion = change;
|
|
53768
|
+
} else if (change.removed) {
|
|
53769
|
+
deletion = change;
|
|
53770
|
+
} else {
|
|
53771
|
+
if (insertion || deletion) {
|
|
53772
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
53773
|
+
}
|
|
53774
|
+
lastKeep = change;
|
|
53775
|
+
insertion = null;
|
|
53776
|
+
deletion = null;
|
|
53777
|
+
}
|
|
53778
|
+
});
|
|
53779
|
+
if (insertion || deletion) {
|
|
53780
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
53781
|
+
}
|
|
53782
|
+
return changes;
|
|
53783
|
+
}
|
|
53784
|
+
}
|
|
53785
|
+
var wordDiff = new WordDiff;
|
|
53786
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
53787
|
+
if (deletion && insertion) {
|
|
53788
|
+
const oldWsPrefix = leadingWs(deletion.value);
|
|
53789
|
+
const oldWsSuffix = trailingWs(deletion.value);
|
|
53790
|
+
const newWsPrefix = leadingWs(insertion.value);
|
|
53791
|
+
const newWsSuffix = trailingWs(insertion.value);
|
|
53792
|
+
if (startKeep) {
|
|
53793
|
+
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
53794
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
53795
|
+
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
53796
|
+
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
53797
|
+
}
|
|
53798
|
+
if (endKeep) {
|
|
53799
|
+
const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
53800
|
+
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
53801
|
+
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
53802
|
+
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
53803
|
+
}
|
|
53804
|
+
} else if (insertion) {
|
|
53805
|
+
if (startKeep) {
|
|
53806
|
+
const ws = leadingWs(insertion.value);
|
|
53807
|
+
insertion.value = insertion.value.substring(ws.length);
|
|
53808
|
+
}
|
|
53809
|
+
if (endKeep) {
|
|
53810
|
+
const ws = leadingWs(endKeep.value);
|
|
53811
|
+
endKeep.value = endKeep.value.substring(ws.length);
|
|
53812
|
+
}
|
|
53813
|
+
} else if (startKeep && endKeep) {
|
|
53814
|
+
const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
|
|
53815
|
+
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
53816
|
+
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
53817
|
+
const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
53818
|
+
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
53819
|
+
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
53820
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
53821
|
+
} else if (endKeep) {
|
|
53822
|
+
const endKeepWsPrefix = leadingWs(endKeep.value);
|
|
53823
|
+
const deletionWsSuffix = trailingWs(deletion.value);
|
|
53824
|
+
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
53825
|
+
deletion.value = removeSuffix(deletion.value, overlap);
|
|
53826
|
+
} else if (startKeep) {
|
|
53827
|
+
const startKeepWsSuffix = trailingWs(startKeep.value);
|
|
53828
|
+
const deletionWsPrefix = leadingWs(deletion.value);
|
|
53829
|
+
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
53830
|
+
deletion.value = removePrefix(deletion.value, overlap);
|
|
53831
|
+
}
|
|
53832
|
+
}
|
|
53833
|
+
|
|
53834
|
+
class WordsWithSpaceDiff extends Diff {
|
|
53835
|
+
tokenize(value) {
|
|
53836
|
+
const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
|
|
53837
|
+
return value.match(regex) || [];
|
|
53838
|
+
}
|
|
53839
|
+
}
|
|
53840
|
+
var wordsWithSpaceDiff = new WordsWithSpaceDiff;
|
|
53841
|
+
|
|
53842
|
+
class LineDiff extends Diff {
|
|
53843
|
+
constructor() {
|
|
53844
|
+
super(...arguments);
|
|
53845
|
+
this.tokenize = tokenize;
|
|
53846
|
+
}
|
|
53847
|
+
equals(left, right, options) {
|
|
53848
|
+
if (options.ignoreWhitespace) {
|
|
53849
|
+
if (!options.newlineIsToken || !left.includes(`
|
|
53850
|
+
`)) {
|
|
53851
|
+
left = left.trim();
|
|
53852
|
+
}
|
|
53853
|
+
if (!options.newlineIsToken || !right.includes(`
|
|
53854
|
+
`)) {
|
|
53855
|
+
right = right.trim();
|
|
53856
|
+
}
|
|
53857
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
53858
|
+
if (left.endsWith(`
|
|
53859
|
+
`)) {
|
|
53860
|
+
left = left.slice(0, -1);
|
|
53861
|
+
}
|
|
53862
|
+
if (right.endsWith(`
|
|
53863
|
+
`)) {
|
|
53864
|
+
right = right.slice(0, -1);
|
|
53865
|
+
}
|
|
53866
|
+
}
|
|
53867
|
+
return super.equals(left, right, options);
|
|
53868
|
+
}
|
|
53869
|
+
}
|
|
53870
|
+
var lineDiff = new LineDiff;
|
|
53871
|
+
function tokenize(value, options) {
|
|
53872
|
+
if (options.stripTrailingCr) {
|
|
53873
|
+
value = value.replace(/\r\n/g, `
|
|
53874
|
+
`);
|
|
53875
|
+
}
|
|
53876
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
53877
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
53878
|
+
linesAndNewlines.pop();
|
|
53879
|
+
}
|
|
53880
|
+
for (let i = 0;i < linesAndNewlines.length; i++) {
|
|
53881
|
+
const line = linesAndNewlines[i];
|
|
53882
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
53883
|
+
retLines[retLines.length - 1] += line;
|
|
53884
|
+
} else {
|
|
53885
|
+
retLines.push(line);
|
|
53886
|
+
}
|
|
53887
|
+
}
|
|
53888
|
+
return retLines;
|
|
53889
|
+
}
|
|
53890
|
+
function isSentenceEndPunct(char) {
|
|
53891
|
+
return char == "." || char == "!" || char == "?";
|
|
53892
|
+
}
|
|
53893
|
+
|
|
53894
|
+
class SentenceDiff extends Diff {
|
|
53895
|
+
tokenize(value) {
|
|
53896
|
+
var _a;
|
|
53897
|
+
const result = [];
|
|
53898
|
+
let tokenStartI = 0;
|
|
53899
|
+
for (let i = 0;i < value.length; i++) {
|
|
53900
|
+
if (i == value.length - 1) {
|
|
53901
|
+
result.push(value.slice(tokenStartI));
|
|
53902
|
+
break;
|
|
53903
|
+
}
|
|
53904
|
+
if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
|
|
53905
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
53906
|
+
i = tokenStartI = i + 1;
|
|
53907
|
+
while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
|
|
53908
|
+
i++;
|
|
53909
|
+
}
|
|
53910
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
53911
|
+
tokenStartI = i + 1;
|
|
53912
|
+
}
|
|
53913
|
+
}
|
|
53914
|
+
return result;
|
|
53915
|
+
}
|
|
53916
|
+
}
|
|
53917
|
+
var sentenceDiff = new SentenceDiff;
|
|
53918
|
+
|
|
53919
|
+
class CssDiff extends Diff {
|
|
53920
|
+
tokenize(value) {
|
|
53921
|
+
return value.split(/([{}:;,]|\s+)/);
|
|
53922
|
+
}
|
|
53923
|
+
}
|
|
53924
|
+
var cssDiff = new CssDiff;
|
|
53925
|
+
|
|
53926
|
+
class JsonDiff extends Diff {
|
|
53927
|
+
constructor() {
|
|
53928
|
+
super(...arguments);
|
|
53929
|
+
this.tokenize = tokenize;
|
|
53930
|
+
}
|
|
53931
|
+
get useLongestToken() {
|
|
53932
|
+
return true;
|
|
53933
|
+
}
|
|
53934
|
+
castInput(value, options) {
|
|
53935
|
+
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
|
|
53936
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
|
|
53937
|
+
}
|
|
53938
|
+
equals(left, right, options) {
|
|
53939
|
+
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
53940
|
+
}
|
|
53941
|
+
}
|
|
53942
|
+
var jsonDiff = new JsonDiff;
|
|
53943
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
53944
|
+
stack = stack || [];
|
|
53945
|
+
replacementStack = replacementStack || [];
|
|
53946
|
+
if (replacer) {
|
|
53947
|
+
obj = replacer(key === undefined ? "" : key, obj);
|
|
53948
|
+
}
|
|
53949
|
+
let i;
|
|
53950
|
+
for (i = 0;i < stack.length; i += 1) {
|
|
53951
|
+
if (stack[i] === obj) {
|
|
53952
|
+
return replacementStack[i];
|
|
53953
|
+
}
|
|
53954
|
+
}
|
|
53955
|
+
let canonicalizedObj;
|
|
53956
|
+
if (Object.prototype.toString.call(obj) === "[object Array]") {
|
|
53957
|
+
stack.push(obj);
|
|
53958
|
+
canonicalizedObj = new Array(obj.length);
|
|
53959
|
+
replacementStack.push(canonicalizedObj);
|
|
53960
|
+
for (i = 0;i < obj.length; i += 1) {
|
|
53961
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
53962
|
+
}
|
|
53963
|
+
stack.pop();
|
|
53964
|
+
replacementStack.pop();
|
|
53965
|
+
return canonicalizedObj;
|
|
53966
|
+
}
|
|
53967
|
+
if (obj && obj.toJSON) {
|
|
53968
|
+
obj = obj.toJSON();
|
|
53969
|
+
}
|
|
53970
|
+
if (typeof obj === "object" && obj !== null) {
|
|
53971
|
+
stack.push(obj);
|
|
53972
|
+
canonicalizedObj = {};
|
|
53973
|
+
replacementStack.push(canonicalizedObj);
|
|
53974
|
+
const sortedKeys = [];
|
|
53975
|
+
let key2;
|
|
53976
|
+
for (key2 in obj) {
|
|
53977
|
+
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
53978
|
+
sortedKeys.push(key2);
|
|
53979
|
+
}
|
|
53980
|
+
}
|
|
53981
|
+
sortedKeys.sort();
|
|
53982
|
+
for (i = 0;i < sortedKeys.length; i += 1) {
|
|
53983
|
+
key2 = sortedKeys[i];
|
|
53984
|
+
canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
|
|
53985
|
+
}
|
|
53986
|
+
stack.pop();
|
|
53987
|
+
replacementStack.pop();
|
|
53988
|
+
} else {
|
|
53989
|
+
canonicalizedObj = obj;
|
|
53990
|
+
}
|
|
53991
|
+
return canonicalizedObj;
|
|
53992
|
+
}
|
|
53993
|
+
|
|
53994
|
+
class ArrayDiff extends Diff {
|
|
53995
|
+
tokenize(value) {
|
|
53996
|
+
return value.slice();
|
|
53997
|
+
}
|
|
53998
|
+
join(value) {
|
|
53999
|
+
return value;
|
|
54000
|
+
}
|
|
54001
|
+
removeEmpty(value) {
|
|
54002
|
+
return value;
|
|
54003
|
+
}
|
|
54004
|
+
}
|
|
54005
|
+
var arrayDiff = new ArrayDiff;
|
|
53668
54006
|
function parsePatch(uniDiff) {
|
|
53669
54007
|
const diffstr = uniDiff.split(/\n/), list = [];
|
|
53670
54008
|
let i = 0;
|
|
@@ -56077,7 +56415,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56077
56415
|
_content;
|
|
56078
56416
|
_wrapMode;
|
|
56079
56417
|
_columnWidthMode;
|
|
56080
|
-
_columnFitter;
|
|
56081
56418
|
_cellPadding;
|
|
56082
56419
|
_showBorders;
|
|
56083
56420
|
_border;
|
|
@@ -56105,9 +56442,8 @@ class TextTableRenderable extends Renderable {
|
|
|
56105
56442
|
_cachedMeasureWidth = undefined;
|
|
56106
56443
|
_defaultOptions = {
|
|
56107
56444
|
content: [],
|
|
56108
|
-
wrapMode: "
|
|
56109
|
-
columnWidthMode: "
|
|
56110
|
-
columnFitter: "proportional",
|
|
56445
|
+
wrapMode: "none",
|
|
56446
|
+
columnWidthMode: "content",
|
|
56111
56447
|
cellPadding: 0,
|
|
56112
56448
|
showBorders: true,
|
|
56113
56449
|
border: true,
|
|
@@ -56124,11 +56460,10 @@ class TextTableRenderable extends Renderable {
|
|
|
56124
56460
|
attributes: 0
|
|
56125
56461
|
};
|
|
56126
56462
|
constructor(ctx, options = {}) {
|
|
56127
|
-
super(ctx, { ...options,
|
|
56463
|
+
super(ctx, { ...options, buffered: true });
|
|
56128
56464
|
this._content = options.content ?? this._defaultOptions.content;
|
|
56129
56465
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
56130
56466
|
this._columnWidthMode = options.columnWidthMode ?? this._defaultOptions.columnWidthMode;
|
|
56131
|
-
this._columnFitter = this.resolveColumnFitter(options.columnFitter);
|
|
56132
56467
|
this._cellPadding = this.resolveCellPadding(options.cellPadding);
|
|
56133
56468
|
this._showBorders = options.showBorders ?? this._defaultOptions.showBorders;
|
|
56134
56469
|
this._border = options.border ?? this._defaultOptions.border;
|
|
@@ -56177,16 +56512,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56177
56512
|
this._columnWidthMode = value;
|
|
56178
56513
|
this.invalidateLayoutAndRaster();
|
|
56179
56514
|
}
|
|
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
56515
|
get cellPadding() {
|
|
56191
56516
|
return this._cellPadding;
|
|
56192
56517
|
}
|
|
@@ -56340,7 +56665,7 @@ class TextTableRenderable extends Renderable {
|
|
|
56340
56665
|
super.destroySelf();
|
|
56341
56666
|
}
|
|
56342
56667
|
setupMeasureFunc() {
|
|
56343
|
-
const measureFunc = (width, widthMode,
|
|
56668
|
+
const measureFunc = (width, widthMode, height, heightMode) => {
|
|
56344
56669
|
const hasWidthConstraint = widthMode !== MeasureMode.Undefined && Number.isFinite(width);
|
|
56345
56670
|
const rawWidthConstraint = hasWidthConstraint ? Math.max(1, Math.floor(width)) : undefined;
|
|
56346
56671
|
const widthConstraint = this.resolveLayoutWidthConstraint(rawWidthConstraint);
|
|
@@ -56352,6 +56677,9 @@ class TextTableRenderable extends Renderable {
|
|
|
56352
56677
|
if (widthMode === MeasureMode.AtMost && rawWidthConstraint !== undefined && this._positionType !== "absolute") {
|
|
56353
56678
|
measuredWidth = Math.min(rawWidthConstraint, measuredWidth);
|
|
56354
56679
|
}
|
|
56680
|
+
if (heightMode === MeasureMode.AtMost && Number.isFinite(height) && this._positionType !== "absolute") {
|
|
56681
|
+
measuredHeight = Math.min(Math.max(1, Math.floor(height)), measuredHeight);
|
|
56682
|
+
}
|
|
56355
56683
|
return {
|
|
56356
56684
|
width: measuredWidth,
|
|
56357
56685
|
height: measuredHeight
|
|
@@ -56523,9 +56851,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56523
56851
|
tableHeight: (rowOffsets[rowOffsets.length - 1] ?? 0) + 1
|
|
56524
56852
|
};
|
|
56525
56853
|
}
|
|
56526
|
-
isFullWidthMode() {
|
|
56527
|
-
return this._columnWidthMode === "full";
|
|
56528
|
-
}
|
|
56529
56854
|
computeColumnWidths(maxTableWidth, borderLayout) {
|
|
56530
56855
|
const horizontalPadding = this.getHorizontalCellPadding();
|
|
56531
56856
|
const intrinsicWidths = new Array(this._columnCount).fill(1 + horizontalPadding);
|
|
@@ -56548,7 +56873,7 @@ class TextTableRenderable extends Renderable {
|
|
|
56548
56873
|
return intrinsicWidths;
|
|
56549
56874
|
}
|
|
56550
56875
|
if (currentWidth < maxContentWidth) {
|
|
56551
|
-
if (this.
|
|
56876
|
+
if (this._columnWidthMode === "fill") {
|
|
56552
56877
|
return this.expandColumnWidths(intrinsicWidths, maxContentWidth);
|
|
56553
56878
|
}
|
|
56554
56879
|
return intrinsicWidths;
|
|
@@ -56578,12 +56903,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56578
56903
|
return expanded;
|
|
56579
56904
|
}
|
|
56580
56905
|
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
56906
|
const minWidth = 1 + this.getHorizontalCellPadding();
|
|
56588
56907
|
const hardMinWidths = new Array(widths.length).fill(minWidth);
|
|
56589
56908
|
const baseWidths = widths.map((width) => Math.max(1, Math.floor(width)));
|
|
@@ -56634,80 +56953,6 @@ class TextTableRenderable extends Renderable {
|
|
|
56634
56953
|
}
|
|
56635
56954
|
return baseWidths.map((width, idx) => Math.max(floorWidths[idx], width - integerShrink[idx]));
|
|
56636
56955
|
}
|
|
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
56956
|
computeRowHeights(columnWidths) {
|
|
56712
56957
|
const horizontalPadding = this.getHorizontalCellPadding();
|
|
56713
56958
|
const verticalPadding = this.getVerticalCellPadding();
|
|
@@ -57031,7 +57276,7 @@ class TextTableRenderable extends Renderable {
|
|
|
57031
57276
|
if (width === undefined || !Number.isFinite(width) || width <= 0) {
|
|
57032
57277
|
return;
|
|
57033
57278
|
}
|
|
57034
|
-
if (this._wrapMode !== "none" || this.
|
|
57279
|
+
if (this._wrapMode !== "none" || this._columnWidthMode === "fill") {
|
|
57035
57280
|
return Math.max(1, Math.floor(width));
|
|
57036
57281
|
}
|
|
57037
57282
|
return;
|
|
@@ -57042,12 +57287,6 @@ class TextTableRenderable extends Renderable {
|
|
|
57042
57287
|
getVerticalCellPadding() {
|
|
57043
57288
|
return this._cellPadding * 2;
|
|
57044
57289
|
}
|
|
57045
|
-
resolveColumnFitter(value) {
|
|
57046
|
-
if (value === undefined) {
|
|
57047
|
-
return this._defaultOptions.columnFitter;
|
|
57048
|
-
}
|
|
57049
|
-
return value === "balanced" ? "balanced" : "proportional";
|
|
57050
|
-
}
|
|
57051
57290
|
resolveCellPadding(value) {
|
|
57052
57291
|
if (value === undefined || !Number.isFinite(value)) {
|
|
57053
57292
|
return this._defaultOptions.cellPadding;
|
|
@@ -58823,9 +59062,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
58823
59062
|
resolveTableRenderableOptions() {
|
|
58824
59063
|
const borders = this._tableOptions?.borders ?? true;
|
|
58825
59064
|
return {
|
|
58826
|
-
columnWidthMode: this._tableOptions?.widthMode ?? "
|
|
58827
|
-
|
|
58828
|
-
wrapMode: this._tableOptions?.wrapMode ?? "word",
|
|
59065
|
+
columnWidthMode: this._tableOptions?.widthMode ?? "content",
|
|
59066
|
+
wrapMode: this._tableOptions?.wrapMode ?? "none",
|
|
58829
59067
|
cellPadding: this._tableOptions?.cellPadding ?? 0,
|
|
58830
59068
|
border: borders,
|
|
58831
59069
|
outerBorder: this._tableOptions?.outerBorder ?? borders,
|
|
@@ -58837,7 +59075,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
58837
59075
|
}
|
|
58838
59076
|
applyTableRenderableOptions(tableRenderable, options) {
|
|
58839
59077
|
tableRenderable.columnWidthMode = options.columnWidthMode;
|
|
58840
|
-
tableRenderable.columnFitter = options.columnFitter;
|
|
58841
59078
|
tableRenderable.wrapMode = options.wrapMode;
|
|
58842
59079
|
tableRenderable.cellPadding = options.cellPadding;
|
|
58843
59080
|
tableRenderable.border = options.border;
|
|
@@ -58868,7 +59105,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
58868
59105
|
width: "100%",
|
|
58869
59106
|
marginBottom,
|
|
58870
59107
|
columnWidthMode: options.columnWidthMode,
|
|
58871
|
-
columnFitter: options.columnFitter,
|
|
58872
59108
|
wrapMode: options.wrapMode,
|
|
58873
59109
|
cellPadding: options.cellPadding,
|
|
58874
59110
|
border: options.border,
|
|
@@ -59728,34 +59964,6 @@ class ContentRenderable extends BoxRenderable {
|
|
|
59728
59964
|
return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
|
|
59729
59965
|
}
|
|
59730
59966
|
}
|
|
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
59967
|
|
|
59760
59968
|
class ScrollBoxRenderable extends BoxRenderable {
|
|
59761
59969
|
static idCounter = 0;
|
|
@@ -59903,38 +60111,27 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
59903
60111
|
this._isApplyingStickyScroll = wasApplyingStickyScroll;
|
|
59904
60112
|
}
|
|
59905
60113
|
}
|
|
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
|
-
};
|
|
60114
|
+
constructor(ctx, {
|
|
60115
|
+
wrapperOptions,
|
|
60116
|
+
viewportOptions,
|
|
60117
|
+
contentOptions,
|
|
60118
|
+
rootOptions,
|
|
60119
|
+
scrollbarOptions,
|
|
60120
|
+
verticalScrollbarOptions,
|
|
60121
|
+
horizontalScrollbarOptions,
|
|
60122
|
+
stickyScroll = false,
|
|
60123
|
+
stickyStart,
|
|
60124
|
+
scrollX = false,
|
|
60125
|
+
scrollY = true,
|
|
60126
|
+
scrollAcceleration,
|
|
60127
|
+
viewportCulling = true,
|
|
60128
|
+
...options
|
|
60129
|
+
}) {
|
|
59933
60130
|
super(ctx, {
|
|
59934
60131
|
flexDirection: "row",
|
|
59935
60132
|
alignItems: "stretch",
|
|
59936
|
-
...
|
|
59937
|
-
...
|
|
60133
|
+
...options,
|
|
60134
|
+
...rootOptions
|
|
59938
60135
|
});
|
|
59939
60136
|
this.internalId = ScrollBoxRenderable.idCounter++;
|
|
59940
60137
|
this._stickyScroll = stickyScroll;
|
|
@@ -59966,7 +60163,7 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
59966
60163
|
onSizeChange: () => {
|
|
59967
60164
|
this.recalculateBarProps();
|
|
59968
60165
|
},
|
|
59969
|
-
...
|
|
60166
|
+
...contentOptions,
|
|
59970
60167
|
id: `scroll-box-content-${this.internalId}`
|
|
59971
60168
|
});
|
|
59972
60169
|
this.viewport.add(this.content);
|
|
@@ -60282,34 +60479,6 @@ class ScrollBoxRenderable extends BoxRenderable {
|
|
|
60282
60479
|
this.requestRender();
|
|
60283
60480
|
});
|
|
60284
60481
|
}
|
|
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
60482
|
set rootOptions(options) {
|
|
60314
60483
|
Object.assign(this, options);
|
|
60315
60484
|
this.requestRender();
|
|
@@ -61071,8 +61240,8 @@ class TabSelectRenderable extends Renderable {
|
|
|
61071
61240
|
}
|
|
61072
61241
|
}
|
|
61073
61242
|
|
|
61074
|
-
// node_modules/@opentui/react/chunk-
|
|
61075
|
-
|
|
61243
|
+
// node_modules/@opentui/react/chunk-9gg102mq.js
|
|
61244
|
+
init_chunk_eecw9x2f();
|
|
61076
61245
|
var import_react = __toESM(require_react(), 1);
|
|
61077
61246
|
var import_react2 = __toESM(require_react(), 1);
|
|
61078
61247
|
var import_react3 = __toESM(require_react(), 1);
|
|
@@ -61199,7 +61368,7 @@ class ErrorBoundary extends import_react3.default.Component {
|
|
|
61199
61368
|
}
|
|
61200
61369
|
var package_default = {
|
|
61201
61370
|
name: "@opentui/react",
|
|
61202
|
-
version: "0.1.
|
|
61371
|
+
version: "0.1.83",
|
|
61203
61372
|
description: "React renderer for building terminal user interfaces using OpenTUI core",
|
|
61204
61373
|
license: "MIT",
|
|
61205
61374
|
repository: {
|
|
@@ -61534,7 +61703,7 @@ var hostConfig = {
|
|
|
61534
61703
|
var reconciler = import_react_reconciler.default(hostConfig);
|
|
61535
61704
|
if (process.env["DEV"] === "true") {
|
|
61536
61705
|
try {
|
|
61537
|
-
await
|
|
61706
|
+
await init_chunk_pm1hna8x().then(() => exports_chunk_pm1hna8x);
|
|
61538
61707
|
} catch (error) {
|
|
61539
61708
|
if (error.code === "ERR_MODULE_NOT_FOUND") {
|
|
61540
61709
|
console.warn(`
|
|
@@ -61579,7 +61748,7 @@ function createRoot(renderer) {
|
|
|
61579
61748
|
}
|
|
61580
61749
|
|
|
61581
61750
|
// node_modules/@opentui/react/index.js
|
|
61582
|
-
|
|
61751
|
+
init_chunk_eecw9x2f();
|
|
61583
61752
|
var import_react5 = __toESM(require_react(), 1);
|
|
61584
61753
|
var import_react6 = __toESM(require_react(), 1);
|
|
61585
61754
|
var import_react7 = __toESM(require_react(), 1);
|
|
@@ -61689,8 +61858,6 @@ function Header() {
|
|
|
61689
61858
|
const [branch, setBranch] = import_react13.useState("");
|
|
61690
61859
|
const { isNarrow } = useLayout();
|
|
61691
61860
|
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
61861
|
import_react13.useEffect(() => {
|
|
61695
61862
|
try {
|
|
61696
61863
|
const b2 = execSync("git rev-parse --abbrev-ref HEAD 2>/dev/null", {
|
|
@@ -61713,13 +61880,9 @@ function Header() {
|
|
|
61713
61880
|
fg: import_theme.colors.dim,
|
|
61714
61881
|
children: " "
|
|
61715
61882
|
}),
|
|
61716
|
-
/* @__PURE__ */ jsx_runtime.
|
|
61717
|
-
fg:
|
|
61718
|
-
children: [
|
|
61719
|
-
"[",
|
|
61720
|
-
mode,
|
|
61721
|
-
"]"
|
|
61722
|
-
]
|
|
61883
|
+
/* @__PURE__ */ jsx_runtime.jsx("span", {
|
|
61884
|
+
fg: import_theme.colors.accent,
|
|
61885
|
+
children: "[max]"
|
|
61723
61886
|
}),
|
|
61724
61887
|
/* @__PURE__ */ jsx_runtime.jsx("span", {
|
|
61725
61888
|
fg: import_theme.colors.dim,
|
|
@@ -62369,8 +62532,7 @@ var import_theme14 = __toESM(require_theme(), 1);
|
|
|
62369
62532
|
var jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
62370
62533
|
var COMMANDS = [
|
|
62371
62534
|
{ cmd: "/help", desc: "Show this menu" },
|
|
62372
|
-
{ cmd: "/
|
|
62373
|
-
{ cmd: "/compact", desc: "Compact conversation context" },
|
|
62535
|
+
{ cmd: "/compact", desc: "Compact/summarize conversation context" },
|
|
62374
62536
|
{ cmd: "/files", desc: "Show project file tree" },
|
|
62375
62537
|
{ cmd: "/clear", desc: "Clear conversation" },
|
|
62376
62538
|
{ cmd: "/cost", desc: "Show session stats" },
|