pushary 1.9.36 → 1.9.38

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 (101) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/bin/pushary-bell-hook.js +25 -25
  3. package/dist/bin/pushary-bell.js +9 -9
  4. package/dist/bin/pushary-claude.js +24 -24
  5. package/dist/bin/pushary-clean.js +29 -29
  6. package/dist/bin/pushary-codex-bridge.js +40 -29
  7. package/dist/bin/pushary-codex-hook.js +66 -41
  8. package/dist/bin/pushary-codex.js +12 -12
  9. package/dist/bin/pushary-connect.js +24 -24
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +32 -32
  12. package/dist/bin/pushary-disconnect.js +24 -24
  13. package/dist/bin/pushary-doctor.js +33 -33
  14. package/dist/bin/pushary-elicitation-hook.js +25 -25
  15. package/dist/bin/pushary-gemini-bridge.js +13 -13
  16. package/dist/bin/pushary-gemini-hook.js +27 -27
  17. package/dist/bin/pushary-hook.js +29 -29
  18. package/dist/bin/pushary-login.js +12 -12
  19. package/dist/bin/pushary-logout.js +24 -24
  20. package/dist/bin/pushary-mcp.js +9 -9
  21. package/dist/bin/pushary-mode.js +12 -12
  22. package/dist/bin/pushary-notification-hook.js +24 -24
  23. package/dist/bin/pushary-opencode-hook.js +26 -26
  24. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  25. package/dist/bin/pushary-permission-hook.js +28 -28
  26. package/dist/bin/pushary-post-hook.js +24 -24
  27. package/dist/bin/pushary-prompt-hook.js +24 -24
  28. package/dist/bin/pushary-session-end-hook.js +24 -24
  29. package/dist/bin/pushary-session-start-hook.js +28 -28
  30. package/dist/bin/pushary-setup.js +35 -35
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +26 -26
  33. package/dist/bin/pushary-stop-hook.js +24 -24
  34. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  35. package/dist/bin/pushary-suggestions.js +12 -12
  36. package/dist/bin/pushary-transcript-register.js +17 -17
  37. package/dist/bin/pushary-transcripts.js +7 -7
  38. package/dist/bin/pushary-upgrade.js +30 -30
  39. package/dist/bin/pushary-wait.js +12 -12
  40. package/dist/bin/pushary.js +6 -6
  41. package/dist/{chunk-NE5OPCD5.js → chunk-3DXDJL4K.js} +4 -4
  42. package/dist/{chunk-EGTVN6YV.js → chunk-3HUHP4A4.js} +1 -1
  43. package/dist/{chunk-H3MOTS2C.js → chunk-4D54LZGF.js} +1 -1
  44. package/dist/{chunk-K5X25GUV.js → chunk-4GEHVRV3.js} +9 -6
  45. package/dist/{chunk-UDHT3W7I.js → chunk-5DC2PRVT.js} +2 -2
  46. package/dist/{chunk-VRALPR4B.js → chunk-5KVL4AP5.js} +4 -4
  47. package/dist/{chunk-SHLLDMPM.js → chunk-7GSOIBVM.js} +4 -4
  48. package/dist/{chunk-FBKGGIFB.js → chunk-7O5U5TED.js} +5 -5
  49. package/dist/{chunk-EH635XAR.js → chunk-7P43CI6G.js} +2 -2
  50. package/dist/{chunk-BS64ZHTB.js → chunk-ABDGTGBT.js} +5 -4
  51. package/dist/{chunk-7GQILLZD.js → chunk-AI2YBW42.js} +5 -5
  52. package/dist/{chunk-Y5FCB66K.js → chunk-AJIH4JGB.js} +5 -5
  53. package/dist/{chunk-MBBPLF5T.js → chunk-B54Q4I7T.js} +2 -2
  54. package/dist/{chunk-CRZ4CP7C.js → chunk-BMHD2NEH.js} +3 -3
  55. package/dist/chunk-CHRRBADC.js +184 -0
  56. package/dist/{chunk-ML42WKI7.js → chunk-CW3IJD2H.js} +3 -3
  57. package/dist/{chunk-JWURAYXK.js → chunk-D2G6HWEA.js} +2 -2
  58. package/dist/{chunk-PRKH662J.js → chunk-D322CKL2.js} +1 -1
  59. package/dist/{chunk-HCKBZYBW.js → chunk-D5IAEPFA.js} +2 -2
  60. package/dist/{chunk-QHL3Y6D2.js → chunk-DDRLK67P.js} +2 -2
  61. package/dist/{chunk-TRNSODJ6.js → chunk-FLEWP4BV.js} +1 -1
  62. package/dist/{chunk-EQXMVKKD.js → chunk-FZEQWY7Q.js} +1 -1
  63. package/dist/{chunk-J36W6ARB.js → chunk-G3CNMCQS.js} +1 -1
  64. package/dist/{chunk-ULDOQF4Q.js → chunk-GBNG6QEV.js} +3 -3
  65. package/dist/{chunk-GTEF64CJ.js → chunk-HCXBAF43.js} +1 -1
  66. package/dist/{chunk-U2PUHT4W.js → chunk-IBUAVM6X.js} +1 -1
  67. package/dist/{chunk-CHWJ7ZXI.js → chunk-J2APHNZL.js} +5 -5
  68. package/dist/{chunk-5ML6E3L7.js → chunk-JVKY6ILU.js} +1 -1
  69. package/dist/{chunk-42FTY5II.js → chunk-JWMCGL3P.js} +3 -3
  70. package/dist/{chunk-4E4PZQFE.js → chunk-K2CZJBUS.js} +4 -4
  71. package/dist/{chunk-YRAPCLOB.js → chunk-KBMQYMGG.js} +6 -6
  72. package/dist/{chunk-6LKIK7V2.js → chunk-L5WOYQT7.js} +8 -8
  73. package/dist/{chunk-ETGGQWBR.js → chunk-LZZ3EKKI.js} +4 -4
  74. package/dist/{chunk-26AEFJSK.js → chunk-MBTNHQCI.js} +2 -2
  75. package/dist/{chunk-5S2P2CK6.js → chunk-MIENLS7P.js} +2 -2
  76. package/dist/{chunk-LL256PHP.js → chunk-MXEDMQLC.js} +1 -1
  77. package/dist/{chunk-RNRCOOQZ.js → chunk-N2I7RMC6.js} +34 -109
  78. package/dist/{chunk-RYXSY3RH.js → chunk-NRVZNZVE.js} +5 -5
  79. package/dist/{chunk-GNESC5EF.js → chunk-OLS4DTFN.js} +3 -3
  80. package/dist/{chunk-L25KSDIB.js → chunk-PA3OZGIA.js} +8 -8
  81. package/dist/{chunk-QPUTCMAK.js → chunk-QC7ZNZMZ.js} +1 -1
  82. package/dist/{chunk-2DZBIELP.js → chunk-QOUW57RT.js} +170 -67
  83. package/dist/{chunk-55XIK7YS.js → chunk-QZ4KOMFE.js} +1 -1
  84. package/dist/{chunk-CRZKFEEO.js → chunk-RISJLN3O.js} +2 -2
  85. package/dist/{chunk-CHNSFTD5.js → chunk-RULJMNY7.js} +2 -2
  86. package/dist/{chunk-556JCOMK.js → chunk-STXWIYAY.js} +4 -4
  87. package/dist/{chunk-IPYCRJGM.js → chunk-TEG2JL5M.js} +7 -7
  88. package/dist/{chunk-KCUTE3EB.js → chunk-VITJTFFT.js} +2 -2
  89. package/dist/{chunk-DC6KHRVH.js → chunk-W2TXFM6O.js} +1 -1
  90. package/dist/{chunk-JAA7YJJZ.js → chunk-WASCAI2U.js} +4 -4
  91. package/dist/{chunk-7MOFAAZ3.js → chunk-WLQENMOW.js} +4 -4
  92. package/dist/{chunk-X4BPD5RD.js → chunk-WR3GKYKD.js} +1 -1
  93. package/dist/{chunk-F5W7B7YT.js → chunk-Y3XF324T.js} +1 -1
  94. package/dist/{chunk-4NMDFPK7.js → chunk-ZFJAZBBF.js} +5 -5
  95. package/dist/{global-upgrade-EF6RZBPU.js → global-upgrade-ROZHFAO5.js} +6 -6
  96. package/dist/{paths-F645XTFZ.js → paths-FSFFGRRU.js} +2 -2
  97. package/dist/{reapply-HJOTWJAN.js → reapply-WY5LHIR4.js} +20 -20
  98. package/dist/src/index.js +19 -19
  99. package/dist/{upgrade-lock-APUN7YKQ.js → upgrade-lock-6PYOTF4X.js} +3 -3
  100. package/package.json +1 -1
  101. package/dist/chunk-MNXHKEXB.js +0 -71
@@ -1,20 +1,22 @@
1
1
  import {
2
+ askAgentQuestions,
2
3
  defersToNativeMode,
3
- reportMachineDenial
4
- } from "./chunk-MNXHKEXB.js";
4
+ outcomeOfFailedAsk,
5
+ reportMachineDenial,
6
+ storedWaitDeadline
7
+ } from "./chunk-CHRRBADC.js";
5
8
  import {
6
9
  isGatingMoment,
7
10
  recordKeylessMoment
8
- } from "./chunk-J36W6ARB.js";
11
+ } from "./chunk-G3CNMCQS.js";
9
12
  import {
10
- announceSubscriptionRequired,
11
13
  isDeferAnswer,
12
14
  oncePerSession
13
- } from "./chunk-DC6KHRVH.js";
15
+ } from "./chunk-W2TXFM6O.js";
14
16
  import {
15
17
  activeHookSource,
16
18
  activeIdentity
17
- } from "./chunk-SHLLDMPM.js";
19
+ } from "./chunk-7GSOIBVM.js";
18
20
  import {
19
21
  DEFAULT_SESSION,
20
22
  UNNAMED_ACTION,
@@ -39,7 +41,7 @@ import {
39
41
  reportEvent,
40
42
  scopePathFor,
41
43
  settleQuestionsForToolUse
42
- } from "./chunk-6LKIK7V2.js";
44
+ } from "./chunk-L5WOYQT7.js";
43
45
  import {
44
46
  askUser,
45
47
  cancelQuestion,
@@ -52,22 +54,20 @@ import {
52
54
  sendNotification,
53
55
  waitForQuestion,
54
56
  waitsForThePhone
55
- } from "./chunk-FBKGGIFB.js";
56
- import {
57
- SubscriptionRequiredError
58
- } from "./chunk-BS64ZHTB.js";
57
+ } from "./chunk-7O5U5TED.js";
59
58
  import {
60
59
  getMachineId
61
- } from "./chunk-EGTVN6YV.js";
60
+ } from "./chunk-3HUHP4A4.js";
62
61
  import {
63
62
  getApiKey,
64
63
  getBaseUrl
65
- } from "./chunk-PRKH662J.js";
64
+ } from "./chunk-D322CKL2.js";
66
65
  import {
67
66
  NPX_LATEST_COMMAND
68
- } from "./chunk-LL256PHP.js";
67
+ } from "./chunk-MXEDMQLC.js";
69
68
  import {
70
69
  AGENT_QUESTION_STRATEGY,
70
+ AGENT_QUESTION_TOOL,
71
71
  DECISION_STOP_REASON,
72
72
  GATE_BLOCK_REASON_MAX_LENGTH,
73
73
  GATE_WIRE,
@@ -104,13 +104,12 @@ import {
104
104
  isBlockedActionRequest,
105
105
  isPermissionRequestOwnedByPreToolUse,
106
106
  isPusharyOwnTool,
107
- parseAgentQuestionAnswers,
108
107
  parseAgentQuestions,
109
108
  questionHandedToTheTerminal,
110
109
  resolveGate,
111
110
  timeoutActionWithoutLocalPrompt,
112
111
  unansweredRefusalReason
113
- } from "./chunk-2DZBIELP.js";
112
+ } from "./chunk-QOUW57RT.js";
114
113
 
115
114
  // src/claude-permission-rules.ts
116
115
  import { readFileSync, statSync } from "fs";
@@ -191,16 +190,7 @@ var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, u
191
190
  var ask = (reason) => claudePreToolUseOutput("ask", reason);
192
191
  var halted = (reason) => claudeStoppedPreToolUseOutput(reason);
193
192
  var undecidedCall = (reason) => PUSHARY_IS_SOLE_GATE ? deny(reason) : void 0;
194
- var outcomeOfFailedAsk = (error, sessionId, failure) => {
195
- if (!(error instanceof SubscriptionRequiredError)) return failure;
196
- announceSubscriptionRequired(error.upgradeUrl, sessionId);
197
- return void 0;
198
- };
199
193
  var outcomeOfFailedPermissionAsk = (error, sessionId) => outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON)) ?? undecidedCall(SOLE_GATE_SUBSCRIPTION_REASON);
200
- var storedWaitDeadline = (result, requestedDeadline) => {
201
- const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
202
- return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
203
- };
204
194
  var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, timeoutAction, sessionId, machineId, toolName, toolTarget, decision, signals) => {
205
195
  const effectiveWait = effectiveWaitSeconds(timeoutAction, timeoutSeconds, "claude");
206
196
  const now = Date.now();
@@ -393,94 +383,29 @@ var keylessNoticeOnce = (sessionId) => {
393
383
  }
394
384
  };
395
385
  var shouldDeferToNativeMode = defersToNativeMode;
396
- var withLabels = (question) => ({
397
- ...question,
398
- labels: question.options.map((option) => option.label)
399
- });
400
- var withoutLabels = ({ labels: _, ...question }) => question;
401
- var parseQuestions = (toolInput) => parseAgentQuestions(toolInput)?.map(withLabels);
402
- var questionContext = (question, index, total, project) => {
403
- const subject = question.header ? `${question.header}: your agent is asking in ${project}` : `Your agent is asking in ${project}`;
404
- return total > 1 ? `${subject} (${index + 1} of ${total})` : subject;
405
- };
406
- var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
407
- const only = parsed[0];
408
- let result;
409
- try {
410
- result = await askUser(apiKey, {
411
- question: only.question,
412
- type: "select",
413
- options: [...only.labels],
414
- questions: parsed.map(withoutLabels),
415
- context: questionContext(only, 0, 1, projectName),
416
- agentName: agentNameIn(projectName),
417
- sessionId: input.session_id,
418
- machineId: getMachineId(),
419
- toolName: "AskUserQuestion",
420
- toolUseId: input.tool_use_id,
421
- waitEndsAt: new Date(deadline).toISOString()
422
- });
423
- } catch (error) {
424
- return outcomeOfFailedAsk(error, input.session_id, null);
425
- }
426
- if (isDecisionStopped(result)) return null;
427
- const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
428
- if (isDecisionStopped(answer)) return null;
429
- const values = answer.answered && answer.value ? parseAgentQuestionAnswers(parsed, answer.value) : null;
430
- if (!values || isDeferAnswer(answer.value)) {
431
- return void 0;
432
- }
433
- return values;
434
- };
435
- var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline) => {
436
- const answers = {};
437
- for (const [index, question] of parsed.entries()) {
438
- let result;
439
- try {
440
- result = await askUser(apiKey, {
441
- question: question.question,
442
- type: "select",
443
- options: [...question.labels],
444
- questions: [withoutLabels(question)],
445
- context: questionContext(question, index, parsed.length, projectName),
446
- agentName: agentNameIn(projectName),
447
- sessionId: input.session_id,
448
- machineId: getMachineId(),
449
- toolName: "AskUserQuestion",
450
- // One AskUserQuestion call raises several questions, and their payload
451
- // fingerprints are identical (same tool, no target, no body). Without the
452
- // index they would all collapse onto the first decision.
453
- toolUseId: input.tool_use_id ? `${input.tool_use_id}#q${index}` : void 0,
454
- waitEndsAt: new Date(deadline).toISOString()
455
- });
456
- } catch (error) {
457
- return outcomeOfFailedAsk(error, input.session_id, null);
458
- }
459
- if (isDecisionStopped(result)) return null;
460
- const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
461
- if (isDecisionStopped(answer)) return null;
462
- const legacyValue = answer.answered ? answer.value?.trim() : void 0;
463
- const values = legacyValue ? parseAgentQuestionAnswers([question], legacyValue) ?? parseAgentQuestionAnswers([question], JSON.stringify({
464
- [question.question]: question.multiSelect ? JSON.stringify([legacyValue]) : legacyValue
465
- })) : null;
466
- const value = values?.[question.question];
467
- if (!value || isDeferAnswer(answer.value)) {
468
- return void 0;
469
- }
470
- answers[question.question] = value;
471
- }
472
- return answers;
473
- };
474
386
  var handleAskUserQuestion = async (apiKey, input, modeState) => {
475
387
  if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
476
- const parsed = parseQuestions(input.tool_input ?? {});
477
- if (!parsed) return void 0;
388
+ const questions = parseAgentQuestions(input.tool_input ?? {});
389
+ if (!questions) return void 0;
478
390
  const projectName = basename(input.cwd ?? process.cwd());
479
391
  const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
480
- const answers = parsed.length === 1 ? await askAsOneCard(apiKey, input, parsed, projectName, deadline) : await askQuestionByQuestion(apiKey, input, parsed, projectName, deadline);
481
- if (answers === null) return halted(DECISION_STOP_REASON);
482
- if (!answers) return void 0;
483
- return allowWithInput({ ...input.tool_input ?? {}, answers });
392
+ const outcome = await askAgentQuestions(apiKey, {
393
+ toolName: AGENT_QUESTION_TOOL,
394
+ agentName: agentNameIn(projectName),
395
+ projectName,
396
+ sessionId: input.session_id,
397
+ toolUseId: input.tool_use_id,
398
+ deadline
399
+ }, questions);
400
+ switch (outcome.kind) {
401
+ case "answered":
402
+ return allowWithInput({ ...input.tool_input ?? {}, answers: outcome.answers });
403
+ case "stopped":
404
+ case "unavailable":
405
+ return halted(DECISION_STOP_REASON);
406
+ case "unanswered":
407
+ return void 0;
408
+ }
484
409
  };
485
410
  var PLAN_APPROVE = "Approve, start coding";
486
411
  var PLAN_KEEP_PLANNING = "Keep planning";
@@ -4,7 +4,7 @@ import {
4
4
  forkFinishWithUpgradeLock,
5
5
  installWithUpgradeLock,
6
6
  releaseAutoUpdateLock
7
- } from "./chunk-55XIK7YS.js";
7
+ } from "./chunk-QZ4KOMFE.js";
8
8
  import {
9
9
  describeAutoUpdateCheck,
10
10
  globalInstallLocation,
@@ -14,7 +14,7 @@ import {
14
14
  readAutoUpdateState,
15
15
  updateAutoUpdateState,
16
16
  upgradeEntryFor
17
- } from "./chunk-HCKBZYBW.js";
17
+ } from "./chunk-D5IAEPFA.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -27,10 +27,10 @@ import {
27
27
  npmErrorMessage,
28
28
  readGlobalCliInstallAt,
29
29
  readGlobalPrefix
30
- } from "./chunk-K5X25GUV.js";
30
+ } from "./chunk-4GEHVRV3.js";
31
31
  import {
32
32
  NPX_LATEST_COMMAND
33
- } from "./chunk-LL256PHP.js";
33
+ } from "./chunk-MXEDMQLC.js";
34
34
  import {
35
35
  commandsPackage,
36
36
  globalUpgradeEntry,
@@ -39,7 +39,7 @@ import {
39
39
  isSameMajorVersion,
40
40
  ownPackageRoot,
41
41
  packageVersionAt
42
- } from "./chunk-2DZBIELP.js";
42
+ } from "./chunk-QOUW57RT.js";
43
43
 
44
44
  // src/global-upgrade.ts
45
45
  import { existsSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-CRZ4CP7C.js";
3
+ } from "./chunk-BMHD2NEH.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -9,11 +9,11 @@ import {
9
9
  } from "./chunk-KZERVKTD.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-PRKH662J.js";
12
+ } from "./chunk-D322CKL2.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-2DZBIELP.js";
16
+ } from "./chunk-QOUW57RT.js";
17
17
 
18
18
  // src/session.ts
19
19
  var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
@@ -6,38 +6,38 @@ import {
6
6
  } from "./chunk-DWQYCOPI.js";
7
7
  import {
8
8
  ensureDaemonRunning
9
- } from "./chunk-Y5FCB66K.js";
9
+ } from "./chunk-AJIH4JGB.js";
10
10
  import {
11
11
  buildTranscriptRecords,
12
12
  decodePublicKey,
13
13
  generateSessionKey,
14
14
  wrapSessionKey
15
- } from "./chunk-H3MOTS2C.js";
15
+ } from "./chunk-4D54LZGF.js";
16
16
  import {
17
17
  fetchTranscriptRecipients,
18
18
  uploadTranscriptRecords
19
- } from "./chunk-X4BPD5RD.js";
19
+ } from "./chunk-WR3GKYKD.js";
20
20
  import {
21
21
  transcriptEnvironmentPreference,
22
22
  transcriptsEnabled
23
- } from "./chunk-QPUTCMAK.js";
23
+ } from "./chunk-QC7ZNZMZ.js";
24
24
  import {
25
25
  hookOwnerOf
26
- } from "./chunk-4NMDFPK7.js";
26
+ } from "./chunk-ZFJAZBBF.js";
27
27
  import {
28
28
  readTranscriptPreference
29
- } from "./chunk-42FTY5II.js";
29
+ } from "./chunk-JWMCGL3P.js";
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-K5X25GUV.js";
33
+ } from "./chunk-4GEHVRV3.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-AQFEP65J.js";
37
37
  import {
38
38
  getApiKey,
39
39
  getBaseUrl
40
- } from "./chunk-PRKH662J.js";
40
+ } from "./chunk-D322CKL2.js";
41
41
 
42
42
  // src/transcript-registration.ts
43
43
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-42FTY5II.js";
3
+ } from "./chunk-JWMCGL3P.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {