adhdev 0.9.59 → 0.9.60
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 +77 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +75 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +341 -48
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -8757,18 +8757,31 @@ function collapseReplayDuplicatesFromReadChat(messages) {
|
|
|
8757
8757
|
const collapsed = [];
|
|
8758
8758
|
const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
|
|
8759
8759
|
let stableAssistantAnswerContentInCurrentTurn = "";
|
|
8760
|
+
let stableAssistantAnswerCollapsedIndex = -1;
|
|
8761
|
+
let stableAssistantAnswerHadInterveningActivity = false;
|
|
8760
8762
|
let previousReplaySignature = "";
|
|
8761
8763
|
for (const message of messages) {
|
|
8762
8764
|
const info = getReadChatReplayCollapseInfo(message);
|
|
8763
8765
|
if (info?.role === "user") {
|
|
8764
8766
|
replaySignaturesInCurrentTurn.clear();
|
|
8765
8767
|
stableAssistantAnswerContentInCurrentTurn = "";
|
|
8768
|
+
stableAssistantAnswerCollapsedIndex = -1;
|
|
8769
|
+
stableAssistantAnswerHadInterveningActivity = false;
|
|
8766
8770
|
previousReplaySignature = "";
|
|
8767
8771
|
}
|
|
8768
8772
|
if (info?.collapsible && info.signature) {
|
|
8769
8773
|
if (previousReplaySignature === info.signature) continue;
|
|
8770
8774
|
if (replaySignaturesInCurrentTurn.has(info.signature)) continue;
|
|
8771
|
-
if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn))
|
|
8775
|
+
if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) {
|
|
8776
|
+
const isAdjacentFullerAssistantAnswer = info.role === "assistant" && (!info.kind || info.kind === "standard") && stableAssistantAnswerCollapsedIndex >= 0 && stableAssistantAnswerCollapsedIndex === collapsed.length - 1 && !stableAssistantAnswerHadInterveningActivity && info.content.length > stableAssistantAnswerContentInCurrentTurn.length && info.content.startsWith(stableAssistantAnswerContentInCurrentTurn);
|
|
8777
|
+
if (isAdjacentFullerAssistantAnswer) {
|
|
8778
|
+
collapsed[stableAssistantAnswerCollapsedIndex] = message;
|
|
8779
|
+
replaySignaturesInCurrentTurn.add(info.signature);
|
|
8780
|
+
stableAssistantAnswerContentInCurrentTurn = info.content;
|
|
8781
|
+
previousReplaySignature = info.signature;
|
|
8782
|
+
}
|
|
8783
|
+
continue;
|
|
8784
|
+
}
|
|
8772
8785
|
}
|
|
8773
8786
|
collapsed.push(message);
|
|
8774
8787
|
previousReplaySignature = info?.collapsible ? info.signature : "";
|
|
@@ -8777,6 +8790,10 @@ function collapseReplayDuplicatesFromReadChat(messages) {
|
|
|
8777
8790
|
}
|
|
8778
8791
|
if (isStableReadChatAssistantAnswerInfo(info)) {
|
|
8779
8792
|
stableAssistantAnswerContentInCurrentTurn = info?.content || "";
|
|
8793
|
+
stableAssistantAnswerCollapsedIndex = collapsed.length - 1;
|
|
8794
|
+
stableAssistantAnswerHadInterveningActivity = false;
|
|
8795
|
+
} else if (stableAssistantAnswerContentInCurrentTurn && info?.role === "assistant" && (!info.kind || info.kind !== "standard")) {
|
|
8796
|
+
stableAssistantAnswerHadInterveningActivity = true;
|
|
8780
8797
|
}
|
|
8781
8798
|
}
|
|
8782
8799
|
return collapsed;
|
|
@@ -49351,7 +49368,7 @@ var init_server_connection = __esm({
|
|
|
49351
49368
|
*/
|
|
49352
49369
|
sendMeshCommand(targetDaemonId, command, args = {}, timeoutMs = 3e4) {
|
|
49353
49370
|
return new Promise((resolve19, reject) => {
|
|
49354
|
-
const requestId = `mesh_${
|
|
49371
|
+
const requestId = `mesh_${crypto.randomUUID()}`;
|
|
49355
49372
|
const timer = setTimeout(() => {
|
|
49356
49373
|
this.off("daemon_mesh_result", handler);
|
|
49357
49374
|
reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
|
|
@@ -58868,15 +58885,38 @@ var init_daemon_mesh_manager = __esm({
|
|
|
58868
58885
|
"src/daemon-mesh-manager.ts"() {
|
|
58869
58886
|
"use strict";
|
|
58870
58887
|
init_src();
|
|
58871
|
-
DaemonMeshManager = class {
|
|
58888
|
+
DaemonMeshManager = class _DaemonMeshManager {
|
|
58872
58889
|
rules = [];
|
|
58873
58890
|
serverConn;
|
|
58874
58891
|
constructor(serverConn) {
|
|
58875
58892
|
this.serverConn = serverConn;
|
|
58876
58893
|
}
|
|
58894
|
+
static COMMAND_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
58895
|
+
"send_chat",
|
|
58896
|
+
"read_chat",
|
|
58897
|
+
"git_status",
|
|
58898
|
+
"git_diff_summary",
|
|
58899
|
+
"launch_cli"
|
|
58900
|
+
]);
|
|
58877
58901
|
setRules(rules) {
|
|
58878
|
-
|
|
58879
|
-
|
|
58902
|
+
const valid = [];
|
|
58903
|
+
for (const rule of rules) {
|
|
58904
|
+
if (!rule.trigger || typeof rule.trigger !== "string") {
|
|
58905
|
+
LOG.warn("Mesh", `[Mesh] Skipping rule: missing or invalid 'trigger'`);
|
|
58906
|
+
continue;
|
|
58907
|
+
}
|
|
58908
|
+
if (!rule.targetDaemonId || typeof rule.targetDaemonId !== "string") {
|
|
58909
|
+
LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': missing or invalid 'targetDaemonId'`);
|
|
58910
|
+
continue;
|
|
58911
|
+
}
|
|
58912
|
+
if (!_DaemonMeshManager.COMMAND_ALLOWLIST.has(rule.command)) {
|
|
58913
|
+
LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': command '${rule.command}' not in allowlist`);
|
|
58914
|
+
continue;
|
|
58915
|
+
}
|
|
58916
|
+
valid.push(rule);
|
|
58917
|
+
}
|
|
58918
|
+
this.rules = valid;
|
|
58919
|
+
LOG.info("Mesh", `[Mesh] ${valid.length}/${rules.length} rule(s) loaded`);
|
|
58880
58920
|
}
|
|
58881
58921
|
async emit(event) {
|
|
58882
58922
|
const matching = this.rules.filter((r) => r.trigger === event.trigger);
|
|
@@ -59147,7 +59187,7 @@ var init_adhdev_daemon = __esm({
|
|
|
59147
59187
|
init_version();
|
|
59148
59188
|
init_src();
|
|
59149
59189
|
init_runtime_defaults();
|
|
59150
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
59190
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.60" });
|
|
59151
59191
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
59152
59192
|
localHttpServer = null;
|
|
59153
59193
|
localWss = null;
|
|
@@ -59962,6 +60002,26 @@ ${err?.stack || ""}`);
|
|
|
59962
60002
|
if (!result || result.success !== true) return false;
|
|
59963
60003
|
return commandType === "launch_cli" || commandType === "launch_ide";
|
|
59964
60004
|
}
|
|
60005
|
+
async buildMeshCheckpointContext(workspace, base) {
|
|
60006
|
+
if (!this.components) return base;
|
|
60007
|
+
try {
|
|
60008
|
+
const statusResult = await Promise.race([
|
|
60009
|
+
this.components.router.execute("git_status", { workspace }, "mesh"),
|
|
60010
|
+
new Promise((resolve19) => setTimeout(() => resolve19(null), 4e3))
|
|
60011
|
+
]);
|
|
60012
|
+
const s = statusResult?.status ?? statusResult;
|
|
60013
|
+
if (s?.isGitRepo) {
|
|
60014
|
+
return {
|
|
60015
|
+
...base,
|
|
60016
|
+
branch: s.branch ?? "",
|
|
60017
|
+
ahead: s.ahead ?? 0,
|
|
60018
|
+
behind: s.behind ?? 0
|
|
60019
|
+
};
|
|
60020
|
+
}
|
|
60021
|
+
} catch {
|
|
60022
|
+
}
|
|
60023
|
+
return base;
|
|
60024
|
+
}
|
|
59965
60025
|
triggerImmediateLaunchStatusUpdate(reason) {
|
|
59966
60026
|
this.statusReporter?.resetP2PHash();
|
|
59967
60027
|
void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
|
|
@@ -60083,13 +60143,15 @@ ${err?.stack || ""}`);
|
|
|
60083
60143
|
void this.flushP2PWorkspaceGitSubscriptions();
|
|
60084
60144
|
}
|
|
60085
60145
|
if (cmdType === "git_checkpoint" && routed.success && this.meshManager) {
|
|
60086
|
-
|
|
60087
|
-
|
|
60088
|
-
|
|
60089
|
-
|
|
60090
|
-
|
|
60091
|
-
|
|
60092
|
-
|
|
60146
|
+
const workspace = String(normalizedData.workspace ?? "");
|
|
60147
|
+
const baseContext = {
|
|
60148
|
+
workspace,
|
|
60149
|
+
checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
|
|
60150
|
+
commit: routed.checkpoint?.commit ?? "",
|
|
60151
|
+
source_session_id: String(normalizedData.targetSessionId ?? "")
|
|
60152
|
+
};
|
|
60153
|
+
void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
|
|
60154
|
+
this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
|
|
60093
60155
|
});
|
|
60094
60156
|
}
|
|
60095
60157
|
return { ...routed, interactionId };
|