@pushary/agent-hooks 1.9.9 → 1.9.11
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 +15 -0
- package/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +25 -21
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +31 -34
- package/dist/bin/pushary-clean.js +108 -34
- package/dist/bin/pushary-codex-bridge.js +20 -22
- package/dist/bin/pushary-codex-hook.js +33 -36
- package/dist/bin/pushary-codex.js +12 -14
- package/dist/bin/pushary-connect.js +27 -29
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +31 -33
- package/dist/bin/pushary-disconnect.js +29 -29
- package/dist/bin/pushary-doctor.js +60 -50
- package/dist/bin/pushary-elicitation-hook.js +26 -26
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +30 -33
- package/dist/bin/pushary-hook.js +31 -33
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +18 -78
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +12 -12
- package/dist/bin/pushary-notification-hook.js +24 -26
- package/dist/bin/pushary-opencode-hook.js +29 -32
- package/dist/bin/pushary-permission-denied-hook.js +29 -31
- package/dist/bin/pushary-permission-hook.js +28 -30
- 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 +24 -26
- package/dist/bin/pushary-session-start-hook.js +28 -30
- package/dist/bin/pushary-setup.js +62 -46
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +30 -32
- package/dist/bin/pushary-stop-hook.js +24 -26
- package/dist/bin/pushary-stopfailure-hook.js +24 -26
- 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 -32
- package/dist/bin/pushary-wait.js +12 -12
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-IIVZZMSO.js → chunk-2AQ4VZSA.js} +1 -1
- package/dist/{chunk-APP43AW7.js → chunk-2GG77ADC.js} +1 -1
- package/dist/{chunk-KOWFRUIT.js → chunk-2NAQRPZQ.js} +1 -1
- package/dist/{chunk-Z23ZBYDW.js → chunk-4FWWHCYM.js} +4 -4
- package/dist/{chunk-ZGADIZDS.js → chunk-4HR2ICME.js} +1 -1
- package/dist/{chunk-E5HOHIUV.js → chunk-4RENRBSB.js} +4 -4
- package/dist/{chunk-RQ32ADJP.js → chunk-5WAYSUWV.js} +2 -2
- package/dist/{chunk-BYLKCZ2G.js → chunk-7RWQZQV2.js} +14 -14
- package/dist/{chunk-KQFTBQ66.js → chunk-A6J5Z2HO.js} +514 -313
- package/dist/{chunk-EIAEUG7G.js → chunk-AIWZRRSK.js} +2 -2
- package/dist/{chunk-H5T27W7M.js → chunk-BDRXDO25.js} +2 -2
- package/dist/{chunk-UAP5DS6P.js → chunk-BMP2BLIR.js} +3 -3
- package/dist/{chunk-VIIHC42X.js → chunk-BZI7EBTB.js} +1 -1
- package/dist/{chunk-TO3PS646.js → chunk-C6QM5SJR.js} +2 -2
- package/dist/{chunk-BNSKVIAW.js → chunk-CBDJ2X5P.js} +2 -2
- package/dist/{chunk-COQ64C4F.js → chunk-CHDAH4HP.js} +8 -8
- package/dist/{chunk-M3STIAGU.js → chunk-CZYMYM7X.js} +3 -3
- package/dist/{chunk-MD4SVNT6.js → chunk-E6YQW43K.js} +1 -1
- package/dist/{chunk-5N5L6DNN.js → chunk-EJVYEOKC.js} +3 -3
- package/dist/{chunk-AI7RMFVV.js → chunk-ERXY2SIW.js} +19 -16
- package/dist/{chunk-IRHABAQT.js → chunk-FJCOOFT7.js} +1 -1
- package/dist/{chunk-NGKUXZID.js → chunk-GA4J6YFN.js} +2 -2
- package/dist/{chunk-WRPYCIV2.js → chunk-GUNZHSTL.js} +136 -8
- package/dist/{chunk-T6ZN4TEF.js → chunk-HX5TI6DP.js} +1 -1
- package/dist/{chunk-QRXPWW3M.js → chunk-I4I4UH62.js} +3 -3
- package/dist/{chunk-6AYSKVLL.js → chunk-KBN3UP2R.js} +3 -3
- package/dist/{chunk-UF6RBP5V.js → chunk-KEV2MOJH.js} +46 -21
- package/dist/{chunk-BZLHTMT6.js → chunk-KIVFWGG6.js} +12 -10
- package/dist/{chunk-HBWYMRR5.js → chunk-LBAMPNDM.js} +5 -4
- package/dist/{chunk-LENBKYRB.js → chunk-LUHNNZSH.js} +2 -2
- package/dist/{chunk-R5RIVOPL.js → chunk-LX6EWNRK.js} +15 -3
- package/dist/{chunk-5DCDQ5VW.js → chunk-M54ATCOZ.js} +2 -2
- package/dist/{chunk-6W5M3MSE.js → chunk-MHHXR7DT.js} +4 -4
- package/dist/{chunk-NUVGDBZC.js → chunk-MITMDERZ.js} +1 -1
- package/dist/{chunk-QTIUJZRX.js → chunk-MJLTABWF.js} +3 -3
- package/dist/{chunk-QIOIO7VN.js → chunk-MX3LPP3K.js} +6 -6
- package/dist/{chunk-F7R3SZ4Q.js → chunk-N6GEI3PK.js} +2 -2
- package/dist/{chunk-462EQA6K.js → chunk-N7HXP4PZ.js} +1 -1
- package/dist/{chunk-Q6C6ILUS.js → chunk-OKSU74QH.js} +2 -2
- package/dist/{chunk-AZOKPWVI.js → chunk-P2EJN7UB.js} +1 -1
- package/dist/{chunk-OAYWO5NP.js → chunk-P7N7FJ7W.js} +1 -1
- package/dist/{chunk-DP3WX7FW.js → chunk-PRJNUNCV.js} +2 -2
- package/dist/{chunk-SZ4Q6ZVS.js → chunk-PTGUJZSD.js} +5 -5
- package/dist/chunk-SB2GN6OP.js +71 -0
- package/dist/{chunk-DCCSULXK.js → chunk-STUJXZC2.js} +4 -4
- package/dist/{chunk-MLGIVVSG.js → chunk-TVVUJTUW.js} +1 -1
- package/dist/{chunk-5OP5MQI7.js → chunk-V6IW5WMK.js} +1 -1
- package/dist/{chunk-5RGA636G.js → chunk-VOP5U2VX.js} +145 -9
- package/dist/{chunk-K545B734.js → chunk-WCELLK4P.js} +2 -2
- package/dist/{chunk-VHPFNLRS.js → chunk-WHRYW4P2.js} +5 -5
- package/dist/{chunk-G7RIDXAT.js → chunk-XYCTS3WP.js} +1 -1
- package/dist/{chunk-6EBGOHDJ.js → chunk-YETKAI5Q.js} +6 -6
- package/dist/{chunk-REU2VQPH.js → chunk-Z4AOR6RZ.js} +15 -13
- package/dist/{chunk-B5NMSP3V.js → chunk-ZTSMQYST.js} +3 -5
- package/dist/{global-upgrade-H272QOGD.js → global-upgrade-VT2JS7DR.js} +6 -6
- package/dist/{paths-HMVOTFUN.js → paths-WRBEUNEY.js} +2 -2
- package/dist/{reapply-Q5NHDTVU.js → reapply-BCR6U7HO.js} +20 -22
- package/dist/src/index.js +19 -21
- package/dist/{upgrade-lock-L3GHFIRW.js → upgrade-lock-VRYMTPZQ.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-N6IOSZOE.js +0 -185
- package/dist/chunk-UPIZSCYD.js +0 -142
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
addGeminiMcpServer,
|
|
4
4
|
removeGeminiMcpServer,
|
|
5
5
|
supportedClaudeEvents
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CZYMYM7X.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_CODE_AGENT,
|
|
9
9
|
parseApplyPatchFiles
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A6J5Z2HO.js";
|
|
11
11
|
import {
|
|
12
12
|
guardBinary,
|
|
13
13
|
holdBudgetOf,
|
|
14
14
|
isProtectedByScope,
|
|
15
15
|
registerHookEntry
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4FWWHCYM.js";
|
|
17
17
|
import {
|
|
18
18
|
HOOK_LOCATOR_BINARY,
|
|
19
19
|
PHONE_ANSWERED_TOOLS,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
hookCompatibleProfileBySource,
|
|
22
22
|
toToolLookup,
|
|
23
23
|
withHookHoldBudget
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VOP5U2VX.js";
|
|
25
25
|
|
|
26
26
|
// src/claude-config.ts
|
|
27
27
|
import { join } from "path";
|
|
@@ -197,7 +197,10 @@ import { homedir } from "os";
|
|
|
197
197
|
import { isAbsolute, join as join2, resolve } from "path";
|
|
198
198
|
var AGENT_FLAG = "--agent";
|
|
199
199
|
var SOURCE_FLAG = "--source";
|
|
200
|
+
var EVENT_FLAG = "--event";
|
|
200
201
|
var agentArgument = (profile) => `${AGENT_FLAG}=${profile.agentType}`;
|
|
202
|
+
var eventArgument = (event) => `${EVENT_FLAG}=${event}`;
|
|
203
|
+
var payloadNamesItsEvent = (profile) => profile.payload === "claude";
|
|
201
204
|
var profileFromArgv = (argv) => {
|
|
202
205
|
const named = namedAgent(argv);
|
|
203
206
|
if (named !== void 0) return hookCompatibleProfile(named);
|
|
@@ -212,6 +215,12 @@ var namedAgent = (argv) => {
|
|
|
212
215
|
const prefix = `${AGENT_FLAG}=`;
|
|
213
216
|
return argv.find((argument) => argument.startsWith(prefix))?.slice(prefix.length);
|
|
214
217
|
};
|
|
218
|
+
var namedEvent = (argv) => {
|
|
219
|
+
const inline = argv.find((argument) => argument.startsWith(`${EVENT_FLAG}=`));
|
|
220
|
+
if (inline) return inline.slice(EVENT_FLAG.length + 1);
|
|
221
|
+
const index = argv.indexOf(EVENT_FLAG);
|
|
222
|
+
return index === -1 ? void 0 : argv[index + 1];
|
|
223
|
+
};
|
|
215
224
|
var namedSource = (argv) => {
|
|
216
225
|
const inline = argv.find((argument) => argument.startsWith(`${SOURCE_FLAG}=`));
|
|
217
226
|
if (inline) return inline.slice(SOURCE_FLAG.length + 1);
|
|
@@ -264,12 +273,17 @@ var pruneEmptyMap = (config, keyPath) => {
|
|
|
264
273
|
return true;
|
|
265
274
|
};
|
|
266
275
|
var aliasesFor = (profile, canonical) => Object.entries(profile.toolAliases).flatMap(([agentName, target]) => target === canonical ? [agentName] : []);
|
|
267
|
-
var carriesPhoneAnswer = (profile, canonical) => profile.wire
|
|
276
|
+
var carriesPhoneAnswer = (profile, canonical) => profile.wire !== "permission_decision" && PHONE_ANSWERED_TOOLS.has(canonical);
|
|
268
277
|
var translateMatcher = (profile, matcher) => {
|
|
269
278
|
const spellings = matcher.split("|").filter((canonical) => !carriesPhoneAnswer(profile, canonical)).flatMap((canonical) => [canonical, ...aliasesFor(profile, canonical)]);
|
|
270
279
|
return [.../* @__PURE__ */ new Set([...spellings, ...profile.extraMatchers])].join("|");
|
|
271
280
|
};
|
|
272
281
|
var TOOL_MATCHED_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse"]);
|
|
282
|
+
var isPusharyHandler = (entry2, scope) => {
|
|
283
|
+
const record = asRecord2(entry2);
|
|
284
|
+
return record !== void 0 && !Array.isArray(record.hooks) && isPusharyHook({ hooks: [record] }, scope);
|
|
285
|
+
};
|
|
286
|
+
var isPusharyCompatibleEntry = (entry2, scope) => isPusharyHook(entry2, scope) || isPusharyHandler(entry2, scope);
|
|
273
287
|
var withoutMatcher = ({ matcher, ...hook }) => hook;
|
|
274
288
|
var compatibleHookEvents = (profile) => CLAUDE_HOOK_EVENTS.filter((hook) => profile.events.includes(hook.event)).map((hook) => {
|
|
275
289
|
if (!hook.matcher) return hook;
|
|
@@ -306,17 +320,20 @@ var addCompatibleToolPermissions = (config) => {
|
|
|
306
320
|
addPusharyToolPermissions(config);
|
|
307
321
|
return WRITTEN;
|
|
308
322
|
};
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
323
|
+
var commandFor = (profile, definition, resolve2) => {
|
|
324
|
+
const named = `${resolve2(definition.binary)} ${agentArgument(profile)}`;
|
|
325
|
+
const command = payloadNamesItsEvent(profile) ? named : `${named} ${eventArgument(definition.event)}`;
|
|
326
|
+
return withHookHoldBudget(command, holdBudgetOf(definition));
|
|
327
|
+
};
|
|
328
|
+
var writesBareHandler = (profile, definition) => profile.nonToolEntries === "handler" && !TOOL_MATCHED_EVENTS.has(definition.event);
|
|
329
|
+
var entryFor = (profile, definition, resolve2) => {
|
|
330
|
+
const handler = { type: "command", command: commandFor(profile, definition, resolve2), timeout: definition.timeout };
|
|
331
|
+
if (writesBareHandler(profile, definition)) return handler;
|
|
332
|
+
return {
|
|
333
|
+
...definition.matcher ? { matcher: definition.matcher } : {},
|
|
334
|
+
hooks: [handler]
|
|
335
|
+
};
|
|
336
|
+
};
|
|
320
337
|
var addCompatibleHooks = (config, profile, binDir) => {
|
|
321
338
|
const conflictAt = hooksShapeConflict(config, profile);
|
|
322
339
|
if (conflictAt) return { ok: false, conflictAt };
|
|
@@ -327,10 +344,10 @@ var addCompatibleHooks = (config, profile, binDir) => {
|
|
|
327
344
|
const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
|
|
328
345
|
const definition = supported.get(known.event);
|
|
329
346
|
if (definition) {
|
|
330
|
-
hooks[known.event] = registerHookEntry(current,
|
|
347
|
+
hooks[known.event] = registerHookEntry(current, isPusharyCompatibleEntry, entryFor(profile, definition, resolve2));
|
|
331
348
|
continue;
|
|
332
349
|
}
|
|
333
|
-
const others = current.filter((item) => !
|
|
350
|
+
const others = current.filter((item) => !isPusharyCompatibleEntry(item));
|
|
334
351
|
if (others.length > 0) hooks[known.event] = others;
|
|
335
352
|
else delete hooks[known.event];
|
|
336
353
|
}
|
|
@@ -343,7 +360,7 @@ var removeCompatibleHooks = (config, profile, scope) => {
|
|
|
343
360
|
for (const { event } of CLAUDE_HOOK_EVENTS) {
|
|
344
361
|
const entries = hooks[event];
|
|
345
362
|
if (!Array.isArray(entries)) continue;
|
|
346
|
-
const kept = entries.filter((entry2) => !
|
|
363
|
+
const kept = entries.filter((entry2) => !isPusharyCompatibleEntry(entry2, scope));
|
|
347
364
|
if (kept.length === entries.length) continue;
|
|
348
365
|
if (kept.length === 0) delete hooks[event];
|
|
349
366
|
else hooks[event] = kept;
|
|
@@ -357,14 +374,14 @@ var hasCompatibleHooks = (config, profile) => {
|
|
|
357
374
|
if (!hooks) return false;
|
|
358
375
|
return compatibleHookEvents(profile).some(({ event }) => {
|
|
359
376
|
const entries = hooks[event];
|
|
360
|
-
return Array.isArray(entries) && entries.some((entry2) =>
|
|
377
|
+
return Array.isArray(entries) && entries.some((entry2) => isPusharyCompatibleEntry(entry2));
|
|
361
378
|
});
|
|
362
379
|
};
|
|
363
380
|
var missingCompatibleHookEvents = (config, profile) => {
|
|
364
381
|
const hooks = findMap(config, profile.hooksKeyPath);
|
|
365
382
|
return compatibleHookEvents(profile).filter(({ event }) => {
|
|
366
383
|
const entries = hooks?.[event];
|
|
367
|
-
return !Array.isArray(entries) || !entries.some((entry2) =>
|
|
384
|
+
return !Array.isArray(entries) || !entries.some((entry2) => isPusharyCompatibleEntry(entry2));
|
|
368
385
|
}).map(({ event }) => event);
|
|
369
386
|
};
|
|
370
387
|
var compatiblePermissionRuleFile = (profile, home) => profile.permissionRuleFile ? underHome(profile.permissionRuleFile, home) : null;
|
|
@@ -374,6 +391,13 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
|
|
|
374
391
|
addGeminiMcpServer(config, apiKey);
|
|
375
392
|
return;
|
|
376
393
|
}
|
|
394
|
+
if (profile.mcp.shape === "antigravity_http") {
|
|
395
|
+
ensureRecord2(config, "mcpServers").pushary = {
|
|
396
|
+
serverUrl: PUSHARY_MCP_URL,
|
|
397
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
398
|
+
};
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
377
401
|
addClaudeMcpServer(config, apiKey);
|
|
378
402
|
if (!profile.mcp.trusted) return;
|
|
379
403
|
const server = asRecord2(asRecord2(config.mcpServers)?.pushary);
|
|
@@ -397,6 +421,7 @@ export {
|
|
|
397
421
|
removePusharySettings,
|
|
398
422
|
profileFromArgv,
|
|
399
423
|
activeIdentity,
|
|
424
|
+
namedEvent,
|
|
400
425
|
activeHookSource,
|
|
401
426
|
normalizeToolCall,
|
|
402
427
|
compatibleConfigFile,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compatibleConfigFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KEV2MOJH.js";
|
|
4
4
|
import {
|
|
5
5
|
hookOwnerOf,
|
|
6
6
|
hookOwnerOfCommands,
|
|
7
7
|
liveBridgeProbe,
|
|
8
8
|
resolveBridgeStub
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7RWQZQV2.js";
|
|
10
|
+
import {
|
|
11
|
+
AGENT_CHOICES
|
|
12
|
+
} from "./chunk-4HR2ICME.js";
|
|
10
13
|
import {
|
|
11
14
|
claudeSettings,
|
|
12
15
|
codexHooksJson,
|
|
@@ -15,7 +18,7 @@ import {
|
|
|
15
18
|
guardedArgv,
|
|
16
19
|
pusharyDir,
|
|
17
20
|
vscodePluginDir
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4FWWHCYM.js";
|
|
19
22
|
import {
|
|
20
23
|
readJsonSafe
|
|
21
24
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
HOOK_LOCATOR_BINARY,
|
|
26
29
|
OPENCODE_APPROVAL_EVENT,
|
|
27
30
|
hookCompatibleProfile
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-VOP5U2VX.js";
|
|
29
32
|
|
|
30
33
|
// src/opencode-plugin.ts
|
|
31
34
|
var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
|
|
@@ -416,6 +419,7 @@ var HOOK_FILES = {
|
|
|
416
419
|
...COMPATIBLE_HOOK_FILES
|
|
417
420
|
};
|
|
418
421
|
var agentHookFile = (agent) => HOOK_FILES[agent]?.() ?? null;
|
|
422
|
+
var agentHooksKeyPath = (agent) => hookCompatibleProfile(agent)?.hooksKeyPath;
|
|
419
423
|
var readTextOrNull = (path) => {
|
|
420
424
|
try {
|
|
421
425
|
return readFileSync2(path, "utf-8");
|
|
@@ -432,13 +436,9 @@ var agentHookOwner = (agent, appAvailable) => {
|
|
|
432
436
|
const file = agentHookFile(agent);
|
|
433
437
|
if (!file) return "none";
|
|
434
438
|
const document = readJsonSafe(file);
|
|
435
|
-
|
|
436
|
-
return hookOwnerOf(
|
|
437
|
-
document.kind === "ok" ? document.value : null,
|
|
438
|
-
appAvailable,
|
|
439
|
-
profile ? profile.hooksKeyPath : void 0
|
|
440
|
-
);
|
|
439
|
+
return hookOwnerOf(document.kind === "ok" ? document.value : null, appAvailable, agentHooksKeyPath(agent));
|
|
441
440
|
};
|
|
441
|
+
var cliOwnsAnyAgentHooks = (appAvailable) => AGENT_CHOICES.some((agent) => agentHookOwner(agent, appAvailable) === "cli");
|
|
442
442
|
var macAppBridgeAvailable = () => resolveBridgeStub(join2(pusharyDir(), "bin", HOOK_LOCATOR_BINARY), liveBridgeProbe()).kind === "bundle";
|
|
443
443
|
|
|
444
444
|
export {
|
|
@@ -460,6 +460,8 @@ export {
|
|
|
460
460
|
addOpenCodeMcpServer,
|
|
461
461
|
removeOpenCodeMcpServer,
|
|
462
462
|
agentHookFile,
|
|
463
|
+
agentHooksKeyPath,
|
|
463
464
|
agentHookOwner,
|
|
465
|
+
cliOwnsAnyAgentHooks,
|
|
464
466
|
macAppBridgeAvailable
|
|
465
467
|
};
|
|
@@ -2,25 +2,25 @@ import {
|
|
|
2
2
|
SIGNED_OUT_ON_MAC_MESSAGE,
|
|
3
3
|
describeSignedOutKey,
|
|
4
4
|
readSignedOutDiagnosis
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OKSU74QH.js";
|
|
6
6
|
import {
|
|
7
7
|
createIo
|
|
8
8
|
} from "./chunk-U4TMAANR.js";
|
|
9
9
|
import {
|
|
10
10
|
readKeySource
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Z4AOR6RZ.js";
|
|
12
12
|
import {
|
|
13
13
|
absoluteUrl,
|
|
14
14
|
checkApiKey,
|
|
15
15
|
describeKeyCheck,
|
|
16
16
|
keyCheckFromResponse
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I4I4UH62.js";
|
|
18
18
|
import {
|
|
19
19
|
EXIT
|
|
20
20
|
} from "./chunk-KZERVKTD.js";
|
|
21
21
|
import {
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FJCOOFT7.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/report-key.ts
|
|
26
26
|
var { dim, yellow } = createIo();
|
|
@@ -90,5 +90,6 @@ var exitOnFailedSettingsRequest = async (response, settings) => {
|
|
|
90
90
|
|
|
91
91
|
export {
|
|
92
92
|
printKeyCheck,
|
|
93
|
+
APPROVAL_SETTINGS_PATH,
|
|
93
94
|
exitOnFailedSettingsRequest
|
|
94
95
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyHookExecutable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7RWQZQV2.js";
|
|
4
4
|
import {
|
|
5
5
|
isProtectedByScope,
|
|
6
6
|
registerHookEntry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4FWWHCYM.js";
|
|
8
8
|
|
|
9
9
|
// src/cursor-config.ts
|
|
10
10
|
var hookCommandOf = (entry) => {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CHDAH4HP.js";
|
|
4
|
+
import {
|
|
5
|
+
namedEvent
|
|
6
|
+
} from "./chunk-KEV2MOJH.js";
|
|
4
7
|
import {
|
|
5
8
|
writeDegraded
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GUNZHSTL.js";
|
|
10
|
+
import {
|
|
11
|
+
claudeShapedHookInput,
|
|
12
|
+
hookCompatibleProfileBySource
|
|
13
|
+
} from "./chunk-VOP5U2VX.js";
|
|
7
14
|
|
|
8
15
|
// src/tool-hook-input.ts
|
|
9
16
|
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
@@ -80,13 +87,18 @@ var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, pa
|
|
|
80
87
|
return null;
|
|
81
88
|
}
|
|
82
89
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
83
|
-
const
|
|
90
|
+
const shaped = inClaudeShape(source, namedEvent(process.argv) ?? fallbackEvent, parsed);
|
|
91
|
+
const input = parseInput ? parseInput(shaped) : shaped;
|
|
84
92
|
if (input === null) return null;
|
|
85
93
|
const event = eventNameOf(input) ?? fallbackEvent;
|
|
86
94
|
if (!isAdmitted(readAdmissionRules(), source, event)) return null;
|
|
87
95
|
if (stdin === process.stdin) registerTranscript(source, input);
|
|
88
96
|
return input;
|
|
89
97
|
};
|
|
98
|
+
var inClaudeShape = (source, event, parsed) => {
|
|
99
|
+
const profile = hookCompatibleProfileBySource(source);
|
|
100
|
+
return profile ? claudeShapedHookInput(profile.payload, event, parsed) : parsed;
|
|
101
|
+
};
|
|
90
102
|
var eventNameOf = (input) => {
|
|
91
103
|
if (!("hook_event_name" in input)) return void 0;
|
|
92
104
|
const name = input.hook_event_name;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DISCONNECT_AGENT_IDS,
|
|
3
3
|
SETUP_AGENT_CHOICES,
|
|
4
4
|
isApprovalMode
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VOP5U2VX.js";
|
|
6
6
|
|
|
7
7
|
// src/cli/mode-request.ts
|
|
8
8
|
var parseDuration = (value) => {
|
|
@@ -141,7 +141,7 @@ var COMMAND_OPTIONS = {
|
|
|
141
141
|
],
|
|
142
142
|
clean: [
|
|
143
143
|
["--dry-run", "List everything it would remove and change nothing"],
|
|
144
|
-
["--everything", "Also remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
|
|
144
|
+
["--everything", "Also revoke the keys the CLI wrote (config.json and its shell profile export) and remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
|
|
145
145
|
["--yes", "Remove everything without asking"]
|
|
146
146
|
],
|
|
147
147
|
transcripts: [
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MCP_BRIDGE_BINARY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BDRXDO25.js";
|
|
4
4
|
import {
|
|
5
5
|
KEY_FILE_MODE
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Z4AOR6RZ.js";
|
|
7
7
|
import {
|
|
8
8
|
NpmMissingError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4FWWHCYM.js";
|
|
10
10
|
import {
|
|
11
11
|
readJsonSafe,
|
|
12
12
|
writeFileAtomic,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-T7E75EKA.js";
|
|
15
15
|
import {
|
|
16
16
|
NPX_LATEST_COMMAND
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-M54ATCOZ.js";
|
|
18
18
|
|
|
19
19
|
// src/instruction-file.ts
|
|
20
20
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync } from "fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4HR2ICME.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-7QLSKOSU.js";
|
|
10
10
|
import {
|
|
11
11
|
NPX_LATEST_COMMAND
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-M54ATCOZ.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-VOP5U2VX.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/cowork.ts
|
|
23
23
|
import { readFileSync } from "fs";
|
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
expectedLaunchCapabilities,
|
|
4
4
|
hasSpawnProvider,
|
|
5
5
|
resolveControlPolicy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-N6GEI3PK.js";
|
|
7
7
|
import {
|
|
8
8
|
daemonHasRemoteProof,
|
|
9
9
|
daemonServiceManagerAvailable,
|
|
10
10
|
hasDaemonServiceDefinition,
|
|
11
11
|
readDaemonNeedsLogin,
|
|
12
12
|
readDaemonStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PTGUJZSD.js";
|
|
14
14
|
import {
|
|
15
15
|
readControlMode,
|
|
16
16
|
readKeySource
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z4AOR6RZ.js";
|
|
18
18
|
import {
|
|
19
19
|
getMachineId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2NAQRPZQ.js";
|
|
21
21
|
import {
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FJCOOFT7.js";
|
|
24
24
|
import {
|
|
25
25
|
getPackageVersion
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VOP5U2VX.js";
|
|
27
27
|
|
|
28
28
|
// src/machines.ts
|
|
29
29
|
import { hostname } from "os";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
resolvePackageVersionFromBinary,
|
|
11
11
|
resolvePathBinary,
|
|
12
12
|
resolvePathBinaryAsync
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4FWWHCYM.js";
|
|
14
14
|
import {
|
|
15
15
|
MANAGED_PROVIDERS
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VOP5U2VX.js";
|
|
17
17
|
|
|
18
18
|
// src/setup/codex-install.ts
|
|
19
19
|
var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
keyPrefix,
|
|
4
4
|
readConfigFileKey,
|
|
5
5
|
readMacAppKeyPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Z4AOR6RZ.js";
|
|
7
7
|
import {
|
|
8
8
|
NPX_LATEST_COMMAND
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M54ATCOZ.js";
|
|
10
10
|
|
|
11
11
|
// src/key-signed-out.ts
|
|
12
12
|
var VERDICT_BY_CHECK = {
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
readControlMode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Z4AOR6RZ.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2NAQRPZQ.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir,
|
|
13
13
|
resolveGlobalBinary
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4FWWHCYM.js";
|
|
15
15
|
import {
|
|
16
16
|
readJsonSafe,
|
|
17
17
|
writeFileAtomic,
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
} from "./chunk-T7E75EKA.js";
|
|
21
21
|
import {
|
|
22
22
|
getApiKey
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FJCOOFT7.js";
|
|
24
24
|
import {
|
|
25
25
|
CLI_PACKAGE_NAMES,
|
|
26
26
|
cmdShimTarget,
|
|
27
27
|
getPackageVersion,
|
|
28
28
|
globalPackageFolder,
|
|
29
29
|
globalRootFor
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VOP5U2VX.js";
|
|
31
31
|
|
|
32
32
|
// src/daemon-lifecycle.ts
|
|
33
33
|
import { dirname, join, win32 as win32Path } from "path";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/key-revocation.ts
|
|
2
|
+
var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
|
|
3
|
+
var DEVICE_KEY_PATH = "/api/agent/device-key";
|
|
4
|
+
var FULL_ACCESS_ONLY_STATUS = 403;
|
|
5
|
+
var REVOKE_TIMEOUT_MS = 1e4;
|
|
6
|
+
var readRevokedCount = async (response) => {
|
|
7
|
+
try {
|
|
8
|
+
const body = await response.json();
|
|
9
|
+
const revoked = typeof body === "object" && body !== null && "revoked" in body ? body.revoked : void 0;
|
|
10
|
+
return typeof revoked === "number" && Number.isInteger(revoked) && revoked >= 0 ? revoked : null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var revokeAgentKey = async (apiKey, baseUrl, fetchImpl) => {
|
|
16
|
+
const response = await fetchImpl(`${baseUrl}${DEVICE_KEY_PATH}`, {
|
|
17
|
+
method: "DELETE",
|
|
18
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
19
|
+
signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) return { kind: "refused", status: response.status };
|
|
22
|
+
const revoked = await readRevokedCount(response);
|
|
23
|
+
if (revoked === null) return { kind: "refused", status: response.status };
|
|
24
|
+
return revoked > 0 ? { kind: "revoked" } : { kind: "not_accepted" };
|
|
25
|
+
};
|
|
26
|
+
var revokeOwnKey = async (apiKey, baseUrl, fetchImpl = fetch) => {
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetchImpl(`${baseUrl}${SELF_REVOKE_PATH}`, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
31
|
+
signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
|
|
32
|
+
});
|
|
33
|
+
if (response.status === 401) return { kind: "not_accepted" };
|
|
34
|
+
if (response.status === FULL_ACCESS_ONLY_STATUS) return await revokeAgentKey(apiKey, baseUrl, fetchImpl);
|
|
35
|
+
if (!response.ok) return { kind: "refused", status: response.status };
|
|
36
|
+
return { kind: "revoked" };
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return { kind: "unreachable", detail: err instanceof Error ? err.message : "network error" };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var REVOKE_DETAIL = {
|
|
42
|
+
revoked: "Revoked the key on pushary.com.",
|
|
43
|
+
not_accepted: "pushary.com had already stopped accepting the key.",
|
|
44
|
+
refused: "pushary.com refused to revoke the key",
|
|
45
|
+
unreachable: "Could not reach pushary.com to revoke the key"
|
|
46
|
+
};
|
|
47
|
+
var describeRevokeAttempt = (attempt) => {
|
|
48
|
+
if (attempt.kind === "refused") return `${REVOKE_DETAIL.refused} (HTTP ${attempt.status}).`;
|
|
49
|
+
if (attempt.kind === "unreachable") return `${REVOKE_DETAIL.unreachable}: ${attempt.detail}`;
|
|
50
|
+
return REVOKE_DETAIL[attempt.kind];
|
|
51
|
+
};
|
|
52
|
+
var keyNoLongerAccepted = (attempt) => attempt.kind === "revoked" || attempt.kind === "not_accepted";
|
|
53
|
+
var keyValidityOf = (check) => {
|
|
54
|
+
switch (check.kind) {
|
|
55
|
+
case "ok":
|
|
56
|
+
case "locked":
|
|
57
|
+
return "valid";
|
|
58
|
+
case "rejected":
|
|
59
|
+
case "malformed":
|
|
60
|
+
return "invalid";
|
|
61
|
+
case "unreachable":
|
|
62
|
+
return "unknown";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
revokeOwnKey,
|
|
68
|
+
describeRevokeAttempt,
|
|
69
|
+
keyNoLongerAccepted,
|
|
70
|
+
keyValidityOf
|
|
71
|
+
};
|
|
@@ -14,19 +14,19 @@ import {
|
|
|
14
14
|
} from "./chunk-U4TMAANR.js";
|
|
15
15
|
import {
|
|
16
16
|
callMcpTool
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KBN3UP2R.js";
|
|
18
18
|
import {
|
|
19
19
|
reportedInstallSource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CBDJ2X5P.js";
|
|
21
21
|
import {
|
|
22
22
|
NPX_LATEST_COMMAND
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-M54ATCOZ.js";
|
|
24
24
|
import {
|
|
25
25
|
NO_PAIRING_COMPUTER,
|
|
26
26
|
PAIR_TTL_SECONDS,
|
|
27
27
|
classifyConfirmResponse,
|
|
28
28
|
isAnswerSource
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-VOP5U2VX.js";
|
|
30
30
|
|
|
31
31
|
// src/reach.ts
|
|
32
32
|
var reachVerdict = (channels) => {
|