adhdev 0.9.59 → 0.9.61

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 CHANGED
@@ -9277,18 +9277,31 @@ function collapseReplayDuplicatesFromReadChat(messages) {
9277
9277
  const collapsed = [];
9278
9278
  const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
9279
9279
  let stableAssistantAnswerContentInCurrentTurn = "";
9280
+ let stableAssistantAnswerCollapsedIndex = -1;
9281
+ let stableAssistantAnswerHadInterveningActivity = false;
9280
9282
  let previousReplaySignature = "";
9281
9283
  for (const message of messages) {
9282
9284
  const info = getReadChatReplayCollapseInfo(message);
9283
9285
  if (info?.role === "user") {
9284
9286
  replaySignaturesInCurrentTurn.clear();
9285
9287
  stableAssistantAnswerContentInCurrentTurn = "";
9288
+ stableAssistantAnswerCollapsedIndex = -1;
9289
+ stableAssistantAnswerHadInterveningActivity = false;
9286
9290
  previousReplaySignature = "";
9287
9291
  }
9288
9292
  if (info?.collapsible && info.signature) {
9289
9293
  if (previousReplaySignature === info.signature) continue;
9290
9294
  if (replaySignaturesInCurrentTurn.has(info.signature)) continue;
9291
- if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) continue;
9295
+ if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) {
9296
+ 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);
9297
+ if (isAdjacentFullerAssistantAnswer) {
9298
+ collapsed[stableAssistantAnswerCollapsedIndex] = message;
9299
+ replaySignaturesInCurrentTurn.add(info.signature);
9300
+ stableAssistantAnswerContentInCurrentTurn = info.content;
9301
+ previousReplaySignature = info.signature;
9302
+ }
9303
+ continue;
9304
+ }
9292
9305
  }
9293
9306
  collapsed.push(message);
9294
9307
  previousReplaySignature = info?.collapsible ? info.signature : "";
@@ -9297,6 +9310,10 @@ function collapseReplayDuplicatesFromReadChat(messages) {
9297
9310
  }
9298
9311
  if (isStableReadChatAssistantAnswerInfo(info)) {
9299
9312
  stableAssistantAnswerContentInCurrentTurn = info?.content || "";
9313
+ stableAssistantAnswerCollapsedIndex = collapsed.length - 1;
9314
+ stableAssistantAnswerHadInterveningActivity = false;
9315
+ } else if (stableAssistantAnswerContentInCurrentTurn && info?.role === "assistant" && (!info.kind || info.kind !== "standard")) {
9316
+ stableAssistantAnswerHadInterveningActivity = true;
9300
9317
  }
9301
9318
  }
9302
9319
  return collapsed;
@@ -80987,7 +81004,7 @@ var init_server_connection = __esm({
80987
81004
  */
80988
81005
  sendMeshCommand(targetDaemonId, command, args = {}, timeoutMs = 3e4) {
80989
81006
  return new Promise((resolve22, reject) => {
80990
- const requestId = `mesh_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
81007
+ const requestId = `mesh_${crypto.randomUUID()}`;
80991
81008
  const timer = setTimeout(() => {
80992
81009
  this.off("daemon_mesh_result", handler);
80993
81010
  reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
@@ -90010,15 +90027,38 @@ var init_daemon_mesh_manager = __esm({
90010
90027
  "src/daemon-mesh-manager.ts"() {
90011
90028
  "use strict";
90012
90029
  init_src();
90013
- DaemonMeshManager = class {
90030
+ DaemonMeshManager = class _DaemonMeshManager {
90014
90031
  rules = [];
90015
90032
  serverConn;
90016
90033
  constructor(serverConn) {
90017
90034
  this.serverConn = serverConn;
90018
90035
  }
90036
+ static COMMAND_ALLOWLIST = /* @__PURE__ */ new Set([
90037
+ "send_chat",
90038
+ "read_chat",
90039
+ "git_status",
90040
+ "git_diff_summary",
90041
+ "launch_cli"
90042
+ ]);
90019
90043
  setRules(rules) {
90020
- this.rules = rules;
90021
- LOG.info("Mesh", `[Mesh] ${rules.length} rule(s) loaded`);
90044
+ const valid = [];
90045
+ for (const rule of rules) {
90046
+ if (!rule.trigger || typeof rule.trigger !== "string") {
90047
+ LOG.warn("Mesh", `[Mesh] Skipping rule: missing or invalid 'trigger'`);
90048
+ continue;
90049
+ }
90050
+ if (!rule.targetDaemonId || typeof rule.targetDaemonId !== "string") {
90051
+ LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': missing or invalid 'targetDaemonId'`);
90052
+ continue;
90053
+ }
90054
+ if (!_DaemonMeshManager.COMMAND_ALLOWLIST.has(rule.command)) {
90055
+ LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': command '${rule.command}' not in allowlist`);
90056
+ continue;
90057
+ }
90058
+ valid.push(rule);
90059
+ }
90060
+ this.rules = valid;
90061
+ LOG.info("Mesh", `[Mesh] ${valid.length}/${rules.length} rule(s) loaded`);
90022
90062
  }
90023
90063
  async emit(event) {
90024
90064
  const matching = this.rules.filter((r) => r.trigger === event.trigger);
@@ -90289,7 +90329,7 @@ var init_adhdev_daemon = __esm({
90289
90329
  init_version();
90290
90330
  init_src();
90291
90331
  init_runtime_defaults();
90292
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.59" });
90332
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.61" });
90293
90333
  AdhdevDaemon = class _AdhdevDaemon {
90294
90334
  localHttpServer = null;
90295
90335
  localWss = null;
@@ -91104,6 +91144,26 @@ ${err?.stack || ""}`);
91104
91144
  if (!result || result.success !== true) return false;
91105
91145
  return commandType === "launch_cli" || commandType === "launch_ide";
91106
91146
  }
91147
+ async buildMeshCheckpointContext(workspace, base) {
91148
+ if (!this.components) return base;
91149
+ try {
91150
+ const statusResult = await Promise.race([
91151
+ this.components.router.execute("git_status", { workspace }, "mesh"),
91152
+ new Promise((resolve22) => setTimeout(() => resolve22(null), 4e3))
91153
+ ]);
91154
+ const s = statusResult?.status ?? statusResult;
91155
+ if (s?.isGitRepo) {
91156
+ return {
91157
+ ...base,
91158
+ branch: s.branch ?? "",
91159
+ ahead: s.ahead ?? 0,
91160
+ behind: s.behind ?? 0
91161
+ };
91162
+ }
91163
+ } catch {
91164
+ }
91165
+ return base;
91166
+ }
91107
91167
  triggerImmediateLaunchStatusUpdate(reason) {
91108
91168
  this.statusReporter?.resetP2PHash();
91109
91169
  void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
@@ -91225,13 +91285,15 @@ ${err?.stack || ""}`);
91225
91285
  void this.flushP2PWorkspaceGitSubscriptions();
91226
91286
  }
91227
91287
  if (cmdType === "git_checkpoint" && routed.success && this.meshManager) {
91228
- void this.meshManager.emit({
91229
- trigger: "git_checkpoint_complete",
91230
- context: {
91231
- workspace: String(normalizedData.workspace ?? ""),
91232
- checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
91233
- commit: routed.checkpoint?.commit ?? ""
91234
- }
91288
+ const workspace = String(normalizedData.workspace ?? "");
91289
+ const baseContext = {
91290
+ workspace,
91291
+ checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
91292
+ commit: routed.checkpoint?.commit ?? "",
91293
+ source_session_id: String(normalizedData.targetSessionId ?? "")
91294
+ };
91295
+ void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
91296
+ this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
91235
91297
  });
91236
91298
  }
91237
91299
  return { ...routed, interactionId };
@@ -96887,8 +96949,8 @@ Claude Desktop config (~/.claude_desktop_config.json):
96887
96949
  }
96888
96950
  }
96889
96951
 
96890
- Tools available (local): list_sessions, read_chat, send_chat, approve, screenshot, git_status
96891
- Tools available (cloud): list_sessions, read_chat, send_chat, approve
96952
+ Tools available (local): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status, screenshot
96953
+ Tools available (cloud): list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status
96892
96954
  `).action(async (opts) => {
96893
96955
  const mcpBin = resolveMcpBin();
96894
96956
  if (!mcpBin) {