@dudousxd/nestjs-agent 0.6.0 → 0.7.0

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.
@@ -188,8 +188,11 @@ var AgentRunWorkflow = class _AgentRunWorkflow {
188
188
  openSink: /* @__PURE__ */ __name(async () => input.sinkRunId !== void 0 ? childSinkWriter(await deps.sink.open(sinkRunId)) : deps.sink.open(ctx.runId), "openSink"),
189
189
  awaitApproval: /* @__PURE__ */ __name((call) => ctx.waitForSignal(`tool:${ctx.runId}:${call.id}`), "awaitApproval"),
190
190
  step: /* @__PURE__ */ __name((name, fn) => ctx.localStep(name, fn), "step"),
191
- // Dispatched-step suspends must escape the loop's tool catch — control flow, not a tool failure.
192
- isControlFlowError: /* @__PURE__ */ __name((error) => error instanceof import_nestjs_durable_core.WorkflowSuspended || error instanceof import_nestjs_durable_core.ContinueAsNew, "isControlFlowError"),
191
+ // Dispatched-step suspends must escape the loop's tool catch — control flow, not a tool
192
+ // failure. Marker-based predicate, NOT instanceof: the signal's CLASS differs by runtime
193
+ // (engine in-process throws durable-core's WorkflowSuspended/ContinueAsNew; the BullMQ thin
194
+ // worker throws durable-worker's own Suspend), so only the Symbol.for marker is reliable.
195
+ isControlFlowError: /* @__PURE__ */ __name((error) => (0, import_nestjs_durable_core.isWorkflowControlFlowSignal)(error), "isControlFlowError"),
193
196
  runAgent: /* @__PURE__ */ __name(async (agentName, task) => {
194
197
  const subThreadId = await ctx.localStep(`subthread:${agentName}`, async () => {
195
198
  const thread = await this.store.createThread({
@@ -230,7 +233,7 @@ var AgentRunWorkflow = class _AgentRunWorkflow {
230
233
  await ctx.localStep("deactivate", () => this.store.setActiveStream(input.threadId, null));
231
234
  return result;
232
235
  } catch (error) {
233
- if (error instanceof import_nestjs_durable_core.WorkflowSuspended || error instanceof import_nestjs_durable_core.ContinueAsNew) {
236
+ if ((0, import_nestjs_durable_core.isWorkflowControlFlowSignal)(error)) {
234
237
  throw error;
235
238
  }
236
239
  const message = error instanceof Error ? error.message : String(error);
@@ -307,7 +310,7 @@ var DurableAgentRunner = class {
307
310
  try {
308
311
  await this.workflows.start(AgentRunWorkflow, stamped, runId);
309
312
  } catch (error) {
310
- if (!(error instanceof import_nestjs_durable_core2.WorkflowSuspended)) {
313
+ if (!(0, import_nestjs_durable_core2.isWorkflowControlFlowSignal)(error)) {
311
314
  throw error;
312
315
  }
313
316
  }