@adhdev/daemon-standalone 0.9.76-rc.27 → 0.9.76-rc.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-standalone",
3
- "version": "0.9.76-rc.27",
3
+ "version": "0.9.76-rc.29",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -46043,9 +46043,11 @@ ${effect.notification.body || ""}`.trim();
46043
46043
  }
46044
46044
  const sessionLookupFailed = !!targetSessionId && !session;
46045
46045
  const managerKey = this.extractIdeType(args, sessionLookupFailed);
46046
- let providerType;
46046
+ let providerType = args?.agentType || args?.providerType;
46047
46047
  if (!sessionLookupFailed) {
46048
- providerType = session?.providerType || args?.agentType || args?.providerType || this.inferProviderType(managerKey);
46048
+ providerType = session?.providerType || providerType || this.inferProviderType(managerKey);
46049
+ } else if (!providerType) {
46050
+ providerType = this.inferProviderType(managerKey);
46049
46051
  }
46050
46052
  return { session, managerKey, providerType, sessionLookupFailed };
46051
46053
  }
@@ -46125,7 +46127,8 @@ ${effect.notification.body || ""}`.trim();
46125
46127
  "pty_resize",
46126
46128
  "invoke_provider_script"
46127
46129
  ]);
46128
- if (this._currentRoute.sessionLookupFailed && sessionScopedCommands.has(cmd)) {
46130
+ const allowsInactiveReadChatFallback = cmd === "read_chat" && !!this._currentRoute.providerType && (typeof args?.providerSessionId === "string" && args.providerSessionId.trim().length > 0 || typeof args?.historySessionId === "string" && args.historySessionId.trim().length > 0);
46131
+ if (this._currentRoute.sessionLookupFailed && sessionScopedCommands.has(cmd) && !allowsInactiveReadChatFallback) {
46129
46132
  const result2 = {
46130
46133
  success: false,
46131
46134
  error: `Live session not found for targetSessionId: ${String(args?.targetSessionId || "").trim() || "unknown"}`
@@ -56572,7 +56575,16 @@ async function findNodeWithRefresh(ctx, nodeId) {
56572
56575
  return refreshed;
56573
56576
  }
56574
56577
  function unwrapCommandPayload(value) {
56575
- return value?.result?.result ?? value?.result ?? value;
56578
+ let current = value;
56579
+ const seen = /* @__PURE__ */ new Set();
56580
+ for (let depth = 0; depth < 8; depth += 1) {
56581
+ if (!current || typeof current !== "object" || seen.has(current)) break;
56582
+ seen.add(current);
56583
+ const nested = current.result ?? current.payload;
56584
+ if (!nested || typeof nested !== "object") break;
56585
+ current = nested;
56586
+ }
56587
+ return current;
56576
56588
  }
56577
56589
  function findNestedPayload(value, predicate) {
56578
56590
  const seen = /* @__PURE__ */ new Set();
@@ -56822,11 +56834,20 @@ async function meshSendTask(ctx, args) {
56822
56834
  return JSON.stringify({ error: `Node '${args.node_id}' is read-only` });
56823
56835
  }
56824
56836
  if (isLocalTransport(ctx.transport)) {
56825
- await commandForNode(ctx, node, "send_chat", {
56837
+ const result = await commandForNode(ctx, node, "send_chat", {
56826
56838
  message: args.message,
56827
56839
  sessionId: args.session_id,
56828
56840
  targetSessionId: args.session_id
56829
56841
  });
56842
+ const payload = unwrapCommandPayload(result);
56843
+ if (payload?.success === false) {
56844
+ return JSON.stringify({
56845
+ success: false,
56846
+ nodeId: args.node_id,
56847
+ sessionId: args.session_id,
56848
+ error: payload.error || "send_chat failed"
56849
+ });
56850
+ }
56830
56851
  return JSON.stringify({ success: true, nodeId: args.node_id, sessionId: args.session_id });
56831
56852
  } else {
56832
56853
  return JSON.stringify({ error: "Cloud mesh send_task not yet implemented" });
@@ -56840,11 +56861,13 @@ async function meshReadChat(ctx, args) {
56840
56861
  const result = await commandForNode(ctx, node, "read_chat", {
56841
56862
  sessionId: args.session_id,
56842
56863
  targetSessionId: args.session_id,
56864
+ workspace: node.workspace,
56843
56865
  ...cached2?.providerType ? { agentType: cached2.providerType, providerType: cached2.providerType } : {},
56844
56866
  ...providerSessionId ? { providerSessionId } : {},
56845
56867
  tailLimit: args.tail ?? 10
56846
56868
  });
56847
- return JSON.stringify(result, null, 2);
56869
+ const payload = unwrapCommandPayload(result);
56870
+ return JSON.stringify(payload, null, 2);
56848
56871
  } else {
56849
56872
  return JSON.stringify({ error: "Cloud mesh read_chat not yet implemented" });
56850
56873
  }
@@ -56857,7 +56880,7 @@ async function meshLaunchSession(ctx, args) {
56857
56880
  const rawProviderPriority = node.policy?.providerPriority;
56858
56881
  const providerPriority = Array.isArray(rawProviderPriority) ? rawProviderPriority.map((type2) => typeof type2 === "string" ? type2.trim() : "").filter(Boolean) : [];
56859
56882
  if (!providerPriority.length) {
56860
- return JSON.stringify({ error: `Node '${args.node_id}' has no providerPriority policy; pass type explicitly or configure node.policy.providerPriority` });
56883
+ return JSON.stringify({ success: false, error: `Node '${args.node_id}' has no providerPriority policy; pass type explicitly or configure node.policy.providerPriority` });
56861
56884
  }
56862
56885
  const failed = [];
56863
56886
  for (const providerType of providerPriority) {
@@ -56870,7 +56893,7 @@ async function meshLaunchSession(ctx, args) {
56870
56893
  failed.push(`${providerType}: ${detectedPayload?.error || "not detected"}`);
56871
56894
  }
56872
56895
  if (!resolvedProviderType) {
56873
- return JSON.stringify({ error: `No usable provider detected for node '${args.node_id}' from providerPriority: ${failed.join("; ")}` });
56896
+ return JSON.stringify({ success: false, error: `No usable provider detected for node '${args.node_id}' from providerPriority: ${failed.join("; ")}` });
56874
56897
  }
56875
56898
  }
56876
56899
  const result = await commandForNode(ctx, node, "launch_cli", {