@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.d.cts CHANGED
@@ -418,7 +418,7 @@ type SmartAgentToolResponseConfig = {
418
418
  /**
419
419
  * Retention policy applied to all non-critical tool responses by the summarizer
420
420
  * when it fires (context limit reached). Has no effect at execution time.
421
- * Defaults to "summarize_archive".
421
+ * Defaults to context.toolResponsePolicy, or the active runtime profile default.
422
422
  */
423
423
  defaultPolicy?: ToolResponseRetentionPolicy;
424
424
  /**
package/dist/index.d.ts CHANGED
@@ -418,7 +418,7 @@ type SmartAgentToolResponseConfig = {
418
418
  /**
419
419
  * Retention policy applied to all non-critical tool responses by the summarizer
420
420
  * when it fires (context limit reached). Has no effect at execution time.
421
- * Defaults to "summarize_archive".
421
+ * Defaults to context.toolResponsePolicy, or the active runtime profile default.
422
422
  */
423
423
  defaultPolicy?: ToolResponseRetentionPolicy;
424
424
  /**
package/dist/index.mjs CHANGED
@@ -2229,6 +2229,7 @@ function normalizeSmartAgentOptions(opts) {
2229
2229
  const summarizationOverride = typeof opts.summarization === "object" ? opts.summarization : {};
2230
2230
  const planningMode = opts.planning?.mode ?? customProfile.planning?.mode ?? (useTodoList ? "todo" : preset.planning.mode);
2231
2231
  const memoryStore = opts.memory?.store ?? customProfile.memory?.store;
2232
+ const contextToolResponsePolicy = opts.context?.toolResponsePolicy ?? customProfile.context?.toolResponsePolicy ?? preset.context.toolResponsePolicy;
2232
2233
  return {
2233
2234
  runtimeProfile,
2234
2235
  baseProfile,
@@ -2251,7 +2252,7 @@ function normalizeSmartAgentOptions(opts) {
2251
2252
  ...customProfile.context?.budget || {},
2252
2253
  ...opts.context?.budget || {}
2253
2254
  },
2254
- toolResponsePolicy: opts.context?.toolResponsePolicy ?? customProfile.context?.toolResponsePolicy ?? preset.context.toolResponsePolicy
2255
+ toolResponsePolicy: contextToolResponsePolicy
2255
2256
  },
2256
2257
  planning: {
2257
2258
  ...preset.planning,
@@ -2274,6 +2275,7 @@ function normalizeSmartAgentOptions(opts) {
2274
2275
  ...preset.toolResponses,
2275
2276
  ...customProfile.toolResponses || {},
2276
2277
  ...opts.toolResponses || {},
2278
+ defaultPolicy: opts.toolResponses?.defaultPolicy ?? customProfile.toolResponses?.defaultPolicy ?? contextToolResponsePolicy,
2277
2279
  toolResponseRetentionByTool: {
2278
2280
  ...preset.toolResponses.toolResponseRetentionByTool,
2279
2281
  ...customProfile.toolResponses?.toolResponseRetentionByTool || {},
@@ -6119,7 +6121,7 @@ var OpenAIProvider = class extends BaseProvider {
6119
6121
  if (request.tools?.length) {
6120
6122
  body.tools = request.tools.map((t) => this.toOpenAITool(t));
6121
6123
  }
6122
- if (request.toolChoice != null) {
6124
+ if (request.toolChoice != null && request.tools?.length) {
6123
6125
  if (typeof request.toolChoice === "string") {
6124
6126
  body.tool_choice = request.toolChoice;
6125
6127
  } else {
@@ -7400,7 +7402,7 @@ function fromNativeProvider(provider, options) {
7400
7402
  const reasoningCfg = reasoningOverride ?? opts?.reasoning;
7401
7403
  if (reasoningCfg) req.reasoning = reasoningCfg;
7402
7404
  const tc = invokeOptions?.tool_choice ?? invokeOptions?.toolChoice;
7403
- if (tc) {
7405
+ if (tc && tools?.length) {
7404
7406
  req.toolChoice = tc;
7405
7407
  }
7406
7408
  const rf = invokeOptions?.response_format;