titan-agent 5.5.26 → 5.5.27
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 +45 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/personaRollout.js +252 -0
- package/dist/agent/personaRollout.js.map +1 -0
- package/dist/config/schema.js +36 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/gateway/server.js +109 -0
- package/dist/gateway/server.js.map +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
package/dist/agent/agent.js
CHANGED
|
@@ -1075,7 +1075,27 @@ CRITICAL: Widgets are NOT files. Do NOT use write_file, edit_file, or any file t
|
|
|
1075
1075
|
} catch {
|
|
1076
1076
|
}
|
|
1077
1077
|
const { resolveActivePersona: __resolvePersona } = await import("./personaProfiles.js");
|
|
1078
|
-
|
|
1078
|
+
let earlyPersona = __resolvePersona({ channel });
|
|
1079
|
+
let __cohortAssignment = null;
|
|
1080
|
+
if (earlyPersona) {
|
|
1081
|
+
try {
|
|
1082
|
+
const { pickCohortAssignment } = await import("./personaRollout.js");
|
|
1083
|
+
const assignment = pickCohortAssignment(earlyPersona.id, { sessionId: session.id, channel });
|
|
1084
|
+
if (assignment) {
|
|
1085
|
+
__cohortAssignment = { cohortId: assignment.cohortId, role: assignment.role };
|
|
1086
|
+
if (assignment.role === "candidate" && assignment.personaId !== earlyPersona.id) {
|
|
1087
|
+
const { resolveActivePersona } = await import("./personaProfiles.js");
|
|
1088
|
+
const candidate = resolveActivePersona({ forceId: assignment.personaId });
|
|
1089
|
+
if (candidate) {
|
|
1090
|
+
logger.info(COMPONENT, `[Cohort:${assignment.cohortId}] swap ${earlyPersona.id} \u2192 ${candidate.id}`);
|
|
1091
|
+
earlyPersona = candidate;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
} catch (err) {
|
|
1096
|
+
logger.warn(COMPONENT, `cohort assignment skipped: ${err.message}`);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1079
1099
|
if (earlyPersona?.systemPromptAppendix) {
|
|
1080
1100
|
enrichedSystemPrompt += earlyPersona.systemPromptAppendix;
|
|
1081
1101
|
logger.info(COMPONENT, `[Persona:${earlyPersona.id}] system prompt appendix injected`);
|
|
@@ -1332,6 +1352,30 @@ Synthesize these results into a coherent response for the user.`
|
|
|
1332
1352
|
recordUsage(session.id, providerName, modelUsed, totalPromptTokens, totalCompletionTokens);
|
|
1333
1353
|
const durationMs = Date.now() - startTime;
|
|
1334
1354
|
logger.info(COMPONENT, `Response generated in ${durationMs}ms (${totalPromptTokens + totalCompletionTokens} tokens)`);
|
|
1355
|
+
if (__cohortAssignment) {
|
|
1356
|
+
void (async () => {
|
|
1357
|
+
try {
|
|
1358
|
+
const { recordOutcome } = await import("./personaRollout.js");
|
|
1359
|
+
let safetySat = null;
|
|
1360
|
+
try {
|
|
1361
|
+
const { loadDriveHistory } = await import("../organism/drives.js");
|
|
1362
|
+
const persisted = loadDriveHistory();
|
|
1363
|
+
const safety = persisted?.latest?.drives?.find((d) => d.id === "safety");
|
|
1364
|
+
safetySat = safety ? safety.satisfaction : null;
|
|
1365
|
+
} catch {
|
|
1366
|
+
}
|
|
1367
|
+
recordOutcome({
|
|
1368
|
+
cohortId: __cohortAssignment.cohortId,
|
|
1369
|
+
role: __cohortAssignment.role,
|
|
1370
|
+
sessionId: session.id,
|
|
1371
|
+
success: !budgetExhausted && finalContent.length > 0,
|
|
1372
|
+
latencyMs: durationMs,
|
|
1373
|
+
safetySat
|
|
1374
|
+
});
|
|
1375
|
+
} catch {
|
|
1376
|
+
}
|
|
1377
|
+
})();
|
|
1378
|
+
}
|
|
1335
1379
|
if (toolsUsed.length > 0) {
|
|
1336
1380
|
const uniqueTools = [...new Set(toolsUsed)];
|
|
1337
1381
|
learnFact(
|