@cognipeer/agent-sdk 0.6.3 → 0.6.4

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
@@ -2239,6 +2239,7 @@ function normalizeSmartAgentOptions(opts) {
2239
2239
  const summarizationOverride = typeof opts.summarization === "object" ? opts.summarization : {};
2240
2240
  const planningMode = opts.planning?.mode ?? customProfile.planning?.mode ?? (useTodoList ? "todo" : preset.planning.mode);
2241
2241
  const memoryStore = opts.memory?.store ?? customProfile.memory?.store;
2242
+ const contextToolResponsePolicy = opts.context?.toolResponsePolicy ?? customProfile.context?.toolResponsePolicy ?? preset.context.toolResponsePolicy;
2242
2243
  return {
2243
2244
  runtimeProfile,
2244
2245
  baseProfile,
@@ -2261,7 +2262,7 @@ function normalizeSmartAgentOptions(opts) {
2261
2262
  ...customProfile.context?.budget || {},
2262
2263
  ...opts.context?.budget || {}
2263
2264
  },
2264
- toolResponsePolicy: opts.context?.toolResponsePolicy ?? customProfile.context?.toolResponsePolicy ?? preset.context.toolResponsePolicy
2265
+ toolResponsePolicy: contextToolResponsePolicy
2265
2266
  },
2266
2267
  planning: {
2267
2268
  ...preset.planning,
@@ -2284,6 +2285,7 @@ function normalizeSmartAgentOptions(opts) {
2284
2285
  ...preset.toolResponses,
2285
2286
  ...customProfile.toolResponses || {},
2286
2287
  ...opts.toolResponses || {},
2288
+ defaultPolicy: opts.toolResponses?.defaultPolicy ?? customProfile.toolResponses?.defaultPolicy ?? contextToolResponsePolicy,
2287
2289
  toolResponseRetentionByTool: {
2288
2290
  ...preset.toolResponses.toolResponseRetentionByTool,
2289
2291
  ...customProfile.toolResponses?.toolResponseRetentionByTool || {},
@@ -6129,7 +6131,7 @@ var OpenAIProvider = class extends BaseProvider {
6129
6131
  if (request.tools?.length) {
6130
6132
  body.tools = request.tools.map((t) => this.toOpenAITool(t));
6131
6133
  }
6132
- if (request.toolChoice != null) {
6134
+ if (request.toolChoice != null && request.tools?.length) {
6133
6135
  if (typeof request.toolChoice === "string") {
6134
6136
  body.tool_choice = request.toolChoice;
6135
6137
  } else {
@@ -7410,7 +7412,7 @@ function fromNativeProvider(provider, options) {
7410
7412
  const reasoningCfg = reasoningOverride ?? opts?.reasoning;
7411
7413
  if (reasoningCfg) req.reasoning = reasoningCfg;
7412
7414
  const tc = invokeOptions?.tool_choice ?? invokeOptions?.toolChoice;
7413
- if (tc) {
7415
+ if (tc && tools?.length) {
7414
7416
  req.toolChoice = tc;
7415
7417
  }
7416
7418
  const rf = invokeOptions?.response_format;