@ev-ai/agent-hook 1.3.10 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -896,10 +896,16 @@ var require_dist = __commonJS({
896
896
  var SKILLS_DIR_MARKERS = ["/skills/", "/skills-cursor/"];
897
897
  var RULE_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/rules\/(.+)$/i;
898
898
  var COMMAND_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/(?:commands|prompts)\/(.+)$/i;
899
- var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex"];
899
+ var COPILOT_INSTRUCTION_PATH_RE = /(?:^|\/)\.(?:github|copilot)\/instructions\/(.+)$/i;
900
+ var COPILOT_PROMPT_PATH_RE = /(?:^|\/)\.github\/prompts\/(.+)$/i;
901
+ var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex", ".copilot"];
900
902
  var USER_CONFIG_ROOT_ALIASES = {
901
903
  ".claude.json": ".claude",
902
- ".agents": ".codex"
904
+ ".agents": ".codex",
905
+ // Copilot's project surfaces live under `.github/` (and VS Code's `.vscode/mcp.json`);
906
+ // its user ones under `~/.copilot/`.
907
+ ".github": ".copilot",
908
+ ".vscode": ".copilot"
903
909
  };
904
910
  exports2.ComponentKind = {
905
911
  SKILL: "SKILL",
@@ -957,10 +963,17 @@ var require_dist = __commonJS({
957
963
  return stripped.length > 0 ? stripped : null;
958
964
  }
959
965
  function nativeKeyForRulePath2(path) {
960
- return nativeKeyUnderLayoutRoot(path, RULE_PATH_RE, /\.(mdc|md|rules)$/i);
966
+ return nativeKeyUnderLayoutRoot(path, RULE_PATH_RE, /\.(mdc|md|rules)$/i) ?? copilotNativeKey(path, COPILOT_INSTRUCTION_PATH_RE, /\.instructions\.md$/i);
961
967
  }
962
968
  function nativeKeyForCommandPath2(path) {
963
- return nativeKeyUnderLayoutRoot(path, COMMAND_PATH_RE, /\.(md|mdc|toml)$/i);
969
+ return nativeKeyUnderLayoutRoot(path, COMMAND_PATH_RE, /\.(md|mdc|toml)$/i) ?? copilotNativeKey(path, COPILOT_PROMPT_PATH_RE, /\.prompt\.md$/i);
970
+ }
971
+ function copilotNativeKey(path, rootPattern, compoundExtension) {
972
+ if (!compoundExtension.test(path.split("#", 1)[0] ?? "")) {
973
+ return null;
974
+ }
975
+ const key = nativeKeyUnderLayoutRoot(path, rootPattern, compoundExtension);
976
+ return key === null ? null : key.split("/").pop() ?? null;
964
977
  }
965
978
  function field(value) {
966
979
  return `${Buffer.byteLength(value, "utf8")}:${value}`;
@@ -1104,9 +1117,11 @@ var managed_hooks_snippet_exports = {};
1104
1117
  __export(managed_hooks_snippet_exports, {
1105
1118
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1106
1119
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1120
+ COPILOT_ENTERPRISE_MARKETPLACE_REPO: () => COPILOT_ENTERPRISE_MARKETPLACE_REPO,
1107
1121
  NPX_PACKAGE_SPEC: () => NPX_PACKAGE_SPEC,
1108
1122
  buildCollectorUrl: () => buildCollectorUrl,
1109
1123
  managedCodexConfigTomlSnippet: () => managedCodexConfigTomlSnippet,
1124
+ managedCopilotPluginSettings: () => managedCopilotPluginSettings,
1110
1125
  managedHooksSnippet: () => managedHooksSnippet,
1111
1126
  renderCodexConfigToml: () => renderCodexConfigToml
1112
1127
  });
@@ -1197,6 +1212,55 @@ var RUNNER_LAYOUT = {
1197
1212
  mcpToml: [".codex/config.toml"]
1198
1213
  },
1199
1214
  homeOnly: { memory: [[".codex/AGENTS.override.md", ".codex/AGENTS.md"]], managed: "codex" }
1215
+ },
1216
+ // GitHub Copilot (CLI + VS Code). Mirrors REPO_GITHUB_COPILOT in
1217
+ // common/platform-component-ownership: project surfaces under `.github/`,
1218
+ // user ones under `~/.copilot/`. `dirs` cannot differ by scope, so both trees
1219
+ // are listed; the one that does not apply at a scope simply never exists.
1220
+ // `.github/hooks/*.json` is a directory of hook files, which `settings` (a
1221
+ // file list) cannot express — left for a later pass, like `plugins` / `managed`.
1222
+ //
1223
+ // Copilot also reads other runners' files: `.claude/skills` and
1224
+ // `.agents/skills` (Copilot CLI, and VS Code local sessions, which also read
1225
+ // `~/.claude/skills`), plus `AGENTS.md`, `CLAUDE.md` and `.claude/CLAUDE.md`
1226
+ // in the repo. Listing them here is what lets a Copilot-only machine report
1227
+ // them; `local-spec-owner.ts` attributes them to Copilot as well.
1228
+ // Sources: GitHub "Creating agent skills" and "Adding custom instructions"
1229
+ // for Copilot CLI, and VS Code "Agent skills" and "MCP servers".
1230
+ copilot: {
1231
+ shared: {
1232
+ skillRoots: [".claude/skills", ".agents/skills"],
1233
+ dirs: [
1234
+ { dir: ".github/agents", kind: "SUBAGENT", extensions: [".md"] },
1235
+ // Copilot prompt files are `<name>.prompt.md`, run as `/<name>`.
1236
+ { dir: ".github/prompts", kind: "COMMAND", extensions: [".prompt.md"] },
1237
+ // Copilot only loads `<name>.instructions.md` here; repo-syncer names the rule `<name>`.
1238
+ { dir: ".github/instructions", kind: "RULE", extensions: [".instructions.md"] },
1239
+ { dir: ".copilot/agents", kind: "SUBAGENT", extensions: [".md"] },
1240
+ // User-level instruction files (`~/.copilot/instructions/**`).
1241
+ { dir: ".copilot/instructions", kind: "RULE", extensions: [".instructions.md"] }
1242
+ ],
1243
+ memory: [],
1244
+ settings: []
1245
+ },
1246
+ homeOnly: {
1247
+ skillRoots: [".copilot/skills"],
1248
+ memory: [[".copilot/copilot-instructions.md"]],
1249
+ settings: [".copilot/config.json"],
1250
+ mcpJson: [".copilot/mcp-config.json"]
1251
+ },
1252
+ projectOnly: {
1253
+ skillRoots: [".github/skills"],
1254
+ memory: [
1255
+ [".github/copilot-instructions.md"],
1256
+ ["AGENTS.md"],
1257
+ ["CLAUDE.md"],
1258
+ [".claude/CLAUDE.md"]
1259
+ ],
1260
+ settings: [".github/copilot/settings.json"],
1261
+ // VS Code's workspace file keys servers under `servers`, not `mcpServers`.
1262
+ mcpJson: [".github/mcp.json", ".vscode/mcp.json"]
1263
+ }
1200
1264
  }
1201
1265
  };
1202
1266
  function concatOptional(shared, delta) {
@@ -1341,7 +1405,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1341
1405
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1342
1406
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1343
1407
  var GZIP_MIN_BYTES = 32 * 1024;
1344
- var PACKAGE_VERSION = "1.3.10";
1408
+ var PACKAGE_VERSION = "1.4.0";
1345
1409
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1346
1410
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1347
1411
 
@@ -1440,6 +1504,7 @@ var CURSOR_WIRED_HOOK_EVENTS = [
1440
1504
  ];
1441
1505
 
1442
1506
  // src/install/plugin-hooks.ts
1507
+ var PLUGIN_COLLECTOR_URL_MCP_SCRIPT = "scripts/collector-url-mcp.mjs";
1443
1508
  var CLAUDE_HOOK_TIMEOUT_SECONDS = 5;
1444
1509
  var CLAUDE_SESSION_START_TIMEOUT_SECONDS = 10;
1445
1510
  function buildClaudePluginHooks(command) {
@@ -1457,6 +1522,14 @@ function buildCursorPluginHooks(command) {
1457
1522
  function buildCodexPluginHooks(command) {
1458
1523
  return { hooks: desiredCodexHookGroups(command) };
1459
1524
  }
1525
+ var MARKETPLACE_PLUGIN_NAME = "ev-ai-agent-hooks";
1526
+ var MARKETPLACE_NAME = "ev-ai-marketplace";
1527
+ var MARKETPLACE_PLUGIN_DIRS = {
1528
+ claude: "plugins/claude",
1529
+ cursor: "plugins/cursor",
1530
+ codex: "plugins/codex",
1531
+ copilot: "plugins/copilot"
1532
+ };
1460
1533
 
1461
1534
  // src/install/managed-hooks-snippet.ts
1462
1535
  var CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS = CLAUDE_HOOK_TIMEOUT_SECONDS;
@@ -1534,13 +1607,51 @@ hooks = true
1534
1607
 
1535
1608
  ${hooks}`;
1536
1609
  }
1610
+ var COPILOT_ENTERPRISE_MARKETPLACE_REPO = "ORG/.github-private";
1611
+ function managedCopilotPluginSettings(collectorUrl, options) {
1612
+ const mcpServer = {
1613
+ command: "node",
1614
+ args: [`\${PLUGIN_ROOT}/${PLUGIN_COLLECTOR_URL_MCP_SCRIPT}`, collectorUrl],
1615
+ cwd: `\${PLUGIN_ROOT}`,
1616
+ env: { COLLECTOR_URL: collectorUrl }
1617
+ };
1618
+ const marketplace = {
1619
+ name: MARKETPLACE_NAME,
1620
+ owner: { name: "ev-ai" },
1621
+ plugins: [
1622
+ {
1623
+ name: MARKETPLACE_PLUGIN_NAME,
1624
+ description: "Runtime telemetry hooks for GitHub Copilot (observe-only, fail-open).",
1625
+ source: {
1626
+ source: "github",
1627
+ repo: options.sourceRepo,
1628
+ path: MARKETPLACE_PLUGIN_DIRS.copilot
1629
+ },
1630
+ mcpServers: { [MARKETPLACE_PLUGIN_NAME]: mcpServer }
1631
+ }
1632
+ ]
1633
+ };
1634
+ return {
1635
+ marketplaceJson: JSON.stringify(marketplace, null, 2),
1636
+ extraKnownMarketplaces: {
1637
+ [MARKETPLACE_NAME]: {
1638
+ source: { source: "github", repo: COPILOT_ENTERPRISE_MARKETPLACE_REPO },
1639
+ autoUpdate: true
1640
+ }
1641
+ },
1642
+ enabledPlugins: { [`${MARKETPLACE_PLUGIN_NAME}@${MARKETPLACE_NAME}`]: true },
1643
+ mcpAllowlistEntry: { serverName: MARKETPLACE_PLUGIN_NAME }
1644
+ };
1645
+ }
1537
1646
  // Annotate the CommonJS export names for ESM import in node:
1538
1647
  0 && (module.exports = {
1539
1648
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1540
1649
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1650
+ COPILOT_ENTERPRISE_MARKETPLACE_REPO,
1541
1651
  NPX_PACKAGE_SPEC,
1542
1652
  buildCollectorUrl,
1543
1653
  managedCodexConfigTomlSnippet,
1654
+ managedCopilotPluginSettings,
1544
1655
  managedHooksSnippet,
1545
1656
  renderCodexConfigToml
1546
1657
  });
@@ -1,9 +1,20 @@
1
- export type KnownRunner = 'claude' | 'cursor' | 'codex';
1
+ export type KnownRunner = 'claude' | 'cursor' | 'codex' | 'copilot';
2
2
  export const NPX_PACKAGE_SPEC: string;
3
3
  export function buildCollectorUrl(orgToken: string, baseUrl?: string): string;
4
4
  export function managedHooksSnippet(
5
- runner: KnownRunner,
5
+ runner: Exclude<KnownRunner, 'copilot'>,
6
6
  collectorUrl: string,
7
7
  packageSpec?: string,
8
8
  ): string;
9
9
  export function managedCodexConfigTomlSnippet(collectorUrl: string, packageSpec?: string): string;
10
+ export const COPILOT_ENTERPRISE_MARKETPLACE_REPO: string;
11
+ export interface CopilotPluginSettings {
12
+ marketplaceJson: string;
13
+ extraKnownMarketplaces: Record<string, unknown>;
14
+ enabledPlugins: Record<string, boolean>;
15
+ mcpAllowlistEntry: Record<string, unknown>;
16
+ }
17
+ export function managedCopilotPluginSettings(
18
+ collectorUrl: string,
19
+ options: { sourceRepo: string },
20
+ ): CopilotPluginSettings;
@@ -896,10 +896,16 @@ var require_dist = __commonJS({
896
896
  var SKILLS_DIR_MARKERS = ["/skills/", "/skills-cursor/"];
897
897
  var RULE_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/rules\/(.+)$/i;
898
898
  var COMMAND_PATH_RE = /(?:^|\/)\.(?:cursor|claude|codex)\/(?:commands|prompts)\/(.+)$/i;
899
- var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex"];
899
+ var COPILOT_INSTRUCTION_PATH_RE = /(?:^|\/)\.(?:github|copilot)\/instructions\/(.+)$/i;
900
+ var COPILOT_PROMPT_PATH_RE = /(?:^|\/)\.github\/prompts\/(.+)$/i;
901
+ var USER_CONFIG_ROOTS = [".cursor", ".claude", ".codex", ".copilot"];
900
902
  var USER_CONFIG_ROOT_ALIASES = {
901
903
  ".claude.json": ".claude",
902
- ".agents": ".codex"
904
+ ".agents": ".codex",
905
+ // Copilot's project surfaces live under `.github/` (and VS Code's `.vscode/mcp.json`);
906
+ // its user ones under `~/.copilot/`.
907
+ ".github": ".copilot",
908
+ ".vscode": ".copilot"
903
909
  };
904
910
  exports.ComponentKind = {
905
911
  SKILL: "SKILL",
@@ -957,10 +963,17 @@ var require_dist = __commonJS({
957
963
  return stripped.length > 0 ? stripped : null;
958
964
  }
959
965
  function nativeKeyForRulePath2(path) {
960
- return nativeKeyUnderLayoutRoot(path, RULE_PATH_RE, /\.(mdc|md|rules)$/i);
966
+ return nativeKeyUnderLayoutRoot(path, RULE_PATH_RE, /\.(mdc|md|rules)$/i) ?? copilotNativeKey(path, COPILOT_INSTRUCTION_PATH_RE, /\.instructions\.md$/i);
961
967
  }
962
968
  function nativeKeyForCommandPath2(path) {
963
- return nativeKeyUnderLayoutRoot(path, COMMAND_PATH_RE, /\.(md|mdc|toml)$/i);
969
+ return nativeKeyUnderLayoutRoot(path, COMMAND_PATH_RE, /\.(md|mdc|toml)$/i) ?? copilotNativeKey(path, COPILOT_PROMPT_PATH_RE, /\.prompt\.md$/i);
970
+ }
971
+ function copilotNativeKey(path, rootPattern, compoundExtension) {
972
+ if (!compoundExtension.test(path.split("#", 1)[0] ?? "")) {
973
+ return null;
974
+ }
975
+ const key = nativeKeyUnderLayoutRoot(path, rootPattern, compoundExtension);
976
+ return key === null ? null : key.split("/").pop() ?? null;
964
977
  }
965
978
  function field(value) {
966
979
  return `${Buffer.byteLength(value, "utf8")}:${value}`;
@@ -1184,6 +1197,55 @@ var RUNNER_LAYOUT = {
1184
1197
  mcpToml: [".codex/config.toml"]
1185
1198
  },
1186
1199
  homeOnly: { memory: [[".codex/AGENTS.override.md", ".codex/AGENTS.md"]], managed: "codex" }
1200
+ },
1201
+ // GitHub Copilot (CLI + VS Code). Mirrors REPO_GITHUB_COPILOT in
1202
+ // common/platform-component-ownership: project surfaces under `.github/`,
1203
+ // user ones under `~/.copilot/`. `dirs` cannot differ by scope, so both trees
1204
+ // are listed; the one that does not apply at a scope simply never exists.
1205
+ // `.github/hooks/*.json` is a directory of hook files, which `settings` (a
1206
+ // file list) cannot express — left for a later pass, like `plugins` / `managed`.
1207
+ //
1208
+ // Copilot also reads other runners' files: `.claude/skills` and
1209
+ // `.agents/skills` (Copilot CLI, and VS Code local sessions, which also read
1210
+ // `~/.claude/skills`), plus `AGENTS.md`, `CLAUDE.md` and `.claude/CLAUDE.md`
1211
+ // in the repo. Listing them here is what lets a Copilot-only machine report
1212
+ // them; `local-spec-owner.ts` attributes them to Copilot as well.
1213
+ // Sources: GitHub "Creating agent skills" and "Adding custom instructions"
1214
+ // for Copilot CLI, and VS Code "Agent skills" and "MCP servers".
1215
+ copilot: {
1216
+ shared: {
1217
+ skillRoots: [".claude/skills", ".agents/skills"],
1218
+ dirs: [
1219
+ { dir: ".github/agents", kind: "SUBAGENT", extensions: [".md"] },
1220
+ // Copilot prompt files are `<name>.prompt.md`, run as `/<name>`.
1221
+ { dir: ".github/prompts", kind: "COMMAND", extensions: [".prompt.md"] },
1222
+ // Copilot only loads `<name>.instructions.md` here; repo-syncer names the rule `<name>`.
1223
+ { dir: ".github/instructions", kind: "RULE", extensions: [".instructions.md"] },
1224
+ { dir: ".copilot/agents", kind: "SUBAGENT", extensions: [".md"] },
1225
+ // User-level instruction files (`~/.copilot/instructions/**`).
1226
+ { dir: ".copilot/instructions", kind: "RULE", extensions: [".instructions.md"] }
1227
+ ],
1228
+ memory: [],
1229
+ settings: []
1230
+ },
1231
+ homeOnly: {
1232
+ skillRoots: [".copilot/skills"],
1233
+ memory: [[".copilot/copilot-instructions.md"]],
1234
+ settings: [".copilot/config.json"],
1235
+ mcpJson: [".copilot/mcp-config.json"]
1236
+ },
1237
+ projectOnly: {
1238
+ skillRoots: [".github/skills"],
1239
+ memory: [
1240
+ [".github/copilot-instructions.md"],
1241
+ ["AGENTS.md"],
1242
+ ["CLAUDE.md"],
1243
+ [".claude/CLAUDE.md"]
1244
+ ],
1245
+ settings: [".github/copilot/settings.json"],
1246
+ // VS Code's workspace file keys servers under `servers`, not `mcpServers`.
1247
+ mcpJson: [".github/mcp.json", ".vscode/mcp.json"]
1248
+ }
1187
1249
  }
1188
1250
  };
1189
1251
  function concatOptional(shared, delta) {
@@ -1328,7 +1390,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1328
1390
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1329
1391
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1330
1392
  var GZIP_MIN_BYTES = 32 * 1024;
1331
- var PACKAGE_VERSION = "1.3.10";
1393
+ var PACKAGE_VERSION = "1.4.0";
1332
1394
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1333
1395
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1334
1396
 
@@ -1427,6 +1489,7 @@ var CURSOR_WIRED_HOOK_EVENTS = [
1427
1489
  ];
1428
1490
 
1429
1491
  // src/install/plugin-hooks.ts
1492
+ var PLUGIN_COLLECTOR_URL_MCP_SCRIPT = "scripts/collector-url-mcp.mjs";
1430
1493
  var CLAUDE_HOOK_TIMEOUT_SECONDS = 5;
1431
1494
  var CLAUDE_SESSION_START_TIMEOUT_SECONDS = 10;
1432
1495
  function buildClaudePluginHooks(command) {
@@ -1444,6 +1507,14 @@ function buildCursorPluginHooks(command) {
1444
1507
  function buildCodexPluginHooks(command) {
1445
1508
  return { hooks: desiredCodexHookGroups(command) };
1446
1509
  }
1510
+ var MARKETPLACE_PLUGIN_NAME = "ev-ai-agent-hooks";
1511
+ var MARKETPLACE_NAME = "ev-ai-marketplace";
1512
+ var MARKETPLACE_PLUGIN_DIRS = {
1513
+ claude: "plugins/claude",
1514
+ cursor: "plugins/cursor",
1515
+ codex: "plugins/codex",
1516
+ copilot: "plugins/copilot"
1517
+ };
1447
1518
 
1448
1519
  // src/install/managed-hooks-snippet.ts
1449
1520
  var CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS = CLAUDE_HOOK_TIMEOUT_SECONDS;
@@ -1521,12 +1592,50 @@ hooks = true
1521
1592
 
1522
1593
  ${hooks}`;
1523
1594
  }
1595
+ var COPILOT_ENTERPRISE_MARKETPLACE_REPO = "ORG/.github-private";
1596
+ function managedCopilotPluginSettings(collectorUrl, options) {
1597
+ const mcpServer = {
1598
+ command: "node",
1599
+ args: [`\${PLUGIN_ROOT}/${PLUGIN_COLLECTOR_URL_MCP_SCRIPT}`, collectorUrl],
1600
+ cwd: `\${PLUGIN_ROOT}`,
1601
+ env: { COLLECTOR_URL: collectorUrl }
1602
+ };
1603
+ const marketplace = {
1604
+ name: MARKETPLACE_NAME,
1605
+ owner: { name: "ev-ai" },
1606
+ plugins: [
1607
+ {
1608
+ name: MARKETPLACE_PLUGIN_NAME,
1609
+ description: "Runtime telemetry hooks for GitHub Copilot (observe-only, fail-open).",
1610
+ source: {
1611
+ source: "github",
1612
+ repo: options.sourceRepo,
1613
+ path: MARKETPLACE_PLUGIN_DIRS.copilot
1614
+ },
1615
+ mcpServers: { [MARKETPLACE_PLUGIN_NAME]: mcpServer }
1616
+ }
1617
+ ]
1618
+ };
1619
+ return {
1620
+ marketplaceJson: JSON.stringify(marketplace, null, 2),
1621
+ extraKnownMarketplaces: {
1622
+ [MARKETPLACE_NAME]: {
1623
+ source: { source: "github", repo: COPILOT_ENTERPRISE_MARKETPLACE_REPO },
1624
+ autoUpdate: true
1625
+ }
1626
+ },
1627
+ enabledPlugins: { [`${MARKETPLACE_PLUGIN_NAME}@${MARKETPLACE_NAME}`]: true },
1628
+ mcpAllowlistEntry: { serverName: MARKETPLACE_PLUGIN_NAME }
1629
+ };
1630
+ }
1524
1631
  export {
1525
1632
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1526
1633
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1634
+ COPILOT_ENTERPRISE_MARKETPLACE_REPO,
1527
1635
  NPX_PACKAGE_SPEC,
1528
1636
  buildCollectorUrl,
1529
1637
  managedCodexConfigTomlSnippet,
1638
+ managedCopilotPluginSettings,
1530
1639
  managedHooksSnippet,
1531
1640
  renderCodexConfigToml
1532
1641
  };
@@ -33,13 +33,14 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
33
33
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
34
34
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
35
35
  var GZIP_MIN_BYTES = 32 * 1024;
36
- var PACKAGE_VERSION = "1.3.10";
36
+ var PACKAGE_VERSION = "1.4.0";
37
37
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
38
38
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
39
39
  var PLUGIN_ROOT_VARIABLE = {
40
40
  claude: "CLAUDE_PLUGIN_ROOT",
41
41
  cursor: "CURSOR_PLUGIN_ROOT",
42
- codex: "PLUGIN_ROOT"
42
+ codex: "PLUGIN_ROOT",
43
+ copilot: "PLUGIN_ROOT"
43
44
  };
44
45
 
45
46
  // src/collectors/sys.ts
@@ -120,6 +121,16 @@ function desiredCodexHookGroups(command) {
120
121
  SubagentStop: [commandHook()]
121
122
  };
122
123
  }
124
+ var COPILOT_WIRED_HOOK_EVENTS = [
125
+ "SessionStart",
126
+ "UserPromptSubmit",
127
+ "PreToolUse",
128
+ "PostToolUse",
129
+ "SubagentStart",
130
+ "SubagentStop",
131
+ "Stop",
132
+ "SessionEnd"
133
+ ];
123
134
  var CURSOR_WIRED_HOOK_EVENTS = [
124
135
  "sessionStart",
125
136
  "beforeSubmitPrompt",
@@ -137,6 +148,8 @@ var CURSOR_WIRED_HOOK_EVENTS = [
137
148
  // src/install/plugin-hooks.ts
138
149
  var PLUGIN_HOOK_ENTRY = "dist/launcher.mjs";
139
150
  var PLUGIN_PACKAGE_FILE = "package.json";
151
+ var PLUGIN_COLLECTOR_URL_MCP_SCRIPT = "scripts/collector-url-mcp.mjs";
152
+ var PLUGIN_RUN_NODE_SCRIPT = "scripts/run-node.cmd";
140
153
  function pluginLauncherPosixCommand(runner) {
141
154
  return `node "\${${PLUGIN_ROOT_VARIABLE[runner]}}/${PLUGIN_HOOK_ENTRY}" --runner ${runner} ; exit 0`;
142
155
  }
@@ -145,7 +158,7 @@ function claudePluginCommand() {
145
158
  }
146
159
  function cursorPluginCommand() {
147
160
  const root = `\${${PLUGIN_ROOT_VARIABLE.cursor}}`;
148
- return `"${root}/scripts/run-node.cmd" "${root}/${PLUGIN_HOOK_ENTRY}" --runner cursor ; exit 0`;
161
+ return `"${root}/${PLUGIN_RUN_NODE_SCRIPT}" "${root}/${PLUGIN_HOOK_ENTRY}" --runner cursor ; exit 0`;
149
162
  }
150
163
  function pluginLauncherCodexWindowsCommand() {
151
164
  const variable = PLUGIN_ROOT_VARIABLE.codex;
@@ -157,6 +170,16 @@ function pluginLauncherCodexCommand() {
157
170
  commandWindows: pluginLauncherCodexWindowsCommand()
158
171
  };
159
172
  }
173
+ function toWindowsPath(relativePath) {
174
+ return relativePath.replaceAll("/", "\\");
175
+ }
176
+ function copilotPluginCommand() {
177
+ const variable = PLUGIN_ROOT_VARIABLE.copilot;
178
+ return {
179
+ posix: pluginLauncherPosixCommand("copilot"),
180
+ powershell: `node "\${${variable}}\\${toWindowsPath(PLUGIN_HOOK_ENTRY)}" --runner copilot; exit 0`
181
+ };
182
+ }
160
183
  var CLAUDE_HOOK_TIMEOUT_SECONDS = 5;
161
184
  var CLAUDE_SESSION_START_TIMEOUT_SECONDS = 10;
162
185
  function buildClaudePluginHooks(command) {
@@ -190,6 +213,21 @@ function buildCursorPluginHooks(command) {
190
213
  }
191
214
  return { version: 1, hooks };
192
215
  }
216
+ function buildCopilotPluginHooks(command) {
217
+ const hooks = {};
218
+ for (const eventName of COPILOT_WIRED_HOOK_EVENTS) {
219
+ const timeout = isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS;
220
+ hooks[eventName] = [
221
+ {
222
+ type: "command",
223
+ bash: commandForEvent(eventName, command.posix),
224
+ powershell: commandForEvent(eventName, command.powershell),
225
+ timeoutSec: timeout
226
+ }
227
+ ];
228
+ }
229
+ return { version: 1, hooks };
230
+ }
193
231
  function buildCodexPluginHooks(command) {
194
232
  return { hooks: desiredCodexHookGroups(command) };
195
233
  }
@@ -198,13 +236,15 @@ var MARKETPLACE_NAME = "ev-ai-marketplace";
198
236
  var MARKETPLACE_PLUGIN_DIRS = {
199
237
  claude: "plugins/claude",
200
238
  cursor: "plugins/cursor",
201
- codex: "plugins/codex"
239
+ codex: "plugins/codex",
240
+ copilot: "plugins/copilot"
202
241
  };
203
242
  function marketplacePluginHookPaths(marketplaceRoot) {
204
243
  return {
205
244
  claude: join(marketplaceRoot, MARKETPLACE_PLUGIN_DIRS.claude, "hooks/hooks.json"),
206
245
  cursor: join(marketplaceRoot, MARKETPLACE_PLUGIN_DIRS.cursor, "hooks/hooks.json"),
207
- codex: join(marketplaceRoot, MARKETPLACE_PLUGIN_DIRS.codex, "hooks/hooks.json")
246
+ codex: join(marketplaceRoot, MARKETPLACE_PLUGIN_DIRS.codex, "hooks/hooks.json"),
247
+ copilot: join(marketplaceRoot, MARKETPLACE_PLUGIN_DIRS.copilot, "hooks/hooks.json")
208
248
  };
209
249
  }
210
250
  var PLUGIN_PAYLOAD_FILES = [
@@ -222,6 +262,7 @@ function writeMarketplacePluginHooks(marketplaceRoot) {
222
262
  writeJson(paths.claude, buildClaudeMarketplacePluginHooks());
223
263
  writeJson(paths.cursor, buildCursorPluginHooks(cursorPluginCommand()));
224
264
  writeJson(paths.codex, buildCodexPluginHooks(pluginLauncherCodexCommand()));
265
+ writeJson(paths.copilot, buildCopilotPluginHooks(copilotPluginCommand()));
225
266
  return paths;
226
267
  }
227
268
  function pluginPackageManifest(packageRoot) {
@@ -257,7 +298,8 @@ function expectedMarketplacePluginHooks() {
257
298
  return {
258
299
  claude: buildClaudeMarketplacePluginHooks(),
259
300
  cursor: buildCursorPluginHooks(cursorPluginCommand()),
260
- codex: buildCodexPluginHooks(pluginLauncherCodexCommand())
301
+ codex: buildCodexPluginHooks(pluginLauncherCodexCommand()),
302
+ copilot: buildCopilotPluginHooks(copilotPluginCommand())
261
303
  };
262
304
  }
263
305
  export {
@@ -266,14 +308,18 @@ export {
266
308
  MARKETPLACE_NAME,
267
309
  MARKETPLACE_PLUGIN_DIRS,
268
310
  MARKETPLACE_PLUGIN_NAME,
311
+ PLUGIN_COLLECTOR_URL_MCP_SCRIPT,
269
312
  PLUGIN_HOOK_ENTRY,
270
313
  PLUGIN_PACKAGE_FILE,
271
314
  PLUGIN_PAYLOAD_FILES,
315
+ PLUGIN_RUN_NODE_SCRIPT,
272
316
  buildClaudeMarketplacePluginHooks,
273
317
  buildClaudePluginHooks,
274
318
  buildCodexPluginHooks,
319
+ buildCopilotPluginHooks,
275
320
  buildCursorPluginHooks,
276
321
  claudePluginCommand,
322
+ copilotPluginCommand,
277
323
  copyMarketplacePluginPayload,
278
324
  cursorPluginCommand,
279
325
  expectedMarketplacePluginHooks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ev-ai/agent-hook",
3
- "version": "1.3.10",
3
+ "version": "1.4.0",
4
4
  "description": "Cross-runner runtime telemetry hook for Claude Code, Cursor, and Codex",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "evAi": {
28
28
  "launcherProtocol": 1,
29
29
  "minLauncherProtocol": 1,
30
- "launcherRevision": 7
30
+ "launcherRevision": 8
31
31
  },
32
32
  "engines": {
33
33
  "node": ">=18"