@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.js CHANGED
@@ -3699,6 +3699,20 @@ function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
3699
3699
  }
3700
3700
  return false;
3701
3701
  }
3702
+ function hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId) {
3703
+ const entries = readLedgerEntries(meshId, { tail: 200 });
3704
+ for (let i = entries.length - 1; i >= 0; i--) {
3705
+ const entry = entries[i];
3706
+ if (entry.sessionId !== sessionId) continue;
3707
+ if (entry.kind === "task_completed" || entry.kind === "task_failed" || entry.kind === "task_stalled") {
3708
+ return false;
3709
+ }
3710
+ if (entry.kind === "task_dispatched" && entry.payload?.source === "direct") {
3711
+ return true;
3712
+ }
3713
+ }
3714
+ return false;
3715
+ }
3702
3716
  function buildLongGeneratingCompletionReconciliation(args) {
3703
3717
  const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
3704
3718
  const nodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
@@ -4566,7 +4580,7 @@ function setupMeshEventForwarding(components) {
4566
4580
  if (coordinatorMeshId) {
4567
4581
  try {
4568
4582
  const activeDispatches = getActiveDirectDispatches(coordinatorMeshId);
4569
- if (activeDispatches.some((d) => d.sessionId === instanceId)) {
4583
+ if (activeDispatches.some((d) => d.sessionId === instanceId) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, instanceId)) {
4570
4584
  meshIdFromDirectDispatch = coordinatorMeshId;
4571
4585
  }
4572
4586
  } catch {
@@ -6402,12 +6416,14 @@ function scopeLines(spec, lines, questionIndex) {
6402
6416
  function extractButtons(spec, lines, windowStart, windowEnd) {
6403
6417
  const buttonRe = compile3(spec.buttonPattern, spec.buttonFlags ?? "m");
6404
6418
  const out = [];
6419
+ const labelGroup = Number.isInteger(spec.buttonLabelGroup) && (spec.buttonLabelGroup ?? 0) > 0 ? spec.buttonLabelGroup : 1;
6405
6420
  let i = windowStart;
6406
6421
  while (i < windowEnd) {
6407
6422
  const line = lines[i];
6408
6423
  const m = buttonRe.exec(line);
6409
- if (m && m[1]) {
6410
- let label = m[1].trim();
6424
+ const captured = m?.[labelGroup] ?? (labelGroup === 1 && m && m.length > 2 ? m[m.length - 1] : void 0);
6425
+ if (m && captured) {
6426
+ let label = captured.trim();
6411
6427
  if (spec.continuationLines) {
6412
6428
  let j = i + 1;
6413
6429
  while (j < windowEnd) {
@@ -28397,7 +28413,7 @@ var CliProviderInstance = class {
28397
28413
  };
28398
28414
  }
28399
28415
  getSessionModalState(sessionId) {
28400
- const adapterStatus = this.adapter.getStatus({ allowParse: false });
28416
+ const adapterStatus = this.adapter.getStatus({ allowParse: true });
28401
28417
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
28402
28418
  const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
28403
28419
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
@@ -31930,6 +31946,7 @@ function validateControl(control, errors) {
31930
31946
  }
31931
31947
 
31932
31948
  // src/providers/provider-loader.ts
31949
+ init_external_sources();
31933
31950
  function registerProviderScriptRootSafely(root) {
31934
31951
  if (!root || typeof root !== "string") return;
31935
31952
  try {
@@ -32187,11 +32204,7 @@ var ProviderLoader = class _ProviderLoader {
32187
32204
  this.log(`Loaded ${externalCount} external providers (legacy unnamed source)`);
32188
32205
  }
32189
32206
  } else {
32190
- const {
32191
- loadProvidersActive: loadProvidersActive2,
32192
- resolveActiveSource: resolveActiveSource2
32193
- } = (init_external_sources(), __toCommonJS(external_sources_exports));
32194
- const activeFile = loadProvidersActive2();
32207
+ const activeFile = loadProvidersActive();
32195
32208
  let totalLoaded = 0;
32196
32209
  const ambiguousTypes = [];
32197
32210
  for (const sourceEntry of rootEntries) {
@@ -32206,7 +32219,7 @@ var ProviderLoader = class _ProviderLoader {
32206
32219
  for (const [type] of this.providers) {
32207
32220
  const prov = this.providers.get(type);
32208
32221
  if (!prov) continue;
32209
- const resolved = resolveActiveSource2(prov.category, type, activeFile);
32222
+ const resolved = resolveActiveSource(prov.category, type, activeFile);
32210
32223
  if (resolved.candidates.length <= 1) continue;
32211
32224
  if (resolved.ambiguous) {
32212
32225
  ambiguousTypes.push({ type, chosen: resolved.source ?? "?", candidates: resolved.candidates });