token-harness 0.1.15 → 0.1.17
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 +975 -260
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")
|
|
@@ -6535,12 +6535,33 @@ var init_install = __esm({
|
|
|
6535
6535
|
version3 === null ? packageName : `${packageName}==${version3}`
|
|
6536
6536
|
],
|
|
6537
6537
|
verified: true
|
|
6538
|
+
},
|
|
6539
|
+
uv: {
|
|
6540
|
+
executable: "uv",
|
|
6541
|
+
// Headroom uses uv's isolated tool installer. Token Harness invokes an existing uv only;
|
|
6542
|
+
// it never bootstraps uv, Python, or administrator prerequisites.
|
|
6543
|
+
args: (packageName, version3) => [
|
|
6544
|
+
"tool",
|
|
6545
|
+
"install",
|
|
6546
|
+
"--force",
|
|
6547
|
+
version3 === null ? packageName : `${packageName}==${version3}`
|
|
6548
|
+
],
|
|
6549
|
+
verified: true
|
|
6538
6550
|
}
|
|
6539
6551
|
};
|
|
6540
6552
|
UNINSTALL_COMMANDS = {
|
|
6553
|
+
npm: {
|
|
6554
|
+
executable: "npm",
|
|
6555
|
+
args: (packageName) => ["uninstall", "--global", packageName]
|
|
6556
|
+
},
|
|
6541
6557
|
pipx: {
|
|
6542
6558
|
executable: "pipx",
|
|
6543
6559
|
args: (packageName) => ["uninstall", packageName]
|
|
6560
|
+
},
|
|
6561
|
+
uv: {
|
|
6562
|
+
executable: "uv",
|
|
6563
|
+
// Extras are install-time selectors; uv tool uninstall expects the distribution name.
|
|
6564
|
+
args: (packageName) => ["tool", "uninstall", packageName.replace(/\[.*\]$/, "")]
|
|
6544
6565
|
}
|
|
6545
6566
|
};
|
|
6546
6567
|
QUERY_COMMANDS = {
|
|
@@ -6633,17 +6654,35 @@ var init_install = __esm({
|
|
|
6633
6654
|
},
|
|
6634
6655
|
npm: {
|
|
6635
6656
|
executable: "npm",
|
|
6636
|
-
|
|
6657
|
+
// Listing the global root as JSON proves both presence and absence without depending on
|
|
6658
|
+
// localized human output or npm's exit behavior for a package-name filter.
|
|
6659
|
+
args: () => ["ls", "--global", "--depth=0", "--json"],
|
|
6637
6660
|
parse: (stdout, packageName) => {
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6661
|
+
let parsed;
|
|
6662
|
+
try {
|
|
6663
|
+
parsed = JSON.parse(stdout);
|
|
6664
|
+
} catch {
|
|
6665
|
+
return { status: "unknown", version: null };
|
|
6666
|
+
}
|
|
6667
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
6668
|
+
return { status: "unknown", version: null };
|
|
6669
|
+
}
|
|
6670
|
+
const dependencies = parsed["dependencies"];
|
|
6671
|
+
if (dependencies === void 0)
|
|
6672
|
+
return { status: "absent", version: null };
|
|
6673
|
+
if (typeof dependencies !== "object" || dependencies === null || Array.isArray(dependencies)) {
|
|
6674
|
+
return { status: "unknown", version: null };
|
|
6675
|
+
}
|
|
6676
|
+
const dependency = dependencies[packageName];
|
|
6677
|
+
if (dependency === void 0)
|
|
6678
|
+
return { status: "absent", version: null };
|
|
6679
|
+
const candidate = typeof dependency === "string" ? dependency : typeof dependency === "object" && dependency !== null && !Array.isArray(dependency) ? dependency["version"] : null;
|
|
6680
|
+
if (typeof candidate !== "string" || parseSemanticVersion(candidate) === null) {
|
|
6642
6681
|
return { status: "unknown", version: null };
|
|
6643
6682
|
}
|
|
6644
6683
|
return { status: "captured", version: candidate };
|
|
6645
6684
|
},
|
|
6646
|
-
verified:
|
|
6685
|
+
verified: true
|
|
6647
6686
|
},
|
|
6648
6687
|
pnpm: {
|
|
6649
6688
|
executable: "pnpm",
|
|
@@ -6698,16 +6737,20 @@ var init_install = __esm({
|
|
|
6698
6737
|
executable: "uv",
|
|
6699
6738
|
args: () => ["tool", "list"],
|
|
6700
6739
|
parse: (stdout, packageName) => {
|
|
6701
|
-
const
|
|
6702
|
-
const
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6740
|
+
const distribution = packageName.replace(/\[.*\]$/, "");
|
|
6741
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
6742
|
+
const fields = line.trim().split(/\s+/);
|
|
6743
|
+
if (fields[0] !== distribution)
|
|
6744
|
+
continue;
|
|
6745
|
+
const candidate = (fields[1] ?? "").replace(/^v/i, "");
|
|
6746
|
+
if (parseSemanticVersion(candidate) === null) {
|
|
6747
|
+
return { status: "unknown", version: null };
|
|
6748
|
+
}
|
|
6749
|
+
return { status: "captured", version: candidate };
|
|
6750
|
+
}
|
|
6751
|
+
return { status: "absent", version: null };
|
|
6709
6752
|
},
|
|
6710
|
-
verified:
|
|
6753
|
+
verified: true
|
|
6711
6754
|
},
|
|
6712
6755
|
pipx: {
|
|
6713
6756
|
executable: "pipx",
|
|
@@ -8892,7 +8935,7 @@ var init_snapshots = __esm({
|
|
|
8892
8935
|
* calling a constructor directly.
|
|
8893
8936
|
*/
|
|
8894
8937
|
static create(input) {
|
|
8895
|
-
if (input.fs.isInside(input.backupRoot, input.projectRoot)) {
|
|
8938
|
+
if (input.projectRoot !== null && input.fs.isInside(input.backupRoot, input.projectRoot)) {
|
|
8896
8939
|
return {
|
|
8897
8940
|
ok: false,
|
|
8898
8941
|
diagnostics: [
|
|
@@ -9387,7 +9430,7 @@ var TOOL_VERSION;
|
|
|
9387
9430
|
var init_version2 = __esm({
|
|
9388
9431
|
"apps/cli/dist/src/version.js"() {
|
|
9389
9432
|
"use strict";
|
|
9390
|
-
TOOL_VERSION = "0.1.
|
|
9433
|
+
TOOL_VERSION = "0.1.17";
|
|
9391
9434
|
}
|
|
9392
9435
|
});
|
|
9393
9436
|
|
|
@@ -11189,6 +11232,10 @@ var init_environment = __esm({
|
|
|
11189
11232
|
"HOMEPATH",
|
|
11190
11233
|
"LOCALAPPDATA",
|
|
11191
11234
|
"NUMBER_OF_PROCESSORS",
|
|
11235
|
+
// npm global installs must stay in the same prefix the parent process is using. This value is
|
|
11236
|
+
// a filesystem location, not a credential; dropping it can update a different global npm tree
|
|
11237
|
+
// while PATH continues to resolve the old executable.
|
|
11238
|
+
"NPM_CONFIG_PREFIX",
|
|
11192
11239
|
"PATH",
|
|
11193
11240
|
"PATHEXT",
|
|
11194
11241
|
"PROCESSOR_ARCHITECTURE",
|
|
@@ -11214,6 +11261,10 @@ var init_environment = __esm({
|
|
|
11214
11261
|
"LC_ALL",
|
|
11215
11262
|
"LC_CTYPE",
|
|
11216
11263
|
"LOGNAME",
|
|
11264
|
+
// npm documents config environment variables with the lowercase npm_config_ prefix on POSIX.
|
|
11265
|
+
// Keep both common spellings because POSIX environment names are case-sensitive.
|
|
11266
|
+
"NPM_CONFIG_PREFIX",
|
|
11267
|
+
"npm_config_prefix",
|
|
11217
11268
|
"PATH",
|
|
11218
11269
|
"SHELL",
|
|
11219
11270
|
"TMPDIR",
|
|
@@ -16088,6 +16139,25 @@ function parseHarnessCapabilities(value3) {
|
|
|
16088
16139
|
narrowing: flags
|
|
16089
16140
|
};
|
|
16090
16141
|
}
|
|
16142
|
+
function parseCapabilityDigests(value3) {
|
|
16143
|
+
if (value3 === void 0)
|
|
16144
|
+
return {};
|
|
16145
|
+
if (typeof value3 !== "object" || value3 === null || Array.isArray(value3))
|
|
16146
|
+
return null;
|
|
16147
|
+
const result6 = {};
|
|
16148
|
+
for (const [harness, raw] of Object.entries(value3)) {
|
|
16149
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
16150
|
+
return null;
|
|
16151
|
+
const entries = {};
|
|
16152
|
+
for (const [path, digest] of Object.entries(raw)) {
|
|
16153
|
+
if (typeof digest !== "string" || !/^[a-f0-9]{64}$/i.test(digest))
|
|
16154
|
+
return null;
|
|
16155
|
+
entries[path.replaceAll("\\", "/")] = `sha256:${digest.toLowerCase()}`;
|
|
16156
|
+
}
|
|
16157
|
+
result6[harness] = entries;
|
|
16158
|
+
}
|
|
16159
|
+
return result6;
|
|
16160
|
+
}
|
|
16091
16161
|
function parseCapabilities(stdout) {
|
|
16092
16162
|
let parsed;
|
|
16093
16163
|
try {
|
|
@@ -16100,7 +16170,8 @@ function parseCapabilities(stdout) {
|
|
|
16100
16170
|
const record5 = parsed;
|
|
16101
16171
|
const version3 = record5["version"];
|
|
16102
16172
|
const harnesses = record5["harnesses"];
|
|
16103
|
-
|
|
16173
|
+
const digests = parseCapabilityDigests(record5["digests"]);
|
|
16174
|
+
if (typeof version3 !== "string" || typeof harnesses !== "object" || harnesses === null || digests === null) {
|
|
16104
16175
|
return null;
|
|
16105
16176
|
}
|
|
16106
16177
|
const entries = {};
|
|
@@ -16110,7 +16181,7 @@ function parseCapabilities(stdout) {
|
|
|
16110
16181
|
return null;
|
|
16111
16182
|
entries[harness] = entry;
|
|
16112
16183
|
}
|
|
16113
|
-
return { version: version3, harnesses: entries };
|
|
16184
|
+
return { version: version3, harnesses: entries, digests };
|
|
16114
16185
|
}
|
|
16115
16186
|
async function probeCapabilities(context) {
|
|
16116
16187
|
const outcome2 = await context.runner.run({
|
|
@@ -16185,13 +16256,27 @@ function driftWarning(message, remediation) {
|
|
|
16185
16256
|
function formatSurface(surface) {
|
|
16186
16257
|
return `${surface.toolFamily}/${surface.interceptionPoint}`;
|
|
16187
16258
|
}
|
|
16259
|
+
function requiresRuntimeSkillDigests(capabilities) {
|
|
16260
|
+
const observed = parseSemanticVersion(capabilities.version);
|
|
16261
|
+
const minimum = parseSemanticVersion(RUNTIME_SKILL_DIGESTS_MINIMUM);
|
|
16262
|
+
if (observed === null || minimum === null)
|
|
16263
|
+
return true;
|
|
16264
|
+
return compareVersions(observed, minimum) >= 0;
|
|
16265
|
+
}
|
|
16266
|
+
function publishedSkillArtifactDigests(capabilities, harness) {
|
|
16267
|
+
const install = SKILLS_INSTALL[harness];
|
|
16268
|
+
if (install === void 0)
|
|
16269
|
+
return [];
|
|
16270
|
+
const prefix = `${install.directory}/skills/`;
|
|
16271
|
+
return Object.entries(capabilities.digests?.[harness] ?? {}).filter(([path]) => path.startsWith(prefix));
|
|
16272
|
+
}
|
|
16188
16273
|
function assignableOn(capabilities) {
|
|
16189
16274
|
if (capabilities === null)
|
|
16190
16275
|
return [];
|
|
16191
16276
|
const reviews = MANIFEST6.delegatedInstallReviews ?? {};
|
|
16192
16277
|
return Object.keys(reviews).filter((harness) => {
|
|
16193
16278
|
const observed = capabilities.harnesses[harness];
|
|
16194
|
-
return observed !== void 0 && observed.narrowing.length > 0 && writeSetStillReviewed(capabilities, harnessId(harness));
|
|
16279
|
+
return observed !== void 0 && observed.narrowing.length > 0 && writeSetStillReviewed(capabilities, harnessId(harness)) && (!requiresRuntimeSkillDigests(capabilities) || publishedSkillArtifactDigests(capabilities, harness).length > 0);
|
|
16195
16280
|
}).map((harness) => harnessId(harness));
|
|
16196
16281
|
}
|
|
16197
16282
|
function writeSetStillReviewed(capabilities, harness) {
|
|
@@ -16239,6 +16324,15 @@ function compareCapabilities(manifest, capabilities) {
|
|
|
16239
16324
|
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
16325
|
}
|
|
16241
16326
|
}
|
|
16327
|
+
if (requiresRuntimeSkillDigests(capabilities)) {
|
|
16328
|
+
for (const harness of Object.keys(manifest.delegatedInstallReviews ?? {})) {
|
|
16329
|
+
if (capabilities.harnesses[harness] === void 0)
|
|
16330
|
+
continue;
|
|
16331
|
+
if (publishedSkillArtifactDigests(capabilities, harness).length > 0)
|
|
16332
|
+
continue;
|
|
16333
|
+
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`));
|
|
16334
|
+
}
|
|
16335
|
+
}
|
|
16242
16336
|
return warnings;
|
|
16243
16337
|
}
|
|
16244
16338
|
function harnessesWiredToHarnessTrim(configs) {
|
|
@@ -16332,7 +16426,7 @@ function metricsLocations(context) {
|
|
|
16332
16426
|
async function detect6(context) {
|
|
16333
16427
|
const probe = await probeExecutable(context);
|
|
16334
16428
|
const observed = probe.installed ? await probeCapabilities(context) : null;
|
|
16335
|
-
const configured =
|
|
16429
|
+
const configured = await configuredHarnessesForHarnessTrim(context, observed?.capabilities ?? null);
|
|
16336
16430
|
const warnings = [];
|
|
16337
16431
|
const evidenceItems = [...probe.evidence, ...observed?.evidence ?? []];
|
|
16338
16432
|
if (observed !== null && observed.capabilities !== null) {
|
|
@@ -16496,11 +16590,12 @@ async function verify6(context) {
|
|
|
16496
16590
|
evidence: probe.evidence,
|
|
16497
16591
|
remediation: probe.installed ? null : "Install HarnessTrim, or add it to PATH"
|
|
16498
16592
|
});
|
|
16499
|
-
const
|
|
16593
|
+
const currentCapabilities = probe.installed ? await probeCapabilities(context) : null;
|
|
16594
|
+
const configured = await configuredHarnessesForHarnessTrim(context, currentCapabilities?.capabilities ?? null);
|
|
16500
16595
|
checks.push({
|
|
16501
|
-
id: "
|
|
16596
|
+
id: "integration-configured",
|
|
16502
16597
|
status: configured.length > 0 ? "pass" : "not-exercised",
|
|
16503
|
-
summary: configured.length > 0 ? `
|
|
16598
|
+
summary: configured.length > 0 ? `configured for ${configured.join(", ")}` : "no HarnessTrim hook, plugin, or matching skills-only installation was found",
|
|
16504
16599
|
achievedTier: configured.length > 0 ? "config-only" : null,
|
|
16505
16600
|
evidence: [],
|
|
16506
16601
|
remediation: null
|
|
@@ -16716,16 +16811,65 @@ async function collectMetrics(context, store) {
|
|
|
16716
16811
|
diagnostics
|
|
16717
16812
|
};
|
|
16718
16813
|
}
|
|
16719
|
-
function skillArtifacts(context, harness) {
|
|
16814
|
+
function skillArtifacts(context, harness, capabilities = null) {
|
|
16720
16815
|
const install = SKILLS_INSTALL[harness];
|
|
16721
16816
|
if (install === void 0)
|
|
16722
16817
|
return [];
|
|
16818
|
+
const dynamic = capabilities === null ? [] : publishedSkillArtifactDigests(capabilities, harness).map(([path, digest]) => ({
|
|
16819
|
+
path: context.fs.join(context.projectRoot, ...path.split("/")),
|
|
16820
|
+
digest
|
|
16821
|
+
}));
|
|
16822
|
+
if (dynamic.length > 0)
|
|
16823
|
+
return dynamic;
|
|
16824
|
+
if (capabilities !== null && requiresRuntimeSkillDigests(capabilities))
|
|
16825
|
+
return [];
|
|
16723
16826
|
const skills = context.fs.join(context.projectRoot, install.directory, "skills");
|
|
16724
16827
|
return Object.entries(SKILL_ARTIFACT_DIGESTS).map(([path, digest]) => ({
|
|
16725
16828
|
path: context.fs.join(skills, ...path.split("/")),
|
|
16726
16829
|
digest
|
|
16727
16830
|
}));
|
|
16728
16831
|
}
|
|
16832
|
+
function skillInstallContainmentBoundary(context, harness, capabilities, protectedPaths) {
|
|
16833
|
+
const install = SKILLS_INSTALL[harness];
|
|
16834
|
+
if (install === void 0)
|
|
16835
|
+
return [...protectedPaths];
|
|
16836
|
+
const prefix = `${install.directory}/skills/`;
|
|
16837
|
+
const relativeArtifacts = capabilities === null ? [] : publishedSkillArtifactDigests(capabilities, harness).map(([path]) => path);
|
|
16838
|
+
const fallbackArtifacts = Object.keys(SKILL_ARTIFACT_DIGESTS).map((path) => `${install.directory}/skills/${path}`);
|
|
16839
|
+
const contract = relativeArtifacts.length > 0 ? relativeArtifacts : capabilities !== null && requiresRuntimeSkillDigests(capabilities) ? [] : fallbackArtifacts;
|
|
16840
|
+
const skillRoots = /* @__PURE__ */ new Set();
|
|
16841
|
+
for (const relative of contract) {
|
|
16842
|
+
if (!relative.startsWith(prefix))
|
|
16843
|
+
continue;
|
|
16844
|
+
const first = relative.slice(prefix.length).split("/")[0];
|
|
16845
|
+
if (first) {
|
|
16846
|
+
skillRoots.add(context.fs.join(context.projectRoot, install.directory, "skills", first));
|
|
16847
|
+
}
|
|
16848
|
+
}
|
|
16849
|
+
return [...skillRoots, ...protectedPaths];
|
|
16850
|
+
}
|
|
16851
|
+
async function harnessTrimSkillsConfigured(context, harness, capabilities) {
|
|
16852
|
+
const artifacts = skillArtifacts(context, harness, capabilities);
|
|
16853
|
+
if (artifacts.length === 0)
|
|
16854
|
+
return false;
|
|
16855
|
+
for (const artifact of artifacts) {
|
|
16856
|
+
const stat3 = await context.fs.stat(artifact.path);
|
|
16857
|
+
if (stat3 === null || stat3.kind !== "file")
|
|
16858
|
+
return false;
|
|
16859
|
+
const actual = digestText(new TextDecoder().decode(await context.fs.readFile(artifact.path)));
|
|
16860
|
+
if (actual !== artifact.digest)
|
|
16861
|
+
return false;
|
|
16862
|
+
}
|
|
16863
|
+
return true;
|
|
16864
|
+
}
|
|
16865
|
+
async function configuredHarnessesForHarnessTrim(context, capabilities) {
|
|
16866
|
+
const configured = new Set(harnessesWiredToHarnessTrim(context.harnessConfigs));
|
|
16867
|
+
for (const harness of [CLAUDE2, CODEX2]) {
|
|
16868
|
+
if (await harnessTrimSkillsConfigured(context, harness, capabilities))
|
|
16869
|
+
configured.add(harness);
|
|
16870
|
+
}
|
|
16871
|
+
return [...configured];
|
|
16872
|
+
}
|
|
16729
16873
|
async function plan(context, request) {
|
|
16730
16874
|
const reviews = MANIFEST6.delegatedInstallReviews ?? {};
|
|
16731
16875
|
const targets = request.harnesses.map((harness) => harness.id).filter((harness) => reviews[harness] !== void 0 && SKILLS_INSTALL[harness] !== void 0);
|
|
@@ -16737,8 +16881,11 @@ async function plan(context, request) {
|
|
|
16737
16881
|
targetHarnesses: []
|
|
16738
16882
|
};
|
|
16739
16883
|
}
|
|
16884
|
+
const installed2 = await probeExecutable(context);
|
|
16885
|
+
const observed = installed2.installed ? await probeCapabilities(context) : null;
|
|
16886
|
+
const currentCapabilities = observed?.capabilities ?? null;
|
|
16740
16887
|
if (request.desiredState === "absent") {
|
|
16741
|
-
const actions2 = targets.flatMap((harness) => skillArtifacts(context, harness).map((artifact) => ({
|
|
16888
|
+
const actions2 = targets.flatMap((harness) => skillArtifacts(context, harness, currentCapabilities).map((artifact) => ({
|
|
16742
16889
|
kind: "remove-owned-change",
|
|
16743
16890
|
id: `harnesstrim-${harness}-skill-remove-${digestText(artifact.path).slice(7, 15)}`,
|
|
16744
16891
|
riskClass: "reversible",
|
|
@@ -16747,7 +16894,7 @@ async function plan(context, request) {
|
|
|
16747
16894
|
affectedPaths: [artifact.path],
|
|
16748
16895
|
affectedProcesses: [],
|
|
16749
16896
|
preconditions: [
|
|
16750
|
-
`the HarnessTrim skill still matches the
|
|
16897
|
+
`the HarnessTrim skill still matches the installed HarnessTrim artifact contract`
|
|
16751
16898
|
],
|
|
16752
16899
|
postconditions: ["the owned HarnessTrim skill is absent"],
|
|
16753
16900
|
rollbackData: "file-snapshot",
|
|
@@ -16768,7 +16915,6 @@ async function plan(context, request) {
|
|
|
16768
16915
|
targetHarnesses: actions2.length === 0 ? [] : targets.map((harness) => harnessId(harness))
|
|
16769
16916
|
};
|
|
16770
16917
|
}
|
|
16771
|
-
const installed2 = await probeExecutable(context);
|
|
16772
16918
|
if (!installed2.installed) {
|
|
16773
16919
|
return {
|
|
16774
16920
|
providerId: HARNESSTRIM2,
|
|
@@ -16777,7 +16923,6 @@ async function plan(context, request) {
|
|
|
16777
16923
|
targetHarnesses: []
|
|
16778
16924
|
};
|
|
16779
16925
|
}
|
|
16780
|
-
const observed = await probeCapabilities(context);
|
|
16781
16926
|
const actions = [];
|
|
16782
16927
|
const plannedHarnesses = [];
|
|
16783
16928
|
for (const harness of targets) {
|
|
@@ -16785,10 +16930,17 @@ async function plan(context, request) {
|
|
|
16785
16930
|
const install = SKILLS_INSTALL[harness];
|
|
16786
16931
|
if (review === void 0 || install === void 0)
|
|
16787
16932
|
continue;
|
|
16788
|
-
const reviewed =
|
|
16933
|
+
const reviewed = currentCapabilities === null ? installed2.version === review.upstreamVersion : writeSetStillReviewed(currentCapabilities, harnessId(harness));
|
|
16789
16934
|
if (!reviewed)
|
|
16790
16935
|
continue;
|
|
16791
|
-
const expectedArtifacts = skillArtifacts(context, harness);
|
|
16936
|
+
const expectedArtifacts = skillArtifacts(context, harness, currentCapabilities);
|
|
16937
|
+
if (expectedArtifacts.length === 0)
|
|
16938
|
+
continue;
|
|
16939
|
+
const protectedPaths = [
|
|
16940
|
+
context.fs.join(context.projectRoot, install.directory, install.hook),
|
|
16941
|
+
context.fs.join(context.projectRoot, install.instructions)
|
|
16942
|
+
];
|
|
16943
|
+
const containmentBoundary = skillInstallContainmentBoundary(context, harness, currentCapabilities, protectedPaths);
|
|
16792
16944
|
actions.push({
|
|
16793
16945
|
kind: "delegated-provider-install",
|
|
16794
16946
|
id: `harnesstrim-${harness}-skills-${digestText(context.projectRoot).slice(7, 15)}`,
|
|
@@ -16798,24 +16950,21 @@ async function plan(context, request) {
|
|
|
16798
16950
|
affectedPaths: expectedArtifacts.map((artifact) => artifact.path),
|
|
16799
16951
|
affectedProcesses: ["harnesstrim"],
|
|
16800
16952
|
preconditions: [
|
|
16801
|
-
"harnesstrim is installed, on PATH, and declares
|
|
16802
|
-
`the
|
|
16953
|
+
"harnesstrim is installed, on PATH, and declares a compatible write set",
|
|
16954
|
+
`the installed HarnessTrim build publishes the exact ${harness} skill artifact contract`
|
|
16803
16955
|
],
|
|
16804
16956
|
postconditions: [
|
|
16805
|
-
`HarnessTrim ${harness} skills match the
|
|
16957
|
+
`HarnessTrim ${harness} skills match the installed ${installed2.version ?? review.upstreamVersion} artifact contract`,
|
|
16806
16958
|
"no HarnessTrim hook or reduce-pipe instruction was added"
|
|
16807
16959
|
],
|
|
16808
16960
|
rollbackData: "directory-snapshot",
|
|
16809
16961
|
explanation: `Install HarnessTrim ${harness} skills without a hook or reduce-pipe instruction`,
|
|
16810
16962
|
executable: "harnesstrim",
|
|
16811
16963
|
args: ["install", harness, context.projectRoot, "--apply", ...install.args],
|
|
16812
|
-
containmentBoundary
|
|
16964
|
+
containmentBoundary,
|
|
16813
16965
|
expectedArtifacts,
|
|
16814
16966
|
// The two files each installer reports skipping. Named here because they must not appear.
|
|
16815
|
-
protectedPaths
|
|
16816
|
-
context.fs.join(context.projectRoot, install.directory, install.hook),
|
|
16817
|
-
context.fs.join(context.projectRoot, install.instructions)
|
|
16818
|
-
],
|
|
16967
|
+
protectedPaths,
|
|
16819
16968
|
rollbackStrategy: "restore-snapshot",
|
|
16820
16969
|
snapshotSizeCapBytes: 1048576,
|
|
16821
16970
|
upstreamUninstallAvailable: review.upstreamUninstallAvailable
|
|
@@ -16829,7 +16978,7 @@ async function plan(context, request) {
|
|
|
16829
16978
|
targetHarnesses: plannedHarnesses
|
|
16830
16979
|
};
|
|
16831
16980
|
}
|
|
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;
|
|
16981
|
+
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
16982
|
var init_harnesstrim = __esm({
|
|
16834
16983
|
"packages/adapters/dist/src/providers/harnesstrim.js"() {
|
|
16835
16984
|
"use strict";
|
|
@@ -16840,6 +16989,7 @@ var init_harnesstrim = __esm({
|
|
|
16840
16989
|
CODEX2 = harnessId("codex");
|
|
16841
16990
|
PI2 = harnessId("pi");
|
|
16842
16991
|
SKILLS_UPSTREAM = "0.0.7";
|
|
16992
|
+
RUNTIME_SKILL_DIGESTS_MINIMUM = "0.2.0";
|
|
16843
16993
|
SKILL_ARTIFACT_DIGESTS = {
|
|
16844
16994
|
"compact-handoff/SKILL.md": "sha256:0efbf35581c559359e755b204778b64a289dab4d20dadc1cba3d5b5c995b5f01",
|
|
16845
16995
|
"debug-log-slim/SKILL.md": "sha256:17f5ccc34d29d7aba083444e0e4d87fd3d49916ebcb4e6544caf8c89f13f0045",
|
|
@@ -18088,15 +18238,87 @@ var init_gitnexus_candidate = __esm({
|
|
|
18088
18238
|
function claudeTarget(context) {
|
|
18089
18239
|
return context.fs.join(context.paths.home, ".claude.json");
|
|
18090
18240
|
}
|
|
18091
|
-
function
|
|
18241
|
+
async function observeGitNexusManagedRuntime(context) {
|
|
18242
|
+
const versionOutcome = await context.runner.run({
|
|
18243
|
+
executable: "gitnexus",
|
|
18244
|
+
args: ["--version"],
|
|
18245
|
+
cwd: context.projectRoot,
|
|
18246
|
+
timeoutMs: 2e4
|
|
18247
|
+
});
|
|
18248
|
+
if (versionOutcome.failure !== null) {
|
|
18249
|
+
return {
|
|
18250
|
+
ready: false,
|
|
18251
|
+
absent: versionOutcome.failure.reason === "executable-not-found",
|
|
18252
|
+
version: null,
|
|
18253
|
+
executable: versionOutcome.executablePath,
|
|
18254
|
+
supportsMcp: false,
|
|
18255
|
+
detail: `gitnexus --version failed: ${versionOutcome.failure.reason}`
|
|
18256
|
+
};
|
|
18257
|
+
}
|
|
18258
|
+
const version3 = parseGitNexusVersion(`${versionOutcome.stdout}
|
|
18259
|
+
${versionOutcome.stderr}`);
|
|
18260
|
+
const actual = version3 === null ? null : parseSemanticVersion(version3);
|
|
18261
|
+
const floor = parseSemanticVersion(GITNEXUS_REVIEWED_MCP_VERSION);
|
|
18262
|
+
const newEnough = actual !== null && floor !== null && compareVersions(actual, floor) >= 0;
|
|
18263
|
+
if (versionOutcome.exitCode !== 0 || !newEnough) {
|
|
18264
|
+
return {
|
|
18265
|
+
ready: false,
|
|
18266
|
+
absent: false,
|
|
18267
|
+
version: version3,
|
|
18268
|
+
executable: versionOutcome.executablePath,
|
|
18269
|
+
supportsMcp: false,
|
|
18270
|
+
detail: version3 === null ? "GitNexus did not report a semantic version" : `GitNexus ${version3} predates the managed MCP floor ${GITNEXUS_REVIEWED_MCP_VERSION}`
|
|
18271
|
+
};
|
|
18272
|
+
}
|
|
18273
|
+
const help = await context.runner.run({
|
|
18274
|
+
executable: "gitnexus",
|
|
18275
|
+
args: ["--help"],
|
|
18276
|
+
cwd: context.projectRoot,
|
|
18277
|
+
timeoutMs: 2e4
|
|
18278
|
+
});
|
|
18279
|
+
const capabilities = help.failure === null && help.exitCode === 0 ? parseGitNexusCliCapabilities(`${help.stdout}
|
|
18280
|
+
${help.stderr}`, "") : { query: false, context: false, statusJson: false, mcp: false };
|
|
18281
|
+
return {
|
|
18282
|
+
ready: capabilities.mcp,
|
|
18283
|
+
absent: false,
|
|
18284
|
+
version: version3,
|
|
18285
|
+
executable: versionOutcome.executablePath,
|
|
18286
|
+
supportsMcp: capabilities.mcp,
|
|
18287
|
+
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`
|
|
18288
|
+
};
|
|
18289
|
+
}
|
|
18290
|
+
function prerequisiteDiagnostic(harness, detail2) {
|
|
18092
18291
|
return diagnostic({
|
|
18093
18292
|
severity: "warning",
|
|
18094
18293
|
code: "gitnexus-managed-mcp-prerequisite",
|
|
18095
18294
|
subject: harness,
|
|
18096
|
-
message:
|
|
18097
|
-
remediation: `
|
|
18295
|
+
message: detail2,
|
|
18296
|
+
remediation: `Install or update GitNexus to ${GITNEXUS_REVIEWED_MCP_VERSION} or newer with the MCP command, then refresh Token Harness`
|
|
18098
18297
|
});
|
|
18099
18298
|
}
|
|
18299
|
+
function gitnexusInstallAction() {
|
|
18300
|
+
return {
|
|
18301
|
+
kind: "package-manager-install",
|
|
18302
|
+
id: `gitnexus:install:${GITNEXUS_REVIEWED_MCP_VERSION}`,
|
|
18303
|
+
riskClass: "delegated",
|
|
18304
|
+
requiresNetwork: true,
|
|
18305
|
+
requiresElevation: false,
|
|
18306
|
+
affectedPaths: [],
|
|
18307
|
+
affectedProcesses: ["npm"],
|
|
18308
|
+
preconditions: [
|
|
18309
|
+
"npm remains runnable",
|
|
18310
|
+
`the reviewed GitNexus ${GITNEXUS_REVIEWED_MCP_VERSION} package remains installable`
|
|
18311
|
+
],
|
|
18312
|
+
postconditions: [
|
|
18313
|
+
`GitNexus ${GITNEXUS_REVIEWED_MCP_VERSION} is installed and exposes the mcp command`
|
|
18314
|
+
],
|
|
18315
|
+
rollbackData: "package-inventory",
|
|
18316
|
+
explanation: `Install the reviewed GitNexus ${GITNEXUS_REVIEWED_MCP_VERSION} CLI through npm`,
|
|
18317
|
+
packageManager: "npm",
|
|
18318
|
+
packageName: "gitnexus",
|
|
18319
|
+
version: GITNEXUS_REVIEWED_MCP_VERSION
|
|
18320
|
+
};
|
|
18321
|
+
}
|
|
18100
18322
|
async function planGitNexusManagedMcpActivation(context, harness) {
|
|
18101
18323
|
if (harness !== "claude") {
|
|
18102
18324
|
return {
|
|
@@ -18114,14 +18336,40 @@ async function planGitNexusManagedMcpActivation(context, harness) {
|
|
|
18114
18336
|
]
|
|
18115
18337
|
};
|
|
18116
18338
|
}
|
|
18117
|
-
const observation = await
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
|
|
18121
|
-
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18339
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
18340
|
+
const installActions = [];
|
|
18341
|
+
if (!observation.ready) {
|
|
18342
|
+
if (!observation.absent) {
|
|
18343
|
+
return {
|
|
18344
|
+
harness,
|
|
18345
|
+
target: null,
|
|
18346
|
+
actions: [],
|
|
18347
|
+
diagnostics: [prerequisiteDiagnostic(harness, observation.detail)]
|
|
18348
|
+
};
|
|
18349
|
+
}
|
|
18350
|
+
const npm = await context.runner.run({
|
|
18351
|
+
executable: "npm",
|
|
18352
|
+
args: ["--version"],
|
|
18353
|
+
cwd: context.projectRoot,
|
|
18354
|
+
timeoutMs: 2e4
|
|
18355
|
+
});
|
|
18356
|
+
if (npm.failure !== null || npm.exitCode !== 0) {
|
|
18357
|
+
return {
|
|
18358
|
+
harness,
|
|
18359
|
+
target: null,
|
|
18360
|
+
actions: [],
|
|
18361
|
+
diagnostics: [
|
|
18362
|
+
diagnostic({
|
|
18363
|
+
severity: "warning",
|
|
18364
|
+
code: "gitnexus-npm-unavailable",
|
|
18365
|
+
subject: harness,
|
|
18366
|
+
message: "GitNexus is absent and npm is not available in this terminal",
|
|
18367
|
+
remediation: "Make npm available on PATH, then refresh Token Harness. Token Harness will not bootstrap Node.js or administrator prerequisites."
|
|
18368
|
+
})
|
|
18369
|
+
]
|
|
18370
|
+
};
|
|
18371
|
+
}
|
|
18372
|
+
installActions.push(gitnexusInstallAction());
|
|
18125
18373
|
}
|
|
18126
18374
|
const target = claudeTarget(context);
|
|
18127
18375
|
if (!context.fs.isInside(target, context.paths.home)) {
|
|
@@ -18239,7 +18487,7 @@ async function planGitNexusManagedMcpActivation(context, harness) {
|
|
|
18239
18487
|
],
|
|
18240
18488
|
createIfMissing: true
|
|
18241
18489
|
};
|
|
18242
|
-
return { harness, target, actions: [action], diagnostics: [] };
|
|
18490
|
+
return { harness, target, actions: [...installActions, action], diagnostics: [] };
|
|
18243
18491
|
}
|
|
18244
18492
|
function planGitNexusManagedMcpRemoval(context, ownership) {
|
|
18245
18493
|
const harness = "claude";
|
|
@@ -18287,12 +18535,12 @@ async function verifyGitNexusManagedMcpActivation(context, harness) {
|
|
|
18287
18535
|
detail: "Managed GitNexus MCP verification is currently reviewed only for Claude Code"
|
|
18288
18536
|
};
|
|
18289
18537
|
}
|
|
18290
|
-
const observation = await
|
|
18291
|
-
if (observation.
|
|
18538
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
18539
|
+
if (!observation.ready) {
|
|
18292
18540
|
return {
|
|
18293
18541
|
state: "candidate-unavailable",
|
|
18294
18542
|
target: null,
|
|
18295
|
-
detail: observation.
|
|
18543
|
+
detail: observation.detail
|
|
18296
18544
|
};
|
|
18297
18545
|
}
|
|
18298
18546
|
const target = claudeTarget(context);
|
|
@@ -18327,7 +18575,7 @@ async function verifyGitNexusManagedMcpActivation(context, harness) {
|
|
|
18327
18575
|
return {
|
|
18328
18576
|
state: "verified",
|
|
18329
18577
|
target,
|
|
18330
|
-
detail: `GitNexus ${
|
|
18578
|
+
detail: `GitNexus ${observation.version ?? ""} is registered through the Token Harness-owned Claude MCP entry; verification did not start the MCP server`
|
|
18331
18579
|
};
|
|
18332
18580
|
}
|
|
18333
18581
|
var GITNEXUS_REVIEWED_MCP_VERSION, GITNEXUS_CLAUDE_MCP_POINTER, GITNEXUS_MCP_SERVER, DECODER;
|
|
@@ -18479,6 +18727,28 @@ var init_headroom_candidate = __esm({
|
|
|
18479
18727
|
function parseMcptoonVersion(text3) {
|
|
18480
18728
|
return VERSION_PATTERN10.exec(text3)?.[1] ?? null;
|
|
18481
18729
|
}
|
|
18730
|
+
function numericCore2(version3) {
|
|
18731
|
+
const core = version3.split(/[-+]/, 1)[0];
|
|
18732
|
+
if (core === void 0)
|
|
18733
|
+
return null;
|
|
18734
|
+
const parts = core.split(".").map((part) => Number.parseInt(part, 10));
|
|
18735
|
+
if (parts.length !== 3 || parts.some((part) => !Number.isInteger(part) || part < 0))
|
|
18736
|
+
return null;
|
|
18737
|
+
return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];
|
|
18738
|
+
}
|
|
18739
|
+
function mcptoonVersionAtLeast(version3, minimum) {
|
|
18740
|
+
const actual = numericCore2(version3);
|
|
18741
|
+
const floor = numericCore2(minimum);
|
|
18742
|
+
if (actual === null || floor === null)
|
|
18743
|
+
return false;
|
|
18744
|
+
for (let index = 0; index < 3; index += 1) {
|
|
18745
|
+
const left = actual[index] ?? 0;
|
|
18746
|
+
const right = floor[index] ?? 0;
|
|
18747
|
+
if (left !== right)
|
|
18748
|
+
return left > right;
|
|
18749
|
+
}
|
|
18750
|
+
return !(version3.includes("-") && !minimum.includes("-"));
|
|
18751
|
+
}
|
|
18482
18752
|
function parseMcptoonManifestCapabilities(text3) {
|
|
18483
18753
|
const lower = text3.toLowerCase();
|
|
18484
18754
|
return {
|
|
@@ -18586,6 +18856,50 @@ var init_mcptoon_candidate = __esm({
|
|
|
18586
18856
|
});
|
|
18587
18857
|
|
|
18588
18858
|
// packages/adapters/dist/src/providers/mcptoon-managed.js
|
|
18859
|
+
async function observeMcptoonManagedRuntime(context) {
|
|
18860
|
+
const versionOutcome = await context.runner.run({
|
|
18861
|
+
executable: "mcptoon",
|
|
18862
|
+
args: ["--version"],
|
|
18863
|
+
cwd: context.projectRoot,
|
|
18864
|
+
timeoutMs: 2e4
|
|
18865
|
+
});
|
|
18866
|
+
if (versionOutcome.failure !== null) {
|
|
18867
|
+
return {
|
|
18868
|
+
ready: false,
|
|
18869
|
+
absent: versionOutcome.failure.reason === "executable-not-found",
|
|
18870
|
+
version: null,
|
|
18871
|
+
executable: versionOutcome.executablePath,
|
|
18872
|
+
detail: `mcptoon --version failed: ${versionOutcome.failure.reason}`
|
|
18873
|
+
};
|
|
18874
|
+
}
|
|
18875
|
+
const version3 = parseMcptoonVersion(`${versionOutcome.stdout}
|
|
18876
|
+
${versionOutcome.stderr}`);
|
|
18877
|
+
if (versionOutcome.exitCode !== 0 || version3 === null || !mcptoonVersionAtLeast(version3, MCPTOON_MANAGED_MINIMUM_VERSION)) {
|
|
18878
|
+
return {
|
|
18879
|
+
ready: false,
|
|
18880
|
+
absent: false,
|
|
18881
|
+
version: version3,
|
|
18882
|
+
executable: versionOutcome.executablePath,
|
|
18883
|
+
detail: version3 === null ? "mcptoon did not report a semantic version" : `mcptoon ${version3} predates the managed runtime floor ${MCPTOON_MANAGED_MINIMUM_VERSION}`
|
|
18884
|
+
};
|
|
18885
|
+
}
|
|
18886
|
+
const help = await context.runner.run({
|
|
18887
|
+
executable: "mcptoon",
|
|
18888
|
+
args: ["--help"],
|
|
18889
|
+
cwd: context.projectRoot,
|
|
18890
|
+
timeoutMs: 2e4
|
|
18891
|
+
});
|
|
18892
|
+
const capabilities = help.failure === null && help.exitCode === 0 ? parseMcptoonManifestCapabilities(`${help.stdout}
|
|
18893
|
+
${help.stderr}`) : { compact: false, json: false };
|
|
18894
|
+
const ready = capabilities.compact && capabilities.json;
|
|
18895
|
+
return {
|
|
18896
|
+
ready,
|
|
18897
|
+
absent: false,
|
|
18898
|
+
version: version3,
|
|
18899
|
+
executable: versionOutcome.executablePath,
|
|
18900
|
+
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`
|
|
18901
|
+
};
|
|
18902
|
+
}
|
|
18589
18903
|
function mcptoonInstallAction() {
|
|
18590
18904
|
return {
|
|
18591
18905
|
kind: "package-manager-install",
|
|
@@ -18811,11 +19125,11 @@ async function planMcptoonManagedActivation(context, harness) {
|
|
|
18811
19125
|
]
|
|
18812
19126
|
};
|
|
18813
19127
|
}
|
|
18814
|
-
const observation = await
|
|
19128
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
18815
19129
|
const activation = harness === "claude" ? await planClaudeActivation(context, harness) : await planCodexActivation(context, harness);
|
|
18816
|
-
if (observation.
|
|
19130
|
+
if (observation.ready)
|
|
18817
19131
|
return activation;
|
|
18818
|
-
if (observation.
|
|
19132
|
+
if (observation.absent) {
|
|
18819
19133
|
const activationSatisfied = activation.diagnostics.some((entry) => entry.code === "mcptoon-guidance-already-present");
|
|
18820
19134
|
if (activation.actions.length === 0 && !activationSatisfied) {
|
|
18821
19135
|
return activation;
|
|
@@ -18867,19 +19181,19 @@ async function planMcptoonManagedActivation(context, harness) {
|
|
|
18867
19181
|
severity: "warning",
|
|
18868
19182
|
code: "mcptoon-managed-prerequisite",
|
|
18869
19183
|
subject: harness,
|
|
18870
|
-
message:
|
|
18871
|
-
remediation: `
|
|
19184
|
+
message: observation.detail,
|
|
19185
|
+
remediation: `Update mcptoon to ${MCPTOON_MANAGED_MINIMUM_VERSION} or newer with the required compact/JSON CLI surfaces, then refresh Token Harness`
|
|
18872
19186
|
})
|
|
18873
19187
|
]
|
|
18874
19188
|
};
|
|
18875
19189
|
}
|
|
18876
19190
|
async function verifyMcptoonManagedActivation(context, harness) {
|
|
18877
|
-
const observation = await
|
|
18878
|
-
if (observation.
|
|
19191
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
19192
|
+
if (!observation.ready) {
|
|
18879
19193
|
return {
|
|
18880
19194
|
state: "candidate-unavailable",
|
|
18881
19195
|
target: null,
|
|
18882
|
-
detail: observation.
|
|
19196
|
+
detail: observation.detail
|
|
18883
19197
|
};
|
|
18884
19198
|
}
|
|
18885
19199
|
let target;
|
|
@@ -18906,22 +19220,23 @@ async function verifyMcptoonManagedActivation(context, harness) {
|
|
|
18906
19220
|
return {
|
|
18907
19221
|
state: "not-configured",
|
|
18908
19222
|
target,
|
|
18909
|
-
detail: "The
|
|
19223
|
+
detail: "The Token Harness mcptoon agent instructions are not present"
|
|
18910
19224
|
};
|
|
18911
19225
|
}
|
|
18912
19226
|
return {
|
|
18913
19227
|
state: "verified",
|
|
18914
19228
|
target,
|
|
18915
|
-
detail:
|
|
19229
|
+
detail: `Agent instructions are present and mcptoon ${observation.version ?? ""} exposes the required passive CLI capabilities`
|
|
18916
19230
|
};
|
|
18917
19231
|
}
|
|
18918
|
-
var MCPTOON_REVIEWED_INSTALL_VERSION, MCPTOON_MARKER_BEGIN, MCPTOON_MARKER_END, MCPTOON_AGENT_INSTRUCTIONS, MCPTOON_CLAUDE_SKILL, DECODER2;
|
|
19232
|
+
var MCPTOON_REVIEWED_INSTALL_VERSION, MCPTOON_MANAGED_MINIMUM_VERSION, MCPTOON_MARKER_BEGIN, MCPTOON_MARKER_END, MCPTOON_AGENT_INSTRUCTIONS, MCPTOON_CLAUDE_SKILL, DECODER2;
|
|
18919
19233
|
var init_mcptoon_managed = __esm({
|
|
18920
19234
|
"packages/adapters/dist/src/providers/mcptoon-managed.js"() {
|
|
18921
19235
|
"use strict";
|
|
18922
19236
|
init_src();
|
|
18923
19237
|
init_mcptoon_candidate();
|
|
18924
19238
|
MCPTOON_REVIEWED_INSTALL_VERSION = "0.7.10";
|
|
19239
|
+
MCPTOON_MANAGED_MINIMUM_VERSION = MCPTOON_REVIEWED_INSTALL_VERSION;
|
|
18925
19240
|
MCPTOON_MARKER_BEGIN = "TOKEN-HARNESS:MCPTOON:BEGIN";
|
|
18926
19241
|
MCPTOON_MARKER_END = "TOKEN-HARNESS:MCPTOON:END";
|
|
18927
19242
|
MCPTOON_AGENT_INSTRUCTIONS = `Use mcptoon as the CLI gateway for MCP tools when a task needs one.
|
|
@@ -18961,7 +19276,7 @@ function warning(code, subject, message) {
|
|
|
18961
19276
|
code,
|
|
18962
19277
|
subject,
|
|
18963
19278
|
message,
|
|
18964
|
-
remediation: "
|
|
19279
|
+
remediation: "Update the provider or restore the CLI capability this managed integration requires, then refresh Token Harness."
|
|
18965
19280
|
});
|
|
18966
19281
|
}
|
|
18967
19282
|
function unavailableMetrics(provider) {
|
|
@@ -18976,53 +19291,79 @@ function unavailableMetrics(provider) {
|
|
|
18976
19291
|
};
|
|
18977
19292
|
}
|
|
18978
19293
|
async function mcptoonDetection(context) {
|
|
18979
|
-
const observation = await
|
|
19294
|
+
const observation = await observeMcptoonManagedRuntime(context);
|
|
18980
19295
|
const configuredHarnesses = [];
|
|
18981
|
-
if (observation.
|
|
19296
|
+
if (observation.ready) {
|
|
18982
19297
|
for (const harness of [CLAUDE5, CODEX3]) {
|
|
18983
19298
|
const verification = await verifyMcptoonManagedActivation(context, harness);
|
|
18984
19299
|
if (verification.state === "verified")
|
|
18985
19300
|
configuredHarnesses.push(harness);
|
|
18986
19301
|
}
|
|
18987
19302
|
}
|
|
18988
|
-
const
|
|
18989
|
-
|
|
18990
|
-
|
|
19303
|
+
const pipx = observation.absent ? await context.runner.run({
|
|
19304
|
+
executable: "pipx",
|
|
19305
|
+
args: ["--version"],
|
|
19306
|
+
cwd: context.projectRoot,
|
|
19307
|
+
timeoutMs: 2e4
|
|
19308
|
+
}) : null;
|
|
19309
|
+
const canInstall = observation.absent && pipx !== null && pipx.failure === null && pipx.exitCode === 0;
|
|
19310
|
+
const warnings = observation.absent && !canInstall ? [
|
|
19311
|
+
diagnostic({
|
|
19312
|
+
severity: "warning",
|
|
19313
|
+
code: "mcptoon-pipx-unavailable",
|
|
19314
|
+
subject: "mcptoon",
|
|
19315
|
+
message: "mcptoon is not installed and pipx is not available in this terminal",
|
|
19316
|
+
remediation: "Install pipx or make it available on PATH, then refresh. Token Harness will use it to install the reviewed mcptoon build."
|
|
19317
|
+
})
|
|
19318
|
+
] : !observation.absent && !observation.ready ? [warning("mcptoon-provider-capability-unavailable", "mcptoon", observation.detail)] : [];
|
|
18991
19319
|
return {
|
|
18992
19320
|
providerId: MCPTOON,
|
|
18993
|
-
state: observation.
|
|
19321
|
+
state: observation.absent ? "absent" : configuredHarnesses.length > 0 ? "configured" : "installed",
|
|
18994
19322
|
version: observation.version,
|
|
18995
19323
|
executable: observation.executable,
|
|
18996
|
-
installationChannel: observation.
|
|
19324
|
+
installationChannel: observation.absent ? "pipx" : null,
|
|
18997
19325
|
versionVerdict: versionVerdict(observation.version, MCPTOON_REVIEWED_BENCHMARK_VERSION),
|
|
18998
19326
|
configuredHarnesses,
|
|
18999
19327
|
unmanagedHarnessesConfigured: [],
|
|
19000
19328
|
supportsUnmanagedHarnesses: false,
|
|
19001
19329
|
managedByTokenHarness: false,
|
|
19002
|
-
assignableHarnesses: observation.
|
|
19330
|
+
assignableHarnesses: observation.ready || canInstall ? [CLAUDE5, CODEX3] : [],
|
|
19003
19331
|
evidence: [],
|
|
19004
19332
|
warnings
|
|
19005
19333
|
};
|
|
19006
19334
|
}
|
|
19007
19335
|
async function gitnexusDetection(context) {
|
|
19008
|
-
const observation = await
|
|
19009
|
-
const verification = observation.
|
|
19336
|
+
const observation = await observeGitNexusManagedRuntime(context);
|
|
19337
|
+
const verification = observation.ready ? await verifyGitNexusManagedMcpActivation(context, CLAUDE5) : null;
|
|
19010
19338
|
const configuredHarnesses = verification?.state === "verified" ? [CLAUDE5] : [];
|
|
19011
|
-
const
|
|
19012
|
-
|
|
19013
|
-
|
|
19339
|
+
const npm = observation.absent ? await context.runner.run({
|
|
19340
|
+
executable: "npm",
|
|
19341
|
+
args: ["--version"],
|
|
19342
|
+
cwd: context.projectRoot,
|
|
19343
|
+
timeoutMs: 2e4
|
|
19344
|
+
}) : null;
|
|
19345
|
+
const canInstall = observation.absent && npm !== null && npm.failure === null && npm.exitCode === 0;
|
|
19346
|
+
const warnings = observation.absent && !canInstall ? [
|
|
19347
|
+
diagnostic({
|
|
19348
|
+
severity: "warning",
|
|
19349
|
+
code: "gitnexus-npm-unavailable",
|
|
19350
|
+
subject: "gitnexus",
|
|
19351
|
+
message: "GitNexus is not installed and npm is not available in this terminal",
|
|
19352
|
+
remediation: "Make npm available on PATH, then refresh. Token Harness can install the reviewed GitNexus build after explicit approval."
|
|
19353
|
+
})
|
|
19354
|
+
] : !observation.absent && !observation.ready ? [warning("gitnexus-provider-capability-unavailable", "gitnexus", observation.detail)] : [];
|
|
19014
19355
|
return {
|
|
19015
19356
|
providerId: GITNEXUS,
|
|
19016
|
-
state: observation.
|
|
19357
|
+
state: observation.absent ? "absent" : configuredHarnesses.length > 0 ? "configured" : "installed",
|
|
19017
19358
|
version: observation.version,
|
|
19018
19359
|
executable: observation.executable,
|
|
19019
|
-
installationChannel: observation.
|
|
19360
|
+
installationChannel: observation.absent ? "npm" : null,
|
|
19020
19361
|
versionVerdict: versionVerdict(observation.version, GITNEXUS_REVIEWED_BENCHMARK_VERSION),
|
|
19021
19362
|
configuredHarnesses,
|
|
19022
19363
|
unmanagedHarnessesConfigured: [],
|
|
19023
19364
|
supportsUnmanagedHarnesses: false,
|
|
19024
19365
|
managedByTokenHarness: false,
|
|
19025
|
-
assignableHarnesses: observation.
|
|
19366
|
+
assignableHarnesses: observation.ready || canInstall ? [CLAUDE5] : [],
|
|
19026
19367
|
evidence: [],
|
|
19027
19368
|
warnings
|
|
19028
19369
|
};
|
|
@@ -19322,12 +19663,15 @@ function directoryAction2(harness, path) {
|
|
|
19322
19663
|
path
|
|
19323
19664
|
};
|
|
19324
19665
|
}
|
|
19325
|
-
async function
|
|
19666
|
+
async function headroomManagedMcpRuntime(context) {
|
|
19326
19667
|
const observation = await observeHeadroomCandidate(context);
|
|
19327
|
-
|
|
19668
|
+
const compatible = observation.version !== null && headroomVersionAtLeast(observation.version, HEADROOM_REVIEWED_MCP_VERSION);
|
|
19669
|
+
if (!compatible) {
|
|
19328
19670
|
return {
|
|
19329
19671
|
ok: false,
|
|
19330
|
-
|
|
19672
|
+
version: observation.version,
|
|
19673
|
+
executable: observation.executable,
|
|
19674
|
+
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
19675
|
};
|
|
19332
19676
|
}
|
|
19333
19677
|
const help = await context.runner.run({
|
|
@@ -19339,12 +19683,40 @@ async function reviewedMcpCliAvailable(context) {
|
|
|
19339
19683
|
if (help.failure !== null || help.exitCode !== 0) {
|
|
19340
19684
|
return {
|
|
19341
19685
|
ok: false,
|
|
19342
|
-
|
|
19686
|
+
version: observation.version,
|
|
19687
|
+
executable: observation.executable,
|
|
19688
|
+
detail: `Headroom ${observation.version} is installed but its MCP server command is unavailable`
|
|
19343
19689
|
};
|
|
19344
19690
|
}
|
|
19345
19691
|
return {
|
|
19346
19692
|
ok: true,
|
|
19347
|
-
|
|
19693
|
+
version: observation.version,
|
|
19694
|
+
executable: observation.executable,
|
|
19695
|
+
detail: `Headroom ${observation.version} exposes the local MCP server required by the managed integration`
|
|
19696
|
+
};
|
|
19697
|
+
}
|
|
19698
|
+
function headroomInstallAction() {
|
|
19699
|
+
return {
|
|
19700
|
+
kind: "package-manager-install",
|
|
19701
|
+
id: `headroom:install:${HEADROOM_REVIEWED_MCP_VERSION}`,
|
|
19702
|
+
riskClass: "delegated",
|
|
19703
|
+
requiresNetwork: true,
|
|
19704
|
+
requiresElevation: false,
|
|
19705
|
+
affectedPaths: [],
|
|
19706
|
+
affectedProcesses: ["uv"],
|
|
19707
|
+
preconditions: [
|
|
19708
|
+
"uv remains runnable",
|
|
19709
|
+
`the reviewed Headroom ${HEADROOM_REVIEWED_MCP_VERSION} MCP package remains installable`
|
|
19710
|
+
],
|
|
19711
|
+
postconditions: [
|
|
19712
|
+
`Headroom ${HEADROOM_REVIEWED_MCP_VERSION} is installed with the MCP extra`,
|
|
19713
|
+
"headroom mcp serve --help succeeds"
|
|
19714
|
+
],
|
|
19715
|
+
rollbackData: "package-inventory",
|
|
19716
|
+
explanation: `Install reviewed Headroom ${HEADROOM_REVIEWED_MCP_VERSION} with its MCP extra through uv`,
|
|
19717
|
+
packageManager: "uv",
|
|
19718
|
+
packageName: "headroom-ai[mcp]",
|
|
19719
|
+
version: HEADROOM_REVIEWED_MCP_VERSION
|
|
19348
19720
|
};
|
|
19349
19721
|
}
|
|
19350
19722
|
function prerequisite(harness, detail2) {
|
|
@@ -19358,7 +19730,7 @@ function prerequisite(harness, detail2) {
|
|
|
19358
19730
|
code: "headroom-managed-mcp-prerequisite",
|
|
19359
19731
|
subject: harness,
|
|
19360
19732
|
message: detail2,
|
|
19361
|
-
remediation: `Install
|
|
19733
|
+
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
19734
|
})
|
|
19363
19735
|
]
|
|
19364
19736
|
};
|
|
@@ -19612,9 +19984,9 @@ async function planCodex(context, harness) {
|
|
|
19612
19984
|
affectedPaths: [target],
|
|
19613
19985
|
affectedProcesses: [],
|
|
19614
19986
|
preconditions: ["No Headroom MCP table or Token Harness Headroom marker block exists"],
|
|
19615
|
-
postconditions: ["Codex config contains exactly one
|
|
19987
|
+
postconditions: ["Codex config contains exactly one Token Harness Headroom MCP server block"],
|
|
19616
19988
|
rollbackData: "file-snapshot",
|
|
19617
|
-
explanation: "Register the installed
|
|
19989
|
+
explanation: "Register the installed Headroom CLI as a Codex MCP server",
|
|
19618
19990
|
path: target,
|
|
19619
19991
|
markerBegin: HEADROOM_CODEX_MARKER_BEGIN,
|
|
19620
19992
|
markerEnd: HEADROOM_CODEX_MARKER_END,
|
|
@@ -19643,10 +20015,25 @@ async function planHeadroomManagedMcpActivation(context, harness) {
|
|
|
19643
20015
|
]
|
|
19644
20016
|
};
|
|
19645
20017
|
}
|
|
19646
|
-
const cli = await
|
|
19647
|
-
|
|
19648
|
-
|
|
19649
|
-
|
|
20018
|
+
const cli = await headroomManagedMcpRuntime(context);
|
|
20019
|
+
const installActions = [];
|
|
20020
|
+
if (!cli.ok) {
|
|
20021
|
+
const observation = await observeHeadroomCandidate(context);
|
|
20022
|
+
if (observation.state !== "absent")
|
|
20023
|
+
return prerequisite(harness, cli.detail);
|
|
20024
|
+
const uv = await context.runner.run({
|
|
20025
|
+
executable: "uv",
|
|
20026
|
+
args: ["--version"],
|
|
20027
|
+
cwd: context.projectRoot,
|
|
20028
|
+
timeoutMs: 2e4
|
|
20029
|
+
});
|
|
20030
|
+
if (uv.failure !== null || uv.exitCode !== 0) {
|
|
20031
|
+
return prerequisite(harness, "Headroom is absent and uv is not available in this terminal. Install uv or make it available on PATH; Token Harness will not bootstrap Python or uv itself.");
|
|
20032
|
+
}
|
|
20033
|
+
installActions.push(headroomInstallAction());
|
|
20034
|
+
}
|
|
20035
|
+
const activation = harness === "claude" ? await planClaude(context, harness) : await planCodex(context, harness);
|
|
20036
|
+
return { ...activation, actions: [...installActions, ...activation.actions] };
|
|
19650
20037
|
}
|
|
19651
20038
|
function headroomOwnedArtifact(context, harness) {
|
|
19652
20039
|
if (harness === "claude") {
|
|
@@ -19670,7 +20057,7 @@ function headroomOwnedArtifact(context, harness) {
|
|
|
19670
20057
|
return null;
|
|
19671
20058
|
}
|
|
19672
20059
|
async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
19673
|
-
const cli = await
|
|
20060
|
+
const cli = await headroomManagedMcpRuntime(context);
|
|
19674
20061
|
if (!cli.ok)
|
|
19675
20062
|
return { state: "candidate-unavailable", target: null, detail: cli.detail };
|
|
19676
20063
|
if (harness === "claude") {
|
|
@@ -19693,13 +20080,13 @@ async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
|
19693
20080
|
return {
|
|
19694
20081
|
state: "degraded",
|
|
19695
20082
|
target,
|
|
19696
|
-
detail: "Headroom MCP entry differs from the
|
|
20083
|
+
detail: "Headroom MCP entry differs from the Token Harness managed command"
|
|
19697
20084
|
};
|
|
19698
20085
|
}
|
|
19699
20086
|
return {
|
|
19700
20087
|
state: "verified",
|
|
19701
20088
|
target,
|
|
19702
|
-
detail: `${cli.detail}; Claude registration matches the
|
|
20089
|
+
detail: `${cli.detail}; Claude registration matches the managed entry`
|
|
19703
20090
|
};
|
|
19704
20091
|
}
|
|
19705
20092
|
if (harness === "codex") {
|
|
@@ -19719,12 +20106,12 @@ async function verifyHeadroomManagedMcpActivation(context, harness) {
|
|
|
19719
20106
|
return {
|
|
19720
20107
|
state: "not-configured",
|
|
19721
20108
|
target,
|
|
19722
|
-
detail: "
|
|
20109
|
+
detail: "Token Harness Headroom Codex MCP block is absent"
|
|
19723
20110
|
};
|
|
19724
20111
|
return {
|
|
19725
20112
|
state: "verified",
|
|
19726
20113
|
target,
|
|
19727
|
-
detail: `${cli.detail}; Codex registration matches the
|
|
20114
|
+
detail: `${cli.detail}; Codex registration matches the managed owned block`
|
|
19728
20115
|
};
|
|
19729
20116
|
}
|
|
19730
20117
|
return {
|
|
@@ -19760,30 +20147,38 @@ function manualInstallWarning() {
|
|
|
19760
20147
|
severity: "warning",
|
|
19761
20148
|
code: "headroom-uv-install-prerequisite",
|
|
19762
20149
|
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,
|
|
20150
|
+
message: `Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer is not installed. Token Harness can manage its MCP configuration after a compatible CLI is present.`,
|
|
20151
|
+
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
20152
|
});
|
|
19766
20153
|
}
|
|
19767
20154
|
async function detect8(context) {
|
|
19768
20155
|
const observation = await observeHeadroomCandidate(context);
|
|
20156
|
+
const runtime = await headroomManagedMcpRuntime(context);
|
|
19769
20157
|
const configuredHarnesses = [];
|
|
19770
|
-
if (
|
|
20158
|
+
if (runtime.ok) {
|
|
19771
20159
|
for (const harness of [CLAUDE7, CODEX4]) {
|
|
19772
20160
|
const verification = await verifyHeadroomManagedMcpActivation(context, harness);
|
|
19773
20161
|
if (verification.state === "verified")
|
|
19774
20162
|
configuredHarnesses.push(harness);
|
|
19775
20163
|
}
|
|
19776
20164
|
}
|
|
20165
|
+
const uv = observation.state === "absent" ? await context.runner.run({
|
|
20166
|
+
executable: "uv",
|
|
20167
|
+
args: ["--version"],
|
|
20168
|
+
cwd: context.projectRoot,
|
|
20169
|
+
timeoutMs: 2e4
|
|
20170
|
+
}) : null;
|
|
20171
|
+
const canInstall = observation.state === "absent" && uv !== null && uv.failure === null && uv.exitCode === 0;
|
|
19777
20172
|
const warnings = [];
|
|
19778
|
-
if (observation.state === "absent")
|
|
20173
|
+
if (observation.state === "absent" && !canInstall)
|
|
19779
20174
|
warnings.push(manualInstallWarning());
|
|
19780
|
-
if (observation.state
|
|
20175
|
+
else if (!runtime.ok && observation.state !== "absent") {
|
|
19781
20176
|
warnings.push(diagnostic({
|
|
19782
20177
|
severity: "warning",
|
|
19783
|
-
code: "headroom-provider-
|
|
20178
|
+
code: "headroom-provider-capability-unavailable",
|
|
19784
20179
|
subject: "headroom",
|
|
19785
|
-
message:
|
|
19786
|
-
remediation: `
|
|
20180
|
+
message: runtime.detail,
|
|
20181
|
+
remediation: `Update Headroom to ${HEADROOM_REVIEWED_MCP_VERSION} or newer with the MCP extra, then refresh Token Harness.`
|
|
19787
20182
|
}));
|
|
19788
20183
|
}
|
|
19789
20184
|
return {
|
|
@@ -19800,7 +20195,7 @@ async function detect8(context) {
|
|
|
19800
20195
|
unmanagedHarnessesConfigured: [],
|
|
19801
20196
|
supportsUnmanagedHarnesses: false,
|
|
19802
20197
|
managedByTokenHarness: false,
|
|
19803
|
-
assignableHarnesses:
|
|
20198
|
+
assignableHarnesses: runtime.ok || canInstall ? [CLAUDE7, CODEX4] : [],
|
|
19804
20199
|
evidence: [],
|
|
19805
20200
|
warnings
|
|
19806
20201
|
};
|
|
@@ -19873,7 +20268,7 @@ async function verify8(context) {
|
|
|
19873
20268
|
summary: result6.detail,
|
|
19874
20269
|
achievedTier: result6.state === "verified" ? "config-only" : result6.state === "candidate-unavailable" ? null : "presence",
|
|
19875
20270
|
evidence: [],
|
|
19876
|
-
remediation: result6.state === "candidate-unavailable" ? `Install
|
|
20271
|
+
remediation: result6.state === "candidate-unavailable" ? `Install Headroom ${HEADROOM_REVIEWED_MCP_VERSION} or newer with its MCP extra first.` : null
|
|
19877
20272
|
});
|
|
19878
20273
|
}
|
|
19879
20274
|
return {
|
|
@@ -20046,26 +20441,25 @@ var init_mcptoon_provider = __esm({
|
|
|
20046
20441
|
|
|
20047
20442
|
// packages/adapters/dist/src/providers/version-compatibility.js
|
|
20048
20443
|
function reviewedProviderPackageMaximum(provider) {
|
|
20049
|
-
return
|
|
20444
|
+
return PACKAGE_UPDATE_BASELINES.get(provider)?.maximum ?? null;
|
|
20050
20445
|
}
|
|
20051
20446
|
function admitProviderPackageUpdate(provider, targetVersion) {
|
|
20052
|
-
const range =
|
|
20447
|
+
const range = PACKAGE_UPDATE_BASELINES.get(provider);
|
|
20053
20448
|
if (range === void 0) {
|
|
20054
20449
|
return { state: "blocked", reason: `no package-update policy exists for ${provider}` };
|
|
20055
20450
|
}
|
|
20056
20451
|
const target = parseSemanticVersion(targetVersion);
|
|
20057
20452
|
const minimum = parseSemanticVersion(range.minimum);
|
|
20058
|
-
|
|
20059
|
-
if (target === null || minimum === null || maximum === null) {
|
|
20453
|
+
if (target === null || minimum === null) {
|
|
20060
20454
|
return {
|
|
20061
20455
|
state: "blocked",
|
|
20062
|
-
reason: `${targetVersion} is not a parseable
|
|
20456
|
+
reason: `${targetVersion} is not a parseable provider release`
|
|
20063
20457
|
};
|
|
20064
20458
|
}
|
|
20065
|
-
if (compareVersions(target, minimum) < 0
|
|
20459
|
+
if (compareVersions(target, minimum) < 0) {
|
|
20066
20460
|
return {
|
|
20067
20461
|
state: "blocked",
|
|
20068
|
-
reason: `${targetVersion}
|
|
20462
|
+
reason: `${targetVersion} predates the supported provider update floor ${range.minimum}`
|
|
20069
20463
|
};
|
|
20070
20464
|
}
|
|
20071
20465
|
return { state: "admitted" };
|
|
@@ -20078,10 +20472,15 @@ function harnessTrimContractMatchesInstalledVersion(detection) {
|
|
|
20078
20472
|
const capabilityDrift = detection.warnings.some((warning2) => warning2.code === "provider-capabilities-drift");
|
|
20079
20473
|
return declaredByInstalledBuild && !capabilityDrift;
|
|
20080
20474
|
}
|
|
20475
|
+
function runtimeManagedSurfaceStillAvailable(detection) {
|
|
20476
|
+
if (detection.state === "broken" || detection.assignableHarnesses.length === 0)
|
|
20477
|
+
return false;
|
|
20478
|
+
return !detection.warnings.some((warning2) => /capabilit/i.test(warning2.code) && /(unavailable|drift|mismatch|unsupported)/i.test(warning2.code));
|
|
20479
|
+
}
|
|
20081
20480
|
function applyProviderVersionCompatibility(detection) {
|
|
20082
20481
|
if (detection.versionVerdict !== "unknown-newer" || detection.version === null)
|
|
20083
20482
|
return detection;
|
|
20084
|
-
const compatible = detection.providerId ===
|
|
20483
|
+
const compatible = detection.providerId === HARNESSTRIM3 ? harnessTrimContractMatchesInstalledVersion(detection) : [RTK3, MCPTOON2, GITNEXUS2, HEADROOM3].includes(detection.providerId) && runtimeManagedSurfaceStillAvailable(detection);
|
|
20085
20484
|
if (!compatible)
|
|
20086
20485
|
return detection;
|
|
20087
20486
|
return {
|
|
@@ -20096,17 +20495,40 @@ function withProviderVersionCompatibility(adapter) {
|
|
|
20096
20495
|
detect: async (context) => applyProviderVersionCompatibility(await adapter.detect(context))
|
|
20097
20496
|
};
|
|
20098
20497
|
}
|
|
20099
|
-
var RTK3, HARNESSTRIM3,
|
|
20498
|
+
var RTK3, HARNESSTRIM3, MCPTOON2, GITNEXUS2, HEADROOM3, PACKAGE_UPDATE_BASELINES;
|
|
20100
20499
|
var init_version_compatibility = __esm({
|
|
20101
20500
|
"packages/adapters/dist/src/providers/version-compatibility.js"() {
|
|
20102
20501
|
"use strict";
|
|
20103
20502
|
init_src();
|
|
20503
|
+
init_gitnexus_candidate();
|
|
20504
|
+
init_headroom_candidate();
|
|
20505
|
+
init_mcptoon_candidate();
|
|
20104
20506
|
RTK3 = providerId("rtk");
|
|
20105
20507
|
HARNESSTRIM3 = providerId("harnesstrim");
|
|
20106
|
-
|
|
20107
|
-
|
|
20508
|
+
MCPTOON2 = providerId("mcptoon");
|
|
20509
|
+
GITNEXUS2 = providerId("gitnexus");
|
|
20510
|
+
HEADROOM3 = providerId("headroom");
|
|
20511
|
+
PACKAGE_UPDATE_BASELINES = /* @__PURE__ */ new Map([
|
|
20108
20512
|
[RTK3, { minimum: "0.44.0", maximum: "0.49.0" }],
|
|
20109
|
-
[HARNESSTRIM3, { minimum: "0.0.5", maximum: "0.3.0" }]
|
|
20513
|
+
[HARNESSTRIM3, { minimum: "0.0.5", maximum: "0.3.0" }],
|
|
20514
|
+
[
|
|
20515
|
+
MCPTOON2,
|
|
20516
|
+
{ minimum: MCPTOON_REVIEWED_BENCHMARK_VERSION, maximum: MCPTOON_REVIEWED_BENCHMARK_VERSION }
|
|
20517
|
+
],
|
|
20518
|
+
[
|
|
20519
|
+
GITNEXUS2,
|
|
20520
|
+
{
|
|
20521
|
+
minimum: GITNEXUS_REVIEWED_BENCHMARK_VERSION,
|
|
20522
|
+
maximum: GITNEXUS_REVIEWED_BENCHMARK_VERSION
|
|
20523
|
+
}
|
|
20524
|
+
],
|
|
20525
|
+
[
|
|
20526
|
+
HEADROOM3,
|
|
20527
|
+
{
|
|
20528
|
+
minimum: HEADROOM_REVIEWED_BENCHMARK_VERSION,
|
|
20529
|
+
maximum: HEADROOM_REVIEWED_BENCHMARK_VERSION
|
|
20530
|
+
}
|
|
20531
|
+
]
|
|
20110
20532
|
]);
|
|
20111
20533
|
}
|
|
20112
20534
|
});
|
|
@@ -20303,9 +20725,9 @@ var init_providers = __esm({
|
|
|
20303
20725
|
PROVIDER_ADAPTERS = [
|
|
20304
20726
|
rtkAdapter2,
|
|
20305
20727
|
cliHarnessTrimAdapter,
|
|
20306
|
-
mcptoonManagedProviderAdapter,
|
|
20307
|
-
gitnexusManagedProviderAdapter,
|
|
20308
|
-
headroomManagedProviderAdapter
|
|
20728
|
+
withProviderVersionCompatibility(mcptoonManagedProviderAdapter),
|
|
20729
|
+
withProviderVersionCompatibility(gitnexusManagedProviderAdapter),
|
|
20730
|
+
withProviderVersionCompatibility(headroomManagedProviderAdapter)
|
|
20309
20731
|
];
|
|
20310
20732
|
}
|
|
20311
20733
|
});
|
|
@@ -21224,6 +21646,33 @@ var init_candidate_campaign_surface = __esm({
|
|
|
21224
21646
|
}
|
|
21225
21647
|
});
|
|
21226
21648
|
|
|
21649
|
+
// apps/cli/dist/src/commands/snapshot-safety.js
|
|
21650
|
+
async function repositoryRootForBackupSafety(context) {
|
|
21651
|
+
const adapters = context.adapters;
|
|
21652
|
+
if (adapters === null)
|
|
21653
|
+
return context.projectRoot;
|
|
21654
|
+
const fs = adapters.fs;
|
|
21655
|
+
let current = context.projectRoot;
|
|
21656
|
+
while (true) {
|
|
21657
|
+
for (const marker of [".git", ".hg", ".svn"]) {
|
|
21658
|
+
if (await fs.stat(fs.join(current, marker)) !== null)
|
|
21659
|
+
return current;
|
|
21660
|
+
}
|
|
21661
|
+
if (context.home !== null && fs.isInside(current, context.home) && fs.isInside(context.home, current)) {
|
|
21662
|
+
return null;
|
|
21663
|
+
}
|
|
21664
|
+
const parent = fs.dirname(current);
|
|
21665
|
+
if (parent === current)
|
|
21666
|
+
return null;
|
|
21667
|
+
current = parent;
|
|
21668
|
+
}
|
|
21669
|
+
}
|
|
21670
|
+
var init_snapshot_safety = __esm({
|
|
21671
|
+
"apps/cli/dist/src/commands/snapshot-safety.js"() {
|
|
21672
|
+
"use strict";
|
|
21673
|
+
}
|
|
21674
|
+
});
|
|
21675
|
+
|
|
21227
21676
|
// apps/cli/dist/src/commands/gitnexus-candidate-lifecycle.js
|
|
21228
21677
|
function emptyReport(outcome2, requestedStateVerified = false) {
|
|
21229
21678
|
return {
|
|
@@ -21285,7 +21734,7 @@ function selectorProblem(context, command) {
|
|
|
21285
21734
|
}
|
|
21286
21735
|
return null;
|
|
21287
21736
|
}
|
|
21288
|
-
function stores(context, id) {
|
|
21737
|
+
async function stores(context, id) {
|
|
21289
21738
|
if (context.adapters === null || context.stateRoot === null)
|
|
21290
21739
|
return null;
|
|
21291
21740
|
const fs = context.adapters.fs;
|
|
@@ -21293,7 +21742,7 @@ function stores(context, id) {
|
|
|
21293
21742
|
fs,
|
|
21294
21743
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
21295
21744
|
transactionId: id,
|
|
21296
|
-
projectRoot: context
|
|
21745
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
21297
21746
|
now: context.now
|
|
21298
21747
|
});
|
|
21299
21748
|
if (!creation.ok)
|
|
@@ -21486,7 +21935,7 @@ async function runGitNexusCandidateApply(context) {
|
|
|
21486
21935
|
return finish("apply", EXIT_CODES["confirmation-required"], emptyReport("confirmation-required"), diagnostics);
|
|
21487
21936
|
}
|
|
21488
21937
|
const id = transactionId("gitnexus-activate-claude", context);
|
|
21489
|
-
const built = stores(context, id);
|
|
21938
|
+
const built = await stores(context, id);
|
|
21490
21939
|
if (built === null || !("snapshots" in built)) {
|
|
21491
21940
|
diagnostics.push(...built?.failure ?? []);
|
|
21492
21941
|
return finish("apply", EXIT_CODES["unsupported-environment"], emptyReport("rejected"), diagnostics);
|
|
@@ -21592,7 +22041,7 @@ async function runGitNexusCandidateUninstall(context) {
|
|
|
21592
22041
|
return finish("uninstall", EXIT_CODES["confirmation-required"], emptyReport("confirmation-required"), diagnostics);
|
|
21593
22042
|
}
|
|
21594
22043
|
const id = transactionId("gitnexus-deactivate-claude", context);
|
|
21595
|
-
const built = stores(context, id);
|
|
22044
|
+
const built = await stores(context, id);
|
|
21596
22045
|
if (built === null || !("snapshots" in built)) {
|
|
21597
22046
|
diagnostics.push(...built?.failure ?? []);
|
|
21598
22047
|
return finish("uninstall", EXIT_CODES["unsupported-environment"], emptyReport("rejected"), diagnostics);
|
|
@@ -21632,6 +22081,7 @@ var init_gitnexus_candidate_lifecycle = __esm({
|
|
|
21632
22081
|
init_src3();
|
|
21633
22082
|
init_src();
|
|
21634
22083
|
init_candidate_campaign_surface();
|
|
22084
|
+
init_snapshot_safety();
|
|
21635
22085
|
ACTIVATION_ACTION_ID = "gitnexus:claude:mcp-server";
|
|
21636
22086
|
REMOVAL_ACTION_ID = "gitnexus:claude:mcp-server:remove";
|
|
21637
22087
|
REVIEWED_VALUE_DIGEST = jsonValueDigest(GITNEXUS_MCP_SERVER);
|
|
@@ -21709,7 +22159,7 @@ function selectorProblem2(context, command) {
|
|
|
21709
22159
|
}
|
|
21710
22160
|
return null;
|
|
21711
22161
|
}
|
|
21712
|
-
function stores2(context, transactionId2) {
|
|
22162
|
+
async function stores2(context, transactionId2) {
|
|
21713
22163
|
if (context.adapters === null || context.stateRoot === null)
|
|
21714
22164
|
return null;
|
|
21715
22165
|
const fs = context.adapters.fs;
|
|
@@ -21717,7 +22167,7 @@ function stores2(context, transactionId2) {
|
|
|
21717
22167
|
fs,
|
|
21718
22168
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
21719
22169
|
transactionId: transactionId2,
|
|
21720
|
-
projectRoot: context
|
|
22170
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
21721
22171
|
now: context.now
|
|
21722
22172
|
});
|
|
21723
22173
|
if (!creation.ok)
|
|
@@ -21808,7 +22258,7 @@ async function runCandidateApply(context) {
|
|
|
21808
22258
|
return finish2("apply", EXIT_CODES["confirmation-required"], emptyReport2("confirmation-required"), diagnostics);
|
|
21809
22259
|
}
|
|
21810
22260
|
const transactionId2 = candidateTransactionId(`mcptoon-activate-${harness}`, context);
|
|
21811
|
-
const built = stores2(context, transactionId2);
|
|
22261
|
+
const built = await stores2(context, transactionId2);
|
|
21812
22262
|
if (built === null || !("snapshots" in built)) {
|
|
21813
22263
|
diagnostics.push(...built?.failure ?? []);
|
|
21814
22264
|
return finish2("apply", EXIT_CODES["unsupported-environment"], emptyReport2("rejected"), diagnostics);
|
|
@@ -21953,7 +22403,7 @@ async function runCandidateUninstall(context) {
|
|
|
21953
22403
|
return finish2("uninstall", EXIT_CODES["confirmation-required"], emptyReport2("confirmation-required"), diagnostics);
|
|
21954
22404
|
}
|
|
21955
22405
|
const transactionId2 = candidateTransactionId(`mcptoon-deactivate-${harness}`, context);
|
|
21956
|
-
const built = stores2(context, transactionId2);
|
|
22406
|
+
const built = await stores2(context, transactionId2);
|
|
21957
22407
|
if (built === null || !("snapshots" in built)) {
|
|
21958
22408
|
diagnostics.push(...built?.failure ?? []);
|
|
21959
22409
|
return finish2("uninstall", EXIT_CODES["unsupported-environment"], emptyReport2("rejected"), diagnostics);
|
|
@@ -21998,6 +22448,7 @@ var init_mcptoon_candidate_lifecycle = __esm({
|
|
|
21998
22448
|
init_src3();
|
|
21999
22449
|
init_src();
|
|
22000
22450
|
init_candidate_campaign_surface();
|
|
22451
|
+
init_snapshot_safety();
|
|
22001
22452
|
}
|
|
22002
22453
|
});
|
|
22003
22454
|
|
|
@@ -24056,6 +24507,17 @@ async function computePlan(context) {
|
|
|
24056
24507
|
wsl: context.platform.isWsl
|
|
24057
24508
|
});
|
|
24058
24509
|
if (admission.state !== "admitted") {
|
|
24510
|
+
const dynamicallyAssignable = assignable.get(adapter.manifest.id)?.has(harness) === true;
|
|
24511
|
+
if (dynamicallyAssignable) {
|
|
24512
|
+
diagnostics.push(diagnostic({
|
|
24513
|
+
severity: "info",
|
|
24514
|
+
code: "managed-mutation-forward-compatible",
|
|
24515
|
+
subject: adapter.manifest.id,
|
|
24516
|
+
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.`,
|
|
24517
|
+
remediation: null
|
|
24518
|
+
}));
|
|
24519
|
+
continue;
|
|
24520
|
+
}
|
|
24059
24521
|
admitted = false;
|
|
24060
24522
|
blocked.push({
|
|
24061
24523
|
provider: adapter.manifest.id,
|
|
@@ -24224,7 +24686,7 @@ async function computePlan(context) {
|
|
|
24224
24686
|
severity: refusalIsTheOutcome ? "error" : "warning",
|
|
24225
24687
|
code: "managed-mutation-blocked",
|
|
24226
24688
|
message: `plan refuses managed mutation of ${entry.harness} by ${entry.provider}${entry.providerVersion !== null ? ` at ${entry.providerVersion}` : ""}: ${entry.missing}`,
|
|
24227
|
-
remediation: "
|
|
24689
|
+
remediation: "Restore the provider runtime capability required for this managed integration, or configure it by hand"
|
|
24228
24690
|
}));
|
|
24229
24691
|
}
|
|
24230
24692
|
for (const conflict of conflicts) {
|
|
@@ -24303,6 +24765,73 @@ var init_plan2 = __esm({
|
|
|
24303
24765
|
});
|
|
24304
24766
|
|
|
24305
24767
|
// apps/cli/dist/src/commands/apply.js
|
|
24768
|
+
async function verifyManagedIntegrationPostconditions(context, integrations) {
|
|
24769
|
+
if (integrations.length === 0)
|
|
24770
|
+
return [];
|
|
24771
|
+
if (context.adapters === null) {
|
|
24772
|
+
return [
|
|
24773
|
+
diagnostic({
|
|
24774
|
+
severity: "error",
|
|
24775
|
+
code: "managed-setup-postcondition-unavailable",
|
|
24776
|
+
message: "The managed integration could not be re-observed because platform adapters are unavailable",
|
|
24777
|
+
remediation: "Refresh the current setup before retrying"
|
|
24778
|
+
})
|
|
24779
|
+
];
|
|
24780
|
+
}
|
|
24781
|
+
const detectionContext = {
|
|
24782
|
+
fs: context.adapters.fs,
|
|
24783
|
+
runner: context.adapters.runner,
|
|
24784
|
+
facts: context.platform,
|
|
24785
|
+
paths: context.adapters.paths,
|
|
24786
|
+
projectRoot: context.projectRoot
|
|
24787
|
+
};
|
|
24788
|
+
const harnessConfigs = (await Promise.all(listHarnessAdapters().map(async (adapter) => (await adapter.inspect(detectionContext)).summaries))).flat();
|
|
24789
|
+
const providerContext4 = {
|
|
24790
|
+
...detectionContext,
|
|
24791
|
+
harnessConfigs,
|
|
24792
|
+
now: context.now,
|
|
24793
|
+
localDatabase: context.adapters.localDatabase,
|
|
24794
|
+
projectIdFor: context.adapters.projectIdFor
|
|
24795
|
+
};
|
|
24796
|
+
const adapters = new Map(listProviderAdapters().map((adapter) => [adapter.manifest.id, adapter]));
|
|
24797
|
+
const diagnostics = [];
|
|
24798
|
+
for (const integration of integrations) {
|
|
24799
|
+
const adapter = adapters.get(integration.providerId);
|
|
24800
|
+
if (adapter === void 0) {
|
|
24801
|
+
diagnostics.push(diagnostic({
|
|
24802
|
+
severity: "error",
|
|
24803
|
+
code: "managed-setup-postcondition-unavailable",
|
|
24804
|
+
subject: integration.providerId,
|
|
24805
|
+
message: `The provider adapter disappeared before ${integration.harnessId} setup could be verified`,
|
|
24806
|
+
remediation: "Refresh Token Harness and review a new setup preview"
|
|
24807
|
+
}));
|
|
24808
|
+
continue;
|
|
24809
|
+
}
|
|
24810
|
+
try {
|
|
24811
|
+
const detection = await adapter.detect(providerContext4);
|
|
24812
|
+
if (!detection.configuredHarnesses.some((harness) => harness === integration.harnessId)) {
|
|
24813
|
+
const runtimeProblem = detection.warnings.find((entry) => entry.severity === "error" || entry.severity === "warning");
|
|
24814
|
+
diagnostics.push(diagnostic({
|
|
24815
|
+
severity: "error",
|
|
24816
|
+
code: "managed-setup-postcondition-unmet",
|
|
24817
|
+
subject: integration.providerId,
|
|
24818
|
+
message: `${adapter.manifest.displayName} setup did not become active for ${integration.harnessId} after the approved actions` + (runtimeProblem === void 0 ? "" : `: ${runtimeProblem.message}`),
|
|
24819
|
+
path: detection.executable,
|
|
24820
|
+
remediation: runtimeProblem?.remediation ?? "Check that the newly installed provider executable is on PATH, then review a fresh setup preview"
|
|
24821
|
+
}));
|
|
24822
|
+
}
|
|
24823
|
+
} catch (error) {
|
|
24824
|
+
diagnostics.push(diagnostic({
|
|
24825
|
+
severity: "error",
|
|
24826
|
+
code: "managed-setup-postcondition-unavailable",
|
|
24827
|
+
subject: integration.providerId,
|
|
24828
|
+
message: `The provider could not be re-observed after setup: ${error instanceof Error ? error.message : String(error)}`,
|
|
24829
|
+
remediation: "Refresh and inspect the provider runtime before retrying"
|
|
24830
|
+
}));
|
|
24831
|
+
}
|
|
24832
|
+
}
|
|
24833
|
+
return diagnostics;
|
|
24834
|
+
}
|
|
24306
24835
|
function transactionIdFor(planId, at) {
|
|
24307
24836
|
const digest = digestText(`${planId} ${at}`);
|
|
24308
24837
|
return digest.slice(digest.indexOf(":") + 1, digest.indexOf(":") + 13);
|
|
@@ -24522,7 +25051,7 @@ async function runApply(context) {
|
|
|
24522
25051
|
fs,
|
|
24523
25052
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
24524
25053
|
transactionId: transactionId2,
|
|
24525
|
-
projectRoot: context
|
|
25054
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
24526
25055
|
now: context.now
|
|
24527
25056
|
});
|
|
24528
25057
|
if (!creation.ok) {
|
|
@@ -24552,7 +25081,8 @@ async function runApply(context) {
|
|
|
24552
25081
|
journal,
|
|
24553
25082
|
// RFC 0004 §Process policy: an installer reaches the machine through the runner or not at all.
|
|
24554
25083
|
runner: context.adapters.runner,
|
|
24555
|
-
now: context.now
|
|
25084
|
+
now: context.now,
|
|
25085
|
+
verifyPostconditions: async () => verifyManagedIntegrationPostconditions(context, computed.managedIntegrations)
|
|
24556
25086
|
});
|
|
24557
25087
|
diagnostics.push(...transaction.diagnostics);
|
|
24558
25088
|
const report = {
|
|
@@ -24587,8 +25117,10 @@ var init_apply = __esm({
|
|
|
24587
25117
|
"apps/cli/dist/src/commands/apply.js"() {
|
|
24588
25118
|
"use strict";
|
|
24589
25119
|
init_src();
|
|
25120
|
+
init_src3();
|
|
24590
25121
|
init_candidate_lifecycle();
|
|
24591
25122
|
init_plan2();
|
|
25123
|
+
init_snapshot_safety();
|
|
24592
25124
|
PLANS_DIRECTORY = "plans";
|
|
24593
25125
|
}
|
|
24594
25126
|
});
|
|
@@ -26864,7 +27396,7 @@ async function runDoctor(context) {
|
|
|
26864
27396
|
]
|
|
26865
27397
|
};
|
|
26866
27398
|
});
|
|
26867
|
-
const problemCount = harnesses.filter(isBroken).length + providers.filter(isBroken).length
|
|
27399
|
+
const problemCount = harnesses.filter(isBroken).length + providers.filter(isBroken).length;
|
|
26868
27400
|
const rows = context.compatibilityRows ?? COMPATIBILITY_ROWS;
|
|
26869
27401
|
const providersWithCoverage = providersWithPathDiagnostics.map((detection) => {
|
|
26870
27402
|
if (detection.state !== "configured" || detection.configuredHarnesses.length === 0) {
|
|
@@ -26880,14 +27412,14 @@ async function runDoctor(context) {
|
|
|
26880
27412
|
os: context.platform.os,
|
|
26881
27413
|
wsl: context.platform.isWsl
|
|
26882
27414
|
});
|
|
26883
|
-
if (admission.state === "admitted")
|
|
27415
|
+
if (admission.state === "admitted" || detection.assignableHarnesses.includes(harness))
|
|
26884
27416
|
return [];
|
|
26885
27417
|
return [
|
|
26886
27418
|
diagnostic({
|
|
26887
27419
|
severity: "warning",
|
|
26888
|
-
code: "
|
|
26889
|
-
message:
|
|
26890
|
-
remediation: "
|
|
27420
|
+
code: "provider-surface-not-assignable",
|
|
27421
|
+
message: `${detection.providerId} is configured on ${harness}, but the currently installed provider build does not advertise that harness as an automatic setup target`,
|
|
27422
|
+
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
27423
|
})
|
|
26892
27424
|
];
|
|
26893
27425
|
});
|
|
@@ -27337,7 +27869,7 @@ function finish4(exitCode, command, data, diagnostics) {
|
|
|
27337
27869
|
diagnostics
|
|
27338
27870
|
});
|
|
27339
27871
|
}
|
|
27340
|
-
function stores3(context, transactionId2) {
|
|
27872
|
+
async function stores3(context, transactionId2) {
|
|
27341
27873
|
if (context.adapters === null || context.stateRoot === null)
|
|
27342
27874
|
return null;
|
|
27343
27875
|
const fs = context.adapters.fs;
|
|
@@ -27345,7 +27877,7 @@ function stores3(context, transactionId2) {
|
|
|
27345
27877
|
fs,
|
|
27346
27878
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
27347
27879
|
transactionId: transactionId2,
|
|
27348
|
-
projectRoot: context
|
|
27880
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
27349
27881
|
now: context.now
|
|
27350
27882
|
});
|
|
27351
27883
|
if (!creation.ok)
|
|
@@ -27420,7 +27952,7 @@ async function runRollback(context) {
|
|
|
27420
27952
|
}));
|
|
27421
27953
|
return finish4(EXIT_CODES["confirmation-required"], "rollback", empty("confirmation-required"), diagnostics);
|
|
27422
27954
|
}
|
|
27423
|
-
const built = stores3(context, target.transactionId);
|
|
27955
|
+
const built = await stores3(context, target.transactionId);
|
|
27424
27956
|
if (built === null || built.store === void 0) {
|
|
27425
27957
|
diagnostics.push(...built?.failure ?? []);
|
|
27426
27958
|
return finish4(EXIT_CODES["unsupported-environment"], "rollback", empty("rejected"), diagnostics);
|
|
@@ -27548,7 +28080,7 @@ async function runUninstall(context) {
|
|
|
27548
28080
|
}
|
|
27549
28081
|
const fs = context.adapters.fs;
|
|
27550
28082
|
const transactionId2 = `uninstall-${context.now().replace(/[^0-9]/g, "").slice(0, 14)}`;
|
|
27551
|
-
const built = stores3(context, transactionId2);
|
|
28083
|
+
const built = await stores3(context, transactionId2);
|
|
27552
28084
|
if (built === null || built.store === void 0) {
|
|
27553
28085
|
diagnostics.push(...built?.failure ?? []);
|
|
27554
28086
|
return finish4(EXIT_CODES["unsupported-environment"], "uninstall", empty("rejected"), diagnostics);
|
|
@@ -27584,6 +28116,7 @@ var init_rollback = __esm({
|
|
|
27584
28116
|
init_src();
|
|
27585
28117
|
init_candidate_lifecycle();
|
|
27586
28118
|
init_plan2();
|
|
28119
|
+
init_snapshot_safety();
|
|
27587
28120
|
}
|
|
27588
28121
|
});
|
|
27589
28122
|
|
|
@@ -28104,6 +28637,7 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28104
28637
|
projectIdFor: adapters.projectIdFor
|
|
28105
28638
|
};
|
|
28106
28639
|
const actions = [];
|
|
28640
|
+
const updateTargets = /* @__PURE__ */ new Map();
|
|
28107
28641
|
const blockedUpdates = [];
|
|
28108
28642
|
const destinations = /* @__PURE__ */ new Set();
|
|
28109
28643
|
for (const adapter of providerAdapters) {
|
|
@@ -28180,7 +28714,7 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28180
28714
|
}
|
|
28181
28715
|
row2.verdict = "upgradable";
|
|
28182
28716
|
report.providers.push(row2);
|
|
28183
|
-
|
|
28717
|
+
const action = upgradeAction({
|
|
28184
28718
|
providerId: adapter.manifest.id,
|
|
28185
28719
|
channel: channel.id,
|
|
28186
28720
|
packageName,
|
|
@@ -28188,15 +28722,23 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28188
28722
|
requiresNetwork: channel.requiresNetwork,
|
|
28189
28723
|
requiresElevation: channel.requiresElevation,
|
|
28190
28724
|
installed: detection.version ?? "an unknown version"
|
|
28191
|
-
})
|
|
28725
|
+
});
|
|
28726
|
+
actions.push(action);
|
|
28727
|
+
updateTargets.set(action.id, {
|
|
28728
|
+
providerId: adapter.manifest.id,
|
|
28729
|
+
target: query.version,
|
|
28730
|
+
channel: channel.id,
|
|
28731
|
+
packageName,
|
|
28732
|
+
adapter
|
|
28733
|
+
});
|
|
28192
28734
|
}
|
|
28193
28735
|
report.network = [...destinations].sort();
|
|
28194
28736
|
for (const blocked of blockedUpdates) {
|
|
28195
28737
|
diagnostics.push(diagnostic({
|
|
28196
28738
|
severity: "info",
|
|
28197
28739
|
code: "provider-update-target-unreviewed",
|
|
28198
|
-
message: `${blocked.providerId} ${blocked.target} is available but
|
|
28199
|
-
remediation: "
|
|
28740
|
+
message: `${blocked.providerId} ${blocked.target} is available but does not meet the provider update prerequisites; keeping ${blocked.installed ?? "the installed version"}`,
|
|
28741
|
+
remediation: "Check the provider update floor or version format, then retry the update"
|
|
28200
28742
|
}));
|
|
28201
28743
|
diagnostics.push(diagnostic({
|
|
28202
28744
|
severity: "info",
|
|
@@ -28248,7 +28790,7 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28248
28790
|
fs,
|
|
28249
28791
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
28250
28792
|
transactionId: transactionId2,
|
|
28251
|
-
projectRoot: context
|
|
28793
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
28252
28794
|
now: context.now
|
|
28253
28795
|
});
|
|
28254
28796
|
if (!creation.ok) {
|
|
@@ -28269,7 +28811,78 @@ async function runPackageChannelUpdate(context, options = {}) {
|
|
|
28269
28811
|
backupRoot: fs.join(context.stateRoot, "backups")
|
|
28270
28812
|
}),
|
|
28271
28813
|
runner: adapters.runner,
|
|
28272
|
-
now: context.now
|
|
28814
|
+
now: context.now,
|
|
28815
|
+
verifyPostconditions: async (applied) => {
|
|
28816
|
+
const postconditions = [];
|
|
28817
|
+
for (const outcome2 of applied) {
|
|
28818
|
+
if (outcome2.status !== "applied" && outcome2.status !== "already-satisfied")
|
|
28819
|
+
continue;
|
|
28820
|
+
const target = updateTargets.get(outcome2.actionId);
|
|
28821
|
+
if (target === void 0)
|
|
28822
|
+
continue;
|
|
28823
|
+
const detection = await target.adapter.detect(providerContext4);
|
|
28824
|
+
const observed = detection.version === null ? null : parseSemanticVersion(detection.version);
|
|
28825
|
+
const expected = parseSemanticVersion(target.target);
|
|
28826
|
+
const exactTarget = observed !== null && expected !== null && compareVersions(observed, expected) === 0;
|
|
28827
|
+
if (!exactTarget) {
|
|
28828
|
+
const inventory = await queryPackageInventory({
|
|
28829
|
+
channel: target.channel,
|
|
28830
|
+
packageName: target.packageName,
|
|
28831
|
+
runner: adapters.runner,
|
|
28832
|
+
cwd: context.projectRoot
|
|
28833
|
+
});
|
|
28834
|
+
const inventoryDetail = inventory.status === "captured" && inventory.version !== null ? ` The ${target.channel} global inventory reports ${inventory.version}.` : ` The ${target.channel} inventory could not confirm the installed target (status: ${inventory.status}).`;
|
|
28835
|
+
const prefix = target.channel === "npm" ? await adapters.runner.run({
|
|
28836
|
+
executable: "npm",
|
|
28837
|
+
args: ["config", "get", "prefix"],
|
|
28838
|
+
cwd: context.projectRoot,
|
|
28839
|
+
timeoutMs: 2e4
|
|
28840
|
+
}) : null;
|
|
28841
|
+
const prefixDetail = prefix !== null && prefix.failure === null && prefix.exitCode === 0 ? ` npm prefix: ${prefix.stdout.trim() || "(empty)"}.` : "";
|
|
28842
|
+
postconditions.push(diagnostic({
|
|
28843
|
+
severity: "error",
|
|
28844
|
+
code: "provider-update-version-not-observed",
|
|
28845
|
+
subject: target.adapter.manifest.id,
|
|
28846
|
+
message: `${target.providerId} update did not become active: requested ${target.target}, but the executable currently resolved on PATH reports ${detection.version ?? "no readable version"}.` + inventoryDetail + prefixDetail,
|
|
28847
|
+
path: detection.executable,
|
|
28848
|
+
remediation: "Review duplicate PATH installations and the package-manager global prefix. Token Harness will not report this update as successful while the requested runtime is not the one being resolved."
|
|
28849
|
+
}));
|
|
28850
|
+
continue;
|
|
28851
|
+
}
|
|
28852
|
+
const capabilityProblem = detection.warnings.find((warning2) => /capabilit/i.test(warning2.code) && /(unavailable|drift|mismatch|unsupported)/i.test(warning2.code));
|
|
28853
|
+
if (target.adapter.manifest.id === "harnesstrim" && (detection.versionVerdict !== "in-range" || capabilityProblem !== void 0)) {
|
|
28854
|
+
postconditions.push(diagnostic({
|
|
28855
|
+
severity: "error",
|
|
28856
|
+
code: "harnesstrim-update-contract-mismatch",
|
|
28857
|
+
subject: target.adapter.manifest.id,
|
|
28858
|
+
message: `HarnessTrim ${target.target} was installed, but its machine-readable capability/artifact contract did not pass Token Harness validation` + (capabilityProblem === void 0 ? "" : `: ${capabilityProblem.message}`),
|
|
28859
|
+
path: detection.executable,
|
|
28860
|
+
remediation: "Keep the previous working HarnessTrim release until the changed contract is understood."
|
|
28861
|
+
}));
|
|
28862
|
+
continue;
|
|
28863
|
+
}
|
|
28864
|
+
if (["mcptoon", "gitnexus", "headroom"].includes(target.adapter.manifest.id) && (detection.assignableHarnesses.length === 0 || capabilityProblem !== void 0)) {
|
|
28865
|
+
postconditions.push(diagnostic({
|
|
28866
|
+
severity: "error",
|
|
28867
|
+
code: "provider-update-capability-unavailable",
|
|
28868
|
+
subject: target.adapter.manifest.id,
|
|
28869
|
+
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}`),
|
|
28870
|
+
path: detection.executable,
|
|
28871
|
+
remediation: "Keep the previous working provider release until the changed CLI capability surface is understood."
|
|
28872
|
+
}));
|
|
28873
|
+
continue;
|
|
28874
|
+
}
|
|
28875
|
+
postconditions.push(diagnostic({
|
|
28876
|
+
severity: "info",
|
|
28877
|
+
code: "provider-update-version-verified",
|
|
28878
|
+
subject: target.adapter.manifest.id,
|
|
28879
|
+
message: `${target.providerId} ${target.target} is now the executable resolved on PATH and passed post-update detection`,
|
|
28880
|
+
path: detection.executable,
|
|
28881
|
+
remediation: null
|
|
28882
|
+
}));
|
|
28883
|
+
}
|
|
28884
|
+
return postconditions;
|
|
28885
|
+
}
|
|
28273
28886
|
});
|
|
28274
28887
|
diagnostics.push(...transaction.diagnostics);
|
|
28275
28888
|
report.execution = {
|
|
@@ -28304,6 +28917,7 @@ var init_update_base = __esm({
|
|
|
28304
28917
|
"use strict";
|
|
28305
28918
|
init_src();
|
|
28306
28919
|
init_src3();
|
|
28920
|
+
init_snapshot_safety();
|
|
28307
28921
|
}
|
|
28308
28922
|
});
|
|
28309
28923
|
|
|
@@ -28564,7 +29178,7 @@ async function runUpdate(context) {
|
|
|
28564
29178
|
fs,
|
|
28565
29179
|
backupRoot: fs.join(context.stateRoot, "backups"),
|
|
28566
29180
|
transactionId: transactionId2,
|
|
28567
|
-
projectRoot: context
|
|
29181
|
+
projectRoot: await repositoryRootForBackupSafety(context),
|
|
28568
29182
|
now: context.now
|
|
28569
29183
|
});
|
|
28570
29184
|
if (!snapshotCreation.ok) {
|
|
@@ -28847,6 +29461,7 @@ var init_update = __esm({
|
|
|
28847
29461
|
"use strict";
|
|
28848
29462
|
init_src();
|
|
28849
29463
|
init_src2();
|
|
29464
|
+
init_snapshot_safety();
|
|
28850
29465
|
init_update_base();
|
|
28851
29466
|
init_rtk_release_update();
|
|
28852
29467
|
}
|
|
@@ -31998,21 +32613,21 @@ function guideSetupTarget(report, harness, provider) {
|
|
|
31998
32613
|
reason: `${label} is configured for ${name(harness)}.`
|
|
31999
32614
|
};
|
|
32000
32615
|
}
|
|
32001
|
-
const hasReviewedHarnessSurface = COMPATIBILITY_ROWS.some((row2) => row2.provider === provider && row2.harness === harnessDetection.harnessId);
|
|
32002
|
-
if (!hasReviewedHarnessSurface) {
|
|
32003
|
-
return {
|
|
32004
|
-
providerId: provider,
|
|
32005
|
-
provider: label,
|
|
32006
|
-
state: "not-applicable",
|
|
32007
|
-
reason: `Token Harness does not manage a reviewed ${label} connection for ${name(harness)}.`
|
|
32008
|
-
};
|
|
32009
|
-
}
|
|
32010
32616
|
if (detection.state === "absent" || detection.state === "available") {
|
|
32617
|
+
if (detection.assignableHarnesses.includes(harnessDetection.harnessId)) {
|
|
32618
|
+
return {
|
|
32619
|
+
providerId: provider,
|
|
32620
|
+
provider: label,
|
|
32621
|
+
state: "actionable",
|
|
32622
|
+
reason: `${label} is not installed yet, but Token Harness has a reviewed automatic install + ${name(harness)} setup path. The exact package and configuration changes are shown before approval.`
|
|
32623
|
+
};
|
|
32624
|
+
}
|
|
32625
|
+
const prerequisite2 = detection.warnings.find((entry) => entry.severity === "warning" || entry.severity === "error");
|
|
32011
32626
|
return {
|
|
32012
32627
|
providerId: provider,
|
|
32013
32628
|
provider: label,
|
|
32014
32629
|
state: "unavailable",
|
|
32015
|
-
reason: `${label} is not installed in
|
|
32630
|
+
reason: prerequisite2 === void 0 ? `${label} is not installed and no automatic installer prerequisite is available in this terminal.` : `${prerequisite2.message}${prerequisite2.remediation === null ? "" : ` ${prerequisite2.remediation}`}`
|
|
32016
32631
|
};
|
|
32017
32632
|
}
|
|
32018
32633
|
if (detection.state === "broken") {
|
|
@@ -32024,34 +32639,19 @@ function guideSetupTarget(report, harness, provider) {
|
|
|
32024
32639
|
};
|
|
32025
32640
|
}
|
|
32026
32641
|
if (!detection.assignableHarnesses.includes(harnessDetection.harnessId)) {
|
|
32642
|
+
const capability = detection.warnings.find((entry) => entry.severity === "warning" || entry.severity === "error");
|
|
32027
32643
|
return {
|
|
32028
32644
|
providerId: provider,
|
|
32029
32645
|
provider: label,
|
|
32030
|
-
state: "
|
|
32031
|
-
reason: `The installed ${label} build does not expose
|
|
32032
|
-
};
|
|
32033
|
-
}
|
|
32034
|
-
const admission = admitManagedMutation(COMPATIBILITY_ROWS, {
|
|
32035
|
-
provider: detection.providerId,
|
|
32036
|
-
providerVersion: detection.version,
|
|
32037
|
-
harness: harnessDetection.harnessId,
|
|
32038
|
-
harnessVersion: harnessDetection.version,
|
|
32039
|
-
os: report.platform.os,
|
|
32040
|
-
wsl: report.platform.isWsl
|
|
32041
|
-
});
|
|
32042
|
-
if (admission.state !== "admitted") {
|
|
32043
|
-
return {
|
|
32044
|
-
providerId: provider,
|
|
32045
|
-
provider: label,
|
|
32046
|
-
state: "unavailable",
|
|
32047
|
-
reason: `Automatic ${label} setup is not reviewed for the installed ${name(harness)} / ${label} version combination on ${report.platform.os}.`
|
|
32646
|
+
state: "not-applicable",
|
|
32647
|
+
reason: capability === void 0 ? `The installed ${label} build does not expose an automatic ${name(harness)} setup surface.` : `${capability.message}${capability.remediation === null ? "" : ` ${capability.remediation}`}`
|
|
32048
32648
|
};
|
|
32049
32649
|
}
|
|
32050
32650
|
return {
|
|
32051
32651
|
providerId: provider,
|
|
32052
32652
|
provider: label,
|
|
32053
32653
|
state: "actionable",
|
|
32054
|
-
reason: `${label} can be configured automatically for ${name(harness)}
|
|
32654
|
+
reason: `${label} can be configured automatically for ${name(harness)}. Token Harness will apply it transactionally and re-check the resulting state.`
|
|
32055
32655
|
};
|
|
32056
32656
|
}
|
|
32057
32657
|
function guideSetupTargets(report, harness) {
|
|
@@ -32063,7 +32663,7 @@ function explainGuideIssue(diagnostics, fallback) {
|
|
|
32063
32663
|
return ISSUE_COPY[known.code];
|
|
32064
32664
|
const blocked = diagnostics.find((entry) => /compatibility|unsupported|unreviewed|no-row/.test(entry.code));
|
|
32065
32665
|
if (blocked !== void 0)
|
|
32066
|
-
return "
|
|
32666
|
+
return "The required automatic capability or safety precondition is not available in the current runtime. Your current settings are preserved.";
|
|
32067
32667
|
if (diagnostics.some((entry) => /drift|mismatch|precondition|conflict/.test(entry.code)))
|
|
32068
32668
|
return "Something changed since the preview. No unsafe change was made. Review the current setup again.";
|
|
32069
32669
|
return fallback;
|
|
@@ -32089,7 +32689,7 @@ function stackFingerprint(report) {
|
|
|
32089
32689
|
function createGuideCall(base) {
|
|
32090
32690
|
return async (args) => {
|
|
32091
32691
|
const savings = args[0] === "savings";
|
|
32092
|
-
const updateCheck = args[0] === "update";
|
|
32692
|
+
const updateCheck = args[0] === "update" && !args.includes("--yes");
|
|
32093
32693
|
const translated = savings ? ["metrics", ...args.slice(1)] : [...args];
|
|
32094
32694
|
let stdout = "";
|
|
32095
32695
|
await run({
|
|
@@ -32300,7 +32900,7 @@ function describeChange(action, harness) {
|
|
|
32300
32900
|
files: action.affectedPaths.length
|
|
32301
32901
|
};
|
|
32302
32902
|
}
|
|
32303
|
-
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;
|
|
32903
|
+
var GuideError, NAMES, name, sameGuideVersion, GUIDE_MANAGED_PROVIDERS, RECOMMENDED_SETUP_PROVIDERS, TASKS, PERIODS, STACK_COMPONENTS, ISSUE_COPY, EFFORT_LABELS, SAFETY_RULES, TASK_RULES, READ_STAGES, GuideService;
|
|
32304
32904
|
var init_guided = __esm({
|
|
32305
32905
|
"apps/cli/dist/src/guided.js"() {
|
|
32306
32906
|
"use strict";
|
|
@@ -32328,6 +32928,7 @@ var init_guided = __esm({
|
|
|
32328
32928
|
headroom: "Headroom"
|
|
32329
32929
|
};
|
|
32330
32930
|
name = (id) => NAMES[id] ?? id;
|
|
32931
|
+
sameGuideVersion = (left, right) => left !== null && right !== null && left.replace(/^v/i, "").trim() === right.replace(/^v/i, "").trim();
|
|
32331
32932
|
GUIDE_MANAGED_PROVIDERS = [
|
|
32332
32933
|
"rtk",
|
|
32333
32934
|
"harnesstrim",
|
|
@@ -32373,13 +32974,19 @@ var init_guided = __esm({
|
|
|
32373
32974
|
"cclimits-claude-token-expired": "The Claude login has expired. Sign in again in Claude, then refresh.",
|
|
32374
32975
|
"cclimits-claude-cache-stale": "Only old Claude allowance data was found. It is not presented as current allowance.",
|
|
32375
32976
|
"cclimits-claude-source-unsupported": "This cclimits response lacks supported Claude discovery information. Check its installed version.",
|
|
32376
|
-
"claude-native-policy-blocked": "Claude settings could not be changed safely. A project override, environment setting or
|
|
32377
|
-
"native-policy-harness-unsupported": "This agent does not expose a
|
|
32977
|
+
"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.",
|
|
32978
|
+
"native-policy-harness-unsupported": "This agent does not expose a writable setting surface for this action.",
|
|
32378
32979
|
"codex-native-policy-unavailable": "Codex did not expose a writable, versioned user setting. No change is proposed.",
|
|
32379
32980
|
"codex-native-policy-shadowed": "A project or profile overrides this Codex setting. That setting belongs to you and will not be replaced.",
|
|
32380
32981
|
"no-providers-registered": "No optimization provider was selected for this operation.",
|
|
32381
32982
|
"already-in-desired-state": "The supported integration is already configured. Nothing needs to be changed.",
|
|
32382
|
-
"
|
|
32983
|
+
"delegated-install-snapshot-too-large": "The optimizer setup found too much unrelated data inside its rollback boundary. Nothing was changed. Update Token Harness or use a narrower project directory before retrying.",
|
|
32984
|
+
"delegated-install-failed": "The optimizer installer itself did not complete successfully. Nothing was kept from the failed transaction.",
|
|
32985
|
+
"delegated-install-artifact-mismatch": "The optimizer installer completed but did not produce the artifact contract it advertised. The transaction was rolled back.",
|
|
32986
|
+
"delegated-install-protected-path-changed": "The optimizer installer touched a file this setup promised to leave alone. The transaction was rolled back.",
|
|
32987
|
+
"delegated-install-undeclared-write": "The optimizer installer changed a path outside the approved write set. The transaction was rolled back.",
|
|
32988
|
+
"action-precondition-drift": "A file changed after the preview was created. Review a fresh preview before applying anything.",
|
|
32989
|
+
"managed-mutation-unsupported": "Automatic setup is unavailable because the installed provider does not expose the required managed surface. Existing integrations are left untouched.",
|
|
32383
32990
|
"plan-ownership-drift": "The integration changed after the preview. Review a fresh plan; nothing was forced.",
|
|
32384
32991
|
"plan-version-drift": "An installed version changed after the preview. Review a fresh plan.",
|
|
32385
32992
|
"plan-project-mismatch": "This preview belongs to a different project. Open a new preview here.",
|
|
@@ -32515,7 +33122,7 @@ var init_guided = __esm({
|
|
|
32515
33122
|
if (this.busy && this.cached !== null)
|
|
32516
33123
|
return this.cached.value;
|
|
32517
33124
|
if (this.busy)
|
|
32518
|
-
throw new GuideError(409, "
|
|
33125
|
+
throw new GuideError(409, "Another managed change is in progress.");
|
|
32519
33126
|
if (this.cached?.period === period && this.now() - this.cached.at < 15e3)
|
|
32520
33127
|
return this.cached.value;
|
|
32521
33128
|
if (this.reading !== null) {
|
|
@@ -32649,7 +33256,7 @@ var init_guided = __esm({
|
|
|
32649
33256
|
name: name(agent.harnessId),
|
|
32650
33257
|
version: agent.version,
|
|
32651
33258
|
configured: providers.length > 0,
|
|
32652
|
-
state: agent.state === "broken" ? "Needs attention" : providers.length > 0 ? "Integration configured" : hasActionableSetup ? "Ready to set up" : "No
|
|
33259
|
+
state: agent.state === "broken" ? "Needs attention" : providers.length > 0 ? "Integration configured" : hasActionableSetup ? "Ready to set up" : "No automatic setup surface available",
|
|
32653
33260
|
providers: providers.map(name),
|
|
32654
33261
|
setup,
|
|
32655
33262
|
effort: observed?.nativeEffort?.current ?? observed?.reasoningEffort ?? null,
|
|
@@ -32925,59 +33532,147 @@ var init_guided = __esm({
|
|
|
32925
33532
|
}
|
|
32926
33533
|
async apply(input) {
|
|
32927
33534
|
if (input === null || typeof input !== "object" || Array.isArray(input))
|
|
32928
|
-
throw new GuideError(400, "A
|
|
33535
|
+
throw new GuideError(400, "A current preview is required.");
|
|
32929
33536
|
const data = input;
|
|
32930
33537
|
if (Object.keys(data).length !== 1 || typeof data["ticket"] !== "string")
|
|
32931
|
-
throw new GuideError(400, "A
|
|
33538
|
+
throw new GuideError(400, "A current preview is required.");
|
|
32932
33539
|
return this.exclusive(async () => {
|
|
32933
33540
|
const approval = this.approval;
|
|
32934
33541
|
if (approval === null || approval.id !== data["ticket"] || this.now() >= approval.expires)
|
|
32935
33542
|
throw new GuideError(409, "This preview expired or was already used. Review a fresh preview.");
|
|
32936
33543
|
this.approval = null;
|
|
32937
33544
|
if (approval.operation === "update") {
|
|
32938
|
-
|
|
32939
|
-
|
|
33545
|
+
const approvedUpdates = approval.updateTargets ?? [];
|
|
33546
|
+
if (approvedUpdates.length === 0)
|
|
33547
|
+
throw new GuideError(409, "This update preview contains no concrete provider version. Review it again.");
|
|
33548
|
+
this.record("Re-checking the exact provider versions you approved before installing them.", "working");
|
|
33549
|
+
let fresh;
|
|
32940
33550
|
try {
|
|
32941
|
-
|
|
33551
|
+
fresh = await this.call(["update"]);
|
|
32942
33552
|
} catch {
|
|
32943
33553
|
this.invalidateObservedState();
|
|
32944
|
-
const message = "The update
|
|
33554
|
+
const message = "The update channels could not be re-checked immediately before installation. Nothing was changed. Review a fresh update preview.";
|
|
32945
33555
|
this.record(message, "attention");
|
|
32946
33556
|
return {
|
|
32947
33557
|
ok: false,
|
|
32948
|
-
title: "Update
|
|
33558
|
+
title: "Update preview changed",
|
|
32949
33559
|
messages: [message],
|
|
32950
33560
|
appliedPlans: 0
|
|
32951
33561
|
};
|
|
32952
33562
|
}
|
|
32953
|
-
if (
|
|
32954
|
-
const message = explainGuideIssue(
|
|
33563
|
+
if (fresh.exitCode !== 0 || fresh.data === null) {
|
|
33564
|
+
const message = explainGuideIssue(fresh.diagnostics, "The update channels changed or could not be re-checked after approval. Nothing was changed; review a fresh update preview.");
|
|
32955
33565
|
this.invalidateObservedState();
|
|
32956
33566
|
this.record(message, "attention");
|
|
32957
33567
|
return {
|
|
32958
33568
|
ok: false,
|
|
32959
|
-
title: "
|
|
33569
|
+
title: "Update preview changed",
|
|
32960
33570
|
messages: [message],
|
|
32961
33571
|
appliedPlans: 0
|
|
32962
33572
|
};
|
|
32963
33573
|
}
|
|
32964
|
-
const
|
|
33574
|
+
const approvedByProvider = new Map(approvedUpdates.map((target) => [String(target.provider), target.version]));
|
|
33575
|
+
const freshUpgradable = fresh.data.providers.filter((row2) => row2.verdict === "upgradable");
|
|
33576
|
+
const unexpected = freshUpgradable.find((row2) => {
|
|
33577
|
+
const approved = approvedByProvider.get(String(row2.providerId)) ?? null;
|
|
33578
|
+
return approved === null || !sameGuideVersion(row2.available, approved);
|
|
33579
|
+
});
|
|
33580
|
+
const unresolved = approvedUpdates.find((target) => {
|
|
33581
|
+
const row2 = fresh.data?.providers.find((candidate) => candidate.providerId === target.provider);
|
|
33582
|
+
return !(row2 !== void 0 && (row2.verdict === "upgradable" && sameGuideVersion(row2.available, target.version) || row2.verdict === "current" && sameGuideVersion(row2.installed, target.version)));
|
|
33583
|
+
});
|
|
33584
|
+
if (unexpected !== void 0 || unresolved !== void 0) {
|
|
33585
|
+
const changed = unexpected !== void 0 ? `${name(unexpected.providerId)} now offers ${unexpected.available ?? "a different version"}.` : `${name(unresolved.provider)} no longer reports the approved target ${unresolved.version}.`;
|
|
33586
|
+
const message = changed + " Nothing was installed because the live update state no longer matches the preview. Review a fresh update preview.";
|
|
33587
|
+
this.invalidateObservedState();
|
|
33588
|
+
this.record(message, "attention");
|
|
33589
|
+
return {
|
|
33590
|
+
ok: false,
|
|
33591
|
+
title: "Update preview changed",
|
|
33592
|
+
messages: [message],
|
|
33593
|
+
appliedPlans: 0
|
|
33594
|
+
};
|
|
33595
|
+
}
|
|
33596
|
+
const pending = approvedUpdates.filter((target) => {
|
|
33597
|
+
const row2 = fresh.data?.providers.find((candidate) => candidate.providerId === target.provider);
|
|
33598
|
+
return row2?.verdict === "upgradable";
|
|
33599
|
+
});
|
|
33600
|
+
let appliedCount = 0;
|
|
33601
|
+
if (pending.length > 0) {
|
|
33602
|
+
this.record("Installing the provider versions from the approved preview.", "working");
|
|
33603
|
+
let result6;
|
|
33604
|
+
try {
|
|
33605
|
+
result6 = await this.call(["update", "--yes"]);
|
|
33606
|
+
} catch {
|
|
33607
|
+
this.invalidateObservedState();
|
|
33608
|
+
const message = "The update stopped before its final result could be read. No automatic retry was made. Refresh and inspect the installed optimizer versions before retrying.";
|
|
33609
|
+
this.record(message, "attention");
|
|
33610
|
+
return {
|
|
33611
|
+
ok: false,
|
|
33612
|
+
title: "Update result needs checking",
|
|
33613
|
+
messages: [message],
|
|
33614
|
+
appliedPlans: 0
|
|
33615
|
+
};
|
|
33616
|
+
}
|
|
33617
|
+
if (result6.exitCode !== 0 || result6.data === null) {
|
|
33618
|
+
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.");
|
|
33619
|
+
this.invalidateObservedState();
|
|
33620
|
+
this.record(message, "attention");
|
|
33621
|
+
return {
|
|
33622
|
+
ok: false,
|
|
33623
|
+
title: "Optimizer update was not applied",
|
|
33624
|
+
messages: [message],
|
|
33625
|
+
appliedPlans: 0
|
|
33626
|
+
};
|
|
33627
|
+
}
|
|
33628
|
+
appliedCount = result6.data.execution?.results.filter((row2) => row2.status === "applied").length ?? 0;
|
|
33629
|
+
}
|
|
33630
|
+
let inventory;
|
|
33631
|
+
try {
|
|
33632
|
+
inventory = await this.call(["doctor"]);
|
|
33633
|
+
} catch {
|
|
33634
|
+
this.invalidateObservedState();
|
|
33635
|
+
const message = "The installer returned, but Token Harness could not re-read the active optimizer runtimes. The update is not being reported as successful. Refresh and inspect the installed versions.";
|
|
33636
|
+
this.record(message, "attention");
|
|
33637
|
+
return {
|
|
33638
|
+
ok: false,
|
|
33639
|
+
title: "Update result needs checking",
|
|
33640
|
+
messages: [message],
|
|
33641
|
+
appliedPlans: appliedCount
|
|
33642
|
+
};
|
|
33643
|
+
}
|
|
33644
|
+
const missing = approvedUpdates.filter((target) => {
|
|
33645
|
+
const detection = inventory.data?.providers.find((candidate) => candidate.providerId === target.provider);
|
|
33646
|
+
return !sameGuideVersion(detection?.version ?? null, target.version);
|
|
33647
|
+
});
|
|
33648
|
+
if (inventory.data === null || missing.length > 0) {
|
|
33649
|
+
const message = missing.length > 0 ? "The approved update target was not observed on the active PATH after installation: " + missing.map((target) => `${name(target.provider)} ${target.version}`).join(", ") + ". This is not being reported as a successful update." : "The active optimizer versions could not be verified after installation. This is not being reported as a successful update.";
|
|
33650
|
+
this.invalidateObservedState();
|
|
33651
|
+
this.record(message, "attention");
|
|
33652
|
+
return {
|
|
33653
|
+
ok: false,
|
|
33654
|
+
title: "Update was not verified",
|
|
33655
|
+
messages: [
|
|
33656
|
+
message,
|
|
33657
|
+
"Refresh after correcting PATH or the package installation; no automatic retry was made."
|
|
33658
|
+
],
|
|
33659
|
+
appliedPlans: appliedCount
|
|
33660
|
+
};
|
|
33661
|
+
}
|
|
32965
33662
|
this.lastApplied = null;
|
|
32966
33663
|
this.invalidateObservedState();
|
|
32967
|
-
const
|
|
32968
|
-
|
|
32969
|
-
|
|
32970
|
-
"
|
|
32971
|
-
|
|
32972
|
-
"No optimizer needed an update by the time the approved action ran.",
|
|
32973
|
-
"Nothing was forced. Choose Refresh to read the current versions."
|
|
33664
|
+
const versions = approvedUpdates.map((target) => `${name(target.provider)} ${target.version}`).join(", ");
|
|
33665
|
+
const messages2 = [
|
|
33666
|
+
appliedCount > 0 ? `Installed and verified the approved optimizer version${approvedUpdates.length === 1 ? "" : "s"}: ${versions}.` : `The approved optimizer version${approvedUpdates.length === 1 ? " was" : "s were"} already active when the final check ran: ${versions}.`,
|
|
33667
|
+
"The active runtime was re-read after the operation; success is shown only because it matches the approved target.",
|
|
33668
|
+
"Reopen a coding agent if the updated optimizer requires it."
|
|
32974
33669
|
];
|
|
32975
|
-
this.record(
|
|
33670
|
+
this.record(appliedCount > 0 ? "Optimizer update installed and verified." : "Approved optimizer version already active and verified.", "success");
|
|
32976
33671
|
return {
|
|
32977
33672
|
ok: true,
|
|
32978
|
-
title:
|
|
33673
|
+
title: appliedCount > 0 ? "Optimizer updated" : "Approved version already active",
|
|
32979
33674
|
messages: messages2,
|
|
32980
|
-
appliedPlans:
|
|
33675
|
+
appliedPlans: appliedCount
|
|
32981
33676
|
};
|
|
32982
33677
|
}
|
|
32983
33678
|
if (approval.operation === "candidate-apply" || approval.operation === "candidate-uninstall") {
|
|
@@ -33078,7 +33773,7 @@ var init_guided = __esm({
|
|
|
33078
33773
|
this.record(`${name(provider)} managed integration removed.`, "success");
|
|
33079
33774
|
return { ok: true, title: "Integration removed", messages: messages2, appliedPlans: 1 };
|
|
33080
33775
|
}
|
|
33081
|
-
this.record(approval.operation === "rollback" ? "Restoring the
|
|
33776
|
+
this.record(approval.operation === "rollback" ? "Restoring the approved configuration backup." : "Backing up and applying exactly the changes you approved.", "working");
|
|
33082
33777
|
const messages = [];
|
|
33083
33778
|
let appliedPlans = 0;
|
|
33084
33779
|
const steps = approval.operation === "rollback" && approval.transactionId !== null ? [
|
|
@@ -33122,7 +33817,7 @@ var init_guided = __esm({
|
|
|
33122
33817
|
this.lastApplied = approval.operation === "rollback" ? null : step.plan === null ? null : { kind: "plan", plan: step.plan, network: approval.network };
|
|
33123
33818
|
}
|
|
33124
33819
|
this.invalidateObservedState();
|
|
33125
|
-
messages.push(approval.operation === "rollback" ? "The
|
|
33820
|
+
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.");
|
|
33126
33821
|
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.");
|
|
33127
33822
|
this.record(`${approval.description} applied and verified against its configuration checks.`, "success");
|
|
33128
33823
|
return {
|
|
@@ -33176,18 +33871,21 @@ var init_guided = __esm({
|
|
|
33176
33871
|
}
|
|
33177
33872
|
this.updates = { fingerprint, report: updateResult.data };
|
|
33178
33873
|
const available = updateResult.data.providers.filter((row2) => row2.verdict === "upgradable");
|
|
33874
|
+
const updateTargets = available.flatMap((row2) => row2.available === null ? [] : [{ provider: row2.providerId, version: row2.available }]);
|
|
33179
33875
|
const blocked = updateResult.data.providers.filter((row2) => row2.verdict === "blocked-unreviewed");
|
|
33180
33876
|
const messages = [];
|
|
33181
33877
|
if (available.length > 0) {
|
|
33182
|
-
messages.push(...available.map((row2) => `${name(row2.providerId)}: ${row2.installed ?? "installed version"} \u2192 ${row2.available ?? "new version"} is
|
|
33878
|
+
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.`));
|
|
33183
33879
|
}
|
|
33184
33880
|
if (blocked.length > 0) {
|
|
33185
|
-
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
|
|
33881
|
+
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.`));
|
|
33186
33882
|
}
|
|
33187
33883
|
if (available.length === 0 && blocked.length === 0)
|
|
33188
|
-
messages.push("Your managed optimizers are up to date on their
|
|
33884
|
+
messages.push("Your managed optimizers are up to date on their configured channels.");
|
|
33189
33885
|
let ticket = null;
|
|
33190
|
-
if (available.length > 0) {
|
|
33886
|
+
if (available.length > 0 && updateTargets.length !== available.length) {
|
|
33887
|
+
messages.push("An update channel reported an upgradable optimizer without a concrete target version. No install approval was created.");
|
|
33888
|
+
} else if (updateTargets.length > 0) {
|
|
33191
33889
|
ticket = this.random();
|
|
33192
33890
|
const expires = this.now() + 10 * 6e4;
|
|
33193
33891
|
this.approval = {
|
|
@@ -33198,7 +33896,8 @@ var init_guided = __esm({
|
|
|
33198
33896
|
provider: null,
|
|
33199
33897
|
description: "Optimizer updates",
|
|
33200
33898
|
operation: "update",
|
|
33201
|
-
network: updateResult.data.network.length > 0
|
|
33899
|
+
network: updateResult.data.network.length > 0,
|
|
33900
|
+
updateTargets
|
|
33202
33901
|
};
|
|
33203
33902
|
messages.push("Review the versions above, then choose Install updates. Token Harness will re-check the update channels and transaction safety rules before changing software.");
|
|
33204
33903
|
} else {
|
|
@@ -33207,10 +33906,10 @@ var init_guided = __esm({
|
|
|
33207
33906
|
const stack = this.stackSnapshot();
|
|
33208
33907
|
if (this.cached !== null)
|
|
33209
33908
|
this.cached.value = { ...this.cached.value, stack };
|
|
33210
|
-
this.record(
|
|
33909
|
+
this.record(ticket !== null ? "Optimizer update available. Waiting for your approval." : available.length > 0 ? "Provider update check could not produce an exact install target." : "Provider update check completed. No update is pending.", "success");
|
|
33211
33910
|
return {
|
|
33212
33911
|
ok: true,
|
|
33213
|
-
title: available.length > 0 ? "
|
|
33912
|
+
title: ticket !== null ? "Updates available" : available.length > 0 ? "Update check needs attention" : "Optimizers up to date",
|
|
33214
33913
|
messages,
|
|
33215
33914
|
appliedPlans: 0,
|
|
33216
33915
|
stack,
|
|
@@ -34979,7 +35678,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
34979
35678
|
const activeRun = runId;
|
|
34980
35679
|
working = true;
|
|
34981
35680
|
$('modal-actions').replaceChildren(closeButton('Applying…', true));
|
|
34982
|
-
$('modal-content').append(progress('Applying the
|
|
35681
|
+
$('modal-content').append(progress('Applying the approved change', 'Only the approved transaction is being applied. Keep this window open until it finishes.'));
|
|
34983
35682
|
try {
|
|
34984
35683
|
const result = await request('/api/apply', { ticket });
|
|
34985
35684
|
if (activeRun !== runId) return;
|
|
@@ -35077,7 +35776,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
35077
35776
|
return preview(
|
|
35078
35777
|
{ action: 'skill', harness: action.harness },
|
|
35079
35778
|
'Review in-session guidance for ' + (action.harness === 'claude' ? 'Claude Code' : 'Codex'),
|
|
35080
|
-
'Enable
|
|
35779
|
+
'Enable managed guidance',
|
|
35081
35780
|
'Guidance enabled',
|
|
35082
35781
|
);
|
|
35083
35782
|
if (action.kind === 'refresh') return $('refresh')?.click();
|
|
@@ -35166,7 +35865,7 @@ var init_guided_capabilities_client = __esm({
|
|
|
35166
35865
|
actionButton('Review removal', () => preview(
|
|
35167
35866
|
{ action: 'remove', provider: component.providerId },
|
|
35168
35867
|
'Review removal for ' + name,
|
|
35169
|
-
'Remove
|
|
35868
|
+
'Remove managed integration',
|
|
35170
35869
|
'Integration removed',
|
|
35171
35870
|
), 'secondary'),
|
|
35172
35871
|
);
|
|
@@ -35267,24 +35966,24 @@ var init_guided_product_client = __esm({
|
|
|
35267
35966
|
},
|
|
35268
35967
|
harnesstrim: {
|
|
35269
35968
|
name: 'HarnessTrim',
|
|
35270
|
-
role: 'Adds
|
|
35969
|
+
role: 'Adds version-aware instructions that help coding agents keep tool output and context lean.',
|
|
35271
35970
|
managed: true,
|
|
35272
35971
|
},
|
|
35273
35972
|
mcptoon: {
|
|
35274
35973
|
name: 'mcptoon',
|
|
35275
|
-
role: 'Provides
|
|
35974
|
+
role: 'Provides compact MCP discovery integration and verifies the resulting setup.',
|
|
35276
35975
|
managed: true,
|
|
35277
35976
|
optional: true,
|
|
35278
35977
|
},
|
|
35279
35978
|
gitnexus: {
|
|
35280
35979
|
name: 'GitNexus',
|
|
35281
|
-
role: 'Registers an already-installed
|
|
35980
|
+
role: 'Registers an already-installed GitNexus CLI as a narrow Claude MCP integration and verifies the result.',
|
|
35282
35981
|
managed: true,
|
|
35283
35982
|
optional: true,
|
|
35284
35983
|
},
|
|
35285
35984
|
headroom: {
|
|
35286
35985
|
name: 'Headroom',
|
|
35287
|
-
role: 'Provides local MCP compression and retrieval through the
|
|
35986
|
+
role: 'Provides local MCP compression and retrieval through the installed Headroom server.',
|
|
35288
35987
|
managed: true,
|
|
35289
35988
|
optional: true,
|
|
35290
35989
|
},
|
|
@@ -35342,7 +36041,7 @@ var init_guided_product_client = __esm({
|
|
|
35342
36041
|
element.disabled = value;
|
|
35343
36042
|
});
|
|
35344
36043
|
$('live-status').textContent = value
|
|
35345
|
-
? (applying ? 'Applying only the
|
|
36044
|
+
? (applying ? 'Applying only the approved change…' : 'Reading current state…')
|
|
35346
36045
|
: 'Nothing changes without your approval';
|
|
35347
36046
|
}
|
|
35348
36047
|
|
|
@@ -35496,7 +36195,7 @@ var init_guided_product_client = __esm({
|
|
|
35496
36195
|
if (unavailable.length)
|
|
35497
36196
|
return {
|
|
35498
36197
|
state: 'limited',
|
|
35499
|
-
label: '
|
|
36198
|
+
label: 'Setup complete',
|
|
35500
36199
|
cls: 'good',
|
|
35501
36200
|
actionable,
|
|
35502
36201
|
unavailable,
|
|
@@ -35589,7 +36288,7 @@ var init_guided_product_client = __esm({
|
|
|
35589
36288
|
label: 'Needs attention',
|
|
35590
36289
|
cls: 'warn',
|
|
35591
36290
|
title: 'One configured optimizer needs attention',
|
|
35592
|
-
detail: 'Use Re-check health below to see whether the configured integration still matches
|
|
36291
|
+
detail: 'Use Re-check health below to see whether the configured integration still matches the provider and agent state currently installed.',
|
|
35593
36292
|
action: 'verify',
|
|
35594
36293
|
};
|
|
35595
36294
|
if (incomplete.length)
|
|
@@ -35599,7 +36298,7 @@ var init_guided_product_client = __esm({
|
|
|
35599
36298
|
title: incomplete.length === 1
|
|
35600
36299
|
? 'Finish setup for ' + incomplete[0].name
|
|
35601
36300
|
: 'Finish the available recommended setup for your coding agents',
|
|
35602
|
-
detail: 'Every Finish setup action below has
|
|
36301
|
+
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.',
|
|
35603
36302
|
action: 'configure',
|
|
35604
36303
|
};
|
|
35605
36304
|
const unavailable = baselineUnavailableAgents();
|
|
@@ -35607,8 +36306,8 @@ var init_guided_product_client = __esm({
|
|
|
35607
36306
|
return {
|
|
35608
36307
|
label: 'No automatic setup',
|
|
35609
36308
|
cls: '',
|
|
35610
|
-
title: 'No
|
|
35611
|
-
detail: '
|
|
36309
|
+
title: 'No automatic setup surface is currently exposed',
|
|
36310
|
+
detail: 'The installed provider does not currently expose the setup surface Token Harness needs. This is a capability limitation, not a missing review row.',
|
|
35612
36311
|
action: 'none',
|
|
35613
36312
|
};
|
|
35614
36313
|
if (!(current?.savings?.rows || []).length)
|
|
@@ -35667,16 +36366,21 @@ var init_guided_product_client = __esm({
|
|
|
35667
36366
|
function componentState(id, component) {
|
|
35668
36367
|
if (!component || component.detectedState === 'absent') return { label: 'Not installed', cls: '' };
|
|
35669
36368
|
if (component.health === 'attention') return { label: 'Needs attention', cls: 'warn' };
|
|
35670
|
-
|
|
36369
|
+
const targets = activeAgents().map(agent => setupTarget(agent.id, id)).filter(Boolean);
|
|
36370
|
+
const connectedHere = targets.some(target => target.state === 'connected');
|
|
36371
|
+
const actionableHere = targets.some(target => target.state === 'actionable');
|
|
36372
|
+
if (component.installed && actionableHere && connectedHere)
|
|
36373
|
+
return { label: 'Partially connected · setup available', cls: 'warn' };
|
|
36374
|
+
if (component.installed && actionableHere)
|
|
36375
|
+
return { label: 'Installed · setup available', cls: 'warn' };
|
|
36376
|
+
if (connectedHere)
|
|
35671
36377
|
return {
|
|
35672
36378
|
label: component.verification === 'verified' ? 'Connected · verified' : 'Connected',
|
|
35673
36379
|
cls: 'good',
|
|
35674
36380
|
};
|
|
35675
|
-
const targets = activeAgents().map(agent => setupTarget(agent.id, id)).filter(Boolean);
|
|
35676
|
-
if (component.installed && targets.some(target => target.state === 'actionable'))
|
|
35677
|
-
return { label: 'Installed · setup available', cls: 'warn' };
|
|
35678
36381
|
if (component.installed && targets.some(target => target.state === 'unavailable'))
|
|
35679
36382
|
return { label: 'Installed · no automatic setup', cls: '' };
|
|
36383
|
+
if (component.configured) return { label: 'Connected elsewhere', cls: '' };
|
|
35680
36384
|
if (component.installed) return { label: 'Installed', cls: '' };
|
|
35681
36385
|
return { label: 'Not installed', cls: '' };
|
|
35682
36386
|
}
|
|
@@ -35703,22 +36407,32 @@ var init_guided_product_client = __esm({
|
|
|
35703
36407
|
const actionableFor = providerTargets
|
|
35704
36408
|
.filter(item => item.target.state === 'actionable')
|
|
35705
36409
|
.map(item => item.agent.name);
|
|
35706
|
-
const unavailableFor = providerTargets
|
|
35707
|
-
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35711
|
-
|
|
35712
|
-
|
|
35713
|
-
|
|
35714
|
-
|
|
36410
|
+
const unavailableFor = providerTargets
|
|
36411
|
+
.filter(item => item.target.state === 'unavailable')
|
|
36412
|
+
.map(item => item.agent.name);
|
|
36413
|
+
const notApplicableFor = providerTargets
|
|
36414
|
+
.filter(item => item.target.state === 'not-applicable')
|
|
36415
|
+
.map(item => item.agent.name);
|
|
36416
|
+
const connectedFor = component?.configuredHarnesses?.length
|
|
36417
|
+
? component.configuredHarnesses.map(agentName)
|
|
36418
|
+
: [];
|
|
36419
|
+
if (connectedFor.length)
|
|
36420
|
+
facts.append(node('span', 'Connected to'), node('strong', connectedFor.join(', ')));
|
|
36421
|
+
if (actionableFor.length)
|
|
36422
|
+
facts.append(node('span', 'Setup available'), node('strong', actionableFor.join(', ')));
|
|
36423
|
+
if (unavailableFor.length)
|
|
36424
|
+
facts.append(node('span', 'Automatic setup unavailable'), node('strong', unavailableFor.join(', ')));
|
|
36425
|
+
if (notApplicableFor.length)
|
|
36426
|
+
facts.append(node('span', 'Not applicable'), node('strong', notApplicableFor.join(', ')));
|
|
36427
|
+
if (!connectedFor.length && !actionableFor.length && !unavailableFor.length && !notApplicableFor.length)
|
|
36428
|
+
facts.append(node('span', 'Connection'), node('strong', 'No detected coding agent target'));
|
|
35715
36429
|
if (component?.update === 'available')
|
|
35716
36430
|
facts.append(
|
|
35717
36431
|
node('span', 'Update'),
|
|
35718
36432
|
node('strong', 'v' + (component.updateAvailableVersion || 'new version') + ' available'),
|
|
35719
36433
|
);
|
|
35720
36434
|
else if (component?.update === 'blocked')
|
|
35721
|
-
facts.append(node('span', 'Update'), node('strong', 'Newer
|
|
36435
|
+
facts.append(node('span', 'Update'), node('strong', 'Newer package requires a provider-specific update path'));
|
|
35722
36436
|
card.append(facts);
|
|
35723
36437
|
|
|
35724
36438
|
if (
|
|
@@ -35730,7 +36444,8 @@ var init_guided_product_client = __esm({
|
|
|
35730
36444
|
card.append(
|
|
35731
36445
|
messageBox(
|
|
35732
36446
|
'Why there is no Connect button',
|
|
35733
|
-
|
|
36447
|
+
providerTargets.find(item => item.target.state === 'unavailable')?.target.reason ||
|
|
36448
|
+
'The installed provider does not expose an automatic setup surface for this coding agent.',
|
|
35734
36449
|
),
|
|
35735
36450
|
);
|
|
35736
36451
|
|
|
@@ -35795,14 +36510,14 @@ var init_guided_product_client = __esm({
|
|
|
35795
36510
|
head.append(title, pill(baseline.label, baseline.cls));
|
|
35796
36511
|
const detail =
|
|
35797
36512
|
baseline.state === 'incomplete'
|
|
35798
|
-
? '
|
|
36513
|
+
? 'An automatic setup is available for ' +
|
|
35799
36514
|
baseline.actionable.map(target => target.provider).join(' + ') +
|
|
35800
36515
|
'. Finish setup to review and apply it.'
|
|
35801
36516
|
: baseline.state === 'unavailable'
|
|
35802
|
-
? '
|
|
36517
|
+
? 'The installed baseline providers do not currently expose an automatic setup surface for this agent. Token Harness will not offer a no-op button.'
|
|
35803
36518
|
: baseline.state === 'limited'
|
|
35804
|
-
? 'All
|
|
35805
|
-
: 'All
|
|
36519
|
+
? 'All automatic baseline actions exposed by the installed providers are complete.'
|
|
36520
|
+
: 'All automatic baseline connections exposed for this coding agent are configured.';
|
|
35806
36521
|
card.append(head, node('p', detail));
|
|
35807
36522
|
if (agent.providers?.length)
|
|
35808
36523
|
card.append(
|
|
@@ -35843,7 +36558,7 @@ var init_guided_product_client = __esm({
|
|
|
35843
36558
|
'Safe preview first',
|
|
35844
36559
|
provider
|
|
35845
36560
|
? 'Token Harness will inspect only ' + provider.name + ' for ' + agent.name + '. If setup is supported, the exact change appears before you confirm it.'
|
|
35846
|
-
: 'Token Harness will prepare
|
|
36561
|
+
: '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.',
|
|
35847
36562
|
),
|
|
35848
36563
|
messageBox('Nothing changes yet', 'This first step only prepares the safe plan. You decide whether to apply it after seeing the concrete changes.'),
|
|
35849
36564
|
progress('Checking ' + agent.name, 'Reading installed optimizer versions and current integration state.'),
|
|
@@ -35880,7 +36595,7 @@ var init_guided_product_client = __esm({
|
|
|
35880
36595
|
provider ? 'This optimizer only' : 'Recommended setup',
|
|
35881
36596
|
provider
|
|
35882
36597
|
? 'This approval changes only ' + provider.name + ' for ' + agent.name + '. Other optimizers are left unchanged.'
|
|
35883
|
-
: 'This review includes only the currently actionable RTK/HarnessTrim changes for ' + agent.name + '.
|
|
36598
|
+
: '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.',
|
|
35884
36599
|
),
|
|
35885
36600
|
);
|
|
35886
36601
|
if (!data.changes.length) {
|
|
@@ -35888,7 +36603,7 @@ var init_guided_product_client = __esm({
|
|
|
35888
36603
|
messageBox(
|
|
35889
36604
|
'No setup change available',
|
|
35890
36605
|
(data.notices || []).join(' ') ||
|
|
35891
|
-
'No
|
|
36606
|
+
'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.',
|
|
35892
36607
|
),
|
|
35893
36608
|
);
|
|
35894
36609
|
} else {
|
|
@@ -35899,7 +36614,7 @@ var init_guided_product_client = __esm({
|
|
|
35899
36614
|
}
|
|
35900
36615
|
for (const notice of data.notices || []) $('modal-content').append(node('p', notice, 'notice-row'));
|
|
35901
36616
|
}
|
|
35902
|
-
$('modal-content').append(messageBox('Safety', 'Apply uses the
|
|
36617
|
+
$('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'));
|
|
35903
36618
|
$('modal-actions').replaceChildren(modalClose(data.ticket ? 'Cancel' : 'Done'));
|
|
35904
36619
|
if (data.ticket)
|
|
35905
36620
|
$('modal-actions').append(
|
|
@@ -35933,7 +36648,7 @@ var init_guided_product_client = __esm({
|
|
|
35933
36648
|
const run = modalRun;
|
|
35934
36649
|
setBusy(true, true);
|
|
35935
36650
|
$('modal-actions').replaceChildren(modalClose('Applying…', true));
|
|
35936
|
-
$('modal-content').append(progress('Applying the
|
|
36651
|
+
$('modal-content').append(progress('Applying the approved change', 'Keep this window open until the transaction finishes.'));
|
|
35937
36652
|
try {
|
|
35938
36653
|
await ensureSession();
|
|
35939
36654
|
const result = await request('/api/apply', { ticket });
|
|
@@ -36246,7 +36961,7 @@ var init_guided_product_client = __esm({
|
|
|
36246
36961
|
isVerify ? 'Troubleshooting check' : 'Update preview',
|
|
36247
36962
|
isVerify
|
|
36248
36963
|
? 'Re-checks the configured optimizer integrations without repairing or changing them. Normal setup already performs its own safety checks.'
|
|
36249
|
-
: 'Checks
|
|
36964
|
+
: '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.',
|
|
36250
36965
|
),
|
|
36251
36966
|
progress(
|
|
36252
36967
|
isVerify ? 'Checking configured optimizers' : 'Checking update channels',
|
|
@@ -36357,7 +37072,7 @@ var init_guided_product_client = __esm({
|
|
|
36357
37072
|
'p',
|
|
36358
37073
|
available.length
|
|
36359
37074
|
? available.map(component => (TOOL_INFO[component.providerId]?.name || component.providerId) + ' has an update ready.').join(' ')
|
|
36360
|
-
: 'Check installed optimizer versions. If
|
|
37075
|
+
: '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.',
|
|
36361
37076
|
'caption',
|
|
36362
37077
|
),
|
|
36363
37078
|
);
|