@pushary/agent-hooks 0.8.3 → 0.9.1
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/dist/bin/pushary-clean.js +5 -3
- package/dist/bin/pushary-codex.js +17 -10
- package/dist/bin/pushary-doctor.js +39 -3
- package/dist/bin/pushary-hook.js +3 -2
- package/dist/bin/pushary-post-hook.js +2 -2
- package/dist/bin/pushary-setup.js +72 -35
- package/dist/bin/pushary-stop-hook.js +2 -2
- package/dist/chunk-5GFUI5N6.js +132 -0
- package/dist/chunk-AB4KX4XT.js +109 -0
- package/dist/chunk-IBWCHA5M.js +10 -0
- package/dist/chunk-M2N5DYWN.js +247 -0
- package/dist/chunk-OF5WIOYS.js +129 -0
- package/dist/chunk-RSHN2AQ7.js +29 -0
- package/dist/chunk-W5KRWUNE.js +262 -0
- package/dist/src/index.d.ts +13 -17
- package/dist/src/index.js +6 -3
- package/package.json +5 -4
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { PolicyConfig, ApprovalMode, ToolPolicy } from '@pushary/contracts';
|
|
2
|
+
export { ApprovalMode, PolicyConfig, ToolPolicy } from '@pushary/contracts';
|
|
3
|
+
|
|
1
4
|
interface ToolInput {
|
|
2
5
|
tool_name: string;
|
|
3
6
|
tool_input: Record<string, unknown>;
|
|
@@ -19,6 +22,7 @@ interface AgentEvent {
|
|
|
19
22
|
agentName?: string;
|
|
20
23
|
action?: string;
|
|
21
24
|
machineId?: string;
|
|
25
|
+
sessionId?: string;
|
|
22
26
|
error?: string;
|
|
23
27
|
}
|
|
24
28
|
declare const reportEvent: (event: AgentEvent) => Promise<void>;
|
|
@@ -48,6 +52,9 @@ interface AskUserParams {
|
|
|
48
52
|
options?: string[];
|
|
49
53
|
context?: string;
|
|
50
54
|
agentName?: string;
|
|
55
|
+
sessionId?: string;
|
|
56
|
+
machineId?: string;
|
|
57
|
+
toolName?: string;
|
|
51
58
|
}
|
|
52
59
|
interface AskUserResponse {
|
|
53
60
|
correlationId: string;
|
|
@@ -61,27 +68,16 @@ declare const askUser: (apiKey: string, params: AskUserParams) => Promise<AskUse
|
|
|
61
68
|
declare const waitForAnswer: (apiKey: string, correlationId: string, timeoutMs?: number) => Promise<WaitForAnswerResponse>;
|
|
62
69
|
declare const cancelQuestion: (apiKey: string, correlationId: string) => Promise<void>;
|
|
63
70
|
|
|
64
|
-
type ApprovalMode = 'push_only' | 'terminal_only' | 'push_first' | 'notify_only';
|
|
65
|
-
interface ToolPolicy {
|
|
66
|
-
tool: string;
|
|
67
|
-
timeoutSeconds: number;
|
|
68
|
-
timeoutAction: 'approve' | 'deny' | 'escalate';
|
|
69
|
-
mode: ApprovalMode;
|
|
70
|
-
pushFirstSeconds: number;
|
|
71
|
-
}
|
|
72
|
-
interface PolicyConfig {
|
|
73
|
-
policies: ToolPolicy[];
|
|
74
|
-
defaultTimeoutSeconds: number;
|
|
75
|
-
defaultTimeoutAction: 'approve' | 'deny' | 'escalate';
|
|
76
|
-
defaultMode: ApprovalMode;
|
|
77
|
-
defaultPushFirstSeconds: number;
|
|
78
|
-
modeOverride?: ApprovalMode | null;
|
|
79
|
-
}
|
|
80
71
|
declare const getPolicy: (apiKey: string) => Promise<PolicyConfig>;
|
|
81
72
|
declare const resolvePolicy: (config: PolicyConfig, toolName: string, modeOverride?: ApprovalMode | null) => ToolPolicy;
|
|
73
|
+
interface ModeState {
|
|
74
|
+
readonly mode: ApprovalMode | null;
|
|
75
|
+
readonly kill: boolean;
|
|
76
|
+
}
|
|
77
|
+
declare const fetchModeState: (apiKey: string, sessionId?: string) => Promise<ModeState>;
|
|
82
78
|
declare const fetchModeOverride: (apiKey: string) => Promise<ApprovalMode | null>;
|
|
83
79
|
|
|
84
80
|
declare const getApiKey: () => string;
|
|
85
81
|
declare const getBaseUrl: () => string;
|
|
86
82
|
|
|
87
|
-
export { type
|
|
83
|
+
export { type ModeState, askUser, cancelQuestion, fetchModeOverride, fetchModeState, getApiKey, getBaseUrl, getPolicy, handleNotification, handlePostToolUse, handlePreToolUse, handleStop, reportEvent, resolvePolicy, waitForAnswer };
|
package/dist/src/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchModeOverride,
|
|
3
|
+
fetchModeState,
|
|
3
4
|
getPolicy,
|
|
4
5
|
handlePreToolUse,
|
|
5
6
|
resolvePolicy
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-W5KRWUNE.js";
|
|
8
|
+
import "../chunk-IBWCHA5M.js";
|
|
7
9
|
import {
|
|
8
10
|
handleNotification,
|
|
9
11
|
handlePostToolUse,
|
|
10
12
|
handleStop,
|
|
11
13
|
reportEvent
|
|
12
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-AB4KX4XT.js";
|
|
13
15
|
import {
|
|
14
16
|
askUser,
|
|
15
17
|
cancelQuestion,
|
|
16
18
|
waitForAnswer
|
|
17
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-OF5WIOYS.js";
|
|
18
20
|
import "../chunk-3MIR7ODJ.js";
|
|
19
21
|
import {
|
|
20
22
|
getApiKey,
|
|
@@ -24,6 +26,7 @@ export {
|
|
|
24
26
|
askUser,
|
|
25
27
|
cancelQuestion,
|
|
26
28
|
fetchModeOverride,
|
|
29
|
+
fetchModeState,
|
|
27
30
|
getApiKey,
|
|
28
31
|
getBaseUrl,
|
|
29
32
|
getPolicy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushary/agent-hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
|
|
5
5
|
"author": "Pushary <business@pushary.com>",
|
|
6
6
|
"homepage": "https://pushary.com",
|
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
"data"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "tsup
|
|
34
|
-
"dev": "tsup
|
|
35
|
-
"test": "bun test src/api.test.ts && bun test src/claude-config.test.ts && bun test src/mcp-http.test.ts && bun test src/retry.test.ts && bun test src/validate.test.ts && bun test src/policy.test.ts && bun test src/events.test.ts && bun test src/hook.test.ts"
|
|
33
|
+
"build": "tsup",
|
|
34
|
+
"dev": "tsup --watch",
|
|
35
|
+
"test": "bun test src/api.test.ts && bun test src/claude-config.test.ts && bun test src/mcp-http.test.ts && bun test src/retry.test.ts && bun test src/validate.test.ts && bun test src/policy.test.ts && bun test src/npm.test.ts && bun test src/identity.test.ts && bun test src/pending.test.ts && bun test src/events.test.ts && bun test src/hook.test.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@inquirer/prompts": "^8.4.2",
|
|
39
39
|
"smol-toml": "^1.6.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@pushary/contracts": "workspace:*",
|
|
42
43
|
"tsup": "^8.0.0",
|
|
43
44
|
"typescript": "^5.0.0"
|
|
44
45
|
}
|