titan-agent 5.3.2 → 5.4.1
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/agent/agent.js +11 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/agentLoop.js +36 -1
- package/dist/agent/agentLoop.js.map +1 -1
- package/dist/agent/session.js +106 -5
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/subAgent.js +62 -1
- package/dist/agent/subAgent.js.map +1 -1
- package/dist/config/config.js +30 -8
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.js +25 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/gateway/server.js +32 -1
- package/dist/gateway/server.js.map +1 -1
- package/dist/memory/graph.js +49 -15
- package/dist/memory/graph.js.map +1 -1
- package/dist/memory/index.js +192 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/memory.js +1 -0
- package/dist/memory/memory.js.map +1 -1
- package/dist/mesh/transport.js +60 -8
- package/dist/mesh/transport.js.map +1 -1
- package/dist/providers/anthropic.js +3 -2
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/base.js.map +1 -1
- package/dist/providers/google.js +94 -20
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/modelCapabilities.js +59 -0
- package/dist/providers/modelCapabilities.js.map +1 -0
- package/dist/providers/ollama.js +3 -2
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.js +4 -3
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openai_compat.js +3 -2
- package/dist/providers/openai_compat.js.map +1 -1
- package/dist/providers/router.js +63 -21
- package/dist/providers/router.js.map +1 -1
- package/dist/safety/fabricationGuard.js +140 -0
- package/dist/safety/fabricationGuard.js.map +1 -0
- package/dist/skills/builtin/gepa.js +23 -1
- package/dist/skills/builtin/gepa.js.map +1 -1
- package/dist/skills/builtin/model_trainer.js +31 -4
- package/dist/skills/builtin/model_trainer.js.map +1 -1
- package/dist/skills/builtin/self_improve.js +50 -2
- package/dist/skills/builtin/self_improve.js.map +1 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
package/dist/agent/agentLoop.js
CHANGED
|
@@ -26,6 +26,7 @@ async function chatWithTimeout(fn, label, timeoutMs = 3e5) {
|
|
|
26
26
|
import { buildSmartContext } from "./contextManager.js";
|
|
27
27
|
import { isKilled } from "../safety/killSwitch.js";
|
|
28
28
|
import { estimateTokens } from "../utils/tokens.js";
|
|
29
|
+
import { DEFAULT_MAX_TOKENS } from "../utils/constants.js";
|
|
29
30
|
import { getCachedResponse, setCachedResponse } from "./responseCache.js";
|
|
30
31
|
import { shouldReflect, reflect, resetProgress, recordProgress, setProgressSession } from "./reflection.js";
|
|
31
32
|
import { recordToolResult, classifyTaskType, recordToolPreference, getErrorResolution, recordErrorResolution } from "../memory/learning.js";
|
|
@@ -442,7 +443,7 @@ async function runAgentLoop(ctx) {
|
|
|
442
443
|
let budgetWarningSent = false;
|
|
443
444
|
let pendingToolCalls = [];
|
|
444
445
|
let pendingAssistantContent = "";
|
|
445
|
-
const tokenBudget = ctx.voiceFastPath ? 2e3 : ctx.config.agent.tokenBudget ||
|
|
446
|
+
const tokenBudget = ctx.voiceFastPath ? 2e3 : ctx.config.agent.tokenBudget || DEFAULT_MAX_TOKENS;
|
|
446
447
|
globalSteerQueues.set(ctx.sessionId, ctx.steerQueue ?? []);
|
|
447
448
|
const traceCtx = newTraceContext();
|
|
448
449
|
initOtel();
|
|
@@ -663,6 +664,23 @@ Try a COMPLETELY DIFFERENT strategy. Do NOT repeat the same tools or approach.`
|
|
|
663
664
|
ctx.streamCallbacks.onToolCall?.(chunk.toolCall.function.name, JSON.parse(chunk.toolCall.function.arguments || "{}"));
|
|
664
665
|
} else if (chunk.type === "error") {
|
|
665
666
|
logger.error(COMPONENT, `Stream error: ${chunk.error}`);
|
|
667
|
+
} else if (chunk.type === "retry") {
|
|
668
|
+
logger.warn(COMPONENT, `Stream retrying ${chunk.provider}/${chunk.model} (attempt ${chunk.attempt}/${chunk.maxRetries}, reason=${chunk.reason}, delay=${chunk.delayMs}ms)`);
|
|
669
|
+
ctx.streamCallbacks.onRetry?.({
|
|
670
|
+
attempt: chunk.attempt,
|
|
671
|
+
maxRetries: chunk.maxRetries,
|
|
672
|
+
reason: chunk.reason,
|
|
673
|
+
provider: chunk.provider,
|
|
674
|
+
model: chunk.model,
|
|
675
|
+
delayMs: chunk.delayMs
|
|
676
|
+
});
|
|
677
|
+
} else if (chunk.type === "failover") {
|
|
678
|
+
logger.warn(COMPONENT, `Stream failover from ${chunk.originalProvider}/${chunk.originalModel}${chunk.error ? ` (${chunk.error})` : ""}`);
|
|
679
|
+
ctx.streamCallbacks.onFailover?.({
|
|
680
|
+
originalProvider: chunk.originalProvider,
|
|
681
|
+
originalModel: chunk.originalModel,
|
|
682
|
+
error: chunk.error
|
|
683
|
+
});
|
|
666
684
|
}
|
|
667
685
|
}
|
|
668
686
|
const estCompletionTokens = estimateTokens(streamContent + JSON.stringify(streamToolCalls));
|
|
@@ -1423,6 +1441,23 @@ Examples: use read_file instead of cat/head/tail/grep, and edit_file instead of
|
|
|
1423
1441
|
ctx.streamCallbacks.onToken(chunk.content);
|
|
1424
1442
|
} else if (chunk.type === "error") {
|
|
1425
1443
|
logger.error(COMPONENT, `Stream error: ${chunk.error}`);
|
|
1444
|
+
} else if (chunk.type === "retry") {
|
|
1445
|
+
logger.warn(COMPONENT, `Respond-phase stream retrying ${chunk.provider}/${chunk.model} (attempt ${chunk.attempt}/${chunk.maxRetries}, reason=${chunk.reason})`);
|
|
1446
|
+
ctx.streamCallbacks.onRetry?.({
|
|
1447
|
+
attempt: chunk.attempt,
|
|
1448
|
+
maxRetries: chunk.maxRetries,
|
|
1449
|
+
reason: chunk.reason,
|
|
1450
|
+
provider: chunk.provider,
|
|
1451
|
+
model: chunk.model,
|
|
1452
|
+
delayMs: chunk.delayMs
|
|
1453
|
+
});
|
|
1454
|
+
} else if (chunk.type === "failover") {
|
|
1455
|
+
logger.warn(COMPONENT, `Respond-phase stream failover from ${chunk.originalProvider}/${chunk.originalModel}`);
|
|
1456
|
+
ctx.streamCallbacks.onFailover?.({
|
|
1457
|
+
originalProvider: chunk.originalProvider,
|
|
1458
|
+
originalModel: chunk.originalModel,
|
|
1459
|
+
error: chunk.error
|
|
1460
|
+
});
|
|
1426
1461
|
}
|
|
1427
1462
|
}
|
|
1428
1463
|
response = {
|