@pushary/agent-hooks 0.92.1 → 0.93.0
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 +10 -0
- package/dist/bin/pushary-bell.js +1 -1
- package/dist/bin/pushary-claude.js +36 -20
- package/dist/bin/pushary-clean.js +9 -9
- package/dist/bin/pushary-codex-bridge.js +5 -5
- package/dist/bin/pushary-codex-hook.js +44 -10
- package/dist/bin/pushary-codex.js +7 -6
- package/dist/bin/pushary-connect.js +2 -2
- package/dist/bin/pushary-daemon.js +10 -10
- package/dist/bin/pushary-disconnect.js +3 -3
- package/dist/bin/pushary-doctor.js +21 -14
- package/dist/bin/pushary-elicitation-hook.js +4 -4
- package/dist/bin/pushary-gemini-bridge.js +5 -5
- package/dist/bin/pushary-gemini-hook.js +7 -6
- package/dist/bin/pushary-hook.js +8 -8
- package/dist/bin/pushary-login.js +3 -3
- package/dist/bin/pushary-logout.js +1 -1
- package/dist/bin/pushary-notification-hook.js +7 -6
- package/dist/bin/pushary-opencode-hook.js +7 -6
- package/dist/bin/pushary-permission-denied-hook.js +8 -8
- package/dist/bin/pushary-permission-hook.js +8 -8
- package/dist/bin/pushary-post-hook.js +7 -6
- package/dist/bin/pushary-prompt-hook.js +7 -6
- package/dist/bin/pushary-session-end-hook.js +7 -6
- package/dist/bin/pushary-session-start-hook.js +11 -11
- package/dist/bin/pushary-setup.js +15 -15
- package/dist/bin/pushary-status.js +5 -5
- package/dist/bin/pushary-stop-hook.js +7 -6
- package/dist/bin/pushary-stopfailure-hook.js +7 -6
- package/dist/bin/pushary-upgrade.js +9 -9
- package/dist/{chunk-ZMKKK6DC.js → chunk-6Y4IKMQT.js} +2 -2
- package/dist/{chunk-2ACC5M7F.js → chunk-72FWXLW2.js} +1 -1
- package/dist/{chunk-QZCFVWA7.js → chunk-EQRS3SGM.js} +3 -1
- package/dist/{chunk-BSZYIAZL.js → chunk-EYRGBYZG.js} +2 -1
- package/dist/{chunk-YXDYKECP.js → chunk-G5L3WVFV.js} +117 -80
- package/dist/{chunk-4TFXV5MW.js → chunk-GKMQMSTB.js} +1 -1
- package/dist/{chunk-RQPQSJJH.js → chunk-HCLSTQ3N.js} +23 -8
- package/dist/{chunk-CNPAT3HL.js → chunk-KHTFHUL3.js} +1 -1
- package/dist/{chunk-CV2YD2JR.js → chunk-N3TF3RQ2.js} +42 -10
- package/dist/{chunk-3HS4YGHB.js → chunk-NXZYC3B3.js} +1 -1
- package/dist/{chunk-QCXKQJTG.js → chunk-NZQTIDXN.js} +2 -2
- package/dist/chunk-QQSQWLFR.js +53 -0
- package/dist/{chunk-F7OURW3C.js → chunk-RER3FRTD.js} +7 -7
- package/dist/{chunk-2XQSN66Q.js → chunk-T2PKGGDM.js} +1 -1
- package/dist/{chunk-I3ORVBTP.js → chunk-TFN7ZCTI.js} +4 -4
- package/dist/{chunk-SQYBP3QQ.js → chunk-TWVZHZM3.js} +2 -2
- package/dist/{chunk-L4E2BIJ2.js → chunk-UAFQC35P.js} +56 -3
- package/dist/{chunk-PYA4FLKI.js → chunk-UPCPR7QW.js} +1 -1
- package/dist/{chunk-HDORB7WD.js → chunk-WEDYCMHU.js} +1 -1
- package/dist/{chunk-I7W3UTDK.js → chunk-YUZYMAL7.js} +9 -7
- package/dist/src/index.d.ts +31 -3
- package/dist/src/index.js +9 -9
- package/package.json +2 -2
- package/dist/chunk-2LAHXHBR.js +0 -23
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASKED_IN_EVERY_MODE_TOOLS
|
|
3
|
+
} from "./chunk-VNMKIJZB.js";
|
|
4
|
+
|
|
5
|
+
// src/claude-tools.ts
|
|
6
|
+
var PRETOOLUSE_GATED_TOOLS = [
|
|
7
|
+
"Bash",
|
|
8
|
+
"Write",
|
|
9
|
+
"Edit",
|
|
10
|
+
"MultiEdit",
|
|
11
|
+
"NotebookEdit",
|
|
12
|
+
"PowerShell",
|
|
13
|
+
"Monitor"
|
|
14
|
+
];
|
|
15
|
+
var PRETOOLUSE_PHONE_ANSWERED_TOOLS = ASKED_IN_EVERY_MODE_TOOLS;
|
|
16
|
+
var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
|
|
17
|
+
var POSTTOOLUSE_MIRRORED_TOOLS = [...PRETOOLUSE_GATED_TOOLS, ...POSTTOOLUSE_MIRROR_ONLY_TOOLS];
|
|
18
|
+
var PRETOOLUSE_HANDLED_TOOLS = /* @__PURE__ */ new Set([...PRETOOLUSE_GATED_TOOLS, ...PRETOOLUSE_PHONE_ANSWERED_TOOLS]);
|
|
19
|
+
|
|
20
|
+
// src/claude-notifications.ts
|
|
21
|
+
var NOTIFICATION_MATCHED_TYPES = [
|
|
22
|
+
// Blocks. The agent, or one of its workers, is waiting on a person.
|
|
23
|
+
"permission_prompt",
|
|
24
|
+
"idle_prompt",
|
|
25
|
+
"agent_needs_input",
|
|
26
|
+
"worker_permission_prompt",
|
|
27
|
+
// An MCP server asking the person for a value. The Elicitation hook answers it;
|
|
28
|
+
// this is the feed row saying one is open.
|
|
29
|
+
"elicitation_dialog",
|
|
30
|
+
"elicitation_url_dialog",
|
|
31
|
+
// Turn boundary.
|
|
32
|
+
"agent_completed",
|
|
33
|
+
// Quota. The island already reads plan usage, and these say when a limit hit,
|
|
34
|
+
// went stale, or was turned off, which no polling of the usage endpoint reveals.
|
|
35
|
+
"quota_auto_resume_fired",
|
|
36
|
+
"quota_auto_resume_stale",
|
|
37
|
+
"quota_auto_resume_disabled"
|
|
38
|
+
];
|
|
39
|
+
var NOTIFICATION_PUSH_TYPES = /* @__PURE__ */ new Set([
|
|
40
|
+
"idle_prompt",
|
|
41
|
+
"agent_needs_input",
|
|
42
|
+
"worker_permission_prompt"
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
PRETOOLUSE_GATED_TOOLS,
|
|
47
|
+
PRETOOLUSE_PHONE_ANSWERED_TOOLS,
|
|
48
|
+
POSTTOOLUSE_MIRROR_ONLY_TOOLS,
|
|
49
|
+
POSTTOOLUSE_MIRRORED_TOOLS,
|
|
50
|
+
PRETOOLUSE_HANDLED_TOOLS,
|
|
51
|
+
NOTIFICATION_MATCHED_TYPES,
|
|
52
|
+
NOTIFICATION_PUSH_TYPES
|
|
53
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
callMcpTool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EYRGBYZG.js";
|
|
4
4
|
import {
|
|
5
5
|
installProxyDispatcher
|
|
6
6
|
} from "./chunk-SAF6HGAA.js";
|
|
@@ -33,11 +33,11 @@ var askUser = async (apiKey, params, timeoutMs = 15e3) => {
|
|
|
33
33
|
if (!isAskUserResponse(result)) throw new Error("Invalid ask_user response");
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
-
var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4) => {
|
|
36
|
+
var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4, signal) => {
|
|
37
37
|
const result = await callMcpTool(apiKey, "wait_for_answer", {
|
|
38
38
|
correlationId,
|
|
39
39
|
timeoutMs
|
|
40
|
-
}, { timeoutMs: timeoutMs + 1e4 });
|
|
40
|
+
}, { timeoutMs: timeoutMs + 1e4, signal });
|
|
41
41
|
if (!isWaitForAnswerResponse(result)) throw new Error("Invalid wait_for_answer response");
|
|
42
42
|
return result;
|
|
43
43
|
};
|
|
@@ -59,11 +59,11 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
|
|
|
59
59
|
}
|
|
60
60
|
return { answered: false };
|
|
61
61
|
};
|
|
62
|
-
var cancelQuestion = async (apiKey, correlationId) => {
|
|
63
|
-
await callMcpTool(apiKey, "cancel_question", { correlationId });
|
|
62
|
+
var cancelQuestion = async (apiKey, correlationId, signal) => {
|
|
63
|
+
await callMcpTool(apiKey, "cancel_question", { correlationId }, { signal });
|
|
64
64
|
};
|
|
65
|
-
var sendNotification = async (apiKey, params, timeoutMs = 15e3) => {
|
|
66
|
-
await callMcpTool(apiKey, "send_notification", { ...params }, { maxRetries: 3, timeoutMs });
|
|
65
|
+
var sendNotification = async (apiKey, params, timeoutMs = 15e3, signal) => {
|
|
66
|
+
await callMcpTool(apiKey, "send_notification", { ...params }, { maxRetries: signal ? 1 : 3, timeoutMs, signal });
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// src/pending.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WEDYCMHU.js";
|
|
4
4
|
import {
|
|
5
5
|
claudeWired,
|
|
6
6
|
codexWired,
|
|
7
7
|
geminiWired
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6Y4IKMQT.js";
|
|
9
9
|
import {
|
|
10
10
|
CLAUDE_HOOK_EVENTS,
|
|
11
11
|
GEMINI_HOOK_BINARY,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
needsReregistration,
|
|
20
20
|
registrationSignatures,
|
|
21
21
|
supportedClaudeEvents
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YUZYMAL7.js";
|
|
23
23
|
import {
|
|
24
24
|
guardBinary
|
|
25
25
|
} from "./chunk-EZIEXHYM.js";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
codexHooksJson,
|
|
39
39
|
hasCodexHooks,
|
|
40
40
|
vscodePluginMcp
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-N3TF3RQ2.js";
|
|
42
42
|
import {
|
|
43
43
|
readJsonSafe,
|
|
44
44
|
writeJsonAtomic
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-L4ZCFMWW.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-72FWXLW2.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-N3TF3RQ2.js";
|
|
14
14
|
import {
|
|
15
15
|
getPackageVersion
|
|
16
16
|
} from "./chunk-DINDL2CF.js";
|
|
@@ -20,8 +20,14 @@ var hookPrefixes = {
|
|
|
20
20
|
// Without an entry here the fallback stringifies the whole tool input, and for
|
|
21
21
|
// ExitPlanMode that input IS the plan: the action line became a truncated dump of
|
|
22
22
|
// the plan markdown. The plan belongs in the body, not the one-line summary.
|
|
23
|
-
ExitPlanMode: () => "finished planning and wants to start coding"
|
|
24
|
-
|
|
23
|
+
ExitPlanMode: () => "finished planning and wants to start coding",
|
|
24
|
+
// Mirrored on PostToolUse since the matcher was widened. Without entries the
|
|
25
|
+
// fallback prints `Task: done` and `WebSearch: done`, which name the tool and
|
|
26
|
+
// drop the only part a person reads: which subagent, and what it looked for.
|
|
27
|
+
Task: (input) => `subagent: ${describeTaskCall(input)}`,
|
|
28
|
+
WebSearch: (input) => `web search: ${firstString(input.query) ?? "(no query)"}`
|
|
29
|
+
};
|
|
30
|
+
var describeTaskCall = (input) => firstString(input.description) ?? firstString(input.subagent_type) ?? "(unnamed)";
|
|
25
31
|
var describeTodoProgress = (todos) => {
|
|
26
32
|
if (!Array.isArray(todos)) return "updated the plan";
|
|
27
33
|
const items = todos.filter((t) => !!t && typeof t === "object");
|
|
@@ -42,7 +48,9 @@ var eventPrefixes = {
|
|
|
42
48
|
Edit: (input) => `edited: ${input.file_path ?? "unknown"}`,
|
|
43
49
|
MultiEdit: (input) => `edited: ${input.file_path ?? "unknown"}`,
|
|
44
50
|
Read: (input) => `read: ${input.file_path ?? "unknown"}`,
|
|
45
|
-
TodoWrite: (input) => describeTodoProgress(input.todos)
|
|
51
|
+
TodoWrite: (input) => describeTodoProgress(input.todos),
|
|
52
|
+
Task: (input) => `ran subagent: ${describeTaskCall(input)}`,
|
|
53
|
+
WebSearch: (input) => `searched: ${firstString(input.query) ?? "the web"}`
|
|
46
54
|
};
|
|
47
55
|
var MCP_TOOL_PREFIX = "mcp__";
|
|
48
56
|
var parseMcpToolName = (toolName) => {
|
|
@@ -287,6 +295,7 @@ var AGENT_IDENTITIES = {
|
|
|
287
295
|
vscode: { type: "vscode", label: AGENT_LABELS_BY_TYPE.vscode },
|
|
288
296
|
opencode: { type: "opencode", label: AGENT_LABELS_BY_TYPE.opencode }
|
|
289
297
|
};
|
|
298
|
+
var TEAMMATE_IDLE_ACTION = "A teammate went idle";
|
|
290
299
|
var TASK_TITLE_MAX_LENGTH = 120;
|
|
291
300
|
var STOP_SUMMARY_MAX_LENGTH = 200;
|
|
292
301
|
var SESSION_END_ACTIONS = {
|
|
@@ -333,6 +342,45 @@ var sessionStartAction = (source) => source === "resume" ? "Session resumed" : "
|
|
|
333
342
|
var sessionEndAction = (reason) => typeof reason === "string" && SESSION_END_ACTIONS[reason] || "Session ended";
|
|
334
343
|
var taskTitleFrom = (prompt) => typeof prompt === "string" ? prompt.replace(/\s+/g, " ").trim().slice(0, TASK_TITLE_MAX_LENGTH) || void 0 : void 0;
|
|
335
344
|
var asString = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
345
|
+
var NOTIFICATION_ACTION_MAX_LENGTH = 200;
|
|
346
|
+
var STOP_FAILURE_REASON_MAX_LENGTH = 300;
|
|
347
|
+
var notificationTypeOf = (payload) => asString(payload.notification_type) ?? asString(payload.type);
|
|
348
|
+
var notificationAction = (payload) => {
|
|
349
|
+
const text = asString(payload.message) ?? asString(payload.title);
|
|
350
|
+
const collapsed = redactSecrets(text ?? "").replace(/\s+/g, " ").trim();
|
|
351
|
+
return collapsed ? collapsed.slice(0, NOTIFICATION_ACTION_MAX_LENGTH) : "Notification";
|
|
352
|
+
};
|
|
353
|
+
var STOP_FAILURE_REASONS = {
|
|
354
|
+
rate_limit: "Rate limited by the API",
|
|
355
|
+
overloaded: "The API is overloaded right now",
|
|
356
|
+
authentication_failed: "Authentication failed",
|
|
357
|
+
billing_error: "A billing error stopped the turn"
|
|
358
|
+
};
|
|
359
|
+
var STOP_FAILURE_FALLBACK = "The turn ended on an API error (rate limit, billing, or auth).";
|
|
360
|
+
var describeStopFailure = (error) => {
|
|
361
|
+
const fromString = (value) => {
|
|
362
|
+
const trimmed = value.trim();
|
|
363
|
+
if (!trimmed) return void 0;
|
|
364
|
+
return STOP_FAILURE_REASONS[trimmed] ?? redactSecrets(trimmed).slice(0, STOP_FAILURE_REASON_MAX_LENGTH);
|
|
365
|
+
};
|
|
366
|
+
if (typeof error === "string") {
|
|
367
|
+
const described = fromString(error);
|
|
368
|
+
if (described) return described;
|
|
369
|
+
} else if (error && typeof error === "object") {
|
|
370
|
+
for (const key of ["type", "message", "error", "code"]) {
|
|
371
|
+
const value = error[key];
|
|
372
|
+
if (typeof value === "string") {
|
|
373
|
+
const described = fromString(value);
|
|
374
|
+
if (described) return described;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return STOP_FAILURE_FALLBACK;
|
|
379
|
+
};
|
|
380
|
+
var permissionDeniedAction = (toolName) => {
|
|
381
|
+
const tool = asString(toolName);
|
|
382
|
+
return tool ? `Auto-mode blocked ${tool}` : "Auto-mode blocked a tool call";
|
|
383
|
+
};
|
|
336
384
|
var sessionIdentityOf = (payload) => {
|
|
337
385
|
const sessionId = asString(payload.session_id);
|
|
338
386
|
const agentId = asString(payload.agent_id);
|
|
@@ -356,11 +404,16 @@ export {
|
|
|
356
404
|
deriveAction,
|
|
357
405
|
deriveBlocker,
|
|
358
406
|
AGENT_IDENTITIES,
|
|
407
|
+
TEAMMATE_IDLE_ACTION,
|
|
359
408
|
summarizeStop,
|
|
360
409
|
subagentStopSummary,
|
|
361
410
|
compactionAction,
|
|
362
411
|
sessionStartAction,
|
|
363
412
|
sessionEndAction,
|
|
364
413
|
taskTitleFrom,
|
|
414
|
+
notificationTypeOf,
|
|
415
|
+
notificationAction,
|
|
416
|
+
describeStopFailure,
|
|
417
|
+
permissionDeniedAction,
|
|
365
418
|
sessionIdentityOf
|
|
366
419
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PRETOOLUSE_GATED_TOOLS,
|
|
3
|
-
PRETOOLUSE_PHONE_ANSWERED_TOOLS
|
|
4
|
-
} from "./chunk-2LAHXHBR.js";
|
|
5
1
|
import {
|
|
6
2
|
guardBinary
|
|
7
3
|
} from "./chunk-EZIEXHYM.js";
|
|
4
|
+
import {
|
|
5
|
+
NOTIFICATION_MATCHED_TYPES,
|
|
6
|
+
POSTTOOLUSE_MIRRORED_TOOLS,
|
|
7
|
+
PRETOOLUSE_GATED_TOOLS,
|
|
8
|
+
PRETOOLUSE_PHONE_ANSWERED_TOOLS
|
|
9
|
+
} from "./chunk-QQSQWLFR.js";
|
|
8
10
|
import {
|
|
9
11
|
isProtectedByScope
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N3TF3RQ2.js";
|
|
11
13
|
import {
|
|
12
14
|
HOOK_BUDGETS,
|
|
13
15
|
HOOK_LOCATOR_BINARY
|
|
@@ -32,7 +34,7 @@ var formatVersion = (version) => version.join(".");
|
|
|
32
34
|
|
|
33
35
|
// src/claude-events.ts
|
|
34
36
|
var GATED_TOOLS = [...PRETOOLUSE_GATED_TOOLS, ...PRETOOLUSE_PHONE_ANSWERED_TOOLS].join("|");
|
|
35
|
-
var MIRRORED_TOOLS =
|
|
37
|
+
var MIRRORED_TOOLS = POSTTOOLUSE_MIRRORED_TOOLS.join("|");
|
|
36
38
|
var ESTABLISHED = [1, 0, 0];
|
|
37
39
|
var OBSERVED = [2, 0, 0];
|
|
38
40
|
var CLAUDE_HOOK_EVENTS = [
|
|
@@ -40,7 +42,7 @@ var CLAUDE_HOOK_EVENTS = [
|
|
|
40
42
|
{ event: "PostToolUse", binary: "pushary-post-hook", matcher: MIRRORED_TOOLS, timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
41
43
|
{ event: "Stop", binary: "pushary-stop-hook", timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
42
44
|
{ event: "UserPromptSubmit", binary: "pushary-prompt-hook", timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
43
|
-
{ event: "Notification", binary: "pushary-notification-hook", matcher: "
|
|
45
|
+
{ event: "Notification", binary: "pushary-notification-hook", matcher: NOTIFICATION_MATCHED_TYPES.join("|"), timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
44
46
|
{ event: "SessionStart", binary: "pushary-session-start-hook", matcher: "startup|resume|clear", timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
45
47
|
{ event: "SessionEnd", binary: "pushary-session-end-hook", timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
|
46
48
|
{ event: "StopFailure", binary: "pushary-stopfailure-hook", timeout: 10, delivery: "telemetry", since: ESTABLISHED },
|
package/dist/src/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const handlePreToolUse: (input: ToolInput) => Promise<HookOutput | undef
|
|
|
16
16
|
|
|
17
17
|
declare const getPolicy: (apiKey: string, expectedVersion?: string | null, agent?: string, repoAware?: boolean, sessionId?: string) => Promise<PolicyConfig>;
|
|
18
18
|
|
|
19
|
-
declare const fetchModeState: (apiKey: string, sessionId?: string, reuseWithinMs?: number) => Promise<ModeState>;
|
|
19
|
+
declare const fetchModeState: (apiKey: string, sessionId?: string, reuseWithinMs?: number, signal?: AbortSignal) => Promise<ModeState>;
|
|
20
20
|
declare const fetchModeOverride: (apiKey: string) => Promise<ApprovalMode | null>;
|
|
21
21
|
|
|
22
22
|
interface UsageReport {
|
|
@@ -52,8 +52,35 @@ interface AgentEvent {
|
|
|
52
52
|
pid?: number;
|
|
53
53
|
}
|
|
54
54
|
interface ReportEventOptions {
|
|
55
|
+
signal?: AbortSignal;
|
|
55
56
|
maxAttempts?: number;
|
|
56
57
|
timeoutMs?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Total wall clock this call may spend, acknowledge round trip included.
|
|
60
|
+
*
|
|
61
|
+
* Deliberately not `timeoutMs`. That option doubles as the "I am a side report"
|
|
62
|
+
* signal (`clientCanDrain` below is keyed on its absence), so a drain-carrying
|
|
63
|
+
* caller that set it to bound its time would silently stop delivering the
|
|
64
|
+
* instructions a person sent from their phone. This bounds the clock and says
|
|
65
|
+
* nothing about draining.
|
|
66
|
+
*
|
|
67
|
+
* Without it, a single report could spend `timeoutMs ?? 10_000` on the event
|
|
68
|
+
* POST and then a further `timeoutMs ?? 10_000` acknowledging a pending command,
|
|
69
|
+
* which is twice the ceiling the hook was given and, on Codex, twice what the
|
|
70
|
+
* agent will wait before killing the process mid-flight.
|
|
71
|
+
*/
|
|
72
|
+
budgetMs?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Tells the server not to pop a queued instruction for this report.
|
|
75
|
+
*
|
|
76
|
+
* `canDrainCommand: false` is not enough. The route's first disjunct is
|
|
77
|
+
* `event === "session_end" && consumesDrainedCommand(agentType)`, which never
|
|
78
|
+
* reads that flag, so any `session_end` from an agent whose Stop carries text
|
|
79
|
+
* back pops the queue destructively. A subagent's stop is a `session_end` and
|
|
80
|
+
* its caller throws the response away, which is a queued instruction destroyed
|
|
81
|
+
* rather than delivered. `skipCommandDrain` is the route's own first check.
|
|
82
|
+
*/
|
|
83
|
+
skipDrain?: boolean;
|
|
57
84
|
requireOk?: boolean;
|
|
58
85
|
/**
|
|
59
86
|
* Authenticate with this key instead of the ambient one.
|
|
@@ -102,6 +129,7 @@ declare const handleNotification: (input: {
|
|
|
102
129
|
title?: string;
|
|
103
130
|
type?: string;
|
|
104
131
|
notification_type?: string;
|
|
132
|
+
hook_event_name?: string;
|
|
105
133
|
cwd?: string;
|
|
106
134
|
session_id?: string;
|
|
107
135
|
}, agent?: AgentIdentity) => Promise<void>;
|
|
@@ -148,8 +176,8 @@ interface AnswerResult {
|
|
|
148
176
|
note?: string;
|
|
149
177
|
}
|
|
150
178
|
declare const askUser: (apiKey: string, params: AskUserParams, timeoutMs?: number) => Promise<AskUserResponse>;
|
|
151
|
-
declare const waitForAnswer: (apiKey: string, correlationId: string, timeoutMs?: number) => Promise<AnswerResult>;
|
|
152
|
-
declare const cancelQuestion: (apiKey: string, correlationId: string) => Promise<void>;
|
|
179
|
+
declare const waitForAnswer: (apiKey: string, correlationId: string, timeoutMs?: number, signal?: AbortSignal) => Promise<AnswerResult>;
|
|
180
|
+
declare const cancelQuestion: (apiKey: string, correlationId: string, signal?: AbortSignal) => Promise<void>;
|
|
153
181
|
|
|
154
182
|
declare const getApiKey: () => string;
|
|
155
183
|
declare const getBaseUrl: () => string;
|
package/dist/src/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-2LAHXHBR.js";
|
|
3
|
+
} from "../chunk-HCLSTQ3N.js";
|
|
5
4
|
import {
|
|
6
5
|
fetchAccountPublicKey
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-EQRS3SGM.js";
|
|
8
7
|
import "../chunk-I463AEG3.js";
|
|
9
8
|
import "../chunk-VHWCVD42.js";
|
|
10
9
|
import "../chunk-YHG74UFF.js";
|
|
@@ -16,16 +15,17 @@ import {
|
|
|
16
15
|
handlePostToolUse,
|
|
17
16
|
handleStop,
|
|
18
17
|
reportEvent
|
|
19
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-G5L3WVFV.js";
|
|
20
19
|
import {
|
|
21
20
|
askUser,
|
|
22
21
|
cancelQuestion,
|
|
23
22
|
waitForAnswer
|
|
24
|
-
} from "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-RER3FRTD.js";
|
|
24
|
+
import "../chunk-UAFQC35P.js";
|
|
25
|
+
import "../chunk-QQSQWLFR.js";
|
|
26
|
+
import "../chunk-72FWXLW2.js";
|
|
27
|
+
import "../chunk-N3TF3RQ2.js";
|
|
28
|
+
import "../chunk-EYRGBYZG.js";
|
|
29
29
|
import "../chunk-SAF6HGAA.js";
|
|
30
30
|
import "../chunk-7QLSKOSU.js";
|
|
31
31
|
import "../chunk-KZERVKTD.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushary/agent-hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pushary",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"type": "module",
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=20"
|
|
34
|
+
"node": ">=20.3.0"
|
|
35
35
|
},
|
|
36
36
|
"main": "./dist/src/index.js",
|
|
37
37
|
"types": "./dist/src/index.d.ts",
|
package/dist/chunk-2LAHXHBR.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ASKED_IN_EVERY_MODE_TOOLS
|
|
3
|
-
} from "./chunk-VNMKIJZB.js";
|
|
4
|
-
|
|
5
|
-
// src/claude-tools.ts
|
|
6
|
-
var PRETOOLUSE_GATED_TOOLS = [
|
|
7
|
-
"Bash",
|
|
8
|
-
"Write",
|
|
9
|
-
"Edit",
|
|
10
|
-
"MultiEdit",
|
|
11
|
-
"NotebookEdit",
|
|
12
|
-
"PowerShell",
|
|
13
|
-
"Monitor"
|
|
14
|
-
];
|
|
15
|
-
var PRETOOLUSE_PHONE_ANSWERED_TOOLS = ASKED_IN_EVERY_MODE_TOOLS;
|
|
16
|
-
var POSTTOOLUSE_MIRRORED_TOOLS = [...PRETOOLUSE_GATED_TOOLS, "TodoWrite"];
|
|
17
|
-
var PRETOOLUSE_HANDLED_TOOLS = /* @__PURE__ */ new Set([...PRETOOLUSE_GATED_TOOLS, ...PRETOOLUSE_PHONE_ANSWERED_TOOLS]);
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
PRETOOLUSE_GATED_TOOLS,
|
|
21
|
-
PRETOOLUSE_PHONE_ANSWERED_TOOLS,
|
|
22
|
-
PRETOOLUSE_HANDLED_TOOLS
|
|
23
|
-
};
|