pushary 1.9.39 → 1.9.41
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 +10 -0
- package/dist/bin/pushary-bell-hook.js +25 -25
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +24 -24
- package/dist/bin/pushary-clean.js +29 -29
- package/dist/bin/pushary-codex-bridge.js +157 -38
- package/dist/bin/pushary-codex-hook.js +30 -30
- package/dist/bin/pushary-codex.js +12 -12
- package/dist/bin/pushary-connect.js +24 -24
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +32 -32
- package/dist/bin/pushary-disconnect.js +24 -24
- package/dist/bin/pushary-doctor.js +33 -33
- package/dist/bin/pushary-elicitation-hook.js +25 -25
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +27 -27
- package/dist/bin/pushary-hook.js +29 -29
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +24 -24
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +12 -12
- package/dist/bin/pushary-notification-hook.js +24 -24
- package/dist/bin/pushary-opencode-hook.js +26 -26
- package/dist/bin/pushary-permission-denied-hook.js +29 -29
- package/dist/bin/pushary-permission-hook.js +28 -28
- package/dist/bin/pushary-post-hook.js +24 -24
- package/dist/bin/pushary-prompt-hook.js +24 -24
- package/dist/bin/pushary-session-end-hook.js +24 -24
- package/dist/bin/pushary-session-start-hook.js +28 -28
- package/dist/bin/pushary-setup.js +35 -35
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +26 -26
- package/dist/bin/pushary-stop-hook.js +24 -24
- package/dist/bin/pushary-stopfailure-hook.js +24 -24
- package/dist/bin/pushary-suggestions.js +12 -12
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +30 -30
- package/dist/bin/pushary-wait.js +12 -12
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-RJDMLAHO.js → chunk-3U3FU6ZX.js} +3 -3
- package/dist/{chunk-ZEJ4HPXN.js → chunk-4UCTKLHY.js} +3 -3
- package/dist/{chunk-L5OCX5EH.js → chunk-4WM7IVVQ.js} +2 -2
- package/dist/{chunk-IHP6X4MJ.js → chunk-5INZFKHL.js} +1 -1
- package/dist/{chunk-YHTGLZ3F.js → chunk-6PABNQVH.js} +4 -4
- package/dist/{chunk-NBH6KBD4.js → chunk-7L6YSHZO.js} +2 -2
- package/dist/{chunk-EBBESQKO.js → chunk-ASXBYX2N.js} +1 -1
- package/dist/{chunk-54OESWJ5.js → chunk-AUDM6HU6.js} +2 -2
- package/dist/{chunk-Z4IBDCBH.js → chunk-AW4TDBUJ.js} +3 -3
- package/dist/{chunk-I2SXJH5G.js → chunk-B7PZBWBU.js} +7 -7
- package/dist/{chunk-W52MFAWQ.js → chunk-BDSIE2MT.js} +2 -2
- package/dist/{chunk-AVCTQB2J.js → chunk-BZIXDIIT.js} +1 -1
- package/dist/{chunk-GLGMC25A.js → chunk-CGRVIUKE.js} +8 -8
- package/dist/{chunk-SOPKWVMZ.js → chunk-CHD6IUNM.js} +1 -1
- package/dist/{chunk-AX4MCCIQ.js → chunk-DIJ532S7.js} +1 -1
- package/dist/{chunk-O4ZDPJU2.js → chunk-DPISXMLL.js} +4 -4
- package/dist/{chunk-6EVKSX75.js → chunk-E47JEBUR.js} +4 -4
- package/dist/{chunk-IL5NWORI.js → chunk-EBZK2SJ2.js} +4 -4
- package/dist/{chunk-RDR4CWVU.js → chunk-F43LAKAK.js} +2 -2
- package/dist/{chunk-3KWEGRNF.js → chunk-FMYXPJYS.js} +5 -5
- package/dist/{chunk-6DYR4SX2.js → chunk-FP2ZJK3T.js} +5 -5
- package/dist/{chunk-KBH7AEQK.js → chunk-I7EZMNKI.js} +5 -5
- package/dist/{chunk-PP3D2TG6.js → chunk-IVUP2EE4.js} +4 -4
- package/dist/{chunk-JTHGOW7A.js → chunk-IXNVIWNN.js} +2 -2
- package/dist/{chunk-J4FVW55Z.js → chunk-J7OBJZ5S.js} +1 -1
- package/dist/{chunk-XWG22IUE.js → chunk-JBK47Y2M.js} +6 -6
- package/dist/{chunk-4QAX6YTC.js → chunk-JQX2L3ES.js} +1 -1
- package/dist/{chunk-BPHAE44X.js → chunk-K2SSNAUW.js} +1 -1
- package/dist/{chunk-EOULXXHA.js → chunk-KYFWYPHN.js} +1 -1
- package/dist/{chunk-6FBQLKOJ.js → chunk-M2YE3OEC.js} +3 -3
- package/dist/{chunk-Z2ZPMSJO.js → chunk-M7VKFAAK.js} +3 -3
- package/dist/{chunk-NEPOKBSG.js → chunk-MAB6CGL5.js} +1 -1
- package/dist/{chunk-HYRUW76F.js → chunk-MI67QQEQ.js} +10 -10
- package/dist/{chunk-LBNXMPQ6.js → chunk-NRSTNZYJ.js} +5 -5
- package/dist/{chunk-WBZEW5RY.js → chunk-ODPULZZG.js} +2 -2
- package/dist/{chunk-KLNC2KW5.js → chunk-OLLWYLQX.js} +2 -2
- package/dist/{chunk-AWPUBTCU.js → chunk-ORLTWJ2O.js} +31 -13
- package/dist/{chunk-77HOP22I.js → chunk-PJ3C6IID.js} +4 -4
- package/dist/{chunk-RQN752UC.js → chunk-Q3QRD67J.js} +5 -5
- package/dist/{chunk-E3ZYXYBV.js → chunk-QPT4PTUG.js} +1 -1
- package/dist/{chunk-BCOS5PVT.js → chunk-QRNNIDGY.js} +1 -1
- package/dist/{chunk-A4C6JKIJ.js → chunk-RBUCXUT7.js} +4 -4
- package/dist/{chunk-GFPUTOME.js → chunk-RETRVO47.js} +2 -2
- package/dist/{chunk-6UQC6RLE.js → chunk-RTM5GVRZ.js} +8 -8
- package/dist/{chunk-BXD33IG7.js → chunk-STETTN4K.js} +5 -5
- package/dist/{chunk-NNJNN5OL.js → chunk-T3Q4B6WV.js} +2 -2
- package/dist/{chunk-XN3DMUWI.js → chunk-WZNRDDC4.js} +6 -6
- package/dist/{chunk-4G4T2EL2.js → chunk-X7TNLYNZ.js} +1 -1
- package/dist/{chunk-X7OOLKKT.js → chunk-Y3HTWB5S.js} +1 -1
- package/dist/{chunk-VHGTMFKS.js → chunk-Z4RM54LU.js} +2 -2
- package/dist/{chunk-DMGXWZYC.js → chunk-ZJY4KON3.js} +4 -4
- package/dist/{chunk-SSV75WCM.js → chunk-ZV56INA6.js} +3 -3
- package/dist/{chunk-TNGCGQ4R.js → chunk-ZVMFRUBD.js} +4 -4
- package/dist/{chunk-36Y2YAAQ.js → chunk-ZX3PFROQ.js} +1 -1
- package/dist/{global-upgrade-364SJFGE.js → global-upgrade-YEAGJG4G.js} +6 -6
- package/dist/{paths-HRX7TWHU.js → paths-HQAICWAF.js} +2 -2
- package/dist/{reapply-3IZIQNEU.js → reapply-XBEB2B5A.js} +20 -20
- package/dist/src/index.js +19 -19
- package/dist/{upgrade-lock-PPYGYFVQ.js → upgrade-lock-GIO5QZ7E.js} +3 -3
- package/package.json +1 -1
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
postLiveSession,
|
|
6
6
|
postLiveSessionUntilAccepted,
|
|
7
7
|
startLiveSessionHeartbeat
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-OLLWYLQX.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveProviderBinary
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-T3Q4B6WV.js";
|
|
12
12
|
import "../chunk-RIVNNBEK.js";
|
|
13
13
|
import {
|
|
14
14
|
SESSION_IDLE_TIMEOUT_MS,
|
|
@@ -16,55 +16,121 @@ import {
|
|
|
16
16
|
idleDeadlinePassed,
|
|
17
17
|
startProcessOwnership,
|
|
18
18
|
withSpawnProcessOwnership
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
19
|
+
} from "../chunk-4WM7IVVQ.js";
|
|
20
|
+
import "../chunk-X7TNLYNZ.js";
|
|
21
|
+
import "../chunk-MAB6CGL5.js";
|
|
22
22
|
import {
|
|
23
23
|
transcriptsEnabled
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-QRNNIDGY.js";
|
|
25
25
|
import {
|
|
26
26
|
spawnClaude
|
|
27
27
|
} from "../chunk-XHKBHWLX.js";
|
|
28
28
|
import "../chunk-6ICPEJY5.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-M7VKFAAK.js";
|
|
30
30
|
import {
|
|
31
31
|
isAskUserResponse,
|
|
32
32
|
isDecisionStopped,
|
|
33
33
|
isWaitForAnswerResponse,
|
|
34
34
|
withdrawQuestion,
|
|
35
35
|
writeDegraded
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-I7EZMNKI.js";
|
|
37
37
|
import "../chunk-POFBE6ZY.js";
|
|
38
38
|
import {
|
|
39
39
|
callMcpTool,
|
|
40
40
|
isRetryable
|
|
41
|
-
} from "../chunk-
|
|
42
|
-
import "../chunk-
|
|
43
|
-
import "../chunk-
|
|
41
|
+
} from "../chunk-AW4TDBUJ.js";
|
|
42
|
+
import "../chunk-ZV56INA6.js";
|
|
43
|
+
import "../chunk-4UCTKLHY.js";
|
|
44
44
|
import {
|
|
45
45
|
getMachineId
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-QPT4PTUG.js";
|
|
47
47
|
import "../chunk-7QLSKOSU.js";
|
|
48
48
|
import "../chunk-KZERVKTD.js";
|
|
49
|
-
import "../chunk-
|
|
50
|
-
import "../chunk-
|
|
49
|
+
import "../chunk-ODPULZZG.js";
|
|
50
|
+
import "../chunk-EBZK2SJ2.js";
|
|
51
51
|
import "../chunk-AQFEP65J.js";
|
|
52
52
|
import {
|
|
53
53
|
getApiKey,
|
|
54
54
|
getBaseUrl
|
|
55
|
-
} from "../chunk-
|
|
56
|
-
import "../chunk-
|
|
55
|
+
} from "../chunk-CHD6IUNM.js";
|
|
56
|
+
import "../chunk-DIJ532S7.js";
|
|
57
57
|
import {
|
|
58
|
+
AGENT_QUESTION_DESCRIPTION_MAX,
|
|
59
|
+
AGENT_QUESTION_HEADER_MAX,
|
|
60
|
+
AGENT_QUESTION_OPTION_MAX,
|
|
61
|
+
ASK_CONTEXT_MAX,
|
|
62
|
+
ASK_QUESTION_MAX,
|
|
63
|
+
PERSONAL_QUESTION_CAPABILITY,
|
|
64
|
+
canonicalJsonText,
|
|
58
65
|
elicitationContent,
|
|
59
|
-
|
|
66
|
+
isQuestionOwner,
|
|
60
67
|
parseAgentQuestionAnswers,
|
|
68
|
+
parseCodexQuestions,
|
|
61
69
|
planElicitationAsk,
|
|
62
70
|
readElicitationFields
|
|
63
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-ORLTWJ2O.js";
|
|
64
72
|
|
|
65
73
|
// bin/pushary-codex-bridge.ts
|
|
66
74
|
import { existsSync } from "fs";
|
|
67
75
|
|
|
76
|
+
// src/codex-question-owner.ts
|
|
77
|
+
import { createHash } from "crypto";
|
|
78
|
+
var codexQuestionOwner = (params, requestId, runtime) => {
|
|
79
|
+
if (params.threadId !== runtime.threadId || typeof params.isBlocking !== "boolean") return null;
|
|
80
|
+
const owner = {
|
|
81
|
+
capability: PERSONAL_QUESTION_CAPABILITY,
|
|
82
|
+
machineId: runtime.machineId,
|
|
83
|
+
generation: runtime.generation,
|
|
84
|
+
threadId: params.threadId,
|
|
85
|
+
turnId: params.turnId,
|
|
86
|
+
itemId: params.itemId,
|
|
87
|
+
requestId,
|
|
88
|
+
method: "item/tool/requestUserInput",
|
|
89
|
+
subjectHash: createHash("sha256").update(canonicalJsonText(params)).digest("hex")
|
|
90
|
+
};
|
|
91
|
+
return isQuestionOwner(owner) ? owner : null;
|
|
92
|
+
};
|
|
93
|
+
var closesOwnedQuestion = (owner, method, params) => {
|
|
94
|
+
if (method === "serverRequest/resolved") return params.requestId === owner.requestId;
|
|
95
|
+
if (params.threadId !== owner.threadId) return false;
|
|
96
|
+
if (method === "thread/closed" || method === "thread/archived") return true;
|
|
97
|
+
if (method === "turn/completed") {
|
|
98
|
+
const turn = params.turn;
|
|
99
|
+
return turn !== null && typeof turn === "object" && "id" in turn && turn.id === owner.turnId;
|
|
100
|
+
}
|
|
101
|
+
if (method === "item/completed" && params.turnId === owner.turnId) {
|
|
102
|
+
const item = params.item;
|
|
103
|
+
return item !== null && typeof item === "object" && "id" in item && item.id === owner.itemId;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/question-dispatch.ts
|
|
109
|
+
var claimOwnedQuestion = async (options, dispatch) => {
|
|
110
|
+
const response = await postLiveSession(options, "/api/agent/question/dispatch", {
|
|
111
|
+
owner: dispatch.owner,
|
|
112
|
+
correlationIds: dispatch.correlationIds,
|
|
113
|
+
operation: "claim"
|
|
114
|
+
});
|
|
115
|
+
const body = await response.json();
|
|
116
|
+
if (!response.ok || body === null || typeof body !== "object" || !("claimId" in body) || typeof body.claimId !== "string" || !body.claimId) throw new Error("Question delivery could not be claimed");
|
|
117
|
+
dispatch.claimId = body.claimId;
|
|
118
|
+
};
|
|
119
|
+
var reportOwnedQuestion = async (options, dispatch, operation) => {
|
|
120
|
+
if (dispatch.correlationIds.length === 0) return;
|
|
121
|
+
try {
|
|
122
|
+
const response = await postLiveSession({ ...options, signal: AbortSignal.timeout(3e3), requestTimeoutMs: 3e3 }, "/api/agent/question/dispatch", {
|
|
123
|
+
owner: dispatch.owner,
|
|
124
|
+
correlationIds: dispatch.correlationIds,
|
|
125
|
+
claimId: dispatch.claimId,
|
|
126
|
+
operation
|
|
127
|
+
});
|
|
128
|
+
if (!response.ok) throw new Error("Receipt refused");
|
|
129
|
+
} catch {
|
|
130
|
+
writeDegraded("questions", { reason: "question_receipt_unconfirmed", fallback: "no automatic replay", event: operation });
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
68
134
|
// src/codex-bridge.ts
|
|
69
135
|
import { randomUUID } from "crypto";
|
|
70
136
|
|
|
@@ -126,6 +192,7 @@ var JsonRpcClient = class {
|
|
|
126
192
|
child;
|
|
127
193
|
pending = /* @__PURE__ */ new Map();
|
|
128
194
|
notifications = /* @__PURE__ */ new Set();
|
|
195
|
+
generation = randomUUID();
|
|
129
196
|
serverRequests = /* @__PURE__ */ new Map();
|
|
130
197
|
threadId = null;
|
|
131
198
|
nextId = 1;
|
|
@@ -174,7 +241,10 @@ var JsonRpcClient = class {
|
|
|
174
241
|
async close() {
|
|
175
242
|
if (this.closed) return;
|
|
176
243
|
this.closed = true;
|
|
177
|
-
for (const request of this.serverRequests.values())
|
|
244
|
+
for (const request of this.serverRequests.values()) {
|
|
245
|
+
request.controller.abort();
|
|
246
|
+
if (request.dispatch) void reportOwnedQuestion(this.bridgeOptions, request.dispatch, "unavailable");
|
|
247
|
+
}
|
|
178
248
|
this.serverRequests.clear();
|
|
179
249
|
this.child.stdin?.end();
|
|
180
250
|
if (this.child.exitCode != null) return;
|
|
@@ -218,23 +288,50 @@ var JsonRpcClient = class {
|
|
|
218
288
|
}
|
|
219
289
|
if (message.id !== void 0 && (message.method === "item/tool/requestUserInput" || message.method === "mcpServer/elicitation/request")) {
|
|
220
290
|
const id = message.id;
|
|
221
|
-
|
|
291
|
+
const owner = message.method === "item/tool/requestUserInput" ? codexQuestionOwner(message.params ?? {}, id, { machineId: this.bridgeOptions.machineId, generation: this.generation, threadId: this.threadId }) : null;
|
|
292
|
+
if (message.method === "item/tool/requestUserInput" && !owner) {
|
|
293
|
+
this.write({ id, error: { code: -32e3, message: "Unsupported question ownership" } });
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const existing = this.serverRequests.get(id);
|
|
297
|
+
if (existing) {
|
|
298
|
+
if (existing.dispatch && existing.dispatch.owner.subjectHash !== owner?.subjectHash) existing.controller.abort();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
222
301
|
if (this.serverRequests.size >= MAX_PENDING_RPC) {
|
|
223
302
|
this.write({ id, error: { code: -32e3, message: "Too many pending user questions" } });
|
|
224
303
|
return;
|
|
225
304
|
}
|
|
226
305
|
const controller = new AbortController();
|
|
227
|
-
this.
|
|
306
|
+
const now = this.bridgeOptions.now ?? Date.now;
|
|
307
|
+
const duration = message.params?.autoResolutionMs;
|
|
308
|
+
if (duration != null && (typeof duration !== "number" || !Number.isFinite(duration) || duration < 0)) {
|
|
309
|
+
this.write({ id, error: { code: -32e3, message: "Invalid question deadline" } });
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const deadline = typeof duration === "number" ? now() + duration : null;
|
|
313
|
+
const dispatch = owner ? { owner, correlationIds: [], deadline } : void 0;
|
|
314
|
+
this.serverRequests.set(id, { controller, dispatch });
|
|
228
315
|
const signal = AbortSignal.any([controller.signal, this.bridgeOptions.signal]);
|
|
229
|
-
const answer = message.method === "mcpServer/elicitation/request" ? answerCodexElicitation(this.bridgeOptions, message.params ?? {}, this.threadId, signal) : answerCodexQuestions(this.bridgeOptions, message.params ?? {}, signal);
|
|
316
|
+
const answer = message.method === "mcpServer/elicitation/request" ? answerCodexElicitation(this.bridgeOptions, message.params ?? {}, this.threadId, signal) : answerCodexQuestions(this.bridgeOptions, message.params ?? {}, signal, "request_user_input", dispatch);
|
|
230
317
|
void answer.then(
|
|
231
|
-
(result) => {
|
|
232
|
-
if (
|
|
318
|
+
async (result) => {
|
|
319
|
+
if (signal.aborted || this.closed) return;
|
|
320
|
+
if (dispatch) await claimOwnedQuestion(this.bridgeOptions, dispatch);
|
|
321
|
+
if (signal.aborted || this.closed || this.serverRequests.get(id)?.controller !== controller) return;
|
|
322
|
+
if (deadline !== null && now() >= deadline) throw new Error("Question expired");
|
|
323
|
+
this.write({ id, result });
|
|
324
|
+
if (dispatch) await reportOwnedQuestion(this.bridgeOptions, dispatch, "reply_queued");
|
|
233
325
|
},
|
|
234
326
|
(error) => {
|
|
235
327
|
if (!signal.aborted && !this.closed) this.write({ id, error: { code: -32e3, message: error instanceof Error && error.message === LOCAL_QUESTION_UNAVAILABLE ? LOCAL_QUESTION_UNAVAILABLE : "No user answer was received through Pushary" } });
|
|
236
328
|
}
|
|
237
|
-
).
|
|
329
|
+
).catch(() => {
|
|
330
|
+
if (!signal.aborted && !this.closed) this.write({ id, error: { code: -32e3, message: "Question delivery is unconfirmed; no automatic retry" } });
|
|
331
|
+
}).finally(async () => {
|
|
332
|
+
if (dispatch && (signal.aborted || !dispatch.claimId)) await reportOwnedQuestion(this.bridgeOptions, dispatch, "unavailable");
|
|
333
|
+
if (!dispatch?.claimId || signal.aborted) this.serverRequests.delete(id);
|
|
334
|
+
});
|
|
238
335
|
return;
|
|
239
336
|
}
|
|
240
337
|
if (message.id !== void 0 && message.method) {
|
|
@@ -251,9 +348,17 @@ var JsonRpcClient = class {
|
|
|
251
348
|
else pending.resolve(message.result);
|
|
252
349
|
return;
|
|
253
350
|
}
|
|
254
|
-
if (message.method
|
|
255
|
-
const
|
|
256
|
-
|
|
351
|
+
if (message.method) {
|
|
352
|
+
for (const request of this.serverRequests.values()) {
|
|
353
|
+
if (request.dispatch && closesOwnedQuestion(request.dispatch.owner, message.method, message.params ?? {})) {
|
|
354
|
+
request.controller.abort();
|
|
355
|
+
void reportOwnedQuestion(this.bridgeOptions, request.dispatch, request.dispatch.claimId ? "request_closed" : "unavailable");
|
|
356
|
+
this.serverRequests.delete(request.dispatch.owner.requestId);
|
|
357
|
+
} else if (!request.dispatch && message.method === "serverRequest/resolved") {
|
|
358
|
+
const id = message.params?.requestId;
|
|
359
|
+
if ((typeof id === "string" || typeof id === "number") && this.serverRequests.get(id) === request) request.controller.abort();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
257
362
|
}
|
|
258
363
|
if (message.method) {
|
|
259
364
|
for (const listener of this.notifications) listener(message);
|
|
@@ -263,7 +368,10 @@ var JsonRpcClient = class {
|
|
|
263
368
|
if (this.closed) return;
|
|
264
369
|
this.closed = true;
|
|
265
370
|
this.failure = error;
|
|
266
|
-
for (const request of this.serverRequests.values())
|
|
371
|
+
for (const request of this.serverRequests.values()) {
|
|
372
|
+
request.controller.abort();
|
|
373
|
+
if (request.dispatch) void reportOwnedQuestion(this.bridgeOptions, request.dispatch, "unavailable");
|
|
374
|
+
}
|
|
267
375
|
this.serverRequests.clear();
|
|
268
376
|
this.rejectPending(error);
|
|
269
377
|
if (this.child.exitCode == null) this.child.kill();
|
|
@@ -286,20 +394,29 @@ var rpcTurnId = (result) => {
|
|
|
286
394
|
const response = object(result);
|
|
287
395
|
return string(object(response?.turn)?.id) ?? string(response?.turnId);
|
|
288
396
|
};
|
|
289
|
-
var
|
|
397
|
+
var readCodexBridgeQuestion = (raw) => {
|
|
398
|
+
const question = object(raw);
|
|
399
|
+
const id = string(question?.id);
|
|
400
|
+
const prompt = string(question?.question);
|
|
401
|
+
if (!question || !id || !prompt || prompt.length > ASK_QUESTION_MAX || question.isSecret != null && question.isSecret !== false || question.isOther != null && typeof question.isOther !== "boolean" || question.multiSelect != null && question.multiSelect !== false || question.header !== void 0 && typeof question.header !== "string") throw new Error("Unsupported question");
|
|
402
|
+
const hasChoices = question.options != null && !(Array.isArray(question.options) && question.options.length === 0);
|
|
403
|
+
const structured = hasChoices ? parseCodexQuestions("request_user_input", { questions: [{ ...question, multiSelect: false, allowOther: question.isOther === true }] })?.[0] : void 0;
|
|
404
|
+
if (hasChoices && !structured) throw new Error("Unsupported question");
|
|
405
|
+
const headerLimit = structured ? AGENT_QUESTION_HEADER_MAX : ASK_CONTEXT_MAX;
|
|
406
|
+
if (typeof question.header === "string" && question.header.length > headerLimit || structured?.options.some((option) => option.label.length > AGENT_QUESTION_OPTION_MAX || (option.description?.length ?? 0) > AGENT_QUESTION_DESCRIPTION_MAX)) throw new Error("Unsupported question");
|
|
407
|
+
return { question, id, prompt, structured };
|
|
408
|
+
};
|
|
409
|
+
var answerCodexQuestions = async (options, params, signal, toolName = "request_user_input", dispatch) => {
|
|
290
410
|
if (!Array.isArray(params.questions) || !params.questions.length || params.questions.length > 3) throw new Error("Invalid questions");
|
|
411
|
+
const questions = params.questions.map(readCodexBridgeQuestion);
|
|
412
|
+
if (new Set(questions.map((question) => question.id)).size !== questions.length) throw new Error("Unsupported question");
|
|
291
413
|
const answers = /* @__PURE__ */ Object.create(null);
|
|
292
414
|
const now = options.now ?? Date.now;
|
|
293
415
|
if (params.autoResolutionMs != null && (typeof params.autoResolutionMs !== "number" || !Number.isFinite(params.autoResolutionMs) || params.autoResolutionMs < 0)) throw new Error("Invalid question deadline");
|
|
294
|
-
const deadline = typeof params.autoResolutionMs === "number" ? now() + params.autoResolutionMs : null;
|
|
295
|
-
for (const
|
|
416
|
+
const deadline = dispatch ? dispatch.deadline : typeof params.autoResolutionMs === "number" ? now() + params.autoResolutionMs : null;
|
|
417
|
+
for (const { question, id, prompt, structured } of questions) {
|
|
296
418
|
if (signal.aborted || deadline !== null && now() >= deadline) throw new Error("Question expired");
|
|
297
|
-
const
|
|
298
|
-
const id = string(question?.id);
|
|
299
|
-
const prompt = string(question?.question);
|
|
300
|
-
if (!id || !prompt || id in answers || question?.isSecret === true) throw new Error("Unsupported question");
|
|
301
|
-
const labels = Array.isArray(question?.options) ? question.options.map((option) => string(object(option)?.label)).filter((label) => !!label) : [];
|
|
302
|
-
const structured = labels.length >= 2 ? parseAgentQuestion({ ...question, multiSelect: false, allowOther: question?.isOther === true }) : void 0;
|
|
419
|
+
const labels = structured?.options.map((option) => option.label) ?? [];
|
|
303
420
|
let correlationId = null;
|
|
304
421
|
let settled = false;
|
|
305
422
|
const call = async (name, args, timeoutMs, waitSignal = signal) => {
|
|
@@ -311,6 +428,7 @@ var answerCodexQuestions = async (options, params, signal, toolName = "request_u
|
|
|
311
428
|
signal.throwIfAborted();
|
|
312
429
|
if (deadline !== null && now() >= deadline) throw new Error("Question expired");
|
|
313
430
|
let result = await call("ask_user", {
|
|
431
|
+
...dispatch ? { questionOwner: dispatch.owner } : {},
|
|
314
432
|
requestId: randomUUID(),
|
|
315
433
|
question: prompt,
|
|
316
434
|
type: labels.length >= 2 ? "select" : "input",
|
|
@@ -327,6 +445,7 @@ var answerCodexQuestions = async (options, params, signal, toolName = "request_u
|
|
|
327
445
|
}, deadline === null ? 1e4 : Math.min(1e4, deadline - now()));
|
|
328
446
|
correlationId = string(object(result)?.correlationId);
|
|
329
447
|
if (!isAskUserResponse(result)) throw new Error("Invalid ask_user response");
|
|
448
|
+
if (correlationId && dispatch) dispatch.correlationIds.push(correlationId);
|
|
330
449
|
while (!result.answered) {
|
|
331
450
|
if (result.status === "terminal" || result.status === "notified" || result.suppressed || result.mode === "terminal_only" || result.mode === "notify_only") {
|
|
332
451
|
if (correlationId) {
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
takeHookHoldBudget
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-J7OBJZ5S.js";
|
|
5
5
|
import {
|
|
6
6
|
askAgentQuestions,
|
|
7
7
|
defersToNativeMode,
|
|
8
8
|
reportMachineDenial
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-WZNRDDC4.js";
|
|
10
10
|
import {
|
|
11
11
|
isGatingMoment,
|
|
12
12
|
recordKeylessMoment
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-JQX2L3ES.js";
|
|
14
14
|
import {
|
|
15
15
|
triggerAutoUpdate
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-7L6YSHZO.js";
|
|
17
17
|
import {
|
|
18
18
|
readHookInput
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-6PABNQVH.js";
|
|
20
20
|
import {
|
|
21
21
|
announceSubscriptionRequired,
|
|
22
22
|
isDeferAnswer
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-ZX3PFROQ.js";
|
|
24
|
+
import "../chunk-RTM5GVRZ.js";
|
|
25
25
|
import "../chunk-DWQYCOPI.js";
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-STETTN4K.js";
|
|
27
|
+
import "../chunk-X7TNLYNZ.js";
|
|
28
|
+
import "../chunk-MAB6CGL5.js";
|
|
29
|
+
import "../chunk-QRNNIDGY.js";
|
|
30
30
|
import "../chunk-XHKBHWLX.js";
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
-
import "../chunk-
|
|
35
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-IVUP2EE4.js";
|
|
32
|
+
import "../chunk-NRSTNZYJ.js";
|
|
33
|
+
import "../chunk-3U3FU6ZX.js";
|
|
34
|
+
import "../chunk-KYFWYPHN.js";
|
|
35
|
+
import "../chunk-Y3HTWB5S.js";
|
|
36
36
|
import "../chunk-GMXKITVA.js";
|
|
37
37
|
import "../chunk-6ICPEJY5.js";
|
|
38
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-M7VKFAAK.js";
|
|
39
39
|
import {
|
|
40
40
|
CODEX_AGENT,
|
|
41
41
|
DEFAULT_SESSION,
|
|
@@ -79,8 +79,8 @@ import {
|
|
|
79
79
|
toPolicyLookup,
|
|
80
80
|
toPolicyLookups,
|
|
81
81
|
userScope
|
|
82
|
-
} from "../chunk-
|
|
83
|
-
import "../chunk-
|
|
82
|
+
} from "../chunk-CGRVIUKE.js";
|
|
83
|
+
import "../chunk-K2SSNAUW.js";
|
|
84
84
|
import {
|
|
85
85
|
askUser,
|
|
86
86
|
cancelQuestion,
|
|
@@ -94,31 +94,31 @@ import {
|
|
|
94
94
|
sendNotification,
|
|
95
95
|
unavailableQuestionUnlessSubscriptionRequired,
|
|
96
96
|
waitForQuestion
|
|
97
|
-
} from "../chunk-
|
|
97
|
+
} from "../chunk-I7EZMNKI.js";
|
|
98
98
|
import "../chunk-POFBE6ZY.js";
|
|
99
99
|
import {
|
|
100
100
|
SubscriptionRequiredError
|
|
101
|
-
} from "../chunk-
|
|
102
|
-
import "../chunk-
|
|
103
|
-
import "../chunk-
|
|
101
|
+
} from "../chunk-AW4TDBUJ.js";
|
|
102
|
+
import "../chunk-ZV56INA6.js";
|
|
103
|
+
import "../chunk-4UCTKLHY.js";
|
|
104
104
|
import {
|
|
105
105
|
getMachineId
|
|
106
|
-
} from "../chunk-
|
|
106
|
+
} from "../chunk-QPT4PTUG.js";
|
|
107
107
|
import "../chunk-7QLSKOSU.js";
|
|
108
108
|
import {
|
|
109
109
|
EXIT
|
|
110
110
|
} from "../chunk-KZERVKTD.js";
|
|
111
|
-
import "../chunk-
|
|
111
|
+
import "../chunk-ODPULZZG.js";
|
|
112
112
|
import {
|
|
113
113
|
canonicalJson
|
|
114
|
-
} from "../chunk-
|
|
114
|
+
} from "../chunk-EBZK2SJ2.js";
|
|
115
115
|
import {
|
|
116
116
|
writeFileAtomic
|
|
117
117
|
} from "../chunk-AQFEP65J.js";
|
|
118
118
|
import {
|
|
119
119
|
getApiKey
|
|
120
|
-
} from "../chunk-
|
|
121
|
-
import "../chunk-
|
|
120
|
+
} from "../chunk-CHD6IUNM.js";
|
|
121
|
+
import "../chunk-DIJ532S7.js";
|
|
122
122
|
import {
|
|
123
123
|
CODEX_RESCUE_TOOL_NAME,
|
|
124
124
|
DECISION_STOP_REASON,
|
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
resolveGate,
|
|
147
147
|
scopeBreachReasonOf,
|
|
148
148
|
unapprovedScopeReason
|
|
149
|
-
} from "../chunk-
|
|
149
|
+
} from "../chunk-ORLTWJ2O.js";
|
|
150
150
|
|
|
151
151
|
// bin/pushary-codex-hook.ts
|
|
152
152
|
import { basename } from "path";
|
|
@@ -795,7 +795,7 @@ var decidePreToolUse = async (input) => {
|
|
|
795
795
|
};
|
|
796
796
|
var repairCodexHoldsQuietly = async () => {
|
|
797
797
|
try {
|
|
798
|
-
const { repairCodexHolds } = await import("../reapply-
|
|
798
|
+
const { repairCodexHolds } = await import("../reapply-XBEB2B5A.js");
|
|
799
799
|
repairCodexHolds();
|
|
800
800
|
} catch {
|
|
801
801
|
return;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reportEvent
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-CGRVIUKE.js";
|
|
5
|
+
import "../chunk-K2SSNAUW.js";
|
|
6
6
|
import {
|
|
7
7
|
askUser,
|
|
8
8
|
isDecisionStopped,
|
|
9
9
|
waitForAnswer
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-I7EZMNKI.js";
|
|
11
11
|
import "../chunk-POFBE6ZY.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-AW4TDBUJ.js";
|
|
13
|
+
import "../chunk-ZV56INA6.js";
|
|
14
|
+
import "../chunk-4UCTKLHY.js";
|
|
15
15
|
import {
|
|
16
16
|
getMachineId
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-QPT4PTUG.js";
|
|
18
18
|
import "../chunk-7QLSKOSU.js";
|
|
19
19
|
import "../chunk-KZERVKTD.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-ODPULZZG.js";
|
|
21
|
+
import "../chunk-EBZK2SJ2.js";
|
|
22
22
|
import "../chunk-AQFEP65J.js";
|
|
23
23
|
import {
|
|
24
24
|
getApiKey
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-CHD6IUNM.js";
|
|
26
26
|
import {
|
|
27
27
|
NPX_LATEST_COMMAND
|
|
28
|
-
} from "../chunk-
|
|
29
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-DIJ532S7.js";
|
|
29
|
+
import "../chunk-ORLTWJ2O.js";
|
|
30
30
|
|
|
31
31
|
// bin/pushary-codex.ts
|
|
32
32
|
import { basename } from "path";
|
|
@@ -3,61 +3,61 @@ import {
|
|
|
3
3
|
connectDevice,
|
|
4
4
|
connectExistingApp,
|
|
5
5
|
printConnectInstructions
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-ZJY4KON3.js";
|
|
7
7
|
import "../chunk-3EGEA4KH.js";
|
|
8
8
|
import "../chunk-QCGNGEGE.js";
|
|
9
9
|
import {
|
|
10
10
|
printKeyCheck
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-ZVMFRUBD.js";
|
|
12
12
|
import {
|
|
13
13
|
CONNECTED_THROUGH_MAC_APP,
|
|
14
14
|
PAIR_FROM_MAC_APP,
|
|
15
15
|
readMacAppConnection
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-PJ3C6IID.js";
|
|
17
|
+
import "../chunk-IXNVIWNN.js";
|
|
18
|
+
import "../chunk-FP2ZJK3T.js";
|
|
19
19
|
import {
|
|
20
20
|
createIo
|
|
21
21
|
} from "../chunk-FO3MDD26.js";
|
|
22
22
|
import {
|
|
23
23
|
exitOnHelpFlag
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
24
|
+
} from "../chunk-F43LAKAK.js";
|
|
25
|
+
import "../chunk-IVUP2EE4.js";
|
|
26
|
+
import "../chunk-NRSTNZYJ.js";
|
|
27
|
+
import "../chunk-3U3FU6ZX.js";
|
|
28
|
+
import "../chunk-KYFWYPHN.js";
|
|
29
|
+
import "../chunk-Y3HTWB5S.js";
|
|
30
30
|
import {
|
|
31
31
|
parseFlags
|
|
32
32
|
} from "../chunk-GMXKITVA.js";
|
|
33
33
|
import "../chunk-6ICPEJY5.js";
|
|
34
34
|
import {
|
|
35
35
|
readKeySource
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
38
|
-
import "../chunk-
|
|
39
|
-
import "../chunk-
|
|
36
|
+
} from "../chunk-M7VKFAAK.js";
|
|
37
|
+
import "../chunk-CGRVIUKE.js";
|
|
38
|
+
import "../chunk-K2SSNAUW.js";
|
|
39
|
+
import "../chunk-I7EZMNKI.js";
|
|
40
40
|
import "../chunk-POFBE6ZY.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-AW4TDBUJ.js";
|
|
42
42
|
import {
|
|
43
43
|
checkApiKey
|
|
44
|
-
} from "../chunk-
|
|
45
|
-
import "../chunk-
|
|
46
|
-
import "../chunk-
|
|
44
|
+
} from "../chunk-ZV56INA6.js";
|
|
45
|
+
import "../chunk-4UCTKLHY.js";
|
|
46
|
+
import "../chunk-QPT4PTUG.js";
|
|
47
47
|
import {
|
|
48
48
|
UsageError
|
|
49
49
|
} from "../chunk-7QLSKOSU.js";
|
|
50
50
|
import {
|
|
51
51
|
EXIT
|
|
52
52
|
} from "../chunk-KZERVKTD.js";
|
|
53
|
-
import "../chunk-
|
|
54
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-ODPULZZG.js";
|
|
54
|
+
import "../chunk-EBZK2SJ2.js";
|
|
55
55
|
import "../chunk-AQFEP65J.js";
|
|
56
|
-
import "../chunk-
|
|
56
|
+
import "../chunk-CHD6IUNM.js";
|
|
57
57
|
import {
|
|
58
58
|
isInvocationOf
|
|
59
|
-
} from "../chunk-
|
|
60
|
-
import "../chunk-
|
|
59
|
+
} from "../chunk-DIJ532S7.js";
|
|
60
|
+
import "../chunk-ORLTWJ2O.js";
|
|
61
61
|
|
|
62
62
|
// bin/pushary-connect.ts
|
|
63
63
|
exitOnHelpFlag("pair");
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
coworkOutput,
|
|
4
4
|
parseCoworkOptions
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-M2YE3OEC.js";
|
|
6
6
|
import {
|
|
7
7
|
canOpenBrowser,
|
|
8
8
|
openInBrowser
|
|
9
9
|
} from "../chunk-PUZZELE6.js";
|
|
10
10
|
import {
|
|
11
11
|
exitOnHelpFlag
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-F43LAKAK.js";
|
|
13
|
+
import "../chunk-KYFWYPHN.js";
|
|
14
14
|
import "../chunk-GMXKITVA.js";
|
|
15
15
|
import {
|
|
16
16
|
UsageError
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
EXIT
|
|
20
20
|
} from "../chunk-KZERVKTD.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-DIJ532S7.js";
|
|
22
22
|
import {
|
|
23
23
|
CLAUDE_CONNECTOR_GUIDE
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-ORLTWJ2O.js";
|
|
25
25
|
|
|
26
26
|
// bin/pushary-cowork.ts
|
|
27
27
|
exitOnHelpFlag("cowork");
|