pushary 1.9.72 → 1.9.75

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 (126) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{api-K4UGZNOE.js → api-L3BIISGS.js} +10 -10
  3. package/dist/bin/pushary-bell-hook.js +26 -25
  4. package/dist/bin/pushary-bell.js +14 -14
  5. package/dist/bin/pushary-claude.js +54 -82
  6. package/dist/bin/pushary-clean.js +37 -37
  7. package/dist/bin/pushary-codex-bridge.js +24 -24
  8. package/dist/bin/pushary-codex-hook.js +35 -34
  9. package/dist/bin/pushary-codex-session.js +8 -8
  10. package/dist/bin/pushary-codex.js +15 -15
  11. package/dist/bin/pushary-connect.js +26 -26
  12. package/dist/bin/pushary-cowork.js +5 -5
  13. package/dist/bin/pushary-daemon.js +1292 -63
  14. package/dist/bin/pushary-disconnect.js +31 -31
  15. package/dist/bin/pushary-display-hook.d.ts +1 -0
  16. package/dist/bin/pushary-display-hook.js +57 -0
  17. package/dist/bin/pushary-doctor.js +50 -50
  18. package/dist/bin/pushary-elicitation-hook.js +28 -27
  19. package/dist/bin/pushary-gemini-bridge.js +16 -16
  20. package/dist/bin/pushary-gemini-hook.js +30 -29
  21. package/dist/bin/pushary-hook.js +30 -29
  22. package/dist/bin/pushary-login.js +20 -20
  23. package/dist/bin/pushary-logout.js +30 -30
  24. package/dist/bin/pushary-mcp.js +14 -14
  25. package/dist/bin/pushary-mode.js +18 -18
  26. package/dist/bin/pushary-notification-hook.js +25 -24
  27. package/dist/bin/pushary-opencode-hook.js +29 -28
  28. package/dist/bin/pushary-permission-denied-hook.js +30 -29
  29. package/dist/bin/pushary-permission-hook.js +30 -29
  30. package/dist/bin/pushary-post-hook.js +31 -29
  31. package/dist/bin/pushary-prompt-hook.js +31 -29
  32. package/dist/bin/pushary-session-end-hook.js +27 -26
  33. package/dist/bin/pushary-session-start-hook.js +35 -34
  34. package/dist/bin/pushary-setup.js +61 -60
  35. package/dist/bin/pushary-stats.js +6 -6
  36. package/dist/bin/pushary-status.js +31 -31
  37. package/dist/bin/pushary-stop-hook.js +31 -26
  38. package/dist/bin/pushary-stopfailure-hook.js +25 -24
  39. package/dist/bin/pushary-suggestions.js +18 -18
  40. package/dist/bin/pushary-transcript-register.js +17 -16
  41. package/dist/bin/pushary-transcripts.js +19 -19
  42. package/dist/bin/pushary-upgrade.js +45 -45
  43. package/dist/bin/pushary-wait.js +18 -18
  44. package/dist/bin/pushary.js +7 -7
  45. package/dist/{chunk-QFF3QVIV.js → chunk-2DB7TBA7.js} +2 -2
  46. package/dist/{chunk-N4NSX5MB.js → chunk-2J4IVUEA.js} +3 -2
  47. package/dist/{chunk-E56VJY23.js → chunk-32JJ5KV3.js} +4 -4
  48. package/dist/{chunk-VFF7TP5B.js → chunk-3PPL64AG.js} +3 -3
  49. package/dist/{chunk-KFGRDWAW.js → chunk-3SAF4QXU.js} +4 -4
  50. package/dist/{chunk-TM4JH7YR.js → chunk-4DH54LS7.js} +1 -1
  51. package/dist/{chunk-RXR44U2J.js → chunk-4GWKKUQ5.js} +5 -5
  52. package/dist/{chunk-4U7F7VMC.js → chunk-4T25BBBO.js} +4 -4
  53. package/dist/{chunk-BMVWGPYB.js → chunk-53D6FFVE.js} +1 -1
  54. package/dist/{chunk-EW7CZHYP.js → chunk-5EQOUZYE.js} +2 -2
  55. package/dist/{chunk-PIO66HPG.js → chunk-6BFLDHPM.js} +3 -3
  56. package/dist/{chunk-D6COE26P.js → chunk-7FNSQMQ2.js} +4 -4
  57. package/dist/{chunk-R4B5AVFC.js → chunk-7O54GE5C.js} +3 -3
  58. package/dist/{chunk-GUJBS6TK.js → chunk-AUDYAVNM.js} +3 -3
  59. package/dist/{chunk-5XYYBB5Z.js → chunk-BGEUAJYL.js} +2 -2
  60. package/dist/{chunk-2KDTIUC7.js → chunk-BRG4XS2H.js} +1 -1
  61. package/dist/{chunk-EPARIXRC.js → chunk-CI6MDBQB.js} +7 -7
  62. package/dist/{chunk-LKXOSW2L.js → chunk-CLHRSK5L.js} +4 -4
  63. package/dist/{chunk-5KQN7AIL.js → chunk-D4X4BQVQ.js} +10 -10
  64. package/dist/{chunk-ZWCKS65X.js → chunk-DARPCQPY.js} +2 -2
  65. package/dist/{chunk-QDISUNK3.js → chunk-DCHZ5JOI.js} +6 -6
  66. package/dist/{chunk-N7A44RIA.js → chunk-DOG3BQFO.js} +6 -6
  67. package/dist/{chunk-ILWEGI4H.js → chunk-DUOBFECC.js} +1 -1
  68. package/dist/{chunk-LT2DOCFI.js → chunk-DX65IDBI.js} +1 -1
  69. package/dist/{chunk-37OD7FUI.js → chunk-E5XYFIYL.js} +6 -6
  70. package/dist/{chunk-HIHA3GOR.js → chunk-EH5OLIP2.js} +2 -2
  71. package/dist/{chunk-3S5X7VZJ.js → chunk-EM2RSWDA.js} +5 -5
  72. package/dist/{chunk-DU7L7R4A.js → chunk-EOGVWCLF.js} +5 -5
  73. package/dist/{chunk-UTVNXB6U.js → chunk-EVBG5YUO.js} +3 -3
  74. package/dist/{chunk-YDSOTAZ6.js → chunk-FEC3JUIH.js} +3 -3
  75. package/dist/{chunk-KYEZFN6K.js → chunk-GAAN3Y7V.js} +1 -1
  76. package/dist/{chunk-LISVMDVS.js → chunk-HRRGIVIL.js} +3 -3
  77. package/dist/{chunk-RRW2LVVR.js → chunk-HXV2SY2V.js} +2 -2
  78. package/dist/{chunk-2BVLEMGX.js → chunk-I6TIZMM3.js} +5 -5
  79. package/dist/{chunk-4Y7EI5W5.js → chunk-I73UQU7K.js} +1 -1
  80. package/dist/{chunk-QQ7VXRIN.js → chunk-JCZWWBBA.js} +5 -5
  81. package/dist/{chunk-EEFFP64A.js → chunk-JFVLMWKY.js} +241 -52
  82. package/dist/{chunk-5KS3E3T5.js → chunk-JOMG6J64.js} +1 -1
  83. package/dist/{chunk-EEQG7VF2.js → chunk-KDUWFGY2.js} +4 -4
  84. package/dist/{chunk-6YZ72YP3.js → chunk-LIDUPDEY.js} +4 -4
  85. package/dist/{chunk-DNCEZWRC.js → chunk-LRYZXY4V.js} +1 -1
  86. package/dist/{chunk-L6F62LKX.js → chunk-M7BXAWUC.js} +3 -3
  87. package/dist/{chunk-CR3HOHJC.js → chunk-MD4UJICD.js} +6 -5
  88. package/dist/{chunk-SMVTNLXU.js → chunk-NCTABQMC.js} +4 -3
  89. package/dist/{chunk-GNDPZBG3.js → chunk-P4TWTQ6V.js} +8 -8
  90. package/dist/{chunk-6HTAOF6H.js → chunk-PGLNE556.js} +1 -1
  91. package/dist/{chunk-PZV27E4J.js → chunk-PV5XEBFI.js} +9 -9
  92. package/dist/{chunk-S6BD346V.js → chunk-QDUDXJAF.js} +3 -3
  93. package/dist/{chunk-5XKJH5GD.js → chunk-QRS7FQHE.js} +504 -175
  94. package/dist/{chunk-LFBQ55OO.js → chunk-R7V6BPEV.js} +1 -1
  95. package/dist/{chunk-VZG76CWC.js → chunk-RPKFXNOJ.js} +1 -1
  96. package/dist/{chunk-4W7CKRWR.js → chunk-SFJOGZQV.js} +3 -3
  97. package/dist/{chunk-WHM3OVBA.js → chunk-SHW6KK2K.js} +2 -2
  98. package/dist/{chunk-4TRA3GDE.js → chunk-SIJHPGUW.js} +5 -5
  99. package/dist/{chunk-XGGAZJWJ.js → chunk-SNUHX5GQ.js} +6 -6
  100. package/dist/{chunk-IBHZ3JFE.js → chunk-SOHJ37NA.js} +5 -5
  101. package/dist/{chunk-CAUNUTYE.js → chunk-SONZCJY5.js} +26 -4
  102. package/dist/{chunk-SAXNYDPS.js → chunk-T6RWREWU.js} +1 -1
  103. package/dist/{chunk-LCBZLTHW.js → chunk-TPYZFYQ5.js} +4 -4
  104. package/dist/{chunk-XHVHGDMB.js → chunk-UBANQ4EZ.js} +13 -13
  105. package/dist/{chunk-OGGUOTIK.js → chunk-UEJTWQVF.js} +1 -1
  106. package/dist/{chunk-7KMLITXH.js → chunk-UIS332AZ.js} +1 -1
  107. package/dist/{chunk-PWVQALO2.js → chunk-UU3CDLIX.js} +2 -2
  108. package/dist/{chunk-MWR25RQZ.js → chunk-VGHWK5Z2.js} +5 -3
  109. package/dist/{chunk-OFTTOPTD.js → chunk-WL3V2UV4.js} +6 -6
  110. package/dist/{chunk-NVM4S37G.js → chunk-XO7LP3JC.js} +1 -1
  111. package/dist/{chunk-L3S2ZTQZ.js → chunk-Z7ORL6SC.js} +2 -2
  112. package/dist/{chunk-RO5G3OEN.js → chunk-ZX3KEXO3.js} +343 -84
  113. package/dist/{codex-app-cards-switch-PWLWIWKG.js → codex-app-cards-switch-CN3G7GZW.js} +11 -11
  114. package/dist/{codex-desktop-launch-S3PDGLAY.js → codex-desktop-launch-GFZXCDSL.js} +1 -1
  115. package/dist/{codex-session-launch-PY5IMFJU.js → codex-session-launch-4F2UGQYE.js} +18 -18
  116. package/dist/{config-SWV4YOP3.js → config-BLHDUDCS.js} +3 -3
  117. package/dist/{global-upgrade-DI3LGOQP.js → global-upgrade-IZEC22BQ.js} +10 -10
  118. package/dist/{identity-AY35DGAO.js → identity-3HGTEP5Q.js} +4 -4
  119. package/dist/{live-capabilities-IH3EGKL3.js → live-capabilities-AZK664T7.js} +5 -5
  120. package/dist/{paths-I4Q77ULZ.js → paths-ROMZUSEX.js} +3 -3
  121. package/dist/{reapply-OAV4IAG3.js → reapply-IJYRR4YK.js} +27 -27
  122. package/dist/src/index.d.ts +2 -6
  123. package/dist/src/index.js +31 -30
  124. package/dist/{upgrade-lock-7U5BOK6V.js → upgrade-lock-FGEZPX56.js} +4 -4
  125. package/dist/{usage-NTER4GHT.js → usage-HCURE44F.js} +3 -3
  126. package/package.json +5 -2
@@ -54,9 +54,9 @@ var isAgentQuestionSet = (value) => {
54
54
  const labels = /* @__PURE__ */ new Set();
55
55
  for (const option of question.options) {
56
56
  if (!option || typeof option !== "object" || Array.isArray(option)) return false;
57
- const record3 = option;
58
- const label = record3.label;
59
- if (typeof label !== "string" || label.length === 0 || labels.has(label) || record3.description !== void 0 && typeof record3.description !== "string") return false;
57
+ const record4 = option;
58
+ const label = record4.label;
59
+ if (typeof label !== "string" || label.length === 0 || labels.has(label) || record4.description !== void 0 && typeof record4.description !== "string") return false;
60
60
  labels.add(label);
61
61
  }
62
62
  questions.add(question.question);
@@ -536,9 +536,9 @@ var CANONICAL_COMMAND_KEYS = ["command"];
536
536
  var SHELL_TOOLS = /* @__PURE__ */ new Set([SHELL_TOOL, POWERSHELL_TOOL]);
537
537
  var PATH_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit", "Read"]);
538
538
  var PHONE_ANSWERED_TOOLS = /* @__PURE__ */ new Set(["AskUserQuestion", "ExitPlanMode"]);
539
- var firstString = (record3, keys2) => {
539
+ var firstString = (record4, keys2) => {
540
540
  for (const key of keys2) {
541
- const value = record3[key];
541
+ const value = record4[key];
542
542
  if (typeof value === "string" && value.length > 0) return value;
543
543
  }
544
544
  return void 0;
@@ -554,12 +554,12 @@ var BLANK_TASK_INPUT_TOOL = "TaskInput";
554
554
  var typesText = (value) => typeof value === "string" && value.trim().length > 0;
555
555
  var taskIdOf = (control, toolInput) => typeof toolInput[control.taskKey] === "string" ? { task_id: toolInput[control.taskKey] } : {};
556
556
  var typedIntoTask = (control, toolInput) => {
557
- const text2 = toolInput[control.inputKey];
558
- if (typesText(text2)) return { tool: SHELL_TOOL, input: { command: text2 }, unreadable: false };
559
- if (text2 !== void 0 && typeof text2 !== "string") return { tool: control.name, input: toolInput, unreadable: true };
557
+ const text3 = toolInput[control.inputKey];
558
+ if (typesText(text3)) return { tool: SHELL_TOOL, input: { command: text3 }, unreadable: false };
559
+ if (text3 !== void 0 && typeof text3 !== "string") return { tool: control.name, input: toolInput, unreadable: true };
560
560
  return {
561
561
  tool: BLANK_TASK_INPUT_TOOL,
562
- input: { ...taskIdOf(control, toolInput), input: text2 ?? "" },
562
+ input: { ...taskIdOf(control, toolInput), input: text3 ?? "" },
563
563
  unreadable: false
564
564
  };
565
565
  };
@@ -986,10 +986,10 @@ var secretRedactionRules = (shapes) => [
986
986
  var SECRET_REDACTION_RULES = secretRedactionRules(DISPLAYED_SECRET_SHAPES);
987
987
  var CUT_OFF_TEXT_REDACTION_RULES = secretRedactionRules(CUT_OFF_SECRET_SHAPES);
988
988
  var HIGH_ENTROPY_RULE = { pattern: /[A-Za-z0-9+/]{40,}={0,2}/g, replacement: "[redacted]" };
989
- var applyRedactionRules = (rules, text2) => rules.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text2);
990
- var redactSecrets = (text2) => applyRedactionRules(SECRET_REDACTION_RULES, text2);
991
- var redactSecretsFromContent = (text2) => applyRedactionRules(CUT_OFF_TEXT_REDACTION_RULES, text2);
992
- var redactSecretsDeep = (text2) => redactSecrets(text2).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
989
+ var applyRedactionRules = (rules, text3) => rules.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text3);
990
+ var redactSecrets = (text3) => applyRedactionRules(SECRET_REDACTION_RULES, text3);
991
+ var redactSecretsFromContent = (text3) => applyRedactionRules(CUT_OFF_TEXT_REDACTION_RULES, text3);
992
+ var redactSecretsDeep = (text3) => redactSecrets(text3).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
993
993
 
994
994
  // ../contracts/src/cursor.ts
995
995
  var CURSOR_GATE_EVENTS = ["beforeShellExecution", "beforeMCPExecution", "preToolUse"];
@@ -1029,13 +1029,13 @@ var cursorGateOwnsToolCall = (registration, toolName) => typeof toolName === "st
1029
1029
  var INTERNAL_ENVELOPE = /(^|\n) {0,3}(?:<(total_tokens|task-notification)>[\s\S]*?(?:<\/\2>|$)[\t ]*)+/g;
1030
1030
  var INCOMPLETE_ENVELOPE = /(^|\n) {0,3}<(?:total_tokens|task-notification)$/g;
1031
1031
  var SUGGESTION_REQUEST = /^This is an app-generated request for a suggested next user(?: message| prompt)/;
1032
- var visibleProse = (text2) => text2.replace(INTERNAL_ENVELOPE, "$1").replace(INCOMPLETE_ENVELOPE, "$1");
1033
- function conversationText(text2) {
1034
- if (SUGGESTION_REQUEST.test(text2.trimStart())) return "";
1032
+ var visibleProse = (text3) => text3.replace(INTERNAL_ENVELOPE, "$1").replace(INCOMPLETE_ENVELOPE, "$1");
1033
+ function conversationText(text3) {
1034
+ if (SUGGESTION_REQUEST.test(text3.trimStart())) return "";
1035
1035
  const output = [];
1036
1036
  let prose = [];
1037
1037
  let fence = null;
1038
- for (const line of text2.split("\n")) {
1038
+ for (const line of text3.split("\n")) {
1039
1039
  const marker = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];
1040
1040
  if (fence) {
1041
1041
  output.push(line);
@@ -1059,6 +1059,186 @@ function extractMessageText(content) {
1059
1059
  ).join("\n");
1060
1060
  }
1061
1061
 
1062
+ // ../contracts/src/native-input.ts
1063
+ var NativeInputAgent = /* @__PURE__ */ ((NativeInputAgent2) => {
1064
+ NativeInputAgent2["codex"] = "codex";
1065
+ NativeInputAgent2["hermes"] = "hermes";
1066
+ return NativeInputAgent2;
1067
+ })(NativeInputAgent || {});
1068
+ var NATIVE_INPUT = {
1069
+ protocol: 1,
1070
+ codexVersion: "0.163.0",
1071
+ hermesCommit: "2e83e2a935ee04f606aab58e498d34ca58d84c07",
1072
+ hermesRecoveryCommit: "1ba5596b494c699386304d425792f214b67afe2c",
1073
+ rpcTimeoutMs: 5e3,
1074
+ receiptWindowMs: 15e3,
1075
+ maxFrameBytes: 4194304,
1076
+ maxSessions: 128,
1077
+ receiptPageSize: 100,
1078
+ receiptMaxPages: 4,
1079
+ heartbeatMs: 6e4,
1080
+ maxConcurrent: 4,
1081
+ journalVersion: 1,
1082
+ journalDirectory: "run/native-input",
1083
+ codexSocket: "app-server-control/app-server-control.sock",
1084
+ hermesSocket: "gateway.sock",
1085
+ hermesWebSocketProtocol: "hermes-gateway-v1",
1086
+ hermesTicketPrefix: "hermes-gateway-ticket."
1087
+ };
1088
+ var HermesInputCapability = /* @__PURE__ */ ((HermesInputCapability2) => {
1089
+ HermesInputCapability2["durableAdmission"] = "durable-admission-v1";
1090
+ HermesInputCapability2["submissionReceipt"] = "submission-receipt-v1";
1091
+ HermesInputCapability2["admissionHistory"] = "admission-history-v1";
1092
+ HermesInputCapability2["ordinaryInputEvents"] = "ordinary-input-events-v1";
1093
+ return HermesInputCapability2;
1094
+ })(HermesInputCapability || {});
1095
+ var qualifyHermesReceiptMode = (codeSha, capabilities) => {
1096
+ if (!Array.isArray(capabilities) || !capabilities.every((value) => typeof value === "string"))
1097
+ return null;
1098
+ if (!capabilities.includes("durable-admission-v1" /* durableAdmission */))
1099
+ return null;
1100
+ if (codeSha === NATIVE_INPUT.hermesCommit)
1101
+ return "event_replay" /* eventReplay */;
1102
+ if (codeSha === NATIVE_INPUT.hermesRecoveryCommit && Object.values(HermesInputCapability).every(
1103
+ (capability) => capabilities.includes(capability)
1104
+ ))
1105
+ return "submission" /* submission */;
1106
+ return null;
1107
+ };
1108
+ var nativeRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1109
+ var nativeIdentifier = (v) => typeof v === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(v);
1110
+ var nativeInputAction = (p) => {
1111
+ if (p.accepted) return "acknowledge" /* acknowledge */;
1112
+ if (p.nowMs >= p.expiresAtMs)
1113
+ return p.attempted ? "outcome_unknown" /* outcomeUnknown */ : "expire" /* expire */;
1114
+ if (p.attempted) return "observe" /* observe */;
1115
+ return "submit" /* submit */;
1116
+ };
1117
+ var isCodexQueuedReceipt = (v, commandId) => nativeRecord(v) && nativeIdentifier(v.id) && v.clientUserMessageId === commandId;
1118
+ var isCodexInputReceipt = (v, sessionId, commandId) => nativeRecord(v) && v.id === sessionId && Array.isArray(v.turns) && v.turns.some(
1119
+ (turn) => nativeRecord(turn) && Array.isArray(turn.items) && turn.items.some(
1120
+ (item) => nativeRecord(item) && item.type === "userMessage" && item.clientId === commandId
1121
+ )
1122
+ );
1123
+ var parseHermesAdmission = (v, profile, sessionId) => {
1124
+ if (!nativeRecord(v) || !nativeIdentifier(v.admission_id) || !nativeRecord(v.ref) || v.ref.profile_id !== profile || v.ref.session_id !== sessionId || v.status !== "queued" /* queued */ && v.status !== "started" /* started */ && v.status !== "terminal" /* terminal */ && v.status !== "unknown" /* unknown */)
1125
+ return null;
1126
+ return {
1127
+ admissionId: v.admission_id,
1128
+ status: v.status,
1129
+ outcome: typeof v.outcome === "string" ? v.outcome : null
1130
+ };
1131
+ };
1132
+ var parseHermesReplayCursor = (v) => {
1133
+ if (!nativeRecord(v) || !nativeIdentifier(v.replay_epoch) || typeof v.last_sequence !== "number" || !Number.isSafeInteger(v.last_sequence) || v.last_sequence < 0)
1134
+ return null;
1135
+ return { replay_epoch: v.replay_epoch, last_sequence: v.last_sequence };
1136
+ };
1137
+ var hermesPendingAdmissionId = (snapshot, profile, sessionId, commandId) => {
1138
+ if (!nativeRecord(snapshot) || snapshot.session_id !== sessionId || !Array.isArray(snapshot.pending))
1139
+ return null;
1140
+ for (const row of snapshot.pending) {
1141
+ if (!nativeRecord(row) || row.input_id !== commandId) continue;
1142
+ const receipt = parseHermesAdmission(row, profile, sessionId);
1143
+ if (receipt) return receipt.admissionId;
1144
+ }
1145
+ return null;
1146
+ };
1147
+ var hermesReplayAdmissionId = (replay, cursor, sessionId, commandId) => {
1148
+ if (!nativeRecord(replay) || replay.replay_epoch !== cursor.replay_epoch || replay.truncated !== false || replay.snapshot_required !== false || !Array.isArray(replay.events))
1149
+ return null;
1150
+ for (const event of replay.events) {
1151
+ if (!nativeRecord(event) || event.type !== "message.complete" || event.session_id !== sessionId || event.replay_epoch !== cursor.replay_epoch || typeof event.seq !== "number" || !Number.isSafeInteger(event.seq) || event.seq <= cursor.last_sequence || !nativeIdentifier(event.admission_id) || !nativeRecord(event.payload) || event.payload.admission_id !== event.admission_id || !nativeRecord(event.payload.persisted_turn) || event.payload.persisted_turn.submission_id !== commandId)
1152
+ continue;
1153
+ return event.admission_id;
1154
+ }
1155
+ return null;
1156
+ };
1157
+
1158
+ // ../contracts/src/command-delivery.ts
1159
+ var COMMAND_SETTLEMENT_STATES = [
1160
+ "delivered",
1161
+ "failed",
1162
+ "uncertain"
1163
+ ];
1164
+ var COMMAND_RECOVERY = {
1165
+ receiptRetentionMs: 7 * 24 * 60 * 60 * 1e3,
1166
+ waitingObservationMs: 9e4,
1167
+ acknowledgementTimeoutMs: 5e3,
1168
+ emissionRecoveryGraceMs: 6e4,
1169
+ retrySendWindowMs: 72e5
1170
+ };
1171
+ var COMMAND_ACKNOWLEDGEMENT_STATES = [
1172
+ "dispatching",
1173
+ ...COMMAND_SETTLEMENT_STATES
1174
+ ];
1175
+ var isCommandAcknowledgementReceipt = (value) => typeof value === "object" && value !== null && "ok" in value && value.ok === true;
1176
+
1177
+ // ../contracts/src/claude-wake.ts
1178
+ var CLAUDE_WAKE = {
1179
+ apiPath: "/api/agent/command/wake",
1180
+ message: "Pushary has a message from your user. It arrives through Pushary's hook; no reply is needed.",
1181
+ unixMinimumVersion: "2.1.224",
1182
+ windowsMinimumVersion: "2.1.234",
1183
+ stopFeedbackMinimumVersion: "2.1.163",
1184
+ receiptWindowMs: 15e3,
1185
+ debounceMs: 6e4,
1186
+ missingReceiptLimit: 3,
1187
+ retainedAttempts: 128,
1188
+ directory: "run/claude-wake"
1189
+ };
1190
+ var versionAtLeast = (version, floor) => {
1191
+ if (!version || !/^\d+\.\d+\.\d+$/.test(version)) return false;
1192
+ const parts = version.split(".").map(Number);
1193
+ const minimum = floor.split(".").map(Number);
1194
+ if (!parts.every(Number.isSafeInteger)) return false;
1195
+ for (let index = 0; index < 3; index++) {
1196
+ if (parts[index] !== minimum[index]) return parts[index] > minimum[index];
1197
+ }
1198
+ return true;
1199
+ };
1200
+ var supportsClaudeInbox = (version, platform) => {
1201
+ if (platform === "win32")
1202
+ return versionAtLeast(version, CLAUDE_WAKE.windowsMinimumVersion);
1203
+ return (platform === "darwin" || platform === "linux") && versionAtLeast(version, CLAUDE_WAKE.unixMinimumVersion);
1204
+ };
1205
+ var claudeWakeDecision = (progress) => {
1206
+ if (!progress.idle) return "agent_busy" /* busy */;
1207
+ const attempts = [...progress.attempts].sort(
1208
+ (a, b) => b.submittedAtMs - a.submittedAtMs
1209
+ );
1210
+ const recent = attempts.find(
1211
+ (attempt) => attempt.sessionId === progress.sessionId
1212
+ );
1213
+ if (recent && progress.nowMs - recent.submittedAtMs < CLAUDE_WAKE.debounceMs) {
1214
+ return recent.accepted ? "wake_accepted" /* accepted */ : "wake_unconfirmed" /* unconfirmed */;
1215
+ }
1216
+ let missing = 0;
1217
+ for (const attempt of attempts) {
1218
+ if (attempt.accepted) break;
1219
+ if (progress.nowMs - attempt.submittedAtMs >= CLAUDE_WAKE.receiptWindowMs)
1220
+ missing++;
1221
+ if (missing >= CLAUDE_WAKE.missingReceiptLimit)
1222
+ return "wake_disabled" /* circuitOpen */;
1223
+ }
1224
+ return null;
1225
+ };
1226
+ var CLAUDE_WAKE_API = CLAUDE_WAKE.apiPath;
1227
+ var claudeWakeWaitingOn = (outcome) => {
1228
+ switch (outcome) {
1229
+ case "wake_accepted" /* accepted */:
1230
+ return "hook" /* hook */;
1231
+ case "agent_busy" /* busy */:
1232
+ return "agent_turn" /* agentTurn */;
1233
+ case "wake_unconfirmed" /* unconfirmed */:
1234
+ return "wake_unconfirmed" /* wakeUnconfirmed */;
1235
+ case "wake_disabled" /* circuitOpen */:
1236
+ return "wake_disabled" /* wakeDisabled */;
1237
+ case "wake_not_sent" /* notSent */:
1238
+ return "local_use" /* localUse */;
1239
+ }
1240
+ };
1241
+
1062
1242
  // ../contracts/src/shell-analysis.ts
1063
1243
  var SHELL_WORD_SEPARATOR = /[ \t\n]/;
1064
1244
  var ARITHMETIC_EVALUATING_EXPANSION = /\$[#+=~^]*(?:[A-Za-z_][A-Za-z0-9_]*|[0-9]+|[-?$!@*#])?\[/;
@@ -1096,16 +1276,16 @@ var splitShellSegments = (command) => {
1096
1276
  let consumed = -1;
1097
1277
  let readsPipe = false;
1098
1278
  for (const lexeme of lexemes) {
1099
- const { index, text: text2, quote, kind } = lexeme;
1279
+ const { index, text: text3, quote, kind } = lexeme;
1100
1280
  if (index <= consumed || kind !== "text" || quote === "'") continue;
1101
- if (text2 === "`" || text2 === "$" && command[index + 1] === "(") return null;
1281
+ if (text3 === "`" || text3 === "$" && command[index + 1] === "(") return null;
1102
1282
  if (quote !== null) continue;
1103
- if (UNDECOMPOSABLE.has(text2)) return null;
1104
- if (!SEGMENT_SEPARATORS.has(text2)) continue;
1105
- const doubled = DOUBLED_SEPARATORS.has(text2) && command[index + 1] === text2;
1283
+ if (UNDECOMPOSABLE.has(text3)) return null;
1284
+ if (!SEGMENT_SEPARATORS.has(text3)) continue;
1285
+ const doubled = DOUBLED_SEPARATORS.has(text3) && command[index + 1] === text3;
1106
1286
  consumed = index + (doubled ? 1 : 0);
1107
1287
  segments.push({ text: trimShellWhitespace(command.slice(start, index)), readsPipe });
1108
- readsPipe = text2 === PIPE && !doubled;
1288
+ readsPipe = text3 === PIPE && !doubled;
1109
1289
  start = consumed + 1;
1110
1290
  }
1111
1291
  segments.push({ text: trimShellWhitespace(command.slice(start)), readsPipe });
@@ -1203,10 +1383,10 @@ var shellVisibleText = (command) => {
1203
1383
  const lexemes = scanShell(command);
1204
1384
  if (lexemes === null) return null;
1205
1385
  let visible = "";
1206
- for (const { text: text2, quote, kind } of lexemes) {
1386
+ for (const { text: text3, quote, kind } of lexemes) {
1207
1387
  if (kind === "escape" && quote === '"') return null;
1208
- const literal = kind === "text" && (quote === "'" || quote === '"' && LITERAL_IN_DOUBLE_QUOTES.has(text2));
1209
- visible += literal ? "_".repeat(text2.length) : text2;
1388
+ const literal = kind === "text" && (quote === "'" || quote === '"' && LITERAL_IN_DOUBLE_QUOTES.has(text3));
1389
+ visible += literal ? "_".repeat(text3.length) : text3;
1210
1390
  }
1211
1391
  return visible;
1212
1392
  };
@@ -1222,14 +1402,14 @@ var shellWordsOf = (command) => {
1222
1402
  const lexemes = scanShell(command);
1223
1403
  if (lexemes === null) return null;
1224
1404
  const words = [];
1225
- let text2 = "";
1405
+ let text3 = "";
1226
1406
  let plain = true;
1227
1407
  let expands = false;
1228
1408
  let comment = false;
1229
1409
  let started = false;
1230
1410
  const finishWord = () => {
1231
- if (started) words.push({ text: text2, plain, expands, comment });
1232
- text2 = "";
1411
+ if (started) words.push({ text: text3, plain, expands, comment });
1412
+ text3 = "";
1233
1413
  plain = true;
1234
1414
  expands = false;
1235
1415
  comment = false;
@@ -1242,7 +1422,7 @@ var shellWordsOf = (command) => {
1242
1422
  continue;
1243
1423
  }
1244
1424
  if (lexeme.kind === "escape") {
1245
- text2 += lexeme.text.slice(1);
1425
+ text3 += lexeme.text.slice(1);
1246
1426
  plain = false;
1247
1427
  started = true;
1248
1428
  continue;
@@ -1253,7 +1433,7 @@ var shellWordsOf = (command) => {
1253
1433
  }
1254
1434
  comment ||= lexeme.quote === null && !started && lexeme.text === "#";
1255
1435
  expands ||= lexeme.quote !== "'" && lexeme.text === "$";
1256
- text2 += lexeme.text;
1436
+ text3 += lexeme.text;
1257
1437
  started = true;
1258
1438
  }
1259
1439
  finishWord();
@@ -1328,40 +1508,40 @@ var opensAHereString = (source, index) => {
1328
1508
  return source.charAt(index) === HERE_STRING_SIGIL && (SINGLE_QUOTES.has(quote) || DOUBLE_QUOTES.has(quote)) && HERE_STRING_HEADER_REST.test(source.slice(index + 2));
1329
1509
  };
1330
1510
  var singleQuotedTextAt = (source, open) => {
1331
- let text2 = "";
1511
+ let text3 = "";
1332
1512
  for (let index = open + 1; index < source.length; index += 1) {
1333
1513
  const char = source.charAt(index);
1334
1514
  if (!SINGLE_QUOTES.has(char)) {
1335
- text2 += char;
1515
+ text3 += char;
1336
1516
  } else if (SINGLE_QUOTES.has(source.charAt(index + 1))) {
1337
- text2 += char;
1517
+ text3 += char;
1338
1518
  index += 1;
1339
1519
  } else {
1340
- return { end: index + 1, text: text2, expands: false, nested: [] };
1520
+ return { end: index + 1, text: text3, expands: false, nested: [] };
1341
1521
  }
1342
1522
  }
1343
1523
  return null;
1344
1524
  };
1345
1525
  var expandableTextUntil = (source, start, closesAt, nesting) => {
1346
- let text2 = "";
1526
+ let text3 = "";
1347
1527
  let expands = false;
1348
1528
  const nested = [];
1349
1529
  for (let index = start; index < source.length; index += 1) {
1350
1530
  const char = source.charAt(index);
1351
- if (closesAt(index)) return { end: index + 1, text: text2, expands, nested };
1531
+ if (closesAt(index)) return { end: index + 1, text: text3, expands, nested };
1352
1532
  if (char === ESCAPE || DOUBLE_QUOTES.has(char) && DOUBLE_QUOTES.has(source.charAt(index + 1))) {
1353
- text2 += source.charAt(index + 1);
1533
+ text3 += source.charAt(index + 1);
1354
1534
  index += 1;
1355
1535
  } else if (source.startsWith(SUBEXPRESSION_OPEN, index)) {
1356
1536
  const group = groupAt(source, index + SUBEXPRESSION_OPEN.length, ")", nesting + 1);
1357
1537
  if (group === null) return null;
1358
1538
  nested.push(group.inner);
1359
- text2 += SUBEXPRESSION_PLACEHOLDER;
1539
+ text3 += SUBEXPRESSION_PLACEHOLDER;
1360
1540
  expands = true;
1361
1541
  index = group.end - 1;
1362
1542
  } else {
1363
1543
  expands ||= opensAVariable(source, index);
1364
- text2 += char;
1544
+ text3 += char;
1365
1545
  }
1366
1546
  }
1367
1547
  return null;
@@ -1860,12 +2040,12 @@ var parameterValueOf = (command, fullName, shortestPrefix) => {
1860
2040
  };
1861
2041
  var operandTextsOf = (command) => command.args.flatMap((arg) => {
1862
2042
  const parameter = parameterOf(arg);
1863
- const text2 = parameter === null ? arg.text : parameter.value;
1864
- return text2 === void 0 ? [] : text2.split(POWERSHELL_ARRAY_SEPARATOR);
2043
+ const text3 = parameter === null ? arg.text : parameter.value;
2044
+ return text3 === void 0 ? [] : text3.split(POWERSHELL_ARRAY_SEPARATOR);
1865
2045
  });
1866
2046
  var positionalTextsOf = (command) => command.args.filter((arg) => parameterOf(arg) === null).map((arg) => arg.text);
1867
2047
  var firstOperandOf = (command, isSwitch) => command.args.find((arg) => !isSwitch.test(arg.text))?.text;
1868
- var namesASecretPath = (text2, judge) => judge.namesASecretFile(fileNameOf(text2.trim()));
2048
+ var namesASecretPath = (text3, judge) => judge.namesASecretFile(fileNameOf(text3.trim()));
1869
2049
  var isAssignmentTarget = (word) => POWERSHELL_ASSIGNMENT_TARGET.test(word.text) || word.text === POWERSHELL_ARRAY_SEPARATOR;
1870
2050
  var wordsAfterAnAssignment = (words) => {
1871
2051
  const operator = words.findIndex((word) => isPowerShellAssignmentOperator(word));
@@ -1924,7 +2104,7 @@ var copyDestinationOf = (command) => {
1924
2104
  };
1925
2105
  var writesASecretFileFromPowerShell = (command, judge) => {
1926
2106
  if (command.cmdlet !== COPY_ITEM) {
1927
- return POWERSHELL_FILE_WRITERS.has(command.cmdlet) && operandTextsOf(command).some((text2) => namesASecretPath(text2, judge));
2107
+ return POWERSHELL_FILE_WRITERS.has(command.cmdlet) && operandTextsOf(command).some((text3) => namesASecretPath(text3, judge));
1928
2108
  }
1929
2109
  const destination = copyDestinationOf(command);
1930
2110
  return destination !== void 0 && namesASecretPath(destination, judge);
@@ -1932,7 +2112,7 @@ var writesASecretFileFromPowerShell = (command, judge) => {
1932
2112
  var formatsADisk = (command) => DISK_ERASERS.has(command.cmdlet);
1933
2113
  var changesAWindowsService = (command) => {
1934
2114
  if (WINDOWS_SERVICE_CHANGERS.has(command.cmdlet)) return true;
1935
- const [verb, ...operands] = command.args.map((arg) => arg.text.toLowerCase()).filter((text2) => !text2.startsWith(REMOTE_MACHINE_PREFIX));
2115
+ const [verb, ...operands] = command.args.map((arg) => arg.text.toLowerCase()).filter((text3) => !text3.startsWith(REMOTE_MACHINE_PREFIX));
1936
2116
  if (command.name === SERVICE_CONTROL_PROGRAM) return SERVICE_CONTROL_VERBS_THAT_CHANGE.has(verb ?? "");
1937
2117
  return NET_PROGRAMS.has(command.name) && (NET_VERBS_THAT_CHANGE_A_SERVICE.has(verb ?? "") || verb === NET_START && operands.length > 0);
1938
2118
  };
@@ -1956,7 +2136,7 @@ var runsTextAsCode = (stage, judge) => {
1956
2136
  return SCRIPTBLOCK_FROM_TEXT.test(stage.source) || command !== null && (command.cmdlet === INVOKE_EXPRESSION || stage.readsAPipe && judge.runsWhatItReads(posixInvocationOf(command)));
1957
2137
  };
1958
2138
  var runsFetchedPowerShellCode = (stages, judge) => stages.some((stage) => fetchesWithPowerShell(stage, judge)) && stages.some((stage) => runsTextAsCode(stage, judge));
1959
- var downloadedFileNameOf = (text2) => fileNameOf(text2.replace(URL_QUERY_OR_FRAGMENT, "")).toLowerCase();
2139
+ var downloadedFileNameOf = (text3) => fileNameOf(text3.replace(URL_QUERY_OR_FRAGMENT, "")).toLowerCase();
1960
2140
  var downloadedFileNamesOf = (stages, judge) => new Set(stages.filter((stage) => fetchesWithPowerShell(stage, judge)).flatMap((stage) => {
1961
2141
  const command = powerShellCommandOf(stage);
1962
2142
  return command === null ? [] : operandTextsOf(command).map(downloadedFileNameOf);
@@ -1988,12 +2168,12 @@ var hostedPowerShellScriptOf = (command) => {
1988
2168
  if (!POWERSHELL_HOSTS.has(command.name)) return { kind: "none" };
1989
2169
  const texts = command.args.map((arg) => arg.text);
1990
2170
  for (let index = 0; index < texts.length; index += 1) {
1991
- const text2 = (texts[index] ?? "").trim();
1992
- if (!text2) continue;
1993
- if (!POWERSHELL_HOST_SWITCH.test(text2)) {
2171
+ const text3 = (texts[index] ?? "").trim();
2172
+ if (!text3) continue;
2173
+ if (!POWERSHELL_HOST_SWITCH.test(text3)) {
1994
2174
  return command.name === WINDOWS_POWERSHELL_HOST ? { kind: "script", script: texts.slice(index).join(" ") } : { kind: "none" };
1995
2175
  }
1996
- const option = text2.toLowerCase().replace(POWERSHELL_HOST_SWITCH_PREFIX, "");
2176
+ const option = text3.toLowerCase().replace(POWERSHELL_HOST_SWITCH_PREFIX, "");
1997
2177
  if (option && (POWERSHELL_HOST_ENCODED_PARAMETER.startsWith(option) || option === POWERSHELL_HOST_ENCODED_ALIAS)) {
1998
2178
  return { kind: "incomplete", reason: "encoded_command" };
1999
2179
  }
@@ -2043,9 +2223,9 @@ var wslCommandWordsOf = (command) => {
2043
2223
  const texts = command.args.map((arg) => arg.text);
2044
2224
  let index = 0;
2045
2225
  while (index < texts.length && POSIX_FLAG.test(texts[index] ?? "")) {
2046
- const text2 = texts[index] ?? "";
2047
- index += WSL_OPTIONS_WITH_A_VALUE.has(text2) ? 2 : 1;
2048
- if (WSL_COMMAND_MARKERS.has(text2)) break;
2226
+ const text3 = texts[index] ?? "";
2227
+ index += WSL_OPTIONS_WITH_A_VALUE.has(text3) ? 2 : 1;
2228
+ if (WSL_COMMAND_MARKERS.has(text3)) break;
2049
2229
  }
2050
2230
  return index < texts.length ? texts.slice(index) : void 0;
2051
2231
  };
@@ -2103,6 +2283,51 @@ var powerShellCommandHasAVisibleConsequence = (command, judge) => {
2103
2283
  return powerShellReadingIsDestructive(reading, judge) || stages.some((stage) => stageHasAVisibleConsequence(stage, judge)) || reading.statements.some(listsRecursivelyIntoARemoval) || runsFetchedPowerShellCode(stages, judge) || runsADownloadedFile(stages, judge) || reading.posixCommands.some((words) => judge.commandShowsAConsequence(words));
2104
2284
  };
2105
2285
 
2286
+ // ../contracts/src/release-version.ts
2287
+ var RELEASE_VERSION_PATTERN = /^(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})$/;
2288
+ var parseReleaseVersion = (version) => {
2289
+ const match = RELEASE_VERSION_PATTERN.exec(version);
2290
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
2291
+ };
2292
+ var compareReleaseVersions = (left, right) => {
2293
+ for (let index = 0; index < left.length; index++) {
2294
+ if (left[index] !== right[index]) return left[index] < right[index] ? -1 : 1;
2295
+ }
2296
+ return 0;
2297
+ };
2298
+ var isReleaseBelow = (version, floor) => compareReleaseVersions(version, floor) < 0;
2299
+ var formatReleaseVersion = (version) => version.join(".");
2300
+
2301
+ // ../contracts/src/claude-turn-end.ts
2302
+ var STOP_CONTEXT_RELEASE = [2, 1, 163];
2303
+ var readsStopContext = (claudeVersion) => {
2304
+ const release = claudeVersion === null ? null : parseReleaseVersion(claudeVersion);
2305
+ return release !== null && !isReleaseBelow(release, STOP_CONTEXT_RELEASE);
2306
+ };
2307
+ var stopContext = (additionalContext) => ({
2308
+ hookEventName: "Stop",
2309
+ additionalContext
2310
+ });
2311
+ var instructionAtTurnEnd = (instruction, claudeVersion) => readsStopContext(claudeVersion) ? { hookSpecificOutput: stopContext(instruction) } : { decision: "block", reason: instruction };
2312
+ var claudeTurnEndOutput = ({
2313
+ instruction,
2314
+ continueReason,
2315
+ claudeVersion
2316
+ }) => {
2317
+ if (instruction === void 0) return continueReason === void 0 ? void 0 : { decision: "block", reason: continueReason };
2318
+ if (continueReason === void 0) return instructionAtTurnEnd(instruction, claudeVersion);
2319
+ return readsStopContext(claudeVersion) ? { decision: "block", reason: continueReason, hookSpecificOutput: stopContext(instruction) } : { decision: "block", reason: `${continueReason}
2320
+
2321
+ ${instruction}` };
2322
+ };
2323
+
2324
+ // ../contracts/src/pending-command.ts
2325
+ var PENDING_COMMAND_PREFIX = "The user sent a new instruction from their phone via Pushary:";
2326
+ var pendingCommandInstruction = (command) => {
2327
+ const instruction = command.trim();
2328
+ return instruction.length === 0 ? void 0 : `${PENDING_COMMAND_PREFIX} ${instruction}`;
2329
+ };
2330
+
2106
2331
  // ../contracts/src/command-analysis/sql-text.ts
2107
2332
  var UNCERTAIN_SQL = { kind: "uncertain" };
2108
2333
  var STRING_PLACEHOLDER = "''";
@@ -2244,8 +2469,8 @@ var quotedToken = (source, start, reading, inside) => {
2244
2469
  }
2245
2470
  if (swallowsABacktick(source, start, end, reading.lexicon)) return "uncertain";
2246
2471
  const quote = source.charAt(start);
2247
- const text2 = syntax.content === "hidden" ? STRING_PLACEHOLDER : visibleQuotedText(source.slice(start + opener.length, end - opener.length).replaceAll(quote + quote, quote));
2248
- return { text: text2, end, insideExecutableComment: inside };
2472
+ const text3 = syntax.content === "hidden" ? STRING_PLACEHOLDER : visibleQuotedText(source.slice(start + opener.length, end - opener.length).replaceAll(quote + quote, quote));
2473
+ return { text: text3, end, insideExecutableComment: inside };
2249
2474
  };
2250
2475
  var lineCommentEnd = (source, start, lexicon) => {
2251
2476
  const terminator = endOfRun(source, start, (character) => !isLineCommentTerminator(character));
@@ -2295,9 +2520,9 @@ var dollarToken = (source, start, lexicon, inside) => {
2295
2520
  };
2296
2521
  var numberToken = (source, start, inside) => {
2297
2522
  const end = endOfRun(source, start, isWordCharacter);
2298
- const text2 = source.slice(start, end);
2299
- if (!DECIMAL_DIGITS.test(text2) && dollarQuoteDelimiterAt(source, end) !== void 0) return "uncertain";
2300
- return { text: text2, end, insideExecutableComment: inside };
2523
+ const text3 = source.slice(start, end);
2524
+ if (!DECIMAL_DIGITS.test(text3) && dollarQuoteDelimiterAt(source, end) !== void 0) return "uncertain";
2525
+ return { text: text3, end, insideExecutableComment: inside };
2301
2526
  };
2302
2527
  var identifierToken = (source, start, inside) => {
2303
2528
  const end = endOfRun(source, start, isIdentifierPart);
@@ -2505,13 +2730,13 @@ var splitReading = (args, index, clusterBefore, attached) => {
2505
2730
  return { kind: "split", prefix, value: args[index + 1], rest: index + 2 };
2506
2731
  };
2507
2732
  var requiredValueStep = (args, index) => index + 1 < args.length ? nextOption(index + 2) : finished(EXITS);
2508
- var shortOptionStep = (args, index, text2, options) => {
2509
- for (let position = 1; position < text2.length; position += 1) {
2510
- const letter = text2.charAt(position);
2733
+ var shortOptionStep = (args, index, text3, options) => {
2734
+ for (let position = 1; position < text3.length; position += 1) {
2735
+ const letter = text3.charAt(position);
2511
2736
  if (options.switches.has(letter)) continue;
2512
2737
  if (!options.withAValue.has(letter)) return finished(EXITS);
2513
- const attached = text2.slice(position + 1);
2514
- if (letter === SPLIT_STRING_LETTER) return finished(splitReading(args, index, text2.slice(0, position), attached === "" ? void 0 : attached));
2738
+ const attached = text3.slice(position + 1);
2739
+ if (letter === SPLIT_STRING_LETTER) return finished(splitReading(args, index, text3.slice(0, position), attached === "" ? void 0 : attached));
2515
2740
  return attached === "" ? requiredValueStep(args, index) : nextOption(index + 1);
2516
2741
  }
2517
2742
  return nextOption(index + 1);
@@ -2522,8 +2747,8 @@ var gnuLongOptionAbbreviatedBy = (name, options) => {
2522
2747
  const candidates = options.filter((option) => option.name.startsWith(name));
2523
2748
  return candidates.length === 1 ? candidates[0] : void 0;
2524
2749
  };
2525
- var longOptionStep = (args, index, text2, options) => {
2526
- const body = text2.slice(LONG_OPTION_PREFIX.length);
2750
+ var longOptionStep = (args, index, text3, options) => {
2751
+ const body = text3.slice(LONG_OPTION_PREFIX.length);
2527
2752
  const separator = body.indexOf(ASSIGNMENT_SEPARATOR);
2528
2753
  const attached = separator === -1 ? void 0 : body.slice(separator + 1);
2529
2754
  const option = gnuLongOptionAbbreviatedBy(separator === -1 ? body : body.slice(0, separator), options);
@@ -2553,7 +2778,7 @@ var runsSomething = (reading) => reading.kind === "command" || reading.kind ===
2553
2778
  var sameEnvReading = (left, right) => {
2554
2779
  if (left.kind === "command" && right.kind === "command") return left.start === right.start;
2555
2780
  if (left.kind !== "split" || right.kind !== "split") return false;
2556
- return left.rest === right.rest && left.prefix.length === right.prefix.length && left.prefix.every((text2, position) => text2 === right.prefix[position]) && left.value?.text === right.value?.text && left.value?.expands === right.value?.expands;
2781
+ return left.rest === right.rest && left.prefix.length === right.prefix.length && left.prefix.every((text3, position) => text3 === right.prefix[position]) && left.value?.text === right.value?.text && left.value?.expands === right.value?.expands;
2557
2782
  };
2558
2783
  var envReadingOf = (args) => {
2559
2784
  const readings = ENV_FLAVORS.map((flavor) => flavorReadingOf(args, flavor));
@@ -2597,8 +2822,8 @@ var clusterReadingOf = (cluster, syntax) => {
2597
2822
  endsOptions: [...letters].some((letter) => syntax.lettersThatEndOptions.has(letter))
2598
2823
  };
2599
2824
  };
2600
- var endsOptionParsing = (text2) => text2 === END_OF_OPTIONS2 || text2 === LONE_DASH2;
2601
- var isAnOperand = (text2) => !text2.startsWith("-") && !text2.startsWith("+");
2825
+ var endsOptionParsing = (text3) => text3 === END_OF_OPTIONS2 || text3 === LONE_DASH2;
2826
+ var isAnOperand = (text3) => !text3.startsWith("-") && !text3.startsWith("+");
2602
2827
  var optionValueIsUnreadable = (value) => value === void 0 || value.expands;
2603
2828
  var shellCommandStringOf = (shell, args) => {
2604
2829
  const syntax = SHELL_OPTION_SYNTAX.get(shell);
@@ -2900,7 +3125,6 @@ var withoutDeclinedAgent = (agents, agent) => agents.filter((candidate) => candi
2900
3125
  // ../contracts/src/cli-version-standing.ts
2901
3126
  var FIRST_AUTO_UPDATING_RELEASE = [1, 5, 0];
2902
3127
  var MIN_SAFE_RELEASE = [1, 9, 26];
2903
- var formatReleaseVersion = (version) => version.join(".");
2904
3128
  var FIRST_AUTO_UPDATING_CLI_VERSION = formatReleaseVersion(FIRST_AUTO_UPDATING_RELEASE);
2905
3129
  var MIN_SAFE_CLI_VERSION = formatReleaseVersion(MIN_SAFE_RELEASE);
2906
3130
 
@@ -2940,13 +3164,13 @@ var leadingWordPart = (rest) => {
2940
3164
  return double ? { text: (double[1] ?? "").replace(ESCAPED_INSIDE_DOUBLE_QUOTES, "$1"), length: double[0].length } : null;
2941
3165
  };
2942
3166
  var leadingWord = (rest) => {
2943
- let text2 = "";
3167
+ let text3 = "";
2944
3168
  let length = 0;
2945
3169
  for (let part = leadingWordPart(rest); part !== null; part = leadingWordPart(rest.slice(length))) {
2946
- text2 += part.text;
3170
+ text3 += part.text;
2947
3171
  length += part.length;
2948
3172
  }
2949
- return length === 0 ? null : { text: text2, length };
3173
+ return length === 0 ? null : { text: text3, length };
2950
3174
  };
2951
3175
  var wordsOfAJoinedCommand = (joined) => {
2952
3176
  const words = [];
@@ -3114,15 +3338,89 @@ var codexNativeApprovalResponse = (approval, answer) => {
3114
3338
  // ../contracts/src/transcript-record.ts
3115
3339
  var COMPRESSED_TRANSCRIPT_RECORD_MARKER = 1;
3116
3340
  var TRANSCRIPT_RECORD_MAX_INFLATED_BYTES = 1024 * 1024;
3341
+ var isCompressedTranscriptRecord = (opened) => opened[0] === COMPRESSED_TRANSCRIPT_RECORD_MARKER;
3117
3342
  var compressionShrinks = (raw, deflated) => deflated.length + 1 < raw.length;
3343
+ var inflatedRecord = (deflated, inflateRawWithin) => {
3344
+ const inflated = inflateRawWithin(deflated, TRANSCRIPT_RECORD_MAX_INFLATED_BYTES);
3345
+ return inflated && inflated.length > 0 ? inflated : null;
3346
+ };
3347
+ var transcriptRecordPlaintext = (opened, inflateRawWithin) => isCompressedTranscriptRecord(opened) ? inflatedRecord(opened.subarray(1), inflateRawWithin) : opened;
3118
3348
  var compressTranscriptRecord = (raw, deflateRaw) => {
3119
3349
  if (raw.length > TRANSCRIPT_RECORD_MAX_INFLATED_BYTES) return raw;
3120
3350
  const deflated = deflateRaw(raw);
3121
3351
  if (!compressionShrinks(raw, deflated)) return raw;
3122
- const record3 = new Uint8Array(deflated.length + 1);
3123
- record3[0] = COMPRESSED_TRANSCRIPT_RECORD_MARKER;
3124
- record3.set(deflated, 1);
3125
- return record3;
3352
+ const record4 = new Uint8Array(deflated.length + 1);
3353
+ record4[0] = COMPRESSED_TRANSCRIPT_RECORD_MARKER;
3354
+ record4.set(deflated, 1);
3355
+ return record4;
3356
+ };
3357
+
3358
+ // ../contracts/src/claude-inbox.ts
3359
+ var CLAUDE_INBOX = {
3360
+ protocol: 1,
3361
+ connectTimeoutMs: 1e3,
3362
+ receiptWindowMs: 15e3,
3363
+ receiptPollMs: 200,
3364
+ maxRecordBytes: 16384,
3365
+ maxTranscriptReadBytes: 4194304,
3366
+ maxMessageBytes: 65536,
3367
+ journalVersion: 1,
3368
+ journalDirectory: "run/native-input",
3369
+ sender: "pushary",
3370
+ carrier: "native"
3371
+ };
3372
+ var record3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3373
+ var text2 = (value) => typeof value === "string" && value.length > 0;
3374
+ var sessionIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3375
+ var parseClaudeInboxSession = (value, platform = "darwin") => {
3376
+ if (!record3(value) || !Number.isSafeInteger(value.pid) || typeof value.pid !== "number" || value.pid <= 0 || !text2(value.sessionId) || !sessionIdPattern.test(value.sessionId) || !text2(value.cwd) || !text2(value.procStart) || !text2(value.messagingSocketPath) || value.peerProtocol !== CLAUDE_INBOX.protocol || !text2(value.version) || !supportsClaudeInbox(value.version, platform))
3377
+ return null;
3378
+ return {
3379
+ pid: value.pid,
3380
+ sessionId: value.sessionId,
3381
+ cwd: value.cwd,
3382
+ procStart: value.procStart,
3383
+ messagingSocketPath: value.messagingSocketPath,
3384
+ peerProtocol: value.peerProtocol,
3385
+ version: value.version,
3386
+ ...typeof value.status === "string" ? { status: value.status } : {}
3387
+ };
3388
+ };
3389
+ var claudeInboxAction = (progress) => {
3390
+ if (progress.accepted) return "acknowledge" /* acknowledge */;
3391
+ if (progress.expiresAtMs <= progress.nowMs) {
3392
+ return progress.attempted ? "outcome_unknown" /* outcomeUnknown */ : "expire" /* expire */;
3393
+ }
3394
+ return progress.attempted ? "observe" /* observe */ : "submit" /* submit */;
3395
+ };
3396
+ var isClaudeInboxReceipt = (value, sessionId, commandId) => record3(value) && value.type === "user" && value.sessionId === sessionId && value.uuid === commandId && record3(value.origin) && value.origin.kind === "peer" && value.origin.msg_id === commandId;
3397
+ var CLAUDE_INBOX_MAX_SESSIONS = 128;
3398
+ var parseClaudeInboxCommand = (value) => {
3399
+ if (!record3(value) || !text2(value.id) || !sessionIdPattern.test(value.id) || !text2(value.text) || typeof value.expiresAtMs !== "number" || !Number.isSafeInteger(value.expiresAtMs))
3400
+ return null;
3401
+ return { id: value.id, text: value.text, expiresAtMs: value.expiresAtMs };
3402
+ };
3403
+ var parseClaudeInboxPoll = (value) => {
3404
+ if (!record3(value) || value.protocol !== CLAUDE_INBOX.protocol || !Array.isArray(value.sessionIds) || value.sessionIds.length > CLAUDE_INBOX_MAX_SESSIONS || !value.sessionIds.every((id) => nativeIdentifier(id)))
3405
+ return null;
3406
+ return value.sessionIds;
3407
+ };
3408
+ var parseClaudeInboxClaim = (value) => record3(value) && value.protocol === CLAUDE_INBOX.protocol ? parseClaudeInboxCommand(value.command) : null;
3409
+ var CLAUDE_INBOX_RECEIVER = {
3410
+ pollMs: 3e3,
3411
+ heartbeatMs: 6e4,
3412
+ requestTimeoutMs: 1e4,
3413
+ maxConcurrent: 4
3414
+ };
3415
+ var CLAUDE_INBOX_SETTLEMENTS = {
3416
+ ["accepted" /* accepted */]: { state: "delivered" },
3417
+ ["expired" /* expired */]: { state: "failed", failureCode: "expired" },
3418
+ ["outcome_unknown" /* outcomeUnknown */]: {
3419
+ state: "uncertain",
3420
+ failureCode: "delivery_unconfirmed"
3421
+ },
3422
+ ["not_sent" /* notSent */]: null,
3423
+ ["unconfirmed" /* unconfirmed */]: null
3126
3424
  };
3127
3425
 
3128
3426
  // ../contracts/src/index.ts
@@ -3170,11 +3468,11 @@ var TIMEOUT_ACTION_THAT_REFUSES = "deny";
3170
3468
  var timeoutActionWithoutLocalPrompt = ({ mode, timeoutAction }) => mode !== "push_only" && timeoutAction === "approve" ? TIMEOUT_ACTION_THAT_REFUSES : timeoutAction;
3171
3469
  var TIMEOUT_ACTIONS = ["approve", "deny", "escalate", "wait"];
3172
3470
  var isTimeoutAction = (value) => typeof value === "string" && TIMEOUT_ACTIONS.includes(value);
3173
- var typedTextAsAnswers = (questions, text2) => {
3471
+ var typedTextAsAnswers = (questions, text3) => {
3174
3472
  const [only, ...others] = questions;
3175
3473
  if (!only || others.length > 0 || !isTypedAnswerQuestion(only)) return null;
3176
- if (text2.trim().length === 0 || isHandBackAnswer(text2)) return null;
3177
- return { [only.question]: text2 };
3474
+ if (text3.trim().length === 0 || isHandBackAnswer(text3)) return null;
3475
+ return { [only.question]: text3 };
3178
3476
  };
3179
3477
  var plainAskOf = (question) => isTypedAnswerQuestion(question) ? { type: "input" } : { type: "select", options: question.options.map((option) => option.label) };
3180
3478
  var isLoneTypedAnswerQuestion = (questions) => questions.length === 1 && questions.every(isTypedAnswerQuestion);
@@ -3239,7 +3537,7 @@ var HOOK_HOLD_BUDGET_FLAG = "--hold-budget";
3239
3537
  var HOOK_HOLD_BUDGET_ENV = "PUSHARY_HOLD_BUDGET_SECONDS";
3240
3538
  var HOOK_BRIDGE_SOURCE_FLAG = "--source";
3241
3539
  var HOOK_HOLD_BUDGET_SECONDS = /^[1-9]\d{0,5}$/;
3242
- var hookHoldBudgetSeconds = (text2) => text2 !== void 0 && HOOK_HOLD_BUDGET_SECONDS.test(text2) ? Number(text2) : void 0;
3540
+ var hookHoldBudgetSeconds = (text3) => text3 !== void 0 && HOOK_HOLD_BUDGET_SECONDS.test(text3) ? Number(text3) : void 0;
3243
3541
  var hookHoldBudgetArgument = (seconds) => `${HOOK_HOLD_BUDGET_FLAG}=${seconds}`;
3244
3542
  var withHookHoldBudget = (command, holdBudgetSeconds) => holdBudgetSeconds === void 0 ? command : `${command} ${hookHoldBudgetArgument(holdBudgetSeconds)}`;
3245
3543
  var registeredHookHoldBudget = (args) => {
@@ -3348,8 +3646,8 @@ var tokenizeGlob = (glob) => {
3348
3646
  return tokens;
3349
3647
  };
3350
3648
  var SLASH = "/".charCodeAt(0);
3351
- var matchGlobTokens = (tokens, text2) => {
3352
- const n = text2.length;
3649
+ var matchGlobTokens = (tokens, text3) => {
3650
+ const n = text3.length;
3353
3651
  let reachable = new Uint8Array(n + 1);
3354
3652
  reachable[0] = 1;
3355
3653
  for (const token of tokens) {
@@ -3357,13 +3655,13 @@ var matchGlobTokens = (tokens, text2) => {
3357
3655
  if (token.kind === "literal") {
3358
3656
  const { value } = token;
3359
3657
  for (let p = 0; p <= n - value.length; p += 1) {
3360
- if (reachable[p] && text2.startsWith(value, p)) next[p + value.length] = 1;
3658
+ if (reachable[p] && text3.startsWith(value, p)) next[p + value.length] = 1;
3361
3659
  }
3362
3660
  } else {
3363
3661
  const spansSeparators = token.kind === "globstar";
3364
3662
  let open = 0;
3365
3663
  for (let p = 0; p <= n; p += 1) {
3366
- if (!spansSeparators && p > 0 && text2.charCodeAt(p - 1) === SLASH) open = 0;
3664
+ if (!spansSeparators && p > 0 && text3.charCodeAt(p - 1) === SLASH) open = 0;
3367
3665
  if (reachable[p]) open = 1;
3368
3666
  if (open) next[p] = 1;
3369
3667
  }
@@ -3727,7 +4025,7 @@ var argumentsMayExpand = (segment) => {
3727
4025
  const visible = shellVisibleText(segment);
3728
4026
  return visible === null || EXPANSION_THAT_CAN_BECOME_A_FLAG.test(visible.replace(SHELL_QUOTE_CHARACTERS, ""));
3729
4027
  };
3730
- var blankedSafeRedirections = (text2) => text2.replace(SAFE_REDIRECTION, (redirection) => " ".repeat(redirection.length));
4028
+ var blankedSafeRedirections = (text3) => text3.replace(SAFE_REDIRECTION, (redirection) => " ".repeat(redirection.length));
3731
4029
  var segmentsSplitWhereVisible = (command, visible, separators) => {
3732
4030
  const segments = [];
3733
4031
  let start = 0;
@@ -3876,10 +4174,10 @@ var DESTRUCTIVE_WORDS_IN_ANY_CASE_BY_COMMAND = /* @__PURE__ */ new Map([
3876
4174
  ]);
3877
4175
  var namesDestructiveWordInAnyCase = (name, texts) => {
3878
4176
  const words = DESTRUCTIVE_WORDS_IN_ANY_CASE_BY_COMMAND.get(name);
3879
- return words !== void 0 && texts.some((text2) => words.has(text2.toLowerCase()));
4177
+ return words !== void 0 && texts.some((text3) => words.has(text3.toLowerCase()));
3880
4178
  };
3881
4179
  var LONG_OPTION = /^--[A-Za-z]/;
3882
- var namesDestructiveArgument = (text2, destructiveArguments) => destructiveArguments.has(text2) || LONG_OPTION.test(text2) && [...destructiveArguments].some((argument) => argument.startsWith(text2)) || [...SHORT_FLAG_CLUSTER.exec(text2)?.[1] ?? ""].some((letter) => destructiveArguments.has(`-${letter}`));
4180
+ var namesDestructiveArgument = (text3, destructiveArguments) => destructiveArguments.has(text3) || LONG_OPTION.test(text3) && [...destructiveArguments].some((argument) => argument.startsWith(text3)) || [...SHORT_FLAG_CLUSTER.exec(text3)?.[1] ?? ""].some((letter) => destructiveArguments.has(`-${letter}`));
3883
4181
  var RUNNER_SUBCOMMANDS = /* @__PURE__ */ new Set(["exec", "dlx"]);
3884
4182
  var SUBCOMMAND_CLIS = /* @__PURE__ */ new Set([
3885
4183
  "git",
@@ -4006,7 +4304,7 @@ var argumentsHideTheEffect = (name, args) => {
4006
4304
  const texts = args.map((arg) => arg.text);
4007
4305
  if (INLINE_CODE_INTERPRETERS.has(name.replace(/\d+(?:\.\d+)*$/, "")) && interpreterRunsUnreadableCode(texts)) return true;
4008
4306
  const destructiveArguments = destructiveArgumentsOf(name, args);
4009
- if (destructiveArguments && texts.some((text2) => namesDestructiveArgument(text2, destructiveArguments))) return true;
4307
+ if (destructiveArguments && texts.some((text3) => namesDestructiveArgument(text3, destructiveArguments))) return true;
4010
4308
  if (namesDestructiveWordInAnyCase(name, texts)) return true;
4011
4309
  if (!SUBCOMMAND_CLIS.has(name)) return false;
4012
4310
  const meaningful = argsAfterHarmlessGlobalFlags(args);
@@ -4025,7 +4323,7 @@ var normalizedInvocation = (invocation) => invocationTextWith(invocation, (word)
4025
4323
  var SHELL_METACHARACTER = /[\s;&|<>()$`\\"'*?[\]#~{}!]/;
4026
4324
  var SINGLE_QUOTE2 = "'";
4027
4325
  var ESCAPED_SINGLE_QUOTE = `'\\''`;
4028
- var asOneShellWord = (text2) => SHELL_METACHARACTER.test(text2) ? `${SINGLE_QUOTE2}${text2.replaceAll(SINGLE_QUOTE2, ESCAPED_SINGLE_QUOTE)}${SINGLE_QUOTE2}` : text2;
4326
+ var asOneShellWord = (text3) => SHELL_METACHARACTER.test(text3) ? `${SINGLE_QUOTE2}${text3.replaceAll(SINGLE_QUOTE2, ESCAPED_SINGLE_QUOTE)}${SINGLE_QUOTE2}` : text3;
4029
4327
  var quotedInvocation = (invocation) => invocationTextWith(invocation, (word) => asOneShellWord(word.text));
4030
4328
  var normalizedCommand = (command) => {
4031
4329
  const segments = readableCommandSegments(command);
@@ -4143,8 +4441,8 @@ var statementSelectsIntoATable = (statement) => {
4143
4441
  return select !== -1 && SQL_INTO_A_TABLE.test(statement.slice(select));
4144
4442
  };
4145
4443
  var selectsIntoATable = (sql) => sql.split(SQL_STATEMENT_SEPARATOR).some(statementSelectsIntoATable);
4146
- var sqlTextWrites = (text2) => {
4147
- const statement = text2.replace(SQL_READ_PHRASE, "");
4444
+ var sqlTextWrites = (text3) => {
4445
+ const statement = text3.replace(SQL_READ_PHRASE, "");
4148
4446
  return SQL_WRITE_STATEMENT.test(statement) || selectsIntoATable(statement) || SQL_CLIENT_FILE_COMMAND.test(statement);
4149
4447
  };
4150
4448
  var writesThroughSql = (sql, lexicon) => {
@@ -4160,7 +4458,7 @@ var SQL_CLIENT_FILE_COMMAND = new RegExp([
4160
4458
  var SHORT_FLAG_CLUSTER_ONLY = /^-([A-Za-z0-9]+)$/;
4161
4459
  var LEADING_OPTION_DASHES = /^-+/;
4162
4460
  var NO_SQL = { script: false, sql: null, hidden: false };
4163
- var shortFlagOf = (flags, text2) => [...flags].find((flag) => /^-[A-Za-z]$/.test(flag) && text2.startsWith(flag) && text2.length > flag.length && !text2.startsWith("--"));
4461
+ var shortFlagOf = (flags, text3) => [...flags].find((flag) => /^-[A-Za-z]$/.test(flag) && text3.startsWith(flag) && text3.length > flag.length && !text3.startsWith("--"));
4164
4462
  var sqlArgumentAt = (args, index, syntax) => {
4165
4463
  const arg = args[index];
4166
4464
  if (arg === void 0) return NO_SQL;
@@ -4180,7 +4478,7 @@ var sqlArgumentAt = (args, index, syntax) => {
4180
4478
  if (cluster && cluster.length > 1 && syntax.inlineFlags.has(last)) return valueOf(next);
4181
4479
  return { script: false, sql: arg.text.replace(LEADING_OPTION_DASHES, ""), hidden: false };
4182
4480
  };
4183
- var namesALongFlagValue = (text2, flags) => [...flags].some((flag) => flag.startsWith("--") && text2.startsWith(`${flag}${FLAG_VALUE_SEPARATOR}`));
4481
+ var namesALongFlagValue = (text3, flags) => [...flags].some((flag) => flag.startsWith("--") && text3.startsWith(`${flag}${FLAG_VALUE_SEPARATOR}`));
4184
4482
  var positionalSqlIsHidden = (args, syntax) => syntax.positionalSql && args.filter((arg) => !arg.text.startsWith("-")).slice(1).some((arg) => arg.expands);
4185
4483
  var sqlClientSyntaxOf = ({ program }) => program === void 0 ? void 0 : SQL_CLIENT_SYNTAX.get(basenameOf(program.text));
4186
4484
  var sqlClientChangesData = (invocation) => {
@@ -4554,7 +4852,7 @@ var gitDiscardsWork = ({ program, args }) => {
4554
4852
  const [subcommand, ...rest] = argsAfterHarmlessGlobalFlags(args);
4555
4853
  const discards = GIT_WORK_DISCARDERS.get(subcommand?.text ?? "");
4556
4854
  const texts = rest.map((arg) => arg.text);
4557
- return discards !== void 0 && discards(texts.filter((text2) => FLAG.test(text2)), texts.filter((text2) => !FLAG.test(text2)));
4855
+ return discards !== void 0 && discards(texts.filter((text3) => FLAG.test(text3)), texts.filter((text3) => !FLAG.test(text3)));
4558
4856
  };
4559
4857
  var PACKAGE_MANAGERS = /* @__PURE__ */ new Set([
4560
4858
  "npm",
@@ -4702,25 +5000,25 @@ var WRAPPER_SYNTAX = /* @__PURE__ */ new Map([
4702
5000
  ]);
4703
5001
  var EVAL = "eval";
4704
5002
  var MAX_CONSEQUENCE_DEPTH = 4;
4705
- var shortValueOptionPosition = (text2, options) => {
4706
- if (!text2.startsWith("-") || text2.startsWith("--")) return -1;
4707
- for (let index = 1; index < text2.length; index += 1) {
4708
- if (options.has(`-${text2[index]}`)) return index;
5003
+ var shortValueOptionPosition = (text3, options) => {
5004
+ if (!text3.startsWith("-") || text3.startsWith("--")) return -1;
5005
+ for (let index = 1; index < text3.length; index += 1) {
5006
+ if (options.has(`-${text3[index]}`)) return index;
4709
5007
  }
4710
5008
  return -1;
4711
5009
  };
4712
- var wrapperOptionConsumesNextWord = (text2, options) => {
4713
- if (options.has(text2)) return true;
4714
- const position = shortValueOptionPosition(text2, options);
4715
- return position !== -1 && position === text2.length - 1;
5010
+ var wrapperOptionConsumesNextWord = (text3, options) => {
5011
+ if (options.has(text3)) return true;
5012
+ const position = shortValueOptionPosition(text3, options);
5013
+ return position !== -1 && position === text3.length - 1;
4716
5014
  };
4717
5015
  var commandStartAfterWrapper = (words, syntax) => {
4718
5016
  let index = 0;
4719
5017
  while (index < words.length) {
4720
- const text2 = words[index]?.text ?? "";
4721
- if (text2 === END_OF_OPTIONS3) return index + 1 + syntax.operandsBeforeTheCommand;
4722
- if (!SHELL_ENV_ASSIGNMENT.test(text2) && (!FLAG.test(text2) || text2 === STANDARD_INPUT_ARGUMENT)) break;
4723
- index += wrapperOptionConsumesNextWord(text2, syntax.optionsWithAValue) ? 2 : 1;
5018
+ const text3 = words[index]?.text ?? "";
5019
+ if (text3 === END_OF_OPTIONS3) return index + 1 + syntax.operandsBeforeTheCommand;
5020
+ if (!SHELL_ENV_ASSIGNMENT.test(text3) && (!FLAG.test(text3) || text3 === STANDARD_INPUT_ARGUMENT)) break;
5021
+ index += wrapperOptionConsumesNextWord(text3, syntax.optionsWithAValue) ? 2 : 1;
4724
5022
  }
4725
5023
  return index + syntax.operandsBeforeTheCommand;
4726
5024
  };
@@ -4822,16 +5120,16 @@ var pipesFetchedCodeIntoAnInterpreter = (command, invocations) => invocations.so
4822
5120
  var WORDS_THAT_OPEN_A_COMMAND = String.raw`if|then|elif|else|do|while|until|!`;
4823
5121
  var SHELL_GROUPING_PREFIX = new RegExp(String.raw`^\s*(?:(?:${WORDS_THAT_OPEN_A_COMMAND})\s+|[({]\s*)+`);
4824
5122
  var GROUP_OPENER_BY_CLOSER = /* @__PURE__ */ new Map([[")", "("], ["}", "{"]]);
4825
- var occurrencesOf = (text2, character) => text2.split(character).length - 1;
4826
- var closesAGroupItDidNotOpen = (text2) => {
4827
- const last = text2.at(-1) ?? "";
5123
+ var occurrencesOf = (text3, character) => text3.split(character).length - 1;
5124
+ var closesAGroupItDidNotOpen = (text3) => {
5125
+ const last = text3.at(-1) ?? "";
4828
5126
  const opener = GROUP_OPENER_BY_CLOSER.get(last);
4829
- return opener !== void 0 && occurrencesOf(text2, last) > occurrencesOf(text2, opener);
5127
+ return opener !== void 0 && occurrencesOf(text3, last) > occurrencesOf(text3, opener);
4830
5128
  };
4831
5129
  var withoutShellGrouping = (segment) => {
4832
- let text2 = segment.replace(SHELL_GROUPING_PREFIX, "").trimEnd();
4833
- while (closesAGroupItDidNotOpen(text2)) text2 = text2.slice(0, -1).trimEnd();
4834
- return text2;
5130
+ let text3 = segment.replace(SHELL_GROUPING_PREFIX, "").trimEnd();
5131
+ while (closesAGroupItDidNotOpen(text3)) text3 = text3.slice(0, -1).trimEnd();
5132
+ return text3;
4835
5133
  };
4836
5134
  var HEREDOC_OPERATOR = /(?<!<)\d*<<(?!<)-?[ \t]*(?:'([A-Za-z_]\w*)'|"([A-Za-z_]\w*)"|\\?([A-Za-z_]\w*))/g;
4837
5135
  var HEREDOC_MARK = "\uE001";
@@ -4864,24 +5162,24 @@ var SEPARATORS_INSIDE_DOUBLE_QUOTES = /* @__PURE__ */ new Set(["$(", "`", ")"]);
4864
5162
  var PIPE3 = "|";
4865
5163
  var SUBSTITUTION_OPENERS = /* @__PURE__ */ new Set(["$(", "`"]);
4866
5164
  var QUOTE_CHARACTERS = /['"]/g;
4867
- var roughPiecesOf = (text2) => {
5165
+ var roughPiecesOf = (text3) => {
4868
5166
  const pieces = [];
4869
5167
  let current = "";
4870
5168
  let before = "";
4871
5169
  let quote = null;
4872
- for (let index = 0; index < text2.length; index += 1) {
4873
- const char = text2.charAt(index);
5170
+ for (let index = 0; index < text3.length; index += 1) {
5171
+ const char = text3.charAt(index);
4874
5172
  if (quote === "'") {
4875
5173
  current += char;
4876
5174
  if (char === "'") quote = null;
4877
5175
  continue;
4878
5176
  }
4879
5177
  if (char === "\\") {
4880
- current += text2.slice(index, index + 2);
5178
+ current += text3.slice(index, index + 2);
4881
5179
  index += 1;
4882
5180
  continue;
4883
5181
  }
4884
- const separator = ROUGH_SEPARATORS.find((candidate) => text2.startsWith(candidate, index) && (quote === null || SEPARATORS_INSIDE_DOUBLE_QUOTES.has(candidate)));
5182
+ const separator = ROUGH_SEPARATORS.find((candidate) => text3.startsWith(candidate, index) && (quote === null || SEPARATORS_INSIDE_DOUBLE_QUOTES.has(candidate)));
4885
5183
  if (separator !== void 0) {
4886
5184
  pieces.push({ text: current, before });
4887
5185
  current = "";
@@ -4894,14 +5192,14 @@ var roughPiecesOf = (text2) => {
4894
5192
  }
4895
5193
  return [...pieces, { text: current, before }];
4896
5194
  };
4897
- var invocationOfRoughPiece = (text2) => {
4898
- const piece = withoutShellGrouping(text2.replaceAll(REDIRECTED_INPUT_MARK, "").replaceAll(HEREDOC_MARK, ""));
5195
+ var invocationOfRoughPiece = (text3) => {
5196
+ const piece = withoutShellGrouping(text3.replaceAll(REDIRECTED_INPUT_MARK, "").replaceAll(HEREDOC_MARK, ""));
4899
5197
  const parsed = invocationOf(piece);
4900
5198
  return parsed.program !== void 0 ? parsed : invocationOf(piece.replace(QUOTE_CHARACTERS, ""));
4901
5199
  };
4902
5200
  var roughSegmentsOf = (command) => {
4903
- const { text: text2, bodies } = withHeredocBodiesSetAside(commandForReading(command));
4904
- const pieces = roughPiecesOf(text2.replace(INPUT_REDIRECTION, ` ${REDIRECTED_INPUT_MARK} `).replace(OUTPUT_REDIRECTION, " "));
5201
+ const { text: text3, bodies } = withHeredocBodiesSetAside(commandForReading(command));
5202
+ const pieces = roughPiecesOf(text3.replace(INPUT_REDIRECTION, ` ${REDIRECTED_INPUT_MARK} `).replace(OUTPUT_REDIRECTION, " "));
4905
5203
  let heredocsSeen = 0;
4906
5204
  return pieces.map((piece, index) => {
4907
5205
  const heredocCount = occurrencesOf(piece.text, HEREDOC_MARK);
@@ -4938,7 +5236,7 @@ var commandHasAVisibleConsequenceAt = (toolName, command, depth) => {
4938
5236
  };
4939
5237
  var posixCommandOf = (words) => words.map(asOneShellWord).join(" ");
4940
5238
  var posixShellJudgeFor = (toolName) => ({
4941
- namesADestructiveAction: (text2) => classifyDecisionRisk(toolName, text2) === "destructive",
5239
+ namesADestructiveAction: (text3) => classifyDecisionRisk(toolName, text3) === "destructive",
4942
5240
  invocationShowsAConsequence: (invocation) => invocationHasAVisibleConsequence(SHELL_TOOL, invocation, 0),
4943
5241
  commandShowsAConsequence: (words) => commandHasAVisibleConsequenceAt(SHELL_TOOL, posixCommandOf(words), 1),
4944
5242
  onlyReads: (words) => isSafeReadOnlyCommand(posixCommandOf(words)),
@@ -4981,9 +5279,9 @@ var GIT_GLOBAL_FLAGS = /* @__PURE__ */ new Set([
4981
5279
  var GIT_OPTION_AND_ITS_VALUE = 2;
4982
5280
  var GIT_OPTION_ALONE = 1;
4983
5281
  var NOT_A_GIT_GLOBAL_OPTION = 0;
4984
- var gitGlobalOptionWidth = (text2) => {
4985
- if (GIT_GLOBAL_OPTIONS_WITH_A_VALUE.has(text2)) return GIT_OPTION_AND_ITS_VALUE;
4986
- const name = longOptionName(text2);
5282
+ var gitGlobalOptionWidth = (text3) => {
5283
+ if (GIT_GLOBAL_OPTIONS_WITH_A_VALUE.has(text3)) return GIT_OPTION_AND_ITS_VALUE;
5284
+ const name = longOptionName(text3);
4987
5285
  return GIT_GLOBAL_OPTIONS_WITH_A_VALUE.has(name) || GIT_GLOBAL_FLAGS.has(name) ? GIT_OPTION_ALONE : NOT_A_GIT_GLOBAL_OPTION;
4988
5286
  };
4989
5287
  var argsAfterGitGlobalOptions = (args) => {
@@ -5002,7 +5300,7 @@ var gitReadingsPastGlobalOptions = ({ program, args }) => {
5002
5300
  };
5003
5301
  var CURRENT_DIRECTORY_STEP = /\/\.(?=\/)/g;
5004
5302
  var LEADING_CURRENT_DIRECTORY = /^(?:\.\/+)+(?=[^/])/;
5005
- var canonicalPathWord = (text2) => text2.replace(CURRENT_DIRECTORY_STEP, "").replace(LEADING_CURRENT_DIRECTORY, "");
5303
+ var canonicalPathWord = (text3) => text3.replace(CURRENT_DIRECTORY_STEP, "").replace(LEADING_CURRENT_DIRECTORY, "");
5006
5304
  var verbatimInvocationText = (invocation) => wordsOfInvocation(invocation).map((word) => asOneShellWord(word.text)).join(" ");
5007
5305
  var canonicalInvocationText = (invocation) => invocationTextWith(invocation, (word) => asOneShellWord(canonicalPathWord(word.text)));
5008
5306
  var spellingsOfAnInvocation = (invocation, innermost) => [invocation, innermost, ...gitReadingsPastGlobalOptions(innermost), ...readingsPastGlobalFlags(innermost)].flatMap((reading) => [verbatimInvocationText(reading), canonicalInvocationText(reading)]);
@@ -5041,8 +5339,8 @@ var runsASubstitutionAsAProgram = (command) => {
5041
5339
  return visible !== null && SUBSTITUTION_AS_A_PROGRAM.test(visible);
5042
5340
  };
5043
5341
  var parsedSpelledSegment = (segment) => {
5044
- const text2 = withoutShellGrouping(segment);
5045
- return { text: text2, invocation: invocationOf(text2), heredocs: [], feedsASubstitution: false };
5342
+ const text3 = withoutShellGrouping(segment);
5343
+ return { text: text3, invocation: invocationOf(text3), heredocs: [], feedsASubstitution: false };
5046
5344
  };
5047
5345
  var roughSpelledSegment = ({ invocation, heredocs, feedsASubstitution }) => ({ text: verbatimInvocationText(invocation), invocation, heredocs, feedsASubstitution });
5048
5346
  var segmentHidesWhatItRuns = (segment, innermost, scripts) => programIsHidden(innermost) || scripts.kind === "hidden" || segment.feedsASubstitution && passesAnInlineScript(innermost);
@@ -5094,7 +5392,7 @@ var parseMcpToolName = (toolName) => {
5094
5392
  return { server: rest.slice(0, split), tool: rest.slice(split + 2) };
5095
5393
  };
5096
5394
  var INVISIBLE_CHARACTERS = /[\u200B-\u200D\u2060\uFEFF]/g;
5097
- var readableText = (text2) => text2.normalize("NFKC").replace(INVISIBLE_CHARACTERS, "");
5395
+ var readableText = (text3) => text3.normalize("NFKC").replace(INVISIBLE_CHARACTERS, "");
5098
5396
  var ACRONYM_BOUNDARY = /([A-Z]{1,63})([A-Z][a-z])/g;
5099
5397
  var CAMEL_CASE_BOUNDARY = /([a-z0-9])([A-Z])/g;
5100
5398
  var IDENTIFIER_WORD_SEPARATOR = /[^a-z0-9]+/;
@@ -5464,15 +5762,15 @@ var toolInputFieldNamed = (fieldName, parent) => {
5464
5762
  holdsGraphql: inherited.holdsGraphql || fieldWordsNameOnly(words, FIELD_WORDS_THAT_NAME_GRAPHQL, FIELD_WORDS_THAT_QUALIFY_A_QUERY)
5465
5763
  };
5466
5764
  };
5467
- var readableToolInputText = (text2) => {
5468
- if (text2.length > LONGEST_TOOL_INPUT_TEXT_READ || COMBINING_MARK_RUN_LONGER_THAN_ANY_LANGUAGE_WRITES.test(text2)) {
5765
+ var readableToolInputText = (text3) => {
5766
+ if (text3.length > LONGEST_TOOL_INPUT_TEXT_READ || COMBINING_MARK_RUN_LONGER_THAN_ANY_LANGUAGE_WRITES.test(text3)) {
5469
5767
  return UNREADABLE_TOOL_INPUT_TEXT;
5470
5768
  }
5471
- const readable = readableText(text2);
5769
+ const readable = readableText(text3);
5472
5770
  return readable.length > LONGEST_TOOL_INPUT_TEXT_READ ? UNREADABLE_TOOL_INPUT_TEXT : { kind: "readable", text: readable };
5473
5771
  };
5474
- var toolInputTextMatches = (field, text2, test) => {
5475
- const readable = readableToolInputText(text2);
5772
+ var toolInputTextMatches = (field, text3, test) => {
5773
+ const readable = readableToolInputText(text3);
5476
5774
  return readable.kind === "unreadable" || test(field, readable.text);
5477
5775
  };
5478
5776
  var fieldNameTooLongToRead = (fieldName) => fieldName.length > LONGEST_TOOL_INPUT_FIELD_NAME_READ;
@@ -5506,9 +5804,9 @@ var WRITTEN_WEB_ADDRESSES = [
5506
5804
  /\blocalhost(?::\d|\/)/i
5507
5805
  ];
5508
5806
  var WHOLE_VALUE_HOST_THAT_CARRIES_DATA_IN_ITS_QUERY = /^[<"'(\[]?(?:[^@\s/]{1,64}@)?(?:[a-z0-9-]{1,63}\.)+[a-z]{2,63}(?::\d{1,5})?(?:\/[^\s?#]*)?\?[^\s#]\S*$/i;
5509
- var textNamesAWebAddress = (field, text2) => {
5510
- const unbroken = text2.replace(LINE_BREAKS_A_URL_PARSER_DROPS, "");
5511
- return field.holdsAnAddress && text2.trim().length > 0 || WRITTEN_WEB_ADDRESSES.some((pattern) => pattern.test(unbroken)) || WHOLE_VALUE_HOST_THAT_CARRIES_DATA_IN_ITS_QUERY.test(unbroken.trim());
5807
+ var textNamesAWebAddress = (field, text3) => {
5808
+ const unbroken = text3.replace(LINE_BREAKS_A_URL_PARSER_DROPS, "");
5809
+ return field.holdsAnAddress && text3.trim().length > 0 || WRITTEN_WEB_ADDRESSES.some((pattern) => pattern.test(unbroken)) || WHOLE_VALUE_HOST_THAT_CARRIES_DATA_IN_ITS_QUERY.test(unbroken.trim());
5512
5810
  };
5513
5811
  var HTTP_METHODS_THAT_WRITE = /* @__PURE__ */ new Set([
5514
5812
  "POST",
@@ -5578,20 +5876,20 @@ var STATEMENTS_THAT_CHANGE = [
5578
5876
  String.raw`\bpg_(?:terminate|cancel)_backend\b`,
5579
5877
  String.raw`\bmutation\b(?:\s+[a-z_]\w{0,127})?\s*(?:\{|@[a-z_]|\(\s*\$)`
5580
5878
  ].map((source) => new RegExp(source, "i"));
5581
- var fieldSetsAnHttpMethodThatWrites = (field, text2) => field.namesAnHttpMethod && HTTP_METHODS_THAT_WRITE.has(text2.trim().toUpperCase());
5582
- var sqlTextWritesAsAClientReadsIt = (text2) => writesThroughSql(text2, UNVERIFIED_SQL_LEXICON);
5583
- var fieldHoldsSqlThatWrites = (field, text2) => field.holdsSql && sqlTextWritesAsAClientReadsIt(text2);
5584
- var fieldHoldsAGraphqlMutation = (field, text2) => field.holdsGraphql && GRAPHQL_MUTATION.test(text2);
5879
+ var fieldSetsAnHttpMethodThatWrites = (field, text3) => field.namesAnHttpMethod && HTTP_METHODS_THAT_WRITE.has(text3.trim().toUpperCase());
5880
+ var sqlTextWritesAsAClientReadsIt = (text3) => writesThroughSql(text3, UNVERIFIED_SQL_LEXICON);
5881
+ var fieldHoldsSqlThatWrites = (field, text3) => field.holdsSql && sqlTextWritesAsAClientReadsIt(text3);
5882
+ var fieldHoldsAGraphqlMutation = (field, text3) => field.holdsGraphql && GRAPHQL_MUTATION.test(text3);
5585
5883
  var COPY_OF_A_SUBQUERY = /\bcopy\s*\((?:\s*\()*\s*(?:select|with|values|table|insert|update|delete|merge)\b/i;
5586
5884
  var COPY_TO_A_PROGRAM_OR_A_FILE = /\)\s*to\s+(?:program\b|')/i;
5587
- var copiesASubqueryOut = (text2) => {
5588
- const copy = text2.search(COPY_OF_A_SUBQUERY);
5589
- return copy !== -1 && COPY_TO_A_PROGRAM_OR_A_FILE.test(text2.slice(copy));
5590
- };
5591
- var carriesAStatementThatChanges = (text2) => STATEMENTS_THAT_CHANGE.some((pattern) => pattern.test(text2)) || copiesASubqueryOut(text2);
5592
- var textCarriesAStatementThatChanges = (text2) => carriesAStatementThatChanges(text2) || carriesAStatementThatChanges(text2.replace(SQL_COMMENT, " "));
5593
- var textAsksToChange = (field, text2) => fieldSetsAnHttpMethodThatWrites(field, text2) || fieldHoldsSqlThatWrites(field, text2) || fieldHoldsAGraphqlMutation(field, text2) || textCarriesAStatementThatChanges(text2);
5594
- var textNeedsAPersonFor = (toolNamesADatabase) => (field, text2) => textNamesAWebAddress(field, text2) || textAsksToChange(field, text2) || toolNamesADatabase && sqlTextWritesAsAClientReadsIt(text2);
5885
+ var copiesASubqueryOut = (text3) => {
5886
+ const copy = text3.search(COPY_OF_A_SUBQUERY);
5887
+ return copy !== -1 && COPY_TO_A_PROGRAM_OR_A_FILE.test(text3.slice(copy));
5888
+ };
5889
+ var carriesAStatementThatChanges = (text3) => STATEMENTS_THAT_CHANGE.some((pattern) => pattern.test(text3)) || copiesASubqueryOut(text3);
5890
+ var textCarriesAStatementThatChanges = (text3) => carriesAStatementThatChanges(text3) || carriesAStatementThatChanges(text3.replace(SQL_COMMENT, " "));
5891
+ var textAsksToChange = (field, text3) => fieldSetsAnHttpMethodThatWrites(field, text3) || fieldHoldsSqlThatWrites(field, text3) || fieldHoldsAGraphqlMutation(field, text3) || textCarriesAStatementThatChanges(text3);
5892
+ var textNeedsAPersonFor = (toolNamesADatabase) => (field, text3) => textNamesAWebAddress(field, text3) || textAsksToChange(field, text3) || toolNamesADatabase && sqlTextWritesAsAClientReadsIt(text3);
5595
5893
  var mcpToolInputOnlyReads = (toolName, toolInput) => !toolInputTooLargeToRead(toolInput) && !anyToolInputText(toolInput, UNNAMED_TOOL_INPUT_FIELD, 0, textNeedsAPersonFor(mcpToolNamesADatabase(toolName)));
5596
5894
  var allowsSessionToolGrant = (toolName) => SESSION_TOOL_GRANT_TOOLS.has(toolName) || mcpToolOnlyReads(toolName);
5597
5895
  var isSessionToolGrant = (policy) => Boolean(policy.sessionId) && allowsSessionToolGrant(policy.tool) && isAutoApprove(policy);
@@ -5606,11 +5904,11 @@ var ASK_CONTEXT_MAX = 500;
5606
5904
  var ASK_AGENT_NAME_MAX = 100;
5607
5905
  var TRUNCATION_MARK = "\u2026";
5608
5906
  var isHighSurrogate = (code) => code >= 55296 && code <= 56319;
5609
- var truncateLine = (text2, max, mark = TRUNCATION_MARK) => {
5610
- if (text2.length <= max) return text2;
5907
+ var truncateLine = (text3, max, mark = TRUNCATION_MARK) => {
5908
+ if (text3.length <= max) return text3;
5611
5909
  const end = max - mark.length;
5612
- const keep = isHighSurrogate(text2.charCodeAt(end - 1)) ? end - 1 : end;
5613
- return `${text2.slice(0, keep)}${mark}`;
5910
+ const keep = isHighSurrogate(text3.charCodeAt(end - 1)) ? end - 1 : end;
5911
+ return `${text3.slice(0, keep)}${mark}`;
5614
5912
  };
5615
5913
  var APPROVAL_FATIGUE_FLAG_PATTERNS = [
5616
5914
  /\brm\s+-[a-z]*r/i,
@@ -5672,9 +5970,9 @@ var addAlnumTokens = (source, set) => {
5672
5970
  if (raw) set.add(raw);
5673
5971
  }
5674
5972
  };
5675
- var tokenize = (text2) => {
5973
+ var tokenize = (text3) => {
5676
5974
  const set = /* @__PURE__ */ new Set();
5677
- for (const raw of text2.toLowerCase().split(/[^a-z0-9]+/)) {
5975
+ for (const raw of text3.toLowerCase().split(/[^a-z0-9]+/)) {
5678
5976
  if (raw && !DELTA_STOPWORDS.has(raw)) set.add(raw);
5679
5977
  }
5680
5978
  return set;
@@ -5945,19 +6243,19 @@ var deriveTargetClass = (path) => {
5945
6243
  var bucketArgCount = (n) => n <= 0 ? "none" : n <= 3 ? "few" : "many";
5946
6244
  var bucketLength = (n) => n < 40 ? "short" : n < 200 ? "medium" : "long";
5947
6245
  var deriveArgShape = (isCommand, commandText, path) => {
5948
- const text2 = isCommand ? commandText : path;
5949
- const tokenCount = isCommand ? text2.trim().split(/\s+/).filter(Boolean).length : 0;
6246
+ const text3 = isCommand ? commandText : path;
6247
+ const tokenCount = isCommand ? text3.trim().split(/\s+/).filter(Boolean).length : 0;
5950
6248
  return {
5951
- hasPipe: isCommand && /(?<!\|)\|(?!\|)/.test(text2),
5952
- hasRedirect: isCommand && /(?<![0-9])[<>]/.test(text2),
5953
- hasChain: isCommand && /&&|\|\||;/.test(text2),
5954
- hasSudo: /\bsudo\b/i.test(text2),
5955
- hasGlob: isCommand && /[*?]/.test(text2),
5956
- hasSubshell: isCommand && /\$\(|`/.test(text2),
5957
- touchesSecretPath: SECRET_TARGET_PATTERNS.some((re) => re.test(text2)),
6249
+ hasPipe: isCommand && /(?<!\|)\|(?!\|)/.test(text3),
6250
+ hasRedirect: isCommand && /(?<![0-9])[<>]/.test(text3),
6251
+ hasChain: isCommand && /&&|\|\||;/.test(text3),
6252
+ hasSudo: /\bsudo\b/i.test(text3),
6253
+ hasGlob: isCommand && /[*?]/.test(text3),
6254
+ hasSubshell: isCommand && /\$\(|`/.test(text3),
6255
+ touchesSecretPath: SECRET_TARGET_PATTERNS.some((re) => re.test(text3)),
5958
6256
  // The command word itself is not an argument, so subtract one.
5959
6257
  argCountBucket: bucketArgCount(isCommand ? Math.max(0, tokenCount - 1) : 0),
5960
- lengthBucket: bucketLength(text2.length)
6258
+ lengthBucket: bucketLength(text3.length)
5961
6259
  };
5962
6260
  };
5963
6261
  var deriveReversibility = (capability, riskClass) => {
@@ -6287,8 +6585,8 @@ var isBlockedActionRequest = (request) => isBlockedActionEvent(request) && block
6287
6585
  var canonicalJsonText = (value) => {
6288
6586
  if (Array.isArray(value)) return `[${value.map(canonicalJsonText).join(",")}]`;
6289
6587
  if (value !== null && typeof value === "object") {
6290
- const record3 = value;
6291
- return `{${Object.keys(record3).filter((key) => record3[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${canonicalJsonText(record3[key])}`).join(",")}}`;
6588
+ const record4 = value;
6589
+ return `{${Object.keys(record4).filter((key) => record4[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${canonicalJsonText(record4[key])}`).join(",")}}`;
6292
6590
  }
6293
6591
  return JSON.stringify(value) ?? "null";
6294
6592
  };
@@ -6550,7 +6848,6 @@ var claudePreToolUseOutput = (decision, reason, updatedInput) => ({
6550
6848
  ...updatedInput ? { updatedInput } : {}
6551
6849
  }
6552
6850
  });
6553
- var PENDING_COMMAND_PREFIX = "The user sent a new instruction from their phone via Pushary:";
6554
6851
  var pendingCommandEvents = (source) => {
6555
6852
  switch (source) {
6556
6853
  case "claude":
@@ -6588,6 +6885,7 @@ var compatiblePendingCommandEvents = (source) => {
6588
6885
  if (!profile || profile.wire !== "permission_decision") return [];
6589
6886
  return COMPATIBLE_PENDING_COMMAND_EVENTS.filter((event) => profile.events.includes(event));
6590
6887
  };
6888
+ var canCarryPendingCommand = (source, event) => pendingCommandEvents(source).includes(event);
6591
6889
  var claudePermissionRequestOutput = (decision, reason, updatedInput) => ({
6592
6890
  hookSpecificOutput: {
6593
6891
  hookEventName: "PermissionRequest",
@@ -6679,11 +6977,11 @@ var elicitationEnum = (property) => {
6679
6977
  return members.length === property.enum.length && members.length >= ELICITATION_MIN_OPTIONS ? members : null;
6680
6978
  };
6681
6979
  var readElicitationFields = (schema) => {
6682
- const record3 = elicitationRecord(schema);
6683
- const properties = elicitationRecord(record3?.properties);
6684
- if (!properties || record3?.type !== "object") return null;
6685
- if (Object.keys(record3).some((key) => !["type", "properties", "required", "$schema"].includes(key))) return null;
6686
- if (record3.required !== void 0 && (!Array.isArray(record3.required) || !record3.required.every((name) => typeof name === "string" && Object.hasOwn(properties, name)))) return null;
6980
+ const record4 = elicitationRecord(schema);
6981
+ const properties = elicitationRecord(record4?.properties);
6982
+ if (!properties || record4?.type !== "object") return null;
6983
+ if (Object.keys(record4).some((key) => !["type", "properties", "required", "$schema"].includes(key))) return null;
6984
+ if (record4.required !== void 0 && (!Array.isArray(record4.required) || !record4.required.every((name) => typeof name === "string" && Object.hasOwn(properties, name)))) return null;
6687
6985
  const entries = Object.entries(properties);
6688
6986
  if (entries.length === 0) return null;
6689
6987
  const fields = [];
@@ -6807,6 +7105,24 @@ var hookActivationResult = (report) => {
6807
7105
  export {
6808
7106
  conversationText,
6809
7107
  extractMessageText,
7108
+ NativeInputAgent,
7109
+ NATIVE_INPUT,
7110
+ qualifyHermesReceiptMode,
7111
+ nativeRecord,
7112
+ nativeIdentifier,
7113
+ nativeInputAction,
7114
+ isCodexQueuedReceipt,
7115
+ isCodexInputReceipt,
7116
+ parseHermesAdmission,
7117
+ parseHermesReplayCursor,
7118
+ hermesPendingAdmissionId,
7119
+ hermesReplayAdmissionId,
7120
+ COMMAND_RECOVERY,
7121
+ isCommandAcknowledgementReceipt,
7122
+ CLAUDE_WAKE,
7123
+ claudeWakeDecision,
7124
+ CLAUDE_WAKE_API,
7125
+ claudeWakeWaitingOn,
6810
7126
  isRecord,
6811
7127
  AGENT_QUESTION_HEADER_MAX,
6812
7128
  AGENT_QUESTION_OPTION_MAX,
@@ -6863,6 +7179,9 @@ export {
6863
7179
  NO_CURSOR_GATE,
6864
7180
  toolsCoveredByGateEntry,
6865
7181
  cursorGateOwnsToolCall,
7182
+ claudeTurnEndOutput,
7183
+ PENDING_COMMAND_PREFIX,
7184
+ pendingCommandInstruction,
6866
7185
  degradedLine,
6867
7186
  KEY_SCOPE,
6868
7187
  normalizeKeyScope,
@@ -6899,7 +7218,17 @@ export {
6899
7218
  CODEX_NATIVE_APPROVAL_REPLIES,
6900
7219
  parseCodexNativeApproval,
6901
7220
  codexNativeApprovalResponse,
7221
+ transcriptRecordPlaintext,
6902
7222
  compressTranscriptRecord,
7223
+ CLAUDE_INBOX,
7224
+ parseClaudeInboxSession,
7225
+ claudeInboxAction,
7226
+ isClaudeInboxReceipt,
7227
+ CLAUDE_INBOX_MAX_SESSIONS,
7228
+ parseClaudeInboxPoll,
7229
+ parseClaudeInboxClaim,
7230
+ CLAUDE_INBOX_RECEIVER,
7231
+ CLAUDE_INBOX_SETTLEMENTS,
6903
7232
  isApprovalMode,
6904
7233
  APPROVAL_MODE_META,
6905
7234
  approvalModeWithoutLocalPrompt,
@@ -6997,8 +7326,8 @@ export {
6997
7326
  claudePermissionDeniedOutput,
6998
7327
  codexStopRescueOutput,
6999
7328
  claudePreToolUseOutput,
7000
- PENDING_COMMAND_PREFIX,
7001
7329
  pendingCommandEvents,
7330
+ canCarryPendingCommand,
7002
7331
  claudePermissionRequestOutput,
7003
7332
  gateOutputFor,
7004
7333
  renderElicitationOutput,