@tangle-network/agent-runtime 0.98.0 → 0.99.0
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/{chunk-WUNFYMEV.js → chunk-6WSFXKQU.js} +2 -2
- package/dist/{chunk-3K2TXWF4.js → chunk-JSPW2Y3P.js} +124 -1
- package/dist/chunk-JSPW2Y3P.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/intelligence.d.ts +20 -1
- package/dist/intelligence.js +7 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3K2TXWF4.js.map +0 -1
- /package/dist/{chunk-WUNFYMEV.js.map → chunk-6WSFXKQU.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-BLQIYRVR.js";
|
|
8
8
|
import {
|
|
9
9
|
createAgentImprovementActivationResult
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JSPW2Y3P.js";
|
|
11
11
|
import {
|
|
12
12
|
canonicalCandidateBytes,
|
|
13
13
|
embeddedCandidateArtifact,
|
|
@@ -471,4 +471,4 @@ export {
|
|
|
471
471
|
runKnowledgeImprovementJob,
|
|
472
472
|
buildKnowledgeImprovementExperimentBundles
|
|
473
473
|
};
|
|
474
|
-
//# sourceMappingURL=chunk-
|
|
474
|
+
//# sourceMappingURL=chunk-6WSFXKQU.js.map
|
|
@@ -1340,6 +1340,11 @@ async function improve(profile, findings, opts) {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
|
|
1342
1342
|
// src/intelligence/improvement-surfaces.ts
|
|
1343
|
+
import {
|
|
1344
|
+
agentProfileDiffSchema,
|
|
1345
|
+
agentProfileSchema as agentProfileSchema2,
|
|
1346
|
+
defineAgentProfileDiff
|
|
1347
|
+
} from "@tangle-network/agent-interface";
|
|
1343
1348
|
var changedSurfaceOrder = [
|
|
1344
1349
|
"prompt",
|
|
1345
1350
|
"skills",
|
|
@@ -1352,6 +1357,14 @@ var changedSurfaceOrder = [
|
|
|
1352
1357
|
"code",
|
|
1353
1358
|
"knowledge"
|
|
1354
1359
|
];
|
|
1360
|
+
var AGENT_IMPROVEMENT_PROFILE_SURFACES = [
|
|
1361
|
+
"prompt",
|
|
1362
|
+
"skills",
|
|
1363
|
+
"tools",
|
|
1364
|
+
"mcp",
|
|
1365
|
+
"hooks",
|
|
1366
|
+
"subagents"
|
|
1367
|
+
];
|
|
1355
1368
|
function deriveChangedSurfaces(baselineBundle, candidateBundle) {
|
|
1356
1369
|
if (baselineBundle.knowledge || candidateBundle.knowledge) {
|
|
1357
1370
|
assertKnowledgeCandidatePair(baselineBundle, candidateBundle);
|
|
@@ -1395,6 +1408,113 @@ function agentImprovementTargetDigest(experiment, arm, surface) {
|
|
|
1395
1408
|
function agentImprovementTargetInput(bundle, surface) {
|
|
1396
1409
|
return improvementSurfaceValues(bundle)[surface];
|
|
1397
1410
|
}
|
|
1411
|
+
function isAgentImprovementProfileSurface(surface) {
|
|
1412
|
+
return AGENT_IMPROVEMENT_PROFILE_SURFACES.includes(surface);
|
|
1413
|
+
}
|
|
1414
|
+
function agentImprovementTargetProfileDiffs(target, options) {
|
|
1415
|
+
const { remove, set } = improvementSurfaceReplacement(target);
|
|
1416
|
+
const common = {
|
|
1417
|
+
kind: "agent-profile-diff",
|
|
1418
|
+
...options.source ? { source: options.source } : {},
|
|
1419
|
+
metadata: {
|
|
1420
|
+
...options.metadata ?? {},
|
|
1421
|
+
surface: target.surface
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
const reset = agentProfileDiffSchema.parse(
|
|
1425
|
+
defineAgentProfileDiff({
|
|
1426
|
+
...common,
|
|
1427
|
+
id: `${options.id}:${target.surface}:reset`,
|
|
1428
|
+
title: `Replace active ${target.surface}`,
|
|
1429
|
+
remove
|
|
1430
|
+
})
|
|
1431
|
+
);
|
|
1432
|
+
if (!set) return [reset];
|
|
1433
|
+
const replacement = agentProfileDiffSchema.parse(
|
|
1434
|
+
defineAgentProfileDiff({
|
|
1435
|
+
...common,
|
|
1436
|
+
id: `${options.id}:${target.surface}:set`,
|
|
1437
|
+
title: `Activate measured ${target.surface}`,
|
|
1438
|
+
set
|
|
1439
|
+
})
|
|
1440
|
+
);
|
|
1441
|
+
return [reset, replacement];
|
|
1442
|
+
}
|
|
1443
|
+
function improvementSurfaceReplacement(target) {
|
|
1444
|
+
const value = target.desiredInput;
|
|
1445
|
+
switch (target.surface) {
|
|
1446
|
+
case "prompt": {
|
|
1447
|
+
const prompt = exactObject(value, ["prompt"], "prompt activation input").prompt;
|
|
1448
|
+
assertDefined(prompt, "prompt activation input.prompt");
|
|
1449
|
+
return {
|
|
1450
|
+
remove: { prompt: true },
|
|
1451
|
+
...prompt === null ? {} : { set: parseProfileSet({ prompt }) }
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
case "skills":
|
|
1455
|
+
assertDefined(value, "skills activation input");
|
|
1456
|
+
return {
|
|
1457
|
+
remove: { resources: { skills: true } },
|
|
1458
|
+
...value === null ? {} : { set: parseProfileSet({ resources: { skills: value } }) }
|
|
1459
|
+
};
|
|
1460
|
+
case "tools": {
|
|
1461
|
+
const parsed = exactObject(value, ["tools", "resources"], "tools activation input");
|
|
1462
|
+
assertDefined(parsed.tools, "tools activation input.tools");
|
|
1463
|
+
assertDefined(parsed.resources, "tools activation input.resources");
|
|
1464
|
+
const set = {
|
|
1465
|
+
...parsed.tools === null ? {} : { tools: parsed.tools },
|
|
1466
|
+
...parsed.resources === null ? {} : { resources: { tools: parsed.resources } }
|
|
1467
|
+
};
|
|
1468
|
+
return {
|
|
1469
|
+
remove: { tools: true, resources: { tools: true } },
|
|
1470
|
+
...Object.keys(set).length === 0 ? {} : { set: parseProfileSet(set) }
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
case "mcp":
|
|
1474
|
+
assertDefined(value, "mcp activation input");
|
|
1475
|
+
return {
|
|
1476
|
+
remove: { mcp: true },
|
|
1477
|
+
...value === null ? {} : { set: parseProfileSet({ mcp: value }) }
|
|
1478
|
+
};
|
|
1479
|
+
case "hooks":
|
|
1480
|
+
assertDefined(value, "hooks activation input");
|
|
1481
|
+
return {
|
|
1482
|
+
remove: { hooks: true },
|
|
1483
|
+
...value === null ? {} : { set: parseProfileSet({ hooks: value }) }
|
|
1484
|
+
};
|
|
1485
|
+
case "subagents": {
|
|
1486
|
+
const parsed = exactObject(value, ["subagents", "resources"], "subagents activation input");
|
|
1487
|
+
assertDefined(parsed.subagents, "subagents activation input.subagents");
|
|
1488
|
+
assertDefined(parsed.resources, "subagents activation input.resources");
|
|
1489
|
+
const set = {
|
|
1490
|
+
...parsed.subagents === null ? {} : { subagents: parsed.subagents },
|
|
1491
|
+
...parsed.resources === null ? {} : { resources: { agents: parsed.resources } }
|
|
1492
|
+
};
|
|
1493
|
+
return {
|
|
1494
|
+
remove: { subagents: true, resources: { agents: true } },
|
|
1495
|
+
...Object.keys(set).length === 0 ? {} : { set: parseProfileSet(set) }
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function assertDefined(value, label) {
|
|
1501
|
+
if (value === void 0) throw new Error(`${label} must not be undefined`);
|
|
1502
|
+
}
|
|
1503
|
+
function exactObject(value, keys, label) {
|
|
1504
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1505
|
+
throw new Error(`${label} must be an object`);
|
|
1506
|
+
}
|
|
1507
|
+
const record = value;
|
|
1508
|
+
const actual = Object.keys(record).sort();
|
|
1509
|
+
const expected = [...keys].sort();
|
|
1510
|
+
if (actual.length !== expected.length || actual.some((key, index) => key !== expected[index])) {
|
|
1511
|
+
throw new Error(`${label} must contain exactly: ${expected.join(", ")}`);
|
|
1512
|
+
}
|
|
1513
|
+
return record;
|
|
1514
|
+
}
|
|
1515
|
+
function parseProfileSet(value) {
|
|
1516
|
+
return agentProfileSchema2.parse(value);
|
|
1517
|
+
}
|
|
1398
1518
|
function assertKnowledgeCandidatePair(baselineBundle, candidateBundle) {
|
|
1399
1519
|
const baseline = baselineBundle.knowledge;
|
|
1400
1520
|
const candidate = candidateBundle.knowledge;
|
|
@@ -2056,7 +2176,10 @@ export {
|
|
|
2056
2176
|
improvementDriver,
|
|
2057
2177
|
rawTraceDistiller,
|
|
2058
2178
|
improve,
|
|
2179
|
+
AGENT_IMPROVEMENT_PROFILE_SURFACES,
|
|
2059
2180
|
buildAgentImprovementActivationTargets,
|
|
2181
|
+
isAgentImprovementProfileSurface,
|
|
2182
|
+
agentImprovementTargetProfileDiffs,
|
|
2060
2183
|
AgentCandidateExperimentCellExecutionError,
|
|
2061
2184
|
runAgentCandidateExperiment,
|
|
2062
2185
|
executeAgentCandidateExperimentCell,
|
|
@@ -2073,4 +2196,4 @@ export {
|
|
|
2073
2196
|
verifyAgentImprovementActivationResult,
|
|
2074
2197
|
executeAgentImprovementActivation
|
|
2075
2198
|
};
|
|
2076
|
-
//# sourceMappingURL=chunk-
|
|
2199
|
+
//# sourceMappingURL=chunk-JSPW2Y3P.js.map
|