@pushary/agent-hooks 0.95.4 → 0.95.5
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 +7 -0
- package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
- package/data/cursor-plugin/CHANGELOG.md +5 -0
- package/data/cursor-plugin/README.md +1 -1
- package/data/cursor-plugin/scripts/pushary-gate.mjs +5 -2
- package/data/vscode-plugin/.claude-plugin/plugin.json +1 -1
- package/data/vscode-plugin/CHANGELOG.md +5 -0
- package/data/vscode-plugin/README.md +1 -1
- package/data/vscode-plugin/scripts/pushary-gate.mjs +14 -3
- package/dist/bin/pushary-bell-hook.js +20 -20
- package/dist/bin/pushary-bell.js +7 -7
- package/dist/bin/pushary-claude.js +29 -24
- package/dist/bin/pushary-clean.js +18 -18
- package/dist/bin/pushary-codex-bridge.js +10 -10
- package/dist/bin/pushary-codex-hook.js +24 -24
- package/dist/bin/pushary-codex.js +8 -8
- package/dist/bin/pushary-connect.js +6 -6
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +24 -24
- package/dist/bin/pushary-disconnect.js +9 -8
- package/dist/bin/pushary-doctor.js +20 -20
- package/dist/bin/pushary-elicitation-hook.js +20 -20
- package/dist/bin/pushary-gemini-bridge.js +9 -9
- package/dist/bin/pushary-gemini-hook.js +23 -23
- package/dist/bin/pushary-hook.js +25 -25
- package/dist/bin/pushary-login.js +7 -7
- package/dist/bin/pushary-logout.js +4 -4
- package/dist/bin/pushary-mode.js +3 -3
- package/dist/bin/pushary-notification-hook.js +22 -22
- package/dist/bin/pushary-opencode-hook.js +23 -23
- package/dist/bin/pushary-permission-denied-hook.js +25 -25
- package/dist/bin/pushary-permission-hook.js +25 -25
- package/dist/bin/pushary-post-hook.js +22 -22
- package/dist/bin/pushary-prompt-hook.js +22 -22
- package/dist/bin/pushary-session-end-hook.js +22 -22
- package/dist/bin/pushary-session-start-hook.js +25 -25
- package/dist/bin/pushary-setup.js +41 -28
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +8 -8
- package/dist/bin/pushary-stop-hook.js +22 -22
- package/dist/bin/pushary-stopfailure-hook.js +22 -22
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +5 -5
- package/dist/bin/pushary-upgrade.js +15 -15
- package/dist/bin/pushary-wait.js +3 -3
- package/dist/{chunk-TKA2L2BU.js → chunk-2D7BAOMY.js} +5 -5
- package/dist/{chunk-MDDKA4QM.js → chunk-2ZTL3PGN.js} +1 -1
- package/dist/{chunk-J6NAWJTQ.js → chunk-32RMQO5Z.js} +1 -1
- package/dist/{chunk-GGX5QTBG.js → chunk-3AJIK5AO.js} +4 -1
- package/dist/{chunk-JDNW6FTV.js → chunk-4PX4QK2Z.js} +1 -1
- package/dist/{chunk-4NJURLRP.js → chunk-4RF52LSU.js} +8 -8
- package/dist/{chunk-U24ERDPE.js → chunk-67YNQ3QA.js} +9 -15
- package/dist/{chunk-TR6DBXO3.js → chunk-6AEM5RCS.js} +1 -1
- package/dist/{chunk-XDHJ4KZJ.js → chunk-6VANQN5Q.js} +2 -2
- package/dist/{chunk-LVU3Q43J.js → chunk-BDI2MXTT.js} +1 -1
- package/dist/{chunk-ZKDQ3QRP.js → chunk-BMANRGJQ.js} +1 -1
- package/dist/{chunk-HTWQH3VI.js → chunk-CUEZMPLJ.js} +1 -1
- package/dist/{chunk-AGQA72IH.js → chunk-D62EONG3.js} +1 -1
- package/dist/{chunk-HJYGC7IR.js → chunk-GOPIMNVC.js} +1 -1
- package/dist/{chunk-TMOCSYJK.js → chunk-HBHEX3JQ.js} +3 -3
- package/dist/{chunk-MQO7J2OJ.js → chunk-HCMM3BOW.js} +7 -7
- package/dist/{chunk-CVZP67ST.js → chunk-HGUZOUB2.js} +4 -4
- package/dist/{chunk-PFRLYYF6.js → chunk-HQIVR7MM.js} +1 -1
- package/dist/{chunk-KT2CGUOE.js → chunk-I6GZX3FT.js} +1 -1
- package/dist/{chunk-3OXHYPZG.js → chunk-IM2A5H33.js} +4 -1
- package/dist/{chunk-YE37HYN3.js → chunk-IVQMNLSA.js} +3 -14
- package/dist/{chunk-MNWDOXX6.js → chunk-KAVDAZ7A.js} +1 -1
- package/dist/{chunk-JAKWHALW.js → chunk-KI4PA7MQ.js} +1 -1
- package/dist/{chunk-O7ODXFII.js → chunk-N4VNLISN.js} +2 -2
- package/dist/{chunk-V4G7BQZ6.js → chunk-OEKFD5BC.js} +1 -1
- package/dist/{chunk-TGORRMOU.js → chunk-OI3DJA7N.js} +1 -1
- package/dist/{chunk-W5GH5GTX.js → chunk-OW6AZDY2.js} +1 -1
- package/dist/{chunk-7W6E3C3I.js → chunk-QHWXUNMN.js} +1 -1
- package/dist/{chunk-6BNBW3M2.js → chunk-QQGNFHIK.js} +2 -2
- package/dist/{chunk-XIVPHGV4.js → chunk-RLXVW4AM.js} +1 -1
- package/dist/{chunk-3N4FT4WQ.js → chunk-S5CMLR35.js} +1 -1
- package/dist/{chunk-EEJ6EQMI.js → chunk-UCS65VVR.js} +1 -1
- package/dist/{chunk-MZOTKCNZ.js → chunk-VOSGZ6PH.js} +4 -4
- package/dist/{chunk-J5KTLGO5.js → chunk-VTO3TNIB.js} +1 -1
- package/dist/{chunk-7VVX6HQG.js → chunk-WDKHZRAS.js} +178 -17
- package/dist/{chunk-HPM47TEO.js → chunk-WRDLHR2F.js} +2 -2
- package/dist/{chunk-ND52YE7L.js → chunk-XLOELLAS.js} +4 -4
- package/dist/{chunk-2BE7ZVWP.js → chunk-XS33QBJA.js} +15 -3
- package/dist/{chunk-57NOPUBK.js → chunk-Z2UWFEJW.js} +8 -8
- package/dist/src/index.js +11 -11
- package/package.json +1 -1
|
@@ -21,6 +21,166 @@ var COWORK_STANDING_INSTRUCTIONS = `Pushary is connected as a custom connector.
|
|
|
21
21
|
- Cancel a question when it is no longer needed. Once this turn ends, reopen Cowork for follow-up work; this connector cannot restart it.
|
|
22
22
|
- If Pushary tools are missing or disabled, report that once and continue within my authorization. Do not claim a notification or approval was delivered.`;
|
|
23
23
|
|
|
24
|
+
// ../contracts/src/agent-manifest.ts
|
|
25
|
+
var defaults = {
|
|
26
|
+
hasStoredIdentity: true,
|
|
27
|
+
hookSource: null,
|
|
28
|
+
policyAgent: null,
|
|
29
|
+
repoAware: false,
|
|
30
|
+
disconnectable: false,
|
|
31
|
+
managedProvider: false,
|
|
32
|
+
enforcement: "cooperative",
|
|
33
|
+
connectVia: "Plain MCP",
|
|
34
|
+
setupCommand: null,
|
|
35
|
+
setupChoice: null,
|
|
36
|
+
setupGuide: "",
|
|
37
|
+
enforcementDetail: "Cooperative. The agent chooses when to ask; no native permission interception.",
|
|
38
|
+
capabilityNote: "",
|
|
39
|
+
documented: true
|
|
40
|
+
};
|
|
41
|
+
var AGENTS = {
|
|
42
|
+
claude_code: {
|
|
43
|
+
...defaults,
|
|
44
|
+
label: "Claude Code",
|
|
45
|
+
hookSource: "claude",
|
|
46
|
+
policyAgent: "claude_code",
|
|
47
|
+
repoAware: true,
|
|
48
|
+
disconnectable: true,
|
|
49
|
+
managedProvider: true,
|
|
50
|
+
enforcement: "enforced",
|
|
51
|
+
connectVia: "Native hooks + MCP",
|
|
52
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
53
|
+
enforcementDetail: "Shell, writes and edits, subject to Claude Code permission mode and explicit policy."
|
|
54
|
+
},
|
|
55
|
+
claude_chat: {
|
|
56
|
+
...defaults,
|
|
57
|
+
label: "Claude Chat",
|
|
58
|
+
connectVia: "Custom MCP connector",
|
|
59
|
+
setupGuide: "[Claude.ai and Claude Desktop setup](/docs/agents/guides/claude-desktop)"
|
|
60
|
+
},
|
|
61
|
+
claude_cowork: {
|
|
62
|
+
...defaults,
|
|
63
|
+
label: "Claude Cowork",
|
|
64
|
+
connectVia: "Custom MCP connector + optional Cowork skill",
|
|
65
|
+
setupGuide: "[Cowork setup](/docs/agents/guides/claude-desktop#use-it-in-cowork)",
|
|
66
|
+
enforcementDetail: COWORK_CONNECTOR_LIMIT
|
|
67
|
+
},
|
|
68
|
+
codex: {
|
|
69
|
+
...defaults,
|
|
70
|
+
label: "Codex",
|
|
71
|
+
hookSource: "codex",
|
|
72
|
+
policyAgent: "codex",
|
|
73
|
+
repoAware: true,
|
|
74
|
+
disconnectable: true,
|
|
75
|
+
managedProvider: true,
|
|
76
|
+
enforcement: "enforced",
|
|
77
|
+
connectVia: "Native hooks + MCP",
|
|
78
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
79
|
+
enforcementDetail: "Shell and apply_patch edits through native permission hooks; requires a compatible Codex runtime."
|
|
80
|
+
},
|
|
81
|
+
chatgpt: {
|
|
82
|
+
...defaults,
|
|
83
|
+
label: "ChatGPT",
|
|
84
|
+
connectVia: "Custom MCP connector",
|
|
85
|
+
setupGuide: "[ChatGPT setup](/docs/agents/guides/chatgpt)"
|
|
86
|
+
},
|
|
87
|
+
gemini_cli: {
|
|
88
|
+
...defaults,
|
|
89
|
+
label: "Gemini CLI",
|
|
90
|
+
hookSource: "gemini",
|
|
91
|
+
policyAgent: "gemini_cli",
|
|
92
|
+
repoAware: true,
|
|
93
|
+
disconnectable: true,
|
|
94
|
+
managedProvider: true,
|
|
95
|
+
enforcement: "enforced",
|
|
96
|
+
connectVia: "Native hooks + MCP",
|
|
97
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
98
|
+
enforcementDetail: "Shell, writes and edits through native BeforeTool hooks."
|
|
99
|
+
},
|
|
100
|
+
hermes: {
|
|
101
|
+
...defaults,
|
|
102
|
+
label: "Hermes",
|
|
103
|
+
policyAgent: "hermes",
|
|
104
|
+
enforcement: "enforced",
|
|
105
|
+
connectVia: "Native Python plugin + approval transport",
|
|
106
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
107
|
+
enforcementDetail: "Hermes dangerous-command approvals when the Pushary transport is selected; optional PUSHARY_GATE_TOOLS gates named tools.",
|
|
108
|
+
capabilityNote: "Uses the Python plugin, not a macOS bridge HookSource. CLI disconnect and managed-provider controls are not implemented for Hermes."
|
|
109
|
+
},
|
|
110
|
+
cursor: {
|
|
111
|
+
...defaults,
|
|
112
|
+
label: "Cursor",
|
|
113
|
+
hookSource: "cursor",
|
|
114
|
+
policyAgent: "cursor",
|
|
115
|
+
disconnectable: true,
|
|
116
|
+
enforcement: "enforced",
|
|
117
|
+
connectVia: "Editor plugin hooks + MCP",
|
|
118
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
119
|
+
enforcementDetail: "With installed hooks: shell, MCP execution and Write/Delete/Edit tool calls. Plain MCP remains cooperative."
|
|
120
|
+
},
|
|
121
|
+
vscode: {
|
|
122
|
+
...defaults,
|
|
123
|
+
label: "VS Code",
|
|
124
|
+
hookSource: "vscode",
|
|
125
|
+
policyAgent: "vscode",
|
|
126
|
+
enforcement: "enforced",
|
|
127
|
+
connectVia: "Agent plugin hooks + MCP",
|
|
128
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
129
|
+
enforcementDetail: "PreToolUse approval hooks from the installed agent plugin; the host decides which events it exposes.",
|
|
130
|
+
capabilityNote: "Has both a bridge HookSource and a per-agent policy profile. CLI disconnect and managed-provider controls are not implemented for VS Code."
|
|
131
|
+
},
|
|
132
|
+
opencode: {
|
|
133
|
+
...defaults,
|
|
134
|
+
label: "OpenCode",
|
|
135
|
+
hookSource: "opencode",
|
|
136
|
+
policyAgent: "opencode",
|
|
137
|
+
repoAware: true,
|
|
138
|
+
disconnectable: true,
|
|
139
|
+
enforcement: "enforced",
|
|
140
|
+
connectVia: "Generated plugin + MCP",
|
|
141
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
142
|
+
enforcementDetail: "Shell, writes, edits and web fetches when OpenCode itself asks for permission."
|
|
143
|
+
},
|
|
144
|
+
windsurf: {
|
|
145
|
+
...defaults,
|
|
146
|
+
label: "Windsurf",
|
|
147
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
148
|
+
setupChoice: "Other"
|
|
149
|
+
},
|
|
150
|
+
unknown: {
|
|
151
|
+
...defaults,
|
|
152
|
+
label: "Agent",
|
|
153
|
+
documented: false
|
|
154
|
+
},
|
|
155
|
+
lovable: {
|
|
156
|
+
...defaults,
|
|
157
|
+
label: "Lovable",
|
|
158
|
+
setupGuide: "[Lovable setup](/docs/agents/guides/lovable)"
|
|
159
|
+
},
|
|
160
|
+
mcp: {
|
|
161
|
+
...defaults,
|
|
162
|
+
hasStoredIdentity: false,
|
|
163
|
+
label: "Any MCP client",
|
|
164
|
+
setupCommand: "npx @pushary/agent-hooks setup",
|
|
165
|
+
setupChoice: "Other"
|
|
166
|
+
},
|
|
167
|
+
http: {
|
|
168
|
+
...defaults,
|
|
169
|
+
hasStoredIdentity: false,
|
|
170
|
+
label: "No-code and HTTP",
|
|
171
|
+
connectVia: "REST with a Bearer token",
|
|
172
|
+
setupGuide: "[Connect any agent](/docs/agents/connect-any-agent)"
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var HOOK_SOURCES = Object.freeze(Object.values(AGENTS).flatMap((agent) => agent.hookSource === null ? [] : [agent.hookSource]));
|
|
176
|
+
var POLICY_AGENTS = [...Object.values(AGENTS).flatMap((agent) => agent.policyAgent === null ? [] : [agent.policyAgent]), "*"];
|
|
177
|
+
var AGENT_LABELS_BY_TYPE = Object.fromEntries(
|
|
178
|
+
Object.entries(AGENTS).flatMap(([id, agent]) => agent.hasStoredIdentity ? [[id, agent.label]] : [])
|
|
179
|
+
);
|
|
180
|
+
var DISCONNECTABLE_AGENTS = Object.freeze(Object.values(AGENTS).flatMap((agent) => agent.disconnectable ? [agent.hookSource] : []));
|
|
181
|
+
var REPO_AWARE_AGENTS = Object.freeze(Object.values(AGENTS).flatMap((agent) => agent.repoAware ? [agent.policyAgent] : []));
|
|
182
|
+
var MANAGED_PROVIDERS = Object.freeze(Object.values(AGENTS).flatMap((agent) => agent.managedProvider ? [agent.hookSource] : []));
|
|
183
|
+
|
|
24
184
|
// ../contracts/src/index.ts
|
|
25
185
|
var KEY_SCOPES = ["full_access", "agent", "connector", "bound"];
|
|
26
186
|
var normalizeKeyScope = (value) => typeof value === "string" && KEY_SCOPES.includes(value) ? value : null;
|
|
@@ -140,21 +300,6 @@ var hookWaitDeadline = (startMs, policyWaitSeconds, agent, nowMs) => {
|
|
|
140
300
|
};
|
|
141
301
|
var hookWaitClamped = (startMs, policyWaitSeconds, agent, nowMs) => startMs + hookMaxWaitSeconds(agent) * 1e3 < nowMs + Math.max(policyWaitSeconds, 0) * 1e3;
|
|
142
302
|
var effectiveWaitSeconds = (timeoutAction, policySeconds, agent) => timeoutAction === "wait" ? hookMaxWaitSeconds(agent) : policySeconds;
|
|
143
|
-
var HOOK_SOURCES = ["claude", "codex", "gemini", "cursor", "vscode", "opencode"];
|
|
144
|
-
var AGENT_LABELS_BY_TYPE = {
|
|
145
|
-
claude_code: "Claude Code",
|
|
146
|
-
claude_chat: "Claude Chat",
|
|
147
|
-
claude_cowork: "Claude Cowork",
|
|
148
|
-
codex: "Codex",
|
|
149
|
-
chatgpt: "ChatGPT",
|
|
150
|
-
gemini_cli: "Gemini CLI",
|
|
151
|
-
hermes: "Hermes",
|
|
152
|
-
cursor: "Cursor",
|
|
153
|
-
vscode: "VS Code",
|
|
154
|
-
opencode: "OpenCode",
|
|
155
|
-
windsurf: "Windsurf",
|
|
156
|
-
unknown: "Agent"
|
|
157
|
-
};
|
|
158
303
|
var OPENCODE_APPROVAL_EVENT = "permission.ask";
|
|
159
304
|
var CURSOR_GATE_EVENTS = ["beforeShellExecution", "beforeMCPExecution", "preToolUse"];
|
|
160
305
|
var HOOK_LOCATOR_BINARY = "pushary-bridge";
|
|
@@ -1111,6 +1256,17 @@ var shouldDeferToNativeMode = (permissionMode, toolName, options = {}) => {
|
|
|
1111
1256
|
var ASKED_IN_EVERY_MODE_TOOLS = ["AskUserQuestion", "ExitPlanMode"];
|
|
1112
1257
|
var ASKED_IN_EVERY_MODE = new Set(ASKED_IN_EVERY_MODE_TOOLS);
|
|
1113
1258
|
var isAskedInEveryMode = (toolName) => ASKED_IN_EVERY_MODE.has(toolName);
|
|
1259
|
+
var PRETOOLUSE_GATED_TOOLS = [
|
|
1260
|
+
"Bash",
|
|
1261
|
+
"Write",
|
|
1262
|
+
"Edit",
|
|
1263
|
+
"MultiEdit",
|
|
1264
|
+
"NotebookEdit",
|
|
1265
|
+
"PowerShell",
|
|
1266
|
+
"Monitor"
|
|
1267
|
+
];
|
|
1268
|
+
var PRETOOLUSE_HANDLED_TOOLS = /* @__PURE__ */ new Set([...PRETOOLUSE_GATED_TOOLS, ...ASKED_IN_EVERY_MODE_TOOLS]);
|
|
1269
|
+
var isPermissionRequestOwnedByPreToolUse = (toolName, permissionMode, defers = shouldDeferToNativeMode) => PRETOOLUSE_HANDLED_TOOLS.has(toolName) && (isAskedInEveryMode(toolName) || !defers(permissionMode, toolName));
|
|
1114
1270
|
var resolveGate = (input) => {
|
|
1115
1271
|
const { modeState, config, toolName, toolInputs, cwd, repoKey, sessionId } = input;
|
|
1116
1272
|
if (isPusharyOwnTool(toolName)) {
|
|
@@ -1375,6 +1531,11 @@ export {
|
|
|
1375
1531
|
CLAUDE_CONNECTOR_STEPS,
|
|
1376
1532
|
CLAUDE_CONNECTOR_TEST,
|
|
1377
1533
|
COWORK_STANDING_INSTRUCTIONS,
|
|
1534
|
+
HOOK_SOURCES,
|
|
1535
|
+
AGENT_LABELS_BY_TYPE,
|
|
1536
|
+
DISCONNECTABLE_AGENTS,
|
|
1537
|
+
REPO_AWARE_AGENTS,
|
|
1538
|
+
MANAGED_PROVIDERS,
|
|
1378
1539
|
normalizeKeyScope,
|
|
1379
1540
|
parseAgentQuestion,
|
|
1380
1541
|
parseAgentQuestions,
|
|
@@ -1384,8 +1545,6 @@ export {
|
|
|
1384
1545
|
hookWaitDeadline,
|
|
1385
1546
|
hookWaitClamped,
|
|
1386
1547
|
effectiveWaitSeconds,
|
|
1387
|
-
HOOK_SOURCES,
|
|
1388
|
-
AGENT_LABELS_BY_TYPE,
|
|
1389
1548
|
OPENCODE_APPROVAL_EVENT,
|
|
1390
1549
|
CURSOR_GATE_EVENTS,
|
|
1391
1550
|
HOOK_LOCATOR_BINARY,
|
|
@@ -1406,6 +1565,8 @@ export {
|
|
|
1406
1565
|
isPusharyOwnTool,
|
|
1407
1566
|
shouldDeferToNativeMode,
|
|
1408
1567
|
ASKED_IN_EVERY_MODE_TOOLS,
|
|
1568
|
+
PRETOOLUSE_GATED_TOOLS,
|
|
1569
|
+
isPermissionRequestOwnedByPreToolUse,
|
|
1409
1570
|
resolveGate,
|
|
1410
1571
|
modeStateFromResponse,
|
|
1411
1572
|
stoppedOutput,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2ZTL3PGN.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CLAUDE_CONNECTOR_URL,
|
|
15
15
|
COWORK_CONNECTOR_LIMIT,
|
|
16
16
|
COWORK_STANDING_INSTRUCTIONS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WDKHZRAS.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/cowork.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -7,22 +7,22 @@ import {
|
|
|
7
7
|
} from "./chunk-L4ZCFMWW.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-N4VNLISN.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OW6AZDY2.js";
|
|
14
14
|
import {
|
|
15
15
|
getPackageVersion
|
|
16
16
|
} from "./chunk-DINDL2CF.js";
|
|
17
17
|
import {
|
|
18
18
|
readControlMode
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-S5CMLR35.js";
|
|
20
20
|
import {
|
|
21
21
|
readJsonSafe,
|
|
22
22
|
writeFileAtomic,
|
|
23
23
|
writeJsonAtomic,
|
|
24
24
|
writeJsonAtomicDurable
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KAVDAZ7A.js";
|
|
26
26
|
import {
|
|
27
27
|
getApiKey
|
|
28
28
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -12,7 +12,7 @@ import { randomUUID } from "crypto";
|
|
|
12
12
|
var isPolicyConfig = (data) => {
|
|
13
13
|
if (!data || typeof data !== "object") return false;
|
|
14
14
|
const d = data;
|
|
15
|
-
return Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
|
|
15
|
+
return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
|
|
16
16
|
};
|
|
17
17
|
var isAskUserResponse = (data) => {
|
|
18
18
|
if (!data || typeof data !== "object") return false;
|
|
@@ -45,13 +45,24 @@ var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4, signal) => {
|
|
|
45
45
|
if (!isWaitForAnswerResponse(result)) throw new Error("Invalid wait_for_answer response");
|
|
46
46
|
return result;
|
|
47
47
|
};
|
|
48
|
+
var WAIT_RESPONSE_GRACE_MS = 2e3;
|
|
49
|
+
var MIN_LONG_POLL_MS = 1e3;
|
|
50
|
+
var MAX_LONG_POLL_MS = 3e4;
|
|
51
|
+
var nextLongPollMs = (deadlineMs, nowMs) => {
|
|
52
|
+
const hold = Math.min(deadlineMs - nowMs - WAIT_RESPONSE_GRACE_MS, MAX_LONG_POLL_MS);
|
|
53
|
+
return hold >= MIN_LONG_POLL_MS ? hold : null;
|
|
54
|
+
};
|
|
48
55
|
var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3) => {
|
|
49
56
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
50
57
|
while (Date.now() < deadlineMs) {
|
|
51
|
-
const
|
|
58
|
+
const hold = nextLongPollMs(deadlineMs, Date.now());
|
|
59
|
+
if (hold === null) {
|
|
60
|
+
await sleep(Math.max(0, deadlineMs - Date.now()));
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
52
63
|
let answer;
|
|
53
64
|
try {
|
|
54
|
-
answer = await waitForAnswer(apiKey, correlationId,
|
|
65
|
+
answer = await waitForAnswer(apiKey, correlationId, hold, AbortSignal.timeout(Math.max(1, deadlineMs - Date.now())));
|
|
55
66
|
} catch {
|
|
56
67
|
const late = await withdrawQuestion(apiKey, correlationId);
|
|
57
68
|
return late.answered ? late : STOPPED;
|
|
@@ -93,6 +104,7 @@ export {
|
|
|
93
104
|
isLocalQuestionHandoff,
|
|
94
105
|
askUser,
|
|
95
106
|
waitForAnswer,
|
|
107
|
+
nextLongPollMs,
|
|
96
108
|
cancelQuestion,
|
|
97
109
|
withdrawQuestion,
|
|
98
110
|
waitForQuestion,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6AEM5RCS.js";
|
|
4
4
|
import {
|
|
5
5
|
addClaudeMcpServer,
|
|
6
6
|
addPusharyHooks,
|
|
7
7
|
addPusharyToolPermissions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HGUZOUB2.js";
|
|
9
9
|
import {
|
|
10
10
|
claudeWired,
|
|
11
11
|
codexWired,
|
|
12
12
|
geminiWired
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HBHEX3JQ.js";
|
|
14
14
|
import {
|
|
15
15
|
CLAUDE_HOOK_EVENTS,
|
|
16
16
|
GEMINI_HOOK_BINARY,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
needsReregistration,
|
|
22
22
|
registrationSignatures,
|
|
23
23
|
supportedClaudeEvents
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2D7BAOMY.js";
|
|
25
25
|
import {
|
|
26
26
|
guardBinary
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3AJIK5AO.js";
|
|
28
28
|
import {
|
|
29
29
|
resolveGlobalBinDir,
|
|
30
30
|
resolveGlobalBinary
|
|
@@ -40,14 +40,14 @@ import {
|
|
|
40
40
|
codexHooksJson,
|
|
41
41
|
hasCodexHooks,
|
|
42
42
|
vscodePluginMcp
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OW6AZDY2.js";
|
|
44
44
|
import {
|
|
45
45
|
readJsonSafe,
|
|
46
46
|
writeJsonAtomic
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-KAVDAZ7A.js";
|
|
48
48
|
import {
|
|
49
49
|
HOOK_LOCATOR_BINARY
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-WDKHZRAS.js";
|
|
51
51
|
|
|
52
52
|
// src/reapply.ts
|
|
53
53
|
import { join } from "path";
|
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-67YNQ3QA.js";
|
|
4
|
+
import "../chunk-D62EONG3.js";
|
|
5
|
+
import "../chunk-UCS65VVR.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchAccountPublicKey
|
|
@@ -15,28 +15,28 @@ import {
|
|
|
15
15
|
handlePostToolUse,
|
|
16
16
|
handleStop,
|
|
17
17
|
reportEvent
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-HCMM3BOW.js";
|
|
19
19
|
import {
|
|
20
20
|
askUser,
|
|
21
21
|
cancelQuestion,
|
|
22
22
|
waitForAnswer
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-XS33QBJA.js";
|
|
24
|
+
import "../chunk-BDI2MXTT.js";
|
|
25
|
+
import "../chunk-IVQMNLSA.js";
|
|
26
|
+
import "../chunk-N4VNLISN.js";
|
|
27
|
+
import "../chunk-OW6AZDY2.js";
|
|
28
28
|
import "../chunk-EYRGBYZG.js";
|
|
29
29
|
import "../chunk-SAF6HGAA.js";
|
|
30
30
|
import "../chunk-7QLSKOSU.js";
|
|
31
31
|
import "../chunk-KZERVKTD.js";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-KAVDAZ7A.js";
|
|
33
33
|
import {
|
|
34
34
|
getApiKey,
|
|
35
35
|
getBaseUrl
|
|
36
36
|
} from "../chunk-2UMNXADU.js";
|
|
37
37
|
import {
|
|
38
38
|
resolvePolicy
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-WDKHZRAS.js";
|
|
40
40
|
export {
|
|
41
41
|
askUser,
|
|
42
42
|
cancelQuestion,
|