token-harness 0.1.14 → 0.1.16
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 +657 -197
package/token-harness.mjs
CHANGED
|
@@ -5051,7 +5051,7 @@ function updateState(row2) {
|
|
|
5051
5051
|
}
|
|
5052
5052
|
}
|
|
5053
5053
|
function healthState(input) {
|
|
5054
|
-
if (input.detection.state === "broken" || input.
|
|
5054
|
+
if (input.detection.state === "broken" || input.verification === "degraded" || input.quality.state === "regressed" || input.conflicts.length > 0 || input.detection.warnings.some((warning2) => warning2.severity === "error")) {
|
|
5055
5055
|
return "attention";
|
|
5056
5056
|
}
|
|
5057
5057
|
if (input.detection.state === "configured" && input.verification === "verified")
|
|
@@ -9387,7 +9387,7 @@ var TOOL_VERSION;
|
|
|
9387
9387
|
var init_version2 = __esm({
|
|
9388
9388
|
"apps/cli/dist/src/version.js"() {
|
|
9389
9389
|
"use strict";
|
|
9390
|
-
TOOL_VERSION = "0.1.
|
|
9390
|
+
TOOL_VERSION = "0.1.16";
|
|
9391
9391
|
}
|
|
9392
9392
|
});
|
|
9393
9393
|
|
|
@@ -16088,6 +16088,25 @@ function parseHarnessCapabilities(value3) {
|
|
|
16088
16088
|
narrowing: flags
|
|
16089
16089
|
};
|
|
16090
16090
|
}
|
|
16091
|
+
function parseCapabilityDigests(value3) {
|
|
16092
|
+
if (value3 === void 0)
|
|
16093
|
+
return {};
|
|
16094
|
+
if (typeof value3 !== "object" || value3 === null || Array.isArray(value3))
|
|
16095
|
+
return null;
|
|
16096
|
+
const result6 = {};
|
|
16097
|
+
for (const [harness, raw] of Object.entries(value3)) {
|
|
16098
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
16099
|
+
return null;
|
|
16100
|
+
const entries = {};
|
|
16101
|
+
for (const [path, digest] of Object.entries(raw)) {
|
|
16102
|
+
if (typeof digest !== "string" || !/^[a-f0-9]{64}$/i.test(digest))
|
|
16103
|
+
return null;
|
|
16104
|
+
entries[path.replaceAll("\\", "/")] = `sha256:${digest.toLowerCase()}`;
|
|
16105
|
+
}
|
|
16106
|
+
result6[harness] = entries;
|
|
16107
|
+
}
|
|
16108
|
+
return result6;
|
|
16109
|
+
}
|
|
16091
16110
|
function parseCapabilities(stdout) {
|
|
16092
16111
|
let parsed;
|
|
16093
16112
|
try {
|
|
@@ -16100,7 +16119,8 @@ function parseCapabilities(stdout) {
|
|
|
16100
16119
|
const record5 = parsed;
|
|
16101
16120
|
const version3 = record5["version"];
|
|
16102
16121
|
const harnesses = record5["harnesses"];
|
|
16103
|
-
|
|
16122
|
+
const digests = parseCapabilityDigests(record5["digests"]);
|
|
16123
|
+
if (typeof version3 !== "string" || typeof harnesses !== "object" || harnesses === null || digests === null) {
|
|
16104
16124
|
return null;
|
|
16105
16125
|
}
|
|
16106
16126
|
const entries = {};
|
|
@@ -16110,7 +16130,7 @@ function parseCapabilities(stdout) {
|
|
|
16110
16130
|
return null;
|
|
16111
16131
|
entries[harness] = entry;
|
|
16112
16132
|
}
|
|
16113
|
-
return { version: version3, harnesses: entries };
|
|
16133
|
+
return { version: version3, harnesses: entries, digests };
|
|
16114
16134
|
}
|
|
16115
16135
|
async function probeCapabilities(context) {
|
|
16116
16136
|
const outcome2 = await context.runner.run({
|
|
@@ -16185,13 +16205,27 @@ function driftWarning(message, remediation) {
|
|
|
16185
16205
|
function formatSurface(surface) {
|
|
16186
16206
|
return `${surface.toolFamily}/${surface.interceptionPoint}`;
|
|
16187
16207
|
}
|
|
16208
|
+
function requiresRuntimeSkillDigests(capabilities) {
|
|
16209
|
+
const observed = parseSemanticVersion(capabilities.version);
|
|
16210
|
+
const minimum = parseSemanticVersion(RUNTIME_SKILL_DIGESTS_MINIMUM);
|
|
16211
|
+
if (observed === null || minimum === null)
|
|
16212
|
+
return true;
|
|
16213
|
+
return compareVersions(observed, minimum) >= 0;
|
|
16214
|
+
}
|
|
16215
|
+
function publishedSkillArtifactDigests(capabilities, harness) {
|
|
16216
|
+
const install = SKILLS_INSTALL[harness];
|
|
16217
|
+
if (install === void 0)
|
|
16218
|
+
return [];
|
|
16219
|
+
const prefix = `${install.directory}/skills/`;
|
|
16220
|
+
return Object.entries(capabilities.digests?.[harness] ?? {}).filter(([path]) => path.startsWith(prefix));
|
|
16221
|
+
}
|
|
16188
16222
|
function assignableOn(capabilities) {
|
|
16189
16223
|
if (capabilities === null)
|
|
16190
16224
|
return [];
|
|
16191
16225
|
const reviews = MANIFEST6.delegatedInstallReviews ?? {};
|
|
16192
16226
|
return Object.keys(reviews).filter((harness) => {
|
|
16193
16227
|
const observed = capabilities.harnesses[harness];
|
|
16194
|
-
return observed !== void 0 && observed.narrowing.length > 0 && writeSetStillReviewed(capabilities, harnessId(harness));
|
|
16228
|
+
return observed !== void 0 && observed.narrowing.length > 0 && writeSetStillReviewed(capabilities, harnessId(harness)) && (!requiresRuntimeSkillDigests(capabilities) || publishedSkillArtifactDigests(capabilities, harness).length > 0);
|
|
16195
16229
|
}).map((harness) => harnessId(harness));
|
|
16196
16230
|
}
|
|
16197
16231
|
function writeSetStillReviewed(capabilities, harness) {
|
|
@@ -16239,6 +16273,15 @@ function compareCapabilities(manifest, capabilities) {
|
|
|
16239
16273
|
warnings.push(driftWarning(`\`harnesstrim capabilities\` (${capabilities.version}) declares ${entry} for ${harness}, which sits outside the containment boundary recorded at ${review.upstreamVersion} (${boundary.join(", ")})`, "Re-review the write set: rollback restores the boundary, and a path it does not cover would survive a rollback"));
|
|
16240
16274
|
}
|
|
16241
16275
|
}
|
|
16276
|
+
if (requiresRuntimeSkillDigests(capabilities)) {
|
|
16277
|
+
for (const harness of Object.keys(manifest.delegatedInstallReviews ?? {})) {
|
|
16278
|
+
if (capabilities.harnesses[harness] === void 0)
|
|
16279
|
+
continue;
|
|
16280
|
+
if (publishedSkillArtifactDigests(capabilities, harness).length > 0)
|
|
16281
|
+
continue;
|
|
16282
|
+
warnings.push(driftWarning(`HarnessTrim ${capabilities.version} does not publish the ${harness} skill artifact digests required by the managed install contract`, `Use a HarnessTrim build that publishes per-harness artifact digests, or update Token Harness if the upstream capability contract changed`));
|
|
16283
|
+
}
|
|
16284
|
+
}
|
|
16242
16285
|
return warnings;
|
|
16243
16286
|
}
|
|
16244
16287
|
function harnessesWiredToHarnessTrim(configs) {
|
|
@@ -16332,7 +16375,7 @@ function metricsLocations(context) {
|
|
|
16332
16375
|
async function detect6(context) {
|
|
16333
16376
|
const probe = await probeExecutable(context);
|
|
16334
16377
|
const observed = probe.installed ? await probeCapabilities(context) : null;
|
|
16335
|
-
const configured =
|
|
16378
|
+
const configured = await configuredHarnessesForHarnessTrim(context, observed?.capabilities ?? null);
|
|
16336
16379
|
const warnings = [];
|
|
16337
16380
|
const evidenceItems = [...probe.evidence, ...observed?.evidence ?? []];
|
|
16338
16381
|
if (observed !== null && observed.capabilities !== null) {
|
|
@@ -16496,11 +16539,12 @@ async function verify6(context) {
|
|
|
16496
16539
|
evidence: probe.evidence,
|
|
16497
16540
|
remediation: probe.installed ? null : "Install HarnessTrim, or add it to PATH"
|
|
16498
16541
|
});
|
|
16499
|
-
const
|
|
16542
|
+
const currentCapabilities = probe.installed ? await probeCapabilities(context) : null;
|
|
16543
|
+
const configured = await configuredHarnessesForHarnessTrim(context, currentCapabilities?.capabilities ?? null);
|
|
16500
16544
|
checks.push({
|
|
16501
|
-
id: "
|
|
16545
|
+
id: "integration-configured",
|
|
16502
16546
|
status: configured.length > 0 ? "pass" : "not-exercised",
|
|
16503
|
-
summary: configured.length > 0 ? `
|
|
16547
|
+
summary: configured.length > 0 ? `configured for ${configured.join(", ")}` : "no HarnessTrim hook, plugin, or matching skills-only installation was found",
|
|
16504
16548
|
achievedTier: configured.length > 0 ? "config-only" : null,
|
|
16505
16549
|
evidence: [],
|
|
16506
16550
|
remediation: null
|
|
@@ -16716,16 +16760,46 @@ async function collectMetrics(context, store) {
|
|
|
16716
16760
|
diagnostics
|
|
16717
16761
|
};
|
|
16718
16762
|
}
|
|
16719
|
-
function skillArtifacts(context, harness) {
|
|
16763
|
+
function skillArtifacts(context, harness, capabilities = null) {
|
|
16720
16764
|
const install = SKILLS_INSTALL[harness];
|
|
16721
16765
|
if (install === void 0)
|
|
16722
16766
|
return [];
|
|
16767
|
+
const dynamic = capabilities === null ? [] : publishedSkillArtifactDigests(capabilities, harness).map(([path, digest]) => ({
|
|
16768
|
+
path: context.fs.join(context.projectRoot, ...path.split("/")),
|
|
16769
|
+
digest
|
|
16770
|
+
}));
|
|
16771
|
+
if (dynamic.length > 0)
|
|
16772
|
+
return dynamic;
|
|
16773
|
+
if (capabilities !== null && requiresRuntimeSkillDigests(capabilities))
|
|
16774
|
+
return [];
|
|
16723
16775
|
const skills = context.fs.join(context.projectRoot, install.directory, "skills");
|
|
16724
16776
|
return Object.entries(SKILL_ARTIFACT_DIGESTS).map(([path, digest]) => ({
|
|
16725
16777
|
path: context.fs.join(skills, ...path.split("/")),
|
|
16726
16778
|
digest
|
|
16727
16779
|
}));
|
|
16728
16780
|
}
|
|
16781
|
+
async function harnessTrimSkillsConfigured(context, harness, capabilities) {
|
|
16782
|
+
const artifacts = skillArtifacts(context, harness, capabilities);
|
|
16783
|
+
if (artifacts.length === 0)
|
|
16784
|
+
return false;
|
|
16785
|
+
for (const artifact of artifacts) {
|
|
16786
|
+
const stat3 = await context.fs.stat(artifact.path);
|
|
16787
|
+
if (stat3 === null || stat3.kind !== "file")
|
|
16788
|
+
return false;
|
|
16789
|
+
const actual = digestText(new TextDecoder().decode(await context.fs.readFile(artifact.path)));
|
|
16790
|
+
if (actual !== artifact.digest)
|
|
16791
|
+
return false;
|
|
16792
|
+
}
|
|
16793
|
+
return true;
|
|
16794
|
+
}
|
|
16795
|
+
async function configuredHarnessesForHarnessTrim(context, capabilities) {
|
|
16796
|
+
const configured = new Set(harnessesWiredToHarnessTrim(context.harnessConfigs));
|
|
16797
|
+
for (const harness of [CLAUDE2, CODEX2]) {
|
|
16798
|
+
if (await harnessTrimSkillsConfigured(context, harness, capabilities))
|
|
16799
|
+
configured.add(harness);
|
|
16800
|
+
}
|
|
16801
|
+
return [...configured];
|
|
16802
|
+
}
|
|
16729
16803
|
async function plan(context, request) {
|
|
16730
16804
|
const reviews = MANIFEST6.delegatedInstallReviews ?? {};
|
|
16731
16805
|
const targets = request.harnesses.map((harness) => harness.id).filter((harness) => reviews[harness] !== void 0 && SKILLS_INSTALL[harness] !== void 0);
|
|
@@ -16737,8 +16811,11 @@ async function plan(context, request) {
|
|
|
16737
16811
|
targetHarnesses: []
|
|
16738
16812
|
};
|
|
16739
16813
|
}
|
|
16814
|
+
const installed2 = await probeExecutable(context);
|
|
16815
|
+
const observed = installed2.installed ? await probeCapabilities(context) : null;
|
|
16816
|
+
const currentCapabilities = observed?.capabilities ?? null;
|
|
16740
16817
|
if (request.desiredState === "absent") {
|
|
16741
|
-
const actions2 = targets.flatMap((harness) => skillArtifacts(context, harness).map((artifact) => ({
|
|
16818
|
+
const actions2 = targets.flatMap((harness) => skillArtifacts(context, harness, currentCapabilities).map((artifact) => ({
|
|
16742
16819
|
kind: "remove-owned-change",
|
|
16743
16820
|
id: `harnesstrim-${harness}-skill-remove-${digestText(artifact.path).slice(7, 15)}`,
|
|
16744
16821
|
riskClass: "reversible",
|
|
@@ -16747,7 +16824,7 @@ async function plan(context, request) {
|
|
|
16747
16824
|
affectedPaths: [artifact.path],
|
|
16748
16825
|
affectedProcesses: [],
|
|
16749
16826
|
preconditions: [
|
|
16750
|
-
`the HarnessTrim skill still matches the
|
|
16827
|
+
`the HarnessTrim skill still matches the installed HarnessTrim artifact contract`
|
|
16751
16828
|
],
|
|
16752
16829
|
postconditions: ["the owned HarnessTrim skill is absent"],
|
|
16753
16830
|
rollbackData: "file-snapshot",
|
|
@@ -16768,7 +16845,6 @@ async function plan(context, request) {
|
|
|
16768
16845
|
targetHarnesses: actions2.length === 0 ? [] : targets.map((harness) => harnessId(harness))
|
|
16769
16846
|
};
|
|
16770
16847
|
}
|
|
16771
|
-
const installed2 = await probeExecutable(context);
|
|
16772
16848
|
if (!installed2.installed) {
|
|
16773
16849
|
return {
|
|
16774
16850
|
providerId: HARNESSTRIM2,
|
|
@@ -16777,7 +16853,6 @@ async function plan(context, request) {
|
|
|
16777
16853
|
targetHarnesses: []
|
|
16778
16854
|
};
|
|
16779
16855
|
}
|
|
16780
|
-
const observed = await probeCapabilities(context);
|
|
16781
16856
|
const actions = [];
|
|
16782
16857
|
const plannedHarnesses = [];
|
|
16783
16858
|
for (const harness of targets) {
|
|
@@ -16785,10 +16860,12 @@ async function plan(context, request) {
|
|
|
16785
16860
|
const install = SKILLS_INSTALL[harness];
|
|
16786
16861
|
if (review === void 0 || install === void 0)
|
|
16787
16862
|
continue;
|
|
16788
|
-
const reviewed =
|
|
16863
|
+
const reviewed = currentCapabilities === null ? installed2.version === review.upstreamVersion : writeSetStillReviewed(currentCapabilities, harnessId(harness));
|
|
16789
16864
|
if (!reviewed)
|
|
16790
16865
|
continue;
|
|
16791
|
-
const expectedArtifacts = skillArtifacts(context, harness);
|
|
16866
|
+
const expectedArtifacts = skillArtifacts(context, harness, currentCapabilities);
|
|
16867
|
+
if (expectedArtifacts.length === 0)
|
|
16868
|
+
continue;
|
|
16792
16869
|
actions.push({
|
|
16793
16870
|
kind: "delegated-provider-install",
|
|
16794
16871
|
id: `harnesstrim-${harness}-skills-${digestText(context.projectRoot).slice(7, 15)}`,
|
|
@@ -16798,11 +16875,11 @@ async function plan(context, request) {
|
|
|
16798
16875
|
affectedPaths: expectedArtifacts.map((artifact) => artifact.path),
|
|
16799
16876
|
affectedProcesses: ["harnesstrim"],
|
|
16800
16877
|
preconditions: [
|
|
16801
|
-
"harnesstrim is installed, on PATH, and declares
|
|
16802
|
-
`the
|
|
16878
|
+
"harnesstrim is installed, on PATH, and declares a compatible write set",
|
|
16879
|
+
`the installed HarnessTrim build publishes the exact ${harness} skill artifact contract`
|
|
16803
16880
|
],
|
|
16804
16881
|
postconditions: [
|
|
16805
|
-
`HarnessTrim ${harness} skills match the
|
|
16882
|
+
`HarnessTrim ${harness} skills match the installed ${installed2.version ?? review.upstreamVersion} artifact contract`,
|
|
16806
16883
|
"no HarnessTrim hook or reduce-pipe instruction was added"
|
|
16807
16884
|
],
|
|
16808
16885
|
rollbackData: "directory-snapshot",
|
|
@@ -16829,7 +16906,7 @@ async function plan(context, request) {
|
|
|
16829
16906
|
targetHarnesses: plannedHarnesses
|
|
16830
16907
|
};
|
|
16831
16908
|
}
|
|
16832
|
-
var HARNESSTRIM2, CLAUDE2, HERMES2, CODEX2, PI2, SKILLS_UPSTREAM, 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, harnesstrimAdapter;
|
|
16909
|
+
var HARNESSTRIM2, CLAUDE2, HERMES2, CODEX2, 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, harnesstrimAdapter;
|
|
16833
16910
|
var init_harnesstrim = __esm({
|
|
16834
16911
|
"packages/adapters/dist/src/providers/harnesstrim.js"() {
|
|
16835
16912
|
"use strict";
|
|
@@ -16840,6 +16917,7 @@ var init_harnesstrim = __esm({
|
|
|
16840
16917
|
CODEX2 = harnessId("codex");
|
|
16841
16918
|
PI2 = harnessId("pi");
|
|
16842
16919
|
SKILLS_UPSTREAM = "0.0.7";
|
|
16920
|
+
RUNTIME_SKILL_DIGESTS_MINIMUM = "0.3.0";
|
|
16843
16921
|
SKILL_ARTIFACT_DIGESTS = {
|
|
16844
16922
|
"compact-handoff/SKILL.md": "sha256:0efbf35581c559359e755b204778b64a289dab4d20dadc1cba3d5b5c995b5f01",
|
|
16845
16923
|
"debug-log-slim/SKILL.md": "sha256:17f5ccc34d29d7aba083444e0e4d87fd3d49916ebcb4e6544caf8c89f13f0045",
|
|
@@ -18088,13 +18166,62 @@ var init_gitnexus_candidate = __esm({
|
|
|
18088
18166
|
function claudeTarget(context) {
|
|
18089
18167
|
return context.fs.join(context.paths.home, ".claude.json");
|
|
18090
18168
|
}
|
|
18091
|
-
function
|
|
18169
|
+
async function observeGitNexusManagedRuntime(context) {
|
|
18170
|
+
const versionOutcome = await context.runner.run({
|
|
18171
|
+
executable: "gitnexus",
|
|
18172
|
+
args: ["--version"],
|
|
18173
|
+
cwd: context.projectRoot,
|
|
18174
|
+
timeoutMs: 2e4
|
|
18175
|
+
});
|
|
18176
|
+
if (versionOutcome.failure !== null) {
|
|
18177
|
+
return {
|
|
18178
|
+
ready: false,
|
|
18179
|
+
absent: versionOutcome.failure.reason === "executable-not-found",
|
|
18180
|
+
version: null,
|
|
18181
|
+
executable: versionOutcome.executablePath,
|
|
18182
|
+
supportsMcp: false,
|
|
18183
|
+
detail: `gitnexus --version failed: ${versionOutcome.failure.reason}`
|
|
18184
|
+
};
|
|
18185
|
+
}
|
|
18186
|
+
const version3 = parseGitNexusVersion(`${versionOutcome.stdout}
|
|
18187
|
+
${versionOutcome.stderr}`);
|
|
18188
|
+
const actual = version3 === null ? null : parseSemanticVersion(version3);
|
|
18189
|
+
const floor = parseSemanticVersion(GITNEXUS_REVIEWED_MCP_VERSION);
|
|
18190
|
+
const newEnough = actual !== null && floor !== null && compareVersions(actual, floor) >= 0;
|
|
18191
|
+
if (versionOutcome.exitCode !== 0 || !newEnough) {
|
|
18192
|
+
return {
|
|
18193
|
+
ready: false,
|
|
18194
|
+
absent: false,
|
|
18195
|
+
version: version3,
|
|
18196
|
+
executable: versionOutcome.executablePath,
|
|
18197
|
+
supportsMcp: false,
|
|
18198
|
+
detail: version3 === null ? "GitNexus did not report a semantic version" : `GitNexus ${version3} predates the managed MCP floor ${GITNEXUS_REVIEWED_MCP_VERSION}`
|
|
18199
|
+
};
|
|
18200
|
+
}
|
|
18201
|
+
const help = await context.runner.run({
|
|
18202
|
+
executable: "gitnexus",
|
|
18203
|
+
args: ["--help"],
|
|
18204
|
+
cwd: context.projectRoot,
|
|
18205
|
+
timeoutMs: 2e4
|
|
18206
|
+
});
|
|
18207
|
+
const capabilities = help.failure === null && help.exitCode === 0 ? parseGitNexusCliCapabilities(`${help.stdout}
|
|
18208
|
+
${help.stderr}`, "") : { query: false, context: false, statusJson: false, mcp: false };
|
|
18209
|
+
return {
|
|
18210
|
+
ready: capabilities.mcp,
|
|
18211
|
+
absent: false,
|
|
18212
|
+
version: version3,
|
|
18213
|
+
executable: versionOutcome.executablePath,
|
|
18214
|
+
supportsMcp: capabilities.mcp,
|
|
18215
|
+
detail: capabilities.mcp ? `GitNexus ${version3} exposes the MCP command required by the managed Claude integration` : `GitNexus ${version3} does not advertise the MCP command required by the managed Claude integration`
|
|
18216
|
+
};
|
|
18217
|
+
}
|
|
18218
|
+
function prerequisiteDiagnostic(harness, detail2) {
|
|
18092
18219
|
return diagnostic({
|
|
18093
18220
|
severity: "warning",
|
|
18094
18221
|
code: "gitnexus-managed-mcp-prerequisite",
|
|
18095
18222
|
subject: harness,
|
|
18096
|
-
message:
|
|
18097
|
-
remediation: `
|
|
18223
|
+
message: detail2,
|
|
18224
|
+
remediation: `Install or update GitNexus to ${GITNEXUS_REVIEWED_MCP_VERSION} or newer with the MCP command, then refresh Token Harness`
|
|
18098
18225
|
});
|
|
18099
18226
|
}
|
|
18100
18227
|
async function planGitNexusManagedMcpActivation(context, harness) {
|
|
@@ -18114,13 +18241,13 @@ async function planGitNexusManagedMcpActivation(context, harness) {
|
|
|
18114
18241
|
]
|
|
18115
18242
|
};
|
|
18116
18243
|
}
|
|
18117
|
-
const observation = await
|
|
18118
|
-
if (observation.
|
|
18244
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
18245
|
+
if (!observation.ready) {
|
|
18119
18246
|
return {
|
|
18120
18247
|
harness,
|
|
18121
18248
|
target: null,
|
|
18122
18249
|
actions: [],
|
|
18123
|
-
diagnostics: [prerequisiteDiagnostic(harness, observation.
|
|
18250
|
+
diagnostics: [prerequisiteDiagnostic(harness, observation.detail)]
|
|
18124
18251
|
};
|
|
18125
18252
|
}
|
|
18126
18253
|
const target = claudeTarget(context);
|
|
@@ -18287,12 +18414,12 @@ async function verifyGitNexusManagedMcpActivation(context, harness) {
|
|
|
18287
18414
|
detail: "Managed GitNexus MCP verification is currently reviewed only for Claude Code"
|
|
18288
18415
|
};
|
|
18289
18416
|
}
|
|
18290
|
-
const observation = await
|
|
18291
|
-
if (observation.
|
|
18417
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
18418
|
+
if (!observation.ready) {
|
|
18292
18419
|
return {
|
|
18293
18420
|
state: "candidate-unavailable",
|
|
18294
18421
|
target: null,
|
|
18295
|
-
detail: observation.
|
|
18422
|
+
detail: observation.detail
|
|
18296
18423
|
};
|
|
18297
18424
|
}
|
|
18298
18425
|
const target = claudeTarget(context);
|
|
@@ -18327,7 +18454,7 @@ async function verifyGitNexusManagedMcpActivation(context, harness) {
|
|
|
18327
18454
|
return {
|
|
18328
18455
|
state: "verified",
|
|
18329
18456
|
target,
|
|
18330
|
-
detail: `GitNexus ${
|
|
18457
|
+
detail: `GitNexus ${observation.version ?? ""} is registered through the Token Harness-owned Claude MCP entry; verification did not start the MCP server`
|
|
18331
18458
|
};
|
|
18332
18459
|
}
|
|
18333
18460
|
var GITNEXUS_REVIEWED_MCP_VERSION, GITNEXUS_CLAUDE_MCP_POINTER, GITNEXUS_MCP_SERVER, DECODER;
|
|
@@ -18479,6 +18606,28 @@ var init_headroom_candidate = __esm({
|
|
|
18479
18606
|
function parseMcptoonVersion(text3) {
|
|
18480
18607
|
return VERSION_PATTERN10.exec(text3)?.[1] ?? null;
|
|
18481
18608
|
}
|
|
18609
|
+
function numericCore2(version3) {
|
|
18610
|
+
const core = version3.split(/[-+]/, 1)[0];
|
|
18611
|
+
if (core === void 0)
|
|
18612
|
+
return null;
|
|
18613
|
+
const parts = core.split(".").map((part) => Number.parseInt(part, 10));
|
|
18614
|
+
if (parts.length !== 3 || parts.some((part) => !Number.isInteger(part) || part < 0))
|
|
18615
|
+
return null;
|
|
18616
|
+
return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];
|
|
18617
|
+
}
|
|
18618
|
+
function mcptoonVersionAtLeast(version3, minimum) {
|
|
18619
|
+
const actual = numericCore2(version3);
|
|
18620
|
+
const floor = numericCore2(minimum);
|
|
18621
|
+
if (actual === null || floor === null)
|
|
18622
|
+
return false;
|
|
18623
|
+
for (let index = 0; index < 3; index += 1) {
|
|
18624
|
+
const left = actual[index] ?? 0;
|
|
18625
|
+
const right = floor[index] ?? 0;
|
|
18626
|
+
if (left !== right)
|
|
18627
|
+
return left > right;
|
|
18628
|
+
}
|
|
18629
|
+
return !(version3.includes("-") && !minimum.includes("-"));
|
|
18630
|
+
}
|
|
18482
18631
|
function parseMcptoonManifestCapabilities(text3) {
|
|
18483
18632
|
const lower = text3.toLowerCase();
|
|
18484
18633
|
return {
|
|
@@ -18586,6 +18735,50 @@ var init_mcptoon_candidate = __esm({
|
|
|
18586
18735
|
});
|
|
18587
18736
|
|
|
18588
18737
|
// packages/adapters/dist/src/providers/mcptoon-managed.js
|
|
18738
|
+
async function observeMcptoonManagedRuntime(context) {
|
|
18739
|
+
const versionOutcome = await context.runner.run({
|
|
18740
|
+
executable: "mcptoon",
|
|
18741
|
+
args: ["--version"],
|
|
18742
|
+
cwd: context.projectRoot,
|
|
18743
|
+
timeoutMs: 2e4
|
|
18744
|
+
});
|
|
18745
|
+
if (versionOutcome.failure !== null) {
|
|
18746
|
+
return {
|
|
18747
|
+
ready: false,
|
|
18748
|
+
absent: versionOutcome.failure.reason === "executable-not-found",
|
|
18749
|
+
version: null,
|
|
18750
|
+
executable: versionOutcome.executablePath,
|
|
18751
|
+
detail: `mcptoon --version failed: ${versionOutcome.failure.reason}`
|
|
18752
|
+
};
|
|
18753
|
+
}
|
|
18754
|
+
const version3 = parseMcptoonVersion(`${versionOutcome.stdout}
|
|
18755
|
+
${versionOutcome.stderr}`);
|
|
18756
|
+
if (versionOutcome.exitCode !== 0 || version3 === null || !mcptoonVersionAtLeast(version3, MCPTOON_MANAGED_MINIMUM_VERSION)) {
|
|
18757
|
+
return {
|
|
18758
|
+
ready: false,
|
|
18759
|
+
absent: false,
|
|
18760
|
+
version: version3,
|
|
18761
|
+
executable: versionOutcome.executablePath,
|
|
18762
|
+
detail: version3 === null ? "mcptoon did not report a semantic version" : `mcptoon ${version3} predates the managed runtime floor ${MCPTOON_MANAGED_MINIMUM_VERSION}`
|
|
18763
|
+
};
|
|
18764
|
+
}
|
|
18765
|
+
const help = await context.runner.run({
|
|
18766
|
+
executable: "mcptoon",
|
|
18767
|
+
args: ["--help"],
|
|
18768
|
+
cwd: context.projectRoot,
|
|
18769
|
+
timeoutMs: 2e4
|
|
18770
|
+
});
|
|
18771
|
+
const capabilities = help.failure === null && help.exitCode === 0 ? parseMcptoonManifestCapabilities(`${help.stdout}
|
|
18772
|
+
${help.stderr}`) : { compact: false, json: false };
|
|
18773
|
+
const ready = capabilities.compact && capabilities.json;
|
|
18774
|
+
return {
|
|
18775
|
+
ready,
|
|
18776
|
+
absent: false,
|
|
18777
|
+
version: version3,
|
|
18778
|
+
executable: versionOutcome.executablePath,
|
|
18779
|
+
detail: ready ? `mcptoon ${version3} exposes the compact/JSON CLI surfaces used by the managed integration` : `mcptoon ${version3} no longer advertises the compact/JSON CLI surfaces required by the managed integration`
|
|
18780
|
+
};
|
|
18781
|
+
}
|
|
18589
18782
|
function mcptoonInstallAction() {
|
|
18590
18783
|
return {
|
|
18591
18784
|
kind: "package-manager-install",
|
|
@@ -18811,11 +19004,11 @@ async function planMcptoonManagedActivation(context, harness) {
|
|
|
18811
19004
|
]
|
|
18812
19005
|
};
|
|
18813
19006
|
}
|
|
18814
|
-
const observation = await
|
|
19007
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
18815
19008
|
const activation = harness === "claude" ? await planClaudeActivation(context, harness) : await planCodexActivation(context, harness);
|
|
18816
|
-
if (observation.
|
|
19009
|
+
if (observation.ready)
|
|
18817
19010
|
return activation;
|
|
18818
|
-
if (observation.
|
|
19011
|
+
if (observation.absent) {
|
|
18819
19012
|
const activationSatisfied = activation.diagnostics.some((entry) => entry.code === "mcptoon-guidance-already-present");
|
|
18820
19013
|
if (activation.actions.length === 0 && !activationSatisfied) {
|
|
18821
19014
|
return activation;
|
|
@@ -18867,19 +19060,19 @@ async function planMcptoonManagedActivation(context, harness) {
|
|
|
18867
19060
|
severity: "warning",
|
|
18868
19061
|
code: "mcptoon-managed-prerequisite",
|
|
18869
19062
|
subject: harness,
|
|
18870
|
-
message:
|
|
18871
|
-
remediation: `
|
|
19063
|
+
message: observation.detail,
|
|
19064
|
+
remediation: `Update mcptoon to ${MCPTOON_MANAGED_MINIMUM_VERSION} or newer with the required compact/JSON CLI surfaces, then refresh Token Harness`
|
|
18872
19065
|
})
|
|
18873
19066
|
]
|
|
18874
19067
|
};
|
|
18875
19068
|
}
|
|
18876
19069
|
async function verifyMcptoonManagedActivation(context, harness) {
|
|
18877
|
-
const observation = await
|
|
18878
|
-
if (observation.
|
|
19070
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
19071
|
+
if (!observation.ready) {
|
|
18879
19072
|
return {
|
|
18880
19073
|
state: "candidate-unavailable",
|
|
18881
19074
|
target: null,
|
|
18882
|
-
detail: observation.
|
|
19075
|
+
detail: observation.detail
|
|
18883
19076
|
};
|
|
18884
19077
|
}
|
|
18885
19078
|
let target;
|
|
@@ -18906,22 +19099,23 @@ async function verifyMcptoonManagedActivation(context, harness) {
|
|
|
18906
19099
|
return {
|
|
18907
19100
|
state: "not-configured",
|
|
18908
19101
|
target,
|
|
18909
|
-
detail: "The
|
|
19102
|
+
detail: "The Token Harness mcptoon agent instructions are not present"
|
|
18910
19103
|
};
|
|
18911
19104
|
}
|
|
18912
19105
|
return {
|
|
18913
19106
|
state: "verified",
|
|
18914
19107
|
target,
|
|
18915
|
-
detail:
|
|
19108
|
+
detail: `Agent instructions are present and mcptoon ${observation.version ?? ""} exposes the required passive CLI capabilities`
|
|
18916
19109
|
};
|
|
18917
19110
|
}
|
|
18918
|
-
var MCPTOON_REVIEWED_INSTALL_VERSION, MCPTOON_MARKER_BEGIN, MCPTOON_MARKER_END, MCPTOON_AGENT_INSTRUCTIONS, MCPTOON_CLAUDE_SKILL, DECODER2;
|
|
19111
|
+
var MCPTOON_REVIEWED_INSTALL_VERSION, MCPTOON_MANAGED_MINIMUM_VERSION, MCPTOON_MARKER_BEGIN, MCPTOON_MARKER_END, MCPTOON_AGENT_INSTRUCTIONS, MCPTOON_CLAUDE_SKILL, DECODER2;
|
|
18919
19112
|
var init_mcptoon_managed = __esm({
|
|
18920
19113
|
"packages/adapters/dist/src/providers/mcptoon-managed.js"() {
|
|
18921
19114
|
"use strict";
|
|
18922
19115
|
init_src();
|
|
18923
19116
|
init_mcptoon_candidate();
|
|
18924
19117
|
MCPTOON_REVIEWED_INSTALL_VERSION = "0.7.10";
|
|
19118
|
+
MCPTOON_MANAGED_MINIMUM_VERSION = MCPTOON_REVIEWED_INSTALL_VERSION;
|
|
18925
19119
|
MCPTOON_MARKER_BEGIN = "TOKEN-HARNESS:MCPTOON:BEGIN";
|
|
18926
19120
|
MCPTOON_MARKER_END = "TOKEN-HARNESS:MCPTOON:END";
|
|
18927
19121
|
MCPTOON_AGENT_INSTRUCTIONS = `Use mcptoon as the CLI gateway for MCP tools when a task needs one.
|
|
@@ -18961,7 +19155,7 @@ function warning(code, subject, message) {
|
|
|
18961
19155
|
code,
|
|
18962
19156
|
subject,
|
|
18963
19157
|
message,
|
|
18964
|
-
remediation: "
|
|
19158
|
+
remediation: "Update the provider or restore the CLI capability this managed integration requires, then refresh Token Harness."
|
|
18965
19159
|
});
|
|
18966
19160
|
}
|
|
18967
19161
|
function unavailableMetrics(provider) {
|
|
@@ -18976,53 +19170,49 @@ function unavailableMetrics(provider) {
|
|
|
18976
19170
|
};
|
|
18977
19171
|
}
|
|
18978
19172
|
async function mcptoonDetection(context) {
|
|
18979
|
-
const observation = await
|
|
19173
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
18980
19174
|
const configuredHarnesses = [];
|
|
18981
|
-
if (observation.
|
|
19175
|
+
if (observation.ready) {
|
|
18982
19176
|
for (const harness of [CLAUDE5, CODEX3]) {
|
|
18983
19177
|
const verification = await verifyMcptoonManagedActivation(context, harness);
|
|
18984
19178
|
if (verification.state === "verified")
|
|
18985
19179
|
configuredHarnesses.push(harness);
|
|
18986
19180
|
}
|
|
18987
19181
|
}
|
|
18988
|
-
const warnings = observation.
|
|
18989
|
-
warning("mcptoon-provider-version-unreviewed", "mcptoon", observation.reasons[0] ?? "The installed mcptoon version is outside the reviewed row.")
|
|
18990
|
-
] : [];
|
|
19182
|
+
const warnings = !observation.absent && !observation.ready ? [warning("mcptoon-provider-capability-unavailable", "mcptoon", observation.detail)] : [];
|
|
18991
19183
|
return {
|
|
18992
19184
|
providerId: MCPTOON,
|
|
18993
|
-
state: observation.
|
|
19185
|
+
state: observation.absent ? "absent" : configuredHarnesses.length > 0 ? "configured" : "installed",
|
|
18994
19186
|
version: observation.version,
|
|
18995
19187
|
executable: observation.executable,
|
|
18996
|
-
installationChannel: observation.
|
|
19188
|
+
installationChannel: observation.absent ? "pipx" : null,
|
|
18997
19189
|
versionVerdict: versionVerdict(observation.version, MCPTOON_REVIEWED_BENCHMARK_VERSION),
|
|
18998
19190
|
configuredHarnesses,
|
|
18999
19191
|
unmanagedHarnessesConfigured: [],
|
|
19000
19192
|
supportsUnmanagedHarnesses: false,
|
|
19001
19193
|
managedByTokenHarness: false,
|
|
19002
|
-
assignableHarnesses: observation.
|
|
19194
|
+
assignableHarnesses: observation.ready ? [CLAUDE5, CODEX3] : [],
|
|
19003
19195
|
evidence: [],
|
|
19004
19196
|
warnings
|
|
19005
19197
|
};
|
|
19006
19198
|
}
|
|
19007
19199
|
async function gitnexusDetection(context) {
|
|
19008
|
-
const observation = await
|
|
19009
|
-
const verification = observation.
|
|
19200
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
19201
|
+
const verification = observation.ready ? await verifyGitNexusManagedMcpActivation(context, CLAUDE5) : null;
|
|
19010
19202
|
const configuredHarnesses = verification?.state === "verified" ? [CLAUDE5] : [];
|
|
19011
|
-
const warnings = observation.
|
|
19012
|
-
warning("gitnexus-provider-version-unreviewed", "gitnexus", observation.reasons[0] ?? "The installed GitNexus version is outside the reviewed row.")
|
|
19013
|
-
] : [];
|
|
19203
|
+
const warnings = !observation.absent && !observation.ready ? [warning("gitnexus-provider-capability-unavailable", "gitnexus", observation.detail)] : [];
|
|
19014
19204
|
return {
|
|
19015
19205
|
providerId: GITNEXUS,
|
|
19016
|
-
state: observation.
|
|
19206
|
+
state: observation.absent ? "absent" : configuredHarnesses.length > 0 ? "configured" : "installed",
|
|
19017
19207
|
version: observation.version,
|
|
19018
19208
|
executable: observation.executable,
|
|
19019
|
-
installationChannel: observation.
|
|
19209
|
+
installationChannel: observation.absent ? "npm" : null,
|
|
19020
19210
|
versionVerdict: versionVerdict(observation.version, GITNEXUS_REVIEWED_BENCHMARK_VERSION),
|
|
19021
19211
|
configuredHarnesses,
|
|
19022
19212
|
unmanagedHarnessesConfigured: [],
|
|
19023
19213
|
supportsUnmanagedHarnesses: false,
|
|
19024
19214
|
managedByTokenHarness: false,
|
|
19025
|
-
assignableHarnesses: observation.
|
|
19215
|
+
assignableHarnesses: observation.ready ? [CLAUDE5] : [],
|
|
19026
19216
|
evidence: [],
|
|
19027
19217
|
warnings
|
|
19028
19218
|
};
|
|
@@ -19322,12 +19512,15 @@ function directoryAction2(harness, path) {
|
|
|
19322
19512
|
path
|
|
19323
19513
|
};
|
|
19324
19514
|
}
|
|
19325
|
-
async function
|
|
19515
|
+
async function headroomManagedMcpRuntime(context) {
|
|
19326
19516
|
const observation = await observeHeadroomCandidate(context);
|
|
19327
|
-
|
|
19517
|
+
const compatible = observation.version !== null && headroomVersionAtLeast(observation.version, HEADROOM_REVIEWED_MCP_VERSION);
|
|
19518
|
+
if (!compatible) {
|
|
19328
19519
|
return {
|
|
19329
19520
|
ok: false,
|
|
19330
|
-
|
|
19521
|
+
version: observation.version,
|
|
19522
|
+
executable: observation.executable,
|
|
19523
|
+
detail: observation.version === null ? `Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer is not installed` : `Headroom ${observation.version} predates the managed MCP floor ${HEADROOM_REVIEWED_MCP_VERSION}`
|
|
19331
19524
|
};
|
|
19332
19525
|
}
|
|
19333
19526
|
const help = await context.runner.run({
|
|
@@ -19339,12 +19532,16 @@ async function reviewedMcpCliAvailable(context) {
|
|
|
19339
19532
|
if (help.failure !== null || help.exitCode !== 0) {
|
|
19340
19533
|
return {
|
|
19341
19534
|
ok: false,
|
|
19342
|
-
|
|
19535
|
+
version: observation.version,
|
|
19536
|
+
executable: observation.executable,
|
|
19537
|
+
detail: `Headroom ${observation.version} is installed but its MCP server command is unavailable`
|
|
19343
19538
|
};
|
|
19344
19539
|
}
|
|
19345
19540
|
return {
|
|
19346
19541
|
ok: true,
|
|
19347
|
-
|
|
19542
|
+
version: observation.version,
|
|
19543
|
+
executable: observation.executable,
|
|
19544
|
+
detail: `Headroom ${observation.version} exposes the local MCP server required by the managed integration`
|
|
19348
19545
|
};
|
|
19349
19546
|
}
|
|
19350
19547
|
function prerequisite(harness, detail2) {
|
|
@@ -19358,7 +19555,7 @@ function prerequisite(harness, detail2) {
|
|
|
19358
19555
|
code: "headroom-managed-mcp-prerequisite",
|
|
19359
19556
|
subject: harness,
|
|
19360
19557
|
message: detail2,
|
|
19361
|
-
remediation: `Install
|
|
19558
|
+
remediation: `Install Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer with its MCP extra using your existing Python/uv tooling, then refresh Token Harness. Token Harness will not install Python, uv, or system prerequisites implicitly.`
|
|
19362
19559
|
})
|
|
19363
19560
|
]
|
|
19364
19561
|
};
|
|
@@ -19612,9 +19809,9 @@ async function planCodex(context, harness) {
|
|
|
19612
19809
|
affectedPaths: [target],
|
|
19613
19810
|
affectedProcesses: [],
|
|
19614
19811
|
preconditions: ["No Headroom MCP table or Token Harness Headroom marker block exists"],
|
|
19615
|
-
postconditions: ["Codex config contains exactly one
|
|
19812
|
+
postconditions: ["Codex config contains exactly one Token Harness Headroom MCP server block"],
|
|
19616
19813
|
rollbackData: "file-snapshot",
|
|
19617
|
-
explanation: "Register the installed
|
|
19814
|
+
explanation: "Register the installed Headroom CLI as a Codex MCP server",
|
|
19618
19815
|
path: target,
|
|
19619
19816
|
markerBegin: HEADROOM_CODEX_MARKER_BEGIN,
|
|
19620
19817
|
markerEnd: HEADROOM_CODEX_MARKER_END,
|
|
@@ -19643,7 +19840,7 @@ async function planHeadroomManagedMcpActivation(context, harness) {
|
|
|
19643
19840
|
]
|
|
19644
19841
|
};
|
|
19645
19842
|
}
|
|
19646
|
-
const cli = await
|
|
19843
|
+
const cli = await headroomManagedMcpRuntime(context);
|
|
19647
19844
|
if (!cli.ok)
|
|
19648
19845
|
return prerequisite(harness, cli.detail);
|
|
19649
19846
|
return harness === "claude" ? planClaude(context, harness) : planCodex(context, harness);
|
|
@@ -19670,7 +19867,7 @@ function headroomOwnedArtifact(context, harness) {
|
|
|
19670
19867
|
return null;
|
|
19671
19868
|
}
|
|
19672
19869
|
async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
19673
|
-
const cli = await
|
|
19870
|
+
const cli = await headroomManagedMcpRuntime(context);
|
|
19674
19871
|
if (!cli.ok)
|
|
19675
19872
|
return { state: "candidate-unavailable", target: null, detail: cli.detail };
|
|
19676
19873
|
if (harness === "claude") {
|
|
@@ -19693,13 +19890,13 @@ async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
|
19693
19890
|
return {
|
|
19694
19891
|
state: "degraded",
|
|
19695
19892
|
target,
|
|
19696
|
-
detail: "Headroom MCP entry differs from the
|
|
19893
|
+
detail: "Headroom MCP entry differs from the Token Harness managed command"
|
|
19697
19894
|
};
|
|
19698
19895
|
}
|
|
19699
19896
|
return {
|
|
19700
19897
|
state: "verified",
|
|
19701
19898
|
target,
|
|
19702
|
-
detail: `${cli.detail}; Claude registration matches the
|
|
19899
|
+
detail: `${cli.detail}; Claude registration matches the managed entry`
|
|
19703
19900
|
};
|
|
19704
19901
|
}
|
|
19705
19902
|
if (harness === "codex") {
|
|
@@ -19719,12 +19916,12 @@ async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
|
19719
19916
|
return {
|
|
19720
19917
|
state: "not-configured",
|
|
19721
19918
|
target,
|
|
19722
|
-
detail: "
|
|
19919
|
+
detail: "Token Harness Headroom Codex MCP block is absent"
|
|
19723
19920
|
};
|
|
19724
19921
|
return {
|
|
19725
19922
|
state: "verified",
|
|
19726
19923
|
target,
|
|
19727
|
-
detail: `${cli.detail}; Codex registration matches the
|
|
19924
|
+
detail: `${cli.detail}; Codex registration matches the managed owned block`
|
|
19728
19925
|
};
|
|
19729
19926
|
}
|
|
19730
19927
|
return {
|
|
@@ -19760,14 +19957,15 @@ function manualInstallWarning() {
|
|
|
19760
19957
|
severity: "warning",
|
|
19761
19958
|
code: "headroom-uv-install-prerequisite",
|
|
19762
19959
|
subject: "headroom",
|
|
19763
|
-
message: `Headroom ${HEADROOM_REVIEWED_MCP_VERSION} is not installed. Token Harness can manage its MCP configuration after
|
|
19764
|
-
remediation: `With your existing uv and a compatible system Python >=3.10,
|
|
19960
|
+
message: `Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer is not installed. Token Harness can manage its MCP configuration after a compatible CLI is present.`,
|
|
19961
|
+
remediation: `With your existing uv and a compatible system Python >=3.10, install headroom-ai[mcp] ${HEADROOM_REVIEWED_MCP_VERSION} or newer. Token Harness does not install uv, Python, or admin prerequisites.`
|
|
19765
19962
|
});
|
|
19766
19963
|
}
|
|
19767
19964
|
async function detect8(context) {
|
|
19768
19965
|
const observation = await observeHeadroomCandidate(context);
|
|
19966
|
+
const runtime = await headroomManagedMcpRuntime(context);
|
|
19769
19967
|
const configuredHarnesses = [];
|
|
19770
|
-
if (
|
|
19968
|
+
if (runtime.ok) {
|
|
19771
19969
|
for (const harness of [CLAUDE7, CODEX4]) {
|
|
19772
19970
|
const verification = await verifyHeadroomManagedMcpActivation(context, harness);
|
|
19773
19971
|
if (verification.state === "verified")
|
|
@@ -19777,13 +19975,13 @@ async function detect8(context) {
|
|
|
19777
19975
|
const warnings = [];
|
|
19778
19976
|
if (observation.state === "absent")
|
|
19779
19977
|
warnings.push(manualInstallWarning());
|
|
19780
|
-
if (
|
|
19978
|
+
else if (!runtime.ok) {
|
|
19781
19979
|
warnings.push(diagnostic({
|
|
19782
19980
|
severity: "warning",
|
|
19783
|
-
code: "headroom-provider-
|
|
19981
|
+
code: "headroom-provider-capability-unavailable",
|
|
19784
19982
|
subject: "headroom",
|
|
19785
|
-
message:
|
|
19786
|
-
remediation: `
|
|
19983
|
+
message: runtime.detail,
|
|
19984
|
+
remediation: `Update Headroom to ${HEADROOM_REVIEWED_MCP_VERSION} or newer with the MCP extra, then refresh Token Harness.`
|
|
19787
19985
|
}));
|
|
19788
19986
|
}
|
|
19789
19987
|
return {
|
|
@@ -19800,7 +19998,7 @@ async function detect8(context) {
|
|
|
19800
19998
|
unmanagedHarnessesConfigured: [],
|
|
19801
19999
|
supportsUnmanagedHarnesses: false,
|
|
19802
20000
|
managedByTokenHarness: false,
|
|
19803
|
-
assignableHarnesses:
|
|
20001
|
+
assignableHarnesses: runtime.ok ? [CLAUDE7, CODEX4] : [],
|
|
19804
20002
|
evidence: [],
|
|
19805
20003
|
warnings
|
|
19806
20004
|
};
|
|
@@ -19873,7 +20071,7 @@ async function verify8(context) {
|
|
|
19873
20071
|
summary: result6.detail,
|
|
19874
20072
|
achievedTier: result6.state === "verified" ? "config-only" : result6.state === "candidate-unavailable" ? null : "presence",
|
|
19875
20073
|
evidence: [],
|
|
19876
|
-
remediation: result6.state === "candidate-unavailable" ? `Install
|
|
20074
|
+
remediation: result6.state === "candidate-unavailable" ? `Install Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer with its MCP extra first.` : null
|
|
19877
20075
|
});
|
|
19878
20076
|
}
|
|
19879
20077
|
return {
|
|
@@ -20046,26 +20244,25 @@ var init_mcptoon_provider = __esm({
|
|
|
20046
20244
|
|
|
20047
20245
|
// packages/adapters/dist/src/providers/version-compatibility.js
|
|
20048
20246
|
function reviewedProviderPackageMaximum(provider) {
|
|
20049
|
-
return
|
|
20247
|
+
return PACKAGE_UPDATE_BASELINES.get(provider)?.maximum ?? null;
|
|
20050
20248
|
}
|
|
20051
20249
|
function admitProviderPackageUpdate(provider, targetVersion) {
|
|
20052
|
-
const range =
|
|
20250
|
+
const range = PACKAGE_UPDATE_BASELINES.get(provider);
|
|
20053
20251
|
if (range === void 0) {
|
|
20054
20252
|
return { state: "blocked", reason: `no package-update policy exists for ${provider}` };
|
|
20055
20253
|
}
|
|
20056
20254
|
const target = parseSemanticVersion(targetVersion);
|
|
20057
20255
|
const minimum = parseSemanticVersion(range.minimum);
|
|
20058
|
-
|
|
20059
|
-
if (target === null || minimum === null || maximum === null) {
|
|
20256
|
+
if (target === null || minimum === null) {
|
|
20060
20257
|
return {
|
|
20061
20258
|
state: "blocked",
|
|
20062
|
-
reason: `${targetVersion} is not a parseable
|
|
20259
|
+
reason: `${targetVersion} is not a parseable provider release`
|
|
20063
20260
|
};
|
|
20064
20261
|
}
|
|
20065
|
-
if (compareVersions(target, minimum) < 0
|
|
20262
|
+
if (compareVersions(target, minimum) < 0) {
|
|
20066
20263
|
return {
|
|
20067
20264
|
state: "blocked",
|
|
20068
|
-
reason: `${targetVersion}
|
|
20265
|
+
reason: `${targetVersion} predates the supported provider update floor ${range.minimum}`
|
|
20069
20266
|
};
|
|
20070
20267
|
}
|
|
20071
20268
|
return { state: "admitted" };
|
|
@@ -20078,10 +20275,15 @@ function harnessTrimContractMatchesInstalledVersion(detection) {
|
|
|
20078
20275
|
const capabilityDrift = detection.warnings.some((warning2) => warning2.code === "provider-capabilities-drift");
|
|
20079
20276
|
return declaredByInstalledBuild && !capabilityDrift;
|
|
20080
20277
|
}
|
|
20278
|
+
function runtimeManagedSurfaceStillAvailable(detection) {
|
|
20279
|
+
if (detection.state === "broken" || detection.assignableHarnesses.length === 0)
|
|
20280
|
+
return false;
|
|
20281
|
+
return !detection.warnings.some((warning2) => /capabilit/i.test(warning2.code) && /(unavailable|drift|mismatch|unsupported)/i.test(warning2.code));
|
|
20282
|
+
}
|
|
20081
20283
|
function applyProviderVersionCompatibility(detection) {
|
|
20082
20284
|
if (detection.versionVerdict !== "unknown-newer" || detection.version === null)
|
|
20083
20285
|
return detection;
|
|
20084
|
-
const compatible = detection.providerId ===
|
|
20286
|
+
const compatible = detection.providerId === HARNESSTRIM3 ? harnessTrimContractMatchesInstalledVersion(detection) : [RTK3, MCPTOON2, GITNEXUS2, HEADROOM3].includes(detection.providerId) && runtimeManagedSurfaceStillAvailable(detection);
|
|
20085
20287
|
if (!compatible)
|
|
20086
20288
|
return detection;
|
|
20087
20289
|
return {
|
|
@@ -20096,17 +20298,40 @@ function withProviderVersionCompatibility(adapter) {
|
|
|
20096
20298
|
detect: async (context) => applyProviderVersionCompatibility(await adapter.detect(context))
|
|
20097
20299
|
};
|
|
20098
20300
|
}
|
|
20099
|
-
var RTK3, HARNESSTRIM3,
|
|
20301
|
+
var RTK3, HARNESSTRIM3, MCPTOON2, GITNEXUS2, HEADROOM3, PACKAGE_UPDATE_BASELINES;
|
|
20100
20302
|
var init_version_compatibility = __esm({
|
|
20101
20303
|
"packages/adapters/dist/src/providers/version-compatibility.js"() {
|
|
20102
20304
|
"use strict";
|
|
20103
20305
|
init_src();
|
|
20306
|
+
init_gitnexus_candidate();
|
|
20307
|
+
init_headroom_candidate();
|
|
20308
|
+
init_mcptoon_candidate();
|
|
20104
20309
|
RTK3 = providerId("rtk");
|
|
20105
20310
|
HARNESSTRIM3 = providerId("harnesstrim");
|
|
20106
|
-
|
|
20107
|
-
|
|
20311
|
+
MCPTOON2 = providerId("mcptoon");
|
|
20312
|
+
GITNEXUS2 = providerId("gitnexus");
|
|
20313
|
+
HEADROOM3 = providerId("headroom");
|
|
20314
|
+
PACKAGE_UPDATE_BASELINES = /* @__PURE__ */ new Map([
|
|
20108
20315
|
[RTK3, { minimum: "0.44.0", maximum: "0.49.0" }],
|
|
20109
|
-
[HARNESSTRIM3, { minimum: "0.0.5", maximum: "0.3.0" }]
|
|
20316
|
+
[HARNESSTRIM3, { minimum: "0.0.5", maximum: "0.3.0" }],
|
|
20317
|
+
[
|
|
20318
|
+
MCPTOON2,
|
|
20319
|
+
{ minimum: MCPTOON_REVIEWED_BENCHMARK_VERSION, maximum: MCPTOON_REVIEWED_BENCHMARK_VERSION }
|
|
20320
|
+
],
|
|
20321
|
+
[
|
|
20322
|
+
GITNEXUS2,
|
|
20323
|
+
{
|
|
20324
|
+
minimum: GITNEXUS_REVIEWED_BENCHMARK_VERSION,
|
|
20325
|
+
maximum: GITNEXUS_REVIEWED_BENCHMARK_VERSION
|
|
20326
|
+
}
|
|
20327
|
+
],
|
|
20328
|
+
[
|
|
20329
|
+
HEADROOM3,
|
|
20330
|
+
{
|
|
20331
|
+
minimum: HEADROOM_REVIEWED_BENCHMARK_VERSION,
|
|
20332
|
+
maximum: HEADROOM_REVIEWED_BENCHMARK_VERSION
|
|
20333
|
+
}
|
|
20334
|
+
]
|
|
20110
20335
|
]);
|
|
20111
20336
|
}
|
|
20112
20337
|
});
|
|
@@ -20303,9 +20528,9 @@ var init_providers = __esm({
|
|
|
20303
20528
|
PROVIDER_ADAPTERS = [
|
|
20304
20529
|
rtkAdapter2,
|
|
20305
20530
|
cliHarnessTrimAdapter,
|
|
20306
|
-
mcptoonManagedProviderAdapter,
|
|
20307
|
-
gitnexusManagedProviderAdapter,
|
|
20308
|
-
headroomManagedProviderAdapter
|
|
20531
|
+
withProviderVersionCompatibility(mcptoonManagedProviderAdapter),
|
|
20532
|
+
withProviderVersionCompatibility(gitnexusManagedProviderAdapter),
|
|
20533
|
+
withProviderVersionCompatibility(headroomManagedProviderAdapter)
|
|
20309
20534
|
];
|
|
20310
20535
|
}
|
|
20311
20536
|
});
|
|
@@ -24056,6 +24281,17 @@ async function computePlan(context) {
|
|
|
24056
24281
|
wsl: context.platform.isWsl
|
|
24057
24282
|
});
|
|
24058
24283
|
if (admission.state !== "admitted") {
|
|
24284
|
+
const dynamicallyAssignable = assignable.get(adapter.manifest.id)?.has(harness) === true;
|
|
24285
|
+
if (dynamicallyAssignable) {
|
|
24286
|
+
diagnostics.push(diagnostic({
|
|
24287
|
+
severity: "info",
|
|
24288
|
+
code: "managed-mutation-forward-compatible",
|
|
24289
|
+
subject: adapter.manifest.id,
|
|
24290
|
+
message: `${adapter.manifest.displayName} declares that it can configure ${harness} on the installed build. Token Harness will use the normal transactional apply path and verify the resulting state even though this exact version tuple is newer than the recorded compatibility evidence.`,
|
|
24291
|
+
remediation: null
|
|
24292
|
+
}));
|
|
24293
|
+
continue;
|
|
24294
|
+
}
|
|
24059
24295
|
admitted = false;
|
|
24060
24296
|
blocked.push({
|
|
24061
24297
|
provider: adapter.manifest.id,
|
|
@@ -24224,7 +24460,7 @@ async function computePlan(context) {
|
|
|
24224
24460
|
severity: refusalIsTheOutcome ? "error" : "warning",
|
|
24225
24461
|
code: "managed-mutation-blocked",
|
|
24226
24462
|
message: `plan refuses managed mutation of ${entry.harness} by ${entry.provider}${entry.providerVersion !== null ? ` at ${entry.providerVersion}` : ""}: ${entry.missing}`,
|
|
24227
|
-
remediation: "
|
|
24463
|
+
remediation: "Restore the provider runtime capability required for this managed integration, or configure it by hand"
|
|
24228
24464
|
}));
|
|
24229
24465
|
}
|
|
24230
24466
|
for (const conflict of conflicts) {
|
|
@@ -26864,7 +27100,7 @@ async function runDoctor(context) {
|
|
|
26864
27100
|
]
|
|
26865
27101
|
};
|
|
26866
27102
|
});
|
|
26867
|
-
const problemCount = harnesses.filter(isBroken).length + providers.filter(isBroken).length
|
|
27103
|
+
const problemCount = harnesses.filter(isBroken).length + providers.filter(isBroken).length;
|
|
26868
27104
|
const rows = context.compatibilityRows ?? COMPATIBILITY_ROWS;
|
|
26869
27105
|
const providersWithCoverage = providersWithPathDiagnostics.map((detection) => {
|
|
26870
27106
|
if (detection.state !== "configured" || detection.configuredHarnesses.length === 0) {
|
|
@@ -26880,14 +27116,14 @@ async function runDoctor(context) {
|
|
|
26880
27116
|
os: context.platform.os,
|
|
26881
27117
|
wsl: context.platform.isWsl
|
|
26882
27118
|
});
|
|
26883
|
-
if (admission.state === "admitted")
|
|
27119
|
+
if (admission.state === "admitted" || detection.assignableHarnesses.includes(harness))
|
|
26884
27120
|
return [];
|
|
26885
27121
|
return [
|
|
26886
27122
|
diagnostic({
|
|
26887
27123
|
severity: "warning",
|
|
26888
|
-
code: "
|
|
26889
|
-
message:
|
|
26890
|
-
remediation: "
|
|
27124
|
+
code: "provider-surface-not-assignable",
|
|
27125
|
+
message: `${detection.providerId} is configured on ${harness}, but the currently installed provider build does not advertise that harness as an automatic setup target`,
|
|
27126
|
+
remediation: "Run the provider verification checks; keep the existing configuration if it is healthy, or update the provider if its automatic setup contract has changed"
|
|
26891
27127
|
})
|
|
26892
27128
|
];
|
|
26893
27129
|
});
|
|
@@ -28104,6 +28340,7 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28104
28340
|
projectIdFor: adapters.projectIdFor
|
|
28105
28341
|
};
|
|
28106
28342
|
const actions = [];
|
|
28343
|
+
const updateTargets = /* @__PURE__ */ new Map();
|
|
28107
28344
|
const blockedUpdates = [];
|
|
28108
28345
|
const destinations = /* @__PURE__ */ new Set();
|
|
28109
28346
|
for (const adapter of providerAdapters) {
|
|
@@ -28180,7 +28417,7 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28180
28417
|
}
|
|
28181
28418
|
row2.verdict = "upgradable";
|
|
28182
28419
|
report.providers.push(row2);
|
|
28183
|
-
|
|
28420
|
+
const action = upgradeAction({
|
|
28184
28421
|
providerId: adapter.manifest.id,
|
|
28185
28422
|
channel: channel.id,
|
|
28186
28423
|
packageName,
|
|
@@ -28188,15 +28425,21 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28188
28425
|
requiresNetwork: channel.requiresNetwork,
|
|
28189
28426
|
requiresElevation: channel.requiresElevation,
|
|
28190
28427
|
installed: detection.version ?? "an unknown version"
|
|
28191
|
-
})
|
|
28428
|
+
});
|
|
28429
|
+
actions.push(action);
|
|
28430
|
+
updateTargets.set(action.id, {
|
|
28431
|
+
providerId: adapter.manifest.id,
|
|
28432
|
+
target: query.version,
|
|
28433
|
+
adapter
|
|
28434
|
+
});
|
|
28192
28435
|
}
|
|
28193
28436
|
report.network = [...destinations].sort();
|
|
28194
28437
|
for (const blocked of blockedUpdates) {
|
|
28195
28438
|
diagnostics.push(diagnostic({
|
|
28196
28439
|
severity: "info",
|
|
28197
28440
|
code: "provider-update-target-unreviewed",
|
|
28198
|
-
message: `${blocked.providerId} ${blocked.target} is available but
|
|
28199
|
-
remediation: "
|
|
28441
|
+
message: `${blocked.providerId} ${blocked.target} is available but does not meet the provider update prerequisites; keeping ${blocked.installed ?? "the installed version"}`,
|
|
28442
|
+
remediation: "Check the provider update floor or version format, then retry the update"
|
|
28200
28443
|
}));
|
|
28201
28444
|
diagnostics.push(diagnostic({
|
|
28202
28445
|
severity: "info",
|
|
@@ -28269,7 +28512,64 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28269
28512
|
backupRoot: fs.join(context.stateRoot, "backups")
|
|
28270
28513
|
}),
|
|
28271
28514
|
runner: adapters.runner,
|
|
28272
|
-
now: context.now
|
|
28515
|
+
now: context.now,
|
|
28516
|
+
verifyPostconditions: async (applied) => {
|
|
28517
|
+
const postconditions = [];
|
|
28518
|
+
for (const outcome2 of applied) {
|
|
28519
|
+
if (outcome2.status !== "applied" && outcome2.status !== "already-satisfied")
|
|
28520
|
+
continue;
|
|
28521
|
+
const target = updateTargets.get(outcome2.actionId);
|
|
28522
|
+
if (target === void 0)
|
|
28523
|
+
continue;
|
|
28524
|
+
const detection = await target.adapter.detect(providerContext4);
|
|
28525
|
+
const observed = detection.version === null ? null : parseSemanticVersion(detection.version);
|
|
28526
|
+
const expected = parseSemanticVersion(target.target);
|
|
28527
|
+
const exactTarget = observed !== null && expected !== null && compareVersions(observed, expected) === 0;
|
|
28528
|
+
if (!exactTarget) {
|
|
28529
|
+
postconditions.push(diagnostic({
|
|
28530
|
+
severity: "error",
|
|
28531
|
+
code: "provider-update-version-not-observed",
|
|
28532
|
+
subject: target.adapter.manifest.id,
|
|
28533
|
+
message: `${target.providerId} update did not become active: requested ${target.target}, but the executable currently resolved on PATH reports ${detection.version ?? "no readable version"}`,
|
|
28534
|
+
path: detection.executable,
|
|
28535
|
+
remediation: "Review duplicate PATH installations. Token Harness will not report this update as successful while the old executable is still the one being resolved."
|
|
28536
|
+
}));
|
|
28537
|
+
continue;
|
|
28538
|
+
}
|
|
28539
|
+
const capabilityProblem = detection.warnings.find((warning2) => /capabilit/i.test(warning2.code) && /(unavailable|drift|mismatch|unsupported)/i.test(warning2.code));
|
|
28540
|
+
if (target.adapter.manifest.id === "harnesstrim" && (detection.versionVerdict !== "in-range" || capabilityProblem !== void 0)) {
|
|
28541
|
+
postconditions.push(diagnostic({
|
|
28542
|
+
severity: "error",
|
|
28543
|
+
code: "harnesstrim-update-contract-mismatch",
|
|
28544
|
+
subject: target.adapter.manifest.id,
|
|
28545
|
+
message: `HarnessTrim ${target.target} was installed, but its machine-readable capability/artifact contract did not pass Token Harness validation` + (capabilityProblem === void 0 ? "" : `: ${capabilityProblem.message}`),
|
|
28546
|
+
path: detection.executable,
|
|
28547
|
+
remediation: "Keep the previous working HarnessTrim release until the changed contract is understood."
|
|
28548
|
+
}));
|
|
28549
|
+
continue;
|
|
28550
|
+
}
|
|
28551
|
+
if (["mcptoon", "gitnexus", "headroom"].includes(target.adapter.manifest.id) && (detection.assignableHarnesses.length === 0 || capabilityProblem !== void 0)) {
|
|
28552
|
+
postconditions.push(diagnostic({
|
|
28553
|
+
severity: "error",
|
|
28554
|
+
code: "provider-update-capability-unavailable",
|
|
28555
|
+
subject: target.adapter.manifest.id,
|
|
28556
|
+
message: `${target.providerId} ${target.target} became active on PATH, but the installed build no longer exposes the runtime capability surface required by Token Harness` + (capabilityProblem === void 0 ? "" : `: ${capabilityProblem.message}`),
|
|
28557
|
+
path: detection.executable,
|
|
28558
|
+
remediation: "Keep the previous working provider release until the changed CLI capability surface is understood."
|
|
28559
|
+
}));
|
|
28560
|
+
continue;
|
|
28561
|
+
}
|
|
28562
|
+
postconditions.push(diagnostic({
|
|
28563
|
+
severity: "info",
|
|
28564
|
+
code: "provider-update-version-verified",
|
|
28565
|
+
subject: target.adapter.manifest.id,
|
|
28566
|
+
message: `${target.providerId} ${target.target} is now the executable resolved on PATH and passed post-update detection`,
|
|
28567
|
+
path: detection.executable,
|
|
28568
|
+
remediation: null
|
|
28569
|
+
}));
|
|
28570
|
+
}
|
|
28571
|
+
return postconditions;
|
|
28572
|
+
}
|
|
28273
28573
|
});
|
|
28274
28574
|
diagnostics.push(...transaction.diagnostics);
|
|
28275
28575
|
report.execution = {
|
|
@@ -31970,13 +32270,75 @@ var init_stack_combination_reviews = __esm({
|
|
|
31970
32270
|
});
|
|
31971
32271
|
|
|
31972
32272
|
// apps/cli/dist/src/guided.js
|
|
32273
|
+
function guideSetupTarget(report, harness, provider) {
|
|
32274
|
+
const harnessDetection = report.harnesses.find((item) => item.harnessId === harness);
|
|
32275
|
+
const detection = report.providers.find((item) => item.providerId === provider);
|
|
32276
|
+
const label = name(provider);
|
|
32277
|
+
if (harnessDetection === void 0 || harnessDetection.state === "absent") {
|
|
32278
|
+
return {
|
|
32279
|
+
providerId: provider,
|
|
32280
|
+
provider: label,
|
|
32281
|
+
state: "not-applicable",
|
|
32282
|
+
reason: `${name(harness)} is not currently detected.`
|
|
32283
|
+
};
|
|
32284
|
+
}
|
|
32285
|
+
if (detection === void 0) {
|
|
32286
|
+
return {
|
|
32287
|
+
providerId: provider,
|
|
32288
|
+
provider: label,
|
|
32289
|
+
state: "not-applicable",
|
|
32290
|
+
reason: `${label} is not a managed provider in this build.`
|
|
32291
|
+
};
|
|
32292
|
+
}
|
|
32293
|
+
if (detection.configuredHarnesses.includes(harnessDetection.harnessId)) {
|
|
32294
|
+
return {
|
|
32295
|
+
providerId: provider,
|
|
32296
|
+
provider: label,
|
|
32297
|
+
state: "connected",
|
|
32298
|
+
reason: `${label} is configured for ${name(harness)}.`
|
|
32299
|
+
};
|
|
32300
|
+
}
|
|
32301
|
+
if (detection.state === "absent" || detection.state === "available") {
|
|
32302
|
+
return {
|
|
32303
|
+
providerId: provider,
|
|
32304
|
+
provider: label,
|
|
32305
|
+
state: "unavailable",
|
|
32306
|
+
reason: `${label} is not installed in a state Token Harness can configure automatically.`
|
|
32307
|
+
};
|
|
32308
|
+
}
|
|
32309
|
+
if (detection.state === "broken") {
|
|
32310
|
+
return {
|
|
32311
|
+
providerId: provider,
|
|
32312
|
+
provider: label,
|
|
32313
|
+
state: "unavailable",
|
|
32314
|
+
reason: `${label} is detected but its current integration needs attention before setup can continue.`
|
|
32315
|
+
};
|
|
32316
|
+
}
|
|
32317
|
+
if (!detection.assignableHarnesses.includes(harnessDetection.harnessId)) {
|
|
32318
|
+
return {
|
|
32319
|
+
providerId: provider,
|
|
32320
|
+
provider: label,
|
|
32321
|
+
state: "not-applicable",
|
|
32322
|
+
reason: `The installed ${label} build does not expose an automatic ${name(harness)} setup surface.`
|
|
32323
|
+
};
|
|
32324
|
+
}
|
|
32325
|
+
return {
|
|
32326
|
+
providerId: provider,
|
|
32327
|
+
provider: label,
|
|
32328
|
+
state: "actionable",
|
|
32329
|
+
reason: `${label} can be configured automatically for ${name(harness)}. Token Harness will apply it transactionally and re-check the resulting state.`
|
|
32330
|
+
};
|
|
32331
|
+
}
|
|
32332
|
+
function guideSetupTargets(report, harness) {
|
|
32333
|
+
return GUIDE_MANAGED_PROVIDERS.map((provider) => guideSetupTarget(report, harness, provider));
|
|
32334
|
+
}
|
|
31973
32335
|
function explainGuideIssue(diagnostics, fallback) {
|
|
31974
32336
|
const known = diagnostics.find((entry) => ISSUE_COPY[entry.code] !== void 0);
|
|
31975
32337
|
if (known !== void 0)
|
|
31976
32338
|
return ISSUE_COPY[known.code];
|
|
31977
32339
|
const blocked = diagnostics.find((entry) => /compatibility|unsupported|unreviewed|no-row/.test(entry.code));
|
|
31978
32340
|
if (blocked !== void 0)
|
|
31979
|
-
return "
|
|
32341
|
+
return "The required automatic capability or safety precondition is not available in the current runtime. Your current settings are preserved.";
|
|
31980
32342
|
if (diagnostics.some((entry) => /drift|mismatch|precondition|conflict/.test(entry.code)))
|
|
31981
32343
|
return "Something changed since the preview. No unsafe change was made. Review the current setup again.";
|
|
31982
32344
|
return fallback;
|
|
@@ -31994,7 +32356,8 @@ function stackFingerprint(report) {
|
|
|
31994
32356
|
version: item.version,
|
|
31995
32357
|
versionVerdict: item.versionVerdict,
|
|
31996
32358
|
managedByTokenHarness: item.managedByTokenHarness,
|
|
31997
|
-
configuredHarnesses: [...item.configuredHarnesses].sort()
|
|
32359
|
+
configuredHarnesses: [...item.configuredHarnesses].sort(),
|
|
32360
|
+
assignableHarnesses: [...item.assignableHarnesses].sort()
|
|
31998
32361
|
})).sort((left, right) => left.id.localeCompare(right.id));
|
|
31999
32362
|
return JSON.stringify({ harnesses, providers });
|
|
32000
32363
|
}
|
|
@@ -32212,7 +32575,7 @@ function describeChange(action, harness) {
|
|
|
32212
32575
|
files: action.affectedPaths.length
|
|
32213
32576
|
};
|
|
32214
32577
|
}
|
|
32215
|
-
var GuideError, NAMES, name, TASKS, PERIODS, STACK_COMPONENTS, ISSUE_COPY, EFFORT_LABELS, SAFETY_RULES, TASK_RULES, READ_STAGES, GuideService;
|
|
32578
|
+
var GuideError, NAMES, name, GUIDE_MANAGED_PROVIDERS, RECOMMENDED_SETUP_PROVIDERS, TASKS, PERIODS, STACK_COMPONENTS, ISSUE_COPY, EFFORT_LABELS, SAFETY_RULES, TASK_RULES, READ_STAGES, GuideService;
|
|
32216
32579
|
var init_guided = __esm({
|
|
32217
32580
|
"apps/cli/dist/src/guided.js"() {
|
|
32218
32581
|
"use strict";
|
|
@@ -32240,6 +32603,14 @@ var init_guided = __esm({
|
|
|
32240
32603
|
headroom: "Headroom"
|
|
32241
32604
|
};
|
|
32242
32605
|
name = (id) => NAMES[id] ?? id;
|
|
32606
|
+
GUIDE_MANAGED_PROVIDERS = [
|
|
32607
|
+
"rtk",
|
|
32608
|
+
"harnesstrim",
|
|
32609
|
+
"mcptoon",
|
|
32610
|
+
"gitnexus",
|
|
32611
|
+
"headroom"
|
|
32612
|
+
];
|
|
32613
|
+
RECOMMENDED_SETUP_PROVIDERS = ["rtk", "harnesstrim"];
|
|
32243
32614
|
TASKS = /* @__PURE__ */ new Set(["mechanical", "standard", "hard", "critical"]);
|
|
32244
32615
|
PERIODS = /* @__PURE__ */ new Set(["all", "7d", "30d"]);
|
|
32245
32616
|
STACK_COMPONENTS = [
|
|
@@ -32277,13 +32648,13 @@ var init_guided = __esm({
|
|
|
32277
32648
|
"cclimits-claude-token-expired": "The Claude login has expired. Sign in again in Claude, then refresh.",
|
|
32278
32649
|
"cclimits-claude-cache-stale": "Only old Claude allowance data was found. It is not presented as current allowance.",
|
|
32279
32650
|
"cclimits-claude-source-unsupported": "This cclimits response lacks supported Claude discovery information. Check its installed version.",
|
|
32280
|
-
"claude-native-policy-blocked": "Claude settings could not be changed safely. A project override, environment setting or
|
|
32281
|
-
"native-policy-harness-unsupported": "This agent does not expose a
|
|
32651
|
+
"claude-native-policy-blocked": "Claude settings could not be changed safely. A project override, environment setting or changed writable surface may be in effect. Your settings were kept.",
|
|
32652
|
+
"native-policy-harness-unsupported": "This agent does not expose a writable setting surface for this action.",
|
|
32282
32653
|
"codex-native-policy-unavailable": "Codex did not expose a writable, versioned user setting. No change is proposed.",
|
|
32283
32654
|
"codex-native-policy-shadowed": "A project or profile overrides this Codex setting. That setting belongs to you and will not be replaced.",
|
|
32284
32655
|
"no-providers-registered": "No optimization provider was selected for this operation.",
|
|
32285
32656
|
"already-in-desired-state": "The supported integration is already configured. Nothing needs to be changed.",
|
|
32286
|
-
"managed-mutation-unsupported": "Automatic setup is
|
|
32657
|
+
"managed-mutation-unsupported": "Automatic setup is unavailable because the installed provider does not expose the required managed surface. Existing integrations are left untouched.",
|
|
32287
32658
|
"plan-ownership-drift": "The integration changed after the preview. Review a fresh plan; nothing was forced.",
|
|
32288
32659
|
"plan-version-drift": "An installed version changed after the preview. Review a fresh plan.",
|
|
32289
32660
|
"plan-project-mismatch": "This preview belongs to a different project. Open a new preview here.",
|
|
@@ -32419,7 +32790,7 @@ var init_guided = __esm({
|
|
|
32419
32790
|
if (this.busy && this.cached !== null)
|
|
32420
32791
|
return this.cached.value;
|
|
32421
32792
|
if (this.busy)
|
|
32422
|
-
throw new GuideError(409, "
|
|
32793
|
+
throw new GuideError(409, "Another managed change is in progress.");
|
|
32423
32794
|
if (this.cached?.period === period && this.now() - this.cached.at < 15e3)
|
|
32424
32795
|
return this.cached.value;
|
|
32425
32796
|
if (this.reading !== null) {
|
|
@@ -32542,6 +32913,8 @@ var init_guided = __esm({
|
|
|
32542
32913
|
const providers = (doctor.data?.providers ?? []).filter((provider) => provider.state === "configured" && provider.configuredHarnesses.includes(agent.harnessId)).map((p) => p.providerId);
|
|
32543
32914
|
const usage = budget.data?.harnesses.find((item) => item.harnessId === agent.harnessId);
|
|
32544
32915
|
const observed = context.data?.harnesses.find((item) => item.harnessId === agent.harnessId);
|
|
32916
|
+
const setup = doctor.data === null ? [] : guideSetupTargets(doctor.data, agent.harnessId);
|
|
32917
|
+
const hasActionableSetup = setup.some((target) => target.state === "actionable");
|
|
32545
32918
|
return {
|
|
32546
32919
|
pending: [
|
|
32547
32920
|
...!complete2.rules ? ["reasoning"] : [],
|
|
@@ -32551,8 +32924,9 @@ var init_guided = __esm({
|
|
|
32551
32924
|
name: name(agent.harnessId),
|
|
32552
32925
|
version: agent.version,
|
|
32553
32926
|
configured: providers.length > 0,
|
|
32554
|
-
state: agent.state === "broken" ? "Needs attention" : providers.length > 0 ? "Integration configured" : "Ready to set up",
|
|
32927
|
+
state: agent.state === "broken" ? "Needs attention" : providers.length > 0 ? "Integration configured" : hasActionableSetup ? "Ready to set up" : "No automatic setup surface available",
|
|
32555
32928
|
providers: providers.map(name),
|
|
32929
|
+
setup,
|
|
32556
32930
|
effort: observed?.nativeEffort?.current ?? observed?.reasoningEffort ?? null,
|
|
32557
32931
|
reasoning: reasoningView(agent.harnessId, observed),
|
|
32558
32932
|
...guidance?.[agent.harnessId] ? { guidance: guidance[agent.harnessId] } : {},
|
|
@@ -32754,11 +33128,17 @@ var init_guided = __esm({
|
|
|
32754
33128
|
for (const agent of selected) {
|
|
32755
33129
|
this.record(`Preparing supported changes for ${name(agent.harnessId)}. No settings changed.`, "working");
|
|
32756
33130
|
const setupProviders = [];
|
|
32757
|
-
if (data["action"] === "setup"
|
|
32758
|
-
|
|
32759
|
-
|
|
32760
|
-
|
|
32761
|
-
|
|
33131
|
+
if (data["action"] === "setup") {
|
|
33132
|
+
const requested = data["provider"] === void 0 ? RECOMMENDED_SETUP_PROVIDERS : [String(data["provider"])];
|
|
33133
|
+
for (const setupProvider of requested) {
|
|
33134
|
+
const target = inventory.data === null ? null : guideSetupTarget(inventory.data, agent.harnessId, setupProvider);
|
|
33135
|
+
if (target?.state === "actionable") {
|
|
33136
|
+
setupProviders.push(setupProvider);
|
|
33137
|
+
} else if (target?.state === "connected") {
|
|
33138
|
+
notices.push(`${name(agent.harnessId)} \xB7 ${name(setupProvider)}: already connected. No setup change is needed.`);
|
|
33139
|
+
} else if (target !== null) {
|
|
33140
|
+
notices.push(`${name(agent.harnessId)} \xB7 ${name(setupProvider)}: ${target.reason}`);
|
|
33141
|
+
}
|
|
32762
33142
|
}
|
|
32763
33143
|
} else {
|
|
32764
33144
|
setupProviders.push(null);
|
|
@@ -32775,7 +33155,7 @@ var init_guided = __esm({
|
|
|
32775
33155
|
const report = result6.data;
|
|
32776
33156
|
if (report === null || result6.exitCode !== 0 || report.conflicts.length > 0 || report.actions.length === 0 || !report.persisted || report.planId === null) {
|
|
32777
33157
|
const subject = setupProvider !== null ? `${name(agent.harnessId)} \xB7 ${name(setupProvider)}` : name(agent.harnessId);
|
|
32778
|
-
notices.push(`${subject}: ${explainGuideIssue(result6.diagnostics, data["action"] === "effort" ? "No supported preference change is needed or available. Your current preference is kept." : data["action"] === "skill" ? "In-session guidance is already present, or an existing user-owned skill location was left untouched." : "No safe setup change is available
|
|
33158
|
+
notices.push(`${subject}: ${explainGuideIssue(result6.diagnostics, data["action"] === "effort" ? "No supported preference change is needed or available. Your current preference is kept." : data["action"] === "skill" ? "In-session guidance is already present, or an existing user-owned skill location was left untouched." : "No safe setup change is available for the current provider, agent version and platform.")}`);
|
|
32779
33159
|
continue;
|
|
32780
33160
|
}
|
|
32781
33161
|
plans.push(report.planId);
|
|
@@ -32820,17 +33200,17 @@ var init_guided = __esm({
|
|
|
32820
33200
|
}
|
|
32821
33201
|
async apply(input) {
|
|
32822
33202
|
if (input === null || typeof input !== "object" || Array.isArray(input))
|
|
32823
|
-
throw new GuideError(400, "A
|
|
33203
|
+
throw new GuideError(400, "A current preview is required.");
|
|
32824
33204
|
const data = input;
|
|
32825
33205
|
if (Object.keys(data).length !== 1 || typeof data["ticket"] !== "string")
|
|
32826
|
-
throw new GuideError(400, "A
|
|
33206
|
+
throw new GuideError(400, "A current preview is required.");
|
|
32827
33207
|
return this.exclusive(async () => {
|
|
32828
33208
|
const approval = this.approval;
|
|
32829
33209
|
if (approval === null || approval.id !== data["ticket"] || this.now() >= approval.expires)
|
|
32830
33210
|
throw new GuideError(409, "This preview expired or was already used. Review a fresh preview.");
|
|
32831
33211
|
this.approval = null;
|
|
32832
33212
|
if (approval.operation === "update") {
|
|
32833
|
-
this.record("Installing only the
|
|
33213
|
+
this.record("Installing only the provider updates you approved.", "working");
|
|
32834
33214
|
let result6;
|
|
32835
33215
|
try {
|
|
32836
33216
|
result6 = await this.call(["update", "--yes"]);
|
|
@@ -32846,7 +33226,7 @@ var init_guided = __esm({
|
|
|
32846
33226
|
};
|
|
32847
33227
|
}
|
|
32848
33228
|
if (result6.exitCode !== 0 || result6.data === null) {
|
|
32849
|
-
const message = explainGuideIssue(result6.diagnostics, "The
|
|
33229
|
+
const message = explainGuideIssue(result6.diagnostics, "The optimizer update was not applied. The installed version, update channel or runtime capability state changed after the preview, so nothing was forced.");
|
|
32850
33230
|
this.invalidateObservedState();
|
|
32851
33231
|
this.record(message, "attention");
|
|
32852
33232
|
return {
|
|
@@ -32860,14 +33240,14 @@ var init_guided = __esm({
|
|
|
32860
33240
|
this.lastApplied = null;
|
|
32861
33241
|
this.invalidateObservedState();
|
|
32862
33242
|
const messages2 = applied.length > 0 ? [
|
|
32863
|
-
"The
|
|
33243
|
+
"The optimizer update completed successfully and the active runtime was verified.",
|
|
32864
33244
|
"Token Harness re-ran the update transaction safety checks before changing software.",
|
|
32865
33245
|
"Choose Refresh to read the installed versions again. Reopen a coding agent if the updated optimizer requires it."
|
|
32866
33246
|
] : [
|
|
32867
33247
|
"No optimizer needed an update by the time the approved action ran.",
|
|
32868
33248
|
"Nothing was forced. Choose Refresh to read the current versions."
|
|
32869
33249
|
];
|
|
32870
|
-
this.record(applied.length > 0 ? "
|
|
33250
|
+
this.record(applied.length > 0 ? "Optimizer update installed and verified." : "Optimizer update no longer needed.", "success");
|
|
32871
33251
|
return {
|
|
32872
33252
|
ok: true,
|
|
32873
33253
|
title: applied.length > 0 ? "Optimizer updated" : "Already up to date",
|
|
@@ -32973,7 +33353,7 @@ var init_guided = __esm({
|
|
|
32973
33353
|
this.record(`${name(provider)} managed integration removed.`, "success");
|
|
32974
33354
|
return { ok: true, title: "Integration removed", messages: messages2, appliedPlans: 1 };
|
|
32975
33355
|
}
|
|
32976
|
-
this.record(approval.operation === "rollback" ? "Restoring the
|
|
33356
|
+
this.record(approval.operation === "rollback" ? "Restoring the approved configuration backup." : "Backing up and applying exactly the changes you approved.", "working");
|
|
32977
33357
|
const messages = [];
|
|
32978
33358
|
let appliedPlans = 0;
|
|
32979
33359
|
const steps = approval.operation === "rollback" && approval.transactionId !== null ? [
|
|
@@ -33017,7 +33397,7 @@ var init_guided = __esm({
|
|
|
33017
33397
|
this.lastApplied = approval.operation === "rollback" ? null : step.plan === null ? null : { kind: "plan", plan: step.plan, network: approval.network };
|
|
33018
33398
|
}
|
|
33019
33399
|
this.invalidateObservedState();
|
|
33020
|
-
messages.push(approval.operation === "rollback" ? "The
|
|
33400
|
+
messages.push(approval.operation === "rollback" ? "The approved backup was restored. Reopen the affected coding agent." : "The approved configuration was saved and checked. Reopen the affected coding agent to load it.");
|
|
33021
33401
|
messages.push("Keep using the agent normally. The dashboard reads available measurements automatically; it does not need to stay open for the configured integration to operate.");
|
|
33022
33402
|
this.record(`${approval.description} applied and verified against its configuration checks.`, "success");
|
|
33023
33403
|
return {
|
|
@@ -33074,13 +33454,13 @@ var init_guided = __esm({
|
|
|
33074
33454
|
const blocked = updateResult.data.providers.filter((row2) => row2.verdict === "blocked-unreviewed");
|
|
33075
33455
|
const messages = [];
|
|
33076
33456
|
if (available.length > 0) {
|
|
33077
|
-
messages.push(...available.map((row2) => `${name(row2.providerId)}: ${row2.installed ?? "installed version"} \u2192 ${row2.available ?? "new version"} is
|
|
33457
|
+
messages.push(...available.map((row2) => `${name(row2.providerId)}: ${row2.installed ?? "installed version"} \u2192 ${row2.available ?? "new version"} is available and ready to install; Token Harness will verify the active runtime after installation.`));
|
|
33078
33458
|
}
|
|
33079
33459
|
if (blocked.length > 0) {
|
|
33080
|
-
messages.push(...blocked.map((row2) => `${name(row2.providerId)}: ${row2.available ?? "a newer version"} exists, but Token Harness is keeping ${row2.installed ?? "the installed version"} because
|
|
33460
|
+
messages.push(...blocked.map((row2) => `${name(row2.providerId)}: ${row2.available ?? "a newer version"} exists, but Token Harness is keeping ${row2.installed ?? "the installed version"} because the target does not meet the provider update prerequisites.`));
|
|
33081
33461
|
}
|
|
33082
33462
|
if (available.length === 0 && blocked.length === 0)
|
|
33083
|
-
messages.push("Your managed optimizers are up to date on their
|
|
33463
|
+
messages.push("Your managed optimizers are up to date on their configured channels.");
|
|
33084
33464
|
let ticket = null;
|
|
33085
33465
|
if (available.length > 0) {
|
|
33086
33466
|
ticket = this.random();
|
|
@@ -33102,7 +33482,7 @@ var init_guided = __esm({
|
|
|
33102
33482
|
const stack = this.stackSnapshot();
|
|
33103
33483
|
if (this.cached !== null)
|
|
33104
33484
|
this.cached.value = { ...this.cached.value, stack };
|
|
33105
|
-
this.record(available.length > 0 ? "
|
|
33485
|
+
this.record(available.length > 0 ? "Optimizer update available. Waiting for your approval." : "Provider update check completed. No update is pending.", "success");
|
|
33106
33486
|
return {
|
|
33107
33487
|
ok: true,
|
|
33108
33488
|
title: available.length > 0 ? "Updates available" : "Optimizers up to date",
|
|
@@ -34874,7 +35254,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
34874
35254
|
const activeRun = runId;
|
|
34875
35255
|
working = true;
|
|
34876
35256
|
$('modal-actions').replaceChildren(closeButton('Applying…', true));
|
|
34877
|
-
$('modal-content').append(progress('Applying the
|
|
35257
|
+
$('modal-content').append(progress('Applying the approved change', 'Only the approved transaction is being applied. Keep this window open until it finishes.'));
|
|
34878
35258
|
try {
|
|
34879
35259
|
const result = await request('/api/apply', { ticket });
|
|
34880
35260
|
if (activeRun !== runId) return;
|
|
@@ -34972,7 +35352,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
34972
35352
|
return preview(
|
|
34973
35353
|
{ action: 'skill', harness: action.harness },
|
|
34974
35354
|
'Review in-session guidance for ' + (action.harness === 'claude' ? 'Claude Code' : 'Codex'),
|
|
34975
|
-
'Enable
|
|
35355
|
+
'Enable managed guidance',
|
|
34976
35356
|
'Guidance enabled',
|
|
34977
35357
|
);
|
|
34978
35358
|
if (action.kind === 'refresh') return $('refresh')?.click();
|
|
@@ -35061,7 +35441,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
35061
35441
|
actionButton('Review removal', () => preview(
|
|
35062
35442
|
{ action: 'remove', provider: component.providerId },
|
|
35063
35443
|
'Review removal for ' + name,
|
|
35064
|
-
'Remove
|
|
35444
|
+
'Remove managed integration',
|
|
35065
35445
|
'Integration removed',
|
|
35066
35446
|
), 'secondary'),
|
|
35067
35447
|
);
|
|
@@ -35162,24 +35542,24 @@ var init_guided_product_client = __esm({
|
|
|
35162
35542
|
},
|
|
35163
35543
|
harnesstrim: {
|
|
35164
35544
|
name: 'HarnessTrim',
|
|
35165
|
-
role: 'Adds
|
|
35545
|
+
role: 'Adds version-aware instructions that help coding agents keep tool output and context lean.',
|
|
35166
35546
|
managed: true,
|
|
35167
35547
|
},
|
|
35168
35548
|
mcptoon: {
|
|
35169
35549
|
name: 'mcptoon',
|
|
35170
|
-
role: 'Provides
|
|
35550
|
+
role: 'Provides compact MCP discovery integration and verifies the resulting setup.',
|
|
35171
35551
|
managed: true,
|
|
35172
35552
|
optional: true,
|
|
35173
35553
|
},
|
|
35174
35554
|
gitnexus: {
|
|
35175
35555
|
name: 'GitNexus',
|
|
35176
|
-
role: 'Registers an already-installed
|
|
35556
|
+
role: 'Registers an already-installed GitNexus CLI as a narrow Claude MCP integration and verifies the result.',
|
|
35177
35557
|
managed: true,
|
|
35178
35558
|
optional: true,
|
|
35179
35559
|
},
|
|
35180
35560
|
headroom: {
|
|
35181
35561
|
name: 'Headroom',
|
|
35182
|
-
role: 'Provides local MCP compression and retrieval through the
|
|
35562
|
+
role: 'Provides local MCP compression and retrieval through the installed Headroom server.',
|
|
35183
35563
|
managed: true,
|
|
35184
35564
|
optional: true,
|
|
35185
35565
|
},
|
|
@@ -35237,7 +35617,7 @@ var init_guided_product_client = __esm({
|
|
|
35237
35617
|
element.disabled = value;
|
|
35238
35618
|
});
|
|
35239
35619
|
$('live-status').textContent = value
|
|
35240
|
-
? (applying ? 'Applying only the
|
|
35620
|
+
? (applying ? 'Applying only the approved change…' : 'Reading current state…')
|
|
35241
35621
|
: 'Nothing changes without your approval';
|
|
35242
35622
|
}
|
|
35243
35623
|
|
|
@@ -35358,22 +35738,61 @@ var init_guided_product_client = __esm({
|
|
|
35358
35738
|
return (current?.stack?.components || []).filter(component => component.configured);
|
|
35359
35739
|
}
|
|
35360
35740
|
|
|
35361
|
-
function
|
|
35362
|
-
const
|
|
35363
|
-
return
|
|
35741
|
+
function setupTarget(agentId, providerId) {
|
|
35742
|
+
const agent = activeAgents().find(item => item.id === agentId);
|
|
35743
|
+
return agent?.setup?.find(item => item.providerId === providerId) || null;
|
|
35364
35744
|
}
|
|
35365
35745
|
|
|
35366
|
-
function
|
|
35367
|
-
|
|
35746
|
+
function baselineStatusFor(agentId) {
|
|
35747
|
+
const targets = ['rtk', 'harnesstrim']
|
|
35748
|
+
.map(providerId => setupTarget(agentId, providerId))
|
|
35749
|
+
.filter(Boolean);
|
|
35750
|
+
const actionable = targets.filter(target => target.state === 'actionable');
|
|
35751
|
+
const unavailable = targets.filter(target => target.state === 'unavailable');
|
|
35752
|
+
const connected = targets.filter(target => target.state === 'connected');
|
|
35753
|
+
if (actionable.length)
|
|
35754
|
+
return {
|
|
35755
|
+
state: 'incomplete',
|
|
35756
|
+
label: 'Setup incomplete',
|
|
35757
|
+
cls: 'warn',
|
|
35758
|
+
actionable,
|
|
35759
|
+
unavailable,
|
|
35760
|
+
connected,
|
|
35761
|
+
};
|
|
35762
|
+
if (unavailable.length && connected.length === 0)
|
|
35763
|
+
return {
|
|
35764
|
+
state: 'unavailable',
|
|
35765
|
+
label: 'No automatic setup',
|
|
35766
|
+
cls: '',
|
|
35767
|
+
actionable,
|
|
35768
|
+
unavailable,
|
|
35769
|
+
connected,
|
|
35770
|
+
};
|
|
35771
|
+
if (unavailable.length)
|
|
35772
|
+
return {
|
|
35773
|
+
state: 'limited',
|
|
35774
|
+
label: 'Setup complete',
|
|
35775
|
+
cls: 'good',
|
|
35776
|
+
actionable,
|
|
35777
|
+
unavailable,
|
|
35778
|
+
connected,
|
|
35779
|
+
};
|
|
35780
|
+
return {
|
|
35781
|
+
state: 'ready',
|
|
35782
|
+
label: 'Ready',
|
|
35783
|
+
cls: 'good',
|
|
35784
|
+
actionable,
|
|
35785
|
+
unavailable,
|
|
35786
|
+
connected,
|
|
35787
|
+
};
|
|
35368
35788
|
}
|
|
35369
35789
|
|
|
35370
35790
|
function baselineIncompleteAgents() {
|
|
35371
|
-
return activeAgents().filter(agent =>
|
|
35791
|
+
return activeAgents().filter(agent => baselineStatusFor(agent.id).state === 'incomplete');
|
|
35372
35792
|
}
|
|
35373
35793
|
|
|
35374
|
-
function
|
|
35375
|
-
|
|
35376
|
-
return agentId === 'claude' || agentId === 'codex';
|
|
35794
|
+
function baselineUnavailableAgents() {
|
|
35795
|
+
return activeAgents().filter(agent => baselineStatusFor(agent.id).state === 'unavailable');
|
|
35377
35796
|
}
|
|
35378
35797
|
|
|
35379
35798
|
function candidateObservation(id) {
|
|
@@ -35445,7 +35864,7 @@ var init_guided_product_client = __esm({
|
|
|
35445
35864
|
label: 'Needs attention',
|
|
35446
35865
|
cls: 'warn',
|
|
35447
35866
|
title: 'One configured optimizer needs attention',
|
|
35448
|
-
detail: 'Use Re-check health below to see whether the configured integration still matches
|
|
35867
|
+
detail: 'Use Re-check health below to see whether the configured integration still matches the provider and agent state currently installed.',
|
|
35449
35868
|
action: 'verify',
|
|
35450
35869
|
};
|
|
35451
35870
|
if (incomplete.length)
|
|
@@ -35454,10 +35873,19 @@ var init_guided_product_client = __esm({
|
|
|
35454
35873
|
cls: 'warn',
|
|
35455
35874
|
title: incomplete.length === 1
|
|
35456
35875
|
? 'Finish setup for ' + incomplete[0].name
|
|
35457
|
-
: 'Finish the recommended setup for your coding agents',
|
|
35458
|
-
detail: '
|
|
35876
|
+
: 'Finish the available recommended setup for your coding agents',
|
|
35877
|
+
detail: 'Every Finish setup action below has a concrete change available from the installed provider. Newer version combinations are attempted transactionally and checked again after apply.',
|
|
35459
35878
|
action: 'configure',
|
|
35460
35879
|
};
|
|
35880
|
+
const unavailable = baselineUnavailableAgents();
|
|
35881
|
+
if (unavailable.length)
|
|
35882
|
+
return {
|
|
35883
|
+
label: 'No automatic setup',
|
|
35884
|
+
cls: '',
|
|
35885
|
+
title: 'No automatic setup surface is currently exposed',
|
|
35886
|
+
detail: 'The installed provider does not currently expose the setup surface Token Harness needs. This is a capability limitation, not a missing review row.',
|
|
35887
|
+
action: 'none',
|
|
35888
|
+
};
|
|
35461
35889
|
if (!(current?.savings?.rows || []).length)
|
|
35462
35890
|
return {
|
|
35463
35891
|
label: 'Ready',
|
|
@@ -35511,7 +35939,7 @@ var init_guided_product_client = __esm({
|
|
|
35511
35939
|
);
|
|
35512
35940
|
}
|
|
35513
35941
|
|
|
35514
|
-
function componentState(component) {
|
|
35942
|
+
function componentState(id, component) {
|
|
35515
35943
|
if (!component || component.detectedState === 'absent') return { label: 'Not installed', cls: '' };
|
|
35516
35944
|
if (component.health === 'attention') return { label: 'Needs attention', cls: 'warn' };
|
|
35517
35945
|
if (component.configured)
|
|
@@ -35519,14 +35947,19 @@ var init_guided_product_client = __esm({
|
|
|
35519
35947
|
label: component.verification === 'verified' ? 'Connected · verified' : 'Connected',
|
|
35520
35948
|
cls: 'good',
|
|
35521
35949
|
};
|
|
35522
|
-
|
|
35950
|
+
const targets = activeAgents().map(agent => setupTarget(agent.id, id)).filter(Boolean);
|
|
35951
|
+
if (component.installed && targets.some(target => target.state === 'actionable'))
|
|
35952
|
+
return { label: 'Installed · setup available', cls: 'warn' };
|
|
35953
|
+
if (component.installed && targets.some(target => target.state === 'unavailable'))
|
|
35954
|
+
return { label: 'Installed · no automatic setup', cls: '' };
|
|
35955
|
+
if (component.installed) return { label: 'Installed', cls: '' };
|
|
35523
35956
|
return { label: 'Not installed', cls: '' };
|
|
35524
35957
|
}
|
|
35525
35958
|
|
|
35526
35959
|
function renderManagedTool(id) {
|
|
35527
35960
|
const info = TOOL_INFO[id];
|
|
35528
35961
|
const component = managedComponent(id);
|
|
35529
|
-
const state = componentState(component);
|
|
35962
|
+
const state = componentState(id, component);
|
|
35530
35963
|
const card = node('article', undefined, 'tool-card');
|
|
35531
35964
|
const head = node('div', undefined, 'tool-head');
|
|
35532
35965
|
const title = node('div');
|
|
@@ -35539,9 +35972,20 @@ var init_guided_product_client = __esm({
|
|
|
35539
35972
|
|
|
35540
35973
|
const facts = node('div', undefined, 'tool-facts');
|
|
35541
35974
|
if (component?.version) facts.append(node('span', 'Installed version'), node('strong', 'v' + component.version));
|
|
35975
|
+
const providerTargets = activeAgents()
|
|
35976
|
+
.map(agent => ({ agent, target: setupTarget(agent.id, id) }))
|
|
35977
|
+
.filter(item => item.target);
|
|
35978
|
+
const actionableFor = providerTargets
|
|
35979
|
+
.filter(item => item.target.state === 'actionable')
|
|
35980
|
+
.map(item => item.agent.name);
|
|
35981
|
+
const unavailableFor = providerTargets.filter(item => item.target.state === 'unavailable');
|
|
35542
35982
|
const configuredFor = component?.configuredHarnesses?.length
|
|
35543
35983
|
? component.configuredHarnesses.map(agentName).join(', ')
|
|
35544
|
-
:
|
|
35984
|
+
: actionableFor.length
|
|
35985
|
+
? 'Setup available for ' + actionableFor.join(', ')
|
|
35986
|
+
: unavailableFor.length
|
|
35987
|
+
? 'No compatible automatic setup surface detected'
|
|
35988
|
+
: 'Not applicable to the detected coding agents';
|
|
35545
35989
|
facts.append(node('span', 'Connection'), node('strong', configuredFor));
|
|
35546
35990
|
if (component?.update === 'available')
|
|
35547
35991
|
facts.append(
|
|
@@ -35549,9 +35993,22 @@ var init_guided_product_client = __esm({
|
|
|
35549
35993
|
node('strong', 'v' + (component.updateAvailableVersion || 'new version') + ' available'),
|
|
35550
35994
|
);
|
|
35551
35995
|
else if (component?.update === 'blocked')
|
|
35552
|
-
facts.append(node('span', 'Update'), node('strong', 'Newer
|
|
35996
|
+
facts.append(node('span', 'Update'), node('strong', 'Newer package requires a provider-specific update path'));
|
|
35553
35997
|
card.append(facts);
|
|
35554
35998
|
|
|
35999
|
+
if (
|
|
36000
|
+
component?.installed &&
|
|
36001
|
+
!(component?.configuredHarnesses?.length) &&
|
|
36002
|
+
actionableFor.length === 0 &&
|
|
36003
|
+
unavailableFor.length > 0
|
|
36004
|
+
)
|
|
36005
|
+
card.append(
|
|
36006
|
+
messageBox(
|
|
36007
|
+
'Why there is no Connect button',
|
|
36008
|
+
unavailableFor[0].target.reason,
|
|
36009
|
+
),
|
|
36010
|
+
);
|
|
36011
|
+
|
|
35555
36012
|
if (component?.warnings?.length) {
|
|
35556
36013
|
const attention = component.health === 'attention';
|
|
35557
36014
|
const prerequisite = !component.installed && component.nextAction?.kind === 'install-configure';
|
|
@@ -35567,25 +36024,15 @@ var init_guided_product_client = __esm({
|
|
|
35567
36024
|
|
|
35568
36025
|
const actions = node('div', undefined, 'inline-actions');
|
|
35569
36026
|
for (const agent of activeAgents()) {
|
|
35570
|
-
|
|
35571
|
-
if (
|
|
35572
|
-
|
|
35573
|
-
|
|
35574
|
-
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35578
|
-
|
|
35579
|
-
);
|
|
35580
|
-
} else {
|
|
35581
|
-
actions.append(
|
|
35582
|
-
actionButton(
|
|
35583
|
-
component?.installed ? 'Connect to ' + agent.name : 'Set up for ' + agent.name,
|
|
35584
|
-
() => reviewSetup(agent.id, id),
|
|
35585
|
-
'secondary',
|
|
35586
|
-
),
|
|
35587
|
-
);
|
|
35588
|
-
}
|
|
36027
|
+
const target = setupTarget(agent.id, id);
|
|
36028
|
+
if (target?.state !== 'actionable') continue;
|
|
36029
|
+
actions.append(
|
|
36030
|
+
actionButton(
|
|
36031
|
+
component?.installed ? 'Connect to ' + agent.name : 'Set up for ' + agent.name,
|
|
36032
|
+
() => reviewSetup(agent.id, id),
|
|
36033
|
+
'secondary',
|
|
36034
|
+
),
|
|
36035
|
+
);
|
|
35589
36036
|
}
|
|
35590
36037
|
if (component?.update === 'available')
|
|
35591
36038
|
actions.append(actionButton('Install update', () => readOnlyOperation('updates'), 'secondary'));
|
|
@@ -35612,7 +36059,7 @@ var init_guided_product_client = __esm({
|
|
|
35612
36059
|
return;
|
|
35613
36060
|
}
|
|
35614
36061
|
for (const agent of activeAgents()) {
|
|
35615
|
-
const
|
|
36062
|
+
const baseline = baselineStatusFor(agent.id);
|
|
35616
36063
|
const card = node('article', undefined, 'tool-card compact');
|
|
35617
36064
|
const head = node('div', undefined, 'tool-head');
|
|
35618
36065
|
const title = node('div');
|
|
@@ -35620,16 +36067,18 @@ var init_guided_product_client = __esm({
|
|
|
35620
36067
|
node('h3', agent.name),
|
|
35621
36068
|
node('span', agent.version ? 'v' + agent.version : 'Version unavailable', 'caption'),
|
|
35622
36069
|
);
|
|
35623
|
-
head.append(title, pill(
|
|
35624
|
-
|
|
35625
|
-
|
|
35626
|
-
|
|
35627
|
-
|
|
35628
|
-
|
|
35629
|
-
|
|
35630
|
-
|
|
35631
|
-
|
|
35632
|
-
|
|
36070
|
+
head.append(title, pill(baseline.label, baseline.cls));
|
|
36071
|
+
const detail =
|
|
36072
|
+
baseline.state === 'incomplete'
|
|
36073
|
+
? 'An automatic setup is available for ' +
|
|
36074
|
+
baseline.actionable.map(target => target.provider).join(' + ') +
|
|
36075
|
+
'. Finish setup to review and apply it.'
|
|
36076
|
+
: baseline.state === 'unavailable'
|
|
36077
|
+
? 'The installed baseline providers do not currently expose an automatic setup surface for this agent. Token Harness will not offer a no-op button.'
|
|
36078
|
+
: baseline.state === 'limited'
|
|
36079
|
+
? 'All automatic baseline actions exposed by the installed providers are complete.'
|
|
36080
|
+
: 'All automatic baseline connections exposed for this coding agent are configured.';
|
|
36081
|
+
card.append(head, node('p', detail));
|
|
35633
36082
|
if (agent.providers?.length)
|
|
35634
36083
|
card.append(
|
|
35635
36084
|
node(
|
|
@@ -35638,10 +36087,16 @@ var init_guided_product_client = __esm({
|
|
|
35638
36087
|
'caption',
|
|
35639
36088
|
),
|
|
35640
36089
|
);
|
|
35641
|
-
if (
|
|
36090
|
+
if (baseline.state === 'incomplete') {
|
|
35642
36091
|
const actions = node('div', undefined, 'inline-actions');
|
|
35643
36092
|
actions.append(actionButton('Finish setup', () => reviewSetup(agent.id)));
|
|
35644
36093
|
card.append(actions);
|
|
36094
|
+
} else if (baseline.unavailable.length) {
|
|
36095
|
+
const details = node('details', undefined, 'agent-details');
|
|
36096
|
+
details.append(node('summary', 'Why some automatic connections are unavailable'));
|
|
36097
|
+
for (const target of baseline.unavailable)
|
|
36098
|
+
details.append(node('p', target.provider + ': ' + target.reason, 'caption'));
|
|
36099
|
+
card.append(details);
|
|
35645
36100
|
}
|
|
35646
36101
|
root.append(card);
|
|
35647
36102
|
}
|
|
@@ -35663,7 +36118,7 @@ var init_guided_product_client = __esm({
|
|
|
35663
36118
|
'Safe preview first',
|
|
35664
36119
|
provider
|
|
35665
36120
|
? 'Token Harness will inspect only ' + provider.name + ' for ' + agent.name + '. If setup is supported, the exact change appears before you confirm it.'
|
|
35666
|
-
: 'Token Harness will prepare the
|
|
36121
|
+
: 'Token Harness will prepare the RTK/HarnessTrim changes exposed by the installed providers for ' + agent.name + '. Newer combinations use the same transactional path and are checked again after apply. The exact files and changes appear before you confirm them.',
|
|
35667
36122
|
),
|
|
35668
36123
|
messageBox('Nothing changes yet', 'This first step only prepares the safe plan. You decide whether to apply it after seeing the concrete changes.'),
|
|
35669
36124
|
progress('Checking ' + agent.name, 'Reading installed optimizer versions and current integration state.'),
|
|
@@ -35689,13 +36144,18 @@ var init_guided_product_client = __esm({
|
|
|
35689
36144
|
.then(data => {
|
|
35690
36145
|
if (run !== modalRun || !$('modal').open) return;
|
|
35691
36146
|
pendingTicket = data.ticket;
|
|
36147
|
+
if (!data.ticket) {
|
|
36148
|
+
refreshOverviewAfterMutation('Refreshing setup availability after the review…').catch(
|
|
36149
|
+
() => undefined,
|
|
36150
|
+
);
|
|
36151
|
+
}
|
|
35692
36152
|
$('modal-content').replaceChildren();
|
|
35693
36153
|
$('modal-content').append(
|
|
35694
36154
|
messageBox(
|
|
35695
36155
|
provider ? 'This optimizer only' : 'Recommended setup',
|
|
35696
36156
|
provider
|
|
35697
36157
|
? 'This approval changes only ' + provider.name + ' for ' + agent.name + '. Other optimizers are left unchanged.'
|
|
35698
|
-
: 'This
|
|
36158
|
+
: 'This review includes only the currently actionable RTK/HarnessTrim changes for ' + agent.name + '. Providers that do not expose the required setup surface, and already-complete providers, are left out. Optional optimizers stay separate.',
|
|
35699
36159
|
),
|
|
35700
36160
|
);
|
|
35701
36161
|
if (!data.changes.length) {
|
|
@@ -35703,7 +36163,7 @@ var init_guided_product_client = __esm({
|
|
|
35703
36163
|
messageBox(
|
|
35704
36164
|
'No setup change available',
|
|
35705
36165
|
(data.notices || []).join(' ') ||
|
|
35706
|
-
'
|
|
36166
|
+
'No automatic change is available from the provider’s current capability surface. The dashboard is refreshing so an obsolete setup action is not left visible.',
|
|
35707
36167
|
),
|
|
35708
36168
|
);
|
|
35709
36169
|
} else {
|
|
@@ -35714,7 +36174,7 @@ var init_guided_product_client = __esm({
|
|
|
35714
36174
|
}
|
|
35715
36175
|
for (const notice of data.notices || []) $('modal-content').append(node('p', notice, 'notice-row'));
|
|
35716
36176
|
}
|
|
35717
|
-
$('modal-content').append(messageBox('Safety', 'Apply uses the
|
|
36177
|
+
$('modal-content').append(messageBox('Safety', 'Apply uses the transactional engine with backups, ownership checks and rollback. A newer version tuple is allowed when the installed provider exposes the required capability, then the resulting state is checked again after apply.', 'safe'));
|
|
35718
36178
|
$('modal-actions').replaceChildren(modalClose(data.ticket ? 'Cancel' : 'Done'));
|
|
35719
36179
|
if (data.ticket)
|
|
35720
36180
|
$('modal-actions').append(
|
|
@@ -35748,7 +36208,7 @@ var init_guided_product_client = __esm({
|
|
|
35748
36208
|
const run = modalRun;
|
|
35749
36209
|
setBusy(true, true);
|
|
35750
36210
|
$('modal-actions').replaceChildren(modalClose('Applying…', true));
|
|
35751
|
-
$('modal-content').append(progress('Applying the
|
|
36211
|
+
$('modal-content').append(progress('Applying the approved change', 'Keep this window open until the transaction finishes.'));
|
|
35752
36212
|
try {
|
|
35753
36213
|
await ensureSession();
|
|
35754
36214
|
const result = await request('/api/apply', { ticket });
|
|
@@ -36061,7 +36521,7 @@ var init_guided_product_client = __esm({
|
|
|
36061
36521
|
isVerify ? 'Troubleshooting check' : 'Update preview',
|
|
36062
36522
|
isVerify
|
|
36063
36523
|
? 'Re-checks the configured optimizer integrations without repairing or changing them. Normal setup already performs its own safety checks.'
|
|
36064
|
-
: 'Checks
|
|
36524
|
+
: 'Checks provider update channels first. If an installable update exists, you can approve it from this window; the active executable is re-checked after installation before success is reported.',
|
|
36065
36525
|
),
|
|
36066
36526
|
progress(
|
|
36067
36527
|
isVerify ? 'Checking configured optimizers' : 'Checking update channels',
|
|
@@ -36172,7 +36632,7 @@ var init_guided_product_client = __esm({
|
|
|
36172
36632
|
'p',
|
|
36173
36633
|
available.length
|
|
36174
36634
|
? available.map(component => (TOOL_INFO[component.providerId]?.name || component.providerId) + ' has an update ready.').join(' ')
|
|
36175
|
-
: 'Check installed optimizer versions. If
|
|
36635
|
+
: 'Check installed optimizer versions. If an update is available, you can install it from the same dialog; Token Harness verifies the active runtime after installation.',
|
|
36176
36636
|
'caption',
|
|
36177
36637
|
),
|
|
36178
36638
|
);
|
|
@@ -37094,7 +37554,7 @@ ${GUIDE_CANDIDATE_READINESS_JS}`;
|
|
|
37094
37554
|
</div>
|
|
37095
37555
|
|
|
37096
37556
|
<section class="setup-step" id="coding-agents">
|
|
37097
|
-
<div class="section-title"><div><h2>Coding agents</h2><p>
|
|
37557
|
+
<div class="section-title"><div><h2>Coding agents</h2><p>Token Harness shows setup actions only when it has a reviewed automatic change for that exact agent, provider version and platform. Unsupported combinations are shown as unavailable instead of as unfinished work.</p></div></div>
|
|
37098
37558
|
<div id="setup-agents" class="tool-grid"><article class="tool-card"><h3>Checking agents\u2026</h3></article></div>
|
|
37099
37559
|
<details class="disclosure advanced-disclosure">
|
|
37100
37560
|
<summary>Agent details and optional reasoning settings</summary>
|