pushary 1.9.44 → 1.9.45
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 +6 -0
- package/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +25 -26
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +32 -34
- package/dist/bin/pushary-clean.js +30 -31
- package/dist/bin/pushary-codex-bridge.js +22 -690
- package/dist/bin/pushary-codex-hook.js +32 -34
- package/dist/bin/pushary-codex-session.js +437 -41
- package/dist/bin/pushary-codex.js +12 -13
- package/dist/bin/pushary-connect.js +24 -25
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +42 -43
- package/dist/bin/pushary-disconnect.js +24 -25
- package/dist/bin/pushary-doctor.js +35 -36
- package/dist/bin/pushary-elicitation-hook.js +25 -26
- package/dist/bin/pushary-gemini-bridge.js +22 -22
- package/dist/bin/pushary-gemini-hook.js +29 -31
- package/dist/bin/pushary-hook.js +30 -31
- package/dist/bin/pushary-login.js +13 -13
- package/dist/bin/pushary-logout.js +24 -25
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +12 -12
- package/dist/bin/pushary-notification-hook.js +24 -25
- package/dist/bin/pushary-opencode-hook.js +28 -30
- package/dist/bin/pushary-permission-denied-hook.js +29 -30
- package/dist/bin/pushary-permission-hook.js +28 -29
- package/dist/bin/pushary-post-hook.js +24 -25
- package/dist/bin/pushary-prompt-hook.js +24 -25
- package/dist/bin/pushary-session-end-hook.js +24 -25
- package/dist/bin/pushary-session-start-hook.js +29 -30
- package/dist/bin/pushary-setup.js +37 -38
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +27 -28
- package/dist/bin/pushary-stop-hook.js +24 -25
- package/dist/bin/pushary-stopfailure-hook.js +24 -25
- 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 +31 -32
- package/dist/bin/pushary-wait.js +12 -12
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-MIBCRQWK.js → chunk-2DORVRDB.js} +2 -2
- package/dist/{chunk-KILK6SWZ.js → chunk-2FUHSKXH.js} +4 -4
- package/dist/{chunk-UY5E2UUW.js → chunk-2SXXH6JY.js} +5 -5
- package/dist/{chunk-UJXLVH66.js → chunk-335ZDJ7R.js} +1 -1
- package/dist/{chunk-OZ7MLVDM.js → chunk-3PM62C2R.js} +8 -8
- package/dist/{chunk-GRAPJKDK.js → chunk-46F4BRUQ.js} +1 -1
- package/dist/{chunk-WMO2XVG4.js → chunk-4A6VUVXV.js} +1 -1
- package/dist/{chunk-T3KMJI4W.js → chunk-57M4ERJK.js} +2 -2
- package/dist/{chunk-SI2NC6UU.js → chunk-5DCZL3BC.js} +3 -3
- package/dist/chunk-6JPDAUFP.js +866 -0
- package/dist/{chunk-S2ALW446.js → chunk-6TYKZ4DN.js} +3 -3
- package/dist/{chunk-WBD7HZEZ.js → chunk-7SGYCU5C.js} +1 -1
- package/dist/{chunk-KYLY6UMN.js → chunk-7URSJMAB.js} +1 -1
- package/dist/{chunk-T4CKP47U.js → chunk-ASK2MSD2.js} +5 -5
- package/dist/{chunk-W2TA4EVZ.js → chunk-AUOSFZJ3.js} +7 -7
- package/dist/{chunk-TWATOPHK.js → chunk-BT57FUMT.js} +2 -2
- package/dist/{chunk-GOEIW2VH.js → chunk-CDERSTBO.js} +182 -39
- package/dist/{chunk-M2L7625S.js → chunk-CFMCV6Z7.js} +2 -2
- package/dist/{chunk-FI2F5KZJ.js → chunk-DSGB5JLG.js} +4 -4
- package/dist/{chunk-2NVXFWQY.js → chunk-ECFEYB6Z.js} +1 -1
- package/dist/{chunk-DD6IBKEJ.js → chunk-EH5ZDG6V.js} +4 -4
- package/dist/{chunk-PQAFH4DF.js → chunk-EKGQEDQ4.js} +2 -2
- package/dist/{chunk-OWQOMGBF.js → chunk-EWC4P4ZL.js} +1 -1
- package/dist/{chunk-LEHBWBCG.js → chunk-FOUK4CBO.js} +4 -4
- package/dist/{chunk-4WBAHVBK.js → chunk-GQ5KCVGK.js} +6 -6
- package/dist/{chunk-BKK3JCTD.js → chunk-GZSSAY6N.js} +12 -14
- package/dist/{chunk-PGHN5D4N.js → chunk-H4ODQD3Y.js} +2 -2
- package/dist/{chunk-CAJCCQ7N.js → chunk-HHX6IRSH.js} +1 -1
- package/dist/{chunk-3IRC3XFG.js → chunk-IFT3GU7Y.js} +2 -2
- package/dist/{chunk-UC4PNLMK.js → chunk-IKYI63RF.js} +6 -6
- package/dist/{chunk-4JHEZ2PV.js → chunk-IOVJVGIT.js} +4 -4
- package/dist/{chunk-JNU3LV47.js → chunk-K7EGWMDU.js} +18 -3
- package/dist/{chunk-CESLE4UN.js → chunk-KS7NA5CK.js} +7 -7
- package/dist/{chunk-IWHDNMM3.js → chunk-N2K3BSCA.js} +5 -5
- package/dist/{chunk-HV4TEKNP.js → chunk-NJN5NRHZ.js} +4 -4
- package/dist/{chunk-6EV3B5CD.js → chunk-OHFC3GJY.js} +1 -1
- package/dist/{chunk-SWDPCDLT.js → chunk-P2F3JUFX.js} +4 -4
- package/dist/{chunk-TKTS3SIM.js → chunk-PWUIPQ2I.js} +3 -3
- package/dist/{chunk-ALY7ZBNB.js → chunk-QQXP3CQA.js} +1 -1
- package/dist/{chunk-FYNMFSIZ.js → chunk-R7ZQHAVL.js} +2 -2
- package/dist/{chunk-FKDZU6YX.js → chunk-RBJWPUI6.js} +4 -4
- package/dist/{chunk-MRQJCIFO.js → chunk-RFQWB5ZV.js} +1 -1
- package/dist/{chunk-XPQDBTW4.js → chunk-S6EGJBI5.js} +1 -1
- package/dist/{chunk-53UZN7JW.js → chunk-SFQSOBLM.js} +3 -3
- package/dist/{chunk-75M7NFFC.js → chunk-SIN7NJD7.js} +1 -1
- package/dist/{chunk-OSMNLNPF.js → chunk-U45OINYS.js} +1 -1
- package/dist/{chunk-E76QCZIA.js → chunk-U6Z56IQS.js} +2 -2
- package/dist/{chunk-GBCR2FH2.js → chunk-VO6XI6AX.js} +3 -3
- package/dist/{chunk-7UM4NCUI.js → chunk-WDIX4XZH.js} +2 -2
- package/dist/{chunk-CEZTYTBN.js → chunk-WM76AN4X.js} +11 -13
- package/dist/{chunk-L2ZM7LXN.js → chunk-WPPKXVV3.js} +2 -2
- package/dist/{chunk-RGBTKOCC.js → chunk-XFHISCJM.js} +5 -5
- package/dist/{chunk-TJZUQRMH.js → chunk-YK7FGPYS.js} +3 -3
- package/dist/{chunk-42CVAOC5.js → chunk-YWIFK2UB.js} +2 -2
- package/dist/{chunk-UZVF6MP2.js → chunk-YXGWG5PO.js} +5 -5
- package/dist/{chunk-OR6KJOHE.js → chunk-ZSY6BWUD.js} +2 -2
- package/dist/{global-upgrade-QSSDYZCZ.js → global-upgrade-U6NWZA5W.js} +6 -6
- package/dist/{paths-55DDFLY4.js → paths-IQTB3ZZI.js} +2 -2
- package/dist/{reapply-MEU66ALO.js → reapply-LILGWJO3.js} +21 -22
- package/dist/src/index.js +19 -20
- package/dist/{upgrade-lock-YLXAU4AD.js → upgrade-lock-2BVFIDU4.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-5ZSBQHCM.js +0 -161
- package/dist/chunk-SVCT5D7K.js +0 -196
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readExistingMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4A6VUVXV.js";
|
|
4
4
|
import {
|
|
5
5
|
NetworkError
|
|
6
6
|
} from "./chunk-7QLSKOSU.js";
|
|
7
7
|
import {
|
|
8
8
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EWC4P4ZL.js";
|
|
10
10
|
import {
|
|
11
11
|
clientContextHeaders,
|
|
12
12
|
getPackageVersion
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K7EGWMDU.js";
|
|
14
14
|
|
|
15
15
|
// src/cli/net.ts
|
|
16
16
|
import { createRequire } from "module";
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5DCZL3BC.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_CHOICES
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OHFC3GJY.js";
|
|
9
9
|
import {
|
|
10
10
|
BELL_HOOK_BINARY
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-U45OINYS.js";
|
|
12
12
|
import {
|
|
13
13
|
CODEX_HOOK_EVENTS,
|
|
14
14
|
hasCodexHooks,
|
|
15
15
|
holdBudgetOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IOVJVGIT.js";
|
|
17
17
|
import {
|
|
18
18
|
CURSOR_GATE_EVENTS,
|
|
19
19
|
HOOK_LOCATOR_BINARY,
|
|
20
20
|
hookCommandHoldBudget
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-K7EGWMDU.js";
|
|
22
22
|
|
|
23
23
|
// src/diagnostics/bridge.ts
|
|
24
24
|
import { execFileSync } from "child_process";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readControlMode
|
|
3
|
+
} from "./chunk-YK7FGPYS.js";
|
|
1
4
|
import {
|
|
2
5
|
needsShell,
|
|
3
6
|
spawnClaude
|
|
4
7
|
} from "./chunk-XHKBHWLX.js";
|
|
5
|
-
import {
|
|
6
|
-
readControlMode
|
|
7
|
-
} from "./chunk-TJZUQRMH.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4A6VUVXV.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir,
|
|
13
13
|
resolveGlobalBinary
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IOVJVGIT.js";
|
|
15
15
|
import {
|
|
16
16
|
readJsonSafe,
|
|
17
17
|
writeFileAtomic,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-AQFEP65J.js";
|
|
21
21
|
import {
|
|
22
22
|
getApiKey
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-EWC4P4ZL.js";
|
|
24
24
|
import {
|
|
25
25
|
CLI_PACKAGE_NAMES,
|
|
26
26
|
cmdShimTarget,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
globalPackageFolder,
|
|
29
29
|
globalRootFor,
|
|
30
30
|
isRecord
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-K7EGWMDU.js";
|
|
32
32
|
|
|
33
33
|
// src/daemon-lifecycle.ts
|
|
34
34
|
import { dirname, join, win32 as win32Path } from "path";
|
|
@@ -3,21 +3,30 @@ import {
|
|
|
3
3
|
isDisabledByEnv
|
|
4
4
|
} from "./chunk-POFBE6ZY.js";
|
|
5
5
|
import {
|
|
6
|
+
SubscriptionRequiredError,
|
|
7
|
+
callMcpTool
|
|
8
|
+
} from "./chunk-SFQSOBLM.js";
|
|
9
|
+
import {
|
|
10
|
+
installNetworkDefaults,
|
|
6
11
|
isNetworkFailure
|
|
7
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6TYKZ4DN.js";
|
|
8
13
|
import {
|
|
9
14
|
clientReportClaims
|
|
10
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IOVJVGIT.js";
|
|
11
16
|
import {
|
|
12
17
|
getApiKey,
|
|
13
18
|
getBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EWC4P4ZL.js";
|
|
15
20
|
import {
|
|
21
|
+
ASK_AGENT_NAME_MAX,
|
|
16
22
|
CLIENT_REPORT_PATH,
|
|
23
|
+
DECISION_LINE_MAX,
|
|
24
|
+
GATE_PERMISSION_MODE_MAX_LENGTH,
|
|
17
25
|
degradedLine,
|
|
18
26
|
localRepoKey,
|
|
19
|
-
normalizeRepoRemote
|
|
20
|
-
|
|
27
|
+
normalizeRepoRemote,
|
|
28
|
+
truncateLine
|
|
29
|
+
} from "./chunk-K7EGWMDU.js";
|
|
21
30
|
|
|
22
31
|
// src/client-report-claim.ts
|
|
23
32
|
import { createHash } from "crypto";
|
|
@@ -136,6 +145,159 @@ var writeDegraded = (subsystem, report) => {
|
|
|
136
145
|
void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
|
|
137
146
|
};
|
|
138
147
|
|
|
148
|
+
// src/api.ts
|
|
149
|
+
import { randomUUID } from "crypto";
|
|
150
|
+
|
|
151
|
+
// src/validate.ts
|
|
152
|
+
var isPolicyConfig = (data) => {
|
|
153
|
+
if (!data || typeof data !== "object") return false;
|
|
154
|
+
const d = data;
|
|
155
|
+
return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
|
|
156
|
+
};
|
|
157
|
+
var isAskUserResponse = (data) => {
|
|
158
|
+
if (!data || typeof data !== "object") return false;
|
|
159
|
+
const d = data;
|
|
160
|
+
return typeof d.correlationId === "string" && typeof d.status === "string" && (d.answered === void 0 || typeof d.answered === "boolean") && (d.value === void 0 || typeof d.value === "string") && (d.note === void 0 || typeof d.note === "string") && (d.waitEndsAt === void 0 || typeof d.waitEndsAt === "string");
|
|
161
|
+
};
|
|
162
|
+
var isWaitForAnswerResponse = (data) => {
|
|
163
|
+
if (!data || typeof data !== "object") return false;
|
|
164
|
+
const d = data;
|
|
165
|
+
return typeof d.answered === "boolean";
|
|
166
|
+
};
|
|
167
|
+
var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
|
|
168
|
+
var isSettlementOutputs = (value) => {
|
|
169
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
170
|
+
const outputs = value;
|
|
171
|
+
return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
|
|
172
|
+
};
|
|
173
|
+
var isGateReply = (data) => {
|
|
174
|
+
if (!data || typeof data !== "object") return false;
|
|
175
|
+
const d = data;
|
|
176
|
+
return GATE_REPLY_KINDS.includes(d.kind) && (d.output === void 0 || typeof d.output === "string") && (d.correlationId === void 0 || typeof d.correlationId === "string") && (d.deadlineSeconds === void 0 || typeof d.deadlineSeconds === "number") && (d.noDevices === void 0 || typeof d.noDevices === "boolean") && (d.suppressed === void 0 || typeof d.suppressed === "boolean") && (d.settlementOutputs === void 0 || isSettlementOutputs(d.settlementOutputs));
|
|
177
|
+
};
|
|
178
|
+
var isBlockedActionClaim = (data) => {
|
|
179
|
+
if (!data || typeof data !== "object") return false;
|
|
180
|
+
return typeof data.granted === "boolean";
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// src/api.ts
|
|
184
|
+
installNetworkDefaults();
|
|
185
|
+
var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
|
|
186
|
+
var isAwayPaused = (result) => result.paused === true;
|
|
187
|
+
var isLocalQuestionHandoff = (result) => !isAwayPaused(result) && (result.suppressed === true || result.noDevices === true || result.status === "terminal" || result.status === "notified");
|
|
188
|
+
var waitsForThePhone = (result) => result.answered !== true && !isAwayPaused(result) && !isLocalQuestionHandoff(result);
|
|
189
|
+
var STOPPED = { answered: false, handoffAction: "stop" };
|
|
190
|
+
var unavailableQuestionUnlessSubscriptionRequired = (error) => {
|
|
191
|
+
if (error instanceof SubscriptionRequiredError) throw error;
|
|
192
|
+
return { correlationId: "", status: "unavailable" };
|
|
193
|
+
};
|
|
194
|
+
var truncateOptional = (text, max) => text === void 0 ? void 0 : truncateLine(text, max);
|
|
195
|
+
var boundedPermissionMode = (value) => typeof value === "string" && value.length > 0 ? value.slice(0, GATE_PERMISSION_MODE_MAX_LENGTH) : void 0;
|
|
196
|
+
var withinAskUserLimits = (params) => ({
|
|
197
|
+
...params,
|
|
198
|
+
question: params.question,
|
|
199
|
+
agentName: truncateOptional(params.agentName, ASK_AGENT_NAME_MAX),
|
|
200
|
+
intent: truncateOptional(params.intent, DECISION_LINE_MAX),
|
|
201
|
+
action: truncateOptional(params.action, DECISION_LINE_MAX),
|
|
202
|
+
blocker: truncateOptional(params.blocker, DECISION_LINE_MAX),
|
|
203
|
+
permissionMode: boundedPermissionMode(params.permissionMode)
|
|
204
|
+
});
|
|
205
|
+
var askUser = async (apiKey, params, timeoutMs = 15e3) => {
|
|
206
|
+
const identified = params.toolUseId || params.requestId ? params : { ...params, requestId: randomUUID() };
|
|
207
|
+
const result = await callMcpTool(apiKey, "ask_user", { ...withinAskUserLimits(identified), pausedAware: true, wait: false }, { maxRetries: 3, timeoutMs });
|
|
208
|
+
if (!isAskUserResponse(result)) throw new Error("Invalid ask_user response");
|
|
209
|
+
return result;
|
|
210
|
+
};
|
|
211
|
+
var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4, signal) => {
|
|
212
|
+
const result = await callMcpTool(apiKey, "wait_for_answer", {
|
|
213
|
+
correlationId,
|
|
214
|
+
timeoutMs
|
|
215
|
+
}, { timeoutMs: timeoutMs + 1e4, signal });
|
|
216
|
+
if (!isWaitForAnswerResponse(result)) throw new Error("Invalid wait_for_answer response");
|
|
217
|
+
return result;
|
|
218
|
+
};
|
|
219
|
+
var WAIT_RESPONSE_GRACE_MS = 2e3;
|
|
220
|
+
var MIN_LONG_POLL_MS = 1e3;
|
|
221
|
+
var MAX_LONG_POLL_MS = 3e4;
|
|
222
|
+
var nextLongPollMs = (deadlineMs, nowMs) => {
|
|
223
|
+
const hold = Math.min(deadlineMs - nowMs - WAIT_RESPONSE_GRACE_MS, MAX_LONG_POLL_MS);
|
|
224
|
+
return hold >= MIN_LONG_POLL_MS ? hold : null;
|
|
225
|
+
};
|
|
226
|
+
var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3) => {
|
|
227
|
+
const sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
228
|
+
while (Date.now() < deadlineMs) {
|
|
229
|
+
const hold = nextLongPollMs(deadlineMs, Date.now());
|
|
230
|
+
if (hold === null) {
|
|
231
|
+
await sleep(Math.max(0, deadlineMs - Date.now()));
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
let answer;
|
|
235
|
+
try {
|
|
236
|
+
answer = await waitForAnswer(apiKey, correlationId, hold, AbortSignal.timeout(Math.max(1, deadlineMs - Date.now())));
|
|
237
|
+
} catch {
|
|
238
|
+
const late = await withdrawQuestion(apiKey, correlationId);
|
|
239
|
+
return late.answered ? late : STOPPED;
|
|
240
|
+
}
|
|
241
|
+
if (isDecisionStopped(answer) || answer.answered) return answer;
|
|
242
|
+
if (answer.status === "expired") return STOPPED;
|
|
243
|
+
await sleep(Math.min(pollInterval, Math.max(0, deadlineMs - Date.now())));
|
|
244
|
+
}
|
|
245
|
+
return withdrawQuestion(apiKey, correlationId);
|
|
246
|
+
};
|
|
247
|
+
var cancelQuestion = async (apiKey, correlationId, signal) => {
|
|
248
|
+
return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: 4e3, maxRetries: 1 });
|
|
249
|
+
};
|
|
250
|
+
var withdrawQuestion = async (apiKey, correlationId, transport = { cancelQuestion, waitForAnswer }) => {
|
|
251
|
+
try {
|
|
252
|
+
const cancelled = await transport.cancelQuestion(apiKey, correlationId, AbortSignal.timeout(4e3));
|
|
253
|
+
if (!cancelled || isDecisionStopped(cancelled)) return STOPPED;
|
|
254
|
+
if (cancelled.cancelled === true) return { answered: false, status: "withdrawn" };
|
|
255
|
+
const late = await transport.waitForAnswer(apiKey, correlationId, 1e3, AbortSignal.timeout(2e3));
|
|
256
|
+
if (late.answered || isDecisionStopped(late)) return late;
|
|
257
|
+
return late.status === "expired" ? { answered: false, status: "withdrawn" } : STOPPED;
|
|
258
|
+
} catch {
|
|
259
|
+
return STOPPED;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var waitForQuestion = async (apiKey, question, deadlineMs, pollInterval = 2e3) => {
|
|
263
|
+
if (isDecisionStopped(question) || question.answered) return { ...question, answered: !!question.answered };
|
|
264
|
+
if (question.status === "expired") return STOPPED;
|
|
265
|
+
return isAwayPaused(question) || isLocalQuestionHandoff(question) ? withdrawQuestion(apiKey, question.correlationId) : pollForAnswer(apiKey, question.correlationId, deadlineMs, pollInterval);
|
|
266
|
+
};
|
|
267
|
+
var sendNotification = async (apiKey, params, timeoutMs = 15e3, signal) => {
|
|
268
|
+
await callMcpTool(apiKey, "send_notification", { ...params }, { maxRetries: signal ? 1 : 3, timeoutMs, signal });
|
|
269
|
+
};
|
|
270
|
+
var GATE_PATH = "/api/agent/gate";
|
|
271
|
+
var BLOCKED_ACTION_CLAIM_PATH = "/api/agent/blocked-action/claim";
|
|
272
|
+
var postAgentRequest = async (apiKey, path, body, timeoutMs) => {
|
|
273
|
+
const response = await fetch(`${getBaseUrl()}${path}`, {
|
|
274
|
+
method: "POST",
|
|
275
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
|
|
276
|
+
body: JSON.stringify(body),
|
|
277
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
278
|
+
});
|
|
279
|
+
if (!response.ok) throw new Error(`${path} rejected (${response.status})`);
|
|
280
|
+
return response.json();
|
|
281
|
+
};
|
|
282
|
+
var requestGate = async (apiKey, request, timeoutMs = 15e3) => {
|
|
283
|
+
try {
|
|
284
|
+
const reply = await postAgentRequest(apiKey, GATE_PATH, request, timeoutMs);
|
|
285
|
+
return isGateReply(reply) ? reply : null;
|
|
286
|
+
} catch (error) {
|
|
287
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "gate_request_failed" });
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
var claimBlockedAction = async (apiKey, request, timeoutMs) => {
|
|
292
|
+
try {
|
|
293
|
+
const reply = await postAgentRequest(apiKey, BLOCKED_ACTION_CLAIM_PATH, request, timeoutMs);
|
|
294
|
+
return isBlockedActionClaim(reply) ? reply.granted : null;
|
|
295
|
+
} catch (error) {
|
|
296
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "blocked_action_claim_failed" });
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
139
301
|
// src/repo.ts
|
|
140
302
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
141
303
|
import { basename, dirname, isAbsolute, join as join2, resolve } from "path";
|
|
@@ -220,38 +382,6 @@ var repoKeyFor = (cwd) => {
|
|
|
220
382
|
return derived;
|
|
221
383
|
};
|
|
222
384
|
|
|
223
|
-
// src/validate.ts
|
|
224
|
-
var isPolicyConfig = (data) => {
|
|
225
|
-
if (!data || typeof data !== "object") return false;
|
|
226
|
-
const d = data;
|
|
227
|
-
return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
|
|
228
|
-
};
|
|
229
|
-
var isAskUserResponse = (data) => {
|
|
230
|
-
if (!data || typeof data !== "object") return false;
|
|
231
|
-
const d = data;
|
|
232
|
-
return typeof d.correlationId === "string" && typeof d.status === "string" && (d.answered === void 0 || typeof d.answered === "boolean") && (d.value === void 0 || typeof d.value === "string") && (d.note === void 0 || typeof d.note === "string") && (d.waitEndsAt === void 0 || typeof d.waitEndsAt === "string");
|
|
233
|
-
};
|
|
234
|
-
var isWaitForAnswerResponse = (data) => {
|
|
235
|
-
if (!data || typeof data !== "object") return false;
|
|
236
|
-
const d = data;
|
|
237
|
-
return typeof d.answered === "boolean";
|
|
238
|
-
};
|
|
239
|
-
var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
|
|
240
|
-
var isSettlementOutputs = (value) => {
|
|
241
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
242
|
-
const outputs = value;
|
|
243
|
-
return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
|
|
244
|
-
};
|
|
245
|
-
var isGateReply = (data) => {
|
|
246
|
-
if (!data || typeof data !== "object") return false;
|
|
247
|
-
const d = data;
|
|
248
|
-
return GATE_REPLY_KINDS.includes(d.kind) && (d.output === void 0 || typeof d.output === "string") && (d.correlationId === void 0 || typeof d.correlationId === "string") && (d.deadlineSeconds === void 0 || typeof d.deadlineSeconds === "number") && (d.noDevices === void 0 || typeof d.noDevices === "boolean") && (d.suppressed === void 0 || typeof d.suppressed === "boolean") && (d.settlementOutputs === void 0 || isSettlementOutputs(d.settlementOutputs));
|
|
249
|
-
};
|
|
250
|
-
var isBlockedActionClaim = (data) => {
|
|
251
|
-
if (!data || typeof data !== "object") return false;
|
|
252
|
-
return typeof data.granted === "boolean";
|
|
253
|
-
};
|
|
254
|
-
|
|
255
385
|
export {
|
|
256
386
|
reportClientError,
|
|
257
387
|
exitAfterClientReports,
|
|
@@ -260,7 +390,20 @@ export {
|
|
|
260
390
|
isPolicyConfig,
|
|
261
391
|
isAskUserResponse,
|
|
262
392
|
isWaitForAnswerResponse,
|
|
263
|
-
|
|
264
|
-
|
|
393
|
+
isDecisionStopped,
|
|
394
|
+
isAwayPaused,
|
|
395
|
+
isLocalQuestionHandoff,
|
|
396
|
+
waitsForThePhone,
|
|
397
|
+
unavailableQuestionUnlessSubscriptionRequired,
|
|
398
|
+
askUser,
|
|
399
|
+
waitForAnswer,
|
|
400
|
+
nextLongPollMs,
|
|
401
|
+
pollForAnswer,
|
|
402
|
+
cancelQuestion,
|
|
403
|
+
withdrawQuestion,
|
|
404
|
+
waitForQuestion,
|
|
405
|
+
sendNotification,
|
|
406
|
+
requestGate,
|
|
407
|
+
claimBlockedAction,
|
|
265
408
|
repoKeyFor
|
|
266
409
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compatibleConfigFile,
|
|
3
3
|
hasCompatibleHooks
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RBJWPUI6.js";
|
|
5
5
|
import {
|
|
6
6
|
pusharyHookExecutable
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ASK2MSD2.js";
|
|
8
8
|
import {
|
|
9
9
|
isProtectedByScope,
|
|
10
10
|
registerHookEntry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IOVJVGIT.js";
|
|
12
12
|
import {
|
|
13
13
|
isRecord
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-K7EGWMDU.js";
|
|
15
15
|
|
|
16
16
|
// src/cursor-config.ts
|
|
17
17
|
var hookCommandOf = (entry) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3PM62C2R.js";
|
|
4
4
|
import {
|
|
5
5
|
namedEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RBJWPUI6.js";
|
|
7
7
|
import {
|
|
8
8
|
writeDegraded
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CDERSTBO.js";
|
|
10
10
|
import {
|
|
11
11
|
claudeShapedHookInput,
|
|
12
12
|
hookCompatibleProfileBySource,
|
|
13
13
|
isGrokHookPayload,
|
|
14
14
|
isGrokSessionEndStop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-K7EGWMDU.js";
|
|
16
16
|
|
|
17
17
|
// src/tool-hook-input.ts
|
|
18
18
|
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
decodePublicKey,
|
|
4
4
|
generateSessionKey,
|
|
5
5
|
wrapSessionKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SIN7NJD7.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchTranscriptRecipients,
|
|
9
9
|
uploadTranscriptRecords
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RFQWB5ZV.js";
|
|
11
11
|
|
|
12
12
|
// src/live-session.ts
|
|
13
13
|
var MAX_TRANSCRIPT_QUEUE = 100;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
macAppBridgeAvailable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YXGWG5PO.js";
|
|
4
4
|
import {
|
|
5
5
|
keyPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YK7FGPYS.js";
|
|
7
7
|
import {
|
|
8
8
|
bridgeAgentKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IOVJVGIT.js";
|
|
10
10
|
import {
|
|
11
11
|
readJsonSafe
|
|
12
12
|
} from "./chunk-AQFEP65J.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-K7EGWMDU.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;
|
|
@@ -4,26 +4,26 @@ import {
|
|
|
4
4
|
hasDaemonServiceDefinition,
|
|
5
5
|
readDaemonNeedsLogin,
|
|
6
6
|
readDaemonStatus
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AUOSFZJ3.js";
|
|
8
8
|
import {
|
|
9
9
|
readControlMode,
|
|
10
10
|
readKeySource
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YK7FGPYS.js";
|
|
12
12
|
import {
|
|
13
13
|
detectProviderLiveCapabilities,
|
|
14
14
|
expectedLaunchCapabilities,
|
|
15
15
|
hasSpawnProvider,
|
|
16
16
|
resolveControlPolicy
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WPPKXVV3.js";
|
|
18
18
|
import {
|
|
19
19
|
getMachineId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4A6VUVXV.js";
|
|
21
21
|
import {
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-EWC4P4ZL.js";
|
|
24
24
|
import {
|
|
25
25
|
getPackageVersion
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-K7EGWMDU.js";
|
|
27
27
|
|
|
28
28
|
// src/machines.ts
|
|
29
29
|
import { hostname } from "os";
|
|
@@ -2,37 +2,35 @@ import {
|
|
|
2
2
|
IDLE_PROMPT_NOTIFICATION,
|
|
3
3
|
NOTIFICATION_PUSH_TYPES,
|
|
4
4
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
cancelQuestion,
|
|
8
|
-
sendNotification,
|
|
9
|
-
waitForAnswer
|
|
10
|
-
} from "./chunk-5ZSBQHCM.js";
|
|
5
|
+
} from "./chunk-HHX6IRSH.js";
|
|
11
6
|
import {
|
|
12
7
|
reportedInstallSource
|
|
13
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CFMCV6Z7.js";
|
|
14
9
|
import {
|
|
10
|
+
cancelQuestion,
|
|
15
11
|
clientErrorKindOf,
|
|
16
12
|
isPolicyConfig,
|
|
17
13
|
repoKeyFor,
|
|
18
|
-
reportClientError
|
|
19
|
-
|
|
14
|
+
reportClientError,
|
|
15
|
+
sendNotification,
|
|
16
|
+
waitForAnswer
|
|
17
|
+
} from "./chunk-CDERSTBO.js";
|
|
20
18
|
import {
|
|
21
19
|
withRetry
|
|
22
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SFQSOBLM.js";
|
|
23
21
|
import {
|
|
24
22
|
getMachineId
|
|
25
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4A6VUVXV.js";
|
|
26
24
|
import {
|
|
27
25
|
canonicalJson
|
|
28
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IOVJVGIT.js";
|
|
29
27
|
import {
|
|
30
28
|
writeFileAtomic
|
|
31
29
|
} from "./chunk-AQFEP65J.js";
|
|
32
30
|
import {
|
|
33
31
|
getApiKey,
|
|
34
32
|
getBaseUrl
|
|
35
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-EWC4P4ZL.js";
|
|
36
34
|
import {
|
|
37
35
|
ACTION_BODY_MAX,
|
|
38
36
|
AGENTS,
|
|
@@ -65,7 +63,7 @@ import {
|
|
|
65
63
|
toToolLookup,
|
|
66
64
|
truncateLine,
|
|
67
65
|
unansweredRefusalReason
|
|
68
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-K7EGWMDU.js";
|
|
69
67
|
|
|
70
68
|
// ../hook-mapping/src/describe.ts
|
|
71
69
|
import { isAbsolute, relative, resolve } from "path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IOVJVGIT.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe
|
|
6
6
|
} from "./chunk-AQFEP65J.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-K7EGWMDU.js";
|
|
10
10
|
|
|
11
11
|
// src/process-ownership.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-POFBE6ZY.js";
|
|
4
4
|
import {
|
|
5
5
|
autoUpdateState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IOVJVGIT.js";
|
|
7
7
|
import {
|
|
8
8
|
readJsonSafe,
|
|
9
9
|
writeJsonAtomic
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
globalUpgradeEntry,
|
|
16
16
|
isAutoUpdateResult,
|
|
17
17
|
ownPackageRoot
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-K7EGWMDU.js";
|
|
19
19
|
|
|
20
20
|
// src/auto-update.ts
|
|
21
21
|
import { spawn } from "child_process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
announceSubscriptionRequired,
|
|
3
3
|
isDeferAnswer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ECFEYB6Z.js";
|
|
5
5
|
import {
|
|
6
6
|
AUTO_DECISION_WINDOW_MS,
|
|
7
7
|
DEFAULT_SESSION,
|
|
@@ -10,24 +10,24 @@ import {
|
|
|
10
10
|
permissionDeniedAction,
|
|
11
11
|
releaseThrottle,
|
|
12
12
|
reportEvent
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GZSSAY6N.js";
|
|
14
14
|
import {
|
|
15
15
|
askUser,
|
|
16
16
|
isDecisionStopped,
|
|
17
17
|
waitForQuestion
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CDERSTBO.js";
|
|
19
19
|
import {
|
|
20
20
|
SubscriptionRequiredError
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SFQSOBLM.js";
|
|
22
22
|
import {
|
|
23
23
|
getMachineId
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4A6VUVXV.js";
|
|
25
25
|
import {
|
|
26
26
|
machineDecisionFor,
|
|
27
27
|
parseAgentQuestionAnswers,
|
|
28
28
|
shouldDeferToNativeMode,
|
|
29
29
|
wireVerdictFor
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-K7EGWMDU.js";
|
|
31
31
|
|
|
32
32
|
// src/machine-decision-audit.ts
|
|
33
33
|
import { basename } from "path";
|