pentesting 0.70.8 → 0.70.9
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/main.js +436 -372
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -82,9 +82,9 @@ var THEME = {
|
|
|
82
82
|
spinner: COLORS.primary
|
|
83
83
|
};
|
|
84
84
|
var ASCII_BANNER = `
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
86
|
+
\u2502 P E N T E S T I N G A G E N T \u2502
|
|
87
|
+
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
88
88
|
`;
|
|
89
89
|
var ICONS = {
|
|
90
90
|
// Status
|
|
@@ -421,7 +421,7 @@ function isZaiProvider() {
|
|
|
421
421
|
return baseUrl.includes("z.ai");
|
|
422
422
|
}
|
|
423
423
|
function isThinkingEnabled() {
|
|
424
|
-
return process.env[ENV_KEYS.THINKING]
|
|
424
|
+
return process.env[ENV_KEYS.THINKING] !== "false";
|
|
425
425
|
}
|
|
426
426
|
function getThinkingBudget() {
|
|
427
427
|
const val = parseInt(process.env[ENV_KEYS.THINKING_BUDGET] || "", 10);
|
|
@@ -759,7 +759,7 @@ var INPUT_PROMPT_PATTERNS = [
|
|
|
759
759
|
|
|
760
760
|
// src/shared/constants/agent.ts
|
|
761
761
|
var APP_NAME = "Pentest AI";
|
|
762
|
-
var APP_VERSION = "0.70.
|
|
762
|
+
var APP_VERSION = "0.70.9";
|
|
763
763
|
var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
|
|
764
764
|
var LLM_ROLES = {
|
|
765
765
|
SYSTEM: "system",
|
|
@@ -815,7 +815,7 @@ import chalk from "chalk";
|
|
|
815
815
|
|
|
816
816
|
// src/platform/tui/app.tsx
|
|
817
817
|
import { useState as useState6, useCallback as useCallback9, useRef as useRef8 } from "react";
|
|
818
|
-
import { Box as
|
|
818
|
+
import { Box as Box20, useApp, useStdout as useStdout4 } from "ink";
|
|
819
819
|
|
|
820
820
|
// src/platform/tui/hooks/useAgent.ts
|
|
821
821
|
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useRef as useRef3 } from "react";
|
|
@@ -12567,16 +12567,16 @@ function extractHypothesizedReason(failureLine) {
|
|
|
12567
12567
|
}
|
|
12568
12568
|
|
|
12569
12569
|
// src/shared/utils/context-digest/formatters.ts
|
|
12570
|
-
function formatContextForLLM(
|
|
12570
|
+
function formatContextForLLM(memo15) {
|
|
12571
12571
|
const compact = {};
|
|
12572
|
-
if (
|
|
12573
|
-
if (
|
|
12574
|
-
if (
|
|
12575
|
-
if (
|
|
12576
|
-
if (
|
|
12577
|
-
if (
|
|
12578
|
-
compact.attackValue =
|
|
12579
|
-
if (
|
|
12572
|
+
if (memo15.keyFindings.length > 0) compact.findings = memo15.keyFindings;
|
|
12573
|
+
if (memo15.credentials.length > 0) compact.credentials = memo15.credentials;
|
|
12574
|
+
if (memo15.attackVectors.length > 0) compact.attackVectors = memo15.attackVectors;
|
|
12575
|
+
if (memo15.failures.length > 0) compact.failures = memo15.failures;
|
|
12576
|
+
if (memo15.suspicions.length > 0) compact.suspicions = memo15.suspicions;
|
|
12577
|
+
if (memo15.nextSteps.length > 0) compact.nextSteps = memo15.nextSteps;
|
|
12578
|
+
compact.attackValue = memo15.attackValue;
|
|
12579
|
+
if (memo15.reflection) compact.reflection = memo15.reflection;
|
|
12580
12580
|
return JSON.stringify(compact);
|
|
12581
12581
|
}
|
|
12582
12582
|
function formatAnalystDigest(digest, filePath, originalChars) {
|
|
@@ -12634,15 +12634,15 @@ async function digestToolOutput(output, toolName, toolInput, analystFn) {
|
|
|
12634
12634
|
try {
|
|
12635
12635
|
const context = `Tool: ${toolName}${toolInput ? ` | Input: ${toolInput}` : ""}`;
|
|
12636
12636
|
const rawAnalystResponse = await analystFn(preprocessed, context);
|
|
12637
|
-
const
|
|
12637
|
+
const memo15 = parseAnalystMemo(rawAnalystResponse);
|
|
12638
12638
|
const formatted = formatAnalystDigest(rawAnalystResponse, savedOutputPath, originalLength);
|
|
12639
|
-
const contextForLLM = formatContextForLLM(
|
|
12639
|
+
const contextForLLM = formatContextForLLM(memo15);
|
|
12640
12640
|
return {
|
|
12641
12641
|
digestedOutput: formatted,
|
|
12642
12642
|
contextForLLM,
|
|
12643
12643
|
fullOutputPath: savedOutputPath,
|
|
12644
12644
|
analystUsed: true,
|
|
12645
|
-
memo:
|
|
12645
|
+
memo: memo15,
|
|
12646
12646
|
originalLength,
|
|
12647
12647
|
digestedLength: formatted.length,
|
|
12648
12648
|
compressionRatio: formatted.length / originalLength
|
|
@@ -13597,7 +13597,7 @@ function buildSummaryFromEntries(entries) {
|
|
|
13597
13597
|
|
|
13598
13598
|
// src/shared/utils/journal/formatters/record.ts
|
|
13599
13599
|
function formatTurnRecord(input) {
|
|
13600
|
-
const { turn, timestamp, phase, tools, memo:
|
|
13600
|
+
const { turn, timestamp, phase, tools, memo: memo15, reflection } = input;
|
|
13601
13601
|
const time = timestamp.slice(0, 19).replace("T", " ");
|
|
13602
13602
|
const sections = [];
|
|
13603
13603
|
sections.push(`# Turn ${turn} | ${time} | Phase: ${phase}`);
|
|
@@ -13614,25 +13614,25 @@ function formatTurnRecord(input) {
|
|
|
13614
13614
|
}
|
|
13615
13615
|
sections.push("");
|
|
13616
13616
|
sections.push(`## ${TURN_SECTIONS.KEY_INSIGHTS}`);
|
|
13617
|
-
if (
|
|
13618
|
-
for (const f of
|
|
13617
|
+
if (memo15.keyFindings.length > 0) {
|
|
13618
|
+
for (const f of memo15.keyFindings) sections.push(`- ${INSIGHT_TAGS.DISCOVERED}: ${f}`);
|
|
13619
13619
|
}
|
|
13620
|
-
if (
|
|
13621
|
-
for (const c of
|
|
13620
|
+
if (memo15.credentials.length > 0) {
|
|
13621
|
+
for (const c of memo15.credentials) sections.push(`- ${INSIGHT_TAGS.CREDENTIAL}: ${c}`);
|
|
13622
13622
|
}
|
|
13623
|
-
if (
|
|
13624
|
-
for (const v of
|
|
13623
|
+
if (memo15.attackVectors.length > 0) {
|
|
13624
|
+
for (const v of memo15.attackVectors) sections.push(`- ${INSIGHT_TAGS.CONFIRMED}: ${v}`);
|
|
13625
13625
|
}
|
|
13626
|
-
if (
|
|
13627
|
-
for (const f of
|
|
13626
|
+
if (memo15.failures.length > 0) {
|
|
13627
|
+
for (const f of memo15.failures) sections.push(`- ${INSIGHT_TAGS.DEAD_END}: ${f}`);
|
|
13628
13628
|
}
|
|
13629
|
-
if (
|
|
13630
|
-
for (const s of
|
|
13629
|
+
if (memo15.suspicions.length > 0) {
|
|
13630
|
+
for (const s of memo15.suspicions) sections.push(`- ${INSIGHT_TAGS.SUSPICIOUS}: ${s}`);
|
|
13631
13631
|
}
|
|
13632
|
-
if (
|
|
13633
|
-
for (const n of
|
|
13632
|
+
if (memo15.nextSteps.length > 0) {
|
|
13633
|
+
for (const n of memo15.nextSteps) sections.push(`- ${INSIGHT_TAGS.NEXT}: ${n}`);
|
|
13634
13634
|
}
|
|
13635
|
-
if (
|
|
13635
|
+
if (memo15.keyFindings.length === 0 && memo15.failures.length === 0 && memo15.credentials.length === 0) {
|
|
13636
13636
|
sections.push(`- ${TURN_EMPTY_MESSAGES.NO_INSIGHTS}`);
|
|
13637
13637
|
}
|
|
13638
13638
|
sections.push("");
|
|
@@ -13644,7 +13644,7 @@ function formatTurnRecord(input) {
|
|
|
13644
13644
|
|
|
13645
13645
|
// src/shared/utils/journal/formatters/reflection.ts
|
|
13646
13646
|
function formatReflectionInput(input) {
|
|
13647
|
-
const { tools, memo:
|
|
13647
|
+
const { tools, memo: memo15, phase } = input;
|
|
13648
13648
|
const parts = [
|
|
13649
13649
|
`\uD604\uC7AC Phase: ${phase}`,
|
|
13650
13650
|
"",
|
|
@@ -13662,12 +13662,12 @@ function formatReflectionInput(input) {
|
|
|
13662
13662
|
}
|
|
13663
13663
|
parts.push("");
|
|
13664
13664
|
parts.push("Analyst \uCD94\uCD9C \uBA54\uBAA8:");
|
|
13665
|
-
if (
|
|
13666
|
-
if (
|
|
13667
|
-
if (
|
|
13668
|
-
if (
|
|
13669
|
-
if (
|
|
13670
|
-
parts.push(` \uACF5\uACA9 \uAC00\uCE58: ${
|
|
13665
|
+
if (memo15) {
|
|
13666
|
+
if (memo15.keyFindings.length > 0) parts.push(` \uBC1C\uACAC: ${memo15.keyFindings.join(", ")}`);
|
|
13667
|
+
if (memo15.credentials.length > 0) parts.push(` \uD06C\uB808\uB374\uC15C: ${memo15.credentials.join(", ")}`);
|
|
13668
|
+
if (memo15.failures.length > 0) parts.push(` \uC2E4\uD328: ${memo15.failures.join(", ")}`);
|
|
13669
|
+
if (memo15.suspicions.length > 0) parts.push(` \uC758\uC2EC: ${memo15.suspicions.join(", ")}`);
|
|
13670
|
+
parts.push(` \uACF5\uACA9 \uAC00\uCE58: ${memo15.attackValue}`);
|
|
13671
13671
|
} else {
|
|
13672
13672
|
parts.push(" (\uBD84\uC11D \uACB0\uACFC \uC5C6\uC74C)");
|
|
13673
13673
|
}
|
|
@@ -14561,13 +14561,13 @@ ${extraction.extractedContext}
|
|
|
14561
14561
|
}
|
|
14562
14562
|
return false;
|
|
14563
14563
|
}
|
|
14564
|
-
async function processReflection(toolJournal,
|
|
14564
|
+
async function processReflection(toolJournal, memo15, phase, reflector) {
|
|
14565
14565
|
if (toolJournal.length === 0) {
|
|
14566
14566
|
return null;
|
|
14567
14567
|
}
|
|
14568
14568
|
const reflection = await reflector.execute({
|
|
14569
14569
|
tools: toolJournal,
|
|
14570
|
-
memo:
|
|
14570
|
+
memo: memo15,
|
|
14571
14571
|
phase
|
|
14572
14572
|
});
|
|
14573
14573
|
if (reflection.success && reflection.reflection) {
|
|
@@ -14580,7 +14580,7 @@ async function processReflection(toolJournal, memo14, phase, reflector) {
|
|
|
14580
14580
|
import { writeFileSync as writeFileSync10, existsSync as existsSync15, readFileSync as readFileSync11 } from "fs";
|
|
14581
14581
|
import { join as join16 } from "path";
|
|
14582
14582
|
async function recordTurn(context) {
|
|
14583
|
-
const { turnCounter, phase, toolJournal, memo:
|
|
14583
|
+
const { turnCounter, phase, toolJournal, memo: memo15, reflections, summaryRegenerator } = context;
|
|
14584
14584
|
if (toolJournal.length === 0) {
|
|
14585
14585
|
return turnCounter;
|
|
14586
14586
|
}
|
|
@@ -14590,10 +14590,10 @@ async function recordTurn(context) {
|
|
|
14590
14590
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14591
14591
|
phase,
|
|
14592
14592
|
tools: toolJournal,
|
|
14593
|
-
memo:
|
|
14594
|
-
reflection: reflections.length > 0 ? reflections.join(" | ") :
|
|
14593
|
+
memo: memo15,
|
|
14594
|
+
reflection: reflections.length > 0 ? reflections.join(" | ") : memo15.nextSteps.join("; ")
|
|
14595
14595
|
};
|
|
14596
|
-
const entryCtx = { entry, journalTools: toolJournal, memo:
|
|
14596
|
+
const entryCtx = { entry, journalTools: toolJournal, memo: memo15, phase, reflections };
|
|
14597
14597
|
await createTurnArchive(turnCounter, entryCtx);
|
|
14598
14598
|
await regenerateSummary(turnCounter, summaryRegenerator, entryCtx);
|
|
14599
14599
|
rotateTurnRecords();
|
|
@@ -14602,7 +14602,7 @@ async function recordTurn(context) {
|
|
|
14602
14602
|
return turnCounter + 1;
|
|
14603
14603
|
}
|
|
14604
14604
|
async function createTurnArchive(turnCounter, ctx) {
|
|
14605
|
-
const { entry, journalTools, memo:
|
|
14605
|
+
const { entry, journalTools, memo: memo15, phase } = ctx;
|
|
14606
14606
|
try {
|
|
14607
14607
|
const turnDir = WORKSPACE.turnPath(turnCounter);
|
|
14608
14608
|
const toolsDir = WORKSPACE.turnToolsPath(turnCounter);
|
|
@@ -14613,35 +14613,35 @@ async function createTurnArchive(turnCounter, ctx) {
|
|
|
14613
14613
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14614
14614
|
phase,
|
|
14615
14615
|
tools: journalTools,
|
|
14616
|
-
memo:
|
|
14616
|
+
memo: memo15,
|
|
14617
14617
|
reflection: entry.reflection
|
|
14618
14618
|
});
|
|
14619
14619
|
writeFileSync10(join16(turnDir, TURN_FILES.RECORD), turnContent, "utf-8");
|
|
14620
14620
|
writeFileSync10(join16(turnDir, TURN_FILES.STRUCTURED), JSON.stringify(entry, null, 2), "utf-8");
|
|
14621
|
-
writeAnalystFile(turnDir,
|
|
14621
|
+
writeAnalystFile(turnDir, memo15);
|
|
14622
14622
|
} catch {
|
|
14623
14623
|
}
|
|
14624
14624
|
}
|
|
14625
|
-
function writeAnalystFile(turnDir,
|
|
14625
|
+
function writeAnalystFile(turnDir, memo15) {
|
|
14626
14626
|
const memoLines = [];
|
|
14627
|
-
if (
|
|
14628
|
-
if (
|
|
14629
|
-
if (
|
|
14630
|
-
if (
|
|
14631
|
-
if (
|
|
14632
|
-
if (
|
|
14627
|
+
if (memo15.keyFindings.length > 0) memoLines.push("## Key Findings", ...memo15.keyFindings.map((f) => `- ${f}`), "");
|
|
14628
|
+
if (memo15.credentials.length > 0) memoLines.push("## Credentials", ...memo15.credentials.map((c) => `- ${c}`), "");
|
|
14629
|
+
if (memo15.attackVectors.length > 0) memoLines.push("## Attack Vectors", ...memo15.attackVectors.map((v) => `- ${v}`), "");
|
|
14630
|
+
if (memo15.failures.length > 0) memoLines.push("## Failures", ...memo15.failures.map((f) => `- ${f}`), "");
|
|
14631
|
+
if (memo15.suspicions.length > 0) memoLines.push("## Suspicious", ...memo15.suspicions.map((s) => `- ${s}`), "");
|
|
14632
|
+
if (memo15.nextSteps.length > 0) memoLines.push("## Next Steps", ...memo15.nextSteps.map((n) => `- ${n}`), "");
|
|
14633
14633
|
if (memoLines.length > 0) {
|
|
14634
14634
|
writeFileSync10(join16(turnDir, TURN_FILES.ANALYST), memoLines.join("\n"), "utf-8");
|
|
14635
14635
|
flowLog(
|
|
14636
14636
|
"\u2462Analyst",
|
|
14637
14637
|
"\u2192",
|
|
14638
14638
|
`archive/turn-${turnDir.split("/").pop()}/analyst.md`,
|
|
14639
|
-
`findings:${
|
|
14639
|
+
`findings:${memo15.keyFindings.length} creds:${memo15.credentials.length} vectors:${memo15.attackVectors.length} failures:${memo15.failures.length}`
|
|
14640
14640
|
);
|
|
14641
14641
|
}
|
|
14642
14642
|
}
|
|
14643
14643
|
async function regenerateSummary(turnCounter, summaryRegenerator, ctx) {
|
|
14644
|
-
const { entry, journalTools, memo:
|
|
14644
|
+
const { entry, journalTools, memo: memo15, phase } = ctx;
|
|
14645
14645
|
try {
|
|
14646
14646
|
const turnDir = WORKSPACE.turnPath(turnCounter);
|
|
14647
14647
|
const summaryPath = join16(turnDir, TURN_FILES.SUMMARY);
|
|
@@ -14658,7 +14658,7 @@ async function regenerateSummary(turnCounter, summaryRegenerator, ctx) {
|
|
|
14658
14658
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14659
14659
|
phase,
|
|
14660
14660
|
tools: journalTools,
|
|
14661
|
-
memo:
|
|
14661
|
+
memo: memo15,
|
|
14662
14662
|
reflection: entry.reflection
|
|
14663
14663
|
});
|
|
14664
14664
|
const summaryResult = await summaryRegenerator.execute({
|
|
@@ -14995,7 +14995,13 @@ var TUI_DISPLAY_LIMITS = {
|
|
|
14995
14995
|
* sessions accumulate thousands of messages and RAM grows without bound.
|
|
14996
14996
|
* Oldest messages are pruned first; all content is preserved in the disk archive.
|
|
14997
14997
|
*/
|
|
14998
|
-
MAX_MESSAGES: 500
|
|
14998
|
+
MAX_MESSAGES: 500,
|
|
14999
|
+
/** Fallback terminal row count when stdout.rows is unavailable */
|
|
15000
|
+
TERMINAL_DEFAULT_ROWS: 24,
|
|
15001
|
+
/** Reserved rows for modal chrome (header + borders + padding + footer) */
|
|
15002
|
+
MODAL_CHROME_HEIGHT: 6,
|
|
15003
|
+
/** Max chars shown for masked password in message history */
|
|
15004
|
+
PASSWORD_MASK_MAX: 20
|
|
14999
15005
|
};
|
|
15000
15006
|
|
|
15001
15007
|
// src/platform/tui/hooks/useAgentState.ts
|
|
@@ -15009,6 +15015,8 @@ var useAgentState = () => {
|
|
|
15009
15015
|
const [inputRequest, setInputRequest] = useState({ status: "inactive" });
|
|
15010
15016
|
const [stats, setStats] = useState({ phase: DEFAULTS.INIT_PHASE, targets: 0, findings: 0, todo: 0 });
|
|
15011
15017
|
const [turnCount, setTurnCount] = useState(0);
|
|
15018
|
+
const [liveReasoning, setLiveReasoning] = useState("");
|
|
15019
|
+
const [isReasoning, setIsReasoning] = useState(false);
|
|
15012
15020
|
const lastResponseMetaRef = useRef(null);
|
|
15013
15021
|
const startTimeRef = useRef(0);
|
|
15014
15022
|
const timerRef = useRef(null);
|
|
@@ -15076,19 +15084,24 @@ var useAgentState = () => {
|
|
|
15076
15084
|
setStats,
|
|
15077
15085
|
turnCount,
|
|
15078
15086
|
setTurnCount,
|
|
15079
|
-
|
|
15087
|
+
liveReasoning,
|
|
15088
|
+
setLiveReasoning,
|
|
15089
|
+
isReasoning,
|
|
15090
|
+
setIsReasoning,
|
|
15091
|
+
// Refs (external consumers only)
|
|
15080
15092
|
lastResponseMetaRef,
|
|
15081
|
-
timerRef,
|
|
15082
15093
|
retryCountdownRef,
|
|
15083
15094
|
retryCountRef,
|
|
15084
15095
|
tokenAccumRef,
|
|
15085
15096
|
lastStepTokensRef,
|
|
15097
|
+
toolStartedAtRef,
|
|
15098
|
+
// WHY timerRef excluded: internal to manageTimer/clearAllTimers only,
|
|
15099
|
+
// no external consumer exists.
|
|
15086
15100
|
// Helpers
|
|
15087
15101
|
addMessage,
|
|
15088
15102
|
resetCumulativeCounters,
|
|
15089
15103
|
manageTimer,
|
|
15090
|
-
clearAllTimers
|
|
15091
|
-
toolStartedAtRef
|
|
15104
|
+
clearAllTimers
|
|
15092
15105
|
};
|
|
15093
15106
|
};
|
|
15094
15107
|
|
|
@@ -15282,13 +15295,16 @@ function createLifecycleHandlers(agent, state, _reasoningBufferRef) {
|
|
|
15282
15295
|
|
|
15283
15296
|
// src/platform/tui/hooks/useAgentEvents/handlers/reasoning.ts
|
|
15284
15297
|
function createReasoningHandlers(state, reasoningBufferRef) {
|
|
15285
|
-
const { addMessage, setCurrentStatus } = state;
|
|
15298
|
+
const { addMessage, setCurrentStatus, setLiveReasoning, setIsReasoning } = state;
|
|
15286
15299
|
const onStart = () => {
|
|
15287
15300
|
reasoningBufferRef.current = "";
|
|
15301
|
+
setLiveReasoning("");
|
|
15302
|
+
setIsReasoning(true);
|
|
15288
15303
|
setCurrentStatus("Reasoning\u2026");
|
|
15289
15304
|
};
|
|
15290
15305
|
const onDelta = (e) => {
|
|
15291
15306
|
reasoningBufferRef.current += e.data.content;
|
|
15307
|
+
setLiveReasoning(reasoningBufferRef.current);
|
|
15292
15308
|
const chars = reasoningBufferRef.current.length;
|
|
15293
15309
|
const estTokens = Math.round(chars / LLM_LIMITS.charsPerTokenEstimate);
|
|
15294
15310
|
const firstLine = reasoningBufferRef.current.split("\n")[0]?.slice(0, TUI_DISPLAY_LIMITS.reasoningPreviewChars) || "";
|
|
@@ -15298,6 +15314,8 @@ ${firstLine}`);
|
|
|
15298
15314
|
const onEnd = () => {
|
|
15299
15315
|
const text = reasoningBufferRef.current.trim();
|
|
15300
15316
|
reasoningBufferRef.current = "";
|
|
15317
|
+
setIsReasoning(false);
|
|
15318
|
+
setLiveReasoning("");
|
|
15301
15319
|
setCurrentStatus("");
|
|
15302
15320
|
if (text) {
|
|
15303
15321
|
addMessage("thinking", text);
|
|
@@ -15392,7 +15410,9 @@ var useAgentEvents = (agent, eventsRef, state) => {
|
|
|
15392
15410
|
tokenAccumRef,
|
|
15393
15411
|
lastStepTokensRef,
|
|
15394
15412
|
lastResponseMetaRef,
|
|
15395
|
-
setCurrentTokens
|
|
15413
|
+
setCurrentTokens,
|
|
15414
|
+
setLiveReasoning,
|
|
15415
|
+
setIsReasoning
|
|
15396
15416
|
} = state;
|
|
15397
15417
|
const reasoningBufferRef = useRef2("");
|
|
15398
15418
|
useEffect(() => {
|
|
@@ -15410,7 +15430,10 @@ var useAgentEvents = (agent, eventsRef, state) => {
|
|
|
15410
15430
|
tokenAccumRef,
|
|
15411
15431
|
lastStepTokensRef
|
|
15412
15432
|
}, reasoningBufferRef);
|
|
15413
|
-
const reasoningHandlers = createReasoningHandlers(
|
|
15433
|
+
const reasoningHandlers = createReasoningHandlers(
|
|
15434
|
+
{ addMessage, setCurrentStatus, setLiveReasoning, setIsReasoning },
|
|
15435
|
+
reasoningBufferRef
|
|
15436
|
+
);
|
|
15414
15437
|
const cleanupInput = setupInputHandlers(setInputRequest, addMessage);
|
|
15415
15438
|
const cleanupCommand = setupCommandHandlers(addMessage, setCurrentStatus);
|
|
15416
15439
|
const updateStats = () => {
|
|
@@ -15460,7 +15483,9 @@ var useAgentEvents = (agent, eventsRef, state) => {
|
|
|
15460
15483
|
lastStepTokensRef,
|
|
15461
15484
|
clearAllTimers,
|
|
15462
15485
|
toolStartedAtRef,
|
|
15463
|
-
eventsRef
|
|
15486
|
+
eventsRef,
|
|
15487
|
+
setLiveReasoning,
|
|
15488
|
+
setIsReasoning
|
|
15464
15489
|
]);
|
|
15465
15490
|
};
|
|
15466
15491
|
|
|
@@ -15488,7 +15513,9 @@ var useAgent = (shouldAutoApprove, target) => {
|
|
|
15488
15513
|
manageTimer,
|
|
15489
15514
|
resetCumulativeCounters,
|
|
15490
15515
|
turnCount,
|
|
15491
|
-
setTurnCount
|
|
15516
|
+
setTurnCount,
|
|
15517
|
+
liveReasoning,
|
|
15518
|
+
isReasoning
|
|
15492
15519
|
} = state;
|
|
15493
15520
|
useEffect2(() => {
|
|
15494
15521
|
if (target) {
|
|
@@ -15569,7 +15596,9 @@ var useAgent = (shouldAutoApprove, target) => {
|
|
|
15569
15596
|
abort,
|
|
15570
15597
|
cancelInputRequest,
|
|
15571
15598
|
addMessage,
|
|
15572
|
-
refreshStats
|
|
15599
|
+
refreshStats,
|
|
15600
|
+
liveReasoning,
|
|
15601
|
+
isReasoning
|
|
15573
15602
|
};
|
|
15574
15603
|
};
|
|
15575
15604
|
|
|
@@ -16246,41 +16275,58 @@ var AnimationProvider = ({ children }) => {
|
|
|
16246
16275
|
var useAnimationTick = () => useContext(AnimationContext);
|
|
16247
16276
|
|
|
16248
16277
|
// src/platform/tui/components/MessageList.tsx
|
|
16249
|
-
import { memo as
|
|
16250
|
-
import { Box as
|
|
16278
|
+
import { memo as memo8 } from "react";
|
|
16279
|
+
import { Box as Box9, Static } from "ink";
|
|
16251
16280
|
|
|
16252
16281
|
// src/platform/tui/components/messages/ThinkingBlock.tsx
|
|
16253
16282
|
import { memo } from "react";
|
|
16254
16283
|
import { Box, Text } from "ink";
|
|
16255
16284
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
16256
|
-
var THINKING_PREVIEW_LINES = 3;
|
|
16257
16285
|
var ThinkingBlock = memo(({ msg }) => {
|
|
16258
16286
|
const lines = msg.content.split("\n");
|
|
16259
|
-
const
|
|
16260
|
-
const estTokens = Math.round(charCount / LLM_LIMITS.charsPerTokenEstimate);
|
|
16261
|
-
const hiddenCount = lines.length - THINKING_PREVIEW_LINES;
|
|
16262
|
-
const visibleLines = lines.slice(0, THINKING_PREVIEW_LINES);
|
|
16287
|
+
const estTokens = Math.round(msg.content.length / LLM_LIMITS.charsPerTokenEstimate);
|
|
16263
16288
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 0, children: [
|
|
16264
16289
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
16265
|
-
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: "
|
|
16266
|
-
/* @__PURE__ */ jsx2(Text, { color: THEME.gray, children: "Reasoning" }),
|
|
16267
|
-
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: `
|
|
16268
|
-
|
|
16290
|
+
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: "\u25C6 " }),
|
|
16291
|
+
/* @__PURE__ */ jsx2(Text, { color: THEME.gray, bold: true, children: "Reasoning" }),
|
|
16292
|
+
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: ` ~${estTokens} tok ${lines.length} lines` })
|
|
16293
|
+
] }),
|
|
16294
|
+
lines.map((line, i) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
16295
|
+
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: "\u2502 " }),
|
|
16296
|
+
/* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, wrap: "truncate", children: line || " " })
|
|
16297
|
+
] }, i)),
|
|
16298
|
+
/* @__PURE__ */ jsx2(Box, { children: /* @__PURE__ */ jsx2(Text, { color: THEME.dimGray, children: "\u2575" }) })
|
|
16299
|
+
] });
|
|
16300
|
+
});
|
|
16301
|
+
|
|
16302
|
+
// src/platform/tui/components/messages/LiveReasoningPanel.tsx
|
|
16303
|
+
import { memo as memo2 } from "react";
|
|
16304
|
+
import { Box as Box2, Text as Text2 } from "ink";
|
|
16305
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
16306
|
+
var LiveReasoningPanel = memo2(({ content, isReasoning }) => {
|
|
16307
|
+
if (!isReasoning) return null;
|
|
16308
|
+
const lines = content.split("\n");
|
|
16309
|
+
const estTokens = Math.round(content.length / LLM_LIMITS.charsPerTokenEstimate);
|
|
16310
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", marginY: 0, children: [
|
|
16311
|
+
/* @__PURE__ */ jsxs2(Box2, { children: [
|
|
16312
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.yellow, children: "\u27F3 " }),
|
|
16313
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.yellow, bold: true, children: "Reasoning" }),
|
|
16314
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.dimGray, children: ` ~${estTokens} tok ${lines.length} lines streaming\u2026` })
|
|
16269
16315
|
] }),
|
|
16270
|
-
|
|
16271
|
-
/* @__PURE__ */
|
|
16272
|
-
/* @__PURE__ */
|
|
16316
|
+
lines.map((line, i) => /* @__PURE__ */ jsxs2(Box2, { children: [
|
|
16317
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.dimGray, children: "\u2502 " }),
|
|
16318
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.gray, wrap: "truncate", children: line || " " })
|
|
16273
16319
|
] }, i)),
|
|
16274
|
-
|
|
16275
|
-
/* @__PURE__ */
|
|
16276
|
-
/* @__PURE__ */
|
|
16320
|
+
/* @__PURE__ */ jsxs2(Box2, { children: [
|
|
16321
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.dimGray, children: "\u2502 " }),
|
|
16322
|
+
/* @__PURE__ */ jsx3(Text2, { color: THEME.yellow, children: "\u258C" })
|
|
16277
16323
|
] })
|
|
16278
16324
|
] });
|
|
16279
16325
|
});
|
|
16280
16326
|
|
|
16281
16327
|
// src/platform/tui/components/messages/MessageRow.tsx
|
|
16282
|
-
import { memo as
|
|
16283
|
-
import { Box as
|
|
16328
|
+
import { memo as memo5 } from "react";
|
|
16329
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
16284
16330
|
|
|
16285
16331
|
// src/platform/tui/constants/styles.ts
|
|
16286
16332
|
var MESSAGE_STYLES = {
|
|
@@ -16317,10 +16363,16 @@ var MESSAGE_STYLES = {
|
|
|
16317
16363
|
// Thinking/reasoning icon
|
|
16318
16364
|
}
|
|
16319
16365
|
};
|
|
16366
|
+
var UI_MESSAGES = {
|
|
16367
|
+
/** Shown when user sends a message while agent is processing */
|
|
16368
|
+
QUEUED: "\u{1F4AC} Message queued \u2014 will be processed at next iteration",
|
|
16369
|
+
/** Prefix for masked secret input in message history */
|
|
16370
|
+
SECRET_PREFIX: "\u21B3 "
|
|
16371
|
+
};
|
|
16320
16372
|
|
|
16321
16373
|
// src/platform/tui/components/inline-status.tsx
|
|
16322
|
-
import { Box as
|
|
16323
|
-
import { Fragment, jsx as
|
|
16374
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
16375
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
16324
16376
|
function formatDuration3(ms) {
|
|
16325
16377
|
const seconds = Math.floor(ms / 1e3);
|
|
16326
16378
|
if (seconds < 60) return `${seconds}s`;
|
|
@@ -16346,18 +16398,18 @@ function getRoleColor(role) {
|
|
|
16346
16398
|
}
|
|
16347
16399
|
function StatusIndicator({ isRunning, exitCode }) {
|
|
16348
16400
|
if (isRunning) {
|
|
16349
|
-
return /* @__PURE__ */
|
|
16401
|
+
return /* @__PURE__ */ jsxs3(Text3, { color: THEME.primary, children: [
|
|
16350
16402
|
ICONS.running,
|
|
16351
16403
|
" "
|
|
16352
16404
|
] });
|
|
16353
16405
|
}
|
|
16354
16406
|
if (exitCode === 0) {
|
|
16355
|
-
return /* @__PURE__ */
|
|
16407
|
+
return /* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16356
16408
|
ICONS.success,
|
|
16357
16409
|
" "
|
|
16358
16410
|
] });
|
|
16359
16411
|
}
|
|
16360
|
-
return /* @__PURE__ */
|
|
16412
|
+
return /* @__PURE__ */ jsxs3(Text3, { color: THEME.red, children: [
|
|
16361
16413
|
ICONS.error,
|
|
16362
16414
|
" "
|
|
16363
16415
|
] });
|
|
@@ -16367,26 +16419,26 @@ function ProcessRow({ proc, isCompact }) {
|
|
|
16367
16419
|
const port = proc.listeningPort ? `:${proc.listeningPort}` : "";
|
|
16368
16420
|
const purpose = proc.purpose || proc.description || "";
|
|
16369
16421
|
const truncatedPurpose = isCompact && purpose.length > TUI_DISPLAY_LIMITS.purposeMaxLength ? purpose.slice(0, TUI_DISPLAY_LIMITS.purposeTruncated) + "..." : purpose;
|
|
16370
|
-
return /* @__PURE__ */
|
|
16371
|
-
/* @__PURE__ */
|
|
16372
|
-
/* @__PURE__ */
|
|
16422
|
+
return /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
16423
|
+
/* @__PURE__ */ jsx4(StatusIndicator, { isRunning: proc.isRunning, exitCode: proc.exitCode }),
|
|
16424
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16373
16425
|
"[",
|
|
16374
16426
|
proc.id,
|
|
16375
16427
|
"]"
|
|
16376
16428
|
] }),
|
|
16377
|
-
/* @__PURE__ */
|
|
16378
|
-
/* @__PURE__ */
|
|
16429
|
+
/* @__PURE__ */ jsx4(Text3, { children: " " }),
|
|
16430
|
+
/* @__PURE__ */ jsxs3(Text3, { color: getRoleColor(proc.role), bold: true, children: [
|
|
16379
16431
|
proc.role,
|
|
16380
16432
|
port
|
|
16381
16433
|
] }),
|
|
16382
|
-
/* @__PURE__ */
|
|
16434
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16383
16435
|
" (",
|
|
16384
16436
|
duration,
|
|
16385
16437
|
")"
|
|
16386
16438
|
] }),
|
|
16387
|
-
truncatedPurpose && /* @__PURE__ */
|
|
16388
|
-
/* @__PURE__ */
|
|
16389
|
-
/* @__PURE__ */
|
|
16439
|
+
truncatedPurpose && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
16440
|
+
/* @__PURE__ */ jsx4(Text3, { color: THEME.gray, children: " - " }),
|
|
16441
|
+
/* @__PURE__ */ jsx4(Text3, { color: THEME.gray, children: truncatedPurpose })
|
|
16390
16442
|
] })
|
|
16391
16443
|
] });
|
|
16392
16444
|
}
|
|
@@ -16397,7 +16449,7 @@ var InlineStatus = ({
|
|
|
16397
16449
|
isCompact = true
|
|
16398
16450
|
}) => {
|
|
16399
16451
|
if (processes.length === 0 && zombies.length === 0) {
|
|
16400
|
-
return /* @__PURE__ */
|
|
16452
|
+
return /* @__PURE__ */ jsx4(Box3, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx4(Text3, { color: THEME.gray, children: "\u2022 No active background processes" }) });
|
|
16401
16453
|
}
|
|
16402
16454
|
const running = processes.filter((p) => p.isRunning);
|
|
16403
16455
|
const stopped = processes.filter((p) => !p.isRunning);
|
|
@@ -16406,66 +16458,66 @@ var InlineStatus = ({
|
|
|
16406
16458
|
warning: THEME.yellow,
|
|
16407
16459
|
critical: THEME.red
|
|
16408
16460
|
}[health];
|
|
16409
|
-
return /* @__PURE__ */
|
|
16410
|
-
running.length > 0 && /* @__PURE__ */
|
|
16411
|
-
/* @__PURE__ */
|
|
16461
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginBottom: 1, children: [
|
|
16462
|
+
running.length > 0 && /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
16463
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, bold: true, children: [
|
|
16412
16464
|
ICONS.running,
|
|
16413
16465
|
" Active (",
|
|
16414
16466
|
running.length,
|
|
16415
16467
|
")"
|
|
16416
16468
|
] }),
|
|
16417
|
-
running.map((proc) => /* @__PURE__ */
|
|
16469
|
+
running.map((proc) => /* @__PURE__ */ jsx4(ProcessRow, { proc, isCompact }, proc.id))
|
|
16418
16470
|
] }),
|
|
16419
|
-
stopped.length > 0 && !isCompact && /* @__PURE__ */
|
|
16420
|
-
/* @__PURE__ */
|
|
16471
|
+
stopped.length > 0 && !isCompact && /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: running.length > 0 ? 1 : 0, children: [
|
|
16472
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16421
16473
|
ICONS.completed,
|
|
16422
16474
|
" Completed (",
|
|
16423
16475
|
stopped.length,
|
|
16424
16476
|
")"
|
|
16425
16477
|
] }),
|
|
16426
|
-
stopped.slice(0, TUI_DISPLAY_LIMITS.maxStoppedProcesses).map((proc) => /* @__PURE__ */
|
|
16427
|
-
stopped.length > TUI_DISPLAY_LIMITS.maxStoppedProcesses && /* @__PURE__ */
|
|
16478
|
+
stopped.slice(0, TUI_DISPLAY_LIMITS.maxStoppedProcesses).map((proc) => /* @__PURE__ */ jsx4(ProcessRow, { proc, isCompact }, proc.id)),
|
|
16479
|
+
stopped.length > TUI_DISPLAY_LIMITS.maxStoppedProcesses && /* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16428
16480
|
" ... and ",
|
|
16429
16481
|
stopped.length - TUI_DISPLAY_LIMITS.maxStoppedProcesses,
|
|
16430
16482
|
" more"
|
|
16431
16483
|
] })
|
|
16432
16484
|
] }),
|
|
16433
|
-
zombies.length > 0 && /* @__PURE__ */
|
|
16434
|
-
/* @__PURE__ */
|
|
16485
|
+
zombies.length > 0 && /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
16486
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.yellow, children: [
|
|
16435
16487
|
ICONS.warning,
|
|
16436
16488
|
" Zombie Processes (",
|
|
16437
16489
|
zombies.length,
|
|
16438
16490
|
")"
|
|
16439
16491
|
] }),
|
|
16440
|
-
zombies.map((z) => /* @__PURE__ */
|
|
16441
|
-
/* @__PURE__ */
|
|
16492
|
+
zombies.map((z) => /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
16493
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.red, children: [
|
|
16442
16494
|
" ",
|
|
16443
16495
|
ICONS.error,
|
|
16444
16496
|
" "
|
|
16445
16497
|
] }),
|
|
16446
|
-
/* @__PURE__ */
|
|
16498
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.gray, children: [
|
|
16447
16499
|
"[",
|
|
16448
16500
|
z.processId,
|
|
16449
16501
|
"] "
|
|
16450
16502
|
] }),
|
|
16451
|
-
/* @__PURE__ */
|
|
16503
|
+
/* @__PURE__ */ jsxs3(Text3, { color: THEME.yellow, children: [
|
|
16452
16504
|
z.orphanedChildren.length,
|
|
16453
16505
|
" orphaned children"
|
|
16454
16506
|
] })
|
|
16455
16507
|
] }, z.processId)),
|
|
16456
|
-
/* @__PURE__ */
|
|
16508
|
+
/* @__PURE__ */ jsx4(Text3, { color: THEME.gray, children: " Run /cleanup to terminate" })
|
|
16457
16509
|
] }),
|
|
16458
|
-
/* @__PURE__ */
|
|
16459
|
-
/* @__PURE__ */
|
|
16460
|
-
/* @__PURE__ */
|
|
16510
|
+
/* @__PURE__ */ jsxs3(Box3, { marginTop: running.length > 0 ? 1 : 0, children: [
|
|
16511
|
+
/* @__PURE__ */ jsx4(Text3, { color: THEME.gray, children: "Health: " }),
|
|
16512
|
+
/* @__PURE__ */ jsx4(Text3, { color: healthColor, bold: true, children: health.toUpperCase() })
|
|
16461
16513
|
] })
|
|
16462
16514
|
] });
|
|
16463
16515
|
};
|
|
16464
16516
|
|
|
16465
16517
|
// src/platform/tui/components/ToolCard.tsx
|
|
16466
|
-
import { memo as
|
|
16467
|
-
import { Box as
|
|
16468
|
-
import { Fragment as Fragment2, jsx as
|
|
16518
|
+
import { memo as memo3 } from "react";
|
|
16519
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
16520
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
16469
16521
|
var ARGS_MAX = 72;
|
|
16470
16522
|
function truncate(s, max) {
|
|
16471
16523
|
return s.length > max ? s.slice(0, max - 1) + "\u2026" : s;
|
|
@@ -16507,23 +16559,23 @@ function parseToolContent(content) {
|
|
|
16507
16559
|
}
|
|
16508
16560
|
return { name: content.trim(), args: "" };
|
|
16509
16561
|
}
|
|
16510
|
-
var ToolCard =
|
|
16562
|
+
var ToolCard = memo3(({ content }) => {
|
|
16511
16563
|
const { name, args } = parseToolContent(content);
|
|
16512
|
-
return /* @__PURE__ */
|
|
16513
|
-
/* @__PURE__ */
|
|
16514
|
-
/* @__PURE__ */
|
|
16515
|
-
args && /* @__PURE__ */
|
|
16516
|
-
/* @__PURE__ */
|
|
16517
|
-
/* @__PURE__ */
|
|
16518
|
-
/* @__PURE__ */
|
|
16564
|
+
return /* @__PURE__ */ jsxs4(Box4, { children: [
|
|
16565
|
+
/* @__PURE__ */ jsx5(Text4, { color: THEME.primary, children: " \u2295 " }),
|
|
16566
|
+
/* @__PURE__ */ jsx5(Text4, { color: THEME.white, bold: true, children: name }),
|
|
16567
|
+
args && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
16568
|
+
/* @__PURE__ */ jsx5(Text4, { color: THEME.dimGray, children: "(" }),
|
|
16569
|
+
/* @__PURE__ */ jsx5(Text4, { color: THEME.gray, children: args }),
|
|
16570
|
+
/* @__PURE__ */ jsx5(Text4, { color: THEME.dimGray, children: ")" })
|
|
16519
16571
|
] })
|
|
16520
16572
|
] });
|
|
16521
16573
|
});
|
|
16522
16574
|
|
|
16523
16575
|
// src/platform/tui/components/MarkdownText.tsx
|
|
16524
|
-
import { memo as
|
|
16525
|
-
import { Box as
|
|
16526
|
-
import { Fragment as Fragment3, jsx as
|
|
16576
|
+
import { memo as memo4 } from "react";
|
|
16577
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
16578
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
16527
16579
|
function tokenizeLine(line) {
|
|
16528
16580
|
const tokens = [];
|
|
16529
16581
|
let i = 0;
|
|
@@ -16547,14 +16599,14 @@ function tokenizeLine(line) {
|
|
|
16547
16599
|
}
|
|
16548
16600
|
return tokens;
|
|
16549
16601
|
}
|
|
16550
|
-
var InlineContent = ({ tokens }) => /* @__PURE__ */
|
|
16602
|
+
var InlineContent = ({ tokens }) => /* @__PURE__ */ jsx6(Fragment3, { children: tokens.map((tok, i) => {
|
|
16551
16603
|
if (tok.type === "bold") {
|
|
16552
|
-
return /* @__PURE__ */
|
|
16604
|
+
return /* @__PURE__ */ jsx6(Text5, { bold: true, color: THEME.white, children: tok.value }, i);
|
|
16553
16605
|
}
|
|
16554
16606
|
if (tok.type === "code") {
|
|
16555
|
-
return /* @__PURE__ */
|
|
16607
|
+
return /* @__PURE__ */ jsx6(Text5, { color: THEME.cyan, children: `\`${tok.value}\`` }, i);
|
|
16556
16608
|
}
|
|
16557
|
-
return /* @__PURE__ */
|
|
16609
|
+
return /* @__PURE__ */ jsx6(Text5, { color: THEME.white, children: tok.value }, i);
|
|
16558
16610
|
}) });
|
|
16559
16611
|
function parseBlocks(lines) {
|
|
16560
16612
|
const blocks = [];
|
|
@@ -16604,29 +16656,29 @@ function parseBlocks(lines) {
|
|
|
16604
16656
|
}
|
|
16605
16657
|
var BlockRenderer = ({ block, blockIdx }) => {
|
|
16606
16658
|
if (block.type === "blank") {
|
|
16607
|
-
return /* @__PURE__ */
|
|
16659
|
+
return /* @__PURE__ */ jsx6(Text5, { children: " " }, blockIdx);
|
|
16608
16660
|
}
|
|
16609
16661
|
if (block.type === "heading") {
|
|
16610
16662
|
const prefixes = { 1: "\u25B8 ", 2: " \u25B9 ", 3: " \xB7 " };
|
|
16611
16663
|
const colors = { 1: THEME.primary, 2: THEME.cyan, 3: THEME.white };
|
|
16612
|
-
return /* @__PURE__ */
|
|
16664
|
+
return /* @__PURE__ */ jsx6(Box5, { children: /* @__PURE__ */ jsxs5(Text5, { color: colors[block.level], bold: true, children: [
|
|
16613
16665
|
prefixes[block.level],
|
|
16614
16666
|
block.content
|
|
16615
16667
|
] }) }, blockIdx);
|
|
16616
16668
|
}
|
|
16617
16669
|
if (block.type === "listItem") {
|
|
16618
16670
|
const bullet = block.ordered ? `${block.index}.` : "\u2022";
|
|
16619
|
-
return /* @__PURE__ */
|
|
16620
|
-
/* @__PURE__ */
|
|
16671
|
+
return /* @__PURE__ */ jsxs5(Box5, { paddingLeft: 1, children: [
|
|
16672
|
+
/* @__PURE__ */ jsxs5(Text5, { color: THEME.dimGray, children: [
|
|
16621
16673
|
bullet,
|
|
16622
16674
|
" "
|
|
16623
16675
|
] }),
|
|
16624
|
-
/* @__PURE__ */
|
|
16676
|
+
/* @__PURE__ */ jsx6(InlineContent, { tokens: tokenizeLine(block.content) })
|
|
16625
16677
|
] }, blockIdx);
|
|
16626
16678
|
}
|
|
16627
16679
|
if (block.type === "codeBlock") {
|
|
16628
|
-
return /* @__PURE__ */
|
|
16629
|
-
|
|
16680
|
+
return /* @__PURE__ */ jsxs5(
|
|
16681
|
+
Box5,
|
|
16630
16682
|
{
|
|
16631
16683
|
flexDirection: "column",
|
|
16632
16684
|
borderStyle: "single",
|
|
@@ -16634,19 +16686,19 @@ var BlockRenderer = ({ block, blockIdx }) => {
|
|
|
16634
16686
|
paddingX: 1,
|
|
16635
16687
|
marginY: 0,
|
|
16636
16688
|
children: [
|
|
16637
|
-
block.lang && /* @__PURE__ */
|
|
16638
|
-
block.lines.map((l, li) => /* @__PURE__ */
|
|
16689
|
+
block.lang && /* @__PURE__ */ jsx6(Text5, { color: THEME.dimGray, children: block.lang }),
|
|
16690
|
+
block.lines.map((l, li) => /* @__PURE__ */ jsx6(Text5, { color: THEME.cyan, children: l }, li))
|
|
16639
16691
|
]
|
|
16640
16692
|
},
|
|
16641
16693
|
blockIdx
|
|
16642
16694
|
);
|
|
16643
16695
|
}
|
|
16644
|
-
return /* @__PURE__ */
|
|
16696
|
+
return /* @__PURE__ */ jsx6(Box5, { children: /* @__PURE__ */ jsx6(InlineContent, { tokens: tokenizeLine(block.content) }) }, blockIdx);
|
|
16645
16697
|
};
|
|
16646
|
-
var MarkdownText =
|
|
16698
|
+
var MarkdownText = memo4(({ content }) => {
|
|
16647
16699
|
const lines = content.split("\n");
|
|
16648
16700
|
const blocks = parseBlocks(lines);
|
|
16649
|
-
return /* @__PURE__ */
|
|
16701
|
+
return /* @__PURE__ */ jsx6(Box5, { flexDirection: "column", children: blocks.map((block, i) => /* @__PURE__ */ jsx6(BlockRenderer, { block, blockIdx: i }, i)) });
|
|
16650
16702
|
});
|
|
16651
16703
|
|
|
16652
16704
|
// src/platform/tui/components/messages/parseStatusContent.ts
|
|
@@ -16693,12 +16745,12 @@ function computeResultDisplay(content) {
|
|
|
16693
16745
|
}
|
|
16694
16746
|
|
|
16695
16747
|
// src/platform/tui/components/messages/MessageRow.tsx
|
|
16696
|
-
import { jsx as
|
|
16697
|
-
var MessageRow =
|
|
16748
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
16749
|
+
var MessageRow = memo5(({ msg }) => {
|
|
16698
16750
|
if (msg.type === "status") {
|
|
16699
16751
|
const statusData = parseStatusContent(msg.content);
|
|
16700
16752
|
if (statusData) {
|
|
16701
|
-
return /* @__PURE__ */
|
|
16753
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: /* @__PURE__ */ jsx7(
|
|
16702
16754
|
InlineStatus,
|
|
16703
16755
|
{
|
|
16704
16756
|
processes: statusData.processes,
|
|
@@ -16707,147 +16759,150 @@ var MessageRow = memo4(({ msg }) => {
|
|
|
16707
16759
|
}
|
|
16708
16760
|
) }, msg.id);
|
|
16709
16761
|
}
|
|
16710
|
-
return /* @__PURE__ */
|
|
16711
|
-
/* @__PURE__ */
|
|
16712
|
-
/* @__PURE__ */
|
|
16762
|
+
return /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16763
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.dimGray, children: " \xB7 " }),
|
|
16764
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.gray, children: msg.content })
|
|
16713
16765
|
] }, msg.id);
|
|
16714
16766
|
}
|
|
16715
16767
|
if (msg.type === "thinking") {
|
|
16716
|
-
return /* @__PURE__ */
|
|
16768
|
+
return /* @__PURE__ */ jsx7(ThinkingBlock, { msg });
|
|
16717
16769
|
}
|
|
16718
16770
|
if (msg.type === "tool") {
|
|
16719
|
-
return /* @__PURE__ */
|
|
16771
|
+
return /* @__PURE__ */ jsx7(Box6, { children: /* @__PURE__ */ jsx7(ToolCard, { content: msg.content }) }, msg.id);
|
|
16720
16772
|
}
|
|
16721
16773
|
if (msg.type === "result") {
|
|
16722
16774
|
const kind = classifyResult(msg.content);
|
|
16723
16775
|
const color = kind === "success" ? THEME.primary : kind === "failure" ? THEME.red : kind === "warning" ? THEME.yellow : THEME.gray;
|
|
16724
16776
|
const { firstLine, visibleRest, hasMore } = computeResultDisplay(msg.content);
|
|
16725
16777
|
const hiddenCount = msg.content.split("\n").length - 1;
|
|
16726
|
-
return /* @__PURE__ */
|
|
16727
|
-
/* @__PURE__ */
|
|
16728
|
-
/* @__PURE__ */
|
|
16729
|
-
/* @__PURE__ */
|
|
16730
|
-
hasMore && /* @__PURE__ */
|
|
16778
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
16779
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16780
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.dimGray, children: " \u2514 " }),
|
|
16781
|
+
/* @__PURE__ */ jsx7(Text6, { color, children: firstLine }),
|
|
16782
|
+
hasMore && /* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.dimGray, children: ` [+${hiddenCount - RESULT_PREVIEW_LINES}]` })
|
|
16731
16783
|
] }),
|
|
16732
|
-
visibleRest.map((line, i) => /* @__PURE__ */
|
|
16733
|
-
/* @__PURE__ */
|
|
16734
|
-
/* @__PURE__ */
|
|
16784
|
+
visibleRest.map((line, i) => /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16785
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.dimGray, children: " " }),
|
|
16786
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.gray, children: line })
|
|
16735
16787
|
] }, i))
|
|
16736
16788
|
] }, msg.id);
|
|
16737
16789
|
}
|
|
16738
16790
|
if (msg.type === "ai" || msg.type === "assistant") {
|
|
16739
|
-
return /* @__PURE__ */
|
|
16791
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 0, children: [
|
|
16792
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16793
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.primary, children: "\u25B8 " }),
|
|
16794
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.gray, bold: true, children: "Response" })
|
|
16795
|
+
] }),
|
|
16796
|
+
/* @__PURE__ */ jsx7(Box6, { paddingLeft: 2, children: /* @__PURE__ */ jsx7(MarkdownText, { content: msg.content }) })
|
|
16797
|
+
] }, msg.id);
|
|
16740
16798
|
}
|
|
16741
16799
|
if (msg.type === "error") {
|
|
16742
16800
|
const eLines = msg.content.split("\n");
|
|
16743
16801
|
const eFirst = eLines[0] || msg.content;
|
|
16744
16802
|
const eHidden = eLines.length - 1;
|
|
16745
|
-
return /* @__PURE__ */
|
|
16746
|
-
/* @__PURE__ */
|
|
16747
|
-
/* @__PURE__ */
|
|
16748
|
-
eHidden > 0 && /* @__PURE__ */
|
|
16803
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16804
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.red, children: " \u2717 " }),
|
|
16805
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.red, children: eFirst }),
|
|
16806
|
+
eHidden > 0 && /* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.dimGray, children: ` [+${eHidden}]` })
|
|
16749
16807
|
] }) }, msg.id);
|
|
16750
16808
|
}
|
|
16751
16809
|
if (msg.type === "user") {
|
|
16752
|
-
return /* @__PURE__ */
|
|
16753
|
-
/* @__PURE__ */
|
|
16754
|
-
/* @__PURE__ */
|
|
16810
|
+
return /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16811
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.primary, children: "\u276F " }),
|
|
16812
|
+
/* @__PURE__ */ jsx7(Text6, { color: THEME.white, bold: true, children: msg.content })
|
|
16755
16813
|
] }, msg.id);
|
|
16756
16814
|
}
|
|
16757
16815
|
if (msg.type === "system") {
|
|
16758
|
-
return /* @__PURE__ */
|
|
16759
|
-
/* @__PURE__ */
|
|
16760
|
-
/* @__PURE__ */
|
|
16816
|
+
return /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16817
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.dimGray, children: " \xB7 " }),
|
|
16818
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.gray, children: msg.content })
|
|
16761
16819
|
] }, msg.id);
|
|
16762
16820
|
}
|
|
16763
|
-
return /* @__PURE__ */
|
|
16764
|
-
/* @__PURE__ */
|
|
16765
|
-
/* @__PURE__ */
|
|
16821
|
+
return /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
16822
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, color: THEME.dimGray, children: " \xB7 " }),
|
|
16823
|
+
/* @__PURE__ */ jsx7(Text6, { color: MESSAGE_STYLES.colors[msg.type] ?? THEME.gray, children: msg.content })
|
|
16766
16824
|
] }, msg.id);
|
|
16767
16825
|
});
|
|
16768
16826
|
|
|
16769
16827
|
// src/platform/tui/components/messages/BrandingHeader.tsx
|
|
16770
|
-
import { memo as
|
|
16771
|
-
import { Box as
|
|
16828
|
+
import { memo as memo7 } from "react";
|
|
16829
|
+
import { Box as Box8, Text as Text8 } from "ink";
|
|
16772
16830
|
|
|
16773
16831
|
// src/platform/tui/components/ShimmerBanner.tsx
|
|
16774
|
-
import { memo as
|
|
16775
|
-
import { Box as
|
|
16776
|
-
import { jsx as
|
|
16777
|
-
var ShimmerBanner =
|
|
16832
|
+
import { memo as memo6 } from "react";
|
|
16833
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
16834
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
16835
|
+
var ShimmerBanner = memo6(({ banner }) => {
|
|
16778
16836
|
const lines = banner.split("\n").filter((l) => l.length > 0);
|
|
16779
|
-
return /* @__PURE__ */
|
|
16837
|
+
return /* @__PURE__ */ jsx8(Box7, { flexDirection: "column", children: lines.map((line, row) => /* @__PURE__ */ jsx8(Text7, { color: HEX.primary, children: line }, row)) });
|
|
16780
16838
|
});
|
|
16781
16839
|
|
|
16782
16840
|
// src/platform/tui/components/messages/BrandingHeader.tsx
|
|
16783
|
-
import { Fragment as Fragment4, jsx as
|
|
16784
|
-
var BrandingHeader =
|
|
16841
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
16842
|
+
var BrandingHeader = memo7(({ modelName, autoApproveMode, version, showGuide = false }) => {
|
|
16785
16843
|
const autoLabel = autoApproveMode ? "ON" : "OFF";
|
|
16786
|
-
const autoColor = autoApproveMode ? THEME.primary : THEME.
|
|
16787
|
-
return /* @__PURE__ */
|
|
16788
|
-
/* @__PURE__ */
|
|
16789
|
-
/* @__PURE__ */
|
|
16790
|
-
version && /* @__PURE__ */
|
|
16791
|
-
modelName && /* @__PURE__ */
|
|
16792
|
-
"\xB7",
|
|
16793
|
-
|
|
16794
|
-
/* @__PURE__ */ jsx8(Text7, { color: THEME.gray, children: modelName })
|
|
16844
|
+
const autoColor = autoApproveMode ? THEME.primary : THEME.dimGray;
|
|
16845
|
+
return /* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", paddingBottom: 1, children: [
|
|
16846
|
+
/* @__PURE__ */ jsx9(ShimmerBanner, { banner: ASCII_BANNER }),
|
|
16847
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 1, paddingLeft: 1, children: [
|
|
16848
|
+
version && /* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: `v${version}` }),
|
|
16849
|
+
modelName && /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
16850
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "\xB7" }),
|
|
16851
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.gray, children: modelName })
|
|
16795
16852
|
] }),
|
|
16796
|
-
/* @__PURE__ */
|
|
16797
|
-
|
|
16798
|
-
|
|
16799
|
-
/* @__PURE__ */ jsx8(Text7, { color: autoColor, children: autoLabel })
|
|
16800
|
-
] })
|
|
16853
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "\xB7" }),
|
|
16854
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "Auto:" }),
|
|
16855
|
+
/* @__PURE__ */ jsx9(Text8, { color: autoColor, bold: !!autoApproveMode, children: autoLabel })
|
|
16801
16856
|
] }),
|
|
16802
|
-
showGuide && /* @__PURE__ */
|
|
16803
|
-
/* @__PURE__ */
|
|
16804
|
-
/* @__PURE__ */
|
|
16805
|
-
/* @__PURE__ */
|
|
16806
|
-
|
|
16807
|
-
"
|
|
16808
|
-
/* @__PURE__ */
|
|
16809
|
-
"/target ",
|
|
16810
|
-
"<ip>"
|
|
16811
|
-
] }),
|
|
16812
|
-
" \u2014 Set target IP or domain"
|
|
16857
|
+
showGuide && /* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", paddingTop: 1, paddingLeft: 1, children: [
|
|
16858
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "\u2500".repeat(40) }),
|
|
16859
|
+
/* @__PURE__ */ jsxs7(Box8, { flexDirection: "column", paddingTop: 0, children: [
|
|
16860
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 2, children: [
|
|
16861
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.primary, children: "\u276F" }),
|
|
16862
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.white, children: "/target <ip>" }),
|
|
16863
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "Set target IP or domain" })
|
|
16813
16864
|
] }),
|
|
16814
|
-
/* @__PURE__ */
|
|
16815
|
-
"
|
|
16816
|
-
/* @__PURE__ */
|
|
16817
|
-
"
|
|
16865
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 2, children: [
|
|
16866
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.primary, children: "\u276F" }),
|
|
16867
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.white, children: "/start" }),
|
|
16868
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: " Begin autonomous pentest" })
|
|
16818
16869
|
] }),
|
|
16819
|
-
/* @__PURE__ */
|
|
16820
|
-
"
|
|
16821
|
-
/* @__PURE__ */
|
|
16822
|
-
"
|
|
16870
|
+
/* @__PURE__ */ jsxs7(Box8, { gap: 2, children: [
|
|
16871
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.primary, children: "\u276F" }),
|
|
16872
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.white, children: "/help" }),
|
|
16873
|
+
/* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: " Show all commands" })
|
|
16823
16874
|
] }),
|
|
16824
|
-
/* @__PURE__ */
|
|
16825
|
-
/* @__PURE__ */ jsx8(Text7, { color: THEME.dimGray, children: "Or just type a task and press Enter." })
|
|
16875
|
+
/* @__PURE__ */ jsx9(Box8, { paddingTop: 1, children: /* @__PURE__ */ jsx9(Text8, { color: THEME.dimGray, children: "Or just type a task and press Enter." }) })
|
|
16826
16876
|
] })
|
|
16827
16877
|
] })
|
|
16828
16878
|
] });
|
|
16829
16879
|
});
|
|
16830
16880
|
|
|
16831
16881
|
// src/platform/tui/components/MessageList.tsx
|
|
16832
|
-
import { jsx as
|
|
16833
|
-
var
|
|
16834
|
-
|
|
16835
|
-
|
|
16836
|
-
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
|
|
16843
|
-
|
|
16844
|
-
|
|
16845
|
-
|
|
16882
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
16883
|
+
var HEADER_ITEM = { id: "__header__", type: "header" };
|
|
16884
|
+
var MessageList = memo8(({ messages, modelName, autoApproveMode, version }) => {
|
|
16885
|
+
const staticItems = [HEADER_ITEM, ...messages];
|
|
16886
|
+
return /* @__PURE__ */ jsx10(Box9, { flexDirection: "column", children: /* @__PURE__ */ jsx10(Static, { items: staticItems, children: (item) => {
|
|
16887
|
+
if (item.type === "header") {
|
|
16888
|
+
return /* @__PURE__ */ jsx10(
|
|
16889
|
+
BrandingHeader,
|
|
16890
|
+
{
|
|
16891
|
+
modelName,
|
|
16892
|
+
autoApproveMode,
|
|
16893
|
+
version,
|
|
16894
|
+
showGuide: messages.length === 0
|
|
16895
|
+
},
|
|
16896
|
+
"__header__"
|
|
16897
|
+
);
|
|
16898
|
+
}
|
|
16899
|
+
return /* @__PURE__ */ jsx10(MessageRow, { msg: item }, item.id);
|
|
16900
|
+
} }) });
|
|
16846
16901
|
});
|
|
16847
16902
|
|
|
16848
16903
|
// src/platform/tui/components/StatusDisplay.tsx
|
|
16849
|
-
import { memo as
|
|
16850
|
-
import { Box as
|
|
16904
|
+
import { memo as memo11 } from "react";
|
|
16905
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
16851
16906
|
|
|
16852
16907
|
// src/platform/tui/hooks/useStatusTimer.ts
|
|
16853
16908
|
import { useState as useState4, useEffect as useEffect6, useRef as useRef5 } from "react";
|
|
@@ -16875,12 +16930,12 @@ var useStatusTimer = (currentStatus, isProcessing) => {
|
|
|
16875
16930
|
};
|
|
16876
16931
|
|
|
16877
16932
|
// src/platform/tui/components/status/RetryView.tsx
|
|
16878
|
-
import { Box as
|
|
16933
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
16879
16934
|
|
|
16880
16935
|
// src/platform/tui/components/StarSpinner.tsx
|
|
16881
|
-
import { memo as
|
|
16882
|
-
import { Text as
|
|
16883
|
-
import { jsx as
|
|
16936
|
+
import { memo as memo9 } from "react";
|
|
16937
|
+
import { Text as Text9 } from "ink";
|
|
16938
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
16884
16939
|
var FRAMES = [
|
|
16885
16940
|
"\xB7",
|
|
16886
16941
|
"\u2726",
|
|
@@ -16897,34 +16952,34 @@ var FRAMES = [
|
|
|
16897
16952
|
"\u2727",
|
|
16898
16953
|
"\u2726"
|
|
16899
16954
|
];
|
|
16900
|
-
var StarSpinner =
|
|
16955
|
+
var StarSpinner = memo9(({ color }) => {
|
|
16901
16956
|
const tick = useAnimationTick();
|
|
16902
16957
|
const index = tick % FRAMES.length;
|
|
16903
|
-
return /* @__PURE__ */
|
|
16958
|
+
return /* @__PURE__ */ jsx11(Text9, { color: color || "yellow", children: FRAMES[index] });
|
|
16904
16959
|
});
|
|
16905
16960
|
|
|
16906
16961
|
// src/platform/tui/components/status/RetryView.tsx
|
|
16907
|
-
import { jsx as
|
|
16962
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
16908
16963
|
var RetryView = ({ retryState }) => {
|
|
16909
16964
|
const truncateError = (err) => {
|
|
16910
16965
|
return err.length > DISPLAY_LIMITS.RETRY_ERROR_PREVIEW ? err.substring(0, DISPLAY_LIMITS.RETRY_ERROR_TRUNCATED) + "..." : err;
|
|
16911
16966
|
};
|
|
16912
|
-
return /* @__PURE__ */ jsxs8(
|
|
16913
|
-
/* @__PURE__ */ jsxs8(
|
|
16914
|
-
/* @__PURE__ */
|
|
16915
|
-
/* @__PURE__ */ jsxs8(
|
|
16967
|
+
return /* @__PURE__ */ jsxs8(Box10, { flexDirection: "column", height: 2, children: [
|
|
16968
|
+
/* @__PURE__ */ jsxs8(Box10, { children: [
|
|
16969
|
+
/* @__PURE__ */ jsx12(Text10, { color: THEME.yellow, wrap: "truncate", children: /* @__PURE__ */ jsx12(StarSpinner, { color: THEME.yellow }) }),
|
|
16970
|
+
/* @__PURE__ */ jsxs8(Text10, { color: THEME.yellow, bold: true, wrap: "truncate", children: [
|
|
16916
16971
|
" \u29F3 Retry #",
|
|
16917
16972
|
retryState.attempt,
|
|
16918
16973
|
"/",
|
|
16919
16974
|
retryState.maxRetries
|
|
16920
16975
|
] }),
|
|
16921
|
-
/* @__PURE__ */ jsxs8(
|
|
16976
|
+
/* @__PURE__ */ jsxs8(Text10, { color: THEME.gray, wrap: "truncate", children: [
|
|
16922
16977
|
" \u2014 ",
|
|
16923
16978
|
retryState.countdown,
|
|
16924
16979
|
"s"
|
|
16925
16980
|
] })
|
|
16926
16981
|
] }),
|
|
16927
|
-
/* @__PURE__ */
|
|
16982
|
+
/* @__PURE__ */ jsx12(Box10, { children: /* @__PURE__ */ jsxs8(Text10, { color: THEME.gray, wrap: "truncate", children: [
|
|
16928
16983
|
" ",
|
|
16929
16984
|
truncateError(retryState.error)
|
|
16930
16985
|
] }) })
|
|
@@ -16932,12 +16987,12 @@ var RetryView = ({ retryState }) => {
|
|
|
16932
16987
|
};
|
|
16933
16988
|
|
|
16934
16989
|
// src/platform/tui/components/status/ProcessingView.tsx
|
|
16935
|
-
import { Box as
|
|
16990
|
+
import { Box as Box11, Text as Text12 } from "ink";
|
|
16936
16991
|
|
|
16937
16992
|
// src/platform/tui/components/ShimmerText.tsx
|
|
16938
|
-
import { memo as
|
|
16939
|
-
import { Text as
|
|
16940
|
-
import { jsx as
|
|
16993
|
+
import { memo as memo10 } from "react";
|
|
16994
|
+
import { Text as Text11 } from "ink";
|
|
16995
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
16941
16996
|
var WAVE_SPEED = 0.25 * (120 / ANIM_TICK_MS);
|
|
16942
16997
|
var CHAR_PHASE_GAP = 0.55;
|
|
16943
16998
|
function sinToColor(sin) {
|
|
@@ -16946,19 +17001,19 @@ function sinToColor(sin) {
|
|
|
16946
17001
|
const hex = brightness.toString(16).padStart(2, "0");
|
|
16947
17002
|
return `#${hex}${hex}${hex}`;
|
|
16948
17003
|
}
|
|
16949
|
-
var ShimmerText =
|
|
17004
|
+
var ShimmerText = memo10(({ children, bold, phase = 0 }) => {
|
|
16950
17005
|
const tick = useAnimationTick();
|
|
16951
17006
|
const globalPhase = tick * WAVE_SPEED + phase;
|
|
16952
|
-
return /* @__PURE__ */
|
|
17007
|
+
return /* @__PURE__ */ jsx13(Text11, { bold, children: Array.from(children).map((char, i) => {
|
|
16953
17008
|
const charPhase = globalPhase - i * CHAR_PHASE_GAP;
|
|
16954
17009
|
const sin = Math.sin(charPhase);
|
|
16955
17010
|
const color = sinToColor(sin);
|
|
16956
|
-
return /* @__PURE__ */
|
|
17011
|
+
return /* @__PURE__ */ jsx13(Text11, { color, children: char }, i);
|
|
16957
17012
|
}) });
|
|
16958
17013
|
});
|
|
16959
17014
|
|
|
16960
17015
|
// src/platform/tui/components/status/ProcessingView.tsx
|
|
16961
|
-
import { jsx as
|
|
17016
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
16962
17017
|
var ProcessingView = ({
|
|
16963
17018
|
statusMain,
|
|
16964
17019
|
detailText,
|
|
@@ -16977,27 +17032,27 @@ var ProcessingView = ({
|
|
|
16977
17032
|
const parenIdx = statusMain.indexOf("(");
|
|
16978
17033
|
const shimmerPart = parenIdx > -1 ? statusMain.slice(0, parenIdx).trimEnd() : statusMain;
|
|
16979
17034
|
const staticSuffix = parenIdx > -1 ? " " + statusMain.slice(parenIdx) : "";
|
|
16980
|
-
return /* @__PURE__ */ jsxs9(
|
|
16981
|
-
/* @__PURE__ */ jsxs9(
|
|
16982
|
-
/* @__PURE__ */
|
|
16983
|
-
/* @__PURE__ */
|
|
16984
|
-
/* @__PURE__ */
|
|
16985
|
-
staticSuffix ? /* @__PURE__ */
|
|
16986
|
-
/* @__PURE__ */ jsxs9(
|
|
17035
|
+
return /* @__PURE__ */ jsxs9(Box11, { flexDirection: "column", height: 2, children: [
|
|
17036
|
+
/* @__PURE__ */ jsxs9(Box11, { children: [
|
|
17037
|
+
/* @__PURE__ */ jsx14(Text12, { color, wrap: "truncate", children: /* @__PURE__ */ jsx14(StarSpinner, { color }) }),
|
|
17038
|
+
/* @__PURE__ */ jsx14(Text12, { children: " " }),
|
|
17039
|
+
/* @__PURE__ */ jsx14(ShimmerText, { bold: true, phase: 0, children: shimmerPart }),
|
|
17040
|
+
staticSuffix ? /* @__PURE__ */ jsx14(Text12, { color: THEME.dimGray, wrap: "truncate", children: staticSuffix }) : null,
|
|
17041
|
+
/* @__PURE__ */ jsxs9(Text12, { color: THEME.dimGray, wrap: "truncate", children: [
|
|
16987
17042
|
" ",
|
|
16988
17043
|
meta
|
|
16989
17044
|
] })
|
|
16990
17045
|
] }),
|
|
16991
|
-
/* @__PURE__ */
|
|
17046
|
+
/* @__PURE__ */ jsx14(Box11, { children: detailText ? /* @__PURE__ */ jsxs9(Text12, { color: THEME.dimGray, wrap: "truncate", children: [
|
|
16992
17047
|
" ",
|
|
16993
17048
|
detailText
|
|
16994
|
-
] }) : /* @__PURE__ */
|
|
17049
|
+
] }) : /* @__PURE__ */ jsx14(Text12, { children: " " }) })
|
|
16995
17050
|
] });
|
|
16996
17051
|
};
|
|
16997
17052
|
|
|
16998
17053
|
// src/platform/tui/components/StatusDisplay.tsx
|
|
16999
|
-
import { jsx as
|
|
17000
|
-
var StatusDisplay =
|
|
17054
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
17055
|
+
var StatusDisplay = memo11(({
|
|
17001
17056
|
retryState,
|
|
17002
17057
|
isProcessing,
|
|
17003
17058
|
currentStatus,
|
|
@@ -17007,12 +17062,12 @@ var StatusDisplay = memo10(({
|
|
|
17007
17062
|
const isWaitingForInput = inputRequest?.status === "active";
|
|
17008
17063
|
const statusElapsed = useStatusTimer(currentStatus, isProcessing && !isWaitingForInput);
|
|
17009
17064
|
if (retryState && retryState.status === "retrying") {
|
|
17010
|
-
return /* @__PURE__ */
|
|
17065
|
+
return /* @__PURE__ */ jsx15(RetryView, { retryState });
|
|
17011
17066
|
}
|
|
17012
17067
|
if (isProcessing && isWaitingForInput) {
|
|
17013
|
-
return /* @__PURE__ */ jsxs10(
|
|
17014
|
-
/* @__PURE__ */
|
|
17015
|
-
/* @__PURE__ */
|
|
17068
|
+
return /* @__PURE__ */ jsxs10(Box12, { flexDirection: "column", height: 2, children: [
|
|
17069
|
+
/* @__PURE__ */ jsx15(Text13, { children: " " }),
|
|
17070
|
+
/* @__PURE__ */ jsx15(Text13, { children: " " })
|
|
17016
17071
|
] });
|
|
17017
17072
|
}
|
|
17018
17073
|
if (isProcessing) {
|
|
@@ -17020,7 +17075,7 @@ var StatusDisplay = memo10(({
|
|
|
17020
17075
|
const statusLines = currentStatus ? currentStatus.split("\n").filter(Boolean) : [];
|
|
17021
17076
|
const statusMain = statusLines[0] || "Processing...";
|
|
17022
17077
|
const detailText = isThinkingStatus && statusLines.length > 1 ? statusLines[statusLines.length - 1].slice(0, 120) : "";
|
|
17023
|
-
return /* @__PURE__ */
|
|
17078
|
+
return /* @__PURE__ */ jsx15(
|
|
17024
17079
|
ProcessingView,
|
|
17025
17080
|
{
|
|
17026
17081
|
statusMain,
|
|
@@ -17031,46 +17086,46 @@ var StatusDisplay = memo10(({
|
|
|
17031
17086
|
}
|
|
17032
17087
|
);
|
|
17033
17088
|
}
|
|
17034
|
-
return /* @__PURE__ */ jsxs10(
|
|
17035
|
-
/* @__PURE__ */
|
|
17036
|
-
/* @__PURE__ */
|
|
17089
|
+
return /* @__PURE__ */ jsxs10(Box12, { flexDirection: "column", height: 2, children: [
|
|
17090
|
+
/* @__PURE__ */ jsx15(Text13, { children: " " }),
|
|
17091
|
+
/* @__PURE__ */ jsx15(Text13, { children: " " })
|
|
17037
17092
|
] });
|
|
17038
17093
|
});
|
|
17039
17094
|
|
|
17040
17095
|
// src/platform/tui/components/ChatInput.tsx
|
|
17041
|
-
import { useMemo, useCallback as useCallback7, useRef as useRef6, memo as
|
|
17042
|
-
import { Box as
|
|
17096
|
+
import { useMemo, useCallback as useCallback7, useRef as useRef6, memo as memo12, useState as useState5, useEffect as useEffect7 } from "react";
|
|
17097
|
+
import { Box as Box16, Text as Text17, useInput as useInput2 } from "ink";
|
|
17043
17098
|
|
|
17044
17099
|
// src/platform/tui/components/input/AutocompletePreview.tsx
|
|
17045
|
-
import { Box as
|
|
17046
|
-
import { jsx as
|
|
17100
|
+
import { Box as Box13, Text as Text14 } from "ink";
|
|
17101
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
17047
17102
|
var AutocompletePreview = ({
|
|
17048
17103
|
suggestions,
|
|
17049
17104
|
clampedIdx
|
|
17050
17105
|
}) => {
|
|
17051
|
-
return /* @__PURE__ */
|
|
17106
|
+
return /* @__PURE__ */ jsx16(Box13, { flexDirection: "column", paddingX: 1, children: suggestions.map((cmd, i) => {
|
|
17052
17107
|
const isSelected = i === clampedIdx;
|
|
17053
17108
|
const argsText = cmd.args ? ` ${cmd.args}` : "";
|
|
17054
|
-
return /* @__PURE__ */ jsxs11(
|
|
17055
|
-
/* @__PURE__ */
|
|
17056
|
-
/* @__PURE__ */ jsxs11(
|
|
17109
|
+
return /* @__PURE__ */ jsxs11(Box13, { children: [
|
|
17110
|
+
/* @__PURE__ */ jsx16(Text14, { color: isSelected ? THEME.primary : THEME.dimGray, children: isSelected ? " \u276F " : " " }),
|
|
17111
|
+
/* @__PURE__ */ jsxs11(Text14, { color: isSelected ? THEME.white : THEME.gray, bold: isSelected, children: [
|
|
17057
17112
|
"/",
|
|
17058
17113
|
cmd.name
|
|
17059
17114
|
] }),
|
|
17060
|
-
/* @__PURE__ */
|
|
17061
|
-
/* @__PURE__ */ jsxs11(
|
|
17115
|
+
/* @__PURE__ */ jsx16(Text14, { dimColor: true, color: THEME.gray, children: argsText }),
|
|
17116
|
+
/* @__PURE__ */ jsxs11(Text14, { dimColor: true, color: THEME.dimGray, children: [
|
|
17062
17117
|
" \u2014 ",
|
|
17063
17118
|
cmd.description
|
|
17064
17119
|
] }),
|
|
17065
|
-
isSelected && cmd.alias && /* @__PURE__ */
|
|
17120
|
+
isSelected && cmd.alias && /* @__PURE__ */ jsx16(Text14, { dimColor: true, color: THEME.dimGray, children: ` (/${cmd.alias})` })
|
|
17066
17121
|
] }, cmd.name);
|
|
17067
17122
|
}) });
|
|
17068
17123
|
};
|
|
17069
17124
|
|
|
17070
17125
|
// src/platform/tui/components/input/SecretInputArea.tsx
|
|
17071
|
-
import { Box as
|
|
17126
|
+
import { Box as Box14, Text as Text15, useStdout } from "ink";
|
|
17072
17127
|
import TextInput from "ink-text-input";
|
|
17073
|
-
import { jsx as
|
|
17128
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
17074
17129
|
var OUTER_PADDING = 2;
|
|
17075
17130
|
var SecretInputArea = ({
|
|
17076
17131
|
inputRequest,
|
|
@@ -17081,11 +17136,11 @@ var SecretInputArea = ({
|
|
|
17081
17136
|
const { stdout } = useStdout();
|
|
17082
17137
|
const borderWidth = Math.max(10, (stdout?.columns ?? 80) - OUTER_PADDING);
|
|
17083
17138
|
const borderLine = "\u2501".repeat(borderWidth);
|
|
17084
|
-
return /* @__PURE__ */ jsxs12(
|
|
17085
|
-
/* @__PURE__ */
|
|
17086
|
-
/* @__PURE__ */ jsxs12(
|
|
17087
|
-
/* @__PURE__ */
|
|
17088
|
-
/* @__PURE__ */
|
|
17139
|
+
return /* @__PURE__ */ jsxs12(Box14, { flexDirection: "column", children: [
|
|
17140
|
+
/* @__PURE__ */ jsx17(Box14, { children: /* @__PURE__ */ jsx17(Text15, { color: THEME.yellow, children: borderLine }) }),
|
|
17141
|
+
/* @__PURE__ */ jsxs12(Box14, { paddingX: 1, children: [
|
|
17142
|
+
/* @__PURE__ */ jsx17(Text15, { color: THEME.yellow, bold: true, children: "\u25B8 " }),
|
|
17143
|
+
/* @__PURE__ */ jsx17(
|
|
17089
17144
|
TextInput,
|
|
17090
17145
|
{
|
|
17091
17146
|
value: secretInput,
|
|
@@ -17096,14 +17151,14 @@ var SecretInputArea = ({
|
|
|
17096
17151
|
}
|
|
17097
17152
|
)
|
|
17098
17153
|
] }),
|
|
17099
|
-
/* @__PURE__ */
|
|
17154
|
+
/* @__PURE__ */ jsx17(Box14, { children: /* @__PURE__ */ jsx17(Text15, { color: THEME.yellow, children: borderLine }) })
|
|
17100
17155
|
] });
|
|
17101
17156
|
};
|
|
17102
17157
|
|
|
17103
17158
|
// src/platform/tui/components/input/NormalInputArea.tsx
|
|
17104
|
-
import { Box as
|
|
17159
|
+
import { Box as Box15, Text as Text16, useStdout as useStdout2 } from "ink";
|
|
17105
17160
|
import TextInput2 from "ink-text-input";
|
|
17106
|
-
import { jsx as
|
|
17161
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
17107
17162
|
var OUTER_PADDING2 = 2;
|
|
17108
17163
|
var NormalInputArea = ({
|
|
17109
17164
|
inputKey,
|
|
@@ -17115,11 +17170,11 @@ var NormalInputArea = ({
|
|
|
17115
17170
|
const { stdout } = useStdout2();
|
|
17116
17171
|
const borderWidth = Math.max(10, (stdout?.columns ?? 80) - OUTER_PADDING2);
|
|
17117
17172
|
const borderLine = "\u2500".repeat(borderWidth);
|
|
17118
|
-
return /* @__PURE__ */ jsxs13(
|
|
17119
|
-
/* @__PURE__ */
|
|
17120
|
-
/* @__PURE__ */ jsxs13(
|
|
17121
|
-
/* @__PURE__ */
|
|
17122
|
-
/* @__PURE__ */
|
|
17173
|
+
return /* @__PURE__ */ jsxs13(Box15, { flexDirection: "column", children: [
|
|
17174
|
+
/* @__PURE__ */ jsx18(Box15, { children: /* @__PURE__ */ jsx18(Text16, { dimColor: true, color: THEME.dimGray, children: borderLine }) }),
|
|
17175
|
+
/* @__PURE__ */ jsxs13(Box15, { paddingX: 1, children: [
|
|
17176
|
+
/* @__PURE__ */ jsx18(Text16, { color: THEME.primary, children: "\u276F " }),
|
|
17177
|
+
/* @__PURE__ */ jsx18(
|
|
17123
17178
|
TextInput2,
|
|
17124
17179
|
{
|
|
17125
17180
|
value,
|
|
@@ -17130,14 +17185,14 @@ var NormalInputArea = ({
|
|
|
17130
17185
|
inputKey
|
|
17131
17186
|
)
|
|
17132
17187
|
] }),
|
|
17133
|
-
/* @__PURE__ */
|
|
17188
|
+
/* @__PURE__ */ jsx18(Box15, { children: /* @__PURE__ */ jsx18(Text16, { dimColor: true, color: THEME.dimGray, children: borderLine }) })
|
|
17134
17189
|
] });
|
|
17135
17190
|
};
|
|
17136
17191
|
|
|
17137
17192
|
// src/platform/tui/components/ChatInput.tsx
|
|
17138
|
-
import { jsx as
|
|
17193
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
17139
17194
|
var MAX_SUGGESTIONS = 6;
|
|
17140
|
-
var ChatInput =
|
|
17195
|
+
var ChatInput = memo12(({
|
|
17141
17196
|
value,
|
|
17142
17197
|
onChange,
|
|
17143
17198
|
onSubmit,
|
|
@@ -17234,8 +17289,8 @@ var ChatInput = memo11(({
|
|
|
17234
17289
|
completeCommand(selectedIdxRef.current);
|
|
17235
17290
|
}
|
|
17236
17291
|
}, [completeCommand]));
|
|
17237
|
-
return /* @__PURE__ */ jsxs14(
|
|
17238
|
-
showPreview && /* @__PURE__ */
|
|
17292
|
+
return /* @__PURE__ */ jsxs14(Box16, { flexDirection: "column", children: [
|
|
17293
|
+
showPreview && /* @__PURE__ */ jsx19(
|
|
17239
17294
|
AutocompletePreview,
|
|
17240
17295
|
{
|
|
17241
17296
|
suggestions,
|
|
@@ -17244,7 +17299,7 @@ var ChatInput = memo11(({
|
|
|
17244
17299
|
),
|
|
17245
17300
|
inputRequest.status === "active" ? (
|
|
17246
17301
|
/* Active input request — yellow top/bottom border */
|
|
17247
|
-
/* @__PURE__ */
|
|
17302
|
+
/* @__PURE__ */ jsx19(
|
|
17248
17303
|
SecretInputArea,
|
|
17249
17304
|
{
|
|
17250
17305
|
inputRequest,
|
|
@@ -17255,7 +17310,7 @@ var ChatInput = memo11(({
|
|
|
17255
17310
|
)
|
|
17256
17311
|
) : (
|
|
17257
17312
|
/* Normal input — dim top/bottom border */
|
|
17258
|
-
/* @__PURE__ */
|
|
17313
|
+
/* @__PURE__ */ jsx19(
|
|
17259
17314
|
NormalInputArea,
|
|
17260
17315
|
{
|
|
17261
17316
|
inputKey,
|
|
@@ -17266,14 +17321,14 @@ var ChatInput = memo11(({
|
|
|
17266
17321
|
}
|
|
17267
17322
|
)
|
|
17268
17323
|
),
|
|
17269
|
-
pastedHint && /* @__PURE__ */
|
|
17324
|
+
pastedHint && /* @__PURE__ */ jsx19(Box16, { paddingX: 2, children: /* @__PURE__ */ jsx19(Text17, { dimColor: true, color: THEME.dimGray, children: pastedHint }) })
|
|
17270
17325
|
] });
|
|
17271
17326
|
});
|
|
17272
17327
|
|
|
17273
17328
|
// src/platform/tui/components/footer.tsx
|
|
17274
|
-
import { memo as
|
|
17275
|
-
import { Box as
|
|
17276
|
-
import { jsx as
|
|
17329
|
+
import { memo as memo13 } from "react";
|
|
17330
|
+
import { Box as Box17, Text as Text18 } from "ink";
|
|
17331
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
17277
17332
|
var CTX_WARN_THRESHOLD = 0.8;
|
|
17278
17333
|
var MAX_CONTEXT_TOKENS = LLM_LIMITS.streamMaxTokens;
|
|
17279
17334
|
var formatElapsed = (totalSeconds) => {
|
|
@@ -17286,55 +17341,55 @@ var formatElapsed = (totalSeconds) => {
|
|
|
17286
17341
|
}
|
|
17287
17342
|
return `${minutes}:${pad(seconds)}`;
|
|
17288
17343
|
};
|
|
17289
|
-
var Footer =
|
|
17344
|
+
var Footer = memo13(({ phase, targets, findings, todo, elapsedTime, isProcessing, totalTokens, turnCount }) => {
|
|
17290
17345
|
const ctxPct = totalTokens > 0 ? Math.round(totalTokens / MAX_CONTEXT_TOKENS * 100) : 0;
|
|
17291
17346
|
const ctxColor = ctxPct >= CTX_WARN_THRESHOLD * 100 ? THEME.yellow : THEME.dimGray;
|
|
17292
17347
|
return /* @__PURE__ */ jsxs15(
|
|
17293
|
-
|
|
17348
|
+
Box17,
|
|
17294
17349
|
{
|
|
17295
17350
|
width: "100%",
|
|
17296
17351
|
paddingX: 1,
|
|
17297
17352
|
justifyContent: "space-between",
|
|
17298
17353
|
overflow: "hidden",
|
|
17299
17354
|
children: [
|
|
17300
|
-
/* @__PURE__ */ jsxs15(
|
|
17301
|
-
/* @__PURE__ */ jsxs15(
|
|
17355
|
+
/* @__PURE__ */ jsxs15(Box17, { gap: 2, children: [
|
|
17356
|
+
/* @__PURE__ */ jsxs15(Text18, { color: THEME.gray, children: [
|
|
17302
17357
|
"Phase: ",
|
|
17303
|
-
/* @__PURE__ */
|
|
17358
|
+
/* @__PURE__ */ jsx20(Text18, { color: THEME.white, children: phase })
|
|
17304
17359
|
] }),
|
|
17305
|
-
/* @__PURE__ */ jsxs15(
|
|
17360
|
+
/* @__PURE__ */ jsxs15(Text18, { color: THEME.gray, children: [
|
|
17306
17361
|
"Targets: ",
|
|
17307
|
-
/* @__PURE__ */
|
|
17362
|
+
/* @__PURE__ */ jsx20(Text18, { color: THEME.white, children: targets })
|
|
17308
17363
|
] }),
|
|
17309
|
-
/* @__PURE__ */ jsxs15(
|
|
17364
|
+
/* @__PURE__ */ jsxs15(Text18, { color: THEME.gray, children: [
|
|
17310
17365
|
"Findings: ",
|
|
17311
|
-
/* @__PURE__ */
|
|
17366
|
+
/* @__PURE__ */ jsx20(Text18, { color: THEME.white, children: findings })
|
|
17312
17367
|
] }),
|
|
17313
|
-
/* @__PURE__ */ jsxs15(
|
|
17368
|
+
/* @__PURE__ */ jsxs15(Text18, { color: THEME.gray, children: [
|
|
17314
17369
|
"Tasks: ",
|
|
17315
|
-
/* @__PURE__ */
|
|
17370
|
+
/* @__PURE__ */ jsx20(Text18, { color: THEME.white, children: todo })
|
|
17316
17371
|
] })
|
|
17317
17372
|
] }),
|
|
17318
|
-
/* @__PURE__ */ jsxs15(
|
|
17319
|
-
isProcessing ? /* @__PURE__ */ jsxs15(
|
|
17320
|
-
/* @__PURE__ */
|
|
17321
|
-
/* @__PURE__ */
|
|
17322
|
-
] }) : /* @__PURE__ */
|
|
17323
|
-
turnCount > 0 && /* @__PURE__ */ jsxs15(
|
|
17373
|
+
/* @__PURE__ */ jsxs15(Box17, { gap: 2, children: [
|
|
17374
|
+
isProcessing ? /* @__PURE__ */ jsxs15(Box17, { gap: 1, children: [
|
|
17375
|
+
/* @__PURE__ */ jsx20(Text18, { dimColor: true, color: THEME.dimGray, children: "[ESC] abort" }),
|
|
17376
|
+
/* @__PURE__ */ jsx20(Text18, { dimColor: true, color: THEME.dimGray, children: "[^C\xD72] exit" })
|
|
17377
|
+
] }) : /* @__PURE__ */ jsx20(Text18, { dimColor: true, color: THEME.dimGray, children: "[/help] commands" }),
|
|
17378
|
+
turnCount > 0 && /* @__PURE__ */ jsxs15(Text18, { dimColor: true, color: THEME.dimGray, children: [
|
|
17324
17379
|
"turn:",
|
|
17325
17380
|
turnCount
|
|
17326
17381
|
] }),
|
|
17327
|
-
totalTokens > 0 && /* @__PURE__ */ jsxs15(
|
|
17382
|
+
totalTokens > 0 && /* @__PURE__ */ jsxs15(Text18, { dimColor: true, color: ctxColor, children: [
|
|
17328
17383
|
"ctx:",
|
|
17329
17384
|
ctxPct,
|
|
17330
17385
|
"%"
|
|
17331
17386
|
] }),
|
|
17332
|
-
totalTokens > 0 && /* @__PURE__ */ jsxs15(
|
|
17387
|
+
totalTokens > 0 && /* @__PURE__ */ jsxs15(Text18, { dimColor: true, color: THEME.dimGray, children: [
|
|
17333
17388
|
"\u2191",
|
|
17334
17389
|
formatTokens(totalTokens)
|
|
17335
17390
|
] }),
|
|
17336
|
-
/* @__PURE__ */
|
|
17337
|
-
/* @__PURE__ */
|
|
17391
|
+
/* @__PURE__ */ jsx20(Text18, { color: isProcessing ? THEME.primary : THEME.gray, children: isProcessing ? "Running " : "Idle " }),
|
|
17392
|
+
/* @__PURE__ */ jsx20(Text18, { color: THEME.white, children: formatElapsed(elapsedTime) })
|
|
17338
17393
|
] })
|
|
17339
17394
|
]
|
|
17340
17395
|
}
|
|
@@ -17343,15 +17398,15 @@ var Footer = memo12(({ phase, targets, findings, todo, elapsedTime, isProcessing
|
|
|
17343
17398
|
var footer_default = Footer;
|
|
17344
17399
|
|
|
17345
17400
|
// src/platform/tui/components/Modal.tsx
|
|
17346
|
-
import { useMemo as useMemo2, memo as
|
|
17347
|
-
import { Box as
|
|
17348
|
-
import { jsx as
|
|
17401
|
+
import { useMemo as useMemo2, memo as memo14, useCallback as useCallback8, useRef as useRef7 } from "react";
|
|
17402
|
+
import { Box as Box18, Text as Text19, useStdout as useStdout3, useInput as useInput3 } from "ink";
|
|
17403
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
17349
17404
|
var MODAL_TITLES = {
|
|
17350
17405
|
findings: "\u25C8 FINDINGS \u25C8",
|
|
17351
17406
|
graph: "\u25C8 ATTACK GRAPH \u25C8",
|
|
17352
17407
|
help: "\u25C8 COMMANDS \u25C8"
|
|
17353
17408
|
};
|
|
17354
|
-
var Modal =
|
|
17409
|
+
var Modal = memo14(({
|
|
17355
17410
|
type,
|
|
17356
17411
|
content,
|
|
17357
17412
|
scrollOffset,
|
|
@@ -17390,19 +17445,19 @@ var Modal = memo13(({
|
|
|
17390
17445
|
const scrollbarHeight = Math.max(1, Math.floor(maxHeight * (maxHeight / Math.max(totalLines, 1))));
|
|
17391
17446
|
const scrollbarPosition = totalLines > maxHeight ? Math.floor(scrollOffset / (totalLines - maxHeight) * (maxHeight - scrollbarHeight)) : 0;
|
|
17392
17447
|
return /* @__PURE__ */ jsxs16(
|
|
17393
|
-
|
|
17448
|
+
Box18,
|
|
17394
17449
|
{
|
|
17395
17450
|
flexDirection: "column",
|
|
17396
17451
|
width: terminalWidth,
|
|
17397
17452
|
height: terminalHeight,
|
|
17398
17453
|
children: [
|
|
17399
|
-
/* @__PURE__ */
|
|
17454
|
+
/* @__PURE__ */ jsx21(Box18, { justifyContent: "center", marginBottom: 0, children: /* @__PURE__ */ jsx21(Text19, { color: THEME.cyan, bold: true, children: (() => {
|
|
17400
17455
|
const title = MODAL_TITLES[type];
|
|
17401
17456
|
const sideWidth = Math.max(3, Math.floor((terminalWidth - title.length - 2) / 2));
|
|
17402
17457
|
return `${"\u2500".repeat(sideWidth)} ${title} ${"\u2500".repeat(sideWidth)}`;
|
|
17403
17458
|
})() }) }),
|
|
17404
|
-
/* @__PURE__ */
|
|
17405
|
-
|
|
17459
|
+
/* @__PURE__ */ jsx21(
|
|
17460
|
+
Box18,
|
|
17406
17461
|
{
|
|
17407
17462
|
flexDirection: "column",
|
|
17408
17463
|
borderStyle: "round",
|
|
@@ -17411,17 +17466,17 @@ var Modal = memo13(({
|
|
|
17411
17466
|
flexGrow: 1,
|
|
17412
17467
|
children: visibleLines.map((line, i) => {
|
|
17413
17468
|
const showScrollbar = totalLines > maxHeight && i >= scrollbarPosition && i < scrollbarPosition + scrollbarHeight;
|
|
17414
|
-
return /* @__PURE__ */ jsxs16(
|
|
17415
|
-
/* @__PURE__ */
|
|
17416
|
-
/* @__PURE__ */
|
|
17417
|
-
totalLines > maxHeight && /* @__PURE__ */
|
|
17469
|
+
return /* @__PURE__ */ jsxs16(Box18, { children: [
|
|
17470
|
+
/* @__PURE__ */ jsx21(Text19, { color: THEME.white, wrap: "truncate", children: line }),
|
|
17471
|
+
/* @__PURE__ */ jsx21(Box18, { flexGrow: 1 }),
|
|
17472
|
+
totalLines > maxHeight && /* @__PURE__ */ jsx21(Text19, { color: showScrollbar ? THEME.cyan : THEME.dimGray, children: showScrollbar ? "\u2588" : "\u2502" })
|
|
17418
17473
|
] }, i);
|
|
17419
17474
|
})
|
|
17420
17475
|
}
|
|
17421
17476
|
),
|
|
17422
|
-
/* @__PURE__ */ jsxs16(
|
|
17423
|
-
/* @__PURE__ */
|
|
17424
|
-
/* @__PURE__ */ jsxs16(
|
|
17477
|
+
/* @__PURE__ */ jsxs16(Box18, { justifyContent: "space-between", paddingX: 1, children: [
|
|
17478
|
+
/* @__PURE__ */ jsx21(Text19, { dimColor: true, color: THEME.gray, children: "\u2191\u2193/jk: scroll | g/G: top/bottom | ESC/q: close" }),
|
|
17479
|
+
/* @__PURE__ */ jsxs16(Text19, { dimColor: true, color: THEME.cyan, children: [
|
|
17425
17480
|
startLine,
|
|
17426
17481
|
"-",
|
|
17427
17482
|
endLine,
|
|
@@ -17435,8 +17490,8 @@ var Modal = memo13(({
|
|
|
17435
17490
|
});
|
|
17436
17491
|
|
|
17437
17492
|
// src/platform/tui/components/app/bottom-region.tsx
|
|
17438
|
-
import { Box as
|
|
17439
|
-
import { jsx as
|
|
17493
|
+
import { Box as Box19 } from "ink";
|
|
17494
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
17440
17495
|
var BottomRegion = ({
|
|
17441
17496
|
input,
|
|
17442
17497
|
setInput,
|
|
@@ -17460,8 +17515,8 @@ var BottomRegion = ({
|
|
|
17460
17515
|
const suggestionCount = isSlashMode && !hasArgs && inputRequest.status !== "active" ? Math.min(getMatchingCommands(partialCmd).length, MAX_SUGGESTIONS) : 0;
|
|
17461
17516
|
const previewHeight = suggestionCount;
|
|
17462
17517
|
const bottomMinHeight = 7;
|
|
17463
|
-
return /* @__PURE__ */ jsxs17(
|
|
17464
|
-
/* @__PURE__ */
|
|
17518
|
+
return /* @__PURE__ */ jsxs17(Box19, { flexDirection: "column", minHeight: bottomMinHeight, children: [
|
|
17519
|
+
/* @__PURE__ */ jsx22(
|
|
17465
17520
|
StatusDisplay,
|
|
17466
17521
|
{
|
|
17467
17522
|
retryState,
|
|
@@ -17471,7 +17526,7 @@ var BottomRegion = ({
|
|
|
17471
17526
|
inputRequest
|
|
17472
17527
|
}
|
|
17473
17528
|
),
|
|
17474
|
-
/* @__PURE__ */
|
|
17529
|
+
/* @__PURE__ */ jsx22(
|
|
17475
17530
|
ChatInput,
|
|
17476
17531
|
{
|
|
17477
17532
|
value: input,
|
|
@@ -17484,7 +17539,7 @@ var BottomRegion = ({
|
|
|
17484
17539
|
onSecretSubmit: handleSecretSubmit
|
|
17485
17540
|
}
|
|
17486
17541
|
),
|
|
17487
|
-
/* @__PURE__ */
|
|
17542
|
+
/* @__PURE__ */ jsx22(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx22(
|
|
17488
17543
|
footer_default,
|
|
17489
17544
|
{
|
|
17490
17545
|
phase: stats.phase,
|
|
@@ -17501,7 +17556,7 @@ var BottomRegion = ({
|
|
|
17501
17556
|
};
|
|
17502
17557
|
|
|
17503
17558
|
// src/platform/tui/app.tsx
|
|
17504
|
-
import { jsx as
|
|
17559
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
17505
17560
|
var MODEL_NAME = getModel() || DEFAULT_MODEL;
|
|
17506
17561
|
var App = ({ autoApprove = false, target }) => {
|
|
17507
17562
|
const { exit } = useApp();
|
|
@@ -17528,7 +17583,9 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17528
17583
|
abort,
|
|
17529
17584
|
cancelInputRequest,
|
|
17530
17585
|
addMessage,
|
|
17531
|
-
refreshStats
|
|
17586
|
+
refreshStats,
|
|
17587
|
+
liveReasoning,
|
|
17588
|
+
isReasoning
|
|
17532
17589
|
} = useAgent(autoApproveMode, target);
|
|
17533
17590
|
const isProcessingRef = useRef8(isProcessing);
|
|
17534
17591
|
isProcessingRef.current = isProcessing;
|
|
@@ -17552,7 +17609,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17552
17609
|
const handleModalScroll = useCallback9((delta) => {
|
|
17553
17610
|
setModal((prev) => {
|
|
17554
17611
|
const lines = prev.content.split("\n");
|
|
17555
|
-
const maxHeight = (stdout?.rows ??
|
|
17612
|
+
const maxHeight = (stdout?.rows ?? TUI_DISPLAY_LIMITS.TERMINAL_DEFAULT_ROWS) - TUI_DISPLAY_LIMITS.MODAL_CHROME_HEIGHT;
|
|
17556
17613
|
const maxScroll = Math.max(0, lines.length - maxHeight);
|
|
17557
17614
|
const newOffset = Math.max(0, Math.min(maxScroll, prev.scrollOffset + delta));
|
|
17558
17615
|
return { ...prev, scrollOffset: newOffset };
|
|
@@ -17591,7 +17648,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17591
17648
|
await handleCommand(cmd, args);
|
|
17592
17649
|
} else if (isProcessingRef.current) {
|
|
17593
17650
|
agent.enqueueUserInput(trimmed);
|
|
17594
|
-
addMessage("system",
|
|
17651
|
+
addMessage("system", UI_MESSAGES.QUEUED);
|
|
17595
17652
|
} else {
|
|
17596
17653
|
await executeTask(trimmed);
|
|
17597
17654
|
}
|
|
@@ -17599,8 +17656,8 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17599
17656
|
const handleSecretSubmit = useCallback9((value) => {
|
|
17600
17657
|
const ir = inputRequestRef.current;
|
|
17601
17658
|
if (ir.status !== "active") return;
|
|
17602
|
-
const displayText = ir.isPassword ? "\u2022".repeat(Math.min(value.length,
|
|
17603
|
-
addMessage("system",
|
|
17659
|
+
const displayText = ir.isPassword ? "\u2022".repeat(Math.min(value.length, TUI_DISPLAY_LIMITS.PASSWORD_MASK_MAX)) : value;
|
|
17660
|
+
addMessage("system", `${UI_MESSAGES.SECRET_PREFIX}${displayText}`);
|
|
17604
17661
|
ir.resolve(value);
|
|
17605
17662
|
setInputRequest({ status: "inactive" });
|
|
17606
17663
|
setSecretInput("");
|
|
@@ -17617,7 +17674,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17617
17674
|
clearInput
|
|
17618
17675
|
});
|
|
17619
17676
|
if (modal.type) {
|
|
17620
|
-
return /* @__PURE__ */
|
|
17677
|
+
return /* @__PURE__ */ jsx23(Box20, { flexDirection: "column", paddingX: 1, width: terminalWidth, children: /* @__PURE__ */ jsx23(
|
|
17621
17678
|
Modal,
|
|
17622
17679
|
{
|
|
17623
17680
|
type: modal.type,
|
|
@@ -17628,8 +17685,8 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17628
17685
|
}
|
|
17629
17686
|
) });
|
|
17630
17687
|
}
|
|
17631
|
-
return /* @__PURE__ */ jsxs18(
|
|
17632
|
-
/* @__PURE__ */
|
|
17688
|
+
return /* @__PURE__ */ jsxs18(Box20, { flexDirection: "column", width: terminalWidth, children: [
|
|
17689
|
+
/* @__PURE__ */ jsx23(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx23(
|
|
17633
17690
|
MessageList,
|
|
17634
17691
|
{
|
|
17635
17692
|
messages,
|
|
@@ -17638,7 +17695,14 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17638
17695
|
version: APP_VERSION
|
|
17639
17696
|
}
|
|
17640
17697
|
) }),
|
|
17641
|
-
/* @__PURE__ */
|
|
17698
|
+
/* @__PURE__ */ jsx23(
|
|
17699
|
+
LiveReasoningPanel,
|
|
17700
|
+
{
|
|
17701
|
+
content: liveReasoning,
|
|
17702
|
+
isReasoning
|
|
17703
|
+
}
|
|
17704
|
+
),
|
|
17705
|
+
/* @__PURE__ */ jsx23(
|
|
17642
17706
|
BottomRegion,
|
|
17643
17707
|
{
|
|
17644
17708
|
input,
|
|
@@ -17663,7 +17727,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
17663
17727
|
var app_default = App;
|
|
17664
17728
|
|
|
17665
17729
|
// src/platform/tui/cli/commands/interactive.tsx
|
|
17666
|
-
import { jsx as
|
|
17730
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
17667
17731
|
async function interactiveAction(options) {
|
|
17668
17732
|
const { dangerouslySkipPermissions: skipPermissions = false, target } = options;
|
|
17669
17733
|
console.clear();
|
|
@@ -17672,7 +17736,7 @@ async function interactiveAction(options) {
|
|
|
17672
17736
|
console.log(chalk.hex(HEX.red)("[!] All tool executions will be auto-approved!\n"));
|
|
17673
17737
|
}
|
|
17674
17738
|
const { waitUntilExit } = render(
|
|
17675
|
-
/* @__PURE__ */
|
|
17739
|
+
/* @__PURE__ */ jsx24(AnimationProvider, { children: /* @__PURE__ */ jsx24(
|
|
17676
17740
|
app_default,
|
|
17677
17741
|
{
|
|
17678
17742
|
autoApprove: skipPermissions,
|