@adhdev/daemon-core 0.9.82-rc.365 → 0.9.82-rc.366

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.
@@ -59,6 +59,14 @@ export interface MeshQueueTriggerResult {
59
59
  status?: string;
60
60
  }>;
61
61
  autoLaunchStarted: boolean;
62
+ /**
63
+ * True when a worker session is already on its way to claim a still-pending task —
64
+ * either launched this tick (autoLaunchStarted) or launched on a prior tick and still
65
+ * booting/awaiting-claim. Callers MUST treat this as "wait, do not launch another
66
+ * session": a second launch double-edits the worktree. Mutually informative with
67
+ * `noIdleMeshSessionAvailable`, which is suppressed whenever this is true.
68
+ */
69
+ autoLaunchPending?: boolean;
62
70
  noIdleMeshSessionAvailable?: boolean;
63
71
  }
64
72
  export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<MeshQueueTriggerResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.365",
3
+ "version": "0.9.82-rc.366",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "author": "vilmire",
47
47
  "license": "AGPL-3.0-or-later",
48
48
  "dependencies": {
49
- "@adhdev/mesh-shared": "0.9.82-rc.365",
49
+ "@adhdev/mesh-shared": "0.9.82-rc.366",
50
50
  "@adhdev/session-host-core": "*",
51
51
  "@agentclientprotocol/sdk": "^0.16.1",
52
52
  "ajv": "^8.20.0",
@@ -19,7 +19,7 @@ import { loadState, saveState } from '../config/state-store.js';
19
19
  import { getWorkspaceState, resolveLaunchDirectory } from '../config/workspaces.js';
20
20
  import { appendRecentActivity } from '../config/recent-activity.js';
21
21
  import { shortHash } from '../system/hash.js';
22
- import { unregisterMeshCoordinator, getCoordinatorForSession } from '../mesh/coordinator-registry.js';
22
+ import { unregisterMeshCoordinator, getCoordinatorForSession, listCoordinatorsForWorkspace } from '../mesh/coordinator-registry.js';
23
23
  import { upsertSavedProviderSession } from '../config/saved-sessions.js';
24
24
  import { buildLegacyModelModeSummaryMetadata, normalizeProviderSummaryMetadata } from '../providers/summary-metadata.js';
25
25
  import { CliProviderInstance } from '../providers/cli-provider-instance.js';
@@ -1069,7 +1069,33 @@ export class DaemonCliManager {
1069
1069
  // Both restores are provider-agnostic — getSettings is keyed by provider type and the
1070
1070
  // registry mark is type-independent.
1071
1071
  const restoredSettings: Record<string, any> = { ...this.providerLoader.getSettings(normalizedType) };
1072
- const coordinatorEntry = getCoordinatorForSession(record.runtimeId);
1072
+ // Primary rebind: exact persisted-registry match by runtimeId (stable across
1073
+ // restart, see session-host runtimeId = runtimeRecord.sessionId).
1074
+ let coordinatorEntry = getCoordinatorForSession(record.runtimeId);
1075
+ // CORDBADGE fallback: the by-id match misses when a coordinator's runtime
1076
+ // re-attaches under a different runtimeId than the one it was registered with
1077
+ // (the registry survived, but its key no longer lines up). Without a rebind the
1078
+ // restored session silently loses meshCoordinatorFor → the coordinator badge and
1079
+ // selfIdentification block vanish and pending mesh events stop draining into its
1080
+ // PTY, and the only recovery is a manual coordinator restart. Recover the mark
1081
+ // from the persisted registry scoped to this exact workspace, but ONLY when it is
1082
+ // UNAMBIGUOUS: exactly one registered coordinator for this workspace AND its
1083
+ // cliType matches the restored session's type. The registry never holds worker
1084
+ // sessions (only launch_mesh_coordinator registrations), so this cannot mis-mark a
1085
+ // delegated worker; the uniqueness + cliType gate keeps it from guessing when two
1086
+ // coordinators ever shared a workspace. Anything ambiguous stays unbound (we would
1087
+ // rather miss a badge than mis-attribute one).
1088
+ if (!coordinatorEntry?.meshId && record.workspace) {
1089
+ const workspaceCoordinators = listCoordinatorsForWorkspace(record.workspace)
1090
+ .filter(e => e.meshId && (!e.cliType || e.cliType === record.cliType));
1091
+ if (workspaceCoordinators.length === 1) {
1092
+ coordinatorEntry = workspaceCoordinators[0];
1093
+ LOG.info(
1094
+ 'CLI',
1095
+ `↻ Rebound coordinator mark by workspace for ${record.runtimeKey || record.runtimeId} (mesh ${coordinatorEntry.meshId} @ ${record.workspace}); registry key did not match runtimeId`
1096
+ );
1097
+ }
1098
+ }
1073
1099
  if (coordinatorEntry?.meshId) {
1074
1100
  restoredSettings.meshCoordinatorFor = coordinatorEntry.meshId;
1075
1101
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * RF-ROUTER HIGH family — command registry.
3
+ *
4
+ * Aggregates the high-coupling command handlers extracted from
5
+ * DaemonCommandRouter.executeDaemonCommand into a single cmd → handler map. The
6
+ * router consults this registry after the LOW- and MED-family registries and
7
+ * before its remaining switch (registry hit → return the handler result; miss →
8
+ * fall through to the switch / CommandHandler delegation), so the facade and
9
+ * dispatch semantics are unchanged.
10
+ *
11
+ * HIGH handlers are the most router-coupled: beyond the MED collaborators they
12
+ * reach the router's aggregate-status memory cache and running-refine-job table.
13
+ * The router binds those onto HighFamilyContext at dispatch — see types.ts.
14
+ */
15
+ import { meshEventsHandlers } from './mesh-events.js';
16
+ import { meshCoordinatorLaunchHandlers } from './mesh-coordinator-launch.js';
17
+ import { meshStatusHandlers } from './mesh-status.js';
18
+ import type { HighFamilyRegistry } from './types.js';
19
+
20
+ export type { HighFamilyContext, HighFamilyHandler, HighFamilyRegistry } from './types.js';
21
+
22
+ export const highFamilyRegistry: HighFamilyRegistry = new Map(
23
+ Object.entries({
24
+ ...meshEventsHandlers,
25
+ ...meshCoordinatorLaunchHandlers,
26
+ ...meshStatusHandlers,
27
+ }),
28
+ );