@ev-ai/agent-hook 1.4.1 → 1.4.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.
@@ -864,10 +864,36 @@ var require_skill_source_redaction = __commonJS({
864
864
  var URL_CREDENTIAL_PARAM_RE = /([?&](?:access_token|api_key|apikey|auth|authorization|client_secret|key|password|secret|token)=)[^&\s"'<>]+/gi;
865
865
  var PRIVATE_KEY_BEGIN_RE = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/;
866
866
  var PRIVATE_KEY_END_RE = /-----END [A-Z0-9 ]*PRIVATE KEY-----/;
867
+ var ANY_CASE_REFERENCE_OR_PLACEHOLDER_RE = new RegExp(`^(?:${[
868
+ // Empty password, as in `https://user:@host`.
869
+ "",
870
+ // Shell `${VAR}` and PowerShell `$env:VAR`. No `${VAR:-default}`: the default is a literal.
871
+ String.raw`\$\{[A-Za-z_][A-Za-z0-9_]*\}`,
872
+ String.raw`\$env:[A-Za-z_][A-Za-z0-9_]*`,
873
+ // Template placeholders: `{{ token }}`, `{token}` or an f-string expression such as
874
+ // `{quote_plus(pwd)}`, `<password>`, `[password]` (and the redaction marker itself, so a
875
+ // second pass is a no-op). Angle and square brackets hold letters only.
876
+ String.raw`\{\{\s*[\w.-]+\s*\}\}`,
877
+ String.raw`\{[A-Za-z_][^{}\s]*\}`,
878
+ String.raw`<[A-Za-z][A-Za-z_-]*>`,
879
+ String.raw`\[[A-Za-z][A-Za-z_-]*\]`,
880
+ // Documentation stand-ins.
881
+ String.raw`(?:pass(?:word|wd)?|pwd|secret|token|x+|\*+)`
882
+ ].join("|")})$`, "i");
883
+ var UPPER_CASE_REFERENCE_OR_PLACEHOLDER_RE = new RegExp(`^(?:${[
884
+ // Shell `$VAR` and cmd `%VAR%`, written as environment variable names.
885
+ String.raw`\$[A-Z_][A-Z0-9_]*`,
886
+ String.raw`%[A-Z_][A-Z0-9_]*%`,
887
+ // Upper-case placeholder names that say what they stand for: `YOUR_API_KEY`, `ACCESS_TOKEN`.
888
+ String.raw`(?=[A-Z_]*(?:TOKEN|KEY|SECRET|PASSWORD|PASSWD|PASS|PWD|CREDENTIALS?|YOUR))[A-Z]+(?:_[A-Z]+)+`
889
+ ].join("|")})$`);
890
+ function isReferenceOrPlaceholder(value) {
891
+ return ANY_CASE_REFERENCE_OR_PLACEHOLDER_RE.test(value) || UPPER_CASE_REFERENCE_OR_PLACEHOLDER_RE.test(value);
892
+ }
867
893
  function redactLine(line) {
868
- let redacted = line.replace(URL_USERINFO_RE, (_match, scheme) => `${scheme}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}:${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}@`);
869
- redacted = redacted.replace(URL_CREDENTIAL_PARAM_RE, (_match, prefix) => `${prefix}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}`);
870
- redacted = redacted.replace(BEARER_RE, (_match, prefix) => `${prefix}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}`);
894
+ let redacted = line.replace(URL_USERINFO_RE, (match, scheme, _user, password) => isReferenceOrPlaceholder(password) ? match : `${scheme}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}:${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}@`);
895
+ redacted = redacted.replace(URL_CREDENTIAL_PARAM_RE, (match, prefix) => isReferenceOrPlaceholder(match.slice(prefix.length)) ? match : `${prefix}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}`);
896
+ redacted = redacted.replace(BEARER_RE, (match, prefix) => isReferenceOrPlaceholder(match.slice(prefix.length)) ? match : `${prefix}${exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER}`);
871
897
  for (const pattern of TOKEN_LITERAL_RES) {
872
898
  redacted = redacted.replace(pattern, exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER);
873
899
  }
@@ -901,13 +927,1006 @@ var require_skill_source_redaction = __commonJS({
901
927
  }
902
928
  });
903
929
 
930
+ // ../composition-identity/dist/json.js
931
+ var require_json = __commonJS({
932
+ "../composition-identity/dist/json.js"(exports2) {
933
+ "use strict";
934
+ Object.defineProperty(exports2, "__esModule", { value: true });
935
+ exports2.isRecord = isRecord2;
936
+ function isRecord2(value) {
937
+ return value !== null && typeof value === "object" && !Array.isArray(value);
938
+ }
939
+ }
940
+ });
941
+
942
+ // ../composition-identity/dist/command-tokens.js
943
+ var require_command_tokens = __commonJS({
944
+ "../composition-identity/dist/command-tokens.js"(exports2) {
945
+ "use strict";
946
+ Object.defineProperty(exports2, "__esModule", { value: true });
947
+ exports2.tokenizeCommand = tokenizeCommand3;
948
+ function tokenizeCommand3(command) {
949
+ const tokens = [];
950
+ let current = "";
951
+ let quote = null;
952
+ for (const char of command) {
953
+ if (quote) {
954
+ if (char === quote) {
955
+ quote = null;
956
+ } else {
957
+ current += char;
958
+ }
959
+ continue;
960
+ }
961
+ if (char === '"' || char === "'") {
962
+ quote = char;
963
+ continue;
964
+ }
965
+ if (/\s/.test(char)) {
966
+ if (current.length > 0) {
967
+ tokens.push(current);
968
+ current = "";
969
+ }
970
+ continue;
971
+ }
972
+ current += char;
973
+ }
974
+ if (current.length > 0) {
975
+ tokens.push(current);
976
+ }
977
+ return tokens;
978
+ }
979
+ }
980
+ });
981
+
982
+ // ../composition-identity/dist/home-path.js
983
+ var require_home_path = __commonJS({
984
+ "../composition-identity/dist/home-path.js"(exports2) {
985
+ "use strict";
986
+ Object.defineProperty(exports2, "__esModule", { value: true });
987
+ exports2.tildePath = tildePath2;
988
+ exports2.tildeHomeInText = tildeHomeInText2;
989
+ function posixPath(value) {
990
+ return value.replace(/\\/g, "/");
991
+ }
992
+ function homePosix(home) {
993
+ const n = posixPath(home).replace(/\/+$/, "");
994
+ return n.length <= 1 ? "" : n;
995
+ }
996
+ function isWindowsHome(home) {
997
+ return /^[A-Za-z]:/.test(home) || home.includes("\\");
998
+ }
999
+ function tildePath2(value, home) {
1000
+ const n = posixPath(value);
1001
+ if (n === "~" || n.startsWith("~/")) {
1002
+ return n;
1003
+ }
1004
+ const h = homePosix(home);
1005
+ if (!h) {
1006
+ return n;
1007
+ }
1008
+ const head = n.slice(0, h.length);
1009
+ const matches = isWindowsHome(home) ? head.toLowerCase() === h.toLowerCase() : head === h;
1010
+ if (!matches) {
1011
+ return n;
1012
+ }
1013
+ const rest = n.slice(h.length);
1014
+ if (rest === "") {
1015
+ return "~";
1016
+ }
1017
+ return rest.startsWith("/") ? `~${rest}` : n;
1018
+ }
1019
+ var homeTextPatterns = /* @__PURE__ */ new Map();
1020
+ function homeTextPattern(home) {
1021
+ const cached = homeTextPatterns.get(home);
1022
+ if (cached !== void 0) {
1023
+ return cached;
1024
+ }
1025
+ const h = homePosix(home);
1026
+ let pattern = null;
1027
+ if (h) {
1028
+ const body = h.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("[\\\\/]+");
1029
+ pattern = new RegExp(`(?<![\\w.-])${body}(?![\\w.-])`, isWindowsHome(home) ? "gi" : "g");
1030
+ }
1031
+ homeTextPatterns.set(home, pattern);
1032
+ return pattern;
1033
+ }
1034
+ function tildeHomeInText2(value, home) {
1035
+ const pattern = homeTextPattern(home);
1036
+ return pattern ? value.replace(pattern, "~") : value;
1037
+ }
1038
+ }
1039
+ });
1040
+
1041
+ // ../composition-identity/dist/mcp-redaction.js
1042
+ var require_mcp_redaction = __commonJS({
1043
+ "../composition-identity/dist/mcp-redaction.js"(exports2) {
1044
+ "use strict";
1045
+ Object.defineProperty(exports2, "__esModule", { value: true });
1046
+ exports2.ENABLED_RAW_KEYS = exports2.TOOL_LIST_RAW_KEYS = exports2.OMITTED_VALUE = void 0;
1047
+ exports2.isSecretShapedValue = isSecretShapedValue;
1048
+ exports2.isAuthHeaderName = isAuthHeaderName;
1049
+ exports2.redactCommandOrUrl = redactCommandOrUrl3;
1050
+ exports2.isAuthKeyName = isAuthKeyName;
1051
+ exports2.redactArgs = redactArgs4;
1052
+ exports2.mcpServerEnabledFromJson = mcpServerEnabledFromJson2;
1053
+ var json_js_1 = require_json();
1054
+ exports2.OMITTED_VALUE = "<omitted>";
1055
+ exports2.TOOL_LIST_RAW_KEYS = [
1056
+ { raw: "tools", attr: "tools" },
1057
+ { raw: "autoApprove", attr: "auto_approve" },
1058
+ { raw: "auto_approve", attr: "auto_approve" },
1059
+ { raw: "alwaysAllow", attr: "always_allow" },
1060
+ { raw: "always_allow", attr: "always_allow" },
1061
+ { raw: "enabledTools", attr: "enabled_tools" },
1062
+ { raw: "enabled_tools", attr: "enabled_tools" },
1063
+ { raw: "disabledTools", attr: "disabled_tools" },
1064
+ { raw: "disabled_tools", attr: "disabled_tools" }
1065
+ ];
1066
+ exports2.ENABLED_RAW_KEYS = ["enabled", "disabled"];
1067
+ var AUTH_KEY_RE = /^(authorization|auth|api[-_]?key|access[-_]?token|refresh[-_]?token|secret|password|passwd|token|bearer|client[-_]?secret|client[-_]?id|private[-_]?key|signing[-_]?key)$/i;
1068
+ var AUTH_KEY_SEGMENT_RE = /(?:^|[-_])(secret|password|passwd|token|api[-_]?key|private[-_]?key|signing[-_]?key|client[-_]?secret|client[-_]?id)(?:[-_]|$)/i;
1069
+ var SECRET_ARG_RE = /^(sk-|ghp_|gho_|github_pat_|xox[baprs]-|AKIA|ASIA|AIza|ya29\.)/;
1070
+ var BEARER_ARG_RE = /^bearer(?:\s+|$)/i;
1071
+ function isSecretShapedValue(value) {
1072
+ return SECRET_ARG_RE.test(value) || BEARER_ARG_RE.test(value);
1073
+ }
1074
+ var HEADER_FLAG_RE = /^(?:--headers?|-H)$/;
1075
+ var HEADER_LINE_RE = /^\s*([A-Za-z0-9-]+)\s*:([\s\S]*)$/;
1076
+ var AUTH_HEADER_NAME_RE = /auth|cookie|token|secret|key|passw|credential|session|signature/i;
1077
+ var ENV_REF_VALUE_RE = /^(?:(?:bearer|basic|token)\s+)?\$(?:\{\w+\}|\w+)$/i;
1078
+ function isAuthHeaderName(name) {
1079
+ return AUTH_HEADER_NAME_RE.test(name);
1080
+ }
1081
+ function redactCommandOrUrl3(value) {
1082
+ try {
1083
+ const parsed = new URL(value);
1084
+ return `${parsed.origin}${parsed.pathname}`;
1085
+ } catch {
1086
+ return value;
1087
+ }
1088
+ }
1089
+ function redactSecretShapedValue(value) {
1090
+ if (isSecretShapedValue(value)) {
1091
+ return "<redacted>";
1092
+ }
1093
+ if (value.includes("://")) {
1094
+ return redactCommandOrUrl3(value);
1095
+ }
1096
+ return value;
1097
+ }
1098
+ function redactHeaderArg(value) {
1099
+ const match = HEADER_LINE_RE.exec(value);
1100
+ if (!match) {
1101
+ return redactArg(value);
1102
+ }
1103
+ const name = match[1] ?? "";
1104
+ const headerValue = (match[2] ?? "").trim();
1105
+ if (ENV_REF_VALUE_RE.test(headerValue)) {
1106
+ return value;
1107
+ }
1108
+ const secret = isAuthHeaderName(name) || isSecretShapedValue(headerValue);
1109
+ return secret ? `${name}: <redacted>` : value;
1110
+ }
1111
+ function redactArg(value) {
1112
+ if (/^https?:\/\//i.test(value)) {
1113
+ return redactCommandOrUrl3(value);
1114
+ }
1115
+ const eq = value.indexOf("=");
1116
+ if (eq > 0) {
1117
+ const key = value.slice(0, eq);
1118
+ const rest = value.slice(eq + 1);
1119
+ return `${key}=${HEADER_FLAG_RE.test(key) ? redactHeaderArg(rest) : redactArg(rest)}`;
1120
+ }
1121
+ return redactSecretShapedValue(value);
1122
+ }
1123
+ function isAuthKeyName(key) {
1124
+ return AUTH_KEY_RE.test(key) || AUTH_KEY_SEGMENT_RE.test(key);
1125
+ }
1126
+ function authArgKey(value) {
1127
+ const key = value.replace(/^-+/, "").split("=", 1)[0] ?? "";
1128
+ return isAuthKeyName(key);
1129
+ }
1130
+ function redactArgs4(values) {
1131
+ const sanitized = [];
1132
+ let redactNext = false;
1133
+ let headerNext = false;
1134
+ for (const value of values) {
1135
+ if (redactNext) {
1136
+ sanitized.push("<redacted>");
1137
+ redactNext = false;
1138
+ continue;
1139
+ }
1140
+ if (headerNext) {
1141
+ headerNext = false;
1142
+ if (HEADER_LINE_RE.test(value)) {
1143
+ sanitized.push(redactHeaderArg(value));
1144
+ continue;
1145
+ }
1146
+ }
1147
+ if (HEADER_FLAG_RE.test(value)) {
1148
+ sanitized.push(value);
1149
+ headerNext = true;
1150
+ continue;
1151
+ }
1152
+ if (authArgKey(value)) {
1153
+ sanitized.push("<redacted>");
1154
+ redactNext = !value.includes("=");
1155
+ continue;
1156
+ }
1157
+ sanitized.push(redactArg(value));
1158
+ }
1159
+ return sanitized;
1160
+ }
1161
+ function mcpServerEnabledFromJson2(server) {
1162
+ if (!(0, json_js_1.isRecord)(server)) {
1163
+ return true;
1164
+ }
1165
+ if (server.enabled === false) {
1166
+ return false;
1167
+ }
1168
+ return server.disabled !== true;
1169
+ }
1170
+ }
1171
+ });
1172
+
1173
+ // ../composition-identity/dist/mcp-config-file.js
1174
+ var require_mcp_config_file = __commonJS({
1175
+ "../composition-identity/dist/mcp-config-file.js"(exports2) {
1176
+ "use strict";
1177
+ Object.defineProperty(exports2, "__esModule", { value: true });
1178
+ exports2.MCP_CONFIG_SERVER_KEY_TREATMENT = exports2.MCP_CONFIG_VSCODE_INPUT_TABLE = exports2.MCP_CONFIG_SANDBOX_TABLE = exports2.MCP_CONFIG_TRANSPORT_TYPES = exports2.REDACTED_VALUE = void 0;
1179
+ exports2.sanitizeVariableReference = sanitizeVariableReference;
1180
+ exports2.mcpConfigFormatOf = mcpConfigFormatOf2;
1181
+ exports2.mcpConfigServersKey = mcpConfigServersKey2;
1182
+ exports2.sanitizeMcpConfigFile = sanitizeMcpConfigFile2;
1183
+ var node_path_1 = require("node:path");
1184
+ var command_tokens_js_1 = require_command_tokens();
1185
+ var home_path_js_1 = require_home_path();
1186
+ var json_js_1 = require_json();
1187
+ var mcp_redaction_js_1 = require_mcp_redaction();
1188
+ exports2.REDACTED_VALUE = "<redacted>";
1189
+ exports2.MCP_CONFIG_TRANSPORT_TYPES = /* @__PURE__ */ new Set([
1190
+ "stdio",
1191
+ "http",
1192
+ "sse",
1193
+ "ws",
1194
+ "sdk",
1195
+ "streamable-http",
1196
+ "streamableHttp",
1197
+ "local",
1198
+ "remote"
1199
+ ]);
1200
+ var AUTH_TABLE = {
1201
+ CLIENT_ID: "keep",
1202
+ CLIENT_SECRET: "secret",
1203
+ scopes: "string_list",
1204
+ redirectPort: "keep"
1205
+ // source-only
1206
+ };
1207
+ var OAUTH_TABLE = {
1208
+ clientId: "keep",
1209
+ client_id: "keep",
1210
+ clientSecret: "secret",
1211
+ client_secret: "secret",
1212
+ callbackPort: "keep",
1213
+ callback_port: "keep",
1214
+ // source-only
1215
+ callback_url: "url",
1216
+ // source-only
1217
+ redirectUri: "url",
1218
+ // source-only
1219
+ redirect_uri: "url",
1220
+ // source-only
1221
+ authServerMetadataUrl: "url",
1222
+ auth_server_metadata_url: "url",
1223
+ // source-only
1224
+ authorizationUrl: "url",
1225
+ tokenUrl: "url",
1226
+ issuer: "url",
1227
+ // source-only
1228
+ registrationUrl: "url",
1229
+ // source-only
1230
+ clientMetadataUrl: "url",
1231
+ // source-only
1232
+ scopes: { by: { string: "keep", array: "string_list" } },
1233
+ scope: "keep",
1234
+ // source-only
1235
+ oauthScopes: "string_list",
1236
+ // source-only
1237
+ audiences: "string_list",
1238
+ enabled: "keep",
1239
+ allowPrivateNetwork: "keep",
1240
+ // source-only
1241
+ authorizationResponseIssParameterSupported: "keep",
1242
+ // source-only
1243
+ tokenParamName: "keep"
1244
+ };
1245
+ exports2.MCP_CONFIG_SANDBOX_TABLE = {
1246
+ filesystem: {
1247
+ object: {
1248
+ allowWrite: "path",
1249
+ denyRead: "path",
1250
+ denyWrite: "path"
1251
+ }
1252
+ },
1253
+ network: {
1254
+ object: {
1255
+ allowedDomains: "string_list",
1256
+ deniedDomains: "string_list"
1257
+ }
1258
+ }
1259
+ };
1260
+ var DEV_TABLE = {
1261
+ watch: "path",
1262
+ debug: { object: { type: "keep", debugpyPath: "path" } }
1263
+ };
1264
+ var REQUEST_OPTIONS_TABLE = {
1265
+ headers: "secret_map",
1266
+ proxy: "url",
1267
+ caBundlePath: "path",
1268
+ timeout: "keep",
1269
+ verifySsl: "keep",
1270
+ noProxy: "string_list",
1271
+ extraBodyProperties: "omit",
1272
+ clientCertificate: { object: { cert: "omit", key: "omit", passphrase: "secret" } }
1273
+ };
1274
+ var TIMEOUT_TABLE = { startup: "keep", catalog: "keep", execution: "keep" };
1275
+ var CODEX_TOOL_TABLE = { approval_mode: "keep", output_token_limit: "keep" };
1276
+ exports2.MCP_CONFIG_VSCODE_INPUT_TABLE = {
1277
+ id: "keep",
1278
+ type: "keep",
1279
+ password: "keep",
1280
+ command: "keep",
1281
+ serverName: "keep",
1282
+ description: "omit",
1283
+ options: "omit",
1284
+ args: "omit",
1285
+ default: "secret"
1286
+ };
1287
+ var TRANSPORT_TABLE = {
1288
+ type: "transport_type",
1289
+ command: "command",
1290
+ args: "args",
1291
+ cwd: "path",
1292
+ env: "secret_map",
1293
+ url: "url",
1294
+ headers: "secret_map"
1295
+ };
1296
+ var TOOL_LIST_ALIASES = Object.fromEntries(mcp_redaction_js_1.TOOL_LIST_RAW_KEYS.map(({ raw }) => [raw, "tool_list"]));
1297
+ exports2.MCP_CONFIG_SERVER_KEY_TREATMENT = {
1298
+ ...TOOL_LIST_ALIASES,
1299
+ // Identity / transport / enablement
1300
+ type: "transport_type",
1301
+ transportType: "keep",
1302
+ // source-only
1303
+ transport: { by: { string: "keep", object: { object: TRANSPORT_TABLE } } },
1304
+ disabled: "keep",
1305
+ enabled: "keep",
1306
+ required: "keep",
1307
+ remote: "keep",
1308
+ // source-only
1309
+ remoteConfigured: "keep",
1310
+ // source-only
1311
+ source: "keep",
1312
+ // source-only
1313
+ version: "keep",
1314
+ gallery: { by: { boolean: "keep", string: "url" } },
1315
+ description: "omit",
1316
+ name: "keep",
1317
+ serverName: "keep",
1318
+ // source-only
1319
+ faviconUrl: "url",
1320
+ // source-only
1321
+ sourceFile: "path",
1322
+ sourceSlug: "keep",
1323
+ environment_id: "keep",
1324
+ protocol: "keep",
1325
+ pool: "keep",
1326
+ codemode: "keep",
1327
+ trust: "keep",
1328
+ alwaysLoad: "keep",
1329
+ deferTools: "keep",
1330
+ // source-only
1331
+ supports_parallel_tool_calls: "keep",
1332
+ tool_input_schema_max_bytes: "keep",
1333
+ startup_readiness: "keep",
1334
+ extension: "omit",
1335
+ // source-only
1336
+ metadata: "omit",
1337
+ // source-only
1338
+ settings: "omit",
1339
+ // source-only
1340
+ // stdio / process
1341
+ command: {
1342
+ by: {
1343
+ string: "command",
1344
+ array: "args",
1345
+ // Zed legacy `command: { path, args, env }`.
1346
+ object: { object: { path: "command", args: "args", env: "secret_map" } }
1347
+ }
1348
+ },
1349
+ args: "args",
1350
+ env: "secret_map",
1351
+ environment: "secret_map",
1352
+ env_vars: {
1353
+ list: {
1354
+ by: { string: "env_name", object: { object: { name: "env_name", source: "keep" } } }
1355
+ }
1356
+ },
1357
+ envVars: "secret_map",
1358
+ envFile: "path",
1359
+ cwd: "path",
1360
+ watchPaths: "path",
1361
+ dev: { object: DEV_TABLE },
1362
+ sandboxEnabled: "keep",
1363
+ sandbox: { object: exports2.MCP_CONFIG_SANDBOX_TABLE },
1364
+ // Remote / HTTP
1365
+ url: "url",
1366
+ serverUrl: "url",
1367
+ httpUrl: "url",
1368
+ // Google Antigravity: load tools at startup, and per-server request timeout.
1369
+ eager: "keep",
1370
+ timeoutSeconds: "keep",
1371
+ tcp: "url",
1372
+ // source-only
1373
+ headers: "secret_map",
1374
+ http_headers: "secret_map",
1375
+ env_http_headers: "env_name_map",
1376
+ bearer_token_env_var: "env_name",
1377
+ headersHelper: "helper_command",
1378
+ http_headers_helper: "helper_command",
1379
+ apiKey: "secret",
1380
+ // source-only
1381
+ requestOptions: { object: REQUEST_OPTIONS_TABLE },
1382
+ // source-only
1383
+ auth: { by: { string: "mode", object: { object: AUTH_TABLE } } },
1384
+ oauth: { by: { boolean: "keep", object: { object: OAUTH_TABLE } } },
1385
+ oauthClientId: "keep",
1386
+ oauthClientSecret: "secret",
1387
+ oauthResource: "url",
1388
+ oauth_resource: "url",
1389
+ oauthScopes: "string_list",
1390
+ scopes: { by: { string: "keep", array: "string_list" } },
1391
+ oauthPublicClient: "keep",
1392
+ // source-only
1393
+ oauthGrantType: "keep",
1394
+ // source-only
1395
+ authProviderType: "keep",
1396
+ targetAudience: "keep",
1397
+ targetServiceAccount: "keep",
1398
+ // Tool filtering / approval
1399
+ tools: {
1400
+ by: {
1401
+ array: "tool_list",
1402
+ boolean: "tool_list",
1403
+ string: "tool_list",
1404
+ object: { map: { object: CODEX_TOOL_TABLE } }
1405
+ }
1406
+ },
1407
+ includeTools: "tool_list",
1408
+ excludeTools: "tool_list",
1409
+ omit_tools_from: "tool_list",
1410
+ default_tools_approval_mode: "keep",
1411
+ defaultToolsApprovalMode: "keep",
1412
+ // Timeouts
1413
+ timeout: { by: { number: "keep", object: { object: TIMEOUT_TABLE } } },
1414
+ startup_timeout_sec: "keep",
1415
+ startup_timeout_ms: "keep",
1416
+ tool_timeout_sec: "keep",
1417
+ connectionTimeout: "keep"
1418
+ // source-only
1419
+ };
1420
+ function shapeOf(value) {
1421
+ if (value === null) {
1422
+ return "null";
1423
+ }
1424
+ if (Array.isArray(value)) {
1425
+ return "array";
1426
+ }
1427
+ switch (typeof value) {
1428
+ case "string":
1429
+ return "string";
1430
+ case "number":
1431
+ return "number";
1432
+ case "boolean":
1433
+ return "boolean";
1434
+ case "object":
1435
+ return "object";
1436
+ default:
1437
+ return void 0;
1438
+ }
1439
+ }
1440
+ var ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
1441
+ var REFERENCE_PATTERNS = [
1442
+ /\$\{(?:env|input|command):[A-Za-z0-9_.-]+\}/y,
1443
+ /\$\{file:[^}\s]+\}/y,
1444
+ /\$\{\{\s*secrets\.[A-Za-z0-9_]+\s*\}\}/y,
1445
+ /\$\{\/\}/y,
1446
+ /\$\{[A-Za-z_][A-Za-z0-9_.]*\}/y,
1447
+ /\$[A-Z_][A-Z0-9_]*/y,
1448
+ /%[A-Z_][A-Z0-9_]*%/y,
1449
+ /\{(?:env:[A-Za-z_][A-Za-z0-9_]*|file:[^}\s]+)\}/y
1450
+ ];
1451
+ var DEFAULTED_REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*):-[^}]*\}/y;
1452
+ function referencesOnly(value) {
1453
+ let out = "";
1454
+ let index = 0;
1455
+ while (index < value.length) {
1456
+ DEFAULTED_REFERENCE.lastIndex = index;
1457
+ const defaulted = DEFAULTED_REFERENCE.exec(value);
1458
+ if (defaulted) {
1459
+ out += `\${${defaulted[1] ?? ""}:-${exports2.REDACTED_VALUE}}`;
1460
+ index = DEFAULTED_REFERENCE.lastIndex;
1461
+ continue;
1462
+ }
1463
+ let matched = false;
1464
+ for (const pattern of REFERENCE_PATTERNS) {
1465
+ pattern.lastIndex = index;
1466
+ const match = pattern.exec(value);
1467
+ if (match) {
1468
+ out += match[0];
1469
+ index = pattern.lastIndex;
1470
+ matched = true;
1471
+ break;
1472
+ }
1473
+ }
1474
+ if (!matched) {
1475
+ return null;
1476
+ }
1477
+ }
1478
+ return out.length > 0 ? out : null;
1479
+ }
1480
+ function sanitizeVariableReference(value) {
1481
+ const scheme = /^(bearer|basic|token)(\s+)(.+)$/i.exec(value);
1482
+ if (scheme) {
1483
+ const rest = referencesOnly(scheme[3] ?? "");
1484
+ return rest === null ? null : `${scheme[1] ?? ""}${scheme[2] ?? ""}${rest}`;
1485
+ }
1486
+ return referencesOnly(value);
1487
+ }
1488
+ function tildeText(value, options) {
1489
+ return options.home ? (0, home_path_js_1.tildeHomeInText)(value, options.home) : value;
1490
+ }
1491
+ function containsSecretShapedToken(value) {
1492
+ return (0, mcp_redaction_js_1.isSecretShapedValue)(value) || value.split(/[\s=,;:'"]+/).some(mcp_redaction_js_1.isSecretShapedValue);
1493
+ }
1494
+ function keepString(value, options) {
1495
+ if (containsSecretShapedToken(value)) {
1496
+ return exports2.REDACTED_VALUE;
1497
+ }
1498
+ if (value.includes("://")) {
1499
+ return sanitizeUrl(value, options);
1500
+ }
1501
+ return tildeText(value, options);
1502
+ }
1503
+ var MODE_WORD_RE = /^[A-Za-z][A-Za-z_-]{0,31}$/;
1504
+ function sanitizeMode(value) {
1505
+ if (typeof value !== "string") {
1506
+ return mcp_redaction_js_1.OMITTED_VALUE;
1507
+ }
1508
+ return MODE_WORD_RE.test(value) && !(0, mcp_redaction_js_1.isSecretShapedValue)(value) ? value : exports2.REDACTED_VALUE;
1509
+ }
1510
+ function keepScalar(value, options) {
1511
+ if (typeof value === "string") {
1512
+ return keepString(value, options);
1513
+ }
1514
+ if (typeof value === "number") {
1515
+ return Number.isFinite(value) ? value : mcp_redaction_js_1.OMITTED_VALUE;
1516
+ }
1517
+ if (typeof value === "boolean" || value === null) {
1518
+ return value;
1519
+ }
1520
+ return mcp_redaction_js_1.OMITTED_VALUE;
1521
+ }
1522
+ function toolName(entry) {
1523
+ if (typeof entry !== "string") {
1524
+ return mcp_redaction_js_1.OMITTED_VALUE;
1525
+ }
1526
+ return /[\s=]/.test(entry) || containsSecretShapedToken(entry) ? exports2.REDACTED_VALUE : entry;
1527
+ }
1528
+ function sanitizeToolList(value) {
1529
+ if (typeof value === "boolean") {
1530
+ return value;
1531
+ }
1532
+ if (typeof value === "string") {
1533
+ return toolName(value);
1534
+ }
1535
+ if (!Array.isArray(value)) {
1536
+ return mcp_redaction_js_1.OMITTED_VALUE;
1537
+ }
1538
+ return value.map((entry) => toolName(entry));
1539
+ }
1540
+ function sanitizeStringList(value, options) {
1541
+ if (!Array.isArray(value)) {
1542
+ return mcp_redaction_js_1.OMITTED_VALUE;
1543
+ }
1544
+ return value.map((entry) => typeof entry === "string" ? keepString(entry, options) : mcp_redaction_js_1.OMITTED_VALUE);
1545
+ }
1546
+ function isCredentialHeaderName(name) {
1547
+ return (0, mcp_redaction_js_1.isAuthHeaderName)(name) || (0, mcp_redaction_js_1.isAuthKeyName)(name);
1548
+ }
1549
+ var HEADER_LABEL_RE = /(^|[\s"'=,;])([A-Za-z][A-Za-z0-9_-]*)(\s*:\s*)/g;
1550
+ function redactCredentialHeaders(text) {
1551
+ let out = "";
1552
+ let cursor = 0;
1553
+ HEADER_LABEL_RE.lastIndex = 0;
1554
+ let match;
1555
+ while ((match = HEADER_LABEL_RE.exec(text)) !== null) {
1556
+ const name = match[2] ?? "";
1557
+ const valueStart = match.index + match[0].length;
1558
+ if (!isCredentialHeaderName(name)) {
1559
+ continue;
1560
+ }
1561
+ const quote = text.slice(valueStart).search(/["'\n]/);
1562
+ const valueEnd = quote === -1 ? text.length : valueStart + quote;
1563
+ const value = text.slice(valueStart, valueEnd).trim();
1564
+ if (value.length === 0) {
1565
+ continue;
1566
+ }
1567
+ out += text.slice(cursor, valueStart);
1568
+ out += sanitizeVariableReference(value) ?? exports2.REDACTED_VALUE;
1569
+ cursor = valueEnd;
1570
+ HEADER_LABEL_RE.lastIndex = valueEnd;
1571
+ }
1572
+ return out + text.slice(cursor);
1573
+ }
1574
+ var AUTH_SCHEME_CREDENTIAL_RE = /\b(bearer|basic|token)(\s+)([^\s"']+)/gi;
1575
+ function hasLiteralAuthScheme(text) {
1576
+ for (const match of text.matchAll(AUTH_SCHEME_CREDENTIAL_RE)) {
1577
+ if (sanitizeVariableReference(match[3] ?? "") === null) {
1578
+ return true;
1579
+ }
1580
+ }
1581
+ return false;
1582
+ }
1583
+ function redactCredentialArg(value) {
1584
+ const headers = redactCredentialHeaders(value);
1585
+ return hasLiteralAuthScheme(headers) ? exports2.REDACTED_VALUE : headers;
1586
+ }
1587
+ function redactCredentialCommandLine(value) {
1588
+ return redactCredentialHeaders(value).replace(AUTH_SCHEME_CREDENTIAL_RE, (whole, scheme, space, credential) => sanitizeVariableReference(credential) === null ? `${scheme}${space}${exports2.REDACTED_VALUE}` : whole);
1589
+ }
1590
+ function joinCommandTokens(tokens) {
1591
+ return tokens.map((token) => {
1592
+ if (!/\s/.test(token)) {
1593
+ return token;
1594
+ }
1595
+ return token.includes('"') && !token.includes("'") ? `'${token}'` : `"${token}"`;
1596
+ }).join(" ");
1597
+ }
1598
+ function sanitizeCommand(value, options) {
1599
+ if (typeof value !== "string") {
1600
+ return mcp_redaction_js_1.OMITTED_VALUE;
1601
+ }
1602
+ const tokens = (0, command_tokens_js_1.tokenizeCommand)(redactCredentialCommandLine(value));
1603
+ if (tokens.length === 0) {
1604
+ return value;
1605
+ }
1606
+ return tildeText(joinCommandTokens((0, mcp_redaction_js_1.redactArgs)(tokens)), options);
1607
+ }
1608
+ function sanitizeHelperCommand(value, options) {
1609
+ if (typeof value === "string") {
1610
+ const reference = sanitizeVariableReference(value);
1611
+ if (reference !== null) {
1612
+ return reference;
1613
+ }
1614
+ const tokens = (0, command_tokens_js_1.tokenizeCommand)(value);
1615
+ const [executable] = tokens;
1616
+ if (executable === void 0) {
1617
+ return value;
1618
+ }
1619
+ const kept = sanitizeCommand(executable, options);
1620
+ return tokens.length > 1 ? `${String(kept)} ${exports2.REDACTED_VALUE}` : kept;
1621
+ }
1622
+ if (Array.isArray(value)) {
1623
+ return value.map((entry, index) => index === 0 ? sanitizeCommand(entry, options) : exports2.REDACTED_VALUE);
1624
+ }
1625
+ return mcp_redaction_js_1.OMITTED_VALUE;
1626
+ }
1627
+ function sanitizeArgs(value, options) {
1628
+ if (!Array.isArray(value)) {
1629
+ return mcp_redaction_js_1.OMITTED_VALUE;
1630
+ }
1631
+ const stringIndexes = [];
1632
+ const strings = [];
1633
+ value.forEach((entry, index) => {
1634
+ if (typeof entry === "string") {
1635
+ stringIndexes.push(index);
1636
+ strings.push(entry);
1637
+ }
1638
+ });
1639
+ const redacted = (0, mcp_redaction_js_1.redactArgs)(strings);
1640
+ const out = value.map(() => mcp_redaction_js_1.OMITTED_VALUE);
1641
+ stringIndexes.forEach((index, position) => {
1642
+ out[index] = tildeText(redactCredentialArg(redacted[position] ?? exports2.REDACTED_VALUE), options);
1643
+ });
1644
+ return out;
1645
+ }
1646
+ function canParseUrl(value) {
1647
+ try {
1648
+ return new URL(value).href.length > 0;
1649
+ } catch {
1650
+ return false;
1651
+ }
1652
+ }
1653
+ function redactSecretPathSegments(value) {
1654
+ return value.split("/").map((segment) => containsSecretShapedToken(segment) ? exports2.REDACTED_VALUE : segment).join("/");
1655
+ }
1656
+ function sanitizeUrl(value, options) {
1657
+ if (typeof value !== "string") {
1658
+ return mcp_redaction_js_1.OMITTED_VALUE;
1659
+ }
1660
+ const reference = sanitizeVariableReference(value);
1661
+ if (reference !== null) {
1662
+ return reference;
1663
+ }
1664
+ if (/^(?:unix|pipe):/i.test(value)) {
1665
+ const hash = value.indexOf("#");
1666
+ const beforeHash = hash === -1 ? value : value.slice(0, hash);
1667
+ const fragment = hash === -1 ? "" : value.slice(hash);
1668
+ const withoutQuery2 = beforeHash.split("?", 1)[0] ?? "";
1669
+ return tildeText(redactSecretPathSegments(`${withoutQuery2}${fragment}`), options);
1670
+ }
1671
+ if (/^(?:https?|wss?):/i.test(value) && canParseUrl(value)) {
1672
+ return redactSecretPathSegments((0, mcp_redaction_js_1.redactCommandOrUrl)(value));
1673
+ }
1674
+ const withoutQuery = value.split(/[?#]/, 1)[0] ?? "";
1675
+ const scheme = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//.exec(withoutQuery)?.[0] ?? "";
1676
+ const afterScheme = withoutQuery.slice(scheme.length);
1677
+ const slash = afterScheme.indexOf("/");
1678
+ const authority = slash === -1 ? afterScheme : afterScheme.slice(0, slash);
1679
+ const at = authority.lastIndexOf("@");
1680
+ const cleaned = `${scheme}${at === -1 ? afterScheme : afterScheme.slice(at + 1)}`;
1681
+ return tildeText(redactSecretPathSegments(cleaned), options);
1682
+ }
1683
+ function sanitizeSecret(value) {
1684
+ if (value === null) {
1685
+ return null;
1686
+ }
1687
+ if (typeof value === "string") {
1688
+ return sanitizeVariableReference(value) ?? exports2.REDACTED_VALUE;
1689
+ }
1690
+ return exports2.REDACTED_VALUE;
1691
+ }
1692
+ function envName(value) {
1693
+ if (typeof value !== "string") {
1694
+ return mcp_redaction_js_1.OMITTED_VALUE;
1695
+ }
1696
+ return ENV_NAME_RE.test(value) && !(0, mcp_redaction_js_1.isSecretShapedValue)(value) ? value : exports2.REDACTED_VALUE;
1697
+ }
1698
+ function sanitizeSecretMap(value) {
1699
+ if (Array.isArray(value)) {
1700
+ return value.map((entry) => {
1701
+ if (typeof entry !== "string") {
1702
+ return mcp_redaction_js_1.OMITTED_VALUE;
1703
+ }
1704
+ const eq = entry.indexOf("=");
1705
+ if (eq === -1) {
1706
+ return envName(entry);
1707
+ }
1708
+ const name = entry.slice(0, eq);
1709
+ if (envName(name) !== name) {
1710
+ return exports2.REDACTED_VALUE;
1711
+ }
1712
+ return `${name}=${sanitizeVariableReference(entry.slice(eq + 1)) ?? exports2.REDACTED_VALUE}`;
1713
+ });
1714
+ }
1715
+ if (!(0, json_js_1.isRecord)(value)) {
1716
+ return mcp_redaction_js_1.OMITTED_VALUE;
1717
+ }
1718
+ const out = {};
1719
+ for (const [key, entry] of Object.entries(value)) {
1720
+ out[key] = sanitizeSecret(entry);
1721
+ }
1722
+ return out;
1723
+ }
1724
+ function sanitizeEnvNameMap(value) {
1725
+ if (!(0, json_js_1.isRecord)(value)) {
1726
+ return mcp_redaction_js_1.OMITTED_VALUE;
1727
+ }
1728
+ const out = {};
1729
+ for (const [key, entry] of Object.entries(value)) {
1730
+ out[key] = envName(entry);
1731
+ }
1732
+ return out;
1733
+ }
1734
+ function pathString(value, options) {
1735
+ if (containsSecretShapedToken(value)) {
1736
+ return exports2.REDACTED_VALUE;
1737
+ }
1738
+ return options.home ? (0, home_path_js_1.tildePath)(value, options.home) : value;
1739
+ }
1740
+ function sanitizePath(value, options) {
1741
+ if (typeof value === "string") {
1742
+ return pathString(value, options);
1743
+ }
1744
+ if (Array.isArray(value)) {
1745
+ return value.map((entry) => typeof entry === "string" ? pathString(entry, options) : mcp_redaction_js_1.OMITTED_VALUE);
1746
+ }
1747
+ return mcp_redaction_js_1.OMITTED_VALUE;
1748
+ }
1749
+ function sanitizeObject(value, table, options) {
1750
+ const out = {};
1751
+ for (const [key, entry] of Object.entries(value)) {
1752
+ const treatment = Object.hasOwn(table, key) ? table[key] : void 0;
1753
+ out[key] = treatment === void 0 ? mcp_redaction_js_1.OMITTED_VALUE : applyTreatment(entry, treatment, options);
1754
+ }
1755
+ return out;
1756
+ }
1757
+ function applyLeaf(value, treatment, options) {
1758
+ switch (treatment) {
1759
+ case "keep":
1760
+ return keepScalar(value, options);
1761
+ case "transport_type":
1762
+ return typeof value === "string" && exports2.MCP_CONFIG_TRANSPORT_TYPES.has(value) ? value : mcp_redaction_js_1.OMITTED_VALUE;
1763
+ case "mode":
1764
+ return sanitizeMode(value);
1765
+ case "string_list":
1766
+ return sanitizeStringList(value, options);
1767
+ case "tool_list":
1768
+ return sanitizeToolList(value);
1769
+ case "command":
1770
+ return sanitizeCommand(value, options);
1771
+ case "helper_command":
1772
+ return sanitizeHelperCommand(value, options);
1773
+ case "args":
1774
+ return sanitizeArgs(value, options);
1775
+ case "url":
1776
+ return sanitizeUrl(value, options);
1777
+ case "secret":
1778
+ return sanitizeSecret(value);
1779
+ case "secret_map":
1780
+ return sanitizeSecretMap(value);
1781
+ case "env_name":
1782
+ return envName(value);
1783
+ case "env_name_map":
1784
+ return sanitizeEnvNameMap(value);
1785
+ case "path":
1786
+ return sanitizePath(value, options);
1787
+ case "omit":
1788
+ return mcp_redaction_js_1.OMITTED_VALUE;
1789
+ }
1790
+ }
1791
+ function applyTreatment(value, treatment, options) {
1792
+ if (typeof treatment === "string") {
1793
+ return applyLeaf(value, treatment, options);
1794
+ }
1795
+ if ("object" in treatment) {
1796
+ return (0, json_js_1.isRecord)(value) ? sanitizeObject(value, treatment.object, options) : mcp_redaction_js_1.OMITTED_VALUE;
1797
+ }
1798
+ if ("map" in treatment) {
1799
+ if (!(0, json_js_1.isRecord)(value)) {
1800
+ return mcp_redaction_js_1.OMITTED_VALUE;
1801
+ }
1802
+ const out = {};
1803
+ for (const [key, entry] of Object.entries(value)) {
1804
+ out[key] = applyTreatment(entry, treatment.map, options);
1805
+ }
1806
+ return out;
1807
+ }
1808
+ if ("list" in treatment) {
1809
+ return Array.isArray(value) ? value.map((entry) => applyTreatment(entry, treatment.list, options)) : mcp_redaction_js_1.OMITTED_VALUE;
1810
+ }
1811
+ const shape = shapeOf(value);
1812
+ const branch = shape === void 0 ? void 0 : treatment.by[shape];
1813
+ return branch === void 0 ? mcp_redaction_js_1.OMITTED_VALUE : applyTreatment(value, branch, options);
1814
+ }
1815
+ function sanitizeServers(value, options) {
1816
+ if (!(0, json_js_1.isRecord)(value)) {
1817
+ return mcp_redaction_js_1.OMITTED_VALUE;
1818
+ }
1819
+ const out = {};
1820
+ for (const [name, server] of Object.entries(value)) {
1821
+ out[name] = (0, json_js_1.isRecord)(server) ? sanitizeObject(server, exports2.MCP_CONFIG_SERVER_KEY_TREATMENT, options) : mcp_redaction_js_1.OMITTED_VALUE;
1822
+ }
1823
+ return out;
1824
+ }
1825
+ function isVsCodeMcpJson(filePath) {
1826
+ return /(?:^|[\\/])\.vscode[\\/]mcp\.json$/i.test(filePath);
1827
+ }
1828
+ function mcpConfigFormatOf2(filePath) {
1829
+ if (isVsCodeMcpJson(filePath)) {
1830
+ return "vscode_mcp_json";
1831
+ }
1832
+ return (0, node_path_1.basename)(filePath) === ".claude.json" ? "claude_json_slice" : "mcp_json";
1833
+ }
1834
+ function mcpConfigServersKey2(format) {
1835
+ return format === "vscode_mcp_json" ? "servers" : "mcpServers";
1836
+ }
1837
+ function sanitizeMcpConfigFile2(parsed, format, options = {}) {
1838
+ if (!(0, json_js_1.isRecord)(parsed)) {
1839
+ return {};
1840
+ }
1841
+ const serversKey = mcpConfigServersKey2(format);
1842
+ if (format === "claude_json_slice") {
1843
+ return Object.hasOwn(parsed, serversKey) ? { [serversKey]: sanitizeServers(parsed[serversKey], options) } : {};
1844
+ }
1845
+ const out = {};
1846
+ for (const [key, entry] of Object.entries(parsed)) {
1847
+ if (key === serversKey) {
1848
+ out[key] = sanitizeServers(entry, options);
1849
+ } else if (format === "vscode_mcp_json" && key === "inputs") {
1850
+ out[key] = applyTreatment(entry, { list: { object: exports2.MCP_CONFIG_VSCODE_INPUT_TABLE } }, options);
1851
+ } else if (format === "vscode_mcp_json" && key === "sandbox") {
1852
+ out[key] = applyTreatment(entry, { object: exports2.MCP_CONFIG_SANDBOX_TABLE }, options);
1853
+ } else {
1854
+ out[key] = mcp_redaction_js_1.OMITTED_VALUE;
1855
+ }
1856
+ }
1857
+ return out;
1858
+ }
1859
+ }
1860
+ });
1861
+
1862
+ // ../composition-identity/dist/mcp-config-parse.js
1863
+ var require_mcp_config_parse = __commonJS({
1864
+ "../composition-identity/dist/mcp-config-parse.js"(exports2) {
1865
+ "use strict";
1866
+ Object.defineProperty(exports2, "__esModule", { value: true });
1867
+ exports2.sanitizeMcpConfig = sanitizeMcpConfig;
1868
+ exports2.parseMcpConfig = parseMcpConfig;
1869
+ var node_crypto_1 = require("node:crypto");
1870
+ var json_js_1 = require_json();
1871
+ var mcp_config_file_js_1 = require_mcp_config_file();
1872
+ var mcp_redaction_js_1 = require_mcp_redaction();
1873
+ function sanitizeMcpConfig(body, format) {
1874
+ const parsed = JSON.parse(body);
1875
+ return JSON.stringify((0, mcp_config_file_js_1.sanitizeMcpConfigFile)(parsed, format), null, 2);
1876
+ }
1877
+ function parseMcpConfig(body, format) {
1878
+ const parsed = JSON.parse(body);
1879
+ if (!(0, json_js_1.isRecord)(parsed)) {
1880
+ return [];
1881
+ }
1882
+ const servers = parsed[(0, mcp_config_file_js_1.mcpConfigServersKey)(format)];
1883
+ if (!(0, json_js_1.isRecord)(servers)) {
1884
+ return [];
1885
+ }
1886
+ return Object.entries(servers).flatMap(([key, block]) => (0, json_js_1.isRecord)(block) ? [parsedServer(key, block)] : []);
1887
+ }
1888
+ function parsedServer(key, block) {
1889
+ return {
1890
+ key,
1891
+ enabled: (0, mcp_redaction_js_1.mcpServerEnabledFromJson)(block),
1892
+ block,
1893
+ launch: launchOf(key, block),
1894
+ contentHash: (0, node_crypto_1.createHash)("sha256").update(canonicalJson(block)).digest("hex")
1895
+ };
1896
+ }
1897
+ function launchOf(key, block) {
1898
+ if (typeof block.command === "string" && block.command.length > 0) {
1899
+ const args = Array.isArray(block.args) ? block.args.filter((arg) => typeof arg === "string") : [];
1900
+ return { kind: "command", command: block.command, arguments: args };
1901
+ }
1902
+ const url = [block.url, block.serverUrl, block.httpUrl].find((value) => typeof value === "string" && value.length > 0);
1903
+ if (url !== void 0) {
1904
+ return { kind: "url", url };
1905
+ }
1906
+ return { kind: "unknown", installationRootExternalKey: "", sourcePath: "", nativeKey: key };
1907
+ }
1908
+ function canonicalJson(value) {
1909
+ if (Array.isArray(value)) {
1910
+ return `[${value.map(canonicalJson).join(",")}]`;
1911
+ }
1912
+ if ((0, json_js_1.isRecord)(value)) {
1913
+ const entries = Object.keys(value).sort().map((entryKey) => `${JSON.stringify(entryKey)}:${canonicalJson(value[entryKey])}`);
1914
+ return `{${entries.join(",")}}`;
1915
+ }
1916
+ return JSON.stringify(value) ?? "null";
1917
+ }
1918
+ }
1919
+ });
1920
+
904
1921
  // ../composition-identity/dist/index.js
905
1922
  var require_dist = __commonJS({
906
1923
  "../composition-identity/dist/index.js"(exports2) {
907
1924
  "use strict";
908
1925
  Object.defineProperty(exports2, "__esModule", { value: true });
909
- exports2.redactComponentSource = exports2.prepareComponentInspectionText = exports2.fitSnapshotInspectionTextBudget = exports2.componentSourceContainsRedactableSecret = exports2.capComponentTextBytes = exports2.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES = exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER = exports2.COMPONENT_INSPECTION_TEXT_MAX_BYTES = exports2.usableCatalogText = exports2.parseFrontmatterField = exports2.parseFrontmatterDescription = exports2.mcpServerToolSegmentForms = exports2.mcpServerNameMatchesToolSegment = exports2.isNpmRegistryPublisher = exports2.EMPTY_NPM_PUBLISHER = exports2.displayPublisherName = exports2.classifyMcpProvenance = exports2.resolveMcpPackageIdentity = exports2.resolveLocalBinPackageIdentity = exports2.McpPackageEcosystem = exports2.pinnedPackageVersionFromSpec = exports2.pinnedPackageVersionFromNpx = exports2.packageNameFromSpec = exports2.npxPackageSpecs = exports2.npxExecBin = exports2.isNodeModulesBinCommand = exports2.isExactNpmVersion = exports2.LOCAL_BIN_PACKAGE_VERSION_SOURCE = exports2.PACKAGE_FIELD_MAX = exports2.serializeMcpLaunchIdentity = exports2.projectMcpMissingLaunchIdentity = exports2.projectMcpLaunchIdentity = exports2.normalizeMcpToolNames = exports2.MCP_MISSING_LAUNCH_SERIALIZED = exports2.MCP_LAUNCH_IDENTITY_ALGORITHM = exports2.maskMcpLaunchForDisplay = exports2.launchContainsCredentials = exports2.hashMcpLaunchIdentity = exports2.foldMcpName = exports2.buildMcpFamilyCanonicalKey = exports2.ComponentKind = void 0;
1926
+ exports2.mcpServerEnabledFromJson = exports2.isSecretShapedValue = exports2.isAuthKeyName = exports2.isAuthHeaderName = exports2.ENABLED_RAW_KEYS = exports2.tildePath = exports2.tildeHomeInText = exports2.tokenizeCommand = exports2.isRecord = exports2.redactComponentSource = exports2.prepareComponentInspectionText = exports2.fitSnapshotInspectionTextBudget = exports2.componentSourceContainsRedactableSecret = exports2.capComponentTextBytes = exports2.SNAPSHOT_INSPECTION_TEXT_MAX_BYTES = exports2.COMPONENT_SOURCE_REDACTION_PLACEHOLDER = exports2.COMPONENT_INSPECTION_TEXT_MAX_BYTES = exports2.usableCatalogText = exports2.parseFrontmatterField = exports2.parseFrontmatterDescription = exports2.mcpServerToolSegmentForms = exports2.mcpServerNameMatchesToolSegment = exports2.isNpmRegistryPublisher = exports2.EMPTY_NPM_PUBLISHER = exports2.displayPublisherName = exports2.classifyMcpProvenance = exports2.resolveMcpPackageIdentity = exports2.resolveLocalBinPackageIdentity = exports2.McpPackageEcosystem = exports2.pinnedPackageVersionFromSpec = exports2.pinnedPackageVersionFromNpx = exports2.packageNameFromSpec = exports2.npxPackageSpecs = exports2.npxExecBin = exports2.isNodeModulesBinCommand = exports2.isExactNpmVersion = exports2.LOCAL_BIN_PACKAGE_VERSION_SOURCE = exports2.PACKAGE_FIELD_MAX = exports2.serializeMcpLaunchIdentity = exports2.projectMcpMissingLaunchIdentity = exports2.projectMcpLaunchIdentity = exports2.normalizeMcpToolNames = exports2.MCP_MISSING_LAUNCH_SERIALIZED = exports2.MCP_LAUNCH_IDENTITY_ALGORITHM = exports2.maskMcpLaunchForDisplay = exports2.launchContainsCredentials = exports2.hashMcpLaunchIdentity = exports2.foldMcpName = exports2.buildMcpFamilyCanonicalKey = exports2.ComponentKind = void 0;
1927
+ exports2.sanitizeMcpConfig = exports2.parseMcpConfig = exports2.sanitizeVariableReference = exports2.sanitizeMcpConfigFile = exports2.REDACTED_VALUE = exports2.mcpConfigServersKey = exports2.mcpConfigFormatOf = exports2.MCP_CONFIG_VSCODE_INPUT_TABLE = exports2.MCP_CONFIG_TRANSPORT_TYPES = exports2.MCP_CONFIG_SERVER_KEY_TREATMENT = exports2.MCP_CONFIG_SANDBOX_TABLE = exports2.TOOL_LIST_RAW_KEYS = exports2.redactCommandOrUrl = exports2.redactArgs = exports2.OMITTED_VALUE = void 0;
910
1928
  exports2.userConfigRootFromPath = userConfigRootFromPath;
1929
+ exports2.repositoryConfigRootExternalKeyFromPath = repositoryConfigRootExternalKeyFromPath;
911
1930
  exports2.installationRootExternalKey = installationRootExternalKey;
912
1931
  exports2.normalizeRepositoryRelativePath = normalizeRepositoryRelativePath;
913
1932
  exports2.nativeKeyForSkillPath = nativeKeyForSkillPath;
@@ -921,11 +1940,11 @@ var require_dist = __commonJS({
921
1940
  var REFERENCE_PREFIX = "cmp1_";
922
1941
  var REFERENCE_PATTERN = /^cmp1_[A-Za-z0-9_-]{43}$/;
923
1942
  var SKILLS_DIR_MARKERS = ["/skills/", "/skills-cursor/"];
924
- var RULE_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/rules\/(.+)$/i;
1943
+ var RULE_PATH_RE = /(?:^|\/)(?:\.(?:cursor|claude|codex)|\.gemini\/config)\/rules\/(.+)$/i;
925
1944
  var COMMAND_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/(?:commands|prompts)\/(.+)$/i;
926
1945
  var COPILOT_INSTRUCTION_PATH_RE = /(?:^|\/)\.(?:github|copilot)\/instructions\/(.+)$/i;
927
1946
  var COPILOT_PROMPT_PATH_RE = /(?:^|\/)\.github\/prompts\/(.+)$/i;
928
- var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex", ".copilot"];
1947
+ var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex", ".copilot", ".gemini"];
929
1948
  var USER_CONFIG_ROOT_ALIASES = {
930
1949
  ".claude.json": ".claude",
931
1950
  ".agents": ".codex",
@@ -949,6 +1968,27 @@ var require_dist = __commonJS({
949
1968
  const aliasedRoot = segments.map((segment) => USER_CONFIG_ROOT_ALIASES[segment]).find((root) => root !== void 0);
950
1969
  return aliasedRoot ?? "unknown";
951
1970
  }
1971
+ var REPOSITORY_CONFIG_ROOT_MARKERS = /* @__PURE__ */ new Set([
1972
+ ".claude",
1973
+ ".cursor",
1974
+ ".codex",
1975
+ ".opencode",
1976
+ ".github"
1977
+ ]);
1978
+ var REPOSITORY_AGENTS_DIR = ".agents";
1979
+ var REPOSITORY_AGENTS_DIR_ROOT = ".codex";
1980
+ function repositoryConfigRootExternalKeyFromPath(repoSlug, repoRelativeSourcePath) {
1981
+ const segments = repoRelativeSourcePath.replaceAll("\\", "/").split("/").filter(Boolean);
1982
+ const markerIndex = segments.findIndex((segment) => REPOSITORY_CONFIG_ROOT_MARKERS.has(segment));
1983
+ if (markerIndex >= 0) {
1984
+ return `${repoSlug}:${segments.slice(0, markerIndex + 1).join("/")}`;
1985
+ }
1986
+ const agentsIndex = segments.indexOf(REPOSITORY_AGENTS_DIR);
1987
+ if (agentsIndex < 0) {
1988
+ return null;
1989
+ }
1990
+ return `${repoSlug}:${[...segments.slice(0, agentsIndex), REPOSITORY_AGENTS_DIR_ROOT].join("/")}`;
1991
+ }
952
1992
  function installationRootExternalKey(installationId, configRoot) {
953
1993
  return `runtime-install:${installationId}/${configRoot}`;
954
1994
  }
@@ -1148,6 +2188,84 @@ var require_dist = __commonJS({
1148
2188
  Object.defineProperty(exports2, "redactComponentSource", { enumerable: true, get: function() {
1149
2189
  return skill_source_redaction_js_1.redactComponentSource;
1150
2190
  } });
2191
+ var json_js_1 = require_json();
2192
+ Object.defineProperty(exports2, "isRecord", { enumerable: true, get: function() {
2193
+ return json_js_1.isRecord;
2194
+ } });
2195
+ var command_tokens_js_1 = require_command_tokens();
2196
+ Object.defineProperty(exports2, "tokenizeCommand", { enumerable: true, get: function() {
2197
+ return command_tokens_js_1.tokenizeCommand;
2198
+ } });
2199
+ var home_path_js_1 = require_home_path();
2200
+ Object.defineProperty(exports2, "tildeHomeInText", { enumerable: true, get: function() {
2201
+ return home_path_js_1.tildeHomeInText;
2202
+ } });
2203
+ Object.defineProperty(exports2, "tildePath", { enumerable: true, get: function() {
2204
+ return home_path_js_1.tildePath;
2205
+ } });
2206
+ var mcp_redaction_js_1 = require_mcp_redaction();
2207
+ Object.defineProperty(exports2, "ENABLED_RAW_KEYS", { enumerable: true, get: function() {
2208
+ return mcp_redaction_js_1.ENABLED_RAW_KEYS;
2209
+ } });
2210
+ Object.defineProperty(exports2, "isAuthHeaderName", { enumerable: true, get: function() {
2211
+ return mcp_redaction_js_1.isAuthHeaderName;
2212
+ } });
2213
+ Object.defineProperty(exports2, "isAuthKeyName", { enumerable: true, get: function() {
2214
+ return mcp_redaction_js_1.isAuthKeyName;
2215
+ } });
2216
+ Object.defineProperty(exports2, "isSecretShapedValue", { enumerable: true, get: function() {
2217
+ return mcp_redaction_js_1.isSecretShapedValue;
2218
+ } });
2219
+ Object.defineProperty(exports2, "mcpServerEnabledFromJson", { enumerable: true, get: function() {
2220
+ return mcp_redaction_js_1.mcpServerEnabledFromJson;
2221
+ } });
2222
+ Object.defineProperty(exports2, "OMITTED_VALUE", { enumerable: true, get: function() {
2223
+ return mcp_redaction_js_1.OMITTED_VALUE;
2224
+ } });
2225
+ Object.defineProperty(exports2, "redactArgs", { enumerable: true, get: function() {
2226
+ return mcp_redaction_js_1.redactArgs;
2227
+ } });
2228
+ Object.defineProperty(exports2, "redactCommandOrUrl", { enumerable: true, get: function() {
2229
+ return mcp_redaction_js_1.redactCommandOrUrl;
2230
+ } });
2231
+ Object.defineProperty(exports2, "TOOL_LIST_RAW_KEYS", { enumerable: true, get: function() {
2232
+ return mcp_redaction_js_1.TOOL_LIST_RAW_KEYS;
2233
+ } });
2234
+ var mcp_config_file_js_1 = require_mcp_config_file();
2235
+ Object.defineProperty(exports2, "MCP_CONFIG_SANDBOX_TABLE", { enumerable: true, get: function() {
2236
+ return mcp_config_file_js_1.MCP_CONFIG_SANDBOX_TABLE;
2237
+ } });
2238
+ Object.defineProperty(exports2, "MCP_CONFIG_SERVER_KEY_TREATMENT", { enumerable: true, get: function() {
2239
+ return mcp_config_file_js_1.MCP_CONFIG_SERVER_KEY_TREATMENT;
2240
+ } });
2241
+ Object.defineProperty(exports2, "MCP_CONFIG_TRANSPORT_TYPES", { enumerable: true, get: function() {
2242
+ return mcp_config_file_js_1.MCP_CONFIG_TRANSPORT_TYPES;
2243
+ } });
2244
+ Object.defineProperty(exports2, "MCP_CONFIG_VSCODE_INPUT_TABLE", { enumerable: true, get: function() {
2245
+ return mcp_config_file_js_1.MCP_CONFIG_VSCODE_INPUT_TABLE;
2246
+ } });
2247
+ Object.defineProperty(exports2, "mcpConfigFormatOf", { enumerable: true, get: function() {
2248
+ return mcp_config_file_js_1.mcpConfigFormatOf;
2249
+ } });
2250
+ Object.defineProperty(exports2, "mcpConfigServersKey", { enumerable: true, get: function() {
2251
+ return mcp_config_file_js_1.mcpConfigServersKey;
2252
+ } });
2253
+ Object.defineProperty(exports2, "REDACTED_VALUE", { enumerable: true, get: function() {
2254
+ return mcp_config_file_js_1.REDACTED_VALUE;
2255
+ } });
2256
+ Object.defineProperty(exports2, "sanitizeMcpConfigFile", { enumerable: true, get: function() {
2257
+ return mcp_config_file_js_1.sanitizeMcpConfigFile;
2258
+ } });
2259
+ Object.defineProperty(exports2, "sanitizeVariableReference", { enumerable: true, get: function() {
2260
+ return mcp_config_file_js_1.sanitizeVariableReference;
2261
+ } });
2262
+ var mcp_config_parse_js_1 = require_mcp_config_parse();
2263
+ Object.defineProperty(exports2, "parseMcpConfig", { enumerable: true, get: function() {
2264
+ return mcp_config_parse_js_1.parseMcpConfig;
2265
+ } });
2266
+ Object.defineProperty(exports2, "sanitizeMcpConfig", { enumerable: true, get: function() {
2267
+ return mcp_config_parse_js_1.sanitizeMcpConfig;
2268
+ } });
1151
2269
  }
1152
2270
  });
1153
2271
 
@@ -4140,11 +5258,20 @@ var require_micromatch = __commonJS({
4140
5258
  // src/install/managed-hooks-snippet.ts
4141
5259
  var managed_hooks_snippet_exports = {};
4142
5260
  __export(managed_hooks_snippet_exports, {
5261
+ ANTIGRAVITY_HOOK_NAME: () => ANTIGRAVITY_HOOK_NAME,
5262
+ ANTIGRAVITY_MERGE_SCRIPT: () => ANTIGRAVITY_MERGE_SCRIPT,
5263
+ ANTIGRAVITY_OPERATING_SYSTEMS: () => ANTIGRAVITY_OPERATING_SYSTEMS,
4143
5264
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
4144
5265
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
4145
5266
  COPILOT_ENTERPRISE_MARKETPLACE_REPO: () => COPILOT_ENTERPRISE_MARKETPLACE_REPO,
4146
5267
  NPX_PACKAGE_SPEC: () => NPX_PACKAGE_SPEC,
5268
+ antigravityInstallDir: () => antigravityInstallDir,
5269
+ antigravityMdmScriptFileName: () => antigravityMdmScriptFileName,
5270
+ antigravityMergeCommand: () => antigravityMergeCommand,
5271
+ antigravityReleaseAssets: () => antigravityReleaseAssets,
4147
5272
  buildCollectorUrl: () => buildCollectorUrl,
5273
+ managedAntigravityHooksJson: () => managedAntigravityHooksJson,
5274
+ managedAntigravityMdmScript: () => managedAntigravityMdmScript,
4148
5275
  managedCodexConfigTomlSnippet: () => managedCodexConfigTomlSnippet,
4149
5276
  managedCopilotPluginSettings: () => managedCopilotPluginSettings,
4150
5277
  managedHooksSnippet: () => managedHooksSnippet,
@@ -4162,9 +5289,8 @@ var CLASSIFY_MAX = 64 * 1024;
4162
5289
  var HOOK_MJS_MAX = 4 * 1024 * 1024;
4163
5290
 
4164
5291
  // src/config/collector-url-resolve.ts
4165
- var DEFAULT_COLLECTOR_BASE_URL = "https://hooks.ev-ai.ai";
4166
5292
  var MAX_JSON_FILE_BYTES = 1024 * 1024;
4167
- function buildCollectorUrl(orgToken, baseUrl = DEFAULT_COLLECTOR_BASE_URL) {
5293
+ function buildCollectorUrl(orgToken, baseUrl) {
4168
5294
  const normalizedBase = baseUrl.replace(/\/+$/, "");
4169
5295
  const token = orgToken.trim();
4170
5296
  return `${normalizedBase}/${token}/hook`;
@@ -4286,6 +5412,53 @@ var RUNNER_LAYOUT = {
4286
5412
  // VS Code's workspace file keys servers under `servers`, not `mcpServers`.
4287
5413
  mcpJson: [".github/mcp.json", ".vscode/mcp.json"]
4288
5414
  }
5415
+ },
5416
+ // Google Antigravity (desktop app, `agy` CLI, IDE). Mirrors GOOGLE_ANTIGRAVITY in
5417
+ // common/platform-component-ownership: one layout under the workspace
5418
+ // `.agents/` and the personal `~/.gemini/config/`, plus legacy home skill dirs
5419
+ // the app and CLI still read. `dirs` cannot differ by scope, so both trees are
5420
+ // listed. There is no commands dir (slash commands are skills), and
5421
+ // `admin_settings.json` holds no customizations, so there is no `managed`.
5422
+ // `hooks.json` keys hooks by name with no `hooks{}` object: presence only.
5423
+ // Plugins (`~/.gemini/config/plugins/<plugin>/`) are expanded by
5424
+ // `collectAntigravityPlugins`. The `skills.json` / `rules.json` manifests are
5425
+ // not read yet.
5426
+ // Source: https://antigravity.google/docs/customization-discovery
5427
+ antigravity: {
5428
+ shared: {
5429
+ skillRoots: [],
5430
+ dirs: [
5431
+ { dir: ".agents/rules", kind: "RULE", extensions: [".md"] },
5432
+ { dir: ".agents/agents", kind: "SUBAGENT", extensions: [".md"] },
5433
+ { dir: ".gemini/config/rules", kind: "RULE", extensions: [".md"] },
5434
+ { dir: ".gemini/config/agents", kind: "SUBAGENT", extensions: [".md"] }
5435
+ ],
5436
+ memory: [],
5437
+ settings: []
5438
+ },
5439
+ homeOnly: {
5440
+ skillRoots: [
5441
+ ".gemini/config/skills",
5442
+ ".gemini/antigravity/skills",
5443
+ ".gemini/antigravity-cli/skills",
5444
+ ".gemini/skills"
5445
+ ],
5446
+ memory: [
5447
+ [".gemini/GEMINI.md"],
5448
+ [".gemini/AGENTS.md"],
5449
+ [".gemini/config/GEMINI.md"],
5450
+ [".gemini/config/AGENTS.md"]
5451
+ ],
5452
+ settings: [".gemini/config/hooks.json"],
5453
+ mcpJson: [".gemini/config/mcp_config.json"],
5454
+ plugins: "antigravity"
5455
+ },
5456
+ projectOnly: {
5457
+ skillRoots: [".agents/skills"],
5458
+ memory: [["AGENTS.md"], ["GEMINI.md"], [".agents/AGENTS.md"], [".agents/GEMINI.md"]],
5459
+ settings: [".agents/hooks.json"],
5460
+ mcpJson: [".agents/mcp_config.json"]
5461
+ }
4289
5462
  }
4290
5463
  };
4291
5464
  function concatOptional(shared, delta) {
@@ -4390,7 +5563,7 @@ var USER_SKILL_ROOTS = uniqueOrderedRoots(
4390
5563
  );
4391
5564
 
4392
5565
  // src/extract/rule-extract.ts
4393
- var import_composition_identity5 = __toESM(require_dist(), 1);
5566
+ var import_composition_identity8 = __toESM(require_dist(), 1);
4394
5567
 
4395
5568
  // src/shared/file-logger.ts
4396
5569
  var LOG_MAX_BYTES = 1024 * 1024;
@@ -4417,7 +5590,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
4417
5590
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
4418
5591
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
4419
5592
  var GZIP_MIN_BYTES = 32 * 1024;
4420
- var PACKAGE_VERSION = "1.4.1";
5593
+ var PACKAGE_VERSION = "1.4.2";
4421
5594
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
4422
5595
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
4423
5596
 
@@ -4456,19 +5629,7 @@ var NPX_PACKAGE_ATTRIBUTE_KEYS = [
4456
5629
  "package_version",
4457
5630
  "package_version_source"
4458
5631
  ];
4459
- var TOOL_LIST_RAW_KEYS = [
4460
- { raw: "tools", attr: "tools" },
4461
- { raw: "autoApprove", attr: "auto_approve" },
4462
- { raw: "auto_approve", attr: "auto_approve" },
4463
- { raw: "alwaysAllow", attr: "always_allow" },
4464
- { raw: "always_allow", attr: "always_allow" },
4465
- { raw: "enabledTools", attr: "enabled_tools" },
4466
- { raw: "enabled_tools", attr: "enabled_tools" },
4467
- { raw: "disabledTools", attr: "disabled_tools" },
4468
- { raw: "disabled_tools", attr: "disabled_tools" }
4469
- ];
4470
- var TOOL_LIST_ATTRS = new Set(TOOL_LIST_RAW_KEYS.map((entry) => entry.attr));
4471
- var ENABLED_RAW_KEYS = ["enabled", "disabled"];
5632
+ var TOOL_LIST_ATTRS = new Set(import_composition_identity.TOOL_LIST_RAW_KEYS.map((entry) => entry.attr));
4472
5633
  var SCALAR_RAW_KEYS = [
4473
5634
  "serverUrl",
4474
5635
  "auth",
@@ -4487,9 +5648,9 @@ var MCP_SERVER_READ_KEYS = /* @__PURE__ */ new Set([
4487
5648
  "env",
4488
5649
  "envVars",
4489
5650
  "headers",
4490
- ...ENABLED_RAW_KEYS,
5651
+ ...import_composition_identity.ENABLED_RAW_KEYS,
4491
5652
  ...SCALAR_RAW_KEYS,
4492
- ...TOOL_LIST_RAW_KEYS.map((entry) => entry.raw)
5653
+ ...import_composition_identity.TOOL_LIST_RAW_KEYS.map((entry) => entry.raw)
4493
5654
  ]);
4494
5655
  var DERIVED_KEYS = /* @__PURE__ */ new Set([
4495
5656
  "transport",
@@ -4506,225 +5667,8 @@ var DERIVED_KEYS = /* @__PURE__ */ new Set([
4506
5667
  ...[...TOOL_LIST_ATTRS].map((attr) => `${attr}_truncated`)
4507
5668
  ]);
4508
5669
 
4509
- // src/collectors/permission-key.ts
4510
- var PATH_PLACEHOLDER = "<path>";
4511
- var PATH_CONTINUATION_PATTERN = new RegExp(
4512
- `${PATH_PLACEHOLDER}(?:\\s+[A-Za-z.][^\\s,)]*[\\\\/][^\\s,)]*)+`,
4513
- "g"
4514
- );
4515
-
4516
- // src/collectors/userSpec/settings.ts
4517
- var SETTINGS_JSON_MAX_BYTES = 16 * 1024;
4518
-
4519
- // src/collectors/userSpec/mcp-config-file.ts
4520
- var AUTH_TABLE = {
4521
- CLIENT_ID: "keep",
4522
- CLIENT_SECRET: "secret",
4523
- scopes: "string_list",
4524
- redirectPort: "keep"
4525
- // source-only
4526
- };
4527
- var OAUTH_TABLE = {
4528
- clientId: "keep",
4529
- client_id: "keep",
4530
- clientSecret: "secret",
4531
- client_secret: "secret",
4532
- callbackPort: "keep",
4533
- callback_port: "keep",
4534
- // source-only
4535
- callback_url: "url",
4536
- // source-only
4537
- redirectUri: "url",
4538
- // source-only
4539
- redirect_uri: "url",
4540
- // source-only
4541
- authServerMetadataUrl: "url",
4542
- auth_server_metadata_url: "url",
4543
- // source-only
4544
- authorizationUrl: "url",
4545
- tokenUrl: "url",
4546
- issuer: "url",
4547
- // source-only
4548
- registrationUrl: "url",
4549
- // source-only
4550
- clientMetadataUrl: "url",
4551
- // source-only
4552
- scopes: { by: { string: "keep", array: "string_list" } },
4553
- scope: "keep",
4554
- // source-only
4555
- oauthScopes: "string_list",
4556
- // source-only
4557
- audiences: "string_list",
4558
- enabled: "keep",
4559
- allowPrivateNetwork: "keep",
4560
- // source-only
4561
- authorizationResponseIssParameterSupported: "keep",
4562
- // source-only
4563
- tokenParamName: "keep"
4564
- };
4565
- var MCP_CONFIG_SANDBOX_TABLE = {
4566
- filesystem: {
4567
- object: {
4568
- allowWrite: "path",
4569
- denyRead: "path",
4570
- denyWrite: "path"
4571
- }
4572
- },
4573
- network: {
4574
- object: {
4575
- allowedDomains: "string_list",
4576
- deniedDomains: "string_list"
4577
- }
4578
- }
4579
- };
4580
- var DEV_TABLE = {
4581
- watch: "path",
4582
- debug: { object: { type: "keep", debugpyPath: "path" } }
4583
- };
4584
- var REQUEST_OPTIONS_TABLE = {
4585
- headers: "secret_map",
4586
- proxy: "url",
4587
- caBundlePath: "path",
4588
- timeout: "keep",
4589
- verifySsl: "keep",
4590
- noProxy: "string_list",
4591
- extraBodyProperties: "omit",
4592
- clientCertificate: { object: { cert: "omit", key: "omit", passphrase: "secret" } }
4593
- };
4594
- var TIMEOUT_TABLE = { startup: "keep", catalog: "keep", execution: "keep" };
4595
- var CODEX_TOOL_TABLE = { approval_mode: "keep", output_token_limit: "keep" };
4596
- var TRANSPORT_TABLE = {
4597
- type: "transport_type",
4598
- command: "command",
4599
- args: "args",
4600
- cwd: "path",
4601
- env: "secret_map",
4602
- url: "url",
4603
- headers: "secret_map"
4604
- };
4605
- var TOOL_LIST_ALIASES = Object.fromEntries(
4606
- TOOL_LIST_RAW_KEYS.map(({ raw }) => [raw, "tool_list"])
4607
- );
4608
- var MCP_CONFIG_SERVER_KEY_TREATMENT = {
4609
- ...TOOL_LIST_ALIASES,
4610
- // Identity / transport / enablement
4611
- type: "transport_type",
4612
- transportType: "keep",
4613
- // source-only
4614
- transport: { by: { string: "keep", object: { object: TRANSPORT_TABLE } } },
4615
- disabled: "keep",
4616
- enabled: "keep",
4617
- required: "keep",
4618
- remote: "keep",
4619
- // source-only
4620
- remoteConfigured: "keep",
4621
- // source-only
4622
- source: "keep",
4623
- // source-only
4624
- version: "keep",
4625
- gallery: { by: { boolean: "keep", string: "url" } },
4626
- description: "omit",
4627
- name: "keep",
4628
- serverName: "keep",
4629
- // source-only
4630
- faviconUrl: "url",
4631
- // source-only
4632
- sourceFile: "path",
4633
- sourceSlug: "keep",
4634
- environment_id: "keep",
4635
- protocol: "keep",
4636
- pool: "keep",
4637
- codemode: "keep",
4638
- trust: "keep",
4639
- alwaysLoad: "keep",
4640
- deferTools: "keep",
4641
- // source-only
4642
- supports_parallel_tool_calls: "keep",
4643
- tool_input_schema_max_bytes: "keep",
4644
- startup_readiness: "keep",
4645
- extension: "omit",
4646
- // source-only
4647
- metadata: "omit",
4648
- // source-only
4649
- settings: "omit",
4650
- // source-only
4651
- // stdio / process
4652
- command: {
4653
- by: {
4654
- string: "command",
4655
- array: "args",
4656
- // Zed legacy `command: { path, args, env }`.
4657
- object: { object: { path: "command", args: "args", env: "secret_map" } }
4658
- }
4659
- },
4660
- args: "args",
4661
- env: "secret_map",
4662
- environment: "secret_map",
4663
- env_vars: {
4664
- list: {
4665
- by: { string: "env_name", object: { object: { name: "env_name", source: "keep" } } }
4666
- }
4667
- },
4668
- envVars: "secret_map",
4669
- envFile: "path",
4670
- cwd: "path",
4671
- watchPaths: "path",
4672
- dev: { object: DEV_TABLE },
4673
- sandboxEnabled: "keep",
4674
- sandbox: { object: MCP_CONFIG_SANDBOX_TABLE },
4675
- // Remote / HTTP
4676
- url: "url",
4677
- serverUrl: "url",
4678
- httpUrl: "url",
4679
- tcp: "url",
4680
- // source-only
4681
- headers: "secret_map",
4682
- http_headers: "secret_map",
4683
- env_http_headers: "env_name_map",
4684
- bearer_token_env_var: "env_name",
4685
- headersHelper: "helper_command",
4686
- http_headers_helper: "helper_command",
4687
- apiKey: "secret",
4688
- // source-only
4689
- requestOptions: { object: REQUEST_OPTIONS_TABLE },
4690
- // source-only
4691
- auth: { by: { string: "mode", object: { object: AUTH_TABLE } } },
4692
- oauth: { by: { boolean: "keep", object: { object: OAUTH_TABLE } } },
4693
- oauthClientId: "keep",
4694
- oauthClientSecret: "secret",
4695
- oauthResource: "url",
4696
- oauth_resource: "url",
4697
- oauthScopes: "string_list",
4698
- scopes: { by: { string: "keep", array: "string_list" } },
4699
- oauthPublicClient: "keep",
4700
- // source-only
4701
- oauthGrantType: "keep",
4702
- // source-only
4703
- authProviderType: "keep",
4704
- targetAudience: "keep",
4705
- targetServiceAccount: "keep",
4706
- // Tool filtering / approval
4707
- tools: {
4708
- by: {
4709
- array: "tool_list",
4710
- boolean: "tool_list",
4711
- string: "tool_list",
4712
- object: { map: { object: CODEX_TOOL_TABLE } }
4713
- }
4714
- },
4715
- includeTools: "tool_list",
4716
- excludeTools: "tool_list",
4717
- omit_tools_from: "tool_list",
4718
- default_tools_approval_mode: "keep",
4719
- defaultToolsApprovalMode: "keep",
4720
- // Timeouts
4721
- timeout: { by: { number: "keep", object: { object: TIMEOUT_TABLE } } },
4722
- startup_timeout_sec: "keep",
4723
- startup_timeout_ms: "keep",
4724
- tool_timeout_sec: "keep",
4725
- connectionTimeout: "keep"
4726
- // source-only
4727
- };
5670
+ // src/collectors/userSpec/mcp.ts
5671
+ var import_composition_identity5 = __toESM(require_dist(), 1);
4728
5672
 
4729
5673
  // src/collectors/userSpec/npx-package.ts
4730
5674
  var import_composition_identity4 = __toESM(require_dist(), 1);
@@ -4744,6 +5688,20 @@ var MANIFEST_MAX_BYTES = 1024 * 1024;
4744
5688
  // src/collectors/userSpec/mcp.ts
4745
5689
  var MCP_CONFIG_TEXT_MAX_BYTES = 64 * 1024;
4746
5690
 
5691
+ // src/collectors/userSpec/hook-command.ts
5692
+ var import_composition_identity6 = __toESM(require_dist(), 1);
5693
+
5694
+ // src/collectors/permission-key.ts
5695
+ var PATH_PLACEHOLDER = "<path>";
5696
+ var PATH_CONTINUATION_PATTERN = new RegExp(
5697
+ `${PATH_PLACEHOLDER}(?:\\s+[A-Za-z.][^\\s,)]*[\\\\/][^\\s,)]*)+`,
5698
+ "g"
5699
+ );
5700
+
5701
+ // src/collectors/userSpec/settings.ts
5702
+ var import_composition_identity7 = __toESM(require_dist(), 1);
5703
+ var SETTINGS_JSON_MAX_BYTES = 16 * 1024;
5704
+
4747
5705
  // src/collectors/userSpec/budget.ts
4748
5706
  var USER_SPEC_MAX_BYTES = 2 * 1024 * 1024;
4749
5707
 
@@ -4754,19 +5712,19 @@ var GIT_CONFIG_CACHE_TTL_MS = 60 * 60 * 1e3;
4754
5712
  var RULE_LAYOUT_ROOTS = userScopePathsFromLayouts(Object.values(PLATFORM_PROJECT_LAYOUT)).rules;
4755
5713
 
4756
5714
  // src/extract/command-extract.ts
4757
- var import_composition_identity6 = __toESM(require_dist(), 1);
5715
+ var import_composition_identity9 = __toESM(require_dist(), 1);
4758
5716
  var COMMAND_LAYOUT_ROOTS = userScopePathsFromLayouts(
4759
5717
  Object.values(PLATFORM_PROJECT_LAYOUT)
4760
5718
  ).commands;
4761
5719
 
4762
5720
  // src/hook/runner.ts
4763
- var import_composition_identity7 = __toESM(require_dist(), 1);
5721
+ var import_composition_identity10 = __toESM(require_dist(), 1);
4764
5722
  function isInProcessEvent(runnerEvent, platform) {
4765
5723
  const lower = runnerEvent.toLowerCase();
4766
5724
  if (lower === "sessionend" || lower === "stopfailure" || lower === "subagentstop") {
4767
5725
  return true;
4768
5726
  }
4769
- return lower === "stop" && platform === "codex";
5727
+ return lower === "stop" && (platform === "codex" || platform === "antigravity");
4770
5728
  }
4771
5729
 
4772
5730
  // src/config/hook-config.ts
@@ -4849,6 +5807,28 @@ function desiredCodexHookGroups(command) {
4849
5807
  SubagentStop: [commandHook()]
4850
5808
  };
4851
5809
  }
5810
+ var ANTIGRAVITY_WIRED_HOOK_EVENTS = [
5811
+ "SessionStart",
5812
+ "PreInvocation",
5813
+ "PreToolUse",
5814
+ "PostToolUse",
5815
+ "PostInvocation",
5816
+ "Stop"
5817
+ ];
5818
+ var ANTIGRAVITY_TOOL_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse"]);
5819
+ var ANTIGRAVITY_HOOK_NAME = "ev-ai-agent-hooks";
5820
+ function desiredAntigravityHooks(command, timeoutSeconds, hookName = ANTIGRAVITY_HOOK_NAME) {
5821
+ const entry = { enabled: true };
5822
+ for (const eventName of ANTIGRAVITY_WIRED_HOOK_EVENTS) {
5823
+ const handler = {
5824
+ type: "command",
5825
+ command: `${commandForEvent(eventName, command)} ${eventName}`,
5826
+ timeout: timeoutSeconds(eventName)
5827
+ };
5828
+ entry[eventName] = ANTIGRAVITY_TOOL_EVENTS.has(eventName) ? [{ matcher: "", hooks: [handler] }] : [handler];
5829
+ }
5830
+ return { [hookName]: entry };
5831
+ }
4852
5832
  var CURSOR_WIRED_HOOK_EVENTS = [
4853
5833
  "sessionStart",
4854
5834
  "beforeSubmitPrompt",
@@ -4890,6 +5870,516 @@ var MARKETPLACE_PLUGIN_DIRS = {
4890
5870
  codex: "plugins/codex",
4891
5871
  copilot: "plugins/copilot"
4892
5872
  };
5873
+ var ANTIGRAVITY_PAYLOAD_DIR = "plugins/antigravity";
5874
+ var MARKETPLACE_PAYLOAD_DIRS = [
5875
+ ...Object.values(MARKETPLACE_PLUGIN_DIRS),
5876
+ ANTIGRAVITY_PAYLOAD_DIR
5877
+ ];
5878
+
5879
+ // src/install/antigravity-mdm.ts
5880
+ var ANTIGRAVITY_OPERATING_SYSTEMS = ["macos", "linux", "windows"];
5881
+ var ANTIGRAVITY_ENTRY_MARKER = "--runner antigravity";
5882
+ var CMD_SAFE_URL = /^https?:\/\/[A-Za-z0-9._~:/?#[\]@&+,;=-]+$/;
5883
+ var PLUGIN_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
5884
+ var MARKETPLACE_REPO = /^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/;
5885
+ function assertPluginName(pluginName) {
5886
+ if (!PLUGIN_NAME.test(pluginName)) {
5887
+ throw new Error(`plugin name must be a lowercase slug: ${pluginName}`);
5888
+ }
5889
+ }
5890
+ function assertCollectorUrl(collectorUrl) {
5891
+ if (!CMD_SAFE_URL.test(collectorUrl)) {
5892
+ throw new Error(`collector URL is not safe to quote in a hook command: ${collectorUrl}`);
5893
+ }
5894
+ }
5895
+ function antigravityInstallRoot(pluginName, os) {
5896
+ assertPluginName(pluginName);
5897
+ switch (os) {
5898
+ case "macos":
5899
+ return `/Library/Application Support/${pluginName}`;
5900
+ case "linux":
5901
+ return `/opt/${pluginName}`;
5902
+ case "windows":
5903
+ return `C:\\ProgramData\\${pluginName}`;
5904
+ }
5905
+ }
5906
+ function joinPath(os, ...parts) {
5907
+ return parts.join(os === "windows" ? "\\" : "/");
5908
+ }
5909
+ function antigravityInstallDir(pluginName, os) {
5910
+ return joinPath(os, antigravityInstallRoot(pluginName, os), "antigravity");
5911
+ }
5912
+ function antigravityHookCommand(collectorUrl, os, pluginName, installDir = antigravityInstallDir(pluginName, os)) {
5913
+ assertCollectorUrl(collectorUrl);
5914
+ const launcher = joinPath(os, installDir, "dist", "launcher.mjs");
5915
+ return `node "${launcher}" ${ANTIGRAVITY_ENTRY_MARKER} --url "${collectorUrl}"`;
5916
+ }
5917
+ function antigravityHooksEntry(collectorUrl, options = {}) {
5918
+ const pluginName = options.pluginName ?? ANTIGRAVITY_HOOK_NAME;
5919
+ const os = options.os ?? "macos";
5920
+ const command = antigravityHookCommand(collectorUrl, os, pluginName, options.installDir);
5921
+ return desiredAntigravityHooks(
5922
+ command,
5923
+ (eventName) => isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS,
5924
+ pluginName
5925
+ );
5926
+ }
5927
+ var ANTIGRAVITY_MERGE_SCRIPT = [
5928
+ "const fs=require('fs'),os=require('os'),path=require('path');",
5929
+ "const args=process.argv.slice(1);",
5930
+ "const file=args.length>1?args[0]:path.join(os.userInfo().homedir,'.gemini','config','hooks.json');",
5931
+ "const entry=JSON.parse(Buffer.from(args[args.length-1],'base64').toString('utf8'));",
5932
+ "function isLink(p){try{return fs.lstatSync(p).isSymbolicLink();}catch(e){return false;}}",
5933
+ "function merge(){",
5934
+ "if([path.dirname(path.dirname(file)),path.dirname(file),file].some(isLink)){return 'symlink';}",
5935
+ "let hooks={};",
5936
+ "if(fs.existsSync(file)){try{hooks=JSON.parse(fs.readFileSync(file,'utf8'));}catch(e){hooks=null;}}",
5937
+ "if(Object.prototype.toString.call(hooks)==='[object Object]'===false){return 'not-json';}",
5938
+ "const name=Object.keys(entry)[0];",
5939
+ `const ours=Object.keys(hooks).filter(function(k){return JSON.stringify(hooks[k]).includes('${ANTIGRAVITY_ENTRY_MARKER}');});`,
5940
+ "if(ours.length===1&&ours[0]===name&&JSON.stringify(hooks[name])===JSON.stringify(entry[name])){return 'unchanged';}",
5941
+ "for(const k of ours){delete hooks[k];}",
5942
+ "Object.assign(hooks,entry);",
5943
+ "fs.mkdirSync(path.dirname(file),{recursive:true});",
5944
+ "fs.writeFileSync(file,JSON.stringify(hooks,null,2)+'\\n');",
5945
+ "return ours.length>0?'updated':'added';",
5946
+ "}",
5947
+ "const result=merge();",
5948
+ "console.log(result);",
5949
+ "process.exitCode=result==='symlink'||result==='not-json'?3:0;"
5950
+ ].join("");
5951
+ function base64(text) {
5952
+ return Buffer.from(text, "utf8").toString("base64");
5953
+ }
5954
+ function antigravityMergeCommand(hooksJson) {
5955
+ return `node -e "${ANTIGRAVITY_MERGE_SCRIPT}" ${base64(hooksJson)}`;
5956
+ }
5957
+ function antigravityReleaseAssets(pluginName) {
5958
+ assertPluginName(pluginName);
5959
+ const base = `${pluginName}-antigravity`;
5960
+ return { tarball: `${base}.tar.gz`, zip: `${base}.zip`, checksums: `${base}.sha256` };
5961
+ }
5962
+ function assertMarketplaceRepo(marketplaceRepo) {
5963
+ if (!MARKETPLACE_REPO.test(marketplaceRepo)) {
5964
+ throw new Error(`marketplace repo must be owner/name: ${marketplaceRepo}`);
5965
+ }
5966
+ }
5967
+ function antigravityLatestReleaseBaseUrl(marketplaceRepo) {
5968
+ assertMarketplaceRepo(marketplaceRepo);
5969
+ return `https://github.com/${marketplaceRepo}/releases/latest/download`;
5970
+ }
5971
+ function scriptValues(collectorUrl, options, testing) {
5972
+ const { os, pluginName, marketplaceRepo } = options;
5973
+ assertPluginName(pluginName);
5974
+ assertMarketplaceRepo(marketplaceRepo);
5975
+ assertCollectorUrl(collectorUrl);
5976
+ const installRoot = testing?.installRoot ?? antigravityInstallRoot(pluginName, os);
5977
+ const installDir = joinPath(os, installRoot, "antigravity");
5978
+ const assets = antigravityReleaseAssets(pluginName);
5979
+ const releaseBaseUrl = testing?.releaseBaseUrl ?? antigravityLatestReleaseBaseUrl(marketplaceRepo);
5980
+ const archiveName = os === "windows" ? assets.zip : assets.tarball;
5981
+ const entry = antigravityHooksEntry(collectorUrl, { os, pluginName, installDir });
5982
+ return {
5983
+ pluginName,
5984
+ marketplaceRepo,
5985
+ installRoot,
5986
+ installDir,
5987
+ shaUrl: `${releaseBaseUrl}/${assets.checksums}`,
5988
+ archiveUrl: `${releaseBaseUrl}/${archiveName}`,
5989
+ archiveName,
5990
+ entryBase64: base64(JSON.stringify(entry))
5991
+ };
5992
+ }
5993
+ function posixHeader(v, osLabel, runAs) {
5994
+ return [
5995
+ "#!/bin/sh",
5996
+ `# Google Antigravity agent hooks (${v.pluginName}) for ${osLabel}.`,
5997
+ "# Generated for your organization: every value is already filled in, do not edit it.",
5998
+ `# Run it as ${runAs} once a day on every device. Each run:`,
5999
+ `# 1. installs or updates the hook from the latest stable release of https://github.com/${v.marketplaceRepo}`,
6000
+ `# into ${v.installDir} (only when that release changed);`,
6001
+ "# 2. adds or repairs the hook entry in ~/.gemini/config/hooks.json for every user,",
6002
+ "# keeping each user's own hooks.",
6003
+ "# Running it again changes nothing that is already in place."
6004
+ ].join("\n");
6005
+ }
6006
+ function posixMdmScript(collectorUrl, options, testing) {
6007
+ const v = scriptValues(collectorUrl, options, testing);
6008
+ const macos = options.os === "macos";
6009
+ const header = posixHeader(v, macos ? "macOS" : "Linux", "root");
6010
+ const path = "/usr/bin:/bin:/usr/sbin:/sbin";
6011
+ const nodeCandidates = testing ? `"${testing.node}"` : macos ? "/usr/local/bin/node /opt/homebrew/bin/node /usr/bin/node" : "/usr/local/bin/node /usr/bin/node /snap/bin/node";
6012
+ const sha256 = macos ? "shasum -a 256 -c -" : "sha256sum -c -";
6013
+ const owner = macos ? "root:wheel" : "root:root";
6014
+ const rootCheck = testing ? "" : String.raw`if [ "$(id -u)" -ne 0 ]; then
6015
+ log "run this script as root"
6016
+ exit 1
6017
+ fi
6018
+ `;
6019
+ const secureDir = testing ? String.raw`secure_dir() {
6020
+ chmod -R u=rwX,go=rX "$1"
6021
+ }` : String.raw`secure_dir() {
6022
+ chown -R ${owner} "$1" && chmod -R u=rwX,go=rX "$1"
6023
+ }`;
6024
+ const ownerUid = macos ? "stat -f %u" : "stat -c %u";
6025
+ const prepareRoot = String.raw`untrusted() {
6026
+ [ -L "$1" ] || { [ -e "$1" ] && [ "$(${ownerUid} "$1")" != "$(id -u)" ]; }
6027
+ }
6028
+ prepare_root() {
6029
+ if untrusted "${v.installRoot}"; then
6030
+ rm -rf "${v.installRoot}" || return 1
6031
+ fi
6032
+ mkdir -p "${v.installRoot}" && secure_dir "${v.installRoot}" || return 1
6033
+ for path in "${v.installDir}" "${v.installDir}.new" "${v.installDir}.old"; do
6034
+ if untrusted "$path"; then rm -rf "$path" || return 1; fi
6035
+ done
6036
+ }`;
6037
+ let listUsers;
6038
+ if (testing) {
6039
+ listUsers = String.raw`list_users() {
6040
+ printf '%s:%s\n' "$(id -un)" "${testing.home}"
6041
+ }`;
6042
+ } else if (macos) {
6043
+ listUsers = String.raw`list_users() {
6044
+ dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | while read -r name; do
6045
+ home="$(dscl . read "/Users/$name" NFSHomeDirectory 2>/dev/null | sed -n 's/^NFSHomeDirectory: //p')"
6046
+ if [ -n "$home" ] && [ -d "$home" ]; then printf '%s:%s\n' "$name" "$home"; fi
6047
+ done
6048
+ }`;
6049
+ } else {
6050
+ listUsers = String.raw`list_users() {
6051
+ getent passwd | awk -F: '$3 >= 1000 && $3 < 60000 {print $1 ":" $6}' | while IFS=: read -r name home; do
6052
+ if [ -n "$home" ] && [ -d "$home" ]; then printf '%s:%s\n' "$name" "$home"; fi
6053
+ done
6054
+ }`;
6055
+ }
6056
+ let runAsUser;
6057
+ if (testing) {
6058
+ runAsUser = String.raw`run_as_user() {
6059
+ shift
6060
+ "$@"
6061
+ }`;
6062
+ } else if (macos) {
6063
+ runAsUser = String.raw`run_as_user() {
6064
+ user="$1"
6065
+ shift
6066
+ sudo -u "$user" -H "$@"
6067
+ }`;
6068
+ } else {
6069
+ runAsUser = String.raw`run_as_user() {
6070
+ user="$1"
6071
+ shift
6072
+ if command -v runuser >/dev/null 2>&1; then
6073
+ runuser -u "$user" -- "$@"
6074
+ else
6075
+ sudo -u "$user" -H "$@"
6076
+ fi
6077
+ }`;
6078
+ }
6079
+ const dir = v.installDir;
6080
+ return `${header}
6081
+ set -u
6082
+ cd / || exit 1
6083
+ PATH="${path}"
6084
+ export PATH
6085
+
6086
+ log() {
6087
+ echo "${v.pluginName}: $*"
6088
+ }
6089
+
6090
+ ${rootCheck}# Node runs only as each user (run_as_user below), never as root.
6091
+ NODE=""
6092
+ for candidate in ${nodeCandidates}; do
6093
+ if [ -x "$candidate" ]; then NODE="$candidate"; break; fi
6094
+ done
6095
+ if [ -z "$NODE" ]; then
6096
+ log "node not found, skipped: install Node.js 18 or later"
6097
+ exit 0
6098
+ fi
6099
+
6100
+ WORK="$(mktemp -d)" || exit 1
6101
+ trap 'rm -rf "$WORK"' EXIT
6102
+
6103
+ ${secureDir}
6104
+
6105
+ ${prepareRoot}
6106
+
6107
+ ${listUsers}
6108
+
6109
+ ${runAsUser}
6110
+
6111
+ installed_version() {
6112
+ sed -n 's/.*"version": *"\\([^"]*\\)".*/\\1/p' "${dir}/package.json" | head -n 1
6113
+ }
6114
+
6115
+ # 1. Install or update the hook from the latest stable release.
6116
+ prepare_root || { log "could not prepare ${v.installRoot}"; exit 1; }
6117
+ if ! curl -fsSL --retry 3 --connect-timeout 20 -o "$WORK/release.sha256" "${v.shaUrl}"; then
6118
+ log "could not download ${v.shaUrl}; keeping the installed version"
6119
+ elif [ -f "${dir}/dist/launcher.mjs" ] && cmp -s "$WORK/release.sha256" "${dir}/.release.sha256"; then
6120
+ log "up to date ($(installed_version))"
6121
+ elif ! curl -fsSL --retry 3 --connect-timeout 20 -o "$WORK/${v.archiveName}" "${v.archiveUrl}"; then
6122
+ log "could not download ${v.archiveUrl}; keeping the installed version"
6123
+ elif ! (cd "$WORK" && grep " ${v.archiveName}\\$" release.sha256 | ${sha256} >/dev/null 2>&1); then
6124
+ log "checksum mismatch for ${v.archiveName}; keeping the installed version"
6125
+ exit 1
6126
+ else
6127
+ rm -rf "${dir}.new"
6128
+ if mkdir "${dir}.new" &&
6129
+ tar -xzf "$WORK/${v.archiveName}" -C "${dir}.new" &&
6130
+ [ -f "${dir}.new/dist/launcher.mjs" ] &&
6131
+ cp "$WORK/release.sha256" "${dir}.new/.release.sha256" &&
6132
+ secure_dir "${dir}.new"; then
6133
+ rm -rf "${dir}.old"
6134
+ if [ -d "${dir}" ] && ! mv "${dir}" "${dir}.old"; then
6135
+ rm -rf "${dir}.new"
6136
+ log "could not replace ${dir}; keeping the installed version"
6137
+ exit 1
6138
+ fi
6139
+ if mv "${dir}.new" "${dir}"; then
6140
+ log "installed $(installed_version) in ${dir}"
6141
+ else
6142
+ # Put the previous version back so existing hook entries keep working.
6143
+ if [ -d "${dir}.old" ]; then mv "${dir}.old" "${dir}"; fi
6144
+ rm -rf "${dir}.new"
6145
+ log "could not activate the new release; keeping the installed version"
6146
+ exit 1
6147
+ fi
6148
+ else
6149
+ rm -rf "${dir}.new"
6150
+ log "could not unpack ${v.archiveName}; keeping the installed version"
6151
+ exit 1
6152
+ fi
6153
+ fi
6154
+
6155
+ if [ ! -f "${dir}/dist/launcher.mjs" ]; then
6156
+ log "not installed yet, so no hook entries were written"
6157
+ exit 1
6158
+ fi
6159
+
6160
+ # 2. Add or repair the hook entry for every user on this device.
6161
+ list_users | while IFS=: read -r name home; do
6162
+ result="$(run_as_user "$name" "$NODE" -e "${ANTIGRAVITY_MERGE_SCRIPT}" "$home/.gemini/config/hooks.json" "${v.entryBase64}" 2>&1)"
6163
+ case "$result" in
6164
+ added) log "hook entry added for $name" ;;
6165
+ updated) log "hook entry updated for $name" ;;
6166
+ unchanged) log "hook entry already set for $name" ;;
6167
+ not-json) log "skipped $name: $home/.gemini/config/hooks.json is not valid JSON" ;;
6168
+ symlink) log "skipped $name: $home/.gemini/config is a symbolic link" ;;
6169
+ *) log "skipped $name: $result" ;;
6170
+ esac
6171
+ done
6172
+ exit 0
6173
+ `;
6174
+ }
6175
+ function windowsMdmScript(collectorUrl, options, testing) {
6176
+ const v = scriptValues(collectorUrl, options, testing);
6177
+ const dir = v.installDir;
6178
+ const taskScript = `${v.installRoot}\\antigravity-setup.ps1`;
6179
+ const adminCheck = testing ? "" : String.raw`$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
6180
+ if (-not ([Security.Principal.WindowsPrincipal]$identity).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
6181
+ Write-Log 'run this script as SYSTEM or as an administrator'
6182
+ exit 1
6183
+ }
6184
+ `;
6185
+ const protectFolder = testing ? String.raw`function Protect-Folder([string]$Path) { }` : String.raw`# Only SYSTEM and Administrators can change the folder; users can read and run it.
6186
+ function Protect-Folder([string]$Path) {
6187
+ $acl = New-Object System.Security.AccessControl.DirectorySecurity
6188
+ $acl.SetAccessRuleProtection($true, $false)
6189
+ $acl.SetOwner((New-Object System.Security.Principal.SecurityIdentifier 'S-1-5-32-544'))
6190
+ foreach ($grant in @(@('S-1-5-18', 'FullControl'), @('S-1-5-32-544', 'FullControl'), @('S-1-5-32-545', 'ReadAndExecute'))) {
6191
+ $sid = New-Object System.Security.Principal.SecurityIdentifier $grant[0]
6192
+ $rule = New-Object System.Security.AccessControl.FileSystemAccessRule($sid, $grant[1], 'ContainerInherit, ObjectInherit', 'None', 'Allow')
6193
+ $acl.AddAccessRule($rule)
6194
+ }
6195
+ Set-Acl -LiteralPath $Path -AclObject $acl
6196
+ }`;
6197
+ const trustCheck = testing ? String.raw`function Test-Trusted([string]$Path) { $true }` : String.raw`# A folder is ours only when it is a real folder (not a junction or link) owned by
6198
+ # SYSTEM or Administrators. Users can create folders under C:\ProgramData before
6199
+ # the first run, and SYSTEM must never act on one of theirs.
6200
+ function Test-Trusted([string]$Path) {
6201
+ $item = Get-Item -LiteralPath $Path -Force
6202
+ if ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) { return $false }
6203
+ $owner = (Get-Acl -LiteralPath $Path).GetOwner([System.Security.Principal.SecurityIdentifier]).Value
6204
+ return ($owner -eq 'S-1-5-18' -or $owner -eq 'S-1-5-32-544')
6205
+ }`;
6206
+ const rootHelpers = String.raw`${trustCheck}
6207
+
6208
+ # Deletes a folder without following junctions: Remove-Item -Recurse in Windows
6209
+ # PowerShell 5.1 follows them and would delete what they point to.
6210
+ function Remove-Tree([string]$Path) {
6211
+ if (-not (Test-Path -LiteralPath $Path)) { return }
6212
+ if ((Get-Item -LiteralPath $Path -Force).PSIsContainer) {
6213
+ cmd.exe /d /c rmdir /s /q "$Path" | Out-Null
6214
+ } else {
6215
+ Remove-Item -LiteralPath $Path -Force
6216
+ }
6217
+ }
6218
+
6219
+ # Creates (or takes back) the install root and drops anything inside it that is
6220
+ # not ours, so SYSTEM only ever touches folders it created.
6221
+ function Initialize-Root {
6222
+ if ((Test-Path -LiteralPath '${v.installRoot}') -and -not (Test-Trusted '${v.installRoot}')) {
6223
+ Remove-Tree '${v.installRoot}'
6224
+ }
6225
+ New-Item -ItemType Directory -Force -Path '${v.installRoot}' | Out-Null
6226
+ Protect-Folder '${v.installRoot}'
6227
+ foreach ($child in @(Get-ChildItem -LiteralPath '${v.installRoot}' -Force)) {
6228
+ if (-not (Test-Trusted $child.FullName)) { Remove-Tree $child.FullName }
6229
+ }
6230
+ }`;
6231
+ const userSetupScript = `${v.installRoot}\\antigravity-user-setup.ps1`;
6232
+ const findNode = String.raw`$node = Get-Command node.exe -CommandType Application -All -ErrorAction SilentlyContinue |
6233
+ Where-Object { $_.Source -notlike '*\WindowsApps\*' } |
6234
+ Select-Object -First 1 -ExpandProperty Source
6235
+ if (-not $node -and (Test-Path -LiteralPath 'C:\Program Files\nodejs\node.exe')) {
6236
+ $node = 'C:\Program Files\nodejs\node.exe'
6237
+ }`;
6238
+ const userSteps = testing ? `$ErrorActionPreference = 'Continue'
6239
+ $result = (& '${testing.node}' -e "${ANTIGRAVITY_MERGE_SCRIPT}" '${testing.home}\\.gemini\\config\\hooks.json' '${v.entryBase64}' 2>&1 | Out-String).Trim()
6240
+ $ErrorActionPreference = 'Stop'
6241
+ Write-Log ('hook entry: ' + $result)` : `$userSetup = @'
6242
+ # Adds or repairs the Google Antigravity hook entry (${v.pluginName}) in the signed-in
6243
+ # user's %USERPROFILE%\\.gemini\\config\\hooks.json, keeping their own hooks.
6244
+ # Written by the ${v.pluginName} MDM script; runs as each user at sign-in and once a day.
6245
+ ${findNode}
6246
+ if (-not $node) { exit 0 }
6247
+ & $node -e "${ANTIGRAVITY_MERGE_SCRIPT}" '${v.entryBase64}' | Out-Null
6248
+ exit 0
6249
+ '@
6250
+ Set-Content -LiteralPath '${userSetupScript}' -Value $userSetup -Encoding UTF8
6251
+ $userAction = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File "${userSetupScript}"'
6252
+ $userTriggers = @((New-ScheduledTaskTrigger -AtLogOn), (New-ScheduledTaskTrigger -Daily -At '09:30'))
6253
+ $userSettings = New-ScheduledTaskSettingsSet -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Minutes 5)
6254
+ $userPrincipal = New-ScheduledTaskPrincipal -GroupId 'S-1-5-32-545' -RunLevel Limited
6255
+ Register-ScheduledTask -TaskName '${v.pluginName} Antigravity user setup' -Action $userAction -Trigger $userTriggers -Settings $userSettings -Principal $userPrincipal -Force | Out-Null
6256
+ try { Start-ScheduledTask -TaskName '${v.pluginName} Antigravity user setup' } catch { }
6257
+ Write-Log 'the user setup task adds or repairs the hook entry for each user at sign-in and once a day'`;
6258
+ const header = [
6259
+ `# Google Antigravity agent hooks (${v.pluginName}) for Windows.`,
6260
+ "# Generated for your organization: every value is already filled in, do not edit it.",
6261
+ "# Run it as SYSTEM once a day on every device. Each run:",
6262
+ `# 1. installs or updates the hook from the latest stable release of https://github.com/${v.marketplaceRepo}`,
6263
+ `# into ${dir} (only when that release changed);`,
6264
+ "# 2. registers a task that runs as each signed-in user (at sign-in and daily) and adds or",
6265
+ "# repairs the hook entry in that user's %USERPROFILE%\\.gemini\\config\\hooks.json,",
6266
+ "# keeping the user's own hooks. SYSTEM never writes inside a user profile.",
6267
+ "# Running it again changes nothing that is already in place.",
6268
+ "# -RegisterDailyTask also registers a daily SYSTEM scheduled task that runs this script."
6269
+ ].join("\n");
6270
+ return `${header}
6271
+ param([switch]$RegisterDailyTask)
6272
+ $ErrorActionPreference = 'Stop'
6273
+ $ProgressPreference = 'SilentlyContinue'
6274
+ [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
6275
+
6276
+ function Write-Log([string]$Message) {
6277
+ Write-Output ('${v.pluginName}: ' + $Message)
6278
+ }
6279
+
6280
+ ${protectFolder}
6281
+
6282
+ ${rootHelpers}
6283
+
6284
+ function Get-InstalledVersion {
6285
+ (Get-Content -Raw -LiteralPath '${dir}\\package.json' | ConvertFrom-Json).version
6286
+ }
6287
+
6288
+ ${adminCheck}if ($RegisterDailyTask) {
6289
+ Initialize-Root
6290
+ Copy-Item -LiteralPath $PSCommandPath -Destination '${taskScript}' -Force
6291
+ $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -ExecutionPolicy Bypass -File "${taskScript}"'
6292
+ $triggers = @((New-ScheduledTaskTrigger -Daily -At '09:00'), (New-ScheduledTaskTrigger -AtStartup))
6293
+ $settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Minutes 30)
6294
+ $principal = New-ScheduledTaskPrincipal -UserId 'S-1-5-18' -LogonType ServiceAccount -RunLevel Highest
6295
+ Register-ScheduledTask -TaskName '${v.pluginName} Antigravity' -Action $action -Trigger $triggers -Settings $settings -Principal $principal -Force | Out-Null
6296
+ Write-Log 'registered the daily scheduled task'
6297
+ }
6298
+
6299
+ ${findNode}
6300
+ if (-not $node) {
6301
+ Write-Log 'node not found, skipped: install Node.js 18 or later'
6302
+ exit 0
6303
+ }
6304
+
6305
+ Initialize-Root
6306
+
6307
+ $work = Join-Path ([IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
6308
+ New-Item -ItemType Directory -Path $work | Out-Null
6309
+ try {
6310
+ # 1. Install or update the hook from the latest stable release.
6311
+ $shaFile = Join-Path $work 'release.sha256'
6312
+ $archive = Join-Path $work '${v.archiveName}'
6313
+ $installed = Test-Path -LiteralPath '${dir}\\dist\\launcher.mjs'
6314
+ $current = ''
6315
+ if (Test-Path -LiteralPath '${dir}\\.release.sha256') {
6316
+ $current = Get-Content -Raw -LiteralPath '${dir}\\.release.sha256'
6317
+ }
6318
+ $downloaded = $true
6319
+ try {
6320
+ Invoke-WebRequest -UseBasicParsing -Uri '${v.shaUrl}' -OutFile $shaFile
6321
+ } catch {
6322
+ $downloaded = $false
6323
+ Write-Log 'could not download ${v.shaUrl}; keeping the installed version'
6324
+ }
6325
+ if ($downloaded -and $installed -and ((Get-Content -Raw -LiteralPath $shaFile) -eq $current)) {
6326
+ Write-Log ('up to date (' + (Get-InstalledVersion) + ')')
6327
+ } elseif ($downloaded) {
6328
+ try {
6329
+ Invoke-WebRequest -UseBasicParsing -Uri '${v.archiveUrl}' -OutFile $archive
6330
+ } catch {
6331
+ $downloaded = $false
6332
+ Write-Log 'could not download ${v.archiveUrl}; keeping the installed version'
6333
+ }
6334
+ }
6335
+ if ($downloaded -and -not ($installed -and ((Get-Content -Raw -LiteralPath $shaFile) -eq $current))) {
6336
+ $expected = Get-Content -LiteralPath $shaFile |
6337
+ Where-Object { ($_.Trim() -split '\\s+')[-1].TrimStart('*') -eq '${v.archiveName}' } |
6338
+ ForEach-Object { ($_.Trim() -split '\\s+')[0] } |
6339
+ Select-Object -First 1
6340
+ if (-not $expected -or $expected -ne (Get-FileHash -Algorithm SHA256 -LiteralPath $archive).Hash) {
6341
+ Write-Log 'checksum mismatch for ${v.archiveName}; keeping the installed version'
6342
+ exit 1
6343
+ }
6344
+ try {
6345
+ Remove-Tree '${dir}.new'
6346
+ Expand-Archive -LiteralPath $archive -DestinationPath '${dir}.new' -Force
6347
+ if (-not (Test-Path -LiteralPath '${dir}.new\\dist\\launcher.mjs')) { throw 'the release has no dist\\launcher.mjs' }
6348
+ Copy-Item -LiteralPath $shaFile -Destination '${dir}.new\\.release.sha256'
6349
+ Remove-Tree '${dir}.old'
6350
+ if (Test-Path -LiteralPath '${dir}') { Rename-Item -LiteralPath '${dir}' -NewName 'antigravity.old' }
6351
+ Rename-Item -LiteralPath '${dir}.new' -NewName 'antigravity'
6352
+ Write-Log ('installed ' + (Get-InstalledVersion) + ' in ${dir}')
6353
+ } catch {
6354
+ # Put the previous version back so existing hook entries keep working.
6355
+ if (-not (Test-Path -LiteralPath '${dir}') -and (Test-Path -LiteralPath '${dir}.old')) {
6356
+ Rename-Item -LiteralPath '${dir}.old' -NewName 'antigravity'
6357
+ }
6358
+ Remove-Tree '${dir}.new'
6359
+ Write-Log ('could not install the release, keeping the installed version: ' + $_.Exception.Message)
6360
+ }
6361
+ }
6362
+
6363
+ if (-not (Test-Path -LiteralPath '${dir}\\dist\\launcher.mjs')) {
6364
+ Write-Log 'not installed yet, so no hook entries were written'
6365
+ exit 1
6366
+ }
6367
+
6368
+ # 2. Add or repair the hook entry for every user on this device.
6369
+ ${userSteps}
6370
+ } finally {
6371
+ Remove-Tree $work
6372
+ }
6373
+ exit 0
6374
+ `;
6375
+ }
6376
+ function managedAntigravityMdmScript(collectorUrl, options, testing) {
6377
+ return options.os === "windows" ? windowsMdmScript(collectorUrl, options, testing) : posixMdmScript(collectorUrl, options, testing);
6378
+ }
6379
+ function antigravityMdmScriptFileName(pluginName, os) {
6380
+ assertPluginName(pluginName);
6381
+ return `${pluginName}-antigravity-${os}.${os === "windows" ? "ps1" : "sh"}`;
6382
+ }
4893
6383
 
4894
6384
  // src/install/managed-hooks-snippet.ts
4895
6385
  var CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS = CLAUDE_HOOK_TIMEOUT_SECONDS;
@@ -4967,8 +6457,14 @@ hooks = true
4967
6457
 
4968
6458
  ${hooks}`;
4969
6459
  }
6460
+ function managedAntigravityHooksJson(collectorUrl, options = {}) {
6461
+ return JSON.stringify(antigravityHooksEntry(collectorUrl, options), null, 2);
6462
+ }
4970
6463
  var COPILOT_ENTERPRISE_MARKETPLACE_REPO = "ORG/.github-private";
4971
6464
  function managedCopilotPluginSettings(collectorUrl, options) {
6465
+ const marketplaceName = options.marketplaceName ?? MARKETPLACE_NAME;
6466
+ const pluginName = options.pluginName ?? MARKETPLACE_PLUGIN_NAME;
6467
+ const ownerName = options.ownerName ?? "ev-ai";
4972
6468
  const mcpServer = {
4973
6469
  command: "node",
4974
6470
  args: [`\${PLUGIN_ROOT}/${PLUGIN_COLLECTOR_URL_MCP_SCRIPT}`, collectorUrl],
@@ -4976,40 +6472,49 @@ function managedCopilotPluginSettings(collectorUrl, options) {
4976
6472
  env: { COLLECTOR_URL: collectorUrl }
4977
6473
  };
4978
6474
  const marketplace = {
4979
- name: MARKETPLACE_NAME,
4980
- owner: { name: "ev-ai" },
6475
+ name: marketplaceName,
6476
+ owner: { name: ownerName },
4981
6477
  plugins: [
4982
6478
  {
4983
- name: MARKETPLACE_PLUGIN_NAME,
6479
+ name: pluginName,
4984
6480
  description: "Runtime telemetry hooks for GitHub Copilot (observe-only, fail-open).",
4985
6481
  source: {
4986
6482
  source: "github",
4987
6483
  repo: options.sourceRepo,
4988
6484
  path: MARKETPLACE_PLUGIN_DIRS.copilot
4989
6485
  },
4990
- mcpServers: { [MARKETPLACE_PLUGIN_NAME]: mcpServer }
6486
+ mcpServers: { [pluginName]: mcpServer }
4991
6487
  }
4992
6488
  ]
4993
6489
  };
4994
6490
  return {
4995
6491
  marketplaceJson: JSON.stringify(marketplace, null, 2),
4996
6492
  extraKnownMarketplaces: {
4997
- [MARKETPLACE_NAME]: {
6493
+ [marketplaceName]: {
4998
6494
  source: { source: "github", repo: COPILOT_ENTERPRISE_MARKETPLACE_REPO },
4999
6495
  autoUpdate: true
5000
6496
  }
5001
6497
  },
5002
- enabledPlugins: { [`${MARKETPLACE_PLUGIN_NAME}@${MARKETPLACE_NAME}`]: true },
5003
- mcpAllowlistEntry: { serverName: MARKETPLACE_PLUGIN_NAME }
6498
+ enabledPlugins: { [`${pluginName}@${marketplaceName}`]: true },
6499
+ mcpAllowlistEntry: { serverName: pluginName }
5004
6500
  };
5005
6501
  }
5006
6502
  // Annotate the CommonJS export names for ESM import in node:
5007
6503
  0 && (module.exports = {
6504
+ ANTIGRAVITY_HOOK_NAME,
6505
+ ANTIGRAVITY_MERGE_SCRIPT,
6506
+ ANTIGRAVITY_OPERATING_SYSTEMS,
5008
6507
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
5009
6508
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
5010
6509
  COPILOT_ENTERPRISE_MARKETPLACE_REPO,
5011
6510
  NPX_PACKAGE_SPEC,
6511
+ antigravityInstallDir,
6512
+ antigravityMdmScriptFileName,
6513
+ antigravityMergeCommand,
6514
+ antigravityReleaseAssets,
5012
6515
  buildCollectorUrl,
6516
+ managedAntigravityHooksJson,
6517
+ managedAntigravityMdmScript,
5013
6518
  managedCodexConfigTomlSnippet,
5014
6519
  managedCopilotPluginSettings,
5015
6520
  managedHooksSnippet,