pushary 1.9.65 → 1.9.66
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.
- package/CHANGELOG.md +9 -0
- package/dist/{api-32B3XLJR.js → api-GDSVUTI2.js} +12 -10
- package/dist/bin/pushary-bell-hook.js +25 -27
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +26 -28
- package/dist/bin/pushary-clean.js +34 -36
- package/dist/bin/pushary-codex-bridge.js +21 -22
- package/dist/bin/pushary-codex-hook.js +30 -32
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +13 -13
- package/dist/bin/pushary-connect.js +25 -26
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +37 -39
- package/dist/bin/pushary-disconnect.js +25 -26
- package/dist/bin/pushary-doctor.js +42 -44
- package/dist/bin/pushary-elicitation-hook.js +25 -27
- package/dist/bin/pushary-gemini-bridge.js +15 -16
- package/dist/bin/pushary-gemini-hook.js +27 -29
- package/dist/bin/pushary-hook.js +29 -31
- package/dist/bin/pushary-login.js +19 -19
- package/dist/bin/pushary-logout.js +25 -26
- package/dist/bin/pushary-mcp.js +11 -11
- package/dist/bin/pushary-mode.js +14 -14
- package/dist/bin/pushary-notification-hook.js +24 -26
- package/dist/bin/pushary-opencode-hook.js +26 -28
- package/dist/bin/pushary-permission-denied-hook.js +29 -31
- package/dist/bin/pushary-permission-hook.js +32 -31
- package/dist/bin/pushary-post-hook.js +24 -26
- package/dist/bin/pushary-prompt-hook.js +24 -26
- package/dist/bin/pushary-session-end-hook.js +26 -28
- package/dist/bin/pushary-session-start-hook.js +33 -35
- package/dist/bin/pushary-setup.js +47 -49
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +30 -31
- package/dist/bin/pushary-stop-hook.js +24 -26
- package/dist/bin/pushary-stopfailure-hook.js +24 -26
- package/dist/bin/pushary-suggestions.js +14 -14
- package/dist/bin/pushary-transcript-register.js +16 -18
- package/dist/bin/pushary-transcripts.js +17 -17
- package/dist/bin/pushary-upgrade.js +37 -38
- package/dist/bin/pushary-wait.js +14 -14
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-FFSIYBBU.js → chunk-26W46E46.js} +4 -4
- package/dist/{chunk-3UNAPXED.js → chunk-2BL6KWN7.js} +9 -9
- package/dist/{chunk-GA257T2E.js → chunk-32ZT2ATY.js} +5 -5
- package/dist/{chunk-CSKABVSH.js → chunk-376TUN72.js} +3 -3
- package/dist/{chunk-6CZX6YOE.js → chunk-3ELJIG2R.js} +3 -3
- package/dist/{chunk-WY6YAMZW.js → chunk-3EZP5ZPS.js} +5 -4
- package/dist/{chunk-4LUWNBGD.js → chunk-3FQX74E4.js} +3 -3
- package/dist/{chunk-HVOQUPSO.js → chunk-45KMS76L.js} +1 -1
- package/dist/{chunk-JCWHOB36.js → chunk-4APD2DPI.js} +2 -2
- package/dist/{chunk-ADXHPGBZ.js → chunk-57NTMVMI.js} +6 -6
- package/dist/{chunk-W5L2ZLHE.js → chunk-5FJDODOA.js} +3 -3
- package/dist/{chunk-CZ65D6Q5.js → chunk-5J7OZBJ4.js} +2 -2
- package/dist/{chunk-XJIIU36L.js → chunk-6BGVSV2Q.js} +1 -1
- package/dist/{chunk-I2UBF2SS.js → chunk-6RJZSBPD.js} +1 -1
- package/dist/{chunk-QNZ6G3LY.js → chunk-6ZXCWK27.js} +5 -5
- package/dist/{chunk-P5HZEGT7.js → chunk-7LK3Y6ET.js} +6 -6
- package/dist/{chunk-Y64JGYTB.js → chunk-A47UKPC7.js} +1 -1
- package/dist/{chunk-JFKMPLNF.js → chunk-AVWECJSN.js} +2 -2
- package/dist/{chunk-XZCJC3QO.js → chunk-AWGBL4P3.js} +211 -24
- package/dist/{chunk-LMC5UPL7.js → chunk-B6JC676X.js} +1 -1
- package/dist/{chunk-U2P2LQ5B.js → chunk-CN6JFM62.js} +5 -5
- package/dist/{chunk-ED2SWTPC.js → chunk-CNJ7SI5V.js} +4 -4
- package/dist/{chunk-SZBMTOUZ.js → chunk-DBUHSUL7.js} +1 -1
- package/dist/{chunk-EEVE7H5Z.js → chunk-DIUTSF6I.js} +4 -4
- package/dist/{chunk-UM2X7HL6.js → chunk-DKMVVBXO.js} +13 -15
- package/dist/{chunk-OA6EADFT.js → chunk-DPU6H4JY.js} +3 -3
- package/dist/{chunk-MNKIR2ZB.js → chunk-EJR5JXMV.js} +24 -1
- package/dist/{chunk-VHKK3US3.js → chunk-EU2ZOZC3.js} +3 -3
- package/dist/{chunk-AN7C3CHH.js → chunk-G6VJZ3RB.js} +1 -1
- package/dist/{chunk-ATPJGHUP.js → chunk-GDLT32I4.js} +3 -3
- package/dist/{chunk-7ILQX47W.js → chunk-GECU7V44.js} +3 -3
- package/dist/{chunk-BAGBCSXA.js → chunk-GO7YKPT3.js} +1 -1
- package/dist/{chunk-F56GTJFG.js → chunk-GWYCKTXS.js} +5 -5
- package/dist/{chunk-BEQ3MEE3.js → chunk-HUGVJBDN.js} +2 -2
- package/dist/{chunk-FWS2KLV2.js → chunk-IA5VWIHV.js} +2 -2
- package/dist/{chunk-CU2PXLZ6.js → chunk-IGO3AGZK.js} +4 -4
- package/dist/{chunk-Z3M627TQ.js → chunk-IQ3GKPFM.js} +1 -1
- package/dist/{chunk-HDGB6SQ4.js → chunk-JL3SZJJP.js} +2 -2
- package/dist/{chunk-SCMEVDAR.js → chunk-KS3O6O7E.js} +3 -3
- package/dist/{chunk-HIYLAC3C.js → chunk-MDIGG3Q7.js} +3 -3
- package/dist/{chunk-ICFHMJTW.js → chunk-MNNQEUQC.js} +3 -3
- package/dist/{chunk-BKCI53W6.js → chunk-Q5RNYE2L.js} +4 -4
- package/dist/{chunk-ONBL2GCU.js → chunk-QBNICXMC.js} +6 -6
- package/dist/{chunk-PP7FC3Y7.js → chunk-QN25WBXL.js} +9 -7
- package/dist/{chunk-NUEPJ5W6.js → chunk-QOIPUYUD.js} +3 -5
- package/dist/{chunk-UHS5MMAI.js → chunk-QR2QWGQI.js} +3 -3
- package/dist/{chunk-NOH3EJFH.js → chunk-R7C2FS33.js} +1 -1
- package/dist/{chunk-RABLE5R6.js → chunk-RJ6JEHCP.js} +1 -1
- package/dist/{chunk-WOHP7EL6.js → chunk-RSZQEEEW.js} +6 -6
- package/dist/{chunk-Q2BD4IBX.js → chunk-SVKCYUYP.js} +11 -13
- package/dist/{chunk-R4FL5JHK.js → chunk-T6YLXO6N.js} +4 -4
- package/dist/{chunk-3LF7T3NW.js → chunk-TQNFDNJA.js} +6 -6
- package/dist/{chunk-SROWUG5W.js → chunk-UTAARXYQ.js} +1 -1
- package/dist/{chunk-DXMUJTYF.js → chunk-V3YBVOTZ.js} +2 -2
- package/dist/{chunk-RRHHWYPX.js → chunk-V4EOFOB2.js} +6 -6
- package/dist/{chunk-DM24VZOI.js → chunk-VURDLVAQ.js} +3 -3
- package/dist/{chunk-IZVEBBDH.js → chunk-XDDSURY3.js} +3 -3
- package/dist/{chunk-QSW3HAKI.js → chunk-XEXF2OFZ.js} +61 -2
- package/dist/{chunk-2Z7I7DHT.js → chunk-XFQAK35L.js} +1 -1
- package/dist/{chunk-TK4JU2F7.js → chunk-XGFFNERF.js} +1 -1
- package/dist/{chunk-2VADJ6JH.js → chunk-XIJTXRWB.js} +2 -2
- package/dist/{chunk-3KXBRSL3.js → chunk-XXIJBYNW.js} +1 -1
- package/dist/{chunk-ITYKN2K3.js → chunk-YB3HMDKE.js} +2 -2
- package/dist/{chunk-GTBWWCCM.js → chunk-YQDCTID4.js} +115 -9
- package/dist/{chunk-DTVHZDYM.js → chunk-ZAZUDYSF.js} +26 -12
- package/dist/{chunk-UMTMFDL2.js → chunk-ZJV7SFIJ.js} +1 -1
- package/dist/{codex-app-cards-switch-HK4RMOBI.js → codex-app-cards-switch-W7OLKOMO.js} +11 -11
- package/dist/{codex-desktop-launch-OCO6N7SA.js → codex-desktop-launch-U6V3AXZF.js} +1 -1
- package/dist/{codex-session-launch-ETZQTVFS.js → codex-session-launch-EFU46WBL.js} +18 -19
- package/dist/{config-YY54G3CC.js → config-UC4LMCNX.js} +3 -3
- package/dist/{global-upgrade-5DN5G3ZQ.js → global-upgrade-ABF5O3HU.js} +10 -10
- package/dist/{identity-EGL6HAWG.js → identity-3ZUZPHN6.js} +4 -4
- package/dist/{live-capabilities-WU3FYJJG.js → live-capabilities-BXWXJARK.js} +5 -5
- package/dist/{paths-ZG6KDM6Y.js → paths-FO76CFRQ.js} +3 -3
- package/dist/{reapply-AQLNCCTE.js → reapply-3T3DFUAI.js} +26 -27
- package/dist/src/index.js +30 -20
- package/dist/{upgrade-lock-BIRXIKHJ.js → upgrade-lock-EZ5JIPJE.js} +4 -4
- package/dist/{usage-43C2DHDU.js → usage-Y6BL7RUD.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-ANP3DIST.js +0 -118
- package/dist/chunk-TJUJAK5L.js +0 -62
|
@@ -4,19 +4,24 @@ import {
|
|
|
4
4
|
outcomeOfFailedAsk,
|
|
5
5
|
reportMachineDenial,
|
|
6
6
|
storedWaitDeadline
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-V4EOFOB2.js";
|
|
8
8
|
import {
|
|
9
9
|
isGatingMoment,
|
|
10
10
|
recordKeylessMoment
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6BGVSV2Q.js";
|
|
12
|
+
import {
|
|
13
|
+
isAdmitted,
|
|
14
|
+
readAdmissionRules
|
|
15
|
+
} from "./chunk-QN25WBXL.js";
|
|
12
16
|
import {
|
|
13
17
|
isDeferAnswer,
|
|
14
18
|
oncePerSession
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZJV7SFIJ.js";
|
|
16
20
|
import {
|
|
17
21
|
activeHookSource,
|
|
18
|
-
activeIdentity
|
|
19
|
-
|
|
22
|
+
activeIdentity,
|
|
23
|
+
namedSource
|
|
24
|
+
} from "./chunk-3EZP5ZPS.js";
|
|
20
25
|
import {
|
|
21
26
|
DEFAULT_SESSION,
|
|
22
27
|
UNNAMED_ACTION,
|
|
@@ -40,10 +45,10 @@ import {
|
|
|
40
45
|
reportEvent,
|
|
41
46
|
scopePathFor,
|
|
42
47
|
settleQuestionsForToolUse
|
|
43
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-2BL6KWN7.js";
|
|
44
49
|
import {
|
|
45
50
|
repoKeyFor
|
|
46
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-XXIJBYNW.js";
|
|
47
52
|
import {
|
|
48
53
|
askUser,
|
|
49
54
|
cancelQuestion,
|
|
@@ -58,21 +63,22 @@ import {
|
|
|
58
63
|
requestGate,
|
|
59
64
|
sendNotification,
|
|
60
65
|
waitForQuestion,
|
|
61
|
-
waitsForThePhone
|
|
62
|
-
|
|
66
|
+
waitsForThePhone,
|
|
67
|
+
withdrawQuestion
|
|
68
|
+
} from "./chunk-ZAZUDYSF.js";
|
|
63
69
|
import {
|
|
64
70
|
getMachineId
|
|
65
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-IA5VWIHV.js";
|
|
66
72
|
import {
|
|
67
73
|
claudeConfigDir
|
|
68
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-GDLT32I4.js";
|
|
69
75
|
import {
|
|
70
76
|
getApiKey,
|
|
71
77
|
getBaseUrl
|
|
72
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-A47UKPC7.js";
|
|
73
79
|
import {
|
|
74
80
|
NPX_LATEST_COMMAND
|
|
75
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-GO7YKPT3.js";
|
|
76
82
|
import {
|
|
77
83
|
AGENT_QUESTION_STRATEGY,
|
|
78
84
|
AGENT_QUESTION_TOOL,
|
|
@@ -81,11 +87,13 @@ import {
|
|
|
81
87
|
GATE_WIRE,
|
|
82
88
|
HANDED_BACK_REASON,
|
|
83
89
|
PLAN_DECLINED_REASON,
|
|
90
|
+
PRETOOLUSE_HANDLED_TOOLS,
|
|
84
91
|
QUESTION_LIMIT_PROMPT_REASON,
|
|
85
92
|
SCOPE_BATCH_REASON,
|
|
86
93
|
SOLE_GATE_SIGNED_OUT_REASON,
|
|
87
94
|
SOLE_GATE_SUBSCRIPTION_REASON,
|
|
88
95
|
SOLE_GATE_UNDECIDED_REASON,
|
|
96
|
+
TERMINAL_AND_PHONE_REASON,
|
|
89
97
|
UNREADABLE_CALL_REASON,
|
|
90
98
|
UNVERIFIABLE_APPROVAL_REASON,
|
|
91
99
|
WITHDRAWN_APPROVAL_REASON,
|
|
@@ -99,6 +107,7 @@ import {
|
|
|
99
107
|
claudePermissionRequestOutput,
|
|
100
108
|
claudePermissionRulesFromSettings,
|
|
101
109
|
claudePreToolUseOutput,
|
|
110
|
+
claudePromptTakesTheCall,
|
|
102
111
|
claudeStoppedPermissionRequestOutput,
|
|
103
112
|
claudeStoppedPreToolUseOutput,
|
|
104
113
|
denyReasonFrom,
|
|
@@ -114,17 +123,113 @@ import {
|
|
|
114
123
|
isCursorHookPayload,
|
|
115
124
|
isPermissionRequestOwnedByPreToolUse,
|
|
116
125
|
isPusharyOwnTool,
|
|
126
|
+
isRecord,
|
|
117
127
|
parseAgentQuestions,
|
|
118
128
|
questionHandedToTheTerminal,
|
|
119
129
|
questionLimitHandBack,
|
|
120
130
|
refusesWhenUnanswered,
|
|
121
131
|
resolveGate,
|
|
132
|
+
terminalLiveWait,
|
|
133
|
+
terminalStaysLiveForTheCall,
|
|
122
134
|
timeoutActionWithoutLocalPrompt,
|
|
123
135
|
unansweredRefusalReason
|
|
124
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-EJR5JXMV.js";
|
|
137
|
+
|
|
138
|
+
// src/terminal-answer-watch.ts
|
|
139
|
+
import { closeSync, openSync, readSync, statSync } from "fs";
|
|
140
|
+
import { StringDecoder } from "string_decoder";
|
|
141
|
+
var INITIAL_TAIL_BYTES = 1048576;
|
|
142
|
+
var DEFAULT_POLL_MS = 500;
|
|
143
|
+
var sortedKeys = (value) => {
|
|
144
|
+
if (Array.isArray(value)) return value.map(sortedKeys);
|
|
145
|
+
if (!isRecord(value)) return value;
|
|
146
|
+
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortedKeys(value[key])]));
|
|
147
|
+
};
|
|
148
|
+
var stableJson = (value) => JSON.stringify(sortedKeys(value) ?? null);
|
|
149
|
+
var parsedLine = (line) => {
|
|
150
|
+
try {
|
|
151
|
+
return JSON.parse(line);
|
|
152
|
+
} catch {
|
|
153
|
+
return void 0;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var messageParts = (line) => {
|
|
157
|
+
const row = parsedLine(line);
|
|
158
|
+
const content = isRecord(row) && isRecord(row.message) ? row.message.content : void 0;
|
|
159
|
+
return Array.isArray(content) ? content.filter(isRecord) : [];
|
|
160
|
+
};
|
|
161
|
+
var isToolUse = (part) => part.type === "tool_use" && typeof part.id === "string" && typeof part.name === "string";
|
|
162
|
+
var isToolResultFor = (toolUseId) => (part) => part.type === "tool_result" && part.tool_use_id === toolUseId;
|
|
163
|
+
var matchingToolUseIds = (lines, call) => {
|
|
164
|
+
const wanted = stableJson(call.toolInput);
|
|
165
|
+
return lines.flatMap(messageParts).filter(isToolUse).filter((part) => part.name === call.toolName && stableJson(part.input ?? {}) === wanted).map((part) => part.id);
|
|
166
|
+
};
|
|
167
|
+
var toolUseIdOf = (lines, call) => matchingToolUseIds(lines, call).at(-1);
|
|
168
|
+
var toolResultArrived = (lines, toolUseId) => lines.some((line) => messageParts(line).some(isToolResultFor(toolUseId)));
|
|
169
|
+
var writtenAtMs = (line) => {
|
|
170
|
+
const row = parsedLine(line);
|
|
171
|
+
return isRecord(row) && typeof row.timestamp === "string" ? Date.parse(row.timestamp) : Number.NaN;
|
|
172
|
+
};
|
|
173
|
+
var answeredBefore = (lines, toolUseId, startedAtMs) => lines.some((line) => messageParts(line).some(isToolResultFor(toolUseId)) && !(writtenAtMs(line) >= startedAtMs));
|
|
174
|
+
var openToolUseIdOf = (lines, call, startedAtMs) => matchingToolUseIds(lines, call).filter((id) => !answeredBefore(lines, id, startedAtMs)).at(-1);
|
|
175
|
+
var readTranscriptFrom = (path, offset) => {
|
|
176
|
+
try {
|
|
177
|
+
const size = statSync(path).size;
|
|
178
|
+
if (size <= offset) return { bytes: Buffer.alloc(0), endOffset: size };
|
|
179
|
+
const descriptor = openSync(path, "r");
|
|
180
|
+
try {
|
|
181
|
+
const buffer = Buffer.alloc(size - offset);
|
|
182
|
+
readSync(descriptor, buffer, 0, buffer.length, offset);
|
|
183
|
+
return { bytes: buffer, endOffset: size };
|
|
184
|
+
} finally {
|
|
185
|
+
closeSync(descriptor);
|
|
186
|
+
}
|
|
187
|
+
} catch {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var startingOffset = (path) => {
|
|
192
|
+
try {
|
|
193
|
+
return Math.max(statSync(path).size - INITIAL_TAIL_BYTES, 0);
|
|
194
|
+
} catch {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var watchForTerminalAnswer = (transcriptPath, call, startedAtMs, signal, pollMs = DEFAULT_POLL_MS) => new Promise((resolve) => {
|
|
199
|
+
if (!transcriptPath || signal.aborted) return;
|
|
200
|
+
let offset = startingOffset(transcriptPath);
|
|
201
|
+
const decoder = new StringDecoder("utf8");
|
|
202
|
+
let carry = "";
|
|
203
|
+
let readingHistory = true;
|
|
204
|
+
let toolUseId;
|
|
205
|
+
let timer;
|
|
206
|
+
const stop = () => {
|
|
207
|
+
if (timer) clearTimeout(timer);
|
|
208
|
+
};
|
|
209
|
+
signal.addEventListener("abort", stop, { once: true });
|
|
210
|
+
const tick = () => {
|
|
211
|
+
if (signal.aborted) return;
|
|
212
|
+
const chunk = readTranscriptFrom(transcriptPath, offset);
|
|
213
|
+
if (chunk) {
|
|
214
|
+
offset = chunk.endOffset;
|
|
215
|
+
const pieces = `${carry}${decoder.write(chunk.bytes)}`.split("\n");
|
|
216
|
+
carry = pieces.pop() ?? "";
|
|
217
|
+
toolUseId = toolUseId ?? (readingHistory ? openToolUseIdOf(pieces, call, startedAtMs) : toolUseIdOf(pieces, call));
|
|
218
|
+
readingHistory = false;
|
|
219
|
+
if (toolUseId && toolResultArrived(pieces, toolUseId)) {
|
|
220
|
+
signal.removeEventListener("abort", stop);
|
|
221
|
+
resolve();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
timer = setTimeout(tick, pollMs);
|
|
226
|
+
timer.unref?.();
|
|
227
|
+
};
|
|
228
|
+
tick();
|
|
229
|
+
});
|
|
125
230
|
|
|
126
231
|
// src/claude-permission-rules.ts
|
|
127
|
-
import { readFileSync, statSync } from "fs";
|
|
232
|
+
import { readFileSync, statSync as statSync2 } from "fs";
|
|
128
233
|
import { homedir } from "os";
|
|
129
234
|
import { join } from "path";
|
|
130
235
|
var MANAGED_CLAUDE_SETTINGS_BY_PLATFORM = {
|
|
@@ -146,15 +251,15 @@ var claudeSettingsSources = (location) => [
|
|
|
146
251
|
{ path: join(location.projectDir, ".claude", "settings.local.json"), trust: "grants" }
|
|
147
252
|
] : []
|
|
148
253
|
];
|
|
149
|
-
var
|
|
254
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
150
255
|
var restrictionsOnly = (document) => {
|
|
151
|
-
if (!
|
|
256
|
+
if (!isRecord2(document) || !isRecord2(document.permissions)) return null;
|
|
152
257
|
const { ask: ask2, deny: deny2 } = document.permissions;
|
|
153
258
|
return { permissions: { ask: ask2, deny: deny2 } };
|
|
154
259
|
};
|
|
155
260
|
var readSettingsDocument = (path) => {
|
|
156
261
|
try {
|
|
157
|
-
const stats =
|
|
262
|
+
const stats = statSync2(path);
|
|
158
263
|
if (!stats.isFile() || stats.size > MAX_CLAUDE_SETTINGS_BYTES) return null;
|
|
159
264
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
160
265
|
} catch {
|
|
@@ -194,6 +299,8 @@ import { basename } from "path";
|
|
|
194
299
|
var START_MS = Date.now();
|
|
195
300
|
var ACTIVE_AGENT = activeIdentity(process.argv);
|
|
196
301
|
var ACTIVE_SOURCE = activeHookSource(process.argv);
|
|
302
|
+
var HANDED_DOWN_BY_THE_MAC_BRIDGE = namedSource(process.argv) !== void 0;
|
|
303
|
+
var CLAUDE_SESSION_ATTENDED_ENV = "CLAUDE_CODE_SESSION_ATTENDED";
|
|
197
304
|
var PUSHARY_IS_SOLE_GATE = ACTIVE_SOURCE !== null && hookCompatibleProfileBySource(ACTIVE_SOURCE)?.soleGate != null;
|
|
198
305
|
var agentNameIn = (projectName) => `${ACTIVE_AGENT.label} - ${projectName}`;
|
|
199
306
|
var allow = (reason) => claudePreToolUseOutput("allow", reason);
|
|
@@ -302,6 +409,64 @@ var handleNotifyOnly = async (apiKey, description, projectName, sessionId, machi
|
|
|
302
409
|
}
|
|
303
410
|
return ask();
|
|
304
411
|
};
|
|
412
|
+
var TERMINAL_ANSWERED = /* @__PURE__ */ Symbol("terminal-answered");
|
|
413
|
+
var terminalAnswered = (input, signal) => watchForTerminalAnswer(input.transcript_path, { toolName: input.tool_name, toolInput: input.tool_input ?? {} }, START_MS, signal).then(() => TERMINAL_ANSWERED);
|
|
414
|
+
var terminalLiveTimeoutOutput = (onTimeout, question) => {
|
|
415
|
+
switch (onTimeout) {
|
|
416
|
+
case "allow":
|
|
417
|
+
return allow();
|
|
418
|
+
case "deny":
|
|
419
|
+
return deny(unansweredRefusalReason(isAwayPaused(question)));
|
|
420
|
+
case "leave_to_terminal":
|
|
421
|
+
return ask(WITHDRAWN_APPROVAL_REASON);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
var outcomeOfFailedTerminalLiveAsk = (error, sessionId, refusesUnanswered) => isQuestionLimitRefusal(error) ? questionLimitOutput(questionLimitHandBack({ refusesUnanswered, agentPromptFollows: true })) : outcomeOfFailedAsk(error, sessionId, void 0);
|
|
425
|
+
var handleTerminalLive = async (apiKey, input, description, projectName, toolPolicy, holdBudgetSeconds, machineId, toolTarget, decision, signals) => {
|
|
426
|
+
const plan = terminalLiveWait(toolPolicy, holdBudgetSeconds);
|
|
427
|
+
const sessionId = input.session_id;
|
|
428
|
+
const stop = new AbortController();
|
|
429
|
+
const terminal = terminalAnswered(input, stop.signal);
|
|
430
|
+
let question;
|
|
431
|
+
const servedEndsAt = Date.now() + plan.waitSeconds * 1e3;
|
|
432
|
+
const requestedDeadline = Math.min(servedEndsAt, START_MS + plan.holdSeconds * 1e3);
|
|
433
|
+
try {
|
|
434
|
+
question = await askUser(apiKey, {
|
|
435
|
+
question: `Allow ${description || UNNAMED_ACTION}?`,
|
|
436
|
+
type: "confirm",
|
|
437
|
+
context: `Agent wants to run this in ${projectName}`,
|
|
438
|
+
agentName: agentNameIn(projectName),
|
|
439
|
+
sessionId,
|
|
440
|
+
machineId,
|
|
441
|
+
toolName: input.tool_name,
|
|
442
|
+
toolTarget,
|
|
443
|
+
waitEndsAt: plan.onTimeout === "leave_to_terminal" ? new Date(requestedDeadline).toISOString() : void 0,
|
|
444
|
+
...decision
|
|
445
|
+
});
|
|
446
|
+
} catch (error) {
|
|
447
|
+
stop.abort();
|
|
448
|
+
return outcomeOfFailedTerminalLiveAsk(error, sessionId, plan.onTimeout === "deny");
|
|
449
|
+
}
|
|
450
|
+
if (isDecisionStopped(question)) {
|
|
451
|
+
stop.abort();
|
|
452
|
+
return void 0;
|
|
453
|
+
}
|
|
454
|
+
const deadline = storedWaitDeadline(question, requestedDeadline);
|
|
455
|
+
const first = await Promise.race([waitForQuestion(apiKey, question, deadline, 2e3, stop.signal), terminal]).finally(() => stop.abort());
|
|
456
|
+
if (first === TERMINAL_ANSWERED) {
|
|
457
|
+
await withdrawQuestion(apiKey, question.correlationId);
|
|
458
|
+
return void 0;
|
|
459
|
+
}
|
|
460
|
+
if (isDecisionStopped(first)) return void 0;
|
|
461
|
+
if (!first.answered && isLocalQuestionHandoff(question)) return ask("Approve in the current client.");
|
|
462
|
+
if (first.answered) {
|
|
463
|
+
if (isDeferAnswer(first.value)) return ask(HANDED_BACK_REASON);
|
|
464
|
+
signals.humanDecision = true;
|
|
465
|
+
return first.value === "yes" ? allow() : deny(denyReasonFrom(first.value, first.note));
|
|
466
|
+
}
|
|
467
|
+
return terminalLiveTimeoutOutput(deadline < servedEndsAt ? "leave_to_terminal" : plan.onTimeout, question);
|
|
468
|
+
};
|
|
469
|
+
var pushesToThePhone = (mode) => mode !== "terminal_only" && mode !== "notify_only";
|
|
305
470
|
var emitDecisionEpisode = (apiKey, input, toolPolicy, machineId, toolTarget, decision, result) => {
|
|
306
471
|
const verdict = result?.hookSpecificOutput?.permissionDecision;
|
|
307
472
|
const outcome = verdict === "allow" ? "approve" : verdict === "deny" ? "deny" : null;
|
|
@@ -330,7 +495,7 @@ var emitDecisionEpisode = (apiKey, input, toolPolicy, machineId, toolTarget, dec
|
|
|
330
495
|
machineId
|
|
331
496
|
});
|
|
332
497
|
};
|
|
333
|
-
var dispatchModeHandler = async (apiKey, input, toolPolicy, machineId, trainingConsent = false, scopeReason, scopePath) => {
|
|
498
|
+
var dispatchModeHandler = async (apiKey, input, toolPolicy, machineId, trainingConsent = false, scopeReason, scopePath, terminalLive) => {
|
|
334
499
|
const description = describeToolCall(input.tool_name, input.tool_input, "hook");
|
|
335
500
|
const projectName = basename(input.cwd ?? process.cwd());
|
|
336
501
|
const sessionId = input.session_id;
|
|
@@ -358,7 +523,11 @@ var dispatchModeHandler = async (apiKey, input, toolPolicy, machineId, trainingC
|
|
|
358
523
|
};
|
|
359
524
|
const signals = {};
|
|
360
525
|
const runHandler = () => {
|
|
361
|
-
|
|
526
|
+
const mode = ownPrompt ? toolPolicy.mode : approvalModeWithoutLocalPrompt(toolPolicy.mode);
|
|
527
|
+
if (terminalLive && pushesToThePhone(mode)) {
|
|
528
|
+
return handleTerminalLive(apiKey, input, description, projectName, { ...toolPolicy, mode }, terminalLive.holdBudgetSeconds, machineId, toolTarget, decision, signals);
|
|
529
|
+
}
|
|
530
|
+
switch (mode) {
|
|
362
531
|
case "push_only":
|
|
363
532
|
return handlePushOnly(apiKey, description, projectName, toolPolicy.timeoutSeconds, ownPrompt ? toolPolicy.timeoutAction : timeoutActionWithoutLocalPrompt(toolPolicy), sessionId, machineId, input.tool_name, toolTarget, decision, signals, agentPromptFollows);
|
|
364
533
|
case "terminal_only":
|
|
@@ -403,6 +572,16 @@ var keylessNoticeOnce = (sessionId) => {
|
|
|
403
572
|
}
|
|
404
573
|
};
|
|
405
574
|
var shouldDeferToNativeMode = defersToNativeMode;
|
|
575
|
+
var terminalLiveFactsOf = (input) => ({
|
|
576
|
+
source: ACTIVE_SOURCE,
|
|
577
|
+
sessionAttended: process.env[CLAUDE_SESSION_ATTENDED_ENV] === "1",
|
|
578
|
+
permissionHookAdmitted: isAdmitted(readAdmissionRules(), "claude", "PermissionRequest"),
|
|
579
|
+
handedDownByTheMacBridge: HANDED_DOWN_BY_THE_MAC_BRIDGE,
|
|
580
|
+
fromCursor: isCursorHookPayload(input),
|
|
581
|
+
permissionMode: input.permission_mode,
|
|
582
|
+
toolName: input.tool_name
|
|
583
|
+
});
|
|
584
|
+
var preToolUseHandsOff = (input, gateInput, verdict) => claudePromptTakesTheCall(terminalLiveFactsOf(input), gateInput, verdict);
|
|
406
585
|
var handleAskUserQuestion = async (apiKey, input, modeState) => {
|
|
407
586
|
if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
|
|
408
587
|
const questions = parseAgentQuestions(input.tool_input ?? {});
|
|
@@ -599,6 +778,7 @@ var handlePreToolUse = async (input, canonical) => {
|
|
|
599
778
|
case "defer":
|
|
600
779
|
return undecidedCall(SOLE_GATE_UNDECIDED_REASON);
|
|
601
780
|
default:
|
|
781
|
+
if (preToolUseHandsOff(input, gateInput, verdict)) return ask(TERMINAL_AND_PHONE_REASON);
|
|
602
782
|
return await dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath);
|
|
603
783
|
}
|
|
604
784
|
} catch (error) {
|
|
@@ -616,9 +796,9 @@ var toPermissionRequestOutput = (hookOutput) => {
|
|
|
616
796
|
if (d.permissionDecision === "deny") return permReqDeny(d.permissionDecisionReason);
|
|
617
797
|
return void 0;
|
|
618
798
|
};
|
|
619
|
-
var handlePermissionRequest = async (input, canonical) => {
|
|
799
|
+
var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
|
|
620
800
|
const claudeRules = claudePermissionRulesFor(input);
|
|
621
|
-
if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode)) return void 0;
|
|
801
|
+
if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode) && !terminalStaysLiveForTheCall(terminalLiveFactsOf(input))) return void 0;
|
|
622
802
|
if (isPusharyOwnTool(input.tool_name)) return void 0;
|
|
623
803
|
let apiKey;
|
|
624
804
|
try {
|
|
@@ -642,7 +822,14 @@ var handlePermissionRequest = async (input, canonical) => {
|
|
|
642
822
|
if (canonical === null) return permReqDeny(UNREADABLE_CALL_REASON);
|
|
643
823
|
if (agentQuestionStrategy(ACTIVE_SOURCE, "PermissionRequest", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
|
|
644
824
|
if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return permReqDeny(SCOPE_BATCH_REASON);
|
|
645
|
-
|
|
825
|
+
const handedOff = preToolUseHandsOff(input, gateInput, verdict);
|
|
826
|
+
const terminalLive = terminalStaysLiveForTheCall(terminalLiveFactsOf(input));
|
|
827
|
+
const scopeQuestion = verdict.kind === "gate" && Boolean(verdict.scopeReason);
|
|
828
|
+
const preToolUseRanForTheCall = PRETOOLUSE_HANDLED_TOOLS.has(input.tool_name) && isAdmitted(readAdmissionRules(), "claude", "PreToolUse");
|
|
829
|
+
const preToolUseAskedTheScopeQuestion = scopeQuestion && terminalLive && preToolUseRanForTheCall;
|
|
830
|
+
const preToolUseOwnsTheCall = !scopeQuestion && !claudeAllowlistOwnsCall(gateInput, verdict, input.permission_mode, claudeRules) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode);
|
|
831
|
+
if (!handedOff && (preToolUseAskedTheScopeQuestion || preToolUseOwnsTheCall)) return void 0;
|
|
832
|
+
const terminalLiveDispatch = handedOff ? { holdBudgetSeconds } : void 0;
|
|
646
833
|
switch (verdict.kind) {
|
|
647
834
|
case "allow":
|
|
648
835
|
return permReqAllow();
|
|
@@ -651,7 +838,7 @@ var handlePermissionRequest = async (input, canonical) => {
|
|
|
651
838
|
return void 0;
|
|
652
839
|
default:
|
|
653
840
|
return toPermissionRequestOutput(
|
|
654
|
-
await dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath)
|
|
841
|
+
await dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath, terminalLiveDispatch)
|
|
655
842
|
);
|
|
656
843
|
}
|
|
657
844
|
} catch (error) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
macAppBridgeAvailable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7LK3Y6ET.js";
|
|
4
4
|
import {
|
|
5
5
|
keyPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CNJ7SI5V.js";
|
|
7
7
|
import {
|
|
8
8
|
bridgeAgentKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GDLT32I4.js";
|
|
10
10
|
import {
|
|
11
11
|
readJsonSafe
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KS3O6O7E.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EJR5JXMV.js";
|
|
16
16
|
|
|
17
17
|
// src/shared-mcp-key.ts
|
|
18
18
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XIJTXRWB.js";
|
|
4
4
|
import {
|
|
5
5
|
backupFile,
|
|
6
6
|
readJsonSafe,
|
|
7
7
|
writeFileAtomic,
|
|
8
8
|
writeJsonAtomic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KS3O6O7E.js";
|
|
10
10
|
import {
|
|
11
11
|
configFilePath
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A47UKPC7.js";
|
|
13
13
|
import {
|
|
14
14
|
API_KEY_PREFIX_PATTERN,
|
|
15
15
|
isRecord
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EJR5JXMV.js";
|
|
17
17
|
|
|
18
18
|
// src/shell-alias.ts
|
|
19
19
|
import { homedir } from "os";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
reachVerdict,
|
|
13
13
|
reachesYou,
|
|
14
14
|
verifyDelivery
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MNNQEUQC.js";
|
|
16
16
|
import {
|
|
17
17
|
humanIsTty,
|
|
18
18
|
writeHuman
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
} from "./chunk-FO3MDD26.js";
|
|
25
25
|
import {
|
|
26
26
|
reportedInstallSource
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-XIJTXRWB.js";
|
|
28
28
|
import {
|
|
29
29
|
NPX_LATEST_COMMAND
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GO7YKPT3.js";
|
|
31
31
|
import {
|
|
32
32
|
NO_PAIRING_COMPUTER,
|
|
33
33
|
PAIR_TTL_SECONDS
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-EJR5JXMV.js";
|
|
35
35
|
|
|
36
36
|
// src/onboarding.ts
|
|
37
37
|
import qrcodeTerminal from "qrcode-terminal";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureCodexTrustsPusharyHooks
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JL3SZJJP.js";
|
|
4
4
|
import {
|
|
5
5
|
fxIgnoresInstructionsFile,
|
|
6
6
|
fxInstructionsBody,
|
|
7
7
|
fxServerHolder,
|
|
8
8
|
macAppFxBridge,
|
|
9
9
|
refreshClineKey
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6ZXCWK27.js";
|
|
11
11
|
import {
|
|
12
12
|
OPENCODE_HOOK_BINARY,
|
|
13
13
|
agentHookOwner,
|
|
@@ -19,30 +19,28 @@ import {
|
|
|
19
19
|
openCodePluginDir,
|
|
20
20
|
openCodeWired,
|
|
21
21
|
withOpenCodeAskRules
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7LK3Y6ET.js";
|
|
23
23
|
import {
|
|
24
24
|
detectClaudeVersion
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MDIGG3Q7.js";
|
|
26
26
|
import {
|
|
27
27
|
addCompatibleHooks,
|
|
28
28
|
compatibleConfigFile,
|
|
29
29
|
compatibleInstructionsFile,
|
|
30
30
|
hasCompatibleHooks
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3EZP5ZPS.js";
|
|
32
32
|
import {
|
|
33
|
+
GEMINI_HOOK_BINARY,
|
|
34
|
+
addGeminiHooks,
|
|
35
|
+
addGeminiMcpServer,
|
|
33
36
|
claudeUnprovenHolds,
|
|
34
37
|
claudeWired,
|
|
35
38
|
codexUnprovenHolds,
|
|
36
39
|
codexWired,
|
|
37
40
|
geminiWired,
|
|
41
|
+
hasGeminiHooks,
|
|
38
42
|
planHooks
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
GEMINI_HOOK_BINARY,
|
|
42
|
-
addGeminiHooks,
|
|
43
|
-
addGeminiMcpServer,
|
|
44
|
-
hasGeminiHooks
|
|
45
|
-
} from "./chunk-ANP3DIST.js";
|
|
43
|
+
} from "./chunk-YQDCTID4.js";
|
|
46
44
|
import {
|
|
47
45
|
CLAUDE_HOOK_BINARY,
|
|
48
46
|
CLAUDE_HOOK_EVENTS,
|
|
@@ -87,7 +85,7 @@ import {
|
|
|
87
85
|
renderAgentInstructions,
|
|
88
86
|
supportedClaudeEvents,
|
|
89
87
|
vscodePluginMcp
|
|
90
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-GDLT32I4.js";
|
|
91
89
|
import {
|
|
92
90
|
formatVersion,
|
|
93
91
|
readJsonSafe,
|
|
@@ -95,12 +93,12 @@ import {
|
|
|
95
93
|
resolveGlobalBinary,
|
|
96
94
|
writeFileAtomic,
|
|
97
95
|
writeJsonAtomic
|
|
98
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-KS3O6O7E.js";
|
|
99
97
|
import {
|
|
100
98
|
HOOK_COMPATIBLE_PROFILES,
|
|
101
99
|
isCompatibleAgentType,
|
|
102
100
|
isRecord
|
|
103
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-EJR5JXMV.js";
|
|
104
102
|
|
|
105
103
|
// src/reapply.ts
|
|
106
104
|
import { dirname, join } from "path";
|
|
@@ -8,20 +8,20 @@ import {
|
|
|
8
8
|
everyProgramFileIsThere,
|
|
9
9
|
installedCodexApp,
|
|
10
10
|
shellQuoted
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AVWECJSN.js";
|
|
12
12
|
import {
|
|
13
13
|
writeHuman
|
|
14
14
|
} from "./chunk-QCGNGEGE.js";
|
|
15
15
|
import {
|
|
16
16
|
xml
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-57NTMVMI.js";
|
|
18
18
|
import {
|
|
19
19
|
CODEX_APP_LAUNCH_AT_LOGIN_VERB,
|
|
20
20
|
CODEX_APP_LAUNCH_VARIABLE
|
|
21
21
|
} from "./chunk-E46NE7FB.js";
|
|
22
22
|
import {
|
|
23
23
|
writeFileAtomic
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-KS3O6O7E.js";
|
|
25
25
|
|
|
26
26
|
// src/codex-app-cards-switch.ts
|
|
27
27
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -5757,6 +5757,22 @@ var EXIT_PLAN_MODE_TOOL = "ExitPlanMode";
|
|
|
5757
5757
|
var ASKED_IN_EVERY_MODE_TOOLS = [AGENT_QUESTION_TOOL, EXIT_PLAN_MODE_TOOL];
|
|
5758
5758
|
var ASKED_IN_EVERY_MODE = /* @__PURE__ */ new Set([...ASKED_IN_EVERY_MODE_TOOLS, ...CODEX_QUESTION_TOOLS]);
|
|
5759
5759
|
var isAskedInEveryMode = (toolName) => ASKED_IN_EVERY_MODE.has(toolName);
|
|
5760
|
+
var MODES_WITH_A_TERMINAL_PROMPT = /* @__PURE__ */ new Set(["default", "acceptEdits"]);
|
|
5761
|
+
var TERMINAL_AND_PHONE_REASON = "Pushary may also ask your phone. The first answer counts.";
|
|
5762
|
+
var terminalStaysLiveForTheCall = (facts) => facts.source === "claude" && facts.sessionAttended && facts.permissionHookAdmitted && !facts.handedDownByTheMacBridge && !facts.fromCursor && MODES_WITH_A_TERMINAL_PROMPT.has(facts.permissionMode ?? "") && !isAskedInEveryMode(facts.toolName);
|
|
5763
|
+
var TIMEOUT_DECISIONS = { approve: "allow", deny: "deny" };
|
|
5764
|
+
var pushOnlyTimeoutDecision = (policy) => policy.mode === "push_only" ? TIMEOUT_DECISIONS[policy.timeoutAction] : void 0;
|
|
5765
|
+
var phoneWindowSeconds = (policy) => Math.max(policy.mode === "push_only" ? policy.timeoutSeconds : policy.pushFirstSeconds, 0);
|
|
5766
|
+
var terminalLiveWait = (policy, holdBudgetProof) => {
|
|
5767
|
+
const budget = Math.min(holdBudgetProof ?? HOOK_BUDGETS.claude.budgetSeconds, HOOK_BUDGETS.claude.budgetSeconds);
|
|
5768
|
+
const ceiling = Math.max(budget - HOOK_BUDGETS.claude.guardSeconds, 1);
|
|
5769
|
+
const policySeconds = phoneWindowSeconds(policy);
|
|
5770
|
+
const decision = pushOnlyTimeoutDecision(policy);
|
|
5771
|
+
if (decision !== void 0 && policySeconds <= ceiling) return { waitSeconds: policySeconds, holdSeconds: ceiling, onTimeout: decision };
|
|
5772
|
+
const waitsForThePhone = policy.mode === "push_only" && policy.timeoutAction === "wait";
|
|
5773
|
+
const holdsTheBudget = waitsForThePhone || holdBudgetProof !== void 0 && decision === void 0;
|
|
5774
|
+
return { waitSeconds: holdsTheBudget ? ceiling : Math.min(policySeconds, ceiling), holdSeconds: ceiling, onTimeout: "leave_to_terminal" };
|
|
5775
|
+
};
|
|
5760
5776
|
var NATIVE_BLOCK_EVENTS = /* @__PURE__ */ new Set(["PermissionDenied"]);
|
|
5761
5777
|
var isNativeBlockEvent = (event) => typeof event === "string" && NATIVE_BLOCK_EVENTS.has(event);
|
|
5762
5778
|
var CODEX_RESCUE_TOOL_NAME = "Bash";
|
|
@@ -5833,7 +5849,8 @@ var resolveGate = (input) => {
|
|
|
5833
5849
|
scopePath: scopeReason && "path" in scopeVerdict ? widenablePath(scopeVerdict.path) : void 0
|
|
5834
5850
|
};
|
|
5835
5851
|
};
|
|
5836
|
-
var
|
|
5852
|
+
var noModeOverrideIsActive = (input) => (input.modeState.mode ?? input.config.modeOverride ?? null) === null;
|
|
5853
|
+
var editAsksAtTheAgentsPrompt = (input, verdict) => verdict.kind === "gate" && !verdict.scopeReason && noModeOverrideIsActive(input) && !aChosenRuleGoverns(input) && verdict.policy.mode === "push_first" && FILE_EDIT_TOOLS.has(input.toolName);
|
|
5837
5854
|
var claudePromptsBeforeAnEdit = (permissionMode) => permissionMode === "default";
|
|
5838
5855
|
var runsTheClaudeHook = (source) => source === null || source === "claude" || hookCompatibleProfileBySource(source) !== void 0;
|
|
5839
5856
|
var agentPromptsBeforeAnEdit = ({ source, event, permissionMode }) => {
|
|
@@ -5950,6 +5967,7 @@ var aChosenRuleGoverns = (input) => {
|
|
|
5950
5967
|
});
|
|
5951
5968
|
};
|
|
5952
5969
|
var claudeAllowlistOwnsCall = (input, verdict, permissionMode, rules) => rules !== null && verdict.kind === "gate" && !verdict.scopeReason && !aChosenRuleGoverns(input) && !isAskedInEveryMode(input.toolName) && claudeConsultsItsAllowlist(permissionMode) && agentRulesAllowEveryInput(rules, input.toolName, input.toolInputs, input.cwd);
|
|
5970
|
+
var claudePromptTakesTheCall = (facts, input, verdict) => verdict.kind === "gate" && !verdict.scopeReason && terminalStaysLiveForTheCall(facts) && noModeOverrideIsActive(input) && !aChosenRuleGoverns(input) && !editGoesToTheAgentsPrompt({ source: facts.source, event: "PreToolUse", permissionMode: facts.permissionMode }, input, verdict);
|
|
5953
5971
|
var toPolicyVersion = (value) => typeof value === "string" || typeof value === "number" ? String(value) : null;
|
|
5954
5972
|
var modeStateFromResponse = (data) => {
|
|
5955
5973
|
const mode = data.override?.mode;
|
|
@@ -6426,12 +6444,16 @@ export {
|
|
|
6426
6444
|
codexQuestionGoesToPushary,
|
|
6427
6445
|
agentQuestionStrategy,
|
|
6428
6446
|
questionHandedToTheTerminal,
|
|
6447
|
+
TERMINAL_AND_PHONE_REASON,
|
|
6448
|
+
terminalStaysLiveForTheCall,
|
|
6449
|
+
terminalLiveWait,
|
|
6429
6450
|
CODEX_RESCUE_TOOL_NAME,
|
|
6430
6451
|
isBlockedActionRequest,
|
|
6431
6452
|
canonicalJsonText,
|
|
6432
6453
|
BLOCKED_ACTION_GRANT_TTL_SECONDS,
|
|
6433
6454
|
blockedActionIdentity,
|
|
6434
6455
|
PRETOOLUSE_GATED_TOOLS,
|
|
6456
|
+
PRETOOLUSE_HANDLED_TOOLS,
|
|
6435
6457
|
isPermissionRequestOwnedByPreToolUse,
|
|
6436
6458
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
6437
6459
|
resolveGate,
|
|
@@ -6453,6 +6475,7 @@ export {
|
|
|
6453
6475
|
claudeConsultsItsAllowlist,
|
|
6454
6476
|
agentRulesAllowEveryInput,
|
|
6455
6477
|
claudeAllowlistOwnsCall,
|
|
6478
|
+
claudePromptTakesTheCall,
|
|
6456
6479
|
modeStateFromResponse,
|
|
6457
6480
|
GATE_WIRE,
|
|
6458
6481
|
GATE_MAX_TOOL_INPUTS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UTAARXYQ.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-NMUI3ZWG.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-PPY5N2E6.js";
|
|
10
10
|
import {
|
|
11
11
|
NPX_LATEST_COMMAND
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GO7YKPT3.js";
|
|
13
13
|
import {
|
|
14
14
|
CLAUDE_CONNECTOR_GUIDE,
|
|
15
15
|
CLAUDE_CONNECTOR_STEPS,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
CLAUDE_CONNECTOR_URL,
|
|
18
18
|
COWORK_CONNECTOR_LIMIT,
|
|
19
19
|
COWORK_STANDING_INSTRUCTIONS
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EJR5JXMV.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/cowork.ts
|
|
23
23
|
import { readFileSync } from "fs";
|