@node9/proxy 2.47.0 → 2.47.2

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.
@@ -13,6 +13,19 @@ var __export = (target, all) => {
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
15
 
16
+ // node_modules/tsup/assets/esm_shims.js
17
+ import path from "path";
18
+ import { fileURLToPath } from "url";
19
+ var getFilename, getDirname, __dirname;
20
+ var init_esm_shims = __esm({
21
+ "node_modules/tsup/assets/esm_shims.js"() {
22
+ "use strict";
23
+ getFilename = () => fileURLToPath(import.meta.url);
24
+ getDirname = () => path.dirname(getFilename());
25
+ __dirname = /* @__PURE__ */ getDirname();
26
+ }
27
+ });
28
+
16
29
  // src/tui/dashboard/types.ts
17
30
  function windowStartMs(window, openedAt) {
18
31
  if (window === "now") return openedAt;
@@ -32,6 +45,7 @@ var EMPTY_SESSION_FORENSIC, EMPTY_SESSION_ACTIVITY, EMPTY_SESSION_SHIELDS;
32
45
  var init_types = __esm({
33
46
  "src/tui/dashboard/types.ts"() {
34
47
  "use strict";
48
+ init_esm_shims();
35
49
  EMPTY_SESSION_FORENSIC = {
36
50
  pii: 0,
37
51
  sensitiveFileRead: 0,
@@ -83,6 +97,7 @@ function hashArgs(args) {
83
97
  var init_hasher = __esm({
84
98
  "src/audit/hasher.ts"() {
85
99
  "use strict";
100
+ init_esm_shims();
86
101
  }
87
102
  });
88
103
 
@@ -101,17 +116,17 @@ var als;
101
116
  var init_forecast_context = __esm({
102
117
  "src/auth/forecast-context.ts"() {
103
118
  "use strict";
119
+ init_esm_shims();
104
120
  als = new AsyncLocalStorage();
105
121
  }
106
122
  });
107
123
 
108
124
  // packages/policy-engine/dist/index.mjs
125
+ import { fileURLToPath as fileURLToPath2 } from "url";
109
126
  import picomatch from "picomatch";
110
127
  import safeRegex from "safe-regex2";
111
128
  import pm from "picomatch";
112
- import mvdanSh2 from "mvdan-sh";
113
- import mvdanSh from "mvdan-sh";
114
- import mvdanSh3 from "mvdan-sh";
129
+ import { createRequire } from "module";
115
130
  import safeRegex2 from "safe-regex2";
116
131
  import { createHash as createHash2 } from "crypto";
117
132
  import { createHash as createHash22 } from "crypto";
@@ -697,11 +712,29 @@ function resolveCheckMap(settings) {
697
712
  for (const c of CHECKS) out[c.id] = checkValue(settings, c.id);
698
713
  return out;
699
714
  }
715
+ function getSyntax() {
716
+ if (syntax === null) {
717
+ const req = createRequire(__filename2);
718
+ syntax = req("mvdan-sh").syntax;
719
+ }
720
+ return syntax;
721
+ }
722
+ function lazy(compute) {
723
+ let done = false;
724
+ let value;
725
+ return () => {
726
+ if (!done) {
727
+ value = compute();
728
+ done = true;
729
+ }
730
+ return value;
731
+ };
732
+ }
700
733
  function isGoNode(v) {
701
734
  return v !== null && typeof v === "object" && typeof v.Pos === "function";
702
735
  }
703
736
  function toPlainTree(goNode) {
704
- const kind = syntax.NodeType(goNode);
737
+ const kind = getSyntax().NodeType(goNode);
705
738
  const out = { kind, pos: goNode.Pos().Offset(), end: goNode.End().Offset() };
706
739
  const spec = KINDS[kind];
707
740
  if (!spec) {
@@ -891,12 +924,12 @@ function judgeInlineCode(language, code, isProtected) {
891
924
  category
892
925
  };
893
926
  }
894
- const path48 = protectedLiteral(text, isProtected);
895
- if (path48) {
927
+ const path210 = protectedLiteral(text, isProtected);
928
+ if (path210) {
896
929
  return {
897
930
  outcome: "dangerous",
898
931
  what: WHAT["reads-protected"],
899
- evidence: path48.slice(0, 60),
932
+ evidence: path210.slice(0, 60),
900
933
  category: "reads-protected"
901
934
  };
902
935
  }
@@ -932,7 +965,7 @@ function parseShared(command) {
932
965
  }
933
966
  let parsed;
934
967
  try {
935
- parsed = toPlainTree(sharedParser.Parse(command, "cmd"));
968
+ parsed = toPlainTree(sharedParser().Parse(command, "cmd"));
936
969
  } catch {
937
970
  parsed = PARSE_FAIL;
938
971
  }
@@ -1480,7 +1513,7 @@ function redirStdinOps() {
1480
1513
  }
1481
1514
  function deriveBinaryOp(sample) {
1482
1515
  try {
1483
- const f = toPlainTree(sharedParser.Parse(sample, "cmd"));
1516
+ const f = toPlainTree(sharedParser().Parse(sample, "cmd"));
1484
1517
  let op = -1;
1485
1518
  walk(f, (node) => {
1486
1519
  const n = node;
@@ -1924,7 +1957,7 @@ function recordTopLevelAssignments(f) {
1924
1957
  }
1925
1958
  function probeBinOp(src) {
1926
1959
  try {
1927
- const cmd = toPlainTree(syntax2.NewParser().Parse(src, "probe"))?.Stmts?.[0]?.Cmd;
1960
+ const cmd = toPlainTree(getSyntax().NewParser().Parse(src, "probe"))?.Stmts?.[0]?.Cmd;
1928
1961
  if (cmd && cmd.kind === "BinaryCmd") return cmd.Op;
1929
1962
  } catch {
1930
1963
  }
@@ -1934,9 +1967,9 @@ function recordTopLevelStmt(stmt) {
1934
1967
  if (!stmt || !stmt.Cmd) return false;
1935
1968
  const t = stmt.Cmd.kind;
1936
1969
  if (t === "BinaryCmd") {
1937
- if (!AND_OR_OPS.has(stmt.Cmd.Op)) return false;
1970
+ if (!andOrOps().AND_OR_OPS.has(stmt.Cmd.Op)) return false;
1938
1971
  if (!recordTopLevelStmt(stmt.Cmd.X)) return false;
1939
- if (stmt.Cmd.Op === AND_OP) return recordTopLevelStmt(stmt.Cmd.Y);
1972
+ if (stmt.Cmd.Op === andOrOps().AND_OP) return recordTopLevelStmt(stmt.Cmd.Y);
1940
1973
  return true;
1941
1974
  }
1942
1975
  if (t !== "CallExpr" && t !== "DeclClause") return false;
@@ -2387,7 +2420,7 @@ function isWaivableCleanupTarget(p) {
2387
2420
  }
2388
2421
  function deriveRedirOp(sample) {
2389
2422
  try {
2390
- const f = toPlainTree(sharedParser.Parse(sample, "cmd"));
2423
+ const f = toPlainTree(sharedParser().Parse(sample, "cmd"));
2391
2424
  let op = -1;
2392
2425
  walk(f, (node) => {
2393
2426
  const n = node;
@@ -2406,9 +2439,9 @@ function collectSameCommandCreations(f) {
2406
2439
  for (const stmt of stmts) {
2407
2440
  if (!stmt || !stmt.Cmd || stmt.Cmd.kind !== "CallExpr") continue;
2408
2441
  const redirs = stmt.Redirs || [];
2409
- if (!redirs.some((r) => r && REDIR_HEREDOC_OPS.has(r.Op))) continue;
2442
+ if (!redirs.some((r) => r && REDIR_HEREDOC_OPS().has(r.Op))) continue;
2410
2443
  for (const r of redirs) {
2411
- if (r && REDIR_TRUNCATE_OPS.has(r.Op) && r.N == null) {
2444
+ if (r && REDIR_TRUNCATE_OPS().has(r.Op) && r.N == null) {
2412
2445
  const w = resolveWordLiteral(r.Word);
2413
2446
  if (w) created.add(stripDotSlash(w));
2414
2447
  }
@@ -2978,7 +3011,7 @@ function literalShellPayload(words, name) {
2978
3011
  function jailedRedirectRead(stmt) {
2979
3012
  const redirs = stmt.Redirs || [];
2980
3013
  for (const r of redirs) {
2981
- if (!r || !REDIR_FILE_IN_OPS.has(r.Op)) continue;
3014
+ if (!r || !REDIR_FILE_IN_OPS().has(r.Op)) continue;
2982
3015
  const p = resolveWordLiteral(r.Word);
2983
3016
  if (p === null || p === "") continue;
2984
3017
  const hit = matchSensitivePath(p);
@@ -3060,9 +3093,9 @@ function ruleServerMatches(rule, serverLabel) {
3060
3093
  if (rule.notServer && label2 && matchesPattern(label2, rule.notServer)) return false;
3061
3094
  return true;
3062
3095
  }
3063
- function getNestedValue(obj, path48) {
3096
+ function getNestedValue(obj, path210) {
3064
3097
  if (!obj || typeof obj !== "object") return null;
3065
- const segments2 = path48.split(".");
3098
+ const segments2 = path210.split(".");
3066
3099
  for (const seg of segments2) {
3067
3100
  if (FORBIDDEN_PATH_SEGMENTS.has(seg)) return null;
3068
3101
  }
@@ -3274,7 +3307,7 @@ function runnablePrefix(command) {
3274
3307
  let text = command;
3275
3308
  for (let attempt = 0; attempt < 32; attempt++) {
3276
3309
  try {
3277
- return toPlainTree(syntax3.NewParser().Parse(text, ""));
3310
+ return toPlainTree(getSyntax().NewParser().Parse(text, ""));
3278
3311
  } catch (error) {
3279
3312
  const message = String(typeof error?.Error === "function" ? error.Error() : error?.message);
3280
3313
  const line = Number(/^(\d+):/.exec(message)?.[1]);
@@ -3319,7 +3352,7 @@ function wordValues(word, state) {
3319
3352
  const name = node.Param?.Value;
3320
3353
  const known = name === "PWD" ? state.cwd : state.vars.get(name);
3321
3354
  if (node.Exp) {
3322
- if (!DEFAULT_OPS.has(node.Exp.Op)) return null;
3355
+ if (!ops().DEFAULT_OPS.has(node.Exp.Op)) return null;
3323
3356
  if (known && known.length) return toWords(known, quoted);
3324
3357
  const fallback = expand(node.Exp.Word?.Parts ?? [], quoted);
3325
3358
  return fallback.dynamic ? null : fallback.out.map(asWord);
@@ -3844,7 +3877,7 @@ function collectShellFileAccesses(command, context = {}) {
3844
3877
  function stdinText(stmt) {
3845
3878
  for (const redir of stmt?.Redirs ?? []) {
3846
3879
  if (redir.Hdoc) return resolveWordLiteral(redir.Hdoc);
3847
- if (redir.Op === HERE_STRING) return resolveWordLiteral(redir.Word);
3880
+ if (redir.Op === ops().HERE_STRING) return resolveWordLiteral(redir.Word);
3848
3881
  }
3849
3882
  return null;
3850
3883
  }
@@ -3874,10 +3907,10 @@ function collectShellFileAccesses(command, context = {}) {
3874
3907
  for (const redir of stmt.Redirs ?? []) {
3875
3908
  substitutions(redir.Word, state, depth);
3876
3909
  for (const word of wordValues(redir.Word, state)) {
3877
- if (WRITES.has(redir.Op))
3878
- add("write", word, state, APPENDS.has(redir.Op) ? { append: true } : {});
3879
- if (READS.has(redir.Op)) add("read", word, state, sends ? { upload: true } : {});
3880
- if (redir.Op === DUP_OUT && word.value && !/^\d+$/.test(word.value))
3910
+ if (ops().WRITES.has(redir.Op))
3911
+ add("write", word, state, ops().APPENDS.has(redir.Op) ? { append: true } : {});
3912
+ if (ops().READS.has(redir.Op)) add("read", word, state, sends ? { upload: true } : {});
3913
+ if (redir.Op === ops().DUP_OUT && word.value && !/^\d+$/.test(word.value))
3881
3914
  add("write", word, state);
3882
3915
  }
3883
3916
  substitutions(redir.Hdoc, state, depth);
@@ -3909,16 +3942,17 @@ function collectShellFileAccesses(command, context = {}) {
3909
3942
  const seen = clone(state);
3910
3943
  let pureAnd = true;
3911
3944
  segments2.forEach(({ op, part }, i) => {
3912
- if (op === AND || op === OR) {
3913
- if (i > 0 && op === AND && pureAnd && state.onSuccess) state.cwd = state.onSuccess;
3914
- if (i > 0 && op === OR) merge(state, seen);
3945
+ if (op === ops().AND || op === ops().OR) {
3946
+ if (i > 0 && op === ops().AND && pureAnd && state.onSuccess)
3947
+ state.cwd = state.onSuccess;
3948
+ if (i > 0 && op === ops().OR) merge(state, seen);
3915
3949
  statement(part, state, depth + 1);
3916
3950
  } else {
3917
3951
  statement(part, clone(state), depth + 1);
3918
3952
  if (i > 0 && readsScriptFromStdin(part))
3919
3953
  nestedPayload(producedText(segments2[i - 1].part), clone(state), depth);
3920
3954
  }
3921
- if (i > 0 && op !== AND) pureAnd = false;
3955
+ if (i > 0 && op !== ops().AND) pureAnd = false;
3922
3956
  merge(seen, state);
3923
3957
  });
3924
3958
  merge(state, seen);
@@ -4042,8 +4076,8 @@ function collectFileAccesses(tool, args, context = {}, inspection = {}) {
4042
4076
  }
4043
4077
  return out;
4044
4078
  }
4045
- function within(path48, root) {
4046
- return path48 === root || path48.startsWith(root === "/" ? "/" : root + "/");
4079
+ function within(path210, root) {
4080
+ return path210 === root || path210.startsWith(root === "/" ? "/" : root + "/");
4047
4081
  }
4048
4082
  function hits(access, paths, directories, context) {
4049
4083
  const home = context.homeDirs?.[0] ?? "~";
@@ -5278,7 +5312,7 @@ function shellWriteUnseen(command, target) {
5278
5312
  );
5279
5313
  const redirs = n.Redirs || [];
5280
5314
  const redirectsTo = redirs.some((r) => r.Word && resolveWordLiteral(r.Word) === target);
5281
- const readsFromFile = redirs.some((r) => r.Op === RDR_IN && r.Word && !r.Hdoc);
5315
+ const readsFromFile = redirs.some((r) => r.Op === RDR_IN() && r.Word && !r.Hdoc);
5282
5316
  const named = words.includes(target);
5283
5317
  if (!redirectsTo && !named) return true;
5284
5318
  const head = unwrapCommandHead(words);
@@ -6394,14 +6428,14 @@ function mavenGet(words, from, out) {
6394
6428
  push(out, "Maven", "mvn dependency:get", coord, exact, artifact ?? coord);
6395
6429
  }
6396
6430
  function composerPackages(words, from, manager, out) {
6397
- const ops = operands(words, from, COMPOSER_VALUE_FLAGS);
6398
- const specs = manager === "composer create-project" ? ops.slice(0, 1) : ops;
6431
+ const ops2 = operands(words, from, COMPOSER_VALUE_FLAGS);
6432
+ const specs = manager === "composer create-project" ? ops2.slice(0, 1) : ops2;
6399
6433
  for (const raw of specs) {
6400
6434
  const sep = raw.search(/[:=]/);
6401
6435
  const name = sep < 0 ? raw : raw.slice(0, sep);
6402
6436
  if (!COMPOSER_NAME_RE.test(name)) continue;
6403
6437
  let ver = sep < 0 ? void 0 : raw.slice(sep + 1);
6404
- if (manager === "composer create-project" && ver === void 0) ver = ops[2] ?? void 0;
6438
+ if (manager === "composer create-project" && ver === void 0) ver = ops2[2] ?? void 0;
6405
6439
  push(out, "Packagist", manager, name.toLowerCase(), exactVersion(ver), raw);
6406
6440
  }
6407
6441
  }
@@ -7332,9 +7366,9 @@ function bareToolName(toolName) {
7332
7366
  const parts = toolName.split("__");
7333
7367
  return (parts.length >= 3 ? parts.slice(2).join("__") : toolName).toLowerCase();
7334
7368
  }
7335
- function valuesAt(args, path48) {
7369
+ function valuesAt(args, path210) {
7336
7370
  let cursors = [args];
7337
- for (const rawSegment of path48.split(".")) {
7371
+ for (const rawSegment of path210.split(".")) {
7338
7372
  const isArray = rawSegment.endsWith("[]");
7339
7373
  const key = isArray ? rawSegment.slice(0, -2) : rawSegment;
7340
7374
  const next = [];
@@ -7365,8 +7399,8 @@ function extractToolDestinations(toolName, args) {
7365
7399
  try {
7366
7400
  const out = [];
7367
7401
  const paths = DESTINATION_ARGS.get(bareToolName(toolName)) ?? [];
7368
- for (const path48 of paths) {
7369
- for (const value of valuesAt(args, path48)) {
7402
+ for (const path210 of paths) {
7403
+ for (const value of valuesAt(args, path210)) {
7370
7404
  const host2 = hostOf(value);
7371
7405
  if (host2) out.push({ host: host2, binary: toolName, raw: value });
7372
7406
  }
@@ -7392,8 +7426,8 @@ function ssrfDestinationFloor(toolName, args, opts = {}) {
7392
7426
  try {
7393
7427
  const paths = DESTINATION_ARGS.get(bareToolName(toolName));
7394
7428
  if (!paths) return null;
7395
- for (const path48 of paths) {
7396
- for (const value of valuesAt(args, path48)) {
7429
+ for (const path210 of paths) {
7430
+ for (const value of valuesAt(args, path210)) {
7397
7431
  const host2 = hostOf(value);
7398
7432
  if (!host2) continue;
7399
7433
  const m = classifySsrf(host2);
@@ -7402,7 +7436,7 @@ function ssrfDestinationFloor(toolName, args, opts = {}) {
7402
7436
  const decision = ssrfFloorDecision(m, written, opts);
7403
7437
  if (decision === null) continue;
7404
7438
  const reason = decision === "review" ? ssrfDisguisedReason(m, written) : ssrfReason(m, host2);
7405
- return { ...m, argPath: path48, host: host2, reason, decision };
7439
+ return { ...m, argPath: path210, host: host2, reason, decision };
7406
7440
  }
7407
7441
  }
7408
7442
  return null;
@@ -9067,10 +9101,13 @@ function matchCanaryArgs(args, values) {
9067
9101
  return null;
9068
9102
  }
9069
9103
  }
9070
- var MAX_REGEX_LENGTH, REGEX_CACHE_MAX, regexCache, aws_default, bash_safe_default, docker_default, filesystem_default, github_default, k8s_default, mongodb_default, postgres_default, project_jail_default, redis_default, finance_default, identity_default, publishing_default, settings_default, branches_default, ACTION_TEMPLATES, ACTION_CHECKS, GAP, prog, httpTo, httpWrite, HTTP_WRITE, HTTP_WRITE_ANY, NOT_STRIPE_TEST, postTo, STRIPE_OBJECTS, APP_SHIELD_SPECS, APP_SHIELDS, APP_SHIELD_NAMES, APP_SERVER_GLOB, GENERAL_ACTION_RULES, BUILTIN_SHIELDS, SSRF_MAX_HOST, METADATA_ADDRESSES, STRICT_TIERS, METADATA_HOSTNAMES, v4Octets, TIER_REASON, CHECK_TEXT, LEVELS, MODE_VALUES, SOFT, STRICT, BLOCK_ALL, LEVEL_CHECKS, VERDICTS, CHECK_VERDICT_RANK, ALL, BUILTIN_DANGEROUS_WORDS, PRODUCT_CHECKS, SHIELD_RULE_NAME, SHIELD_RULES_FOLDED_INTO_PRODUCT, CHECKS, CHECK_BY_ID, LEGACY_TO_ID, PROJECT_JAIL_BLOCK_READ, OVERRIDE_PREFIX, LABEL_WRAPPERS, LEGACY_READERS, syntax, KINDS, STRUCTS, unknownKinds, INVISIBLE_RE, INVISIBLE_ONE, HOMOGLYPHS, HOMOGLYPH_RE, MAX_BLOBS, MIN_DECODED, BASE64_RUN_RE, HEX_RUN_RE, HEX_ESCAPE_RUN_RE, SYSTEM_AUTH_FILES, SYSTEM_AUTH_DIRS, PASSWORD_HASH_FILES, STARTUP_NAMES, SYSTEM_DIRS, SYSTEM_DIRS_EXEMPT, UPLOAD_SYSTEM_DIRS, AGENT_INSTRUCTION_FILES, AGENT_INSTRUCTION_DIRS, LEGACY_SYSTEM_PATH_RE, MAX_INLINE_CODE, WHAT, OUTSIDE, pyImport, either, PYTHON, NODE, PERL, RUBY, PHP, TABLES, STRING_LITERAL, syntax2, sharedParser, MESSAGE_FLAGS, SHELL_INTERPRETERS, DOWNLOAD_CMDS, NORMALIZE_CACHE_MAX, normalizeCache, codeBodiesCache, AST_CACHE_MAX, astCache, PARSE_FAIL, INTERPRETER_LINE, PROGRAM_DIR, ACCESS_VIEW_CACHE_MAX, accessViewCache, MAX_READING_PAYLOADS, STDIN_CODE_INTERPRETERS, RUNS_TEXT_ELSEWHERE, defaultExpansionOps, VARIABLE_READERS, FS_READ_TOOLS, GREP_SHAPE, PATTERN_VERBS, PATTERN_VERB_NAMES, GREP_FILE_OPERANDS, READER_VALUE_LETTERS, FILE_OPERAND_FLAGS, SCP_VALUE_FLAGS, CURL_SOURCE_FLAGS, CURL_VALUE_LETTERS, WGET_VALUE_LETTERS, TAR_VALUE_LETTERS, ZIP_VALUE_LETTERS, RSYNC_VALUE_LETTERS, RSYNC_SKIP, CP_VALUE_LETTERS, INSTALL_VALUE_LETTERS, COPY_VERBS, TAR_MODE_WORD, COPY_VERB_HEADS, FS_OP_PRESCREEN_RE, HOME_CACHE_ALLOWLIST, SENSITIVE_PATH_RULES, AST_FS_REGEX_RULES, SQL_DB_CLIS, SQL_DDL_RE, CHMOD_OPEN_PERM_TOKENS, COMMAND_WRAPPERS, INLINE_INTERPRETER, RUNNER_WRAPPERS, _redirStdinOps, _listOps, WRAPPER_TAKES_TARGET, FIND_EXEC_FLAGS, FS_MUTATION_TOOLS, INTERP_LEADING_TARGET, MAX_PAYLOAD_NESTING, payloadNesting, MAX_INLINE_CALLS, INLINE_EXEC_FALLBACK, UNREADABLE_SOURCE, SCRIPT_RUNNERS, SCRIPT_RUNNER_VALUE_FLAGS, MAX_SCRIPT_OPERANDS, NET_BINARIES, VALUE_FLAGS, HOME_VARIABLES, assignmentTable, currentStmtOffset, PAYLOAD_BUDGET, payloadBudget, seenPayloads, UNANALYSABLE_NESTING, ASSIGNMENT_HEADS, AND_OP, OR_OP, AND_OR_OPS, MAX_CALL_DEPTH, MAX_CALL_WALKS, callDepth, callWalks, FS_OP_CACHE_MAX, fsOpCache, stripDotSlash, REDIR_TRUNCATE_OPS, REDIR_FILE_IN_OPS, REDIR_HEREDOC_OPS, FIND_OPTIONS, COPY_RULE_OF, isReaderWord, positionalAfter, NONE, UNKNOWN, FORBIDDEN_PATH_SEGMENTS, BASH_TOOL_NAMES, MCP_EXECUTORS, BUILTIN_FIELDS, ARGV_FIELDS, BARE_WORD, MAX_ARGV_CHARACTERS, syntax3, MAX_ALTERNATIVES, MAX_CALL_DEPTH2, MAX_CALL_WALKS2, POSITIONAL, MAX_DEPTH, MAX_PAYLOAD_DEPTH, unique, clone, SENDING_STDIN, DOWNLOAD_SHORT_VALUE, DOWNLOAD_LONG_VALUE, DOWNLOAD_OUTPUT_FLAGS, DOWNLOAD_DIR_FLAGS, base, quoteGlob, asWord, WRITES, APPENDS, READS, DUP_OUT, HERE_STRING, AND, OR, DEFAULT_OPS, exempt, RANK, SEQUENCE_OPS, BIP39_ENGLISH, BIP39_PUBLIC_VECTORS, indices, lengths, hash, MAX_MNEMONIC_HASHES, SECRET_VIEW_LIMITS, IBAN_LENGTH, IBAN_BBAN_SHAPE, B58, B58_INDEX, XPRV_VERSIONS, B62, CRC32_TABLE, GITHUB_TOKEN_RE, B64URL, B64URL_INDEX, CASK_TWO_ZERO_SUFFIX, CASK_FOUR_ZERO_SUFFIX, CF_ODD, CF_EVEN, SPANISH_LETTERS, HETU_CHARS, VERHOEFF_D, VERHOEFF_P, MAX, UNTRUSTED_TOOLS, INJECTION_SIGNALS, MENTION_QUOTE_RE, MENTION_WORD_RE, ASSIGNMENT_CONTEXT_RE, DLP_STOPWORDS, REFERENCE_VALUE_RE, IDENTIFIER_VALUE_RE, PATH_VALUE_RE, DOTTED_REFERENCE_RE, CONCATENATION_RE, EMAIL_VALUE_RE, FIXTURE_NAME_RE, DERIVATIVE_NAME_RE, QUERY_CREDENTIAL_VALUE_RE, OTP_SECRET_RE, OTP_DOC_SECRETS, ASSIGNED_SECRET_VALUE_RE, ASSIGNED_SECRET_NAME_RE, NAME_KEYWORD_RE, ARN_CONTEXT_RE, CIPHER_KEY_NAME_RE, CIPHER_NAME_PARTS, CIPHER_KEY_VALUE_RE, LARAVEL_KEY_VALUE_RE, SQL_PASSWORD_VALUE_RE, GRAFANA_KEY_VALUE_RE, BASIC_VALUE_RE, BASIC_PAIR_RE, BASIC_HEADER_RE, BASIC_HEADER_PAIR_RE, BASIC_PLACEHOLDER_RE, BASIC_TEMPLATE_MARKERS, DROPBOX_SECRET_RE, OTP_CAPTURE_RE, DB_URL_PASSWORD_RE, DLP_PATTERNS, DLP_PATTERNS_GLOBAL, SENSITIVE_PATH_PATTERNS, SENSITIVE_PATH_REGEXES, MAX_DEPTH2, MAX_STRING_BYTES, MAX_JSON_PARSE_BYTES, BATCH_SEPARATOR, ENCODED_RUN_RE, IMPERATIVE, SECRET_TARGET, GUARD, SIGNALS, DESTINATION_RE, REUSED_SIGNALS, NEVER_NEGATED, NEGATION_BEFORE, RDR_IN, COPY_VERBS2, LITERAL_VERBS, GIT_PRESCREEN_RE, MAX_PAYLOAD_DEPTH2, MAX_ALIAS_DEPTH, CACHE_MAX, cache, PAYLOAD_SHELLS, CONFIG_SCOPE_FLAGS, CONFIG_VALUE_FLAGS, GLOBAL_VALUE_OPTIONS, GLOBAL_FLAG_OPTIONS, MAX_LOOP_ITEMS, GitWalk, POSITIONAL2, FORCE_PUSH, DESTRUCTIVE, UNREADABLE, PUSH_LONG_VALUE, BRANCH_LONG_VALUE, TAG_LONG_VALUE, CLEAN_LONG_VALUE, HOOKS_BYPASS, NO_VERIFY_SUBS, HOOK_KILL_SWITCHES, COMMIT_LONG_VALUE, CHMOD_OPTION_RE, STAGE_ALL, ADD_LONG_VALUE, CHECK_ID, RULE_NAME, INERT_LINE_RE, CHECK_ID2, INSTRUCTION_NAMES, SETTINGS_RE, HOOK_WORDS_RE, SHELLS, NETCATS, NET_CLIENTS, SENDERS, NETCAT_EXEC_LONG, DECL_DUMPS, PROC_ENVIRON_RE, DEV_NET_RE, SOCAT_PROGRAM_RE, SOCAT_NET_RE, PRESCREEN_RE, MAX_PAYLOAD_DEPTH3, CACHE_MAX2, cache2, dupInOp, REVERSE_SHELL_DESCRIPTION, ENV_EXFIL_DESCRIPTION, DYNAMIC_WORD, MULTICALL, SHELL_VALUE_OPTIONS, INTERPRETERS, OutboundWalk, NPM_INSTALL_VERBS, NPM_EXEC_VERBS, PNPM_INSTALL_VERBS, YARN_INSTALL_VERBS, BUN_INSTALL_VERBS, DLX_VERBS, NON_REGISTRY_RE, NPM_NAME_RE, EXACT_SEMVER_RE, NPM_VALUE_FLAGS, PNPM_VALUE_FLAGS, YARN_VALUE_FLAGS, BUN_VALUE_FLAGS, PIP_VALUE_FLAGS, UV_VALUE_FLAGS, POETRY_VALUE_FLAGS, PIPENV_VALUE_FLAGS, PIPX_VALUE_FLAGS, PY_SPEC_RE, PY_EXACT_RE, EXACT_VERSION_RE, GEM_NAME_RE, GEM_VALUE_FLAGS, BUNDLE_VALUE_FLAGS, CRATE_NAME_RE, CARGO_ADD_VALUE_FLAGS, CARGO_INSTALL_VALUE_FLAGS, GO_VALUE_FLAGS, GO_PATH_RE, NUGET_NAME_RE, DOTNET_ADD_VALUE_FLAGS, DOTNET_TOOL_VALUE_FLAGS, NUGET_VALUE_FLAGS, MAVEN_COORD_RE, COMPOSER_NAME_RE, COMPOSER_VALUE_FLAGS, EDITOR_HEADS, EXTENSION_ID_RE, MANAGER_HEADS, SHELLS2, MAX_NESTING, SHELL_VALUE_FLAGS, NPM_FAMILY, PIP_FAMILY, NPM_FETCH_VERBS, PIP_FETCH_VERBS, NPM_FLAGS, PIP_FLAGS, NPM_VARS, PIP_VARS, PRESCREEN_RE2, PIP_ATTACHED_RE, MAX_PAYLOAD_DEPTH4, PUBLIC_REGISTRY_HOSTS, TUNING_FIELDS, MAP_GOVERNED, KNOB_GOVERNED, CONFIGURABLE_CHECK_IDS, DEFAULT_EGRESS_ALLOWLIST, PRIVATE_HOST_SUFFIXES, SOURCE_COMMANDS, SINK_COMMANDS, OBFUSCATORS, SENSITIVE_PATTERNS, FLAGS_WITH_VALUES, DESTINATION_ARGS, MCP_DESTINATION_KEYS, ARGUMENT_SCAN_LIMITS, RUN_CHAR, runChar, VERDICT_RANK, SQL_DML_KEYWORDS, MAX_DESTINATIONS, MAX_SCAN_CHARS, EMAIL_RE, URL_RE, IBAN_RE, RECIPIENT_KEYS, DESTRUCTIVE_VERB_RE, PII_EMAIL_RE, PII_SSN_RE, PII_PHONE_RE, PII_CC16_RE, PII_CC15_RE, PII_CC14_RE, PII_CC13_RE, PII_CC19_RE, CARD_PATTERNS, PII_ROUTING_RE, ROUTING_LABEL_RE, ROUTING_LABEL_WINDOW, NATIONAL_ID_SHAPES, NATIONAL_ID_LABEL_RE, NATIONAL_ID_LABEL_CS_RE, idLabelIn, NATIONAL_ID_LABEL_WINDOW, NATIONAL_ID_GUARD_RE, PII_IBAN_RE, REALTIME_PII_PATTERNS, MAX_PII_SCAN_BYTES, IBAN_DESTINATION_KEYS, WHOLE_IBAN_RE, JSON_ESCAPE_RE, JSON_ESCAPES, MASKED_KINDS, ENTRY_RE, IBAN_TEXT_RE, EMAIL_TEXT_RE, ACCOUNT_KEY_RE, ACCOUNT_VALUE_RE, MAX_MASK_DEPTH, EMPTY, CURL_SEND_FLAGS, WGET_SEND_FLAGS, IWR_SEND_FLAGS, WRITE_METHODS, GH_READ, GH_WRITE, GH_HOSTNAME_FLAGS, GH_REPO_VALUE_FLAGS, GH_API_VALUE_FLAGS, GIT_FETCH, PUBLISH, SHELLS3, OWN_HEADS, MAX_DEPTH3, CWD_CHANGERS, TERMINAL_ESCAPE_RE, LOOP_MAX_RECORDS, CANARY_MIN_LENGTH, MAX_TEXT, MAX_DEPTH4, MAX_JSON_PARSE, URL_DEPTH, B64_DEPTH, MIN_SEGMENT, SEPARATORS, stripSeparators, looksText, CANARY_DECODERS, VIEWS, LONG_OUTPUT_THRESHOLD_BYTES, CANONICAL_EXTRACTOR_VERSION;
9104
+ var getFilename2, __filename2, MAX_REGEX_LENGTH, REGEX_CACHE_MAX, regexCache, aws_default, bash_safe_default, docker_default, filesystem_default, github_default, k8s_default, mongodb_default, postgres_default, project_jail_default, redis_default, finance_default, identity_default, publishing_default, settings_default, branches_default, ACTION_TEMPLATES, ACTION_CHECKS, GAP, prog, httpTo, httpWrite, HTTP_WRITE, HTTP_WRITE_ANY, NOT_STRIPE_TEST, postTo, STRIPE_OBJECTS, APP_SHIELD_SPECS, APP_SHIELDS, APP_SHIELD_NAMES, APP_SERVER_GLOB, GENERAL_ACTION_RULES, BUILTIN_SHIELDS, SSRF_MAX_HOST, METADATA_ADDRESSES, STRICT_TIERS, METADATA_HOSTNAMES, v4Octets, TIER_REASON, CHECK_TEXT, LEVELS, MODE_VALUES, SOFT, STRICT, BLOCK_ALL, LEVEL_CHECKS, VERDICTS, CHECK_VERDICT_RANK, ALL, BUILTIN_DANGEROUS_WORDS, PRODUCT_CHECKS, SHIELD_RULE_NAME, SHIELD_RULES_FOLDED_INTO_PRODUCT, CHECKS, CHECK_BY_ID, LEGACY_TO_ID, PROJECT_JAIL_BLOCK_READ, OVERRIDE_PREFIX, LABEL_WRAPPERS, LEGACY_READERS, syntax, KINDS, STRUCTS, unknownKinds, INVISIBLE_RE, INVISIBLE_ONE, HOMOGLYPHS, HOMOGLYPH_RE, MAX_BLOBS, MIN_DECODED, BASE64_RUN_RE, HEX_RUN_RE, HEX_ESCAPE_RUN_RE, SYSTEM_AUTH_FILES, SYSTEM_AUTH_DIRS, PASSWORD_HASH_FILES, STARTUP_NAMES, SYSTEM_DIRS, SYSTEM_DIRS_EXEMPT, UPLOAD_SYSTEM_DIRS, AGENT_INSTRUCTION_FILES, AGENT_INSTRUCTION_DIRS, LEGACY_SYSTEM_PATH_RE, MAX_INLINE_CODE, WHAT, OUTSIDE, pyImport, either, PYTHON, NODE, PERL, RUBY, PHP, TABLES, STRING_LITERAL, sharedParser, MESSAGE_FLAGS, SHELL_INTERPRETERS, DOWNLOAD_CMDS, NORMALIZE_CACHE_MAX, normalizeCache, codeBodiesCache, AST_CACHE_MAX, astCache, PARSE_FAIL, INTERPRETER_LINE, PROGRAM_DIR, ACCESS_VIEW_CACHE_MAX, accessViewCache, MAX_READING_PAYLOADS, STDIN_CODE_INTERPRETERS, RUNS_TEXT_ELSEWHERE, defaultExpansionOps, VARIABLE_READERS, FS_READ_TOOLS, GREP_SHAPE, PATTERN_VERBS, PATTERN_VERB_NAMES, GREP_FILE_OPERANDS, READER_VALUE_LETTERS, FILE_OPERAND_FLAGS, SCP_VALUE_FLAGS, CURL_SOURCE_FLAGS, CURL_VALUE_LETTERS, WGET_VALUE_LETTERS, TAR_VALUE_LETTERS, ZIP_VALUE_LETTERS, RSYNC_VALUE_LETTERS, RSYNC_SKIP, CP_VALUE_LETTERS, INSTALL_VALUE_LETTERS, COPY_VERBS, TAR_MODE_WORD, COPY_VERB_HEADS, FS_OP_PRESCREEN_RE, HOME_CACHE_ALLOWLIST, SENSITIVE_PATH_RULES, AST_FS_REGEX_RULES, SQL_DB_CLIS, SQL_DDL_RE, CHMOD_OPEN_PERM_TOKENS, COMMAND_WRAPPERS, INLINE_INTERPRETER, RUNNER_WRAPPERS, _redirStdinOps, _listOps, WRAPPER_TAKES_TARGET, FIND_EXEC_FLAGS, FS_MUTATION_TOOLS, INTERP_LEADING_TARGET, MAX_PAYLOAD_NESTING, payloadNesting, MAX_INLINE_CALLS, INLINE_EXEC_FALLBACK, UNREADABLE_SOURCE, SCRIPT_RUNNERS, SCRIPT_RUNNER_VALUE_FLAGS, MAX_SCRIPT_OPERANDS, NET_BINARIES, VALUE_FLAGS, HOME_VARIABLES, assignmentTable, currentStmtOffset, PAYLOAD_BUDGET, payloadBudget, seenPayloads, UNANALYSABLE_NESTING, ASSIGNMENT_HEADS, andOrOps, MAX_CALL_DEPTH, MAX_CALL_WALKS, callDepth, callWalks, FS_OP_CACHE_MAX, fsOpCache, stripDotSlash, REDIR_TRUNCATE_OPS, REDIR_FILE_IN_OPS, REDIR_HEREDOC_OPS, FIND_OPTIONS, COPY_RULE_OF, isReaderWord, positionalAfter, NONE, UNKNOWN, FORBIDDEN_PATH_SEGMENTS, BASH_TOOL_NAMES, MCP_EXECUTORS, BUILTIN_FIELDS, ARGV_FIELDS, BARE_WORD, MAX_ARGV_CHARACTERS, MAX_ALTERNATIVES, MAX_CALL_DEPTH2, MAX_CALL_WALKS2, POSITIONAL, MAX_DEPTH, MAX_PAYLOAD_DEPTH, unique, clone, SENDING_STDIN, DOWNLOAD_SHORT_VALUE, DOWNLOAD_LONG_VALUE, DOWNLOAD_OUTPUT_FLAGS, DOWNLOAD_DIR_FLAGS, base, quoteGlob, asWord, ops, exempt, RANK, SEQUENCE_OPS, BIP39_ENGLISH, BIP39_PUBLIC_VECTORS, indices, lengths, hash, MAX_MNEMONIC_HASHES, SECRET_VIEW_LIMITS, IBAN_LENGTH, IBAN_BBAN_SHAPE, B58, B58_INDEX, XPRV_VERSIONS, B62, CRC32_TABLE, GITHUB_TOKEN_RE, B64URL, B64URL_INDEX, CASK_TWO_ZERO_SUFFIX, CASK_FOUR_ZERO_SUFFIX, CF_ODD, CF_EVEN, SPANISH_LETTERS, HETU_CHARS, VERHOEFF_D, VERHOEFF_P, MAX, UNTRUSTED_TOOLS, INJECTION_SIGNALS, MENTION_QUOTE_RE, MENTION_WORD_RE, ASSIGNMENT_CONTEXT_RE, DLP_STOPWORDS, REFERENCE_VALUE_RE, IDENTIFIER_VALUE_RE, PATH_VALUE_RE, DOTTED_REFERENCE_RE, CONCATENATION_RE, EMAIL_VALUE_RE, FIXTURE_NAME_RE, DERIVATIVE_NAME_RE, QUERY_CREDENTIAL_VALUE_RE, OTP_SECRET_RE, OTP_DOC_SECRETS, ASSIGNED_SECRET_VALUE_RE, ASSIGNED_SECRET_NAME_RE, NAME_KEYWORD_RE, ARN_CONTEXT_RE, CIPHER_KEY_NAME_RE, CIPHER_NAME_PARTS, CIPHER_KEY_VALUE_RE, LARAVEL_KEY_VALUE_RE, SQL_PASSWORD_VALUE_RE, GRAFANA_KEY_VALUE_RE, BASIC_VALUE_RE, BASIC_PAIR_RE, BASIC_HEADER_RE, BASIC_HEADER_PAIR_RE, BASIC_PLACEHOLDER_RE, BASIC_TEMPLATE_MARKERS, DROPBOX_SECRET_RE, OTP_CAPTURE_RE, DB_URL_PASSWORD_RE, DLP_PATTERNS, DLP_PATTERNS_GLOBAL, SENSITIVE_PATH_PATTERNS, SENSITIVE_PATH_REGEXES, MAX_DEPTH2, MAX_STRING_BYTES, MAX_JSON_PARSE_BYTES, BATCH_SEPARATOR, ENCODED_RUN_RE, IMPERATIVE, SECRET_TARGET, GUARD, SIGNALS, DESTINATION_RE, REUSED_SIGNALS, NEVER_NEGATED, NEGATION_BEFORE, RDR_IN, COPY_VERBS2, LITERAL_VERBS, GIT_PRESCREEN_RE, MAX_PAYLOAD_DEPTH2, MAX_ALIAS_DEPTH, CACHE_MAX, cache, PAYLOAD_SHELLS, CONFIG_SCOPE_FLAGS, CONFIG_VALUE_FLAGS, GLOBAL_VALUE_OPTIONS, GLOBAL_FLAG_OPTIONS, MAX_LOOP_ITEMS, GitWalk, POSITIONAL2, FORCE_PUSH, DESTRUCTIVE, UNREADABLE, PUSH_LONG_VALUE, BRANCH_LONG_VALUE, TAG_LONG_VALUE, CLEAN_LONG_VALUE, HOOKS_BYPASS, NO_VERIFY_SUBS, HOOK_KILL_SWITCHES, COMMIT_LONG_VALUE, CHMOD_OPTION_RE, STAGE_ALL, ADD_LONG_VALUE, CHECK_ID, RULE_NAME, INERT_LINE_RE, CHECK_ID2, INSTRUCTION_NAMES, SETTINGS_RE, HOOK_WORDS_RE, SHELLS, NETCATS, NET_CLIENTS, SENDERS, NETCAT_EXEC_LONG, DECL_DUMPS, PROC_ENVIRON_RE, DEV_NET_RE, SOCAT_PROGRAM_RE, SOCAT_NET_RE, PRESCREEN_RE, MAX_PAYLOAD_DEPTH3, CACHE_MAX2, cache2, dupInOp, REVERSE_SHELL_DESCRIPTION, ENV_EXFIL_DESCRIPTION, DYNAMIC_WORD, MULTICALL, SHELL_VALUE_OPTIONS, INTERPRETERS, OutboundWalk, NPM_INSTALL_VERBS, NPM_EXEC_VERBS, PNPM_INSTALL_VERBS, YARN_INSTALL_VERBS, BUN_INSTALL_VERBS, DLX_VERBS, NON_REGISTRY_RE, NPM_NAME_RE, EXACT_SEMVER_RE, NPM_VALUE_FLAGS, PNPM_VALUE_FLAGS, YARN_VALUE_FLAGS, BUN_VALUE_FLAGS, PIP_VALUE_FLAGS, UV_VALUE_FLAGS, POETRY_VALUE_FLAGS, PIPENV_VALUE_FLAGS, PIPX_VALUE_FLAGS, PY_SPEC_RE, PY_EXACT_RE, EXACT_VERSION_RE, GEM_NAME_RE, GEM_VALUE_FLAGS, BUNDLE_VALUE_FLAGS, CRATE_NAME_RE, CARGO_ADD_VALUE_FLAGS, CARGO_INSTALL_VALUE_FLAGS, GO_VALUE_FLAGS, GO_PATH_RE, NUGET_NAME_RE, DOTNET_ADD_VALUE_FLAGS, DOTNET_TOOL_VALUE_FLAGS, NUGET_VALUE_FLAGS, MAVEN_COORD_RE, COMPOSER_NAME_RE, COMPOSER_VALUE_FLAGS, EDITOR_HEADS, EXTENSION_ID_RE, MANAGER_HEADS, SHELLS2, MAX_NESTING, SHELL_VALUE_FLAGS, NPM_FAMILY, PIP_FAMILY, NPM_FETCH_VERBS, PIP_FETCH_VERBS, NPM_FLAGS, PIP_FLAGS, NPM_VARS, PIP_VARS, PRESCREEN_RE2, PIP_ATTACHED_RE, MAX_PAYLOAD_DEPTH4, PUBLIC_REGISTRY_HOSTS, TUNING_FIELDS, MAP_GOVERNED, KNOB_GOVERNED, CONFIGURABLE_CHECK_IDS, DEFAULT_EGRESS_ALLOWLIST, PRIVATE_HOST_SUFFIXES, SOURCE_COMMANDS, SINK_COMMANDS, OBFUSCATORS, SENSITIVE_PATTERNS, FLAGS_WITH_VALUES, DESTINATION_ARGS, MCP_DESTINATION_KEYS, ARGUMENT_SCAN_LIMITS, RUN_CHAR, runChar, VERDICT_RANK, SQL_DML_KEYWORDS, MAX_DESTINATIONS, MAX_SCAN_CHARS, EMAIL_RE, URL_RE, IBAN_RE, RECIPIENT_KEYS, DESTRUCTIVE_VERB_RE, PII_EMAIL_RE, PII_SSN_RE, PII_PHONE_RE, PII_CC16_RE, PII_CC15_RE, PII_CC14_RE, PII_CC13_RE, PII_CC19_RE, CARD_PATTERNS, PII_ROUTING_RE, ROUTING_LABEL_RE, ROUTING_LABEL_WINDOW, NATIONAL_ID_SHAPES, NATIONAL_ID_LABEL_RE, NATIONAL_ID_LABEL_CS_RE, idLabelIn, NATIONAL_ID_LABEL_WINDOW, NATIONAL_ID_GUARD_RE, PII_IBAN_RE, REALTIME_PII_PATTERNS, MAX_PII_SCAN_BYTES, IBAN_DESTINATION_KEYS, WHOLE_IBAN_RE, JSON_ESCAPE_RE, JSON_ESCAPES, MASKED_KINDS, ENTRY_RE, IBAN_TEXT_RE, EMAIL_TEXT_RE, ACCOUNT_KEY_RE, ACCOUNT_VALUE_RE, MAX_MASK_DEPTH, EMPTY, CURL_SEND_FLAGS, WGET_SEND_FLAGS, IWR_SEND_FLAGS, WRITE_METHODS, GH_READ, GH_WRITE, GH_HOSTNAME_FLAGS, GH_REPO_VALUE_FLAGS, GH_API_VALUE_FLAGS, GIT_FETCH, PUBLISH, SHELLS3, OWN_HEADS, MAX_DEPTH3, CWD_CHANGERS, TERMINAL_ESCAPE_RE, LOOP_MAX_RECORDS, CANARY_MIN_LENGTH, MAX_TEXT, MAX_DEPTH4, MAX_JSON_PARSE, URL_DEPTH, B64_DEPTH, MIN_SEGMENT, SEPARATORS, stripSeparators, looksText, CANARY_DECODERS, VIEWS, LONG_OUTPUT_THRESHOLD_BYTES, CANONICAL_EXTRACTOR_VERSION;
9071
9105
  var init_dist = __esm({
9072
9106
  "packages/policy-engine/dist/index.mjs"() {
9073
9107
  "use strict";
9108
+ init_esm_shims();
9109
+ getFilename2 = () => fileURLToPath2(import.meta.url);
9110
+ __filename2 = /* @__PURE__ */ getFilename2();
9074
9111
  MAX_REGEX_LENGTH = 256;
9075
9112
  REGEX_CACHE_MAX = 500;
9076
9113
  regexCache = /* @__PURE__ */ new Map();
@@ -11715,7 +11752,7 @@ var init_dist = __esm({
11715
11752
  return s.untrustedContent.afterExposure === "log-only" ? "log" : "review";
11716
11753
  }
11717
11754
  };
11718
- ({ syntax } = mvdanSh);
11755
+ syntax = null;
11719
11756
  KINDS = {
11720
11757
  File: { nodes: ["Stmts"] },
11721
11758
  Stmt: { nodes: ["Cmd", "Redirs"], scalars: ["Negated", "Background", "Coprocess"] },
@@ -12055,8 +12092,7 @@ var init_dist = __esm({
12055
12092
  php: PHP
12056
12093
  };
12057
12094
  STRING_LITERAL = /(['"`])((?:\\.|(?!\1)[^\\\n]){1,4096})\1/g;
12058
- ({ syntax: syntax2 } = mvdanSh2);
12059
- sharedParser = syntax2.NewParser();
12095
+ sharedParser = lazy(() => getSyntax().NewParser());
12060
12096
  MESSAGE_FLAGS = /* @__PURE__ */ new Set([
12061
12097
  "-m",
12062
12098
  "--message",
@@ -13021,9 +13057,14 @@ var init_dist = __esm({
13021
13057
  path: ""
13022
13058
  };
13023
13059
  ASSIGNMENT_HEADS = /* @__PURE__ */ new Set(["export", "declare", "local", "readonly", "typeset"]);
13024
- AND_OP = probeBinOp("a && b");
13025
- OR_OP = probeBinOp("a || b");
13026
- AND_OR_OPS = new Set([AND_OP, OR_OP].filter((o) => o !== null));
13060
+ andOrOps = lazy(() => {
13061
+ const and = probeBinOp("a && b");
13062
+ const or = probeBinOp("a || b");
13063
+ return {
13064
+ AND_OP: and,
13065
+ AND_OR_OPS: new Set([and, or].filter((o) => o !== null))
13066
+ };
13067
+ });
13027
13068
  MAX_CALL_DEPTH = 4;
13028
13069
  MAX_CALL_WALKS = 256;
13029
13070
  callDepth = 0;
@@ -13031,14 +13072,13 @@ var init_dist = __esm({
13031
13072
  FS_OP_CACHE_MAX = 5e3;
13032
13073
  fsOpCache = /* @__PURE__ */ new Map();
13033
13074
  stripDotSlash = (p) => p.replace(/^\.\//, "");
13034
- REDIR_TRUNCATE_OPS = /* @__PURE__ */ new Set([deriveRedirOp(">_f")]);
13035
- REDIR_FILE_IN_OPS = new Set(
13036
- [deriveRedirOp("cat < f"), deriveRedirOp("cat <> f")].filter((op) => op >= 0)
13075
+ REDIR_TRUNCATE_OPS = lazy(() => /* @__PURE__ */ new Set([deriveRedirOp(">_f")]));
13076
+ REDIR_FILE_IN_OPS = lazy(
13077
+ () => new Set([deriveRedirOp("cat < f"), deriveRedirOp("cat <> f")].filter((op) => op >= 0))
13078
+ );
13079
+ REDIR_HEREDOC_OPS = lazy(
13080
+ () => /* @__PURE__ */ new Set([deriveRedirOp("cat <<X\nX"), deriveRedirOp("cat <<-X\nX")])
13037
13081
  );
13038
- REDIR_HEREDOC_OPS = /* @__PURE__ */ new Set([
13039
- deriveRedirOp("cat <<X\nX"),
13040
- deriveRedirOp("cat <<-X\nX")
13041
- ]);
13042
13082
  FIND_OPTIONS = /* @__PURE__ */ new Set(["-H", "-L", "-P"]);
13043
13083
  COPY_RULE_OF = {
13044
13084
  "shield:project-jail:block-read-ssh": "shield:project-jail:review-copy-ssh",
@@ -13075,7 +13115,6 @@ var init_dist = __esm({
13075
13115
  ARGV_FIELDS = ["args", "argv"];
13076
13116
  BARE_WORD = /^[A-Za-z0-9_./+:@%,-]+$/;
13077
13117
  MAX_ARGV_CHARACTERS = 262144;
13078
- ({ syntax: syntax3 } = mvdanSh3);
13079
13118
  MAX_ALTERNATIVES = 64;
13080
13119
  MAX_CALL_DEPTH2 = 4;
13081
13120
  MAX_CALL_WALKS2 = 256;
@@ -13153,31 +13192,35 @@ var init_dist = __esm({
13153
13192
  base = (s) => (s ?? "").replace(/\/+$/, "").split("/").pop() ?? "";
13154
13193
  quoteGlob = (s) => s.replace(/[\\*?\[\]{}()!+@]/g, "\\$&");
13155
13194
  asWord = (p) => ({ value: p.value, ...p.glob ? { pattern: p.pattern } : {} });
13156
- WRITES = new Set([">x", ">>x", ">|x", "&>x", "&>>x", "<>x"].map(opOf));
13157
- APPENDS = new Set([">>x", "&>>x"].map(opOf));
13158
- READS = new Set(["<x", "<>x"].map(opOf));
13159
- DUP_OUT = opOf(">&x");
13160
- HERE_STRING = opOf("<<<x");
13161
- AND = parseShared("a && b").Stmts[0].Cmd.Op;
13162
- OR = parseShared("a || b").Stmts[0].Cmd.Op;
13163
- DEFAULT_OPS = new Set(
13164
- ["${x:-y}", "${x-y}", "${x:=y}", "${x=y}"].map(
13165
- (s) => parseShared(`echo ${s}`).Stmts[0].Cmd.Args[1].Parts[0].Exp.Op
13195
+ ops = lazy(() => ({
13196
+ WRITES: new Set([">x", ">>x", ">|x", "&>x", "&>>x", "<>x"].map(opOf)),
13197
+ APPENDS: new Set([">>x", "&>>x"].map(opOf)),
13198
+ READS: new Set(["<x", "<>x"].map(opOf)),
13199
+ /** `>&word` with a non-numeric word is `&>word` in bash. */
13200
+ DUP_OUT: opOf(">&x"),
13201
+ HERE_STRING: opOf("<<<x"),
13202
+ AND: parseShared("a && b").Stmts[0].Cmd.Op,
13203
+ OR: parseShared("a || b").Stmts[0].Cmd.Op,
13204
+ /** `${x:-d}` `${x-d}` `${x:=d}` `${x=d}`: the default is the value when x is unset. */
13205
+ DEFAULT_OPS: new Set(
13206
+ ["${x:-y}", "${x-y}", "${x:=y}", "${x=y}"].map(
13207
+ (s) => parseShared(`echo ${s}`).Stmts[0].Cmd.Args[1].Parts[0].Exp.Op
13208
+ )
13166
13209
  )
13167
- );
13210
+ }));
13168
13211
  exempt = (p) => SYSTEM_DIRS_EXEMPT.some((d) => within(p, d));
13169
13212
  RANK = { allow: 0, review: 1, block: 2 };
13170
- SEQUENCE_OPS = (() => {
13171
- const ops = /* @__PURE__ */ new Set();
13213
+ SEQUENCE_OPS = lazy(() => {
13214
+ const ops2 = /* @__PURE__ */ new Set();
13172
13215
  for (const text of ["x && y", "x || y"]) {
13173
13216
  try {
13174
13217
  const f = parseShared(text);
13175
- if (typeof f !== "symbol") ops.add(f.Stmts[0].Cmd.Op);
13218
+ if (typeof f !== "symbol") ops2.add(f.Stmts[0].Cmd.Op);
13176
13219
  } catch {
13177
13220
  }
13178
13221
  }
13179
- return ops;
13180
- })();
13222
+ return ops2;
13223
+ });
13181
13224
  BIP39_ENGLISH = `abandon
13182
13225
  ability
13183
13226
  able
@@ -16328,13 +16371,13 @@ zoo`.split("\n");
16328
16371
  );
16329
16372
  NEVER_NEGATED = /* @__PURE__ */ new Set([SIGNALS[1].any[0]]);
16330
16373
  NEGATION_BEFORE = /\b(never|do not|don'?t|must not|mustn'?t|should not|shouldn'?t|not allowed to|forbidden to|avoid|without|no|not)\b[^.!?;:\n]{0,24}$/i;
16331
- RDR_IN = (() => {
16374
+ RDR_IN = lazy(() => {
16332
16375
  try {
16333
16376
  return parseShared("x <y").Stmts[0].Redirs[0].Op;
16334
16377
  } catch {
16335
16378
  return null;
16336
16379
  }
16337
- })();
16380
+ });
16338
16381
  COPY_VERBS2 = /* @__PURE__ */ new Set([
16339
16382
  "cp",
16340
16383
  "mv",
@@ -18163,7 +18206,7 @@ __export(audit_exports, {
18163
18206
  truncateAuditPreview: () => truncateAuditPreview
18164
18207
  });
18165
18208
  import fs from "fs";
18166
- import path from "path";
18209
+ import path2 from "path";
18167
18210
  import os from "os";
18168
18211
  import crypto2 from "crypto";
18169
18212
  function generateEventId() {
@@ -18210,7 +18253,7 @@ function truncateAuditPreview(text) {
18210
18253
  function appendToLog(logPath, entry) {
18211
18254
  if (forecastRun()) return;
18212
18255
  try {
18213
- const dir2 = path.dirname(logPath);
18256
+ const dir2 = path2.dirname(logPath);
18214
18257
  if (!fs.existsSync(dir2)) fs.mkdirSync(dir2, { recursive: true });
18215
18258
  fs.appendFileSync(logPath, JSON.stringify(entry) + "\n");
18216
18259
  } catch {
@@ -18289,7 +18332,7 @@ function appendLocalAudit(toolName, args, decision, checkedBy, meta, auditHashAr
18289
18332
  } : {};
18290
18333
  const cloudLinkField = meta?.cloudRequestId ? { cloudRequestId: meta.cloudRequestId } : {};
18291
18334
  const workingDirField = meta?.workingDir ? { workingDir: meta.workingDir } : {};
18292
- const shell = process.env.SHELL ? path.basename(process.env.SHELL) : void 0;
18335
+ const shell = process.env.SHELL ? path2.basename(process.env.SHELL) : void 0;
18293
18336
  const shellTypeField = shell ? { shellType: shell } : {};
18294
18337
  const editFilePath = filePathFromArgs(args);
18295
18338
  const editFilePathField = editFilePath ? { editFilePath } : {};
@@ -18349,18 +18392,19 @@ var LOCAL_AUDIT_LOG, HOOK_DEBUG_LOG, TEST_COMMAND_RE;
18349
18392
  var init_audit = __esm({
18350
18393
  "src/audit/index.ts"() {
18351
18394
  "use strict";
18395
+ init_esm_shims();
18352
18396
  init_hasher();
18353
18397
  init_forecast_context();
18354
18398
  init_dist();
18355
- LOCAL_AUDIT_LOG = path.join(os.homedir(), ".node9", "audit.log");
18356
- HOOK_DEBUG_LOG = path.join(os.homedir(), ".node9", "hook-debug.log");
18399
+ LOCAL_AUDIT_LOG = path2.join(os.homedir(), ".node9", "audit.log");
18400
+ HOOK_DEBUG_LOG = path2.join(os.homedir(), ".node9", "hook-debug.log");
18357
18401
  TEST_COMMAND_RE = /(?:^|\s)(npm\s+(?:run\s+)?test|npx\s+(?:vitest|jest|mocha)|yarn\s+(?:run\s+)?test|pnpm\s+(?:run\s+)?test|vitest|jest|mocha|pytest|py\.test|cargo\s+test|go\s+test|bundle\s+exec\s+rspec|rspec|phpunit|dotnet\s+test)\b/i;
18358
18402
  }
18359
18403
  });
18360
18404
 
18361
18405
  // src/pricing/litellm.ts
18362
18406
  import fs2 from "fs";
18363
- import path2 from "path";
18407
+ import path3 from "path";
18364
18408
  import os2 from "os";
18365
18409
  function normalizeModel(raw) {
18366
18410
  return raw.replace(/-\d{8}$/, "").toLowerCase();
@@ -18382,7 +18426,7 @@ function readCache(opts) {
18382
18426
  function writeCache(prices) {
18383
18427
  try {
18384
18428
  const target = CACHE_FILE();
18385
- const dir2 = path2.dirname(target);
18429
+ const dir2 = path3.dirname(target);
18386
18430
  if (!fs2.existsSync(dir2)) fs2.mkdirSync(dir2, { recursive: true });
18387
18431
  const tmp = target + ".tmp";
18388
18432
  const body = {
@@ -18500,6 +18544,7 @@ var LITELLM_URL, BUNDLED_PRICING, CACHE_FILE, TTL_MS, memCache, memCacheAt, disk
18500
18544
  var init_litellm = __esm({
18501
18545
  "src/pricing/litellm.ts"() {
18502
18546
  "use strict";
18547
+ init_esm_shims();
18503
18548
  init_audit();
18504
18549
  LITELLM_URL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json";
18505
18550
  BUNDLED_PRICING = {
@@ -18551,7 +18596,7 @@ var init_litellm = __esm({
18551
18596
  "gemini-2.0-flash": [75e-9, 3e-7, 0, 0],
18552
18597
  "gemini-1.5-pro": [125e-8, 5e-6, 0, 0]
18553
18598
  };
18554
- CACHE_FILE = () => path2.join(os2.homedir(), ".node9", "model-pricing.json");
18599
+ CACHE_FILE = () => path3.join(os2.homedir(), ".node9", "model-pricing.json");
18555
18600
  TTL_MS = 24 * 60 * 60 * 1e3;
18556
18601
  memCache = null;
18557
18602
  memCacheAt = 0;
@@ -18563,9 +18608,9 @@ var init_litellm = __esm({
18563
18608
  // src/cost-codex.ts
18564
18609
  import fs3 from "fs";
18565
18610
  import os3 from "os";
18566
- import path3 from "path";
18611
+ import path4 from "path";
18567
18612
  function codexSessionsDir() {
18568
- return path3.join(process.env.CODEX_HOME?.trim() || path3.join(os3.homedir(), ".codex"), "sessions");
18613
+ return path4.join(process.env.CODEX_HOME?.trim() || path4.join(os3.homedir(), ".codex"), "sessions");
18569
18614
  }
18570
18615
  function codexPriceFor(model) {
18571
18616
  return pricingFor(codexModel(model), { exact: true }) ?? CODEX_FALLBACK;
@@ -18621,7 +18666,7 @@ function listCodexSessionFiles(base2 = codexSessionsDir()) {
18621
18666
  const walk3 = (dir2) => {
18622
18667
  try {
18623
18668
  for (const entry of fs3.readdirSync(dir2, { withFileTypes: true })) {
18624
- const file2 = path3.join(dir2, entry.name);
18669
+ const file2 = path4.join(dir2, entry.name);
18625
18670
  if (entry.isDirectory()) walk3(file2);
18626
18671
  else if (entry.isFile() && entry.name.endsWith(".jsonl")) files.push(file2);
18627
18672
  }
@@ -18629,7 +18674,7 @@ function listCodexSessionFiles(base2 = codexSessionsDir()) {
18629
18674
  }
18630
18675
  };
18631
18676
  walk3(base2);
18632
- if (path3.basename(base2) === "sessions") walk3(path3.join(path3.dirname(base2), "archived_sessions"));
18677
+ if (path4.basename(base2) === "sessions") walk3(path4.join(path4.dirname(base2), "archived_sessions"));
18633
18678
  const sessions = /* @__PURE__ */ new Map();
18634
18679
  for (const file2 of files.sort()) {
18635
18680
  try {
@@ -18779,6 +18824,7 @@ var CODEX_FALLBACK;
18779
18824
  var init_cost_codex = __esm({
18780
18825
  "src/cost-codex.ts"() {
18781
18826
  "use strict";
18827
+ init_esm_shims();
18782
18828
  init_litellm();
18783
18829
  CODEX_FALLBACK = [5e-6, 15e-6, 0, 25e-7];
18784
18830
  }
@@ -18786,17 +18832,17 @@ var init_cost_codex = __esm({
18786
18832
 
18787
18833
  // src/dlp.ts
18788
18834
  import fs4 from "fs";
18789
- import path4 from "path";
18835
+ import path5 from "path";
18790
18836
  function scanFilePath(filePath, cwd = process.cwd(), options = {}) {
18791
18837
  if (!filePath) return null;
18792
18838
  let resolved;
18793
18839
  try {
18794
- const absolute2 = path4.resolve(cwd, filePath);
18840
+ const absolute2 = path5.resolve(cwd, filePath);
18795
18841
  resolved = fs4.realpathSync.native(absolute2);
18796
18842
  } catch (err) {
18797
18843
  const code = err.code;
18798
18844
  if (code === "ENOENT" || code === "ENOTDIR") {
18799
- resolved = path4.resolve(cwd, filePath);
18845
+ resolved = path5.resolve(cwd, filePath);
18800
18846
  } else {
18801
18847
  return sensitivePathMatch(filePath);
18802
18848
  }
@@ -18806,16 +18852,17 @@ function scanFilePath(filePath, cwd = process.cwd(), options = {}) {
18806
18852
  var init_dlp = __esm({
18807
18853
  "src/dlp.ts"() {
18808
18854
  "use strict";
18855
+ init_esm_shims();
18809
18856
  init_dist();
18810
18857
  init_dist();
18811
18858
  }
18812
18859
  });
18813
18860
 
18814
18861
  // src/credential-files.ts
18815
- import path5 from "path";
18862
+ import path6 from "path";
18816
18863
  function homeCredentialFiles(home) {
18817
18864
  const f = (parts, description, score, kind = "credential") => ({
18818
- full: path5.join(home, ...parts),
18865
+ full: path6.join(home, ...parts),
18819
18866
  label: "~/" + parts.join("/"),
18820
18867
  description,
18821
18868
  score,
@@ -18842,6 +18889,7 @@ function homeCredentialFiles(home) {
18842
18889
  var init_credential_files = __esm({
18843
18890
  "src/credential-files.ts"() {
18844
18891
  "use strict";
18892
+ init_esm_shims();
18845
18893
  }
18846
18894
  });
18847
18895
 
@@ -18849,6 +18897,7 @@ var init_credential_files = __esm({
18849
18897
  var init_mcp_cmd = __esm({
18850
18898
  "src/mcp-cmd.ts"() {
18851
18899
  "use strict";
18900
+ init_esm_shims();
18852
18901
  }
18853
18902
  });
18854
18903
 
@@ -18856,6 +18905,7 @@ var init_mcp_cmd = __esm({
18856
18905
  var init_mcp_pin = __esm({
18857
18906
  "src/mcp-pin.ts"() {
18858
18907
  "use strict";
18908
+ init_esm_shims();
18859
18909
  }
18860
18910
  });
18861
18911
 
@@ -18864,6 +18914,7 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
18864
18914
  var init_mcp_wrap = __esm({
18865
18915
  "src/mcp-wrap.ts"() {
18866
18916
  "use strict";
18917
+ init_esm_shims();
18867
18918
  init_agent_wiring();
18868
18919
  init_mcp_cmd();
18869
18920
  init_mcp_pin();
@@ -18875,6 +18926,7 @@ var init_mcp_wrap = __esm({
18875
18926
  var init_platform_shell = __esm({
18876
18927
  "src/utils/platform-shell.ts"() {
18877
18928
  "use strict";
18929
+ init_esm_shims();
18878
18930
  }
18879
18931
  });
18880
18932
 
@@ -18883,6 +18935,7 @@ import { parse as parseToml2 } from "smol-toml";
18883
18935
  var init_codex_app_server = __esm({
18884
18936
  "src/codex-app-server.ts"() {
18885
18937
  "use strict";
18938
+ init_esm_shims();
18886
18939
  }
18887
18940
  });
18888
18941
 
@@ -18891,20 +18944,22 @@ import { parse as parseToml3 } from "smol-toml";
18891
18944
  var init_codex_trust = __esm({
18892
18945
  "src/codex-trust.ts"() {
18893
18946
  "use strict";
18947
+ init_esm_shims();
18894
18948
  init_platform_shell();
18895
18949
  init_codex_app_server();
18896
18950
  }
18897
18951
  });
18898
18952
 
18899
18953
  // src/daemon/hook-baseline.ts
18900
- import path6 from "path";
18954
+ import path7 from "path";
18901
18955
  import os4 from "os";
18902
18956
  var BASELINE_FILE, NOTIFIED_FILE;
18903
18957
  var init_hook_baseline = __esm({
18904
18958
  "src/daemon/hook-baseline.ts"() {
18905
18959
  "use strict";
18906
- BASELINE_FILE = path6.join(os4.homedir(), ".node9", "hooks-baseline.json");
18907
- NOTIFIED_FILE = path6.join(os4.homedir(), ".node9", "hook-heal-notified.json");
18960
+ init_esm_shims();
18961
+ BASELINE_FILE = path7.join(os4.homedir(), ".node9", "hooks-baseline.json");
18962
+ NOTIFIED_FILE = path7.join(os4.homedir(), ".node9", "hook-heal-notified.json");
18908
18963
  }
18909
18964
  });
18910
18965
 
@@ -18912,6 +18967,7 @@ var init_hook_baseline = __esm({
18912
18967
  var init_setup_opencode_shim = __esm({
18913
18968
  "src/setup-opencode-shim.ts"() {
18914
18969
  "use strict";
18970
+ init_esm_shims();
18915
18971
  }
18916
18972
  });
18917
18973
 
@@ -18919,15 +18975,16 @@ var init_setup_opencode_shim = __esm({
18919
18975
  var init_setup_pi_shim = __esm({
18920
18976
  "src/setup-pi-shim.ts"() {
18921
18977
  "use strict";
18978
+ init_esm_shims();
18922
18979
  }
18923
18980
  });
18924
18981
 
18925
18982
  // src/utils/atomic-write.ts
18926
18983
  import fs5 from "fs";
18927
- import path7 from "path";
18984
+ import path8 from "path";
18928
18985
  import { randomUUID } from "crypto";
18929
18986
  function atomicWriteSync(filePath, data, options) {
18930
- const dir2 = path7.dirname(filePath);
18987
+ const dir2 = path8.dirname(filePath);
18931
18988
  if (!fs5.existsSync(dir2)) fs5.mkdirSync(dir2, { recursive: true });
18932
18989
  const tmpPath = `${filePath}.${randomUUID()}.tmp`;
18933
18990
  try {
@@ -18952,12 +19009,13 @@ function atomicWriteSync(filePath, data, options) {
18952
19009
  var init_atomic_write = __esm({
18953
19010
  "src/utils/atomic-write.ts"() {
18954
19011
  "use strict";
19012
+ init_esm_shims();
18955
19013
  }
18956
19014
  });
18957
19015
 
18958
19016
  // src/setup.ts
18959
19017
  import fs6 from "fs";
18960
- import path8 from "path";
19018
+ import path9 from "path";
18961
19019
  import os5 from "os";
18962
19020
  import chalk from "chalk";
18963
19021
  import { confirm as rawConfirm } from "@inquirer/prompts";
@@ -18973,7 +19031,7 @@ function isNode9Hook(cmd) {
18973
19031
  }
18974
19032
  function claudeDesktopConfigPath(homeDir = os5.homedir()) {
18975
19033
  if (process.platform === "darwin") {
18976
- return path8.join(
19034
+ return path9.join(
18977
19035
  homeDir,
18978
19036
  "Library",
18979
19037
  "Application Support",
@@ -18982,37 +19040,37 @@ function claudeDesktopConfigPath(homeDir = os5.homedir()) {
18982
19040
  );
18983
19041
  }
18984
19042
  if (process.platform === "linux") {
18985
- return path8.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
19043
+ return path9.join(homeDir, ".config", "Claude", "claude_desktop_config.json");
18986
19044
  }
18987
19045
  if (process.platform === "win32") {
18988
- const appData = process.env.APPDATA || path8.join(homeDir, "AppData", "Roaming");
18989
- return path8.join(appData, "Claude", "claude_desktop_config.json");
19046
+ const appData = process.env.APPDATA || path9.join(homeDir, "AppData", "Roaming");
19047
+ return path9.join(appData, "Claude", "claude_desktop_config.json");
18990
19048
  }
18991
19049
  return null;
18992
19050
  }
18993
19051
  function opencodeConfigDir(home = os5.homedir()) {
18994
19052
  const xdg = process.env.XDG_CONFIG_HOME;
18995
- const base2 = xdg && path8.isAbsolute(xdg) ? xdg : path8.join(home, ".config");
18996
- return path8.join(base2, "opencode");
19053
+ const base2 = xdg && path9.isAbsolute(xdg) ? xdg : path9.join(home, ".config");
19054
+ return path9.join(base2, "opencode");
18997
19055
  }
18998
19056
  function commonBinDirs(home) {
18999
19057
  return [
19000
- path8.join(home, ".local", "bin"),
19001
- path8.join(home, ".bun", "bin"),
19002
- path8.join(home, ".npm-global", "bin"),
19058
+ path9.join(home, ".local", "bin"),
19059
+ path9.join(home, ".bun", "bin"),
19060
+ path9.join(home, ".npm-global", "bin"),
19003
19061
  "/usr/local/bin",
19004
19062
  "/opt/homebrew/bin"
19005
19063
  ];
19006
19064
  }
19007
19065
  function binaryInPath(binary, home = os5.homedir()) {
19008
19066
  const pathEnv = process.env.PATH ?? "";
19009
- const dirs = [...pathEnv.split(path8.delimiter), ...commonBinDirs(home)];
19067
+ const dirs = [...pathEnv.split(path9.delimiter), ...commonBinDirs(home)];
19010
19068
  const seen = /* @__PURE__ */ new Set();
19011
19069
  for (const dir2 of dirs) {
19012
19070
  if (!dir2 || seen.has(dir2)) continue;
19013
19071
  seen.add(dir2);
19014
19072
  try {
19015
- fs6.accessSync(path8.join(dir2, binary), fs6.constants.X_OK);
19073
+ fs6.accessSync(path9.join(dir2, binary), fs6.constants.X_OK);
19016
19074
  return true;
19017
19075
  } catch {
19018
19076
  }
@@ -19034,7 +19092,7 @@ function detectAgents(homeDir = os5.homedir()) {
19034
19092
  };
19035
19093
  const desktopPath = claudeDesktopConfigPath(homeDir);
19036
19094
  return {
19037
- claude: exists2(path8.join(homeDir, ".claude")) || exists2(path8.join(homeDir, ".claude.json")),
19095
+ claude: exists2(path9.join(homeDir, ".claude")) || exists2(path9.join(homeDir, ".claude.json")),
19038
19096
  // Antigravity (agy) shares the ~/.gemini root, so a bare
19039
19097
  // `exists(~/.gemini)` would report the (EOL'd) Gemini CLI as
19040
19098
  // installed on every agy machine — and `node9 init` would then
@@ -19044,19 +19102,19 @@ function detectAgents(homeDir = os5.homedir()) {
19044
19102
  // creates ~/.gemini/settings.json on first run; agy does not touch
19045
19103
  // it (it uses antigravity-cli/settings.json) — that file is the
19046
19104
  // legacy-CLI discriminator.
19047
- gemini: exists2(path8.join(homeDir, ".gemini", "settings.json")) || binaryInPath("gemini", homeDir),
19105
+ gemini: exists2(path9.join(homeDir, ".gemini", "settings.json")) || binaryInPath("gemini", homeDir),
19048
19106
  // agy creates ~/.gemini/antigravity-cli/ on first launch; the IDE
19049
19107
  // creates antigravity-ide/. PATH fallback covers installed-but-
19050
19108
  // never-launched (same class as opencode #186).
19051
- antigravity: exists2(path8.join(homeDir, ".gemini", "antigravity-cli")) || exists2(path8.join(homeDir, ".gemini", "antigravity-ide")) || binaryInPath("agy", homeDir),
19109
+ antigravity: exists2(path9.join(homeDir, ".gemini", "antigravity-cli")) || exists2(path9.join(homeDir, ".gemini", "antigravity-ide")) || binaryInPath("agy", homeDir),
19052
19110
  // GitHub Copilot CLI creates ~/.copilot on first launch; PATH
19053
19111
  // fallback covers installed-but-never-launched (same as opencode #186).
19054
- copilot: exists2(path8.join(homeDir, ".copilot")) || binaryInPath("copilot", homeDir),
19055
- cursor: exists2(path8.join(homeDir, ".cursor")),
19056
- codex: exists2(path8.join(homeDir, ".codex")),
19057
- windsurf: exists2(path8.join(homeDir, ".codeium", "windsurf")),
19058
- vscode: exists2(path8.join(homeDir, ".vscode")),
19059
- claudeDesktop: desktopPath !== null && exists2(path8.dirname(desktopPath)),
19112
+ copilot: exists2(path9.join(homeDir, ".copilot")) || binaryInPath("copilot", homeDir),
19113
+ cursor: exists2(path9.join(homeDir, ".cursor")),
19114
+ codex: exists2(path9.join(homeDir, ".codex")),
19115
+ windsurf: exists2(path9.join(homeDir, ".codeium", "windsurf")),
19116
+ vscode: exists2(path9.join(homeDir, ".vscode")),
19117
+ claudeDesktop: desktopPath !== null && exists2(path9.dirname(desktopPath)),
19060
19118
  // Opencode creates its config dir lazily on first launch — fall back to a
19061
19119
  // PATH lookup so installed-but-never-launched CLIs are still wired. Config
19062
19120
  // dir honors $XDG_CONFIG_HOME via opencodeConfigDir (#186, custom-XDG).
@@ -19067,7 +19125,7 @@ function detectAgents(homeDir = os5.homedir()) {
19067
19125
  // dir lazily on first launch — same class of bug as opencode's #186
19068
19126
  // (design R6) — so fall back to PATH lookup for installed-but-never-
19069
19127
  // launched pi.
19070
- pi: exists2(path8.join(homeDir, ".pi", "agent")) || binaryInPath("pi", homeDir),
19128
+ pi: exists2(path9.join(homeDir, ".pi", "agent")) || binaryInPath("pi", homeDir),
19071
19129
  // Hermes Agent (https://github.com/NousResearch/hermes-agent): home dir
19072
19130
  // is $HERMES_HOME (default ~/.hermes) per hermes_constants.py:30. config.yaml
19073
19131
  // appears after `hermes setup` has run; the directory alone exists from
@@ -19078,16 +19136,17 @@ function detectAgents(homeDir = os5.homedir()) {
19078
19136
  }
19079
19137
  function hermesHomeDir(homeDir = os5.homedir()) {
19080
19138
  const env = process.env.HERMES_HOME?.trim();
19081
- if (env && path8.isAbsolute(env)) return env;
19082
- return path8.join(homeDir, ".hermes");
19139
+ if (env && path9.isAbsolute(env)) return env;
19140
+ return path9.join(homeDir, ".hermes");
19083
19141
  }
19084
19142
  function hermesConfigPath(homeDir = os5.homedir()) {
19085
- return path8.join(hermesHomeDir(homeDir), HERMES_CONFIG_FILENAME);
19143
+ return path9.join(hermesHomeDir(homeDir), HERMES_CONFIG_FILENAME);
19086
19144
  }
19087
19145
  var HERMES_CONFIG_FILENAME;
19088
19146
  var init_setup = __esm({
19089
19147
  "src/setup.ts"() {
19090
19148
  "use strict";
19149
+ init_esm_shims();
19091
19150
  init_mcp_wrap();
19092
19151
  init_codex_trust();
19093
19152
  init_codex_app_server();
@@ -19102,7 +19161,7 @@ var init_setup = __esm({
19102
19161
 
19103
19162
  // src/agent-wiring.ts
19104
19163
  import fs7 from "fs";
19105
- import path9 from "path";
19164
+ import path10 from "path";
19106
19165
  import os6 from "os";
19107
19166
  import * as yaml2 from "yaml";
19108
19167
  import { parse as parseToml5 } from "smol-toml";
@@ -19213,6 +19272,7 @@ var exists, ck, lg, DEFAULT_LABEL_PAD, hookLabelOf, AGENT_SPECS;
19213
19272
  var init_agent_wiring = __esm({
19214
19273
  "src/agent-wiring.ts"() {
19215
19274
  "use strict";
19275
+ init_esm_shims();
19216
19276
  init_setup();
19217
19277
  exists = (p) => {
19218
19278
  try {
@@ -19230,55 +19290,55 @@ var init_agent_wiring = __esm({
19230
19290
  id: "claude",
19231
19291
  label: "Claude Code",
19232
19292
  setupCommand: "node9 agents add claude",
19233
- hookFile: (h) => path9.join(h, ".claude", "settings.json"),
19293
+ hookFile: (h) => path10.join(h, ".claude", "settings.json"),
19234
19294
  hookFormat: "matcher",
19235
19295
  // UserPromptSubmit is prompt DLP. setup.ts has written it for Claude since
19236
19296
  // that shipped; the spec must name it too, or status/doctor never show the
19237
19297
  // row and heal (which repairs via setupAgent) has no signal it is missing.
19238
19298
  hookEvents: [ck("PreToolUse"), lg("PostToolUse"), ck("UserPromptSubmit")],
19239
- mcpFile: (h) => path9.join(h, ".claude.json"),
19240
- present: (h) => exists(path9.join(h, ".claude", "settings.json")) || exists(path9.join(h, ".claude.json"))
19299
+ mcpFile: (h) => path10.join(h, ".claude.json"),
19300
+ present: (h) => exists(path10.join(h, ".claude", "settings.json")) || exists(path10.join(h, ".claude.json"))
19241
19301
  },
19242
19302
  {
19243
19303
  id: "gemini",
19244
19304
  label: "Gemini CLI",
19245
19305
  setupCommand: "node9 agents add gemini",
19246
- hookFile: (h) => path9.join(h, ".gemini", "settings.json"),
19306
+ hookFile: (h) => path10.join(h, ".gemini", "settings.json"),
19247
19307
  hookFormat: "matcher",
19248
19308
  hookEvents: [ck("BeforeTool"), lg("AfterTool")],
19249
- mcpFile: (h) => path9.join(h, ".gemini", "settings.json"),
19250
- present: (h) => exists(path9.join(h, ".gemini", "settings.json"))
19309
+ mcpFile: (h) => path10.join(h, ".gemini", "settings.json"),
19310
+ present: (h) => exists(path10.join(h, ".gemini", "settings.json"))
19251
19311
  },
19252
19312
  {
19253
19313
  id: "codex",
19254
19314
  label: "Codex",
19255
19315
  setupCommand: "node9 agents add codex",
19256
- hookFile: (h) => path9.join(h, ".codex", "hooks.json"),
19316
+ hookFile: (h) => path10.join(h, ".codex", "hooks.json"),
19257
19317
  hookFormat: "matcher",
19258
19318
  hookEvents: [ck("PreToolUse"), ck("UserPromptSubmit")],
19259
- mcpFile: (h) => path9.join(h, ".codex", "config.toml"),
19319
+ mcpFile: (h) => path10.join(h, ".codex", "config.toml"),
19260
19320
  mcpFormat: "toml",
19261
- present: (h) => exists(path9.join(h, ".codex"))
19321
+ present: (h) => exists(path10.join(h, ".codex"))
19262
19322
  },
19263
19323
  {
19264
19324
  id: "antigravity",
19265
19325
  label: "Antigravity",
19266
19326
  setupCommand: "node9 agents add antigravity",
19267
- hookFile: (h) => path9.join(h, ".gemini", "config", "hooks.json"),
19327
+ hookFile: (h) => path10.join(h, ".gemini", "config", "hooks.json"),
19268
19328
  hookFormat: "matcher",
19269
19329
  hookEvents: [ck("PreToolUse"), lg("PostToolUse")],
19270
- mcpFile: (h) => path9.join(h, ".gemini", "config", "mcp_config.json"),
19271
- present: (h) => exists(path9.join(h, ".gemini", "config", "hooks.json")) || exists(path9.join(h, ".gemini", "antigravity-cli")) || exists(path9.join(h, ".gemini", "antigravity-ide"))
19330
+ mcpFile: (h) => path10.join(h, ".gemini", "config", "mcp_config.json"),
19331
+ present: (h) => exists(path10.join(h, ".gemini", "config", "hooks.json")) || exists(path10.join(h, ".gemini", "antigravity-cli")) || exists(path10.join(h, ".gemini", "antigravity-ide"))
19272
19332
  },
19273
19333
  {
19274
19334
  id: "copilot",
19275
19335
  label: "GitHub Copilot",
19276
19336
  setupCommand: "node9 agents add copilot",
19277
- hookFile: (h) => path9.join(h, ".copilot", "hooks", "node9.json"),
19337
+ hookFile: (h) => path10.join(h, ".copilot", "hooks", "node9.json"),
19278
19338
  hookFormat: "flat",
19279
19339
  hookEvents: [ck("PreToolUse"), lg("PostToolUse"), ck("UserPromptSubmit")],
19280
- mcpFile: (h) => path9.join(h, ".copilot", "mcp-config.json"),
19281
- present: (h) => exists(path9.join(h, ".copilot"))
19340
+ mcpFile: (h) => path10.join(h, ".copilot", "mcp-config.json"),
19341
+ present: (h) => exists(path10.join(h, ".copilot"))
19282
19342
  },
19283
19343
  {
19284
19344
  id: "cursor",
@@ -19287,8 +19347,8 @@ var init_agent_wiring = __esm({
19287
19347
  // MCP-only — no hook file (see note above).
19288
19348
  hookFormat: "flat",
19289
19349
  hookEvents: [],
19290
- mcpFile: (h) => path9.join(h, ".cursor", "mcp.json"),
19291
- present: (h) => exists(path9.join(h, ".cursor", "mcp.json"))
19350
+ mcpFile: (h) => path10.join(h, ".cursor", "mcp.json"),
19351
+ present: (h) => exists(path10.join(h, ".cursor", "mcp.json"))
19292
19352
  },
19293
19353
  // The three MCP-only agents below came over from `getAgentsStatus` (fw#421
19294
19354
  // P3), so one registry answers every "is it wired" question.
@@ -19298,9 +19358,9 @@ var init_agent_wiring = __esm({
19298
19358
  setupCommand: "node9 agents add windsurf",
19299
19359
  hookFormat: "flat",
19300
19360
  hookEvents: [],
19301
- mcpFile: (h) => path9.join(h, ".codeium", "windsurf", "mcp_config.json"),
19361
+ mcpFile: (h) => path10.join(h, ".codeium", "windsurf", "mcp_config.json"),
19302
19362
  mcpInventory: false,
19303
- present: (h) => exists(path9.join(h, ".codeium", "windsurf"))
19363
+ present: (h) => exists(path10.join(h, ".codeium", "windsurf"))
19304
19364
  },
19305
19365
  {
19306
19366
  id: "vscode",
@@ -19308,10 +19368,10 @@ var init_agent_wiring = __esm({
19308
19368
  setupCommand: "node9 agents add vscode",
19309
19369
  hookFormat: "flat",
19310
19370
  hookEvents: [],
19311
- mcpFile: (h) => path9.join(h, ".vscode", "mcp.json"),
19371
+ mcpFile: (h) => path10.join(h, ".vscode", "mcp.json"),
19312
19372
  mcpFormat: "vscode",
19313
19373
  mcpInventory: false,
19314
- present: (h) => exists(path9.join(h, ".vscode"))
19374
+ present: (h) => exists(path10.join(h, ".vscode"))
19315
19375
  },
19316
19376
  {
19317
19377
  id: "claudeDesktop",
@@ -19320,11 +19380,11 @@ var init_agent_wiring = __esm({
19320
19380
  hookFormat: "flat",
19321
19381
  hookEvents: [],
19322
19382
  // The per-platform config path; its parent directory is the footprint.
19323
- mcpFile: (h) => claudeDesktopConfigPath(h) ?? path9.join(h, ".config", "Claude", "claude_desktop_config.json"),
19383
+ mcpFile: (h) => claudeDesktopConfigPath(h) ?? path10.join(h, ".config", "Claude", "claude_desktop_config.json"),
19324
19384
  mcpInventory: false,
19325
19385
  present: (h) => {
19326
19386
  const p = claudeDesktopConfigPath(h);
19327
- return p !== null && exists(path9.dirname(p));
19387
+ return p !== null && exists(path10.dirname(p));
19328
19388
  }
19329
19389
  },
19330
19390
  {
@@ -19346,8 +19406,8 @@ var init_agent_wiring = __esm({
19346
19406
  setupCommand: "node9 agents add opencode",
19347
19407
  hookFormat: "flat",
19348
19408
  hookEvents: [],
19349
- shimFile: (h) => path9.join(opencodeConfigDir(h), "plugins", "node9.js"),
19350
- present: (h) => exists(opencodeConfigDir(h)) || exists(path9.join(opencodeConfigDir(h), "plugins", "node9.js"))
19409
+ shimFile: (h) => path10.join(opencodeConfigDir(h), "plugins", "node9.js"),
19410
+ present: (h) => exists(opencodeConfigDir(h)) || exists(path10.join(opencodeConfigDir(h), "plugins", "node9.js"))
19351
19411
  },
19352
19412
  {
19353
19413
  id: "pi",
@@ -19355,8 +19415,8 @@ var init_agent_wiring = __esm({
19355
19415
  setupCommand: "node9 agents add pi",
19356
19416
  hookFormat: "flat",
19357
19417
  hookEvents: [],
19358
- shimFile: (h) => path9.join(h, ".pi", "agent", "extensions", "node9.js"),
19359
- present: (h) => exists(path9.join(h, ".pi", "agent")) || exists(path9.join(h, ".pi", "agent", "extensions", "node9.js"))
19418
+ shimFile: (h) => path10.join(h, ".pi", "agent", "extensions", "node9.js"),
19419
+ present: (h) => exists(path10.join(h, ".pi", "agent")) || exists(path10.join(h, ".pi", "agent", "extensions", "node9.js"))
19360
19420
  }
19361
19421
  ];
19362
19422
  }
@@ -19438,6 +19498,7 @@ var B, SEP, LEGACY_BASH_PATH_RULE;
19438
19498
  var init_build = __esm({
19439
19499
  "src/shields/build.ts"() {
19440
19500
  "use strict";
19501
+ init_esm_shims();
19441
19502
  init_dist();
19442
19503
  B = "[\\s/\\\\]";
19443
19504
  SEP = "[/\\\\]";
@@ -19447,7 +19508,7 @@ var init_build = __esm({
19447
19508
 
19448
19509
  // src/shields.ts
19449
19510
  import fs8 from "fs";
19450
- import path10 from "path";
19511
+ import path11 from "path";
19451
19512
  import os7 from "os";
19452
19513
  function loadUserShields() {
19453
19514
  const result = {};
@@ -19464,7 +19525,7 @@ function loadUserShields() {
19464
19525
  return result;
19465
19526
  }
19466
19527
  for (const file2 of entries) {
19467
- const filePath = path10.join(USER_SHIELDS_DIR, file2);
19528
+ const filePath = path11.join(USER_SHIELDS_DIR, file2);
19468
19529
  try {
19469
19530
  const raw = JSON.parse(fs8.readFileSync(filePath, "utf-8"));
19470
19531
  const v = validateShieldDefinition(raw);
@@ -19528,21 +19589,22 @@ var USER_SHIELDS_DIR, SHIELDS, SHIELDS_STATE_FILE;
19528
19589
  var init_shields = __esm({
19529
19590
  "src/shields.ts"() {
19530
19591
  "use strict";
19592
+ init_esm_shims();
19531
19593
  init_dist();
19532
19594
  init_build();
19533
19595
  init_dist();
19534
- USER_SHIELDS_DIR = path10.join(os7.homedir(), ".node9", "shields");
19596
+ USER_SHIELDS_DIR = path11.join(os7.homedir(), ".node9", "shields");
19535
19597
  SHIELDS = buildSHIELDS();
19536
- SHIELDS_STATE_FILE = path10.join(os7.homedir(), ".node9", "shields.json");
19598
+ SHIELDS_STATE_FILE = path11.join(os7.homedir(), ".node9", "shields.json");
19537
19599
  }
19538
19600
  });
19539
19601
 
19540
19602
  // src/shields/jail.ts
19541
19603
  import fs9 from "fs";
19542
19604
  import os8 from "os";
19543
- import path11 from "path";
19605
+ import path12 from "path";
19544
19606
  function jailStorePath() {
19545
- return path11.join(os8.homedir(), ".node9", "jail-paths.json");
19607
+ return path12.join(os8.homedir(), ".node9", "jail-paths.json");
19546
19608
  }
19547
19609
  function readJailPaths() {
19548
19610
  let text;
@@ -19577,6 +19639,7 @@ var USER_JAIL_SHIELD;
19577
19639
  var init_jail = __esm({
19578
19640
  "src/shields/jail.ts"() {
19579
19641
  "use strict";
19642
+ init_esm_shims();
19580
19643
  init_build();
19581
19644
  init_dist();
19582
19645
  init_shields();
@@ -19587,9 +19650,9 @@ var init_jail = __esm({
19587
19650
  // src/canary/registry.ts
19588
19651
  import fs10 from "fs";
19589
19652
  import os9 from "os";
19590
- import path12 from "path";
19653
+ import path13 from "path";
19591
19654
  function canaryStorePath() {
19592
- return path12.join(os9.homedir(), ".node9", "canaries.json");
19655
+ return path13.join(os9.homedir(), ".node9", "canaries.json");
19593
19656
  }
19594
19657
  function isRecord(x) {
19595
19658
  if (!x || typeof x !== "object") return false;
@@ -19633,6 +19696,7 @@ function canaryCtxValues() {
19633
19696
  var init_registry = __esm({
19634
19697
  "src/canary/registry.ts"() {
19635
19698
  "use strict";
19699
+ init_esm_shims();
19636
19700
  init_dist();
19637
19701
  init_jail();
19638
19702
  }
@@ -19679,17 +19743,18 @@ function readCappedText(file2, maxBytes, openFlags = "r") {
19679
19743
  var init_read_capped = __esm({
19680
19744
  "src/utils/read-capped.ts"() {
19681
19745
  "use strict";
19746
+ init_esm_shims();
19682
19747
  }
19683
19748
  });
19684
19749
 
19685
19750
  // src/posture/secrets.ts
19686
19751
  import fs12 from "fs";
19687
- import path13 from "path";
19752
+ import path14 from "path";
19688
19753
  import os10 from "os";
19689
19754
  function displayPath(p, home) {
19690
19755
  if (p === home) return "~";
19691
- const prefix = home.endsWith(path13.sep) ? home : home + path13.sep;
19692
- if (p.startsWith(prefix)) return "~" + path13.sep + p.slice(prefix.length);
19756
+ const prefix = home.endsWith(path14.sep) ? home : home + path14.sep;
19757
+ if (p.startsWith(prefix)) return "~" + path14.sep + p.slice(prefix.length);
19693
19758
  return p;
19694
19759
  }
19695
19760
  function safeRead(file2) {
@@ -19701,7 +19766,7 @@ function candidateFiles(home, cwd) {
19701
19766
  const files = /* @__PURE__ */ new Set();
19702
19767
  try {
19703
19768
  for (const name of fs12.readdirSync(cwd)) {
19704
- if (name === ".env" || name.startsWith(".env.")) files.add(path13.join(cwd, name));
19769
+ if (name === ".env" || name.startsWith(".env.")) files.add(path14.join(cwd, name));
19705
19770
  }
19706
19771
  } catch {
19707
19772
  }
@@ -19709,7 +19774,7 @@ function candidateFiles(home, cwd) {
19709
19774
  if (spec.hookFile) files.add(spec.hookFile(home));
19710
19775
  if (spec.mcpFile) files.add(spec.mcpFile(home));
19711
19776
  }
19712
- files.add(path13.join(home, ".env"));
19777
+ files.add(path14.join(home, ".env"));
19713
19778
  return [...files];
19714
19779
  }
19715
19780
  function credentialMaterial(home) {
@@ -19816,6 +19881,7 @@ var MAX_FILE_BYTES;
19816
19881
  var init_secrets = __esm({
19817
19882
  "src/posture/secrets.ts"() {
19818
19883
  "use strict";
19884
+ init_esm_shims();
19819
19885
  init_dist();
19820
19886
  init_agent_wiring();
19821
19887
  init_registry();
@@ -19830,8 +19896,8 @@ var init_secrets = __esm({
19830
19896
  import { z } from "zod";
19831
19897
  function formatIssues(issues) {
19832
19898
  const lines = issues.map((issue) => {
19833
- const path48 = issue.path.length > 0 ? issue.path.map(String).join(".") : "root";
19834
- return ` \u2022 ${path48}: ${issue.message}`;
19899
+ const path49 = issue.path.length > 0 ? issue.path.map(String).join(".") : "root";
19900
+ return ` \u2022 ${path49}: ${issue.message}`;
19835
19901
  });
19836
19902
  return `Invalid config:
19837
19903
  ${lines.join("\n")}`;
@@ -19844,9 +19910,9 @@ function prunePaths(root, paths) {
19844
19910
  const yi = y[y.length - 1];
19845
19911
  return typeof xi === "number" && typeof yi === "number" ? yi - xi : 0;
19846
19912
  });
19847
- for (const path48 of ordered) {
19913
+ for (const path49 of ordered) {
19848
19914
  let cur = root;
19849
- for (const key of path48.slice(0, -1)) {
19915
+ for (const key of path49.slice(0, -1)) {
19850
19916
  if (cur === null || typeof cur !== "object") {
19851
19917
  cur = void 0;
19852
19918
  break;
@@ -19854,7 +19920,7 @@ function prunePaths(root, paths) {
19854
19920
  cur = cur[key];
19855
19921
  }
19856
19922
  if (cur === null || typeof cur !== "object") continue;
19857
- const last = path48[path48.length - 1];
19923
+ const last = path49[path49.length - 1];
19858
19924
  if (Array.isArray(cur)) {
19859
19925
  const i = Number(last);
19860
19926
  if (Number.isInteger(i) && i >= 0 && i < cur.length) {
@@ -19890,7 +19956,7 @@ function sanitizeConfig(raw) {
19890
19956
  return issue.keys.map((k) => [...at, k]);
19891
19957
  }
19892
19958
  return [at.slice(0, -level || void 0)];
19893
- }).filter((path48) => path48.length > 0);
19959
+ }).filter((path49) => path49.length > 0);
19894
19960
  if (paths.length === 0 || !prunePaths(working, paths)) break;
19895
19961
  }
19896
19962
  if (ConfigFileSchema.safeParse(working).success) break;
@@ -19914,6 +19980,7 @@ var noNewlines, SmartConditionSchema, SmartRuleSchema, ConfigFileSchema;
19914
19980
  var init_config_schema = __esm({
19915
19981
  "src/config-schema.ts"() {
19916
19982
  "use strict";
19983
+ init_esm_shims();
19917
19984
  noNewlines = z.string().refine((s) => !s.includes("\n") && !s.includes("\r"), {
19918
19985
  message: "Value must not contain literal newline characters (use \\n instead)"
19919
19986
  });
@@ -20211,6 +20278,7 @@ var MODE_ORDER, EGRESS_MODE_ORDER, DLP_PII_ORDER, DLP_REVIEW_ACTION_ORDER, COMMA
20211
20278
  var init_managed = __esm({
20212
20279
  "src/config/managed.ts"() {
20213
20280
  "use strict";
20281
+ init_esm_shims();
20214
20282
  MODE_ORDER = ["observe", "audit", "soft", "standard", "strict", "block-all"];
20215
20283
  EGRESS_MODE_ORDER = ["off", "review", "block"];
20216
20284
  DLP_PII_ORDER = ["off", "block"];
@@ -20233,10 +20301,10 @@ var init_managed = __esm({
20233
20301
 
20234
20302
  // src/auth/trusted-hosts.ts
20235
20303
  import fs13 from "fs";
20236
- import path14 from "path";
20304
+ import path15 from "path";
20237
20305
  import os11 from "os";
20238
20306
  function getTrustedHostsPath() {
20239
- return path14.join(os11.homedir(), ".node9", "trusted-hosts.json");
20307
+ return path15.join(os11.homedir(), ".node9", "trusted-hosts.json");
20240
20308
  }
20241
20309
  function readTrustedHosts() {
20242
20310
  try {
@@ -20288,6 +20356,7 @@ var _cache, CACHE_TTL_MS;
20288
20356
  var init_trusted_hosts = __esm({
20289
20357
  "src/auth/trusted-hosts.ts"() {
20290
20358
  "use strict";
20359
+ init_esm_shims();
20291
20360
  _cache = null;
20292
20361
  CACHE_TTL_MS = 5e3;
20293
20362
  }
@@ -20395,6 +20464,7 @@ var CONFIG_FILE_VERSION_2, SETTINGS_WITH_A_HOME, APPROVER_CHANNELS, KNOWN_V2_KEY
20395
20464
  var init_v2 = __esm({
20396
20465
  "src/config/v2.ts"() {
20397
20466
  "use strict";
20467
+ init_esm_shims();
20398
20468
  init_dist();
20399
20469
  init_dist();
20400
20470
  init_config();
@@ -20461,6 +20531,7 @@ var DEFAULT_API_URL, LOOPBACK, HOST_ALLOW_ENV;
20461
20531
  var init_api_url = __esm({
20462
20532
  "src/auth/api-url.ts"() {
20463
20533
  "use strict";
20534
+ init_esm_shims();
20464
20535
  DEFAULT_API_URL = "https://api.node9.ai/api/v1/intercept";
20465
20536
  LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "[::1]", "0.0.0.0"]);
20466
20537
  HOST_ALLOW_ENV = "NODE9_API_HOST_ALLOW";
@@ -20469,7 +20540,7 @@ var init_api_url = __esm({
20469
20540
 
20470
20541
  // src/config/index.ts
20471
20542
  import fs14 from "fs";
20472
- import path15 from "path";
20543
+ import path16 from "path";
20473
20544
  import os12 from "os";
20474
20545
  function sanitizeSsrfAllow(entries, source) {
20475
20546
  const kept = [];
@@ -20493,7 +20564,7 @@ function noteRejectedApiUrl(raw) {
20493
20564
  rejectedApiUrlsSeen.add(key);
20494
20565
  try {
20495
20566
  fs14.appendFileSync(
20496
- path15.join(os12.homedir(), ".node9", "hook-debug.log"),
20567
+ path16.join(os12.homedir(), ".node9", "hook-debug.log"),
20497
20568
  `[${(/* @__PURE__ */ new Date()).toISOString()}] REFUSED apiUrl, using the default instead: ${String(raw).slice(0, 200).replace(/[\r\n]+/g, " ")}
20498
20569
  `
20499
20570
  );
@@ -20510,7 +20581,7 @@ function getCredentials() {
20510
20581
  };
20511
20582
  }
20512
20583
  try {
20513
- const credPath = path15.join(os12.homedir(), ".node9", "credentials.json");
20584
+ const credPath = path16.join(os12.homedir(), ".node9", "credentials.json");
20514
20585
  if (fs14.existsSync(credPath)) {
20515
20586
  const creds = JSON.parse(fs14.readFileSync(credPath, "utf-8"));
20516
20587
  const profileName = process.env.NODE9_PROFILE || "default";
@@ -20559,7 +20630,7 @@ function readRulesCacheResilient(cacheFile) {
20559
20630
  }
20560
20631
  }
20561
20632
  if (existed || sawReadError) {
20562
- const backup = path15.join(path15.dirname(cacheFile), "rules-cache.last-good.json");
20633
+ const backup = path16.join(path16.dirname(cacheFile), "rules-cache.last-good.json");
20563
20634
  if (backup !== cacheFile) {
20564
20635
  try {
20565
20636
  const raw = JSON.parse(fs14.readFileSync(backup, "utf-8"));
@@ -20583,7 +20654,7 @@ function logCacheReadIssue(cacheFile, kind) {
20583
20654
  cacheReadLastLoggedAt = now;
20584
20655
  try {
20585
20656
  fs14.appendFileSync(
20586
- path15.join(os12.homedir(), ".node9", "hook-debug.log"),
20657
+ path16.join(os12.homedir(), ".node9", "hook-debug.log"),
20587
20658
  `[${(/* @__PURE__ */ new Date()).toISOString()}] ${kind} ${cacheFile}
20588
20659
  `
20589
20660
  );
@@ -20600,8 +20671,8 @@ function catalogSettingsFrom(settings, policy) {
20600
20671
  }
20601
20672
  function getConfig(cwd) {
20602
20673
  if (!cwd && cachedConfig) return cachedConfig;
20603
- const globalPath = path15.join(os12.homedir(), ".node9", "config.json");
20604
- const projectPath = path15.join(cwd ?? process.cwd(), "node9.config.json");
20674
+ const globalPath = path16.join(os12.homedir(), ".node9", "config.json");
20675
+ const projectPath = path16.join(cwd ?? process.cwd(), "node9.config.json");
20605
20676
  const globalConfig = tryLoadConfig(globalPath);
20606
20677
  const projectConfig = tryLoadConfig(projectPath, { project: true });
20607
20678
  const mergedSettings = {
@@ -20846,7 +20917,7 @@ function getConfig(cwd) {
20846
20917
  let cloudMandatesEnforcement = false;
20847
20918
  let cloudMandatesAppPerm = false;
20848
20919
  {
20849
- const cacheFile = path15.join(os12.homedir(), ".node9", "rules-cache.json");
20920
+ const cacheFile = path16.join(os12.homedir(), ".node9", "rules-cache.json");
20850
20921
  try {
20851
20922
  const raw = readRulesCacheResilient(cacheFile);
20852
20923
  if (Array.isArray(raw.rules) && raw.rules.length > 0) {
@@ -21039,13 +21110,13 @@ function getConfig(cwd) {
21039
21110
  }
21040
21111
  if (Array.isArray(mc.jailPaths)) {
21041
21112
  for (const jp of mc.jailPaths) {
21042
- const path48 = typeof jp?.path === "string" ? jp.path.trim() : "";
21043
- if (!path48) continue;
21113
+ const path49 = typeof jp?.path === "string" ? jp.path.trim() : "";
21114
+ if (!path49) continue;
21044
21115
  const verdict = jp?.verdict === "review" ? "review" : "block";
21045
- for (const r of pathRules(path48, verdict, "org-managed jail")) {
21116
+ for (const r of pathRules(path49, verdict, "org-managed jail")) {
21046
21117
  mergedPolicy.smartRules.push({ ...r, name: `org:${r.name}` });
21047
21118
  }
21048
- mergedPolicy.managedJailPaths.push({ path: path48, verdict });
21119
+ mergedPolicy.managedJailPaths.push({ path: path49, verdict });
21049
21120
  }
21050
21121
  }
21051
21122
  if (Array.isArray(mc.trustedHosts)) {
@@ -21383,6 +21454,7 @@ var DANGEROUS_WORDS, RUNTIME_ONLY_CONFIG_KEYS, DEFAULT_CONFIG, RM_SAFE_PATH_PATT
21383
21454
  var init_config = __esm({
21384
21455
  "src/config/index.ts"() {
21385
21456
  "use strict";
21457
+ init_esm_shims();
21386
21458
  init_config_schema();
21387
21459
  init_shields();
21388
21460
  init_managed();
@@ -21739,6 +21811,7 @@ var ALLOWED_DOMAINS_PATH;
21739
21811
  var init_templates = __esm({
21740
21812
  "src/sandbox/templates.ts"() {
21741
21813
  "use strict";
21814
+ init_esm_shims();
21742
21815
  ALLOWED_DOMAINS_PATH = "/etc/node9-sandbox/allowed-domains.txt";
21743
21816
  }
21744
21817
  });
@@ -21871,6 +21944,7 @@ function checkEgress(ctx) {
21871
21944
  var init_egress = __esm({
21872
21945
  "src/posture/egress.ts"() {
21873
21946
  "use strict";
21947
+ init_esm_shims();
21874
21948
  init_config();
21875
21949
  init_templates();
21876
21950
  }
@@ -22082,6 +22156,7 @@ var PRE_ENGINE_GATES, GATE_LABELS;
22082
22156
  var init_gate_order = __esm({
22083
22157
  "src/policy/gate-order.ts"() {
22084
22158
  "use strict";
22159
+ init_esm_shims();
22085
22160
  PRE_ENGINE_GATES = ["file", "dlp", "pii", "package"];
22086
22161
  GATE_LABELS = {
22087
22162
  dlpBlock: "\u{1F6A8} Node9 DLP (Secret Detected)",
@@ -22096,16 +22171,16 @@ var init_gate_order = __esm({
22096
22171
  // src/policy/file-access.ts
22097
22172
  import fs16 from "fs";
22098
22173
  import os13 from "os";
22099
- import path16 from "path";
22174
+ import path17 from "path";
22100
22175
  function absoluteSpelling(p, cwd, home) {
22101
22176
  if (p === "~" || p.startsWith("~/")) p = home + p.slice(1);
22102
- return path16.isAbsolute(p) ? p : `${cwd}/${p}`;
22177
+ return path17.isAbsolute(p) ? p : `${cwd}/${p}`;
22103
22178
  }
22104
22179
  function physical(p, followFinal, links = 0) {
22105
22180
  if (links > 40) throw new Error("Too many symbolic links");
22106
22181
  if (!followFinal) {
22107
- const parent = physical(path16.dirname(p), true, links);
22108
- return { path: `${parent.path}/${path16.basename(p)}`, missing: parent.missing };
22182
+ const parent = physical(path17.dirname(p), true, links);
22183
+ return { path: `${parent.path}/${path17.basename(p)}`, missing: parent.missing };
22109
22184
  }
22110
22185
  try {
22111
22186
  return { path: fs16.realpathSync.native(p), missing: false };
@@ -22116,7 +22191,7 @@ function physical(p, followFinal, links = 0) {
22116
22191
  if (fs16.lstatSync(p).isSymbolicLink()) {
22117
22192
  const target = fs16.readlinkSync(p);
22118
22193
  return physical(
22119
- path16.isAbsolute(target) ? target : `${path16.dirname(p)}/${target}`,
22194
+ path17.isAbsolute(target) ? target : `${path17.dirname(p)}/${target}`,
22120
22195
  true,
22121
22196
  links + 1
22122
22197
  );
@@ -22125,10 +22200,10 @@ function physical(p, followFinal, links = 0) {
22125
22200
  if (!["ENOENT", "ENOTDIR"].includes(linkError.code ?? ""))
22126
22201
  throw linkError;
22127
22202
  }
22128
- const parent = path16.dirname(p);
22203
+ const parent = path17.dirname(p);
22129
22204
  if (parent === p) return { path: p, missing: true };
22130
22205
  const resolved = physical(parent, true, links);
22131
- return { path: `${resolved.path}/${path16.basename(p)}`, missing: true };
22206
+ return { path: `${resolved.path}/${path17.basename(p)}`, missing: true };
22132
22207
  }
22133
22208
  }
22134
22209
  function prepareFileAccesses(tool, args, cwd = process.cwd(), inspection = {}, home = os13.homedir()) {
@@ -22211,6 +22286,7 @@ function prepareFileAccesses(tool, args, cwd = process.cwd(), inspection = {}, h
22211
22286
  var init_file_access = __esm({
22212
22287
  "src/policy/file-access.ts"() {
22213
22288
  "use strict";
22289
+ init_esm_shims();
22214
22290
  init_dist();
22215
22291
  }
22216
22292
  });
@@ -22218,13 +22294,13 @@ var init_file_access = __esm({
22218
22294
  // src/supply-chain/osv-index.ts
22219
22295
  import fs17 from "fs";
22220
22296
  import os14 from "os";
22221
- import path17 from "path";
22297
+ import path18 from "path";
22222
22298
  import { createHash as createHash4 } from "crypto";
22223
22299
  function osvRoot() {
22224
- return path17.join(os14.homedir(), ".node9", "osv");
22300
+ return path18.join(os14.homedir(), ".node9", "osv");
22225
22301
  }
22226
22302
  function ecoDir(eco) {
22227
- return path17.join(osvRoot(), eco);
22303
+ return path18.join(osvRoot(), eco);
22228
22304
  }
22229
22305
  function indexKey(eco, name) {
22230
22306
  switch (eco) {
@@ -22243,11 +22319,11 @@ function shardOf(key) {
22243
22319
  return createHash4("sha1").update(key).digest("hex").slice(0, 2);
22244
22320
  }
22245
22321
  function shardPath(eco, shard) {
22246
- return path17.join(ecoDir(eco), "shards", `${shard}.json`);
22322
+ return path18.join(ecoDir(eco), "shards", `${shard}.json`);
22247
22323
  }
22248
22324
  function readMeta(eco) {
22249
22325
  try {
22250
- const m = JSON.parse(fs17.readFileSync(path17.join(ecoDir(eco), "meta.json"), "utf8"));
22326
+ const m = JSON.parse(fs17.readFileSync(path18.join(ecoDir(eco), "meta.json"), "utf8"));
22251
22327
  if (typeof m?.syncedAt !== "string" || typeof m?.lastModifiedMs !== "number") return null;
22252
22328
  return m;
22253
22329
  } catch {
@@ -22303,6 +22379,7 @@ var INDEX_FRESH_MS;
22303
22379
  var init_osv_index = __esm({
22304
22380
  "src/supply-chain/osv-index.ts"() {
22305
22381
  "use strict";
22382
+ init_esm_shims();
22306
22383
  init_dist();
22307
22384
  init_atomic_write();
22308
22385
  INDEX_FRESH_MS = 72 * 60 * 60 * 1e3;
@@ -22359,6 +22436,7 @@ var DEFAULTS, OVERRIDES;
22359
22436
  var init_net = __esm({
22360
22437
  "src/supply-chain/net.ts"() {
22361
22438
  "use strict";
22439
+ init_esm_shims();
22362
22440
  DEFAULTS = {
22363
22441
  osvBucket: "https://osv-vulnerabilities.storage.googleapis.com",
22364
22442
  osvApi: "https://api.osv.dev",
@@ -22398,6 +22476,7 @@ var TIMEOUT_MS;
22398
22476
  var init_osv_online = __esm({
22399
22477
  "src/supply-chain/osv-online.ts"() {
22400
22478
  "use strict";
22479
+ init_esm_shims();
22401
22480
  init_net();
22402
22481
  TIMEOUT_MS = 2500;
22403
22482
  }
@@ -22489,6 +22568,7 @@ var TIMEOUT_MS2, MAX_BYTES, PYPI_FINAL;
22489
22568
  var init_provenance = __esm({
22490
22569
  "src/supply-chain/provenance.ts"() {
22491
22570
  "use strict";
22571
+ init_esm_shims();
22492
22572
  init_net();
22493
22573
  TIMEOUT_MS2 = 1500;
22494
22574
  MAX_BYTES = 256 * 1024;
@@ -22627,6 +22707,7 @@ var TIMEOUT_MS3, MAX_BYTES2, VERSION_DOC_MAX_BYTES, INSTALL_SCRIPTS, HAS_REGISTR
22627
22707
  var init_registry2 = __esm({
22628
22708
  "src/supply-chain/registry.ts"() {
22629
22709
  "use strict";
22710
+ init_esm_shims();
22630
22711
  init_net();
22631
22712
  init_provenance();
22632
22713
  TIMEOUT_MS3 = 1500;
@@ -22639,14 +22720,14 @@ var init_registry2 = __esm({
22639
22720
 
22640
22721
  // src/supply-chain/local-resolve.ts
22641
22722
  import fs18 from "fs";
22642
- import path18 from "path";
22723
+ import path19 from "path";
22643
22724
  function resolveInstalled(name, cwd) {
22644
- if (!cwd || !path18.isAbsolute(cwd)) return null;
22725
+ if (!cwd || !path19.isAbsolute(cwd)) return null;
22645
22726
  if (!/^(?:@[^/\\]+\/)?[^/\\]+$/.test(name)) return null;
22646
- let dir2 = path18.resolve(cwd);
22727
+ let dir2 = path19.resolve(cwd);
22647
22728
  for (let i = 0; i < MAX_LEVELS; i++) {
22648
- const pkgDir = path18.join(dir2, "node_modules", ...name.split("/"));
22649
- const manifest = path18.join(pkgDir, "package.json");
22729
+ const pkgDir = path19.join(dir2, "node_modules", ...name.split("/"));
22730
+ const manifest = path19.join(pkgDir, "package.json");
22650
22731
  try {
22651
22732
  const raw = fs18.readFileSync(manifest, "utf8");
22652
22733
  const parsed = JSON.parse(raw);
@@ -22656,7 +22737,7 @@ function resolveInstalled(name, cwd) {
22656
22737
  return null;
22657
22738
  } catch {
22658
22739
  }
22659
- const parent = path18.dirname(dir2);
22740
+ const parent = path19.dirname(dir2);
22660
22741
  if (parent === dir2) break;
22661
22742
  dir2 = parent;
22662
22743
  }
@@ -22666,6 +22747,7 @@ var MAX_LEVELS, LOCAL_FIRST_MANAGERS;
22666
22747
  var init_local_resolve = __esm({
22667
22748
  "src/supply-chain/local-resolve.ts"() {
22668
22749
  "use strict";
22750
+ init_esm_shims();
22669
22751
  MAX_LEVELS = 32;
22670
22752
  LOCAL_FIRST_MANAGERS = /* @__PURE__ */ new Set(["npx", "bunx", "npm exec"]);
22671
22753
  }
@@ -22673,7 +22755,7 @@ var init_local_resolve = __esm({
22673
22755
 
22674
22756
  // src/supply-chain/check.ts
22675
22757
  import picomatch2 from "picomatch";
22676
- import path19 from "path";
22758
+ import path20 from "path";
22677
22759
  function commandOf(toolName, args) {
22678
22760
  if (!isBashTool(toolName) || !args || typeof args !== "object") return null;
22679
22761
  const a = args;
@@ -22775,7 +22857,7 @@ function checkInstalled(p, version, misses) {
22775
22857
  }
22776
22858
  async function checkOne(p, cfg, misses, networkCapped, cwd) {
22777
22859
  if (p.ecosystem === "npm" && LOCAL_FIRST_MANAGERS.has(p.manager) && p.localCwd !== null && (p.raw === p.name || p.version)) {
22778
- const localCwd = cwd && path19.isAbsolute(cwd) ? (p.localCwd ?? []).reduce((dir2, step) => path19.resolve(dir2, step), cwd) : void 0;
22860
+ const localCwd = cwd && path20.isAbsolute(cwd) ? (p.localCwd ?? []).reduce((dir2, step) => path20.resolve(dir2, step), cwd) : void 0;
22779
22861
  const installed = resolveInstalled(p.name, localCwd);
22780
22862
  if (installed && (!p.version || p.version === installed.version))
22781
22863
  return checkInstalled(p, installed.version, misses);
@@ -22920,6 +23002,7 @@ var MAX_NETWORK_PACKAGES, ALLOW, KIND, SOFT2;
22920
23002
  var init_check = __esm({
22921
23003
  "src/supply-chain/check.ts"() {
22922
23004
  "use strict";
23005
+ init_esm_shims();
22923
23006
  init_dist();
22924
23007
  init_osv_index();
22925
23008
  init_osv_online();
@@ -22945,32 +23028,32 @@ var init_check = __esm({
22945
23028
 
22946
23029
  // src/supply-chain/registries.ts
22947
23030
  import os15 from "os";
22948
- import path20 from "path";
23031
+ import path21 from "path";
22949
23032
  import fs19 from "fs";
22950
23033
  function userFiles(home, env) {
22951
- const xdg = env.XDG_CONFIG_HOME || path20.join(home, ".config");
23034
+ const xdg = env.XDG_CONFIG_HOME || path21.join(home, ".config");
22952
23035
  return [
22953
- env.NPM_CONFIG_USERCONFIG || env.npm_config_userconfig || path20.join(home, ".npmrc"),
22954
- path20.join(home, ".yarnrc"),
22955
- path20.join(home, ".yarnrc.yml"),
22956
- path20.join(home, ".bunfig.toml"),
23036
+ env.NPM_CONFIG_USERCONFIG || env.npm_config_userconfig || path21.join(home, ".npmrc"),
23037
+ path21.join(home, ".yarnrc"),
23038
+ path21.join(home, ".yarnrc.yml"),
23039
+ path21.join(home, ".bunfig.toml"),
22957
23040
  env.PIP_CONFIG_FILE || "",
22958
- path20.join(xdg, "pip", "pip.conf"),
22959
- path20.join(home, ".pip", "pip.conf"),
23041
+ path21.join(xdg, "pip", "pip.conf"),
23042
+ path21.join(home, ".pip", "pip.conf"),
22960
23043
  "/etc/pip.conf",
22961
- env.VIRTUAL_ENV ? path20.join(env.VIRTUAL_ENV, "pip.conf") : "",
23044
+ env.VIRTUAL_ENV ? path21.join(env.VIRTUAL_ENV, "pip.conf") : "",
22962
23045
  env.UV_CONFIG_FILE || "",
22963
- path20.join(xdg, "uv", "uv.toml"),
23046
+ path21.join(xdg, "uv", "uv.toml"),
22964
23047
  "/etc/uv/uv.toml"
22965
23048
  ].filter(Boolean);
22966
23049
  }
22967
23050
  function projectFiles(cwd) {
22968
- if (!cwd || !path20.isAbsolute(cwd)) return [];
23051
+ if (!cwd || !path21.isAbsolute(cwd)) return [];
22969
23052
  const out = [];
22970
23053
  let dir2 = cwd;
22971
23054
  for (let i = 0; i < MAX_PARENT_DIRS; i++) {
22972
- for (const f of PROJECT_FILES) out.push(path20.join(dir2, f));
22973
- const parent = path20.dirname(dir2);
23055
+ for (const f of PROJECT_FILES) out.push(path21.join(dir2, f));
23056
+ const parent = path21.dirname(dir2);
22974
23057
  if (parent === dir2) break;
22975
23058
  dir2 = parent;
22976
23059
  }
@@ -23042,6 +23125,7 @@ var MAX_CONFIG_BYTES, MAX_PARENT_DIRS, TTL_MS2, PROJECT_FILES, ENV_VARS, PATH_VA
23042
23125
  var init_registries = __esm({
23043
23126
  "src/supply-chain/registries.ts"() {
23044
23127
  "use strict";
23128
+ init_esm_shims();
23045
23129
  init_dist();
23046
23130
  init_read_capped();
23047
23131
  MAX_CONFIG_BYTES = 256 * 1024;
@@ -23089,14 +23173,14 @@ var init_registries = __esm({
23089
23173
 
23090
23174
  // src/utils/provenance.ts
23091
23175
  import fs20 from "fs";
23092
- import path21 from "path";
23176
+ import path22 from "path";
23093
23177
  import os16 from "os";
23094
23178
  function findInPath(cmd) {
23095
- if (path21.posix.isAbsolute(cmd)) return cmd;
23179
+ if (path22.posix.isAbsolute(cmd)) return cmd;
23096
23180
  const pathEnv = process.env.PATH ?? "";
23097
- for (const dir2 of pathEnv.split(path21.delimiter)) {
23181
+ for (const dir2 of pathEnv.split(path22.delimiter)) {
23098
23182
  if (!dir2) continue;
23099
- const full = path21.join(dir2, cmd);
23183
+ const full = path22.join(dir2, cmd);
23100
23184
  try {
23101
23185
  fs20.accessSync(full, fs20.constants.X_OK);
23102
23186
  return full;
@@ -23127,7 +23211,7 @@ function _classifyPath(resolved, cwd) {
23127
23211
  }
23128
23212
  function checkProvenance(cmd, cwd) {
23129
23213
  const bare = cmd.startsWith("./") ? cmd.slice(2) : cmd;
23130
- if (path21.posix.isAbsolute(bare)) {
23214
+ if (path22.posix.isAbsolute(bare)) {
23131
23215
  const early = _classifyPath(bare, cwd);
23132
23216
  if (early.trustLevel === "suspect") {
23133
23217
  return { resolvedPath: bare, ...early };
@@ -23174,14 +23258,15 @@ var SYSTEM_PREFIXES, MANAGED_PREFIXES, USER_PREFIXES, SUSPECT_PREFIXES;
23174
23258
  var init_provenance2 = __esm({
23175
23259
  "src/utils/provenance.ts"() {
23176
23260
  "use strict";
23261
+ init_esm_shims();
23177
23262
  SYSTEM_PREFIXES = ["/usr/bin", "/usr/sbin", "/bin", "/sbin"];
23178
23263
  MANAGED_PREFIXES = ["/usr/local/bin", "/opt/homebrew", "/home/linuxbrew", "/nix/store"];
23179
23264
  USER_PREFIXES = [
23180
- path21.join(os16.homedir(), "bin"),
23181
- path21.join(os16.homedir(), ".local", "bin"),
23182
- path21.join(os16.homedir(), ".cargo", "bin"),
23183
- path21.join(os16.homedir(), ".npm-global", "bin"),
23184
- path21.join(os16.homedir(), ".volta", "bin")
23265
+ path22.join(os16.homedir(), "bin"),
23266
+ path22.join(os16.homedir(), ".local", "bin"),
23267
+ path22.join(os16.homedir(), ".cargo", "bin"),
23268
+ path22.join(os16.homedir(), ".npm-global", "bin"),
23269
+ path22.join(os16.homedir(), ".volta", "bin")
23185
23270
  ];
23186
23271
  SUSPECT_PREFIXES = ["/tmp", "/var/tmp", "/dev/shm"];
23187
23272
  }
@@ -23189,7 +23274,7 @@ var init_provenance2 = __esm({
23189
23274
 
23190
23275
  // src/policy/index.ts
23191
23276
  import fs21 from "fs";
23192
- import path22 from "path";
23277
+ import path23 from "path";
23193
23278
  async function evaluatePolicy2(toolName, args, agent, cwd, opts) {
23194
23279
  const config = opts?.config ?? getConfig(cwd);
23195
23280
  const prepared = opts?.fileAccess ?? prepareFileAccesses(toolName, args, cwd, inspectionLayers(config.policy));
@@ -23221,9 +23306,9 @@ async function evaluatePolicy2(toolName, args, agent, cwd, opts) {
23221
23306
  );
23222
23307
  }
23223
23308
  function isGitWorkTreeTop(dir2, cwd) {
23224
- if (!path22.isAbsolute(cwd)) return true;
23309
+ if (!path23.isAbsolute(cwd)) return true;
23225
23310
  try {
23226
- return fs21.existsSync(path22.join(path22.resolve(cwd, dir2), ".git"));
23311
+ return fs21.existsSync(path23.join(path23.resolve(cwd, dir2), ".git"));
23227
23312
  } catch {
23228
23313
  return true;
23229
23314
  }
@@ -23243,6 +23328,7 @@ var MAX_AGENT_SETTINGS_BYTES;
23243
23328
  var init_policy = __esm({
23244
23329
  "src/policy/index.ts"() {
23245
23330
  "use strict";
23331
+ init_esm_shims();
23246
23332
  init_dist();
23247
23333
  init_read_capped();
23248
23334
  init_dlp();
@@ -23295,6 +23381,7 @@ var BASELINE;
23295
23381
  var init_gate = __esm({
23296
23382
  "src/posture/gate.ts"() {
23297
23383
  "use strict";
23384
+ init_esm_shims();
23298
23385
  init_policy();
23299
23386
  BASELINE = ["rm", "-rf", "/"].join(" ");
23300
23387
  }
@@ -23302,13 +23389,13 @@ var init_gate = __esm({
23302
23389
 
23303
23390
  // src/posture/supply-chain.ts
23304
23391
  import os17 from "os";
23305
- import path23 from "path";
23392
+ import path24 from "path";
23306
23393
  import { parse as parseToml6 } from "smol-toml";
23307
23394
  function isNode9Managed(command, args = []) {
23308
23395
  if (!command) return false;
23309
- if (path23.basename(command).toLowerCase() === "node9") return true;
23310
- if (PACKAGE_RUNNERS.has(path23.basename(command).toLowerCase())) {
23311
- return args.some((a) => a === "node9" || path23.basename(a).toLowerCase() === "node9");
23396
+ if (path24.basename(command).toLowerCase() === "node9") return true;
23397
+ if (PACKAGE_RUNNERS.has(path24.basename(command).toLowerCase())) {
23398
+ return args.some((a) => a === "node9" || path24.basename(a).toLowerCase() === "node9");
23312
23399
  }
23313
23400
  return false;
23314
23401
  }
@@ -23374,6 +23461,7 @@ var PACKAGE_RUNNERS, MAX_CONFIG_BYTES2;
23374
23461
  var init_supply_chain = __esm({
23375
23462
  "src/posture/supply-chain.ts"() {
23376
23463
  "use strict";
23464
+ init_esm_shims();
23377
23465
  init_provenance2();
23378
23466
  init_agent_wiring();
23379
23467
  init_read_capped();
@@ -23423,6 +23511,7 @@ var SUDO_PROBE;
23423
23511
  var init_privilege = __esm({
23424
23512
  "src/posture/privilege.ts"() {
23425
23513
  "use strict";
23514
+ init_esm_shims();
23426
23515
  init_policy();
23427
23516
  SUDO_PROBE = "sudo chmod 777 /etc/passwd";
23428
23517
  }
@@ -23474,6 +23563,7 @@ var ISOLATION_WEIGHT;
23474
23563
  var init_containment = __esm({
23475
23564
  "src/posture/containment.ts"() {
23476
23565
  "use strict";
23566
+ init_esm_shims();
23477
23567
  ISOLATION_WEIGHT = 12;
23478
23568
  }
23479
23569
  });
@@ -23649,6 +23739,7 @@ var DB_EXPOSURE_WEIGHT, KNOWN_SERVICE_PORTS, KNOWN_SERVICE_COMMS, DB_LABEL, SHIE
23649
23739
  var init_inbound = __esm({
23650
23740
  "src/posture/inbound.ts"() {
23651
23741
  "use strict";
23742
+ init_esm_shims();
23652
23743
  DB_EXPOSURE_WEIGHT = 4;
23653
23744
  KNOWN_SERVICE_PORTS = {
23654
23745
  5432: "PostgreSQL",
@@ -23721,6 +23812,7 @@ function checkCoverage(ctx) {
23721
23812
  var init_coverage = __esm({
23722
23813
  "src/posture/coverage.ts"() {
23723
23814
  "use strict";
23815
+ init_esm_shims();
23724
23816
  init_config();
23725
23817
  init_dist();
23726
23818
  init_agent_wiring();
@@ -23728,7 +23820,7 @@ var init_coverage = __esm({
23728
23820
  });
23729
23821
 
23730
23822
  // src/posture/governance.ts
23731
- import path24 from "path";
23823
+ import path25 from "path";
23732
23824
  function checkData(ctx) {
23733
23825
  const dlp = getConfig(ctx.cwd).policy.dlp;
23734
23826
  if (!dlp?.enabled) {
@@ -23871,8 +23963,9 @@ var jailProbePath;
23871
23963
  var init_governance = __esm({
23872
23964
  "src/posture/governance.ts"() {
23873
23965
  "use strict";
23966
+ init_esm_shims();
23874
23967
  init_config();
23875
- jailProbePath = (home) => path24.join(home, ".aws", "credentials");
23968
+ jailProbePath = (home) => path25.join(home, ".aws", "credentials");
23876
23969
  }
23877
23970
  });
23878
23971
 
@@ -23899,6 +23992,7 @@ function openHeadroom(findings) {
23899
23992
  var init_score = __esm({
23900
23993
  "src/posture/score.ts"() {
23901
23994
  "use strict";
23995
+ init_esm_shims();
23902
23996
  init_dist();
23903
23997
  }
23904
23998
  });
@@ -23965,6 +24059,7 @@ var SEVERITY_RANK;
23965
24059
  var init_headline = __esm({
23966
24060
  "src/posture/headline.ts"() {
23967
24061
  "use strict";
24062
+ init_esm_shims();
23968
24063
  SEVERITY_RANK = {
23969
24064
  critical: 0,
23970
24065
  high: 1,
@@ -24042,6 +24137,7 @@ async function annotateCoverage(findings, ctx) {
24042
24137
  var init_enforcement = __esm({
24043
24138
  "src/posture/enforcement.ts"() {
24044
24139
  "use strict";
24140
+ init_esm_shims();
24045
24141
  init_dlp();
24046
24142
  init_policy();
24047
24143
  init_config();
@@ -24108,6 +24204,7 @@ var POSTURE_CHECKS;
24108
24204
  var init_posture = __esm({
24109
24205
  "src/posture/index.ts"() {
24110
24206
  "use strict";
24207
+ init_esm_shims();
24111
24208
  init_secrets();
24112
24209
  init_egress();
24113
24210
  init_gate();
@@ -24145,6 +24242,7 @@ var ICON, TIER_LABEL;
24145
24242
  var init_render = __esm({
24146
24243
  "src/posture/render.ts"() {
24147
24244
  "use strict";
24245
+ init_esm_shims();
24148
24246
  init_score();
24149
24247
  ICON = {
24150
24248
  critical: chalk2.red("\u274C"),
@@ -24163,7 +24261,7 @@ var init_render = __esm({
24163
24261
  // src/cli/commands/blast.ts
24164
24262
  import chalk3 from "chalk";
24165
24263
  import fs24 from "fs";
24166
- import path25 from "path";
24264
+ import path26 from "path";
24167
24265
  import os20 from "os";
24168
24266
  function buildSensitivePaths(home, cwd) {
24169
24267
  const homeFiles = homeCredentialFiles(home).map(({ full, label: label2, description, score }) => ({
@@ -24175,19 +24273,19 @@ function buildSensitivePaths(home, cwd) {
24175
24273
  return [
24176
24274
  ...homeFiles,
24177
24275
  {
24178
- full: path25.join(cwd, ".env"),
24276
+ full: path26.join(cwd, ".env"),
24179
24277
  label: ".env (current folder)",
24180
24278
  description: "App secrets: database passwords, API keys",
24181
24279
  score: 20
24182
24280
  },
24183
24281
  {
24184
- full: path25.join(cwd, ".env.local"),
24282
+ full: path26.join(cwd, ".env.local"),
24185
24283
  label: ".env.local (current folder)",
24186
24284
  description: "Local overrides: often contains real credentials",
24187
24285
  score: 15
24188
24286
  },
24189
24287
  {
24190
- full: path25.join(cwd, ".env.production"),
24288
+ full: path26.join(cwd, ".env.production"),
24191
24289
  label: ".env.production (current folder)",
24192
24290
  description: "Production secrets",
24193
24291
  score: 20
@@ -24228,6 +24326,7 @@ function runBlast() {
24228
24326
  var init_blast = __esm({
24229
24327
  "src/cli/commands/blast.ts"() {
24230
24328
  "use strict";
24329
+ init_esm_shims();
24231
24330
  init_dlp();
24232
24331
  init_credential_files();
24233
24332
  init_posture();
@@ -24356,6 +24455,7 @@ var CHANNELS, PERSON_CHANNELS, CARD_PROTOCOL, PERSON_LABELS, REDIRECT_LABEL, TIM
24356
24455
  var init_decision_record = __esm({
24357
24456
  "src/auth/decision-record.ts"() {
24358
24457
  "use strict";
24458
+ init_esm_shims();
24359
24459
  CHANNELS = ["terminal", "monitor", "native", "cloud"];
24360
24460
  PERSON_CHANNELS = /* @__PURE__ */ new Set([
24361
24461
  "terminal",
@@ -24391,7 +24491,7 @@ var init_decision_record = __esm({
24391
24491
  // src/auth/daemon.ts
24392
24492
  import fs25 from "fs";
24393
24493
  import http from "http";
24394
- import path26 from "path";
24494
+ import path27 from "path";
24395
24495
  import os21 from "os";
24396
24496
  async function checkStatePredicates(predicates) {
24397
24497
  if (predicates.length === 0) return {};
@@ -24418,7 +24518,7 @@ function resolveDaemonPort(env = process.env) {
24418
24518
  function getInternalToken() {
24419
24519
  if (forecastRun()) return null;
24420
24520
  try {
24421
- const pidFile = path26.join(os21.homedir(), ".node9", "daemon.pid");
24521
+ const pidFile = path27.join(os21.homedir(), ".node9", "daemon.pid");
24422
24522
  if (!fs25.existsSync(pidFile)) return null;
24423
24523
  const data = JSON.parse(fs25.readFileSync(pidFile, "utf-8"));
24424
24524
  process.kill(data.pid, 0);
@@ -24429,7 +24529,7 @@ function getInternalToken() {
24429
24529
  }
24430
24530
  function isDaemonRunning() {
24431
24531
  if (forecastRun()) return false;
24432
- const pidFile = path26.join(os21.homedir(), ".node9", "daemon.pid");
24532
+ const pidFile = path27.join(os21.homedir(), ".node9", "daemon.pid");
24433
24533
  if (fs25.existsSync(pidFile)) {
24434
24534
  let pid;
24435
24535
  let port;
@@ -24789,9 +24889,10 @@ var ACTIVITY_SOCKET_PATH, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
24789
24889
  var init_daemon = __esm({
24790
24890
  "src/auth/daemon.ts"() {
24791
24891
  "use strict";
24892
+ init_esm_shims();
24792
24893
  init_forecast_context();
24793
24894
  init_decision_record();
24794
- ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : path26.join(os21.tmpdir(), "node9-activity.sock");
24895
+ ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : path27.join(os21.tmpdir(), "node9-activity.sock");
24795
24896
  DEFAULT_DAEMON_PORT = 7391;
24796
24897
  DAEMON_PORT = resolveDaemonPort();
24797
24898
  DAEMON_HOST = "127.0.0.1";
@@ -24814,6 +24915,7 @@ var GEMINI_FALLBACK_MODELS;
24814
24915
  var init_cost_gemini = __esm({
24815
24916
  "src/cost-gemini.ts"() {
24816
24917
  "use strict";
24918
+ init_esm_shims();
24817
24919
  init_litellm();
24818
24920
  GEMINI_FALLBACK_MODELS = ["gemini-2.5-flash", "gemini-2.0-flash"];
24819
24921
  }
@@ -24885,13 +24987,14 @@ function parseCopilotSession(lines) {
24885
24987
  var init_cost_copilot = __esm({
24886
24988
  "src/cost-copilot.ts"() {
24887
24989
  "use strict";
24990
+ init_esm_shims();
24888
24991
  init_litellm();
24889
24992
  }
24890
24993
  });
24891
24994
 
24892
24995
  // src/session-files.ts
24893
24996
  import * as fs26 from "fs";
24894
- import * as path27 from "path";
24997
+ import * as path28 from "path";
24895
24998
  function listSessionFiles(dir2, maxDepth = 6) {
24896
24999
  const out = [];
24897
25000
  const walk3 = (d, rel, depth) => {
@@ -24903,8 +25006,8 @@ function listSessionFiles(dir2, maxDepth = 6) {
24903
25006
  return;
24904
25007
  }
24905
25008
  for (const e of entries) {
24906
- const childRel = rel ? path27.join(rel, e.name) : e.name;
24907
- if (e.isDirectory()) walk3(path27.join(d, e.name), childRel, depth + 1);
25009
+ const childRel = rel ? path28.join(rel, e.name) : e.name;
25010
+ if (e.isDirectory()) walk3(path28.join(d, e.name), childRel, depth + 1);
24908
25011
  else if (e.name.endsWith(".jsonl")) out.push(childRel);
24909
25012
  }
24910
25013
  };
@@ -24912,11 +25015,12 @@ function listSessionFiles(dir2, maxDepth = 6) {
24912
25015
  return out;
24913
25016
  }
24914
25017
  function sessionIdOf(relPath) {
24915
- return path27.basename(relPath).replace(/\.jsonl$/, "");
25018
+ return path28.basename(relPath).replace(/\.jsonl$/, "");
24916
25019
  }
24917
25020
  var init_session_files = __esm({
24918
25021
  "src/session-files.ts"() {
24919
25022
  "use strict";
25023
+ init_esm_shims();
24920
25024
  }
24921
25025
  });
24922
25026
 
@@ -24924,6 +25028,7 @@ var init_session_files = __esm({
24924
25028
  var init_safe_text = __esm({
24925
25029
  "src/utils/safe-text.ts"() {
24926
25030
  "use strict";
25031
+ init_esm_shims();
24927
25032
  init_dist();
24928
25033
  }
24929
25034
  });
@@ -24936,6 +25041,7 @@ var SYNC_INTERVAL_MS;
24936
25041
  var init_costSync = __esm({
24937
25042
  "src/costSync.ts"() {
24938
25043
  "use strict";
25044
+ init_esm_shims();
24939
25045
  init_config();
24940
25046
  init_audit();
24941
25047
  init_litellm();
@@ -24998,6 +25104,7 @@ var HUMAN_SOURCES, TIMEOUT_SOURCES, NON_DECISION_SOURCES, has;
24998
25104
  var init_decision = __esm({
24999
25105
  "src/audit/decision.ts"() {
25000
25106
  "use strict";
25107
+ init_esm_shims();
25001
25108
  HUMAN_SOURCES = /* @__PURE__ */ new Set([
25002
25109
  "daemon",
25003
25110
  "cloud",
@@ -25020,6 +25127,7 @@ var MAX_LINE_BYTES;
25020
25127
  var init_scan_watermark = __esm({
25021
25128
  "src/daemon/scan-watermark.ts"() {
25022
25129
  "use strict";
25130
+ init_esm_shims();
25023
25131
  init_dlp();
25024
25132
  init_registry();
25025
25133
  init_config();
@@ -25031,7 +25139,7 @@ var init_scan_watermark = __esm({
25031
25139
  // src/cli/aggregate/report-audit.ts
25032
25140
  import fs27 from "fs";
25033
25141
  import os22 from "os";
25034
- import path28 from "path";
25142
+ import path29 from "path";
25035
25143
  function buildTestTimestamps(allEntries) {
25036
25144
  const testTs = /* @__PURE__ */ new Set();
25037
25145
  for (const e of allEntries) {
@@ -25167,7 +25275,7 @@ function freezeClaudeCost(acc) {
25167
25275
  };
25168
25276
  }
25169
25277
  function processClaudeCostProject(proj, projectsDir, start, end, acc) {
25170
- const projPath = path28.join(projectsDir, proj);
25278
+ const projPath = path29.join(projectsDir, proj);
25171
25279
  let files;
25172
25280
  try {
25173
25281
  const stat = fs27.statSync(projPath);
@@ -25178,7 +25286,7 @@ function processClaudeCostProject(proj, projectsDir, start, end, acc) {
25178
25286
  }
25179
25287
  const startMs = start.getTime();
25180
25288
  for (const file2 of files) {
25181
- const filePath = path28.join(projPath, file2);
25289
+ const filePath = path29.join(projPath, file2);
25182
25290
  try {
25183
25291
  if (fs27.statSync(filePath).mtimeMs < startMs) continue;
25184
25292
  } catch {
@@ -25417,7 +25525,7 @@ function listGeminiSessionFiles(geminiTmpDir) {
25417
25525
  return out;
25418
25526
  }
25419
25527
  for (const proj of dirs) {
25420
- const chatsDir = path28.join(geminiTmpDir, proj, "chats");
25528
+ const chatsDir = path29.join(geminiTmpDir, proj, "chats");
25421
25529
  let files;
25422
25530
  try {
25423
25531
  if (!fs27.statSync(chatsDir).isDirectory()) continue;
@@ -25427,7 +25535,7 @@ function listGeminiSessionFiles(geminiTmpDir) {
25427
25535
  }
25428
25536
  for (const f of files) {
25429
25537
  if (!f.endsWith(".jsonl")) continue;
25430
- out.push({ projectKey: proj, file: path28.join(chatsDir, f) });
25538
+ out.push({ projectKey: proj, file: path29.join(chatsDir, f) });
25431
25539
  }
25432
25540
  }
25433
25541
  return out;
@@ -25468,10 +25576,10 @@ function dimensionOfBlock(checkedBy, ruleName) {
25468
25576
  }
25469
25577
  function aggregateReportFromAudit(period, opts = {}) {
25470
25578
  const now = opts.now ?? /* @__PURE__ */ new Date();
25471
- const auditLogPath2 = opts.auditLogPath ?? path28.join(os22.homedir(), ".node9", "audit.log");
25472
- const claudeProjectsDir = opts.claudeProjectsDir ?? path28.join(os22.homedir(), ".claude", "projects");
25579
+ const auditLogPath2 = opts.auditLogPath ?? path29.join(os22.homedir(), ".node9", "audit.log");
25580
+ const claudeProjectsDir = opts.claudeProjectsDir ?? path29.join(os22.homedir(), ".claude", "projects");
25473
25581
  const codexSessionsDir2 = opts.codexSessionsDir ?? codexSessionsDir();
25474
- const geminiTmpDir = opts.geminiTmpDir ?? path28.join(os22.homedir(), ".gemini", "tmp");
25582
+ const geminiTmpDir = opts.geminiTmpDir ?? path29.join(os22.homedir(), ".gemini", "tmp");
25475
25583
  const hasAuditFile = fs27.existsSync(auditLogPath2);
25476
25584
  const allEntries = opts.preloadedAuditEntries ?? parseAuditLog(auditLogPath2);
25477
25585
  const unackedDlp = allEntries.filter((e) => e.source === "response-dlp");
@@ -25703,6 +25811,7 @@ var TEST_COMMAND_RE2, SUPERSEDE_WINDOW_MS, GEMINI_FALLBACK_MODELS2;
25703
25811
  var init_report_audit = __esm({
25704
25812
  "src/cli/aggregate/report-audit.ts"() {
25705
25813
  "use strict";
25814
+ init_esm_shims();
25706
25815
  init_costSync();
25707
25816
  init_litellm();
25708
25817
  init_cost_codex();
@@ -25726,6 +25835,7 @@ function isKeyedForPolicy() {
25726
25835
  var init_keyed_guard = __esm({
25727
25836
  "src/config/keyed-guard.ts"() {
25728
25837
  "use strict";
25838
+ init_esm_shims();
25729
25839
  init_config();
25730
25840
  }
25731
25841
  });
@@ -25735,6 +25845,7 @@ var APP_CATALOG, APP_BY_SLUG;
25735
25845
  var init_catalog = __esm({
25736
25846
  "src/apps/catalog.ts"() {
25737
25847
  "use strict";
25848
+ init_esm_shims();
25738
25849
  APP_CATALOG = [
25739
25850
  {
25740
25851
  slug: "redis",
@@ -25864,10 +25975,10 @@ var init_catalog = __esm({
25864
25975
 
25865
25976
  // src/daemon/mcp-tools.ts
25866
25977
  import fs28 from "fs";
25867
- import path29 from "path";
25978
+ import path30 from "path";
25868
25979
  import os23 from "os";
25869
25980
  function getMcpToolsFile() {
25870
- return path29.join(os23.homedir(), ".node9", "mcp-tools.json");
25981
+ return path30.join(os23.homedir(), ".node9", "mcp-tools.json");
25871
25982
  }
25872
25983
  function readMcpToolsConfig() {
25873
25984
  try {
@@ -25882,6 +25993,7 @@ function readMcpToolsConfig() {
25882
25993
  var init_mcp_tools = __esm({
25883
25994
  "src/daemon/mcp-tools.ts"() {
25884
25995
  "use strict";
25996
+ init_esm_shims();
25885
25997
  init_mcp_cmd();
25886
25998
  }
25887
25999
  });
@@ -25889,9 +26001,9 @@ var init_mcp_tools = __esm({
25889
26001
  // src/apps/state.ts
25890
26002
  import fs29 from "fs";
25891
26003
  import os24 from "os";
25892
- import path30 from "path";
26004
+ import path31 from "path";
25893
26005
  function appsFilePath(home = os24.homedir()) {
25894
- return path30.join(home, ".node9", "apps.json");
26006
+ return path31.join(home, ".node9", "apps.json");
25895
26007
  }
25896
26008
  function emptyFile() {
25897
26009
  return { version: 1, apps: /* @__PURE__ */ Object.create(null), links: /* @__PURE__ */ Object.create(null) };
@@ -25993,6 +26105,7 @@ var SIGNAL_KINDS, linkCache, NO_LINKS;
25993
26105
  var init_state = __esm({
25994
26106
  "src/apps/state.ts"() {
25995
26107
  "use strict";
26108
+ init_esm_shims();
25996
26109
  init_catalog();
25997
26110
  init_shields();
25998
26111
  init_audit();
@@ -26004,7 +26117,7 @@ var init_state = __esm({
26004
26117
  });
26005
26118
 
26006
26119
  // src/context-sniper.ts
26007
- import path31 from "path";
26120
+ import path32 from "path";
26008
26121
  function smartTruncate(str, maxLen = 500) {
26009
26122
  if (str.length <= maxLen) return str;
26010
26123
  const edge = Math.floor(maxLen / 2) - 3;
@@ -26056,7 +26169,7 @@ function computeRiskMetadata(args, tier, blockedByLabel, matchedField, matchedWo
26056
26169
  intent = "EDIT";
26057
26170
  if (obj.file_path) {
26058
26171
  editFilePath = String(obj.file_path);
26059
- editFileName = path31.basename(editFilePath);
26172
+ editFileName = path32.basename(editFilePath);
26060
26173
  }
26061
26174
  const result = extractContext(String(obj.new_string), matchedWord);
26062
26175
  contextSnippet = result.snippet;
@@ -26092,6 +26205,7 @@ var CODE_KEYS;
26092
26205
  var init_context_sniper = __esm({
26093
26206
  "src/context-sniper.ts"() {
26094
26207
  "use strict";
26208
+ init_esm_shims();
26095
26209
  CODE_KEYS = [
26096
26210
  "command",
26097
26211
  "cmd",
@@ -26113,7 +26227,7 @@ var init_context_sniper = __esm({
26113
26227
 
26114
26228
  // src/ui/native.ts
26115
26229
  import { spawn } from "child_process";
26116
- import path32 from "path";
26230
+ import path33 from "path";
26117
26231
  function resolveNativeDecision(opts) {
26118
26232
  const { code, output, elapsedMs, locked } = opts;
26119
26233
  if (locked) return "deny";
@@ -26141,7 +26255,7 @@ function formatArgs(args, matchedField, matchedWord) {
26141
26255
  if (typeof parsed === "object" && !Array.isArray(parsed)) {
26142
26256
  const obj = parsed;
26143
26257
  if (obj.old_string !== void 0 && obj.new_string !== void 0) {
26144
- const file2 = obj.file_path ? path32.basename(String(obj.file_path)) : "file";
26258
+ const file2 = obj.file_path ? path33.basename(String(obj.file_path)) : "file";
26145
26259
  const oldPreview = smartTruncate(String(obj.old_string), 120);
26146
26260
  const newPreview = extractContext(String(obj.new_string), matchedWord).snippet;
26147
26261
  return {
@@ -26346,6 +26460,7 @@ var isTestEnv, MIN_INTERACTION_MS;
26346
26460
  var init_native = __esm({
26347
26461
  "src/ui/native.ts"() {
26348
26462
  "use strict";
26463
+ init_esm_shims();
26349
26464
  init_context_sniper();
26350
26465
  init_safe_text();
26351
26466
  isTestEnv = () => {
@@ -26358,7 +26473,7 @@ var init_native = __esm({
26358
26473
  // src/auth/session-script.ts
26359
26474
  import fs30 from "fs";
26360
26475
  import os25 from "os";
26361
- import path33 from "path";
26476
+ import path34 from "path";
26362
26477
  function readScriptFile(resolved) {
26363
26478
  let fd;
26364
26479
  try {
@@ -26387,7 +26502,7 @@ function readScriptFile(resolved) {
26387
26502
  }
26388
26503
  function absolute(p, cwd, home) {
26389
26504
  const spelled = p === "~" || p.startsWith("~/") ? home + p.slice(1) : p;
26390
- return path33.resolve(cwd, spelled);
26505
+ return path34.resolve(cwd, spelled);
26391
26506
  }
26392
26507
  async function resolveSessionScript(toolName, args, cwd, layers, deps, home = os25.homedir()) {
26393
26508
  try {
@@ -26444,6 +26559,7 @@ var MAX_SCRIPT_BYTES, MAX_RECORDED_WRITES;
26444
26559
  var init_session_script = __esm({
26445
26560
  "src/auth/session-script.ts"() {
26446
26561
  "use strict";
26562
+ init_esm_shims();
26447
26563
  init_dist();
26448
26564
  init_daemon();
26449
26565
  init_file_access();
@@ -26454,7 +26570,7 @@ var init_session_script = __esm({
26454
26570
 
26455
26571
  // src/utils/git-remotes.ts
26456
26572
  import fs31 from "fs";
26457
- import path34 from "path";
26573
+ import path35 from "path";
26458
26574
  function readSmallFile(p, max) {
26459
26575
  let fd;
26460
26576
  try {
@@ -26486,20 +26602,20 @@ function gitRemoteHost(url) {
26486
26602
  return null;
26487
26603
  }
26488
26604
  function findGitConfig(dir2, walkUp = true) {
26489
- let cur = path34.resolve(dir2);
26605
+ let cur = path35.resolve(dir2);
26490
26606
  for (let i = 0; i < (walkUp ? 64 : 1); i++) {
26491
- const dotGit = path34.join(cur, ".git");
26492
- const direct = readSmallFile(path34.join(dotGit, "config"), 1e6);
26607
+ const dotGit = path35.join(cur, ".git");
26608
+ const direct = readSmallFile(path35.join(dotGit, "config"), 1e6);
26493
26609
  if (direct !== null) return direct;
26494
26610
  const pointer = readSmallFile(dotGit, 4096);
26495
26611
  const m = pointer && /^gitdir:\s*(.+?)\s*$/m.exec(pointer);
26496
26612
  if (m) {
26497
- let gitDir = path34.resolve(cur, m[1]);
26498
- const common = readSmallFile(path34.join(gitDir, "commondir"), 4096);
26499
- if (common !== null) gitDir = path34.resolve(gitDir, common.trim());
26500
- return readSmallFile(path34.join(gitDir, "config"), 1e6);
26613
+ let gitDir = path35.resolve(cur, m[1]);
26614
+ const common = readSmallFile(path35.join(gitDir, "commondir"), 4096);
26615
+ if (common !== null) gitDir = path35.resolve(gitDir, common.trim());
26616
+ return readSmallFile(path35.join(gitDir, "config"), 1e6);
26501
26617
  }
26502
- const parent = path34.dirname(cur);
26618
+ const parent = path35.dirname(cur);
26503
26619
  if (parent === cur) return null;
26504
26620
  cur = parent;
26505
26621
  }
@@ -26508,12 +26624,12 @@ function findGitConfig(dir2, walkUp = true) {
26508
26624
  function readGitRemotes(dir2, opts = {}) {
26509
26625
  if (!dir2) return [];
26510
26626
  const walkUp = opts.walkUp !== false;
26511
- const key = `${walkUp ? "up" : "at"}:${path34.resolve(dir2)}`;
26627
+ const key = `${walkUp ? "up" : "at"}:${path35.resolve(dir2)}`;
26512
26628
  const hit = cache4.get(key);
26513
26629
  if (hit) return hit;
26514
26630
  const out = [];
26515
26631
  try {
26516
- const cfg = findGitConfig(path34.resolve(dir2), walkUp);
26632
+ const cfg = findGitConfig(path35.resolve(dir2), walkUp);
26517
26633
  if (cfg !== null) {
26518
26634
  let current = null;
26519
26635
  for (const line of cfg.split(/\r?\n/)) {
@@ -26542,6 +26658,7 @@ var cache4;
26542
26658
  var init_git_remotes = __esm({
26543
26659
  "src/utils/git-remotes.ts"() {
26544
26660
  "use strict";
26661
+ init_esm_shims();
26545
26662
  init_dist();
26546
26663
  cache4 = /* @__PURE__ */ new Map();
26547
26664
  }
@@ -26549,17 +26666,17 @@ var init_git_remotes = __esm({
26549
26666
 
26550
26667
  // src/exposure/known-hosts.ts
26551
26668
  import fs32 from "fs";
26552
- import path35 from "path";
26669
+ import path36 from "path";
26553
26670
  function manifestRoot(dir2) {
26554
- let cur = path35.resolve(dir2);
26671
+ let cur = path36.resolve(dir2);
26555
26672
  for (let i = 0; i < 64; i++) {
26556
26673
  for (const [m] of ECOSYSTEMS) {
26557
26674
  try {
26558
- if (fs32.existsSync(path35.join(cur, m))) return cur;
26675
+ if (fs32.existsSync(path36.join(cur, m))) return cur;
26559
26676
  } catch {
26560
26677
  }
26561
26678
  }
26562
- const parent = path35.dirname(cur);
26679
+ const parent = path36.dirname(cur);
26563
26680
  if (parent === cur) return null;
26564
26681
  cur = parent;
26565
26682
  }
@@ -26568,7 +26685,7 @@ function manifestRoot(dir2) {
26568
26685
  function knownProjectHosts(dir2) {
26569
26686
  const empty = { hosts: /* @__PURE__ */ new Set(), repos: /* @__PURE__ */ new Set(), remotes: /* @__PURE__ */ new Map() };
26570
26687
  if (!dir2) return empty;
26571
- const key = path35.resolve(dir2);
26688
+ const key = path36.resolve(dir2);
26572
26689
  const hit = cache5.get(key);
26573
26690
  if (hit) return hit;
26574
26691
  const out = { hosts: /* @__PURE__ */ new Set(), repos: /* @__PURE__ */ new Set(), remotes: /* @__PURE__ */ new Map() };
@@ -26581,7 +26698,7 @@ function knownProjectHosts(dir2) {
26581
26698
  const root = manifestRoot(key);
26582
26699
  if (root !== null) {
26583
26700
  for (const [m, registry] of ECOSYSTEMS) {
26584
- if (fs32.existsSync(path35.join(root, m))) out.hosts.add(registry);
26701
+ if (fs32.existsSync(path36.join(root, m))) out.hosts.add(registry);
26585
26702
  }
26586
26703
  try {
26587
26704
  if (fs32.readdirSync(root).some((f) => f.endsWith(".gemspec")))
@@ -26598,6 +26715,7 @@ var ECOSYSTEMS, cache5;
26598
26715
  var init_known_hosts = __esm({
26599
26716
  "src/exposure/known-hosts.ts"() {
26600
26717
  "use strict";
26718
+ init_esm_shims();
26601
26719
  init_git_remotes();
26602
26720
  ECOSYSTEMS = [
26603
26721
  ["package.json", "host:registry.npmjs.org"],
@@ -26613,7 +26731,7 @@ var init_known_hosts = __esm({
26613
26731
  // src/exposure/writes.ts
26614
26732
  import fs33 from "fs";
26615
26733
  import os26 from "os";
26616
- import path36 from "path";
26734
+ import path37 from "path";
26617
26735
  function writtenContent(args) {
26618
26736
  if (!args || typeof args !== "object" || Array.isArray(args)) return [];
26619
26737
  const a = args;
@@ -26661,7 +26779,7 @@ function judgeWritesAfterExposure(opts) {
26661
26779
  seen.add(p);
26662
26780
  if (p === "/dev" || p.startsWith("/dev/")) continue;
26663
26781
  if (root !== null && isInside(root, p)) {
26664
- if (isAgentInstructionPath(p, root) && (path36.basename(p) !== "package.json" || packageScriptsTouched(opts.args, p, opts.shellCommand)))
26782
+ if (isAgentInstructionPath(p, root) && (path37.basename(p) !== "package.json" || packageScriptsTouched(opts.args, p, opts.shellCommand)))
26665
26783
  holds.push({ path: p, why: "agent-instruction" });
26666
26784
  continue;
26667
26785
  }
@@ -26684,6 +26802,7 @@ var WRITE_OPS, LIFECYCLE_RE;
26684
26802
  var init_writes = __esm({
26685
26803
  "src/exposure/writes.ts"() {
26686
26804
  "use strict";
26805
+ init_esm_shims();
26687
26806
  init_dist();
26688
26807
  WRITE_OPS = /* @__PURE__ */ new Set(["write", "create", "remove"]);
26689
26808
  LIFECYCLE_RE = /"(scripts|preinstall|install|postinstall|prepare|prepublish|prepublishOnly|prepack|postpack|publish|postpublish)"\s*:/;
@@ -26695,6 +26814,7 @@ var SESSION_EXPOSURE_TTL_MS;
26695
26814
  var init_exposure_store = __esm({
26696
26815
  "src/daemon/exposure-store.ts"() {
26697
26816
  "use strict";
26817
+ init_esm_shims();
26698
26818
  SESSION_EXPOSURE_TTL_MS = 4 * 60 * 60 * 1e3;
26699
26819
  }
26700
26820
  });
@@ -26703,13 +26823,13 @@ var init_exposure_store = __esm({
26703
26823
  import crypto3 from "crypto";
26704
26824
  import fs34 from "fs";
26705
26825
  import os27 from "os";
26706
- import path37 from "path";
26826
+ import path38 from "path";
26707
26827
  function dir() {
26708
- return path37.join(os27.homedir(), ".node9", "exposure-sessions");
26828
+ return path38.join(os27.homedir(), ".node9", "exposure-sessions");
26709
26829
  }
26710
26830
  function file(sessionId) {
26711
26831
  const id = crypto3.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
26712
- return path37.join(dir(), id);
26832
+ return path38.join(dir(), id);
26713
26833
  }
26714
26834
  function maybeSessionExposed(sessionId) {
26715
26835
  if (!sessionId) return false;
@@ -26725,6 +26845,7 @@ function maybeSessionExposed(sessionId) {
26725
26845
  var init_marker = __esm({
26726
26846
  "src/exposure/marker.ts"() {
26727
26847
  "use strict";
26848
+ init_esm_shims();
26728
26849
  init_exposure_store();
26729
26850
  init_forecast_context();
26730
26851
  }
@@ -26804,6 +26925,7 @@ var EXPOSURE_LABEL, AGENT_INTERNAL_PREFIXES, inventoryCache, inventoryStamp, BUI
26804
26925
  var init_roles = __esm({
26805
26926
  "src/exposure/roles.ts"() {
26806
26927
  "use strict";
26928
+ init_esm_shims();
26807
26929
  init_mcp_tools();
26808
26930
  EXPOSURE_LABEL = "\u{1F6E1}\uFE0F Node9 Exposure";
26809
26931
  AGENT_INTERNAL_PREFIXES = ["ccd_", "visualize"];
@@ -26833,10 +26955,10 @@ var init_roles = __esm({
26833
26955
 
26834
26956
  // src/auth/trusted-recipients.ts
26835
26957
  import fs36 from "fs";
26836
- import path38 from "path";
26958
+ import path39 from "path";
26837
26959
  import os28 from "os";
26838
26960
  function getTrustedRecipientsPath() {
26839
- return path38.join(os28.homedir(), ".node9", "trusted-recipients.json");
26961
+ return path39.join(os28.homedir(), ".node9", "trusted-recipients.json");
26840
26962
  }
26841
26963
  function readTrustedRecipients() {
26842
26964
  try {
@@ -26849,7 +26971,7 @@ function readTrustedRecipients() {
26849
26971
  }
26850
26972
  function writeTrustedRecipients(entries) {
26851
26973
  const filePath = getTrustedRecipientsPath();
26852
- fs36.mkdirSync(path38.dirname(filePath), { recursive: true });
26974
+ fs36.mkdirSync(path39.dirname(filePath), { recursive: true });
26853
26975
  const tmp = filePath + ".node9-tmp";
26854
26976
  fs36.writeFileSync(tmp, JSON.stringify({ entries }, null, 2), { mode: 384 });
26855
26977
  fs36.renameSync(tmp, filePath);
@@ -26882,6 +27004,7 @@ var cache6;
26882
27004
  var init_trusted_recipients = __esm({
26883
27005
  "src/auth/trusted-recipients.ts"() {
26884
27006
  "use strict";
27007
+ init_esm_shims();
26885
27008
  init_dist();
26886
27009
  cache6 = null;
26887
27010
  }
@@ -26889,7 +27012,7 @@ var init_trusted_recipients = __esm({
26889
27012
 
26890
27013
  // src/auth/state.ts
26891
27014
  import fs37 from "fs";
26892
- import path39 from "path";
27015
+ import path40 from "path";
26893
27016
  import os29 from "os";
26894
27017
  function extractCommandPattern(toolName, args) {
26895
27018
  const lower2 = toolName.toLowerCase();
@@ -26967,7 +27090,7 @@ function writeTrustSession(toolName, durationMs, args) {
26967
27090
  }
26968
27091
  function getPersistentDecision(toolName) {
26969
27092
  try {
26970
- const file2 = path39.join(os29.homedir(), ".node9", "decisions.json");
27093
+ const file2 = path40.join(os29.homedir(), ".node9", "decisions.json");
26971
27094
  if (!fs37.existsSync(file2)) return null;
26972
27095
  const decisions = JSON.parse(fs37.readFileSync(file2, "utf-8"));
26973
27096
  const d = decisions[toolName];
@@ -26980,18 +27103,19 @@ var PAUSED_FILE, TRUST_FILE;
26980
27103
  var init_state2 = __esm({
26981
27104
  "src/auth/state.ts"() {
26982
27105
  "use strict";
27106
+ init_esm_shims();
26983
27107
  init_policy();
26984
27108
  init_atomic_write();
26985
27109
  init_forecast_context();
26986
- PAUSED_FILE = path39.join(os29.homedir(), ".node9", "PAUSED");
26987
- TRUST_FILE = path39.join(os29.homedir(), ".node9", "trust.json");
27110
+ PAUSED_FILE = path40.join(os29.homedir(), ".node9", "PAUSED");
27111
+ TRUST_FILE = path40.join(os29.homedir(), ".node9", "trust.json");
26988
27112
  }
26989
27113
  });
26990
27114
 
26991
27115
  // src/auth/cloud.ts
26992
27116
  import fs38 from "fs";
26993
27117
  import os30 from "os";
26994
- import path40 from "path";
27118
+ import path41 from "path";
26995
27119
  function maskArgsForCloud(args) {
26996
27120
  if (args === void 0 || args === null) return args;
26997
27121
  try {
@@ -27024,7 +27148,7 @@ async function initNode9SaaS(toolName, args, creds, meta, riskMetadata, agentPol
27024
27148
  let ciContext;
27025
27149
  if (process.env.CI) {
27026
27150
  try {
27027
- const ciContextPath = path40.join(os30.homedir(), ".node9", "ci-context.json");
27151
+ const ciContextPath = path41.join(os30.homedir(), ".node9", "ci-context.json");
27028
27152
  const ci = readCappedText(ciContextPath, 1e4);
27029
27153
  if (!ci) throw new Error("ci-context.json unreadable");
27030
27154
  if (ci.truncated) throw new Error("ci-context.json exceeds 10 KB");
@@ -27160,6 +27284,7 @@ var CLOUD_ARRAY_KEYS;
27160
27284
  var init_cloud = __esm({
27161
27285
  "src/auth/cloud.ts"() {
27162
27286
  "use strict";
27287
+ init_esm_shims();
27163
27288
  init_audit();
27164
27289
  init_safe_text();
27165
27290
  init_read_capped();
@@ -27171,10 +27296,10 @@ var init_cloud = __esm({
27171
27296
 
27172
27297
  // src/loop-detector.ts
27173
27298
  import fs39 from "fs";
27174
- import path41 from "path";
27299
+ import path42 from "path";
27175
27300
  import os31 from "os";
27176
27301
  function loopStateFile() {
27177
- return path41.join(os31.homedir(), ".node9", "loop-state.json");
27302
+ return path42.join(os31.homedir(), ".node9", "loop-state.json");
27178
27303
  }
27179
27304
  function readState() {
27180
27305
  try {
@@ -27188,7 +27313,7 @@ function readState() {
27188
27313
  }
27189
27314
  }
27190
27315
  function writeState(records) {
27191
- const dir2 = path41.dirname(loopStateFile());
27316
+ const dir2 = path42.dirname(loopStateFile());
27192
27317
  if (!fs39.existsSync(dir2)) fs39.mkdirSync(dir2, { recursive: true });
27193
27318
  const tmpPath = `${loopStateFile()}.${os31.hostname()}.${process.pid}.tmp`;
27194
27319
  fs39.writeFileSync(tmpPath, JSON.stringify(records));
@@ -27219,6 +27344,7 @@ function recordAndCheck(tool, args, threshold = 3, windowMs = 12e4) {
27219
27344
  var init_loop_detector = __esm({
27220
27345
  "src/loop-detector.ts"() {
27221
27346
  "use strict";
27347
+ init_esm_shims();
27222
27348
  init_dist();
27223
27349
  init_forecast_context();
27224
27350
  init_dist();
@@ -27243,6 +27369,7 @@ var BLOCKED_BY, DASH_BLOCKED_BY, SHIELD;
27243
27369
  var init_negotiation = __esm({
27244
27370
  "src/policy/negotiation.ts"() {
27245
27371
  "use strict";
27372
+ init_esm_shims();
27246
27373
  BLOCKED_BY = " is blocked by ";
27247
27374
  DASH_BLOCKED_BY = " \u2014 blocked by ";
27248
27375
  SHIELD = " shield";
@@ -27339,6 +27466,7 @@ var CHANNEL_NAMES;
27339
27466
  var init_card_result = __esm({
27340
27467
  "src/auth/card-result.ts"() {
27341
27468
  "use strict";
27469
+ init_esm_shims();
27342
27470
  init_decision_record();
27343
27471
  CHANNEL_NAMES = {
27344
27472
  terminal: "Terminal (node9 tail)",
@@ -27351,7 +27479,7 @@ var init_card_result = __esm({
27351
27479
 
27352
27480
  // src/auth/orchestrator.ts
27353
27481
  import os32 from "os";
27354
- import path42 from "path";
27482
+ import path43 from "path";
27355
27483
  function isProtectedPathRule(ruleName) {
27356
27484
  if (!ruleName) return false;
27357
27485
  return /^(?:org:)?block-path-/.test(ruleName) || /^shield:project-jail:block-read-/.test(ruleName);
@@ -27398,9 +27526,9 @@ function isMcpToolName(toolName) {
27398
27526
  return /^mcp__[^_](?:[^_]|_(?!_))*?__/i.test(toolName);
27399
27527
  }
27400
27528
  function absoluteUploadPath(spelled, cwd) {
27401
- const expanded = spelled === "~" || spelled.startsWith("~/") ? path42.join(os32.homedir(), spelled.slice(1)) : spelled;
27402
- if (path42.isAbsolute(expanded)) return expanded;
27403
- return cwd && path42.isAbsolute(cwd) ? path42.resolve(cwd, expanded) : expanded;
27529
+ const expanded = spelled === "~" || spelled.startsWith("~/") ? path43.join(os32.homedir(), spelled.slice(1)) : spelled;
27530
+ if (path43.isAbsolute(expanded)) return expanded;
27531
+ return cwd && path43.isAbsolute(cwd) ? path43.resolve(cwd, expanded) : expanded;
27404
27532
  }
27405
27533
  function extractFilePaths(toolName, args, shellCommand) {
27406
27534
  const paths = [];
@@ -28747,6 +28875,7 @@ var SENSITIVE_PATH_PATTERN, WRITE_TOOLS, VERDICT_RANK2, NETWORK_COMMAND_RE;
28747
28875
  var init_orchestrator = __esm({
28748
28876
  "src/auth/orchestrator.ts"() {
28749
28877
  "use strict";
28878
+ init_esm_shims();
28750
28879
  init_state();
28751
28880
  init_native();
28752
28881
  init_context_sniper();
@@ -28802,6 +28931,7 @@ var TAINT_TTL_MS, SESSION_TAINT_TTL_MS, EXPOSURE_TTL_MS, ForecastSessionState;
28802
28931
  var init_forecast_state = __esm({
28803
28932
  "src/auth/forecast-state.ts"() {
28804
28933
  "use strict";
28934
+ init_esm_shims();
28805
28935
  TAINT_TTL_MS = 60 * 60 * 1e3;
28806
28936
  SESSION_TAINT_TTL_MS = 30 * 60 * 1e3;
28807
28937
  EXPOSURE_TTL_MS = 4 * 60 * 60 * 1e3;
@@ -28986,6 +29116,7 @@ var LAYER_BY_TAG, LOGGED_TAGS;
28986
29116
  var init_forecast = __esm({
28987
29117
  "src/auth/forecast.ts"() {
28988
29118
  "use strict";
29119
+ init_esm_shims();
28989
29120
  init_dist();
28990
29121
  init_config();
28991
29122
  init_orchestrator();
@@ -29017,17 +29148,17 @@ var init_forecast = __esm({
29017
29148
 
29018
29149
  // src/version.ts
29019
29150
  import fs40 from "fs";
29020
- import path43 from "path";
29151
+ import path44 from "path";
29021
29152
  function readVersion() {
29022
29153
  let dir2 = __dirname;
29023
29154
  for (let i = 0; i < 5; i++) {
29024
- const p = path43.join(dir2, "package.json");
29155
+ const p = path44.join(dir2, "package.json");
29025
29156
  try {
29026
29157
  const pkg = JSON.parse(fs40.readFileSync(p, "utf-8"));
29027
29158
  if (pkg.name === "@node9/proxy" && typeof pkg.version === "string") return pkg.version;
29028
29159
  } catch {
29029
29160
  }
29030
- const parent = path43.dirname(dir2);
29161
+ const parent = path44.dirname(dir2);
29031
29162
  if (parent === dir2) break;
29032
29163
  dir2 = parent;
29033
29164
  }
@@ -29037,6 +29168,7 @@ var PROXY_VERSION;
29037
29168
  var init_version = __esm({
29038
29169
  "src/version.ts"() {
29039
29170
  "use strict";
29171
+ init_esm_shims();
29040
29172
  PROXY_VERSION = readVersion();
29041
29173
  }
29042
29174
  });
@@ -29044,10 +29176,10 @@ var init_version = __esm({
29044
29176
  // src/cli/commands/scan-cache.ts
29045
29177
  import fs41 from "fs";
29046
29178
  import os33 from "os";
29047
- import path44 from "path";
29179
+ import path45 from "path";
29048
29180
  import { createHash as createHash5 } from "crypto";
29049
29181
  function scanCacheRoot() {
29050
- return path44.join(os33.homedir(), ".node9", "scan-cache");
29182
+ return path45.join(os33.homedir(), ".node9", "scan-cache");
29051
29183
  }
29052
29184
  function configHashOf(config) {
29053
29185
  const h = createHash5("sha256");
@@ -29055,7 +29187,7 @@ function configHashOf(config) {
29055
29187
  h.update(JSON.stringify(config.policySource));
29056
29188
  h.update(JSON.stringify(config.policy));
29057
29189
  for (const name of SIDECAR_FILES) {
29058
- const st = fileStamp(path44.join(os33.homedir(), ".node9", name));
29190
+ const st = fileStamp(path45.join(os33.homedir(), ".node9", name));
29059
29191
  h.update(`|${name}:${st ? `${st.size}:${st.mtimeMs}` : "absent"}`);
29060
29192
  }
29061
29193
  return h.digest("hex").slice(0, 16);
@@ -29072,6 +29204,7 @@ var SCAN_CACHE_VERSION, FLUSH_EVERY_FILES, FLUSH_EVERY_MS, activeCaches, SIDECAR
29072
29204
  var init_scan_cache = __esm({
29073
29205
  "src/cli/commands/scan-cache.ts"() {
29074
29206
  "use strict";
29207
+ init_esm_shims();
29075
29208
  init_dist();
29076
29209
  init_version();
29077
29210
  SCAN_CACHE_VERSION = 3;
@@ -29086,8 +29219,8 @@ var init_scan_cache = __esm({
29086
29219
  "trusted-hosts.json",
29087
29220
  "trusted-recipients.json",
29088
29221
  "rules-cache.json",
29089
- path44.join("osv", "npm", "meta.json"),
29090
- path44.join("osv", "PyPI", "meta.json")
29222
+ path45.join("osv", "npm", "meta.json"),
29223
+ path45.join("osv", "PyPI", "meta.json")
29091
29224
  ];
29092
29225
  ScanCache = class {
29093
29226
  root;
@@ -29116,7 +29249,7 @@ var init_scan_cache = __esm({
29116
29249
  if (!this.enabled) return fresh;
29117
29250
  try {
29118
29251
  const raw = JSON.parse(
29119
- fs41.readFileSync(path44.join(this.root, "index.json"), "utf8")
29252
+ fs41.readFileSync(path45.join(this.root, "index.json"), "utf8")
29120
29253
  );
29121
29254
  if (raw.cacheVersion !== SCAN_CACHE_VERSION || raw.engineVersion !== CANONICAL_EXTRACTOR_VERSION || raw.proxyVersion !== PROXY_VERSION || raw.configHash !== configHash || typeof raw.files !== "object") {
29122
29255
  this.dropAll();
@@ -29153,7 +29286,7 @@ var init_scan_cache = __esm({
29153
29286
  }
29154
29287
  }
29155
29288
  try {
29156
- const stored = JSON.parse(fs41.readFileSync(path44.join(this.root, e.result), "utf8"));
29289
+ const stored = JSON.parse(fs41.readFileSync(path45.join(this.root, e.result), "utf8"));
29157
29290
  if ((stored.judgedFrom ?? null) !== (e.judgedFrom ?? null) || !stored.result) {
29158
29291
  this.misses++;
29159
29292
  return null;
@@ -29168,13 +29301,13 @@ var init_scan_cache = __esm({
29168
29301
  put(filePath, stamp, agent, result, hasher, judgeFrom = null) {
29169
29302
  if (!this.enabled) return;
29170
29303
  const name = createHash5("sha256").update(`${agent}|${filePath}`).digest("hex").slice(0, 40);
29171
- const rel = path44.join("files", name.slice(0, 2), `${name}.json`);
29304
+ const rel = path45.join("files", name.slice(0, 2), `${name}.json`);
29172
29305
  const configHashes = {};
29173
29306
  if (hasher)
29174
29307
  for (const cwd of result.configCwds ?? []) configHashes[cwd] = hasher.configHashFor(cwd);
29175
29308
  try {
29176
- const abs = path44.join(this.root, rel);
29177
- fs41.mkdirSync(path44.dirname(abs), { recursive: true, mode: 448 });
29309
+ const abs = path45.join(this.root, rel);
29310
+ fs41.mkdirSync(path45.dirname(abs), { recursive: true, mode: 448 });
29178
29311
  fs41.writeFileSync(
29179
29312
  abs,
29180
29313
  JSON.stringify({ judgedFrom: judgeFrom ? judgeFrom.toISOString() : null, result }),
@@ -29200,7 +29333,7 @@ var init_scan_cache = __esm({
29200
29333
  for (const [key, e] of Object.entries(this.index.files)) {
29201
29334
  if (fs41.existsSync(key)) continue;
29202
29335
  try {
29203
- fs41.rmSync(path44.join(this.root, e.result), { force: true });
29336
+ fs41.rmSync(path45.join(this.root, e.result), { force: true });
29204
29337
  } catch {
29205
29338
  }
29206
29339
  delete this.index.files[key];
@@ -29222,9 +29355,9 @@ var init_scan_cache = __esm({
29222
29355
  if (!this.dirty) return;
29223
29356
  try {
29224
29357
  fs41.mkdirSync(this.root, { recursive: true, mode: 448 });
29225
- const tmp = path44.join(this.root, `index.${process.pid}.tmp`);
29358
+ const tmp = path45.join(this.root, `index.${process.pid}.tmp`);
29226
29359
  fs41.writeFileSync(tmp, JSON.stringify(this.index), { mode: 384 });
29227
- fs41.renameSync(tmp, path44.join(this.root, "index.json"));
29360
+ fs41.renameSync(tmp, path45.join(this.root, "index.json"));
29228
29361
  this.dirty = false;
29229
29362
  } catch {
29230
29363
  }
@@ -29236,7 +29369,7 @@ var init_scan_cache = __esm({
29236
29369
  // src/cli/commands/scan-judge.ts
29237
29370
  import fs42 from "fs";
29238
29371
  import os34 from "os";
29239
- import path45 from "path";
29372
+ import path46 from "path";
29240
29373
  function findingDedupKey(f) {
29241
29374
  return `${f.source.rule.name ?? "<unnamed>"}|${preview(f.input)}|${f.project}|${f.repo ?? ""}`;
29242
29375
  }
@@ -29307,6 +29440,7 @@ var PREVIEW_LEN, HistoryJudge, CONTENT_FIELDS;
29307
29440
  var init_scan_judge = __esm({
29308
29441
  "src/cli/commands/scan-judge.ts"() {
29309
29442
  "use strict";
29443
+ init_esm_shims();
29310
29444
  init_config();
29311
29445
  init_shields();
29312
29446
  init_forecast();
@@ -29335,20 +29469,20 @@ var init_scan_judge = __esm({
29335
29469
  * file, so worktrees count), home-relative; undefined when none. Cached per
29336
29470
  * directory: history repeats the same few cwds thousands of times. */
29337
29471
  repoOf(cwd) {
29338
- if (!cwd || !path45.isAbsolute(cwd)) return void 0;
29472
+ if (!cwd || !path46.isAbsolute(cwd)) return void 0;
29339
29473
  if (this.repos.has(cwd)) return this.repos.get(cwd);
29340
29474
  let dir2 = cwd;
29341
29475
  let found;
29342
29476
  for (; ; ) {
29343
29477
  try {
29344
- if (fs42.existsSync(path45.join(dir2, ".git"))) {
29478
+ if (fs42.existsSync(path46.join(dir2, ".git"))) {
29345
29479
  found = dir2;
29346
29480
  break;
29347
29481
  }
29348
29482
  } catch {
29349
29483
  break;
29350
29484
  }
29351
- const parent = path45.dirname(dir2);
29485
+ const parent = path46.dirname(dir2);
29352
29486
  if (parent === dir2) break;
29353
29487
  dir2 = parent;
29354
29488
  }
@@ -29510,6 +29644,7 @@ function canonicalToolInput(rawToolName, input) {
29510
29644
  var init_hook_payload = __esm({
29511
29645
  "src/utils/hook-payload.ts"() {
29512
29646
  "use strict";
29647
+ init_esm_shims();
29513
29648
  }
29514
29649
  });
29515
29650
 
@@ -29517,6 +29652,7 @@ var init_hook_payload = __esm({
29517
29652
  var init_scan_summary = __esm({
29518
29653
  "src/scan-summary.ts"() {
29519
29654
  "use strict";
29655
+ init_esm_shims();
29520
29656
  init_shields();
29521
29657
  init_dist();
29522
29658
  init_dist();
@@ -29529,6 +29665,7 @@ import stringWidth from "string-width";
29529
29665
  var init_scan_derive = __esm({
29530
29666
  "src/cli/render/scan-derive.ts"() {
29531
29667
  "use strict";
29668
+ init_esm_shims();
29532
29669
  }
29533
29670
  });
29534
29671
 
@@ -29536,6 +29673,7 @@ var init_scan_derive = __esm({
29536
29673
  var init_protection = __esm({
29537
29674
  "src/protection.ts"() {
29538
29675
  "use strict";
29676
+ init_esm_shims();
29539
29677
  }
29540
29678
  });
29541
29679
 
@@ -29543,6 +29681,7 @@ var init_protection = __esm({
29543
29681
  var init_scan_json = __esm({
29544
29682
  "src/cli/render/scan-json.ts"() {
29545
29683
  "use strict";
29684
+ init_esm_shims();
29546
29685
  }
29547
29686
  });
29548
29687
 
@@ -29550,6 +29689,7 @@ var init_scan_json = __esm({
29550
29689
  var init_scan_history = __esm({
29551
29690
  "src/cli/render/scan-history.ts"() {
29552
29691
  "use strict";
29692
+ init_esm_shims();
29553
29693
  init_atomic_write();
29554
29694
  }
29555
29695
  });
@@ -29557,7 +29697,7 @@ var init_scan_history = __esm({
29557
29697
  // src/cli/commands/scan.ts
29558
29698
  import chalk6 from "chalk";
29559
29699
  import fs43 from "fs";
29560
- import path46 from "path";
29700
+ import path47 from "path";
29561
29701
  import os35 from "os";
29562
29702
  import stringWidth2 from "string-width";
29563
29703
  function dayKey(ts) {
@@ -29771,7 +29911,7 @@ async function processClaudeFile(file2, projPath, projLabel, judge, judgeFrom, r
29771
29911
  const session = { sessionId, costUSD: 0, toolCalls: 0 };
29772
29912
  let raw;
29773
29913
  try {
29774
- raw = fs43.readFileSync(path46.join(projPath, file2), "utf-8");
29914
+ raw = fs43.readFileSync(path47.join(projPath, file2), "utf-8");
29775
29915
  } catch {
29776
29916
  return false;
29777
29917
  }
@@ -29840,7 +29980,7 @@ async function processClaudeFile(file2, projPath, projLabel, judge, judgeFrom, r
29840
29980
  if (block.type !== "tool_result") continue;
29841
29981
  const filePath = block.tool_use_id ? toolUseFilePaths.get(block.tool_use_id) : void 0;
29842
29982
  if (filePath) {
29843
- const ext = path46.extname(filePath).toLowerCase();
29983
+ const ext = path47.extname(filePath).toLowerCase();
29844
29984
  if (CODE_EXTENSIONS.has(ext)) continue;
29845
29985
  }
29846
29986
  const resultText = typeof block.content === "string" ? block.content : Array.isArray(block.content) ? block.content.map((c) => c.text ?? "").join("\n") : null;
@@ -29960,7 +30100,7 @@ async function processClaudeFile(file2, projPath, projLabel, judge, judgeFrom, r
29960
30100
  return true;
29961
30101
  }
29962
30102
  async function processClaudeProjectAsync(proj, projectsDir, judge, cache7, startDate, result, dedup, canaryVals, onProgress, onLine) {
29963
- const projPath = path46.join(projectsDir, proj);
30103
+ const projPath = path47.join(projectsDir, proj);
29964
30104
  try {
29965
30105
  if (!fs43.statSync(projPath).isDirectory()) return;
29966
30106
  } catch {
@@ -29974,7 +30114,7 @@ async function processClaudeProjectAsync(proj, projectsDir, judge, cache7, start
29974
30114
  return;
29975
30115
  }
29976
30116
  for (const file2 of files) {
29977
- const filePath = path46.join(projPath, file2);
30117
+ const filePath = path47.join(projPath, file2);
29978
30118
  const stamp = fileStamp(filePath);
29979
30119
  if (!fileMayHoldWindow(stamp, startDate)) continue;
29980
30120
  result.filesScanned++;
@@ -30117,7 +30257,7 @@ function mergeFileScan(result, file2, dedup, startDate = null) {
30117
30257
  }
30118
30258
  }
30119
30259
  async function scanClaudeHistoryAsync(startDate, onProgress, onLine, opts = {}) {
30120
- const projectsDir = path46.join(os35.homedir(), ".claude", "projects");
30260
+ const projectsDir = path47.join(os35.homedir(), ".claude", "projects");
30121
30261
  const result = emptyClaudeScan();
30122
30262
  if (!fs43.existsSync(projectsDir)) return result;
30123
30263
  let projDirs;
@@ -30150,7 +30290,7 @@ async function scanClaudeHistoryAsync(startDate, onProgress, onLine, opts = {})
30150
30290
  }
30151
30291
  async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30152
30292
  const canaryVals = safeCanaryScanValues();
30153
- const tmpDir = path46.join(os35.homedir(), ".gemini", "tmp");
30293
+ const tmpDir = path47.join(os35.homedir(), ".gemini", "tmp");
30154
30294
  const result = {
30155
30295
  filesScanned: 0,
30156
30296
  sessions: 0,
@@ -30177,7 +30317,7 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30177
30317
  const judge = new HistoryJudge();
30178
30318
  const cache7 = openScanCache(judge, opts);
30179
30319
  for (const slug2 of slugDirs) {
30180
- const slugPath = path46.join(tmpDir, slug2);
30320
+ const slugPath = path47.join(tmpDir, slug2);
30181
30321
  try {
30182
30322
  if (!fs43.statSync(slugPath).isDirectory()) continue;
30183
30323
  } catch {
@@ -30186,11 +30326,11 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30186
30326
  let projLabel = stripTerminalEscapes(slug2).slice(0, 40);
30187
30327
  try {
30188
30328
  projLabel = stripTerminalEscapes(
30189
- fs43.readFileSync(path46.join(slugPath, ".project_root"), "utf-8").trim()
30329
+ fs43.readFileSync(path47.join(slugPath, ".project_root"), "utf-8").trim()
30190
30330
  ).replace(os35.homedir(), "~").slice(0, 40);
30191
30331
  } catch {
30192
30332
  }
30193
- const chatsDir = path46.join(slugPath, "chats");
30333
+ const chatsDir = path47.join(slugPath, "chats");
30194
30334
  if (!fs43.existsSync(chatsDir)) continue;
30195
30335
  let chatFiles;
30196
30336
  try {
@@ -30200,7 +30340,7 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30200
30340
  }
30201
30341
  for (const chatFile of chatFiles) {
30202
30342
  const sessionId = chatFile.replace(/\.jsonl?$/, "");
30203
- const filePath = path46.join(chatsDir, chatFile);
30343
+ const filePath = path47.join(chatsDir, chatFile);
30204
30344
  const stamp = fileStamp(filePath);
30205
30345
  if (!fileMayHoldWindow(stamp, startDate)) continue;
30206
30346
  result.filesScanned++;
@@ -30214,7 +30354,7 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30214
30354
  const fileDedup = emptyScanDedup();
30215
30355
  let raw;
30216
30356
  try {
30217
- raw = fs43.readFileSync(path46.join(chatsDir, chatFile), "utf-8");
30357
+ raw = fs43.readFileSync(path47.join(chatsDir, chatFile), "utf-8");
30218
30358
  } catch {
30219
30359
  continue;
30220
30360
  }
@@ -30351,12 +30491,12 @@ async function scanGeminiHistory(startDate, onProgress, onLine, opts = {}) {
30351
30491
  return result;
30352
30492
  }
30353
30493
  function antigravityBrainDirs() {
30354
- return ["antigravity-cli", "antigravity-ide"].map((surface) => path46.join(os35.homedir(), ".gemini", surface, "brain")).filter((p) => fs43.existsSync(p));
30494
+ return ["antigravity-cli", "antigravity-ide"].map((surface) => path47.join(os35.homedir(), ".gemini", surface, "brain")).filter((p) => fs43.existsSync(p));
30355
30495
  }
30356
30496
  function antigravityTranscriptPath(convPath) {
30357
- const logsDir = path46.join(convPath, ".system_generated", "logs");
30497
+ const logsDir = path47.join(convPath, ".system_generated", "logs");
30358
30498
  for (const name of ["transcript_full.jsonl", "transcript.jsonl"]) {
30359
- const p = path46.join(logsDir, name);
30499
+ const p = path47.join(logsDir, name);
30360
30500
  if (fs43.existsSync(p)) return p;
30361
30501
  }
30362
30502
  return null;
@@ -30392,7 +30532,7 @@ async function scanAntigravityHistory(startDate, onProgress, onLine, opts = {})
30392
30532
  continue;
30393
30533
  }
30394
30534
  for (const conv of convDirs) {
30395
- const convPath = path46.join(brainDir, conv);
30535
+ const convPath = path47.join(brainDir, conv);
30396
30536
  try {
30397
30537
  if (!fs43.statSync(convPath).isDirectory()) continue;
30398
30538
  } catch {
@@ -30514,7 +30654,7 @@ async function scanAntigravityHistory(startDate, onProgress, onLine, opts = {})
30514
30654
  timestamp: timestamp2,
30515
30655
  sessionId,
30516
30656
  project: projLabel,
30517
- cwd: typeof input.cwd === "string" && path46.isAbsolute(input.cwd) ? input.cwd : void 0
30657
+ cwd: typeof input.cwd === "string" && path47.isAbsolute(input.cwd) ? input.cwd : void 0
30518
30658
  },
30519
30659
  fileResult,
30520
30660
  fileDedup
@@ -30537,7 +30677,7 @@ async function scanAntigravityHistory(startDate, onProgress, onLine, opts = {})
30537
30677
  }
30538
30678
  async function scanCopilotHistory(startDate, onProgress, onLine, opts = {}) {
30539
30679
  const canaryVals = safeCanaryScanValues();
30540
- const sessionDir = path46.join(os35.homedir(), ".copilot", "session-state");
30680
+ const sessionDir = path47.join(os35.homedir(), ".copilot", "session-state");
30541
30681
  const result = {
30542
30682
  filesScanned: 0,
30543
30683
  sessions: 0,
@@ -30565,7 +30705,7 @@ async function scanCopilotHistory(startDate, onProgress, onLine, opts = {}) {
30565
30705
  const judge = new HistoryJudge();
30566
30706
  const cache7 = openScanCache(judge, opts);
30567
30707
  for (const sessionId of sessionIds) {
30568
- const eventsPath = path46.join(sessionDir, sessionId, "events.jsonl");
30708
+ const eventsPath = path47.join(sessionDir, sessionId, "events.jsonl");
30569
30709
  if (!fs43.existsSync(eventsPath)) continue;
30570
30710
  const stamp = fileStamp(eventsPath);
30571
30711
  if (!fileMayHoldWindow(stamp, startDate)) continue;
@@ -30606,7 +30746,7 @@ async function scanCopilotHistory(startDate, onProgress, onLine, opts = {}) {
30606
30746
  const cwd = ev.data?.context?.cwd;
30607
30747
  if (typeof cwd === "string" && cwd) {
30608
30748
  projLabel = stripTerminalEscapes(cwd).replace(os35.homedir(), "~").slice(0, 40);
30609
- if (path46.isAbsolute(cwd)) sessionCwd = cwd;
30749
+ if (path47.isAbsolute(cwd)) sessionCwd = cwd;
30610
30750
  }
30611
30751
  continue;
30612
30752
  }
@@ -30763,7 +30903,7 @@ async function scanCodexHistory(startDate, onProgress, onLine, opts = {}) {
30763
30903
  startTime = String(payload["timestamp"] ?? "");
30764
30904
  const cwd = String(payload["cwd"] ?? "");
30765
30905
  projLabel = stripTerminalEscapes(cwd.replace(os35.homedir(), "~")).slice(0, 40);
30766
- if (path46.isAbsolute(cwd)) sessionCwd = cwd;
30906
+ if (path47.isAbsolute(cwd)) sessionCwd = cwd;
30767
30907
  continue;
30768
30908
  }
30769
30909
  if (entry.type === "event_msg" && payload["type"] === "user_message") {
@@ -30883,6 +31023,7 @@ var toolInspectionMap, STATE_LOOKBACK_MS, CODE_EXTENSIONS, SELF_OUTPUT_MARKERS,
30883
31023
  var init_scan = __esm({
30884
31024
  "src/cli/commands/scan.ts"() {
30885
31025
  "use strict";
31026
+ init_esm_shims();
30886
31027
  init_keyed_guard();
30887
31028
  init_shields();
30888
31029
  init_config();
@@ -30963,11 +31104,11 @@ var init_scan = __esm({
30963
31104
  // src/tui/dashboard/data.ts
30964
31105
  import fs44 from "fs";
30965
31106
  import os36 from "os";
30966
- import path47 from "path";
31107
+ import path48 from "path";
30967
31108
  import http2 from "http";
30968
31109
  import { execFile } from "child_process";
30969
31110
  function auditLogPath() {
30970
- return path47.join(os36.homedir(), ".node9", "audit.log");
31111
+ return path48.join(os36.homedir(), ".node9", "audit.log");
30971
31112
  }
30972
31113
  function readAuditEntriesAsync(chunkSize = 1e3, customPath) {
30973
31114
  return new Promise((resolve) => {
@@ -31149,9 +31290,9 @@ function shortenPath(p) {
31149
31290
  return p.startsWith(home) ? p.replace(home, "~") : p;
31150
31291
  }
31151
31292
  async function loadReportAuditAsync(period) {
31152
- const claudeProjectsDir = path47.join(os36.homedir(), ".claude", "projects");
31293
+ const claudeProjectsDir = path48.join(os36.homedir(), ".claude", "projects");
31153
31294
  const codexSessionsDir2 = codexSessionsDir();
31154
- const geminiTmpDir = path47.join(os36.homedir(), ".gemini", "tmp");
31295
+ const geminiTmpDir = path48.join(os36.homedir(), ".gemini", "tmp");
31155
31296
  const { start, end } = getDateRange(period, /* @__PURE__ */ new Date());
31156
31297
  const entries = await readAuditEntriesAsync();
31157
31298
  void ensurePricingLoaded();
@@ -31497,6 +31638,7 @@ var TEST_TOOLS, COST_WALK_LOOKBACK_MS, FORENSIC_CATEGORIES, SHELL_TOOLS, SSE_BAC
31497
31638
  var init_data = __esm({
31498
31639
  "src/tui/dashboard/data.ts"() {
31499
31640
  "use strict";
31641
+ init_esm_shims();
31500
31642
  init_cost_codex();
31501
31643
  init_blast();
31502
31644
  init_posture();
@@ -31585,6 +31727,7 @@ function computeHealthBadge(input) {
31585
31727
  var init_health = __esm({
31586
31728
  "src/tui/dashboard/health.ts"() {
31587
31729
  "use strict";
31730
+ init_esm_shims();
31588
31731
  }
31589
31732
  });
31590
31733
 
@@ -31622,6 +31765,7 @@ function localTimeOf(ts) {
31622
31765
  var init_format = __esm({
31623
31766
  "src/tui/dashboard/format.ts"() {
31624
31767
  "use strict";
31768
+ init_esm_shims();
31625
31769
  }
31626
31770
  });
31627
31771
 
@@ -32072,6 +32216,7 @@ var COL, NOTIFICATION_HEIGHT, LIVE_SECURITY_ROWS_HEIGHT, LIVE_ACTIVITY_ROWS, SHI
32072
32216
  var init_panels = __esm({
32073
32217
  "src/tui/dashboard/panels.tsx"() {
32074
32218
  "use strict";
32219
+ init_esm_shims();
32075
32220
  init_format();
32076
32221
  COL = {
32077
32222
  brand: "#FF8C42",
@@ -32129,6 +32274,7 @@ var BLOCK_REASON_LABELS;
32129
32274
  var init_util = __esm({
32130
32275
  "src/tui/dashboard/views/report/util.ts"() {
32131
32276
  "use strict";
32277
+ init_esm_shims();
32132
32278
  BLOCK_REASON_LABELS = {
32133
32279
  timeout: "Approval timeout",
32134
32280
  "smart-rule-block": "Smart rule",
@@ -32179,6 +32325,7 @@ var ICON_W, LABEL_W, COUNT_W;
32179
32325
  var init_Protection = __esm({
32180
32326
  "src/tui/dashboard/views/report/panels/Protection.tsx"() {
32181
32327
  "use strict";
32328
+ init_esm_shims();
32182
32329
  init_panels();
32183
32330
  init_util();
32184
32331
  ICON_W = 2;
@@ -32198,6 +32345,7 @@ var COST_LABEL;
32198
32345
  var init_cost_note = __esm({
32199
32346
  "src/cli/render/ink/panels/cost-note.ts"() {
32200
32347
  "use strict";
32348
+ init_esm_shims();
32201
32349
  init_keyed_guard();
32202
32350
  COST_LABEL = "COST \xB7 based on API value";
32203
32351
  }
@@ -32260,6 +32408,7 @@ var LABEL_W2;
32260
32408
  var init_Cost = __esm({
32261
32409
  "src/tui/dashboard/views/report/panels/Cost.tsx"() {
32262
32410
  "use strict";
32411
+ init_esm_shims();
32263
32412
  init_panels();
32264
32413
  init_format();
32265
32414
  init_cost_note();
@@ -32274,8 +32423,8 @@ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-run
32274
32423
  function TopToolsProjects({ audit }) {
32275
32424
  const data = audit?.data;
32276
32425
  const tools = data ? [...data.toolMap.entries()].sort(([, a], [, b]) => b.calls - a.calls).slice(0, ROW_LIMIT) : [];
32277
- const projects = data ? [...data.cost.byProject.entries()].map(([path48, r]) => ({
32278
- name: basenameOf(path48),
32426
+ const projects = data ? [...data.cost.byProject.entries()].map(([path49, r]) => ({
32427
+ name: basenameOf(path49),
32279
32428
  cost: r.cost,
32280
32429
  tokens: r.inputTokens + r.outputTokens
32281
32430
  })).sort((a, b) => b.cost - a.cost).slice(0, ROW_LIMIT) : [];
@@ -32328,6 +32477,7 @@ var ROW_LIMIT, TOOL_LABEL_W, TOOL_COUNT_W, COL_GUTTER, PROJECT_LABEL_W;
32328
32477
  var init_TopToolsProjects = __esm({
32329
32478
  "src/tui/dashboard/views/report/panels/TopToolsProjects.tsx"() {
32330
32479
  "use strict";
32480
+ init_esm_shims();
32331
32481
  init_panels();
32332
32482
  init_format();
32333
32483
  init_util();
@@ -32399,6 +32549,7 @@ var ROW_LIMIT2, LABEL_W3;
32399
32549
  var init_PeriodShields = __esm({
32400
32550
  "src/tui/dashboard/views/report/panels/PeriodShields.tsx"() {
32401
32551
  "use strict";
32552
+ init_esm_shims();
32402
32553
  init_panels();
32403
32554
  init_data();
32404
32555
  init_util();
@@ -32460,6 +32611,7 @@ var LABEL_WIDTH, PATH_ROW_LIMIT;
32460
32611
  var init_BlastRadius = __esm({
32461
32612
  "src/tui/dashboard/views/report/panels/BlastRadius.tsx"() {
32462
32613
  "use strict";
32614
+ init_esm_shims();
32463
32615
  init_panels();
32464
32616
  LABEL_WIDTH = 36;
32465
32617
  PATH_ROW_LIMIT = 5;
@@ -32482,6 +32634,7 @@ var FRAMES;
32482
32634
  var init_Spinner = __esm({
32483
32635
  "src/tui/dashboard/views/report/panels/Spinner.tsx"() {
32484
32636
  "use strict";
32637
+ init_esm_shims();
32485
32638
  FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
32486
32639
  }
32487
32640
  });
@@ -32525,6 +32678,7 @@ var ROW_LIMIT3, ICON_W2, LABEL_W4, COUNT_W2;
32525
32678
  var init_Leaks = __esm({
32526
32679
  "src/tui/dashboard/views/report/panels/Leaks.tsx"() {
32527
32680
  "use strict";
32681
+ init_esm_shims();
32528
32682
  init_panels();
32529
32683
  init_Spinner();
32530
32684
  init_util();
@@ -32590,6 +32744,7 @@ var TOOL_ROWS;
32590
32744
  var init_Loops = __esm({
32591
32745
  "src/tui/dashboard/views/report/panels/Loops.tsx"() {
32592
32746
  "use strict";
32747
+ init_esm_shims();
32593
32748
  init_panels();
32594
32749
  init_util();
32595
32750
  init_Spinner();
@@ -32626,6 +32781,7 @@ var ROW_LIMIT4, LABEL_W5, COUNT_W3;
32626
32781
  var init_TopBlocks = __esm({
32627
32782
  "src/tui/dashboard/views/report/panels/TopBlocks.tsx"() {
32628
32783
  "use strict";
32784
+ init_esm_shims();
32629
32785
  init_panels();
32630
32786
  init_util();
32631
32787
  ROW_LIMIT4 = 5;
@@ -32701,13 +32857,14 @@ function pickTopLoopFile(loops) {
32701
32857
  map.set(k, (map.get(k) ?? 0) + (l.count ?? 0));
32702
32858
  }
32703
32859
  if (map.size === 0) return void 0;
32704
- const [path48, count] = [...map.entries()].sort((a, b) => b[1] - a[1])[0];
32705
- return { path: path48, count };
32860
+ const [path49, count] = [...map.entries()].sort((a, b) => b[1] - a[1])[0];
32861
+ return { path: path49, count };
32706
32862
  }
32707
32863
  var EMPTY_FILTERED_SCAN;
32708
32864
  var init_derive = __esm({
32709
32865
  "src/tui/dashboard/views/report/derive.ts"() {
32710
32866
  "use strict";
32867
+ init_esm_shims();
32711
32868
  init_report_audit();
32712
32869
  EMPTY_FILTERED_SCAN = {
32713
32870
  leaks: [],
@@ -32907,6 +33064,7 @@ var PERIOD_LONG_LABEL;
32907
33064
  var init_report = __esm({
32908
33065
  "src/tui/dashboard/views/report/index.tsx"() {
32909
33066
  "use strict";
33067
+ init_esm_shims();
32910
33068
  init_panels();
32911
33069
  init_Protection();
32912
33070
  init_Cost();
@@ -33427,6 +33585,7 @@ var LIVE_BUFFER_CAP, AUDIT_REFRESH_MS, BLAST_REFRESH_MS, FIXED_PANELS_HEIGHT, LI
33427
33585
  var init_App = __esm({
33428
33586
  "src/tui/dashboard/App.tsx"() {
33429
33587
  "use strict";
33588
+ init_esm_shims();
33430
33589
  init_types();
33431
33590
  init_data();
33432
33591
  init_health();
@@ -33446,6 +33605,7 @@ var init_App = __esm({
33446
33605
  });
33447
33606
 
33448
33607
  // src/tui/dashboard/index.ts
33608
+ init_esm_shims();
33449
33609
  var ENTER_ALT_SCREEN = "\x1B[?1049h";
33450
33610
  var EXIT_ALT_SCREEN = "\x1B[?1049l";
33451
33611
  var altScreenActive = false;