@pushary/agent-hooks 1.9.42 → 1.9.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +1 -0
- package/data/SKILL.md +7 -1
- package/data/cowork/SKILL.md +3 -1
- package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
- package/data/cursor-plugin/skills/pushary/SKILL.md +6 -0
- package/data/vscode-plugin/skills/pushary/SKILL.md +6 -0
- package/dist/bin/pushary-bell-hook.js +27 -26
- package/dist/bin/pushary-bell.js +11 -11
- package/dist/bin/pushary-claude.js +30 -28
- package/dist/bin/pushary-clean.js +39 -38
- package/dist/bin/pushary-codex-bridge.js +38 -28
- package/dist/bin/pushary-codex-hook.js +35 -33
- package/dist/bin/pushary-codex-session.d.ts +1 -0
- package/dist/bin/pushary-codex-session.js +253 -0
- package/dist/bin/pushary-codex.js +13 -12
- package/dist/bin/pushary-connect.js +28 -27
- package/dist/bin/pushary-cowork.js +6 -6
- package/dist/bin/pushary-daemon.js +48 -47
- package/dist/bin/pushary-disconnect.js +27 -26
- package/dist/bin/pushary-doctor.js +85 -82
- package/dist/bin/pushary-elicitation-hook.js +27 -26
- package/dist/bin/pushary-gemini-bridge.js +22 -22
- package/dist/bin/pushary-gemini-hook.js +32 -30
- package/dist/bin/pushary-hook.js +33 -32
- package/dist/bin/pushary-login.js +16 -16
- package/dist/bin/pushary-logout.js +28 -27
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +14 -14
- package/dist/bin/pushary-notification-hook.js +26 -25
- package/dist/bin/pushary-opencode-hook.js +31 -29
- package/dist/bin/pushary-permission-denied-hook.js +31 -30
- package/dist/bin/pushary-permission-hook.js +30 -29
- package/dist/bin/pushary-post-hook.js +26 -25
- package/dist/bin/pushary-prompt-hook.js +26 -25
- package/dist/bin/pushary-session-end-hook.js +26 -25
- package/dist/bin/pushary-session-start-hook.js +31 -30
- package/dist/bin/pushary-setup.js +165 -112
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +35 -34
- package/dist/bin/pushary-stop-hook.js +26 -25
- package/dist/bin/pushary-stopfailure-hook.js +26 -25
- package/dist/bin/pushary-suggestions.js +14 -14
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +41 -40
- package/dist/bin/pushary-wait.js +14 -14
- package/dist/bin/pushary.js +7 -6
- package/dist/{chunk-ZX3PFROQ.js → chunk-2NVXFWQY.js} +1 -1
- package/dist/{chunk-7L6YSHZO.js → chunk-3IRC3XFG.js} +2 -2
- package/dist/{chunk-IXNVIWNN.js → chunk-42CVAOC5.js} +2 -2
- package/dist/{chunk-EBZK2SJ2.js → chunk-4JHEZ2PV.js} +12 -5
- package/dist/{chunk-JBK47Y2M.js → chunk-4WBAHVBK.js} +11 -11
- package/dist/{chunk-AW4TDBUJ.js → chunk-53UZN7JW.js} +3 -3
- package/dist/{chunk-I7EZMNKI.js → chunk-5ZSBQHCM.js} +12 -173
- package/dist/{chunk-KYFWYPHN.js → chunk-6EV3B5CD.js} +1 -1
- package/dist/{chunk-X7TNLYNZ.js → chunk-75M7NFFC.js} +1 -1
- package/dist/{chunk-AUDM6HU6.js → chunk-7UM4NCUI.js} +2 -2
- package/dist/{chunk-5INZFKHL.js → chunk-ALY7ZBNB.js} +1 -1
- package/dist/{chunk-CGRVIUKE.js → chunk-BKK3JCTD.js} +80 -164
- package/dist/{chunk-K2SSNAUW.js → chunk-CAJCCQ7N.js} +1 -1
- package/dist/{chunk-B7PZBWBU.js → chunk-CESLE4UN.js} +10 -10
- package/dist/{chunk-MI67QQEQ.js → chunk-CEZTYTBN.js} +13 -11
- package/dist/{chunk-6PABNQVH.js → chunk-DD6IBKEJ.js} +4 -4
- package/dist/{chunk-Z4RM54LU.js → chunk-E76QCZIA.js} +2 -2
- package/dist/{chunk-RBUCXUT7.js → chunk-FI2F5KZJ.js} +4 -4
- package/dist/{chunk-IVUP2EE4.js → chunk-FKDZU6YX.js} +4 -4
- package/dist/{chunk-EA5NWDK7.js → chunk-FYNMFSIZ.js} +29 -0
- package/dist/{chunk-M2YE3OEC.js → chunk-GBCR2FH2.js} +3 -3
- package/dist/chunk-GOEIW2VH.js +266 -0
- package/dist/{chunk-JQX2L3ES.js → chunk-GRAPJKDK.js} +1 -1
- package/dist/{chunk-DPISXMLL.js → chunk-HV4TEKNP.js} +4 -4
- package/dist/{chunk-FMYXPJYS.js → chunk-IWHDNMM3.js} +5 -5
- package/dist/{chunk-ORLTWJ2O.js → chunk-JNU3LV47.js} +355 -138
- package/dist/{chunk-ZJY4KON3.js → chunk-KILK6SWZ.js} +7 -7
- package/dist/{chunk-J7OBJZ5S.js → chunk-KYLY6UMN.js} +1 -1
- package/dist/{chunk-T3Q4B6WV.js → chunk-L2ZM7LXN.js} +2 -2
- package/dist/{chunk-PJ3C6IID.js → chunk-LEHBWBCG.js} +4 -4
- package/dist/{chunk-ODPULZZG.js → chunk-M2L7625S.js} +2 -2
- package/dist/{chunk-BDSIE2MT.js → chunk-MIBCRQWK.js} +2 -2
- package/dist/{chunk-MAB6CGL5.js → chunk-MRQJCIFO.js} +1 -1
- package/dist/{chunk-F43LAKAK.js → chunk-OR6KJOHE.js} +2 -2
- package/dist/{chunk-Y3HTWB5S.js → chunk-OSMNLNPF.js} +1 -1
- package/dist/{chunk-CHD6IUNM.js → chunk-OWQOMGBF.js} +1 -1
- package/dist/{chunk-RTM5GVRZ.js → chunk-OZ7MLVDM.js} +15 -15
- package/dist/{chunk-4WM7IVVQ.js → chunk-PGHN5D4N.js} +2 -2
- package/dist/{chunk-OLLWYLQX.js → chunk-PQAFH4DF.js} +3 -11
- package/dist/{chunk-E47JEBUR.js → chunk-RGBTKOCC.js} +45 -8
- package/dist/{chunk-4UCTKLHY.js → chunk-S2ALW446.js} +3 -3
- package/dist/{chunk-3U3FU6ZX.js → chunk-SI2NC6UU.js} +3 -3
- package/dist/chunk-SVCT5D7K.js +196 -0
- package/dist/{chunk-ZVMFRUBD.js → chunk-SWDPCDLT.js} +4 -4
- package/dist/{chunk-DIJ532S7.js → chunk-T3KMJI4W.js} +2 -1
- package/dist/{chunk-NRSTNZYJ.js → chunk-T4CKP47U.js} +5 -5
- package/dist/{chunk-M7VKFAAK.js → chunk-TJZUQRMH.js} +3 -3
- package/dist/{chunk-ZV56INA6.js → chunk-TKTS3SIM.js} +3 -3
- package/dist/{chunk-RETRVO47.js → chunk-TWATOPHK.js} +2 -2
- package/dist/{chunk-WZNRDDC4.js → chunk-UC4PNLMK.js} +6 -6
- package/dist/{chunk-ASXBYX2N.js → chunk-UJXLVH66.js} +1 -1
- package/dist/{chunk-Q3QRD67J.js → chunk-UY5E2UUW.js} +5 -5
- package/dist/{chunk-FP2ZJK3T.js → chunk-UZVF6MP2.js} +5 -5
- package/dist/{chunk-STETTN4K.js → chunk-W2TA4EVZ.js} +5 -5
- package/dist/{chunk-QRNNIDGY.js → chunk-WBD7HZEZ.js} +1 -1
- package/dist/{chunk-QPT4PTUG.js → chunk-WMO2XVG4.js} +1 -1
- package/dist/{chunk-BZIXDIIT.js → chunk-XPQDBTW4.js} +1 -1
- package/dist/{global-upgrade-YEAGJG4G.js → global-upgrade-QSSDYZCZ.js} +6 -6
- package/dist/{paths-HQAICWAF.js → paths-55DDFLY4.js} +2 -2
- package/dist/{reapply-XBEB2B5A.js → reapply-MEU66ALO.js} +23 -22
- package/dist/src/index.js +20 -19
- package/dist/{upgrade-lock-GIO5QZ7E.js → upgrade-lock-YLXAU4AD.js} +3 -3
- package/package.json +5 -2
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
outcomeOfFailedAsk,
|
|
5
5
|
reportMachineDenial,
|
|
6
6
|
storedWaitDeadline
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UC4PNLMK.js";
|
|
8
8
|
import {
|
|
9
9
|
isGatingMoment,
|
|
10
10
|
recordKeylessMoment
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GRAPJKDK.js";
|
|
12
12
|
import {
|
|
13
13
|
isDeferAnswer,
|
|
14
14
|
oncePerSession
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2NVXFWQY.js";
|
|
16
16
|
import {
|
|
17
17
|
activeHookSource,
|
|
18
18
|
activeIdentity
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FKDZU6YX.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_SESSION,
|
|
22
22
|
UNNAMED_ACTION,
|
|
@@ -37,11 +37,10 @@ import {
|
|
|
37
37
|
readLastPrompt,
|
|
38
38
|
readLastUserPrompt,
|
|
39
39
|
recordBlockedActionHint,
|
|
40
|
-
repoKeyFor,
|
|
41
40
|
reportEvent,
|
|
42
41
|
scopePathFor,
|
|
43
42
|
settleQuestionsForToolUse
|
|
44
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-BKK3JCTD.js";
|
|
45
44
|
import {
|
|
46
45
|
askUser,
|
|
47
46
|
cancelQuestion,
|
|
@@ -54,17 +53,20 @@ import {
|
|
|
54
53
|
sendNotification,
|
|
55
54
|
waitForQuestion,
|
|
56
55
|
waitsForThePhone
|
|
57
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-5ZSBQHCM.js";
|
|
57
|
+
import {
|
|
58
|
+
repoKeyFor
|
|
59
|
+
} from "./chunk-GOEIW2VH.js";
|
|
58
60
|
import {
|
|
59
61
|
getMachineId
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-WMO2XVG4.js";
|
|
61
63
|
import {
|
|
62
64
|
getApiKey,
|
|
63
65
|
getBaseUrl
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-OWQOMGBF.js";
|
|
65
67
|
import {
|
|
66
68
|
NPX_LATEST_COMMAND
|
|
67
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-T3KMJI4W.js";
|
|
68
70
|
import {
|
|
69
71
|
AGENT_QUESTION_STRATEGY,
|
|
70
72
|
AGENT_QUESTION_TOOL,
|
|
@@ -109,7 +111,7 @@ import {
|
|
|
109
111
|
resolveGate,
|
|
110
112
|
timeoutActionWithoutLocalPrompt,
|
|
111
113
|
unansweredRefusalReason
|
|
112
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-JNU3LV47.js";
|
|
113
115
|
|
|
114
116
|
// src/claude-permission-rules.ts
|
|
115
117
|
import { readFileSync, statSync } from "fs";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OZ7MLVDM.js";
|
|
4
4
|
import {
|
|
5
5
|
namedEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FKDZU6YX.js";
|
|
7
7
|
import {
|
|
8
8
|
writeDegraded
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GOEIW2VH.js";
|
|
10
10
|
import {
|
|
11
11
|
claudeShapedHookInput,
|
|
12
12
|
hookCompatibleProfileBySource,
|
|
13
13
|
isGrokHookPayload,
|
|
14
14
|
isGrokSessionEndStop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JNU3LV47.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"];
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
codexHooksJsonIn,
|
|
9
9
|
isPusharyCodexCommand,
|
|
10
10
|
resolvePathBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4JHEZ2PV.js";
|
|
12
12
|
import {
|
|
13
13
|
getPackageVersion
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JNU3LV47.js";
|
|
15
15
|
|
|
16
16
|
// src/codex-app-server.ts
|
|
17
17
|
import { existsSync, realpathSync } from "fs";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compatibleConfigFile,
|
|
3
3
|
hasCompatibleHooks
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FKDZU6YX.js";
|
|
5
5
|
import {
|
|
6
6
|
pusharyHookExecutable
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T4CKP47U.js";
|
|
8
8
|
import {
|
|
9
9
|
isProtectedByScope,
|
|
10
10
|
registerHookEntry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4JHEZ2PV.js";
|
|
12
12
|
import {
|
|
13
13
|
isRecord
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JNU3LV47.js";
|
|
15
15
|
|
|
16
16
|
// src/cursor-config.ts
|
|
17
17
|
var hookCommandOf = (entry) => {
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
addGeminiMcpServer,
|
|
4
4
|
removeGeminiMcpServer,
|
|
5
5
|
supportedClaudeEvents
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SI2NC6UU.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_CODE_AGENT,
|
|
9
9
|
compatibleToolLookup
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BKK3JCTD.js";
|
|
11
11
|
import {
|
|
12
12
|
guardBinary,
|
|
13
13
|
guardBinaryRefusing,
|
|
14
14
|
holdBudgetOf,
|
|
15
15
|
isProtectedByScope,
|
|
16
16
|
registerHookEntry
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4JHEZ2PV.js";
|
|
18
18
|
import {
|
|
19
19
|
HOOK_LOCATOR_BINARY,
|
|
20
20
|
PHONE_ANSWERED_TOOLS,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
pusharyMissingReason,
|
|
26
26
|
refusalOutput,
|
|
27
27
|
withHookHoldBudget
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JNU3LV47.js";
|
|
29
29
|
|
|
30
30
|
// src/claude-config.ts
|
|
31
31
|
import { join } from "path";
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readJsonSafe,
|
|
3
|
+
writeJsonAtomic
|
|
4
|
+
} from "./chunk-AQFEP65J.js";
|
|
5
|
+
import {
|
|
6
|
+
configFilePath
|
|
7
|
+
} from "./chunk-OWQOMGBF.js";
|
|
8
|
+
import {
|
|
9
|
+
readSetupOutcomeProperties
|
|
10
|
+
} from "./chunk-JNU3LV47.js";
|
|
11
|
+
|
|
1
12
|
// src/hooks-spec.ts
|
|
2
13
|
var CURSOR_GATE_SCRIPT = "pushary-gate.mjs";
|
|
3
14
|
|
|
@@ -39,7 +50,25 @@ var versionManagerOf = (execPath) => {
|
|
|
39
50
|
};
|
|
40
51
|
var describeVersionManagerPin = (execPath, manager) => `The background service is pinned to ${execPath}, which ${manager} manages. Switching Node versions strands it; run pushary daemon install afterwards.`;
|
|
41
52
|
|
|
53
|
+
// src/setup/failure-record.ts
|
|
54
|
+
import { dirname, join } from "path";
|
|
55
|
+
var failurePath = () => join(dirname(configFilePath()), "last-setup-failure.json");
|
|
56
|
+
var saveSetupFailure = (body, path = failurePath()) => {
|
|
57
|
+
const properties = readSetupOutcomeProperties(body);
|
|
58
|
+
if (properties.exitCode === null || properties.exitCode === 0) return;
|
|
59
|
+
writeJsonAtomic(path, { ...properties, recordedAt: (/* @__PURE__ */ new Date()).toISOString() }, 384);
|
|
60
|
+
};
|
|
61
|
+
var readSetupFailure = (path = failurePath()) => {
|
|
62
|
+
const result = readJsonSafe(path);
|
|
63
|
+
if (result.kind !== "ok" || typeof result.value !== "object" || result.value === null || Array.isArray(result.value)) return null;
|
|
64
|
+
const body = result.value;
|
|
65
|
+
if (!("recordedAt" in body) || typeof body.recordedAt !== "string" || body.recordedAt.length > 30 || !Number.isFinite(Date.parse(body.recordedAt))) return null;
|
|
66
|
+
return { ...readSetupOutcomeProperties({ ...body }), recordedAt: body.recordedAt };
|
|
67
|
+
};
|
|
68
|
+
|
|
42
69
|
export {
|
|
70
|
+
saveSetupFailure,
|
|
71
|
+
readSetupFailure,
|
|
43
72
|
CURSOR_GATE_SCRIPT,
|
|
44
73
|
readServiceExecPath,
|
|
45
74
|
versionManagerOf,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6EV3B5CD.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-T3KMJI4W.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-JNU3LV47.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/cowork.ts
|
|
23
23
|
import { readFileSync } from "fs";
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CLIENT_REPORT_DISABLE_ENV,
|
|
3
|
+
isDisabledByEnv
|
|
4
|
+
} from "./chunk-POFBE6ZY.js";
|
|
5
|
+
import {
|
|
6
|
+
isNetworkFailure
|
|
7
|
+
} from "./chunk-S2ALW446.js";
|
|
8
|
+
import {
|
|
9
|
+
clientReportClaims
|
|
10
|
+
} from "./chunk-4JHEZ2PV.js";
|
|
11
|
+
import {
|
|
12
|
+
getApiKey,
|
|
13
|
+
getBaseUrl
|
|
14
|
+
} from "./chunk-OWQOMGBF.js";
|
|
15
|
+
import {
|
|
16
|
+
CLIENT_REPORT_PATH,
|
|
17
|
+
degradedLine,
|
|
18
|
+
localRepoKey,
|
|
19
|
+
normalizeRepoRemote
|
|
20
|
+
} from "./chunk-JNU3LV47.js";
|
|
21
|
+
|
|
22
|
+
// src/client-report-claim.ts
|
|
23
|
+
import { createHash } from "crypto";
|
|
24
|
+
import { closeSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
|
|
25
|
+
import { join } from "path";
|
|
26
|
+
var CLIENT_REPORT_WINDOW_MS = 6e4;
|
|
27
|
+
var CLAIM_DIRECTORY_MODE = 448;
|
|
28
|
+
var CLAIM_FILE_MODE = 384;
|
|
29
|
+
var CLAIM_KEY_HASH_LENGTH = 16;
|
|
30
|
+
var CLAIM_FILE_PATTERN = /^[0-9a-f]{16}-(\d+)$/;
|
|
31
|
+
var EXCLUSIVE_CREATE = "wx";
|
|
32
|
+
var ALREADY_EXISTS = "EEXIST";
|
|
33
|
+
var WINDOWS_KEPT_BEHIND = 1;
|
|
34
|
+
var reportWindowOf = (now) => Math.floor(now / CLIENT_REPORT_WINDOW_MS);
|
|
35
|
+
var claimFileName = (key, window) => `${createHash("sha256").update(key).digest("hex").slice(0, CLAIM_KEY_HASH_LENGTH)}-${window}`;
|
|
36
|
+
var errorCodeOf = (error) => typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : null;
|
|
37
|
+
var claimWindowOf = (fileName) => {
|
|
38
|
+
const match = CLAIM_FILE_PATTERN.exec(fileName);
|
|
39
|
+
return match ? Number(match[1]) : null;
|
|
40
|
+
};
|
|
41
|
+
var isStaleClaim = (fileName, window) => {
|
|
42
|
+
const claimedWindow = claimWindowOf(fileName);
|
|
43
|
+
return claimedWindow !== null && claimedWindow < window - WINDOWS_KEPT_BEHIND;
|
|
44
|
+
};
|
|
45
|
+
var removeQuietly = (filePath) => {
|
|
46
|
+
try {
|
|
47
|
+
unlinkSync(filePath);
|
|
48
|
+
} catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var removeStaleClaims = (claimsDir, window) => {
|
|
53
|
+
try {
|
|
54
|
+
for (const fileName of readdirSync(claimsDir)) {
|
|
55
|
+
if (isStaleClaim(fileName, window)) removeQuietly(join(claimsDir, fileName));
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var claimReportWindow = (claimsDir, key, now) => {
|
|
62
|
+
const window = reportWindowOf(now);
|
|
63
|
+
try {
|
|
64
|
+
mkdirSync(claimsDir, { recursive: true, mode: CLAIM_DIRECTORY_MODE });
|
|
65
|
+
closeSync(openSync(join(claimsDir, claimFileName(key, window)), EXCLUSIVE_CREATE, CLAIM_FILE_MODE));
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return errorCodeOf(error) === ALREADY_EXISTS ? "already_claimed" : "unavailable";
|
|
68
|
+
}
|
|
69
|
+
removeStaleClaims(claimsDir, window);
|
|
70
|
+
return "claimed";
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/client-report.ts
|
|
74
|
+
var CLIENT_REPORT_TIMEOUT_MS = 1e3;
|
|
75
|
+
var readApiKey = () => {
|
|
76
|
+
try {
|
|
77
|
+
return getApiKey();
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var defaultDeps = () => ({
|
|
83
|
+
disabled: () => isDisabledByEnv(process.env, CLIENT_REPORT_DISABLE_ENV),
|
|
84
|
+
fetchImpl: fetch,
|
|
85
|
+
apiKey: readApiKey,
|
|
86
|
+
baseUrl: getBaseUrl,
|
|
87
|
+
now: Date.now,
|
|
88
|
+
claimsDir: clientReportClaims()
|
|
89
|
+
});
|
|
90
|
+
var reportKey = (event) => `${event.kind}:${event.code}`;
|
|
91
|
+
var createClientErrorReporter = (deps) => {
|
|
92
|
+
const windowClaimedInProcess = /* @__PURE__ */ new Map();
|
|
93
|
+
const claimInProcess = (key, now) => {
|
|
94
|
+
if (windowClaimedInProcess.get(key) === reportWindowOf(now)) return false;
|
|
95
|
+
windowClaimedInProcess.set(key, reportWindowOf(now));
|
|
96
|
+
return true;
|
|
97
|
+
};
|
|
98
|
+
const claimReport = (key, now) => {
|
|
99
|
+
const claim = claimReportWindow(deps.claimsDir, key, now);
|
|
100
|
+
return claim === "unavailable" ? claimInProcess(key, now) : claim === "claimed";
|
|
101
|
+
};
|
|
102
|
+
return async (event) => {
|
|
103
|
+
try {
|
|
104
|
+
if (deps.disabled()) return;
|
|
105
|
+
const apiKey = deps.apiKey();
|
|
106
|
+
const now = deps.now();
|
|
107
|
+
if (!apiKey || !claimReport(reportKey(event), now)) return;
|
|
108
|
+
await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
|
|
109
|
+
method: "POST",
|
|
110
|
+
headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
111
|
+
body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
|
|
112
|
+
signal: AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS)
|
|
113
|
+
});
|
|
114
|
+
} catch {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
var processReporter = null;
|
|
120
|
+
var inFlightReports = /* @__PURE__ */ new Set();
|
|
121
|
+
var reportClientError = (event) => {
|
|
122
|
+
processReporter ??= createClientErrorReporter(defaultDeps());
|
|
123
|
+
const report = processReporter(event);
|
|
124
|
+
inFlightReports.add(report);
|
|
125
|
+
void report.finally(() => inFlightReports.delete(report));
|
|
126
|
+
return report;
|
|
127
|
+
};
|
|
128
|
+
var exitAfterClientReports = async (code) => {
|
|
129
|
+
await Promise.all(inFlightReports);
|
|
130
|
+
return process.exit(code);
|
|
131
|
+
};
|
|
132
|
+
var clientErrorKindOf = (error) => isNetworkFailure(error) ? "network" : "unexpected";
|
|
133
|
+
var writeDegraded = (subsystem, report) => {
|
|
134
|
+
process.stderr.write(`${degradedLine(subsystem, report)}
|
|
135
|
+
`);
|
|
136
|
+
void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/repo.ts
|
|
140
|
+
import { existsSync, readFileSync, statSync } from "fs";
|
|
141
|
+
import { basename, dirname, isAbsolute, join as join2, resolve } from "path";
|
|
142
|
+
var MAX_PARENT_WALK = 64;
|
|
143
|
+
var GIT_FILE_PREFIX = "gitdir:";
|
|
144
|
+
var findGitDir = (startDir) => {
|
|
145
|
+
let current = resolve(startDir);
|
|
146
|
+
for (let depth = 0; depth < MAX_PARENT_WALK; depth += 1) {
|
|
147
|
+
const candidate = join2(current, ".git");
|
|
148
|
+
try {
|
|
149
|
+
if (existsSync(candidate)) {
|
|
150
|
+
if (statSync(candidate).isDirectory()) return candidate;
|
|
151
|
+
const pointer = readFileSync(candidate, "utf-8").trim();
|
|
152
|
+
if (pointer.startsWith(GIT_FILE_PREFIX)) {
|
|
153
|
+
const target = pointer.slice(GIT_FILE_PREFIX.length).trim();
|
|
154
|
+
return isAbsolute(target) ? target : resolve(current, target);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch {
|
|
158
|
+
}
|
|
159
|
+
const parent = dirname(current);
|
|
160
|
+
if (parent === current) return void 0;
|
|
161
|
+
current = parent;
|
|
162
|
+
}
|
|
163
|
+
return void 0;
|
|
164
|
+
};
|
|
165
|
+
var configPathFor = (gitDir) => {
|
|
166
|
+
const index = gitDir.replace(/\\/g, "/").indexOf("/worktrees/");
|
|
167
|
+
return index === -1 ? join2(gitDir, "config") : join2(gitDir.slice(0, index), "config");
|
|
168
|
+
};
|
|
169
|
+
var ORIGIN_SECTION = /^\[remote "origin"\]/;
|
|
170
|
+
var SECTION_HEADER = /^\[/;
|
|
171
|
+
var URL_LINE = /^url\s*=\s*(.+)$/;
|
|
172
|
+
var readOriginRemote = (gitDir) => {
|
|
173
|
+
try {
|
|
174
|
+
const configPath = configPathFor(gitDir);
|
|
175
|
+
if (!existsSync(configPath)) return void 0;
|
|
176
|
+
let inOrigin = false;
|
|
177
|
+
for (const rawLine of readFileSync(configPath, "utf-8").split("\n")) {
|
|
178
|
+
const line = rawLine.trim();
|
|
179
|
+
if (SECTION_HEADER.test(line)) {
|
|
180
|
+
inOrigin = ORIGIN_SECTION.test(line);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (!inOrigin) continue;
|
|
184
|
+
const url = URL_LINE.exec(line);
|
|
185
|
+
if (url) return url[1]?.trim();
|
|
186
|
+
}
|
|
187
|
+
} catch {
|
|
188
|
+
}
|
|
189
|
+
return void 0;
|
|
190
|
+
};
|
|
191
|
+
var deriveRepoKey = (cwd) => {
|
|
192
|
+
const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
|
|
193
|
+
try {
|
|
194
|
+
const gitDir = findGitDir(dir);
|
|
195
|
+
if (gitDir) {
|
|
196
|
+
const remote = readOriginRemote(gitDir);
|
|
197
|
+
const normalized = remote ? normalizeRepoRemote(remote) : void 0;
|
|
198
|
+
if (normalized) return normalized;
|
|
199
|
+
const root = gitDir.endsWith(".git") ? dirname(gitDir) : dir;
|
|
200
|
+
return localRepoKey(basename(root));
|
|
201
|
+
}
|
|
202
|
+
return localRepoKey(basename(resolve(dir)));
|
|
203
|
+
} catch {
|
|
204
|
+
return void 0;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var repoKeyCache = /* @__PURE__ */ new Map();
|
|
208
|
+
var REPO_KEY_ENV = "PUSHARY_REPO_KEY";
|
|
209
|
+
var repoKeyFor = (cwd) => {
|
|
210
|
+
const override = process.env[REPO_KEY_ENV];
|
|
211
|
+
if (typeof override === "string") {
|
|
212
|
+
const trimmed = override.trim();
|
|
213
|
+
if (trimmed.toLowerCase() === "off") return void 0;
|
|
214
|
+
if (trimmed.length > 0) return trimmed.toLowerCase();
|
|
215
|
+
}
|
|
216
|
+
const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
|
|
217
|
+
if (repoKeyCache.has(dir)) return repoKeyCache.get(dir);
|
|
218
|
+
const derived = deriveRepoKey(dir);
|
|
219
|
+
repoKeyCache.set(dir, derived);
|
|
220
|
+
return derived;
|
|
221
|
+
};
|
|
222
|
+
|
|
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
|
+
export {
|
|
256
|
+
reportClientError,
|
|
257
|
+
exitAfterClientReports,
|
|
258
|
+
clientErrorKindOf,
|
|
259
|
+
writeDegraded,
|
|
260
|
+
isPolicyConfig,
|
|
261
|
+
isAskUserResponse,
|
|
262
|
+
isWaitForAnswerResponse,
|
|
263
|
+
isGateReply,
|
|
264
|
+
isBlockedActionClaim,
|
|
265
|
+
repoKeyFor
|
|
266
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UZVF6MP2.js";
|
|
4
4
|
import {
|
|
5
5
|
grokHome
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FKDZU6YX.js";
|
|
7
7
|
import {
|
|
8
8
|
codexHomeFrom,
|
|
9
9
|
resolvePathBinary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4JHEZ2PV.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_COMPATIBLE_PROFILES
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JNU3LV47.js";
|
|
14
14
|
|
|
15
15
|
// src/hermes-config.ts
|
|
16
16
|
import { execFileSync } from "child_process";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
APPROVAL_SETTINGS_PATH
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SWDPCDLT.js";
|
|
4
4
|
import {
|
|
5
5
|
readMacAppAgentKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LEHBWBCG.js";
|
|
7
7
|
import {
|
|
8
8
|
findExportedKeyLines,
|
|
9
9
|
isAdoptedMacAppKey,
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
readConfigFileKey,
|
|
14
14
|
readKeySource,
|
|
15
15
|
readMacAppKeyPrefix
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TJZUQRMH.js";
|
|
17
17
|
import {
|
|
18
18
|
absoluteUrl
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TKTS3SIM.js";
|
|
20
20
|
import {
|
|
21
21
|
isValidApiKey
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JNU3LV47.js";
|
|
23
23
|
|
|
24
24
|
// src/key-revocation.ts
|
|
25
25
|
var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
|