token-harness 0.1.24 → 0.1.25

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-harness",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Quota-aware efficiency layer for Claude Code and Codex subscription limits.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/sbom.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "bomFormat": "CycloneDX",
3
3
  "specVersion": "1.5",
4
- "serialNumber": "urn:uuid:dae606f9-46c6-3383-876b-2c09bda8c296",
4
+ "serialNumber": "urn:uuid:98c77e0b-85a6-4ff8-8659-17f04e51ef5f",
5
5
  "version": 1,
6
6
  "metadata": {
7
7
  "component": {
8
8
  "type": "application",
9
9
  "bom-ref": "token-harness",
10
10
  "name": "token-harness",
11
- "version": "0.1.24",
11
+ "version": "0.1.25",
12
12
  "description": "Quota-aware efficiency layer for Claude Code and Codex subscription limits.",
13
13
  "licenses": [
14
14
  {
@@ -20,7 +20,7 @@
20
20
  "hashes": [
21
21
  {
22
22
  "alg": "SHA-256",
23
- "content": "dae606f946c63383876b2c09bda8c296da1816849916f5d1774d2f1d84384c47"
23
+ "content": "98c77e0b85a64ff8865917f04e51ef5fa489bcbc4bdd473f712a1cec2e025cac"
24
24
  }
25
25
  ]
26
26
  },
package/token-harness.mjs CHANGED
@@ -4675,35 +4675,36 @@ function detectUnownedEntries(input) {
4675
4675
  });
4676
4676
  }
4677
4677
  for (const config of input.configs) {
4678
- for (const point of config.interceptionPoints) {
4679
- for (const matcher of config.matchers) {
4680
- for (const [key, resolved] of exclusiveOwners) {
4681
- if (resolved.scope.harness !== config.harnessId)
4682
- continue;
4683
- if (resolved.scope.interceptionPoint !== point)
4684
- continue;
4685
- if (resolved.scope.toolFamily !== matcher)
4686
- continue;
4687
- for (const command of config.commands) {
4688
- const belongsTo = input.identify(command);
4689
- if (belongsTo === resolved.owner)
4690
- continue;
4691
- findings.push({
4692
- code: "unowned-entry-on-exclusive-scope",
4693
- scope: key,
4694
- expectedOwner: resolved.owner,
4695
- configPath: config.configPath,
4696
- matcher,
4697
- command,
4698
- detail: [
4699
- `${key} is an exclusive scope owned by ${resolved.owner}`,
4700
- belongsTo === null ? "An entry here invokes a command Token Harness does not recognise" : `An entry here invokes ${belongsTo}`,
4701
- "The harness runs every matching hook rather than only the first, so both would transform the same payload and the saving would be counted twice"
4702
- ],
4703
- remediation: "Remove the competing entry, or assign the scope to it explicitly with `profile: custom`. Token Harness will not remove a third party\u2019s entry."
4704
- });
4705
- }
4706
- }
4678
+ const observedHooks = config.hookCommands === void 0 ? config.interceptionPoints.flatMap((interceptionPoint) => config.matchers.flatMap((toolFamily) => config.commands.map((command) => ({
4679
+ interceptionPoint,
4680
+ toolFamilies: [toolFamily],
4681
+ command
4682
+ })))) : config.hookCommands;
4683
+ for (const hook of observedHooks) {
4684
+ for (const [key, resolved] of exclusiveOwners) {
4685
+ if (resolved.scope.harness !== config.harnessId)
4686
+ continue;
4687
+ if (resolved.scope.interceptionPoint !== hook.interceptionPoint)
4688
+ continue;
4689
+ if (!hook.toolFamilies.includes(resolved.scope.toolFamily))
4690
+ continue;
4691
+ const belongsTo = input.identify(hook.command);
4692
+ if (belongsTo === resolved.owner)
4693
+ continue;
4694
+ findings.push({
4695
+ code: "unowned-entry-on-exclusive-scope",
4696
+ scope: key,
4697
+ expectedOwner: resolved.owner,
4698
+ configPath: config.configPath,
4699
+ matcher: resolved.scope.toolFamily,
4700
+ command: hook.command,
4701
+ detail: [
4702
+ `${key} is an exclusive scope owned by ${resolved.owner}`,
4703
+ belongsTo === null ? "An entry here invokes a command Token Harness does not recognise" : `An entry here invokes ${belongsTo}`,
4704
+ "The harness runs every matching hook rather than only the first, so both would transform the same payload and the saving would be counted twice"
4705
+ ],
4706
+ remediation: "Remove the competing entry, or assign the scope to it explicitly with `profile: custom`. Token Harness will not remove a third party\u2019s entry."
4707
+ });
4707
4708
  }
4708
4709
  }
4709
4710
  }
@@ -9861,7 +9862,7 @@ var TOOL_VERSION;
9861
9862
  var init_version2 = __esm({
9862
9863
  "apps/cli/dist/src/version.js"() {
9863
9864
  "use strict";
9864
- TOOL_VERSION = "0.1.24";
9865
+ TOOL_VERSION = "0.1.25";
9865
9866
  }
9866
9867
  });
9867
9868
 
@@ -14215,7 +14216,9 @@ function readHooks(document2) {
14215
14216
  return [
14216
14217
  {
14217
14218
  eventName: point.eventName,
14219
+ interceptionPoint: point.scopeId,
14218
14220
  matcher: typeof matcher === "string" ? matcher : null,
14221
+ toolFamilies: typeof matcher !== "string" ? MANIFEST.toolFamilies.map((family) => family.id) : MANIFEST.toolFamilies.filter((family) => matcherCoversFamily(matcher, family.id)).map((family) => family.id),
14219
14222
  command: hook["command"],
14220
14223
  entryPointer,
14221
14224
  commandPointer: `${entryPointer}.hooks.${String(hookIndex)}.command`
@@ -14960,7 +14963,7 @@ var init_codex_hooks = __esm({
14960
14963
  function isRecord3(value3) {
14961
14964
  return typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
14962
14965
  }
14963
- function readHooks2(document2) {
14966
+ function readHooks2(document2, os) {
14964
14967
  if (!isRecord3(document2) || !isRecord3(document2["hooks"]))
14965
14968
  return { points: [], matchers: [], commands: [], hookCommands: [] };
14966
14969
  const hooks = document2["hooks"];
@@ -14981,15 +14984,21 @@ function readHooks2(document2) {
14981
14984
  matchers.push(matcher);
14982
14985
  if (Array.isArray(entry["hooks"])) {
14983
14986
  for (const [hookIndex, hook] of entry["hooks"].entries()) {
14984
- if (isRecord3(hook) && typeof hook["command"] === "string") {
14985
- commands.push(hook["command"]);
14987
+ if (!isRecord3(hook))
14988
+ continue;
14989
+ const commandKey = os === "windows" && typeof hook["commandWindows"] === "string" ? "commandWindows" : "command";
14990
+ const command = hook[commandKey];
14991
+ if (typeof command === "string") {
14992
+ commands.push(command);
14986
14993
  const entryPointer = `hooks.${point.eventName}.${String(entryIndex)}`;
14987
14994
  hookCommands.push({
14988
14995
  eventName: point.eventName,
14996
+ interceptionPoint: point.scopeId,
14989
14997
  matcher,
14990
- command: hook["command"],
14998
+ toolFamilies: matcher === null ? MANIFEST2.toolFamilies.map((family) => family.id) : MANIFEST2.toolFamilies.filter((family) => matcherCoversFamily(matcher, family.id)).map((family) => family.id),
14999
+ command,
14991
15000
  entryPointer,
14992
- commandPointer: `${entryPointer}.hooks.${String(hookIndex)}.command`
15001
+ commandPointer: `${entryPointer}.hooks.${String(hookIndex)}.${commandKey}`
14993
15002
  });
14994
15003
  carries = true;
14995
15004
  }
@@ -15034,7 +15043,7 @@ async function resolveConfig2(declaration, context) {
15034
15043
  };
15035
15044
  }
15036
15045
  try {
15037
- const hooks = readHooks2(JSON.parse(text3));
15046
+ const hooks = readHooks2(JSON.parse(text3), context.facts.os);
15038
15047
  return {
15039
15048
  declaration,
15040
15049
  path,
@@ -18349,7 +18358,7 @@ function installAction(context, manifest) {
18349
18358
  packageName: channel.packageId ?? "rtk",
18350
18359
  // The managed Codex hook first exists in this RTK release. Pinning makes a fresh setup's
18351
18360
  // promised surface deterministic instead of installing an older prompt-only build.
18352
- version: "0.50.0"
18361
+ version: "0.51.0"
18353
18362
  };
18354
18363
  }
18355
18364
  function buildRtkPlan(input) {
@@ -18528,9 +18537,15 @@ async function readHarnessActivity(context, harness) {
18528
18537
  failure: null
18529
18538
  };
18530
18539
  }
18540
+ function supportsCodexHook(version3) {
18541
+ if (version3 === null)
18542
+ return false;
18543
+ const parsed = parseSemanticVersion(version3);
18544
+ const minimum = parseSemanticVersion(RTK_CODEX_HOOK_MINIMUM_VERSION);
18545
+ return parsed !== null && minimum !== null && compareVersions(parsed, minimum) >= 0;
18546
+ }
18531
18547
  function hasAttributionHook(context, harness) {
18532
- const command = new RegExp(`^token-harness __internal-rtk-hook ${harness}(?: --restore-rtk)?$`, "i");
18533
- return context.harnessConfigs.some((config) => config.harnessId === harness && config.commands.some((entry) => command.test(entry.trim())));
18548
+ return context.harnessConfigs.some((config) => config.harnessId === harness && config.commands.some((entry) => tokenHarnessRtkHookHarness(entry) === harness));
18534
18549
  }
18535
18550
  async function detect7(context) {
18536
18551
  const evidenceItems = [];
@@ -18554,7 +18569,7 @@ async function detect7(context) {
18554
18569
  remediation: "Check the release notes for analytics or hook changes before applying a plan"
18555
18570
  }));
18556
18571
  }
18557
- const codexHookSupported = version3.version === RTK_CODEX_HOOK_VERSION;
18572
+ const codexHookSupported = supportsCodexHook(version3.version);
18558
18573
  const codexConfiguredWithoutHookSupport = configured.includes(CODEX4) && !codexHookSupported;
18559
18574
  if (codexConfiguredWithoutHookSupport) {
18560
18575
  warnings.push(diagnostic({
@@ -18562,7 +18577,7 @@ async function detect7(context) {
18562
18577
  code: "rtk-codex-hook-unsupported",
18563
18578
  subject: CODEX4,
18564
18579
  message: `RTK ${String(version3.version)} does not provide the Codex hook; its configuration entry cannot capture commands`,
18565
- remediation: `Upgrade RTK to ${RTK_CODEX_HOOK_VERSION}, then refresh and apply the attribution plan`
18580
+ remediation: `Upgrade RTK to ${RTK_CODEX_HOOK_MINIMUM_VERSION}, then refresh and apply the attribution plan`
18566
18581
  }));
18567
18582
  }
18568
18583
  const state = version3.version === null ? configured.length > 0 ? "broken" : "absent" : codexConfiguredWithoutHookSupport && configured.length === 1 ? "broken" : configured.length > 0 ? "configured" : "installed";
@@ -18628,14 +18643,14 @@ async function verify7(context) {
18628
18643
  remediation: version3.version === null ? "Install RTK, or add it to PATH" : null
18629
18644
  });
18630
18645
  const configured = harnessesWiredToRtk(context.harnessConfigs);
18631
- const configuredSupported = configured.filter((harness) => harness === CLAUDE5 || harness === CODEX4 && version3.version === RTK_CODEX_HOOK_VERSION);
18646
+ const configuredSupported = configured.filter((harness) => harness === CLAUDE5 || harness === CODEX4 && supportsCodexHook(version3.version));
18632
18647
  checks.push({
18633
18648
  id: "hook-registered",
18634
18649
  status: configuredSupported.length > 0 ? "pass" : configured.length > 0 ? "fail" : "not-exercised",
18635
18650
  summary: configuredSupported.length > 0 ? `wired to ${configuredSupported.join(", ")}` : configured.length > 0 ? `RTK ${String(version3.version)} cannot run its Codex hook` : "no harness configuration names rtk",
18636
18651
  achievedTier: configuredSupported.length > 0 ? "config-only" : null,
18637
18652
  evidence: [],
18638
- remediation: configured.length > 0 && configuredSupported.length === 0 ? `Upgrade RTK to ${RTK_CODEX_HOOK_VERSION} for Codex hook support` : null
18653
+ remediation: configured.length > 0 && configuredSupported.length === 0 ? `Upgrade RTK to ${RTK_CODEX_HOOK_MINIMUM_VERSION} for Codex hook support` : null
18639
18654
  });
18640
18655
  let receipt = null;
18641
18656
  let bestReceiptTime = Number.NEGATIVE_INFINITY;
@@ -18643,7 +18658,7 @@ async function verify7(context) {
18643
18658
  if (!configured.includes(harness))
18644
18659
  continue;
18645
18660
  const label = harness === CLAUDE5 ? "Claude Code" : "Codex";
18646
- const supported = harness !== CODEX4 || version3.version === RTK_CODEX_HOOK_VERSION;
18661
+ const supported = harness !== CODEX4 || supportsCodexHook(version3.version);
18647
18662
  if (!supported) {
18648
18663
  checks.push({
18649
18664
  id: `rtk-attribution-${harness}`,
@@ -18651,7 +18666,7 @@ async function verify7(context) {
18651
18666
  summary: `RTK ${String(version3.version)} does not provide an active ${label} hook`,
18652
18667
  achievedTier: null,
18653
18668
  evidence: [],
18654
- remediation: `Upgrade RTK to ${RTK_CODEX_HOOK_VERSION}, then refresh and apply the tracking update`
18669
+ remediation: `Upgrade RTK to ${RTK_CODEX_HOOK_MINIMUM_VERSION}, then refresh and apply the tracking update`
18655
18670
  });
18656
18671
  continue;
18657
18672
  }
@@ -19046,7 +19061,20 @@ async function importHistorySource(context, store, path, attributedHarness) {
19046
19061
  };
19047
19062
  }
19048
19063
  function identifiesCommand2(command) {
19049
- return HOOK_COMMAND_PATTERN2.test(command) || PLUGIN_MODULE_PATTERN3.test(command) || /(^|[\\/\s"'])token-harness(?:\.cmd|\.exe)?\s+__internal-rtk-hook(?:\s|$)/i.test(command);
19064
+ return HOOK_COMMAND_PATTERN2.test(command) || PLUGIN_MODULE_PATTERN3.test(command) || tokenHarnessRtkHookHarness(command) !== null;
19065
+ }
19066
+ function tokenHarnessRtkHookHarness(command) {
19067
+ const match = /^\s*(?:"([^"]+)"|'([^']+)'|(\S+))\s+__internal-rtk-hook\s+(claude|codex)(?:\s+--restore-rtk)?\s*$/i.exec(command);
19068
+ if (match === null)
19069
+ return null;
19070
+ const executable = match[1] ?? match[2] ?? match[3];
19071
+ if (executable === void 0)
19072
+ return null;
19073
+ const basename = executable.split(/[\\/]/).at(-1);
19074
+ if (basename === void 0 || !/^token-harness(?:\.cmd|\.exe)?$/i.test(basename)) {
19075
+ return null;
19076
+ }
19077
+ return harnessId((match[4] ?? "").toLowerCase());
19050
19078
  }
19051
19079
  async function plan2(context, request) {
19052
19080
  const version3 = await readVersion(context);
@@ -19070,7 +19098,7 @@ async function plan2(context, request) {
19070
19098
  hookProxyAvailable
19071
19099
  });
19072
19100
  }
19073
- 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;
19101
+ var RTK2, CLAUDE5, CODEX4, OPENCODE3, TRACKED_HARNESSES, RTK_CODEX_HOOK_MINIMUM_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;
19074
19102
  var init_rtk = __esm({
19075
19103
  "packages/adapters/dist/src/providers/rtk.js"() {
19076
19104
  "use strict";
@@ -19081,7 +19109,7 @@ var init_rtk = __esm({
19081
19109
  CODEX4 = harnessId("codex");
19082
19110
  OPENCODE3 = harnessId("opencode");
19083
19111
  TRACKED_HARNESSES = [CLAUDE5, CODEX4];
19084
- RTK_CODEX_HOOK_VERSION = "0.50.0";
19112
+ RTK_CODEX_HOOK_MINIMUM_VERSION = "0.50.0";
19085
19113
  MANIFEST7 = {
19086
19114
  schemaVersion: MANIFEST_SCHEMA_VERSION,
19087
19115
  id: RTK2,
@@ -19261,7 +19289,7 @@ var init_rtk = __esm({
19261
19289
  },
19262
19290
  delegatedInstallReviews: null
19263
19291
  };
19264
- TESTED_VERSIONS2 = { minimum: "0.44.0", maximum: "0.50.0" };
19292
+ TESTED_VERSIONS2 = { minimum: "0.44.0", maximum: "0.51.0" };
19265
19293
  VERSION_PATTERN7 = /(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)/;
19266
19294
  HOOK_COMMAND_PATTERN2 = /(^|[\\/\s"'])rtk(\.exe)?([\s"']|$)/i;
19267
19295
  PLUGIN_MODULE_PATTERN3 = /(^|[\\/])rtk\.(ts|js|mjs|cjs|mts|cts)$/i;
@@ -21941,7 +21969,7 @@ var init_version_compatibility = __esm({
21941
21969
  GITNEXUS2 = providerId("gitnexus");
21942
21970
  HEADROOM3 = providerId("headroom");
21943
21971
  PACKAGE_UPDATE_BASELINES = /* @__PURE__ */ new Map([
21944
- [RTK3, { minimum: "0.44.0", maximum: "0.50.0" }],
21972
+ [RTK3, { minimum: "0.44.0", maximum: "0.51.0" }],
21945
21973
  [HARNESSTRIM3, { minimum: "0.0.5", maximum: "0.3.1" }],
21946
21974
  [
21947
21975
  MCPTOON2,
@@ -26821,6 +26849,14 @@ async function computePlan(context) {
26821
26849
  ],
26822
26850
  remediation: "Give each provider a distinct marker pair, or disable one of the providers for this instruction region"
26823
26851
  }));
26852
+ if (providerAdapters.length === 0 && context.provider !== providerId("none") && actions.length === 0) {
26853
+ diagnostics.push(diagnostic({
26854
+ severity: "info",
26855
+ code: "no-providers-registered",
26856
+ message: "No optimization provider is available for this operation",
26857
+ remediation: null
26858
+ }));
26859
+ }
26824
26860
  const conflicts = [...resolution.conflicts, ...markerConflicts];
26825
26861
  const report = {
26826
26862
  // RFC 0006 §Plan persistence: "a digest over the plan's normalized content, so identical
@@ -26869,14 +26905,6 @@ async function computePlan(context) {
26869
26905
  remediation: null
26870
26906
  }));
26871
26907
  }
26872
- if (providerAdapters.length === 0) {
26873
- diagnostics.push(diagnostic({
26874
- severity: "info",
26875
- code: "no-providers-registered",
26876
- message: "No provider adapters are registered in this build, so no plan has actions",
26877
- remediation: null
26878
- }));
26879
- }
26880
26908
  if (resolution.ownership.length > 0 && actions.length === 0 && blocked.length === 0) {
26881
26909
  diagnostics.push(diagnostic({
26882
26910
  severity: "info",
@@ -35474,7 +35502,7 @@ function guideSetupTargets(report, harness) {
35474
35502
  return GUIDE_MANAGED_PROVIDERS.map((provider) => guideSetupTarget(report, harness, provider));
35475
35503
  }
35476
35504
  function explainGuideIssue(diagnostics, fallback) {
35477
- const known = diagnostics.find((entry) => ISSUE_COPY[entry.code] !== void 0);
35505
+ const known = diagnostics.find((entry) => entry.severity === "error" && ISSUE_COPY[entry.code] !== void 0) ?? diagnostics.find((entry) => entry.severity === "warning" && ISSUE_COPY[entry.code] !== void 0) ?? diagnostics.find((entry) => entry.severity === "info" && ISSUE_COPY[entry.code] !== void 0);
35478
35506
  if (known !== void 0)
35479
35507
  return ISSUE_COPY[known.code];
35480
35508
  const blocked = diagnostics.find((entry) => /compatibility|unsupported|unreviewed|no-row/.test(entry.code));
@@ -35824,6 +35852,13 @@ var init_guided = __esm({
35824
35852
  "codex-native-policy-unavailable": "Codex did not expose a writable, versioned user setting. No change is proposed.",
35825
35853
  "codex-native-policy-shadowed": "A project or profile overrides this Codex setting. That setting belongs to you and will not be replaced.",
35826
35854
  "no-providers-registered": "No optimization provider was selected for this operation.",
35855
+ "prompt-routing-target-unavailable": "Token Harness could not locate a supported user-level prompt-hook settings file for this agent.",
35856
+ "prompt-routing-version-unverified": "Automatic routing is not available for this agent version until its prompt-hook format has been verified.",
35857
+ "prompt-routing-runtime-unavailable": "The Token Harness hook command could not run from this dashboard environment. Make Token Harness available on PATH, then review routing again.",
35858
+ "prompt-routing-target-not-file": "A non-file occupies the agent hook settings path, so Token Harness left it unchanged.",
35859
+ "prompt-routing-settings-unmergeable": "The current hook settings cannot be merged safely. Repair the JSON or review the hook manually.",
35860
+ "prompt-routing-already-configured": "Automatic routing hooks are already present. Nothing needs to be changed.",
35861
+ "prompt-routing-existing-hook-conflict": "An existing Token Harness routing hook was changed or only partly installed. It was left untouched for review.",
35827
35862
  "already-in-desired-state": "The supported integration is already configured. Nothing needs to be changed.",
35828
35863
  "delegated-install-snapshot-too-large": "The optimizer setup found too much unrelated data inside its rollback boundary. Nothing was changed. Update Token Harness or use a narrower project directory before retrying.",
35829
35864
  "delegated-install-failed": "The optimizer installer itself did not complete successfully. Nothing was kept from the failed transaction.",
@@ -36862,22 +36897,51 @@ var init_guided = __esm({
36862
36897
  const messages = [];
36863
36898
  const results = [];
36864
36899
  let ok = true;
36900
+ let healthyAtDeclaredTier = true;
36865
36901
  const inventory = await this.call(["doctor"]);
36866
36902
  const present = (inventory.data?.harnesses ?? []).filter((item) => item.state !== "absent" && ["claude", "codex"].includes(item.harnessId));
36903
+ if (inventory.data === null) {
36904
+ ok = false;
36905
+ healthyAtDeclaredTier = false;
36906
+ messages.push("The installed-agent inventory could not be read. Refresh and check the local installation.");
36907
+ }
36867
36908
  if (present.length === 0) {
36868
36909
  ok = false;
36869
- messages.push("No supported installed agent could be checked. Refresh after installing or signing in.");
36910
+ healthyAtDeclaredTier = false;
36911
+ messages.push("No supported installed agent was detected, so no integration was checked.");
36870
36912
  }
36871
36913
  for (const agent of present) {
36872
36914
  const harness = agent.harnessId;
36873
36915
  this.record(`Checking ${name(harness)} configuration and available execution evidence. No settings changed.`, "working");
36874
36916
  const result6 = await this.call(["verify", "--harness", harness]);
36875
36917
  const healthy = result6.data?.healthyAtDeclaredTier === true;
36876
- if (!healthy)
36918
+ const versionWarnings = result6.diagnostics.filter((entry) => entry.severity === "warning" && (entry.code === "harness-version-unknown-newer" || entry.code === "provider-version-unknown-newer"));
36919
+ const failed = result6.data === null || result6.exitCode !== 0 || result6.diagnostics.some((entry) => entry.severity === "error" || entry.severity === "warning" && !versionWarnings.includes(entry)) || result6.data.results.some((entry) => entry.status === "degraded" || entry.status === "failed");
36920
+ if (failed)
36877
36921
  ok = false;
36922
+ if (!healthy)
36923
+ healthyAtDeclaredTier = false;
36878
36924
  if (result6.data !== null)
36879
36925
  results.push(...result6.data.results);
36880
- messages.push(`${name(harness)}: ${healthy ? "the available integration checks passed. This is not proof that every command was reduced." : explainGuideIssue(result6.diagnostics, "execution could not be fully confirmed. The agent may be absent, an integration may not be enabled, or runtime evidence may be unavailable.")}`);
36926
+ const prefix = `${name(harness)}: `;
36927
+ if (result6.data === null) {
36928
+ messages.push(prefix + "the verification report could not be read. Refresh and check the local installation.");
36929
+ } else if (healthy) {
36930
+ messages.push(prefix + "the available integration checks passed. This is not proof that every command was reduced.");
36931
+ } else if (failed) {
36932
+ messages.push(prefix + "a known integration check failed. Review the specific check before changing setup.");
36933
+ } else if (result6.data.results.length === 0) {
36934
+ messages.push(prefix + "the agent is detected, but no managed optimizer connection is present to verify. Review setup only if you want to connect one.");
36935
+ } else {
36936
+ const pendingProviders = [
36937
+ ...new Set(result6.data.results.filter((entry) => entry.status === "not-applicable").map((entry) => name(entry.providerId)))
36938
+ ];
36939
+ const subject = pendingProviders.length > 0 ? pendingProviders.join(" and ") : "Some integrations";
36940
+ messages.push(`${prefix}${subject} have not produced enough attributable runtime evidence for ${name(harness)} yet. This is an evidence gap, not a finding that the setup is broken. If you do not use this agent on this machine, no action is required.`);
36941
+ }
36942
+ if (versionWarnings.length > 0) {
36943
+ messages.push(prefix + "the installed version is newer than Token Harness\u2019s recorded compatibility sample; read-only checks can continue, but review the version before changing its integration.");
36944
+ }
36881
36945
  }
36882
36946
  if (inventory.data !== null) {
36883
36947
  const fingerprint = stackFingerprint(inventory.data);
@@ -36887,7 +36951,7 @@ var init_guided = __esm({
36887
36951
  receiptId: null,
36888
36952
  appliedAt: null,
36889
36953
  results,
36890
- healthyAtDeclaredTier: ok
36954
+ healthyAtDeclaredTier: healthyAtDeclaredTier && present.length > 0
36891
36955
  }
36892
36956
  };
36893
36957
  this.stackBase = {
@@ -36903,7 +36967,13 @@ var init_guided = __esm({
36903
36967
  if (this.cached !== null)
36904
36968
  this.cached.value = { ...this.cached.value, stack };
36905
36969
  this.record("Integration checks completed. No settings changed.", ok ? "success" : "attention");
36906
- return { ok, title: "Integration checks", messages, appliedPlans: 0, stack };
36970
+ return {
36971
+ ok,
36972
+ title: ok ? healthyAtDeclaredTier ? "Integration checks passed" : "Configuration checks complete; runtime evidence pending" : "Integration checks need attention",
36973
+ messages,
36974
+ appliedPlans: 0,
36975
+ stack
36976
+ };
36907
36977
  });
36908
36978
  }
36909
36979
  };
@@ -39552,7 +39622,7 @@ var init_guided_product_client = __esm({
39552
39622
  if (!(data.changes || []).length)
39553
39623
  $('modal-content').append(messageBox('No change proposed', (data.notices || []).join(' ') || 'The current routing state or ownership evidence does not support a safe change.'));
39554
39624
  for (const notice of data.notices || []) $('modal-content').append(node('p', notice, 'notice-row'));
39555
- $('modal-content').append(messageBox(
39625
+ if (data.ticket) $('modal-content').append(messageBox(
39556
39626
  agentId === 'codex' ? 'Codex trust step' : 'When it takes effect',
39557
39627
  agentId === 'codex'
39558
39628
  ? 'After Apply, review and trust the UserPromptSubmit hook in Codex using /hooks. Until a callback is observed, the dashboard will show it as configured but not runtime verified.'