@pushary/agent-hooks 1.9.9 → 1.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/dist/bin/pushary-bell-hook.js +25 -21
  4. package/dist/bin/pushary-bell.js +9 -9
  5. package/dist/bin/pushary-claude.js +31 -34
  6. package/dist/bin/pushary-clean.js +108 -34
  7. package/dist/bin/pushary-codex-bridge.js +20 -22
  8. package/dist/bin/pushary-codex-hook.js +33 -36
  9. package/dist/bin/pushary-codex.js +12 -14
  10. package/dist/bin/pushary-connect.js +27 -29
  11. package/dist/bin/pushary-cowork.js +5 -5
  12. package/dist/bin/pushary-daemon.js +31 -33
  13. package/dist/bin/pushary-disconnect.js +29 -29
  14. package/dist/bin/pushary-doctor.js +60 -50
  15. package/dist/bin/pushary-elicitation-hook.js +26 -26
  16. package/dist/bin/pushary-gemini-bridge.js +13 -13
  17. package/dist/bin/pushary-gemini-hook.js +30 -33
  18. package/dist/bin/pushary-hook.js +31 -33
  19. package/dist/bin/pushary-login.js +12 -12
  20. package/dist/bin/pushary-logout.js +18 -78
  21. package/dist/bin/pushary-mcp.js +9 -9
  22. package/dist/bin/pushary-mode.js +12 -12
  23. package/dist/bin/pushary-notification-hook.js +24 -26
  24. package/dist/bin/pushary-opencode-hook.js +29 -32
  25. package/dist/bin/pushary-permission-denied-hook.js +29 -31
  26. package/dist/bin/pushary-permission-hook.js +28 -30
  27. package/dist/bin/pushary-post-hook.js +24 -26
  28. package/dist/bin/pushary-prompt-hook.js +24 -26
  29. package/dist/bin/pushary-session-end-hook.js +24 -26
  30. package/dist/bin/pushary-session-start-hook.js +28 -30
  31. package/dist/bin/pushary-setup.js +62 -46
  32. package/dist/bin/pushary-stats.js +5 -5
  33. package/dist/bin/pushary-status.js +30 -32
  34. package/dist/bin/pushary-stop-hook.js +24 -26
  35. package/dist/bin/pushary-stopfailure-hook.js +24 -26
  36. package/dist/bin/pushary-suggestions.js +12 -12
  37. package/dist/bin/pushary-transcript-register.js +17 -17
  38. package/dist/bin/pushary-transcripts.js +7 -7
  39. package/dist/bin/pushary-upgrade.js +30 -32
  40. package/dist/bin/pushary-wait.js +12 -12
  41. package/dist/bin/pushary.js +6 -6
  42. package/dist/{chunk-IIVZZMSO.js → chunk-2AQ4VZSA.js} +1 -1
  43. package/dist/{chunk-APP43AW7.js → chunk-2GG77ADC.js} +1 -1
  44. package/dist/{chunk-KOWFRUIT.js → chunk-2NAQRPZQ.js} +1 -1
  45. package/dist/{chunk-Z23ZBYDW.js → chunk-4FWWHCYM.js} +4 -4
  46. package/dist/{chunk-ZGADIZDS.js → chunk-4HR2ICME.js} +1 -1
  47. package/dist/{chunk-E5HOHIUV.js → chunk-4RENRBSB.js} +4 -4
  48. package/dist/{chunk-RQ32ADJP.js → chunk-5WAYSUWV.js} +2 -2
  49. package/dist/{chunk-BYLKCZ2G.js → chunk-7RWQZQV2.js} +14 -14
  50. package/dist/{chunk-KQFTBQ66.js → chunk-A6J5Z2HO.js} +514 -313
  51. package/dist/{chunk-EIAEUG7G.js → chunk-AIWZRRSK.js} +2 -2
  52. package/dist/{chunk-H5T27W7M.js → chunk-BDRXDO25.js} +2 -2
  53. package/dist/{chunk-UAP5DS6P.js → chunk-BMP2BLIR.js} +3 -3
  54. package/dist/{chunk-VIIHC42X.js → chunk-BZI7EBTB.js} +1 -1
  55. package/dist/{chunk-TO3PS646.js → chunk-C6QM5SJR.js} +2 -2
  56. package/dist/{chunk-BNSKVIAW.js → chunk-CBDJ2X5P.js} +2 -2
  57. package/dist/{chunk-COQ64C4F.js → chunk-CHDAH4HP.js} +8 -8
  58. package/dist/{chunk-M3STIAGU.js → chunk-CZYMYM7X.js} +3 -3
  59. package/dist/{chunk-MD4SVNT6.js → chunk-E6YQW43K.js} +1 -1
  60. package/dist/{chunk-5N5L6DNN.js → chunk-EJVYEOKC.js} +3 -3
  61. package/dist/{chunk-AI7RMFVV.js → chunk-ERXY2SIW.js} +19 -16
  62. package/dist/{chunk-IRHABAQT.js → chunk-FJCOOFT7.js} +1 -1
  63. package/dist/{chunk-NGKUXZID.js → chunk-GA4J6YFN.js} +2 -2
  64. package/dist/{chunk-WRPYCIV2.js → chunk-GUNZHSTL.js} +136 -8
  65. package/dist/{chunk-T6ZN4TEF.js → chunk-HX5TI6DP.js} +1 -1
  66. package/dist/{chunk-QRXPWW3M.js → chunk-I4I4UH62.js} +3 -3
  67. package/dist/{chunk-6AYSKVLL.js → chunk-KBN3UP2R.js} +3 -3
  68. package/dist/{chunk-UF6RBP5V.js → chunk-KEV2MOJH.js} +46 -21
  69. package/dist/{chunk-BZLHTMT6.js → chunk-KIVFWGG6.js} +12 -10
  70. package/dist/{chunk-HBWYMRR5.js → chunk-LBAMPNDM.js} +5 -4
  71. package/dist/{chunk-LENBKYRB.js → chunk-LUHNNZSH.js} +2 -2
  72. package/dist/{chunk-R5RIVOPL.js → chunk-LX6EWNRK.js} +15 -3
  73. package/dist/{chunk-5DCDQ5VW.js → chunk-M54ATCOZ.js} +2 -2
  74. package/dist/{chunk-6W5M3MSE.js → chunk-MHHXR7DT.js} +4 -4
  75. package/dist/{chunk-NUVGDBZC.js → chunk-MITMDERZ.js} +1 -1
  76. package/dist/{chunk-QTIUJZRX.js → chunk-MJLTABWF.js} +3 -3
  77. package/dist/{chunk-QIOIO7VN.js → chunk-MX3LPP3K.js} +6 -6
  78. package/dist/{chunk-F7R3SZ4Q.js → chunk-N6GEI3PK.js} +2 -2
  79. package/dist/{chunk-462EQA6K.js → chunk-N7HXP4PZ.js} +1 -1
  80. package/dist/{chunk-Q6C6ILUS.js → chunk-OKSU74QH.js} +2 -2
  81. package/dist/{chunk-AZOKPWVI.js → chunk-P2EJN7UB.js} +1 -1
  82. package/dist/{chunk-OAYWO5NP.js → chunk-P7N7FJ7W.js} +1 -1
  83. package/dist/{chunk-DP3WX7FW.js → chunk-PRJNUNCV.js} +2 -2
  84. package/dist/{chunk-SZ4Q6ZVS.js → chunk-PTGUJZSD.js} +5 -5
  85. package/dist/chunk-SB2GN6OP.js +71 -0
  86. package/dist/{chunk-DCCSULXK.js → chunk-STUJXZC2.js} +4 -4
  87. package/dist/{chunk-MLGIVVSG.js → chunk-TVVUJTUW.js} +1 -1
  88. package/dist/{chunk-5OP5MQI7.js → chunk-V6IW5WMK.js} +1 -1
  89. package/dist/{chunk-5RGA636G.js → chunk-VOP5U2VX.js} +145 -9
  90. package/dist/{chunk-K545B734.js → chunk-WCELLK4P.js} +2 -2
  91. package/dist/{chunk-VHPFNLRS.js → chunk-WHRYW4P2.js} +5 -5
  92. package/dist/{chunk-G7RIDXAT.js → chunk-XYCTS3WP.js} +1 -1
  93. package/dist/{chunk-6EBGOHDJ.js → chunk-YETKAI5Q.js} +6 -6
  94. package/dist/{chunk-REU2VQPH.js → chunk-Z4AOR6RZ.js} +15 -13
  95. package/dist/{chunk-B5NMSP3V.js → chunk-ZTSMQYST.js} +3 -5
  96. package/dist/{global-upgrade-H272QOGD.js → global-upgrade-VT2JS7DR.js} +6 -6
  97. package/dist/{paths-HMVOTFUN.js → paths-WRBEUNEY.js} +2 -2
  98. package/dist/{reapply-Q5NHDTVU.js → reapply-BCR6U7HO.js} +20 -22
  99. package/dist/src/index.js +19 -21
  100. package/dist/{upgrade-lock-L3GHFIRW.js → upgrade-lock-VRYMTPZQ.js} +3 -3
  101. package/package.json +1 -1
  102. package/dist/chunk-N6IOSZOE.js +0 -185
  103. package/dist/chunk-UPIZSCYD.js +0 -142
@@ -3,17 +3,17 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-M3STIAGU.js";
6
+ } from "./chunk-CZYMYM7X.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  parseApplyPatchFiles
10
- } from "./chunk-KQFTBQ66.js";
10
+ } from "./chunk-A6J5Z2HO.js";
11
11
  import {
12
12
  guardBinary,
13
13
  holdBudgetOf,
14
14
  isProtectedByScope,
15
15
  registerHookEntry
16
- } from "./chunk-Z23ZBYDW.js";
16
+ } from "./chunk-4FWWHCYM.js";
17
17
  import {
18
18
  HOOK_LOCATOR_BINARY,
19
19
  PHONE_ANSWERED_TOOLS,
@@ -21,7 +21,7 @@ import {
21
21
  hookCompatibleProfileBySource,
22
22
  toToolLookup,
23
23
  withHookHoldBudget
24
- } from "./chunk-5RGA636G.js";
24
+ } from "./chunk-VOP5U2VX.js";
25
25
 
26
26
  // src/claude-config.ts
27
27
  import { join } from "path";
@@ -197,7 +197,10 @@ import { homedir } from "os";
197
197
  import { isAbsolute, join as join2, resolve } from "path";
198
198
  var AGENT_FLAG = "--agent";
199
199
  var SOURCE_FLAG = "--source";
200
+ var EVENT_FLAG = "--event";
200
201
  var agentArgument = (profile) => `${AGENT_FLAG}=${profile.agentType}`;
202
+ var eventArgument = (event) => `${EVENT_FLAG}=${event}`;
203
+ var payloadNamesItsEvent = (profile) => profile.payload === "claude";
201
204
  var profileFromArgv = (argv) => {
202
205
  const named = namedAgent(argv);
203
206
  if (named !== void 0) return hookCompatibleProfile(named);
@@ -212,6 +215,12 @@ var namedAgent = (argv) => {
212
215
  const prefix = `${AGENT_FLAG}=`;
213
216
  return argv.find((argument) => argument.startsWith(prefix))?.slice(prefix.length);
214
217
  };
218
+ var namedEvent = (argv) => {
219
+ const inline = argv.find((argument) => argument.startsWith(`${EVENT_FLAG}=`));
220
+ if (inline) return inline.slice(EVENT_FLAG.length + 1);
221
+ const index = argv.indexOf(EVENT_FLAG);
222
+ return index === -1 ? void 0 : argv[index + 1];
223
+ };
215
224
  var namedSource = (argv) => {
216
225
  const inline = argv.find((argument) => argument.startsWith(`${SOURCE_FLAG}=`));
217
226
  if (inline) return inline.slice(SOURCE_FLAG.length + 1);
@@ -264,12 +273,17 @@ var pruneEmptyMap = (config, keyPath) => {
264
273
  return true;
265
274
  };
266
275
  var aliasesFor = (profile, canonical) => Object.entries(profile.toolAliases).flatMap(([agentName, target]) => target === canonical ? [agentName] : []);
267
- var carriesPhoneAnswer = (profile, canonical) => profile.wire === "legacy_decision" && PHONE_ANSWERED_TOOLS.has(canonical);
276
+ var carriesPhoneAnswer = (profile, canonical) => profile.wire !== "permission_decision" && PHONE_ANSWERED_TOOLS.has(canonical);
268
277
  var translateMatcher = (profile, matcher) => {
269
278
  const spellings = matcher.split("|").filter((canonical) => !carriesPhoneAnswer(profile, canonical)).flatMap((canonical) => [canonical, ...aliasesFor(profile, canonical)]);
270
279
  return [.../* @__PURE__ */ new Set([...spellings, ...profile.extraMatchers])].join("|");
271
280
  };
272
281
  var TOOL_MATCHED_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse"]);
282
+ var isPusharyHandler = (entry2, scope) => {
283
+ const record = asRecord2(entry2);
284
+ return record !== void 0 && !Array.isArray(record.hooks) && isPusharyHook({ hooks: [record] }, scope);
285
+ };
286
+ var isPusharyCompatibleEntry = (entry2, scope) => isPusharyHook(entry2, scope) || isPusharyHandler(entry2, scope);
273
287
  var withoutMatcher = ({ matcher, ...hook }) => hook;
274
288
  var compatibleHookEvents = (profile) => CLAUDE_HOOK_EVENTS.filter((hook) => profile.events.includes(hook.event)).map((hook) => {
275
289
  if (!hook.matcher) return hook;
@@ -306,17 +320,20 @@ var addCompatibleToolPermissions = (config) => {
306
320
  addPusharyToolPermissions(config);
307
321
  return WRITTEN;
308
322
  };
309
- var entryFor = (profile, definition, resolve2) => ({
310
- ...definition.matcher ? { matcher: definition.matcher } : {},
311
- hooks: [{
312
- type: "command",
313
- command: withHookHoldBudget(
314
- `${resolve2(definition.binary)} ${agentArgument(profile)}`,
315
- holdBudgetOf(definition)
316
- ),
317
- timeout: definition.timeout
318
- }]
319
- });
323
+ var commandFor = (profile, definition, resolve2) => {
324
+ const named = `${resolve2(definition.binary)} ${agentArgument(profile)}`;
325
+ const command = payloadNamesItsEvent(profile) ? named : `${named} ${eventArgument(definition.event)}`;
326
+ return withHookHoldBudget(command, holdBudgetOf(definition));
327
+ };
328
+ var writesBareHandler = (profile, definition) => profile.nonToolEntries === "handler" && !TOOL_MATCHED_EVENTS.has(definition.event);
329
+ var entryFor = (profile, definition, resolve2) => {
330
+ const handler = { type: "command", command: commandFor(profile, definition, resolve2), timeout: definition.timeout };
331
+ if (writesBareHandler(profile, definition)) return handler;
332
+ return {
333
+ ...definition.matcher ? { matcher: definition.matcher } : {},
334
+ hooks: [handler]
335
+ };
336
+ };
320
337
  var addCompatibleHooks = (config, profile, binDir) => {
321
338
  const conflictAt = hooksShapeConflict(config, profile);
322
339
  if (conflictAt) return { ok: false, conflictAt };
@@ -327,10 +344,10 @@ var addCompatibleHooks = (config, profile, binDir) => {
327
344
  const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
328
345
  const definition = supported.get(known.event);
329
346
  if (definition) {
330
- hooks[known.event] = registerHookEntry(current, isPusharyHook, entryFor(profile, definition, resolve2));
347
+ hooks[known.event] = registerHookEntry(current, isPusharyCompatibleEntry, entryFor(profile, definition, resolve2));
331
348
  continue;
332
349
  }
333
- const others = current.filter((item) => !isPusharyHook(item));
350
+ const others = current.filter((item) => !isPusharyCompatibleEntry(item));
334
351
  if (others.length > 0) hooks[known.event] = others;
335
352
  else delete hooks[known.event];
336
353
  }
@@ -343,7 +360,7 @@ var removeCompatibleHooks = (config, profile, scope) => {
343
360
  for (const { event } of CLAUDE_HOOK_EVENTS) {
344
361
  const entries = hooks[event];
345
362
  if (!Array.isArray(entries)) continue;
346
- const kept = entries.filter((entry2) => !isPusharyHook(entry2, scope));
363
+ const kept = entries.filter((entry2) => !isPusharyCompatibleEntry(entry2, scope));
347
364
  if (kept.length === entries.length) continue;
348
365
  if (kept.length === 0) delete hooks[event];
349
366
  else hooks[event] = kept;
@@ -357,14 +374,14 @@ var hasCompatibleHooks = (config, profile) => {
357
374
  if (!hooks) return false;
358
375
  return compatibleHookEvents(profile).some(({ event }) => {
359
376
  const entries = hooks[event];
360
- return Array.isArray(entries) && entries.some((entry2) => isPusharyHook(entry2));
377
+ return Array.isArray(entries) && entries.some((entry2) => isPusharyCompatibleEntry(entry2));
361
378
  });
362
379
  };
363
380
  var missingCompatibleHookEvents = (config, profile) => {
364
381
  const hooks = findMap(config, profile.hooksKeyPath);
365
382
  return compatibleHookEvents(profile).filter(({ event }) => {
366
383
  const entries = hooks?.[event];
367
- return !Array.isArray(entries) || !entries.some((entry2) => isPusharyHook(entry2));
384
+ return !Array.isArray(entries) || !entries.some((entry2) => isPusharyCompatibleEntry(entry2));
368
385
  }).map(({ event }) => event);
369
386
  };
370
387
  var compatiblePermissionRuleFile = (profile, home) => profile.permissionRuleFile ? underHome(profile.permissionRuleFile, home) : null;
@@ -374,6 +391,13 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
374
391
  addGeminiMcpServer(config, apiKey);
375
392
  return;
376
393
  }
394
+ if (profile.mcp.shape === "antigravity_http") {
395
+ ensureRecord2(config, "mcpServers").pushary = {
396
+ serverUrl: PUSHARY_MCP_URL,
397
+ headers: { Authorization: `Bearer ${apiKey}` }
398
+ };
399
+ return;
400
+ }
377
401
  addClaudeMcpServer(config, apiKey);
378
402
  if (!profile.mcp.trusted) return;
379
403
  const server = asRecord2(asRecord2(config.mcpServers)?.pushary);
@@ -397,6 +421,7 @@ export {
397
421
  removePusharySettings,
398
422
  profileFromArgv,
399
423
  activeIdentity,
424
+ namedEvent,
400
425
  activeHookSource,
401
426
  normalizeToolCall,
402
427
  compatibleConfigFile,
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  compatibleConfigFile
3
- } from "./chunk-UF6RBP5V.js";
3
+ } from "./chunk-KEV2MOJH.js";
4
4
  import {
5
5
  hookOwnerOf,
6
6
  hookOwnerOfCommands,
7
7
  liveBridgeProbe,
8
8
  resolveBridgeStub
9
- } from "./chunk-BYLKCZ2G.js";
9
+ } from "./chunk-7RWQZQV2.js";
10
+ import {
11
+ AGENT_CHOICES
12
+ } from "./chunk-4HR2ICME.js";
10
13
  import {
11
14
  claudeSettings,
12
15
  codexHooksJson,
@@ -15,7 +18,7 @@ import {
15
18
  guardedArgv,
16
19
  pusharyDir,
17
20
  vscodePluginDir
18
- } from "./chunk-Z23ZBYDW.js";
21
+ } from "./chunk-4FWWHCYM.js";
19
22
  import {
20
23
  readJsonSafe
21
24
  } from "./chunk-T7E75EKA.js";
@@ -25,7 +28,7 @@ import {
25
28
  HOOK_LOCATOR_BINARY,
26
29
  OPENCODE_APPROVAL_EVENT,
27
30
  hookCompatibleProfile
28
- } from "./chunk-5RGA636G.js";
31
+ } from "./chunk-VOP5U2VX.js";
29
32
 
30
33
  // src/opencode-plugin.ts
31
34
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -416,6 +419,7 @@ var HOOK_FILES = {
416
419
  ...COMPATIBLE_HOOK_FILES
417
420
  };
418
421
  var agentHookFile = (agent) => HOOK_FILES[agent]?.() ?? null;
422
+ var agentHooksKeyPath = (agent) => hookCompatibleProfile(agent)?.hooksKeyPath;
419
423
  var readTextOrNull = (path) => {
420
424
  try {
421
425
  return readFileSync2(path, "utf-8");
@@ -432,13 +436,9 @@ var agentHookOwner = (agent, appAvailable) => {
432
436
  const file = agentHookFile(agent);
433
437
  if (!file) return "none";
434
438
  const document = readJsonSafe(file);
435
- const profile = hookCompatibleProfile(agent);
436
- return hookOwnerOf(
437
- document.kind === "ok" ? document.value : null,
438
- appAvailable,
439
- profile ? profile.hooksKeyPath : void 0
440
- );
439
+ return hookOwnerOf(document.kind === "ok" ? document.value : null, appAvailable, agentHooksKeyPath(agent));
441
440
  };
441
+ var cliOwnsAnyAgentHooks = (appAvailable) => AGENT_CHOICES.some((agent) => agentHookOwner(agent, appAvailable) === "cli");
442
442
  var macAppBridgeAvailable = () => resolveBridgeStub(join2(pusharyDir(), "bin", HOOK_LOCATOR_BINARY), liveBridgeProbe()).kind === "bundle";
443
443
 
444
444
  export {
@@ -460,6 +460,8 @@ export {
460
460
  addOpenCodeMcpServer,
461
461
  removeOpenCodeMcpServer,
462
462
  agentHookFile,
463
+ agentHooksKeyPath,
463
464
  agentHookOwner,
465
+ cliOwnsAnyAgentHooks,
464
466
  macAppBridgeAvailable
465
467
  };
@@ -2,25 +2,25 @@ import {
2
2
  SIGNED_OUT_ON_MAC_MESSAGE,
3
3
  describeSignedOutKey,
4
4
  readSignedOutDiagnosis
5
- } from "./chunk-Q6C6ILUS.js";
5
+ } from "./chunk-OKSU74QH.js";
6
6
  import {
7
7
  createIo
8
8
  } from "./chunk-U4TMAANR.js";
9
9
  import {
10
10
  readKeySource
11
- } from "./chunk-REU2VQPH.js";
11
+ } from "./chunk-Z4AOR6RZ.js";
12
12
  import {
13
13
  absoluteUrl,
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-QRXPWW3M.js";
17
+ } from "./chunk-I4I4UH62.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-IRHABAQT.js";
23
+ } from "./chunk-FJCOOFT7.js";
24
24
 
25
25
  // src/cli/report-key.ts
26
26
  var { dim, yellow } = createIo();
@@ -90,5 +90,6 @@ var exitOnFailedSettingsRequest = async (response, settings) => {
90
90
 
91
91
  export {
92
92
  printKeyCheck,
93
+ APPROVAL_SETTINGS_PATH,
93
94
  exitOnFailedSettingsRequest
94
95
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-BYLKCZ2G.js";
3
+ } from "./chunk-7RWQZQV2.js";
4
4
  import {
5
5
  isProtectedByScope,
6
6
  registerHookEntry
7
- } from "./chunk-Z23ZBYDW.js";
7
+ } from "./chunk-4FWWHCYM.js";
8
8
 
9
9
  // src/cursor-config.ts
10
10
  var hookCommandOf = (entry) => {
@@ -1,9 +1,16 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-COQ64C4F.js";
3
+ } from "./chunk-CHDAH4HP.js";
4
+ import {
5
+ namedEvent
6
+ } from "./chunk-KEV2MOJH.js";
4
7
  import {
5
8
  writeDegraded
6
- } from "./chunk-UPIZSCYD.js";
9
+ } from "./chunk-GUNZHSTL.js";
10
+ import {
11
+ claudeShapedHookInput,
12
+ hookCompatibleProfileBySource
13
+ } from "./chunk-VOP5U2VX.js";
7
14
 
8
15
  // src/tool-hook-input.ts
9
16
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -80,13 +87,18 @@ var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, pa
80
87
  return null;
81
88
  }
82
89
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
83
- const input = parseInput ? parseInput(parsed) : parsed;
90
+ const shaped = inClaudeShape(source, namedEvent(process.argv) ?? fallbackEvent, parsed);
91
+ const input = parseInput ? parseInput(shaped) : shaped;
84
92
  if (input === null) return null;
85
93
  const event = eventNameOf(input) ?? fallbackEvent;
86
94
  if (!isAdmitted(readAdmissionRules(), source, event)) return null;
87
95
  if (stdin === process.stdin) registerTranscript(source, input);
88
96
  return input;
89
97
  };
98
+ var inClaudeShape = (source, event, parsed) => {
99
+ const profile = hookCompatibleProfileBySource(source);
100
+ return profile ? claudeShapedHookInput(profile.payload, event, parsed) : parsed;
101
+ };
90
102
  var eventNameOf = (input) => {
91
103
  if (!("hook_event_name" in input)) return void 0;
92
104
  const name = input.hook_event_name;
@@ -2,7 +2,7 @@ import {
2
2
  DISCONNECT_AGENT_IDS,
3
3
  SETUP_AGENT_CHOICES,
4
4
  isApprovalMode
5
- } from "./chunk-5RGA636G.js";
5
+ } from "./chunk-VOP5U2VX.js";
6
6
 
7
7
  // src/cli/mode-request.ts
8
8
  var parseDuration = (value) => {
@@ -141,7 +141,7 @@ var COMMAND_OPTIONS = {
141
141
  ],
142
142
  clean: [
143
143
  ["--dry-run", "List everything it would remove and change nothing"],
144
- ["--everything", "Also remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
144
+ ["--everything", "Also revoke the keys the CLI wrote (config.json and its shell profile export) and remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
145
145
  ["--yes", "Remove everything without asking"]
146
146
  ],
147
147
  transcripts: [
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  MCP_BRIDGE_BINARY
3
- } from "./chunk-H5T27W7M.js";
3
+ } from "./chunk-BDRXDO25.js";
4
4
  import {
5
5
  KEY_FILE_MODE
6
- } from "./chunk-REU2VQPH.js";
6
+ } from "./chunk-Z4AOR6RZ.js";
7
7
  import {
8
8
  NpmMissingError
9
- } from "./chunk-Z23ZBYDW.js";
9
+ } from "./chunk-4FWWHCYM.js";
10
10
  import {
11
11
  readJsonSafe,
12
12
  writeFileAtomic,
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-T7E75EKA.js";
15
15
  import {
16
16
  NPX_LATEST_COMMAND
17
- } from "./chunk-5DCDQ5VW.js";
17
+ } from "./chunk-M54ATCOZ.js";
18
18
 
19
19
  // src/instruction-file.ts
20
20
  import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-Z23ZBYDW.js";
3
+ } from "./chunk-4FWWHCYM.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-T7E75EKA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-ZGADIZDS.js";
3
+ } from "./chunk-4HR2ICME.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-7QLSKOSU.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-5DCDQ5VW.js";
12
+ } from "./chunk-M54ATCOZ.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-5RGA636G.js";
20
+ } from "./chunk-VOP5U2VX.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-F7R3SZ4Q.js";
6
+ } from "./chunk-N6GEI3PK.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-SZ4Q6ZVS.js";
13
+ } from "./chunk-PTGUJZSD.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-REU2VQPH.js";
17
+ } from "./chunk-Z4AOR6RZ.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-KOWFRUIT.js";
20
+ } from "./chunk-2NAQRPZQ.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-IRHABAQT.js";
23
+ } from "./chunk-FJCOOFT7.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-5RGA636G.js";
26
+ } from "./chunk-VOP5U2VX.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";
@@ -10,10 +10,10 @@ import {
10
10
  resolvePackageVersionFromBinary,
11
11
  resolvePathBinary,
12
12
  resolvePathBinaryAsync
13
- } from "./chunk-Z23ZBYDW.js";
13
+ } from "./chunk-4FWWHCYM.js";
14
14
  import {
15
15
  MANAGED_PROVIDERS
16
- } from "./chunk-5RGA636G.js";
16
+ } from "./chunk-VOP5U2VX.js";
17
17
 
18
18
  // src/setup/codex-install.ts
19
19
  var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getBaseUrl
3
- } from "./chunk-IRHABAQT.js";
3
+ } from "./chunk-FJCOOFT7.js";
4
4
 
5
5
  // src/transcript-api.ts
6
6
  var fetchTranscriptRecipients = async (apiKey, baseUrl = getBaseUrl()) => {
@@ -3,10 +3,10 @@ import {
3
3
  keyPrefix,
4
4
  readConfigFileKey,
5
5
  readMacAppKeyPrefix
6
- } from "./chunk-REU2VQPH.js";
6
+ } from "./chunk-Z4AOR6RZ.js";
7
7
  import {
8
8
  NPX_LATEST_COMMAND
9
- } from "./chunk-5DCDQ5VW.js";
9
+ } from "./chunk-M54ATCOZ.js";
10
10
 
11
11
  // src/key-signed-out.ts
12
12
  var VERDICT_BY_CHECK = {
@@ -2,7 +2,7 @@ import {
2
2
  autoUpdateLock,
3
3
  installPackageGlobally,
4
4
  npmErrorMessage
5
- } from "./chunk-Z23ZBYDW.js";
5
+ } from "./chunk-4FWWHCYM.js";
6
6
  import {
7
7
  writeJsonAtomic
8
8
  } from "./chunk-T7E75EKA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-IRHABAQT.js";
12
+ } from "./chunk-FJCOOFT7.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-NGKUXZID.js";
3
+ } from "./chunk-GA4J6YFN.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-5DCDQ5VW.js";
6
+ } from "./chunk-M54ATCOZ.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-REU2VQPH.js";
7
+ } from "./chunk-Z4AOR6RZ.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-KOWFRUIT.js";
10
+ } from "./chunk-2NAQRPZQ.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-Z23ZBYDW.js";
14
+ } from "./chunk-4FWWHCYM.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -20,14 +20,14 @@ import {
20
20
  } from "./chunk-T7E75EKA.js";
21
21
  import {
22
22
  getApiKey
23
- } from "./chunk-IRHABAQT.js";
23
+ } from "./chunk-FJCOOFT7.js";
24
24
  import {
25
25
  CLI_PACKAGE_NAMES,
26
26
  cmdShimTarget,
27
27
  getPackageVersion,
28
28
  globalPackageFolder,
29
29
  globalRootFor
30
- } from "./chunk-5RGA636G.js";
30
+ } from "./chunk-VOP5U2VX.js";
31
31
 
32
32
  // src/daemon-lifecycle.ts
33
33
  import { dirname, join, win32 as win32Path } from "path";
@@ -0,0 +1,71 @@
1
+ // src/key-revocation.ts
2
+ var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
3
+ var DEVICE_KEY_PATH = "/api/agent/device-key";
4
+ var FULL_ACCESS_ONLY_STATUS = 403;
5
+ var REVOKE_TIMEOUT_MS = 1e4;
6
+ var readRevokedCount = async (response) => {
7
+ try {
8
+ const body = await response.json();
9
+ const revoked = typeof body === "object" && body !== null && "revoked" in body ? body.revoked : void 0;
10
+ return typeof revoked === "number" && Number.isInteger(revoked) && revoked >= 0 ? revoked : null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ };
15
+ var revokeAgentKey = async (apiKey, baseUrl, fetchImpl) => {
16
+ const response = await fetchImpl(`${baseUrl}${DEVICE_KEY_PATH}`, {
17
+ method: "DELETE",
18
+ headers: { Authorization: `Bearer ${apiKey}` },
19
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
20
+ });
21
+ if (!response.ok) return { kind: "refused", status: response.status };
22
+ const revoked = await readRevokedCount(response);
23
+ if (revoked === null) return { kind: "refused", status: response.status };
24
+ return revoked > 0 ? { kind: "revoked" } : { kind: "not_accepted" };
25
+ };
26
+ var revokeOwnKey = async (apiKey, baseUrl, fetchImpl = fetch) => {
27
+ try {
28
+ const response = await fetchImpl(`${baseUrl}${SELF_REVOKE_PATH}`, {
29
+ method: "POST",
30
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
31
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
32
+ });
33
+ if (response.status === 401) return { kind: "not_accepted" };
34
+ if (response.status === FULL_ACCESS_ONLY_STATUS) return await revokeAgentKey(apiKey, baseUrl, fetchImpl);
35
+ if (!response.ok) return { kind: "refused", status: response.status };
36
+ return { kind: "revoked" };
37
+ } catch (err) {
38
+ return { kind: "unreachable", detail: err instanceof Error ? err.message : "network error" };
39
+ }
40
+ };
41
+ var REVOKE_DETAIL = {
42
+ revoked: "Revoked the key on pushary.com.",
43
+ not_accepted: "pushary.com had already stopped accepting the key.",
44
+ refused: "pushary.com refused to revoke the key",
45
+ unreachable: "Could not reach pushary.com to revoke the key"
46
+ };
47
+ var describeRevokeAttempt = (attempt) => {
48
+ if (attempt.kind === "refused") return `${REVOKE_DETAIL.refused} (HTTP ${attempt.status}).`;
49
+ if (attempt.kind === "unreachable") return `${REVOKE_DETAIL.unreachable}: ${attempt.detail}`;
50
+ return REVOKE_DETAIL[attempt.kind];
51
+ };
52
+ var keyNoLongerAccepted = (attempt) => attempt.kind === "revoked" || attempt.kind === "not_accepted";
53
+ var keyValidityOf = (check) => {
54
+ switch (check.kind) {
55
+ case "ok":
56
+ case "locked":
57
+ return "valid";
58
+ case "rejected":
59
+ case "malformed":
60
+ return "invalid";
61
+ case "unreachable":
62
+ return "unknown";
63
+ }
64
+ };
65
+
66
+ export {
67
+ revokeOwnKey,
68
+ describeRevokeAttempt,
69
+ keyNoLongerAccepted,
70
+ keyValidityOf
71
+ };
@@ -14,19 +14,19 @@ import {
14
14
  } from "./chunk-U4TMAANR.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-6AYSKVLL.js";
17
+ } from "./chunk-KBN3UP2R.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-BNSKVIAW.js";
20
+ } from "./chunk-CBDJ2X5P.js";
21
21
  import {
22
22
  NPX_LATEST_COMMAND
23
- } from "./chunk-5DCDQ5VW.js";
23
+ } from "./chunk-M54ATCOZ.js";
24
24
  import {
25
25
  NO_PAIRING_COMPUTER,
26
26
  PAIR_TTL_SECONDS,
27
27
  classifyConfirmResponse,
28
28
  isAnswerSource
29
- } from "./chunk-5RGA636G.js";
29
+ } from "./chunk-VOP5U2VX.js";
30
30
 
31
31
  // src/reach.ts
32
32
  var reachVerdict = (channels) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-Z23ZBYDW.js";
3
+ } from "./chunk-4FWWHCYM.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-N6IOSZOE.js";
3
+ } from "./chunk-A6J5Z2HO.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var denyReasonFrom = (value, note) => {