adhdev 0.7.42 → 0.7.43
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/cli/index.js +74 -118
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +74 -118
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.d.mts +1 -0
- package/vendor/session-host-daemon/index.d.ts +1 -0
- package/vendor/session-host-daemon/index.js +82 -12
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +82 -12
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js +2 -2
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js.map +1 -1
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs +2 -2
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2539,8 +2539,6 @@ var init_chat_history = __esm({
|
|
|
2539
2539
|
lastSeenCounts = /* @__PURE__ */ new Map();
|
|
2540
2540
|
/** Last seen message hash per agent (deduplication) */
|
|
2541
2541
|
lastSeenHashes = /* @__PURE__ */ new Map();
|
|
2542
|
-
/** Last seen append-only terminal transcript per agent */
|
|
2543
|
-
lastSeenTerminal = /* @__PURE__ */ new Map();
|
|
2544
2542
|
rotated = false;
|
|
2545
2543
|
/**
|
|
2546
2544
|
* Append new messages to history
|
|
@@ -2598,51 +2596,10 @@ var init_chat_history = __esm({
|
|
|
2598
2596
|
} catch {
|
|
2599
2597
|
}
|
|
2600
2598
|
}
|
|
2601
|
-
appendTerminalHistory(agentType, terminalHistory, sessionTitle, instanceId) {
|
|
2602
|
-
const next = String(terminalHistory || "");
|
|
2603
|
-
if (!next.trim()) return;
|
|
2604
|
-
try {
|
|
2605
|
-
const dedupKey = instanceId ? `${agentType}:${instanceId}:terminal` : `${agentType}:terminal`;
|
|
2606
|
-
const prev = this.lastSeenTerminal.get(dedupKey) || "";
|
|
2607
|
-
if (prev === next) return;
|
|
2608
|
-
let delta = "";
|
|
2609
|
-
if (!prev) {
|
|
2610
|
-
delta = next;
|
|
2611
|
-
} else if (next.startsWith(prev)) {
|
|
2612
|
-
delta = next.slice(prev.length);
|
|
2613
|
-
} else if (prev.includes(next)) {
|
|
2614
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2615
|
-
return;
|
|
2616
|
-
} else {
|
|
2617
|
-
delta = `
|
|
2618
|
-
|
|
2619
|
-
[terminal snapshot reset ${(/* @__PURE__ */ new Date()).toISOString()} | ${sessionTitle || agentType}]
|
|
2620
|
-
${next}`;
|
|
2621
|
-
}
|
|
2622
|
-
if (!delta) {
|
|
2623
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2624
|
-
return;
|
|
2625
|
-
}
|
|
2626
|
-
const dir = path4.join(HISTORY_DIR, this.sanitize(agentType));
|
|
2627
|
-
fs3.mkdirSync(dir, { recursive: true });
|
|
2628
|
-
const date5 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2629
|
-
const filePrefix = instanceId ? `${this.sanitize(instanceId)}_` : "";
|
|
2630
|
-
const filePath = path4.join(dir, `${filePrefix}${date5}.terminal.log`);
|
|
2631
|
-
fs3.appendFileSync(filePath, delta, "utf-8");
|
|
2632
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2633
|
-
if (!this.rotated) {
|
|
2634
|
-
this.rotated = true;
|
|
2635
|
-
this.rotateOldFiles().catch(() => {
|
|
2636
|
-
});
|
|
2637
|
-
}
|
|
2638
|
-
} catch {
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
2599
|
/** Called when agent session is explicitly changed */
|
|
2642
2600
|
onSessionChange(agentType) {
|
|
2643
2601
|
this.lastSeenHashes.delete(agentType);
|
|
2644
2602
|
this.lastSeenCounts.delete(agentType);
|
|
2645
|
-
this.lastSeenTerminal.delete(`${agentType}:terminal`);
|
|
2646
2603
|
}
|
|
2647
2604
|
/** Delete history files older than 30 days */
|
|
2648
2605
|
async rotateOldFiles() {
|
|
@@ -3488,11 +3445,6 @@ function truncateString(value, maxChars) {
|
|
|
3488
3445
|
if (maxChars <= 12) return value.slice(0, Math.max(0, maxChars));
|
|
3489
3446
|
return `${value.slice(0, maxChars - 12)}...[truncated]`;
|
|
3490
3447
|
}
|
|
3491
|
-
function truncateStringTail(value, maxChars) {
|
|
3492
|
-
if (value.length <= maxChars) return value;
|
|
3493
|
-
if (maxChars <= 12) return value.slice(value.length - Math.max(0, maxChars));
|
|
3494
|
-
return `...[truncated]${value.slice(value.length - (maxChars - 12))}`;
|
|
3495
|
-
}
|
|
3496
3448
|
function trimStructuredStrings(value, maxChars) {
|
|
3497
3449
|
if (typeof value === "string") return truncateString(value, maxChars);
|
|
3498
3450
|
if (Array.isArray(value)) return value.map((item) => trimStructuredStrings(item, maxChars));
|
|
@@ -3566,11 +3518,10 @@ function normalizeActiveChatData(activeChat) {
|
|
|
3566
3518
|
(button) => truncateString(String(button || ""), STATUS_MODAL_BUTTON_LIMIT)
|
|
3567
3519
|
)
|
|
3568
3520
|
} : activeChat.activeModal,
|
|
3569
|
-
terminalHistory: activeChat.terminalHistory ? truncateStringTail(activeChat.terminalHistory, STATUS_TERMINAL_HISTORY_LIMIT) : activeChat.terminalHistory,
|
|
3570
3521
|
inputContent: activeChat.inputContent ? truncateString(activeChat.inputContent, STATUS_INPUT_CONTENT_LIMIT) : activeChat.inputContent
|
|
3571
3522
|
};
|
|
3572
3523
|
}
|
|
3573
|
-
var WORKING_STATUSES, STATUS_ACTIVE_CHAT_MESSAGE_LIMIT, STATUS_ACTIVE_CHAT_TOTAL_BYTES_LIMIT, STATUS_ACTIVE_CHAT_STRING_LIMIT, STATUS_ACTIVE_CHAT_FALLBACK_STRING_LIMIT,
|
|
3524
|
+
var WORKING_STATUSES, STATUS_ACTIVE_CHAT_MESSAGE_LIMIT, STATUS_ACTIVE_CHAT_TOTAL_BYTES_LIMIT, STATUS_ACTIVE_CHAT_STRING_LIMIT, STATUS_ACTIVE_CHAT_FALLBACK_STRING_LIMIT, STATUS_INPUT_CONTENT_LIMIT, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT;
|
|
3574
3525
|
var init_normalize = __esm({
|
|
3575
3526
|
"../../oss/packages/daemon-core/src/status/normalize.ts"() {
|
|
3576
3527
|
"use strict";
|
|
@@ -3586,7 +3537,6 @@ var init_normalize = __esm({
|
|
|
3586
3537
|
STATUS_ACTIVE_CHAT_TOTAL_BYTES_LIMIT = 96 * 1024;
|
|
3587
3538
|
STATUS_ACTIVE_CHAT_STRING_LIMIT = 4 * 1024;
|
|
3588
3539
|
STATUS_ACTIVE_CHAT_FALLBACK_STRING_LIMIT = 1024;
|
|
3589
|
-
STATUS_TERMINAL_HISTORY_LIMIT = 8 * 1024;
|
|
3590
3540
|
STATUS_INPUT_CONTENT_LIMIT = 2 * 1024;
|
|
3591
3541
|
STATUS_MODAL_MESSAGE_LIMIT = 2 * 1024;
|
|
3592
3542
|
STATUS_MODAL_BUTTON_LIMIT = 120;
|
|
@@ -9093,6 +9043,9 @@ var init_ghostty_vt_backend = __esm({
|
|
|
9093
9043
|
getText() {
|
|
9094
9044
|
return this.terminal.formatPlainText({ trim: true }) || "";
|
|
9095
9045
|
}
|
|
9046
|
+
getCursorPosition() {
|
|
9047
|
+
return this.terminal.getCursorPosition();
|
|
9048
|
+
}
|
|
9096
9049
|
dispose() {
|
|
9097
9050
|
this.terminal.dispose();
|
|
9098
9051
|
}
|
|
@@ -18245,6 +18198,13 @@ var init_xterm_backend = __esm({
|
|
|
18245
18198
|
while (last > first && !lines[last - 1]?.trim()) last--;
|
|
18246
18199
|
return lines.slice(first, last).join("\n");
|
|
18247
18200
|
}
|
|
18201
|
+
getCursorPosition() {
|
|
18202
|
+
const buffer = this.terminal.buffer.active;
|
|
18203
|
+
return {
|
|
18204
|
+
col: Math.max(0, buffer.cursorX || 0),
|
|
18205
|
+
row: Math.max(0, buffer.cursorY || 0)
|
|
18206
|
+
};
|
|
18207
|
+
}
|
|
18248
18208
|
dispose() {
|
|
18249
18209
|
this.terminal.dispose();
|
|
18250
18210
|
}
|
|
@@ -18331,6 +18291,9 @@ var init_terminal_screen = __esm({
|
|
|
18331
18291
|
getText() {
|
|
18332
18292
|
return this.terminal.getText();
|
|
18333
18293
|
}
|
|
18294
|
+
getCursorPosition() {
|
|
18295
|
+
return this.terminal.getCursorPosition();
|
|
18296
|
+
}
|
|
18334
18297
|
dispose() {
|
|
18335
18298
|
this.terminal.dispose();
|
|
18336
18299
|
}
|
|
@@ -19075,6 +19038,7 @@ var init_pty_transport = __esm({
|
|
|
19075
19038
|
this.handle = handle;
|
|
19076
19039
|
}
|
|
19077
19040
|
ready = Promise.resolve();
|
|
19041
|
+
terminalQueriesHandled = false;
|
|
19078
19042
|
get pid() {
|
|
19079
19043
|
return this.handle.pid;
|
|
19080
19044
|
}
|
|
@@ -19128,6 +19092,32 @@ function stripTerminalNoise(str) {
|
|
|
19128
19092
|
function sanitizeTerminalText(str) {
|
|
19129
19093
|
return stripTerminalNoise(stripAnsi(str));
|
|
19130
19094
|
}
|
|
19095
|
+
function buildCliSpawnEnv(baseEnv, overrides) {
|
|
19096
|
+
const env = {};
|
|
19097
|
+
const source = { ...baseEnv, ...overrides || {} };
|
|
19098
|
+
for (const [key, value] of Object.entries(source)) {
|
|
19099
|
+
if (typeof value !== "string") continue;
|
|
19100
|
+
env[key] = value;
|
|
19101
|
+
}
|
|
19102
|
+
for (const key of Object.keys(env)) {
|
|
19103
|
+
if (key === "INIT_CWD" || key === "NO_COLOR" || key === "FORCE_COLOR" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
|
|
19104
|
+
delete env[key];
|
|
19105
|
+
}
|
|
19106
|
+
}
|
|
19107
|
+
return env;
|
|
19108
|
+
}
|
|
19109
|
+
function computeTerminalQueryTail(buffer) {
|
|
19110
|
+
const prefixes = ["\x1B[6n", "\x1B[?6n"];
|
|
19111
|
+
const maxLength = prefixes.reduce((n, value) => Math.max(n, value.length), 0) - 1;
|
|
19112
|
+
const start = Math.max(0, buffer.length - maxLength);
|
|
19113
|
+
for (let i = start; i < buffer.length; i++) {
|
|
19114
|
+
const suffix = buffer.slice(i);
|
|
19115
|
+
if (prefixes.some((pattern) => suffix.length < pattern.length && pattern.startsWith(suffix))) {
|
|
19116
|
+
return suffix;
|
|
19117
|
+
}
|
|
19118
|
+
}
|
|
19119
|
+
return "";
|
|
19120
|
+
}
|
|
19131
19121
|
function findBinary(name) {
|
|
19132
19122
|
const isWin = os13.platform() === "win32";
|
|
19133
19123
|
try {
|
|
@@ -19214,36 +19204,6 @@ function promptLikelyVisible(screenText, promptSnippet) {
|
|
|
19214
19204
|
).length;
|
|
19215
19205
|
return matched >= required2;
|
|
19216
19206
|
}
|
|
19217
|
-
function splitHistoryLines(text) {
|
|
19218
|
-
return String(text || "").split("\n").map((line) => line.replace(/\s+$/, ""));
|
|
19219
|
-
}
|
|
19220
|
-
function normalizeHistoryLine(line) {
|
|
19221
|
-
return String(line || "").replace(/\s+/g, " ").trim();
|
|
19222
|
-
}
|
|
19223
|
-
function mergeTerminalHistory(existing, snapshot) {
|
|
19224
|
-
const next = String(snapshot || "").trim();
|
|
19225
|
-
if (!next) return existing;
|
|
19226
|
-
const prev = String(existing || "").trim();
|
|
19227
|
-
if (!prev) return next;
|
|
19228
|
-
if (prev === next || prev.endsWith(next)) return prev;
|
|
19229
|
-
const prevLines = splitHistoryLines(prev);
|
|
19230
|
-
const nextLines = splitHistoryLines(next);
|
|
19231
|
-
const prevNorm = prevLines.map(normalizeHistoryLine);
|
|
19232
|
-
const nextNorm = nextLines.map(normalizeHistoryLine);
|
|
19233
|
-
const maxOverlap = Math.min(prevLines.length, nextLines.length);
|
|
19234
|
-
for (let overlap = maxOverlap; overlap >= 1; overlap -= 1) {
|
|
19235
|
-
const prevTail = prevNorm.slice(prevNorm.length - overlap);
|
|
19236
|
-
const nextHead = nextNorm.slice(0, overlap);
|
|
19237
|
-
if (prevTail.every((line, index) => line === nextHead[index])) {
|
|
19238
|
-
return [...prevLines, ...nextLines.slice(overlap)].join("\n").trim();
|
|
19239
|
-
}
|
|
19240
|
-
}
|
|
19241
|
-
const compactPrev = prevNorm.join("\n");
|
|
19242
|
-
const compactNext = nextNorm.join("\n");
|
|
19243
|
-
if (compactPrev.includes(compactNext)) return prev;
|
|
19244
|
-
return `${prev}
|
|
19245
|
-
${next}`.trim();
|
|
19246
|
-
}
|
|
19247
19207
|
function parsePatternEntry(x) {
|
|
19248
19208
|
if (x instanceof RegExp) return x;
|
|
19249
19209
|
if (x && typeof x === "object" && typeof x.source === "string") {
|
|
@@ -19358,6 +19318,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19358
19318
|
pendingOutputParseTimer = null;
|
|
19359
19319
|
ptyOutputBuffer = "";
|
|
19360
19320
|
ptyOutputFlushTimer = null;
|
|
19321
|
+
pendingTerminalQueryTail = "";
|
|
19361
19322
|
// Server log forwarding
|
|
19362
19323
|
serverConn = null;
|
|
19363
19324
|
logBuffer = [];
|
|
@@ -19389,9 +19350,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19389
19350
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
19390
19351
|
accumulatedRawBuffer = "";
|
|
19391
19352
|
/** Current visible terminal screen snapshot */
|
|
19392
|
-
terminalScreen = new TerminalScreen(
|
|
19393
|
-
/** Rolling append-only terminal transcript built from screen snapshots */
|
|
19394
|
-
terminalHistory = "";
|
|
19353
|
+
terminalScreen = new TerminalScreen(30, 100);
|
|
19395
19354
|
/** Max accumulated buffer size (last 50KB) */
|
|
19396
19355
|
static MAX_ACCUMULATED_BUFFER = 5e4;
|
|
19397
19356
|
currentTurnScope = null;
|
|
@@ -19413,15 +19372,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
19413
19372
|
return text.slice(start);
|
|
19414
19373
|
}
|
|
19415
19374
|
buildParseInput(baseMessages, partialResponse, scope) {
|
|
19416
|
-
const buffer = scope ? this.sliceFromOffset(this.
|
|
19375
|
+
const buffer = scope ? this.sliceFromOffset(this.accumulatedBuffer, scope.bufferStart) || this.accumulatedBuffer : this.accumulatedBuffer;
|
|
19417
19376
|
const rawBuffer = scope ? this.sliceFromOffset(this.accumulatedRawBuffer, scope.rawBufferStart) || this.accumulatedRawBuffer : this.accumulatedRawBuffer;
|
|
19418
|
-
const terminalHistory = scope ? this.sliceFromOffset(this.terminalHistory, scope.terminalHistoryStart) || this.terminalHistory : this.terminalHistory;
|
|
19419
19377
|
return {
|
|
19420
19378
|
buffer,
|
|
19421
19379
|
rawBuffer,
|
|
19422
19380
|
recentBuffer: buffer.slice(-1e3) || this.recentOutputBuffer,
|
|
19423
19381
|
screenText: this.terminalScreen.getText(),
|
|
19424
|
-
terminalHistory,
|
|
19425
19382
|
messages: [...baseMessages],
|
|
19426
19383
|
partialResponse
|
|
19427
19384
|
};
|
|
@@ -19499,13 +19456,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
19499
19456
|
shellArgs = allArgs;
|
|
19500
19457
|
}
|
|
19501
19458
|
const ptyOpts = {
|
|
19502
|
-
cols:
|
|
19503
|
-
rows:
|
|
19459
|
+
cols: 100,
|
|
19460
|
+
rows: 30,
|
|
19504
19461
|
cwd: this.workingDir,
|
|
19505
|
-
env:
|
|
19506
|
-
...process.env,
|
|
19507
|
-
...spawnConfig.env
|
|
19508
|
-
}
|
|
19462
|
+
env: buildCliSpawnEnv(process.env, spawnConfig.env)
|
|
19509
19463
|
};
|
|
19510
19464
|
try {
|
|
19511
19465
|
this.ptyProcess = this.transportFactory.spawn(shellCmd, shellArgs, ptyOpts);
|
|
@@ -19523,8 +19477,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
19523
19477
|
}
|
|
19524
19478
|
this.ptyProcess.onData((data) => {
|
|
19525
19479
|
if (Date.now() < this.resizeSuppressUntil) return;
|
|
19526
|
-
if (
|
|
19527
|
-
this.
|
|
19480
|
+
if (!this.ptyProcess?.terminalQueriesHandled) {
|
|
19481
|
+
this.respondToTerminalQueries(data);
|
|
19528
19482
|
}
|
|
19529
19483
|
this.pendingOutputParseBuffer += data;
|
|
19530
19484
|
if (!this.pendingOutputParseTimer) {
|
|
@@ -19559,8 +19513,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
19559
19513
|
this.spawnAt = Date.now();
|
|
19560
19514
|
this.startupParseGate = true;
|
|
19561
19515
|
this.startupBuffer = "";
|
|
19562
|
-
this.terminalScreen.reset(
|
|
19563
|
-
this.
|
|
19516
|
+
this.terminalScreen.reset(30, 100);
|
|
19517
|
+
this.pendingTerminalQueryTail = "";
|
|
19564
19518
|
this.currentTurnScope = null;
|
|
19565
19519
|
this.ready = false;
|
|
19566
19520
|
await this.ptyProcess.ready;
|
|
@@ -19570,7 +19524,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19570
19524
|
// ─── Output Handling ────────────────────────────
|
|
19571
19525
|
handleOutput(rawData) {
|
|
19572
19526
|
this.terminalScreen.write(rawData);
|
|
19573
|
-
this.terminalHistory = mergeTerminalHistory(this.terminalHistory, this.terminalScreen.getText());
|
|
19574
19527
|
const cleanData = sanitizeTerminalText(rawData);
|
|
19575
19528
|
if (this.isWaitingForResponse && cleanData) {
|
|
19576
19529
|
this.responseBuffer = (this.responseBuffer + cleanData).slice(-8e3);
|
|
@@ -19846,8 +19799,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19846
19799
|
status: this.currentStatus,
|
|
19847
19800
|
messages: [...this.committedMessages],
|
|
19848
19801
|
workingDir: this.workingDir,
|
|
19849
|
-
activeModal: this.activeModal
|
|
19850
|
-
terminalHistory: this.terminalHistory
|
|
19802
|
+
activeModal: this.activeModal
|
|
19851
19803
|
};
|
|
19852
19804
|
}
|
|
19853
19805
|
/**
|
|
@@ -19865,7 +19817,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19865
19817
|
id: parsed.id || "cli_session",
|
|
19866
19818
|
status: parsed.status || this.currentStatus,
|
|
19867
19819
|
title: parsed.title || this.cliName,
|
|
19868
|
-
terminalHistory: this.terminalHistory,
|
|
19869
19820
|
messages: parsed.messages,
|
|
19870
19821
|
activeModal: parsed.activeModal ?? this.activeModal
|
|
19871
19822
|
};
|
|
@@ -19875,7 +19826,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19875
19826
|
id: "cli_session",
|
|
19876
19827
|
status: this.currentStatus,
|
|
19877
19828
|
title: this.cliName,
|
|
19878
|
-
terminalHistory: this.terminalHistory,
|
|
19879
19829
|
messages: messages.slice(-50).map((message, index) => ({
|
|
19880
19830
|
id: `msg_${index}`,
|
|
19881
19831
|
role: message.role,
|
|
@@ -19943,10 +19893,9 @@ ${data.message || ""}`.trim();
|
|
|
19943
19893
|
prompt: text,
|
|
19944
19894
|
startedAt: Date.now(),
|
|
19945
19895
|
bufferStart: this.accumulatedBuffer.length,
|
|
19946
|
-
rawBufferStart: this.accumulatedRawBuffer.length
|
|
19947
|
-
terminalHistoryStart: this.terminalHistory.length
|
|
19896
|
+
rawBufferStart: this.accumulatedRawBuffer.length
|
|
19948
19897
|
};
|
|
19949
|
-
LOG.info("CLI", `[${this.cliType}] sendMessage turn scope buffer=${this.currentTurnScope.bufferStart} raw=${this.currentTurnScope.rawBufferStart}
|
|
19898
|
+
LOG.info("CLI", `[${this.cliType}] sendMessage turn scope buffer=${this.currentTurnScope.bufferStart} raw=${this.currentTurnScope.rawBufferStart} prompt=${JSON.stringify(text).slice(0, 120)}`);
|
|
19950
19899
|
this.submitRetryUsed = false;
|
|
19951
19900
|
this.submitRetryPromptSnippet = extractPromptRetrySnippet(text);
|
|
19952
19901
|
const normalizedPromptSnippet = normalizePromptText(this.submitRetryPromptSnippet);
|
|
@@ -20131,6 +20080,7 @@ ${data.message || ""}`.trim();
|
|
|
20131
20080
|
this.pendingOutputParseTimer = null;
|
|
20132
20081
|
}
|
|
20133
20082
|
this.pendingOutputParseBuffer = "";
|
|
20083
|
+
this.pendingTerminalQueryTail = "";
|
|
20134
20084
|
if (this.ptyOutputFlushTimer) {
|
|
20135
20085
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
20136
20086
|
this.ptyOutputFlushTimer = null;
|
|
@@ -20170,6 +20120,7 @@ ${data.message || ""}`.trim();
|
|
|
20170
20120
|
this.pendingOutputParseTimer = null;
|
|
20171
20121
|
}
|
|
20172
20122
|
this.pendingOutputParseBuffer = "";
|
|
20123
|
+
this.pendingTerminalQueryTail = "";
|
|
20173
20124
|
if (this.ptyOutputFlushTimer) {
|
|
20174
20125
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
20175
20126
|
this.ptyOutputFlushTimer = null;
|
|
@@ -20196,7 +20147,6 @@ ${data.message || ""}`.trim();
|
|
|
20196
20147
|
this.syncMessageViews();
|
|
20197
20148
|
this.accumulatedBuffer = "";
|
|
20198
20149
|
this.accumulatedRawBuffer = "";
|
|
20199
|
-
this.terminalHistory = "";
|
|
20200
20150
|
this.currentTurnScope = null;
|
|
20201
20151
|
this.submitRetryUsed = false;
|
|
20202
20152
|
this.submitRetryPromptSnippet = "";
|
|
@@ -20205,6 +20155,7 @@ ${data.message || ""}`.trim();
|
|
|
20205
20155
|
this.pendingOutputParseTimer = null;
|
|
20206
20156
|
}
|
|
20207
20157
|
this.pendingOutputParseBuffer = "";
|
|
20158
|
+
this.pendingTerminalQueryTail = "";
|
|
20208
20159
|
if (this.ptyOutputFlushTimer) {
|
|
20209
20160
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
20210
20161
|
this.ptyOutputFlushTimer = null;
|
|
@@ -20266,7 +20217,6 @@ ${data.message || ""}`.trim();
|
|
|
20266
20217
|
structuredMessages: this.structuredMessages.slice(-20),
|
|
20267
20218
|
messageCount: this.committedMessages.length,
|
|
20268
20219
|
screenText: sanitizeTerminalText(this.terminalScreen.getText()).slice(-4e3),
|
|
20269
|
-
terminalHistory: this.terminalHistory.slice(-8e3),
|
|
20270
20220
|
currentTurnScope: this.currentTurnScope,
|
|
20271
20221
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
20272
20222
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -20294,6 +20244,20 @@ ${data.message || ""}`.trim();
|
|
|
20294
20244
|
ptyAlive: !!this.ptyProcess
|
|
20295
20245
|
};
|
|
20296
20246
|
}
|
|
20247
|
+
respondToTerminalQueries(data) {
|
|
20248
|
+
if (!this.ptyProcess || !data) return;
|
|
20249
|
+
const combined = this.pendingTerminalQueryTail + data;
|
|
20250
|
+
const regex = /\x1b\[(\?)?6n/g;
|
|
20251
|
+
let match;
|
|
20252
|
+
while ((match = regex.exec(combined)) !== null) {
|
|
20253
|
+
const cursor = this.terminalScreen.getCursorPosition();
|
|
20254
|
+
const row = Math.max(1, (cursor.row | 0) + 1);
|
|
20255
|
+
const col = Math.max(1, (cursor.col | 0) + 1);
|
|
20256
|
+
const response = match[1] ? `\x1B[?${row};${col}R` : `\x1B[${row};${col}R`;
|
|
20257
|
+
this.ptyProcess.write(response);
|
|
20258
|
+
}
|
|
20259
|
+
this.pendingTerminalQueryTail = computeTerminalQueryTail(combined);
|
|
20260
|
+
}
|
|
20297
20261
|
};
|
|
20298
20262
|
}
|
|
20299
20263
|
});
|
|
@@ -20315,7 +20279,7 @@ var init_cli_provider_instance = __esm({
|
|
|
20315
20279
|
this.cliArgs = cliArgs;
|
|
20316
20280
|
this.type = provider.type;
|
|
20317
20281
|
this.instanceId = instanceId || crypto3.randomUUID();
|
|
20318
|
-
this.presentationMode = "
|
|
20282
|
+
this.presentationMode = "chat";
|
|
20319
20283
|
this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, transportFactory);
|
|
20320
20284
|
this.monitor = new StatusMonitor();
|
|
20321
20285
|
this.historyWriter = new ChatHistoryWriter();
|
|
@@ -20362,14 +20326,6 @@ var init_cli_provider_instance = __esm({
|
|
|
20362
20326
|
const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
|
|
20363
20327
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
20364
20328
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
20365
|
-
if (adapterStatus.terminalHistory?.trim()) {
|
|
20366
|
-
this.historyWriter.appendTerminalHistory(
|
|
20367
|
-
this.type,
|
|
20368
|
-
adapterStatus.terminalHistory,
|
|
20369
|
-
`${this.provider.name} \xB7 ${dirName}`,
|
|
20370
|
-
this.instanceId
|
|
20371
|
-
);
|
|
20372
|
-
}
|
|
20373
20329
|
return {
|
|
20374
20330
|
type: this.type,
|
|
20375
20331
|
name: this.provider.name,
|
|
@@ -20382,7 +20338,6 @@ var init_cli_provider_instance = __esm({
|
|
|
20382
20338
|
status: parsedStatus?.status || adapterStatus.status,
|
|
20383
20339
|
messages: Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [],
|
|
20384
20340
|
activeModal: parsedStatus?.activeModal ?? adapterStatus.activeModal,
|
|
20385
|
-
terminalHistory: adapterStatus.terminalHistory,
|
|
20386
20341
|
inputContent: ""
|
|
20387
20342
|
},
|
|
20388
20343
|
workspace: this.workingDir,
|
|
@@ -43523,6 +43478,7 @@ var init_session_host_transport = __esm({
|
|
|
43523
43478
|
this.ready = this.boot();
|
|
43524
43479
|
}
|
|
43525
43480
|
ready;
|
|
43481
|
+
terminalQueriesHandled = true;
|
|
43526
43482
|
client;
|
|
43527
43483
|
dataCallbacks = /* @__PURE__ */ new Set();
|
|
43528
43484
|
exitCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -45932,7 +45888,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45932
45888
|
fs15 = __toESM(require("fs"));
|
|
45933
45889
|
path17 = __toESM(require("path"));
|
|
45934
45890
|
import_chalk2 = __toESM(require("chalk"));
|
|
45935
|
-
pkgVersion = "0.7.
|
|
45891
|
+
pkgVersion = "0.7.43";
|
|
45936
45892
|
if (pkgVersion === "unknown") {
|
|
45937
45893
|
try {
|
|
45938
45894
|
const possiblePaths = [
|