@mrciphersmith/keryx 0.4.38 → 0.4.39
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/cli.js
CHANGED
|
@@ -34831,7 +34831,7 @@ var package_default;
|
|
|
34831
34831
|
var init_package = __esm(() => {
|
|
34832
34832
|
package_default = {
|
|
34833
34833
|
name: "@mrciphersmith/keryx",
|
|
34834
|
-
version: "0.4.
|
|
34834
|
+
version: "0.4.39",
|
|
34835
34835
|
description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
34836
34836
|
private: false,
|
|
34837
34837
|
publishConfig: {
|
|
@@ -81848,7 +81848,7 @@ ${describeBlockers(open, card)}`
|
|
|
81848
81848
|
message: `The managed review ${open.reviewId} is not finished: it is finished when the package is closed (${card ? "the operator answers the `review_complete` card and its gates pass" : "`keryx review complete` accepts it"}), not when you stop writing. ` + `It still refuses on:
|
|
81849
81849
|
${describeBlockers(open, card)}
|
|
81850
81850
|
` + `${nextStep(open, card)}
|
|
81851
|
-
` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
|
|
81851
|
+
` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A routing refusal is the exception: when `keryx review tier` reports `dispatchable: false`, the operator's routing configuration refuses the reviewer model and no retry changes that, so report it as the one real blocker with the `routing:` lines it printed. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
|
|
81852
81852
|
};
|
|
81853
81853
|
}
|
|
81854
81854
|
var MAX_REVIEW_GATE_CONTINUES = 20, MAX_REVIEW_GATE_STALLS = 3, MAX_HASHED_FILES = 4096, SIGNATURE_WALKS_PER_STOP = 2, MAX_SIGNATURE_FILES, RACY_WINDOW_MS = 2000, fileHashes, fileReads = 0, MAX_CONTENT_HASH_BYTES, ReviewGateAbortedError, TRUNCATION_MARKER = "\u2026truncated", byName = (a, b) => a < b ? -1 : a > b ? 1 : 0, METAPROJECT = ".metaproject", REVIEWS = "reviews", PREFIX_DELIMITERS, MAX_PREFIX_CHARS = 1024, MAX_NAME_CHARS = 255, MAX_SESSION_REVIEW_ROOTS = 8, MAX_SESSION_REVIEW_DIRS = 32, MAX_SESSION_REVIEW_IDS = 32, MAX_PENDING_CALLS = 64, SAFE_REVIEW_ID, isPathDelimiter = (ch) => PREFIX_DELIMITERS.has(ch) || /\s/.test(ch), isSeparator = (ch) => ch === "/" || ch === "\\", OPENING_SUBCOMMANDS, PACKAGE_ARG_SUBCOMMANDS, VALUELESS_FLAGS, OWN_OUTPUT_LINE, KERYX_PACKAGE, PIPE_FILTERS, NO_VALUE_OPTIONS, HEAD_TAIL_VALUE_OPTIONS, GREP_VALUE_OPTIONS, READER_VALUE_OPTIONS, GREP_PATTERN_OPTIONS, GREP_TREE_OPTION, KERYX_PACKAGE_NAMES, nextIs = (line, at, chars) => at + 1 < line.length && chars.includes(line[at + 1]), baseName2 = (word) => path180.posix.basename(word.replace(/\\/g, "/")), trackers, SCAN_CONCURRENCY = 16, NO_PACKAGE_BLOCKER = "no review package this session opened or named: `keryx review start` has not opened one, and no `keryx review` command in this session names an open package by its path or review id", MAX_NUDGE_BLOCKERS = 20, MAX_NUDGE_BLOCKER_CHARS = 300;
|
|
@@ -82830,6 +82830,9 @@ function isGitReadConfined(words, walk) {
|
|
|
82830
82830
|
return false;
|
|
82831
82831
|
return !words.slice(2).some((w) => !w.startsWith("-") && isEscapingOperand(w, cwd, walk.projectRoot));
|
|
82832
82832
|
}
|
|
82833
|
+
function isGitObjectCheck(words) {
|
|
82834
|
+
return words.length === 4 && GIT_CAT_FILE_CHECK_FLAGS.has(words[2]) && !words[3].startsWith("-");
|
|
82835
|
+
}
|
|
82833
82836
|
function isRoutineSegment(words, walk) {
|
|
82834
82837
|
if (words.length === 0 || stripAssignments(words).length !== words.length)
|
|
82835
82838
|
return false;
|
|
@@ -82844,6 +82847,8 @@ function isRoutineSegment(words, walk) {
|
|
|
82844
82847
|
case "bun":
|
|
82845
82848
|
return words[1] === "test" && isRoutineBunTest(words, walk);
|
|
82846
82849
|
case "git":
|
|
82850
|
+
if (words[1] === "cat-file")
|
|
82851
|
+
return isGitObjectCheck(words) && isGitReadConfined(words, walk);
|
|
82847
82852
|
return words[1] !== undefined && GIT_READ_SUBCOMMANDS.has(words[1]) && !hasExecWord(words) && isGitReadConfined(words, walk);
|
|
82848
82853
|
default:
|
|
82849
82854
|
return false;
|
|
@@ -82868,7 +82873,7 @@ function isTrustRoutineCommand(command, context = {}) {
|
|
|
82868
82873
|
function isJudgedByWords(words) {
|
|
82869
82874
|
return words[0] === "git" || words[0] === "keryx";
|
|
82870
82875
|
}
|
|
82871
|
-
var MAX_CHAIN_SEGMENTS = 4, MAX_HELP_WORDS = 4, GIT_READ_SUBCOMMANDS, BUN_TEST_FLAGS, BUN_TEST_COUNT_FLAGS, EXEC_FLAGS, TRUST_ROUTINE_KEYRYX, TRUST_ROUTINE_TOOLS, EXEC_FLAG_PREFIXES, bunfigBaselines, preloadVerdicts, MAX_BUNFIG_BYTES, GIT_OUTSIDE_READ_FLAGS;
|
|
82876
|
+
var MAX_CHAIN_SEGMENTS = 4, MAX_HELP_WORDS = 4, GIT_READ_SUBCOMMANDS, GIT_CAT_FILE_CHECK_FLAGS, BUN_TEST_FLAGS, BUN_TEST_COUNT_FLAGS, EXEC_FLAGS, TRUST_ROUTINE_KEYRYX, TRUST_ROUTINE_TOOLS, EXEC_FLAG_PREFIXES, bunfigBaselines, preloadVerdicts, MAX_BUNFIG_BYTES, GIT_OUTSIDE_READ_FLAGS;
|
|
82872
82877
|
var init_trust_routine_command = __esm(() => {
|
|
82873
82878
|
init_args();
|
|
82874
82879
|
init_command_risk();
|
|
@@ -82886,6 +82891,7 @@ var init_trust_routine_command = __esm(() => {
|
|
|
82886
82891
|
"merge-base",
|
|
82887
82892
|
"blame"
|
|
82888
82893
|
]);
|
|
82894
|
+
GIT_CAT_FILE_CHECK_FLAGS = new Set(["-e", "-t"]);
|
|
82889
82895
|
BUN_TEST_FLAGS = new Set(["--bail", "--only", "--todo"]);
|
|
82890
82896
|
BUN_TEST_COUNT_FLAGS = new Set(["--rerun-each", "--timeout"]);
|
|
82891
82897
|
EXEC_FLAGS = ["--pre", "--hostname-bin", "--output", "--ext-diff", "--exec", "--upload-pack", "--post", "--publish", "--push"];
|
|
@@ -82897,6 +82903,7 @@ var init_trust_routine_command = __esm(() => {
|
|
|
82897
82903
|
...rows("review", [
|
|
82898
82904
|
"attach",
|
|
82899
82905
|
"start",
|
|
82906
|
+
"plan",
|
|
82900
82907
|
"scope",
|
|
82901
82908
|
"slice",
|
|
82902
82909
|
"dispatch-check",
|
|
@@ -120781,7 +120788,7 @@ function assignmentFor(request, config) {
|
|
|
120781
120788
|
}
|
|
120782
120789
|
return { assignment: configured, source, recommendationSource: "none" };
|
|
120783
120790
|
}
|
|
120784
|
-
function commonDecision(request, snapshot, config, resolved, exclusions, requestedClass, fallbackReason) {
|
|
120791
|
+
function commonDecision(request, snapshot, config, resolved, exclusions, requestedClass, fallbackReason, notices = []) {
|
|
120785
120792
|
const snapshotDigest = typeof snapshot?.snapshotDigest === "string" && snapshot.snapshotDigest.length > 0 ? snapshot.snapshotDigest : "invalid-snapshot";
|
|
120786
120793
|
return {
|
|
120787
120794
|
schemaVersion: 2,
|
|
@@ -120795,7 +120802,8 @@ function commonDecision(request, snapshot, config, resolved, exclusions, request
|
|
|
120795
120802
|
exclusions,
|
|
120796
120803
|
...requestedClass !== undefined ? { requestedClass } : {},
|
|
120797
120804
|
...resolved.classifierReceiptId !== undefined ? { classifierReceiptId: resolved.classifierReceiptId } : {},
|
|
120798
|
-
...fallbackReason !== undefined ? { fallbackReason } : {}
|
|
120805
|
+
...fallbackReason !== undefined ? { fallbackReason } : {},
|
|
120806
|
+
...notices.length > 0 ? { notices } : {}
|
|
120799
120807
|
};
|
|
120800
120808
|
}
|
|
120801
120809
|
function providerAllowed2(ref, request, config) {
|
|
@@ -120809,7 +120817,16 @@ function effectiveCostLimit(request, config) {
|
|
|
120809
120817
|
const limits = [request.requirements.maxEstimatedCostUsd, config.execution.maxEstimatedCostUsd].filter((value) => value !== undefined && value !== null);
|
|
120810
120818
|
return limits.length === 0 ? undefined : Math.min(...limits);
|
|
120811
120819
|
}
|
|
120812
|
-
function
|
|
120820
|
+
function requiredContext(request) {
|
|
120821
|
+
return request.requirements.inputTokensRequired + request.requirements.outputTokensReserved;
|
|
120822
|
+
}
|
|
120823
|
+
function contextUnknownFor(candidate, facts, request) {
|
|
120824
|
+
return facts !== undefined && facts.contextLength === null && requiredContext(request) > 0 && !sameModelRef(candidate, request.baseline);
|
|
120825
|
+
}
|
|
120826
|
+
function explicitUserPin(resolved) {
|
|
120827
|
+
return resolved.assignment.mode === "model" && (resolved.source === "user" || resolved.source === "user-override");
|
|
120828
|
+
}
|
|
120829
|
+
function candidateRejection(candidate, facts, authFailedProviderIds, request, config, allowUnknownContext = false) {
|
|
120813
120830
|
if (!providerAllowed2(candidate, request, config))
|
|
120814
120831
|
return "provider-scope-conflict";
|
|
120815
120832
|
if (authFailedProviderIds.has(candidate.providerId))
|
|
@@ -120828,9 +120845,12 @@ function candidateRejection(candidate, facts, authFailedProviderIds, request, co
|
|
|
120828
120845
|
return "cooldown";
|
|
120829
120846
|
if (request.requirements.capabilities.some((capability) => !facts.capabilities.includes(capability)))
|
|
120830
120847
|
return "capability-missing";
|
|
120831
|
-
|
|
120832
|
-
|
|
120848
|
+
if (contextUnknownFor(candidate, facts, request)) {
|
|
120849
|
+
if (!allowUnknownContext)
|
|
120850
|
+
return "context-unknown";
|
|
120851
|
+
} else if (facts.contextLength !== null && facts.contextLength < requiredContext(request)) {
|
|
120833
120852
|
return "context-insufficient";
|
|
120853
|
+
}
|
|
120834
120854
|
const costLimit = effectiveCostLimit(request, config);
|
|
120835
120855
|
if (facts.estimatedCostUsd === null && (costLimit !== undefined || config.execution.unknownCost === "deny"))
|
|
120836
120856
|
return "cost-unknown";
|
|
@@ -120914,10 +120934,13 @@ function resolveRoutingDecision(request, snapshot, config) {
|
|
|
120914
120934
|
const directTarget = assignment.mode === "baseline" ? request.baseline : assignment.mode === "model" ? assignment.target : undefined;
|
|
120915
120935
|
let pinFallbackUsed = false;
|
|
120916
120936
|
if (directTarget !== undefined) {
|
|
120917
|
-
const
|
|
120937
|
+
const directFacts = facts.get(modelRefKey(directTarget));
|
|
120938
|
+
const userPin = assignment.mode === "model" && explicitUserPin(resolved);
|
|
120939
|
+
const reason = candidateRejection(directTarget, directFacts, authFailedProviderIds, request, config, userPin) ?? minimumClassRejection(directTarget, request, config);
|
|
120918
120940
|
if (reason === undefined) {
|
|
120919
120941
|
const fallbackReason = resolved.recommendationSource === "classifier-fallback" ? "classifier-fallback" : undefined;
|
|
120920
|
-
|
|
120942
|
+
const notices = userPin && contextUnknownFor(directTarget, directFacts, request) ? [{ target: directTarget, reason: "context-unknown" }] : [];
|
|
120943
|
+
return { ...commonDecision(request, snapshot, config, resolved, exclusions, undefined, fallbackReason, notices), status: "selected", selection: directTarget };
|
|
120921
120944
|
}
|
|
120922
120945
|
exclusions.push({ target: directTarget, reason });
|
|
120923
120946
|
const fallbackClass = assignment.mode === "baseline" || assignment.mode === "model" ? assignment.fallbackClass : undefined;
|
|
@@ -129327,7 +129350,7 @@ function requireStringField(params, field, method) {
|
|
|
129327
129350
|
}
|
|
129328
129351
|
return value;
|
|
129329
129352
|
}
|
|
129330
|
-
var ACP_PROTOCOL_VERSION = 1, ACP_SUPPORTED_PROTOCOL_VERSIONS, ACP_AGENT_METHODS, ACP_CLIENT_METHODS, ACP_IMPLEMENTED_AGENT_METHODS, ACP_REFUSED_AGENT_METHODS, KERYX_AGENT_CAPABILITIES, KERYX_AUTH_METHODS;
|
|
129353
|
+
var ACP_PROTOCOL_VERSION = 1, ACP_SUPPORTED_PROTOCOL_VERSIONS, ACP_AGENT_METHODS, ACP_CLIENT_METHODS, ACP_IMPLEMENTED_AGENT_METHODS, ACP_REFUSED_AGENT_METHODS, SYSTEM_NOTE_META, KERYX_AGENT_CAPABILITIES, KERYX_AUTH_METHODS;
|
|
129331
129354
|
var init_protocol = __esm(() => {
|
|
129332
129355
|
init_jsonrpc();
|
|
129333
129356
|
ACP_SUPPORTED_PROTOCOL_VERSIONS = [ACP_PROTOCOL_VERSION];
|
|
@@ -129412,6 +129435,7 @@ var init_protocol = __esm(() => {
|
|
|
129412
129435
|
}
|
|
129413
129436
|
]
|
|
129414
129437
|
]);
|
|
129438
|
+
SYSTEM_NOTE_META = Object.freeze({ keryx: Object.freeze({ system: true }) });
|
|
129415
129439
|
KERYX_AGENT_CAPABILITIES = Object.freeze({
|
|
129416
129440
|
loadSession: true,
|
|
129417
129441
|
promptCapabilities: Object.freeze({ image: false, audio: false, embeddedContext: true }),
|
|
@@ -163637,6 +163661,38 @@ var init_floor = __esm(() => {
|
|
|
163637
163661
|
ANNOTATION_MARKERS = new Set(["@suppresswarnings", "@suppress", "#[allow(", "#[ignore]"]);
|
|
163638
163662
|
});
|
|
163639
163663
|
|
|
163664
|
+
// src/harness/routing/context-guidance.ts
|
|
163665
|
+
function displayRef(target) {
|
|
163666
|
+
return `${target.providerId}/${target.modelId}`;
|
|
163667
|
+
}
|
|
163668
|
+
function contextUnknownGuidance(target, category) {
|
|
163669
|
+
const key = displayRef(target);
|
|
163670
|
+
return `${key} has no known context length (no model profile), so routing cannot show it fits this ${category} request. ` + `Record it with \`keryx routing profile set ${key} --context <tokens>\`, ` + `or route ${category} to the session model with \`keryx routing set ${category} baseline\`.`;
|
|
163671
|
+
}
|
|
163672
|
+
function contextUnknownPinNotice(target, category) {
|
|
163673
|
+
const key = displayRef(target);
|
|
163674
|
+
return `${category} uses ${key}, pinned by you, although its context length is unknown (no model profile); ` + `routing could not check that it fits. Record it with \`keryx routing profile set ${key} --context <tokens>\` to have it checked.`;
|
|
163675
|
+
}
|
|
163676
|
+
function contextUnknownLines(decision, category) {
|
|
163677
|
+
const lines = [];
|
|
163678
|
+
const seen = new Set;
|
|
163679
|
+
for (const exclusion of decision.exclusions) {
|
|
163680
|
+
if (exclusion.reason !== "context-unknown" || exclusion.target === undefined)
|
|
163681
|
+
continue;
|
|
163682
|
+
const key = modelRefKey(exclusion.target);
|
|
163683
|
+
if (seen.has(key))
|
|
163684
|
+
continue;
|
|
163685
|
+
seen.add(key);
|
|
163686
|
+
lines.push(contextUnknownGuidance(exclusion.target, category));
|
|
163687
|
+
}
|
|
163688
|
+
for (const notice of decision.notices ?? [])
|
|
163689
|
+
lines.push(contextUnknownPinNotice(notice.target, category));
|
|
163690
|
+
return lines;
|
|
163691
|
+
}
|
|
163692
|
+
var init_context_guidance = __esm(() => {
|
|
163693
|
+
init_model_class();
|
|
163694
|
+
});
|
|
163695
|
+
|
|
163640
163696
|
// src/harness/routing/provider-facts.ts
|
|
163641
163697
|
function inspectProviderRoutingFacts(targets, describe) {
|
|
163642
163698
|
const capabilities = new Map;
|
|
@@ -164909,6 +164965,29 @@ async function ghPrBase(ref) {
|
|
|
164909
164965
|
return;
|
|
164910
164966
|
}
|
|
164911
164967
|
}
|
|
164968
|
+
async function ghPrHead(ref) {
|
|
164969
|
+
if (process.env.KERYX_REVIEW_PR_BASE === "off" || ref.startsWith("-") || Bun.which("gh") === null)
|
|
164970
|
+
return;
|
|
164971
|
+
try {
|
|
164972
|
+
const proc = Bun.spawn(["gh", "pr", "view", ref, "--json", "headRefOid", "--jq", ".headRefOid"], { stdin: "ignore", stdout: "pipe", stderr: "ignore", timeout: PR_BASE_TIMEOUT_MS2, killSignal: "SIGKILL" });
|
|
164973
|
+
const [stdout, exitCode] = await Promise.all([new Response(proc.stdout).text(), proc.exited]);
|
|
164974
|
+
const sha = stdout.trim().toLowerCase();
|
|
164975
|
+
return exitCode === 0 && /^[0-9a-f]{40}$/.test(sha) ? sha : undefined;
|
|
164976
|
+
} catch {
|
|
164977
|
+
return;
|
|
164978
|
+
}
|
|
164979
|
+
}
|
|
164980
|
+
function prHeadMismatchRefusal(input) {
|
|
164981
|
+
const { ref, localHead, prHead } = input;
|
|
164982
|
+
if (localHead === null || prHead === undefined || localHead.toLowerCase() === prHead.toLowerCase())
|
|
164983
|
+
return;
|
|
164984
|
+
return [
|
|
164985
|
+
`This checkout is at ${localHead.slice(0, 12)}, but pull request ${ref} is at ${prHead.slice(0, 12)}: a round started here would review the wrong commit.`,
|
|
164986
|
+
`Pin the pull request's head: \`git fetch origin ${prHead}\`, then run this command again with \`--head ${prHead}\`. Or check the pull request out first (\`gh pr checkout ${ref}\`).`,
|
|
164987
|
+
`To review this checkout as it is, pass \`--head ${localHead}\`.`
|
|
164988
|
+
].join(`
|
|
164989
|
+
`);
|
|
164990
|
+
}
|
|
164912
164991
|
async function trackerPrLookup(ref) {
|
|
164913
164992
|
if (!await githubAdapter.detect())
|
|
164914
164993
|
return null;
|
|
@@ -165263,6 +165342,12 @@ async function runCreate(mode, args, createSeams = {}) {
|
|
|
165263
165342
|
}
|
|
165264
165343
|
const cwd = process.cwd();
|
|
165265
165344
|
const head = await resolveCreateHead(args, targetKind, targetRef, cwd);
|
|
165345
|
+
if (mode === "review-flow" && targetKind === "pr" && optionValue(args, "--head") === undefined) {
|
|
165346
|
+
const localHead = await resolveGitHead2(cwd);
|
|
165347
|
+
const refusal = localHead === null ? undefined : prHeadMismatchRefusal({ ref: targetRef, localHead, prHead: await (createSeams.prHead ?? ghPrHead)(targetRef) });
|
|
165348
|
+
if (refusal !== undefined)
|
|
165349
|
+
throw new Error(refusal);
|
|
165350
|
+
}
|
|
165266
165351
|
const givenBase = optionValue(args, "--base")?.trim() || undefined;
|
|
165267
165352
|
const prBase = targetKind === "pr" ? await (createSeams.prBase ?? ghPrBase)(targetRef) : undefined;
|
|
165268
165353
|
const base = givenBase ?? prBase;
|
|
@@ -165533,6 +165618,9 @@ async function resolveReviewRouting(cwd, catalog, session, routingConfig = loadR
|
|
|
165533
165618
|
const env = envWithSavedApiKeys();
|
|
165534
165619
|
const external = await resolveExternalSetting({ cwd });
|
|
165535
165620
|
const { config: externalConfig } = loadExternalProvidersConfig();
|
|
165621
|
+
if (session.providerId === "" || session.modelId === "") {
|
|
165622
|
+
throw new Error("review routing needs the session model as its baseline, and none was named. " + "Pass --from-shell-config (the model `keryx shell` saved; if you already did, `keryx shell` has not saved one yet), " + "or --session-provider <id> --session-model <id>, or set KERYX_SESSION_PROVIDER and KERYX_SESSION_MODEL.");
|
|
165623
|
+
}
|
|
165536
165624
|
const baseline = { providerId: session.providerId, modelId: session.modelId };
|
|
165537
165625
|
const parentConnected = connectedPredicateFrom(catalog, baseline);
|
|
165538
165626
|
const policyConnected = externalAllowedConnectedPredicate(parentConnected, external.value === "on", externalConfig);
|
|
@@ -165621,13 +165709,17 @@ async function resolveReviewRouting(cwd, catalog, session, routingConfig = loadR
|
|
|
165621
165709
|
}
|
|
165622
165710
|
async function applyReviewRoutingCategory(decision, cwd, catalog, session, routingConfig, routingTask, routingRequirements) {
|
|
165623
165711
|
const receipt = await resolveReviewRouting(cwd, catalog, session, routingConfig, routingTask, routingRequirements);
|
|
165712
|
+
const contextLines = contextUnknownLines(receipt.decision, "review");
|
|
165624
165713
|
if (receipt.decision.status !== "selected") {
|
|
165625
165714
|
const reason = receipt.decision.status === "blocked" ? receipt.decision.reason : receipt.decision.status;
|
|
165626
165715
|
return {
|
|
165627
165716
|
decision,
|
|
165628
165717
|
routed: false,
|
|
165629
165718
|
routingRefused: true,
|
|
165630
|
-
notices: [
|
|
165719
|
+
notices: [
|
|
165720
|
+
`routing refused review selection: ${reason} (decision ${receipt.decision.decisionId}); no dispatch target was selected`,
|
|
165721
|
+
...contextLines
|
|
165722
|
+
],
|
|
165631
165723
|
routing: receipt
|
|
165632
165724
|
};
|
|
165633
165725
|
}
|
|
@@ -165638,7 +165730,7 @@ async function applyReviewRoutingCategory(decision, cwd, catalog, session, routi
|
|
|
165638
165730
|
model: receipt.decision.selection.modelId
|
|
165639
165731
|
},
|
|
165640
165732
|
routed: true,
|
|
165641
|
-
notices:
|
|
165733
|
+
notices: contextLines,
|
|
165642
165734
|
routing: receipt
|
|
165643
165735
|
};
|
|
165644
165736
|
}
|
|
@@ -166223,7 +166315,7 @@ async function resolveConformExplainModel(cwd, routingTask) {
|
|
|
166223
166315
|
{
|
|
166224
166316
|
const session = resolveCallerSession();
|
|
166225
166317
|
if (session.providerId === "" || session.modelId === "") {
|
|
166226
|
-
throw new Error("routing requires the caller session provider/model for review explanations");
|
|
166318
|
+
throw new Error("routing requires the caller session provider/model for review explanations: " + "set KERYX_SESSION_PROVIDER and KERYX_SESSION_MODEL, or run inside `keryx shell`.");
|
|
166227
166319
|
}
|
|
166228
166320
|
const catalog = await tierCatalog([], session);
|
|
166229
166321
|
const budget = new RoutingBudgetLedger({
|
|
@@ -166237,7 +166329,8 @@ async function resolveConformExplainModel(cwd, routingTask) {
|
|
|
166237
166329
|
}, budget);
|
|
166238
166330
|
if (receipt.decision.status !== "selected") {
|
|
166239
166331
|
const reason = receipt.decision.status === "blocked" ? receipt.decision.reason : receipt.decision.status;
|
|
166240
|
-
|
|
166332
|
+
const detail = contextUnknownLines(receipt.decision, "review").map((line) => ` ${line}`).join("");
|
|
166333
|
+
throw new Error(`routing refused review explanation: ${reason} (decision ${receipt.decision.decisionId}).${detail}`);
|
|
166241
166334
|
}
|
|
166242
166335
|
const selected = receipt.decision.selection;
|
|
166243
166336
|
const profile = loadModelProfiles()[profileKey(selected.providerId, selected.modelId)];
|
|
@@ -168656,6 +168749,7 @@ var init_review = __esm(() => {
|
|
|
168656
168749
|
init_settings();
|
|
168657
168750
|
init_config2();
|
|
168658
168751
|
init_model_profile();
|
|
168752
|
+
init_context_guidance();
|
|
168659
168753
|
init_routing_runtime();
|
|
168660
168754
|
init_snapshot_adapter();
|
|
168661
168755
|
init_model_class();
|
|
@@ -287561,6 +287655,7 @@ function renderRoutingBlockedMessage(reason) {
|
|
|
287561
287655
|
"candidate-unverified": "model availability could not be verified; refresh provider detection or choose another model",
|
|
287562
287656
|
"capability-missing": "no connected model supports the capabilities this turn needs; connect or choose a compatible model",
|
|
287563
287657
|
"context-insufficient": "no eligible model has enough context for this turn; shorten the conversation or choose a larger-context model",
|
|
287658
|
+
"context-unknown": "the routed model has no known context length; record it with `keryx routing profile set <provider>/<model> --context <tokens>` or route this category to the session model in /routing",
|
|
287564
287659
|
cooldown: "eligible models are temporarily cooling down; wait briefly and retry",
|
|
287565
287660
|
"cost-unknown": "model cost is unknown under the current budget policy; add pricing data or allow unknown cost",
|
|
287566
287661
|
"budget-exceeded": "the routing budget is too low for an eligible model; raise the limit or choose a lower-cost class",
|
|
@@ -309732,7 +309827,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
309732
309827
|
registryDigest: "96f6ac176ce1847bcc637495a22b7e217d5f472d7a97651ea1614cfe26bfc27e",
|
|
309733
309828
|
contractDigest: "95fd86252f56e1ddca9e5acc8f3817e1dba30c7a576e7a7130ded3424d23b018",
|
|
309734
309829
|
subjectCatalogueDigest: "0aaa0f567b5b26de53e54af7b8441fd4f475d2e044c127543db635eb47569430",
|
|
309735
|
-
inventoryDigest: "
|
|
309830
|
+
inventoryDigest: "42842e9e70380e81d328033f7fb5b542df293d7bb40aac6c3dfd1212e7204e5e",
|
|
309736
309831
|
releaseReady: true,
|
|
309737
309832
|
counts: {
|
|
309738
309833
|
registeredCommands: 76,
|
|
@@ -310012,7 +310107,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
310012
310107
|
"workspace.navigate"
|
|
310013
310108
|
],
|
|
310014
310109
|
otherBlockers: [],
|
|
310015
|
-
descriptorDigest: "
|
|
310110
|
+
descriptorDigest: "6b32dc4bddfda501e2bd4869e6d8b7bbd1a6e3e117f4cc2c36cb785d13fd077c"
|
|
310016
310111
|
};
|
|
310017
310112
|
});
|
|
310018
310113
|
|
|
@@ -339635,7 +339730,7 @@ function createAcpAgentIo(sessionId, send, askPermission, ioOptions = {}) {
|
|
|
339635
339730
|
if (text.length === 0) {
|
|
339636
339731
|
return;
|
|
339637
339732
|
}
|
|
339638
|
-
emit({ sessionUpdate: "agent_message_chunk", content: textBlock(text) });
|
|
339733
|
+
emit({ sessionUpdate: "agent_message_chunk", content: textBlock(text), _meta: SYSTEM_NOTE_META });
|
|
339639
339734
|
}
|
|
339640
339735
|
};
|
|
339641
339736
|
}
|
|
@@ -343997,7 +344092,8 @@ async function runAcpServer(options) {
|
|
|
343997
344092
|
sendUpdate(sessionId, {
|
|
343998
344093
|
sessionUpdate: "agent_message_chunk",
|
|
343999
344094
|
content: textBlock(`keryx: this session ${kept !== undefined ? "was on" : "last ran"} ${value}, but ${reason}; it continues on ${launchChoice.value}.
|
|
344000
|
-
`)
|
|
344095
|
+
`),
|
|
344096
|
+
_meta: SYSTEM_NOTE_META
|
|
344001
344097
|
});
|
|
344002
344098
|
});
|
|
344003
344099
|
}
|
|
@@ -344018,7 +344114,8 @@ async function runAcpServer(options) {
|
|
|
344018
344114
|
sendUpdate(sessionId, {
|
|
344019
344115
|
sessionUpdate: "agent_message_chunk",
|
|
344020
344116
|
content: textBlock(`keryx: MCP server "${problem.name}" ${problem.reason}
|
|
344021
|
-
`)
|
|
344117
|
+
`),
|
|
344118
|
+
_meta: SYSTEM_NOTE_META
|
|
344022
344119
|
});
|
|
344023
344120
|
}
|
|
344024
344121
|
}
|
|
@@ -344028,7 +344125,8 @@ async function runAcpServer(options) {
|
|
|
344028
344125
|
sendUpdate(sessionId, {
|
|
344029
344126
|
sessionUpdate: "agent_message_chunk",
|
|
344030
344127
|
content: textBlock(`${line}
|
|
344031
|
-
`)
|
|
344128
|
+
`),
|
|
344129
|
+
_meta: SYSTEM_NOTE_META
|
|
344032
344130
|
});
|
|
344033
344131
|
}
|
|
344034
344132
|
}
|
|
@@ -29009,7 +29009,7 @@ ${describeBlockers(open, card)}`
|
|
|
29009
29009
|
message: `The managed review ${open.reviewId} is not finished: it is finished when the package is closed (${card ? "the operator answers the `review_complete` card and its gates pass" : "`keryx review complete` accepts it"}), not when you stop writing. ` + `It still refuses on:
|
|
29010
29010
|
${describeBlockers(open, card)}
|
|
29011
29011
|
` + `${nextStep(open, card)}
|
|
29012
|
-
` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
|
|
29012
|
+
` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A routing refusal is the exception: when `keryx review tier` reports `dispatchable: false`, the operator's routing configuration refuses the reviewer model and no retry changes that, so report it as the one real blocker with the `routing:` lines it printed. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
|
|
29013
29013
|
};
|
|
29014
29014
|
}
|
|
29015
29015
|
|
|
@@ -29682,6 +29682,7 @@ var GIT_READ_SUBCOMMANDS = new Set([
|
|
|
29682
29682
|
"merge-base",
|
|
29683
29683
|
"blame"
|
|
29684
29684
|
]);
|
|
29685
|
+
var GIT_CAT_FILE_CHECK_FLAGS = new Set(["-e", "-t"]);
|
|
29685
29686
|
var BUN_TEST_FLAGS = new Set(["--bail", "--only", "--todo"]);
|
|
29686
29687
|
var BUN_TEST_COUNT_FLAGS = new Set(["--rerun-each", "--timeout"]);
|
|
29687
29688
|
var EXEC_FLAGS = ["--pre", "--hostname-bin", "--output", "--ext-diff", "--exec", "--upload-pack", "--post", "--publish", "--push"];
|
|
@@ -29706,6 +29707,7 @@ var TRUST_ROUTINE_KEYRYX = [
|
|
|
29706
29707
|
...rows("review", [
|
|
29707
29708
|
"attach",
|
|
29708
29709
|
"start",
|
|
29710
|
+
"plan",
|
|
29709
29711
|
"scope",
|
|
29710
29712
|
"slice",
|
|
29711
29713
|
"dispatch-check",
|
|
@@ -29919,6 +29921,9 @@ function isGitReadConfined(words, walk) {
|
|
|
29919
29921
|
return false;
|
|
29920
29922
|
return !words.slice(2).some((w) => !w.startsWith("-") && isEscapingOperand(w, cwd, walk.projectRoot));
|
|
29921
29923
|
}
|
|
29924
|
+
function isGitObjectCheck(words) {
|
|
29925
|
+
return words.length === 4 && GIT_CAT_FILE_CHECK_FLAGS.has(words[2]) && !words[3].startsWith("-");
|
|
29926
|
+
}
|
|
29922
29927
|
function isRoutineSegment(words, walk) {
|
|
29923
29928
|
if (words.length === 0 || stripAssignments(words).length !== words.length)
|
|
29924
29929
|
return false;
|
|
@@ -29933,6 +29938,8 @@ function isRoutineSegment(words, walk) {
|
|
|
29933
29938
|
case "bun":
|
|
29934
29939
|
return words[1] === "test" && isRoutineBunTest(words, walk);
|
|
29935
29940
|
case "git":
|
|
29941
|
+
if (words[1] === "cat-file")
|
|
29942
|
+
return isGitObjectCheck(words) && isGitReadConfined(words, walk);
|
|
29936
29943
|
return words[1] !== undefined && GIT_READ_SUBCOMMANDS.has(words[1]) && !hasExecWord(words) && isGitReadConfined(words, walk);
|
|
29937
29944
|
default:
|
|
29938
29945
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.39",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,7 +14,7 @@ triggers:
|
|
|
14
14
|
- "review --hierarchical"
|
|
15
15
|
metadata:
|
|
16
16
|
author: "MrCipherSmith"
|
|
17
|
-
version: "1.16.
|
|
17
|
+
version: "1.16.2"
|
|
18
18
|
category: "review"
|
|
19
19
|
compatible_harnesses: "cursor,codex,zed,opencode,claude"
|
|
20
20
|
license: "MIT"
|
|
@@ -48,11 +48,11 @@ license: "MIT"
|
|
|
48
48
|
- **Host question, four acts:** `confirm-plan`, `waive-mutation`, `override-reviewers`, `decide-premise`. Where no card exists (Claude Code, Codex, other hosts) never send the operator to a terminal or keryx shell for them. Ask with the host's own question tool, as you would on a card, with the verb's options: `yes` or `no`; `waive` or `keep`; `override` or `keep`; `uphold` or `dismiss`. The question names its subject: for `confirm-plan` the plan numbers as the plan card shows them (reviewers, waves, dispatches, minutes, cost); for `waive-mutation` the mutant ids or their count; for `override-reviewers` the reviewer names; for `decide-premise` the finding id. **A Telegram operator:** When the session has the `mcp__helyx-channel__send_poll` tool, the operator reads Telegram and not the terminal, and the host's own question tool never reaches them: `AskUserQuestion` draws a selector in a terminal nobody watches and the session hangs. Ask every question of this skill through `send_poll` instead (`questions: [{question, options}]`, one call for the three start questions), recommended option first, and wait for the `poll_submit:<id>` message; do not re-ask in the terminal. Record the answer with `--answered-by helyx-poll:<poll-id>` and a distinct `:<message-id>` or `/<question>` ref per question.
|
|
49
49
|
- **Record the answer** with `keryx review <verb> --package <package> --answered-by <source>:<ref> --answer-text "<their words, verbatim>" --question-text "<the question as asked>"`, plus `--reason "<why>"` on `waive-mutation`, `override-reviewers` and `decide-premise` (`decide-premise` also `--finding <global_id> --answer uphold|dismiss`). In keryx shell use the card first: `keryx-shell:<ref>` is only for a plain question the shell itself asked. `claude-code:<ref>` and `codex:<ref>` are for the host harness's own question tool, `<ref>` its question id; `helyx-poll:<poll-id>[:<message-id>]` for a Telegram poll; `other:<ref>` for a host that asks in its reply, `<ref>` the message id or a short label.
|
|
50
50
|
- **What the record means.** `confirmedVia: "host-question"` keeps the question and the answer so a reviewer can check them; keryx does not verify them, which is why it is weaker than a card. Record only an answer the operator gave: free text that is not one of the options, a decline, an answer naming the other choice, or words you wrote is not a decision. Unattended runs and nested keryx (`KERYX_TOOL_CALL=1`) refuse the flag, and so does a `confirm-plan` question that does not show the current plan numbers.
|
|
51
|
-
- **Terminal or card only.** The other acts stay with the operator, who runs the exact command in their own terminal outside keryx shell: `keryx review complete <package> --waive <item> "<their words>"` or `--waive-coverage "<their words>"`, `keryx review chunks estimate --package <package> --answer yes --quote "<their words>"`, `keryx review publish <package>`, `keryx review comments reply … --final`. You wait. Never run `--mode automatic` or `--yes`.
|
|
51
|
+
- **Terminal or card only.** The other acts stay with the operator, who runs the exact command in their own terminal outside keryx shell: `keryx review complete <package> --waive <item> "<their words>"` or `--waive-coverage "<their words>"`, `keryx review chunks estimate --package <package> --answer yes --quote "<their words>"`, `keryx review publish <package>`, `keryx review comments reply … --final`. You wait. Never run `--mode automatic` or `--yes`. **Shell calls in a `trust` or `auto` session.** Once a search, web, MCP or external-agent result has entered the turn, only a routine command runs without asking the operator, so write each call to stay routine: one keryx command per shell call (a short `&&` chain of keryx and read-only git commands is fine, a chain with `gh` or any other program is not); no `$(…)`, backticks or variables inside it, so read a pull request's base and head in a call of their own and pass them as literal SHAs; `keryx agents external list --no-probe`, never without the flag; a revision with braces quoted (`git cat-file -e '<sha>^{commit}'`). A `gh` call still asks: that is expected, so make it once and reuse what it printed.
|
|
52
52
|
|
|
53
53
|
## Round plan — the order on every host
|
|
54
54
|
|
|
55
|
-
1. `keryx review plan --target <pr-url|branch> [--ref <base>] [--head <sha>] --host <host> [--memory-query "<query>"] [--unattended]` is the one command: it runs start, scope (Step 3), blast-radius (Step 3b), slice, required and estimate, writes `<package>/plan.json` and dispatches nothing. Read the round first (Step 1a), then dispatch from step 7.
|
|
55
|
+
1. `keryx review plan --target <pr-url|branch> [--ref <base>] [--head <sha>] --host <host> [--memory-query "<query>"] [--unattended]` is the one command: it runs start, scope (Step 3), blast-radius (Step 3b), slice, required and estimate, writes `<package>/plan.json` and dispatches nothing. Read the round first (Step 1a), then dispatch from step 7. **A pull request is reviewed at its own head.** Without `--head` the round records the checkout's commit, so read the pull request's head first (`gh pr view <n> --json headRefOid --jq .headRefOid`) and, unless `git rev-parse HEAD` prints the same commit, fetch it (`git fetch origin <sha>`) and pass `--head <sha>`; `review start` and `review plan` refuse a checkout that is at another commit than the pull request.
|
|
56
56
|
2. Without `plan`, run those stages one by one in this order: `keryx review scope --ref <base> --json > .metaproject/data/review/scope.json`, then `keryx review start --target <kind> --ref <ref> --scope .metaproject/data/review/scope.json --memory-query "<query>" --host <host>` (plus `--unattended` when nobody is at the keyboard); `start` searches every prior-round source (local package, git history, the PR's keryx round block, PR comments, flow) and writes `round.json`.
|
|
57
57
|
3. `keryx review blast-radius --ref <base> --package <package> --json > blast-radius.json` (Step 3b). Reasoned omissions (`unrelated-symbol`, `hub-damped`, `text-hub`, `test-consumer`) are context, not scope; only cap drops become chunks. Run the tests in `<package>/tests-to-run.json` with the command the radius prints, instead of reading them, and hand the output to the reviewers as context.
|
|
58
58
|
4. `keryx review slice --ref <base> --package <package> --host <host>`: each slice carries `roles`, `depth` (deep or light) and `audit`.
|