adhdev 0.9.82-rc.57 → 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;
@@ -100517,7 +100579,7 @@ var init_adhdev_daemon = __esm({
100517
100579
  init_version();
100518
100580
  init_src();
100519
100581
  init_runtime_defaults();
100520
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.57" });
100582
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.58" });
100521
100583
  AdhdevDaemon = class _AdhdevDaemon {
100522
100584
  localHttpServer = null;
100523
100585
  localWss = null;