@pushary/agent-hooks 0.89.0 → 0.89.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +7 -2
  3. package/dist/bin/pushary-bell-hook.js +4 -4
  4. package/dist/bin/pushary-bell.js +5 -5
  5. package/dist/bin/pushary-claude.js +8 -8
  6. package/dist/bin/pushary-clean.js +6 -6
  7. package/dist/bin/pushary-codex-bridge.js +5 -5
  8. package/dist/bin/pushary-codex-hook.js +5 -5
  9. package/dist/bin/pushary-codex.js +4 -4
  10. package/dist/bin/pushary-connect.js +6 -6
  11. package/dist/bin/pushary-daemon.js +4 -4
  12. package/dist/bin/pushary-disconnect.js +4 -4
  13. package/dist/bin/pushary-doctor.js +13 -13
  14. package/dist/bin/pushary-elicitation-hook.js +48 -28
  15. package/dist/bin/pushary-gemini-bridge.js +5 -5
  16. package/dist/bin/pushary-gemini-hook.js +5 -5
  17. package/dist/bin/pushary-hook.js +6 -6
  18. package/dist/bin/pushary-login.js +4 -4
  19. package/dist/bin/pushary-logout.js +4 -4
  20. package/dist/bin/pushary-mode.js +3 -3
  21. package/dist/bin/pushary-notification-hook.js +4 -4
  22. package/dist/bin/pushary-opencode-hook.js +5 -5
  23. package/dist/bin/pushary-permission-denied-hook.js +6 -6
  24. package/dist/bin/pushary-permission-hook.js +6 -6
  25. package/dist/bin/pushary-post-hook.js +4 -4
  26. package/dist/bin/pushary-prompt-hook.js +4 -4
  27. package/dist/bin/pushary-session-end-hook.js +4 -4
  28. package/dist/bin/pushary-session-start-hook.js +4 -4
  29. package/dist/bin/pushary-setup.js +14 -14
  30. package/dist/bin/pushary-stats.js +2 -2
  31. package/dist/bin/pushary-status.js +5 -5
  32. package/dist/bin/pushary-stop-hook.js +4 -4
  33. package/dist/bin/pushary-stopfailure-hook.js +4 -4
  34. package/dist/bin/pushary-upgrade.js +4 -4
  35. package/dist/bin/pushary-wait.js +3 -3
  36. package/dist/{chunk-DLI5IXSD.js → chunk-475T3XIO.js} +1 -1
  37. package/dist/{chunk-SUZF64M4.js → chunk-4VYUMYWD.js} +2 -2
  38. package/dist/{chunk-OSE7X44J.js → chunk-6XSC6Z2K.js} +3 -3
  39. package/dist/{chunk-F3ZDPL6O.js → chunk-7TS2G4QG.js} +1 -1
  40. package/dist/{chunk-WPDMGNQR.js → chunk-B7JE4XHD.js} +1 -1
  41. package/dist/{chunk-LNAQWWBP.js → chunk-C623LWJR.js} +1 -1
  42. package/dist/{chunk-U65EIMUJ.js → chunk-HEQVIIBN.js} +13 -8
  43. package/dist/{chunk-WFFPWJN6.js → chunk-I5L6SK5V.js} +1 -1
  44. package/dist/{chunk-4FANZF2L.js → chunk-K42SZKYF.js} +1 -1
  45. package/dist/{chunk-Q6MK2YKV.js → chunk-L4C2JXJS.js} +12 -3
  46. package/dist/{chunk-EKNFTIKO.js → chunk-LALHWDWL.js} +1 -1
  47. package/dist/{chunk-LXTX5CT7.js → chunk-LGXTBUT4.js} +1 -1
  48. package/dist/{chunk-O7P7O4VY.js → chunk-LUCFN47K.js} +2 -2
  49. package/dist/{chunk-4KMWTOBK.js → chunk-O5B7EK5U.js} +1 -1
  50. package/dist/{chunk-AJ4EMW5D.js → chunk-OFRNZWC4.js} +1 -1
  51. package/dist/{chunk-6GBQDZ7K.js → chunk-PMHTCDEO.js} +1 -1
  52. package/dist/{chunk-ZPRF4YLA.js → chunk-SS72Z7FV.js} +1 -1
  53. package/dist/{chunk-SHVW5KFR.js → chunk-T3LRWZKI.js} +1 -1
  54. package/dist/{chunk-FRH2QIMY.js → chunk-VKVHY5HD.js} +1 -1
  55. package/dist/{chunk-PXEFENML.js → chunk-VZKXBFUA.js} +1 -1
  56. package/dist/{chunk-U44C3ULB.js → chunk-ZYPS2XMT.js} +1 -1
  57. package/dist/src/index.js +6 -6
  58. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  hasGeminiHooks
3
- } from "./chunk-F3ZDPL6O.js";
3
+ } from "./chunk-7TS2G4QG.js";
4
4
  import {
5
5
  hasCodexHooks
6
- } from "./chunk-FRH2QIMY.js";
6
+ } from "./chunk-VKVHY5HD.js";
7
7
 
8
8
  // src/diagnostics/wiring.ts
9
9
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -22,7 +22,7 @@ import {
22
22
  summarizeStop,
23
23
  taskTitleFrom,
24
24
  toolResultErrorText
25
- } from "./chunk-LXTX5CT7.js";
25
+ } from "./chunk-LGXTBUT4.js";
26
26
  import {
27
27
  getMachineId
28
28
  } from "./chunk-RN3NOEJF.js";
@@ -31,7 +31,7 @@ import {
31
31
  } from "./chunk-BSZYIAZL.js";
32
32
  import {
33
33
  reportedInstallSource
34
- } from "./chunk-AJ4EMW5D.js";
34
+ } from "./chunk-OFRNZWC4.js";
35
35
  import {
36
36
  getApiKey,
37
37
  getBaseUrl
@@ -47,7 +47,7 @@ import {
47
47
  pendingCommandEvents,
48
48
  resolveAutoResolveOrigin,
49
49
  resolvePolicy
50
- } from "./chunk-Q6MK2YKV.js";
50
+ } from "./chunk-L4C2JXJS.js";
51
51
 
52
52
  // src/policy.ts
53
53
  import { createHash } from "crypto";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  HOOK_BUDGETS,
10
10
  HOOK_LOCATOR_BINARY
11
- } from "./chunk-Q6MK2YKV.js";
11
+ } from "./chunk-L4C2JXJS.js";
12
12
 
13
13
  // src/claude-config.ts
14
14
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConfigFileKey
3
- } from "./chunk-EKNFTIKO.js";
3
+ } from "./chunk-LALHWDWL.js";
4
4
 
5
5
  // src/bell/fleet.ts
6
6
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  generateSessionKey,
6
6
  uploadTranscriptRecords,
7
7
  wrapSessionKey
8
- } from "./chunk-6GBQDZ7K.js";
8
+ } from "./chunk-PMHTCDEO.js";
9
9
 
10
10
  // src/live-session.ts
11
11
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "./chunk-PXEFENML.js";
8
+ } from "./chunk-VZKXBFUA.js";
9
9
  import {
10
10
  denyReasonFrom,
11
11
  isDeferAnswer
@@ -17,7 +17,7 @@ import {
17
17
  readLastUserPrompt,
18
18
  repoKeyFor,
19
19
  throttlePass
20
- } from "./chunk-OSE7X44J.js";
20
+ } from "./chunk-6XSC6Z2K.js";
21
21
  import {
22
22
  DEFAULT_SESSION,
23
23
  askUser,
@@ -33,7 +33,7 @@ import {
33
33
  deriveToolTarget,
34
34
  describeToolCall,
35
35
  scopePathFor
36
- } from "./chunk-LXTX5CT7.js";
36
+ } from "./chunk-LGXTBUT4.js";
37
37
  import {
38
38
  getMachineId
39
39
  } from "./chunk-RN3NOEJF.js";
@@ -52,7 +52,7 @@ import {
52
52
  parseAgentQuestions,
53
53
  resolveGate,
54
54
  shouldDeferToNativeMode
55
- } from "./chunk-Q6MK2YKV.js";
55
+ } from "./chunk-L4C2JXJS.js";
56
56
 
57
57
  // src/decision-episode.ts
58
58
  var EPISODE_PATH = "/api/agent/decision-episode";
@@ -316,12 +316,12 @@ var withLabels = (question) => ({
316
316
  ...question,
317
317
  labels: question.options.map((option) => option.label)
318
318
  });
319
+ var withoutLabels = ({ labels: _, ...question }) => question;
319
320
  var parseQuestions = (toolInput) => parseAgentQuestions(toolInput)?.map(withLabels);
320
321
  var questionContext = (question, index, total, project) => {
321
322
  const subject = question.header ? `${question.header}: your agent is asking in ${project}` : `Your agent is asking in ${project}`;
322
323
  return total > 1 ? `${subject} (${index + 1} of ${total})` : subject;
323
324
  };
324
- var encodeAnswer = (question, value) => question.multiSelect ? JSON.stringify([value]) : value;
325
325
  var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
326
326
  const only = parsed[0];
327
327
  let result;
@@ -330,7 +330,7 @@ var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
330
330
  question: only.question,
331
331
  type: "select",
332
332
  options: [...only.labels],
333
- questions: parsed.map(({ labels: _, ...question }) => question),
333
+ questions: parsed.map(withoutLabels),
334
334
  context: questionContext(only, 0, 1, projectName),
335
335
  agentName: `Claude Code - ${projectName}`,
336
336
  sessionId: input.session_id,
@@ -363,6 +363,7 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
363
363
  question: question.question,
364
364
  type: "select",
365
365
  options: [...question.labels],
366
+ questions: [withoutLabels(question)],
366
367
  context: questionContext(question, index, parsed.length, projectName),
367
368
  agentName: `Claude Code - ${projectName}`,
368
369
  sessionId: input.session_id,
@@ -382,12 +383,16 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
382
383
  return void 0;
383
384
  }
384
385
  const answer = await pollForAnswer(apiKey, result.correlationId, deadline);
385
- const value = answer.answered ? (answer.value ?? "").trim() : "";
386
+ const legacyValue = answer.answered ? answer.value?.trim() : void 0;
387
+ const values = legacyValue ? parseAgentQuestionAnswers([question], legacyValue) ?? parseAgentQuestionAnswers([question], JSON.stringify({
388
+ [question.question]: question.multiSelect ? JSON.stringify([legacyValue]) : legacyValue
389
+ })) : null;
390
+ const value = values?.[question.question];
386
391
  if (!value || isDeferAnswer(answer.value)) {
387
392
  savePendingQuestion(input.session_id || DEFAULT_SESSION, result.correlationId);
388
393
  return void 0;
389
394
  }
390
- answers[question.question] = encodeAnswer(question, value);
395
+ answers[question.question] = value;
391
396
  }
392
397
  return answers;
393
398
  };
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-2UMNXADU.js";
13
13
  import {
14
14
  isValidApiKey
15
- } from "./chunk-Q6MK2YKV.js";
15
+ } from "./chunk-L4C2JXJS.js";
16
16
 
17
17
  // src/session.ts
18
18
  var IDENTITY_PATH = "/api/v1/server/identity";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-PZA7G4CN.js";
8
8
  import {
9
9
  pusharyDir
10
- } from "./chunk-FRH2QIMY.js";
10
+ } from "./chunk-VKVHY5HD.js";
11
11
  import {
12
12
  getMachineId
13
13
  } from "./chunk-RN3NOEJF.js";
@@ -19,6 +19,7 @@ var parseAgentQuestion = (raw) => {
19
19
  question: q.question,
20
20
  ...typeof q.header === "string" ? { header: q.header } : {},
21
21
  multiSelect: q.multiSelect === true,
22
+ ...typeof q.allowOther === "boolean" ? { allowOther: q.allowOther } : {},
22
23
  options
23
24
  };
24
25
  };
@@ -47,13 +48,20 @@ var parseAgentQuestionAnswers = (questions, value) => {
47
48
  for (const question of questions) {
48
49
  const answer = answers[question.question];
49
50
  if (typeof answer !== "string" || answer.trim().length === 0) return null;
50
- if (!question.multiSelect) continue;
51
+ const labels = new Set(question.options.map((option) => option.label));
52
+ if (!question.multiSelect) {
53
+ if (question.allowOther === false && !labels.has(answer)) return null;
54
+ continue;
55
+ }
51
56
  try {
52
57
  const selected = JSON.parse(answer);
53
- if (!Array.isArray(selected)) continue;
54
- const labels = new Set(question.options.map((option) => option.label));
58
+ if (!Array.isArray(selected)) {
59
+ if (question.allowOther === false) return null;
60
+ continue;
61
+ }
55
62
  if (selected.length === 0 || new Set(selected).size !== selected.length || !selected.every((label) => typeof label === "string" && labels.has(label))) return null;
56
63
  } catch {
64
+ if (question.allowOther === false) return null;
57
65
  }
58
66
  }
59
67
  return answers;
@@ -1277,6 +1285,7 @@ var planElicitationAsk = (message, fields) => {
1277
1285
  question: elicitationQuestionText(message, field, false),
1278
1286
  header: field.label.slice(0, 12),
1279
1287
  multiSelect: false,
1288
+ allowOther: false,
1280
1289
  options: field.options.map((label) => ({ label }))
1281
1290
  }));
1282
1291
  return new Set(questions.map((question) => question.question)).size === questions.length ? { kind: "questions", fields, questions } : null;
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-6MTNS63X.js";
10
10
  import {
11
11
  resolveInstallSourceFor
12
- } from "./chunk-AJ4EMW5D.js";
12
+ } from "./chunk-OFRNZWC4.js";
13
13
  import {
14
14
  configFilePath
15
15
  } from "./chunk-2UMNXADU.js";
@@ -5,7 +5,7 @@ import {
5
5
  FILE_TARGET_TOOLS,
6
6
  redactSecrets,
7
7
  redactSecretsDeep
8
- } from "./chunk-Q6MK2YKV.js";
8
+ } from "./chunk-L4C2JXJS.js";
9
9
 
10
10
  // ../hook-mapping/src/describe.ts
11
11
  import { isAbsolute, relative, resolve } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-4KMWTOBK.js";
3
+ } from "./chunk-O5B7EK5U.js";
4
4
  import {
5
5
  codexHomeFrom
6
- } from "./chunk-FRH2QIMY.js";
6
+ } from "./chunk-VKVHY5HD.js";
7
7
 
8
8
  // src/vscode-config.ts
9
9
  import { homedir } from "os";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_BUDGETS,
3
3
  OPENCODE_APPROVAL_EVENT
4
- } from "./chunk-Q6MK2YKV.js";
4
+ } from "./chunk-L4C2JXJS.js";
5
5
 
6
6
  // src/opencode-plugin.ts
7
7
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2UMNXADU.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-Q6MK2YKV.js";
6
+ } from "./chunk-L4C2JXJS.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2UMNXADU.js";
4
4
  import {
5
5
  redactSecrets
6
- } from "./chunk-Q6MK2YKV.js";
6
+ } from "./chunk-L4C2JXJS.js";
7
7
 
8
8
  // src/crypto.ts
9
9
  import nacl from "tweetnacl";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  describeKeyCheck,
3
3
  keyCheckFromResponse
4
- } from "./chunk-WFFPWJN6.js";
4
+ } from "./chunk-I5L6SK5V.js";
5
5
  import {
6
6
  createIo
7
7
  } from "./chunk-5RUIFDTP.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-BSZYIAZL.js";
12
12
  import {
13
13
  reportedInstallSource
14
- } from "./chunk-AJ4EMW5D.js";
14
+ } from "./chunk-OFRNZWC4.js";
15
15
 
16
16
  // src/reach.ts
17
17
  var reachVerdict = (channels) => {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  HOOK_BUDGETS,
6
6
  HOOK_LOCATOR_BINARY
7
- } from "./chunk-Q6MK2YKV.js";
7
+ } from "./chunk-L4C2JXJS.js";
8
8
 
9
9
  // src/codex-config.ts
10
10
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-Q6MK2YKV.js";
3
+ } from "./chunk-L4C2JXJS.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-FRH2QIMY.js";
3
+ } from "./chunk-VKVHY5HD.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-6MTNS63X.js";
package/dist/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-U65EIMUJ.js";
3
+ } from "../chunk-HEQVIIBN.js";
4
4
  import "../chunk-ATBKJNWS.js";
5
- import "../chunk-PXEFENML.js";
5
+ import "../chunk-VZKXBFUA.js";
6
6
  import "../chunk-YHG74UFF.js";
7
7
  import {
8
8
  fetchModeOverride,
@@ -12,17 +12,17 @@ import {
12
12
  handlePostToolUse,
13
13
  handleStop,
14
14
  reportEvent
15
- } from "../chunk-OSE7X44J.js";
15
+ } from "../chunk-6XSC6Z2K.js";
16
16
  import {
17
17
  askUser,
18
18
  cancelQuestion,
19
19
  waitForAnswer
20
20
  } from "../chunk-J3YDT4HM.js";
21
- import "../chunk-LXTX5CT7.js";
21
+ import "../chunk-LGXTBUT4.js";
22
22
  import "../chunk-RN3NOEJF.js";
23
23
  import "../chunk-BSZYIAZL.js";
24
24
  import "../chunk-SAF6HGAA.js";
25
- import "../chunk-AJ4EMW5D.js";
25
+ import "../chunk-OFRNZWC4.js";
26
26
  import "../chunk-7QLSKOSU.js";
27
27
  import "../chunk-KZERVKTD.js";
28
28
  import {
@@ -31,7 +31,7 @@ import {
31
31
  } from "../chunk-2UMNXADU.js";
32
32
  import {
33
33
  resolvePolicy
34
- } from "../chunk-Q6MK2YKV.js";
34
+ } from "../chunk-L4C2JXJS.js";
35
35
  export {
36
36
  askUser,
37
37
  cancelQuestion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "0.89.0",
3
+ "version": "0.89.2",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",