@pushary/agent-hooks 0.56.0 → 0.58.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/dist/bin/pushary-claude.js +1 -1
- package/dist/bin/pushary-codex-hook.js +1 -1
- package/dist/bin/pushary-codex.js +1 -1
- package/dist/bin/pushary-gemini-hook.js +1 -1
- package/dist/bin/pushary-hook.js +2 -2
- package/dist/bin/pushary-notification-hook.js +1 -1
- package/dist/bin/pushary-permission-denied-hook.js +2 -2
- package/dist/bin/pushary-permission-hook.js +2 -2
- package/dist/bin/pushary-post-hook.js +1 -1
- package/dist/bin/pushary-prompt-hook.js +1 -1
- package/dist/bin/pushary-session-end-hook.js +1 -1
- package/dist/bin/pushary-session-start-hook.js +1 -1
- package/dist/bin/pushary-setup.js +1 -1
- package/dist/bin/pushary-stop-hook.js +1 -1
- package/dist/bin/pushary-stopfailure-hook.js +1 -1
- package/dist/{chunk-GQPIOJA3.js → chunk-Q7VUYLH4.js} +1 -1
- package/dist/{chunk-3EOK3M44.js → chunk-XG3C4DZA.js} +26 -3
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/package.json +1 -1
package/dist/bin/pushary-hook.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePreToolUse
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Q7VUYLH4.js";
|
|
5
5
|
import "../chunk-QYQO6RHJ.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-XG3C4DZA.js";
|
|
8
8
|
import "../chunk-RN3NOEJF.js";
|
|
9
9
|
import "../chunk-5TECIV6T.js";
|
|
10
10
|
import "../chunk-DWED7BS3.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionDenied
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Q7VUYLH4.js";
|
|
5
5
|
import "../chunk-QYQO6RHJ.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-XG3C4DZA.js";
|
|
8
8
|
import "../chunk-RN3NOEJF.js";
|
|
9
9
|
import "../chunk-5TECIV6T.js";
|
|
10
10
|
import "../chunk-DWED7BS3.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionRequest
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Q7VUYLH4.js";
|
|
5
5
|
import "../chunk-QYQO6RHJ.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-XG3C4DZA.js";
|
|
8
8
|
import "../chunk-RN3NOEJF.js";
|
|
9
9
|
import "../chunk-5TECIV6T.js";
|
|
10
10
|
import "../chunk-DWED7BS3.js";
|
|
@@ -284,14 +284,37 @@ var deriveToolTarget = (toolName, toolInput) => {
|
|
|
284
284
|
}
|
|
285
285
|
return void 0;
|
|
286
286
|
};
|
|
287
|
+
var SCRIPT_RUNNERS = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn", "bun", "npx", "deno", "rake", "make", "just", "task", "turbo"]);
|
|
288
|
+
var RUN_SUBCOMMANDS = /* @__PURE__ */ new Set(["run", "run-script", "exec", "task"]);
|
|
289
|
+
var deriveReceiptCommandHead = (command) => {
|
|
290
|
+
if (typeof command !== "string") return void 0;
|
|
291
|
+
const tokens = command.trim().split(/\s+/);
|
|
292
|
+
const [first, second] = tokens;
|
|
293
|
+
const keep = first && second && SCRIPT_RUNNERS.has(first.toLowerCase()) && RUN_SUBCOMMANDS.has(second.toLowerCase()) ? 3 : 2;
|
|
294
|
+
const head = tokens.slice(0, keep).join(" ");
|
|
295
|
+
return head ? head.slice(0, TOOL_TARGET_MAX_LENGTH) : void 0;
|
|
296
|
+
};
|
|
287
297
|
var RECEIPT_TARGET_MAX_LENGTH = 256;
|
|
298
|
+
var EXIT_CODE_FAILURE = /^Error: Exit code \d+/;
|
|
288
299
|
var isToolResultError = (toolResult) => {
|
|
289
300
|
try {
|
|
290
|
-
|
|
301
|
+
if (typeof toolResult === "string") return EXIT_CODE_FAILURE.test(toolResult);
|
|
302
|
+
if (!toolResult || typeof toolResult !== "object") return false;
|
|
303
|
+
return "error" in toolResult || "is_error" in toolResult;
|
|
291
304
|
} catch {
|
|
292
305
|
return false;
|
|
293
306
|
}
|
|
294
307
|
};
|
|
308
|
+
var toolResultErrorText = (toolResult) => {
|
|
309
|
+
try {
|
|
310
|
+
const raw = typeof toolResult === "string" ? toolResult : toolResult && typeof toolResult === "object" ? String(
|
|
311
|
+
toolResult.error ?? toolResult.stderr ?? ""
|
|
312
|
+
) : "";
|
|
313
|
+
return redactSecrets(raw);
|
|
314
|
+
} catch {
|
|
315
|
+
return "";
|
|
316
|
+
}
|
|
317
|
+
};
|
|
295
318
|
var relativizeReceiptPath = (filePath, cwd) => {
|
|
296
319
|
if (!cwd || !isAbsolute(filePath)) return filePath;
|
|
297
320
|
return relative(cwd, filePath);
|
|
@@ -309,7 +332,7 @@ var deriveReceiptMeta = (toolName, toolInput, toolResult, cwd) => {
|
|
|
309
332
|
};
|
|
310
333
|
}
|
|
311
334
|
if (toolName === "Bash" || toolName === "PowerShell" || toolName === "Monitor") {
|
|
312
|
-
const head =
|
|
335
|
+
const head = deriveReceiptCommandHead(toolInput.command);
|
|
313
336
|
if (!head) return void 0;
|
|
314
337
|
return {
|
|
315
338
|
kind: head === "git commit" ? "commit" : "bash",
|
|
@@ -952,7 +975,7 @@ var handlePostToolUse = async (input, agent = CLAUDE_CODE_AGENT) => {
|
|
|
952
975
|
agentName: `${agent.label} - ${projectName}`,
|
|
953
976
|
action,
|
|
954
977
|
sessionId: input.session_id,
|
|
955
|
-
error: isError ?
|
|
978
|
+
error: isError ? toolResultErrorText(toolResult).slice(0, 500) : void 0,
|
|
956
979
|
decisionSource,
|
|
957
980
|
...beacon ? { decisionOrigin: beacon.decisionOrigin, toolName: beacon.toolName, toolTarget: beacon.toolTarget } : {},
|
|
958
981
|
meta: receiptsEnabled ? deriveReceiptMeta(lookup.tool, lookup.input, toolResult, input.cwd ?? process.cwd()) : void 0,
|
package/dist/src/index.d.ts
CHANGED
|
@@ -81,8 +81,8 @@ declare const reportEvent: (event: AgentEvent, options?: ReportEventOptions) =>
|
|
|
81
81
|
declare const handlePostToolUse: (input: {
|
|
82
82
|
tool_name: string;
|
|
83
83
|
tool_input: Record<string, unknown>;
|
|
84
|
-
tool_response?:
|
|
85
|
-
tool_result?:
|
|
84
|
+
tool_response?: unknown;
|
|
85
|
+
tool_result?: unknown;
|
|
86
86
|
cwd?: string;
|
|
87
87
|
session_id?: string;
|
|
88
88
|
transcript_path?: string;
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Q7VUYLH4.js";
|
|
4
4
|
import "../chunk-QYQO6RHJ.js";
|
|
5
5
|
import "../chunk-YHG74UFF.js";
|
|
6
6
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
reportEvent,
|
|
16
16
|
resolvePolicy,
|
|
17
17
|
waitForAnswer
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-XG3C4DZA.js";
|
|
19
19
|
import "../chunk-RN3NOEJF.js";
|
|
20
20
|
import "../chunk-5TECIV6T.js";
|
|
21
21
|
import "../chunk-DWED7BS3.js";
|