@adhdev/daemon-standalone 0.9.82-rc.386 → 0.9.82-rc.388

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.82-rc.386",
3
+ "version": "0.9.82-rc.388",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -4218,33 +4218,6 @@ async function meshSendTask(ctx, args) {
4218
4218
  const taskId = (0, import_node_crypto.randomUUID)();
4219
4219
  const dispatchedAt = (/* @__PURE__ */ new Date()).toISOString();
4220
4220
  const coordinatorDaemonId = resolveCoordinatorDaemonId(ctx);
4221
- const dispatchResult = await commandForNode(ctx, node, "agent_command", {
4222
- targetSessionId: args.session_id,
4223
- agentType: resolvedProviderType,
4224
- cliType: resolvedProviderType,
4225
- providerType: resolvedProviderType,
4226
- action: "send_chat",
4227
- message: args.message,
4228
- meshContext: {
4229
- meshId: ctx.mesh.id,
4230
- nodeId: args.node_id,
4231
- taskId,
4232
- ...coordinatorDaemonId ? { coordinatorDaemonId } : {},
4233
- // (3) Originating coordinator session anchor — see the remote-dispatch path above.
4234
- ...ctx.coordinatorSessionId ? { coordinatorSessionId: ctx.coordinatorSessionId } : {}
4235
- }
4236
- });
4237
- const dispatchPayload = unwrapCommandPayload(dispatchResult);
4238
- if (dispatchPayload?.success === false || dispatchResult?.success === false) {
4239
- const source = dispatchPayload?.success === false ? dispatchPayload : dispatchResult;
4240
- return JSON.stringify({
4241
- ...source && typeof source === "object" ? source : {},
4242
- success: false,
4243
- nodeId: args.node_id,
4244
- sessionId: args.session_id,
4245
- error: dispatchPayload?.error || dispatchResult?.error || "agent_command rejected the task"
4246
- });
4247
- }
4248
4221
  try {
4249
4222
  (0, import_daemon_core3.appendLedgerEntry)(ctx.mesh.id, {
4250
4223
  kind: "task_dispatched",
@@ -4272,6 +4245,37 @@ async function meshSendTask(ctx, args) {
4272
4245
  dispatchedToIdleSession: sessionWasIdle,
4273
4246
  dispatchedAt
4274
4247
  });
4248
+ const dispatchResult = await commandForNode(ctx, node, "agent_command", {
4249
+ targetSessionId: args.session_id,
4250
+ agentType: resolvedProviderType,
4251
+ cliType: resolvedProviderType,
4252
+ providerType: resolvedProviderType,
4253
+ action: "send_chat",
4254
+ message: args.message,
4255
+ meshContext: {
4256
+ meshId: ctx.mesh.id,
4257
+ nodeId: args.node_id,
4258
+ taskId,
4259
+ ...coordinatorDaemonId ? { coordinatorDaemonId } : {},
4260
+ // (3) Originating coordinator session anchor — see the remote-dispatch path above.
4261
+ ...ctx.coordinatorSessionId ? { coordinatorSessionId: ctx.coordinatorSessionId } : {}
4262
+ }
4263
+ });
4264
+ const dispatchPayload = unwrapCommandPayload(dispatchResult);
4265
+ if (dispatchPayload?.success === false || dispatchResult?.success === false) {
4266
+ try {
4267
+ (0, import_daemon_core3.deleteDirectDispatchesByTaskId)(ctx.mesh.id, [taskId]);
4268
+ } catch {
4269
+ }
4270
+ const source = dispatchPayload?.success === false ? dispatchPayload : dispatchResult;
4271
+ return JSON.stringify({
4272
+ ...source && typeof source === "object" ? source : {},
4273
+ success: false,
4274
+ nodeId: args.node_id,
4275
+ sessionId: args.session_id,
4276
+ error: dispatchPayload?.error || dispatchResult?.error || "agent_command rejected the task"
4277
+ });
4278
+ }
4275
4279
  if (missionId) {
4276
4280
  try {
4277
4281
  (0, import_daemon_core3.recordDirectDispatchTask)(ctx.mesh.id, args.message, {