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/index.js
CHANGED
|
@@ -2532,8 +2532,6 @@ var init_chat_history = __esm({
|
|
|
2532
2532
|
lastSeenCounts = /* @__PURE__ */ new Map();
|
|
2533
2533
|
/** Last seen message hash per agent (deduplication) */
|
|
2534
2534
|
lastSeenHashes = /* @__PURE__ */ new Map();
|
|
2535
|
-
/** Last seen append-only terminal transcript per agent */
|
|
2536
|
-
lastSeenTerminal = /* @__PURE__ */ new Map();
|
|
2537
2535
|
rotated = false;
|
|
2538
2536
|
/**
|
|
2539
2537
|
* Append new messages to history
|
|
@@ -2591,51 +2589,10 @@ var init_chat_history = __esm({
|
|
|
2591
2589
|
} catch {
|
|
2592
2590
|
}
|
|
2593
2591
|
}
|
|
2594
|
-
appendTerminalHistory(agentType, terminalHistory, sessionTitle, instanceId) {
|
|
2595
|
-
const next = String(terminalHistory || "");
|
|
2596
|
-
if (!next.trim()) return;
|
|
2597
|
-
try {
|
|
2598
|
-
const dedupKey = instanceId ? `${agentType}:${instanceId}:terminal` : `${agentType}:terminal`;
|
|
2599
|
-
const prev = this.lastSeenTerminal.get(dedupKey) || "";
|
|
2600
|
-
if (prev === next) return;
|
|
2601
|
-
let delta = "";
|
|
2602
|
-
if (!prev) {
|
|
2603
|
-
delta = next;
|
|
2604
|
-
} else if (next.startsWith(prev)) {
|
|
2605
|
-
delta = next.slice(prev.length);
|
|
2606
|
-
} else if (prev.includes(next)) {
|
|
2607
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2608
|
-
return;
|
|
2609
|
-
} else {
|
|
2610
|
-
delta = `
|
|
2611
|
-
|
|
2612
|
-
[terminal snapshot reset ${(/* @__PURE__ */ new Date()).toISOString()} | ${sessionTitle || agentType}]
|
|
2613
|
-
${next}`;
|
|
2614
|
-
}
|
|
2615
|
-
if (!delta) {
|
|
2616
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2617
|
-
return;
|
|
2618
|
-
}
|
|
2619
|
-
const dir = path4.join(HISTORY_DIR, this.sanitize(agentType));
|
|
2620
|
-
fs3.mkdirSync(dir, { recursive: true });
|
|
2621
|
-
const date5 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
2622
|
-
const filePrefix = instanceId ? `${this.sanitize(instanceId)}_` : "";
|
|
2623
|
-
const filePath = path4.join(dir, `${filePrefix}${date5}.terminal.log`);
|
|
2624
|
-
fs3.appendFileSync(filePath, delta, "utf-8");
|
|
2625
|
-
this.lastSeenTerminal.set(dedupKey, next);
|
|
2626
|
-
if (!this.rotated) {
|
|
2627
|
-
this.rotated = true;
|
|
2628
|
-
this.rotateOldFiles().catch(() => {
|
|
2629
|
-
});
|
|
2630
|
-
}
|
|
2631
|
-
} catch {
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
2592
|
/** Called when agent session is explicitly changed */
|
|
2635
2593
|
onSessionChange(agentType) {
|
|
2636
2594
|
this.lastSeenHashes.delete(agentType);
|
|
2637
2595
|
this.lastSeenCounts.delete(agentType);
|
|
2638
|
-
this.lastSeenTerminal.delete(`${agentType}:terminal`);
|
|
2639
2596
|
}
|
|
2640
2597
|
/** Delete history files older than 30 days */
|
|
2641
2598
|
async rotateOldFiles() {
|
|
@@ -3328,11 +3285,6 @@ function truncateString(value, maxChars) {
|
|
|
3328
3285
|
if (maxChars <= 12) return value.slice(0, Math.max(0, maxChars));
|
|
3329
3286
|
return `${value.slice(0, maxChars - 12)}...[truncated]`;
|
|
3330
3287
|
}
|
|
3331
|
-
function truncateStringTail(value, maxChars) {
|
|
3332
|
-
if (value.length <= maxChars) return value;
|
|
3333
|
-
if (maxChars <= 12) return value.slice(value.length - Math.max(0, maxChars));
|
|
3334
|
-
return `...[truncated]${value.slice(value.length - (maxChars - 12))}`;
|
|
3335
|
-
}
|
|
3336
3288
|
function trimStructuredStrings(value, maxChars) {
|
|
3337
3289
|
if (typeof value === "string") return truncateString(value, maxChars);
|
|
3338
3290
|
if (Array.isArray(value)) return value.map((item) => trimStructuredStrings(item, maxChars));
|
|
@@ -3400,11 +3352,10 @@ function normalizeActiveChatData(activeChat) {
|
|
|
3400
3352
|
(button) => truncateString(String(button || ""), STATUS_MODAL_BUTTON_LIMIT)
|
|
3401
3353
|
)
|
|
3402
3354
|
} : activeChat.activeModal,
|
|
3403
|
-
terminalHistory: activeChat.terminalHistory ? truncateStringTail(activeChat.terminalHistory, STATUS_TERMINAL_HISTORY_LIMIT) : activeChat.terminalHistory,
|
|
3404
3355
|
inputContent: activeChat.inputContent ? truncateString(activeChat.inputContent, STATUS_INPUT_CONTENT_LIMIT) : activeChat.inputContent
|
|
3405
3356
|
};
|
|
3406
3357
|
}
|
|
3407
|
-
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,
|
|
3358
|
+
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;
|
|
3408
3359
|
var init_normalize = __esm({
|
|
3409
3360
|
"../../oss/packages/daemon-core/src/status/normalize.ts"() {
|
|
3410
3361
|
"use strict";
|
|
@@ -3420,7 +3371,6 @@ var init_normalize = __esm({
|
|
|
3420
3371
|
STATUS_ACTIVE_CHAT_TOTAL_BYTES_LIMIT = 96 * 1024;
|
|
3421
3372
|
STATUS_ACTIVE_CHAT_STRING_LIMIT = 4 * 1024;
|
|
3422
3373
|
STATUS_ACTIVE_CHAT_FALLBACK_STRING_LIMIT = 1024;
|
|
3423
|
-
STATUS_TERMINAL_HISTORY_LIMIT = 8 * 1024;
|
|
3424
3374
|
STATUS_INPUT_CONTENT_LIMIT = 2 * 1024;
|
|
3425
3375
|
STATUS_MODAL_MESSAGE_LIMIT = 2 * 1024;
|
|
3426
3376
|
STATUS_MODAL_BUTTON_LIMIT = 120;
|
|
@@ -8891,6 +8841,9 @@ var init_ghostty_vt_backend = __esm({
|
|
|
8891
8841
|
getText() {
|
|
8892
8842
|
return this.terminal.formatPlainText({ trim: true }) || "";
|
|
8893
8843
|
}
|
|
8844
|
+
getCursorPosition() {
|
|
8845
|
+
return this.terminal.getCursorPosition();
|
|
8846
|
+
}
|
|
8894
8847
|
dispose() {
|
|
8895
8848
|
this.terminal.dispose();
|
|
8896
8849
|
}
|
|
@@ -18043,6 +17996,13 @@ var init_xterm_backend = __esm({
|
|
|
18043
17996
|
while (last > first && !lines[last - 1]?.trim()) last--;
|
|
18044
17997
|
return lines.slice(first, last).join("\n");
|
|
18045
17998
|
}
|
|
17999
|
+
getCursorPosition() {
|
|
18000
|
+
const buffer = this.terminal.buffer.active;
|
|
18001
|
+
return {
|
|
18002
|
+
col: Math.max(0, buffer.cursorX || 0),
|
|
18003
|
+
row: Math.max(0, buffer.cursorY || 0)
|
|
18004
|
+
};
|
|
18005
|
+
}
|
|
18046
18006
|
dispose() {
|
|
18047
18007
|
this.terminal.dispose();
|
|
18048
18008
|
}
|
|
@@ -18129,6 +18089,9 @@ var init_terminal_screen = __esm({
|
|
|
18129
18089
|
getText() {
|
|
18130
18090
|
return this.terminal.getText();
|
|
18131
18091
|
}
|
|
18092
|
+
getCursorPosition() {
|
|
18093
|
+
return this.terminal.getCursorPosition();
|
|
18094
|
+
}
|
|
18132
18095
|
dispose() {
|
|
18133
18096
|
this.terminal.dispose();
|
|
18134
18097
|
}
|
|
@@ -18873,6 +18836,7 @@ var init_pty_transport = __esm({
|
|
|
18873
18836
|
this.handle = handle;
|
|
18874
18837
|
}
|
|
18875
18838
|
ready = Promise.resolve();
|
|
18839
|
+
terminalQueriesHandled = false;
|
|
18876
18840
|
get pid() {
|
|
18877
18841
|
return this.handle.pid;
|
|
18878
18842
|
}
|
|
@@ -18926,6 +18890,32 @@ function stripTerminalNoise(str) {
|
|
|
18926
18890
|
function sanitizeTerminalText(str) {
|
|
18927
18891
|
return stripTerminalNoise(stripAnsi(str));
|
|
18928
18892
|
}
|
|
18893
|
+
function buildCliSpawnEnv(baseEnv, overrides) {
|
|
18894
|
+
const env = {};
|
|
18895
|
+
const source = { ...baseEnv, ...overrides || {} };
|
|
18896
|
+
for (const [key, value] of Object.entries(source)) {
|
|
18897
|
+
if (typeof value !== "string") continue;
|
|
18898
|
+
env[key] = value;
|
|
18899
|
+
}
|
|
18900
|
+
for (const key of Object.keys(env)) {
|
|
18901
|
+
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_")) {
|
|
18902
|
+
delete env[key];
|
|
18903
|
+
}
|
|
18904
|
+
}
|
|
18905
|
+
return env;
|
|
18906
|
+
}
|
|
18907
|
+
function computeTerminalQueryTail(buffer) {
|
|
18908
|
+
const prefixes = ["\x1B[6n", "\x1B[?6n"];
|
|
18909
|
+
const maxLength = prefixes.reduce((n, value) => Math.max(n, value.length), 0) - 1;
|
|
18910
|
+
const start = Math.max(0, buffer.length - maxLength);
|
|
18911
|
+
for (let i = start; i < buffer.length; i++) {
|
|
18912
|
+
const suffix = buffer.slice(i);
|
|
18913
|
+
if (prefixes.some((pattern) => suffix.length < pattern.length && pattern.startsWith(suffix))) {
|
|
18914
|
+
return suffix;
|
|
18915
|
+
}
|
|
18916
|
+
}
|
|
18917
|
+
return "";
|
|
18918
|
+
}
|
|
18929
18919
|
function findBinary(name) {
|
|
18930
18920
|
const isWin = os13.platform() === "win32";
|
|
18931
18921
|
try {
|
|
@@ -19012,36 +19002,6 @@ function promptLikelyVisible(screenText, promptSnippet) {
|
|
|
19012
19002
|
).length;
|
|
19013
19003
|
return matched >= required2;
|
|
19014
19004
|
}
|
|
19015
|
-
function splitHistoryLines(text) {
|
|
19016
|
-
return String(text || "").split("\n").map((line) => line.replace(/\s+$/, ""));
|
|
19017
|
-
}
|
|
19018
|
-
function normalizeHistoryLine(line) {
|
|
19019
|
-
return String(line || "").replace(/\s+/g, " ").trim();
|
|
19020
|
-
}
|
|
19021
|
-
function mergeTerminalHistory(existing, snapshot) {
|
|
19022
|
-
const next = String(snapshot || "").trim();
|
|
19023
|
-
if (!next) return existing;
|
|
19024
|
-
const prev = String(existing || "").trim();
|
|
19025
|
-
if (!prev) return next;
|
|
19026
|
-
if (prev === next || prev.endsWith(next)) return prev;
|
|
19027
|
-
const prevLines = splitHistoryLines(prev);
|
|
19028
|
-
const nextLines = splitHistoryLines(next);
|
|
19029
|
-
const prevNorm = prevLines.map(normalizeHistoryLine);
|
|
19030
|
-
const nextNorm = nextLines.map(normalizeHistoryLine);
|
|
19031
|
-
const maxOverlap = Math.min(prevLines.length, nextLines.length);
|
|
19032
|
-
for (let overlap = maxOverlap; overlap >= 1; overlap -= 1) {
|
|
19033
|
-
const prevTail = prevNorm.slice(prevNorm.length - overlap);
|
|
19034
|
-
const nextHead = nextNorm.slice(0, overlap);
|
|
19035
|
-
if (prevTail.every((line, index) => line === nextHead[index])) {
|
|
19036
|
-
return [...prevLines, ...nextLines.slice(overlap)].join("\n").trim();
|
|
19037
|
-
}
|
|
19038
|
-
}
|
|
19039
|
-
const compactPrev = prevNorm.join("\n");
|
|
19040
|
-
const compactNext = nextNorm.join("\n");
|
|
19041
|
-
if (compactPrev.includes(compactNext)) return prev;
|
|
19042
|
-
return `${prev}
|
|
19043
|
-
${next}`.trim();
|
|
19044
|
-
}
|
|
19045
19005
|
function parsePatternEntry(x) {
|
|
19046
19006
|
if (x instanceof RegExp) return x;
|
|
19047
19007
|
if (x && typeof x === "object" && typeof x.source === "string") {
|
|
@@ -19156,6 +19116,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19156
19116
|
pendingOutputParseTimer = null;
|
|
19157
19117
|
ptyOutputBuffer = "";
|
|
19158
19118
|
ptyOutputFlushTimer = null;
|
|
19119
|
+
pendingTerminalQueryTail = "";
|
|
19159
19120
|
// Server log forwarding
|
|
19160
19121
|
serverConn = null;
|
|
19161
19122
|
logBuffer = [];
|
|
@@ -19187,9 +19148,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19187
19148
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
19188
19149
|
accumulatedRawBuffer = "";
|
|
19189
19150
|
/** Current visible terminal screen snapshot */
|
|
19190
|
-
terminalScreen = new TerminalScreen(
|
|
19191
|
-
/** Rolling append-only terminal transcript built from screen snapshots */
|
|
19192
|
-
terminalHistory = "";
|
|
19151
|
+
terminalScreen = new TerminalScreen(30, 100);
|
|
19193
19152
|
/** Max accumulated buffer size (last 50KB) */
|
|
19194
19153
|
static MAX_ACCUMULATED_BUFFER = 5e4;
|
|
19195
19154
|
currentTurnScope = null;
|
|
@@ -19211,15 +19170,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
19211
19170
|
return text.slice(start);
|
|
19212
19171
|
}
|
|
19213
19172
|
buildParseInput(baseMessages, partialResponse, scope) {
|
|
19214
|
-
const buffer = scope ? this.sliceFromOffset(this.
|
|
19173
|
+
const buffer = scope ? this.sliceFromOffset(this.accumulatedBuffer, scope.bufferStart) || this.accumulatedBuffer : this.accumulatedBuffer;
|
|
19215
19174
|
const rawBuffer = scope ? this.sliceFromOffset(this.accumulatedRawBuffer, scope.rawBufferStart) || this.accumulatedRawBuffer : this.accumulatedRawBuffer;
|
|
19216
|
-
const terminalHistory = scope ? this.sliceFromOffset(this.terminalHistory, scope.terminalHistoryStart) || this.terminalHistory : this.terminalHistory;
|
|
19217
19175
|
return {
|
|
19218
19176
|
buffer,
|
|
19219
19177
|
rawBuffer,
|
|
19220
19178
|
recentBuffer: buffer.slice(-1e3) || this.recentOutputBuffer,
|
|
19221
19179
|
screenText: this.terminalScreen.getText(),
|
|
19222
|
-
terminalHistory,
|
|
19223
19180
|
messages: [...baseMessages],
|
|
19224
19181
|
partialResponse
|
|
19225
19182
|
};
|
|
@@ -19297,13 +19254,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
19297
19254
|
shellArgs = allArgs;
|
|
19298
19255
|
}
|
|
19299
19256
|
const ptyOpts = {
|
|
19300
|
-
cols:
|
|
19301
|
-
rows:
|
|
19257
|
+
cols: 100,
|
|
19258
|
+
rows: 30,
|
|
19302
19259
|
cwd: this.workingDir,
|
|
19303
|
-
env:
|
|
19304
|
-
...process.env,
|
|
19305
|
-
...spawnConfig.env
|
|
19306
|
-
}
|
|
19260
|
+
env: buildCliSpawnEnv(process.env, spawnConfig.env)
|
|
19307
19261
|
};
|
|
19308
19262
|
try {
|
|
19309
19263
|
this.ptyProcess = this.transportFactory.spawn(shellCmd, shellArgs, ptyOpts);
|
|
@@ -19321,8 +19275,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
19321
19275
|
}
|
|
19322
19276
|
this.ptyProcess.onData((data) => {
|
|
19323
19277
|
if (Date.now() < this.resizeSuppressUntil) return;
|
|
19324
|
-
if (
|
|
19325
|
-
this.
|
|
19278
|
+
if (!this.ptyProcess?.terminalQueriesHandled) {
|
|
19279
|
+
this.respondToTerminalQueries(data);
|
|
19326
19280
|
}
|
|
19327
19281
|
this.pendingOutputParseBuffer += data;
|
|
19328
19282
|
if (!this.pendingOutputParseTimer) {
|
|
@@ -19357,8 +19311,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
19357
19311
|
this.spawnAt = Date.now();
|
|
19358
19312
|
this.startupParseGate = true;
|
|
19359
19313
|
this.startupBuffer = "";
|
|
19360
|
-
this.terminalScreen.reset(
|
|
19361
|
-
this.
|
|
19314
|
+
this.terminalScreen.reset(30, 100);
|
|
19315
|
+
this.pendingTerminalQueryTail = "";
|
|
19362
19316
|
this.currentTurnScope = null;
|
|
19363
19317
|
this.ready = false;
|
|
19364
19318
|
await this.ptyProcess.ready;
|
|
@@ -19368,7 +19322,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19368
19322
|
// ─── Output Handling ────────────────────────────
|
|
19369
19323
|
handleOutput(rawData) {
|
|
19370
19324
|
this.terminalScreen.write(rawData);
|
|
19371
|
-
this.terminalHistory = mergeTerminalHistory(this.terminalHistory, this.terminalScreen.getText());
|
|
19372
19325
|
const cleanData = sanitizeTerminalText(rawData);
|
|
19373
19326
|
if (this.isWaitingForResponse && cleanData) {
|
|
19374
19327
|
this.responseBuffer = (this.responseBuffer + cleanData).slice(-8e3);
|
|
@@ -19644,8 +19597,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
19644
19597
|
status: this.currentStatus,
|
|
19645
19598
|
messages: [...this.committedMessages],
|
|
19646
19599
|
workingDir: this.workingDir,
|
|
19647
|
-
activeModal: this.activeModal
|
|
19648
|
-
terminalHistory: this.terminalHistory
|
|
19600
|
+
activeModal: this.activeModal
|
|
19649
19601
|
};
|
|
19650
19602
|
}
|
|
19651
19603
|
/**
|
|
@@ -19663,7 +19615,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19663
19615
|
id: parsed.id || "cli_session",
|
|
19664
19616
|
status: parsed.status || this.currentStatus,
|
|
19665
19617
|
title: parsed.title || this.cliName,
|
|
19666
|
-
terminalHistory: this.terminalHistory,
|
|
19667
19618
|
messages: parsed.messages,
|
|
19668
19619
|
activeModal: parsed.activeModal ?? this.activeModal
|
|
19669
19620
|
};
|
|
@@ -19673,7 +19624,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19673
19624
|
id: "cli_session",
|
|
19674
19625
|
status: this.currentStatus,
|
|
19675
19626
|
title: this.cliName,
|
|
19676
|
-
terminalHistory: this.terminalHistory,
|
|
19677
19627
|
messages: messages.slice(-50).map((message, index) => ({
|
|
19678
19628
|
id: `msg_${index}`,
|
|
19679
19629
|
role: message.role,
|
|
@@ -19741,10 +19691,9 @@ ${data.message || ""}`.trim();
|
|
|
19741
19691
|
prompt: text,
|
|
19742
19692
|
startedAt: Date.now(),
|
|
19743
19693
|
bufferStart: this.accumulatedBuffer.length,
|
|
19744
|
-
rawBufferStart: this.accumulatedRawBuffer.length
|
|
19745
|
-
terminalHistoryStart: this.terminalHistory.length
|
|
19694
|
+
rawBufferStart: this.accumulatedRawBuffer.length
|
|
19746
19695
|
};
|
|
19747
|
-
LOG.info("CLI", `[${this.cliType}] sendMessage turn scope buffer=${this.currentTurnScope.bufferStart} raw=${this.currentTurnScope.rawBufferStart}
|
|
19696
|
+
LOG.info("CLI", `[${this.cliType}] sendMessage turn scope buffer=${this.currentTurnScope.bufferStart} raw=${this.currentTurnScope.rawBufferStart} prompt=${JSON.stringify(text).slice(0, 120)}`);
|
|
19748
19697
|
this.submitRetryUsed = false;
|
|
19749
19698
|
this.submitRetryPromptSnippet = extractPromptRetrySnippet(text);
|
|
19750
19699
|
const normalizedPromptSnippet = normalizePromptText(this.submitRetryPromptSnippet);
|
|
@@ -19929,6 +19878,7 @@ ${data.message || ""}`.trim();
|
|
|
19929
19878
|
this.pendingOutputParseTimer = null;
|
|
19930
19879
|
}
|
|
19931
19880
|
this.pendingOutputParseBuffer = "";
|
|
19881
|
+
this.pendingTerminalQueryTail = "";
|
|
19932
19882
|
if (this.ptyOutputFlushTimer) {
|
|
19933
19883
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
19934
19884
|
this.ptyOutputFlushTimer = null;
|
|
@@ -19968,6 +19918,7 @@ ${data.message || ""}`.trim();
|
|
|
19968
19918
|
this.pendingOutputParseTimer = null;
|
|
19969
19919
|
}
|
|
19970
19920
|
this.pendingOutputParseBuffer = "";
|
|
19921
|
+
this.pendingTerminalQueryTail = "";
|
|
19971
19922
|
if (this.ptyOutputFlushTimer) {
|
|
19972
19923
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
19973
19924
|
this.ptyOutputFlushTimer = null;
|
|
@@ -19994,7 +19945,6 @@ ${data.message || ""}`.trim();
|
|
|
19994
19945
|
this.syncMessageViews();
|
|
19995
19946
|
this.accumulatedBuffer = "";
|
|
19996
19947
|
this.accumulatedRawBuffer = "";
|
|
19997
|
-
this.terminalHistory = "";
|
|
19998
19948
|
this.currentTurnScope = null;
|
|
19999
19949
|
this.submitRetryUsed = false;
|
|
20000
19950
|
this.submitRetryPromptSnippet = "";
|
|
@@ -20003,6 +19953,7 @@ ${data.message || ""}`.trim();
|
|
|
20003
19953
|
this.pendingOutputParseTimer = null;
|
|
20004
19954
|
}
|
|
20005
19955
|
this.pendingOutputParseBuffer = "";
|
|
19956
|
+
this.pendingTerminalQueryTail = "";
|
|
20006
19957
|
if (this.ptyOutputFlushTimer) {
|
|
20007
19958
|
clearTimeout(this.ptyOutputFlushTimer);
|
|
20008
19959
|
this.ptyOutputFlushTimer = null;
|
|
@@ -20064,7 +20015,6 @@ ${data.message || ""}`.trim();
|
|
|
20064
20015
|
structuredMessages: this.structuredMessages.slice(-20),
|
|
20065
20016
|
messageCount: this.committedMessages.length,
|
|
20066
20017
|
screenText: sanitizeTerminalText(this.terminalScreen.getText()).slice(-4e3),
|
|
20067
|
-
terminalHistory: this.terminalHistory.slice(-8e3),
|
|
20068
20018
|
currentTurnScope: this.currentTurnScope,
|
|
20069
20019
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
20070
20020
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -20092,6 +20042,20 @@ ${data.message || ""}`.trim();
|
|
|
20092
20042
|
ptyAlive: !!this.ptyProcess
|
|
20093
20043
|
};
|
|
20094
20044
|
}
|
|
20045
|
+
respondToTerminalQueries(data) {
|
|
20046
|
+
if (!this.ptyProcess || !data) return;
|
|
20047
|
+
const combined = this.pendingTerminalQueryTail + data;
|
|
20048
|
+
const regex = /\x1b\[(\?)?6n/g;
|
|
20049
|
+
let match;
|
|
20050
|
+
while ((match = regex.exec(combined)) !== null) {
|
|
20051
|
+
const cursor = this.terminalScreen.getCursorPosition();
|
|
20052
|
+
const row = Math.max(1, (cursor.row | 0) + 1);
|
|
20053
|
+
const col = Math.max(1, (cursor.col | 0) + 1);
|
|
20054
|
+
const response = match[1] ? `\x1B[?${row};${col}R` : `\x1B[${row};${col}R`;
|
|
20055
|
+
this.ptyProcess.write(response);
|
|
20056
|
+
}
|
|
20057
|
+
this.pendingTerminalQueryTail = computeTerminalQueryTail(combined);
|
|
20058
|
+
}
|
|
20095
20059
|
};
|
|
20096
20060
|
}
|
|
20097
20061
|
});
|
|
@@ -20113,7 +20077,7 @@ var init_cli_provider_instance = __esm({
|
|
|
20113
20077
|
this.cliArgs = cliArgs;
|
|
20114
20078
|
this.type = provider.type;
|
|
20115
20079
|
this.instanceId = instanceId || crypto3.randomUUID();
|
|
20116
|
-
this.presentationMode = "
|
|
20080
|
+
this.presentationMode = "chat";
|
|
20117
20081
|
this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, transportFactory);
|
|
20118
20082
|
this.monitor = new StatusMonitor();
|
|
20119
20083
|
this.historyWriter = new ChatHistoryWriter();
|
|
@@ -20160,14 +20124,6 @@ var init_cli_provider_instance = __esm({
|
|
|
20160
20124
|
const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
|
|
20161
20125
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
20162
20126
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
20163
|
-
if (adapterStatus.terminalHistory?.trim()) {
|
|
20164
|
-
this.historyWriter.appendTerminalHistory(
|
|
20165
|
-
this.type,
|
|
20166
|
-
adapterStatus.terminalHistory,
|
|
20167
|
-
`${this.provider.name} \xB7 ${dirName}`,
|
|
20168
|
-
this.instanceId
|
|
20169
|
-
);
|
|
20170
|
-
}
|
|
20171
20127
|
return {
|
|
20172
20128
|
type: this.type,
|
|
20173
20129
|
name: this.provider.name,
|
|
@@ -20180,7 +20136,6 @@ var init_cli_provider_instance = __esm({
|
|
|
20180
20136
|
status: parsedStatus?.status || adapterStatus.status,
|
|
20181
20137
|
messages: Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [],
|
|
20182
20138
|
activeModal: parsedStatus?.activeModal ?? adapterStatus.activeModal,
|
|
20183
|
-
terminalHistory: adapterStatus.terminalHistory,
|
|
20184
20139
|
inputContent: ""
|
|
20185
20140
|
},
|
|
20186
20141
|
workspace: this.workingDir,
|
|
@@ -43320,6 +43275,7 @@ var init_session_host_transport = __esm({
|
|
|
43320
43275
|
this.ready = this.boot();
|
|
43321
43276
|
}
|
|
43322
43277
|
ready;
|
|
43278
|
+
terminalQueriesHandled = true;
|
|
43323
43279
|
client;
|
|
43324
43280
|
dataCallbacks = /* @__PURE__ */ new Set();
|
|
43325
43281
|
exitCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -45413,7 +45369,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45413
45369
|
fs15 = __toESM(require("fs"));
|
|
45414
45370
|
path17 = __toESM(require("path"));
|
|
45415
45371
|
import_chalk2 = __toESM(require("chalk"));
|
|
45416
|
-
pkgVersion = "0.7.
|
|
45372
|
+
pkgVersion = "0.7.43";
|
|
45417
45373
|
if (pkgVersion === "unknown") {
|
|
45418
45374
|
try {
|
|
45419
45375
|
const possiblePaths = [
|