adhdev 0.9.82-rc.56 → 0.9.82-rc.58

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
@@ -7976,10 +7976,15 @@ function isMeshCoordinatorEvent(eventName) {
7976
7976
  return typeof eventName === "string" && MESH_COORDINATOR_EVENTS.has(eventName);
7977
7977
  }
7978
7978
  function formatCompletionMetadata(event) {
7979
+ const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
7980
+ const diagnosticReason = completionDiagnostic ? readNonEmptyString(completionDiagnostic.blockReason) || "present" : "";
7981
+ const finalAssistantPresent = typeof completionDiagnostic?.finalAssistantPresent === "boolean" ? String(completionDiagnostic.finalAssistantPresent) : "";
7979
7982
  const parts = [
7980
7983
  readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
7981
7984
  readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
7982
- readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
7985
+ readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : "",
7986
+ diagnosticReason ? `completion_diagnostic=${diagnosticReason}` : "",
7987
+ finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : ""
7983
7988
  ].filter(Boolean);
7984
7989
  return parts.length > 0 ? ` (${parts.join("; ")})` : "";
7985
7990
  }
@@ -8523,6 +8528,7 @@ function injectMeshSystemMessage(components, args) {
8523
8528
  taskId: completedTaskForLedger?.id || void 0,
8524
8529
  providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
8525
8530
  finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0,
8531
+ completionDiagnostic: args.metadataEvent.completionDiagnostic && typeof args.metadataEvent.completionDiagnostic === "object" ? args.metadataEvent.completionDiagnostic : void 0,
8526
8532
  evidence: completionEvidence
8527
8533
  }
8528
8534
  });
@@ -20482,7 +20488,9 @@ function resolveCliSpawnPlan(options) {
20482
20488
  const configuredCommand = typeof runtimeSettings.executablePath === "string" && runtimeSettings.executablePath.trim() ? runtimeSettings.executablePath.trim() : spawnConfig.command;
20483
20489
  const binaryPath = findBinary(configuredCommand);
20484
20490
  const isWin = os13.platform() === "win32";
20485
- const allArgs = [...spawnConfig.args, ...extraArgs];
20491
+ const allArgs = [...spawnConfig.args, ...extraArgs].map(
20492
+ (arg) => typeof arg === "string" ? arg.replace(/\{\{workingDir\}\}/g, workingDir) : arg
20493
+ );
20486
20494
  let shellCmd;
20487
20495
  let shellArgs;
20488
20496
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path16.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
@@ -23256,6 +23264,44 @@ var init_cli_provider_instance = __esm({
23256
23264
  const content = lastVisible ? flattenContent(lastVisible.content).trim() : "";
23257
23265
  return role === "assistant" && !!content;
23258
23266
  }
23267
+ buildCompletedFinalizationDiagnostic(args) {
23268
+ let parsed = null;
23269
+ let parseError;
23270
+ try {
23271
+ parsed = this.adapter.getScriptParsedStatus();
23272
+ } catch (error48) {
23273
+ parseError = error48?.message || String(error48);
23274
+ }
23275
+ const visibleMessages = (Array.isArray(parsed?.messages) ? parsed.messages : []).filter((message) => isUserFacingChatMessage(message));
23276
+ const lastVisible = visibleMessages[visibleMessages.length - 1];
23277
+ const lastVisibleRole = typeof lastVisible?.role === "string" ? lastVisible.role.trim().toLowerCase() : null;
23278
+ const lastVisibleKind = typeof lastVisible?.kind === "string" ? lastVisible.kind : null;
23279
+ const lastVisibleContentLength = lastVisible ? flattenContent(lastVisible.content).trim().length : 0;
23280
+ return {
23281
+ providerType: this.type,
23282
+ sessionId: this.instanceId,
23283
+ providerSessionId: this.providerSessionId || null,
23284
+ workspace: this.workingDir,
23285
+ blockReason: args.blockReason,
23286
+ emittedAfterFinalizationTimeout: args.emittedAfterFinalizationTimeout,
23287
+ waitedMs: args.waitedMs,
23288
+ maxWaitMs: COMPLETED_FINALIZATION_MAX_WAIT_MS,
23289
+ adapterStatus: typeof args.latestStatus?.status === "string" ? args.latestStatus.status : null,
23290
+ latestVisibleStatus: args.latestVisibleStatus,
23291
+ parsedStatus: typeof parsed?.status === "string" ? parsed.status : parseError ? "parse_error" : "unknown",
23292
+ parseError: parseError || void 0,
23293
+ finalAssistantPresent: this.completionHasFinalAssistantMessage(parsed?.messages),
23294
+ visibleMessageCount: visibleMessages.length,
23295
+ lastVisibleRole,
23296
+ lastVisibleKind,
23297
+ lastVisibleContentLength,
23298
+ pendingStartedAt: this.generatingStartedAt || null,
23299
+ pendingFirstObservedAt: args.pending.firstObservedAt,
23300
+ pendingTimestamp: args.pending.timestamp,
23301
+ pendingDurationSec: args.pending.duration,
23302
+ previousBlockReason: args.pending.loggedBlockReason || null
23303
+ };
23304
+ }
23259
23305
  hasAdapterPendingResponse() {
23260
23306
  const adapterAny = this.adapter;
23261
23307
  if (adapterAny?.isWaitingForResponse === true) return true;
@@ -23328,7 +23374,23 @@ var init_cli_provider_instance = __esm({
23328
23374
  this.scheduleCompletedDebounceFlush(COMPLETED_FINALIZATION_RETRY_MS);
23329
23375
  return;
23330
23376
  }
23331
- LOG.warn("CLI", `[${this.type}] suppressed completed event after ${waitedMs}ms without finalized assistant turn (${blockReason})`);
23377
+ const completionDiagnostic = this.buildCompletedFinalizationDiagnostic({
23378
+ blockReason,
23379
+ latestStatus,
23380
+ latestVisibleStatus,
23381
+ waitedMs,
23382
+ pending,
23383
+ emittedAfterFinalizationTimeout: true
23384
+ });
23385
+ LOG.warn("CLI", `[${this.type}] emitting completed event after ${waitedMs}ms without finalized assistant turn (${blockReason})`);
23386
+ this.pushEvent({
23387
+ event: "agent:generating_completed",
23388
+ chatTitle: pending.chatTitle,
23389
+ duration: pending.duration,
23390
+ timestamp: pending.timestamp,
23391
+ finalSummary: extractFinalSummaryFromMessages(this.adapter?.getScriptParsedStatus()?.messages),
23392
+ completionDiagnostic
23393
+ });
23332
23394
  this.completedDebouncePending = null;
23333
23395
  this.completedDebounceTimer = null;
23334
23396
  this.generatingStartedAt = 0;
@@ -47779,15 +47841,15 @@ function reconcileInlineMeshCache(cached2, incoming) {
47779
47841
  const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
47780
47842
  const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
47781
47843
  if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
47782
- const incomingById = /* @__PURE__ */ new Map();
47783
- for (const node of incomingNodes) {
47844
+ const cachedById = /* @__PURE__ */ new Map();
47845
+ for (const node of cachedNodes) {
47784
47846
  const nodeId = readInlineMeshNodeId(node);
47785
- if (nodeId) incomingById.set(nodeId, node);
47847
+ if (nodeId) cachedById.set(nodeId, node);
47786
47848
  }
47787
- const nodes = cachedNodes.map((cachedNode) => {
47788
- const nodeId = readInlineMeshNodeId(cachedNode);
47789
- const incomingNode = nodeId ? incomingById.get(nodeId) : void 0;
47790
- if (!incomingNode) return cachedNode;
47849
+ const nodes = incomingNodes.map((incomingNode) => {
47850
+ const nodeId = readInlineMeshNodeId(incomingNode);
47851
+ const cachedNode = nodeId ? cachedById.get(nodeId) : void 0;
47852
+ if (!cachedNode) return incomingNode;
47791
47853
  if (hasInlineMeshTransientNodeState(incomingNode)) {
47792
47854
  return { ...cachedNode, ...incomingNode };
47793
47855
  }
@@ -47942,7 +48004,7 @@ async function hydrateInlineMeshDirectTruth(args) {
47942
48004
  if (!isSelfNode && daemonId) unavailableNodeIds.push(nodeId);
47943
48005
  continue;
47944
48006
  }
47945
- if (isSelfNode && fs10.existsSync(workspace)) {
48007
+ if (fs10.existsSync(workspace)) {
47946
48008
  try {
47947
48009
  const localGit = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
47948
48010
  if (localGit?.isGitRepo) {
@@ -60102,7 +60164,7 @@ var require_yoctocolors_cjs = __commonJS({
60102
60164
  }
60103
60165
  });
60104
60166
 
60105
- // ../../node_modules/@inquirer/figures/dist/esm/index.mjs
60167
+ // ../../node_modules/@inquirer/figures/dist/esm/index.js
60106
60168
  function isUnicodeSupported() {
60107
60169
  if (import_node_process3.default.platform !== "win32") {
60108
60170
  return import_node_process3.default.env["TERM"] !== "linux";
@@ -60114,7 +60176,7 @@ function isUnicodeSupported() {
60114
60176
  }
60115
60177
  var import_node_process3, common2, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
60116
60178
  var init_esm3 = __esm({
60117
- "../../node_modules/@inquirer/figures/dist/esm/index.mjs"() {
60179
+ "../../node_modules/@inquirer/figures/dist/esm/index.js"() {
60118
60180
  "use strict";
60119
60181
  import_node_process3 = __toESM(require("process"), 1);
60120
60182
  common2 = {
@@ -60385,7 +60447,10 @@ var init_esm3 = __esm({
60385
60447
  oneNinth: "1/9",
60386
60448
  oneTenth: "1/10"
60387
60449
  };
60388
- mainSymbols = { ...common2, ...specialMainSymbols };
60450
+ mainSymbols = {
60451
+ ...common2,
60452
+ ...specialMainSymbols
60453
+ };
60389
60454
  fallbackSymbols = {
60390
60455
  ...common2,
60391
60456
  ...specialFallbackSymbols
@@ -100514,7 +100579,7 @@ var init_adhdev_daemon = __esm({
100514
100579
  init_version();
100515
100580
  init_src();
100516
100581
  init_runtime_defaults();
100517
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.56" });
100582
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.58" });
100518
100583
  AdhdevDaemon = class _AdhdevDaemon {
100519
100584
  localHttpServer = null;
100520
100585
  localWss = null;