@dudousxd/nestjs-agent 0.12.0 → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
2
2
  import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
3
- import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-EROMcBNh.cjs';
3
+ import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-y2hvoQ6U.cjs';
4
4
  import { WorkflowService } from '@dudousxd/nestjs-durable';
5
5
  import { DynamicModule } from '@nestjs/common';
6
6
  import '@standard-schema/spec';
@@ -10,10 +10,10 @@ import '@standard-schema/spec';
10
10
  * in-process primitive, NOT the always-dispatched `ctx.step`: their names are dynamic checkpoint
11
11
  * identities (`persist:toolcall:<id>`), not routable worker groups, and their deps (store, sink)
12
12
  * live in THIS workflow worker's DI. The two LONG steps (model call, tool execution) are dispatched
13
- * through `AgentRunSteps` by default (`AGENT_DISPATCHED_STEPS`, ON under `durable: true`) so the
14
- * run isn't pinned to this pod while they execute; `dispatchedSteps: false` keeps them localSteps
15
- * too. HITL is `ctx.waitForSignal`, and sub-agent delegation is `ctx.child(AgentRunWorkflow)` — a
16
- * replay-safe, observable child run (it shows up as a node in the durable dashboard). A child
13
+ * through `AgentRunSteps` where the deployment asked for it (`AGENT_DISPATCHED_STEPS`, from
14
+ * `dispatchedSteps: true`) so the run isn't pinned to this pod while they execute; without that
15
+ * flag they are localSteps too. HITL is `ctx.waitForSignal`, and sub-agent delegation is
16
+ * `ctx.child(AgentRunWorkflow)` — a replay-safe, observable child run (it shows up as a node in the durable dashboard). A child
17
17
  * streams into its top-level ancestor's sink (`sinkRunId`) so the human watching the parent sees it
18
18
  * and can approve its action tools; the approval routes to the child's own run via `runForToolCall`.
19
19
  */
@@ -86,8 +86,8 @@ interface DispatchedToolInput extends ToolStepEnvelope {
86
86
  }
87
87
  /**
88
88
  * The two long steps `AgentRunWorkflow` dispatches as routed remote steps (`AgentRunSteps.llm` /
89
- * `AgentRunSteps.tool`) — the default under `durable: true`; `dispatchedSteps: false` runs them
90
- * in-process under `ctx.localStep` instead. Both re-resolve their deps from THIS worker's own DI via
89
+ * `AgentRunSteps.tool`) under `dispatchedSteps: true`; omitting that flag runs them in-process
90
+ * under `ctx.localStep` instead. Both re-resolve their deps from THIS worker's own DI via
91
91
  * `AGENT_DEPS_FACTORY.forAgent` — a step can be served by any worker in the fleet, not just the one
92
92
  * that started the run. Always provided by `AgentDurableModule` regardless of `dispatchedSteps`, so
93
93
  * the worker group is never orphaned.
@@ -220,10 +220,10 @@ declare function agentDurable(options: AgentModuleOptions): DynamicModule[];
220
220
  /**
221
221
  * DI flag carrying the EFFECTIVE `dispatchedSteps` value: whether `AgentRunWorkflow` dispatches its
222
222
  * `llm`/`tool` steps as routed remote steps (`AgentRunSteps`) instead of in-process `ctx.localStep`s.
223
- * `AgentDurableModule` derives it from `AGENT_OPTIONS` (`durable === true && dispatchedSteps !==
224
- * false` — default ON under durable); `AgentRunWorkflow` injects it. Kept in its own file —
225
- * `AgentDurableModule` provides `AgentRunWorkflow` and `AgentRunWorkflow` injects this token, so
226
- * declaring it in either of those two files would make them import each other.
223
+ * `AgentDurableModule` derives it from `AGENT_OPTIONS` (`durable === true && dispatchedSteps ===
224
+ * true`); `AgentRunWorkflow` injects it. Kept in its own file — `AgentDurableModule` provides
225
+ * `AgentRunWorkflow` and `AgentRunWorkflow` injects this token, so declaring it in either of those
226
+ * two files would make them import each other.
227
227
  */
228
228
  declare const AGENT_DISPATCHED_STEPS: unique symbol;
229
229
 
@@ -1,6 +1,6 @@
1
1
  import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
2
2
  import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
3
- import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-EROMcBNh.js';
3
+ import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-y2hvoQ6U.js';
4
4
  import { WorkflowService } from '@dudousxd/nestjs-durable';
5
5
  import { DynamicModule } from '@nestjs/common';
6
6
  import '@standard-schema/spec';
@@ -10,10 +10,10 @@ import '@standard-schema/spec';
10
10
  * in-process primitive, NOT the always-dispatched `ctx.step`: their names are dynamic checkpoint
11
11
  * identities (`persist:toolcall:<id>`), not routable worker groups, and their deps (store, sink)
12
12
  * live in THIS workflow worker's DI. The two LONG steps (model call, tool execution) are dispatched
13
- * through `AgentRunSteps` by default (`AGENT_DISPATCHED_STEPS`, ON under `durable: true`) so the
14
- * run isn't pinned to this pod while they execute; `dispatchedSteps: false` keeps them localSteps
15
- * too. HITL is `ctx.waitForSignal`, and sub-agent delegation is `ctx.child(AgentRunWorkflow)` — a
16
- * replay-safe, observable child run (it shows up as a node in the durable dashboard). A child
13
+ * through `AgentRunSteps` where the deployment asked for it (`AGENT_DISPATCHED_STEPS`, from
14
+ * `dispatchedSteps: true`) so the run isn't pinned to this pod while they execute; without that
15
+ * flag they are localSteps too. HITL is `ctx.waitForSignal`, and sub-agent delegation is
16
+ * `ctx.child(AgentRunWorkflow)` — a replay-safe, observable child run (it shows up as a node in the durable dashboard). A child
17
17
  * streams into its top-level ancestor's sink (`sinkRunId`) so the human watching the parent sees it
18
18
  * and can approve its action tools; the approval routes to the child's own run via `runForToolCall`.
19
19
  */
@@ -86,8 +86,8 @@ interface DispatchedToolInput extends ToolStepEnvelope {
86
86
  }
87
87
  /**
88
88
  * The two long steps `AgentRunWorkflow` dispatches as routed remote steps (`AgentRunSteps.llm` /
89
- * `AgentRunSteps.tool`) — the default under `durable: true`; `dispatchedSteps: false` runs them
90
- * in-process under `ctx.localStep` instead. Both re-resolve their deps from THIS worker's own DI via
89
+ * `AgentRunSteps.tool`) under `dispatchedSteps: true`; omitting that flag runs them in-process
90
+ * under `ctx.localStep` instead. Both re-resolve their deps from THIS worker's own DI via
91
91
  * `AGENT_DEPS_FACTORY.forAgent` — a step can be served by any worker in the fleet, not just the one
92
92
  * that started the run. Always provided by `AgentDurableModule` regardless of `dispatchedSteps`, so
93
93
  * the worker group is never orphaned.
@@ -220,10 +220,10 @@ declare function agentDurable(options: AgentModuleOptions): DynamicModule[];
220
220
  /**
221
221
  * DI flag carrying the EFFECTIVE `dispatchedSteps` value: whether `AgentRunWorkflow` dispatches its
222
222
  * `llm`/`tool` steps as routed remote steps (`AgentRunSteps`) instead of in-process `ctx.localStep`s.
223
- * `AgentDurableModule` derives it from `AGENT_OPTIONS` (`durable === true && dispatchedSteps !==
224
- * false` — default ON under durable); `AgentRunWorkflow` injects it. Kept in its own file —
225
- * `AgentDurableModule` provides `AgentRunWorkflow` and `AgentRunWorkflow` injects this token, so
226
- * declaring it in either of those two files would make them import each other.
223
+ * `AgentDurableModule` derives it from `AGENT_OPTIONS` (`durable === true && dispatchedSteps ===
224
+ * true`); `AgentRunWorkflow` injects it. Kept in its own file — `AgentDurableModule` provides
225
+ * `AgentRunWorkflow` and `AgentRunWorkflow` injects this token, so declaring it in either of those
226
+ * two files would make them import each other.
227
227
  */
228
228
  declare const AGENT_DISPATCHED_STEPS: unique symbol;
229
229
 
@@ -633,9 +633,9 @@ function runnerProviders() {
633
633
  {
634
634
  provide: AGENT_DISPATCHED_STEPS,
635
635
  useFactory: /* @__PURE__ */ __name((options, sink) => {
636
- const enabled = options.durable === true && options.dispatchedSteps !== false;
636
+ const enabled = options.durable === true && options.dispatchedSteps === true;
637
637
  if (enabled && sink instanceof InProcessTokenStreamSink) {
638
- logger.warn("Dispatched steps are active (the default under durable: true) with the default InProcessTokenStreamSink, which only buffers tokens in-process. A dispatched `llm` step served by a different worker cannot stream into this buffer. Wire a cross-process TokenStreamSink (e.g. a Redis pub/sub sink) via AgentModule.forRoot({ sink }) before running multi-pod, or set dispatchedSteps: false to keep the turn in-process localSteps.");
638
+ logger.warn("dispatchedSteps: true with the default InProcessTokenStreamSink, which only buffers tokens in-process. A dispatched `llm` step served by a different worker cannot stream into this buffer. Wire a cross-process TokenStreamSink (e.g. a Redis pub/sub sink) via AgentModule.forRoot({ sink }) before running multi-pod, or drop dispatchedSteps to keep the turn in-process localSteps.");
639
639
  }
640
640
  return enabled;
641
641
  }, "useFactory"),