@dudousxd/nestjs-agent-core 0.23.0 → 0.24.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,4 +1,4 @@
1
- import { A as Actor, I as InputProcessor, O as OutputProcessor, T as ToolHandler } from '../tool-BdW-LV1J.cjs';
1
+ import { A as Actor, I as InputProcessor, O as OutputProcessor, T as ToolHandler } from '../tool-fLRLs_f3.cjs';
2
2
  import '@standard-schema/spec';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { A as Actor, I as InputProcessor, O as OutputProcessor, T as ToolHandler } from '../tool-BdW-LV1J.js';
1
+ import { A as Actor, I as InputProcessor, O as OutputProcessor, T as ToolHandler } from '../tool-fLRLs_f3.js';
2
2
  import '@standard-schema/spec';
3
3
 
4
4
  /**
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ __export(src_exports, {
32
32
  AGENT_GOVERNANCE_QUERIES: () => AGENT_GOVERNANCE_QUERIES,
33
33
  AGENT_MEMORY: () => AGENT_MEMORY,
34
34
  AGENT_MODEL: () => AGENT_MODEL,
35
+ AGENT_MODEL_CATALOG: () => AGENT_MODEL_CATALOG,
35
36
  AGENT_OPTIONS: () => AGENT_OPTIONS,
36
37
  AGENT_PRICING_STORE: () => AGENT_PRICING_STORE,
37
38
  AGENT_PROMPT_CONTRIBUTORS: () => AGENT_PROMPT_CONTRIBUTORS,
@@ -113,6 +114,7 @@ __export(src_exports, {
113
114
  filterToolsByCanUse: () => filterToolsByCanUse,
114
115
  filterToolsByEnabled: () => filterToolsByEnabled,
115
116
  filterToolsByRole: () => filterToolsByRole,
117
+ findCatalogModel: () => findCatalogModel,
116
118
  gateFollowUps: () => gateFollowUps,
117
119
  gateTail: () => gateTail,
118
120
  invokeWithTransientRetry: () => invokeWithTransientRetry,
@@ -169,6 +171,7 @@ __export(src_exports, {
169
171
  skillToolDefinition: () => skillToolDefinition,
170
172
  skillWriteVerdict: () => skillWriteVerdict,
171
173
  stampToolKinds: () => stampToolKinds,
174
+ staticModelCatalog: () => staticModelCatalog,
172
175
  staticSkillProvider: () => staticSkillProvider,
173
176
  summarizeWithModel: () => summarizeWithModel,
174
177
  tenantScope: () => tenantScope,
@@ -183,6 +186,7 @@ __export(src_exports, {
183
186
  windowHistory: () => windowHistory,
184
187
  withAskTool: () => withAskTool,
185
188
  withMemoryTool: () => withMemoryTool,
189
+ withSelectedModel: () => withSelectedModel,
186
190
  withSkillTool: () => withSkillTool,
187
191
  withToolTimeout: () => withToolTimeout,
188
192
  withTurnFrames: () => withTurnFrames,
@@ -204,6 +208,7 @@ var AGENT_TOOL_REGISTRY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:too
204
208
  var AGENT_REGISTRY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:agent-registry");
205
209
  var AGENT_ACTOR_RESOLVER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:actor-resolver");
206
210
  var AGENT_GOVERNANCE_QUERIES = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:governance-queries");
211
+ var AGENT_MODEL_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:model-catalog");
207
212
  var AGENT_PRICING_STORE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:pricing-store");
208
213
  var AGENT_RETRIEVER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:retriever");
209
214
  var AGENT_EMBEDDING_PROVIDER = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:embedding-provider");
@@ -216,6 +221,31 @@ var AGENT_SKILLS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skills");
216
221
  var AGENT_MEMORY = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:memory");
217
222
  var AGENT_SKILL_SOURCES = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skill-sources");
218
223
 
224
+ // src/spi/model-catalog.ts
225
+ function staticModelCatalog(view) {
226
+ return {
227
+ list: /* @__PURE__ */ __name(() => view, "list")
228
+ };
229
+ }
230
+ __name(staticModelCatalog, "staticModelCatalog");
231
+ function findCatalogModel(view, id) {
232
+ for (const group of view.providers) {
233
+ const found = group.models.find((model) => model.id === id);
234
+ if (found !== void 0) return found;
235
+ }
236
+ return void 0;
237
+ }
238
+ __name(findCatalogModel, "findCatalogModel");
239
+ function withSelectedModel(provider, model) {
240
+ return {
241
+ runTurn: /* @__PURE__ */ __name((args) => provider.runTurn({
242
+ ...args,
243
+ model
244
+ }), "runTurn")
245
+ };
246
+ }
247
+ __name(withSelectedModel, "withSelectedModel");
248
+
219
249
  // src/spi/token-stream-sink.ts
220
250
  var AgentStreamError = class extends Error {
221
251
  static {
@@ -4112,7 +4142,12 @@ async function invokeClaimedToolsTogether(turn, parallel, claimed) {
4112
4142
  return results;
4113
4143
  }
4114
4144
  __name(invokeClaimedToolsTogether, "invokeClaimedToolsTogether");
4115
- async function runAgentLoop(deps, input, hooks) {
4145
+ async function runAgentLoop(boundDeps, input, hooks) {
4146
+ const deps = input.model === void 0 ? boundDeps : {
4147
+ ...boundDeps,
4148
+ model: withSelectedModel(boundDeps.model, input.model),
4149
+ modelId: input.model
4150
+ };
4116
4151
  const maxSteps = deps.maxSteps ?? 8;
4117
4152
  let system = await resolveSystemPrompt(deps, input);
4118
4153
  const inputProcessors = deps.inputProcessors ?? [];
@@ -4309,6 +4344,9 @@ ${block}`;
4309
4344
  actor: input.actor,
4310
4345
  ...gated ? {
4311
4346
  bufferOutput: true
4347
+ } : {},
4348
+ ...input.model !== void 0 ? {
4349
+ model: input.model
4312
4350
  } : {}
4313
4351
  });
4314
4352
  } else {
@@ -4728,6 +4766,7 @@ __name(runAgentLoop, "runAgentLoop");
4728
4766
  AGENT_GOVERNANCE_QUERIES,
4729
4767
  AGENT_MEMORY,
4730
4768
  AGENT_MODEL,
4769
+ AGENT_MODEL_CATALOG,
4731
4770
  AGENT_OPTIONS,
4732
4771
  AGENT_PRICING_STORE,
4733
4772
  AGENT_PROMPT_CONTRIBUTORS,
@@ -4809,6 +4848,7 @@ __name(runAgentLoop, "runAgentLoop");
4809
4848
  filterToolsByCanUse,
4810
4849
  filterToolsByEnabled,
4811
4850
  filterToolsByRole,
4851
+ findCatalogModel,
4812
4852
  gateFollowUps,
4813
4853
  gateTail,
4814
4854
  invokeWithTransientRetry,
@@ -4865,6 +4905,7 @@ __name(runAgentLoop, "runAgentLoop");
4865
4905
  skillToolDefinition,
4866
4906
  skillWriteVerdict,
4867
4907
  stampToolKinds,
4908
+ staticModelCatalog,
4868
4909
  staticSkillProvider,
4869
4910
  summarizeWithModel,
4870
4911
  tenantScope,
@@ -4879,6 +4920,7 @@ __name(runAgentLoop, "runAgentLoop");
4879
4920
  windowHistory,
4880
4921
  withAskTool,
4881
4922
  withMemoryTool,
4923
+ withSelectedModel,
4882
4924
  withSkillTool,
4883
4925
  withToolTimeout,
4884
4926
  withTurnFrames,