adhdev 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/cli/index.js +197 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +197 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +2 -1
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -13680,13 +13680,25 @@ var init_pty_transport = __esm({
|
|
|
13680
13680
|
|
|
13681
13681
|
// ../../oss/packages/daemon-core/src/cli-adapters/provider-cli-shared.ts
|
|
13682
13682
|
function stripAnsi(str2) {
|
|
13683
|
-
return str2.replace(/\x1B\][^\x07]
|
|
13683
|
+
return str2.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
13684
|
+
}
|
|
13685
|
+
function parseCount(params, fallback2 = 1) {
|
|
13686
|
+
const first = Number(String(params || "").split(";")[0] || fallback2);
|
|
13687
|
+
return Math.max(1, Number.isFinite(first) ? first : fallback2);
|
|
13688
|
+
}
|
|
13689
|
+
function isCombiningMark(ch) {
|
|
13690
|
+
return /[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/.test(ch);
|
|
13691
|
+
}
|
|
13692
|
+
function isWideCodePoint(ch) {
|
|
13693
|
+
const cp = ch.codePointAt(0) || 0;
|
|
13694
|
+
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);
|
|
13684
13695
|
}
|
|
13685
13696
|
function stripTerminalNoise(str2) {
|
|
13686
|
-
return String(str2 || "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "").replace(
|
|
13697
|
+
return String(str2 || "").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");
|
|
13687
13698
|
}
|
|
13688
13699
|
function sanitizeTerminalText(str2) {
|
|
13689
|
-
|
|
13700
|
+
const accumulator = new TerminalTranscriptAccumulator();
|
|
13701
|
+
return stripTerminalNoise(stripAnsi(accumulator.append(str2)));
|
|
13690
13702
|
}
|
|
13691
13703
|
function listCliScriptNames(scripts) {
|
|
13692
13704
|
if (!scripts) return [];
|
|
@@ -13865,7 +13877,7 @@ function normalizeCliProviderForRuntime(raw) {
|
|
|
13865
13877
|
}
|
|
13866
13878
|
};
|
|
13867
13879
|
}
|
|
13868
|
-
var os11, path14, import_child_process4, buildCliSpawnEnv;
|
|
13880
|
+
var os11, path14, import_child_process4, TerminalTranscriptAccumulator, buildCliSpawnEnv;
|
|
13869
13881
|
var init_provider_cli_shared = __esm({
|
|
13870
13882
|
"../../oss/packages/daemon-core/src/cli-adapters/provider-cli-shared.ts"() {
|
|
13871
13883
|
"use strict";
|
|
@@ -13873,6 +13885,155 @@ var init_provider_cli_shared = __esm({
|
|
|
13873
13885
|
path14 = __toESM(require("path"));
|
|
13874
13886
|
import_child_process4 = require("child_process");
|
|
13875
13887
|
init_spawn_env();
|
|
13888
|
+
TerminalTranscriptAccumulator = class {
|
|
13889
|
+
lines = [[]];
|
|
13890
|
+
row = 0;
|
|
13891
|
+
col = 0;
|
|
13892
|
+
savedCursor = null;
|
|
13893
|
+
pendingEscape = "";
|
|
13894
|
+
append(data) {
|
|
13895
|
+
const input = this.pendingEscape + String(data || "");
|
|
13896
|
+
this.pendingEscape = "";
|
|
13897
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
13898
|
+
let ch = input[i];
|
|
13899
|
+
if (ch === "\x1B") {
|
|
13900
|
+
const consumed = this.consumeEscape(input.slice(i));
|
|
13901
|
+
if (consumed === 0) {
|
|
13902
|
+
this.pendingEscape = input.slice(i);
|
|
13903
|
+
break;
|
|
13904
|
+
}
|
|
13905
|
+
i += consumed - 1;
|
|
13906
|
+
continue;
|
|
13907
|
+
}
|
|
13908
|
+
const cp = input.codePointAt(i);
|
|
13909
|
+
if (cp && cp > 65535) {
|
|
13910
|
+
ch = String.fromCodePoint(cp);
|
|
13911
|
+
i += 1;
|
|
13912
|
+
}
|
|
13913
|
+
this.writeControlOrChar(ch);
|
|
13914
|
+
}
|
|
13915
|
+
return this.getText();
|
|
13916
|
+
}
|
|
13917
|
+
reset() {
|
|
13918
|
+
this.lines = [[]];
|
|
13919
|
+
this.row = 0;
|
|
13920
|
+
this.col = 0;
|
|
13921
|
+
this.savedCursor = null;
|
|
13922
|
+
this.pendingEscape = "";
|
|
13923
|
+
}
|
|
13924
|
+
getText() {
|
|
13925
|
+
return this.lines.map((line) => line.join("").replace(/[ \t]+$/g, "")).join("\n");
|
|
13926
|
+
}
|
|
13927
|
+
ensureRow(row = this.row) {
|
|
13928
|
+
while (this.lines.length <= row) this.lines.push([]);
|
|
13929
|
+
}
|
|
13930
|
+
writeControlOrChar(ch) {
|
|
13931
|
+
if (ch === "\r") {
|
|
13932
|
+
this.col = 0;
|
|
13933
|
+
return;
|
|
13934
|
+
}
|
|
13935
|
+
if (ch === "\n") {
|
|
13936
|
+
this.row += 1;
|
|
13937
|
+
this.col = 0;
|
|
13938
|
+
this.ensureRow();
|
|
13939
|
+
return;
|
|
13940
|
+
}
|
|
13941
|
+
if (ch === "\b") {
|
|
13942
|
+
this.col = Math.max(0, this.col - 1);
|
|
13943
|
+
return;
|
|
13944
|
+
}
|
|
13945
|
+
if (ch < " " || ch === "\x7F") return;
|
|
13946
|
+
this.ensureRow();
|
|
13947
|
+
const line = this.lines[this.row];
|
|
13948
|
+
if (isCombiningMark(ch) && this.col > 0) {
|
|
13949
|
+
line[this.col - 1] = `${line[this.col - 1] || ""}${ch}`;
|
|
13950
|
+
return;
|
|
13951
|
+
}
|
|
13952
|
+
while (line.length < this.col) line.push(" ");
|
|
13953
|
+
line[this.col] = ch;
|
|
13954
|
+
this.col += isWideCodePoint(ch) ? 2 : 1;
|
|
13955
|
+
}
|
|
13956
|
+
consumeEscape(seq2) {
|
|
13957
|
+
if (seq2.length < 2) return 0;
|
|
13958
|
+
const next = seq2[1];
|
|
13959
|
+
if (next === "7") {
|
|
13960
|
+
this.savedCursor = { row: this.row, col: this.col };
|
|
13961
|
+
return 2;
|
|
13962
|
+
}
|
|
13963
|
+
if (next === "8") {
|
|
13964
|
+
if (this.savedCursor) {
|
|
13965
|
+
this.row = this.savedCursor.row;
|
|
13966
|
+
this.col = this.savedCursor.col;
|
|
13967
|
+
this.ensureRow();
|
|
13968
|
+
}
|
|
13969
|
+
return 2;
|
|
13970
|
+
}
|
|
13971
|
+
if (next === "]") {
|
|
13972
|
+
const bel = seq2.indexOf("\x07", 2);
|
|
13973
|
+
const st = seq2.indexOf("\x1B\\", 2);
|
|
13974
|
+
const end = bel >= 0 && (st < 0 || bel < st) ? bel + 1 : st >= 0 ? st + 2 : 0;
|
|
13975
|
+
return end;
|
|
13976
|
+
}
|
|
13977
|
+
if (next === "[") {
|
|
13978
|
+
const match = seq2.match(/^\x1B\[([0-?]*)([ -/]*)([@-~])/);
|
|
13979
|
+
if (!match) return seq2.length < 32 ? 0 : 1;
|
|
13980
|
+
this.applyCsi(match[1] || "", match[3]);
|
|
13981
|
+
return match[0].length;
|
|
13982
|
+
}
|
|
13983
|
+
if (/[P^_X]/.test(next)) {
|
|
13984
|
+
const bel = seq2.indexOf("\x07", 2);
|
|
13985
|
+
const st = seq2.indexOf("\x1B\\", 2);
|
|
13986
|
+
const end = bel >= 0 && (st < 0 || bel < st) ? bel + 1 : st >= 0 ? st + 2 : 0;
|
|
13987
|
+
return end;
|
|
13988
|
+
}
|
|
13989
|
+
return 2;
|
|
13990
|
+
}
|
|
13991
|
+
applyCsi(params, final) {
|
|
13992
|
+
const count = parseCount(params);
|
|
13993
|
+
this.ensureRow();
|
|
13994
|
+
if (final === "A") this.row = Math.max(0, this.row - count);
|
|
13995
|
+
else if (final === "B") this.row += count;
|
|
13996
|
+
else if (final === "C") this.col += count;
|
|
13997
|
+
else if (final === "D") this.col = Math.max(0, this.col - count);
|
|
13998
|
+
else if (final === "G") this.col = Math.max(0, count - 1);
|
|
13999
|
+
else if (final === "H" || final === "f") {
|
|
14000
|
+
const parts = String(params || "").split(";");
|
|
14001
|
+
this.row = Math.max(0, (Number(parts[0] || 1) || 1) - 1);
|
|
14002
|
+
this.col = Math.max(0, (Number(parts[1] || 1) || 1) - 1);
|
|
14003
|
+
} else if (final === "J") {
|
|
14004
|
+
const mode = Number(params || 0) || 0;
|
|
14005
|
+
if (mode === 2 || mode === 3) {
|
|
14006
|
+
this.lines = [[]];
|
|
14007
|
+
this.row = 0;
|
|
14008
|
+
this.col = 0;
|
|
14009
|
+
} else if (mode === 0) {
|
|
14010
|
+
this.lines[this.row] = this.lines[this.row].slice(0, this.col);
|
|
14011
|
+
this.lines.splice(this.row + 1);
|
|
14012
|
+
} else if (mode === 1) {
|
|
14013
|
+
for (let r = 0; r < this.row; r += 1) this.lines[r] = [];
|
|
14014
|
+
const line = this.lines[this.row];
|
|
14015
|
+
for (let c = 0; c <= Math.min(this.col, line.length - 1); c += 1) line[c] = " ";
|
|
14016
|
+
}
|
|
14017
|
+
} else if (final === "K") {
|
|
14018
|
+
const mode = Number(params || 0) || 0;
|
|
14019
|
+
const line = this.lines[this.row];
|
|
14020
|
+
if (mode === 2) this.lines[this.row] = [];
|
|
14021
|
+
else if (mode === 1) {
|
|
14022
|
+
for (let c = 0; c <= Math.min(this.col, line.length - 1); c += 1) line[c] = " ";
|
|
14023
|
+
} else {
|
|
14024
|
+
this.lines[this.row] = line.slice(0, this.col);
|
|
14025
|
+
}
|
|
14026
|
+
} else if (final === "s") {
|
|
14027
|
+
this.savedCursor = { row: this.row, col: this.col };
|
|
14028
|
+
} else if (final === "u") {
|
|
14029
|
+
if (this.savedCursor) {
|
|
14030
|
+
this.row = this.savedCursor.row;
|
|
14031
|
+
this.col = this.savedCursor.col;
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
this.ensureRow();
|
|
14035
|
+
}
|
|
14036
|
+
};
|
|
13876
14037
|
buildCliSpawnEnv = sanitizeSpawnEnv;
|
|
13877
14038
|
}
|
|
13878
14039
|
});
|
|
@@ -14220,8 +14381,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
14220
14381
|
// ─── CLI Scripts (script-based parsing) ───
|
|
14221
14382
|
cliScripts;
|
|
14222
14383
|
runtimeSettings = {};
|
|
14223
|
-
/** Full accumulated
|
|
14384
|
+
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
14224
14385
|
accumulatedBuffer = "";
|
|
14386
|
+
/** Stateful rendered transcript accumulator; raw debug remains in accumulatedRawBuffer. */
|
|
14387
|
+
transcriptAccumulator = new TerminalTranscriptAccumulator();
|
|
14225
14388
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
14226
14389
|
accumulatedRawBuffer = "";
|
|
14227
14390
|
/** Current visible terminal screen snapshot */
|
|
@@ -14287,6 +14450,7 @@ ${lastSnapshot}`;
|
|
|
14287
14450
|
}
|
|
14288
14451
|
resetTerminalScreen(rows, cols) {
|
|
14289
14452
|
this.terminalScreen.reset(rows, cols);
|
|
14453
|
+
this.transcriptAccumulator.reset();
|
|
14290
14454
|
this.lastScreenText = "";
|
|
14291
14455
|
this.lastScreenSnapshot = "";
|
|
14292
14456
|
this.lastScreenChangeAt = 0;
|
|
@@ -14545,6 +14709,7 @@ ${lastSnapshot}`;
|
|
|
14545
14709
|
handleOutput(rawData) {
|
|
14546
14710
|
this.terminalScreen.write(rawData);
|
|
14547
14711
|
const cleanData = sanitizeTerminalText(rawData);
|
|
14712
|
+
const renderedTranscript = this.transcriptAccumulator.append(rawData);
|
|
14548
14713
|
const now = Date.now();
|
|
14549
14714
|
const shouldReadScreen = this.shouldReadTerminalScreenSnapshot(now);
|
|
14550
14715
|
const screenText = shouldReadScreen ? this.readTerminalScreenText(now) : this.lastScreenText;
|
|
@@ -14585,13 +14750,14 @@ ${lastSnapshot}`;
|
|
|
14585
14750
|
}
|
|
14586
14751
|
}
|
|
14587
14752
|
const prevRecentLen = this.recentOutputBuffer.length;
|
|
14588
|
-
const prevAccumulatedLen = this.accumulatedBuffer.length;
|
|
14589
14753
|
const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
|
|
14590
|
-
|
|
14591
|
-
|
|
14754
|
+
const nextAccumulatedBuffer = renderedTranscript.length <= _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER ? renderedTranscript : renderedTranscript.slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
|
|
14755
|
+
const nextRecentOutputBuffer = nextAccumulatedBuffer.slice(-_ProviderCliAdapter.MAX_RECENT_OUTPUT_BUFFER);
|
|
14756
|
+
this.recentOutputBuffer = nextRecentOutputBuffer;
|
|
14757
|
+
this.accumulatedBuffer = nextAccumulatedBuffer;
|
|
14592
14758
|
this.accumulatedRawBuffer = appendBoundedText(this.accumulatedRawBuffer, rawData, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
|
|
14593
|
-
const droppedRecent =
|
|
14594
|
-
const droppedClean =
|
|
14759
|
+
const droppedRecent = Math.max(0, prevRecentLen - this.recentOutputBuffer.length);
|
|
14760
|
+
const droppedClean = Math.max(0, renderedTranscript.length - this.accumulatedBuffer.length);
|
|
14595
14761
|
const droppedRaw = this.recordBoundedAppendDrop(prevAccumulatedRawLen, rawData.length, this.accumulatedRawBuffer.length);
|
|
14596
14762
|
this.recentOutputDroppedChars += droppedRecent;
|
|
14597
14763
|
this.accumulatedBufferDroppedChars += droppedClean;
|
|
@@ -42807,6 +42973,9 @@ var init_mesh_coordinator = __esm({
|
|
|
42807
42973
|
function readNonEmptyString(value) {
|
|
42808
42974
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
42809
42975
|
}
|
|
42976
|
+
function isMeshCoordinatorEvent(eventName) {
|
|
42977
|
+
return typeof eventName === "string" && MESH_COORDINATOR_EVENTS.has(eventName);
|
|
42978
|
+
}
|
|
42810
42979
|
function formatCompletionMetadata(event) {
|
|
42811
42980
|
const parts = [
|
|
42812
42981
|
readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
|
|
@@ -42823,6 +42992,12 @@ function buildMeshSystemMessage(args) {
|
|
|
42823
42992
|
if (args.event === "agent:waiting_approval") {
|
|
42824
42993
|
return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
42825
42994
|
}
|
|
42995
|
+
if (args.event === "agent:stopped") {
|
|
42996
|
+
return `[System] ${args.nodeLabel} has stopped${metadata}. Use mesh_read_chat once if you need to inspect its last output.`;
|
|
42997
|
+
}
|
|
42998
|
+
if (args.event === "monitor:long_generating") {
|
|
42999
|
+
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.`;
|
|
43000
|
+
}
|
|
42826
43001
|
return "";
|
|
42827
43002
|
}
|
|
42828
43003
|
function injectMeshSystemMessage(components, args) {
|
|
@@ -42848,7 +43023,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
42848
43023
|
}
|
|
42849
43024
|
function handleMeshForwardEvent(components, payload) {
|
|
42850
43025
|
const eventName = readNonEmptyString(payload.event);
|
|
42851
|
-
if (eventName
|
|
43026
|
+
if (!isMeshCoordinatorEvent(eventName)) {
|
|
42852
43027
|
return { success: false, error: "unsupported mesh event" };
|
|
42853
43028
|
}
|
|
42854
43029
|
const meshId = readNonEmptyString(payload.meshId);
|
|
@@ -42869,7 +43044,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
42869
43044
|
}
|
|
42870
43045
|
function setupMeshEventForwarding(components) {
|
|
42871
43046
|
components.instanceManager.onEvent((event) => {
|
|
42872
|
-
if (event.event
|
|
43047
|
+
if (!isMeshCoordinatorEvent(event.event)) return;
|
|
42873
43048
|
const instanceId = readNonEmptyString(event.instanceId);
|
|
42874
43049
|
if (!instanceId) return;
|
|
42875
43050
|
const sourceInstance = components.instanceManager.getInstance(instanceId);
|
|
@@ -42897,11 +43072,18 @@ function setupMeshEventForwarding(components) {
|
|
|
42897
43072
|
});
|
|
42898
43073
|
});
|
|
42899
43074
|
}
|
|
43075
|
+
var MESH_COORDINATOR_EVENTS;
|
|
42900
43076
|
var init_mesh_events = __esm({
|
|
42901
43077
|
"../../oss/packages/daemon-core/src/mesh/mesh-events.ts"() {
|
|
42902
43078
|
"use strict";
|
|
42903
43079
|
init_mesh_config();
|
|
42904
43080
|
init_logger();
|
|
43081
|
+
MESH_COORDINATOR_EVENTS = /* @__PURE__ */ new Set([
|
|
43082
|
+
"agent:generating_completed",
|
|
43083
|
+
"agent:waiting_approval",
|
|
43084
|
+
"agent:stopped",
|
|
43085
|
+
"monitor:long_generating"
|
|
43086
|
+
]);
|
|
42905
43087
|
}
|
|
42906
43088
|
});
|
|
42907
43089
|
|
|
@@ -63473,7 +63655,7 @@ var init_adhdev_daemon = __esm({
|
|
|
63473
63655
|
init_version();
|
|
63474
63656
|
init_src();
|
|
63475
63657
|
init_runtime_defaults();
|
|
63476
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.
|
|
63658
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.68" });
|
|
63477
63659
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
63478
63660
|
localHttpServer = null;
|
|
63479
63661
|
localWss = null;
|
|
@@ -64327,7 +64509,8 @@ ${err?.stack || ""}`);
|
|
|
64327
64509
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
64328
64510
|
}
|
|
64329
64511
|
async relayRemoteMeshCoordinatorEvent(event, localDaemonId) {
|
|
64330
|
-
|
|
64512
|
+
const coordinatorEvents = /* @__PURE__ */ new Set(["agent:generating_completed", "agent:waiting_approval", "agent:stopped", "monitor:long_generating"]);
|
|
64513
|
+
if (!coordinatorEvents.has(this.readMeshString(event.event))) return;
|
|
64331
64514
|
if (!this.meshManager || !this.components) return;
|
|
64332
64515
|
const instanceId = this.readMeshString(event.instanceId);
|
|
64333
64516
|
if (!instanceId) return;
|