@tangle-network/agent-app 0.58.2 → 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.
- package/dist/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +6 -3
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-E2HFIKIZ.js → chunk-OHRL6TO3.js} +11 -2
- package/dist/chunk-OHRL6TO3.js.map +1 -0
- package/dist/web-react/agent-profile-editor.d.ts +9 -1
- package/dist/web-react/index.js +1 -1
- package/package.json +15 -15
- package/dist/chunk-E2HFIKIZ.js.map +0 -1
package/dist/assistant/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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;
|