@tangle-network/agent-app 0.58.3 → 0.58.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.
@@ -1136,6 +1136,7 @@ import { createExecutor, streamAgentTurn } from "@tangle-network/agent-runtime/k
1136
1136
  import {
1137
1137
  runProtectedAgentCandidateModelGrant
1138
1138
  } from "@tangle-network/agent-runtime/candidate-execution";
1139
+ var PROTECTED_CHAT_PROVIDERS = /* @__PURE__ */ new Set(["anthropic", "openai"]);
1139
1140
  function createProtectedRuntimeChatProducer(options) {
1140
1141
  if (!Number.isSafeInteger(options.maxToolCalls) || options.maxToolCalls < 0) {
1141
1142
  throw new Error("maxToolCalls must be a non-negative integer");
@@ -1192,7 +1193,9 @@ function createProtectedRuntimeChatProducer(options) {
1192
1193
  reasoningTokens: settlement.calls.reduce((sum2, call) => sum2 + call.reasoningTokens, 0),
1193
1194
  costUsd: settlement.calls.reduce((sum2, call) => sum2 + call.costUsdNanos, 0) / 1e9
1194
1195
  };
1195
- budgetEnforced = settlement.usageWithinLimits;
1196
+ const unauthorizedReasoning = usage.reasoningTokens > 0 && options.grant.resolve.reasoningEffort === "none";
1197
+ budgetEnforced = settlement.usageWithinLimits && !unauthorizedReasoning;
1198
+ if (unauthorizedReasoning) throw new Error("Provider reported reasoning tokens although reasoning was disabled");
1196
1199
  if (!budgetEnforced) throw new Error("Provider settlement exceeded execution limits");
1197
1200
  if (auditError) throw auditError;
1198
1201
  return settlement;
@@ -1202,8 +1205,8 @@ function createProtectedRuntimeChatProducer(options) {
1202
1205
  signal.throwIfAborted();
1203
1206
  if (Date.now() >= options.grant.deadlineAtMs) throw new Error("Protected execution deadline expired");
1204
1207
  model = resolved.model;
1205
- if (resolved.provider !== "anthropic" || resolved.reasoningEffort !== "none") {
1206
- throw new Error("Protected chat currently requires Anthropic without reasoning");
1208
+ if (!PROTECTED_CHAT_PROVIDERS.has(resolved.provider) || resolved.reasoningEffort !== "none") {
1209
+ throw new Error("Protected chat currently requires an Anthropic or OpenAI model without reasoning");
1207
1210
  }
1208
1211
  toolTokens = 0;
1209
1212
  const apiKey = activation.env.OPENAI_API_KEY;