@moda-ai/cli 1.55.77 → 1.55.79
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/dist/{agent-wrc7kn21.js → agent-3acxyetj.js} +3 -3
- package/dist/{cli-0799n1ej.js → cli-m82f9yqj.js} +3 -3
- package/dist/{cli-t8mvqe7n.js → cli-qa0rbdjd.js} +223 -41
- package/dist/{cli-37gk6etv.js → cli-w5en52xc.js} +2 -2
- package/dist/cli.js +7 -7
- package/dist/{doctor-7bd2q83j.js → doctor-txsjyfes.js} +2 -2
- package/dist/{harness-gkc072np.js → harness-dbkbs04z.js} +1 -1
- package/dist/{harness-github-actions-551gfrhe.js → harness-github-actions-amef13q6.js} +1 -1
- package/dist/{index-05gdag9e.js → index-0w2wddj1.js} +1 -1
- package/dist/{index-skaf1djt.js → index-4jaj5eyb.js} +1 -1
- package/dist/{index-smy7hrm5.js → index-xb4svyw4.js} +3 -3
- package/dist/{prompt-attribution-jqer74f1.js → prompt-attribution-mxmgv3bt.js} +1 -1
- package/dist/prompt-source-mcp.js +1 -1
- package/dist/{prompts-8n2ctn3g.js → prompts-tc7fntm5.js} +1 -1
- package/dist/{sync-e71ew4yt.js → sync-chceab5e.js} +2 -2
- package/package.json +1 -1
- package/skills/integration/index.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDoctorReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-w5en52xc.js";
|
|
4
4
|
import"./cli-rrggdmf8.js";
|
|
5
|
-
import"./cli-
|
|
5
|
+
import"./cli-m82f9yqj.js";
|
|
6
6
|
import"./cli-mm48br00.js";
|
|
7
7
|
import {
|
|
8
8
|
readHarnessSyncState
|
|
@@ -95,7 +95,7 @@ async function buildAgentContext(context) {
|
|
|
95
95
|
const graph = readHarnessGraphIfPresent(context.cwd);
|
|
96
96
|
const reportState = readHarnessReportState(context.cwd);
|
|
97
97
|
const syncState = readHarnessSyncState(context.cwd);
|
|
98
|
-
const harness = graph ? await import("./harness-
|
|
98
|
+
const harness = graph ? await import("./harness-dbkbs04z.js") : undefined;
|
|
99
99
|
const topFindings = doctor.checks.filter((check) => check.status === "fail" || check.status === "warning").slice(0, 12).map(checkToFinding);
|
|
100
100
|
const evidenceRefs = [
|
|
101
101
|
...doctor.checks.map(checkToEvidenceRef),
|
|
@@ -5768,7 +5768,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
|
|
|
5768
5768
|
const analyzedDefinitions = new Map;
|
|
5769
5769
|
if (flags["no-analyze"] !== "true") {
|
|
5770
5770
|
options.onProgress?.("Analyzing prompt sources before sync.");
|
|
5771
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
5771
|
+
const { analyzeHarnessPrompts } = await import("./harness-dbkbs04z.js");
|
|
5772
5772
|
const result = await analyzeHarnessPrompts({
|
|
5773
5773
|
rootDir: process.cwd(),
|
|
5774
5774
|
existing: established.flatMap((prompt) => prompt.sourceDefinition ? [prompt.sourceDefinition.source] : []),
|
|
@@ -5796,7 +5796,7 @@ async function runPromptSyncExclusive(flags, profileOptions, options) {
|
|
|
5796
5796
|
const mergedSources = mergePromptSources(manifest.sources, extraSources);
|
|
5797
5797
|
const manifestUpdate = stableJson(mergedSources) === stableJson(mergePromptSources(manifest.sources, [])) ? undefined : $stringify({ version: 2, prompt_paths: manifest.promptPaths, sources: mergedSources });
|
|
5798
5798
|
const prompts = await discoverPrompts(extraSources);
|
|
5799
|
-
const { checkPromptAttribution } = await import("./prompt-attribution-
|
|
5799
|
+
const { checkPromptAttribution } = await import("./prompt-attribution-mxmgv3bt.js");
|
|
5800
5800
|
const attribution = checkPromptAttribution(process.cwd(), prompts.map((prompt) => prompt.key));
|
|
5801
5801
|
const brokenAttribution = attribution.references.filter((reference) => reference.status === "missing");
|
|
5802
5802
|
if (brokenAttribution.length) {
|
|
@@ -6102,7 +6102,7 @@ async function migratePromptManifest(options = {}) {
|
|
|
6102
6102
|
let addedSources = [];
|
|
6103
6103
|
let pendingSources = [];
|
|
6104
6104
|
if (options.discover) {
|
|
6105
|
-
const { analyzeHarnessPrompts } = await import("./harness-
|
|
6105
|
+
const { analyzeHarnessPrompts } = await import("./harness-dbkbs04z.js");
|
|
6106
6106
|
const result = await analyzeHarnessPrompts({
|
|
6107
6107
|
rootDir: root,
|
|
6108
6108
|
existing: manifest.sources,
|
|
@@ -15932,9 +15932,50 @@ function detectDependencies(input) {
|
|
|
15932
15932
|
import { createHash as createHash4 } from "node:crypto";
|
|
15933
15933
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
15934
15934
|
import { join as join7 } from "node:path";
|
|
15935
|
+
|
|
15936
|
+
// ../../packages/harness-bundle/src/detect/links.ts
|
|
15937
|
+
function resolveBundleLink(link, links, opts = {}) {
|
|
15938
|
+
const via = [];
|
|
15939
|
+
let hops = 0;
|
|
15940
|
+
const walk = (base, target2, top) => {
|
|
15941
|
+
if (target2.startsWith("/"))
|
|
15942
|
+
return;
|
|
15943
|
+
const out = [...base];
|
|
15944
|
+
const segments = target2.split("/").filter((segment) => segment !== "" && segment !== ".");
|
|
15945
|
+
for (let i = 0;i < segments.length; i++) {
|
|
15946
|
+
const segment = segments[i];
|
|
15947
|
+
if (segment === "..") {
|
|
15948
|
+
if (out.length === 0)
|
|
15949
|
+
return;
|
|
15950
|
+
out.pop();
|
|
15951
|
+
continue;
|
|
15952
|
+
}
|
|
15953
|
+
out.push(segment);
|
|
15954
|
+
const path = out.join("/");
|
|
15955
|
+
const next = links.get(path);
|
|
15956
|
+
if (next === undefined || top && opts.followLast === false && i === segments.length - 1)
|
|
15957
|
+
continue;
|
|
15958
|
+
if (++hops > 40)
|
|
15959
|
+
return;
|
|
15960
|
+
via.push(path);
|
|
15961
|
+
const resolved2 = walk(out.slice(0, -1), next, false);
|
|
15962
|
+
if (!resolved2)
|
|
15963
|
+
return;
|
|
15964
|
+
out.splice(0, out.length, ...resolved2);
|
|
15965
|
+
}
|
|
15966
|
+
return out;
|
|
15967
|
+
};
|
|
15968
|
+
const target = links.get(link);
|
|
15969
|
+
if (target === undefined)
|
|
15970
|
+
return;
|
|
15971
|
+
const resolved = walk(link.split("/").slice(0, -1), target, true);
|
|
15972
|
+
return resolved ? { path: resolved.length > 0 ? resolved.join("/") : ".", via } : undefined;
|
|
15973
|
+
}
|
|
15974
|
+
|
|
15975
|
+
// ../../packages/harness-bundle/src/register/harness-digest.ts
|
|
15935
15976
|
var WORKSPACE_INPUT = /^(?:package\.json|bun\.lockb?|package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|yarn\.lock|\.yarnrc\.yml|turbo\.json|nx\.json|lerna\.json|tsconfig[\w.-]*\.json|pyproject\.toml|uv\.lock|poetry\.lock|Pipfile(?:\.lock)?|requirements[\w.-]*\.txt|go\.(?:mod|sum|work)|Cargo\.(?:toml|lock)|Gemfile(?:\.lock)?|\.nvmrc|\.node-version|\.python-version|\.tool-versions|(?:tsup|vite|rollup|esbuild|webpack|babel|swc)\.config\.[\w.]+)$/;
|
|
15936
15977
|
var RUNTIME_CATEGORIES = new Set(["prompt", "schema", "migration", "seed_data", "api_spec"]);
|
|
15937
|
-
var INERT = new Set(["
|
|
15978
|
+
var INERT = new Set(["test", "ci"]);
|
|
15938
15979
|
var INERT_DIR = /(^|\/)(\.github|\.gitlab|\.circleci|\.buildkite|\.devcontainer|\.vscode|\.idea|\.cursor|\.claude|\.codex|\.windsurf|\.agents|\.husky|\.changeset|evals?|evaluations?|benchmarks?|\.?screenshots?|[\w.-]+-out)(\/|$)/;
|
|
15939
15980
|
function harnessFiles(manifest, map, read) {
|
|
15940
15981
|
const paths = new Set(manifest.files.map((f) => f.path));
|
|
@@ -15991,6 +16032,7 @@ function harnessDigest(manifest, map, filesDir) {
|
|
|
15991
16032
|
}
|
|
15992
16033
|
};
|
|
15993
16034
|
const byPath = new Map(manifest.files.map((f) => [f.path, f]));
|
|
16035
|
+
const links = new Map(manifest.files.flatMap((f) => f.symlinkTarget !== undefined ? [[f.path, f.symlinkTarget]] : []));
|
|
15994
16036
|
const hash = createHash4("sha256");
|
|
15995
16037
|
hash.update(JSON.stringify({
|
|
15996
16038
|
v: 1,
|
|
@@ -16002,12 +16044,37 @@ function harnessDigest(manifest, map, filesDir) {
|
|
|
16002
16044
|
}));
|
|
16003
16045
|
for (const path of harnessFiles(manifest, map, read)) {
|
|
16004
16046
|
const f = byPath.get(path);
|
|
16005
|
-
if (f)
|
|
16006
|
-
|
|
16047
|
+
if (!f)
|
|
16048
|
+
continue;
|
|
16049
|
+
hash.update(`
|
|
16007
16050
|
${f.path}\x00${f.sha256}\x00${f.executable ? 1 : 0}\x00${f.symlinkTarget ?? ""}`);
|
|
16051
|
+
for (const t of f.symlinkTarget !== undefined ? linkTargets(f, byPath, links) : [])
|
|
16052
|
+
hash.update(`\x00->${t.path}\x00${t.sha256}\x00${t.executable ? 1 : 0}`);
|
|
16008
16053
|
}
|
|
16009
16054
|
return `sha256:${hash.digest("hex")}`;
|
|
16010
16055
|
}
|
|
16056
|
+
function linkTargets(link, byPath, links) {
|
|
16057
|
+
const out = new Map;
|
|
16058
|
+
const seen = new Set;
|
|
16059
|
+
const visit = (from) => {
|
|
16060
|
+
if (seen.has(from))
|
|
16061
|
+
return;
|
|
16062
|
+
seen.add(from);
|
|
16063
|
+
const target = resolveBundleLink(from, links)?.path;
|
|
16064
|
+
if (target === undefined)
|
|
16065
|
+
return;
|
|
16066
|
+
const exact = byPath.get(target);
|
|
16067
|
+
const hits = exact ? [exact] : [...byPath.values()].filter((f) => target === "." || f.path.startsWith(`${target}/`));
|
|
16068
|
+
for (const f of hits) {
|
|
16069
|
+
if (f.symlinkTarget !== undefined)
|
|
16070
|
+
visit(f.path);
|
|
16071
|
+
else
|
|
16072
|
+
out.set(f.path, f);
|
|
16073
|
+
}
|
|
16074
|
+
};
|
|
16075
|
+
visit(link.path);
|
|
16076
|
+
return [...out.values()].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
16077
|
+
}
|
|
16011
16078
|
function wranglerAssetDirs(configPath, text) {
|
|
16012
16079
|
const dir = dirname5(configPath);
|
|
16013
16080
|
const raw = [];
|
|
@@ -16120,7 +16187,8 @@ function registrationBody(collected, options) {
|
|
|
16120
16187
|
manifestBytes: collected.manifestFile.bytes,
|
|
16121
16188
|
...collected.dependencyMapFile ? { dependencyMapSha256: collected.dependencyMapFile.sha256, dependencyMapBytes: collected.dependencyMapFile.bytes } : {},
|
|
16122
16189
|
...gitFields(collected.manifest),
|
|
16123
|
-
...options.imageRef ? { imageRef: options.imageRef } : {}
|
|
16190
|
+
...options.imageRef ? { imageRef: options.imageRef } : {},
|
|
16191
|
+
...collected.manifest.harnessDigest ? { harnessDigest: collected.manifest.harnessDigest } : {}
|
|
16124
16192
|
};
|
|
16125
16193
|
}
|
|
16126
16194
|
async function uploadRegistration(collected, options, client) {
|
|
@@ -16236,10 +16304,13 @@ async function registerCollected(context, options, collected) {
|
|
|
16236
16304
|
}, profileOptions)),
|
|
16237
16305
|
complete: async (id) => await callControlAPI(`/harness-registrations/${encodeURIComponent(id)}/complete`, { method: "POST" }, profileOptions, { timeoutMs: 300000 })
|
|
16238
16306
|
};
|
|
16239
|
-
const
|
|
16307
|
+
const uploaded = await uploadRegistration(collected, options, client);
|
|
16308
|
+
const { deduplicated } = uploaded;
|
|
16309
|
+
const completed = deduplicated ? await callControlAPI(`/harness-registrations/${encodeURIComponent(uploaded.registration.id)}`, {}, profileOptions).catch(() => ({ ...uploaded.registration, checklistIncomplete: true })) : uploaded.registration;
|
|
16240
16310
|
await withFullChecklist(completed, profileOptions);
|
|
16241
16311
|
const dashboardUrl = `${resolveModaBaseUrl(profileOptions)}${completed.dashboardPath}`;
|
|
16242
|
-
|
|
16312
|
+
const shown = { ...completed, dashboardUrl, ...deduplicated ? { unchanged: true } : {} };
|
|
16313
|
+
emit(context, { ...report, dryRun: false, registration: shown }, renderRegisterReport(report, shown), completed.status === "failed" ? "error" : undefined);
|
|
16243
16314
|
return { exitCode: completed.status === "failed" ? 1 : 0 };
|
|
16244
16315
|
}
|
|
16245
16316
|
async function runHarnessRegistration(context) {
|
|
@@ -16540,6 +16611,8 @@ function renderRegistrationStatus(registration) {
|
|
|
16540
16611
|
` Harness ${registration.harnessName} (${registration.mode} mode)`,
|
|
16541
16612
|
` Status ${registration.status}`
|
|
16542
16613
|
];
|
|
16614
|
+
if (registration.unchanged)
|
|
16615
|
+
lines.push(" Unchanged nothing the harness depends on changed since this registration, so no new one was created");
|
|
16543
16616
|
if (registration.failureReason)
|
|
16544
16617
|
lines.push(` Reason ${registration.failureReason}`);
|
|
16545
16618
|
if (registration.git?.commit)
|
|
@@ -17654,7 +17727,7 @@ function toolResultIsPrompt(owner, pieces) {
|
|
|
17654
17727
|
if (own.length === 0)
|
|
17655
17728
|
return false;
|
|
17656
17729
|
const text = withoutLabels(own.join(`
|
|
17657
|
-
`));
|
|
17730
|
+
`)).replace(/(^|[.!?;\n]\s*)[A-Za-z][\w-]*\s+(?:(?:was|were|is|are|has been|have been)\s+)?(?:saved|cleared|completed|created|updated|deleted|removed|scheduled|sent|loaded|finished|cancelled|canceled)\b(?=\s*(?:$|[.!?,;:(\n]))/gi, "$1");
|
|
17658
17731
|
if (own.every((piece) => ERROR_TEXT.test(piece)) && !IMPERATIVE.test(text))
|
|
17659
17732
|
return false;
|
|
17660
17733
|
if (!hasDirective(text) && !IMPERATIVE.test(text))
|
|
@@ -19149,7 +19222,7 @@ async function runHarnessCommand(context) {
|
|
|
19149
19222
|
throw new CliInputError("Focused remote prompt analysis is not supported yet.", "Use local --analyst=claude|codex|cursor|local-scan, or drop --concern for a full remote report.");
|
|
19150
19223
|
}
|
|
19151
19224
|
if (context.flags["github-actions"] === "true") {
|
|
19152
|
-
const { runGithubActionsAnalyze } = await import("./harness-github-actions-
|
|
19225
|
+
const { runGithubActionsAnalyze } = await import("./harness-github-actions-amef13q6.js");
|
|
19153
19226
|
const result = await runGithubActionsAnalyze(rootDir, {
|
|
19154
19227
|
writeReport: (report2) => {
|
|
19155
19228
|
const normalized = normalizeHarnessReport(report2);
|
|
@@ -19295,8 +19368,8 @@ async function runHarnessCommand(context) {
|
|
|
19295
19368
|
}
|
|
19296
19369
|
const { artifacts, unknowns } = deterministicGraphItems(rootDir, promote === "all" ? undefined : promote);
|
|
19297
19370
|
tagComponentStatus({ runtimeAgents: [], artifacts }, rootDir);
|
|
19298
|
-
const { extractHarnessWithContext: extractHarnessWithContext2 } = await import("./index-
|
|
19299
|
-
const { enumerateHarnessComponents, mergeEnumeratedComponents } = await import("./index-
|
|
19371
|
+
const { extractHarnessWithContext: extractHarnessWithContext2 } = await import("./index-4jaj5eyb.js");
|
|
19372
|
+
const { enumerateHarnessComponents, mergeEnumeratedComponents } = await import("./index-0w2wddj1.js");
|
|
19300
19373
|
let components = { runtimeAgents: [], artifacts: [], warnings: [] };
|
|
19301
19374
|
if (promote === "all" || promote === "topology" || promote === "tools") {
|
|
19302
19375
|
const { result, ctx } = extractHarnessWithContext2(rootDir);
|
|
@@ -19330,8 +19403,8 @@ async function runHarnessCommand(context) {
|
|
|
19330
19403
|
}
|
|
19331
19404
|
case "extract": {
|
|
19332
19405
|
writeHumanProgress(context, "Harness extract: tracing model call sites (no LLM, no network)...");
|
|
19333
|
-
const { extractHarnessWithContext: extractHarnessWithContext2, serializeExtractResult } = await import("./index-
|
|
19334
|
-
const { enumerateHarnessComponents, mergeEnumeratedComponents } = await import("./index-
|
|
19406
|
+
const { extractHarnessWithContext: extractHarnessWithContext2, serializeExtractResult } = await import("./index-4jaj5eyb.js");
|
|
19407
|
+
const { enumerateHarnessComponents, mergeEnumeratedComponents } = await import("./index-0w2wddj1.js");
|
|
19335
19408
|
const { result, ctx } = extractHarnessWithContext2(rootDir, { fresh: true });
|
|
19336
19409
|
const artifacts = deterministicArtifacts(rootDir);
|
|
19337
19410
|
tagComponentStatus({ runtimeAgents: [], artifacts }, rootDir);
|
|
@@ -27558,6 +27631,12 @@ var TOOL_FACTORY = /^(?:tool|dynamicTool|agentTool|createTool|defineTool)$/;
|
|
|
27558
27631
|
var TOOL_MODULE = /^(?:ai|agents(?:\/.*)?|@cloudflare\/[\w-]+(?:\/.*)?|@mastra\/[\w-]+|@ai-sdk\/[\w-]+|@openai\/agents(?:-core)?|@langchain\/[\w-]+)$/;
|
|
27559
27632
|
var MODEL_FACING_NAME = /^[A-Za-z_][\w.:-]{0,127}$/;
|
|
27560
27633
|
var MAX_NAMES_PER_SITE = 64;
|
|
27634
|
+
var EVAL_PATH3 = /(?:^|\/)evals?\/|\.eval\.[cm]?[jt]sx?$/;
|
|
27635
|
+
function surfaceOf(rel2, pkg) {
|
|
27636
|
+
const inside = pkg ? rel2.slice(pkg.length + 1) : rel2;
|
|
27637
|
+
const dirs = posix3.dirname(inside).split("/").filter((part) => part && part !== ".");
|
|
27638
|
+
return `${pkg}:${dirs.slice(0, 2).join("/")}`;
|
|
27639
|
+
}
|
|
27561
27640
|
var MAX_TOOLS = 1e4;
|
|
27562
27641
|
var MAX_EVIDENCE_PER_TOOL = 64;
|
|
27563
27642
|
var MAX_DEFINITIONS_PER_TOOL = 64;
|
|
@@ -27592,18 +27671,22 @@ function emitTools(result, ctx, options = {}) {
|
|
|
27592
27671
|
if (!result.warnings.includes(warning))
|
|
27593
27672
|
result.warnings.push(warning);
|
|
27594
27673
|
};
|
|
27595
|
-
const add = (name, via, evidence, toolOwners, definition, displayName, enclosing) => {
|
|
27674
|
+
const add = (name, via, evidence, toolOwners, definition, displayName, enclosing, surfaceHint) => {
|
|
27596
27675
|
if (!MODEL_FACING_NAME.test(name))
|
|
27597
27676
|
return;
|
|
27598
|
-
const
|
|
27599
|
-
const
|
|
27677
|
+
const definedIn = definition ? relPath(ctx.rootDir, definition.getSourceFile().fileName) : undefined;
|
|
27678
|
+
const pkg = packageOf(definedIn ?? evidence.path);
|
|
27679
|
+
const surface = surfaceHint ?? (definedIn && !EVAL_PATH3.test(definedIn) ? surfaceOf(definedIn, pkg) : undefined);
|
|
27680
|
+
const tracedSurface = surfaceOf(evidence.path, pkg);
|
|
27681
|
+
const matchingKey = `${name}\x00${tracedSurface}`;
|
|
27682
|
+
const key = surface ? `${name}\x00${surface}` : found.has(matchingKey) ? matchingKey : `${name}\x01${pkg}`;
|
|
27600
27683
|
let tool = found.get(key);
|
|
27601
27684
|
if (!tool) {
|
|
27602
27685
|
if (found.size >= MAX_TOOLS) {
|
|
27603
27686
|
limit();
|
|
27604
27687
|
return;
|
|
27605
27688
|
}
|
|
27606
|
-
tool = { name, status: enumerationRepository(ctx).status(evidence.path) === "defined_only" ? "defined_only" : "reachable", ...pkg ? { package: pkg } : {}, via, evidence: [], agents: [], calledFrom: [], definitions: [] };
|
|
27689
|
+
tool = { name, status: enumerationRepository(ctx).status(evidence.path) === "defined_only" ? "defined_only" : "reachable", ...pkg ? { package: pkg } : {}, ...surface ? { surface } : {}, via, evidence: [], agents: [], calledFrom: [], definitions: [] };
|
|
27607
27690
|
found.set(key, tool);
|
|
27608
27691
|
ownersByTool.set(key, { direct: [], rpc: [], open: [] });
|
|
27609
27692
|
}
|
|
@@ -27702,6 +27785,17 @@ function emitTools(result, ctx, options = {}) {
|
|
|
27702
27785
|
};
|
|
27703
27786
|
visit2(source);
|
|
27704
27787
|
}
|
|
27788
|
+
const targetFor = (name, path) => {
|
|
27789
|
+
const candidates = [...found.values()].filter((tool) => tool.name === name && tool.surface);
|
|
27790
|
+
const exact = candidates.filter((tool) => tool.definitions.some((definition) => definition.path === path));
|
|
27791
|
+
if (exact.length === 1)
|
|
27792
|
+
return exact[0];
|
|
27793
|
+
const nearby = candidates.filter((tool) => tool.surface === surfaceOf(path, packageOf(path)));
|
|
27794
|
+
if (nearby.length === 1)
|
|
27795
|
+
return nearby[0];
|
|
27796
|
+
const local = candidates.filter((tool) => (tool.package ?? "") === packageOf(path));
|
|
27797
|
+
return local.length === 1 ? local[0] : candidates.length === 1 ? candidates[0] : undefined;
|
|
27798
|
+
};
|
|
27705
27799
|
for (const role of result.roles) {
|
|
27706
27800
|
if (role.role !== "tools" || role.sink.isTest || skipPath(role.sink.path))
|
|
27707
27801
|
continue;
|
|
@@ -27710,10 +27804,16 @@ function emitTools(result, ctx, options = {}) {
|
|
|
27710
27804
|
for (const hit of toolNamesOf(role.tree).names) {
|
|
27711
27805
|
if (skipPath(hit.path))
|
|
27712
27806
|
continue;
|
|
27713
|
-
|
|
27807
|
+
const target = targetFor(hit.name, hit.path);
|
|
27808
|
+
const ambiguous = !target && [...found.values()].some((tool) => tool.name === hit.name && tool.surface);
|
|
27809
|
+
add(hit.name, "tools-arg", { path: hit.path, line: hit.line, reason: `named in the tools argument of ${role.sink.callee} at ${role.sink.path}:${role.sink.line}` }, ambiguous ? { direct: [], rpc: [], open: [] } : siteOwners, undefined, undefined, role.sink.enclosing, target?.surface);
|
|
27714
27810
|
}
|
|
27715
27811
|
}
|
|
27812
|
+
joinSurfaces(found, ownersByTool);
|
|
27716
27813
|
owners.indexAllowlists(new Set([...found.values()].map((tool) => tool.name)));
|
|
27814
|
+
const surfacesByName = new Map;
|
|
27815
|
+
for (const tool of found.values())
|
|
27816
|
+
surfacesByName.set(tool.name, (surfacesByName.get(tool.name) ?? 0) + 1);
|
|
27717
27817
|
const callOwners = new Map;
|
|
27718
27818
|
for (const role of result.roles) {
|
|
27719
27819
|
if (role.role !== "tools" || role.sink.isTest || skipPath(role.sink.path))
|
|
@@ -27722,24 +27822,86 @@ function emitTools(result, ctx, options = {}) {
|
|
|
27722
27822
|
for (const hit of toolNamesOf(role.tree).names) {
|
|
27723
27823
|
let owners2 = callOwners.get(hit.name);
|
|
27724
27824
|
if (!owners2)
|
|
27725
|
-
callOwners.set(hit.name, owners2 =
|
|
27726
|
-
|
|
27727
|
-
owners2.add(id);
|
|
27825
|
+
callOwners.set(hit.name, owners2 = []);
|
|
27826
|
+
owners2.push({ pkg: packageOf(hit.path), surface: surfaceOf(hit.path, packageOf(hit.path)), ids });
|
|
27728
27827
|
}
|
|
27729
27828
|
}
|
|
27730
27829
|
for (const [key, tool] of found) {
|
|
27731
27830
|
const ids = new Set;
|
|
27732
|
-
|
|
27831
|
+
const allowlistApplies = (allowlistPath) => targetFor(tool.name, allowlistPath) === tool || (surfacesByName.get(tool.name) ?? 1) === 1;
|
|
27832
|
+
for (const name of owners.agentsFor(tool.name, ownersByTool.get(key), allowlistApplies)) {
|
|
27733
27833
|
const classes = owners.classes.filter((entry) => entry.name === name);
|
|
27734
27834
|
if (classes.length === 1)
|
|
27735
27835
|
for (const id of agentForScope(`${classes[0].path}#${name}`))
|
|
27736
27836
|
ids.add(id);
|
|
27737
27837
|
}
|
|
27738
|
-
|
|
27739
|
-
|
|
27838
|
+
const single = (surfacesByName.get(tool.name) ?? 1) === 1;
|
|
27839
|
+
for (const entry of callOwners.get(tool.name) ?? []) {
|
|
27840
|
+
if (single || entry.surface === tool.surface || !tool.surface && entry.pkg === (tool.package ?? ""))
|
|
27841
|
+
for (const id of entry.ids)
|
|
27842
|
+
ids.add(id);
|
|
27843
|
+
}
|
|
27740
27844
|
tool.agents = [...ids].sort();
|
|
27741
27845
|
}
|
|
27742
|
-
|
|
27846
|
+
assignToolIds(found.values());
|
|
27847
|
+
return [...found.values()].sort((a, b) => a.name.localeCompare(b.name) || (a.package ?? "").localeCompare(b.package ?? "") || (a.surface ?? "").localeCompare(b.surface ?? ""));
|
|
27848
|
+
}
|
|
27849
|
+
function joinSurfaces(found, ownersByTool) {
|
|
27850
|
+
for (const [key, pending] of [...found]) {
|
|
27851
|
+
if (pending.surface)
|
|
27852
|
+
continue;
|
|
27853
|
+
const defined = [...found.entries()].filter(([, tool]) => tool.name === pending.name && tool.surface);
|
|
27854
|
+
if (defined.length === 0)
|
|
27855
|
+
continue;
|
|
27856
|
+
const local = defined.filter(([, tool]) => (tool.package ?? "") === (pending.package ?? ""));
|
|
27857
|
+
const matching = local.filter(([, tool]) => pending.evidence.some((entry) => surfaceOf(entry.path, pending.package ?? "") === tool.surface));
|
|
27858
|
+
const selected = matching.length === 1 ? matching[0] : local.length === 1 ? local[0] : defined.length === 1 ? defined[0] : undefined;
|
|
27859
|
+
if (!selected) {
|
|
27860
|
+
if (pending.evidence.every((entry) => EVAL_PATH3.test(entry.path))) {
|
|
27861
|
+
found.delete(key);
|
|
27862
|
+
ownersByTool.delete(key);
|
|
27863
|
+
}
|
|
27864
|
+
continue;
|
|
27865
|
+
}
|
|
27866
|
+
const [targetKey, target] = selected;
|
|
27867
|
+
for (const entry of pending.evidence) {
|
|
27868
|
+
if (target.evidence.length >= MAX_EVIDENCE_PER_TOOL)
|
|
27869
|
+
break;
|
|
27870
|
+
if (!target.evidence.some((other) => other.path === entry.path && other.line === entry.line))
|
|
27871
|
+
target.evidence.push(entry);
|
|
27872
|
+
}
|
|
27873
|
+
for (const entry of pending.calledFrom) {
|
|
27874
|
+
if (!target.calledFrom.some((other) => other.path === entry.path && other.line === entry.line))
|
|
27875
|
+
target.calledFrom.push(entry);
|
|
27876
|
+
}
|
|
27877
|
+
if (pending.status === "reachable")
|
|
27878
|
+
target.status = "reachable";
|
|
27879
|
+
target.displayName ??= pending.displayName;
|
|
27880
|
+
const from = ownersByTool.get(key), into = ownersByTool.get(targetKey);
|
|
27881
|
+
if (from && into) {
|
|
27882
|
+
for (const field of ["direct", "rpc", "open"])
|
|
27883
|
+
for (const agent2 of from[field])
|
|
27884
|
+
if (!into[field].includes(agent2))
|
|
27885
|
+
into[field].push(agent2);
|
|
27886
|
+
}
|
|
27887
|
+
found.delete(key);
|
|
27888
|
+
ownersByTool.delete(key);
|
|
27889
|
+
}
|
|
27890
|
+
}
|
|
27891
|
+
function assignToolIds(tools) {
|
|
27892
|
+
const byName = new Map;
|
|
27893
|
+
for (const tool of tools) {
|
|
27894
|
+
let list = byName.get(tool.name);
|
|
27895
|
+
if (!list)
|
|
27896
|
+
byName.set(tool.name, list = []);
|
|
27897
|
+
list.push(tool);
|
|
27898
|
+
}
|
|
27899
|
+
for (const list of byName.values()) {
|
|
27900
|
+
list.sort((a, b) => Number(Boolean(a.package)) - Number(Boolean(b.package)) || (a.surface ?? "").localeCompare(b.surface ?? ""));
|
|
27901
|
+
list.forEach((tool, index) => {
|
|
27902
|
+
tool.id = toolArtifactId(tool.name, index === 0 ? undefined : tool.surface ?? surfaceOf(tool.evidence[0]?.path ?? "", tool.package ?? ""));
|
|
27903
|
+
});
|
|
27904
|
+
}
|
|
27743
27905
|
}
|
|
27744
27906
|
function registryEntryOf(object) {
|
|
27745
27907
|
const parent = object.parent;
|
|
@@ -27872,9 +28034,9 @@ function emitToolsCached(result, ctx) {
|
|
|
27872
28034
|
}
|
|
27873
28035
|
return tools;
|
|
27874
28036
|
}
|
|
27875
|
-
function toolArtifactId(name,
|
|
28037
|
+
function toolArtifactId(name, surface) {
|
|
27876
28038
|
const slug2 = (text) => text.replace(/[^A-Za-z0-9_.:-]+/g, "_");
|
|
27877
|
-
return `tool.extract.${slug2(name)}`;
|
|
28039
|
+
return surface ? `tool.extract.${slug2(name)}@${encodeURIComponent(surface)}` : `tool.extract.${slug2(name)}`;
|
|
27878
28040
|
}
|
|
27879
28041
|
function workspacePackages(rootDir) {
|
|
27880
28042
|
const cache2 = new Map;
|
|
@@ -27893,16 +28055,15 @@ function workspacePackages(rootDir) {
|
|
|
27893
28055
|
function toolDefinitionRefs(tools) {
|
|
27894
28056
|
const out = [];
|
|
27895
28057
|
for (const tool of tools) {
|
|
27896
|
-
const definition
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
|
|
27900
|
-
|
|
27901
|
-
|
|
27902
|
-
|
|
27903
|
-
|
|
27904
|
-
|
|
27905
|
-
});
|
|
28058
|
+
for (const definition of tool.definitions) {
|
|
28059
|
+
out.push({
|
|
28060
|
+
toolId: tool.id ?? toolArtifactId(tool.name),
|
|
28061
|
+
name: tool.name,
|
|
28062
|
+
definition: { path: definition.path, start: definition.start, end: definition.end, line: definition.line },
|
|
28063
|
+
...tool.agents.length > 0 ? { agentIds: [...tool.agents] } : {},
|
|
28064
|
+
scope: definition.scope
|
|
28065
|
+
});
|
|
28066
|
+
}
|
|
27906
28067
|
}
|
|
27907
28068
|
return out;
|
|
27908
28069
|
}
|
|
@@ -27911,7 +28072,7 @@ function toolArtifacts(tools, runtimeAgents = []) {
|
|
|
27911
28072
|
return tools.map((tool) => {
|
|
27912
28073
|
const usedByAgentIds = [...new Set(tool.agents.filter((id) => knownIds.has(id)))];
|
|
27913
28074
|
const artifact2 = {
|
|
27914
|
-
id: toolArtifactId(tool.name
|
|
28075
|
+
id: tool.id ?? toolArtifactId(tool.name),
|
|
27915
28076
|
type: "tool",
|
|
27916
28077
|
name: tool.name,
|
|
27917
28078
|
status: tool.status,
|
|
@@ -29251,8 +29412,12 @@ function enumerateToolCatalog(result, ctx) {
|
|
|
29251
29412
|
}
|
|
29252
29413
|
}
|
|
29253
29414
|
const merged = new Map;
|
|
29415
|
+
const packageOf = workspacePackages(ctx.rootDir);
|
|
29254
29416
|
for (const item of output.artifacts) {
|
|
29255
|
-
const
|
|
29417
|
+
const path = item.sourcePath ?? "";
|
|
29418
|
+
const surface = surfaceOf(path, packageOf(path));
|
|
29419
|
+
const key = `${item.name}\x00${surface}`;
|
|
29420
|
+
const previous = merged.get(key);
|
|
29256
29421
|
if (previous) {
|
|
29257
29422
|
previous.usedByAgentIds = [...new Set([...previous.usedByAgentIds, ...item.usedByAgentIds])].sort();
|
|
29258
29423
|
const seen = new Set(previous.evidence.map((e) => `${e.path}:${e.line}`));
|
|
@@ -29260,8 +29425,8 @@ function enumerateToolCatalog(result, ctx) {
|
|
|
29260
29425
|
if (item.status === "in_prod" || item.status === "reachable" && previous.status === "defined_only")
|
|
29261
29426
|
previous.status = item.status;
|
|
29262
29427
|
} else {
|
|
29263
|
-
item.id = `tool:catalog:${item.name}`;
|
|
29264
|
-
merged.set(
|
|
29428
|
+
item.id = `tool:catalog:${item.name}@${encodeURIComponent(surface)}`;
|
|
29429
|
+
merged.set(key, item);
|
|
29265
29430
|
}
|
|
29266
29431
|
}
|
|
29267
29432
|
output.artifacts = [...merged.values()];
|
|
@@ -29283,8 +29448,25 @@ function mergeEnumeratedComponents(artifacts, components) {
|
|
|
29283
29448
|
const merged = new Map;
|
|
29284
29449
|
const definitions = new Map;
|
|
29285
29450
|
const registry = components.artifacts.filter((item) => item.type === "tool" && item.id.startsWith("tool.extract."));
|
|
29451
|
+
const extractedByName = new Map;
|
|
29452
|
+
for (const item of registry) {
|
|
29453
|
+
let list = extractedByName.get(item.name);
|
|
29454
|
+
if (!list)
|
|
29455
|
+
extractedByName.set(item.name, list = []);
|
|
29456
|
+
list.push(item);
|
|
29457
|
+
}
|
|
29458
|
+
const toolKey2 = (item) => {
|
|
29459
|
+
if (registry.includes(item))
|
|
29460
|
+
return `tool:${item.id}`;
|
|
29461
|
+
const candidates = extractedByName.get(item.name) ?? [];
|
|
29462
|
+
if (candidates.length === 0)
|
|
29463
|
+
return item.id.startsWith("tool:catalog:") ? `tool:${item.id}` : `tool:${item.name}`;
|
|
29464
|
+
const paths = new Set([item.sourcePath, ...item.evidence.map((entry) => entry.path)].filter(Boolean));
|
|
29465
|
+
const target = candidates.find((candidate) => candidate.sourcePath && paths.has(candidate.sourcePath) || candidate.definitionVariants?.some((variant) => variant.sourcePath && paths.has(variant.sourcePath))) ?? candidates.find((candidate) => !candidate.id.includes("@")) ?? candidates[0];
|
|
29466
|
+
return `tool:${target.id}`;
|
|
29467
|
+
};
|
|
29286
29468
|
for (const item of [...registry, ...artifacts, ...components.artifacts.filter((item2) => !registry.includes(item2))]) {
|
|
29287
|
-
const key = item.type === "tool" ?
|
|
29469
|
+
const key = item.type === "tool" ? toolKey2(item) : item.id;
|
|
29288
29470
|
if (item.type === "tool") {
|
|
29289
29471
|
const own = item.definitionVariants ?? (item.body ? [{ sourcePath: item.sourcePath, body: item.body, evidence: item.evidence }] : []);
|
|
29290
29472
|
let variants = definitions.get(key);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./cli-rrggdmf8.js";
|
|
5
5
|
import {
|
|
6
6
|
inspectPromptManifest
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-m82f9yqj.js";
|
|
8
8
|
import {
|
|
9
9
|
readHarnessSyncState,
|
|
10
10
|
renderDoctorHuman,
|
|
@@ -395,7 +395,7 @@ async function harnessCurrentCheck(cwd, manifestPath, manifestExists, tenantId)
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
try {
|
|
398
|
-
const { scanHarness } = await import("./harness-
|
|
398
|
+
const { scanHarness } = await import("./harness-dbkbs04z.js");
|
|
399
399
|
const current = scanHarness({
|
|
400
400
|
rootDir: cwd,
|
|
401
401
|
scannerVersion: "doctor",
|
package/dist/cli.js
CHANGED
|
@@ -2975,25 +2975,25 @@ function leafManifestFields(leaf, commands) {
|
|
|
2975
2975
|
import { fileURLToPath } from "url";
|
|
2976
2976
|
import { realpathSync } from "fs";
|
|
2977
2977
|
async function runPromptsCommand(...args) {
|
|
2978
|
-
return (await import("./prompts-
|
|
2978
|
+
return (await import("./prompts-tc7fntm5.js")).runPromptsCommand(...args);
|
|
2979
2979
|
}
|
|
2980
2980
|
async function runSkillsCommand(...args) {
|
|
2981
2981
|
return (await import("./skills-knpeqryb.js")).runSkillsCommand(...args);
|
|
2982
2982
|
}
|
|
2983
2983
|
async function runHarnessCommand(...args) {
|
|
2984
|
-
return (await import("./harness-
|
|
2984
|
+
return (await import("./harness-dbkbs04z.js")).runHarnessCommand(...args);
|
|
2985
2985
|
}
|
|
2986
2986
|
async function runSyncCommand(...args) {
|
|
2987
|
-
return (await import("./sync-
|
|
2987
|
+
return (await import("./sync-chceab5e.js")).runSyncCommand(...args);
|
|
2988
2988
|
}
|
|
2989
2989
|
async function runRegistryCommand(...args) {
|
|
2990
2990
|
return (await import("./registry-c64qr7ta.js")).runRegistryCommand(...args);
|
|
2991
2991
|
}
|
|
2992
2992
|
async function runDoctorCommand(...args) {
|
|
2993
|
-
return (await import("./doctor-
|
|
2993
|
+
return (await import("./doctor-txsjyfes.js")).runDoctorCommand(...args);
|
|
2994
2994
|
}
|
|
2995
2995
|
async function runStatusCommand(...args) {
|
|
2996
|
-
return (await import("./doctor-
|
|
2996
|
+
return (await import("./doctor-txsjyfes.js")).runStatusCommand(...args);
|
|
2997
2997
|
}
|
|
2998
2998
|
async function runAuthCommand(...args) {
|
|
2999
2999
|
return (await import("./profile-commands-1fdvrs5y.js")).runAuthCommand(...args);
|
|
@@ -3005,7 +3005,7 @@ async function runProfilesCommand(...args) {
|
|
|
3005
3005
|
return (await import("./profile-commands-1fdvrs5y.js")).runProfilesCommand(...args);
|
|
3006
3006
|
}
|
|
3007
3007
|
async function runAgentCommand(...args) {
|
|
3008
|
-
return (await import("./agent-
|
|
3008
|
+
return (await import("./agent-3acxyetj.js")).runAgentCommand(...args);
|
|
3009
3009
|
}
|
|
3010
3010
|
async function runProductionCommand(...args) {
|
|
3011
3011
|
return (await import("./production-intelligence-f9sd68te.js")).runProductionCommand(...args);
|
|
@@ -6769,7 +6769,7 @@ var commandRegistry = createCommandRegistry([
|
|
|
6769
6769
|
resetApiRequestCountBeforeRun: true,
|
|
6770
6770
|
telemetry: "result-and-error",
|
|
6771
6771
|
handler: async (context) => {
|
|
6772
|
-
const { runInit } = await import("./index-
|
|
6772
|
+
const { runInit } = await import("./index-xb4svyw4.js");
|
|
6773
6773
|
if (context.outputMode === "agent-stream") {
|
|
6774
6774
|
context.output.writeEvent({
|
|
6775
6775
|
event: "started",
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
promptsDiscoveredCheck,
|
|
4
4
|
runDoctorCommand,
|
|
5
5
|
runStatusCommand
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-w5en52xc.js";
|
|
7
7
|
import"./cli-rrggdmf8.js";
|
|
8
|
-
import"./cli-
|
|
8
|
+
import"./cli-m82f9yqj.js";
|
|
9
9
|
import"./cli-mm48br00.js";
|
|
10
10
|
import"./cli-k0vxtzxb.js";
|
|
11
11
|
import"./cli-22yvg5kh.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDoctorReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-w5en52xc.js";
|
|
4
4
|
import {
|
|
5
5
|
selectTenantAndCreateKey
|
|
6
6
|
} from "./cli-n1406hqg.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
initPrompts,
|
|
22
22
|
runPromptSync
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-m82f9yqj.js";
|
|
24
24
|
import {
|
|
25
25
|
agentsMdProblem,
|
|
26
26
|
runSkillSync
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
runCodingAgent,
|
|
47
47
|
runHarnessCommand,
|
|
48
48
|
startRemoteAnalyze
|
|
49
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-qa0rbdjd.js";
|
|
50
50
|
import {
|
|
51
51
|
canonicalText,
|
|
52
52
|
renderInitBanner,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPromptsCommand
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-m82f9yqj.js";
|
|
4
4
|
import {
|
|
5
5
|
runSkillsCommand
|
|
6
6
|
} from "./cli-1smcq5pf.js";
|
|
@@ -10,7 +10,7 @@ import"./cli-hcwdz9sd.js";
|
|
|
10
10
|
import"./cli-mm48br00.js";
|
|
11
11
|
import {
|
|
12
12
|
runHarnessCommand
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-qa0rbdjd.js";
|
|
14
14
|
import"./cli-k0vxtzxb.js";
|
|
15
15
|
import"./cli-97fnztpy.js";
|
|
16
16
|
import"./cli-y333w08f.js";
|
package/package.json
CHANGED