@event4u/agent-config 17.2.0 → 17.3.0

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.
Files changed (152) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/.claude-plugin/skills/install-agent-config/SKILL.md +9 -9
  5. package/CHANGELOG.md +174 -0
  6. package/dist/agent-src/skills/code-intelligence/SKILL.md +13 -12
  7. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  8. package/dist/agent-src/templates/scripts/check_memory.ts +1 -1
  9. package/dist/cli/commands/recordTriggerEval.js +1 -1
  10. package/dist/cli-delegate/{chunk-KR5ZIFPO.js → chunk-DHSSP7V3.js} +1 -1
  11. package/dist/cli-delegate/chunk-E7ACTJTJ.js +6792 -0
  12. package/dist/cli-delegate/{chunk-BZJ4Y3CI.js → chunk-MT2WOOCY.js} +1 -1
  13. package/dist/cli-delegate/{chunk-CMZEKSNN.js → chunk-ORJPBER2.js} +2 -2
  14. package/dist/cli-delegate/{chunk-VYZGJLCA.js → chunk-RKNT4LIK.js} +22 -1286
  15. package/dist/cli-delegate/cmd_conformance.js +20 -14
  16. package/dist/cli-delegate/cmd_doctor.js +3 -3
  17. package/dist/cli-delegate/cmd_doctor_neighbours.js +2 -2
  18. package/dist/cli-delegate/cmd_explain.js +1 -1
  19. package/dist/cli-delegate/cmd_export.js +2 -2
  20. package/dist/cli-delegate/cmd_prune.js +2 -2
  21. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  22. package/dist/cli-delegate/cmd_settings_set.js +8 -4
  23. package/dist/cli-delegate/cmd_sync.js +2 -2
  24. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  25. package/dist/cli-delegate/cmd_validate.js +2 -2
  26. package/dist/discovery/deprecation-report.md +1 -1
  27. package/dist/discovery/discovery-manifest.json +3 -3
  28. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  29. package/dist/discovery/discovery-manifest.summary.md +1 -1
  30. package/dist/discovery/dormancy-report.md +1 -1
  31. package/dist/discovery/orphan-report.md +1 -1
  32. package/dist/discovery/packs.json +2 -2
  33. package/dist/discovery/trust-report.md +1 -1
  34. package/dist/discovery/workspaces.json +2 -2
  35. package/dist/hooks/code_graph_refresh.chunk.cjs +414 -0
  36. package/dist/hooks/code_graph_refresh.chunk.cjs.sha256 +1 -0
  37. package/dist/hooks/dispatch.js +21 -11
  38. package/dist/hooks/dispatch.sha256 +1 -1
  39. package/dist/hooks/egress_engine.chunk.cjs +1 -1
  40. package/dist/hooks/egress_engine.chunk.cjs.sha256 +1 -1
  41. package/dist/install/install.mjs +6974 -6037
  42. package/dist/mcp/mcp-cloudflare-catalogue.json +1 -0
  43. package/dist/mcp/registry-manifest.json +3 -2
  44. package/dist/mcp/server.json +13 -4
  45. package/dist/mcp/server.mjs +5561 -2463
  46. package/dist/scripts/_lib/egress_rules.js +8 -2
  47. package/dist/scripts/condense.js +9 -9
  48. package/dist/server/routes/discovery.js +1 -1
  49. package/dist/server/routes/install.js +1 -1
  50. package/dist/server/routes/ping.js +1 -1
  51. package/dist/server/routes/schema.js +4 -4
  52. package/dist/server/routes/settings.js +2 -6
  53. package/dist/server/routes/wizard.js +6 -6
  54. package/dist/server/schemas/settings.js +42 -42
  55. package/dist/shared/settingsSurface.js +1 -1
  56. package/dist/shared/userMd/schema.js +1 -1
  57. package/dist/shared/zodJsonSchema.js +47 -0
  58. package/dist/ui/assets/index-B0bcIgi0.js +77 -0
  59. package/dist/ui/index.html +1 -1
  60. package/package.json +3 -3
  61. package/src/agent-src/templates/scripts/check_memory.ts +1 -1
  62. package/src/config/ci-local-parity.yml +11 -0
  63. package/src/config/continuity-surface.json +9 -2
  64. package/src/config/gate-violation-baselines.json +3 -3
  65. package/src/config/gitignore-block.txt +6 -5
  66. package/src/config/hook-bundle-budget.json +16 -1
  67. package/src/config/pack-size-budget.json +12 -1
  68. package/src/config/packed-binary-manifest.json +9 -0
  69. package/src/scripts/_cli/cmd_settings_set.ts +3 -2
  70. package/src/scripts/_dispatch.bash +1 -1
  71. package/src/scripts/_lib/egress_rules.ts +8 -2
  72. package/src/scripts/_lib/listing_manifests.ts +85 -0
  73. package/src/scripts/_lib/neighbour_census.ts +1 -0
  74. package/src/scripts/_lib/release_settings_surface.ts +2 -6
  75. package/src/scripts/adoption_status.ts +231 -27
  76. package/src/scripts/build_mcp_registry_manifest.ts +23 -12
  77. package/src/scripts/check_dependency_floors.ts +7 -0
  78. package/src/scripts/check_release_manifest_content.ts +17 -2
  79. package/src/scripts/check_release_pr_shape.ts +5 -0
  80. package/src/scripts/code_graph/build.ts +80 -44
  81. package/src/scripts/code_graph/cli.ts +260 -16
  82. package/src/scripts/code_graph/conventions_default.ts +228 -0
  83. package/src/scripts/code_graph/extract.ts +5 -2
  84. package/src/scripts/code_graph/extract_more.ts +105 -1
  85. package/src/scripts/code_graph/loader.ts +10 -2
  86. package/src/scripts/code_graph/map.ts +174 -41
  87. package/src/scripts/code_graph/map_model.ts +53 -15
  88. package/src/scripts/code_graph/map_verify.ts +12 -0
  89. package/src/scripts/code_graph/map_viewer/viewer.css +6 -0
  90. package/src/scripts/code_graph/map_viewer/viewer.js +114 -13
  91. package/src/scripts/code_graph/passes.ts +173 -0
  92. package/src/scripts/code_graph/providers/angular.ts +55 -0
  93. package/src/scripts/code_graph/providers/aspnetcore.ts +182 -0
  94. package/src/scripts/code_graph/providers/catalog.ts +290 -0
  95. package/src/scripts/code_graph/providers/django.ts +163 -0
  96. package/src/scripts/code_graph/providers/express.ts +25 -0
  97. package/src/scripts/code_graph/providers/fastapi.ts +49 -0
  98. package/src/scripts/code_graph/providers/flask.ts +99 -0
  99. package/src/scripts/code_graph/providers/go_http.ts +121 -0
  100. package/src/scripts/code_graph/providers/index.ts +101 -0
  101. package/src/scripts/code_graph/{laravel_overlay.ts → providers/laravel.ts} +113 -7
  102. package/src/scripts/code_graph/providers/nestjs.ts +34 -0
  103. package/src/scripts/code_graph/providers/nextjs.ts +91 -0
  104. package/src/scripts/code_graph/providers/nuxt.ts +55 -0
  105. package/src/scripts/code_graph/providers/react-router.ts +58 -0
  106. package/src/scripts/code_graph/providers/shared/detect.ts +78 -0
  107. package/src/scripts/code_graph/providers/shared/extractors.ts +249 -0
  108. package/src/scripts/code_graph/providers/shared/js.ts +252 -0
  109. package/src/scripts/code_graph/providers/shared/kit.ts +210 -0
  110. package/src/scripts/code_graph/providers/shared/php.ts +64 -0
  111. package/src/scripts/code_graph/providers/shared/python.ts +223 -0
  112. package/src/scripts/code_graph/providers/spring.ts +138 -0
  113. package/src/scripts/code_graph/providers/sqlalchemy.ts +62 -0
  114. package/src/scripts/code_graph/providers/sveltekit.ts +59 -0
  115. package/src/scripts/code_graph/providers/symfony.ts +142 -0
  116. package/src/scripts/code_graph/providers/typeorm.ts +58 -0
  117. package/src/scripts/code_graph/providers/types.ts +56 -0
  118. package/src/scripts/code_graph/providers/vue-router.ts +21 -0
  119. package/src/scripts/code_graph/providers/wordpress.ts +128 -0
  120. package/src/scripts/code_graph/refresh_cli.ts +81 -0
  121. package/src/scripts/code_graph/refresh_lock.ts +193 -0
  122. package/src/scripts/code_graph/resolution_tiers.ts +19 -7
  123. package/src/scripts/code_graph/scip_reader.ts +2 -2
  124. package/src/scripts/code_graph/sqlite_store.ts +10 -4
  125. package/src/scripts/code_graph/types.ts +75 -41
  126. package/src/scripts/code_graph/validate.ts +6 -8
  127. package/src/scripts/condense.ts +9 -9
  128. package/src/scripts/generate_settings_reference.ts +2 -6
  129. package/src/scripts/hook_chunks.mjs +4 -0
  130. package/src/scripts/hook_manifest.json +1 -1
  131. package/src/scripts/hook_manifest.yaml +24 -7
  132. package/src/scripts/hooks/code_graph_refresh_hook.ts +160 -0
  133. package/src/scripts/hooks/lazy_concern.ts +4 -0
  134. package/src/scripts/install-hooks.sh +54 -33
  135. package/src/scripts/install.ts +2 -6
  136. package/src/scripts/lint_hook_manifest.ts +2 -0
  137. package/src/scripts/lint_marketplace.ts +33 -0
  138. package/src/scripts/lint_mcp_registry_manifest.ts +36 -0
  139. package/src/scripts/mcp_server/consumer_tool_catalog.json +1 -0
  140. package/src/scripts/mcp_server/graph_tools.ts +5 -1
  141. package/src/scripts/release.ts +2 -5
  142. package/src/scripts/release_drill.ts +4 -1
  143. package/src/scripts/release_env.ts +17 -0
  144. package/src/scripts/release_mix_taxonomy.json +3 -0
  145. package/src/server/schemas/settings.ts +42 -42
  146. package/src/shared/settingsSurface.ts +1 -1
  147. package/src/shared/userMd/schema.ts +1 -1
  148. package/src/shared/zodJsonSchema.ts +41 -0
  149. package/src/vendor/grammars/README.md +6 -5
  150. package/src/vendor/grammars/tree-sitter-c_sharp.wasm +0 -0
  151. package/dist/cli-delegate/chunk-XIAPY44N.js +0 -4587
  152. package/dist/ui/assets/index-w70Ado09.js +0 -23
@@ -0,0 +1,414 @@
1
+ #!/usr/bin/env tsx
2
+ const __acChunkMetaUrl = require('node:url').pathToFileURL(__filename).href; const __acChunkMeta = { url: __acChunkMetaUrl, dirname: __dirname, filename: __filename };
3
+ "use strict";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/scripts/hooks/code_graph_refresh_hook.ts
33
+ var code_graph_refresh_hook_exports = {};
34
+ __export(code_graph_refresh_hook_exports, {
35
+ CACHE_REL: () => CACHE_REL,
36
+ REFRESH_ARGS: () => REFRESH_ARGS,
37
+ main: () => main,
38
+ refreshFor: () => refreshFor,
39
+ repoRoot: () => repoRoot,
40
+ resolveCli: () => resolveCli
41
+ });
42
+ module.exports = __toCommonJS(code_graph_refresh_hook_exports);
43
+ var import_node_child_process = require("node:child_process");
44
+ var fs4 = __toESM(require("node:fs"), 1);
45
+ var path3 = __toESM(require("node:path"), 1);
46
+ var import_node_url = require("node:url");
47
+
48
+ // src/scripts/_lib/spawn_env.ts
49
+ var DENY_EXACT = /* @__PURE__ */ new Set([
50
+ // dynamic loader
51
+ "LD_PRELOAD",
52
+ "LD_LIBRARY_PATH",
53
+ "LD_AUDIT",
54
+ "DYLD_INSERT_LIBRARIES",
55
+ "DYLD_LIBRARY_PATH",
56
+ "DYLD_FRAMEWORK_PATH",
57
+ "GCONV_PATH",
58
+ // git command-injection
59
+ "GIT_EXTERNAL_DIFF",
60
+ "GIT_SSH",
61
+ "GIT_SSH_COMMAND",
62
+ "GIT_PROXY_COMMAND",
63
+ "GIT_PAGER",
64
+ "PAGER",
65
+ // git config-injection: GIT_ALTERNATE_OBJECT_DIRECTORIES can point git at
66
+ // attacker-controlled object stores; the GIT_CONFIG* family is handled by
67
+ // prefix below (it is a general arbitrary-config-injection primitive).
68
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES",
69
+ // git path-redirection: GIT_DIR / GIT_INDEX_FILE / GIT_NAMESPACE point a
70
+ // child's git at an attacker-controlled repo, index file, or ref namespace
71
+ // — ordinary git ops then read and write attacker state (low severity,
72
+ // same family as GIT_ALTERNATE_OBJECT_DIRECTORIES above).
73
+ "GIT_DIR",
74
+ "GIT_INDEX_FILE",
75
+ "GIT_NAMESPACE",
76
+ // resolver hijack: HOSTALIASES remaps hostnames via an attacker file,
77
+ // redirecting any network fetch the child performs (CWE-427-adjacent).
78
+ "HOSTALIASES",
79
+ // runtime auto-exec hooks
80
+ "NODE_OPTIONS",
81
+ "BASH_ENV",
82
+ "ENV",
83
+ "PYTHONPATH",
84
+ "PYTHONSTARTUP",
85
+ "PYTHONINSPECT",
86
+ "PERL5OPT",
87
+ "PERL5LIB",
88
+ "RUBYOPT",
89
+ // shell field-splitting
90
+ "IFS"
91
+ ]);
92
+ function isDeniedByFamily(name) {
93
+ if (name.startsWith("LD_") || name.startsWith("DYLD_")) return true;
94
+ if (name.startsWith("GIT_") && name.endsWith("_COMMAND")) return true;
95
+ if (name === "GIT_CONFIG" || name.startsWith("GIT_CONFIG_")) return true;
96
+ return false;
97
+ }
98
+ function hardenedSpawnEnv(overrides = {}) {
99
+ const out = {};
100
+ for (const [key, value] of Object.entries(process.env)) {
101
+ if (value === void 0) continue;
102
+ if (DENY_EXACT.has(key)) continue;
103
+ if (isDeniedByFamily(key)) continue;
104
+ out[key] = value;
105
+ }
106
+ for (const [key, value] of Object.entries(overrides)) {
107
+ out[key] = value;
108
+ }
109
+ return out;
110
+ }
111
+
112
+ // src/scripts/code_graph/refresh_cli.ts
113
+ var fs = __toESM(require("node:fs"), 1);
114
+ var path = __toESM(require("node:path"), 1);
115
+ var CAPABILITY_FILE = "src/scripts/code_graph/refresh_lock.ts";
116
+ function resolveCli(root, envPath = process.env["PATH"] ?? "") {
117
+ let realRoot;
118
+ try {
119
+ realRoot = fs.realpathSync(root);
120
+ } catch {
121
+ return null;
122
+ }
123
+ const inside = (p) => {
124
+ const rel = path.relative(realRoot, p);
125
+ return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
126
+ };
127
+ for (const dir of envPath.split(path.delimiter)) {
128
+ if (!path.isAbsolute(dir)) continue;
129
+ const candidate = path.join(dir, "agent-config");
130
+ try {
131
+ fs.accessSync(candidate, fs.constants.X_OK);
132
+ const real = fs.realpathSync(candidate);
133
+ if (fs.statSync(real).isFile() && !inside(real) && !inside(path.resolve(dir))) return candidate;
134
+ } catch {
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ function cliPackage(cli) {
140
+ try {
141
+ for (let dir = path.dirname(fs.realpathSync(cli)); dir !== path.dirname(dir); dir = path.dirname(dir)) {
142
+ const file = path.join(dir, "package.json");
143
+ if (!fs.existsSync(file)) continue;
144
+ const pkg = JSON.parse(fs.readFileSync(file, "utf-8"));
145
+ if (pkg.name === "@event4u/agent-config") return { root: dir, version: pkg.version ?? "?" };
146
+ }
147
+ } catch {
148
+ }
149
+ return null;
150
+ }
151
+ function cliIsCapable(cli) {
152
+ const pkg = cliPackage(cli);
153
+ return pkg !== null && fs.existsSync(path.join(pkg.root, CAPABILITY_FILE));
154
+ }
155
+ function usableCli(root, envPath) {
156
+ const cli = resolveCli(root, envPath);
157
+ if (cli === null) return { reason: "no-cli" };
158
+ return cliIsCapable(cli) ? { cli } : { reason: "cli-too-old", cli };
159
+ }
160
+
161
+ // src/scripts/code_graph/refresh_lock.ts
162
+ var fs2 = __toESM(require("node:fs"), 1);
163
+ var os = __toESM(require("node:os"), 1);
164
+ var path2 = __toESM(require("node:path"), 1);
165
+ var LOCK_REL = path2.join("agents", "runtime", "state", "code-graph-refresh.lock");
166
+ var AUTO_REFRESH_REL = path2.join("agents", "runtime", "state", "code-graph-auto-refresh.json");
167
+ var STALE_LOCK_MS = 5 * 60 * 1e3;
168
+ var MAX_LOCK_AGE_MS = 30 * 60 * 1e3;
169
+ var ownerPath = (lock) => `${lock}.owner.json`;
170
+ var refreshRecordPath = (root, by) => path2.join(root, path2.dirname(LOCK_REL), `code-graph-refresh.${by}.json`);
171
+ function recordRefresh(root, rec) {
172
+ try {
173
+ fs2.writeFileSync(refreshRecordPath(root, rec.by), JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...rec }));
174
+ } catch {
175
+ }
176
+ }
177
+ function pidAlive(pid) {
178
+ try {
179
+ process.kill(pid, 0);
180
+ return true;
181
+ } catch (e) {
182
+ return e.code === "EPERM";
183
+ }
184
+ }
185
+ var errno = (e) => e.code;
186
+ function readOwner(lock) {
187
+ let raw;
188
+ try {
189
+ raw = fs2.readFileSync(ownerPath(lock), "utf-8");
190
+ } catch (e) {
191
+ return errno(e) === "ENOENT" ? "none" : "unreadable";
192
+ }
193
+ try {
194
+ const o = JSON.parse(raw);
195
+ if (typeof o.pid === "number" && typeof o.started_at === "number" && typeof o.nonce === "string") return o;
196
+ } catch {
197
+ }
198
+ return "none";
199
+ }
200
+ function isStale(lock, now = Date.now()) {
201
+ const owner = readOwner(lock);
202
+ if (owner === "unreadable") return false;
203
+ if (owner !== "none") {
204
+ if (owner.host !== os.hostname()) return now - owner.started_at > MAX_LOCK_AGE_MS;
205
+ return !pidAlive(owner.pid);
206
+ }
207
+ try {
208
+ return now - fs2.statSync(lock).mtimeMs > STALE_LOCK_MS;
209
+ } catch (e) {
210
+ return errno(e) === "ENOENT";
211
+ }
212
+ }
213
+
214
+ // src/scripts/hooks/exit_codes.ts
215
+ var EXIT_ALLOW = 0;
216
+ var EXIT_BLOCK = 1;
217
+ var EXIT_WARN = 2;
218
+ var EXIT_ERROR = 3;
219
+ var EXIT_CODES = Object.freeze([
220
+ Object.freeze({
221
+ code: EXIT_ALLOW,
222
+ name: "allow",
223
+ meaning: "no objection; the dispatcher passes the call through",
224
+ owner: "every concern \u2014 the default verdict",
225
+ authorizedBy: "nothing; allowing needs no authority"
226
+ }),
227
+ Object.freeze({
228
+ code: EXIT_BLOCK,
229
+ name: "block",
230
+ meaning: "refuse the call; the dispatcher lowers this onto the host deny channel",
231
+ owner: "a concern declared `severity: blocking` in hook_manifest.yaml",
232
+ authorizedBy: "the manifest entry plus its row in the BLOCKING_ALLOWLIST of tests/hooks/concern_severity.test.ts \u2014 an advisory concern emitting this is downgraded to warn by dispatch_hook._is_advisory"
233
+ }),
234
+ Object.freeze({
235
+ code: EXIT_WARN,
236
+ name: "warn",
237
+ meaning: "advisory; the dispatcher exits 0 and surfaces the reason",
238
+ owner: "any concern",
239
+ authorizedBy: "nothing; warning is the ceiling for an advisory concern and is always available to a blocking one"
240
+ }),
241
+ Object.freeze({
242
+ code: EXIT_ERROR,
243
+ name: "error",
244
+ meaning: "the concern crashed, timed out, or could not decide \u2014 any rc >= 3. The dispatcher resolves it by the concern`s declared severity, never by the number itself",
245
+ owner: "no concern emits this on purpose; the runtime does",
246
+ authorizedBy: "hook_manifest.yaml `severity` alone \u2014 blocking refuses, anything else fails open; `fail_closed` is no longer read on this branch. See docs/contracts/hook-architecture-v1.md \xA7 Exit-code semantics"
247
+ })
248
+ ]);
249
+
250
+ // src/scripts/hooks/hook_stdin.ts
251
+ var tty = __toESM(require("node:tty"), 1);
252
+
253
+ // src/scripts/_lib/stdin.ts
254
+ var fs3 = __toESM(require("node:fs"), 1);
255
+ var CHUNK = 64 * 1024;
256
+ var RETRY_SLEEP_MS = 5;
257
+ var MAX_RETRIES = 2e3;
258
+ function _sleepSync(ms) {
259
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
260
+ }
261
+ function readStdinText(fd = 0, opts = {}) {
262
+ const chunks = [];
263
+ const buf = Buffer.alloc(CHUNK);
264
+ let retries = 0;
265
+ let got_any = false;
266
+ const first_byte_deadline = opts.firstByteTimeoutMs === void 0 ? null : Date.now() + opts.firstByteTimeoutMs;
267
+ for (; ; ) {
268
+ let read;
269
+ try {
270
+ read = fs3.readSync(fd, buf, 0, CHUNK, null);
271
+ retries = 0;
272
+ } catch (exc) {
273
+ const code = exc.code;
274
+ if (code === "EAGAIN") {
275
+ if (!got_any && first_byte_deadline !== null && Date.now() >= first_byte_deadline) {
276
+ return "";
277
+ }
278
+ retries += 1;
279
+ if (retries > MAX_RETRIES) {
280
+ throw new Error(
281
+ `readStdinText: stdin stayed unreadable across ${String(MAX_RETRIES)} retries (~${String(MAX_RETRIES * RETRY_SLEEP_MS / 1e3)}s). Refusing to report an empty read as empty input.`
282
+ );
283
+ }
284
+ _sleepSync(RETRY_SLEEP_MS);
285
+ continue;
286
+ }
287
+ if (code === "EOF") break;
288
+ throw exc;
289
+ }
290
+ if (read === 0) break;
291
+ got_any = true;
292
+ chunks.push(Buffer.from(buf.subarray(0, read)));
293
+ }
294
+ return Buffer.concat(chunks).toString("utf-8");
295
+ }
296
+
297
+ // src/scripts/hooks/hook_stdin.ts
298
+ var OVERRIDE_KEY = /* @__PURE__ */ Symbol.for("agent-config.hookStdinOverride");
299
+ function host() {
300
+ return globalThis;
301
+ }
302
+ var HOOK_FIRST_BYTE_TIMEOUT_MS = 25;
303
+ function readFd0ToEnd() {
304
+ void process.stdin;
305
+ return readStdinText(0, { firstByteTimeoutMs: HOOK_FIRST_BYTE_TIMEOUT_MS });
306
+ }
307
+ function readHookStdin() {
308
+ const override = host()[OVERRIDE_KEY];
309
+ if (override !== null && override !== void 0) return override;
310
+ try {
311
+ if (tty.isatty(0)) return "";
312
+ return readFd0ToEnd();
313
+ } catch {
314
+ return "";
315
+ }
316
+ }
317
+
318
+ // src/scripts/hooks/state_io.ts
319
+ var REPLAY_ENV_VAR = "AGENT_CONFIG_REPLAY";
320
+ function is_replay_mode() {
321
+ return (process.env[REPLAY_ENV_VAR] ?? "").trim() === "1";
322
+ }
323
+
324
+ // src/scripts/hooks/code_graph_refresh_hook.ts
325
+ var CACHE_REL = path3.join("agents", "runtime", "state", "code-graph-v1.json");
326
+ var REFRESH_ARGS = ["code-graph", "refresh", "--single-flight", "--map", "--budget-seconds", "60"];
327
+ function repoRoot(start) {
328
+ let dir;
329
+ try {
330
+ dir = fs4.realpathSync(start);
331
+ } catch {
332
+ return null;
333
+ }
334
+ for (; ; ) {
335
+ try {
336
+ fs4.lstatSync(path3.join(dir, ".git"));
337
+ return dir;
338
+ } catch (e) {
339
+ if (e.code !== "ENOENT") return null;
340
+ }
341
+ const up = path3.dirname(dir);
342
+ if (up === dir) return null;
343
+ dir = up;
344
+ }
345
+ }
346
+ function anyTracked(root, rels) {
347
+ try {
348
+ const out = (0, import_node_child_process.execFileSync)("git", ["-C", root, "ls-files", "--", ...rels], {
349
+ encoding: "utf-8",
350
+ stdio: ["ignore", "pipe", "ignore"],
351
+ env: hardenedSpawnEnv()
352
+ });
353
+ return out.trim() !== "";
354
+ } catch {
355
+ return true;
356
+ }
357
+ }
358
+ function refreshFor(cwd, spawnFn = import_node_child_process.spawn) {
359
+ if (process.env["AGENT_CONFIG_CODE_GRAPH_REFRESH"] === "off") return "disabled";
360
+ if (process.platform === "win32") return "unsupported";
361
+ if (is_replay_mode()) return "replay";
362
+ const root = repoRoot(cwd);
363
+ if (root === null || !fs4.existsSync(path3.join(root, AUTO_REFRESH_REL))) return "not-opted-in";
364
+ if (anyTracked(root, [AUTO_REFRESH_REL, CACHE_REL])) return "tracked";
365
+ const done = (outcome, detail) => {
366
+ recordRefresh(root, { by: "session-start", outcome, detail });
367
+ return outcome;
368
+ };
369
+ if (!fs4.existsSync(path3.join(root, CACHE_REL))) return done("no-cache");
370
+ const lock = path3.join(root, LOCK_REL);
371
+ if (fs4.existsSync(lock) && !isStale(lock)) return done("locked");
372
+ const verdict = usableCli(root);
373
+ if ("reason" in verdict) return done(verdict.reason, verdict.cli);
374
+ const child = spawnFn(verdict.cli, [...REFRESH_ARGS, "--root", root], {
375
+ cwd: root,
376
+ detached: true,
377
+ stdio: "ignore",
378
+ env: hardenedSpawnEnv()
379
+ });
380
+ child.on("error", () => {
381
+ });
382
+ child.unref();
383
+ return done("spawned", verdict.cli);
384
+ }
385
+ function main() {
386
+ try {
387
+ const raw = readHookStdin();
388
+ const envelope = raw.trim() ? JSON.parse(raw) : {};
389
+ const cwd = typeof envelope["cwd"] === "string" && envelope["cwd"] ? envelope["cwd"] : process.cwd();
390
+ refreshFor(cwd);
391
+ } catch {
392
+ }
393
+ return EXIT_ALLOW;
394
+ }
395
+ function isCliEntry() {
396
+ if (true) return false;
397
+ if (process.argv[1] === void 0) return false;
398
+ if (__acChunkMetaUrl === (0, import_node_url.pathToFileURL)(path3.resolve(process.argv[1])).href) return true;
399
+ try {
400
+ return fs4.realpathSync((0, import_node_url.fileURLToPath)(__acChunkMetaUrl)) === fs4.realpathSync(path3.resolve(process.argv[1]));
401
+ } catch {
402
+ return false;
403
+ }
404
+ }
405
+ if (isCliEntry()) process.exit(main());
406
+ // Annotate the CommonJS export names for ESM import in node:
407
+ 0 && (module.exports = {
408
+ CACHE_REL,
409
+ REFRESH_ARGS,
410
+ main,
411
+ refreshFor,
412
+ repoRoot,
413
+ resolveCli
414
+ });
@@ -0,0 +1 @@
1
+ 0374823b04e1d61f886025ef497df1565ae0973573a0b0a7032a73a4b501c2e5 code_graph_refresh.chunk.cjs
@@ -31088,11 +31088,14 @@ import * as fs82 from "node:fs";
31088
31088
  import * as path86 from "node:path";
31089
31089
 
31090
31090
  // src/scripts/code_graph/types.ts
31091
- var GUESS_RESOLVED_VIA = /* @__PURE__ */ new Set(["name-lookup", "dynamic", "foreign"]);
31091
+ var STATED_WORDS = "same-file import-specifier path-alias psr4 route-table directive-scan schema-call orm-relation di-binding compiler-index test-import literal-path literal-dotted fs-route";
31092
+ var GUESS_WORDS = "name-lookup dynamic foreign";
31093
+ var STATED_RESOLVED_VIA = new Set(STATED_WORDS.split(" "));
31094
+ var GUESS_RESOLVED_VIA = new Set(GUESS_WORDS.split(" "));
31092
31095
  function isStatedResolution(resolved_via) {
31093
- return !GUESS_RESOLVED_VIA.has(resolved_via);
31096
+ return STATED_RESOLVED_VIA.has(resolved_via);
31094
31097
  }
31095
- var SCHEMA_VERSION2 = 5;
31098
+ var SCHEMA_VERSION2 = 6;
31096
31099
  var EXT_LANG = {
31097
31100
  ".php": "php",
31098
31101
  ".ts": "typescript",
@@ -31106,18 +31109,17 @@ var EXT_LANG = {
31106
31109
  ".py": "python",
31107
31110
  ".go": "go",
31108
31111
  ".java": "java",
31112
+ ".cs": "csharp",
31109
31113
  ".vue": "typescript"
31110
31114
  };
31111
31115
 
31112
31116
  // src/scripts/code_graph/validate.ts
31113
31117
  var words2 = (s) => new Set(s.split(" "));
31114
31118
  var RELATIONS = words2(
31115
- "calls imports uses inherits member tests routes-to renders includes reads migrates persists relates documents"
31119
+ "calls imports uses inherits member tests routes-to renders includes reads migrates persists relates injects documents"
31116
31120
  );
31117
31121
  var CONFIDENCES = /* @__PURE__ */ new Set(["EXTRACTED", "INFERRED", "AMBIGUOUS"]);
31118
- var RESOLVED_VIA = words2(
31119
- "same-file import-specifier path-alias psr4 route-table directive-scan schema-call eloquent-relation compiler-index test-import name-lookup dynamic foreign"
31120
- );
31122
+ var RESOLVED_VIA = /* @__PURE__ */ new Set([...STATED_RESOLVED_VIA, ...GUESS_RESOLVED_VIA]);
31121
31123
  var PROVIDERS = /* @__PURE__ */ new Set(["native", "foreign", "scip"]);
31122
31124
  var KINDS = words2("file class interface trait function method constant type enum skipped route table");
31123
31125
  function validateGraph(g) {
@@ -31158,6 +31160,8 @@ function validateGraph(g) {
31158
31160
  if (ee["provider"] === void 0) push(`edge[${i}].provider is required`);
31159
31161
  else if (!PROVIDERS.has(ee["provider"]))
31160
31162
  push(`edge[${i}].provider invalid: ${String(ee["provider"])}`);
31163
+ if (ee["provider_id"] !== void 0 && typeof ee["provider_id"] !== "string")
31164
+ push(`edge[${i}].provider_id must be a string`);
31161
31165
  if (typeof ee["source"] === "string" && !ids.has(ee["source"]))
31162
31166
  push(`edge[${i}].source is not a known node: ${String(ee["source"])}`);
31163
31167
  if (ee["candidates"] !== void 0 && !Array.isArray(ee["candidates"]))
@@ -36698,7 +36702,7 @@ function stampUserVersion(conn, version) {
36698
36702
  }
36699
36703
 
36700
36704
  // src/scripts/code_graph/sqlite_store.ts
36701
- var GRAPH_STORE_VERSION = 4;
36705
+ var GRAPH_STORE_VERSION = 5;
36702
36706
  var INDEXED_READ_MIN_EDGES = 5e4;
36703
36707
  function sqliteTwinPath(jsonPath) {
36704
36708
  return jsonPath.endsWith(".json") ? `${jsonPath.slice(0, -5)}.sqlite3` : `${jsonPath}.sqlite3`;
@@ -36720,7 +36724,7 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
36720
36724
  try {
36721
36725
  db.exec("PRAGMA journal_mode = MEMORY");
36722
36726
  db.exec(
36723
- "CREATE TABLE meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);CREATE TABLE nodes (id TEXT PRIMARY KEY, label TEXT NOT NULL, kind TEXT, source_file TEXT, l0 INTEGER, l1 INTEGER, l2 INTEGER, l3 INTEGER);CREATE TABLE edges (source TEXT NOT NULL, target TEXT NOT NULL, relation TEXT NOT NULL, confidence TEXT NOT NULL, candidates TEXT, ambiguity_reason TEXT, resolved_via TEXT, provider TEXT);CREATE INDEX edges_source ON edges(source);CREATE INDEX edges_target ON edges(target);CREATE INDEX nodes_label ON nodes(label);CREATE INDEX nodes_source_file ON nodes(source_file);"
36727
+ "CREATE TABLE meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);CREATE TABLE nodes (id TEXT PRIMARY KEY, label TEXT NOT NULL, kind TEXT, source_file TEXT, l0 INTEGER, l1 INTEGER, l2 INTEGER, l3 INTEGER);CREATE TABLE edges (source TEXT NOT NULL, target TEXT NOT NULL, relation TEXT NOT NULL, confidence TEXT NOT NULL, candidates TEXT, ambiguity_reason TEXT, resolved_via TEXT, provider TEXT, provider_id TEXT);CREATE INDEX edges_source ON edges(source);CREATE INDEX edges_target ON edges(target);CREATE INDEX nodes_label ON nodes(label);CREATE INDEX nodes_source_file ON nodes(source_file);"
36724
36728
  );
36725
36729
  db.exec("BEGIN");
36726
36730
  const meta = db.prepare("INSERT INTO meta (key, value) VALUES (?, ?)");
@@ -36747,7 +36751,7 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
36747
36751
  );
36748
36752
  }
36749
36753
  const insEdge = db.prepare(
36750
- "INSERT INTO edges (source, target, relation, confidence, candidates, ambiguity_reason, resolved_via, provider) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
36754
+ "INSERT INTO edges (source, target, relation, confidence, candidates, ambiguity_reason, resolved_via, provider, provider_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
36751
36755
  );
36752
36756
  for (const e of graph.edges) {
36753
36757
  insEdge.run(
@@ -36758,7 +36762,8 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
36758
36762
  e.candidates ? JSON.stringify(e.candidates) : null,
36759
36763
  e.ambiguity_reason ?? null,
36760
36764
  e.resolved_via,
36761
- e.provider
36765
+ e.provider,
36766
+ e.provider_id ?? null
36762
36767
  );
36763
36768
  }
36764
36769
  db.exec("COMMIT");
@@ -36833,6 +36838,7 @@ function toEdge(r) {
36833
36838
  if (r.ambiguity_reason === "receiver-unknown" || r.ambiguity_reason === "hierarchy-unresolved") {
36834
36839
  e.ambiguity_reason = r.ambiguity_reason;
36835
36840
  }
36841
+ if (r.provider_id) e.provider_id = r.provider_id;
36836
36842
  return e;
36837
36843
  }
36838
36844
  function openGraphIndex(jsonPath) {
@@ -42174,6 +42180,10 @@ var LAZY_CONCERNS = Object.freeze({
42174
42180
  "src/scripts/hooks/instructions_observer_hook.ts": Object.freeze({
42175
42181
  chunk: "instructions_observer.chunk.cjs",
42176
42182
  source: "instructions_observer_hook"
42183
+ }),
42184
+ "src/scripts/hooks/code_graph_refresh_hook.ts": Object.freeze({
42185
+ chunk: "code_graph_refresh.chunk.cjs",
42186
+ source: "code_graph_refresh_hook"
42177
42187
  })
42178
42188
  });
42179
42189
  function isBundled3() {
@@ -1 +1 @@
1
- 1089777b2ae58baebcf459eeaccfe7a043a8aa24de365e85cea9827d5a64be27 dispatch.js
1
+ 012f6aa8850ba81e82bfade67da563b7ec7367b059a683c01d2a24eab8c46fc1 dispatch.js
@@ -80,7 +80,7 @@ function assignmentSource(shape) {
80
80
  const alt = shape.keywords.map((k) => ASSIGNMENT_KEYWORDS[k]).join("|");
81
81
  const group = shape.capture === true ? `(${alt})` : `(?:${alt})`;
82
82
  const gap = shape.gap ?? "\\s*";
83
- const head = `${shape.before ?? ""}${group}${shape.after ?? ""}${gap}[:=]`;
83
+ const head = `${shape.before ?? ""}${group}${shape.after ?? ""}${gap}(?::|=(?!==|=\\s|>)=?)`;
84
84
  return shape.value === void 0 ? head : `${head}${gap}${shape.value}`;
85
85
  }
86
86
  function assignmentPattern(shape, flags) {
@@ -1 +1 @@
1
- 0c82cec5dc2b455a8a7cac5d119d84b800cfd1df56c6e50fa3fb692c69a70312 egress_engine.chunk.cjs
1
+ dd75e3e3ba1c9f810b4dc9c3023a4c1438e1482aaf7047c69d4b3c1018e803cc egress_engine.chunk.cjs