@quikit/quikpilot-runner 9.3.0-rc.59 → 9.3.0-rc.60

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/README.md CHANGED
@@ -165,6 +165,8 @@ wrong (a field that arrives from a database row or a request), so it only warns
165
165
  **9.3.0-rc.46 — the existing tests to read first include the ones that reach the code through one file in between (QUIKTR-1845).** On the live bug-6 run (QTRIA-17) the design changed `lib/services/issueFilters.ts`, and the two tests that assert the bug import `app/api/issues/route.ts`, which imports it, so the list of existing tests the AI reads before writing (`testsToCheck`, rc.44) was empty. When fewer than 3 test files are found by name or a direct import, the runner now takes one more step: of the files the tests import (code, not a test, not under a denied path; the 150 most shared first) it keeps the ones that import a changed file, and adds the tests that import them, after the others and up to 10 in all. A file in between imported by more than 12 tests only brings the tests named after it (a route by its folder) or after the changed file. Paths only, as before. With 3 or more found the list is exactly as in rc.45. Also in rc.46: everything in rc.45. Nothing else changes.
166
166
 
167
167
  **9.3.0-rc.59 - a throwaway test, run once, its output shown (QUIKTR-1702, contract section 44 `codegen-loop-9`).** Before it writes an expected value the AI sometimes needs to SEE what the code really returns. `call_function` could show it, but only for a plain .js file, one function and plain data, on our own repositories: nothing for a Go, Python or Java project. The new tool `run_scratch {path, content}` has the AI name a NEW test file (named the way the project names its tests, in a folder that exists, never a file that exists) and give its text. The runner writes it next to the AI's changes, runs the space's own "Test one file" command on it once (`commands.testFile`, the path quoted, the same environment allow-list, credential scrub and process-group kill as `run_tests`, 60 seconds), puts the checkout back exactly, and answers with ONE string: `exit N`, then the END of what the run printed (stdout and stderr together, colour codes removed, credentials scrubbed, at most 2,000 characters in all). The AI supplies a file and its text, never what runs it: no command, no interpreter, no flag. The scratch file goes to disk through the overlay window as one extra file and never through the loop's overlay, so the syntax guard, the hunk and scope checks, `show_changes`, the proof run and the proposal never see it, and a scratch answer is never evidence that a test fails. It shares the eight `functionCalls` with `call_function`, and a repeat of the same file on the same change is answered as a duplicate and spends nothing. Offered only when fix first is on (loop-9 is loop-8 plus the tool), the space has a one-file command, and the repository is ours (`deathvadeR-afk`, section 28.2 unchanged) or the workflow sets `QUIKPILOT_RUN_SCRATCH=on` (a trial space); `QUIKPILOT_RUN_SCRATCH=off` closes it everywhere. Needs the AI Runtime of QUIKTR-1702 (`codegen-loop-9`, its own flag); an AI Runtime that refuses it is asked again as `codegen-loop-8`, then `codegen-loop-7`. Logs and the run record carry counts and closed words only (`codegen.run_scratch`: status, reason, exit code, seconds, length), never the path, the text or the output. Also in rc.59: everything in rc.58. Nothing else changes.
168
+
169
+ **9.3.0-rc.60 - credential files of every language stay away from the AI (QUIKTR-1703).** QuikPilot hid the npm credential file (`.npmrc`) and a few other secret-shaped files, but a Python, Java, Rust, PHP, Ruby or .NET project's own login files were open to the AI, and the last-line scrubber knew only JavaScript-style secrets. (1) Files that hold nothing but logins or keys are never read, listed, searched, edited or created, whatever the project's Protected paths say: `.pypirc`, `pip.conf`, `.netrc`, `.yarnrc(.yml)`, `.cargo/credentials`, `.gem/credentials`, `.bundle/config`, Maven `settings-security.xml` and a `settings.xml` at the root or under `.mvn`/`.m2`, Composer `auth.json` at the root, `.aws/credentials`, `.docker/config.json`, `.kube/config`, Terraform state, `.htpasswd`, private keys and key stores. The names are exact and anchored, so `locales/en/auth.json` stays readable. Nothing under `.git` can be written. (2) The edit, write, show and revert tools use the read list as well: a file the AI may not see is not one it can probe through an edit answer (`ambiguous` quoted the line before each match; `no_match` against `ok` told a guess from a hit). A credential file or a file it may not read is no target and no context file either. (3) The file listing sent to the AI service leaves out every file the AI may not read (it was the raw list); the runner keeps the whole list for its own checks. (4) The scrubber has a `config` mode for configuration files (properties, ini, cfg, conf, toml, yaml, xml, `.env*`, `appsettings*.json`): `repoPassword=x`, `password = x`, `<password>x</password>`, `Password=x;` inside a connection string, a NuGet `ClearTextPassword` are redacted and the name stays; translation files and code are read as before. It also hides npm, PyPI, GitLab and Docker Hub token shapes in every mode. The recorded words do not change. (5) The command environment passes a few more settings with no secret in them (`GOPRIVATE`, `VIRTUAL_ENV`, `PYTHONPATH`, `NODE_ENV`, `RUSTFLAGS`, `CARGO_TARGET_DIR`, `NUGET_PACKAGES` and kin); `GOPROXY`, `PIP_INDEX_URL`, `UV_INDEX_URL`, `MAVEN_OPTS`, `JAVA_TOOL_OPTIONS`, `GRADLE_OPTS` and `RUSTFLAGS` pass only when their value carries no login; and npm's base64 login (`NPM_CONFIG__AUTH`) no longer slips through the allowed `NPM_CONFIG_` family. Never a wildcard: `BUNDLE_*`, `COMPOSER_AUTH` and the registry token variables stay withheld. No change to the contract with the AI service.
168
170
 
169
171
  **9.3.0-rc.58 - write the fix first, then ask once about every existing test it breaks, with proof (QUIKTR-1851, absorbing QUIKTR-1850; release 1).** Until now, when an existing test expected the bug, the run stopped BEFORE any code was written and a person approved a change to that test with nothing to show it could ever pass, and the tests were found one at a time: QTRIA-23 approved a change that moved the status line off 401 and left `expect(body).toEqual({ ..., error: "Unauthorized" })`, which no fix can satisfy, and spent all three stops. Now, when the project switches it on (`packet.fixFirst`; `QUIKPILOT_FIX_FIRST=off` turns it off without a rebuild) the run speaks `codegen-loop-8`: a `report_test_conflict` is a PROPOSAL that does not end the run, the AI writes the tests and the fix and reports every existing test its fix breaks, and at its DONE the runner proves the proposals (`proofCheck.ts`): it runs the project's WHOLE suite (the related-tests planner off, a fresh tool, outside the AI's run allowance) with the fix and every proposed change written over the old code. A proposal whose test still fails is sent back with its name ("change EVERY expectation of it"), and an existing test the fix broke that no proposal covers is sent back by name (never a failure message: QUIKTR-1474), at most twice; one that still fails after that is not offered to a person. Then ONE stop, as before, whose proposals carry `oldCodeChecked` (fails on the old code with the change alone), `newCode` (`passes` / `fails` / `not_checked`) and `newEndLine` (where the changed test now ends, for showing the whole test); no time, no answer or a list of failures cut to fit is `not_checked`, never proven. The tests phase hands its proposals to the code phase. An AI Runtime that refuses `codegen-loop-8` is asked again as loop-7 (nothing else changes), a fix turn stays loop-7, and a project that did not switch it on sends and receives exactly what it did. Release 2 (keeping the fix across the stop) is not in this version: the next job still writes the code again. Also in rc.58: everything in rc.57.
170
172
 
package/dist/index.js CHANGED
@@ -35641,16 +35641,62 @@ var SECRET_SHAPED_FILES = [
35641
35641
  "**/*credentials*.json",
35642
35642
  "**/docker-compose*"
35643
35643
  ];
35644
+ var CREDENTIAL_FILES = [
35645
+ // Package managers
35646
+ "**/.pypirc",
35647
+ "**/pip.conf",
35648
+ "**/pip.ini",
35649
+ "**/.netrc",
35650
+ "**/_netrc",
35651
+ "**/.git-credentials",
35652
+ "**/.yarnrc",
35653
+ "**/.yarnrc.yml",
35654
+ "**/.cargo/credentials",
35655
+ "**/.cargo/credentials.toml",
35656
+ "**/.gem/credentials",
35657
+ "**/.bundle/config",
35658
+ "**/settings-security.xml",
35659
+ "**/.mvn/settings.xml",
35660
+ "**/.m2/settings.xml",
35661
+ "settings.xml",
35662
+ "auth.json",
35663
+ "**/.composer/auth.json",
35664
+ // Cloud, cluster and infrastructure logins
35665
+ "**/.aws/credentials",
35666
+ "**/.docker/config.json",
35667
+ "**/.dockercfg",
35668
+ "**/.kube/config",
35669
+ "**/kubeconfig",
35670
+ "**/*.tfstate",
35671
+ "**/*.tfstate.backup",
35672
+ "**/.terraformrc",
35673
+ "**/.vault-token",
35674
+ "**/.htpasswd",
35675
+ // Private keys and key stores
35676
+ "**/id_rsa",
35677
+ "**/id_ed25519",
35678
+ "**/id_ecdsa",
35679
+ "**/*.p12",
35680
+ "**/*.pfx",
35681
+ "**/*.jks",
35682
+ "**/*.keystore",
35683
+ "**/*.ppk"
35684
+ ];
35685
+ var GIT_INTERNALS = [".git/**"];
35644
35686
  function withExtra(denied, extra) {
35645
35687
  const have = new Set(denied);
35646
35688
  return [...denied, ...extra.filter((p) => !have.has(p))];
35647
35689
  }
35648
35690
  function writeDenied(denied) {
35649
- return withExtra(denied, OTHER_LOCK_FILES);
35691
+ return withExtra(denied, [...OTHER_LOCK_FILES, ...CREDENTIAL_FILES, ...GIT_INTERNALS]);
35650
35692
  }
35651
35693
  function readDenied(denied) {
35652
35694
  return withExtra(writeDenied(denied), SECRET_SHAPED_FILES);
35653
35695
  }
35696
+ function listingForWire(listing, deniedPaths) {
35697
+ const denied = readDenied(deniedPaths);
35698
+ return listing.filter((p) => matchesDeniedPath(p, denied) === null);
35699
+ }
35654
35700
  var NON_TEXT_EXTENSION_RE = /\.(png|jpe?g|gif|webp|avif|ico|icns|bmp|tiff?|psd|mp[34]|m4a|mov|avi|webm|mkv|wav|ogg|flac|woff2?|ttf|otf|eot|pdf|zip|gz|tgz|bz2|xz|7z|rar|jar|war|wasm|exe|dll|so|dylib|pyc|class|o|a|sqlite3?|db)$/i;
35655
35701
  function isGeneratedText(lf) {
35656
35702
  let start3 = 0;
@@ -35665,6 +35711,159 @@ function isGeneratedText(lf) {
35665
35711
  }
35666
35712
  var GENERATED_FILE_MESSAGE = "This file is generated (its first lines say so), so a change here would be overwritten. Change the file it is generated from instead.";
35667
35713
 
35714
+ // src/runtimeReplyError.ts
35715
+ var RuntimeReplyError = class extends Error {
35716
+ summary;
35717
+ constructor(message, summary) {
35718
+ super(message);
35719
+ this.name = "RuntimeReplyError";
35720
+ this.summary = summary;
35721
+ }
35722
+ };
35723
+
35724
+ // src/failureReason.ts
35725
+ var MAX_FAILURE_REASON = 1e3;
35726
+ var MIN_SECRET_LENGTH = 8;
35727
+ var CREDENTIAL_PATTERNS = [
35728
+ /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,
35729
+ /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
35730
+ /x-access-token:[^@\s'"]+/gi,
35731
+ // Only the header form ("Authorization: basic <token>"), or a bearer value that contains a digit: a bare
35732
+ // "basic authentication" or "bearer of the news" is prose, not a credential.
35733
+ /\bauthorization:\s*(?:basic|bearer|token)\s+[^\s'"]{8,}/gi,
35734
+ /\bbearer\s+(?=[A-Za-z0-9._~+/=-]*\d)[A-Za-z0-9._~+/=-]{12,}/gi,
35735
+ // A signed JWT is three dot-separated segments; QuikPilot's own run token is an encrypted JWT (alg dir) of five, the
35736
+ // second one empty. The run token is also matched by exact value, but one that has expired or rotated is not the
35737
+ // current value, so its shape has to catch it.
35738
+ /\beyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){2,4}/g
35739
+ ];
35740
+ function failureSummary(err2) {
35741
+ if (err2 instanceof RuntimeReplyError) return err2.summary;
35742
+ return err2 instanceof Error ? err2.message : String(err2);
35743
+ }
35744
+ function scrubSecrets(message, secrets = []) {
35745
+ let text3 = message;
35746
+ for (const secret of secrets) {
35747
+ if (secret.length >= MIN_SECRET_LENGTH) text3 = text3.split(secret).join("***");
35748
+ }
35749
+ for (const pattern of CREDENTIAL_PATTERNS) text3 = text3.replace(pattern, "***");
35750
+ return text3;
35751
+ }
35752
+ function describeFailureReason(message, secrets = []) {
35753
+ let text3 = scrubSecrets(message, secrets);
35754
+ text3 = text3.replace(/\s*\n\s*/g, " | ").trim();
35755
+ return text3.length > MAX_FAILURE_REASON ? `${text3.slice(0, MAX_FAILURE_REASON)}\u2026` : text3;
35756
+ }
35757
+
35758
+ // src/scrubForModel.ts
35759
+ var REDACTION_WORDS = ["credential", "private_key", "cloud_key", "url_credentials", "assigned_secret"];
35760
+ function emptyRedactionCounts() {
35761
+ return { credential: 0, private_key: 0, cloud_key: 0, url_credentials: 0, assigned_secret: 0 };
35762
+ }
35763
+ function nonZero(counts) {
35764
+ const out2 = {};
35765
+ for (const w of REDACTION_WORDS) if (counts[w] > 0) out2[w] = counts[w];
35766
+ return out2;
35767
+ }
35768
+ function addRedactionCounts(into, more) {
35769
+ for (const word of REDACTION_WORDS) into[word] += more[word];
35770
+ }
35771
+ var NAMES = "password|passwd|pwd|secret|token|api[_-]?key|access_key|private_key|credential";
35772
+ var PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY-----|$)/g;
35773
+ var CLOUD_KEYS = [
35774
+ /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g,
35775
+ /\bxox[abeprs]-[A-Za-z0-9-]{10,}/g,
35776
+ /\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g,
35777
+ /\bAIza[0-9A-Za-z_-]{35}/g,
35778
+ // QUIKTR-1703: package-registry and container-registry tokens, which have a shape of their own (npm automation tokens, PyPI API tokens,
35779
+ // GitLab personal access tokens, Docker Hub personal access tokens).
35780
+ /\bnpm_[A-Za-z0-9]{30,}\b/g,
35781
+ /\bpypi-[A-Za-z0-9_-]{30,}/g,
35782
+ /\bglpat-[A-Za-z0-9_-]{20,}/g,
35783
+ /\bdckr_pat_[A-Za-z0-9_-]{20,}/g
35784
+ ];
35785
+ var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi;
35786
+ var ASSIGNED_QUOTED = new RegExp(`((?<![\\w.-])[\\w.-]{0,40}(?:${NAMES})[\\w.-]{0,40}["']?\\s*[:=]\\s*)(["'])[^"'\\s]{8,}\\2`, "gi");
35787
+ var ASSIGNED_ENV = new RegExp(
35788
+ `^((?:\\d+\\t)?\\s*(?:export\\s+)?[A-Z0-9_]*(?:${NAMES.toUpperCase().replace(/\[_-\]\?/g, "_?")})[A-Z0-9_]*[ \\t]*=[ \\t]*)(?!["'])\\S{8,}`,
35789
+ "gm"
35790
+ );
35791
+ var NAMES_CONFIG = `${NAMES}|passphrase|access[_-]?key|account[_-]?key|_auth(?![a-z])`;
35792
+ var CONFIG_REFERENCE = "(?!\\$\\{|\\$\\(|%\\(|%[A-Za-z_]+%|\\{\\{|\\*\\*\\*)";
35793
+ var CONFIG_PLAIN = "(?!(?:true|false|null|none|yes|no|on|off|\\d{1,3})[ \\t]*(?:[#;]|$))";
35794
+ var CONFIG_QUOTED = new RegExp(
35795
+ `((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}["']?[ \\t]*[:=][ \\t]*)(["'])${CONFIG_REFERENCE}[^"'\\r\\n]+\\2`,
35796
+ "gi"
35797
+ );
35798
+ var CONFIG_UNQUOTED = new RegExp(
35799
+ `((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}[ \\t]*[:=][ \\t]*)${CONFIG_REFERENCE}(?!["'])${CONFIG_PLAIN}[^\\s#;][^\\r\\n]*$`,
35800
+ "gim"
35801
+ );
35802
+ var CONFIG_INLINE = /(?<![\w.-])((?:password|passwd|pwd|passphrase|secret|accountkey|sharedaccesskey|access[_-]?key)[ \t]*=[ \t]*)(?!\$\{|["']|\*\*\*)[^;&"'\s<]+/gi;
35803
+ var CONFIG_XML_ELEMENT = /<([\w.:-]*(?:password|passwd|pwd|passphrase|secret|token|api-?key|access-?key|credential)[\w.:-]*)((?:\s[^>]*)?)>(?![ \t\r\n]*(?:\$\{|\*\*\*))([^<]*\S[^<]*)<\/\1>/gi;
35804
+ var CONFIG_XML_ATTRIBUTE = /(key[ \t]*=[ \t]*["'][^"']*(?:password|token|secret|api-?key)[^"']*["'][ \t]+value[ \t]*=[ \t]*["'])(?!\$\{|\*\*\*)[^"']+(["'])/gi;
35805
+ var CONFIG_FILE = /(^|\/)\.env(\.[^/]*)?$|\.env$|\.(?:properties|ini|cfg|conf|config|toml|ya?ml|xml)$|(^|\/)(?:appsettings|config|settings|secrets|credentials)[^/]*\.json$/i;
35806
+ var TRANSLATION_FILE = /(^|\/)(?:locales?|i18n|l10n|lang|languages|translations?|messages)\/|(^|\/)(?:messages|labels|strings|bundle)[\w-]*\.properties$|_[a-z]{2}(?:_[A-Z]{2})?\.properties$/;
35807
+ function isConfigPath(path) {
35808
+ return CONFIG_FILE.test(path) && !TRANSLATION_FILE.test(path);
35809
+ }
35810
+ function modeForPath(path, base) {
35811
+ return path !== void 0 && isConfigPath(path) ? "config" : base;
35812
+ }
35813
+ function configPathInDiff(text3) {
35814
+ for (const m of text3.matchAll(/^\+\+\+ b\/(.+)$/gm)) if (isConfigPath(m[1])) return m[1];
35815
+ return void 0;
35816
+ }
35817
+ function replaceCounting(text3, pattern, replacement, onHit) {
35818
+ return text3.replace(pattern, (...args2) => {
35819
+ onHit();
35820
+ return typeof replacement === "function" ? replacement(...args2) : replacement;
35821
+ });
35822
+ }
35823
+ function scrubForModel(input, secrets = [], mode = "look") {
35824
+ const counts = emptyRedactionCounts();
35825
+ let text3 = input;
35826
+ text3 = replaceCounting(text3, PRIVATE_KEY, "***", () => counts.private_key += 1);
35827
+ for (const secret of secrets) {
35828
+ if (secret.length < MIN_SECRET_LENGTH) continue;
35829
+ const parts2 = text3.split(secret);
35830
+ if (parts2.length > 1) {
35831
+ counts.credential += parts2.length - 1;
35832
+ text3 = parts2.join("***");
35833
+ }
35834
+ }
35835
+ for (const pattern of CREDENTIAL_PATTERNS) text3 = replaceCounting(text3, pattern, "***", () => counts.credential += 1);
35836
+ for (const pattern of CLOUD_KEYS) text3 = replaceCounting(text3, pattern, "***", () => counts.cloud_key += 1);
35837
+ text3 = replaceCounting(text3, URL_CREDENTIALS, (_all, scheme) => `${scheme}***@`, () => counts.url_credentials += 1);
35838
+ if (mode === "look" || mode === "config") {
35839
+ text3 = replaceCounting(text3, ASSIGNED_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, () => counts.assigned_secret += 1);
35840
+ text3 = replaceCounting(text3, ASSIGNED_ENV, (_all, name2) => `${name2}***`, () => counts.assigned_secret += 1);
35841
+ }
35842
+ if (mode === "config") {
35843
+ const hit = () => counts.assigned_secret += 1;
35844
+ text3 = replaceCounting(text3, CONFIG_XML_ELEMENT, (_all, tag, attrs) => `<${tag}${attrs}>***</${tag}>`, hit);
35845
+ text3 = replaceCounting(text3, CONFIG_XML_ATTRIBUTE, (_all, head, quote) => `${head}***${quote}`, hit);
35846
+ text3 = replaceCounting(text3, CONFIG_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, hit);
35847
+ text3 = replaceCounting(text3, CONFIG_INLINE, (_all, name2) => `${name2}***`, hit);
35848
+ text3 = replaceCounting(text3, CONFIG_UNQUOTED, (_all, name2) => `${name2}***`, hit);
35849
+ }
35850
+ return { text: text3, counts };
35851
+ }
35852
+ function makeCodeScrubber(secrets, onHits) {
35853
+ return (text3, path) => {
35854
+ const r = scrubForModel(text3, secrets, modeForPath(path, "code"));
35855
+ if (onHits && REDACTION_WORDS.some((w) => r.counts[w] > 0)) onHits(r.counts);
35856
+ return r.text;
35857
+ };
35858
+ }
35859
+ function scrubEntriesForModel(entries, secrets, keep) {
35860
+ return entries.map((e) => {
35861
+ if (keep && "path" in e && keep.has(e.path)) return e;
35862
+ const path = "path" in e && typeof e.path === "string" ? e.path : void 0;
35863
+ return { ...e, content: scrubForModel(e.content, secrets, modeForPath(path, "code")).text };
35864
+ });
35865
+ }
35866
+
35668
35867
  // src/definitions.ts
35669
35868
  var MAX_NAME_CHARS = 80;
35670
35869
  var MAX_DEFINITIONS = 2e3;
@@ -37252,15 +37451,18 @@ function prepareGrep(args2, env2) {
37252
37451
  }
37253
37452
  };
37254
37453
  }
37255
- function scrubAnswer(name2, r, scrub) {
37454
+ function scrubAnswer(name2, r, scrub, argPath) {
37256
37455
  const out2 = { ...r };
37257
- if (r.status === "ambiguous" && typeof r.message === "string") out2.message = scrub(r.message);
37456
+ if (r.status === "ambiguous" && typeof r.message === "string") out2.message = scrub(r.message, argPath);
37258
37457
  const o = r.output;
37259
37458
  if (!isPlainObject(o)) return out2;
37260
- if (name2 === "read_file" && typeof o.content === "string") out2.output = { ...o, content: scrub(o.content) };
37261
- else if (name2 === "show_changes" && typeof o.text === "string") out2.output = { ...o, text: scrub(o.text) };
37459
+ if (name2 === "read_file" && typeof o.content === "string") out2.output = { ...o, content: scrub(o.content, typeof o.path === "string" ? o.path : argPath) };
37460
+ else if (name2 === "show_changes" && typeof o.text === "string") out2.output = { ...o, text: scrub(o.text, configPathInDiff(o.text)) };
37262
37461
  else if (name2 === "grep" && Array.isArray(o.matches)) {
37263
- out2.output = { ...o, matches: o.matches.map((m) => isPlainObject(m) && typeof m.text === "string" ? { ...m, text: scrub(m.text) } : m) };
37462
+ out2.output = {
37463
+ ...o,
37464
+ matches: o.matches.map((m) => isPlainObject(m) && typeof m.text === "string" ? { ...m, text: scrub(m.text, typeof m.path === "string" ? m.path : void 0) } : m)
37465
+ };
37264
37466
  }
37265
37467
  return out2;
37266
37468
  }
@@ -37314,7 +37516,10 @@ function executeToolCall(call, env2, ledger) {
37314
37516
  } catch {
37315
37517
  executed = { result: { status: "unreadable", reason: "io", message: "That could not be read." } };
37316
37518
  }
37317
- if (env2.scrub) executed = { ...executed, result: scrubAnswer(call.name, executed.result, env2.scrub) };
37519
+ if (env2.scrub) {
37520
+ const argPath = isPlainObject(call.args) && typeof call.args.path === "string" ? call.args.path : void 0;
37521
+ executed = { ...executed, result: scrubAnswer(call.name, executed.result, env2.scrub, argPath) };
37522
+ }
37318
37523
  if (env2.guidance && call.name === "read_file" && executed.result.status === "ok" && executed.read && isPlainObject(executed.result.output)) {
37319
37524
  const guidance = env2.guidance.forRead(executed.read.path);
37320
37525
  if (guidance) executed = { ...executed, result: { ...executed.result, output: { ...executed.result.output, guidance } } };
@@ -38432,8 +38637,65 @@ var ALLOWED_NAMES = /* @__PURE__ */ new Set([
38432
38637
  "VOLTA_HOME",
38433
38638
  "COREPACK_HOME",
38434
38639
  "PYENV_ROOT",
38435
- "RBENV_ROOT"
38640
+ "RBENV_ROOT",
38641
+ // QUIKTR-1703: settings a project's own steps export for its tests and that carry no secret: where Go, Python, .NET and Rust look for
38642
+ // things and how they behave. A path, a flag, a pattern list; never a login (those are withheld by name below).
38643
+ "GOPRIVATE",
38644
+ "GONOSUMDB",
38645
+ "GONOSUMCHECK",
38646
+ "GOSUMDB",
38647
+ "GOTOOLCHAIN",
38648
+ "GOOS",
38649
+ "GOARCH",
38650
+ "CGO_ENABLED",
38651
+ "VIRTUAL_ENV",
38652
+ "PYTHONPATH",
38653
+ "PYTHONDONTWRITEBYTECODE",
38654
+ "PYTHONUNBUFFERED",
38655
+ "PYTHONHASHSEED",
38656
+ "PIP_CACHE_DIR",
38657
+ "PIP_NO_INPUT",
38658
+ "PIP_DISABLE_PIP_VERSION_CHECK",
38659
+ "UV_CACHE_DIR",
38660
+ "UV_PYTHON",
38661
+ "NODE_ENV",
38662
+ "NUGET_PACKAGES",
38663
+ "NUGET_HTTP_CACHE_PATH",
38664
+ "CARGO_TARGET_DIR",
38665
+ "CARGO_INCREMENTAL",
38666
+ "RUST_BACKTRACE",
38667
+ "RUST_LOG",
38668
+ // ... and these, which CAN carry a login inside their value (a registry address with `user:pass@`, a Java option `-D...password=`):
38669
+ // kept only when the value is clean (`valueIsClean`).
38670
+ "GOPROXY",
38671
+ "PIP_INDEX_URL",
38672
+ "PIP_EXTRA_INDEX_URL",
38673
+ "UV_INDEX_URL",
38674
+ "UV_DEFAULT_INDEX",
38675
+ "MAVEN_OPTS",
38676
+ "JAVA_TOOL_OPTIONS",
38677
+ "JAVA_OPTS",
38678
+ "GRADLE_OPTS",
38679
+ "RUSTFLAGS"
38680
+ ]);
38681
+ var VALUE_CHECKED_NAMES = /* @__PURE__ */ new Set([
38682
+ "GOPROXY",
38683
+ "PIP_INDEX_URL",
38684
+ "PIP_EXTRA_INDEX_URL",
38685
+ "UV_INDEX_URL",
38686
+ "UV_DEFAULT_INDEX",
38687
+ "MAVEN_OPTS",
38688
+ "JAVA_TOOL_OPTIONS",
38689
+ "JAVA_OPTS",
38690
+ "GRADLE_OPTS",
38691
+ "RUSTFLAGS"
38436
38692
  ]);
38693
+ var OPTION_WITH_LOGIN = /(?:^|\s)(?:-D|--)[\w.-]*(?:password|passwd|pwd|token|secret|credential|api[_-]?key|passphrase)[\w.-]*[= ]/i;
38694
+ function valueIsClean(value) {
38695
+ if (OPTION_WITH_LOGIN.test(value)) return false;
38696
+ const counts = scrubForModel(value, [], "code").counts;
38697
+ return REDACTION_WORDS.every((word) => counts[word] === 0);
38698
+ }
38437
38699
  var ALLOWED_PREFIXES = [
38438
38700
  "LC_",
38439
38701
  "RUNNER_",
@@ -38457,22 +38719,25 @@ var ALWAYS_WITHHELD = /* @__PURE__ */ new Set([
38457
38719
  "GITHUB_STATE",
38458
38720
  "GITHUB_STEP_SUMMARY"
38459
38721
  ]);
38460
- var CREDENTIAL_NAME = /(token|secret|password|passwd|credential|private_?key|api_?key)/i;
38722
+ var CREDENTIAL_NAME = /(token|secret|password|passwd|credential|private_?key|api_?key|(?:^|_)auth(?:$|_))/i;
38461
38723
  function isAllowed(name2) {
38462
38724
  if (ALWAYS_WITHHELD.has(name2) || CREDENTIAL_NAME.test(name2)) return false;
38463
38725
  if (ALLOWED_NAMES.has(name2)) return true;
38464
38726
  return ALLOWED_PREFIXES.some((prefix) => name2.startsWith(prefix));
38465
38727
  }
38728
+ function keeps(name2, value) {
38729
+ return isAllowed(name2) && (!VALUE_CHECKED_NAMES.has(name2) || valueIsClean(value));
38730
+ }
38466
38731
  function commandEnv(source = process.env) {
38467
38732
  const out2 = {};
38468
38733
  for (const [name2, value] of Object.entries(source)) {
38469
38734
  if (value === void 0) continue;
38470
- if (isAllowed(name2)) out2[name2] = value;
38735
+ if (keeps(name2, value)) out2[name2] = value;
38471
38736
  }
38472
38737
  return out2;
38473
38738
  }
38474
38739
  function withheldNames(source = process.env) {
38475
- return Object.entries(source).filter(([name2, value]) => value !== void 0 && !isAllowed(name2)).map(([name2]) => name2).sort();
38740
+ return Object.entries(source).filter(([name2, value]) => value !== void 0 && !keeps(name2, value)).map(([name2]) => name2).sort();
38476
38741
  }
38477
38742
 
38478
38743
  // src/commands.ts
@@ -40184,16 +40449,6 @@ function spendSoFar() {
40184
40449
  var import_node_fs11 = require("node:fs");
40185
40450
  var import_node_path13 = require("node:path");
40186
40451
 
40187
- // src/runtimeReplyError.ts
40188
- var RuntimeReplyError = class extends Error {
40189
- summary;
40190
- constructor(message, summary) {
40191
- super(message);
40192
- this.name = "RuntimeReplyError";
40193
- this.summary = summary;
40194
- }
40195
- };
40196
-
40197
40452
  // src/envelope.ts
40198
40453
  var HARD_FAILURE_CODES = /* @__PURE__ */ new Set(["SEMANTIC_MISMATCH", "CONTRACT_REJECTED"]);
40199
40454
  function checkHardFailure(envelope, useCase, target) {
@@ -40224,108 +40479,6 @@ function unwrapExecute(envelope, useCase) {
40224
40479
  return envelope.structuredJson;
40225
40480
  }
40226
40481
 
40227
- // src/failureReason.ts
40228
- var MAX_FAILURE_REASON = 1e3;
40229
- var MIN_SECRET_LENGTH = 8;
40230
- var CREDENTIAL_PATTERNS = [
40231
- /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,
40232
- /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
40233
- /x-access-token:[^@\s'"]+/gi,
40234
- // Only the header form ("Authorization: basic <token>"), or a bearer value that contains a digit: a bare
40235
- // "basic authentication" or "bearer of the news" is prose, not a credential.
40236
- /\bauthorization:\s*(?:basic|bearer|token)\s+[^\s'"]{8,}/gi,
40237
- /\bbearer\s+(?=[A-Za-z0-9._~+/=-]*\d)[A-Za-z0-9._~+/=-]{12,}/gi,
40238
- // A signed JWT is three dot-separated segments; QuikPilot's own run token is an encrypted JWT (alg dir) of five, the
40239
- // second one empty. The run token is also matched by exact value, but one that has expired or rotated is not the
40240
- // current value, so its shape has to catch it.
40241
- /\beyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){2,4}/g
40242
- ];
40243
- function failureSummary(err2) {
40244
- if (err2 instanceof RuntimeReplyError) return err2.summary;
40245
- return err2 instanceof Error ? err2.message : String(err2);
40246
- }
40247
- function scrubSecrets(message, secrets = []) {
40248
- let text3 = message;
40249
- for (const secret of secrets) {
40250
- if (secret.length >= MIN_SECRET_LENGTH) text3 = text3.split(secret).join("***");
40251
- }
40252
- for (const pattern of CREDENTIAL_PATTERNS) text3 = text3.replace(pattern, "***");
40253
- return text3;
40254
- }
40255
- function describeFailureReason(message, secrets = []) {
40256
- let text3 = scrubSecrets(message, secrets);
40257
- text3 = text3.replace(/\s*\n\s*/g, " | ").trim();
40258
- return text3.length > MAX_FAILURE_REASON ? `${text3.slice(0, MAX_FAILURE_REASON)}\u2026` : text3;
40259
- }
40260
-
40261
- // src/scrubForModel.ts
40262
- var REDACTION_WORDS = ["credential", "private_key", "cloud_key", "url_credentials", "assigned_secret"];
40263
- function emptyRedactionCounts() {
40264
- return { credential: 0, private_key: 0, cloud_key: 0, url_credentials: 0, assigned_secret: 0 };
40265
- }
40266
- function nonZero(counts) {
40267
- const out2 = {};
40268
- for (const w of REDACTION_WORDS) if (counts[w] > 0) out2[w] = counts[w];
40269
- return out2;
40270
- }
40271
- function addRedactionCounts(into, more) {
40272
- for (const word of REDACTION_WORDS) into[word] += more[word];
40273
- }
40274
- var NAMES = "password|passwd|pwd|secret|token|api[_-]?key|access_key|private_key|credential";
40275
- var PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY-----|$)/g;
40276
- var CLOUD_KEYS = [
40277
- /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g,
40278
- /\bxox[abeprs]-[A-Za-z0-9-]{10,}/g,
40279
- /\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g,
40280
- /\bAIza[0-9A-Za-z_-]{35}/g
40281
- ];
40282
- var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi;
40283
- var ASSIGNED_QUOTED = new RegExp(`((?<![\\w.-])[\\w.-]{0,40}(?:${NAMES})[\\w.-]{0,40}["']?\\s*[:=]\\s*)(["'])[^"'\\s]{8,}\\2`, "gi");
40284
- var ASSIGNED_ENV = new RegExp(
40285
- `^((?:\\d+\\t)?\\s*(?:export\\s+)?[A-Z0-9_]*(?:${NAMES.toUpperCase().replace(/\[_-\]\?/g, "_?")})[A-Z0-9_]*[ \\t]*=[ \\t]*)(?!["'])\\S{8,}`,
40286
- "gm"
40287
- );
40288
- function replaceCounting(text3, pattern, replacement, onHit) {
40289
- return text3.replace(pattern, (...args2) => {
40290
- onHit();
40291
- return typeof replacement === "function" ? replacement(...args2) : replacement;
40292
- });
40293
- }
40294
- function scrubForModel(input, secrets = [], mode = "look") {
40295
- const counts = emptyRedactionCounts();
40296
- let text3 = input;
40297
- text3 = replaceCounting(text3, PRIVATE_KEY, "***", () => counts.private_key += 1);
40298
- for (const secret of secrets) {
40299
- if (secret.length < MIN_SECRET_LENGTH) continue;
40300
- const parts2 = text3.split(secret);
40301
- if (parts2.length > 1) {
40302
- counts.credential += parts2.length - 1;
40303
- text3 = parts2.join("***");
40304
- }
40305
- }
40306
- for (const pattern of CREDENTIAL_PATTERNS) text3 = replaceCounting(text3, pattern, "***", () => counts.credential += 1);
40307
- for (const pattern of CLOUD_KEYS) text3 = replaceCounting(text3, pattern, "***", () => counts.cloud_key += 1);
40308
- text3 = replaceCounting(text3, URL_CREDENTIALS, (_all, scheme) => `${scheme}***@`, () => counts.url_credentials += 1);
40309
- if (mode === "look") {
40310
- text3 = replaceCounting(text3, ASSIGNED_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, () => counts.assigned_secret += 1);
40311
- text3 = replaceCounting(text3, ASSIGNED_ENV, (_all, name2) => `${name2}***`, () => counts.assigned_secret += 1);
40312
- }
40313
- return { text: text3, counts };
40314
- }
40315
- function makeCodeScrubber(secrets, onHits) {
40316
- return (text3) => {
40317
- const r = scrubForModel(text3, secrets, "code");
40318
- if (onHits && REDACTION_WORDS.some((w) => r.counts[w] > 0)) onHits(r.counts);
40319
- return r.text;
40320
- };
40321
- }
40322
- function scrubEntriesForModel(entries, secrets, keep) {
40323
- return entries.map((e) => {
40324
- if (keep && "path" in e && keep.has(e.path)) return e;
40325
- return { ...e, content: scrubForModel(e.content, secrets, "code").text };
40326
- });
40327
- }
40328
-
40329
40482
  // src/codegen.ts
40330
40483
  var FILE_TOO_LARGE_CODE = "CODEGEN_FILE_TOO_LARGE";
40331
40484
  var CONTEXT_TOO_LARGE_CODE = "CODEGEN_CONTEXT_TOO_LARGE";
@@ -40344,7 +40497,7 @@ function collectRunContext(target, targets, alreadyNamed, deniedPaths, readFile
40344
40497
  if (candidate.kind !== "EXISTING" || candidate.automationIds?.length) continue;
40345
40498
  if (seen.has(candidate.path)) continue;
40346
40499
  seen.add(candidate.path);
40347
- if (matchesDeniedPath(candidate.path, deniedPaths)) continue;
40500
+ if (matchesDeniedPath(candidate.path, readDenied(deniedPaths))) continue;
40348
40501
  let content;
40349
40502
  try {
40350
40503
  content = readFile(candidate.path);
@@ -40508,7 +40661,7 @@ async function runCodegen(gateway, targets, workspaceListing, requiredTests, den
40508
40661
  const lineEnding = isNewFile ? "LF" : detectLineEnding(currentContent);
40509
40662
  const wantsEdits = !isNewFile && lineEnding !== "mixed";
40510
40663
  const contextPaths = target.contextPaths ?? [];
40511
- const deniedContext = findDeniedContextPath(contextPaths, deniedPaths);
40664
+ const deniedContext = findDeniedContextPath(contextPaths, readDenied(deniedPaths));
40512
40665
  if (deniedContext) {
40513
40666
  throw new Error(
40514
40667
  `pilot.codegen contextPaths cited a denied path (${deniedContext.pattern}): ${deniedContext.path} (target ${target.path})`
@@ -40569,7 +40722,7 @@ async function runCodegen(gateway, targets, workspaceListing, requiredTests, den
40569
40722
  contractVersion: wantsEdits ? CONTRACT_VERSION_EDITS : CONTRACT_VERSION
40570
40723
  };
40571
40724
  if (isNewFile) {
40572
- contextData.workspaceListing = workspaceListing;
40725
+ contextData.workspaceListing = listingForWire(workspaceListing, deniedPaths);
40573
40726
  }
40574
40727
  if (deniedPaths.length > 0) {
40575
40728
  contextData.deniedPaths = deniedPaths;
@@ -45880,7 +46033,7 @@ function createCodegenWorkspace(args2) {
45880
46033
  const approvedBaselines = /* @__PURE__ */ new Map();
45881
46034
  for (const a of args2.approved ?? []) {
45882
46035
  const n = normaliseToolPath(a.targetPath);
45883
- if (!n.ok || matchesDeniedPath(n.path, writeDenied(args2.deniedPaths)) || !insideWriteRoot(n.path, writeRoot) || !baseFs.exists(n.path)) throw new SeedRefused();
46036
+ if (!n.ok || matchesDeniedPath(n.path, readDenied(args2.deniedPaths)) || !insideWriteRoot(n.path, writeRoot) || !baseFs.exists(n.path)) throw new SeedRefused();
45884
46037
  const loaded = loadTextForEdit(baseFs, n.path, limits.fileBytesMax);
45885
46038
  if (!loaded.ok) throw new SeedRefused();
45886
46039
  const lf = toLf(a.newContent.charCodeAt(0) === 65279 ? a.newContent.slice(1) : a.newContent);
@@ -45889,7 +46042,7 @@ function createCodegenWorkspace(args2) {
45889
46042
  }
45890
46043
  for (const kept of args2.seed ?? []) {
45891
46044
  const n = normaliseToolPath(kept.targetPath);
45892
- if (!n.ok || matchesDeniedPath(n.path, writeDenied(args2.deniedPaths)) || !insideWriteRoot(n.path, writeRoot)) throw new SeedRefused();
46045
+ if (!n.ok || matchesDeniedPath(n.path, readDenied(args2.deniedPaths)) || !insideWriteRoot(n.path, writeRoot)) throw new SeedRefused();
45893
46046
  if (baseFs.exists(n.path)) {
45894
46047
  const loaded = loadTextForEdit(baseFs, n.path, limits.fileBytesMax);
45895
46048
  if (!loaded.ok) throw new SeedRefused();
@@ -46120,7 +46273,9 @@ function createCodegenWorkspace(args2) {
46120
46273
  const env2 = {
46121
46274
  listing,
46122
46275
  visible,
46123
- deniedPaths: writeDenied(args2.deniedPaths),
46276
+ // QUIKTR-1703: the edit, write, show and revert gates use the READ list. A file the AI may not see is not one it may edit by guessing:
46277
+ // "ambiguous" quotes the line before each match, and "no_match" against "ok" tells a guess from a hit.
46278
+ deniedPaths: readDenied(args2.deniedPaths),
46124
46279
  readDenied: readDenied(args2.deniedPaths),
46125
46280
  fs: trackReads(createOverlayFs(baseFs, overlay)),
46126
46281
  limits,
@@ -48965,7 +49120,8 @@ function buildCodegenLoopArgs(p, context = collectLoopContext({
48965
49120
  automationIds: t.automationIds ?? []
48966
49121
  })),
48967
49122
  requiredTests,
48968
- ...map ? {} : { workspaceListing: p.workspaceListing }
49123
+ // QUIKTR-1703: the wire copy leaves out every file the AI may not read; `p.workspaceListing` stays whole for the runner's own checks.
49124
+ ...map ? {} : { workspaceListing: listingForWire(p.workspaceListing, p.deniedPaths) }
48969
49125
  };
48970
49126
  if (context.entries.length > 0) baseContext.contextContents = scrubEntriesForModel(context.entries, [p.gateway.token], new Set(p.targets.map((t) => t.path)));
48971
49127
  if (p.deniedPaths.length > 0) baseContext.deniedPaths = p.deniedPaths;
@@ -51262,7 +51418,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
51262
51418
  var REPORT_COPY = "final-test-report.xml";
51263
51419
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
51264
51420
  var MAX_FILES = 200;
51265
- var RUNNER_VERSION = true ? "9.3.0-rc.59" : "dev";
51421
+ var RUNNER_VERSION = true ? "9.3.0-rc.60" : "dev";
51266
51422
  function safeDestination(base, repoPath) {
51267
51423
  if (!repoPath || (0, import_node_path26.isAbsolute)(repoPath)) return null;
51268
51424
  const destination = (0, import_node_path26.resolve)(base, repoPath);
@@ -51497,7 +51653,8 @@ function buildContextData(design, workspaceListing, requiredTests, deniedPaths,
51497
51653
  const contextData = {
51498
51654
  // NESTED, NOT FLATTENED — a second vocabulary for the design shape is exactly what
51499
51655
  // QUIKTR-1034 cost.
51500
- workspaceListing,
51656
+ // QUIKTR-1703: a file the AI may not read is not named here either.
51657
+ workspaceListing: listingForWire(workspaceListing, deniedPaths),
51501
51658
  design,
51502
51659
  // QUIKTR-1065/1083 — requiredTests carried through so targeting can propose a test-file
51503
51660
  // target naming which cases it covers (§15.1's Case shape, unchanged).
@@ -51547,7 +51704,7 @@ function finalizeTargeting(body2, workspaceRoot, workspaceListing, deniedPaths)
51547
51704
  }
51548
51705
  const listing = new Set(workspaceListing);
51549
51706
  for (const target of body2.targets) {
51550
- validateTarget(target, workspaceRoot, listing, deniedPaths);
51707
+ validateTarget(target, workspaceRoot, listing, readDenied(deniedPaths));
51551
51708
  }
51552
51709
  const correctedKinds = [];
51553
51710
  const targets = body2.targets.map((target) => {
@@ -52660,7 +52817,7 @@ function scrubResult(call, result, secrets, counts, ledger) {
52660
52817
  const output = result.output;
52661
52818
  const args2 = isPlainObject4(call.args) ? call.args : {};
52662
52819
  if (call.name === "read_file" && typeof output.content === "string" && typeof output.path === "string") {
52663
- const scrubbed = scrubForModel(output.content, secrets);
52820
+ const scrubbed = scrubForModel(output.content, secrets, modeForPath(output.path, "look"));
52664
52821
  addRedactionCounts(counts, scrubbed.counts);
52665
52822
  output.content = scrubbed.text;
52666
52823
  const path = output.path;
@@ -52671,7 +52828,7 @@ function scrubResult(call, result, secrets, counts, ledger) {
52671
52828
  const hitsByPath = /* @__PURE__ */ new Map();
52672
52829
  for (const m of output.matches) {
52673
52830
  if (typeof m.text !== "string" || typeof m.path !== "string" || typeof m.line !== "number") continue;
52674
- const scrubbed = scrubForModel(m.text, secrets);
52831
+ const scrubbed = scrubForModel(m.text, secrets, modeForPath(m.path, "look"));
52675
52832
  addRedactionCounts(counts, scrubbed.counts);
52676
52833
  m.text = scrubbed.text;
52677
52834
  const list2 = hitsByPath.get(m.path) ?? [];
@@ -52863,7 +53020,7 @@ async function runInvestigateLoop(args2, deps) {
52863
53020
  }
52864
53021
 
52865
53022
  // src/investigate.ts
52866
- var INVESTIGATE_EXTRA_DENIES = ["**/.npmrc", "**/*.pem", "**/*.key", "**/*.tfvars", "**/*credentials*.json", "**/docker-compose*"];
53023
+ var INVESTIGATE_EXTRA_DENIES = [...SECRET_SHAPED_FILES];
52867
53024
  function isStringList(x) {
52868
53025
  return Array.isArray(x) && x.every((s) => typeof s === "string");
52869
53026
  }