@tangle-network/agent-runtime 0.101.0 → 0.101.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/README.md +1 -1
- package/dist/agent.js +4 -3
- package/dist/agent.js.map +1 -1
- package/dist/chunk-2VZYRB55.js +834 -0
- package/dist/chunk-2VZYRB55.js.map +1 -0
- package/dist/{chunk-Y3SRWZMP.js → chunk-AYU35OTU.js} +2 -2
- package/dist/chunk-DI677IPX.js +200 -0
- package/dist/chunk-DI677IPX.js.map +1 -0
- package/dist/{chunk-HZDEXTSL.js → chunk-IKGCKPDX.js} +2 -833
- package/dist/chunk-IKGCKPDX.js.map +1 -0
- package/dist/{chunk-WYC2XJF2.js → chunk-KSBUSEUA.js} +2 -2
- package/dist/{chunk-UQ6PNNXM.js → chunk-KVJQV342.js} +5 -3
- package/dist/{chunk-UQ6PNNXM.js.map → chunk-KVJQV342.js.map} +1 -1
- package/dist/{chunk-FXF2OL34.js → chunk-MAONWP4R.js} +2 -2
- package/dist/{chunk-SGQ4YIQW.js → chunk-N2CEE5Q3.js} +3 -3
- package/dist/{chunk-VOPHC4LB.js → chunk-RJPQLUDA.js} +5 -187
- package/dist/chunk-RJPQLUDA.js.map +1 -0
- package/dist/{chunk-LV6WCT43.js → chunk-TA4RBJLE.js} +3 -3
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/intelligence.js +8 -5
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.js +6 -4
- package/dist/loop-runner-bin.js +5 -4
- package/dist/loops.js +4 -3
- package/dist/mcp/bin.js +4 -3
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.js +6 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/testing.d.ts +6 -0
- package/dist/testing.js +2596 -0
- package/dist/testing.js.map +1 -0
- package/package.json +9 -2
- package/dist/chunk-HZDEXTSL.js.map +0 -1
- package/dist/chunk-VOPHC4LB.js.map +0 -1
- /package/dist/{chunk-Y3SRWZMP.js.map → chunk-AYU35OTU.js.map} +0 -0
- /package/dist/{chunk-WYC2XJF2.js.map → chunk-KSBUSEUA.js.map} +0 -0
- /package/dist/{chunk-FXF2OL34.js.map → chunk-MAONWP4R.js.map} +0 -0
- /package/dist/{chunk-SGQ4YIQW.js.map → chunk-N2CEE5Q3.js.map} +0 -0
- /package/dist/{chunk-LV6WCT43.js.map → chunk-TA4RBJLE.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
settledToIteration,
|
|
19
19
|
supervise,
|
|
20
20
|
withDriverExecutor
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KVJQV342.js";
|
|
22
22
|
import {
|
|
23
23
|
InMemoryResultBlobStore,
|
|
24
24
|
InMemorySpawnJournal
|
|
@@ -5788,4 +5788,4 @@ export {
|
|
|
5788
5788
|
computeFindingId,
|
|
5789
5789
|
makeFinding2 as makeFinding
|
|
5790
5790
|
};
|
|
5791
|
-
//# sourceMappingURL=chunk-
|
|
5791
|
+
//# sourceMappingURL=chunk-MAONWP4R.js.map
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
definePersona,
|
|
6
6
|
runPersonified,
|
|
7
7
|
worktreeFanout
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MAONWP4R.js";
|
|
9
9
|
import {
|
|
10
10
|
createExecutorRegistry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KVJQV342.js";
|
|
12
12
|
import {
|
|
13
13
|
runAnalystLoop
|
|
14
14
|
} from "./chunk-FD2MBMOH.js";
|
|
@@ -196,4 +196,4 @@ export {
|
|
|
196
196
|
runLoopRunnerCli,
|
|
197
197
|
parseLoopRunnerArgv
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-N2CEE5Q3.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
assertModelAllowed,
|
|
22
22
|
harnessInvocation,
|
|
23
23
|
runLocalHarness
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IKGCKPDX.js";
|
|
25
25
|
import {
|
|
26
26
|
runAnalystLoop
|
|
27
27
|
} from "./chunk-FD2MBMOH.js";
|
|
@@ -2014,187 +2014,6 @@ function assertNoJudgeDerivedProposalFindings(findings) {
|
|
|
2014
2014
|
);
|
|
2015
2015
|
}
|
|
2016
2016
|
|
|
2017
|
-
// src/intelligence/activation.ts
|
|
2018
|
-
import {
|
|
2019
|
-
agentImprovementActivationResultSchema,
|
|
2020
|
-
agentImprovementActivationSchema as agentImprovementActivationSchema2
|
|
2021
|
-
} from "@tangle-network/agent-interface";
|
|
2022
|
-
function createAgentImprovementActivationResult(transition, options) {
|
|
2023
|
-
const activation = verifyCanonicalCandidateDocument(
|
|
2024
|
-
agentImprovementActivationSchema2.parse(transition.activation),
|
|
2025
|
-
"agent improvement activation"
|
|
2026
|
-
);
|
|
2027
|
-
assertTransitionInput(activation, transition);
|
|
2028
|
-
const result = agentImprovementActivationResultSchema.parse(
|
|
2029
|
-
canonicalCandidateDocument({
|
|
2030
|
-
kind: "agent-improvement-activation-result",
|
|
2031
|
-
idempotencyKey: activation.digest,
|
|
2032
|
-
attemptedAt: transition.attemptedAt,
|
|
2033
|
-
completedAt: options.completedAt,
|
|
2034
|
-
outcome: options.outcome
|
|
2035
|
-
}).value
|
|
2036
|
-
);
|
|
2037
|
-
assertResultAgainstActivation(activation, result);
|
|
2038
|
-
assertOutcomeDesiredState(
|
|
2039
|
-
activation,
|
|
2040
|
-
result,
|
|
2041
|
-
new Map(transition.targets.map((target) => [targetIdentity(target), target.desiredDigest]))
|
|
2042
|
-
);
|
|
2043
|
-
return immutableCandidateValue(result);
|
|
2044
|
-
}
|
|
2045
|
-
function verifyAgentImprovementActivationResult(input) {
|
|
2046
|
-
const proposal = verifyAgentImprovementProposal(input.proposal);
|
|
2047
|
-
const activation = verifyAgentImprovementActivation(input);
|
|
2048
|
-
const result = verifyCanonicalCandidateDocument(
|
|
2049
|
-
agentImprovementActivationResultSchema.parse(input.result),
|
|
2050
|
-
"agent improvement activation result"
|
|
2051
|
-
);
|
|
2052
|
-
assertResultAgainstActivation(activation, result);
|
|
2053
|
-
assertResultDesiredState(proposal, activation, result);
|
|
2054
|
-
return result;
|
|
2055
|
-
}
|
|
2056
|
-
async function executeAgentImprovementActivation(input, options) {
|
|
2057
|
-
const proposal = verifyAgentImprovementProposal(input.proposal);
|
|
2058
|
-
const activation = verifyAgentImprovementActivation(input);
|
|
2059
|
-
const experiment = proposal.evaluation.experiment;
|
|
2060
|
-
const targetArm = activation.intent === "activate-candidate" ? "candidate" : "baseline";
|
|
2061
|
-
const observedAt = (options.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
2062
|
-
const attemptedAt = Date.parse(observedAt) < Date.parse(activation.authorizedAt) ? activation.authorizedAt : observedAt;
|
|
2063
|
-
const transition = immutableCandidateValue({
|
|
2064
|
-
activation,
|
|
2065
|
-
candidateBundle: experiment.candidate,
|
|
2066
|
-
bundle: experiment[targetArm],
|
|
2067
|
-
targets: activation.targets.map((target) => ({
|
|
2068
|
-
...target,
|
|
2069
|
-
desiredDigest: agentImprovementTargetDigest(experiment, targetArm, target.surface),
|
|
2070
|
-
desiredInput: agentImprovementTargetInput(experiment[targetArm], target.surface)
|
|
2071
|
-
})),
|
|
2072
|
-
attemptedAt,
|
|
2073
|
-
expired: Date.parse(attemptedAt) >= Date.parse(activation.expiresAt)
|
|
2074
|
-
});
|
|
2075
|
-
if (transition.expired) {
|
|
2076
|
-
if (!options.reconcile) {
|
|
2077
|
-
return uncertainActivationResult(transition, "RECONCILIATION_UNAVAILABLE");
|
|
2078
|
-
}
|
|
2079
|
-
let reconciled;
|
|
2080
|
-
try {
|
|
2081
|
-
reconciled = await options.reconcile(transition);
|
|
2082
|
-
} catch {
|
|
2083
|
-
return uncertainActivationResult(transition, "RECONCILIATION_THROW");
|
|
2084
|
-
}
|
|
2085
|
-
if (reconciled === void 0) {
|
|
2086
|
-
return createAgentImprovementActivationResult(transition, {
|
|
2087
|
-
completedAt: transition.attemptedAt,
|
|
2088
|
-
outcome: { status: "expired" }
|
|
2089
|
-
});
|
|
2090
|
-
}
|
|
2091
|
-
try {
|
|
2092
|
-
return verifyAgentImprovementActivationResult({ ...input, result: reconciled });
|
|
2093
|
-
} catch {
|
|
2094
|
-
return uncertainActivationResult(transition, "INVALID_RECONCILIATION");
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
let rawResult;
|
|
2098
|
-
try {
|
|
2099
|
-
rawResult = await options.transition(transition);
|
|
2100
|
-
} catch {
|
|
2101
|
-
return uncertainActivationResult(transition, "TRANSITION_THROW");
|
|
2102
|
-
}
|
|
2103
|
-
try {
|
|
2104
|
-
return verifyAgentImprovementActivationResult({ ...input, result: rawResult });
|
|
2105
|
-
} catch {
|
|
2106
|
-
return uncertainActivationResult(transition, "INVALID_RESULT");
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
function uncertainActivationResult(transition, code) {
|
|
2110
|
-
return createAgentImprovementActivationResult(transition, {
|
|
2111
|
-
completedAt: transition.attemptedAt,
|
|
2112
|
-
outcome: {
|
|
2113
|
-
status: "indeterminate",
|
|
2114
|
-
code,
|
|
2115
|
-
message: "The product transition did not return a trustworthy commit result."
|
|
2116
|
-
}
|
|
2117
|
-
});
|
|
2118
|
-
}
|
|
2119
|
-
function assertTransitionInput(activation, transition) {
|
|
2120
|
-
const authorized = targetMap(activation.targets);
|
|
2121
|
-
const planned = targetMap(transition.targets);
|
|
2122
|
-
const desiredInputsMatch = transition.targets.every(
|
|
2123
|
-
(target) => canonicalCandidateDigest(target.desiredInput) === canonicalCandidateDigest(agentImprovementTargetInput(transition.bundle, target.surface))
|
|
2124
|
-
);
|
|
2125
|
-
if (authorized.size !== planned.size || [...authorized.entries()].some(
|
|
2126
|
-
([identity, target]) => planned.get(identity)?.expectedBaseDigest !== target.expectedBaseDigest
|
|
2127
|
-
) || transition.expired !== Date.parse(transition.attemptedAt) >= Date.parse(activation.expiresAt) || transition.candidateBundle.digest !== activation.candidateBundleDigest || !desiredInputsMatch || activation.intent === "activate-candidate" && transition.bundle.digest !== transition.candidateBundle.digest) {
|
|
2128
|
-
throw new Error("activation transition does not match its authorization");
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
function assertResultAgainstActivation(activation, result) {
|
|
2132
|
-
const attemptedAt = Date.parse(result.attemptedAt);
|
|
2133
|
-
const completedAt = Date.parse(result.completedAt);
|
|
2134
|
-
const expiresAt = Date.parse(activation.expiresAt);
|
|
2135
|
-
if (result.idempotencyKey !== activation.digest || attemptedAt < Date.parse(activation.authorizedAt) || completedAt < attemptedAt) {
|
|
2136
|
-
throw new Error("activation result does not bind its authorization");
|
|
2137
|
-
}
|
|
2138
|
-
const expired = attemptedAt >= expiresAt;
|
|
2139
|
-
if (result.outcome.status === "expired" && !expired || expired && !["expired", "indeterminate", "already-applied"].includes(result.outcome.status)) {
|
|
2140
|
-
throw new Error("activation result does not honor its authorization expiry");
|
|
2141
|
-
}
|
|
2142
|
-
if (!("targets" in result.outcome)) return;
|
|
2143
|
-
const authorized = targetMap(activation.targets);
|
|
2144
|
-
const observed = new Set(result.outcome.targets.map(targetIdentity));
|
|
2145
|
-
if (authorized.size !== observed.size || [...authorized.keys()].some((identity) => !observed.has(identity))) {
|
|
2146
|
-
throw new Error("activation result must cover every authorized target exactly once");
|
|
2147
|
-
}
|
|
2148
|
-
if (result.outcome.status === "applied" && result.outcome.targets.some(
|
|
2149
|
-
(target) => target.beforeDigest !== authorized.get(targetIdentity(target))?.expectedBaseDigest
|
|
2150
|
-
)) {
|
|
2151
|
-
throw new Error("applied activation did not start from its authorized base state");
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
function assertResultDesiredState(proposal, activation, result) {
|
|
2155
|
-
if (!("targets" in result.outcome)) return;
|
|
2156
|
-
const experiment = proposal.evaluation.experiment;
|
|
2157
|
-
const targetArm = activation.intent === "activate-candidate" ? "candidate" : "baseline";
|
|
2158
|
-
const desired = new Map(
|
|
2159
|
-
activation.targets.map((target) => [
|
|
2160
|
-
targetIdentity(target),
|
|
2161
|
-
agentImprovementTargetDigest(experiment, targetArm, target.surface)
|
|
2162
|
-
])
|
|
2163
|
-
);
|
|
2164
|
-
assertOutcomeDesiredState(activation, result, desired);
|
|
2165
|
-
}
|
|
2166
|
-
function assertOutcomeDesiredState(activation, result, desired) {
|
|
2167
|
-
if (!("targets" in result.outcome)) return;
|
|
2168
|
-
if (result.outcome.status === "applied") {
|
|
2169
|
-
if (result.outcome.targets.some(
|
|
2170
|
-
(target) => target.afterDigest !== desired.get(targetIdentity(target))
|
|
2171
|
-
)) {
|
|
2172
|
-
throw new Error("applied activation does not match the requested bundle");
|
|
2173
|
-
}
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
const allDesired = result.outcome.targets.every(
|
|
2177
|
-
(target) => target.currentDigest === desired.get(targetIdentity(target))
|
|
2178
|
-
);
|
|
2179
|
-
if (result.outcome.status === "already-applied") {
|
|
2180
|
-
if (!allDesired) throw new Error("already-applied activation is not at the requested state");
|
|
2181
|
-
return;
|
|
2182
|
-
}
|
|
2183
|
-
const authorized = targetMap(activation.targets);
|
|
2184
|
-
const hasStaleTarget = result.outcome.targets.some(
|
|
2185
|
-
(target) => target.currentDigest !== authorized.get(targetIdentity(target))?.expectedBaseDigest
|
|
2186
|
-
);
|
|
2187
|
-
if (allDesired || !hasStaleTarget) {
|
|
2188
|
-
throw new Error("activation conflict does not identify stale target state");
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
function targetMap(targets) {
|
|
2192
|
-
return new Map(targets.map((target) => [targetIdentity(target), target]));
|
|
2193
|
-
}
|
|
2194
|
-
function targetIdentity(target) {
|
|
2195
|
-
return `${target.surface}\0${target.identity}`;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
2017
|
export {
|
|
2199
2018
|
AGENTIC_PROFILE_RESOURCE_ROOT,
|
|
2200
2019
|
agenticGenerator,
|
|
@@ -2204,6 +2023,8 @@ export {
|
|
|
2204
2023
|
improve,
|
|
2205
2024
|
AGENT_IMPROVEMENT_PROFILE_SURFACES,
|
|
2206
2025
|
buildAgentImprovementActivationTargets,
|
|
2026
|
+
agentImprovementTargetDigest,
|
|
2027
|
+
agentImprovementTargetInput,
|
|
2207
2028
|
isAgentImprovementProfileSurface,
|
|
2208
2029
|
agentImprovementProfileSurfaceInput,
|
|
2209
2030
|
agentImprovementProfileSurfaceDigest,
|
|
@@ -2219,9 +2040,6 @@ export {
|
|
|
2219
2040
|
verifyAgentImprovementProposal,
|
|
2220
2041
|
verifyAgentImprovementReview,
|
|
2221
2042
|
verifyAgentImprovementActivation,
|
|
2222
|
-
verifyCandidateExecutionEvidence
|
|
2223
|
-
createAgentImprovementActivationResult,
|
|
2224
|
-
verifyAgentImprovementActivationResult,
|
|
2225
|
-
executeAgentImprovementActivation
|
|
2043
|
+
verifyCandidateExecutionEvidence
|
|
2226
2044
|
};
|
|
2227
|
-
//# sourceMappingURL=chunk-
|
|
2045
|
+
//# sourceMappingURL=chunk-RJPQLUDA.js.map
|