@adhdev/daemon-standalone 0.9.77-rc.34 → 0.9.77-rc.35

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
@@ -32699,12 +32699,14 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32699
32699
  return "";
32700
32700
  }
32701
32701
  function injectMeshSystemMessage(components, args) {
32702
+ let completedTaskForLedger = null;
32702
32703
  if (args.event === "agent:generating_completed") {
32703
32704
  const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
32704
32705
  const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32705
32706
  const providerType = readNonEmptyString(args.metadataEvent.providerType);
32706
32707
  if (sessionId) {
32707
- updateSessionTaskStatus(args.meshId, sessionId, "completed");
32708
+ const completedTask = updateSessionTaskStatus(args.meshId, sessionId, "completed");
32709
+ completedTaskForLedger = completedTask ? { id: completedTask.id } : null;
32708
32710
  if (nodeId && providerType) {
32709
32711
  setTimeout(() => {
32710
32712
  tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
@@ -32717,6 +32719,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32717
32719
  const providerType = readNonEmptyString(args.metadataEvent.providerType);
32718
32720
  const completedTask = sessionId ? updateSessionTaskStatus(args.meshId, sessionId, "completed") : null;
32719
32721
  if (completedTask) {
32722
+ completedTaskForLedger = { id: completedTask.id };
32720
32723
  try {
32721
32724
  appendLedgerEntry(args.meshId, {
32722
32725
  kind: "task_completed",
@@ -32728,7 +32731,8 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32728
32731
  nodeLabel: args.nodeLabel,
32729
32732
  taskId: completedTask.id,
32730
32733
  completedViaReady: true,
32731
- providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0
32734
+ providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
32735
+ finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
32732
32736
  }
32733
32737
  });
32734
32738
  } catch (e) {
@@ -32771,7 +32775,9 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32771
32775
  payload: {
32772
32776
  event: args.event,
32773
32777
  nodeLabel: args.nodeLabel,
32774
- providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0
32778
+ taskId: completedTaskForLedger?.id || void 0,
32779
+ providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
32780
+ finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
32775
32781
  }
32776
32782
  });
32777
32783
  } catch (e) {
@@ -32886,7 +32892,8 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32886
32892
  metadataEvent: {
32887
32893
  targetSessionId: readNonEmptyString(payload.targetSessionId) || readNonEmptyString(payload.sessionId) || readNonEmptyString(payload.instanceId),
32888
32894
  providerType: readNonEmptyString(payload.providerType),
32889
- providerSessionId: readNonEmptyString(payload.providerSessionId)
32895
+ providerSessionId: readNonEmptyString(payload.providerSessionId),
32896
+ finalSummary: readNonEmptyString(payload.finalSummary) || readNonEmptyString(payload.summary)
32890
32897
  }
32891
32898
  });
32892
32899
  }
@@ -35110,6 +35117,11 @@ ${lastSnapshot}`;
35110
35117
  };
35111
35118
  }
35112
35119
  // ─── Script Execution ──────────────────────────
35120
+ invokeCliScript(script, input) {
35121
+ const hasStateFactory = typeof this.cliScripts?.createState === "function";
35122
+ const expectsStateArgument = hasStateFactory || this.scriptState !== null || script.length >= 2;
35123
+ return expectsStateArgument ? script(this.scriptState, input) : script(input);
35124
+ }
35113
35125
  runParseSession() {
35114
35126
  if (typeof this.cliScripts?.parseSession !== "function") {
35115
35127
  this.parseErrorMessage = `${this.cliType} parseSession unavailable`;
@@ -35130,7 +35142,10 @@ ${lastSnapshot}`;
35130
35142
  scope: this.currentTurnScope,
35131
35143
  runtimeSettings: this.runtimeSettings
35132
35144
  });
35133
- const session = this.cliScripts.parseSession(this.scriptState, { ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
35145
+ const session = this.invokeCliScript(
35146
+ this.cliScripts.parseSession,
35147
+ { ...input, tail, tailScreen: buildCliScreenSnapshot(tail) }
35148
+ );
35134
35149
  this.parseErrorMessage = null;
35135
35150
  return session && typeof session === "object" ? session : null;
35136
35151
  } catch (e) {
@@ -35144,7 +35159,7 @@ ${lastSnapshot}`;
35144
35159
  if (!this.cliScripts?.detectStatus) return null;
35145
35160
  try {
35146
35161
  const screenText = this.terminalScreen.getText();
35147
- const status = this.cliScripts.detectStatus(this.scriptState, {
35162
+ const status = this.invokeCliScript(this.cliScripts.detectStatus, {
35148
35163
  tail: text.slice(-500),
35149
35164
  screenText,
35150
35165
  rawBuffer: this.accumulatedRawBuffer,
@@ -35163,7 +35178,7 @@ ${lastSnapshot}`;
35163
35178
  try {
35164
35179
  const screenText = this.terminalScreen.getText();
35165
35180
  const buffer = screenText || this.accumulatedBuffer;
35166
- return this.cliScripts.parseApproval(this.scriptState, {
35181
+ return this.invokeCliScript(this.cliScripts.parseApproval, {
35167
35182
  buffer,
35168
35183
  screenText,
35169
35184
  rawBuffer: this.accumulatedRawBuffer,
@@ -55189,7 +55204,13 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
55189
55204
  appendLedgerEntry2(meshId, {
55190
55205
  kind: "node_removed",
55191
55206
  nodeId,
55192
- payload: { worktree: !!node?.isLocalWorktree, sessionCleanupMode }
55207
+ payload: {
55208
+ worktree: !!node?.isLocalWorktree,
55209
+ sessionCleanupMode,
55210
+ workspace: typeof node?.workspace === "string" ? node.workspace : void 0,
55211
+ daemonId: typeof node?.daemonId === "string" ? node.daemonId : void 0,
55212
+ worktreeBranch: typeof node?.worktreeBranch === "string" ? node.worktreeBranch : void 0
55213
+ }
55193
55214
  });
55194
55215
  } catch {
55195
55216
  }