@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.cjs CHANGED
@@ -1640,6 +1640,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
1640
1640
  code,
1641
1641
  message
1642
1642
  });
1643
+ await this.store.recordRunEnd?.({
1644
+ runId,
1645
+ status: "failed",
1646
+ errorCode: code,
1647
+ errorMessage: message
1648
+ });
1643
1649
  await this.store.setActiveStream(input.threadId, null);
1644
1650
  const writer = await deps.sink.open(runId);
1645
1651
  await writer.fail({
@@ -1899,11 +1905,18 @@ function routerFor(path) {
1899
1905
  ]);
1900
1906
  }
1901
1907
  __name(routerFor, "routerFor");
1908
+ function assertDispatchedStepsRequiresDurable(dispatchedSteps, durable) {
1909
+ if (dispatchedSteps && !durable) {
1910
+ throw new Error("AgentModule dispatchedSteps: true requires durable: true \u2014 dispatched steps are routed durable steps (AgentRunSteps.llm/tool) with no in-process equivalent.");
1911
+ }
1912
+ }
1913
+ __name(assertDispatchedStepsRequiresDurable, "assertDispatchedStepsRequiresDurable");
1902
1914
  var AgentModule = class _AgentModule {
1903
1915
  static {
1904
1916
  __name(this, "AgentModule");
1905
1917
  }
1906
1918
  static forRoot(options) {
1919
+ assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
1907
1920
  const path = options.path ?? DEFAULT_PATH;
1908
1921
  const includeStore = options.store !== void 0;
1909
1922
  applyGuards(options.guards);
@@ -1927,6 +1940,7 @@ var AgentModule = class _AgentModule {
1927
1940
  };
1928
1941
  }
1929
1942
  static forRootAsync(options) {
1943
+ assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
1930
1944
  const path = options.path ?? DEFAULT_PATH;
1931
1945
  const includeStore = options.externalStore !== true;
1932
1946
  applyGuards(options.guards);