@adhdev/daemon-core 0.9.82-rc.166 → 0.9.82-rc.167

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/index.mjs CHANGED
@@ -3694,6 +3694,20 @@ function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
3694
3694
  }
3695
3695
  return false;
3696
3696
  }
3697
+ function hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId) {
3698
+ const entries = readLedgerEntries(meshId, { tail: 200 });
3699
+ for (let i = entries.length - 1; i >= 0; i--) {
3700
+ const entry = entries[i];
3701
+ if (entry.sessionId !== sessionId) continue;
3702
+ if (entry.kind === "task_completed" || entry.kind === "task_failed" || entry.kind === "task_stalled") {
3703
+ return false;
3704
+ }
3705
+ if (entry.kind === "task_dispatched" && entry.payload?.source === "direct") {
3706
+ return true;
3707
+ }
3708
+ }
3709
+ return false;
3710
+ }
3697
3711
  function buildLongGeneratingCompletionReconciliation(args) {
3698
3712
  const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
3699
3713
  const nodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
@@ -4561,7 +4575,7 @@ function setupMeshEventForwarding(components) {
4561
4575
  if (coordinatorMeshId) {
4562
4576
  try {
4563
4577
  const activeDispatches = getActiveDirectDispatches(coordinatorMeshId);
4564
- if (activeDispatches.some((d) => d.sessionId === instanceId)) {
4578
+ if (activeDispatches.some((d) => d.sessionId === instanceId) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, instanceId)) {
4565
4579
  meshIdFromDirectDispatch = coordinatorMeshId;
4566
4580
  }
4567
4581
  } catch {
@@ -6398,12 +6412,14 @@ function scopeLines(spec, lines, questionIndex) {
6398
6412
  function extractButtons(spec, lines, windowStart, windowEnd) {
6399
6413
  const buttonRe = compile3(spec.buttonPattern, spec.buttonFlags ?? "m");
6400
6414
  const out = [];
6415
+ const labelGroup = Number.isInteger(spec.buttonLabelGroup) && (spec.buttonLabelGroup ?? 0) > 0 ? spec.buttonLabelGroup : 1;
6401
6416
  let i = windowStart;
6402
6417
  while (i < windowEnd) {
6403
6418
  const line = lines[i];
6404
6419
  const m = buttonRe.exec(line);
6405
- if (m && m[1]) {
6406
- let label = m[1].trim();
6420
+ const captured = m?.[labelGroup] ?? (labelGroup === 1 && m && m.length > 2 ? m[m.length - 1] : void 0);
6421
+ if (m && captured) {
6422
+ let label = captured.trim();
6407
6423
  if (spec.continuationLines) {
6408
6424
  let j = i + 1;
6409
6425
  while (j < windowEnd) {
@@ -28100,7 +28116,7 @@ var CliProviderInstance = class {
28100
28116
  };
28101
28117
  }
28102
28118
  getSessionModalState(sessionId) {
28103
- const adapterStatus = this.adapter.getStatus({ allowParse: false });
28119
+ const adapterStatus = this.adapter.getStatus({ allowParse: true });
28104
28120
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
28105
28121
  const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
28106
28122
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
@@ -31638,6 +31654,7 @@ function validateControl(control, errors) {
31638
31654
  }
31639
31655
 
31640
31656
  // src/providers/provider-loader.ts
31657
+ init_external_sources();
31641
31658
  function registerProviderScriptRootSafely(root) {
31642
31659
  if (!root || typeof root !== "string") return;
31643
31660
  try {
@@ -31895,11 +31912,7 @@ var ProviderLoader = class _ProviderLoader {
31895
31912
  this.log(`Loaded ${externalCount} external providers (legacy unnamed source)`);
31896
31913
  }
31897
31914
  } else {
31898
- const {
31899
- loadProvidersActive: loadProvidersActive2,
31900
- resolveActiveSource: resolveActiveSource2
31901
- } = (init_external_sources(), __toCommonJS(external_sources_exports));
31902
- const activeFile = loadProvidersActive2();
31915
+ const activeFile = loadProvidersActive();
31903
31916
  let totalLoaded = 0;
31904
31917
  const ambiguousTypes = [];
31905
31918
  for (const sourceEntry of rootEntries) {
@@ -31914,7 +31927,7 @@ var ProviderLoader = class _ProviderLoader {
31914
31927
  for (const [type] of this.providers) {
31915
31928
  const prov = this.providers.get(type);
31916
31929
  if (!prov) continue;
31917
- const resolved = resolveActiveSource2(prov.category, type, activeFile);
31930
+ const resolved = resolveActiveSource(prov.category, type, activeFile);
31918
31931
  if (resolved.candidates.length <= 1) continue;
31919
31932
  if (resolved.ambiguous) {
31920
31933
  ambiguousTypes.push({ type, chosen: resolved.source ?? "?", candidates: resolved.candidates });