@adhdev/daemon-standalone 0.9.82-rc.271 → 0.9.82-rc.273

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/public/index.html CHANGED
@@ -7,9 +7,9 @@
7
7
  <meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
8
8
  <link rel="icon" href="/otter-logo.png" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-C5JKUf-W.js"></script>
10
+ <script type="module" crossorigin src="/assets/index--LjGeSoY.js"></script>
11
11
  <link rel="modulepreload" crossorigin href="/assets/vendor-BHUMCOj6.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-CbR_x7-3.css">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-CRoMHXE0.css">
13
13
  </head>
14
14
  <body>
15
15
  <!-- Apply theme immediately to prevent FOIT (Flash of Incorrect Theme) -->
@@ -985,14 +985,9 @@ async function reconcileDirectDispatchesFromTranscriptEvidence(ctx, liveNodes, d
985
985
  }
986
986
  return { attempted, reconciled, skipped };
987
987
  }
988
- async function triggerMeshQueueAndReport(ctx, node, opts) {
988
+ async function triggerMeshQueueAndReport(ctx) {
989
989
  try {
990
- let raw;
991
- if (ctx.transport instanceof IpcTransport && node?.daemonId && opts?.localNode === false) {
992
- raw = await ctx.transport.meshCommand(node.daemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id });
993
- } else {
994
- raw = await ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id });
995
- }
990
+ const raw = await ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id });
996
991
  const payload = unwrapCommandPayload(raw);
997
992
  const trigger = payload?.trigger && typeof payload.trigger === "object" ? payload.trigger : payload;
998
993
  return trigger && typeof trigger === "object" ? trigger : { success: true };
@@ -1049,15 +1044,18 @@ function hasRemoteRelayMetadata(session) {
1049
1044
  readString(session?.settings?.meshCoordinatorDaemonId) || readString(session?.meta?.meshCoordinatorDaemonId) || readString(session?.metadata?.meshCoordinatorDaemonId) || readString(session?.meshCoordinatorDaemonId)
1050
1045
  );
1051
1046
  }
1052
- function isRelaySafeRemoteDelegateSession(session, meshId, nodeId) {
1053
- return isMeshOwnedDelegateSession(session, meshId, nodeId) && hasRemoteRelayMetadata(session);
1047
+ function classifyRemoteDelegateRelaySafety(session, meshId, nodeId, coordinatorDaemonId) {
1048
+ if (!isMeshOwnedDelegateSession(session, meshId, nodeId)) return "unsafe_alias";
1049
+ if (hasRemoteRelayMetadata(session)) return "safe";
1050
+ return coordinatorDaemonId ? "self_heal" : "missing_anchor";
1054
1051
  }
1055
- function chooseDispatchableSession(sessions, providerType, meshId, nodeId) {
1052
+ function chooseDispatchableSession(sessions, providerType, meshId, nodeId, coordinatorDaemonId) {
1056
1053
  const live = sessions.filter((session) => !isTerminalSessionRecord(session));
1057
1054
  const matchingProvider = (session) => !providerType || session?.providerType === providerType || session?.cliType === providerType;
1058
- const meshSessions = live.filter(
1059
- (session) => isRelaySafeRemoteDelegateSession(session, meshId, nodeId)
1060
- );
1055
+ const meshSessions = live.filter((session) => {
1056
+ const safety = classifyRemoteDelegateRelaySafety(session, meshId, nodeId, coordinatorDaemonId);
1057
+ return safety === "safe" || safety === "self_heal";
1058
+ });
1061
1059
  return meshSessions.find((session) => isIdleSessionRecord(session) && matchingProvider(session)) || meshSessions.find(matchingProvider) || void 0;
1062
1060
  }
1063
1061
  function buildRelayUnsafeRemoteSessionFailure(ctx, node, sessionId, providerType) {
@@ -1397,12 +1395,14 @@ function buildCoordinatorP2pRelayFailure(error, context) {
1397
1395
  async function ipcDispatchToRemoteAgent(ctx, node, args) {
1398
1396
  const transport = ctx.transport;
1399
1397
  const daemonId = node.daemonId;
1398
+ const dispatchCoordinatorDaemonId = readString(args.meshContext?.coordinatorDaemonId) || "";
1400
1399
  let sessionId = args.session_id?.trim() || "";
1401
1400
  const providerPriorityList = Array.isArray(node.policy?.providerPriority) ? node.policy.providerPriority : [];
1402
1401
  let resolvedProviderType = args.providerType?.trim() || providerPriorityList[0] || "";
1403
1402
  if (sessionId && args.verifiedSession) {
1404
1403
  const explicitSession = args.verifiedSession;
1405
- if (!isRelaySafeRemoteDelegateSession(explicitSession, ctx.mesh.id, node.id)) {
1404
+ const relaySafety = classifyRemoteDelegateRelaySafety(explicitSession, ctx.mesh.id, node.id, dispatchCoordinatorDaemonId);
1405
+ if (relaySafety === "unsafe_alias") {
1406
1406
  return buildRelayUnsafeRemoteSessionFailure(
1407
1407
  ctx,
1408
1408
  node,
@@ -1410,6 +1410,13 @@ async function ipcDispatchToRemoteAgent(ctx, node, args) {
1410
1410
  resolvedProviderType || resolveSessionProviderType(explicitSession) || void 0
1411
1411
  );
1412
1412
  }
1413
+ if (relaySafety === "missing_anchor") {
1414
+ return buildMissingCoordinatorDaemonIdFailure(
1415
+ ctx,
1416
+ node,
1417
+ resolvedProviderType || resolveSessionProviderType(explicitSession) || void 0
1418
+ );
1419
+ }
1413
1420
  if (!resolvedProviderType) {
1414
1421
  resolvedProviderType = resolveSessionProviderType(explicitSession);
1415
1422
  }
@@ -1437,7 +1444,8 @@ async function ipcDispatchToRemoteAgent(ctx, node, args) {
1437
1444
  nextAction: `Launch a fresh session with mesh_launch_session(node_id: '${node.id}'${resolvedProviderType ? `, type: '${resolvedProviderType}'` : ""}) or retry without session_id so Repo Mesh can target a live delegate session.`
1438
1445
  };
1439
1446
  }
1440
- if (!isRelaySafeRemoteDelegateSession(explicitSession, ctx.mesh.id, node.id)) {
1447
+ const relaySafety = classifyRemoteDelegateRelaySafety(explicitSession, ctx.mesh.id, node.id, dispatchCoordinatorDaemonId);
1448
+ if (relaySafety === "unsafe_alias") {
1441
1449
  return buildRelayUnsafeRemoteSessionFailure(
1442
1450
  ctx,
1443
1451
  node,
@@ -1445,11 +1453,18 @@ async function ipcDispatchToRemoteAgent(ctx, node, args) {
1445
1453
  resolvedProviderType || resolveSessionProviderType(explicitSession) || void 0
1446
1454
  );
1447
1455
  }
1456
+ if (relaySafety === "missing_anchor") {
1457
+ return buildMissingCoordinatorDaemonIdFailure(
1458
+ ctx,
1459
+ node,
1460
+ resolvedProviderType || resolveSessionProviderType(explicitSession) || void 0
1461
+ );
1462
+ }
1448
1463
  if (!resolvedProviderType) {
1449
1464
  resolvedProviderType = resolveSessionProviderType(explicitSession);
1450
1465
  }
1451
1466
  } else {
1452
- const targetSession = chooseDispatchableSession(sessions, resolvedProviderType, ctx.mesh.id, node.id);
1467
+ const targetSession = chooseDispatchableSession(sessions, resolvedProviderType, ctx.mesh.id, node.id, dispatchCoordinatorDaemonId);
1453
1468
  if (targetSession?.id || targetSession?.sessionId) {
1454
1469
  sessionId = targetSession.id || targetSession.sessionId;
1455
1470
  if (!resolvedProviderType) {
@@ -3984,7 +3999,7 @@ async function meshLaunchSession(ctx, args) {
3984
3999
  });
3985
4000
  } catch {
3986
4001
  }
3987
- const queueTrigger = await triggerMeshQueueAndReport(ctx, node, { localNode: isLocalNode });
4002
+ const queueTrigger = await triggerMeshQueueAndReport(ctx);
3988
4003
  return JSON.stringify({
3989
4004
  ...launchPayload,
3990
4005
  resolvedProviderType,