@adhdev/daemon-standalone 0.9.76-rc.66 → 0.9.76-rc.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +193 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +195 -13
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -32550,13 +32550,25 @@ Before doing any coordinator work, confirm that the actual callable tool list in
|
|
|
32550
32550
|
}
|
|
32551
32551
|
});
|
|
32552
32552
|
function stripAnsi(str) {
|
|
32553
|
-
return str.replace(/\x1B\][^\x07]
|
|
32553
|
+
return str.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
32554
|
+
}
|
|
32555
|
+
function parseCount(params, fallback = 1) {
|
|
32556
|
+
const first = Number(String(params || "").split(";")[0] || fallback);
|
|
32557
|
+
return Math.max(1, Number.isFinite(first) ? first : fallback);
|
|
32558
|
+
}
|
|
32559
|
+
function isCombiningMark(ch) {
|
|
32560
|
+
return /[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/.test(ch);
|
|
32561
|
+
}
|
|
32562
|
+
function isWideCodePoint(ch) {
|
|
32563
|
+
const cp = ch.codePointAt(0) || 0;
|
|
32564
|
+
return cp >= 4352 && (cp <= 4447 || cp === 9001 || cp === 9002 || cp >= 11904 && cp <= 42191 && cp !== 12351 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65040 && cp <= 65049 || cp >= 65072 && cp <= 65135 || cp >= 65280 && cp <= 65376 || cp >= 65504 && cp <= 65510 || cp >= 127744 && cp <= 129791);
|
|
32554
32565
|
}
|
|
32555
32566
|
function stripTerminalNoise(str) {
|
|
32556
|
-
return String(str || "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "").replace(
|
|
32567
|
+
return String(str || "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "").replace(/\r+/g, "\n").replace(/[ \t]+\n/g, "\n").replace(/\n{4,}/g, "\n\n\n");
|
|
32557
32568
|
}
|
|
32558
32569
|
function sanitizeTerminalText(str) {
|
|
32559
|
-
|
|
32570
|
+
const accumulator = new TerminalTranscriptAccumulator();
|
|
32571
|
+
return stripTerminalNoise(stripAnsi(accumulator.append(str)));
|
|
32560
32572
|
}
|
|
32561
32573
|
function listCliScriptNames(scripts) {
|
|
32562
32574
|
if (!scripts) return [];
|
|
@@ -32738,6 +32750,7 @@ Before doing any coordinator work, confirm that the actual callable tool list in
|
|
|
32738
32750
|
var os9;
|
|
32739
32751
|
var path14;
|
|
32740
32752
|
var import_child_process4;
|
|
32753
|
+
var TerminalTranscriptAccumulator;
|
|
32741
32754
|
var buildCliSpawnEnv;
|
|
32742
32755
|
var init_provider_cli_shared = __esm2({
|
|
32743
32756
|
"src/cli-adapters/provider-cli-shared.ts"() {
|
|
@@ -32746,6 +32759,155 @@ Before doing any coordinator work, confirm that the actual callable tool list in
|
|
|
32746
32759
|
path14 = __toESM2(require("path"));
|
|
32747
32760
|
import_child_process4 = require("child_process");
|
|
32748
32761
|
init_spawn_env();
|
|
32762
|
+
TerminalTranscriptAccumulator = class {
|
|
32763
|
+
lines = [[]];
|
|
32764
|
+
row = 0;
|
|
32765
|
+
col = 0;
|
|
32766
|
+
savedCursor = null;
|
|
32767
|
+
pendingEscape = "";
|
|
32768
|
+
append(data) {
|
|
32769
|
+
const input = this.pendingEscape + String(data || "");
|
|
32770
|
+
this.pendingEscape = "";
|
|
32771
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
32772
|
+
let ch = input[i];
|
|
32773
|
+
if (ch === "\x1B") {
|
|
32774
|
+
const consumed = this.consumeEscape(input.slice(i));
|
|
32775
|
+
if (consumed === 0) {
|
|
32776
|
+
this.pendingEscape = input.slice(i);
|
|
32777
|
+
break;
|
|
32778
|
+
}
|
|
32779
|
+
i += consumed - 1;
|
|
32780
|
+
continue;
|
|
32781
|
+
}
|
|
32782
|
+
const cp = input.codePointAt(i);
|
|
32783
|
+
if (cp && cp > 65535) {
|
|
32784
|
+
ch = String.fromCodePoint(cp);
|
|
32785
|
+
i += 1;
|
|
32786
|
+
}
|
|
32787
|
+
this.writeControlOrChar(ch);
|
|
32788
|
+
}
|
|
32789
|
+
return this.getText();
|
|
32790
|
+
}
|
|
32791
|
+
reset() {
|
|
32792
|
+
this.lines = [[]];
|
|
32793
|
+
this.row = 0;
|
|
32794
|
+
this.col = 0;
|
|
32795
|
+
this.savedCursor = null;
|
|
32796
|
+
this.pendingEscape = "";
|
|
32797
|
+
}
|
|
32798
|
+
getText() {
|
|
32799
|
+
return this.lines.map((line) => line.join("").replace(/[ \t]+$/g, "")).join("\n");
|
|
32800
|
+
}
|
|
32801
|
+
ensureRow(row = this.row) {
|
|
32802
|
+
while (this.lines.length <= row) this.lines.push([]);
|
|
32803
|
+
}
|
|
32804
|
+
writeControlOrChar(ch) {
|
|
32805
|
+
if (ch === "\r") {
|
|
32806
|
+
this.col = 0;
|
|
32807
|
+
return;
|
|
32808
|
+
}
|
|
32809
|
+
if (ch === "\n") {
|
|
32810
|
+
this.row += 1;
|
|
32811
|
+
this.col = 0;
|
|
32812
|
+
this.ensureRow();
|
|
32813
|
+
return;
|
|
32814
|
+
}
|
|
32815
|
+
if (ch === "\b") {
|
|
32816
|
+
this.col = Math.max(0, this.col - 1);
|
|
32817
|
+
return;
|
|
32818
|
+
}
|
|
32819
|
+
if (ch < " " || ch === "\x7F") return;
|
|
32820
|
+
this.ensureRow();
|
|
32821
|
+
const line = this.lines[this.row];
|
|
32822
|
+
if (isCombiningMark(ch) && this.col > 0) {
|
|
32823
|
+
line[this.col - 1] = `${line[this.col - 1] || ""}${ch}`;
|
|
32824
|
+
return;
|
|
32825
|
+
}
|
|
32826
|
+
while (line.length < this.col) line.push(" ");
|
|
32827
|
+
line[this.col] = ch;
|
|
32828
|
+
this.col += isWideCodePoint(ch) ? 2 : 1;
|
|
32829
|
+
}
|
|
32830
|
+
consumeEscape(seq) {
|
|
32831
|
+
if (seq.length < 2) return 0;
|
|
32832
|
+
const next = seq[1];
|
|
32833
|
+
if (next === "7") {
|
|
32834
|
+
this.savedCursor = { row: this.row, col: this.col };
|
|
32835
|
+
return 2;
|
|
32836
|
+
}
|
|
32837
|
+
if (next === "8") {
|
|
32838
|
+
if (this.savedCursor) {
|
|
32839
|
+
this.row = this.savedCursor.row;
|
|
32840
|
+
this.col = this.savedCursor.col;
|
|
32841
|
+
this.ensureRow();
|
|
32842
|
+
}
|
|
32843
|
+
return 2;
|
|
32844
|
+
}
|
|
32845
|
+
if (next === "]") {
|
|
32846
|
+
const bel = seq.indexOf("\x07", 2);
|
|
32847
|
+
const st2 = seq.indexOf("\x1B\\", 2);
|
|
32848
|
+
const end = bel >= 0 && (st2 < 0 || bel < st2) ? bel + 1 : st2 >= 0 ? st2 + 2 : 0;
|
|
32849
|
+
return end;
|
|
32850
|
+
}
|
|
32851
|
+
if (next === "[") {
|
|
32852
|
+
const match = seq.match(/^\x1B\[([0-?]*)([ -/]*)([@-~])/);
|
|
32853
|
+
if (!match) return seq.length < 32 ? 0 : 1;
|
|
32854
|
+
this.applyCsi(match[1] || "", match[3]);
|
|
32855
|
+
return match[0].length;
|
|
32856
|
+
}
|
|
32857
|
+
if (/[P^_X]/.test(next)) {
|
|
32858
|
+
const bel = seq.indexOf("\x07", 2);
|
|
32859
|
+
const st2 = seq.indexOf("\x1B\\", 2);
|
|
32860
|
+
const end = bel >= 0 && (st2 < 0 || bel < st2) ? bel + 1 : st2 >= 0 ? st2 + 2 : 0;
|
|
32861
|
+
return end;
|
|
32862
|
+
}
|
|
32863
|
+
return 2;
|
|
32864
|
+
}
|
|
32865
|
+
applyCsi(params, final) {
|
|
32866
|
+
const count = parseCount(params);
|
|
32867
|
+
this.ensureRow();
|
|
32868
|
+
if (final === "A") this.row = Math.max(0, this.row - count);
|
|
32869
|
+
else if (final === "B") this.row += count;
|
|
32870
|
+
else if (final === "C") this.col += count;
|
|
32871
|
+
else if (final === "D") this.col = Math.max(0, this.col - count);
|
|
32872
|
+
else if (final === "G") this.col = Math.max(0, count - 1);
|
|
32873
|
+
else if (final === "H" || final === "f") {
|
|
32874
|
+
const parts = String(params || "").split(";");
|
|
32875
|
+
this.row = Math.max(0, (Number(parts[0] || 1) || 1) - 1);
|
|
32876
|
+
this.col = Math.max(0, (Number(parts[1] || 1) || 1) - 1);
|
|
32877
|
+
} else if (final === "J") {
|
|
32878
|
+
const mode = Number(params || 0) || 0;
|
|
32879
|
+
if (mode === 2 || mode === 3) {
|
|
32880
|
+
this.lines = [[]];
|
|
32881
|
+
this.row = 0;
|
|
32882
|
+
this.col = 0;
|
|
32883
|
+
} else if (mode === 0) {
|
|
32884
|
+
this.lines[this.row] = this.lines[this.row].slice(0, this.col);
|
|
32885
|
+
this.lines.splice(this.row + 1);
|
|
32886
|
+
} else if (mode === 1) {
|
|
32887
|
+
for (let r = 0; r < this.row; r += 1) this.lines[r] = [];
|
|
32888
|
+
const line = this.lines[this.row];
|
|
32889
|
+
for (let c = 0; c <= Math.min(this.col, line.length - 1); c += 1) line[c] = " ";
|
|
32890
|
+
}
|
|
32891
|
+
} else if (final === "K") {
|
|
32892
|
+
const mode = Number(params || 0) || 0;
|
|
32893
|
+
const line = this.lines[this.row];
|
|
32894
|
+
if (mode === 2) this.lines[this.row] = [];
|
|
32895
|
+
else if (mode === 1) {
|
|
32896
|
+
for (let c = 0; c <= Math.min(this.col, line.length - 1); c += 1) line[c] = " ";
|
|
32897
|
+
} else {
|
|
32898
|
+
this.lines[this.row] = line.slice(0, this.col);
|
|
32899
|
+
}
|
|
32900
|
+
} else if (final === "s") {
|
|
32901
|
+
this.savedCursor = { row: this.row, col: this.col };
|
|
32902
|
+
} else if (final === "u") {
|
|
32903
|
+
if (this.savedCursor) {
|
|
32904
|
+
this.row = this.savedCursor.row;
|
|
32905
|
+
this.col = this.savedCursor.col;
|
|
32906
|
+
}
|
|
32907
|
+
}
|
|
32908
|
+
this.ensureRow();
|
|
32909
|
+
}
|
|
32910
|
+
};
|
|
32749
32911
|
buildCliSpawnEnv = import_session_host_core3.sanitizeSpawnEnv;
|
|
32750
32912
|
}
|
|
32751
32913
|
});
|
|
@@ -33088,8 +33250,10 @@ Before doing any coordinator work, confirm that the actual callable tool list in
|
|
|
33088
33250
|
// ─── CLI Scripts (script-based parsing) ───
|
|
33089
33251
|
cliScripts;
|
|
33090
33252
|
runtimeSettings = {};
|
|
33091
|
-
/** Full accumulated
|
|
33253
|
+
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
33092
33254
|
accumulatedBuffer = "";
|
|
33255
|
+
/** Stateful rendered transcript accumulator; raw debug remains in accumulatedRawBuffer. */
|
|
33256
|
+
transcriptAccumulator = new TerminalTranscriptAccumulator();
|
|
33093
33257
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
33094
33258
|
accumulatedRawBuffer = "";
|
|
33095
33259
|
/** Current visible terminal screen snapshot */
|
|
@@ -33155,6 +33319,7 @@ ${lastSnapshot}`;
|
|
|
33155
33319
|
}
|
|
33156
33320
|
resetTerminalScreen(rows, cols) {
|
|
33157
33321
|
this.terminalScreen.reset(rows, cols);
|
|
33322
|
+
this.transcriptAccumulator.reset();
|
|
33158
33323
|
this.lastScreenText = "";
|
|
33159
33324
|
this.lastScreenSnapshot = "";
|
|
33160
33325
|
this.lastScreenChangeAt = 0;
|
|
@@ -33413,6 +33578,7 @@ ${lastSnapshot}`;
|
|
|
33413
33578
|
handleOutput(rawData) {
|
|
33414
33579
|
this.terminalScreen.write(rawData);
|
|
33415
33580
|
const cleanData = sanitizeTerminalText(rawData);
|
|
33581
|
+
const renderedTranscript = this.transcriptAccumulator.append(rawData);
|
|
33416
33582
|
const now = Date.now();
|
|
33417
33583
|
const shouldReadScreen = this.shouldReadTerminalScreenSnapshot(now);
|
|
33418
33584
|
const screenText = shouldReadScreen ? this.readTerminalScreenText(now) : this.lastScreenText;
|
|
@@ -33453,13 +33619,14 @@ ${lastSnapshot}`;
|
|
|
33453
33619
|
}
|
|
33454
33620
|
}
|
|
33455
33621
|
const prevRecentLen = this.recentOutputBuffer.length;
|
|
33456
|
-
const prevAccumulatedLen = this.accumulatedBuffer.length;
|
|
33457
33622
|
const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
|
|
33458
|
-
|
|
33459
|
-
|
|
33623
|
+
const nextAccumulatedBuffer = renderedTranscript.length <= _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER ? renderedTranscript : renderedTranscript.slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
|
|
33624
|
+
const nextRecentOutputBuffer = nextAccumulatedBuffer.slice(-_ProviderCliAdapter.MAX_RECENT_OUTPUT_BUFFER);
|
|
33625
|
+
this.recentOutputBuffer = nextRecentOutputBuffer;
|
|
33626
|
+
this.accumulatedBuffer = nextAccumulatedBuffer;
|
|
33460
33627
|
this.accumulatedRawBuffer = appendBoundedText(this.accumulatedRawBuffer, rawData, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
|
|
33461
|
-
const droppedRecent =
|
|
33462
|
-
const droppedClean =
|
|
33628
|
+
const droppedRecent = Math.max(0, prevRecentLen - this.recentOutputBuffer.length);
|
|
33629
|
+
const droppedClean = Math.max(0, renderedTranscript.length - this.accumulatedBuffer.length);
|
|
33463
33630
|
const droppedRaw = this.recordBoundedAppendDrop(prevAccumulatedRawLen, rawData.length, this.accumulatedRawBuffer.length);
|
|
33464
33631
|
this.recentOutputDroppedChars += droppedRecent;
|
|
33465
33632
|
this.accumulatedBufferDroppedChars += droppedClean;
|
|
@@ -52247,6 +52414,15 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
52247
52414
|
function readNonEmptyString(value) {
|
|
52248
52415
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
52249
52416
|
}
|
|
52417
|
+
var MESH_COORDINATOR_EVENTS = /* @__PURE__ */ new Set([
|
|
52418
|
+
"agent:generating_completed",
|
|
52419
|
+
"agent:waiting_approval",
|
|
52420
|
+
"agent:stopped",
|
|
52421
|
+
"monitor:long_generating"
|
|
52422
|
+
]);
|
|
52423
|
+
function isMeshCoordinatorEvent(eventName) {
|
|
52424
|
+
return typeof eventName === "string" && MESH_COORDINATOR_EVENTS.has(eventName);
|
|
52425
|
+
}
|
|
52250
52426
|
function formatCompletionMetadata(event) {
|
|
52251
52427
|
const parts = [
|
|
52252
52428
|
readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
|
|
@@ -52263,6 +52439,12 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
52263
52439
|
if (args.event === "agent:waiting_approval") {
|
|
52264
52440
|
return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
52265
52441
|
}
|
|
52442
|
+
if (args.event === "agent:stopped") {
|
|
52443
|
+
return `[System] ${args.nodeLabel} has stopped${metadata}. Use mesh_read_chat once if you need to inspect its last output.`;
|
|
52444
|
+
}
|
|
52445
|
+
if (args.event === "monitor:long_generating") {
|
|
52446
|
+
return `[System] ${args.nodeLabel} has been generating for a long time${metadata}. Use mesh_read_chat once for a status check, but do not poll repeatedly.`;
|
|
52447
|
+
}
|
|
52266
52448
|
return "";
|
|
52267
52449
|
}
|
|
52268
52450
|
function injectMeshSystemMessage(components, args) {
|
|
@@ -52288,7 +52470,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
52288
52470
|
}
|
|
52289
52471
|
function handleMeshForwardEvent(components, payload) {
|
|
52290
52472
|
const eventName = readNonEmptyString(payload.event);
|
|
52291
|
-
if (eventName
|
|
52473
|
+
if (!isMeshCoordinatorEvent(eventName)) {
|
|
52292
52474
|
return { success: false, error: "unsupported mesh event" };
|
|
52293
52475
|
}
|
|
52294
52476
|
const meshId = readNonEmptyString(payload.meshId);
|
|
@@ -52309,7 +52491,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
52309
52491
|
}
|
|
52310
52492
|
function setupMeshEventForwarding(components) {
|
|
52311
52493
|
components.instanceManager.onEvent((event) => {
|
|
52312
|
-
if (event.event
|
|
52494
|
+
if (!isMeshCoordinatorEvent(event.event)) return;
|
|
52313
52495
|
const instanceId = readNonEmptyString(event.instanceId);
|
|
52314
52496
|
if (!instanceId) return;
|
|
52315
52497
|
const sourceInstance = components.instanceManager.getInstance(instanceId);
|