@pushary/agent-hooks 1.6.2 → 1.6.4
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 +12 -0
- package/dist/bin/pushary-bell-hook.js +21 -18
- package/dist/bin/pushary-bell.js +8 -8
- package/dist/bin/pushary-claude.js +24 -22
- package/dist/bin/pushary-clean.js +38 -36
- package/dist/bin/pushary-codex-bridge.js +22 -21
- package/dist/bin/pushary-codex-hook.js +36 -30
- package/dist/bin/pushary-codex.js +11 -9
- package/dist/bin/pushary-connect.js +10 -8
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +27 -27
- package/dist/bin/pushary-disconnect.js +20 -18
- package/dist/bin/pushary-doctor.js +53 -51
- package/dist/bin/pushary-elicitation-hook.js +23 -21
- package/dist/bin/pushary-gemini-bridge.js +9 -9
- package/dist/bin/pushary-gemini-hook.js +32 -26
- package/dist/bin/pushary-hook.js +34 -28
- package/dist/bin/pushary-login.js +8 -8
- package/dist/bin/pushary-logout.js +9 -9
- package/dist/bin/pushary-mode.js +7 -4
- package/dist/bin/pushary-notification-hook.js +25 -23
- package/dist/bin/pushary-opencode-hook.js +31 -25
- package/dist/bin/pushary-permission-denied-hook.js +29 -27
- package/dist/bin/pushary-permission-hook.js +28 -26
- package/dist/bin/pushary-post-hook.js +25 -23
- package/dist/bin/pushary-prompt-hook.js +25 -23
- package/dist/bin/pushary-session-end-hook.js +25 -23
- package/dist/bin/pushary-session-start-hook.js +29 -27
- package/dist/bin/pushary-setup.js +194 -105
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +12 -12
- package/dist/bin/pushary-stop-hook.js +25 -23
- package/dist/bin/pushary-stopfailure-hook.js +25 -23
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +4 -4
- package/dist/bin/pushary-upgrade.js +25 -24
- package/dist/bin/pushary-wait.js +7 -4
- package/dist/bin/pushary.js +8 -3
- package/dist/{chunk-N6AMKPDW.js → chunk-3LU74H52.js} +1 -1
- package/dist/{chunk-SB2CRLFK.js → chunk-3VZX4NSP.js} +1 -1
- package/dist/{chunk-ND43S2N4.js → chunk-53DN77WB.js} +1 -1
- package/dist/{chunk-KKZ5TDTB.js → chunk-5SWQZ6HY.js} +4 -4
- package/dist/{chunk-A6BENRKI.js → chunk-5U3FJ6YF.js} +7 -7
- package/dist/{chunk-CH4QMWBM.js → chunk-5UWV5GHM.js} +1 -1
- package/dist/{chunk-55AT5DJD.js → chunk-6NLWK6ZV.js} +2 -2
- package/dist/{chunk-HW2M7XAU.js → chunk-7CLTSZOL.js} +3 -3
- package/dist/{chunk-HETOKNIL.js → chunk-BJENQBMH.js} +3 -3
- package/dist/{chunk-A5ODW52C.js → chunk-CAS7GFWI.js} +75 -28
- package/dist/{chunk-M543MAUN.js → chunk-D3K2FPPJ.js} +8 -8
- package/dist/chunk-DESAUCH2.js +126 -0
- package/dist/{chunk-LH2N6VAN.js → chunk-DZTKLE7Q.js} +3 -1
- package/dist/{chunk-LVHGSD5E.js → chunk-EREBZHN2.js} +12 -6
- package/dist/{chunk-E72R2MHO.js → chunk-GBL4BTG3.js} +2 -2
- package/dist/{chunk-GKO7T4JM.js → chunk-H6XU22TN.js} +14 -8
- package/dist/{chunk-OXFWJIW4.js → chunk-HUB4Q35G.js} +1 -1
- package/dist/{chunk-NEUYPY3I.js → chunk-I2YUMZLE.js} +7 -6
- package/dist/{chunk-3PDQE66Q.js → chunk-I3XJATMR.js} +1 -1
- package/dist/{chunk-TCT4WUDP.js → chunk-JOGA3TL2.js} +6 -6
- package/dist/{chunk-ON7VIYOQ.js → chunk-K32C2RGK.js} +3 -1
- package/dist/{chunk-F5ENKWKY.js → chunk-LDRGVXLR.js} +1 -1
- package/dist/{chunk-TDXQQB55.js → chunk-LFMOYHPY.js} +1 -1
- package/dist/{chunk-572FZF7T.js → chunk-LJEL7IB5.js} +5 -5
- package/dist/{chunk-3HUDBDO7.js → chunk-LQI7W4RG.js} +1 -1
- package/dist/{chunk-RKSBBEGT.js → chunk-N62KAMMY.js} +1 -1
- package/dist/{chunk-LN3FETAC.js → chunk-NFH73H5B.js} +3 -3
- package/dist/{chunk-SD6SAIEV.js → chunk-NYMPLNV3.js} +3 -3
- package/dist/{chunk-KUQF2VO6.js → chunk-OZE2TQX5.js} +5 -5
- package/dist/{chunk-HYN2BILS.js → chunk-P4UYILQK.js} +5 -6
- package/dist/{chunk-HLY5W2P4.js → chunk-PBKEYMAO.js} +1 -1
- package/dist/{chunk-VQIINJ45.js → chunk-PJF7L7AA.js} +1 -1
- package/dist/chunk-POFBE6ZY.js +12 -0
- package/dist/{chunk-RKNA2L2J.js → chunk-R4HVHTNA.js} +1 -1
- package/dist/{chunk-2J63MNXV.js → chunk-UAP556WK.js} +5 -6
- package/dist/{chunk-HXKY6DFD.js → chunk-UGKDBJJX.js} +2 -2
- package/dist/{chunk-5KREBDUT.js → chunk-VA2R64I7.js} +1 -1
- package/dist/{chunk-NSG2Q4PI.js → chunk-VHNDE3ZD.js} +1 -1
- package/dist/chunk-VOCZHOXV.js +142 -0
- package/dist/{chunk-ZRLB3N37.js → chunk-XJG2FUWS.js} +3 -3
- package/dist/{chunk-7REOI7BC.js → chunk-XOMH53NB.js} +1 -1
- package/dist/{chunk-D5ORNUHK.js → chunk-YPONELWS.js} +6 -6
- package/dist/{chunk-XINNQCPW.js → chunk-YUGGNZSF.js} +1 -1
- package/dist/{chunk-D5PQGC5V.js → chunk-YXPGFRRW.js} +3 -3
- package/dist/{chunk-RK2MUM6Q.js → chunk-ZA5UXRNE.js} +3 -3
- package/dist/{reapply-KV6RTOQL.js → reapply-4DAJKNVP.js} +9 -9
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +17 -15
- package/package.json +1 -1
- package/dist/chunk-SAF6HGAA.js +0 -57
|
@@ -447,6 +447,34 @@ var compatibleTargetFiles = (profile) => {
|
|
|
447
447
|
return [...seen.values()];
|
|
448
448
|
};
|
|
449
449
|
|
|
450
|
+
// ../contracts/src/redaction.ts
|
|
451
|
+
var SECRET_REDACTION_RULES = [
|
|
452
|
+
{ pattern: /\bpk_[A-Za-z0-9_]+\.[A-Za-z0-9_]+/g, replacement: "[redacted]" },
|
|
453
|
+
{ pattern: /-----BEGIN[A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END[A-Z0-9 ]*PRIVATE KEY-----/g, replacement: "[redacted key]" },
|
|
454
|
+
{ pattern: /\bsk-[A-Za-z0-9_-]{16,}\b/g, replacement: "[redacted]" },
|
|
455
|
+
{ pattern: /\b[spr]k_(?:live|test)_[A-Za-z0-9]{8,}\b/g, replacement: "[redacted]" },
|
|
456
|
+
{ pattern: /\bwhsec_[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
457
|
+
{ pattern: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}\b/g, replacement: "[redacted]" },
|
|
458
|
+
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{22,}\b/g, replacement: "[redacted]" },
|
|
459
|
+
{ pattern: /\bglpat-[A-Za-z0-9_-]{20,}\b/g, replacement: "[redacted]" },
|
|
460
|
+
{ pattern: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g, replacement: "[redacted]" },
|
|
461
|
+
{ pattern: /\bAIza[A-Za-z0-9_-]{35}\b/g, replacement: "[redacted]" },
|
|
462
|
+
{ pattern: /\bAKIA[0-9A-Z]{16}\b/g, replacement: "[redacted]" },
|
|
463
|
+
{ pattern: /\bnpm_[A-Za-z0-9]{36}\b/g, replacement: "[redacted]" },
|
|
464
|
+
{ pattern: /\bxai-[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
465
|
+
{ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, replacement: "[redacted]" },
|
|
466
|
+
{ pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)[^\s@/]+@/gi, replacement: "$1[redacted]@" },
|
|
467
|
+
{ pattern: /\bbearer\s+[A-Za-z0-9._~+/=-]+/gi, replacement: "bearer [redacted]" },
|
|
468
|
+
{ pattern: /\bauthorization:\s*\S+/gi, replacement: "authorization: [redacted]" },
|
|
469
|
+
{
|
|
470
|
+
pattern: /((?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,
|
|
471
|
+
replacement: "$1[redacted]"
|
|
472
|
+
}
|
|
473
|
+
];
|
|
474
|
+
var HIGH_ENTROPY_RULE = { pattern: /[A-Za-z0-9+/]{40,}={0,2}/g, replacement: "[redacted]" };
|
|
475
|
+
var redactSecrets = (text) => SECRET_REDACTION_RULES.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text);
|
|
476
|
+
var redactSecretsDeep = (text) => redactSecrets(text).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
|
|
477
|
+
|
|
450
478
|
// ../contracts/src/degraded.ts
|
|
451
479
|
var DEGRADED_PREFIX = "[degraded]";
|
|
452
480
|
var degradedPayload = (subsystem, report) => ({
|
|
@@ -461,6 +489,46 @@ var degradedLine = (subsystem, report) => `${DEGRADED_PREFIX} ${JSON.stringify(d
|
|
|
461
489
|
|
|
462
490
|
// ../contracts/src/setup-wire.ts
|
|
463
491
|
var PAIR_TTL_SECONDS = 900;
|
|
492
|
+
var SETUP_AGENT_CHOICES = [
|
|
493
|
+
"claude_code",
|
|
494
|
+
"codex",
|
|
495
|
+
"gemini_cli",
|
|
496
|
+
"hermes",
|
|
497
|
+
"cursor",
|
|
498
|
+
"vscode",
|
|
499
|
+
"opencode",
|
|
500
|
+
...COMPATIBLE_AGENT_TYPES,
|
|
501
|
+
"custom"
|
|
502
|
+
];
|
|
503
|
+
var SETUP_CONNECT_MODES = ["app", "browser", "web", "none"];
|
|
504
|
+
var isSetupConnectMode = (value) => typeof value === "string" && SETUP_CONNECT_MODES.includes(value);
|
|
505
|
+
|
|
506
|
+
// ../contracts/src/observability.ts
|
|
507
|
+
var CLIENT_CONTEXT_HEADERS = {
|
|
508
|
+
surface: "x-pushary-surface",
|
|
509
|
+
clientVersion: "x-pushary-client-version",
|
|
510
|
+
machineId: "x-pushary-machine-id",
|
|
511
|
+
runId: "x-pushary-run-id",
|
|
512
|
+
platform: "x-pushary-platform"
|
|
513
|
+
};
|
|
514
|
+
var CLIENT_REPORT_PATH = "/api/agent/client-report";
|
|
515
|
+
var CLIENT_VERSION_PATTERN = /^\d+(?:\.\d+){1,3}(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
516
|
+
var CONTEXT_ID_PATTERN = /^[A-Za-z0-9-]{8,64}$/;
|
|
517
|
+
var PLATFORM_PATTERN = /^[a-z0-9_.-]{1,32}$/;
|
|
518
|
+
var CONTEXT_VALUE_MAX_LENGTH = 64;
|
|
519
|
+
var isClientVersion = (value) => typeof value === "string" && value.length <= CONTEXT_VALUE_MAX_LENGTH && CLIENT_VERSION_PATTERN.test(value);
|
|
520
|
+
var isContextId = (value) => typeof value === "string" && CONTEXT_ID_PATTERN.test(value);
|
|
521
|
+
var isClientPlatform = (value) => typeof value === "string" && PLATFORM_PATTERN.test(value);
|
|
522
|
+
var clientContextHeaders = (source) => {
|
|
523
|
+
const headers = {
|
|
524
|
+
[CLIENT_CONTEXT_HEADERS.surface]: source.surface,
|
|
525
|
+
[CLIENT_CONTEXT_HEADERS.runId]: source.runId
|
|
526
|
+
};
|
|
527
|
+
if (isClientVersion(source.clientVersion)) headers[CLIENT_CONTEXT_HEADERS.clientVersion] = source.clientVersion;
|
|
528
|
+
if (isContextId(source.machineId)) headers[CLIENT_CONTEXT_HEADERS.machineId] = source.machineId;
|
|
529
|
+
if (isClientPlatform(source.platform)) headers[CLIENT_CONTEXT_HEADERS.platform] = source.platform;
|
|
530
|
+
return headers;
|
|
531
|
+
};
|
|
464
532
|
|
|
465
533
|
// ../contracts/src/index.ts
|
|
466
534
|
var KEY_SCOPES = ["full_access", "agent", "connector", "bound"];
|
|
@@ -1532,31 +1600,6 @@ var computeDeltaSignal = (input) => {
|
|
|
1532
1600
|
}
|
|
1533
1601
|
return { deltaSignal: "match", deltaScore: 0, remoteApprove: !destructive };
|
|
1534
1602
|
};
|
|
1535
|
-
var SECRET_REDACTION_RULES = [
|
|
1536
|
-
{ pattern: /\bpk_[A-Za-z0-9_]+\.[A-Za-z0-9_]+/g, replacement: "[redacted]" },
|
|
1537
|
-
{ pattern: /-----BEGIN[A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END[A-Z0-9 ]*PRIVATE KEY-----/g, replacement: "[redacted key]" },
|
|
1538
|
-
{ pattern: /\bsk-[A-Za-z0-9_-]{16,}\b/g, replacement: "[redacted]" },
|
|
1539
|
-
{ pattern: /\b[spr]k_(?:live|test)_[A-Za-z0-9]{8,}\b/g, replacement: "[redacted]" },
|
|
1540
|
-
{ pattern: /\bwhsec_[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
1541
|
-
{ pattern: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}\b/g, replacement: "[redacted]" },
|
|
1542
|
-
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{22,}\b/g, replacement: "[redacted]" },
|
|
1543
|
-
{ pattern: /\bglpat-[A-Za-z0-9_-]{20,}\b/g, replacement: "[redacted]" },
|
|
1544
|
-
{ pattern: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g, replacement: "[redacted]" },
|
|
1545
|
-
{ pattern: /\bAIza[A-Za-z0-9_-]{35}\b/g, replacement: "[redacted]" },
|
|
1546
|
-
{ pattern: /\bAKIA[0-9A-Z]{16}\b/g, replacement: "[redacted]" },
|
|
1547
|
-
{ pattern: /\bnpm_[A-Za-z0-9]{36}\b/g, replacement: "[redacted]" },
|
|
1548
|
-
{ pattern: /\bxai-[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
1549
|
-
{ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, replacement: "[redacted]" },
|
|
1550
|
-
{ pattern: /\bbearer\s+[A-Za-z0-9._~+/=-]+/gi, replacement: "bearer [redacted]" },
|
|
1551
|
-
{ pattern: /\bauthorization:\s*\S+/gi, replacement: "authorization: [redacted]" },
|
|
1552
|
-
{
|
|
1553
|
-
pattern: /((?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)\s*[=:]\s*)("[^"]*"|'[^']*'|\S+)/gi,
|
|
1554
|
-
replacement: "$1[redacted]"
|
|
1555
|
-
}
|
|
1556
|
-
];
|
|
1557
|
-
var HIGH_ENTROPY_RULE = { pattern: /[A-Za-z0-9+/]{40,}={0,2}/g, replacement: "[redacted]" };
|
|
1558
|
-
var redactSecrets = (text) => SECRET_REDACTION_RULES.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text);
|
|
1559
|
-
var redactSecretsDeep = (text) => redactSecrets(text).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
|
|
1560
1603
|
var AUTHORIZATION_CANONICAL_VERSION = "pushary.authz.v1";
|
|
1561
1604
|
var AUTHORIZATION_CANONICAL_FIXTURE = [
|
|
1562
1605
|
{
|
|
@@ -2468,7 +2511,6 @@ export {
|
|
|
2468
2511
|
DISCONNECTABLE_AGENTS,
|
|
2469
2512
|
REPO_AWARE_AGENTS,
|
|
2470
2513
|
MANAGED_PROVIDERS,
|
|
2471
|
-
COMPATIBLE_AGENT_TYPES,
|
|
2472
2514
|
PHONE_ANSWERED_TOOLS,
|
|
2473
2515
|
canonicalToolName,
|
|
2474
2516
|
toToolLookup,
|
|
@@ -2477,11 +2519,18 @@ export {
|
|
|
2477
2519
|
hookCompatibleProfile,
|
|
2478
2520
|
hookCompatibleProfileBySource,
|
|
2479
2521
|
compatibleTargetFiles,
|
|
2522
|
+
redactSecrets,
|
|
2523
|
+
redactSecretsDeep,
|
|
2480
2524
|
degradedLine,
|
|
2481
2525
|
hookWritePath,
|
|
2482
2526
|
isHookActivationReport,
|
|
2483
2527
|
hookActivationResult,
|
|
2484
2528
|
PAIR_TTL_SECONDS,
|
|
2529
|
+
SETUP_AGENT_CHOICES,
|
|
2530
|
+
SETUP_CONNECT_MODES,
|
|
2531
|
+
isSetupConnectMode,
|
|
2532
|
+
CLIENT_REPORT_PATH,
|
|
2533
|
+
clientContextHeaders,
|
|
2485
2534
|
normalizeKeyScope,
|
|
2486
2535
|
parseAgentQuestion,
|
|
2487
2536
|
parseAgentQuestions,
|
|
@@ -2509,8 +2558,6 @@ export {
|
|
|
2509
2558
|
isValidApiKey,
|
|
2510
2559
|
ACTION_BODY_MAX,
|
|
2511
2560
|
DECISION_LINE_MAX,
|
|
2512
|
-
redactSecrets,
|
|
2513
|
-
redactSecretsDeep,
|
|
2514
2561
|
isAnswerSource,
|
|
2515
2562
|
buildDecisionEpisodeFeatures,
|
|
2516
2563
|
resolveAutoResolveOrigin,
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "./chunk-SGZJ5LYH.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5SWQZ6HY.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureDaemonRunning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OZE2TQX5.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
decodePublicKey,
|
|
16
16
|
generateSessionKey,
|
|
17
17
|
wrapSessionKey
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XOMH53NB.js";
|
|
19
19
|
import {
|
|
20
20
|
fetchTranscriptRecipients,
|
|
21
21
|
uploadTranscriptRecords
|
|
@@ -23,14 +23,14 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
transcriptEnvironmentPreference,
|
|
25
25
|
transcriptsEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VA2R64I7.js";
|
|
27
|
+
import {
|
|
28
|
+
readTranscriptPreference
|
|
29
|
+
} from "./chunk-R4HVHTNA.js";
|
|
27
30
|
import {
|
|
28
31
|
codexHome,
|
|
29
32
|
pusharyDir
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import {
|
|
32
|
-
readTranscriptPreference
|
|
33
|
-
} from "./chunk-RKNA2L2J.js";
|
|
33
|
+
} from "./chunk-K32C2RGK.js";
|
|
34
34
|
import {
|
|
35
35
|
writeJsonAtomic
|
|
36
36
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readExistingMachineId
|
|
3
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
4
|
+
import {
|
|
5
|
+
NetworkError
|
|
6
|
+
} from "./chunk-7QLSKOSU.js";
|
|
7
|
+
import {
|
|
8
|
+
getBaseUrl
|
|
9
|
+
} from "./chunk-OSJEMXSR.js";
|
|
10
|
+
import {
|
|
11
|
+
clientContextHeaders
|
|
12
|
+
} from "./chunk-CAS7GFWI.js";
|
|
13
|
+
import {
|
|
14
|
+
getPackageVersion
|
|
15
|
+
} from "./chunk-HWJW3CPO.js";
|
|
16
|
+
|
|
17
|
+
// src/cli/net.ts
|
|
18
|
+
import { createRequire } from "module";
|
|
19
|
+
|
|
20
|
+
// src/cli/client-context.ts
|
|
21
|
+
import { randomUUID } from "crypto";
|
|
22
|
+
var CLI_RUN_ID = randomUUID();
|
|
23
|
+
var cliPlatform = () => `${process.platform}-${process.arch}`;
|
|
24
|
+
var memoizedContext = null;
|
|
25
|
+
var safeMachineId = () => {
|
|
26
|
+
try {
|
|
27
|
+
return readExistingMachineId();
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var readCliClientContext = () => ({
|
|
33
|
+
surface: "cli",
|
|
34
|
+
clientVersion: getPackageVersion(),
|
|
35
|
+
machineId: safeMachineId(),
|
|
36
|
+
runId: CLI_RUN_ID,
|
|
37
|
+
platform: cliPlatform()
|
|
38
|
+
});
|
|
39
|
+
var cliClientContext = () => {
|
|
40
|
+
if (memoizedContext) return memoizedContext;
|
|
41
|
+
const context = readCliClientContext();
|
|
42
|
+
if (context.machineId !== null) memoizedContext = context;
|
|
43
|
+
return context;
|
|
44
|
+
};
|
|
45
|
+
var originOf = (url) => {
|
|
46
|
+
try {
|
|
47
|
+
return new URL(url).origin;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var requestUrlOf = (input) => typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
53
|
+
var isPusharyRequest = (input, baseUrl) => {
|
|
54
|
+
const target = originOf(requestUrlOf(input));
|
|
55
|
+
return target !== null && target === originOf(baseUrl);
|
|
56
|
+
};
|
|
57
|
+
var mergeClientContextHeaders = (input, init, context) => {
|
|
58
|
+
const headers = new Headers(input instanceof Request ? input.headers : void 0);
|
|
59
|
+
new Headers(init?.headers).forEach((value, name) => headers.set(name, value));
|
|
60
|
+
for (const [name, value] of Object.entries(clientContextHeaders(context))) {
|
|
61
|
+
if (!headers.has(name)) headers.set(name, value);
|
|
62
|
+
}
|
|
63
|
+
return headers;
|
|
64
|
+
};
|
|
65
|
+
var withClientContext = (fetchImpl, options) => (input, init) => isPusharyRequest(input, options.baseUrl()) ? fetchImpl(input, { ...init, headers: mergeClientContextHeaders(input, init, options.context()) }) : fetchImpl(input, init);
|
|
66
|
+
var installed = false;
|
|
67
|
+
var installClientContextHeaders = () => {
|
|
68
|
+
if (installed) return;
|
|
69
|
+
installed = true;
|
|
70
|
+
globalThis.fetch = withClientContext(globalThis.fetch.bind(globalThis), { baseUrl: getBaseUrl, context: cliClientContext });
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/cli/net.ts
|
|
74
|
+
var requireCjs = createRequire(import.meta.url);
|
|
75
|
+
var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
|
|
76
|
+
var proxyFromEnv = () => {
|
|
77
|
+
for (const name of PROXY_VARS) {
|
|
78
|
+
const value = process.env[name]?.trim();
|
|
79
|
+
if (value) return value;
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
};
|
|
83
|
+
var installed2 = false;
|
|
84
|
+
var installNetworkDefaults = () => {
|
|
85
|
+
if (installed2) return;
|
|
86
|
+
installed2 = true;
|
|
87
|
+
installClientContextHeaders();
|
|
88
|
+
if (!proxyFromEnv()) return;
|
|
89
|
+
try {
|
|
90
|
+
const { EnvHttpProxyAgent, setGlobalDispatcher } = requireCjs("undici");
|
|
91
|
+
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var isNetworkFailure = (err) => {
|
|
96
|
+
if (!(err instanceof Error)) return false;
|
|
97
|
+
const code = err.code;
|
|
98
|
+
if (code && ["ENOTFOUND", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "EPROTO", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE"].includes(code)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return err.name === "AbortError" || err.name === "TimeoutError" || /fetch failed/i.test(err.message);
|
|
102
|
+
};
|
|
103
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
104
|
+
var pusharyFetch = async (url, init = {}) => {
|
|
105
|
+
installNetworkDefaults();
|
|
106
|
+
const { timeoutMs = DEFAULT_TIMEOUT_MS, signal, ...rest } = init;
|
|
107
|
+
try {
|
|
108
|
+
return await fetch(url, {
|
|
109
|
+
...rest,
|
|
110
|
+
signal: signal ?? AbortSignal.timeout(timeoutMs)
|
|
111
|
+
});
|
|
112
|
+
} catch (err) {
|
|
113
|
+
if (isNetworkFailure(err)) {
|
|
114
|
+
const proxy = proxyFromEnv();
|
|
115
|
+
const via = proxy ? ` (via proxy ${proxy})` : "";
|
|
116
|
+
throw new NetworkError(`Could not reach ${new URL(url).host}${via}: ${err instanceof Error ? err.message : String(err)}`);
|
|
117
|
+
}
|
|
118
|
+
throw err;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
installNetworkDefaults,
|
|
124
|
+
isNetworkFailure,
|
|
125
|
+
pusharyFetch
|
|
126
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K32C2RGK.js";
|
|
4
4
|
import {
|
|
5
5
|
writeFileAtomic
|
|
6
6
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -18,6 +18,7 @@ var readMachineId = (filePath) => {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
var readExistingMachineId = (options = {}) => readMachineId(options.filePath ?? join(pusharyDir(), "machine-id"));
|
|
21
22
|
var getOrCreateMachineId = (options = {}) => {
|
|
22
23
|
const filePath = options.filePath ?? join(pusharyDir(), "machine-id");
|
|
23
24
|
const existing = readMachineId(filePath);
|
|
@@ -41,5 +42,6 @@ var getOrCreateMachineId = (options = {}) => {
|
|
|
41
42
|
var getMachineId = (options = {}) => getOrCreateMachineId(options);
|
|
42
43
|
|
|
43
44
|
export {
|
|
45
|
+
readExistingMachineId,
|
|
44
46
|
getMachineId
|
|
45
47
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clientErrorKindOf,
|
|
3
|
+
reportClientError
|
|
4
|
+
} from "./chunk-VOCZHOXV.js";
|
|
1
5
|
import {
|
|
2
6
|
callMcpTool
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BJENQBMH.js";
|
|
4
8
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
installNetworkDefaults
|
|
10
|
+
} from "./chunk-DESAUCH2.js";
|
|
7
11
|
import {
|
|
8
12
|
getBaseUrl
|
|
9
13
|
} from "./chunk-OSJEMXSR.js";
|
|
@@ -44,7 +48,7 @@ var isBlockedActionClaim = (data) => {
|
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
// src/api.ts
|
|
47
|
-
|
|
51
|
+
installNetworkDefaults();
|
|
48
52
|
var DECISION_STOP_REASON = "Approval was cancelled or became unavailable. Retry only after resolving it.";
|
|
49
53
|
var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
|
|
50
54
|
var isLocalQuestionHandoff = (result) => result.suppressed === true || result.noDevices === true || result.status === "terminal" || result.status === "notified";
|
|
@@ -130,7 +134,8 @@ var requestGate = async (apiKey, request, timeoutMs = 15e3) => {
|
|
|
130
134
|
try {
|
|
131
135
|
const reply = await postAgentRequest(apiKey, GATE_PATH, request, timeoutMs);
|
|
132
136
|
return isGateReply(reply) ? reply : null;
|
|
133
|
-
} catch {
|
|
137
|
+
} catch (error) {
|
|
138
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "gate_request_failed" });
|
|
134
139
|
return null;
|
|
135
140
|
}
|
|
136
141
|
};
|
|
@@ -138,7 +143,8 @@ var claimBlockedAction = async (apiKey, request, timeoutMs) => {
|
|
|
138
143
|
try {
|
|
139
144
|
const reply = await postAgentRequest(apiKey, BLOCKED_ACTION_CLAIM_PATH, request, timeoutMs);
|
|
140
145
|
return isBlockedActionClaim(reply) ? reply.granted : null;
|
|
141
|
-
} catch {
|
|
146
|
+
} catch (error) {
|
|
147
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "blocked_action_claim_failed" });
|
|
142
148
|
return null;
|
|
143
149
|
}
|
|
144
150
|
};
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
resolveBinary,
|
|
3
3
|
resolveGlobalPackageVersion,
|
|
4
4
|
resolvePackageVersionFromBinary
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-K32C2RGK.js";
|
|
6
6
|
import {
|
|
7
7
|
MANAGED_PROVIDERS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CAS7GFWI.js";
|
|
9
9
|
|
|
10
10
|
// src/live-capabilities.ts
|
|
11
11
|
var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_PUSH_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YUGGNZSF.js";
|
|
5
5
|
import {
|
|
6
6
|
cancelQuestion,
|
|
7
7
|
isPolicyConfig,
|
|
8
8
|
sendNotification,
|
|
9
9
|
waitForAnswer
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EREBZHN2.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
clientErrorKindOf,
|
|
13
|
+
reportClientError
|
|
14
|
+
} from "./chunk-VOCZHOXV.js";
|
|
14
15
|
import {
|
|
15
16
|
withRetry
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BJENQBMH.js";
|
|
18
|
+
import {
|
|
19
|
+
getMachineId
|
|
20
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
17
21
|
import {
|
|
18
22
|
reportedInstallSource
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VHNDE3ZD.js";
|
|
20
24
|
import {
|
|
21
25
|
getApiKey,
|
|
22
26
|
getBaseUrl
|
|
@@ -44,7 +48,7 @@ import {
|
|
|
44
48
|
resolveAutoResolveOrigin,
|
|
45
49
|
resolvePolicy,
|
|
46
50
|
toToolLookup
|
|
47
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-CAS7GFWI.js";
|
|
48
52
|
|
|
49
53
|
// src/policy.ts
|
|
50
54
|
import { createHash } from "crypto";
|
|
@@ -176,12 +180,14 @@ var fetchModeState = async (apiKey, sessionId, reuseWithinMs = 0, signal) => {
|
|
|
176
180
|
signal: AbortSignal.any([AbortSignal.timeout(3e3), ...signal ? [signal] : []])
|
|
177
181
|
});
|
|
178
182
|
if (!response.ok) {
|
|
183
|
+
void reportClientError({ kind: "http_status", code: `mode_http_${response.status}` });
|
|
179
184
|
return degradedFallback(apiKey, response.status === 401 || response.status === 403);
|
|
180
185
|
}
|
|
181
186
|
const state = modeStateFromResponse(await response.json());
|
|
182
187
|
writeLastGoodMode(apiKey, state, sessionId);
|
|
183
188
|
return state;
|
|
184
|
-
} catch {
|
|
189
|
+
} catch (error) {
|
|
190
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "mode_fetch_failed" });
|
|
185
191
|
return degradedFallback(apiKey);
|
|
186
192
|
}
|
|
187
193
|
};
|
|
@@ -5,19 +5,20 @@ import {
|
|
|
5
5
|
UsageError
|
|
6
6
|
} from "./chunk-7QLSKOSU.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
SETUP_AGENT_CHOICES,
|
|
9
|
+
SETUP_CONNECT_MODES,
|
|
10
|
+
isSetupConnectMode,
|
|
9
11
|
isValidApiKey
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CAS7GFWI.js";
|
|
11
13
|
|
|
12
14
|
// src/setup/options.ts
|
|
13
|
-
var AGENT_CHOICES =
|
|
14
|
-
var CONNECT_MODES = ["app", "browser", "web", "none"];
|
|
15
|
+
var AGENT_CHOICES = SETUP_AGENT_CHOICES;
|
|
15
16
|
var CONNECT_ALIASES = { auto: "app", pwa: "web" };
|
|
16
17
|
var parseConnectMode = (raw) => {
|
|
17
18
|
const value = raw.trim().toLowerCase();
|
|
18
19
|
if (Object.hasOwn(CONNECT_ALIASES, value)) return CONNECT_ALIASES[value];
|
|
19
|
-
if (
|
|
20
|
-
throw new UsageError(`--connect must be one of: ${
|
|
20
|
+
if (isSetupConnectMode(value)) return value;
|
|
21
|
+
throw new UsageError(`--connect must be one of: ${SETUP_CONNECT_MODES.join(", ")} (got ${raw})`);
|
|
21
22
|
};
|
|
22
23
|
var VERIFY_MODES = ["roundtrip", "push", "none"];
|
|
23
24
|
var parseVerifyMode = (raw) => {
|
|
@@ -2,21 +2,21 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GBL4BTG3.js";
|
|
6
6
|
import {
|
|
7
7
|
daemonHasRemoteProof,
|
|
8
8
|
daemonServiceManagerAvailable,
|
|
9
9
|
hasDaemonServiceDefinition,
|
|
10
10
|
readDaemonNeedsLogin,
|
|
11
11
|
readDaemonStatus
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
getMachineId
|
|
15
|
-
} from "./chunk-LH2N6VAN.js";
|
|
12
|
+
} from "./chunk-OZE2TQX5.js";
|
|
16
13
|
import {
|
|
17
14
|
readControlMode,
|
|
18
15
|
readKeySource
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-R4HVHTNA.js";
|
|
17
|
+
import {
|
|
18
|
+
getMachineId
|
|
19
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
20
20
|
import {
|
|
21
21
|
getBaseUrl
|
|
22
22
|
} from "./chunk-OSJEMXSR.js";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
HOOK_BUDGETS,
|
|
3
3
|
HOOK_LOCATOR_BINARY,
|
|
4
4
|
withHookHoldBudget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CAS7GFWI.js";
|
|
6
6
|
import {
|
|
7
7
|
isReleaseVersion
|
|
8
8
|
} from "./chunk-HWJW3CPO.js";
|
|
@@ -625,6 +625,7 @@ var bridgeAgentKey = () => join3(pusharyDir(), "bridge-auth", "agent-key.json");
|
|
|
625
625
|
var autoUpdateState = () => join3(pusharyDir(), "auto-update.json");
|
|
626
626
|
var autoUpdateLock = () => join3(pusharyDir(), "auto-update.lock");
|
|
627
627
|
var autoUpdateLog = () => join3(pusharyDir(), "logs", "auto-update.log");
|
|
628
|
+
var clientReportClaims = () => join3(pusharyDir(), "client-reports");
|
|
628
629
|
var claudeRegistrationReceipt = () => join3(pusharyDir(), "setup", "claude-registration.json");
|
|
629
630
|
var hermesConfigReceipt = () => join3(pusharyDir(), "setup", "hermes-config.json");
|
|
630
631
|
var hookTakeoverReceipt = (agent) => join3(pusharyDir(), "setup", `hook-takeover-${agent}.json`);
|
|
@@ -698,6 +699,7 @@ export {
|
|
|
698
699
|
autoUpdateState,
|
|
699
700
|
autoUpdateLock,
|
|
700
701
|
autoUpdateLog,
|
|
702
|
+
clientReportClaims,
|
|
701
703
|
claudeRegistrationReceipt,
|
|
702
704
|
hermesConfigReceipt,
|
|
703
705
|
hookTakeoverReceipt,
|
|
@@ -3,28 +3,28 @@ import {
|
|
|
3
3
|
addPusharyToolPermissions,
|
|
4
4
|
isPusharyHook,
|
|
5
5
|
removeClaudeMcpServers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZA5UXRNE.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_HOOK_EVENTS,
|
|
9
9
|
addGeminiMcpServer,
|
|
10
10
|
removeGeminiMcpServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7CLTSZOL.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CODE_AGENT,
|
|
14
14
|
parseApplyPatchFiles
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-H6XU22TN.js";
|
|
16
16
|
import {
|
|
17
17
|
guardBinary,
|
|
18
18
|
holdBudgetOf,
|
|
19
19
|
registerHookEntry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-K32C2RGK.js";
|
|
21
21
|
import {
|
|
22
22
|
PHONE_ANSWERED_TOOLS,
|
|
23
23
|
hookCompatibleProfile,
|
|
24
24
|
hookCompatibleProfileBySource,
|
|
25
25
|
toToolLookup,
|
|
26
26
|
withHookHoldBudget
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CAS7GFWI.js";
|
|
28
28
|
|
|
29
29
|
// src/compatible-config.ts
|
|
30
30
|
import { homedir } from "os";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3VZX4NSP.js";
|
|
4
4
|
import {
|
|
5
5
|
codexHomeFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K32C2RGK.js";
|
|
7
7
|
import {
|
|
8
8
|
HOOK_COMPATIBLE_PROFILES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CAS7GFWI.js";
|
|
10
10
|
|
|
11
11
|
// src/vscode-config.ts
|
|
12
12
|
import { homedir } from "os";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
permissionDeniedAction,
|
|
8
8
|
releaseThrottle,
|
|
9
9
|
reportEvent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H6XU22TN.js";
|
|
11
11
|
import {
|
|
12
12
|
canonicalJson
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K32C2RGK.js";
|
|
14
14
|
import {
|
|
15
15
|
writeFileAtomic
|
|
16
16
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
machineDecisionFor,
|
|
21
21
|
shouldDeferToNativeMode,
|
|
22
22
|
wireVerdictFor
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CAS7GFWI.js";
|
|
24
24
|
|
|
25
25
|
// src/machine-decision-audit.ts
|
|
26
26
|
import { basename } from "path";
|