@dudousxd/nestjs-agent 0.4.0 → 0.5.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.
package/dist/index.js CHANGED
@@ -1590,6 +1590,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
1590
1590
  code,
1591
1591
  message
1592
1592
  });
1593
+ await this.store.recordRunEnd?.({
1594
+ runId,
1595
+ status: "failed",
1596
+ errorCode: code,
1597
+ errorMessage: message
1598
+ });
1593
1599
  await this.store.setActiveStream(input.threadId, null);
1594
1600
  const writer = await deps.sink.open(runId);
1595
1601
  await writer.fail({
@@ -1849,11 +1855,18 @@ function routerFor(path) {
1849
1855
  ]);
1850
1856
  }
1851
1857
  __name(routerFor, "routerFor");
1858
+ function assertDispatchedStepsRequiresDurable(dispatchedSteps, durable) {
1859
+ if (dispatchedSteps && !durable) {
1860
+ throw new Error("AgentModule dispatchedSteps: true requires durable: true \u2014 dispatched steps are routed durable steps (AgentRunSteps.llm/tool) with no in-process equivalent.");
1861
+ }
1862
+ }
1863
+ __name(assertDispatchedStepsRequiresDurable, "assertDispatchedStepsRequiresDurable");
1852
1864
  var AgentModule = class _AgentModule {
1853
1865
  static {
1854
1866
  __name(this, "AgentModule");
1855
1867
  }
1856
1868
  static forRoot(options) {
1869
+ assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
1857
1870
  const path = options.path ?? DEFAULT_PATH;
1858
1871
  const includeStore = options.store !== void 0;
1859
1872
  applyGuards(options.guards);
@@ -1877,6 +1890,7 @@ var AgentModule = class _AgentModule {
1877
1890
  };
1878
1891
  }
1879
1892
  static forRootAsync(options) {
1893
+ assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
1880
1894
  const path = options.path ?? DEFAULT_PATH;
1881
1895
  const includeStore = options.externalStore !== true;
1882
1896
  applyGuards(options.guards);