token-harness 0.1.22 → 0.1.23
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/package.json +1 -1
- package/sbom.json +3 -3
- package/token-harness.mjs +670 -234
package/token-harness.mjs
CHANGED
|
@@ -4130,6 +4130,7 @@ function coversProviders(rule, providers) {
|
|
|
4130
4130
|
return rule.providers.length === providers.length && providers.every((provider) => rule.providers.includes(provider));
|
|
4131
4131
|
}
|
|
4132
4132
|
function findCompatibilityRule(rules, query) {
|
|
4133
|
+
const candidates = [];
|
|
4133
4134
|
for (const rule of rules) {
|
|
4134
4135
|
if (!rule.capabilities.includes(query.capability))
|
|
4135
4136
|
continue;
|
|
@@ -4137,9 +4138,20 @@ function findCompatibilityRule(rules, query) {
|
|
|
4137
4138
|
continue;
|
|
4138
4139
|
if (!coversProviders(rule, query.providers))
|
|
4139
4140
|
continue;
|
|
4140
|
-
|
|
4141
|
+
if (rule.platforms !== void 0 && (query.platform === void 0 || !rule.platforms.some((platform) => platform.os === query.platform?.os && platform.wsl === query.platform?.wsl))) {
|
|
4142
|
+
continue;
|
|
4143
|
+
}
|
|
4144
|
+
candidates.push(rule);
|
|
4141
4145
|
}
|
|
4142
|
-
|
|
4146
|
+
if (query.observedVersions !== void 0) {
|
|
4147
|
+
const matchesObservedTuple = (rule) => Object.entries(rule.testedVersions).every(([provider, version3]) => query.observedVersions?.[provider] === version3) && Object.entries(rule.testedHarnessVersions ?? {}).every(([harness, version3]) => query.observedHarnessVersions?.[harness] === version3);
|
|
4148
|
+
const exact = candidates.find(matchesObservedTuple);
|
|
4149
|
+
if (exact !== void 0)
|
|
4150
|
+
return exact;
|
|
4151
|
+
const matchingDimensions = (rule) => Object.entries(rule.testedVersions).filter(([provider, version3]) => query.observedVersions?.[provider] === version3).length + Object.entries(rule.testedHarnessVersions ?? {}).filter(([harness, version3]) => query.observedHarnessVersions?.[harness] === version3).length;
|
|
4152
|
+
candidates.sort((left, right) => matchingDimensions(right) - matchingDimensions(left));
|
|
4153
|
+
}
|
|
4154
|
+
return candidates[0] ?? null;
|
|
4143
4155
|
}
|
|
4144
4156
|
function coversVersion(recorded, observed) {
|
|
4145
4157
|
if (recorded.major === 0 || observed.major === 0)
|
|
@@ -4159,6 +4171,16 @@ function staleRecordedVersions(rule, observed) {
|
|
|
4159
4171
|
}
|
|
4160
4172
|
return stale2;
|
|
4161
4173
|
}
|
|
4174
|
+
function staleRecordedHarnessVersions(rule, observed) {
|
|
4175
|
+
const stale2 = [];
|
|
4176
|
+
for (const [harness, recorded] of Object.entries(rule.testedHarnessVersions ?? {})) {
|
|
4177
|
+
const seen = observed[harness] ?? null;
|
|
4178
|
+
if (seen === recorded)
|
|
4179
|
+
continue;
|
|
4180
|
+
stale2.push({ harness, recorded, observed: seen });
|
|
4181
|
+
}
|
|
4182
|
+
return stale2;
|
|
4183
|
+
}
|
|
4162
4184
|
var init_compatibility = __esm({
|
|
4163
4185
|
"packages/core/dist/src/domain/compatibility.js"() {
|
|
4164
4186
|
"use strict";
|
|
@@ -4777,7 +4799,77 @@ function narrowChannelOverlaps(context) {
|
|
|
4777
4799
|
if (first === void 0)
|
|
4778
4800
|
continue;
|
|
4779
4801
|
const { harness, toolFamily, capability } = first.scope;
|
|
4780
|
-
const
|
|
4802
|
+
const found = findCompatibilityRule(input.rules, {
|
|
4803
|
+
providers: owners,
|
|
4804
|
+
harness,
|
|
4805
|
+
capability,
|
|
4806
|
+
...input.platform === void 0 ? {} : { platform: input.platform },
|
|
4807
|
+
observedVersions: input.observedVersions,
|
|
4808
|
+
...input.observedHarnessVersions === void 0 ? {} : { observedHarnessVersions: input.observedHarnessVersions }
|
|
4809
|
+
});
|
|
4810
|
+
const staleProviders = found === null ? [] : staleRecordedVersions(found, input.observedVersions);
|
|
4811
|
+
const staleHarnesses = found === null ? [] : staleRecordedHarnessVersions(found, input.observedHarnessVersions ?? {});
|
|
4812
|
+
const stale2 = [...staleProviders, ...staleHarnesses];
|
|
4813
|
+
const rule = stale2.length > 0 ? null : found;
|
|
4814
|
+
if (found !== null && stale2.length > 0) {
|
|
4815
|
+
conflicts.push({
|
|
4816
|
+
code: "compatibility-rule-stale",
|
|
4817
|
+
scope: `${harness}/${toolFamily}/${capability}`,
|
|
4818
|
+
claimants: [...owners].sort(),
|
|
4819
|
+
detail: [
|
|
4820
|
+
`${owners.join(" and ")} both use ${capability} on ${harness}/${toolFamily} at different interception points`,
|
|
4821
|
+
`Rule ${found.id} was tested at ${[
|
|
4822
|
+
...staleProviders.map((entry) => `${entry.provider} ${entry.recorded}`),
|
|
4823
|
+
...staleHarnesses.map((entry) => `${entry.harness} ${entry.recorded}`)
|
|
4824
|
+
].join(", ")}`,
|
|
4825
|
+
`Installed now: ${[
|
|
4826
|
+
...staleProviders.map((entry) => `${entry.provider} ${entry.observed ?? "unknown"}`),
|
|
4827
|
+
...staleHarnesses.map((entry) => `${entry.harness} ${entry.observed ?? "unknown"}`)
|
|
4828
|
+
].join(", ")}`,
|
|
4829
|
+
"The compatibility rule does not authorize this provider tuple"
|
|
4830
|
+
],
|
|
4831
|
+
remediation: `Re-test ${found.id} against the installed versions and platform, or assign one owner to ${harness}/${toolFamily}/${capability}`
|
|
4832
|
+
});
|
|
4833
|
+
for (const entry of group)
|
|
4834
|
+
dropped.add(entry);
|
|
4835
|
+
continue;
|
|
4836
|
+
}
|
|
4837
|
+
if (rule?.outcome === "ordered") {
|
|
4838
|
+
const conflictsBeforeOrdering = conflicts.length;
|
|
4839
|
+
const order = rule.order;
|
|
4840
|
+
if (order === void 0 || order.length !== owners.length) {
|
|
4841
|
+
conflicts.push({
|
|
4842
|
+
code: "compatibility-rule-malformed",
|
|
4843
|
+
scope: `${harness}/${toolFamily}/${capability}`,
|
|
4844
|
+
claimants: [...owners].sort(),
|
|
4845
|
+
detail: [`Rule ${rule.id} does not order every owner in this channel`],
|
|
4846
|
+
remediation: `Fix rule ${rule.id} so its order lists every provider on the channel`
|
|
4847
|
+
});
|
|
4848
|
+
for (const entry of group)
|
|
4849
|
+
dropped.add(entry);
|
|
4850
|
+
continue;
|
|
4851
|
+
}
|
|
4852
|
+
for (const entry of group) {
|
|
4853
|
+
const index = order.indexOf(entry.owner);
|
|
4854
|
+
if (index < 0) {
|
|
4855
|
+
conflicts.push({
|
|
4856
|
+
code: "compatibility-rule-malformed",
|
|
4857
|
+
scope: `${harness}/${toolFamily}/${capability}`,
|
|
4858
|
+
claimants: [...owners].sort(),
|
|
4859
|
+
detail: [`Rule ${rule.id} does not include ${entry.owner}`],
|
|
4860
|
+
remediation: `Fix rule ${rule.id} so its order lists every provider on the channel`
|
|
4861
|
+
});
|
|
4862
|
+
break;
|
|
4863
|
+
}
|
|
4864
|
+
entry.mode = "chainable";
|
|
4865
|
+
entry.order = index;
|
|
4866
|
+
}
|
|
4867
|
+
if (conflicts.length > conflictsBeforeOrdering) {
|
|
4868
|
+
for (const entry of group)
|
|
4869
|
+
dropped.add(entry);
|
|
4870
|
+
}
|
|
4871
|
+
continue;
|
|
4872
|
+
}
|
|
4781
4873
|
if (rule === null || rule.outcome !== "narrowed" || rule.retains === void 0) {
|
|
4782
4874
|
conflicts.push({
|
|
4783
4875
|
code: "exclusive-scope-contested",
|
|
@@ -4823,7 +4915,10 @@ function resolveContested(context) {
|
|
|
4823
4915
|
const found = findCompatibilityRule(input.rules, {
|
|
4824
4916
|
providers: claimants,
|
|
4825
4917
|
harness: scope.harness,
|
|
4826
|
-
capability
|
|
4918
|
+
capability,
|
|
4919
|
+
...input.platform === void 0 ? {} : { platform: input.platform },
|
|
4920
|
+
observedVersions: input.observedVersions,
|
|
4921
|
+
...input.observedHarnessVersions === void 0 ? {} : { observedHarnessVersions: input.observedHarnessVersions }
|
|
4827
4922
|
});
|
|
4828
4923
|
const stale2 = found === null ? [] : staleRecordedVersions(found, input.observedVersions);
|
|
4829
4924
|
const rule = stale2.length > 0 ? null : found;
|
|
@@ -5059,18 +5154,33 @@ var init_removal_order = __esm({
|
|
|
5059
5154
|
});
|
|
5060
5155
|
|
|
5061
5156
|
// packages/core/dist/src/planner/rules.js
|
|
5062
|
-
var RTK, HARNESSTRIM, RTK_HARNESSTRIM_SHELL_OVERLAP, COMPATIBILITY_RULES;
|
|
5157
|
+
var RTK, HARNESSTRIM, CLAUDE, CODEX, RTK_HARNESSTRIM_ORDERED_LINUX, RTK_HARNESSTRIM_SHELL_OVERLAP, COMPATIBILITY_RULES;
|
|
5063
5158
|
var init_rules = __esm({
|
|
5064
5159
|
"packages/core/dist/src/planner/rules.js"() {
|
|
5065
5160
|
"use strict";
|
|
5066
5161
|
init_ids();
|
|
5067
5162
|
RTK = providerId("rtk");
|
|
5068
5163
|
HARNESSTRIM = providerId("harnesstrim");
|
|
5164
|
+
CLAUDE = harnessId("claude");
|
|
5165
|
+
CODEX = harnessId("codex");
|
|
5166
|
+
RTK_HARNESSTRIM_ORDERED_LINUX = {
|
|
5167
|
+
id: "rtk-harnesstrim-post-tool-chain-linux",
|
|
5168
|
+
providers: [RTK, HARNESSTRIM],
|
|
5169
|
+
harnesses: [CLAUDE, CODEX],
|
|
5170
|
+
capabilities: ["shell.output.reduce"],
|
|
5171
|
+
outcome: "ordered",
|
|
5172
|
+
order: [RTK, HARNESSTRIM],
|
|
5173
|
+
platforms: [{ os: "linux", wsl: false }],
|
|
5174
|
+
testedVersions: { rtk: "0.50.0", harnesstrim: "0.3.1" },
|
|
5175
|
+
testedHarnessVersions: { claude: "2.1.274", codex: "0.159.0" },
|
|
5176
|
+
rationale: "RTK rewrites the Bash command at PreToolUse; HarnessTrim processes the completed Bash result at PostToolUse. The harness lifecycle establishes RTK-before-HarnessTrim. Their telemetry remains separate because the providers do not expose comparable boundaries for one shared operation.",
|
|
5177
|
+
fixtures: ["tests/fixtures/rows/rtk-harnesstrim-chain-linux"]
|
|
5178
|
+
};
|
|
5069
5179
|
RTK_HARNESSTRIM_SHELL_OVERLAP = {
|
|
5070
5180
|
id: "rtk-harnesstrim-shell-output-overlap",
|
|
5071
5181
|
providers: [RTK, HARNESSTRIM],
|
|
5072
|
-
//
|
|
5073
|
-
//
|
|
5182
|
+
// Legacy providers retain the reviewed RTK-only narrowing. The resolver selects the exact
|
|
5183
|
+
// provider tuple above for the current Linux runtime chain.
|
|
5074
5184
|
harnesses: "*",
|
|
5075
5185
|
capabilities: ["shell.output.reduce"],
|
|
5076
5186
|
outcome: "narrowed",
|
|
@@ -5079,7 +5189,10 @@ var init_rules = __esm({
|
|
|
5079
5189
|
rationale: "RTK keeps shell output reduction: it rewrites the command, so the output arriving at any later point is already reduced, and reducing it again loses signal and counts the saving twice. HarnessTrim 0.1.0 no longer has to be excluded whole for that \u2014 `--no-hook` and `--no-instructions` produce a Claude install that adds skills and reduces nothing, and `--tools` confines its OpenCode reduction to a chosen tool family. So it is narrowed to the form that leaves this channel alone, rather than refused. At 0.0.5 no flag produced any of those states, which is why this rule read `conflict` and said no configuration narrows it.",
|
|
5080
5190
|
fixtures: ["docs/rfcs/0003-capabilities-and-conflicts.md#the-table-is-an-intent"]
|
|
5081
5191
|
};
|
|
5082
|
-
COMPATIBILITY_RULES = [
|
|
5192
|
+
COMPATIBILITY_RULES = [
|
|
5193
|
+
RTK_HARNESSTRIM_ORDERED_LINUX,
|
|
5194
|
+
RTK_HARNESSTRIM_SHELL_OVERLAP
|
|
5195
|
+
];
|
|
5083
5196
|
}
|
|
5084
5197
|
});
|
|
5085
5198
|
|
|
@@ -7160,6 +7273,14 @@ function ensureParent(document2, segments) {
|
|
|
7160
7273
|
let current = document2;
|
|
7161
7274
|
for (let index = 0; index < segments.length - 1; index += 1) {
|
|
7162
7275
|
const segment = segments[index];
|
|
7276
|
+
if (Array.isArray(current)) {
|
|
7277
|
+
const itemIndex = arrayIndex(segment);
|
|
7278
|
+
if (itemIndex === null || itemIndex >= current.length) {
|
|
7279
|
+
return { ok: false, reason: "path crosses a missing or invalid array entry" };
|
|
7280
|
+
}
|
|
7281
|
+
current = current[itemIndex];
|
|
7282
|
+
continue;
|
|
7283
|
+
}
|
|
7163
7284
|
if (!isJsonObject(current)) {
|
|
7164
7285
|
return { ok: false, reason: `\`${segments.slice(0, index).join(".")}\` is not an object` };
|
|
7165
7286
|
}
|
|
@@ -9663,7 +9784,7 @@ var TOOL_VERSION;
|
|
|
9663
9784
|
var init_version2 = __esm({
|
|
9664
9785
|
"apps/cli/dist/src/version.js"() {
|
|
9665
9786
|
"use strict";
|
|
9666
|
-
TOOL_VERSION = "0.1.
|
|
9787
|
+
TOOL_VERSION = "0.1.23";
|
|
9667
9788
|
}
|
|
9668
9789
|
});
|
|
9669
9790
|
|
|
@@ -14190,7 +14311,7 @@ async function detect(context) {
|
|
|
14190
14311
|
const state = unparsed.length > 0 ? "broken" : configured.length > 0 && version3 !== null ? "configured" : version3 !== null || present.length > 0 ? "detected" : "absent";
|
|
14191
14312
|
const primary = present.find((config) => config.declaration.primary) ?? present[0] ?? null;
|
|
14192
14313
|
return {
|
|
14193
|
-
harnessId:
|
|
14314
|
+
harnessId: CLAUDE2,
|
|
14194
14315
|
state,
|
|
14195
14316
|
version: version3,
|
|
14196
14317
|
versionVerdict: verdict,
|
|
@@ -14211,7 +14332,7 @@ async function inspect(context) {
|
|
|
14211
14332
|
diagnostics.push(diagnostic({
|
|
14212
14333
|
severity: "warning",
|
|
14213
14334
|
code: "tool-family-not-covered",
|
|
14214
|
-
subject:
|
|
14335
|
+
subject: CLAUDE2,
|
|
14215
14336
|
/**
|
|
14216
14337
|
* Says whose gap it is, and that the tool is working.
|
|
14217
14338
|
*
|
|
@@ -14228,7 +14349,7 @@ async function inspect(context) {
|
|
|
14228
14349
|
}));
|
|
14229
14350
|
}
|
|
14230
14351
|
return {
|
|
14231
|
-
harnessId:
|
|
14352
|
+
harnessId: CLAUDE2,
|
|
14232
14353
|
configs,
|
|
14233
14354
|
activeToolFamilies,
|
|
14234
14355
|
uncoveredToolFamilies,
|
|
@@ -14236,7 +14357,7 @@ async function inspect(context) {
|
|
|
14236
14357
|
// settings.json runs. Codex is the one that needs the other answer.
|
|
14237
14358
|
enabled: MANIFEST.requiresEnablement ? null : null,
|
|
14238
14359
|
summaries: configs.filter((config) => config.configuredPoints.length > 0).map((config) => ({
|
|
14239
|
-
harnessId:
|
|
14360
|
+
harnessId: CLAUDE2,
|
|
14240
14361
|
configPath: config.path,
|
|
14241
14362
|
scope: config.declaration.scope,
|
|
14242
14363
|
interceptionPoints: config.configuredPoints,
|
|
@@ -14300,7 +14421,7 @@ async function verify(context) {
|
|
|
14300
14421
|
remediation: null
|
|
14301
14422
|
});
|
|
14302
14423
|
const achievedTier = checks.some((check) => check.achievedTier === "config-only") ? "config-only" : checks.some((check) => check.achievedTier === "presence") ? "presence" : null;
|
|
14303
|
-
return { harnessId:
|
|
14424
|
+
return { harnessId: CLAUDE2, declaredTier: MANIFEST.verificationTier, achievedTier, checks };
|
|
14304
14425
|
}
|
|
14305
14426
|
function cclimitsPercent(value3) {
|
|
14306
14427
|
if (typeof value3 !== "string")
|
|
@@ -14326,7 +14447,7 @@ function cclimitsUsageWindow(value3, input) {
|
|
|
14326
14447
|
return null;
|
|
14327
14448
|
}
|
|
14328
14449
|
return {
|
|
14329
|
-
harnessId:
|
|
14450
|
+
harnessId: CLAUDE2,
|
|
14330
14451
|
bucketId: "claude-subscription",
|
|
14331
14452
|
bucketName: "Claude subscription",
|
|
14332
14453
|
window: input.window,
|
|
@@ -14350,7 +14471,7 @@ async function observeUsage(context, observedAt) {
|
|
|
14350
14471
|
maxOutputBytes: 512 * 1024
|
|
14351
14472
|
});
|
|
14352
14473
|
const unavailable3 = (code, message, severity = "warning", remediation = null) => ({
|
|
14353
|
-
harnessId:
|
|
14474
|
+
harnessId: CLAUDE2,
|
|
14354
14475
|
state: "unavailable",
|
|
14355
14476
|
windows: [],
|
|
14356
14477
|
planType: null,
|
|
@@ -14360,7 +14481,7 @@ async function observeUsage(context, observedAt) {
|
|
|
14360
14481
|
diagnostic({
|
|
14361
14482
|
severity,
|
|
14362
14483
|
code,
|
|
14363
|
-
subject:
|
|
14484
|
+
subject: CLAUDE2,
|
|
14364
14485
|
message,
|
|
14365
14486
|
remediation: remediation ?? (severity === "info" ? "Install a cclimits build with cacheless Claude JSON support if you want this optional fallback" : "Run cclimits --claude --json --no-cache-write --no-stale-fallback directly and inspect its output")
|
|
14366
14487
|
})
|
|
@@ -14426,13 +14547,13 @@ async function observeUsage(context, observedAt) {
|
|
|
14426
14547
|
diagnostics.push(diagnostic({
|
|
14427
14548
|
severity: "warning",
|
|
14428
14549
|
code: "cclimits-claude-window-unrecognized",
|
|
14429
|
-
subject:
|
|
14550
|
+
subject: CLAUDE2,
|
|
14430
14551
|
message: "One cclimits Claude quota window failed strict percentage validation",
|
|
14431
14552
|
remediation: "Treat the omitted window as unknown and update the cclimits compatibility fixture"
|
|
14432
14553
|
}));
|
|
14433
14554
|
}
|
|
14434
14555
|
return {
|
|
14435
|
-
harnessId:
|
|
14556
|
+
harnessId: CLAUDE2,
|
|
14436
14557
|
state: "observed",
|
|
14437
14558
|
windows,
|
|
14438
14559
|
planType: typeof claude["plan"] === "string" ? claude["plan"] : null,
|
|
@@ -14465,7 +14586,7 @@ async function observeContext(context, _observedAt) {
|
|
|
14465
14586
|
const nativeEffort = await readClaudeNativeEffort(context);
|
|
14466
14587
|
const benchmarkPolicy = await readClaudeBenchmarkPolicy(context, nativeEffort);
|
|
14467
14588
|
const empty2 = (state, diagnostics) => ({
|
|
14468
|
-
harnessId:
|
|
14589
|
+
harnessId: CLAUDE2,
|
|
14469
14590
|
state,
|
|
14470
14591
|
nativeEffort,
|
|
14471
14592
|
benchmarkPolicy,
|
|
@@ -14492,7 +14613,7 @@ async function observeContext(context, _observedAt) {
|
|
|
14492
14613
|
diagnostic({
|
|
14493
14614
|
severity: "warning",
|
|
14494
14615
|
code: "claude-mcp-inventory-unavailable",
|
|
14495
|
-
subject:
|
|
14616
|
+
subject: CLAUDE2,
|
|
14496
14617
|
message: "Claude MCP inventory could not be read: " + outcome2.failure.message,
|
|
14497
14618
|
remediation: "Run claude mcp list directly and verify the CLI installation"
|
|
14498
14619
|
})
|
|
@@ -14503,7 +14624,7 @@ async function observeContext(context, _observedAt) {
|
|
|
14503
14624
|
diagnostic({
|
|
14504
14625
|
severity: "warning",
|
|
14505
14626
|
code: "claude-mcp-inventory-unavailable",
|
|
14506
|
-
subject:
|
|
14627
|
+
subject: CLAUDE2,
|
|
14507
14628
|
message: "claude mcp list exited " + String(outcome2.exitCode),
|
|
14508
14629
|
remediation: "Run claude mcp list directly and fix the reported MCP configuration"
|
|
14509
14630
|
})
|
|
@@ -14521,7 +14642,7 @@ async function observeContext(context, _observedAt) {
|
|
|
14521
14642
|
if (name2 === void 0 || name2 === "")
|
|
14522
14643
|
continue;
|
|
14523
14644
|
servers.push({
|
|
14524
|
-
harnessId:
|
|
14645
|
+
harnessId: CLAUDE2,
|
|
14525
14646
|
name: name2,
|
|
14526
14647
|
toolCount: null,
|
|
14527
14648
|
runtimeStatus: claudeMcpStatus(match[2] ?? ""),
|
|
@@ -14535,7 +14656,7 @@ async function observeContext(context, _observedAt) {
|
|
|
14535
14656
|
mcpServers: servers
|
|
14536
14657
|
};
|
|
14537
14658
|
}
|
|
14538
|
-
var
|
|
14659
|
+
var CLAUDE2, MANIFEST, VERSION_PATTERN, claudeAdapter;
|
|
14539
14660
|
var init_claude = __esm({
|
|
14540
14661
|
"packages/adapters/dist/src/harnesses/claude.js"() {
|
|
14541
14662
|
"use strict";
|
|
@@ -14543,13 +14664,13 @@ var init_claude = __esm({
|
|
|
14543
14664
|
init_contract();
|
|
14544
14665
|
init_claude_policy();
|
|
14545
14666
|
init_claude_benchmark_policy();
|
|
14546
|
-
|
|
14667
|
+
CLAUDE2 = harnessId("claude");
|
|
14547
14668
|
MANIFEST = {
|
|
14548
14669
|
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
14549
|
-
id:
|
|
14670
|
+
id: CLAUDE2,
|
|
14550
14671
|
displayName: "Claude Code",
|
|
14551
14672
|
homepage: "https://claude.com/claude-code",
|
|
14552
|
-
testedVersions: { minimum: "2.
|
|
14673
|
+
testedVersions: { minimum: "2.1.274", maximum: "2.1.274" },
|
|
14553
14674
|
// RFC 0007 §Per-harness findings: tier 3 was reached on this harness, passively,
|
|
14554
14675
|
// through the provider's receipt. The adapter alone reaches `config-only`.
|
|
14555
14676
|
verificationTier: "canary",
|
|
@@ -14573,6 +14694,7 @@ var init_claude = __esm({
|
|
|
14573
14694
|
toolFamilies: [
|
|
14574
14695
|
{
|
|
14575
14696
|
id: "Bash",
|
|
14697
|
+
matcher: "Bash",
|
|
14576
14698
|
platforms: ["windows", "macos", "linux"],
|
|
14577
14699
|
executesShellCommands: true
|
|
14578
14700
|
},
|
|
@@ -14580,6 +14702,7 @@ var init_claude = __esm({
|
|
|
14580
14702
|
// Observed in a Windows session: the harness offers a separate PowerShell tool,
|
|
14581
14703
|
// and a hook matching `Bash` did not see commands routed through it.
|
|
14582
14704
|
id: "PowerShell",
|
|
14705
|
+
matcher: "PowerShell",
|
|
14583
14706
|
platforms: ["windows"],
|
|
14584
14707
|
executesShellCommands: true
|
|
14585
14708
|
}
|
|
@@ -14913,7 +15036,7 @@ async function detect2(context) {
|
|
|
14913
15036
|
const configured = (hooks?.configuredPoints.length ?? 0) > 0;
|
|
14914
15037
|
const primary = configs.find((config) => config.declaration.primary && config.exists) ?? present[0] ?? null;
|
|
14915
15038
|
return {
|
|
14916
|
-
harnessId:
|
|
15039
|
+
harnessId: CODEX2,
|
|
14917
15040
|
state: hooks?.exists && !hooks.parsed ? "broken" : configured && version3 !== null ? "configured" : version3 !== null || present.length > 0 ? "detected" : "absent",
|
|
14918
15041
|
version: version3,
|
|
14919
15042
|
versionVerdict: verdict,
|
|
@@ -14939,14 +15062,14 @@ async function inspect2(context) {
|
|
|
14939
15062
|
diagnostic({
|
|
14940
15063
|
severity: "info",
|
|
14941
15064
|
code: "hook-enablement-unobservable",
|
|
14942
|
-
subject:
|
|
15065
|
+
subject: CODEX2,
|
|
14943
15066
|
message: "This file declares hooks; run verify to query native enablement/trust where hooks/list is available",
|
|
14944
15067
|
path: hook.path,
|
|
14945
15068
|
remediation: "Open Codex and confirm the hook is enabled and trusted after any hook edit"
|
|
14946
15069
|
})
|
|
14947
15070
|
] : [];
|
|
14948
15071
|
return {
|
|
14949
|
-
harnessId:
|
|
15072
|
+
harnessId: CODEX2,
|
|
14950
15073
|
configs,
|
|
14951
15074
|
activeToolFamilies: familiesOnThisPlatform(MANIFEST2, context.facts),
|
|
14952
15075
|
/**
|
|
@@ -14963,7 +15086,7 @@ async function inspect2(context) {
|
|
|
14963
15086
|
uncoveredToolFamilies: familiesOnThisPlatform(MANIFEST2, context.facts).filter((family) => family.executesShellCommands).filter((family) => matchers.length > 0 && !matchers.some((matcher) => matcherCoversFamily(matcher, family.id))).map((family) => family.id),
|
|
14964
15087
|
enabled: null,
|
|
14965
15088
|
summaries: configs.filter((config) => config.configuredPoints.length > 0).map((config) => ({
|
|
14966
|
-
harnessId:
|
|
15089
|
+
harnessId: CODEX2,
|
|
14967
15090
|
configPath: config.path,
|
|
14968
15091
|
scope: config.declaration.scope,
|
|
14969
15092
|
interceptionPoints: config.configuredPoints,
|
|
@@ -14983,11 +15106,15 @@ async function verify2(context) {
|
|
|
14983
15106
|
const checks = [
|
|
14984
15107
|
{
|
|
14985
15108
|
id: "executable-resolves",
|
|
14986
|
-
|
|
14987
|
-
|
|
15109
|
+
// Codex Desktop can run hooks from its own app process without exposing the optional
|
|
15110
|
+
// `codex` CLI to the shell that runs Token Harness. Missing CLI access therefore means
|
|
15111
|
+
// that CLI-based checks cannot be exercised; the provider rows remain responsible for
|
|
15112
|
+
// proving actual hook execution from RTK/HarnessTrim telemetry.
|
|
15113
|
+
status: detection.version === null ? "not-exercised" : "pass",
|
|
15114
|
+
summary: detection.version === null ? "Codex CLI is unavailable to this process; native CLI checks cannot run" : `Codex ${detection.version} resolves`,
|
|
14988
15115
|
achievedTier: detection.version === null ? null : "presence",
|
|
14989
15116
|
evidence: detection.evidence.filter((item) => item.kind === "version-output"),
|
|
14990
|
-
remediation:
|
|
15117
|
+
remediation: null
|
|
14991
15118
|
},
|
|
14992
15119
|
{
|
|
14993
15120
|
id: "hooks-readable",
|
|
@@ -15010,15 +15137,15 @@ async function verify2(context) {
|
|
|
15010
15137
|
{
|
|
15011
15138
|
id: "hook-enablement",
|
|
15012
15139
|
status: configured ? "info" : "not-exercised",
|
|
15013
|
-
summary: configured ? "Native enablement/trust metadata
|
|
15140
|
+
summary: configured ? "Native enablement/trust metadata is unavailable; configuration alone does not prove activation" : "No declared hook has enablement to inspect",
|
|
15014
15141
|
achievedTier: null,
|
|
15015
15142
|
evidence: [],
|
|
15016
|
-
remediation: configured ? "
|
|
15143
|
+
remediation: configured ? "Use Codex hook controls to enable and trust the declared hook, then run a provider canary; Token Harness cannot grant trust." : null
|
|
15017
15144
|
},
|
|
15018
15145
|
{
|
|
15019
15146
|
id: "canary-intercepted",
|
|
15020
15147
|
status: "not-exercised",
|
|
15021
|
-
summary: "No
|
|
15148
|
+
summary: "No Codex CLI event-stream receipt is available from passive verification; provider-specific runtime receipts are checked separately",
|
|
15022
15149
|
achievedTier: null,
|
|
15023
15150
|
evidence: [],
|
|
15024
15151
|
remediation: null
|
|
@@ -15033,7 +15160,7 @@ async function verify2(context) {
|
|
|
15033
15160
|
}
|
|
15034
15161
|
}
|
|
15035
15162
|
return {
|
|
15036
|
-
harnessId:
|
|
15163
|
+
harnessId: CODEX2,
|
|
15037
15164
|
declaredTier: MANIFEST2.verificationTier,
|
|
15038
15165
|
achievedTier: detection.version !== null && readable && configured ? "config-only" : detection.version !== null ? "presence" : null,
|
|
15039
15166
|
checks
|
|
@@ -15069,7 +15196,7 @@ function rateWindow(value3, input) {
|
|
|
15069
15196
|
const duration2 = readNumber(value3, "windowDurationMins");
|
|
15070
15197
|
const resetsAt = readNumber(value3, "resetsAt");
|
|
15071
15198
|
return {
|
|
15072
|
-
harnessId:
|
|
15199
|
+
harnessId: CODEX2,
|
|
15073
15200
|
bucketId: input.bucketId,
|
|
15074
15201
|
bucketName: input.bucketName,
|
|
15075
15202
|
window: input.window,
|
|
@@ -15171,7 +15298,7 @@ function cclimitsWindow(value3, input) {
|
|
|
15171
15298
|
return null;
|
|
15172
15299
|
}
|
|
15173
15300
|
return {
|
|
15174
|
-
harnessId:
|
|
15301
|
+
harnessId: CODEX2,
|
|
15175
15302
|
bucketId: "codex-subscription",
|
|
15176
15303
|
bucketName: "Codex subscription",
|
|
15177
15304
|
window: input.window,
|
|
@@ -15231,7 +15358,7 @@ async function observeUsageViaCclimits(context, observedAt, nativeDiagnostic) {
|
|
|
15231
15358
|
if (outcome2.failure !== null || outcome2.exitCode !== 0 || outcome2.stdoutTruncated) {
|
|
15232
15359
|
const reason3 = outcome2.failure !== null ? outcome2.failure.message : outcome2.stdoutTruncated ? "output exceeded the bounded capture" : `exited ${String(outcome2.exitCode)}`;
|
|
15233
15360
|
return {
|
|
15234
|
-
harnessId:
|
|
15361
|
+
harnessId: CODEX2,
|
|
15235
15362
|
state: "unavailable",
|
|
15236
15363
|
windows: [],
|
|
15237
15364
|
planType: null,
|
|
@@ -15242,7 +15369,7 @@ async function observeUsageViaCclimits(context, observedAt, nativeDiagnostic) {
|
|
|
15242
15369
|
diagnostic({
|
|
15243
15370
|
severity: outcome2.failure?.reason === "executable-not-found" ? "info" : "warning",
|
|
15244
15371
|
code: "cclimits-codex-usage-unavailable",
|
|
15245
|
-
subject:
|
|
15372
|
+
subject: CODEX2,
|
|
15246
15373
|
message: "Optional cclimits Codex quota fallback was unavailable: " + reason3,
|
|
15247
15374
|
remediation: "Install a cclimits build with cacheless Codex JSON support, or treat Codex quota as unknown"
|
|
15248
15375
|
})
|
|
@@ -15252,7 +15379,7 @@ async function observeUsageViaCclimits(context, observedAt, nativeDiagnostic) {
|
|
|
15252
15379
|
const parsed = parseCclimitsCodexResponse(outcome2.stdout, observedAt);
|
|
15253
15380
|
if (parsed === null) {
|
|
15254
15381
|
return {
|
|
15255
|
-
harnessId:
|
|
15382
|
+
harnessId: CODEX2,
|
|
15256
15383
|
state: "unavailable",
|
|
15257
15384
|
windows: [],
|
|
15258
15385
|
planType: null,
|
|
@@ -15263,7 +15390,7 @@ async function observeUsageViaCclimits(context, observedAt, nativeDiagnostic) {
|
|
|
15263
15390
|
diagnostic({
|
|
15264
15391
|
severity: "warning",
|
|
15265
15392
|
code: "cclimits-codex-schema-unrecognized",
|
|
15266
|
-
subject:
|
|
15393
|
+
subject: CODEX2,
|
|
15267
15394
|
message: "cclimits returned no strictly validated Codex quota window with an absolute reset time",
|
|
15268
15395
|
remediation: "Update the cclimits Codex compatibility fixture before using it for benchmark quota"
|
|
15269
15396
|
})
|
|
@@ -15271,14 +15398,14 @@ async function observeUsageViaCclimits(context, observedAt, nativeDiagnostic) {
|
|
|
15271
15398
|
};
|
|
15272
15399
|
}
|
|
15273
15400
|
return {
|
|
15274
|
-
harnessId:
|
|
15401
|
+
harnessId: CODEX2,
|
|
15275
15402
|
state: "observed",
|
|
15276
15403
|
...parsed,
|
|
15277
15404
|
diagnostics: [
|
|
15278
15405
|
diagnostic({
|
|
15279
15406
|
severity: "info",
|
|
15280
15407
|
code: "codex-rate-limits-companion-fallback",
|
|
15281
|
-
subject:
|
|
15408
|
+
subject: CODEX2,
|
|
15282
15409
|
message: "Native Codex quota was unavailable, so cclimits supplied a read-only reported snapshot",
|
|
15283
15410
|
remediation: null
|
|
15284
15411
|
})
|
|
@@ -15315,7 +15442,7 @@ async function observeUsage2(context, observedAt) {
|
|
|
15315
15442
|
return observeUsageViaCclimits(context, observedAt, diagnostic({
|
|
15316
15443
|
severity: "warning",
|
|
15317
15444
|
code: "codex-rate-limits-unavailable",
|
|
15318
|
-
subject:
|
|
15445
|
+
subject: CODEX2,
|
|
15319
15446
|
message: "Codex rate limits could not be read natively: " + outcome2.failure.message,
|
|
15320
15447
|
remediation: "Run Codex once, confirm ChatGPT authentication, then retry token-harness budget"
|
|
15321
15448
|
}));
|
|
@@ -15324,7 +15451,7 @@ async function observeUsage2(context, observedAt) {
|
|
|
15324
15451
|
return observeUsageViaCclimits(context, observedAt, diagnostic({
|
|
15325
15452
|
severity: "warning",
|
|
15326
15453
|
code: "codex-rate-limits-unavailable",
|
|
15327
|
-
subject:
|
|
15454
|
+
subject: CODEX2,
|
|
15328
15455
|
message: "Codex app-server exited " + String(outcome2.exitCode) + " without a usable rate-limit snapshot",
|
|
15329
15456
|
remediation: "Check codex app-server --help and the installed Codex authentication state"
|
|
15330
15457
|
}));
|
|
@@ -15334,7 +15461,7 @@ async function observeUsage2(context, observedAt) {
|
|
|
15334
15461
|
return observeUsageViaCclimits(context, observedAt, diagnostic({
|
|
15335
15462
|
severity: "warning",
|
|
15336
15463
|
code: "codex-rate-limits-schema-unrecognized",
|
|
15337
|
-
subject:
|
|
15464
|
+
subject: CODEX2,
|
|
15338
15465
|
message: "Codex app-server returned no recognizable account/rateLimits/read response",
|
|
15339
15466
|
remediation: "Refresh the Codex compatibility fixture before relying on this version"
|
|
15340
15467
|
}));
|
|
@@ -15343,13 +15470,13 @@ async function observeUsage2(context, observedAt) {
|
|
|
15343
15470
|
return observeUsageViaCclimits(context, observedAt, diagnostic({
|
|
15344
15471
|
severity: "warning",
|
|
15345
15472
|
code: "codex-rate-limits-empty",
|
|
15346
|
-
subject:
|
|
15473
|
+
subject: CODEX2,
|
|
15347
15474
|
message: "Codex returned a rate-limit response without any readable usage windows",
|
|
15348
15475
|
remediation: "Treat current Codex quota as unknown unless a strict companion snapshot succeeds"
|
|
15349
15476
|
}));
|
|
15350
15477
|
}
|
|
15351
15478
|
return {
|
|
15352
|
-
harnessId:
|
|
15479
|
+
harnessId: CODEX2,
|
|
15353
15480
|
state: "observed",
|
|
15354
15481
|
...parsed,
|
|
15355
15482
|
diagnostics: []
|
|
@@ -15429,7 +15556,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15429
15556
|
maxOutputBytes: 4 * 1024 * 1024
|
|
15430
15557
|
});
|
|
15431
15558
|
const unavailable3 = (state, code, message) => ({
|
|
15432
|
-
harnessId:
|
|
15559
|
+
harnessId: CODEX2,
|
|
15433
15560
|
state,
|
|
15434
15561
|
model: null,
|
|
15435
15562
|
reasoningEffort: null,
|
|
@@ -15451,7 +15578,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15451
15578
|
diagnostic({
|
|
15452
15579
|
severity: "warning",
|
|
15453
15580
|
code,
|
|
15454
|
-
subject:
|
|
15581
|
+
subject: CODEX2,
|
|
15455
15582
|
message,
|
|
15456
15583
|
remediation: "Update Codex and retry token-harness context"
|
|
15457
15584
|
})
|
|
@@ -15518,7 +15645,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15518
15645
|
if (path === null || version3 === null)
|
|
15519
15646
|
continue;
|
|
15520
15647
|
return {
|
|
15521
|
-
harnessId:
|
|
15648
|
+
harnessId: CODEX2,
|
|
15522
15649
|
scope: "user",
|
|
15523
15650
|
path,
|
|
15524
15651
|
version: version3,
|
|
@@ -15542,7 +15669,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15542
15669
|
const path = readString(source, "file");
|
|
15543
15670
|
const profile = readString(source, "profile");
|
|
15544
15671
|
managedConfigFieldOrigins.push({
|
|
15545
|
-
harnessId:
|
|
15672
|
+
harnessId: CODEX2,
|
|
15546
15673
|
keyPath,
|
|
15547
15674
|
sourceType,
|
|
15548
15675
|
path,
|
|
@@ -15578,7 +15705,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15578
15705
|
}
|
|
15579
15706
|
}
|
|
15580
15707
|
availableModels.push({
|
|
15581
|
-
harnessId:
|
|
15708
|
+
harnessId: CODEX2,
|
|
15582
15709
|
id,
|
|
15583
15710
|
model,
|
|
15584
15711
|
displayName,
|
|
@@ -15602,7 +15729,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15602
15729
|
continue;
|
|
15603
15730
|
const tools = isRecord3(item["tools"]) ? item["tools"] : null;
|
|
15604
15731
|
mcpServers.push({
|
|
15605
|
-
harnessId:
|
|
15732
|
+
harnessId: CODEX2,
|
|
15606
15733
|
name: name2,
|
|
15607
15734
|
toolCount: tools === null ? null : Object.keys(tools).length,
|
|
15608
15735
|
runtimeStatus: readString(item, "runtimeStatus"),
|
|
@@ -15618,7 +15745,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15618
15745
|
diagnostics.push(diagnostic({
|
|
15619
15746
|
severity: "warning",
|
|
15620
15747
|
code: "codex-config-read-unavailable",
|
|
15621
|
-
subject:
|
|
15748
|
+
subject: CODEX2,
|
|
15622
15749
|
message: "Codex returned no recognizable config/read result",
|
|
15623
15750
|
remediation: "Treat effective Codex configuration as unknown"
|
|
15624
15751
|
}));
|
|
@@ -15627,7 +15754,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15627
15754
|
diagnostics.push(diagnostic({
|
|
15628
15755
|
severity: "warning",
|
|
15629
15756
|
code: "codex-managed-config-target-unavailable",
|
|
15630
|
-
subject:
|
|
15757
|
+
subject: CODEX2,
|
|
15631
15758
|
message: "Codex effective config was readable, but no versioned base user config layer was returned",
|
|
15632
15759
|
remediation: "Keep native policy advisory; do not guess a config.toml path or expectedVersion"
|
|
15633
15760
|
}));
|
|
@@ -15636,7 +15763,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15636
15763
|
diagnostics.push(diagnostic({
|
|
15637
15764
|
severity: "warning",
|
|
15638
15765
|
code: "codex-model-catalog-unavailable",
|
|
15639
|
-
subject:
|
|
15766
|
+
subject: CODEX2,
|
|
15640
15767
|
message: "Codex returned no recognizable model/list result",
|
|
15641
15768
|
remediation: "Keep the current model; do not infer alternative model ids"
|
|
15642
15769
|
}));
|
|
@@ -15645,7 +15772,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15645
15772
|
diagnostics.push(diagnostic({
|
|
15646
15773
|
severity: "warning",
|
|
15647
15774
|
code: "codex-model-catalog-truncated",
|
|
15648
|
-
subject:
|
|
15775
|
+
subject: CODEX2,
|
|
15649
15776
|
message: "Codex model catalog exceeded the one-shot page size",
|
|
15650
15777
|
remediation: "Do not recommend a model absent from the returned catalog page"
|
|
15651
15778
|
}));
|
|
@@ -15654,7 +15781,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15654
15781
|
diagnostics.push(diagnostic({
|
|
15655
15782
|
severity: "warning",
|
|
15656
15783
|
code: "codex-mcp-inventory-unavailable",
|
|
15657
|
-
subject:
|
|
15784
|
+
subject: CODEX2,
|
|
15658
15785
|
message: "Codex returned no recognizable mcpServerStatus/list result",
|
|
15659
15786
|
remediation: "Treat Codex MCP overhead as unknown; config/model optimization remains available"
|
|
15660
15787
|
}));
|
|
@@ -15663,14 +15790,14 @@ async function observeContext2(context, _observedAt) {
|
|
|
15663
15790
|
diagnostics.push(diagnostic({
|
|
15664
15791
|
severity: "warning",
|
|
15665
15792
|
code: "codex-mcp-inventory-truncated",
|
|
15666
|
-
subject:
|
|
15793
|
+
subject: CODEX2,
|
|
15667
15794
|
message: "Codex MCP inventory exceeded the one-shot page size",
|
|
15668
15795
|
remediation: "Treat the reported MCP/tool counts as lower bounds"
|
|
15669
15796
|
}));
|
|
15670
15797
|
}
|
|
15671
15798
|
const projectRootMarkers = config === null ? null : Array.isArray(config["project_root_markers"]) ? readStringArray(config, "project_root_markers") : null;
|
|
15672
15799
|
return {
|
|
15673
|
-
harnessId:
|
|
15800
|
+
harnessId: CODEX2,
|
|
15674
15801
|
state: config !== null && mcpResponse !== null && modelResponse !== null ? mcpInventoryTruncated || modelCatalogTruncated ? "partial" : "observed" : config !== null || mcpResponse !== null || modelResponse !== null ? "partial" : "unavailable",
|
|
15675
15802
|
model: config === null ? null : readString(config, "model"),
|
|
15676
15803
|
reasoningEffort: config === null ? null : readString(config, "model_reasoning_effort"),
|
|
@@ -15691,7 +15818,7 @@ async function observeContext2(context, _observedAt) {
|
|
|
15691
15818
|
diagnostics
|
|
15692
15819
|
};
|
|
15693
15820
|
}
|
|
15694
|
-
var
|
|
15821
|
+
var CODEX2, RATE_LIMIT_REQUEST_ID, CONTEXT_CONFIG_REQUEST_ID, CONTEXT_MCP_REQUEST_ID, CONTEXT_MODEL_REQUEST_ID, VERSION_PATTERN2, MANIFEST2, codexAdapter;
|
|
15695
15822
|
var init_codex = __esm({
|
|
15696
15823
|
"packages/adapters/dist/src/harnesses/codex.js"() {
|
|
15697
15824
|
"use strict";
|
|
@@ -15699,7 +15826,7 @@ var init_codex = __esm({
|
|
|
15699
15826
|
init_claude();
|
|
15700
15827
|
init_codex_hooks();
|
|
15701
15828
|
init_contract();
|
|
15702
|
-
|
|
15829
|
+
CODEX2 = harnessId("codex");
|
|
15703
15830
|
RATE_LIMIT_REQUEST_ID = "token-harness-rate-limits";
|
|
15704
15831
|
CONTEXT_CONFIG_REQUEST_ID = "token-harness-context-config";
|
|
15705
15832
|
CONTEXT_MCP_REQUEST_ID = "token-harness-context-mcp";
|
|
@@ -15707,10 +15834,10 @@ var init_codex = __esm({
|
|
|
15707
15834
|
VERSION_PATTERN2 = /(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)/;
|
|
15708
15835
|
MANIFEST2 = {
|
|
15709
15836
|
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
15710
|
-
id:
|
|
15837
|
+
id: CODEX2,
|
|
15711
15838
|
displayName: "Codex CLI",
|
|
15712
15839
|
homepage: "https://developers.openai.com/codex",
|
|
15713
|
-
testedVersions: { minimum: "0.
|
|
15840
|
+
testedVersions: { minimum: "0.159.0", maximum: "0.159.0" },
|
|
15714
15841
|
verificationTier: "config-only",
|
|
15715
15842
|
versionCommand: { executable: "codex", args: ["--version"] },
|
|
15716
15843
|
/**
|
|
@@ -15741,7 +15868,12 @@ var init_codex = __esm({
|
|
|
15741
15868
|
}
|
|
15742
15869
|
],
|
|
15743
15870
|
toolFamilies: [
|
|
15744
|
-
{
|
|
15871
|
+
{
|
|
15872
|
+
id: "Bash",
|
|
15873
|
+
matcher: "^Bash$",
|
|
15874
|
+
platforms: ["windows", "macos", "linux"],
|
|
15875
|
+
executesShellCommands: true
|
|
15876
|
+
}
|
|
15745
15877
|
],
|
|
15746
15878
|
requiresEnablement: true,
|
|
15747
15879
|
enablementNote: "Codex persists hook enablement and trust separately from hooks.json; verify reads hooks/list where available and otherwise keeps enablement unknown",
|
|
@@ -16531,6 +16663,105 @@ var init_harnesses = __esm({
|
|
|
16531
16663
|
}
|
|
16532
16664
|
});
|
|
16533
16665
|
|
|
16666
|
+
// packages/adapters/dist/src/providers/hook-plan.js
|
|
16667
|
+
function hookListPointer(eventName) {
|
|
16668
|
+
return `hooks.${eventName.replace(/\./g, "\\.")}`;
|
|
16669
|
+
}
|
|
16670
|
+
function hookMatcherForFamily(harness, toolFamily) {
|
|
16671
|
+
const family = harness.toolFamilies.find((entry) => entry.id === toolFamily);
|
|
16672
|
+
return family?.matcher ?? toolFamily;
|
|
16673
|
+
}
|
|
16674
|
+
function commandHookTarget(context, harness, scopeId, toolFamily) {
|
|
16675
|
+
const point = harness.interceptionPoints.find((entry) => entry.scopeId === scopeId);
|
|
16676
|
+
const family = harness.toolFamilies.find((entry) => entry.id === toolFamily);
|
|
16677
|
+
const file = harness.configFiles.find((entry) => entry.interceptionFormat === "hooks-event-command-list" && entry.interceptionPoints?.includes(scopeId));
|
|
16678
|
+
if (point === void 0 || family === void 0 || file === void 0)
|
|
16679
|
+
return null;
|
|
16680
|
+
const base = file.scope === "user" ? context.paths.home : context.projectRoot;
|
|
16681
|
+
const configPath = context.fs.join(base, ...file.path.split("/"));
|
|
16682
|
+
return {
|
|
16683
|
+
harness,
|
|
16684
|
+
harnessId: harness.id,
|
|
16685
|
+
scopeId,
|
|
16686
|
+
toolFamily,
|
|
16687
|
+
eventName: point.eventName,
|
|
16688
|
+
matcher: family.matcher ?? family.id,
|
|
16689
|
+
configPath,
|
|
16690
|
+
pointer: hookListPointer(point.eventName)
|
|
16691
|
+
};
|
|
16692
|
+
}
|
|
16693
|
+
function commandHookEntry(matcher, command) {
|
|
16694
|
+
return {
|
|
16695
|
+
matcher,
|
|
16696
|
+
hooks: [{ type: "command", command }]
|
|
16697
|
+
};
|
|
16698
|
+
}
|
|
16699
|
+
function appendCommandHookAction(input) {
|
|
16700
|
+
const { target } = input;
|
|
16701
|
+
return {
|
|
16702
|
+
kind: "merge-json",
|
|
16703
|
+
id: input.actionId,
|
|
16704
|
+
riskClass: "reversible",
|
|
16705
|
+
requiresNetwork: false,
|
|
16706
|
+
requiresElevation: false,
|
|
16707
|
+
affectedPaths: [target.configPath],
|
|
16708
|
+
affectedProcesses: [],
|
|
16709
|
+
preconditions: [
|
|
16710
|
+
`${target.configPath} is absent or parses as JSON`,
|
|
16711
|
+
`no ${input.providerId} command hook already exists on ${target.eventName}/${target.toolFamily}`
|
|
16712
|
+
],
|
|
16713
|
+
postconditions: [
|
|
16714
|
+
`${target.eventName} carries one ${input.providerId} command hook for ${target.toolFamily}`,
|
|
16715
|
+
"every other hook entry is unchanged"
|
|
16716
|
+
],
|
|
16717
|
+
rollbackData: "file-snapshot",
|
|
16718
|
+
explanation: input.explanation,
|
|
16719
|
+
path: target.configPath,
|
|
16720
|
+
ownedPointers: [target.pointer],
|
|
16721
|
+
operations: [
|
|
16722
|
+
{
|
|
16723
|
+
kind: "append",
|
|
16724
|
+
pointer: target.pointer,
|
|
16725
|
+
value: commandHookEntry(target.matcher, input.command),
|
|
16726
|
+
expectedValueDigest: null
|
|
16727
|
+
}
|
|
16728
|
+
],
|
|
16729
|
+
createIfMissing: true
|
|
16730
|
+
};
|
|
16731
|
+
}
|
|
16732
|
+
function removeCommandHookAction(input) {
|
|
16733
|
+
return {
|
|
16734
|
+
kind: "remove-owned-change",
|
|
16735
|
+
id: input.actionId,
|
|
16736
|
+
riskClass: "reversible",
|
|
16737
|
+
requiresNetwork: false,
|
|
16738
|
+
requiresElevation: false,
|
|
16739
|
+
affectedPaths: [input.target.configPath],
|
|
16740
|
+
affectedProcesses: [],
|
|
16741
|
+
preconditions: [`the ${input.providerId} hook still matches the entry Token Harness wrote`],
|
|
16742
|
+
postconditions: [
|
|
16743
|
+
`${input.target.eventName} no longer carries the Token Harness ${input.providerId} hook`
|
|
16744
|
+
],
|
|
16745
|
+
rollbackData: "file-snapshot",
|
|
16746
|
+
explanation: `Remove the ${input.providerId} hook from ${input.target.harness.displayName}`,
|
|
16747
|
+
path: input.target.configPath,
|
|
16748
|
+
reverses: input.installActionId,
|
|
16749
|
+
target: {
|
|
16750
|
+
kind: "owned-json-entry",
|
|
16751
|
+
path: input.target.configPath,
|
|
16752
|
+
pointer: input.target.pointer,
|
|
16753
|
+
placement: "array-element",
|
|
16754
|
+
valueDigest: jsonValueDigest(commandHookEntry(input.target.matcher, input.command))
|
|
16755
|
+
}
|
|
16756
|
+
};
|
|
16757
|
+
}
|
|
16758
|
+
var init_hook_plan = __esm({
|
|
16759
|
+
"packages/adapters/dist/src/providers/hook-plan.js"() {
|
|
16760
|
+
"use strict";
|
|
16761
|
+
init_src();
|
|
16762
|
+
}
|
|
16763
|
+
});
|
|
16764
|
+
|
|
16534
16765
|
// packages/adapters/dist/src/providers/harnesstrim.js
|
|
16535
16766
|
function identifiesCommand(command) {
|
|
16536
16767
|
return HOOK_COMMAND_PATTERN.test(command) || PLUGIN_MODULE_PATTERN2.test(command);
|
|
@@ -17037,22 +17268,27 @@ async function verify6(context) {
|
|
|
17037
17268
|
continue;
|
|
17038
17269
|
const text3 = new TextDecoder().decode(await context.fs.readFile(path));
|
|
17039
17270
|
const lines = text3.split("\n").filter((line) => line.trim() !== "");
|
|
17040
|
-
const
|
|
17041
|
-
const
|
|
17042
|
-
if (
|
|
17271
|
+
const parsed = lines.map(parseTrimEvent).filter((event) => event !== null).filter((event) => event.harness === "codex" || event.harness === "claude");
|
|
17272
|
+
const latest = parsed.at(-1);
|
|
17273
|
+
if (latest === void 0)
|
|
17043
17274
|
continue;
|
|
17044
|
-
|
|
17275
|
+
const reductions = parsed.filter((event) => !event.reductionFailed && event.afterChars < event.beforeChars && event.changed !== false);
|
|
17276
|
+
receipt = {
|
|
17277
|
+
observedAt: latest.ts,
|
|
17278
|
+
operations: reductions.length,
|
|
17279
|
+
attempts: parsed.length,
|
|
17280
|
+
source: path
|
|
17281
|
+
};
|
|
17045
17282
|
break;
|
|
17046
17283
|
}
|
|
17047
17284
|
checks.push({
|
|
17048
17285
|
id: "canary-intercepted",
|
|
17049
|
-
status: receipt === null ? "not-exercised" : "pass",
|
|
17050
|
-
summary: receipt === null ? "no telemetry file yet, so nothing has been observed" : `${String(receipt.operations)} reductions recorded, most recently ${receipt.observedAt}`,
|
|
17051
|
-
//
|
|
17052
|
-
|
|
17053
|
-
achievedTier: receipt === null ? null : "canary",
|
|
17286
|
+
status: receipt === null ? "not-exercised" : receipt.operations === 0 ? "info" : "pass",
|
|
17287
|
+
summary: receipt === null ? "no telemetry file yet, so nothing has been observed" : receipt.operations === 0 ? `HarnessTrim observed ${String(receipt.attempts ?? 0)} Claude/Codex outputs, but none was reduced; latest attempt ${receipt.observedAt}` : `${String(receipt.operations)} applied reductions recorded from ${String(receipt.attempts ?? receipt.operations)} Claude/Codex outputs, most recently ${receipt.observedAt}`,
|
|
17288
|
+
// Configured hooks and pass-through receipts do not prove that HarnessTrim shortened output.
|
|
17289
|
+
achievedTier: receipt === null || receipt.operations === 0 ? null : "canary",
|
|
17054
17290
|
evidence: [],
|
|
17055
|
-
remediation: receipt !== null ? null : runtimeConfigured.length > 0 ? "Enable telemetry on the runtime integration, then use it on an output it can reduce." : "A skills-only setup does not write reduction telemetry. Configure a compatible measurement path before expecting agent-attributed results."
|
|
17291
|
+
remediation: receipt !== null && receipt.operations > 0 ? null : receipt !== null ? "Run a canary that produces output the installed HarnessTrim reducer can shorten, then verify again." : runtimeConfigured.length > 0 ? "Enable telemetry on the runtime integration, then use it on an output it can reduce." : "A skills-only setup does not write reduction telemetry. Configure a compatible measurement path before expecting agent-attributed results."
|
|
17056
17292
|
});
|
|
17057
17293
|
const agents = context.fs.join(context.projectRoot, "AGENTS.md");
|
|
17058
17294
|
if (await context.fs.stat(agents) !== null) {
|
|
@@ -17294,7 +17530,7 @@ async function harnessTrimSkillsConfigured(context, harness, capabilities) {
|
|
|
17294
17530
|
}
|
|
17295
17531
|
async function configuredHarnessesForHarnessTrim(context, capabilities) {
|
|
17296
17532
|
const configured = new Set(harnessesWiredToHarnessTrim(context.harnessConfigs));
|
|
17297
|
-
for (const harness of [
|
|
17533
|
+
for (const harness of [CLAUDE3, CODEX3]) {
|
|
17298
17534
|
if (await harnessTrimSkillsConfigured(context, harness, capabilities))
|
|
17299
17535
|
configured.add(harness);
|
|
17300
17536
|
}
|
|
@@ -17338,6 +17574,28 @@ async function plan(context, request) {
|
|
|
17338
17574
|
mode: null
|
|
17339
17575
|
}
|
|
17340
17576
|
})));
|
|
17577
|
+
for (const owned of request.ownership) {
|
|
17578
|
+
if (owned.owner !== HARNESSTRIM2 || owned.scope.capability !== "shell.output.reduce" || owned.scope.interceptionPoint !== "post-tool-use" || owned.scope.harness !== CLAUDE3 && owned.scope.harness !== CODEX3) {
|
|
17579
|
+
continue;
|
|
17580
|
+
}
|
|
17581
|
+
const harness = request.harnesses.find((entry) => entry.id === owned.scope.harness);
|
|
17582
|
+
if (harness === void 0)
|
|
17583
|
+
continue;
|
|
17584
|
+
const target = commandHookTarget(context, harness, owned.scope.interceptionPoint, owned.scope.toolFamily);
|
|
17585
|
+
if (target === null)
|
|
17586
|
+
continue;
|
|
17587
|
+
const existing = context.harnessConfigs.filter((config) => config.harnessId === harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scopeId)).flatMap((config) => config.hookCommands ?? []).find((entry) => entry.eventName === target.eventName && entry.matcher === target.matcher && isHarnessTrimHookFor(entry.command, harness.id));
|
|
17588
|
+
if (existing === void 0)
|
|
17589
|
+
continue;
|
|
17590
|
+
const actionKey = digestText(target.configPath).slice(7, 15);
|
|
17591
|
+
actions2.push(removeCommandHookAction({
|
|
17592
|
+
target,
|
|
17593
|
+
providerId: HARNESSTRIM2,
|
|
17594
|
+
actionId: `harnesstrim-${harness.id}-hook-remove-${actionKey}`,
|
|
17595
|
+
installActionId: `harnesstrim-${harness.id}-hook-${actionKey}`,
|
|
17596
|
+
command: existing.command
|
|
17597
|
+
}));
|
|
17598
|
+
}
|
|
17341
17599
|
return {
|
|
17342
17600
|
providerId: HARNESSTRIM2,
|
|
17343
17601
|
desiredState: "absent",
|
|
@@ -17354,6 +17612,7 @@ async function plan(context, request) {
|
|
|
17354
17612
|
};
|
|
17355
17613
|
}
|
|
17356
17614
|
const actions = [];
|
|
17615
|
+
const diagnostics = [];
|
|
17357
17616
|
const plannedHarnesses = [];
|
|
17358
17617
|
for (const harness of targets) {
|
|
17359
17618
|
const review = reviews[harness];
|
|
@@ -17401,24 +17660,132 @@ async function plan(context, request) {
|
|
|
17401
17660
|
});
|
|
17402
17661
|
plannedHarnesses.push(harnessId(harness));
|
|
17403
17662
|
}
|
|
17663
|
+
for (const owned of request.ownership) {
|
|
17664
|
+
if (owned.owner !== HARNESSTRIM2 || owned.scope.capability !== "shell.output.reduce" || owned.scope.interceptionPoint !== "post-tool-use" || owned.scope.harness !== CLAUDE3 && owned.scope.harness !== CODEX3) {
|
|
17665
|
+
continue;
|
|
17666
|
+
}
|
|
17667
|
+
const harness = request.harnesses.find((entry) => entry.id === owned.scope.harness);
|
|
17668
|
+
if (harness === void 0)
|
|
17669
|
+
continue;
|
|
17670
|
+
const target = commandHookTarget(context, harness, owned.scope.interceptionPoint, owned.scope.toolFamily);
|
|
17671
|
+
if (target === null)
|
|
17672
|
+
continue;
|
|
17673
|
+
const metricsPath = ".harnesstrim/metrics.jsonl";
|
|
17674
|
+
const command = `harnesstrim hook ${harness.id} --metrics ${metricsPath}`;
|
|
17675
|
+
const existing = context.harnessConfigs.filter((config) => config.harnessId === harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scopeId)).flatMap((config) => config.hookCommands ?? []).filter((entry) => entry.eventName === target.eventName && entry.matcher !== null && matcherCoversFamily2(entry.matcher, target.toolFamily) && isHarnessTrimHookFor(entry.command, harness.id));
|
|
17676
|
+
const correctlyMonitored = existing.some((entry) => commandHasMetricsPath(entry.command, metricsPath));
|
|
17677
|
+
if (correctlyMonitored) {
|
|
17678
|
+
plannedHarnesses.push(harness.id);
|
|
17679
|
+
continue;
|
|
17680
|
+
}
|
|
17681
|
+
const upgradable = existing.find((entry) => !hasMetricsArgument(entry.command));
|
|
17682
|
+
if (upgradable !== void 0) {
|
|
17683
|
+
const upgraded = `${upgradable.command.trim()} --metrics ${metricsPath}`;
|
|
17684
|
+
actions.push(replaceHookCommandAction({
|
|
17685
|
+
target,
|
|
17686
|
+
commandPointer: upgradable.commandPointer,
|
|
17687
|
+
currentCommand: upgradable.command,
|
|
17688
|
+
nextCommand: upgraded,
|
|
17689
|
+
actionId: `harnesstrim-${harness.id}-metrics-${digestText(target.configPath).slice(7, 15)}`
|
|
17690
|
+
}));
|
|
17691
|
+
plannedHarnesses.push(harness.id);
|
|
17692
|
+
continue;
|
|
17693
|
+
}
|
|
17694
|
+
if (existing.length > 0) {
|
|
17695
|
+
diagnostics.push(diagnostic({
|
|
17696
|
+
severity: "warning",
|
|
17697
|
+
code: "harnesstrim-metrics-path-needs-review",
|
|
17698
|
+
subject: harness.id,
|
|
17699
|
+
message: `An existing HarnessTrim hook on ${harness.displayName} uses a different telemetry path or custom command and was left unchanged`,
|
|
17700
|
+
path: target.configPath,
|
|
17701
|
+
remediation: `Set its --metrics path to ${metricsPath}, or review the command before changing it`
|
|
17702
|
+
}));
|
|
17703
|
+
continue;
|
|
17704
|
+
}
|
|
17705
|
+
const actionId = `harnesstrim-${harness.id}-hook-${digestText(target.configPath).slice(7, 15)}`;
|
|
17706
|
+
actions.push(appendCommandHookAction({
|
|
17707
|
+
target,
|
|
17708
|
+
providerId: HARNESSTRIM2,
|
|
17709
|
+
actionId,
|
|
17710
|
+
command,
|
|
17711
|
+
explanation: `Register HarnessTrim after ${harness.displayName} Bash commands and record reductions in ${metricsPath}${codexActivationNote(harness.id)}`
|
|
17712
|
+
}));
|
|
17713
|
+
plannedHarnesses.push(harness.id);
|
|
17714
|
+
}
|
|
17404
17715
|
return {
|
|
17405
17716
|
providerId: HARNESSTRIM2,
|
|
17406
17717
|
desiredState: "configured",
|
|
17407
17718
|
actions,
|
|
17408
|
-
|
|
17719
|
+
diagnostics,
|
|
17720
|
+
targetHarnesses: [...new Set(plannedHarnesses)]
|
|
17721
|
+
};
|
|
17722
|
+
}
|
|
17723
|
+
function isHarnessTrimHookFor(command, harness) {
|
|
17724
|
+
const match = HARNESSTRIM_HOOK_COMMAND.exec(command.trim());
|
|
17725
|
+
return match?.[1]?.toLowerCase() === harness;
|
|
17726
|
+
}
|
|
17727
|
+
function hasMetricsArgument(command) {
|
|
17728
|
+
return /(?:^|\s)--metrics(?:\s|=)/i.test(command);
|
|
17729
|
+
}
|
|
17730
|
+
function commandHasMetricsPath(command, metricsPath) {
|
|
17731
|
+
const match = /(?:^|\s)--metrics(?:=|\s+)(?:"([^"]+)"|'([^']+)'|([^\s]+))/i.exec(command);
|
|
17732
|
+
const observed = match?.[1] ?? match?.[2] ?? match?.[3];
|
|
17733
|
+
return observed?.replaceAll("\\", "/") === metricsPath;
|
|
17734
|
+
}
|
|
17735
|
+
function matcherCoversFamily2(matcher, family) {
|
|
17736
|
+
if (matcher === family)
|
|
17737
|
+
return true;
|
|
17738
|
+
try {
|
|
17739
|
+
return new RegExp(matcher).test(family);
|
|
17740
|
+
} catch {
|
|
17741
|
+
return false;
|
|
17742
|
+
}
|
|
17743
|
+
}
|
|
17744
|
+
function replaceHookCommandAction(input) {
|
|
17745
|
+
return {
|
|
17746
|
+
kind: "merge-json",
|
|
17747
|
+
id: input.actionId,
|
|
17748
|
+
riskClass: "reversible",
|
|
17749
|
+
requiresNetwork: false,
|
|
17750
|
+
requiresElevation: false,
|
|
17751
|
+
affectedPaths: [input.target.configPath],
|
|
17752
|
+
affectedProcesses: [],
|
|
17753
|
+
preconditions: [
|
|
17754
|
+
`${input.commandPointer} still contains the HarnessTrim command Token Harness inspected`
|
|
17755
|
+
],
|
|
17756
|
+
postconditions: [
|
|
17757
|
+
`${input.commandPointer} records HarnessTrim reductions to .harnesstrim/metrics.jsonl`
|
|
17758
|
+
],
|
|
17759
|
+
rollbackData: "file-snapshot",
|
|
17760
|
+
explanation: `Enable per-harness HarnessTrim telemetry for ${input.target.harness.displayName}${codexActivationNote(input.target.harnessId)}`,
|
|
17761
|
+
path: input.target.configPath,
|
|
17762
|
+
ownedPointers: [input.commandPointer],
|
|
17763
|
+
operations: [
|
|
17764
|
+
{
|
|
17765
|
+
kind: "set",
|
|
17766
|
+
pointer: input.commandPointer,
|
|
17767
|
+
value: input.nextCommand,
|
|
17768
|
+
expectedValueDigest: jsonValueDigest(input.currentCommand)
|
|
17769
|
+
}
|
|
17770
|
+
],
|
|
17771
|
+
createIfMissing: false
|
|
17409
17772
|
};
|
|
17410
17773
|
}
|
|
17411
|
-
|
|
17774
|
+
function codexActivationNote(harness) {
|
|
17775
|
+
return harness === CODEX3 ? ". Codex must enable and trust this hook in its native UI; Token Harness can register it but cannot grant trust" : "";
|
|
17776
|
+
}
|
|
17777
|
+
var HARNESSTRIM2, CLAUDE3, HERMES2, CODEX3, PI2, SKILLS_UPSTREAM, RUNTIME_SKILL_DIGESTS_MINIMUM, SKILL_ARTIFACT_DIGESTS, SKILL_ARTIFACTS, OPENCODE2, MODE_CARRYING_HARNESSES, HOOK_COMMAND_PATTERN, PLUGIN_MODULE_PATTERN2, PI_EXTENSION_PATTERN, MANIFEST6, SKILLS_INSTALL, TESTED_UPSTREAM, TESTED_VERSIONS, SURFACE_ANCHORS, VERSION_PATTERN6, HARNESSTRIM_HOOK_COMMAND, harnesstrimAdapter;
|
|
17412
17778
|
var init_harnesstrim = __esm({
|
|
17413
17779
|
"packages/adapters/dist/src/providers/harnesstrim.js"() {
|
|
17414
17780
|
"use strict";
|
|
17415
17781
|
init_src();
|
|
17782
|
+
init_hook_plan();
|
|
17416
17783
|
HARNESSTRIM2 = providerId("harnesstrim");
|
|
17417
|
-
|
|
17784
|
+
CLAUDE3 = harnessId("claude");
|
|
17418
17785
|
HERMES2 = harnessId("hermes");
|
|
17419
|
-
|
|
17786
|
+
CODEX3 = harnessId("codex");
|
|
17420
17787
|
PI2 = harnessId("pi");
|
|
17421
|
-
SKILLS_UPSTREAM = "0.
|
|
17788
|
+
SKILLS_UPSTREAM = "0.3.1";
|
|
17422
17789
|
RUNTIME_SKILL_DIGESTS_MINIMUM = "0.2.0";
|
|
17423
17790
|
SKILL_ARTIFACT_DIGESTS = {
|
|
17424
17791
|
"compact-handoff/SKILL.md": "sha256:0efbf35581c559359e755b204778b64a289dab4d20dadc1cba3d5b5c995b5f01",
|
|
@@ -17452,7 +17819,7 @@ var init_harnesstrim = __esm({
|
|
|
17452
17819
|
{
|
|
17453
17820
|
capability: "shell.output.reduce",
|
|
17454
17821
|
mode: "exclusive",
|
|
17455
|
-
harnesses: [
|
|
17822
|
+
harnesses: [CLAUDE3, CODEX3],
|
|
17456
17823
|
// `HOOK_MATCHER = "Bash"` and `CODEX_HOOK_MATCHER = "^Bash$"`, per RFC 0003 §The table is an
|
|
17457
17824
|
// intent. One surface each, and no selector narrows it.
|
|
17458
17825
|
surfaces: [{ toolFamily: "Bash", interceptionPoint: "post-tool-use" }],
|
|
@@ -17482,14 +17849,14 @@ var init_harnesstrim = __esm({
|
|
|
17482
17849
|
],
|
|
17483
17850
|
harnesses: [
|
|
17484
17851
|
{
|
|
17485
|
-
harness:
|
|
17486
|
-
testedVersions: { minimum: "2.
|
|
17487
|
-
verificationTier: "
|
|
17852
|
+
harness: CLAUDE3,
|
|
17853
|
+
testedVersions: { minimum: "2.1.274", maximum: "2.1.274" },
|
|
17854
|
+
verificationTier: "canary"
|
|
17488
17855
|
},
|
|
17489
17856
|
{
|
|
17490
|
-
harness:
|
|
17491
|
-
testedVersions: { minimum: "0.
|
|
17492
|
-
verificationTier: "
|
|
17857
|
+
harness: CODEX3,
|
|
17858
|
+
testedVersions: { minimum: "0.159.0", maximum: "0.159.0" },
|
|
17859
|
+
verificationTier: "canary"
|
|
17493
17860
|
},
|
|
17494
17861
|
{
|
|
17495
17862
|
harness: OPENCODE2,
|
|
@@ -17531,11 +17898,9 @@ var init_harnesstrim = __esm({
|
|
|
17531
17898
|
/**
|
|
17532
17899
|
* One review per harness — PLAN §15 item 46b.
|
|
17533
17900
|
*
|
|
17534
|
-
*
|
|
17535
|
-
*
|
|
17536
|
-
*
|
|
17537
|
-
* skips `AGENTS.md` exactly as the Claude one skips `CLAUDE.md`. What differs is the boundary and
|
|
17538
|
-
* the protected paths, which is precisely why one review could not describe both.
|
|
17901
|
+
* HarnessTrim 0.3.1 declares the same seven skill artifacts on Claude and Codex, byte for byte.
|
|
17902
|
+
* The delegated invocation omits runtime hooks and instructions; Token Harness adds the
|
|
17903
|
+
* versioned PostToolUse hook through the harness adapter and owns that exact JSON entry.
|
|
17539
17904
|
*
|
|
17540
17905
|
* OpenCode is absent on purpose. Its installer writes `.opencode/plugin/harnesstrim.ts` and
|
|
17541
17906
|
* `.opencode/package.json` *and runs an npm install*, so the containment boundary would hold a
|
|
@@ -17570,13 +17935,14 @@ var init_harnesstrim = __esm({
|
|
|
17570
17935
|
args: ["--no-instructions"]
|
|
17571
17936
|
}
|
|
17572
17937
|
};
|
|
17573
|
-
TESTED_UPSTREAM = "0.
|
|
17938
|
+
TESTED_UPSTREAM = "0.3.1";
|
|
17574
17939
|
TESTED_VERSIONS = { minimum: "0.0.5", maximum: TESTED_UPSTREAM };
|
|
17575
17940
|
SURFACE_ANCHORS = {
|
|
17576
17941
|
"post-tool-use": "PostToolUse",
|
|
17577
17942
|
"tool-execute-after": "tool.execute.after"
|
|
17578
17943
|
};
|
|
17579
17944
|
VERSION_PATTERN6 = /(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)/;
|
|
17945
|
+
HARNESSTRIM_HOOK_COMMAND = /^(?:"?[^"\n]*[\\/]?harnesstrim(?:\.cmd|\.exe)?"?|harnesstrim(?:\.cmd|\.exe)?)\s+hook\s+(claude|codex)(?:\s+(.*))?$/i;
|
|
17580
17946
|
harnesstrimAdapter = {
|
|
17581
17947
|
manifest: MANIFEST6,
|
|
17582
17948
|
detect: detect6,
|
|
@@ -17590,7 +17956,7 @@ var init_harnesstrim = __esm({
|
|
|
17590
17956
|
});
|
|
17591
17957
|
|
|
17592
17958
|
// packages/adapters/dist/src/providers/rtk-plan.js
|
|
17593
|
-
function
|
|
17959
|
+
function hookListPointer2(eventName) {
|
|
17594
17960
|
return `hooks.${eventName.replace(/\./g, "\\.")}`;
|
|
17595
17961
|
}
|
|
17596
17962
|
function hookEntryFor(harnessId2, matcher, restoreNativeHookOnUninstall = false) {
|
|
@@ -17607,7 +17973,7 @@ function hookEntryFor(harnessId2, matcher, restoreNativeHookOnUninstall = false)
|
|
|
17607
17973
|
function hookActivationNote(target) {
|
|
17608
17974
|
return target.harness.id === "codex" ? ". After applying, manually enable and trust this hook in Codex; Token Harness writes hooks.json but cannot activate the hook or grant trust" : "";
|
|
17609
17975
|
}
|
|
17610
|
-
function
|
|
17976
|
+
function matcherCoversFamily3(matcher, family) {
|
|
17611
17977
|
if (matcher === family)
|
|
17612
17978
|
return true;
|
|
17613
17979
|
try {
|
|
@@ -17637,12 +18003,13 @@ function planTargets(context, request) {
|
|
|
17637
18003
|
scope: owned.scope,
|
|
17638
18004
|
harness,
|
|
17639
18005
|
eventName: point.eventName,
|
|
18006
|
+
matcher: hookMatcherForFamily(harness, owned.scope.toolFamily),
|
|
17640
18007
|
configPath
|
|
17641
18008
|
});
|
|
17642
18009
|
}
|
|
17643
18010
|
if (context.facts.os === "windows") {
|
|
17644
18011
|
for (const target of [...targets.values()]) {
|
|
17645
|
-
if (target.harness.id !==
|
|
18012
|
+
if (target.harness.id !== CLAUDE4 || target.scope.toolFamily !== BASH)
|
|
17646
18013
|
continue;
|
|
17647
18014
|
if (!target.harness.toolFamilies.some((family) => family.id === POWERSHELL))
|
|
17648
18015
|
continue;
|
|
@@ -17651,14 +18018,15 @@ function planTargets(context, request) {
|
|
|
17651
18018
|
continue;
|
|
17652
18019
|
targets.set(key, {
|
|
17653
18020
|
...target,
|
|
17654
|
-
scope: { ...target.scope, toolFamily: POWERSHELL }
|
|
18021
|
+
scope: { ...target.scope, toolFamily: POWERSHELL },
|
|
18022
|
+
matcher: hookMatcherForFamily(target.harness, POWERSHELL)
|
|
17655
18023
|
});
|
|
17656
18024
|
}
|
|
17657
18025
|
}
|
|
17658
18026
|
return [...targets.values()];
|
|
17659
18027
|
}
|
|
17660
18028
|
function alreadyRegistered(context, target, allowRegexCoverage) {
|
|
17661
|
-
return context.harnessConfigs.some((config) => config.harnessId === target.harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scope.interceptionPoint) && config.matchers.some((matcher) => allowRegexCoverage ?
|
|
18029
|
+
return context.harnessConfigs.some((config) => config.harnessId === target.harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scope.interceptionPoint) && config.matchers.some((matcher) => allowRegexCoverage ? matcherCoversFamily3(matcher, target.scope.toolFamily) : matcher === target.scope.toolFamily) && (config.hookCommands ?? []).some((entry) => entry.eventName === target.eventName && entry.matcher !== null && (allowRegexCoverage ? matcherCoversFamily3(entry.matcher, target.scope.toolFamily) : entry.matcher === target.matcher) && isRtkAttributionCommand(entry.command, target.harness.id)));
|
|
17662
18030
|
}
|
|
17663
18031
|
function isRtkAttributionCommand(command, harness) {
|
|
17664
18032
|
return new RegExp(`^token-harness __internal-rtk-hook ${harness}(?: --restore-rtk)?$`, "i").test(command.trim());
|
|
@@ -17671,7 +18039,7 @@ function deterministicId(parts) {
|
|
|
17671
18039
|
return digest.slice(digest.indexOf(":") + 1, digest.indexOf(":") + 9);
|
|
17672
18040
|
}
|
|
17673
18041
|
function hookAction(target, entry) {
|
|
17674
|
-
const pointer =
|
|
18042
|
+
const pointer = hookListPointer2(target.eventName);
|
|
17675
18043
|
return {
|
|
17676
18044
|
kind: "merge-json",
|
|
17677
18045
|
id: deterministicId([
|
|
@@ -17773,7 +18141,7 @@ function restoreNativeHookAction(target, current) {
|
|
|
17773
18141
|
};
|
|
17774
18142
|
}
|
|
17775
18143
|
function removalAction(target, entry) {
|
|
17776
|
-
const pointer =
|
|
18144
|
+
const pointer = hookListPointer2(target.eventName);
|
|
17777
18145
|
const reverses = deterministicId([
|
|
17778
18146
|
"rtk",
|
|
17779
18147
|
"hook",
|
|
@@ -17857,13 +18225,13 @@ function buildRtkPlan(input) {
|
|
|
17857
18225
|
const targetHarnesses = [...new Set(targets.map((target) => target.harness.id))];
|
|
17858
18226
|
if (request.desiredState === "absent") {
|
|
17859
18227
|
for (const target of targets) {
|
|
17860
|
-
const existing = context.harnessConfigs.flatMap((config) => config.hookCommands ?? []).find((entry) => entry.eventName === target.eventName && entry.matcher === target.
|
|
18228
|
+
const existing = context.harnessConfigs.flatMap((config) => config.hookCommands ?? []).find((entry) => entry.eventName === target.eventName && entry.matcher === target.matcher && isRtkAttributionCommand(entry.command, target.harness.id));
|
|
17861
18229
|
if (existing === void 0)
|
|
17862
18230
|
continue;
|
|
17863
18231
|
if (existing.command.endsWith(" --restore-rtk")) {
|
|
17864
18232
|
actions.push(restoreNativeHookAction(target, existing));
|
|
17865
18233
|
} else {
|
|
17866
|
-
actions.push(removalAction(target, hookEntryFor(target.harness.id, target.
|
|
18234
|
+
actions.push(removalAction(target, hookEntryFor(target.harness.id, target.matcher)));
|
|
17867
18235
|
}
|
|
17868
18236
|
}
|
|
17869
18237
|
return {
|
|
@@ -17899,7 +18267,7 @@ function buildRtkPlan(input) {
|
|
|
17899
18267
|
for (const target of targets) {
|
|
17900
18268
|
if (alreadyRegistered(context, target, true))
|
|
17901
18269
|
continue;
|
|
17902
|
-
const matchingEntries = context.harnessConfigs.filter((config) => config.harnessId === target.harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scope.interceptionPoint)).flatMap((config) => config.hookCommands ?? []).filter((entry) => entry.eventName === target.eventName && entry.matcher !== null &&
|
|
18270
|
+
const matchingEntries = context.harnessConfigs.filter((config) => config.harnessId === target.harness.id && config.configPath === target.configPath && config.interceptionPoints.includes(target.scope.interceptionPoint)).flatMap((config) => config.hookCommands ?? []).filter((entry) => entry.eventName === target.eventName && entry.matcher !== null && matcherCoversFamily3(entry.matcher, target.scope.toolFamily) && input.identifiesCommand(entry.command));
|
|
17903
18271
|
const native = matchingEntries.find((entry) => isCanonicalNativeHook(entry.command, target.harness.id));
|
|
17904
18272
|
if (native !== void 0) {
|
|
17905
18273
|
if (!migratedPointers.has(native.commandPointer)) {
|
|
@@ -17931,7 +18299,7 @@ function buildRtkPlan(input) {
|
|
|
17931
18299
|
}));
|
|
17932
18300
|
continue;
|
|
17933
18301
|
}
|
|
17934
|
-
actions.push(hookAction(target, hookEntryFor(target.harness.id, target.
|
|
18302
|
+
actions.push(hookAction(target, hookEntryFor(target.harness.id, target.matcher)));
|
|
17935
18303
|
}
|
|
17936
18304
|
return {
|
|
17937
18305
|
providerId: "rtk",
|
|
@@ -17941,14 +18309,15 @@ function buildRtkPlan(input) {
|
|
|
17941
18309
|
targetHarnesses: actions.length === 0 ? [] : targetHarnesses
|
|
17942
18310
|
};
|
|
17943
18311
|
}
|
|
17944
|
-
var RTK_HOOK_PROXY_COMMAND, RTK_NATIVE_HOOK_PREFIX,
|
|
18312
|
+
var RTK_HOOK_PROXY_COMMAND, RTK_NATIVE_HOOK_PREFIX, CLAUDE4, BASH, POWERSHELL;
|
|
17945
18313
|
var init_rtk_plan = __esm({
|
|
17946
18314
|
"packages/adapters/dist/src/providers/rtk-plan.js"() {
|
|
17947
18315
|
"use strict";
|
|
17948
18316
|
init_src();
|
|
18317
|
+
init_hook_plan();
|
|
17949
18318
|
RTK_HOOK_PROXY_COMMAND = "token-harness __internal-rtk-hook";
|
|
17950
18319
|
RTK_NATIVE_HOOK_PREFIX = "rtk hook";
|
|
17951
|
-
|
|
18320
|
+
CLAUDE4 = "claude";
|
|
17952
18321
|
BASH = "Bash";
|
|
17953
18322
|
POWERSHELL = "PowerShell";
|
|
17954
18323
|
}
|
|
@@ -18051,12 +18420,12 @@ async function detect7(context) {
|
|
|
18051
18420
|
}));
|
|
18052
18421
|
}
|
|
18053
18422
|
const codexHookSupported = version3.version === RTK_CODEX_HOOK_VERSION;
|
|
18054
|
-
const codexConfiguredWithoutHookSupport = configured.includes(
|
|
18423
|
+
const codexConfiguredWithoutHookSupport = configured.includes(CODEX4) && !codexHookSupported;
|
|
18055
18424
|
if (codexConfiguredWithoutHookSupport) {
|
|
18056
18425
|
warnings.push(diagnostic({
|
|
18057
18426
|
severity: "error",
|
|
18058
18427
|
code: "rtk-codex-hook-unsupported",
|
|
18059
|
-
subject:
|
|
18428
|
+
subject: CODEX4,
|
|
18060
18429
|
message: `RTK ${String(version3.version)} does not provide the Codex hook; its configuration entry cannot capture commands`,
|
|
18061
18430
|
remediation: `Upgrade RTK to ${RTK_CODEX_HOOK_VERSION}, then refresh and apply the attribution plan`
|
|
18062
18431
|
}));
|
|
@@ -18106,7 +18475,7 @@ async function detect7(context) {
|
|
|
18106
18475
|
* its integration is a plugin module installed by `rtk init -g --opencode`, which this build
|
|
18107
18476
|
* deliberately does not delegate without a reviewed write set.
|
|
18108
18477
|
*/
|
|
18109
|
-
assignableHarnesses: version3.version === null || codexHookSupported ? [
|
|
18478
|
+
assignableHarnesses: version3.version === null || codexHookSupported ? [CLAUDE5, CODEX4] : [CLAUDE5],
|
|
18110
18479
|
evidence: evidenceItems,
|
|
18111
18480
|
warnings
|
|
18112
18481
|
};
|
|
@@ -18124,7 +18493,7 @@ async function verify7(context) {
|
|
|
18124
18493
|
remediation: version3.version === null ? "Install RTK, or add it to PATH" : null
|
|
18125
18494
|
});
|
|
18126
18495
|
const configured = harnessesWiredToRtk(context.harnessConfigs);
|
|
18127
|
-
const configuredSupported = configured.filter((harness) => harness ===
|
|
18496
|
+
const configuredSupported = configured.filter((harness) => harness === CLAUDE5 || harness === CODEX4 && version3.version === RTK_CODEX_HOOK_VERSION);
|
|
18128
18497
|
checks.push({
|
|
18129
18498
|
id: "hook-registered",
|
|
18130
18499
|
status: configuredSupported.length > 0 ? "pass" : configured.length > 0 ? "fail" : "not-exercised",
|
|
@@ -18138,8 +18507,8 @@ async function verify7(context) {
|
|
|
18138
18507
|
for (const harness of TRACKED_HARNESSES) {
|
|
18139
18508
|
if (!configured.includes(harness))
|
|
18140
18509
|
continue;
|
|
18141
|
-
const label = harness ===
|
|
18142
|
-
const supported = harness !==
|
|
18510
|
+
const label = harness === CLAUDE5 ? "Claude Code" : "Codex";
|
|
18511
|
+
const supported = harness !== CODEX4 || version3.version === RTK_CODEX_HOOK_VERSION;
|
|
18143
18512
|
if (!supported) {
|
|
18144
18513
|
checks.push({
|
|
18145
18514
|
id: `rtk-attribution-${harness}`,
|
|
@@ -18566,17 +18935,17 @@ async function plan2(context, request) {
|
|
|
18566
18935
|
hookProxyAvailable
|
|
18567
18936
|
});
|
|
18568
18937
|
}
|
|
18569
|
-
var RTK2,
|
|
18938
|
+
var RTK2, CLAUDE5, CODEX4, OPENCODE3, TRACKED_HARNESSES, RTK_CODEX_HOOK_VERSION, MANIFEST7, TESTED_VERSIONS2, VERSION_PATTERN7, HOOK_COMMAND_PATTERN2, PLUGIN_MODULE_PATTERN3, HARNESS_ACTIVITY_QUERY, STALE_RECEIPT_DAYS, HISTORY_QUERY, GENERATION_QUERY, IMPORT_BATCH_SIZE, SOURCE_LABEL, rtkAdapter;
|
|
18570
18939
|
var init_rtk = __esm({
|
|
18571
18940
|
"packages/adapters/dist/src/providers/rtk.js"() {
|
|
18572
18941
|
"use strict";
|
|
18573
18942
|
init_src();
|
|
18574
18943
|
init_rtk_plan();
|
|
18575
18944
|
RTK2 = providerId("rtk");
|
|
18576
|
-
|
|
18577
|
-
|
|
18945
|
+
CLAUDE5 = harnessId("claude");
|
|
18946
|
+
CODEX4 = harnessId("codex");
|
|
18578
18947
|
OPENCODE3 = harnessId("opencode");
|
|
18579
|
-
TRACKED_HARNESSES = [
|
|
18948
|
+
TRACKED_HARNESSES = [CLAUDE5, CODEX4];
|
|
18580
18949
|
RTK_CODEX_HOOK_VERSION = "0.50.0";
|
|
18581
18950
|
MANIFEST7 = {
|
|
18582
18951
|
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
@@ -18590,7 +18959,7 @@ var init_rtk = __esm({
|
|
|
18590
18959
|
{
|
|
18591
18960
|
capability: "shell.command.rewrite",
|
|
18592
18961
|
mode: "exclusive",
|
|
18593
|
-
harnesses: [
|
|
18962
|
+
harnesses: [CLAUDE5],
|
|
18594
18963
|
// The portable resolver surface remains Bash. Windows PowerShell coverage is added by
|
|
18595
18964
|
// the planner only on Windows, because ProviderManifest capabilities are not platform-scoped.
|
|
18596
18965
|
// The native processor and that Windows-only plan path are covered by the live fixture below.
|
|
@@ -18603,7 +18972,7 @@ var init_rtk = __esm({
|
|
|
18603
18972
|
{
|
|
18604
18973
|
capability: "shell.output.reduce",
|
|
18605
18974
|
mode: "exclusive",
|
|
18606
|
-
harnesses: [
|
|
18975
|
+
harnesses: [CLAUDE5],
|
|
18607
18976
|
// Same portable Bash surface. On Windows the planner adds PowerShell as a platform-only
|
|
18608
18977
|
// companion matcher; the live fixture below proves the same native processor handles both.
|
|
18609
18978
|
surfaces: [{ toolFamily: "Bash", interceptionPoint: "pre-tool-use" }],
|
|
@@ -18622,7 +18991,7 @@ var init_rtk = __esm({
|
|
|
18622
18991
|
{
|
|
18623
18992
|
capability: "shell.command.rewrite",
|
|
18624
18993
|
mode: "exclusive",
|
|
18625
|
-
harnesses: [
|
|
18994
|
+
harnesses: [CODEX4],
|
|
18626
18995
|
surfaces: [{ toolFamily: "Bash", interceptionPoint: "pre-tool-use" }],
|
|
18627
18996
|
evidence: {
|
|
18628
18997
|
sourceReference: "docs/spikes/rtk-codex-upstream-contract.md",
|
|
@@ -18632,7 +19001,7 @@ var init_rtk = __esm({
|
|
|
18632
19001
|
{
|
|
18633
19002
|
capability: "shell.output.reduce",
|
|
18634
19003
|
mode: "exclusive",
|
|
18635
|
-
harnesses: [
|
|
19004
|
+
harnesses: [CODEX4],
|
|
18636
19005
|
surfaces: [{ toolFamily: "Bash", interceptionPoint: "pre-tool-use" }],
|
|
18637
19006
|
evidence: {
|
|
18638
19007
|
sourceReference: "docs/spikes/rtk-codex-upstream-contract.md",
|
|
@@ -18691,15 +19060,14 @@ var init_rtk = __esm({
|
|
|
18691
19060
|
],
|
|
18692
19061
|
harnesses: [
|
|
18693
19062
|
{
|
|
18694
|
-
harness:
|
|
18695
|
-
testedVersions: { minimum: "2.
|
|
19063
|
+
harness: CLAUDE5,
|
|
19064
|
+
testedVersions: { minimum: "2.1.274", maximum: "2.1.274" },
|
|
18696
19065
|
verificationTier: "canary"
|
|
18697
19066
|
},
|
|
18698
19067
|
{
|
|
18699
|
-
harness:
|
|
18700
|
-
// RTK
|
|
18701
|
-
|
|
18702
|
-
testedVersions: { minimum: "0.146.0", maximum: "0.146.0" },
|
|
19068
|
+
harness: CODEX4,
|
|
19069
|
+
// RTK 0.50.0's native hook was exercised against the installed Codex 0.159.0 schema.
|
|
19070
|
+
testedVersions: { minimum: "0.159.0", maximum: "0.159.0" },
|
|
18703
19071
|
verificationTier: "canary"
|
|
18704
19072
|
},
|
|
18705
19073
|
{
|
|
@@ -20206,7 +20574,7 @@ async function mcptoonDetection(context) {
|
|
|
20206
20574
|
const observation = await observeMcptoonManagedRuntime(context);
|
|
20207
20575
|
const configuredHarnesses = [];
|
|
20208
20576
|
if (observation.ready) {
|
|
20209
|
-
for (const harness of [
|
|
20577
|
+
for (const harness of [CLAUDE6, CODEX5]) {
|
|
20210
20578
|
const verification = await verifyMcptoonManagedActivation(context, harness);
|
|
20211
20579
|
if (verification.state === "verified")
|
|
20212
20580
|
configuredHarnesses.push(harness);
|
|
@@ -20239,7 +20607,7 @@ async function mcptoonDetection(context) {
|
|
|
20239
20607
|
unmanagedHarnessesConfigured: [],
|
|
20240
20608
|
supportsUnmanagedHarnesses: false,
|
|
20241
20609
|
managedByTokenHarness: false,
|
|
20242
|
-
assignableHarnesses: observation.ready || canInstall ? [
|
|
20610
|
+
assignableHarnesses: observation.ready || canInstall ? [CLAUDE6, CODEX5] : [],
|
|
20243
20611
|
evidence: [],
|
|
20244
20612
|
warnings
|
|
20245
20613
|
};
|
|
@@ -20248,7 +20616,7 @@ async function gitnexusDetection(context) {
|
|
|
20248
20616
|
const observation = await observeGitNexusManagedRuntime(context);
|
|
20249
20617
|
const configuredHarnesses = [];
|
|
20250
20618
|
if (observation.ready) {
|
|
20251
|
-
for (const harness of [
|
|
20619
|
+
for (const harness of [CLAUDE6, CODEX5]) {
|
|
20252
20620
|
const verification = await verifyGitNexusManagedMcpActivation(context, harness);
|
|
20253
20621
|
if (verification.state === "verified")
|
|
20254
20622
|
configuredHarnesses.push(harness);
|
|
@@ -20281,7 +20649,7 @@ async function gitnexusDetection(context) {
|
|
|
20281
20649
|
unmanagedHarnessesConfigured: [],
|
|
20282
20650
|
supportsUnmanagedHarnesses: false,
|
|
20283
20651
|
managedByTokenHarness: false,
|
|
20284
|
-
assignableHarnesses: observation.ready || canInstall ? [
|
|
20652
|
+
assignableHarnesses: observation.ready || canInstall ? [CLAUDE6, CODEX5] : [],
|
|
20285
20653
|
evidence: [],
|
|
20286
20654
|
warnings
|
|
20287
20655
|
};
|
|
@@ -20289,7 +20657,7 @@ async function gitnexusDetection(context) {
|
|
|
20289
20657
|
async function mcptoonVerify(context) {
|
|
20290
20658
|
const checks = [];
|
|
20291
20659
|
let achieved = null;
|
|
20292
|
-
for (const harness of [
|
|
20660
|
+
for (const harness of [CLAUDE6, CODEX5]) {
|
|
20293
20661
|
const result6 = await verifyMcptoonManagedActivation(context, harness);
|
|
20294
20662
|
if (result6.state === "verified")
|
|
20295
20663
|
achieved = "config-only";
|
|
@@ -20316,7 +20684,7 @@ async function mcptoonVerify(context) {
|
|
|
20316
20684
|
async function gitnexusVerify(context) {
|
|
20317
20685
|
const checks = [];
|
|
20318
20686
|
let achieved = null;
|
|
20319
|
-
for (const harness of [
|
|
20687
|
+
for (const harness of [CLAUDE6, CODEX5]) {
|
|
20320
20688
|
const result6 = await verifyGitNexusManagedMcpActivation(context, harness);
|
|
20321
20689
|
if (result6.state === "verified")
|
|
20322
20690
|
achieved = "config-only";
|
|
@@ -20355,7 +20723,7 @@ async function mcptoonPlan(context, request) {
|
|
|
20355
20723
|
const actions = [];
|
|
20356
20724
|
const targets = [];
|
|
20357
20725
|
for (const harness of request.harnesses.map((item) => item.id)) {
|
|
20358
|
-
if (harness !==
|
|
20726
|
+
if (harness !== CLAUDE6 && harness !== CODEX5)
|
|
20359
20727
|
continue;
|
|
20360
20728
|
const plan6 = await planMcptoonManagedActivation(context, harness);
|
|
20361
20729
|
if (plan6.actions.length === 0)
|
|
@@ -20382,7 +20750,7 @@ async function gitnexusPlan(context, request) {
|
|
|
20382
20750
|
const actions = [];
|
|
20383
20751
|
const targets = [];
|
|
20384
20752
|
for (const harness of request.harnesses.map((item) => item.id)) {
|
|
20385
|
-
if (harness !==
|
|
20753
|
+
if (harness !== CLAUDE6 && harness !== CODEX5)
|
|
20386
20754
|
continue;
|
|
20387
20755
|
const plan6 = await planGitNexusManagedMcpActivation(context, harness);
|
|
20388
20756
|
if (plan6.actions.length === 0)
|
|
@@ -20397,7 +20765,7 @@ async function gitnexusPlan(context, request) {
|
|
|
20397
20765
|
targetHarnesses: [...new Set(targets)]
|
|
20398
20766
|
};
|
|
20399
20767
|
}
|
|
20400
|
-
var MCPTOON, GITNEXUS, HEADROOM,
|
|
20768
|
+
var MCPTOON, GITNEXUS, HEADROOM, CLAUDE6, CODEX5, MCPTOON_MANIFEST, GITNEXUS_MANIFEST, HEADROOM_MANIFEST, mcptoonAdapter, gitnexusAdapter;
|
|
20401
20769
|
var init_managed_optimization_tools = __esm({
|
|
20402
20770
|
"packages/adapters/dist/src/providers/managed-optimization-tools.js"() {
|
|
20403
20771
|
"use strict";
|
|
@@ -20410,8 +20778,8 @@ var init_managed_optimization_tools = __esm({
|
|
|
20410
20778
|
MCPTOON = providerId("mcptoon");
|
|
20411
20779
|
GITNEXUS = providerId("gitnexus");
|
|
20412
20780
|
HEADROOM = providerId("headroom");
|
|
20413
|
-
|
|
20414
|
-
|
|
20781
|
+
CLAUDE6 = harnessId("claude");
|
|
20782
|
+
CODEX5 = harnessId("codex");
|
|
20415
20783
|
MCPTOON_MANIFEST = {
|
|
20416
20784
|
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
20417
20785
|
id: MCPTOON,
|
|
@@ -20424,12 +20792,12 @@ var init_managed_optimization_tools = __esm({
|
|
|
20424
20792
|
platforms: platforms(),
|
|
20425
20793
|
harnesses: [
|
|
20426
20794
|
{
|
|
20427
|
-
harness:
|
|
20795
|
+
harness: CLAUDE6,
|
|
20428
20796
|
testedVersions: { minimum: "2.1.269", maximum: "2.1.269" },
|
|
20429
20797
|
verificationTier: "config-only"
|
|
20430
20798
|
},
|
|
20431
20799
|
{
|
|
20432
|
-
harness:
|
|
20800
|
+
harness: CODEX5,
|
|
20433
20801
|
testedVersions: { minimum: "0.152.1", maximum: "0.153.0" },
|
|
20434
20802
|
verificationTier: "config-only"
|
|
20435
20803
|
}
|
|
@@ -20463,12 +20831,12 @@ var init_managed_optimization_tools = __esm({
|
|
|
20463
20831
|
platforms: platforms(),
|
|
20464
20832
|
harnesses: [
|
|
20465
20833
|
{
|
|
20466
|
-
harness:
|
|
20834
|
+
harness: CLAUDE6,
|
|
20467
20835
|
testedVersions: { minimum: "2.1.269", maximum: "2.1.269" },
|
|
20468
20836
|
verificationTier: "config-only"
|
|
20469
20837
|
},
|
|
20470
20838
|
{
|
|
20471
|
-
harness:
|
|
20839
|
+
harness: CODEX5,
|
|
20472
20840
|
testedVersions: { minimum: "0.153.0", maximum: "0.153.0" },
|
|
20473
20841
|
verificationTier: "config-only"
|
|
20474
20842
|
}
|
|
@@ -20542,7 +20910,7 @@ async function plan3(context, request) {
|
|
|
20542
20910
|
const actions = [];
|
|
20543
20911
|
const targets = [];
|
|
20544
20912
|
for (const harness of request.harnesses.map((item) => item.id)) {
|
|
20545
|
-
if (harness !==
|
|
20913
|
+
if (harness !== CLAUDE7 && harness !== CODEX6)
|
|
20546
20914
|
continue;
|
|
20547
20915
|
const target = gitnexusOwnedArtifact(context, harness);
|
|
20548
20916
|
if (target === null)
|
|
@@ -20559,15 +20927,15 @@ async function plan3(context, request) {
|
|
|
20559
20927
|
targetHarnesses: [...new Set(targets)]
|
|
20560
20928
|
};
|
|
20561
20929
|
}
|
|
20562
|
-
var
|
|
20930
|
+
var CLAUDE7, CODEX6, gitnexusManagedProviderAdapter;
|
|
20563
20931
|
var init_gitnexus_provider = __esm({
|
|
20564
20932
|
"packages/adapters/dist/src/providers/gitnexus-provider.js"() {
|
|
20565
20933
|
"use strict";
|
|
20566
20934
|
init_src();
|
|
20567
20935
|
init_managed_optimization_tools();
|
|
20568
20936
|
init_gitnexus_managed();
|
|
20569
|
-
|
|
20570
|
-
|
|
20937
|
+
CLAUDE7 = harnessId("claude");
|
|
20938
|
+
CODEX6 = harnessId("codex");
|
|
20571
20939
|
gitnexusManagedProviderAdapter = {
|
|
20572
20940
|
...gitnexusAdapter,
|
|
20573
20941
|
plan: plan3
|
|
@@ -21085,7 +21453,7 @@ async function detect8(context) {
|
|
|
21085
21453
|
const runtime = await headroomManagedMcpRuntime(context);
|
|
21086
21454
|
const configuredHarnesses = [];
|
|
21087
21455
|
if (runtime.ok) {
|
|
21088
|
-
for (const harness of [
|
|
21456
|
+
for (const harness of [CLAUDE8, CODEX7]) {
|
|
21089
21457
|
const verification = await verifyHeadroomManagedMcpActivation(context, harness);
|
|
21090
21458
|
if (verification.state === "verified")
|
|
21091
21459
|
configuredHarnesses.push(harness);
|
|
@@ -21124,7 +21492,7 @@ async function detect8(context) {
|
|
|
21124
21492
|
unmanagedHarnessesConfigured: [],
|
|
21125
21493
|
supportsUnmanagedHarnesses: false,
|
|
21126
21494
|
managedByTokenHarness: false,
|
|
21127
|
-
assignableHarnesses: runtime.ok || canInstall ? [
|
|
21495
|
+
assignableHarnesses: runtime.ok || canInstall ? [CLAUDE8, CODEX7] : [],
|
|
21128
21496
|
evidence: [],
|
|
21129
21497
|
warnings
|
|
21130
21498
|
};
|
|
@@ -21156,7 +21524,7 @@ function dedupe(actions) {
|
|
|
21156
21524
|
}
|
|
21157
21525
|
async function plan4(context, request) {
|
|
21158
21526
|
if (request.desiredState === "absent") {
|
|
21159
|
-
const targets = request.harnesses.map((item) => item.id).filter((id) => id ===
|
|
21527
|
+
const targets = request.harnesses.map((item) => item.id).filter((id) => id === CLAUDE8 || id === CODEX7);
|
|
21160
21528
|
return {
|
|
21161
21529
|
providerId: HEADROOM2,
|
|
21162
21530
|
desiredState: "absent",
|
|
@@ -21167,7 +21535,7 @@ async function plan4(context, request) {
|
|
|
21167
21535
|
const actions = [];
|
|
21168
21536
|
const targetHarnesses = [];
|
|
21169
21537
|
for (const harness of request.harnesses.map((item) => item.id)) {
|
|
21170
|
-
if (harness !==
|
|
21538
|
+
if (harness !== CLAUDE8 && harness !== CODEX7)
|
|
21171
21539
|
continue;
|
|
21172
21540
|
const activation = await planHeadroomManagedMcpActivation(context, harness);
|
|
21173
21541
|
if (activation.actions.length === 0)
|
|
@@ -21185,7 +21553,7 @@ async function plan4(context, request) {
|
|
|
21185
21553
|
async function verify8(context) {
|
|
21186
21554
|
const checks = [];
|
|
21187
21555
|
let achieved = null;
|
|
21188
|
-
for (const harness of [
|
|
21556
|
+
for (const harness of [CLAUDE8, CODEX7]) {
|
|
21189
21557
|
const result6 = await verifyHeadroomManagedMcpActivation(context, harness);
|
|
21190
21558
|
if (result6.state === "verified")
|
|
21191
21559
|
achieved = "config-only";
|
|
@@ -21220,7 +21588,7 @@ function unavailableMetrics2() {
|
|
|
21220
21588
|
diagnostics: []
|
|
21221
21589
|
};
|
|
21222
21590
|
}
|
|
21223
|
-
var HEADROOM2,
|
|
21591
|
+
var HEADROOM2, CLAUDE8, CODEX7, HEADROOM_MANIFEST2, headroomManagedProviderAdapter;
|
|
21224
21592
|
var init_headroom_provider = __esm({
|
|
21225
21593
|
"packages/adapters/dist/src/providers/headroom-provider.js"() {
|
|
21226
21594
|
"use strict";
|
|
@@ -21228,8 +21596,8 @@ var init_headroom_provider = __esm({
|
|
|
21228
21596
|
init_headroom_candidate();
|
|
21229
21597
|
init_headroom_managed();
|
|
21230
21598
|
HEADROOM2 = providerId("headroom");
|
|
21231
|
-
|
|
21232
|
-
|
|
21599
|
+
CLAUDE8 = harnessId("claude");
|
|
21600
|
+
CODEX7 = harnessId("codex");
|
|
21233
21601
|
HEADROOM_MANIFEST2 = {
|
|
21234
21602
|
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
21235
21603
|
id: HEADROOM2,
|
|
@@ -21246,12 +21614,12 @@ var init_headroom_provider = __esm({
|
|
|
21246
21614
|
],
|
|
21247
21615
|
harnesses: [
|
|
21248
21616
|
{
|
|
21249
|
-
harness:
|
|
21617
|
+
harness: CLAUDE8,
|
|
21250
21618
|
testedVersions: { minimum: "2.1.269", maximum: "2.1.269" },
|
|
21251
21619
|
verificationTier: "config-only"
|
|
21252
21620
|
},
|
|
21253
21621
|
{
|
|
21254
|
-
harness:
|
|
21622
|
+
harness: CODEX7,
|
|
21255
21623
|
testedVersions: { minimum: "0.153.0", maximum: "0.153.0" },
|
|
21256
21624
|
verificationTier: "config-only"
|
|
21257
21625
|
}
|
|
@@ -21285,7 +21653,7 @@ var init_headroom_provider = __esm({
|
|
|
21285
21653
|
|
|
21286
21654
|
// packages/adapters/dist/src/providers/mcptoon-provider.js
|
|
21287
21655
|
function removalAction3(context, harness) {
|
|
21288
|
-
if (harness ===
|
|
21656
|
+
if (harness === CLAUDE9) {
|
|
21289
21657
|
const path = context.fs.join(context.paths.home, ".claude", "skills", "mcptoon", "SKILL.md");
|
|
21290
21658
|
const target = {
|
|
21291
21659
|
kind: "owned-file",
|
|
@@ -21310,7 +21678,7 @@ function removalAction3(context, harness) {
|
|
|
21310
21678
|
target
|
|
21311
21679
|
};
|
|
21312
21680
|
}
|
|
21313
|
-
if (harness ===
|
|
21681
|
+
if (harness === CODEX8) {
|
|
21314
21682
|
const path = context.fs.join(context.projectRoot, "AGENTS.md");
|
|
21315
21683
|
const target = {
|
|
21316
21684
|
kind: "owned-marker-block",
|
|
@@ -21349,18 +21717,18 @@ async function plan5(context, request) {
|
|
|
21349
21717
|
providerId: mcptoonAdapter.manifest.id,
|
|
21350
21718
|
desiredState: "absent",
|
|
21351
21719
|
actions,
|
|
21352
|
-
targetHarnesses: request.harnesses.map((item) => item.id).filter((id) => id ===
|
|
21720
|
+
targetHarnesses: request.harnesses.map((item) => item.id).filter((id) => id === CLAUDE9 || id === CODEX8)
|
|
21353
21721
|
};
|
|
21354
21722
|
}
|
|
21355
|
-
var
|
|
21723
|
+
var CLAUDE9, CODEX8, mcptoonManagedProviderAdapter;
|
|
21356
21724
|
var init_mcptoon_provider = __esm({
|
|
21357
21725
|
"packages/adapters/dist/src/providers/mcptoon-provider.js"() {
|
|
21358
21726
|
"use strict";
|
|
21359
21727
|
init_src();
|
|
21360
21728
|
init_managed_optimization_tools();
|
|
21361
21729
|
init_mcptoon_managed();
|
|
21362
|
-
|
|
21363
|
-
|
|
21730
|
+
CLAUDE9 = harnessId("claude");
|
|
21731
|
+
CODEX8 = harnessId("codex");
|
|
21364
21732
|
mcptoonManagedProviderAdapter = {
|
|
21365
21733
|
...mcptoonAdapter,
|
|
21366
21734
|
plan: plan5
|
|
@@ -21489,7 +21857,19 @@ function parseHarnessTrimReceiptEnvelope(line) {
|
|
|
21489
21857
|
if (schemaVersion === 1 && (typeof record6["eventId"] !== "string" || record6["eventId"].length === 0)) {
|
|
21490
21858
|
return null;
|
|
21491
21859
|
}
|
|
21492
|
-
return {
|
|
21860
|
+
return {
|
|
21861
|
+
ts: record6["ts"],
|
|
21862
|
+
harness: record6["harness"],
|
|
21863
|
+
beforeChars: record6["beforeChars"],
|
|
21864
|
+
afterChars: record6["afterChars"],
|
|
21865
|
+
changed: typeof record6["changed"] === "boolean" ? record6["changed"] : null,
|
|
21866
|
+
reductionFailed: record6["reductionFailed"] === true
|
|
21867
|
+
};
|
|
21868
|
+
}
|
|
21869
|
+
function provesHarnessTrimReduction(event) {
|
|
21870
|
+
return !event.reductionFailed && event.afterChars < event.beforeChars && // Native receipts explicitly mark pass-throughs. Legacy receipts predate this bit, so a
|
|
21871
|
+
// strictly smaller after-size remains the only available evidence that the hook reduced it.
|
|
21872
|
+
event.changed !== false;
|
|
21493
21873
|
}
|
|
21494
21874
|
async function harnessTrimReceiptFor(context, harnessId2) {
|
|
21495
21875
|
for (const path of metricsLocations(context)) {
|
|
@@ -21498,9 +21878,15 @@ async function harnessTrimReceiptFor(context, harnessId2) {
|
|
|
21498
21878
|
continue;
|
|
21499
21879
|
const text3 = new TextDecoder().decode(await context.fs.readFile(path));
|
|
21500
21880
|
const matches = text3.split("\n").filter((line) => line.trim() !== "").map(parseHarnessTrimReceiptEnvelope).filter((event) => event !== null && event.harness === harnessId2);
|
|
21501
|
-
const
|
|
21502
|
-
if (
|
|
21503
|
-
|
|
21881
|
+
const latestAttempt = matches.at(-1);
|
|
21882
|
+
if (latestAttempt !== void 0) {
|
|
21883
|
+
const reductions = matches.filter(provesHarnessTrimReduction);
|
|
21884
|
+
return {
|
|
21885
|
+
observedAt: latestAttempt.ts,
|
|
21886
|
+
operations: reductions.length,
|
|
21887
|
+
attempts: matches.length,
|
|
21888
|
+
source: path
|
|
21889
|
+
};
|
|
21504
21890
|
}
|
|
21505
21891
|
}
|
|
21506
21892
|
return null;
|
|
@@ -21545,10 +21931,19 @@ function scopeCanaryCheck(check, input) {
|
|
|
21545
21931
|
remediation: input.runtimeConfigured ? "Enable telemetry on this runtime integration and use it on an output it can reduce." : "Skills or instructions alone do not write reduction telemetry; a compatible measurement path is required."
|
|
21546
21932
|
};
|
|
21547
21933
|
}
|
|
21934
|
+
if (input.receipt.operations === 0) {
|
|
21935
|
+
return {
|
|
21936
|
+
...check,
|
|
21937
|
+
status: "info",
|
|
21938
|
+
summary: `HarnessTrim observed ${String(input.receipt.attempts ?? 0)} ${input.harnessId} outputs, but none was reduced; latest attempt ${input.receipt.observedAt}`,
|
|
21939
|
+
achievedTier: null,
|
|
21940
|
+
remediation: "Run a canary that produces output the installed HarnessTrim reducer can shorten, then verify again."
|
|
21941
|
+
};
|
|
21942
|
+
}
|
|
21548
21943
|
return {
|
|
21549
21944
|
...check,
|
|
21550
21945
|
status: "pass",
|
|
21551
|
-
summary: `${String(input.receipt.operations)} reductions recorded for ${input.harnessId}, most recently ${input.receipt.observedAt}`,
|
|
21946
|
+
summary: `${String(input.receipt.operations)} reductions recorded for ${input.harnessId} from ${String(input.receipt.attempts ?? input.receipt.operations)} observed outputs, most recently ${input.receipt.observedAt}`,
|
|
21552
21947
|
achievedTier: "canary"
|
|
21553
21948
|
};
|
|
21554
21949
|
}
|
|
@@ -21597,9 +21992,13 @@ async function scopeProviderVerificationToHarness(context, verification, harness
|
|
|
21597
21992
|
const harnessTrim = verification.providerId === HARNESSTRIM4;
|
|
21598
21993
|
const runtimeConfigured = harnessTrim ? harnessesWiredToHarnessTrim(context.harnessConfigs).includes(harnessId2) : configured;
|
|
21599
21994
|
const attributableByExclusion = configured && configuredHarnesses.length === 1 && configuredHarnesses[0] === harnessId2;
|
|
21600
|
-
const receipt = !configured ? null : harnessTrim ? await harnessTrimReceiptFor(context, harnessId2) : attributableByExclusion ? verification.receipt : null;
|
|
21995
|
+
const receipt = !configured ? null : harnessTrim ? await harnessTrimReceiptFor(context, harnessId2) : verification.receipt?.harnessId !== void 0 ? verification.receipt.harnessId === harnessId2 ? verification.receipt : null : attributableByExclusion ? verification.receipt : null;
|
|
21601
21996
|
const providerHasAttributableReceipt = harnessTrim || attributableByExclusion;
|
|
21602
|
-
const
|
|
21997
|
+
const scopedSourceChecks = verification.providerId === RTK4 ? verification.checks.filter((check) => {
|
|
21998
|
+
const match = /^(?:rtk-attribution|receipt-freshness)-(claude|codex)$/.exec(check.id);
|
|
21999
|
+
return match === null || match[1] === harnessId2;
|
|
22000
|
+
}) : verification.checks;
|
|
22001
|
+
const checks = scopedSourceChecks.map((check) => scopeCanaryCheck(scopeIntegrationCheck(scopeHookCheck(check, harnessId2, harnessTrim ? runtimeConfigured : configured), { harnessId: harnessId2, configured, runtimeConfigured }), {
|
|
21603
22002
|
harnessId: harnessId2,
|
|
21604
22003
|
configured,
|
|
21605
22004
|
runtimeConfigured,
|
|
@@ -21614,13 +22013,14 @@ async function scopeProviderVerificationToHarness(context, verification, harness
|
|
|
21614
22013
|
checks
|
|
21615
22014
|
};
|
|
21616
22015
|
}
|
|
21617
|
-
var HARNESSTRIM4;
|
|
22016
|
+
var HARNESSTRIM4, RTK4;
|
|
21618
22017
|
var init_harness_verification = __esm({
|
|
21619
22018
|
"packages/adapters/dist/src/providers/harness-verification.js"() {
|
|
21620
22019
|
"use strict";
|
|
21621
22020
|
init_src();
|
|
21622
22021
|
init_harnesstrim();
|
|
21623
22022
|
HARNESSTRIM4 = providerId("harnesstrim");
|
|
22023
|
+
RTK4 = providerId("rtk");
|
|
21624
22024
|
}
|
|
21625
22025
|
});
|
|
21626
22026
|
|
|
@@ -21787,15 +22187,15 @@ async function runBudget(context) {
|
|
|
21787
22187
|
diagnostics: report.harnesses.flatMap((item) => item.diagnostics)
|
|
21788
22188
|
});
|
|
21789
22189
|
}
|
|
21790
|
-
var
|
|
22190
|
+
var CLAUDE10, CODEX9, BUDGET_HARNESSES;
|
|
21791
22191
|
var init_budget2 = __esm({
|
|
21792
22192
|
"apps/cli/dist/src/commands/budget.js"() {
|
|
21793
22193
|
"use strict";
|
|
21794
22194
|
init_src3();
|
|
21795
22195
|
init_src();
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
BUDGET_HARNESSES = /* @__PURE__ */ new Set([
|
|
22196
|
+
CLAUDE10 = harnessId("claude");
|
|
22197
|
+
CODEX9 = harnessId("codex");
|
|
22198
|
+
BUDGET_HARNESSES = /* @__PURE__ */ new Set([CLAUDE10, CODEX9]);
|
|
21799
22199
|
}
|
|
21800
22200
|
});
|
|
21801
22201
|
|
|
@@ -23883,12 +24283,12 @@ var init_context_owner_candidates = __esm({
|
|
|
23883
24283
|
});
|
|
23884
24284
|
|
|
23885
24285
|
// apps/cli/dist/src/commands/context-cost.js
|
|
23886
|
-
function nativeToolDeferral(harness, version3
|
|
23887
|
-
if (harness !==
|
|
24286
|
+
function nativeToolDeferral(harness, version3) {
|
|
24287
|
+
if (harness !== CODEX10)
|
|
23888
24288
|
return null;
|
|
23889
|
-
if (version3 === "0.146.0"
|
|
24289
|
+
if (version3 === "0.146.0") {
|
|
23890
24290
|
return {
|
|
23891
|
-
harnessId:
|
|
24291
|
+
harnessId: CODEX10,
|
|
23892
24292
|
mechanism: "native-tool-search",
|
|
23893
24293
|
state: "available",
|
|
23894
24294
|
scope: "mcp-tools",
|
|
@@ -23897,7 +24297,7 @@ function nativeToolDeferral(harness, version3, verdict) {
|
|
|
23897
24297
|
};
|
|
23898
24298
|
}
|
|
23899
24299
|
return {
|
|
23900
|
-
harnessId:
|
|
24300
|
+
harnessId: CODEX10,
|
|
23901
24301
|
mechanism: "native-tool-search",
|
|
23902
24302
|
state: "unknown",
|
|
23903
24303
|
scope: "mcp-tools",
|
|
@@ -24014,7 +24414,7 @@ async function codexInstructionFiles(context, observation) {
|
|
|
24014
24414
|
if (selected === null)
|
|
24015
24415
|
continue;
|
|
24016
24416
|
const item = await fileObservation(context, {
|
|
24017
|
-
harnessId:
|
|
24417
|
+
harnessId: CODEX10,
|
|
24018
24418
|
path: selected,
|
|
24019
24419
|
scope: "project",
|
|
24020
24420
|
loadedBytes: remaining2
|
|
@@ -24046,7 +24446,7 @@ async function claudeInstructionFiles(context) {
|
|
|
24046
24446
|
const results = [];
|
|
24047
24447
|
for (const candidate of candidates) {
|
|
24048
24448
|
const item = await fileObservation(context, {
|
|
24049
|
-
harnessId:
|
|
24449
|
+
harnessId: CLAUDE11,
|
|
24050
24450
|
path: candidate.path,
|
|
24051
24451
|
scope: candidate.scope,
|
|
24052
24452
|
loadedBytes: null
|
|
@@ -24113,16 +24513,16 @@ async function runContext(context) {
|
|
|
24113
24513
|
continue;
|
|
24114
24514
|
}
|
|
24115
24515
|
const observation = await adapter.observeContext(harnessContext, report.observedAt);
|
|
24116
|
-
const deferral = nativeToolDeferral(adapter.manifest.id, detection.version
|
|
24516
|
+
const deferral = nativeToolDeferral(adapter.manifest.id, detection.version);
|
|
24117
24517
|
if (deferral !== null)
|
|
24118
24518
|
observation.toolDeferral = deferral;
|
|
24119
24519
|
report.harnesses.push(observation);
|
|
24120
24520
|
}
|
|
24121
|
-
const codex = report.harnesses.find((item) => item.harnessId ===
|
|
24521
|
+
const codex = report.harnesses.find((item) => item.harnessId === CODEX10);
|
|
24122
24522
|
if (codex !== void 0 && codex.state !== "absent") {
|
|
24123
24523
|
report.instructions.push(...await codexInstructionFiles(context, codex));
|
|
24124
24524
|
}
|
|
24125
|
-
const claude = report.harnesses.find((item) => item.harnessId ===
|
|
24525
|
+
const claude = report.harnesses.find((item) => item.harnessId === CLAUDE11);
|
|
24126
24526
|
if (claude !== void 0 && claude.state !== "absent") {
|
|
24127
24527
|
report.instructions.push(...await claudeInstructionFiles(context));
|
|
24128
24528
|
}
|
|
@@ -24174,16 +24574,16 @@ async function runContext(context) {
|
|
|
24174
24574
|
]
|
|
24175
24575
|
});
|
|
24176
24576
|
}
|
|
24177
|
-
var
|
|
24577
|
+
var CLAUDE11, CODEX10, CONTEXT_HARNESSES;
|
|
24178
24578
|
var init_context_cost2 = __esm({
|
|
24179
24579
|
"apps/cli/dist/src/commands/context-cost.js"() {
|
|
24180
24580
|
"use strict";
|
|
24181
24581
|
init_src3();
|
|
24182
24582
|
init_src();
|
|
24183
24583
|
init_context_owner_candidates();
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
CONTEXT_HARNESSES = /* @__PURE__ */ new Set([
|
|
24584
|
+
CLAUDE11 = harnessId("claude");
|
|
24585
|
+
CODEX10 = harnessId("codex");
|
|
24586
|
+
CONTEXT_HARNESSES = /* @__PURE__ */ new Set([CLAUDE11, CODEX10]);
|
|
24187
24587
|
}
|
|
24188
24588
|
});
|
|
24189
24589
|
|
|
@@ -24204,7 +24604,7 @@ function stringArray(value3) {
|
|
|
24204
24604
|
return array(value3).filter((item) => typeof item === "string");
|
|
24205
24605
|
}
|
|
24206
24606
|
function normalizedHarness(value3) {
|
|
24207
|
-
return value3 === "claude" ?
|
|
24607
|
+
return value3 === "claude" ? CLAUDE12 : value3 === "codex" ? CODEX11 : null;
|
|
24208
24608
|
}
|
|
24209
24609
|
function totals(row2) {
|
|
24210
24610
|
const inputTokens = number(row2["inputTokens"]);
|
|
@@ -24512,7 +24912,7 @@ async function runHistory(context) {
|
|
|
24512
24912
|
const filterHarness = context.harness;
|
|
24513
24913
|
const daily = dailyRows(payload).filter((row2) => filterHarness === null || row2.harnessId === filterHarness).sort((left, right) => left.period.localeCompare(right.period));
|
|
24514
24914
|
const sessions = sessionRows(payload).filter((row2) => filterHarness === null || row2.harnessId === filterHarness).sort((left, right) => (left.lastActivity ?? "").localeCompare(right.lastActivity ?? ""));
|
|
24515
|
-
const harnesses = [
|
|
24915
|
+
const harnesses = [CLAUDE12, CODEX11].filter((harness) => filterHarness === null || harness === filterHarness).map((harness) => summarize(harness, daily, sessions, context.now()));
|
|
24516
24916
|
const report = {
|
|
24517
24917
|
...blankReport(context, window.windowStart, window.windowEnd, "available", version3, []),
|
|
24518
24918
|
daily,
|
|
@@ -24525,15 +24925,15 @@ async function runHistory(context) {
|
|
|
24525
24925
|
data: report
|
|
24526
24926
|
});
|
|
24527
24927
|
}
|
|
24528
|
-
var SUPPORTED_CCUSAGE_MAJOR,
|
|
24928
|
+
var SUPPORTED_CCUSAGE_MAJOR, CLAUDE12, CODEX11, HISTORY_HARNESSES;
|
|
24529
24929
|
var init_history2 = __esm({
|
|
24530
24930
|
"apps/cli/dist/src/commands/history.js"() {
|
|
24531
24931
|
"use strict";
|
|
24532
24932
|
init_src();
|
|
24533
24933
|
SUPPORTED_CCUSAGE_MAJOR = 20;
|
|
24534
|
-
|
|
24535
|
-
|
|
24536
|
-
HISTORY_HARNESSES = /* @__PURE__ */ new Set([
|
|
24934
|
+
CLAUDE12 = harnessId("claude");
|
|
24935
|
+
CODEX11 = harnessId("codex");
|
|
24936
|
+
HISTORY_HARNESSES = /* @__PURE__ */ new Set([CLAUDE12, CODEX11]);
|
|
24537
24937
|
}
|
|
24538
24938
|
});
|
|
24539
24939
|
|
|
@@ -25336,7 +25736,7 @@ function admitOutcomePolicy(advice, observation, diagnostics) {
|
|
|
25336
25736
|
async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
25337
25737
|
if (context.nativePolicy !== true)
|
|
25338
25738
|
return;
|
|
25339
|
-
if (context.harness !== null && context.harness !==
|
|
25739
|
+
if (context.harness !== null && context.harness !== CODEX12) {
|
|
25340
25740
|
diagnostics.push(diagnostic({
|
|
25341
25741
|
severity: "warning",
|
|
25342
25742
|
code: "native-policy-harness-unsupported",
|
|
@@ -25346,16 +25746,16 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25346
25746
|
}));
|
|
25347
25747
|
return;
|
|
25348
25748
|
}
|
|
25349
|
-
const nativeContext = { ...context, harness:
|
|
25749
|
+
const nativeContext = { ...context, harness: CODEX12 };
|
|
25350
25750
|
const optimization = await runOptimize(nativeContext);
|
|
25351
25751
|
const contextResult = await runContext(nativeContext);
|
|
25352
|
-
const advice = optimization.data?.harnesses.find((item) => item.harnessId ===
|
|
25353
|
-
const observation = contextResult.data?.harnesses.find((item) => item.harnessId ===
|
|
25752
|
+
const advice = optimization.data?.harnesses.find((item) => item.harnessId === CODEX12) ?? null;
|
|
25753
|
+
const observation = contextResult.data?.harnesses.find((item) => item.harnessId === CODEX12) ?? null;
|
|
25354
25754
|
if (advice === null || observation === null || observation.managedConfigTarget === null) {
|
|
25355
25755
|
diagnostics.push(diagnostic({
|
|
25356
25756
|
severity: "warning",
|
|
25357
25757
|
code: "codex-native-policy-unavailable",
|
|
25358
|
-
subject:
|
|
25758
|
+
subject: CODEX12,
|
|
25359
25759
|
message: "Codex optimizer advice could not be paired with a versioned native user-config target",
|
|
25360
25760
|
remediation: "Run token-harness context --harness codex and keep native policy advisory until the target is observable"
|
|
25361
25761
|
}));
|
|
@@ -25375,7 +25775,7 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25375
25775
|
diagnostics.push(diagnostic({
|
|
25376
25776
|
severity: "warning",
|
|
25377
25777
|
code: "codex-native-policy-observation-drift",
|
|
25378
|
-
subject:
|
|
25778
|
+
subject: CODEX12,
|
|
25379
25779
|
message: `${input.keyPath} changed between optimizer observation (${String(input.adviceCurrent)}) and native-plan observation (${String(input.observedCurrent)})`,
|
|
25380
25780
|
remediation: "Re-run token-harness plan --native-policy so recommendation and config precondition come from a stable state"
|
|
25381
25781
|
}));
|
|
@@ -25385,7 +25785,7 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25385
25785
|
diagnostics.push(diagnostic({
|
|
25386
25786
|
severity: "warning",
|
|
25387
25787
|
code: "codex-native-policy-origin-unavailable",
|
|
25388
|
-
subject:
|
|
25788
|
+
subject: CODEX12,
|
|
25389
25789
|
message: `Codex did not expose origin metadata for ${input.keyPath}, so it will not be managed`,
|
|
25390
25790
|
remediation: "Keep this recommendation advisory rather than guessing config precedence"
|
|
25391
25791
|
}));
|
|
@@ -25396,7 +25796,7 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25396
25796
|
diagnostics.push(diagnostic({
|
|
25397
25797
|
severity: "warning",
|
|
25398
25798
|
code: "codex-native-policy-shadowed",
|
|
25399
|
-
subject:
|
|
25799
|
+
subject: CODEX12,
|
|
25400
25800
|
message: `${input.keyPath} currently comes from Codex layer ${origin.sourceType}` + (origin.profile === null ? "" : ` profile ${origin.profile}`) + ", not from the writable base user layer",
|
|
25401
25801
|
path: origin.path,
|
|
25402
25802
|
remediation: "Leave the project/profile-owned value untouched; change that scope explicitly if desired"
|
|
@@ -25408,7 +25808,7 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25408
25808
|
diagnostics.push(diagnostic({
|
|
25409
25809
|
severity: "warning",
|
|
25410
25810
|
code: "codex-native-model-unproven",
|
|
25411
|
-
subject:
|
|
25811
|
+
subject: CODEX12,
|
|
25412
25812
|
message: "A managed Codex model change requires the learned model candidate and a complete native catalog",
|
|
25413
25813
|
remediation: "Keep the model recommendation advisory until RFC 0018 evidence and the complete catalog agree"
|
|
25414
25814
|
}));
|
|
@@ -25419,7 +25819,7 @@ async function appendCodexNativePolicy(context, actions, diagnostics) {
|
|
|
25419
25819
|
diagnostics.push(diagnostic({
|
|
25420
25820
|
severity: "warning",
|
|
25421
25821
|
code: "codex-native-model-reference-ambiguous",
|
|
25422
|
-
subject:
|
|
25822
|
+
subject: CODEX12,
|
|
25423
25823
|
message: "The learned Codex model recommendation does not resolve uniquely in the current native catalog",
|
|
25424
25824
|
remediation: "Re-run the plan after the Codex model catalog is stable"
|
|
25425
25825
|
}));
|
|
@@ -25539,6 +25939,8 @@ async function computePlan(context) {
|
|
|
25539
25939
|
providers,
|
|
25540
25940
|
rules: [...COMPATIBILITY_RULES],
|
|
25541
25941
|
observedVersions: versions.providers,
|
|
25942
|
+
observedHarnessVersions: versions.harnesses,
|
|
25943
|
+
platform: { os: context.platform.os, wsl: context.platform.isWsl },
|
|
25542
25944
|
harness: context.harness
|
|
25543
25945
|
});
|
|
25544
25946
|
const actions = [];
|
|
@@ -25818,7 +26220,7 @@ function planExitCode(counts) {
|
|
|
25818
26220
|
return EXIT_CODES["blocked-by-conflict"];
|
|
25819
26221
|
return EXIT_CODES.ok;
|
|
25820
26222
|
}
|
|
25821
|
-
var DEFAULT_PROFILE,
|
|
26223
|
+
var DEFAULT_PROFILE, CODEX12;
|
|
25822
26224
|
var init_plan2 = __esm({
|
|
25823
26225
|
"apps/cli/dist/src/commands/plan.js"() {
|
|
25824
26226
|
"use strict";
|
|
@@ -25829,7 +26231,7 @@ var init_plan2 = __esm({
|
|
|
25829
26231
|
init_context_cost2();
|
|
25830
26232
|
init_optimize();
|
|
25831
26233
|
DEFAULT_PROFILE = "safe";
|
|
25832
|
-
|
|
26234
|
+
CODEX12 = harnessId("codex");
|
|
25833
26235
|
}
|
|
25834
26236
|
});
|
|
25835
26237
|
|
|
@@ -26749,7 +27151,7 @@ async function runBenchmarkFinish(context) {
|
|
|
26749
27151
|
]
|
|
26750
27152
|
});
|
|
26751
27153
|
}
|
|
26752
|
-
var
|
|
27154
|
+
var CLAUDE13, CODEX13, CAPTURE_HARNESSES;
|
|
26753
27155
|
var init_benchmark_capture = __esm({
|
|
26754
27156
|
"apps/cli/dist/src/commands/benchmark-capture.js"() {
|
|
26755
27157
|
"use strict";
|
|
@@ -26757,9 +27159,9 @@ var init_benchmark_capture = __esm({
|
|
|
26757
27159
|
init_budget2();
|
|
26758
27160
|
init_context_cost2();
|
|
26759
27161
|
init_history2();
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
CAPTURE_HARNESSES = /* @__PURE__ */ new Set([
|
|
27162
|
+
CLAUDE13 = harnessId("claude");
|
|
27163
|
+
CODEX13 = harnessId("codex");
|
|
27164
|
+
CAPTURE_HARNESSES = /* @__PURE__ */ new Set([CLAUDE13, CODEX13]);
|
|
26763
27165
|
}
|
|
26764
27166
|
});
|
|
26765
27167
|
|
|
@@ -28546,10 +28948,12 @@ async function runStatus(context) {
|
|
|
28546
28948
|
const harnessAdapters = listHarnessAdapters().filter((adapter) => context.harness === null || adapter.manifest.id === context.harness);
|
|
28547
28949
|
const present = [];
|
|
28548
28950
|
const configs = [];
|
|
28951
|
+
const observedHarnessVersions = {};
|
|
28549
28952
|
for (const adapter of harnessAdapters) {
|
|
28550
28953
|
const detection = await adapter.detect(detectionContext);
|
|
28551
28954
|
if (detection.state === "absent")
|
|
28552
28955
|
continue;
|
|
28956
|
+
observedHarnessVersions[adapter.manifest.id] = detection.version;
|
|
28553
28957
|
present.push(adapter.manifest);
|
|
28554
28958
|
const inspection = await adapter.inspect(detectionContext);
|
|
28555
28959
|
configs.push(...inspection.summaries);
|
|
@@ -28580,6 +28984,8 @@ async function runStatus(context) {
|
|
|
28580
28984
|
providers,
|
|
28581
28985
|
rules: [...COMPATIBILITY_RULES],
|
|
28582
28986
|
observedVersions,
|
|
28987
|
+
observedHarnessVersions,
|
|
28988
|
+
platform: { os: context.platform.os, wsl: context.platform.isWsl },
|
|
28583
28989
|
harness: context.harness
|
|
28584
28990
|
});
|
|
28585
28991
|
if (context.stateRoot !== null) {
|
|
@@ -29189,6 +29595,38 @@ var init_rollback = __esm({
|
|
|
29189
29595
|
}
|
|
29190
29596
|
});
|
|
29191
29597
|
|
|
29598
|
+
// apps/cli/dist/src/commands/verify-status.js
|
|
29599
|
+
function harnessesForVerification(selected, configured, present) {
|
|
29600
|
+
if (selected !== null)
|
|
29601
|
+
return present.includes(selected) ? [selected] : [];
|
|
29602
|
+
return configured.length > 0 ? [...configured] : [...present];
|
|
29603
|
+
}
|
|
29604
|
+
function statusFor(achieved, declared, checks = []) {
|
|
29605
|
+
const canaryNotExercised = checks.some((check) => (check.id === "canary-intercepted" || check.id.startsWith("rtk-attribution-")) && (check.status === "not-exercised" || check.status === "info" && check.achievedTier === null));
|
|
29606
|
+
const noObservedOutcome = checks.length > 0 && checks.some((check) => check.status === "not-exercised") && checks.every((check) => check.status === "not-exercised" || check.status === "info");
|
|
29607
|
+
if (canaryNotExercised || noObservedOutcome)
|
|
29608
|
+
return "not-applicable";
|
|
29609
|
+
const order = ["presence", "config-only", "canary", "live-receipt"];
|
|
29610
|
+
if (achieved === null)
|
|
29611
|
+
return "not-applicable";
|
|
29612
|
+
const reached = order.indexOf(achieved);
|
|
29613
|
+
const promised = order.indexOf(declared);
|
|
29614
|
+
if (reached < 0 || promised < 0)
|
|
29615
|
+
return "not-applicable";
|
|
29616
|
+
return reached >= promised ? "healthy" : "degraded";
|
|
29617
|
+
}
|
|
29618
|
+
function allResultsAtDeclaredTier(results) {
|
|
29619
|
+
return results.every((result6) => result6.status === "healthy");
|
|
29620
|
+
}
|
|
29621
|
+
function verificationHasProblems(results, failedCheckCount) {
|
|
29622
|
+
return failedCheckCount > 0 || results.some((result6) => result6.status === "degraded" || result6.status === "failed");
|
|
29623
|
+
}
|
|
29624
|
+
var init_verify_status = __esm({
|
|
29625
|
+
"apps/cli/dist/src/commands/verify-status.js"() {
|
|
29626
|
+
"use strict";
|
|
29627
|
+
}
|
|
29628
|
+
});
|
|
29629
|
+
|
|
29192
29630
|
// apps/cli/dist/src/commands/verify.js
|
|
29193
29631
|
async function runVerify(context) {
|
|
29194
29632
|
const diagnostics = [];
|
|
@@ -29256,18 +29694,14 @@ async function runVerify(context) {
|
|
|
29256
29694
|
continue;
|
|
29257
29695
|
const verification = await adapter.verify(providerContext4);
|
|
29258
29696
|
diagnostics.push(...verification.diagnostics);
|
|
29259
|
-
const harnesses =
|
|
29260
|
-
// Installed but wired to nothing: still worth a row, on every present harness, because
|
|
29261
|
-
// "installed and not connected here" is the finding.
|
|
29262
|
-
presentHarnesses
|
|
29263
|
-
);
|
|
29697
|
+
const harnesses = harnessesForVerification(context.harness, detection.configuredHarnesses, presentHarnesses);
|
|
29264
29698
|
for (const harnessId2 of harnesses) {
|
|
29265
29699
|
const declaredTier = adapter.manifest.harnesses.find((entry) => entry.harness === harnessId2)?.verificationTier ?? verification.declaredTier;
|
|
29266
29700
|
const scopedVerification = await scopeProviderVerificationToHarness(providerContext4, verification, harnessId2, detection.configuredHarnesses);
|
|
29267
29701
|
results.push({
|
|
29268
29702
|
providerId: adapter.manifest.id,
|
|
29269
29703
|
harnessId: harnessId2,
|
|
29270
|
-
status: statusFor(scopedVerification.achievedTier, declaredTier),
|
|
29704
|
+
status: statusFor(scopedVerification.achievedTier, declaredTier, scopedVerification.checks),
|
|
29271
29705
|
declaredTier,
|
|
29272
29706
|
managedByTokenHarness: managedIntegrations.has(`${adapter.manifest.id}\0${harnessId2}`),
|
|
29273
29707
|
providerManagedByTokenHarness: detection.managedByTokenHarness,
|
|
@@ -29278,15 +29712,16 @@ async function runVerify(context) {
|
|
|
29278
29712
|
const receipts = context.metrics === null ? [] : await readReceipts(context);
|
|
29279
29713
|
const latest = receipts[0] ?? null;
|
|
29280
29714
|
const failures = results.flatMap((result6) => result6.checks.filter(contributesToProblems));
|
|
29715
|
+
const hasProblems = verificationHasProblems(results, failures.length);
|
|
29281
29716
|
const report = {
|
|
29282
29717
|
receiptId: latest?.receiptId ?? null,
|
|
29283
29718
|
appliedAt: latest?.appliedAt ?? null,
|
|
29284
29719
|
results,
|
|
29285
|
-
healthyAtDeclaredTier:
|
|
29720
|
+
healthyAtDeclaredTier: allResultsAtDeclaredTier(results)
|
|
29286
29721
|
};
|
|
29287
29722
|
return commandResult({
|
|
29288
29723
|
command: "verify",
|
|
29289
|
-
exitCode:
|
|
29724
|
+
exitCode: hasProblems ? EXIT_CODES["problems-found"] : EXIT_CODES.ok,
|
|
29290
29725
|
data: report,
|
|
29291
29726
|
diagnostics
|
|
29292
29727
|
});
|
|
@@ -29323,21 +29758,12 @@ async function readReceipts(context) {
|
|
|
29323
29758
|
return [];
|
|
29324
29759
|
}
|
|
29325
29760
|
}
|
|
29326
|
-
function statusFor(achieved, declared) {
|
|
29327
|
-
const order = ["presence", "config-only", "canary", "live-receipt"];
|
|
29328
|
-
if (achieved === null)
|
|
29329
|
-
return "not-applicable";
|
|
29330
|
-
const reached = order.indexOf(achieved);
|
|
29331
|
-
const promised = order.indexOf(declared);
|
|
29332
|
-
if (reached < 0 || promised < 0)
|
|
29333
|
-
return "not-applicable";
|
|
29334
|
-
return reached >= promised ? "healthy" : "degraded";
|
|
29335
|
-
}
|
|
29336
29761
|
var init_verify = __esm({
|
|
29337
29762
|
"apps/cli/dist/src/commands/verify.js"() {
|
|
29338
29763
|
"use strict";
|
|
29339
29764
|
init_src3();
|
|
29340
29765
|
init_src();
|
|
29766
|
+
init_verify_status();
|
|
29341
29767
|
}
|
|
29342
29768
|
});
|
|
29343
29769
|
|
|
@@ -32473,8 +32899,18 @@ function renderVerifyReport(report, _context) {
|
|
|
32473
32899
|
if (report.healthyAtDeclaredTier) {
|
|
32474
32900
|
lines.push("Healthy at the declared tier for every provider.");
|
|
32475
32901
|
} else {
|
|
32476
|
-
const
|
|
32477
|
-
|
|
32902
|
+
const belowTier = report.results.filter((result6) => result6.status === "degraded" || result6.status === "failed").length;
|
|
32903
|
+
const notProven = report.results.filter((result6) => result6.status === "not-applicable").length;
|
|
32904
|
+
const failedChecks = report.results.flatMap((result6) => result6.checks).filter((check) => check.status === "fail").length;
|
|
32905
|
+
if (belowTier > 0) {
|
|
32906
|
+
lines.push(`${String(belowTier)} ${pluralize(belowTier, "provider\u2013harness integration")} below declared tier.`);
|
|
32907
|
+
}
|
|
32908
|
+
if (failedChecks > 0) {
|
|
32909
|
+
lines.push(`${String(failedChecks)} ${pluralize(failedChecks, "check")} failed.`);
|
|
32910
|
+
}
|
|
32911
|
+
if (notProven > 0) {
|
|
32912
|
+
lines.push(`${String(notProven)} ${pluralize(notProven, "provider\u2013harness integration")} not proven yet.`);
|
|
32913
|
+
}
|
|
32478
32914
|
}
|
|
32479
32915
|
return document(lines);
|
|
32480
32916
|
}
|