@nathapp/nax 0.92.6 → 0.92.7
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/nax.js +627 -254
- package/package.json +2 -2
package/dist/nax.js
CHANGED
|
@@ -14955,7 +14955,7 @@ async function openNativeSession(state, name, opts) {
|
|
|
14955
14955
|
retainOnClose: opts.retainOnClose === true,
|
|
14956
14956
|
transcriptArchive: opts.transcriptArchive
|
|
14957
14957
|
});
|
|
14958
|
-
state.timeouts.set(name, opts.timeoutSeconds);
|
|
14958
|
+
state.timeouts.set(name, opts.noTurnDeadline === true ? null : opts.timeoutSeconds);
|
|
14959
14959
|
state.scratchpadRoots.set(name, opts.workdir);
|
|
14960
14960
|
if (opts.transcriptOwner !== undefined)
|
|
14961
14961
|
state.transcriptOwners.set(name, opts.transcriptOwner);
|
|
@@ -24392,6 +24392,11 @@ var init_stream_complete = () => {};
|
|
|
24392
24392
|
|
|
24393
24393
|
// ../nax-agent/src/native/session-adapter.ts
|
|
24394
24394
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
24395
|
+
function recordedTurnBudgetSeconds(recorded) {
|
|
24396
|
+
if (recorded === null)
|
|
24397
|
+
return;
|
|
24398
|
+
return recorded ?? FALLBACK_TURN_TIMEOUT_SECONDS;
|
|
24399
|
+
}
|
|
24395
24400
|
function perTurnDeps(opts) {
|
|
24396
24401
|
return {
|
|
24397
24402
|
...opts.loopHandlers !== undefined ? { loopHandlers: opts.loopHandlers } : {},
|
|
@@ -24477,9 +24482,10 @@ class NativeSessionAdapter {
|
|
|
24477
24482
|
fallbackTimeoutSeconds: FALLBACK_TURN_TIMEOUT_SECONDS
|
|
24478
24483
|
});
|
|
24479
24484
|
}
|
|
24480
|
-
const
|
|
24485
|
+
const budgetSeconds = recordedTurnBudgetSeconds(storedTimeoutSeconds);
|
|
24486
|
+
const timeoutSeconds = budgetSeconds ?? 0;
|
|
24481
24487
|
const instructionInteraction = createInstructionInteraction(this.state.repositoryInstructions.get(handle.id), opts.interactionHandler);
|
|
24482
|
-
const deadline = createTurnDeadline(
|
|
24488
|
+
const deadline = createTurnDeadline(budgetSeconds, () => _adapterDeps.now());
|
|
24483
24489
|
const hooks = this.state.streamHooks.get(handle.id);
|
|
24484
24490
|
const callId = randomUUID13();
|
|
24485
24491
|
const owner = this.state.transcriptOwners.get(handle.id);
|
|
@@ -24588,12 +24594,11 @@ class NativeSessionAdapter {
|
|
|
24588
24594
|
return { ...result, ...authFields(provider, this.ownStore) };
|
|
24589
24595
|
}
|
|
24590
24596
|
async compactHistory(handle, opts) {
|
|
24591
|
-
const timeoutSeconds = this.state.timeouts.get(handle.id) ?? FALLBACK_TURN_TIMEOUT_SECONDS;
|
|
24592
24597
|
return compactHistory({
|
|
24593
24598
|
state: this.state,
|
|
24594
24599
|
handle,
|
|
24595
24600
|
client: await this.client(),
|
|
24596
|
-
deadline: createTurnDeadline(
|
|
24601
|
+
deadline: createTurnDeadline(recordedTurnBudgetSeconds(this.state.timeouts.get(handle.id)), () => _adapterDeps.now()),
|
|
24597
24602
|
signal: opts.signal
|
|
24598
24603
|
});
|
|
24599
24604
|
}
|
|
@@ -24693,6 +24698,17 @@ var init_agent_session_deps = __esm(() => {
|
|
|
24693
24698
|
};
|
|
24694
24699
|
});
|
|
24695
24700
|
|
|
24701
|
+
// ../nax-agent/src/session/turn-timeout.ts
|
|
24702
|
+
function armTurnDeadline(seconds, onDeadline) {
|
|
24703
|
+
if (seconds === "none")
|
|
24704
|
+
return () => {};
|
|
24705
|
+
const timer = _agentSessionDeps.setTimeout(onDeadline, seconds * 1000);
|
|
24706
|
+
return () => _agentSessionDeps.clearTimeout(timer);
|
|
24707
|
+
}
|
|
24708
|
+
var init_turn_timeout = __esm(() => {
|
|
24709
|
+
init_agent_session_deps();
|
|
24710
|
+
});
|
|
24711
|
+
|
|
24696
24712
|
// ../nax-agent/src/session/agent-session-command.ts
|
|
24697
24713
|
function claimCommand(options) {
|
|
24698
24714
|
const { ctx, run, command, onEvent, hooks } = options;
|
|
@@ -24708,7 +24724,7 @@ function claimCommand(options) {
|
|
|
24708
24724
|
});
|
|
24709
24725
|
const abort = (code, reason) => controller.abort(new NaxError(reason, code, { stage: "agent-session" }));
|
|
24710
24726
|
const result = Promise.resolve().then(async () => {
|
|
24711
|
-
const
|
|
24727
|
+
const disarm = armTurnDeadline(ctx.turnTimeoutSeconds, () => abort("AGENT_SESSION_TURN_TIMEOUT", "turn deadline"));
|
|
24712
24728
|
try {
|
|
24713
24729
|
hooks.onStart({ turnId, signal: controller.signal, emit });
|
|
24714
24730
|
emit({ type: "tool_call", name: "Bash", input: displayToolInput({ command }), callId });
|
|
@@ -24716,7 +24732,7 @@ function claimCommand(options) {
|
|
|
24716
24732
|
emit({ type: "tool_result", callId, isError: outcome.isError, preview: toolResultPreview(outcome.content) });
|
|
24717
24733
|
return outcome;
|
|
24718
24734
|
} finally {
|
|
24719
|
-
|
|
24735
|
+
disarm();
|
|
24720
24736
|
hooks.onSettle();
|
|
24721
24737
|
}
|
|
24722
24738
|
});
|
|
@@ -24731,6 +24747,7 @@ var init_agent_session_command = __esm(() => {
|
|
|
24731
24747
|
init_nax_error();
|
|
24732
24748
|
init_turn_event_emitter();
|
|
24733
24749
|
init_agent_session_deps();
|
|
24750
|
+
init_turn_timeout();
|
|
24734
24751
|
});
|
|
24735
24752
|
|
|
24736
24753
|
// ../nax-agent/src/session/agent-session-errors.ts
|
|
@@ -24827,7 +24844,7 @@ var init_agent_session_options = __esm(() => {
|
|
|
24827
24844
|
transcriptStore: custom(hasMethods(STORE_METHODS), `must implement ${STORE_METHODS.join(", ")}`),
|
|
24828
24845
|
approvalTimeoutMs: number2().int().min(30000).max(3600000).optional(),
|
|
24829
24846
|
metadata: record2(string2(), string2()).optional(),
|
|
24830
|
-
turnTimeoutSeconds: number2().int().min(1).max(86400).optional()
|
|
24847
|
+
turnTimeoutSeconds: union([number2().int().min(1).max(86400), literal("none")]).optional()
|
|
24831
24848
|
});
|
|
24832
24849
|
});
|
|
24833
24850
|
|
|
@@ -25146,10 +25163,10 @@ function claimTurn(ctx, message, hooks) {
|
|
|
25146
25163
|
if (state !== "claimed")
|
|
25147
25164
|
return;
|
|
25148
25165
|
state = "running";
|
|
25149
|
-
const
|
|
25166
|
+
const disarm = armTurnDeadline(ctx.turnTimeoutSeconds, () => controller.abort(abortReason(TIMED_OUT, "turn deadline")));
|
|
25150
25167
|
hooks.onStart(live);
|
|
25151
25168
|
runTurn(ctx, live, { message, images: hooks.images }, hooks.steers).catch((err) => fromError(err, controller.signal)).then((end) => {
|
|
25152
|
-
|
|
25169
|
+
disarm();
|
|
25153
25170
|
settle(end);
|
|
25154
25171
|
});
|
|
25155
25172
|
}
|
|
@@ -25170,6 +25187,7 @@ var init_agent_session_turn = __esm(() => {
|
|
|
25170
25187
|
init_session_event_channel();
|
|
25171
25188
|
init_session_types();
|
|
25172
25189
|
init_turn_spend();
|
|
25190
|
+
init_turn_timeout();
|
|
25173
25191
|
ZERO_USAGE2 = { inputTokens: 0, outputTokens: 0 };
|
|
25174
25192
|
});
|
|
25175
25193
|
|
|
@@ -25395,10 +25413,10 @@ function claimCompact(options) {
|
|
|
25395
25413
|
const { ctx, closeSignal, run, hooks } = options;
|
|
25396
25414
|
const turnId = _agentSessionDeps.randomUUID();
|
|
25397
25415
|
const controller = new AbortController;
|
|
25398
|
-
const
|
|
25416
|
+
const disarm = armTurnDeadline(ctx.turnTimeoutSeconds, () => controller.abort(new NaxError("compaction deadline", "AGENT_SESSION_TURN_TIMEOUT", { stage: "agent-session" })));
|
|
25399
25417
|
const signal = AbortSignal.any([controller.signal, closeSignal]);
|
|
25400
25418
|
const result = Promise.resolve().then(() => run({ signal })).finally(() => {
|
|
25401
|
-
|
|
25419
|
+
disarm();
|
|
25402
25420
|
hooks.onSettle();
|
|
25403
25421
|
});
|
|
25404
25422
|
const claim = {
|
|
@@ -25738,6 +25756,7 @@ var init_agent_session = __esm(() => {
|
|
|
25738
25756
|
init_pending_asks();
|
|
25739
25757
|
init_session_ask_port();
|
|
25740
25758
|
init_steer_channel();
|
|
25759
|
+
init_turn_timeout();
|
|
25741
25760
|
IDLE_SIGNAL = new AbortController().signal;
|
|
25742
25761
|
});
|
|
25743
25762
|
|
|
@@ -26566,6 +26585,9 @@ var init_session_tool_support = __esm(() => {
|
|
|
26566
26585
|
});
|
|
26567
26586
|
|
|
26568
26587
|
// ../nax-agent/src/session/native-backend.ts
|
|
26588
|
+
function nativeTurnTimeout(seconds) {
|
|
26589
|
+
return seconds === "none" ? { timeoutSeconds: 0, noTurnDeadline: true } : { timeoutSeconds: seconds };
|
|
26590
|
+
}
|
|
26569
26591
|
function createAdapter(raw) {
|
|
26570
26592
|
const overrides = raw.catalogOverrides ?? [];
|
|
26571
26593
|
const owns = overrides.length > 0 || raw.credentials !== undefined;
|
|
@@ -26661,7 +26683,7 @@ async function openNative(resolved, ctx) {
|
|
|
26661
26683
|
...support.providerInstructions !== undefined ? { providerInstructions: support.providerInstructions } : {},
|
|
26662
26684
|
resolvedPermissions: { mode: "default", toolGrants: grants, bashApproval },
|
|
26663
26685
|
modelDef: { provider: resolved.provider, model: raw.model },
|
|
26664
|
-
|
|
26686
|
+
...nativeTurnTimeout(ctx.turnTimeoutSeconds),
|
|
26665
26687
|
transcriptStore: ctx.transcriptStore,
|
|
26666
26688
|
retainOnClose: true,
|
|
26667
26689
|
resume: ctx.resume !== undefined,
|
|
@@ -56095,7 +56117,7 @@ var package_default;
|
|
|
56095
56117
|
var init_package = __esm(() => {
|
|
56096
56118
|
package_default = {
|
|
56097
56119
|
name: "@nathapp/nax",
|
|
56098
|
-
version: "0.92.
|
|
56120
|
+
version: "0.92.7",
|
|
56099
56121
|
description: "AI Coding Agent Orchestrator \u2014 loops until done",
|
|
56100
56122
|
type: "module",
|
|
56101
56123
|
bin: {
|
|
@@ -56181,7 +56203,7 @@ var init_package = __esm(() => {
|
|
|
56181
56203
|
"@agentclientprotocol/sdk": "~1.7.0",
|
|
56182
56204
|
"@anthropic-ai/sandbox-runtime": "0.0.77",
|
|
56183
56205
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
56184
|
-
"@nathapp/nax-ai": "0.92.
|
|
56206
|
+
"@nathapp/nax-ai": "0.92.7",
|
|
56185
56207
|
chalk: "^5.6.2",
|
|
56186
56208
|
commander: "^13.1.0",
|
|
56187
56209
|
"highlight.js": "^11.12.0",
|
|
@@ -63139,6 +63161,9 @@ function createTurnCollector(emit, options = {}) {
|
|
|
63139
63161
|
return;
|
|
63140
63162
|
case "usage_update":
|
|
63141
63163
|
meter.observe(update.cost);
|
|
63164
|
+
if (Number.isSafeInteger(update.used) && update.used >= 0 && Number.isSafeInteger(update.size) && update.size > 0) {
|
|
63165
|
+
send({ type: "context_usage", used: update.used, size: update.size });
|
|
63166
|
+
}
|
|
63142
63167
|
return;
|
|
63143
63168
|
default:
|
|
63144
63169
|
return;
|
|
@@ -78476,6 +78501,7 @@ function activityOf(event, toolNames) {
|
|
|
78476
78501
|
case "usage":
|
|
78477
78502
|
return usageActivity(event);
|
|
78478
78503
|
case "stream_reset":
|
|
78504
|
+
case "context_usage":
|
|
78479
78505
|
case "compaction":
|
|
78480
78506
|
case "tool_input_delta":
|
|
78481
78507
|
return;
|
|
@@ -86454,8 +86480,8 @@ var init_version = __esm(() => {
|
|
|
86454
86480
|
NAX_AI_VERSION = CATALOG_VERSION;
|
|
86455
86481
|
NAX_COMMIT = (() => {
|
|
86456
86482
|
try {
|
|
86457
|
-
if (/^[0-9a-f]{6,10}$/.test("
|
|
86458
|
-
return "
|
|
86483
|
+
if (/^[0-9a-f]{6,10}$/.test("8a088cb"))
|
|
86484
|
+
return "8a088cb";
|
|
86459
86485
|
} catch {}
|
|
86460
86486
|
try {
|
|
86461
86487
|
const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
|
|
@@ -97216,7 +97242,8 @@ async function acpSessionOptions(input) {
|
|
|
97216
97242
|
...resolved.instructions !== undefined ? { toolInstructions: resolved.instructions } : {},
|
|
97217
97243
|
...input.memoryIndex !== undefined ? { memoryIndex: input.memoryIndex } : {}
|
|
97218
97244
|
}),
|
|
97219
|
-
...input.approvalTimeoutMs !== undefined ? { approvalTimeoutMs: input.approvalTimeoutMs } : {}
|
|
97245
|
+
...input.approvalTimeoutMs !== undefined ? { approvalTimeoutMs: input.approvalTimeoutMs } : {},
|
|
97246
|
+
turnTimeoutSeconds: "none"
|
|
97220
97247
|
};
|
|
97221
97248
|
}
|
|
97222
97249
|
var _acpSessionDeps, UNUSABLE_SESSION_CODES, CAPABILITY_UNSUPPORTED = "AGENT_SESSION_CAPABILITY_UNSUPPORTED";
|
|
@@ -110443,7 +110470,8 @@ async function sessionOptions(request, {
|
|
|
110443
110470
|
rulesIndex: set.rules.map(toRulesIndexEntry),
|
|
110444
110471
|
...request.memoryIndex !== undefined ? { memoryIndex: request.memoryIndex } : {}
|
|
110445
110472
|
}),
|
|
110446
|
-
approvalTimeoutMs: request.config.execution.approvalTimeout
|
|
110473
|
+
approvalTimeoutMs: request.config.execution.approvalTimeout,
|
|
110474
|
+
turnTimeoutSeconds: "none"
|
|
110447
110475
|
};
|
|
110448
110476
|
}
|
|
110449
110477
|
async function openAcpBrain(request, { meta, acp }, deps) {
|
|
@@ -158425,10 +158453,10 @@ function splitRow(text, columns) {
|
|
|
158425
158453
|
return pieces.length === 0 ? [""] : pieces;
|
|
158426
158454
|
}
|
|
158427
158455
|
function emptyRows(options) {
|
|
158456
|
+
const focused = options.active === true;
|
|
158428
158457
|
if (options.busy)
|
|
158429
|
-
return [{ text: "", marker: true }];
|
|
158458
|
+
return [{ text: "", marker: true, ...focused ? { cursor: 0 } : {} }];
|
|
158430
158459
|
const hint = sanitizeText(options.hint ?? PLACEHOLDER2);
|
|
158431
|
-
const focused = options.active === true;
|
|
158432
158460
|
return splitRow(hint, layoutColumns(options)).map((text, index) => ({
|
|
158433
158461
|
text,
|
|
158434
158462
|
marker: index === 0,
|
|
@@ -158478,8 +158506,15 @@ function visibleRows(draft, options) {
|
|
|
158478
158506
|
const start = Math.min(Math.max(anchor - cap + 1, 0), pieces.length - cap);
|
|
158479
158507
|
return pieces.slice(start, start + cap);
|
|
158480
158508
|
}
|
|
158509
|
+
function measureInput(draft, options) {
|
|
158510
|
+
return {
|
|
158511
|
+
minimum: INPUT_MIN_ROWS,
|
|
158512
|
+
desired: INPUT_RULE_ROWS + visibleRows(draft, options).length,
|
|
158513
|
+
textRows: textRowCap(options)
|
|
158514
|
+
};
|
|
158515
|
+
}
|
|
158481
158516
|
function inputRows(draft, options) {
|
|
158482
|
-
return
|
|
158517
|
+
return measureInput(draft, options).desired;
|
|
158483
158518
|
}
|
|
158484
158519
|
function ruleLine(options) {
|
|
158485
158520
|
const glyph = options.theme.glyphs.rule;
|
|
@@ -158736,7 +158771,7 @@ function ChatInput({
|
|
|
158736
158771
|
});
|
|
158737
158772
|
}
|
|
158738
158773
|
var import_react29, jsx_runtime2, EMPTY_DRAFT, DOUBLE_ESCAPE_MS = 2000, ARM_EXPIRY_MS, _chatInputDeps, PLACEHOLDER2 = 'Try "explain how nax run picks a model" \xB7 / for commands', PROMPT_MARKER = "> ", CONTINUATION3 = " ", CURSOR_CELL = " ", SLASH = "/", NEWLINE3 = `
|
|
158739
|
-
`, MAX_TEXT_ROWS = 8, INPUT_RULE_ROWS = 2, TEXT_INDENT, BREAK_CHARACTER = " ", GRAPHEME_SEGMENTER3;
|
|
158774
|
+
`, MAX_TEXT_ROWS = 8, INPUT_RULE_ROWS = 2, INPUT_MIN_ROWS, TEXT_INDENT, BREAK_CHARACTER = " ", GRAPHEME_SEGMENTER3;
|
|
158740
158775
|
var init_ChatInput = __esm(async () => {
|
|
158741
158776
|
init_line_editor();
|
|
158742
158777
|
await __promiseAll([
|
|
@@ -158753,6 +158788,7 @@ var init_ChatInput = __esm(async () => {
|
|
|
158753
158788
|
setTimeout: (callback, delayMs) => globalThis.setTimeout(callback, delayMs),
|
|
158754
158789
|
clearTimeout: (handle) => globalThis.clearTimeout(handle)
|
|
158755
158790
|
};
|
|
158791
|
+
INPUT_MIN_ROWS = INPUT_RULE_ROWS + 1;
|
|
158756
158792
|
TEXT_INDENT = displayWidth(PROMPT_MARKER);
|
|
158757
158793
|
GRAPHEME_SEGMENTER3 = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
158758
158794
|
});
|
|
@@ -158778,8 +158814,8 @@ function ruleRow(theme, columns, border) {
|
|
|
158778
158814
|
}
|
|
158779
158815
|
function textRows(text, prefix, style, context) {
|
|
158780
158816
|
const source = textLines2(text);
|
|
158781
|
-
const body = source.length === 0 ? [
|
|
158782
|
-
return body.flatMap((physical) => prefixedLine([styled2(physical, style)], prefix, context));
|
|
158817
|
+
const body = source.length === 0 ? [BLANK_ROW] : source;
|
|
158818
|
+
return body.flatMap((physical) => prefixedLine([styled2(physical === "" ? BLANK_ROW : physical, style)], prefix, context));
|
|
158783
158819
|
}
|
|
158784
158820
|
function optionalRows(text, prefix, style, context) {
|
|
158785
158821
|
return text === undefined || text === "" ? [] : textRows(text, prefix, style, context);
|
|
@@ -158822,17 +158858,16 @@ function diffRows(diff, context) {
|
|
|
158822
158858
|
return prefixedLine([styled2(`${line.sign}${oneLine3(line.text)}`, style)], [styled2(indent, style)], context);
|
|
158823
158859
|
});
|
|
158824
158860
|
}
|
|
158825
|
-
function
|
|
158861
|
+
function countdownRows(expiresAt, nowMs, context) {
|
|
158826
158862
|
const countdown = countdownLabel(expiresAt, nowMs);
|
|
158827
|
-
return [styled2(countdown.text, { color: countdown.color })];
|
|
158863
|
+
return prefixedLine([styled2(countdown.text, { color: countdown.color })], [], context);
|
|
158828
158864
|
}
|
|
158829
|
-
function
|
|
158865
|
+
function approvalParts(approval, options, context) {
|
|
158830
158866
|
const indent = [styled2(SPACE3.repeat(INDENT_COLUMNS))];
|
|
158831
158867
|
const border = approval.kind === "choice" ? "warning" : approval.border;
|
|
158832
158868
|
return {
|
|
158833
|
-
|
|
158834
|
-
|
|
158835
|
-
...titleRows(approval, context),
|
|
158869
|
+
frame: [ruleRow(context.theme, context.width, border), ...titleRows(approval, context)],
|
|
158870
|
+
body: [
|
|
158836
158871
|
CARD_BLANK,
|
|
158837
158872
|
...optionalRows(approval.kind === "choice" ? undefined : approval.command, indent, { bold: true }, context),
|
|
158838
158873
|
...optionalRows(approval.summary, indent, { color: "muted" }, context),
|
|
@@ -158841,61 +158876,98 @@ function approvalBody(approval, options, context) {
|
|
|
158841
158876
|
],
|
|
158842
158877
|
tail: [
|
|
158843
158878
|
...optionRows(approval, options.selected ?? 0, context),
|
|
158844
|
-
|
|
158879
|
+
...countdownRows(options.expiresAt, options.nowMs ?? _askCardDeps.now(), context),
|
|
158845
158880
|
ruleRow(context.theme, context.width, border)
|
|
158846
|
-
]
|
|
158881
|
+
],
|
|
158882
|
+
bodyFloor: 0,
|
|
158883
|
+
question: false
|
|
158847
158884
|
};
|
|
158848
158885
|
}
|
|
158849
|
-
function
|
|
158886
|
+
function questionParts(model, options, context) {
|
|
158887
|
+
const body = textRows(model.text, [], {}, context);
|
|
158850
158888
|
return {
|
|
158851
|
-
|
|
158852
|
-
|
|
158853
|
-
...questionTitleRows(model, context),
|
|
158854
|
-
...textRows(model.text, [], {}, context)
|
|
158855
|
-
],
|
|
158889
|
+
frame: [ruleRow(context.theme, context.width, model.border), ...questionTitleRows(model, context)],
|
|
158890
|
+
body,
|
|
158856
158891
|
tail: [
|
|
158857
|
-
|
|
158892
|
+
...countdownRows(options.expiresAt, options.nowMs ?? _askCardDeps.now(), context),
|
|
158858
158893
|
ruleRow(context.theme, context.width, model.border)
|
|
158859
|
-
]
|
|
158894
|
+
],
|
|
158895
|
+
bodyFloor: Math.min(1, body.length),
|
|
158896
|
+
question: true
|
|
158860
158897
|
};
|
|
158861
158898
|
}
|
|
158899
|
+
function cardParts(model, options, context) {
|
|
158900
|
+
return model.kind === "question" ? questionParts(model, options, context) : approvalParts(model, options, context);
|
|
158901
|
+
}
|
|
158862
158902
|
function elisionRows(elided, context) {
|
|
158863
158903
|
const count = elided === 1 ? ELIDED_ONE : `${elided} more lines`;
|
|
158864
158904
|
return textRows(`${context.theme.glyphs.ellipsis} ${count}`, [], { color: "muted" }, context);
|
|
158865
158905
|
}
|
|
158866
|
-
function
|
|
158867
|
-
|
|
158868
|
-
|
|
158869
|
-
|
|
158870
|
-
|
|
158871
|
-
|
|
158872
|
-
|
|
158873
|
-
|
|
158874
|
-
|
|
158875
|
-
|
|
158876
|
-
|
|
158877
|
-
|
|
158878
|
-
|
|
158879
|
-
|
|
158880
|
-
|
|
158881
|
-
|
|
158882
|
-
|
|
158883
|
-
|
|
158906
|
+
function markerRows(elided, context) {
|
|
158907
|
+
return elided <= 0 ? 0 : elisionRows(elided, context).length;
|
|
158908
|
+
}
|
|
158909
|
+
function headFloorRows(parts, context) {
|
|
158910
|
+
return parts.frame.length + parts.bodyFloor + markerRows(parts.body.length - parts.bodyFloor, context);
|
|
158911
|
+
}
|
|
158912
|
+
function questionBox(parts, budget, options, context) {
|
|
158913
|
+
const desired = inputRows(options.answer, { width: options.width, container: options.width, hint: ANSWER_HINT });
|
|
158914
|
+
const room = budget - parts.tail.length - headFloorRows(parts, context);
|
|
158915
|
+
const rows = Math.min(Math.max(room, BOX_MIN_ROWS), desired);
|
|
158916
|
+
const maxRows = Math.max(1, rows - INPUT_RULE_ROWS);
|
|
158917
|
+
return {
|
|
158918
|
+
rows: inputRows(options.answer, { width: options.width, container: options.width, maxRows, hint: ANSWER_HINT }),
|
|
158919
|
+
maxRows
|
|
158920
|
+
};
|
|
158921
|
+
}
|
|
158922
|
+
function fitHead(parts, available, context) {
|
|
158923
|
+
const roomForBody = available - parts.frame.length;
|
|
158924
|
+
if (parts.body.length <= roomForBody)
|
|
158925
|
+
return { head: [...parts.frame, ...parts.body], elided: 0 };
|
|
158926
|
+
for (let kept = Math.min(parts.body.length, roomForBody);kept > parts.bodyFloor; kept--) {
|
|
158927
|
+
const withheld = parts.body.length - kept;
|
|
158928
|
+
if (kept + markerRows(withheld, context) > roomForBody)
|
|
158929
|
+
continue;
|
|
158930
|
+
return {
|
|
158931
|
+
head: [...parts.frame, ...parts.body.slice(0, kept), ...elisionRows(withheld, context)],
|
|
158932
|
+
elided: withheld
|
|
158933
|
+
};
|
|
158934
|
+
}
|
|
158935
|
+
const elided = parts.body.length - parts.bodyFloor;
|
|
158936
|
+
return {
|
|
158937
|
+
head: [
|
|
158938
|
+
...parts.frame,
|
|
158939
|
+
...parts.body.slice(0, parts.bodyFloor),
|
|
158940
|
+
...elided === 0 ? [] : elisionRows(elided, context)
|
|
158941
|
+
],
|
|
158942
|
+
elided
|
|
158943
|
+
};
|
|
158884
158944
|
}
|
|
158885
158945
|
function askCardLayout(model, options) {
|
|
158886
158946
|
const context = { width: resolveWidth2(options.width), theme: options.theme, expanded: false };
|
|
158887
158947
|
const budget = Math.max(1, Math.floor(options.budget));
|
|
158888
|
-
|
|
158889
|
-
|
|
158890
|
-
|
|
158891
|
-
|
|
158892
|
-
|
|
158893
|
-
|
|
158894
|
-
|
|
158895
|
-
|
|
158896
|
-
|
|
158948
|
+
const parts = cardParts(model, options, context);
|
|
158949
|
+
const box = parts.question ? questionBox(parts, budget, options, context) : NO_BOX;
|
|
158950
|
+
const fitted = fitHead(parts, budget - box.rows - parts.tail.length, context);
|
|
158951
|
+
return {
|
|
158952
|
+
head: fitted.head,
|
|
158953
|
+
tail: parts.tail,
|
|
158954
|
+
input: box.rows,
|
|
158955
|
+
inputMaxRows: box.maxRows,
|
|
158956
|
+
elided: fitted.elided,
|
|
158957
|
+
rows: fitted.head.length + box.rows + parts.tail.length
|
|
158958
|
+
};
|
|
158959
|
+
}
|
|
158960
|
+
function measureAskCard(model, options) {
|
|
158961
|
+
const context = { width: resolveWidth2(options.width), theme: options.theme, expanded: false };
|
|
158962
|
+
const parts = cardParts(model, options, context);
|
|
158963
|
+
const elided = parts.body.length - parts.bodyFloor;
|
|
158964
|
+
const boxDesired = parts.question ? inputRows(options.answer, { width: options.width, container: options.width, hint: ANSWER_HINT }) : NO_BOX.rows;
|
|
158965
|
+
return {
|
|
158966
|
+
minimum: headFloorRows(parts, context) + (parts.question ? BOX_MIN_ROWS : NO_BOX.rows) + parts.tail.length,
|
|
158967
|
+
desired: parts.frame.length + parts.body.length + boxDesired + parts.tail.length,
|
|
158968
|
+
elided,
|
|
158969
|
+
marker: markerRows(elided, context)
|
|
158897
158970
|
};
|
|
158898
|
-
return fitCard(card, box, budget, context);
|
|
158899
158971
|
}
|
|
158900
158972
|
function chosenOption(input, key, options, selected) {
|
|
158901
158973
|
if (key.return)
|
|
@@ -159024,7 +159096,7 @@ function AskCard({
|
|
|
159024
159096
|
]
|
|
159025
159097
|
});
|
|
159026
159098
|
}
|
|
159027
|
-
var import_react30, jsx_runtime3, COUNTDOWN_TICK_MS = 1000, COUNTDOWN_WARNING_SECONDS = 60, INDENT_COLUMNS = 3, MS_PER_SECOND5 = 1000, SECONDS_PER_MINUTE2 = 60, SECONDS_PADDING = 2, ELIDED_ONE = "1 more line", ANSWER_HINT = "type your answer \xB7 enter to send", CARD_BLANK, _askCardDeps, NO_BOX;
|
|
159099
|
+
var import_react30, jsx_runtime3, COUNTDOWN_TICK_MS = 1000, COUNTDOWN_WARNING_SECONDS = 60, INDENT_COLUMNS = 3, MS_PER_SECOND5 = 1000, SECONDS_PER_MINUTE2 = 60, SECONDS_PADDING = 2, ELIDED_ONE = "1 more line", ANSWER_HINT = "type your answer \xB7 enter to send", CARD_BLANK, BLANK_ROW, _askCardDeps, BOX_MIN_ROWS, NO_BOX;
|
|
159028
159100
|
var init_AskCard = __esm(async () => {
|
|
159029
159101
|
await __promiseAll([
|
|
159030
159102
|
init_build3(),
|
|
@@ -159035,11 +159107,13 @@ var init_AskCard = __esm(async () => {
|
|
|
159035
159107
|
import_react30 = __toESM(require_react(), 1);
|
|
159036
159108
|
jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
159037
159109
|
CARD_BLANK = [{ text: SPACE3 }];
|
|
159110
|
+
BLANK_ROW = SPACE3;
|
|
159038
159111
|
_askCardDeps = {
|
|
159039
159112
|
now: () => Date.now(),
|
|
159040
159113
|
setTimeout: (callback, delayMs) => globalThis.setTimeout(callback, delayMs),
|
|
159041
159114
|
clearTimeout: (handle) => globalThis.clearTimeout(handle)
|
|
159042
159115
|
};
|
|
159116
|
+
BOX_MIN_ROWS = INPUT_RULE_ROWS + 1;
|
|
159043
159117
|
NO_BOX = { rows: 0, maxRows: 0 };
|
|
159044
159118
|
});
|
|
159045
159119
|
|
|
@@ -159823,6 +159897,14 @@ function fixedRows(model) {
|
|
|
159823
159897
|
function visibleEntries(model, budget) {
|
|
159824
159898
|
return Math.min(model.entries.length, PICKER_MAX_ROWS, Math.max(0, budget - fixedRows(model)));
|
|
159825
159899
|
}
|
|
159900
|
+
function measurePicker(model) {
|
|
159901
|
+
const fixed = fixedRows(model);
|
|
159902
|
+
return {
|
|
159903
|
+
fixed,
|
|
159904
|
+
minimum: fixed + (model.entries.length === 0 ? 0 : 1),
|
|
159905
|
+
desired: fixed + Math.min(model.entries.length, PICKER_MAX_ROWS)
|
|
159906
|
+
};
|
|
159907
|
+
}
|
|
159826
159908
|
function windowStart2(count, selected, rows) {
|
|
159827
159909
|
return Math.max(FIRST_ENTRY, Math.min(selected - rows + 1, count - rows));
|
|
159828
159910
|
}
|
|
@@ -159854,9 +159936,6 @@ function noteRow(note, theme, columns) {
|
|
|
159854
159936
|
const spans = note.tone === "warning" ? [styled2(`${theme.glyphs.warning}${SPACE3}`, { color: "warning" }), styled2(text, { color: "warning" })] : [styled2(text, { color: "muted" })];
|
|
159855
159937
|
return cutSpans(spans, columns);
|
|
159856
159938
|
}
|
|
159857
|
-
function pickerRows(model, budget) {
|
|
159858
|
-
return fixedRows(model) + visibleEntries(model, Math.max(1, Math.floor(budget)));
|
|
159859
|
-
}
|
|
159860
159939
|
function pickerLayout(model, options) {
|
|
159861
159940
|
const columns = resolveWidth2(options.width);
|
|
159862
159941
|
const budget = Math.max(1, Math.floor(options.budget));
|
|
@@ -160015,26 +160094,11 @@ var init_Picker = __esm(async () => {
|
|
|
160015
160094
|
function bottomBlocked(ask, picker) {
|
|
160016
160095
|
return ask !== undefined || picker !== undefined;
|
|
160017
160096
|
}
|
|
160018
|
-
function viewportActive(locked, picker) {
|
|
160019
|
-
return !locked && picker === undefined;
|
|
160020
|
-
}
|
|
160021
|
-
function bottomRowsFor(input) {
|
|
160022
|
-
if (input.ask !== undefined)
|
|
160023
|
-
return Math.min(input.ask, input.budget);
|
|
160024
|
-
if (input.picker !== undefined)
|
|
160025
|
-
return Math.min(pickerRows(input.picker, input.budget), input.budget);
|
|
160026
|
-
return input.input;
|
|
160027
|
-
}
|
|
160028
|
-
function menuRowsFor(input) {
|
|
160029
|
-
return Math.max(NO_MENU_ROWS, Math.min(input.rows, input.budget - INPUT_MIN_ROWS));
|
|
160030
|
-
}
|
|
160031
|
-
var INPUT_MIN_ROWS, NO_MENU_ROWS = 0;
|
|
160032
160097
|
var init_bottom_region = __esm(async () => {
|
|
160033
160098
|
await __promiseAll([
|
|
160034
160099
|
init_ChatInput(),
|
|
160035
160100
|
init_Picker()
|
|
160036
160101
|
]);
|
|
160037
|
-
INPUT_MIN_ROWS = INPUT_RULE_ROWS + 1;
|
|
160038
160102
|
});
|
|
160039
160103
|
|
|
160040
160104
|
// src/tui/chat/context-span.ts
|
|
@@ -160053,7 +160117,7 @@ function formatWindow(n) {
|
|
|
160053
160117
|
return `${n}`;
|
|
160054
160118
|
}
|
|
160055
160119
|
function contextPercent(state, status) {
|
|
160056
|
-
const
|
|
160120
|
+
const contextWindow = status.contextWindow ?? state.contextWindow;
|
|
160057
160121
|
if (contextWindow === undefined || contextWindow <= 0 || status.contextTokens === undefined)
|
|
160058
160122
|
return;
|
|
160059
160123
|
return Math.round(status.contextTokens / contextWindow * PERCENT);
|
|
@@ -160064,17 +160128,23 @@ function percentColor(percent) {
|
|
|
160064
160128
|
return percent > CONTEXT_WARNING_ABOVE ? "warning" : "muted";
|
|
160065
160129
|
}
|
|
160066
160130
|
function contextSpan(state, status) {
|
|
160131
|
+
if (isChatAcpModel(state.model) && status.contextWindow === undefined)
|
|
160132
|
+
return;
|
|
160067
160133
|
const tokens = status.contextTokens;
|
|
160068
160134
|
if (tokens === undefined)
|
|
160069
160135
|
return;
|
|
160070
160136
|
const percent = contextPercent(state, status);
|
|
160071
|
-
|
|
160137
|
+
const contextWindow = status.contextWindow ?? state.contextWindow;
|
|
160138
|
+
if (percent === undefined || contextWindow === undefined) {
|
|
160072
160139
|
return { text: `${SEPARATOR2}${formatTokens(tokens)} ctx`, color: "muted" };
|
|
160073
160140
|
}
|
|
160074
|
-
const text = `${formatTokens(tokens)}/${formatWindow(
|
|
160141
|
+
const text = `${formatTokens(tokens)}/${formatWindow(contextWindow)} ctx (${percent}%)`;
|
|
160075
160142
|
return { text: `${SEPARATOR2}${text}`, color: percentColor(percent) };
|
|
160076
160143
|
}
|
|
160077
160144
|
var TOKEN_UNIT = 1000, TOKEN_DECIMALS = 1, TOKEN_SUFFIX = "k", MILLION = 1e6, WINDOW_MILLION_FROM = 999500, WINDOW_DECIMALS = 100, WINDOW_MILLION_SUFFIX = "M", SEPARATOR2 = " \xB7 ", CONTEXT_WARNING_ABOVE = 70, CONTEXT_DANGER_ABOVE = 90, PERCENT = 100;
|
|
160145
|
+
var init_context_span = __esm(() => {
|
|
160146
|
+
init_chat2();
|
|
160147
|
+
});
|
|
160078
160148
|
|
|
160079
160149
|
// src/tui/chat/job-strip.ts
|
|
160080
160150
|
function jobPart(job) {
|
|
@@ -160323,6 +160393,7 @@ function inPhase(status, phase, toolName) {
|
|
|
160323
160393
|
}
|
|
160324
160394
|
function applyTurnStart(status, event) {
|
|
160325
160395
|
const started = {
|
|
160396
|
+
...status.contextWindow === undefined ? {} : { contextWindow: status.contextWindow },
|
|
160326
160397
|
running: true,
|
|
160327
160398
|
startedAt: event.at,
|
|
160328
160399
|
phase: THINKING,
|
|
@@ -160338,7 +160409,7 @@ function applyUsage(status, event) {
|
|
|
160338
160409
|
inputTokens: status.inputTokens + event.inputTokens,
|
|
160339
160410
|
outputTokens: status.outputTokens + event.outputTokens,
|
|
160340
160411
|
streamedChars: 0,
|
|
160341
|
-
contextTokens: event.inputTokens + (event.cacheRead ?? 0) + (event.cacheWrite ?? 0)
|
|
160412
|
+
contextTokens: status.contextWindow === undefined ? event.inputTokens + (event.cacheRead ?? 0) + (event.cacheWrite ?? 0) : status.contextTokens
|
|
160342
160413
|
};
|
|
160343
160414
|
}
|
|
160344
160415
|
function reduceTurnStatus(status, event) {
|
|
@@ -160365,6 +160436,8 @@ function reduceTurnStatus(status, event) {
|
|
|
160365
160436
|
return inPhase(status, COMPACTING);
|
|
160366
160437
|
case "stream_reset":
|
|
160367
160438
|
return { ...inPhase(status, RETRYING), streamedChars: 0 };
|
|
160439
|
+
case "context_usage":
|
|
160440
|
+
return { ...status, contextTokens: event.used, contextWindow: event.size };
|
|
160368
160441
|
case "usage":
|
|
160369
160442
|
return applyUsage(status, event);
|
|
160370
160443
|
case "turn_end":
|
|
@@ -160573,8 +160646,10 @@ var IDLE_STATUS, THINKING = "thinking", WRITING = "writing", TOOL = "tool", APPR
|
|
|
160573
160646
|
var init_chat_status = __esm(async () => {
|
|
160574
160647
|
init_src();
|
|
160575
160648
|
init_chat2();
|
|
160649
|
+
init_context_span();
|
|
160576
160650
|
init_theme();
|
|
160577
160651
|
init_tool_card();
|
|
160652
|
+
init_context_span();
|
|
160578
160653
|
await __promiseAll([
|
|
160579
160654
|
init_job_strip(),
|
|
160580
160655
|
init_layout_lines(),
|
|
@@ -160610,7 +160685,7 @@ function clearTimer(handle) {
|
|
|
160610
160685
|
clearTimeout(handle.current);
|
|
160611
160686
|
handle.current = undefined;
|
|
160612
160687
|
}
|
|
160613
|
-
function useChatKeys({ host, running, refresh, onError, onNotice }) {
|
|
160688
|
+
function useChatKeys({ host, running, refresh, onError, onNotice, active }) {
|
|
160614
160689
|
const { exit } = use_app_default();
|
|
160615
160690
|
const queued = import_react33.useRef(undefined);
|
|
160616
160691
|
const interruptedAt = import_react33.useRef(undefined);
|
|
@@ -160637,6 +160712,13 @@ function useChatKeys({ host, running, refresh, onError, onNotice }) {
|
|
|
160637
160712
|
async function switchMode(mode) {
|
|
160638
160713
|
await runControl(() => host.switchTo({ mode }));
|
|
160639
160714
|
}
|
|
160715
|
+
function cycleMode() {
|
|
160716
|
+
const mode = nextChatMode(queued.current?.mode ?? host.current().mode);
|
|
160717
|
+
if (running.current)
|
|
160718
|
+
queued.current = { ...queued.current, mode };
|
|
160719
|
+
else
|
|
160720
|
+
switchMode(mode);
|
|
160721
|
+
}
|
|
160640
160722
|
function cycleModelEffort() {
|
|
160641
160723
|
const model = queued.current?.model ?? host.current().model;
|
|
160642
160724
|
const levels = host.effortLevels?.(model) ?? EFFORT_LEVELS;
|
|
@@ -160712,16 +160794,14 @@ function useChatKeys({ host, running, refresh, onError, onNotice }) {
|
|
|
160712
160794
|
return;
|
|
160713
160795
|
if (key.ctrl && input === "c") {
|
|
160714
160796
|
interrupt();
|
|
160797
|
+
} else if (active?.() === false) {
|
|
160798
|
+
return;
|
|
160715
160799
|
} else if (key.ctrl && input === "b" && canControl()) {
|
|
160716
160800
|
moveForeground();
|
|
160717
160801
|
} else if (key.ctrl && input === "t" && canControl()) {
|
|
160718
160802
|
cycleModelEffort();
|
|
160719
160803
|
} else if (key.shift && key.tab && !key.ctrl && !key.meta && canControl()) {
|
|
160720
|
-
|
|
160721
|
-
if (running.current)
|
|
160722
|
-
queued.current = { ...queued.current, mode };
|
|
160723
|
-
else
|
|
160724
|
-
switchMode(mode);
|
|
160804
|
+
cycleMode();
|
|
160725
160805
|
}
|
|
160726
160806
|
});
|
|
160727
160807
|
return {
|
|
@@ -160870,6 +160950,20 @@ var init_esc_layer = __esm(() => {
|
|
|
160870
160950
|
});
|
|
160871
160951
|
|
|
160872
160952
|
// src/tui/chat/FixedRow.tsx
|
|
160953
|
+
function AllocatedLine({
|
|
160954
|
+
region,
|
|
160955
|
+
line,
|
|
160956
|
+
theme
|
|
160957
|
+
}) {
|
|
160958
|
+
if (region.rows === 0 || line === undefined)
|
|
160959
|
+
return null;
|
|
160960
|
+
return /* @__PURE__ */ jsx_runtime5.jsx(FixedRow, {
|
|
160961
|
+
children: /* @__PURE__ */ jsx_runtime5.jsx(StyledLineView, {
|
|
160962
|
+
line,
|
|
160963
|
+
theme
|
|
160964
|
+
})
|
|
160965
|
+
});
|
|
160966
|
+
}
|
|
160873
160967
|
function FixedRow({ children }) {
|
|
160874
160968
|
return /* @__PURE__ */ jsx_runtime5.jsx(Box_default, {
|
|
160875
160969
|
height: 1,
|
|
@@ -160879,10 +160973,269 @@ function FixedRow({ children }) {
|
|
|
160879
160973
|
}
|
|
160880
160974
|
var jsx_runtime5;
|
|
160881
160975
|
var init_FixedRow = __esm(async () => {
|
|
160882
|
-
await
|
|
160976
|
+
await __promiseAll([
|
|
160977
|
+
init_build3(),
|
|
160978
|
+
init_styled_line()
|
|
160979
|
+
]);
|
|
160883
160980
|
jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
160884
160981
|
});
|
|
160885
160982
|
|
|
160983
|
+
// src/tui/chat/message-queue.ts
|
|
160984
|
+
function pushQueued(queue, text) {
|
|
160985
|
+
return [...queue, text];
|
|
160986
|
+
}
|
|
160987
|
+
function leadsWith(queue, texts) {
|
|
160988
|
+
return texts.length <= queue.length && texts.every((text, index) => queue[index] === text);
|
|
160989
|
+
}
|
|
160990
|
+
function pushDiscardedSteer(group, queue, text) {
|
|
160991
|
+
const leading = group !== undefined && leadsWith(queue, group.texts) ? group.texts : [];
|
|
160992
|
+
const texts = [...leading, text];
|
|
160993
|
+
return { group: { texts }, queue: [...texts, ...queue.slice(leading.length)] };
|
|
160994
|
+
}
|
|
160995
|
+
function takeQueued(queue) {
|
|
160996
|
+
const [text, ...rest] = queue;
|
|
160997
|
+
return text === undefined ? undefined : { text, rest };
|
|
160998
|
+
}
|
|
160999
|
+
function queueToPrompt(queue, draft) {
|
|
161000
|
+
return [...queue, draft].filter((line) => line !== "").join(`
|
|
161001
|
+
`);
|
|
161002
|
+
}
|
|
161003
|
+
function queuedRow(text) {
|
|
161004
|
+
return `${QUEUED_MARKER}${oneLine3(sanitizeText(text))}`;
|
|
161005
|
+
}
|
|
161006
|
+
function steeredRow(row) {
|
|
161007
|
+
return `${STEERING_MARKER}${oneLine3(sanitizeText(row.text))}`;
|
|
161008
|
+
}
|
|
161009
|
+
function pendingPreviewLines(input) {
|
|
161010
|
+
const budget = previewBudget(input.budget);
|
|
161011
|
+
if (budget === 0)
|
|
161012
|
+
return [];
|
|
161013
|
+
const items = [...(input.steering ?? []).map(steeredRow), ...(input.queued ?? []).map(queuedRow)];
|
|
161014
|
+
if (items.length === 0)
|
|
161015
|
+
return [];
|
|
161016
|
+
const shown = items.length <= budget ? items : overflowed(items, budget);
|
|
161017
|
+
return shown.map((row) => fittedRow(row, input.columns));
|
|
161018
|
+
}
|
|
161019
|
+
function previewBudget(budget) {
|
|
161020
|
+
if (budget === undefined || !Number.isFinite(budget))
|
|
161021
|
+
return MAX_PENDING_PREVIEW_ROWS;
|
|
161022
|
+
return Math.max(0, Math.min(MAX_PENDING_PREVIEW_ROWS, Math.floor(budget)));
|
|
161023
|
+
}
|
|
161024
|
+
function overflowed(items, budget) {
|
|
161025
|
+
const shown = items.slice(0, budget - 1);
|
|
161026
|
+
return [...shown, `${MORE_PREFIX}${items.length - shown.length}${PENDING_SUFFIX}`];
|
|
161027
|
+
}
|
|
161028
|
+
function fittedRow(row, columns) {
|
|
161029
|
+
return cutSpans([{ text: row }], resolveWidth2(columns)).map((span) => span.text).join("");
|
|
161030
|
+
}
|
|
161031
|
+
var MAX_PENDING_PREVIEW_ROWS = 4, QUEUED_MARKER = "queued \xB7 ", STEERING_MARKER = "steering \xB7 ", MORE_PREFIX = "+", PENDING_SUFFIX = " pending";
|
|
161032
|
+
var init_message_queue = __esm(async () => {
|
|
161033
|
+
await __promiseAll([
|
|
161034
|
+
init_layout_lines(),
|
|
161035
|
+
init_styled_line(),
|
|
161036
|
+
init_wrap()
|
|
161037
|
+
]);
|
|
161038
|
+
});
|
|
161039
|
+
|
|
161040
|
+
// src/tui/chat/frame-layout.ts
|
|
161041
|
+
function rowCount(rows) {
|
|
161042
|
+
if (rows === undefined || !Number.isFinite(rows))
|
|
161043
|
+
return NO_ROWS;
|
|
161044
|
+
return Math.max(NO_ROWS, Math.floor(rows));
|
|
161045
|
+
}
|
|
161046
|
+
function frameHeight(height) {
|
|
161047
|
+
if (!Number.isFinite(height) || height <= NO_ROWS)
|
|
161048
|
+
return FALLBACK_ROWS;
|
|
161049
|
+
return Math.floor(height);
|
|
161050
|
+
}
|
|
161051
|
+
function usableFrameRows(height) {
|
|
161052
|
+
const rows = frameHeight(height);
|
|
161053
|
+
return rows <= DIAGNOSTIC_ROWS ? DIAGNOSTIC_ROWS : rows - FRAME_SLACK_ROWS;
|
|
161054
|
+
}
|
|
161055
|
+
function visibleSurface(options) {
|
|
161056
|
+
if (options.ask !== undefined)
|
|
161057
|
+
return { kind: "ask", size: options.ask };
|
|
161058
|
+
if (options.picker !== undefined)
|
|
161059
|
+
return { kind: "picker", size: options.picker };
|
|
161060
|
+
return { kind: "input", size: options.input };
|
|
161061
|
+
}
|
|
161062
|
+
function isOverlay(surface) {
|
|
161063
|
+
return surface.kind !== "input";
|
|
161064
|
+
}
|
|
161065
|
+
function desiredOptional(options, surface) {
|
|
161066
|
+
const working = options.working === true;
|
|
161067
|
+
return {
|
|
161068
|
+
headerTitle: HEADER_TITLE_ROWS,
|
|
161069
|
+
headerPath: HEADER_PATH_ROWS,
|
|
161070
|
+
headerRule: HEADER_RULE_ROWS,
|
|
161071
|
+
transcript: TRANSCRIPT_ROWS,
|
|
161072
|
+
gaps: working ? STATUS_GAP_ROWS * 2 : NO_ROWS,
|
|
161073
|
+
previews: isOverlay(surface) ? NO_ROWS : Math.min(rowCount(options.previews), MAX_PENDING_PREVIEW_ROWS),
|
|
161074
|
+
menus: isOverlay(surface) ? NO_ROWS : rowCount(options.menus),
|
|
161075
|
+
surface: Math.max(NO_ROWS, rowCount(surface.size.desired) - rowCount(surface.size.minimum))
|
|
161076
|
+
};
|
|
161077
|
+
}
|
|
161078
|
+
function totalOptional(rows) {
|
|
161079
|
+
return rows.headerTitle + rows.headerPath + rows.headerRule + rows.transcript + rows.gaps + rows.previews + rows.menus + rows.surface;
|
|
161080
|
+
}
|
|
161081
|
+
function shed(rows, region, over) {
|
|
161082
|
+
if (over <= NO_ROWS)
|
|
161083
|
+
return over;
|
|
161084
|
+
const cut = Math.min(rows[region], over);
|
|
161085
|
+
rows[region] -= cut;
|
|
161086
|
+
return over - cut;
|
|
161087
|
+
}
|
|
161088
|
+
function reduceOptional(desired, excess) {
|
|
161089
|
+
const rows = { ...desired };
|
|
161090
|
+
let over = excess;
|
|
161091
|
+
if (over > NO_ROWS) {
|
|
161092
|
+
over -= rows.gaps;
|
|
161093
|
+
rows.gaps = NO_ROWS;
|
|
161094
|
+
}
|
|
161095
|
+
over = shed(rows, "previews", over);
|
|
161096
|
+
over = shed(rows, "menus", over);
|
|
161097
|
+
over = shed(rows, "surface", over);
|
|
161098
|
+
if (over > NO_ROWS) {
|
|
161099
|
+
over -= rows.headerPath + rows.headerRule;
|
|
161100
|
+
rows.headerPath = NO_ROWS;
|
|
161101
|
+
rows.headerRule = NO_ROWS;
|
|
161102
|
+
}
|
|
161103
|
+
if (over > NO_ROWS) {
|
|
161104
|
+
over -= rows.headerTitle;
|
|
161105
|
+
rows.headerTitle = NO_ROWS;
|
|
161106
|
+
}
|
|
161107
|
+
if (over > NO_ROWS) {
|
|
161108
|
+
over -= rows.transcript;
|
|
161109
|
+
rows.transcript = NO_ROWS;
|
|
161110
|
+
}
|
|
161111
|
+
return { ...rows, transcript: rows.transcript + Math.max(NO_ROWS, -over) };
|
|
161112
|
+
}
|
|
161113
|
+
function stackRegions(counts) {
|
|
161114
|
+
let top = NO_ROWS;
|
|
161115
|
+
const place = (rows) => {
|
|
161116
|
+
const region = { rows, top };
|
|
161117
|
+
top += rows;
|
|
161118
|
+
return region;
|
|
161119
|
+
};
|
|
161120
|
+
return {
|
|
161121
|
+
headerTitle: place(counts.headerTitle),
|
|
161122
|
+
headerPath: place(counts.headerPath),
|
|
161123
|
+
headerRule: place(counts.headerRule),
|
|
161124
|
+
transcript: place(counts.transcript),
|
|
161125
|
+
statusGapBefore: place(counts.statusGapBefore),
|
|
161126
|
+
status: place(counts.status),
|
|
161127
|
+
statusGapAfter: place(counts.statusGapAfter),
|
|
161128
|
+
previews: place(counts.previews),
|
|
161129
|
+
surface: place(counts.surface),
|
|
161130
|
+
menus: place(counts.menus),
|
|
161131
|
+
diagnostic: place(counts.diagnostic),
|
|
161132
|
+
footer: place(counts.footer)
|
|
161133
|
+
};
|
|
161134
|
+
}
|
|
161135
|
+
function stackedRows(regions) {
|
|
161136
|
+
return regions.footer.top + regions.footer.rows;
|
|
161137
|
+
}
|
|
161138
|
+
function targetsFor(fitted, drawn) {
|
|
161139
|
+
const unlocked = !fitted.locked;
|
|
161140
|
+
const inputSurface = fitted.kind === "input";
|
|
161141
|
+
return {
|
|
161142
|
+
ask: unlocked && fitted.kind === "ask",
|
|
161143
|
+
picker: unlocked && fitted.kind === "picker",
|
|
161144
|
+
input: unlocked && inputSurface,
|
|
161145
|
+
menus: unlocked && inputSurface && drawn.menus.rows > NO_ROWS,
|
|
161146
|
+
transcript: unlocked && fitted.kind !== "picker" && drawn.transcript.rows > NO_ROWS,
|
|
161147
|
+
footer: inputSurface && drawn.menus.rows === NO_ROWS && drawn.footer.rows > NO_ROWS
|
|
161148
|
+
};
|
|
161149
|
+
}
|
|
161150
|
+
function interactiveFrame(fitted) {
|
|
161151
|
+
const gaps = fitted.rows.gaps;
|
|
161152
|
+
const regions = stackRegions({
|
|
161153
|
+
headerTitle: fitted.rows.headerTitle,
|
|
161154
|
+
headerPath: fitted.rows.headerPath,
|
|
161155
|
+
headerRule: fitted.rows.headerRule,
|
|
161156
|
+
transcript: fitted.rows.transcript,
|
|
161157
|
+
statusGapBefore: gaps > NO_ROWS ? STATUS_GAP_ROWS : NO_ROWS,
|
|
161158
|
+
status: fitted.working ? STATUS_ROWS : NO_ROWS,
|
|
161159
|
+
statusGapAfter: gaps > NO_ROWS ? gaps - STATUS_GAP_ROWS : NO_ROWS,
|
|
161160
|
+
previews: fitted.rows.previews,
|
|
161161
|
+
surface: rowCount(fitted.size.minimum) + fitted.rows.surface,
|
|
161162
|
+
menus: fitted.rows.menus,
|
|
161163
|
+
diagnostic: NO_ROWS,
|
|
161164
|
+
footer: FOOTER_ROWS
|
|
161165
|
+
});
|
|
161166
|
+
return {
|
|
161167
|
+
surface: fitted.kind,
|
|
161168
|
+
height: fitted.height,
|
|
161169
|
+
usable: fitted.usable,
|
|
161170
|
+
rows: stackedRows(regions),
|
|
161171
|
+
regions,
|
|
161172
|
+
targets: targetsFor(fitted, regions)
|
|
161173
|
+
};
|
|
161174
|
+
}
|
|
161175
|
+
function diagnosticFrame(height, usable) {
|
|
161176
|
+
const regions = stackRegions({
|
|
161177
|
+
headerTitle: NO_ROWS,
|
|
161178
|
+
headerPath: NO_ROWS,
|
|
161179
|
+
headerRule: NO_ROWS,
|
|
161180
|
+
transcript: NO_ROWS,
|
|
161181
|
+
statusGapBefore: NO_ROWS,
|
|
161182
|
+
status: NO_ROWS,
|
|
161183
|
+
statusGapAfter: NO_ROWS,
|
|
161184
|
+
previews: NO_ROWS,
|
|
161185
|
+
surface: NO_ROWS,
|
|
161186
|
+
menus: NO_ROWS,
|
|
161187
|
+
diagnostic: Math.min(DIAGNOSTIC_ROWS, usable),
|
|
161188
|
+
footer: NO_ROWS
|
|
161189
|
+
});
|
|
161190
|
+
return { surface: "diagnostic", height, usable, rows: stackedRows(regions), regions, targets: NO_TARGETS };
|
|
161191
|
+
}
|
|
161192
|
+
function allocateChatFrame(options) {
|
|
161193
|
+
const height = frameHeight(options.rows);
|
|
161194
|
+
const usable = usableFrameRows(height);
|
|
161195
|
+
const surface = visibleSurface(options);
|
|
161196
|
+
const working = options.working === true;
|
|
161197
|
+
const essential = rowCount(surface.size.minimum) + FOOTER_ROWS + (working ? STATUS_ROWS : NO_ROWS);
|
|
161198
|
+
if (essential > usable)
|
|
161199
|
+
return diagnosticFrame(height, usable);
|
|
161200
|
+
const desired = desiredOptional(options, surface);
|
|
161201
|
+
const rows = reduceOptional(desired, essential + totalOptional(desired) - usable);
|
|
161202
|
+
return interactiveFrame({ ...surface, height, usable, rows, working, locked: options.locked === true });
|
|
161203
|
+
}
|
|
161204
|
+
var FRAME_SLACK_ROWS = 1, DIAGNOSTIC_ROWS = 1, HEADER_TITLE_ROWS = 1, HEADER_PATH_ROWS = 1, HEADER_RULE_ROWS = 1, FOOTER_ROWS = 1, TRANSCRIPT_ROWS = 1, STATUS_ROWS = 1, STATUS_GAP_ROWS = 1, NO_ROWS = 0, FALLBACK_ROWS = 24, TERMINAL_TOO_SMALL = "Terminal too small \u2014 enlarge to continue", NO_TARGETS;
|
|
161205
|
+
var init_frame_layout = __esm(async () => {
|
|
161206
|
+
await init_message_queue();
|
|
161207
|
+
NO_TARGETS = {
|
|
161208
|
+
ask: false,
|
|
161209
|
+
picker: false,
|
|
161210
|
+
input: false,
|
|
161211
|
+
menus: false,
|
|
161212
|
+
transcript: false,
|
|
161213
|
+
footer: false
|
|
161214
|
+
};
|
|
161215
|
+
});
|
|
161216
|
+
|
|
161217
|
+
// src/tui/chat/frame-surfaces.ts
|
|
161218
|
+
function measureFrameSurfaces(options) {
|
|
161219
|
+
const { draft, input, ask, askModel, answer, picker, theme } = options;
|
|
161220
|
+
return {
|
|
161221
|
+
input: measureInput(draft, input),
|
|
161222
|
+
ask: ask === undefined || askModel === undefined ? undefined : measureAskCard(askModel, {
|
|
161223
|
+
width: input.width,
|
|
161224
|
+
theme,
|
|
161225
|
+
answer,
|
|
161226
|
+
expiresAt: ask.expiresAt
|
|
161227
|
+
}),
|
|
161228
|
+
picker: picker === undefined ? undefined : measurePicker(picker)
|
|
161229
|
+
};
|
|
161230
|
+
}
|
|
161231
|
+
var init_frame_surfaces = __esm(async () => {
|
|
161232
|
+
await __promiseAll([
|
|
161233
|
+
init_AskCard(),
|
|
161234
|
+
init_ChatInput(),
|
|
161235
|
+
init_Picker()
|
|
161236
|
+
]);
|
|
161237
|
+
});
|
|
161238
|
+
|
|
160886
161239
|
// src/tui/chat/image-draft.ts
|
|
160887
161240
|
function imagePlaceholder(number) {
|
|
160888
161241
|
return `[Image #${number}]`;
|
|
@@ -169881,42 +170234,6 @@ var init_MentionMenu = __esm(async () => {
|
|
|
169881
170234
|
jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
169882
170235
|
});
|
|
169883
170236
|
|
|
169884
|
-
// src/tui/chat/message-queue.ts
|
|
169885
|
-
function pushQueued(queue, text) {
|
|
169886
|
-
return [...queue, text];
|
|
169887
|
-
}
|
|
169888
|
-
function leadsWith(queue, texts) {
|
|
169889
|
-
return texts.length <= queue.length && texts.every((text, index) => queue[index] === text);
|
|
169890
|
-
}
|
|
169891
|
-
function pushDiscardedSteer(group, queue, text) {
|
|
169892
|
-
const leading = group !== undefined && leadsWith(queue, group.texts) ? group.texts : [];
|
|
169893
|
-
const texts = [...leading, text];
|
|
169894
|
-
return { group: { texts }, queue: [...texts, ...queue.slice(leading.length)] };
|
|
169895
|
-
}
|
|
169896
|
-
function takeQueued(queue) {
|
|
169897
|
-
const [text, ...rest] = queue;
|
|
169898
|
-
return text === undefined ? undefined : { text, rest };
|
|
169899
|
-
}
|
|
169900
|
-
function queueToPrompt(queue, draft) {
|
|
169901
|
-
return [...queue, draft].filter((line) => line !== "").join(`
|
|
169902
|
-
`);
|
|
169903
|
-
}
|
|
169904
|
-
function queueRowLines(queue) {
|
|
169905
|
-
const shown = queue.slice(0, MAX_QUEUED_ROWS).map((text) => `${QUEUED_MARKER}${oneLine3(sanitizeText(text))}`);
|
|
169906
|
-
const hidden = queue.length - shown.length;
|
|
169907
|
-
return hidden > 0 ? [...shown, `${MORE_PREFIX}${hidden}${MORE_SUFFIX}`] : shown;
|
|
169908
|
-
}
|
|
169909
|
-
function steeringRowLines(steering) {
|
|
169910
|
-
return steering.map((row) => `${STEERING_MARKER}${oneLine3(sanitizeText(row.text))}`);
|
|
169911
|
-
}
|
|
169912
|
-
var MAX_QUEUED_ROWS = 3, QUEUED_MARKER = "queued \xB7 ", STEERING_MARKER = "steering \xB7 ", MORE_PREFIX = "+", MORE_SUFFIX = " more";
|
|
169913
|
-
var init_message_queue = __esm(async () => {
|
|
169914
|
-
await __promiseAll([
|
|
169915
|
-
init_layout_lines(),
|
|
169916
|
-
init_styled_line()
|
|
169917
|
-
]);
|
|
169918
|
-
});
|
|
169919
|
-
|
|
169920
170237
|
// src/tui/chat/help-text.ts
|
|
169921
170238
|
function counted(count, singular, plural) {
|
|
169922
170239
|
return `${count} ${count === 1 ? singular : plural}`;
|
|
@@ -170276,11 +170593,11 @@ function filterSlashMenu(items, input) {
|
|
|
170276
170593
|
return [...equal, ...starting, ...containing];
|
|
170277
170594
|
}
|
|
170278
170595
|
function slashMenuRows(count, maxRows = SLASH_MENU_MAX_ROWS) {
|
|
170279
|
-
return Math.min(Math.max(count, FIRST_MATCH), Math.max(
|
|
170596
|
+
return Math.min(Math.max(count, FIRST_MATCH), Math.max(NO_ROWS2, maxRows));
|
|
170280
170597
|
}
|
|
170281
170598
|
function slashMenuWindow(count, selected, maxRows = SLASH_MENU_MAX_ROWS) {
|
|
170282
170599
|
const rows = slashMenuRows(count, maxRows);
|
|
170283
|
-
if (rows ===
|
|
170600
|
+
if (rows === NO_ROWS2)
|
|
170284
170601
|
return { first: FIRST_MATCH, rows };
|
|
170285
170602
|
const furthest = Math.max(FIRST_MATCH, count - rows);
|
|
170286
170603
|
return { first: Math.min(Math.max(selected - rows + 1, FIRST_MATCH), furthest), rows };
|
|
@@ -170296,7 +170613,7 @@ function slashMenuQueryState(input) {
|
|
|
170296
170613
|
reopen: input.dismissed !== undefined && input.dismissed !== input.query
|
|
170297
170614
|
};
|
|
170298
170615
|
}
|
|
170299
|
-
var WHITESPACE3, SLASH_MENU_MAX_ROWS = 8, FIRST_MATCH = 0,
|
|
170616
|
+
var WHITESPACE3, SLASH_MENU_MAX_ROWS = 8, FIRST_MATCH = 0, NO_ROWS2 = 0;
|
|
170300
170617
|
var init_slash_menu = __esm(async () => {
|
|
170301
170618
|
init_slash_commands();
|
|
170302
170619
|
await __promiseAll([
|
|
@@ -170610,6 +170927,7 @@ function footerSegments(input) {
|
|
|
170610
170927
|
}
|
|
170611
170928
|
var SEPARATOR5 = " \xB7 ";
|
|
170612
170929
|
var init_footer_segments = __esm(async () => {
|
|
170930
|
+
init_context_span();
|
|
170613
170931
|
await __promiseAll([
|
|
170614
170932
|
init_chat_status(),
|
|
170615
170933
|
init_layout_lines()
|
|
@@ -170984,7 +171302,7 @@ function ViewportRows({ visible, rows, offset, unseen, theme }) {
|
|
|
170984
171302
|
}, index)),
|
|
170985
171303
|
Array.from({ length: padding }, (_unused, index) => /* @__PURE__ */ jsx_runtime8.jsx(ViewportRow, {
|
|
170986
171304
|
children: /* @__PURE__ */ jsx_runtime8.jsx(Text, {
|
|
170987
|
-
children:
|
|
171305
|
+
children: BLANK_ROW2
|
|
170988
171306
|
})
|
|
170989
171307
|
}, `padding-${index}`)),
|
|
170990
171308
|
marker === undefined ? null : /* @__PURE__ */ jsx_runtime8.jsx(ViewportRow, {
|
|
@@ -171010,6 +171328,7 @@ function TranscriptViewport({
|
|
|
171010
171328
|
followToken = 0
|
|
171011
171329
|
}) {
|
|
171012
171330
|
const rows = viewRows(height);
|
|
171331
|
+
active = active && rows > 0;
|
|
171013
171332
|
const total = lines.length;
|
|
171014
171333
|
const [memory, setMemory] = import_react37.useState({
|
|
171015
171334
|
state: INITIAL_VIEWPORT,
|
|
@@ -171017,8 +171336,9 @@ function TranscriptViewport({
|
|
|
171017
171336
|
height: rows,
|
|
171018
171337
|
token: followToken
|
|
171019
171338
|
});
|
|
171020
|
-
|
|
171021
|
-
|
|
171339
|
+
const memoryRows = rows > 0 ? rows : memory.height;
|
|
171340
|
+
if (memory.total !== total || memory.height !== memoryRows || memory.token !== followToken) {
|
|
171341
|
+
setMemory(nextMemory(memory, total, memoryRows, followToken));
|
|
171022
171342
|
}
|
|
171023
171343
|
const latestTop = import_react37.useRef(top);
|
|
171024
171344
|
latestTop.current = top;
|
|
@@ -171033,13 +171353,15 @@ function TranscriptViewport({
|
|
|
171033
171353
|
}
|
|
171034
171354
|
if (event.kind !== "wheelUp" && event.kind !== "wheelDown")
|
|
171035
171355
|
return;
|
|
171356
|
+
if (event.x < 1 || event.y <= latestTop.current || event.y > latestTop.current + rows)
|
|
171357
|
+
return;
|
|
171036
171358
|
const action = { type: event.kind };
|
|
171037
171359
|
setMemory((previous) => ({
|
|
171038
171360
|
...previous,
|
|
171039
171361
|
state: reduceViewport(previous.state, action, previous.total, previous.height)
|
|
171040
171362
|
}));
|
|
171041
171363
|
});
|
|
171042
|
-
}, [active, mouse]);
|
|
171364
|
+
}, [active, mouse, rows]);
|
|
171043
171365
|
use_input_default((_input, key) => {
|
|
171044
171366
|
const action = viewportAction(key);
|
|
171045
171367
|
if (action === undefined)
|
|
@@ -171059,6 +171381,10 @@ function TranscriptViewport({
|
|
|
171059
171381
|
});
|
|
171060
171382
|
const { start, end } = visibleRange(total, rows, memory.state.offset);
|
|
171061
171383
|
const visible = lines.slice(start, end).map((line, index) => selection ? highlightLine(line, start + index, selection) : line);
|
|
171384
|
+
if (rows === 0)
|
|
171385
|
+
return /* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
171386
|
+
height: 0
|
|
171387
|
+
});
|
|
171062
171388
|
return /* @__PURE__ */ jsx_runtime8.jsx(ViewportRows, {
|
|
171063
171389
|
visible,
|
|
171064
171390
|
rows,
|
|
@@ -171067,7 +171393,7 @@ function TranscriptViewport({
|
|
|
171067
171393
|
theme
|
|
171068
171394
|
});
|
|
171069
171395
|
}
|
|
171070
|
-
var import_react37, jsx_runtime8, MIN_VIEWPORT_ROWS =
|
|
171396
|
+
var import_react37, jsx_runtime8, MIN_VIEWPORT_ROWS = 0, ROW_HEIGHT = 1, BLANK_ROW2 = " ", UNSEEN_MARKER = "\u2193", UNSEEN_LABEL = "new lines (End)", SCROLL_LABEL = "Scroll to bottom (End)";
|
|
171071
171397
|
var init_TranscriptViewport = __esm(async () => {
|
|
171072
171398
|
init_viewport();
|
|
171073
171399
|
await __promiseAll([
|
|
@@ -172051,14 +172377,17 @@ function loneShell(host) {
|
|
|
172051
172377
|
return;
|
|
172052
172378
|
return tasks[0];
|
|
172053
172379
|
}
|
|
172380
|
+
function blockedNow(input) {
|
|
172381
|
+
return input.blocked || input.region.rows === 0 || input.canControl?.() === false;
|
|
172382
|
+
}
|
|
172054
172383
|
function stripClicked(input, pressed, released) {
|
|
172055
|
-
if (input
|
|
172384
|
+
if (blockedNow(input) || pressed.x !== released.x || pressed.y !== released.y)
|
|
172056
172385
|
return false;
|
|
172057
172386
|
const { footer, size } = input;
|
|
172058
172387
|
return footerStripHit({
|
|
172059
172388
|
x: released.x,
|
|
172060
172389
|
y: released.y,
|
|
172061
|
-
footerRow:
|
|
172390
|
+
footerRow: input.region.top + 1,
|
|
172062
172391
|
columns: size.columns,
|
|
172063
172392
|
rightWidth: spansWidth(footer.right),
|
|
172064
172393
|
stripWidth: footer.stripWidth
|
|
@@ -172080,8 +172409,8 @@ function useJobsOpener(input) {
|
|
|
172080
172409
|
use_input_default((key, modifiers) => {
|
|
172081
172410
|
if (!modifiers.ctrl || key !== JOBS_KEY)
|
|
172082
172411
|
return;
|
|
172083
|
-
const {
|
|
172084
|
-
if (
|
|
172412
|
+
const { host, open, note } = latest.current;
|
|
172413
|
+
if (blockedNow(latest.current))
|
|
172085
172414
|
return;
|
|
172086
172415
|
if (host.jobs === undefined && host.tasks === undefined) {
|
|
172087
172416
|
note(JOBS_UNAVAILABLE);
|
|
@@ -172098,7 +172427,7 @@ function useJobsOpener(input) {
|
|
|
172098
172427
|
if (event.button !== "left")
|
|
172099
172428
|
return;
|
|
172100
172429
|
if (event.kind === "press") {
|
|
172101
|
-
press.current = { x: event.x, y: event.y };
|
|
172430
|
+
press.current = blockedNow(latest.current) ? undefined : { x: event.x, y: event.y };
|
|
172102
172431
|
return;
|
|
172103
172432
|
}
|
|
172104
172433
|
if (event.kind !== "release")
|
|
@@ -172116,7 +172445,7 @@ function useJobsOpener(input) {
|
|
|
172116
172445
|
});
|
|
172117
172446
|
}, [mouse]);
|
|
172118
172447
|
}
|
|
172119
|
-
var import_react43,
|
|
172448
|
+
var import_react43, JOBS_KEY = "g", JOBS_UNAVAILABLE = "jobs are not available in this session";
|
|
172120
172449
|
var init_use_jobs_opener = __esm(async () => {
|
|
172121
172450
|
await __promiseAll([
|
|
172122
172451
|
init_build3(),
|
|
@@ -172277,7 +172606,7 @@ function useMentionMenu(options) {
|
|
|
172277
172606
|
index.get().then(settle, () => settle(NO_LIST2));
|
|
172278
172607
|
setRevision((seen) => seen + 1);
|
|
172279
172608
|
}, [index, options.editor]);
|
|
172280
|
-
const
|
|
172609
|
+
const desiredRows = (count) => Math.min(count, SLASH_MENU_MAX_ROWS);
|
|
172281
172610
|
const claim = () => {
|
|
172282
172611
|
const state = live.current;
|
|
172283
172612
|
if (state.pending)
|
|
@@ -172299,7 +172628,7 @@ function useMentionMenu(options) {
|
|
|
172299
172628
|
return false;
|
|
172300
172629
|
if (state.dismissed === state.editor.text)
|
|
172301
172630
|
return false;
|
|
172302
|
-
return
|
|
172631
|
+
return latest.current.active && latest.current.allocatedRows(desiredRows(found.matches.length), state.editor) > 0;
|
|
172303
172632
|
};
|
|
172304
172633
|
const pointerFor = (found) => {
|
|
172305
172634
|
const placed = live.current.pointer;
|
|
@@ -172368,20 +172697,29 @@ function useMentionMenu(options) {
|
|
|
172368
172697
|
if (listed === undefined)
|
|
172369
172698
|
return NO_VIEW;
|
|
172370
172699
|
if (!listed.git) {
|
|
172371
|
-
const rows =
|
|
172700
|
+
const rows = desiredRows(1);
|
|
172372
172701
|
return { ...NO_VIEW, noGit: rows > 0, rows };
|
|
172373
172702
|
}
|
|
172374
172703
|
const found = claim();
|
|
172375
172704
|
if (found === undefined)
|
|
172376
172705
|
return NO_VIEW;
|
|
172377
|
-
const rows =
|
|
172706
|
+
const rows = desiredRows(found.matches.length);
|
|
172378
172707
|
if (rows <= 0)
|
|
172379
172708
|
return NO_VIEW;
|
|
172380
172709
|
return { matches: found.matches, selected: pointerFor(found), noGit: false, rows };
|
|
172381
172710
|
};
|
|
172382
172711
|
return {
|
|
172383
172712
|
view: draw(),
|
|
172384
|
-
ownsNavigation: () =>
|
|
172713
|
+
ownsNavigation: () => {
|
|
172714
|
+
const current = latest.current;
|
|
172715
|
+
if (!current.active || current.blocked)
|
|
172716
|
+
return false;
|
|
172717
|
+
const found = claim();
|
|
172718
|
+
const rows = current.allocatedRows(desiredRows(found?.matches.length ?? 1), live.current.editor);
|
|
172719
|
+
if (rows <= 0)
|
|
172720
|
+
return false;
|
|
172721
|
+
return !current.suppressed && live.current.acted || visible(found) || current.slashOwns();
|
|
172722
|
+
},
|
|
172385
172723
|
sawEditor: (editor) => {
|
|
172386
172724
|
live.current.editor = editor;
|
|
172387
172725
|
}
|
|
@@ -172392,7 +172730,6 @@ var init_use_mention_menu = __esm(async () => {
|
|
|
172392
172730
|
init_mention_menu();
|
|
172393
172731
|
await __promiseAll([
|
|
172394
172732
|
init_build3(),
|
|
172395
|
-
init_bottom_region(),
|
|
172396
172733
|
init_slash_menu()
|
|
172397
172734
|
]);
|
|
172398
172735
|
import_react44 = __toESM(require_react(), 1);
|
|
@@ -172467,7 +172804,8 @@ function compactingStatus(current) {
|
|
|
172467
172804
|
inputTokens: 0,
|
|
172468
172805
|
outputTokens: 0,
|
|
172469
172806
|
streamedChars: 0,
|
|
172470
|
-
...current.contextTokens === undefined ? {} : { contextTokens: current.contextTokens }
|
|
172807
|
+
...current.contextTokens === undefined ? {} : { contextTokens: current.contextTokens },
|
|
172808
|
+
...current.contextWindow === undefined ? {} : { contextWindow: current.contextWindow }
|
|
172471
172809
|
};
|
|
172472
172810
|
}
|
|
172473
172811
|
function compactedNotice(result) {
|
|
@@ -172478,12 +172816,6 @@ function compactedNotice(result) {
|
|
|
172478
172816
|
function idleForJobNotice(input) {
|
|
172479
172817
|
return !input.turnRunning && !input.bottomBlocked && input.canControl;
|
|
172480
172818
|
}
|
|
172481
|
-
function queueLinesFor(queue, blocked) {
|
|
172482
|
-
return blocked ? EMPTY_QUEUE : queueRowLines(queue);
|
|
172483
|
-
}
|
|
172484
|
-
function steeringLinesFor(steering, blocked) {
|
|
172485
|
-
return blocked ? EMPTY_QUEUE : steeringRowLines(steering);
|
|
172486
|
-
}
|
|
172487
172819
|
function surfaceShown(cardOrPicker, ...menus) {
|
|
172488
172820
|
return cardOrPicker || menus.includes(true);
|
|
172489
172821
|
}
|
|
@@ -172515,6 +172847,14 @@ function ChatApp({
|
|
|
172515
172847
|
const transcriptSession = import_react47.useRef(state.sessionId);
|
|
172516
172848
|
const [entries, setEntries] = import_react47.useState(() => sessionTranscript(host));
|
|
172517
172849
|
const [status, setStatus] = import_react47.useState(IDLE_STATUS);
|
|
172850
|
+
const contextOwner = import_react47.useRef({ sessionId: state.sessionId, model: state.model });
|
|
172851
|
+
import_react47.useLayoutEffect(() => {
|
|
172852
|
+
const previous = contextOwner.current;
|
|
172853
|
+
if (previous.sessionId === state.sessionId && previous.model === state.model)
|
|
172854
|
+
return;
|
|
172855
|
+
contextOwner.current = { sessionId: state.sessionId, model: state.model };
|
|
172856
|
+
setStatus(IDLE_STATUS);
|
|
172857
|
+
}, [state.sessionId, state.model]);
|
|
172518
172858
|
const [draft, setDraft] = import_react47.useState(EMPTY_DRAFT);
|
|
172519
172859
|
const [busy, setBusy] = import_react47.useState(false);
|
|
172520
172860
|
const [queued, setQueued] = import_react47.useState(EMPTY_QUEUE);
|
|
@@ -172546,7 +172886,9 @@ function ChatApp({
|
|
|
172546
172886
|
}, []);
|
|
172547
172887
|
const append = import_react47.useCallback((entry) => appendAll([entry]), [appendAll]);
|
|
172548
172888
|
const showError = import_react47.useCallback((error) => append({ kind: "error", text: errorMessage(error) }), [append]);
|
|
172889
|
+
const interactive = import_react47.useRef(true);
|
|
172549
172890
|
const keys = useChatKeys({
|
|
172891
|
+
active: () => interactive.current,
|
|
172550
172892
|
host,
|
|
172551
172893
|
running: sending,
|
|
172552
172894
|
refresh: update,
|
|
@@ -172571,30 +172913,58 @@ function ChatApp({
|
|
|
172571
172913
|
blocked: bottomBlocked(ask, picker.model)
|
|
172572
172914
|
});
|
|
172573
172915
|
const workingShown = status.running;
|
|
172574
|
-
const usableRows = size.rows - FRAME_SLACK_ROWS;
|
|
172575
|
-
const queueLines = queueLinesFor(queued, bottomBlocked(ask, picker.model));
|
|
172576
|
-
const steeringLines = steeringLinesFor(steering, bottomBlocked(ask, picker.model));
|
|
172577
|
-
const aboveInputLines = [...steeringLines, ...queueLines];
|
|
172578
|
-
const bottomBudget = Math.max(1, usableRows - HEADER_ROWS - (workingShown ? WORKING_ROWS : 0) - aboveInputLines.length - FOOTER_ROWS - MIN_VIEWPORT_ROWS2);
|
|
172579
|
-
const menuRows = menuRowsFor({ rows: menu.rows, budget: bottomBudget });
|
|
172580
172916
|
function menuShown() {
|
|
172581
|
-
return menu.open &&
|
|
172917
|
+
return menu.open && frame.regions.menus.rows > 0;
|
|
172582
172918
|
}
|
|
172583
172919
|
function menuOwnsKeys() {
|
|
172584
|
-
return menuShown() && slashKeys.ownsKeys();
|
|
172920
|
+
return frame.targets.menus && menuShown() && slashKeys.ownsKeys();
|
|
172585
172921
|
}
|
|
172586
172922
|
const mention = useMentionMenu({
|
|
172587
172923
|
cwd,
|
|
172588
172924
|
indexFor: _chatAppDeps.mentionFileIndex,
|
|
172589
172925
|
editor: draft.editor,
|
|
172590
172926
|
blocked: bottomBlocked(ask, picker.model),
|
|
172591
|
-
suppressed:
|
|
172927
|
+
suppressed: menu.open,
|
|
172592
172928
|
slashOwns: menuOwnsKeys,
|
|
172593
|
-
|
|
172929
|
+
allocatedRows: (rows, editor) => {
|
|
172930
|
+
if (editor.text === draft.editor.text)
|
|
172931
|
+
return frame.regions.menus.rows;
|
|
172932
|
+
return allocateChatFrame({
|
|
172933
|
+
...frameOptions,
|
|
172934
|
+
input: measureInput({ ...draft, editor }, { width: size.columns, container: size.columns, busy, hint }),
|
|
172935
|
+
menus: rows
|
|
172936
|
+
}).regions.menus.rows;
|
|
172937
|
+
},
|
|
172594
172938
|
active: !keys.locked,
|
|
172595
172939
|
handle: inputHandle
|
|
172596
172940
|
});
|
|
172597
|
-
const
|
|
172941
|
+
const answer = ask?.type === "question" && ask.requestId === answerDraft.requestId ? answerDraft.draft : EMPTY_DRAFT;
|
|
172942
|
+
const askModel = ask === undefined ? undefined : askCardModel(ask, {
|
|
172943
|
+
canRemember: ask.type === "approval_requested" && host.asks.canRemember(ask),
|
|
172944
|
+
entries
|
|
172945
|
+
});
|
|
172946
|
+
const frameOptions = {
|
|
172947
|
+
rows: size.rows,
|
|
172948
|
+
...measureFrameSurfaces({
|
|
172949
|
+
draft,
|
|
172950
|
+
input: { width: size.columns, container: size.columns, busy, hint },
|
|
172951
|
+
ask,
|
|
172952
|
+
askModel,
|
|
172953
|
+
answer,
|
|
172954
|
+
picker: picker.model,
|
|
172955
|
+
theme
|
|
172956
|
+
}),
|
|
172957
|
+
menus: menu.open ? menu.rows : mention.view.rows,
|
|
172958
|
+
previews: Math.min(MAX_PENDING_PREVIEW_ROWS, steering.length + queued.length),
|
|
172959
|
+
working: workingShown,
|
|
172960
|
+
locked: keys.locked
|
|
172961
|
+
};
|
|
172962
|
+
const frame = allocateChatFrame(frameOptions);
|
|
172963
|
+
interactive.current = frame.surface !== "diagnostic";
|
|
172964
|
+
const { regions, targets } = frame;
|
|
172965
|
+
const mentionView = { ...mention.view, rows: Math.min(mention.view.rows, regions.menus.rows) };
|
|
172966
|
+
const previewLines = pendingPreviewLines({ steering, queued, budget: regions.previews.rows, columns: size.columns });
|
|
172967
|
+
const inputBudget = Math.max(1, regions.surface.rows - INPUT_RULE_ROWS);
|
|
172598
172968
|
const mentionShown = mentionView.rows > 0;
|
|
172599
172969
|
if (menu.reopen) {
|
|
172600
172970
|
slashKeys.sawDismissal(undefined);
|
|
@@ -172620,9 +172990,11 @@ function ChatApp({
|
|
|
172620
172990
|
input: inputHandle,
|
|
172621
172991
|
editor: () => editorRef.current,
|
|
172622
172992
|
notice: (text) => append({ kind: "notice", text }),
|
|
172623
|
-
active: () =>
|
|
172993
|
+
active: () => targets.input
|
|
172624
172994
|
});
|
|
172625
172995
|
use_input_default((input, key) => {
|
|
172996
|
+
if (frame.surface === "diagnostic")
|
|
172997
|
+
return;
|
|
172626
172998
|
if (key.ctrl && input === CTRL_O) {
|
|
172627
172999
|
setExpanded((current) => !current);
|
|
172628
173000
|
return;
|
|
@@ -173102,115 +173474,102 @@ function ChatApp({
|
|
|
173102
173474
|
useJobsOpener({
|
|
173103
173475
|
host,
|
|
173104
173476
|
mouse,
|
|
173105
|
-
blocked: surfaceShown(bottomBlocked(ask, picker.model), menuShown(), mentionShown),
|
|
173477
|
+
blocked: !targets.footer || surfaceShown(bottomBlocked(ask, picker.model), menuShown(), mentionShown),
|
|
173106
173478
|
footer,
|
|
173107
173479
|
size,
|
|
173480
|
+
region: regions.footer,
|
|
173481
|
+
canControl: keys.canControl,
|
|
173108
173482
|
open: picker.open,
|
|
173109
173483
|
note: (text) => append({ kind: "notice", text }),
|
|
173110
173484
|
showOutput: (entry) => void picker.showOutput(entry)
|
|
173111
173485
|
});
|
|
173112
|
-
const inputBudget = Math.max(1, bottomBudget - INPUT_RULE_ROWS - menuRows - mentionView.rows);
|
|
173113
|
-
const answer = ask?.type === "question" && ask.requestId === answerDraft.requestId ? answerDraft.draft : EMPTY_DRAFT;
|
|
173114
|
-
const askModel = ask === undefined ? undefined : askCardModel(ask, {
|
|
173115
|
-
canRemember: ask.type === "approval_requested" && host.asks.canRemember(ask),
|
|
173116
|
-
entries
|
|
173117
|
-
});
|
|
173118
|
-
const cardRows = ask === undefined || askModel === undefined ? undefined : askCardLayout(askModel, {
|
|
173119
|
-
width: columns,
|
|
173120
|
-
budget: bottomBudget,
|
|
173121
|
-
theme,
|
|
173122
|
-
answer,
|
|
173123
|
-
expiresAt: ask.expiresAt
|
|
173124
|
-
}).rows;
|
|
173125
|
-
const inputBottomRows = inputRows(draft, { width: columns, busy, container: columns, maxRows: inputBudget });
|
|
173126
|
-
const bottomRows = bottomRowsFor({
|
|
173127
|
-
ask: cardRows,
|
|
173128
|
-
picker: picker.model,
|
|
173129
|
-
input: aboveInputLines.length + inputBottomRows + menuRows + mentionView.rows,
|
|
173130
|
-
budget: bottomBudget
|
|
173131
|
-
});
|
|
173132
|
-
const viewportHeight = Math.max(MIN_VIEWPORT_ROWS2, usableRows - HEADER_ROWS - (working ? WORKING_ROWS : 0) - bottomRows - FOOTER_ROWS);
|
|
173133
173486
|
return /* @__PURE__ */ jsx_runtime9.jsxs(Box_default, {
|
|
173134
173487
|
flexDirection: "column",
|
|
173135
173488
|
width: columns,
|
|
173136
173489
|
children: [
|
|
173137
|
-
/* @__PURE__ */ jsx_runtime9.jsx(Box_default, {
|
|
173138
|
-
|
|
173139
|
-
children:
|
|
173490
|
+
header.map((row, index) => /* @__PURE__ */ jsx_runtime9.jsx(Box_default, {
|
|
173491
|
+
display: [regions.headerTitle.rows, regions.headerPath.rows, regions.headerRule.rows][index] ? "flex" : "none",
|
|
173492
|
+
children: /* @__PURE__ */ jsx_runtime9.jsx(FixedRow, {
|
|
173140
173493
|
children: /* @__PURE__ */ jsx_runtime9.jsx(StyledLineView, {
|
|
173141
173494
|
line: row,
|
|
173142
173495
|
theme
|
|
173143
173496
|
})
|
|
173144
|
-
}
|
|
173145
|
-
}),
|
|
173497
|
+
})
|
|
173498
|
+
}, index)),
|
|
173146
173499
|
/* @__PURE__ */ jsx_runtime9.jsx(TranscriptViewport, {
|
|
173147
173500
|
mouse,
|
|
173148
|
-
top:
|
|
173501
|
+
top: regions.transcript.top,
|
|
173149
173502
|
onCopy,
|
|
173150
173503
|
onClick: (line) => setEntries((rows) => toggleTranscriptLine(rows, line, layoutOptions)),
|
|
173151
173504
|
lines,
|
|
173152
|
-
height:
|
|
173505
|
+
height: regions.transcript.rows,
|
|
173153
173506
|
theme,
|
|
173154
|
-
active:
|
|
173507
|
+
active: targets.transcript,
|
|
173155
173508
|
followToken
|
|
173156
173509
|
}, state.sessionId),
|
|
173157
|
-
|
|
173510
|
+
/* @__PURE__ */ jsx_runtime9.jsx(AllocatedLine, {
|
|
173511
|
+
region: regions.statusGapBefore,
|
|
173512
|
+
line: [{ text: " " }],
|
|
173513
|
+
theme
|
|
173514
|
+
}),
|
|
173515
|
+
/* @__PURE__ */ jsx_runtime9.jsx(AllocatedLine, {
|
|
173516
|
+
region: regions.status,
|
|
173517
|
+
line: working,
|
|
173518
|
+
theme
|
|
173519
|
+
}),
|
|
173520
|
+
/* @__PURE__ */ jsx_runtime9.jsx(AllocatedLine, {
|
|
173521
|
+
region: regions.statusGapAfter,
|
|
173522
|
+
line: [{ text: " " }],
|
|
173523
|
+
theme
|
|
173524
|
+
}),
|
|
173525
|
+
previewLines.map((text, index) => /* @__PURE__ */ jsx_runtime9.jsx(FixedRow, {
|
|
173158
173526
|
children: /* @__PURE__ */ jsx_runtime9.jsx(StyledLineView, {
|
|
173159
|
-
line:
|
|
173527
|
+
line: [{ text, color: "muted" }],
|
|
173160
173528
|
theme
|
|
173161
173529
|
})
|
|
173162
|
-
})
|
|
173163
|
-
|
|
173164
|
-
|
|
173530
|
+
}, index)),
|
|
173531
|
+
/* @__PURE__ */ jsx_runtime9.jsx(Box_default, {
|
|
173532
|
+
display: frame.surface === "ask" ? "flex" : "none",
|
|
173533
|
+
height: regions.surface.rows,
|
|
173165
173534
|
overflow: "hidden",
|
|
173166
173535
|
flexDirection: "column",
|
|
173167
|
-
children: /* @__PURE__ */ jsx_runtime9.jsx(AskCard, {
|
|
173536
|
+
children: ask !== undefined && askModel !== undefined ? /* @__PURE__ */ jsx_runtime9.jsx(AskCard, {
|
|
173168
173537
|
ask,
|
|
173169
173538
|
model: askModel,
|
|
173170
173539
|
controller: host.asks,
|
|
173171
173540
|
width: columns,
|
|
173172
|
-
budget:
|
|
173541
|
+
budget: regions.surface.rows,
|
|
173173
173542
|
theme,
|
|
173174
173543
|
answer,
|
|
173175
173544
|
onAnswerChange: (next) => setAnswerDraft({ requestId: ask.requestId, draft: next }),
|
|
173176
173545
|
onDeclined: () => setHint(TELL_NAX_HINT),
|
|
173177
173546
|
onDismiss: () => dismissQuestion(ask),
|
|
173178
|
-
active:
|
|
173179
|
-
}, ask.requestId)
|
|
173180
|
-
})
|
|
173181
|
-
|
|
173547
|
+
active: targets.ask
|
|
173548
|
+
}, ask.requestId) : null
|
|
173549
|
+
}),
|
|
173550
|
+
/* @__PURE__ */ jsx_runtime9.jsx(Box_default, {
|
|
173551
|
+
display: frame.surface === "picker" ? "flex" : "none",
|
|
173552
|
+
height: regions.surface.rows,
|
|
173182
173553
|
overflow: "hidden",
|
|
173183
173554
|
flexDirection: "column",
|
|
173184
|
-
children: /* @__PURE__ */ jsx_runtime9.jsx(Picker, {
|
|
173555
|
+
children: picker.model !== undefined ? /* @__PURE__ */ jsx_runtime9.jsx(Picker, {
|
|
173185
173556
|
model: picker.model,
|
|
173186
173557
|
width: columns,
|
|
173187
173558
|
theme,
|
|
173188
|
-
budget:
|
|
173189
|
-
active:
|
|
173559
|
+
budget: regions.surface.rows,
|
|
173560
|
+
active: targets.picker,
|
|
173190
173561
|
onChoose: picker.choose,
|
|
173191
173562
|
onCycle: picker.cycle,
|
|
173192
173563
|
onStop: picker.stop,
|
|
173193
173564
|
onCancel: picker.cancel,
|
|
173194
173565
|
onQuery: picker.setQuery,
|
|
173195
173566
|
query: picker.model.query
|
|
173196
|
-
})
|
|
173197
|
-
})
|
|
173198
|
-
|
|
173199
|
-
|
|
173567
|
+
}) : null
|
|
173568
|
+
}),
|
|
173569
|
+
/* @__PURE__ */ jsx_runtime9.jsxs(Box_default, {
|
|
173570
|
+
display: frame.surface === "input" ? "flex" : "none",
|
|
173200
173571
|
flexDirection: "column",
|
|
173201
173572
|
children: [
|
|
173202
|
-
steeringLines.map((text, index) => /* @__PURE__ */ jsx_runtime9.jsx(FixedRow, {
|
|
173203
|
-
children: /* @__PURE__ */ jsx_runtime9.jsx(StyledLineView, {
|
|
173204
|
-
line: [{ text, color: "muted" }],
|
|
173205
|
-
theme
|
|
173206
|
-
})
|
|
173207
|
-
}, index)),
|
|
173208
|
-
queueLines.map((text, index) => /* @__PURE__ */ jsx_runtime9.jsx(FixedRow, {
|
|
173209
|
-
children: /* @__PURE__ */ jsx_runtime9.jsx(StyledLineView, {
|
|
173210
|
-
line: [{ text, color: "muted" }],
|
|
173211
|
-
theme
|
|
173212
|
-
})
|
|
173213
|
-
}, index)),
|
|
173214
173573
|
/* @__PURE__ */ jsx_runtime9.jsx(ChatInput, {
|
|
173215
173574
|
draft,
|
|
173216
173575
|
onDraftChange: changeDraft,
|
|
@@ -173223,7 +173582,7 @@ function ChatApp({
|
|
|
173223
173582
|
busyNow: () => sending.current,
|
|
173224
173583
|
width: columns,
|
|
173225
173584
|
theme,
|
|
173226
|
-
active:
|
|
173585
|
+
active: targets.input,
|
|
173227
173586
|
busy,
|
|
173228
173587
|
maxRows: inputBudget,
|
|
173229
173588
|
hint,
|
|
@@ -173231,20 +173590,26 @@ function ChatApp({
|
|
|
173231
173590
|
handle: inputHandle,
|
|
173232
173591
|
onClearArmedChange: setClearArmed
|
|
173233
173592
|
}),
|
|
173234
|
-
|
|
173235
|
-
|
|
173236
|
-
|
|
173237
|
-
|
|
173238
|
-
|
|
173239
|
-
|
|
173240
|
-
|
|
173241
|
-
|
|
173242
|
-
|
|
173243
|
-
|
|
173244
|
-
|
|
173245
|
-
|
|
173246
|
-
|
|
173247
|
-
|
|
173593
|
+
/* @__PURE__ */ jsx_runtime9.jsx(Box_default, {
|
|
173594
|
+
display: menuShown() ? "flex" : "none",
|
|
173595
|
+
height: regions.menus.rows,
|
|
173596
|
+
overflow: "hidden",
|
|
173597
|
+
flexDirection: "column",
|
|
173598
|
+
children: /* @__PURE__ */ jsx_runtime9.jsx(SlashMenu, {
|
|
173599
|
+
menu,
|
|
173600
|
+
width: columns,
|
|
173601
|
+
theme,
|
|
173602
|
+
active: targets.menus && menu.open,
|
|
173603
|
+
ownsKeys: menuOwnsKeys,
|
|
173604
|
+
maxRows: regions.menus.rows,
|
|
173605
|
+
onComplete: completeCommand,
|
|
173606
|
+
onRun: runCommandLine,
|
|
173607
|
+
onClose: () => {
|
|
173608
|
+
slashKeys.sawDismissal(menu.query);
|
|
173609
|
+
setDismissedQuery(menu.query);
|
|
173610
|
+
}
|
|
173611
|
+
})
|
|
173612
|
+
}),
|
|
173248
173613
|
/* @__PURE__ */ jsx_runtime9.jsx(MentionMenu, {
|
|
173249
173614
|
view: mentionView,
|
|
173250
173615
|
width: columns,
|
|
@@ -173252,11 +173617,16 @@ function ChatApp({
|
|
|
173252
173617
|
})
|
|
173253
173618
|
]
|
|
173254
173619
|
}),
|
|
173255
|
-
/* @__PURE__ */ jsx_runtime9.
|
|
173620
|
+
/* @__PURE__ */ jsx_runtime9.jsx(AllocatedLine, {
|
|
173621
|
+
region: regions.diagnostic,
|
|
173622
|
+
line: cutSpans([{ text: TERMINAL_TOO_SMALL }], columns),
|
|
173623
|
+
theme
|
|
173624
|
+
}),
|
|
173625
|
+
regions.footer.rows > 0 ? /* @__PURE__ */ jsx_runtime9.jsxs(Box_default, {
|
|
173256
173626
|
flexDirection: "row",
|
|
173257
173627
|
justifyContent: "space-between",
|
|
173258
173628
|
width: columns,
|
|
173259
|
-
height:
|
|
173629
|
+
height: regions.footer.rows,
|
|
173260
173630
|
overflow: "hidden",
|
|
173261
173631
|
children: [
|
|
173262
173632
|
/* @__PURE__ */ jsx_runtime9.jsx(StyledLineView, {
|
|
@@ -173268,11 +173638,11 @@ function ChatApp({
|
|
|
173268
173638
|
theme
|
|
173269
173639
|
})
|
|
173270
173640
|
]
|
|
173271
|
-
})
|
|
173641
|
+
}) : null
|
|
173272
173642
|
]
|
|
173273
173643
|
});
|
|
173274
173644
|
}
|
|
173275
|
-
var import_react47, jsx_runtime9, _chatAppDeps,
|
|
173645
|
+
var import_react47, jsx_runtime9, _chatAppDeps, DEFAULT_COLUMNS = 80, DEFAULT_ROWS = 24, SANDBOX_WARNING = "sandbox unavailable: commands run outside the sandbox", TURN_BUSY_NOTICE = "wait for the turn to finish (Ctrl-C to interrupt)", QUIT = "quit", COMPACTION_UNAVAILABLE = "compaction is not available in this session", NOTHING_TO_COMPACT = "nothing to compact", COMPACTING2 = "compacting", COMPACTED = "compacted", COMPACT_ARROW = "\u2192", IMAGES_NOT_QUEUED = "images cannot be queued; send it after the turn ends", IMAGES_PLAIN_ONLY = "images can only be sent with a plain message", LINE_NOT_SENT = "not sent: ", TELL_NAX_HINT = "tell nax what to do instead", CTRL_O = "o", CTRL_V = "v", CTRL_S = "s", DEFAULT_THEME, NO_ANSWER2, EMPTY_QUEUE, EMPTY_STEERING;
|
|
173276
173646
|
var init_ChatApp = __esm(async () => {
|
|
173277
173647
|
init_internal();
|
|
173278
173648
|
init_chat2();
|
|
@@ -173301,6 +173671,8 @@ var init_ChatApp = __esm(async () => {
|
|
|
173301
173671
|
init_chat_status(),
|
|
173302
173672
|
init_esc_confirm(),
|
|
173303
173673
|
init_FixedRow(),
|
|
173674
|
+
init_frame_layout(),
|
|
173675
|
+
init_frame_surfaces(),
|
|
173304
173676
|
init_layout(),
|
|
173305
173677
|
init_MentionMenu(),
|
|
173306
173678
|
init_message_queue(),
|
|
@@ -173316,7 +173688,8 @@ var init_ChatApp = __esm(async () => {
|
|
|
173316
173688
|
init_use_jobs_opener(),
|
|
173317
173689
|
init_use_mention_menu(),
|
|
173318
173690
|
init_use_slash_menu_keys(),
|
|
173319
|
-
init_useChatKeys()
|
|
173691
|
+
init_useChatKeys(),
|
|
173692
|
+
init_wrap()
|
|
173320
173693
|
]);
|
|
173321
173694
|
import_react47 = __toESM(require_react(), 1);
|
|
173322
173695
|
jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|