@pushary/agent-hooks 0.86.0 → 0.87.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/CHANGELOG.md +9 -0
- package/data/SKILL.md +31 -11
- package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
- package/data/cursor-plugin/rules/pushary.mdc +2 -2
- package/data/cursor-plugin/skills/pushary/SKILL.md +30 -10
- package/data/vscode-plugin/.claude-plugin/plugin.json +1 -1
- package/data/vscode-plugin/skills/pushary/SKILL.md +30 -10
- package/dist/bin/pushary-bell-hook.js +4 -4
- package/dist/bin/pushary-bell.js +6 -6
- package/dist/bin/pushary-claude.js +12 -10
- package/dist/bin/pushary-clean.js +6 -6
- package/dist/bin/pushary-codex-bridge.js +5 -5
- package/dist/bin/pushary-codex-hook.js +13 -29
- package/dist/bin/pushary-codex.js +6 -4
- package/dist/bin/pushary-connect.js +6 -6
- package/dist/bin/pushary-daemon.js +4 -4
- package/dist/bin/pushary-disconnect.js +22 -8
- package/dist/bin/pushary-doctor.js +21 -15
- package/dist/bin/pushary-elicitation-hook.d.ts +1 -0
- package/dist/bin/pushary-elicitation-hook.js +210 -0
- package/dist/bin/pushary-gemini-bridge.js +5 -5
- package/dist/bin/pushary-gemini-hook.js +10 -8
- package/dist/bin/pushary-hook.js +6 -5
- package/dist/bin/pushary-login.js +4 -4
- package/dist/bin/pushary-logout.js +4 -4
- package/dist/bin/pushary-mode.js +3 -3
- package/dist/bin/pushary-notification-hook.js +4 -3
- package/dist/bin/pushary-permission-denied-hook.js +6 -5
- package/dist/bin/pushary-permission-hook.js +6 -5
- package/dist/bin/pushary-post-hook.js +4 -3
- package/dist/bin/pushary-prompt-hook.js +4 -3
- package/dist/bin/pushary-session-end-hook.js +4 -3
- package/dist/bin/pushary-session-start-hook.js +4 -3
- package/dist/bin/pushary-setup.js +19 -15
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +5 -5
- package/dist/bin/pushary-stop-hook.js +4 -3
- package/dist/bin/pushary-stopfailure-hook.js +4 -3
- package/dist/bin/pushary-upgrade.js +8 -7
- package/dist/bin/pushary-wait.js +3 -3
- package/dist/{chunk-5EUZYWID.js → chunk-2T3GX7WG.js} +1 -1
- package/dist/{chunk-GK4CED6Z.js → chunk-5646VKR4.js} +7 -3
- package/dist/{chunk-MNQI6ZZU.js → chunk-7MBDFNUC.js} +1 -1
- package/dist/{chunk-CY4TZK5O.js → chunk-7YJS2VTG.js} +31 -4
- package/dist/{chunk-PZR4XMFU.js → chunk-A3PFIWWN.js} +1 -1
- package/dist/{chunk-2TZCZ7CL.js → chunk-A4I5JGCW.js} +1 -1
- package/dist/{chunk-VPJAAGD4.js → chunk-B3V2H6SA.js} +37 -17
- package/dist/{chunk-XPAGN3SC.js → chunk-ECEUMWBH.js} +1 -1
- package/dist/{chunk-2255DZ74.js → chunk-HAUTLCMA.js} +1 -1
- package/dist/{chunk-S3UD7O35.js → chunk-HJ44HIUW.js} +12 -28
- package/dist/chunk-J3YDT4HM.js +128 -0
- package/dist/{chunk-N52CIK47.js → chunk-JAICP7BA.js} +1 -1
- package/dist/{chunk-QW27ZFA4.js → chunk-LT2VLPUK.js} +2 -2
- package/dist/{chunk-HSGEEBBL.js → chunk-M7RYIZX6.js} +3 -3
- package/dist/{chunk-7G5VO76N.js → chunk-OT4YD54Q.js} +1 -1
- package/dist/{chunk-VZNDR3Z7.js → chunk-QBWYNVKY.js} +1 -1
- package/dist/{chunk-MTKR4YLW.js → chunk-SJVLFIYP.js} +1 -1
- package/dist/{chunk-33T5OOKP.js → chunk-V2XPF77V.js} +96 -161
- package/dist/{chunk-FOY5FISQ.js → chunk-WLLBFDVY.js} +1 -1
- package/dist/{chunk-Q7N3XGWM.js → chunk-XW5CHAQX.js} +2 -2
- package/dist/{chunk-7C5CJC3H.js → chunk-Y3UTTFTZ.js} +1 -1
- package/dist/{chunk-2C6B6V2U.js → chunk-ZZE6FN7T.js} +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +10 -8
- package/package.json +3 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
printKeyCheck
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-JAICP7BA.js";
|
|
5
5
|
import {
|
|
6
6
|
confirmAppConnection,
|
|
7
7
|
connectDevice,
|
|
8
8
|
printConnectInstructions
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-A3PFIWWN.js";
|
|
10
10
|
import "../chunk-3EGEA4KH.js";
|
|
11
11
|
import {
|
|
12
12
|
checkApiKey
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-A4I5JGCW.js";
|
|
14
14
|
import {
|
|
15
15
|
createIo
|
|
16
16
|
} from "../chunk-5RUIFDTP.js";
|
|
17
17
|
import {
|
|
18
18
|
readKeySource
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-OT4YD54Q.js";
|
|
20
20
|
import {
|
|
21
21
|
parseFlags
|
|
22
22
|
} from "../chunk-GMXKITVA.js";
|
|
@@ -29,7 +29,7 @@ import "../chunk-DINDL2CF.js";
|
|
|
29
29
|
import "../chunk-6MTNS63X.js";
|
|
30
30
|
import "../chunk-BSZYIAZL.js";
|
|
31
31
|
import "../chunk-SAF6HGAA.js";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
33
33
|
import {
|
|
34
34
|
UsageError
|
|
35
35
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
EXIT
|
|
38
38
|
} from "../chunk-KZERVKTD.js";
|
|
39
39
|
import "../chunk-2UMNXADU.js";
|
|
40
|
-
import "../chunk-
|
|
40
|
+
import "../chunk-7YJS2VTG.js";
|
|
41
41
|
|
|
42
42
|
// bin/pushary-connect.ts
|
|
43
43
|
exitOnHelpFlag("connect");
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
acquireDaemonLease,
|
|
9
9
|
readDaemonStatus,
|
|
10
10
|
requestDaemonHandoff
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-SJVLFIYP.js";
|
|
12
12
|
import {
|
|
13
13
|
CODEX_BRIDGE_CAPABILITY,
|
|
14
14
|
CODEX_RESUME_CAPABILITY,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
findLiveProcessBySpawnId,
|
|
19
19
|
ownsLiveProcess
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-QBWYNVKY.js";
|
|
21
21
|
import {
|
|
22
22
|
spawnClaude
|
|
23
23
|
} from "../chunk-XHKBHWLX.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
resolveGlobalPackageVersion,
|
|
27
27
|
resolvePackageVersionFromBinary
|
|
28
28
|
} from "../chunk-VT4IVERX.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-B3V2H6SA.js";
|
|
30
30
|
import {
|
|
31
31
|
getMachineId
|
|
32
32
|
} from "../chunk-RN3NOEJF.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
getApiKey,
|
|
44
44
|
getBaseUrl
|
|
45
45
|
} from "../chunk-2UMNXADU.js";
|
|
46
|
-
import "../chunk-
|
|
46
|
+
import "../chunk-7YJS2VTG.js";
|
|
47
47
|
|
|
48
48
|
// src/spawn-daemon.ts
|
|
49
49
|
import { execFileSync, spawn } from "child_process";
|
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
import {
|
|
3
3
|
removeClaudeMcpServers,
|
|
4
4
|
removePusharySettings
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-5646VKR4.js";
|
|
6
6
|
import {
|
|
7
7
|
removeGeminiSettings
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-ZZE6FN7T.js";
|
|
9
9
|
import "../chunk-ATBKJNWS.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-M7RYIZX6.js";
|
|
11
11
|
import "../chunk-VT4IVERX.js";
|
|
12
12
|
import {
|
|
13
13
|
claudeJson,
|
|
14
14
|
claudeSettings,
|
|
15
15
|
claudeSettingsLocal,
|
|
16
16
|
codexConfigToml,
|
|
17
|
+
codexHookPositions,
|
|
17
18
|
codexHooksJson,
|
|
18
19
|
cursorUserHooks,
|
|
19
20
|
cursorUserMcp,
|
|
20
21
|
geminiSettings,
|
|
21
22
|
removeCodexHooks,
|
|
22
23
|
removeCodexSettings
|
|
23
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-B3V2H6SA.js";
|
|
24
25
|
import {
|
|
25
26
|
exitOnHelpFlag
|
|
26
27
|
} from "../chunk-SQOFGPNX.js";
|
|
27
28
|
import "../chunk-GOEXZ5QJ.js";
|
|
28
29
|
import "../chunk-DINDL2CF.js";
|
|
29
30
|
import "../chunk-KZERVKTD.js";
|
|
30
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-7YJS2VTG.js";
|
|
31
32
|
|
|
32
33
|
// bin/pushary-disconnect.ts
|
|
33
34
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -59,11 +60,24 @@ var disconnectPlan = (agent) => {
|
|
|
59
60
|
{ path: claudeSettingsLocal(), format: "json", remove: removePusharySettings },
|
|
60
61
|
{ path: claudeJson(), format: "json", remove: removeClaudeMcpServers }
|
|
61
62
|
];
|
|
62
|
-
case "codex":
|
|
63
|
+
case "codex": {
|
|
64
|
+
const positions = {};
|
|
63
65
|
return [
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
+
{
|
|
67
|
+
path: codexHooksJson(),
|
|
68
|
+
format: "json",
|
|
69
|
+
remove: (config) => {
|
|
70
|
+
Object.assign(positions, codexHookPositions(config));
|
|
71
|
+
return removeCodexHooks(config);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
path: codexConfigToml(),
|
|
76
|
+
format: "toml",
|
|
77
|
+
remove: (config) => removeCodexSettings(config, codexHooksJson(), positions)
|
|
78
|
+
}
|
|
66
79
|
];
|
|
80
|
+
}
|
|
67
81
|
case "gemini":
|
|
68
82
|
return [{ path: geminiSettings(), format: "json", remove: removeGeminiSettings }];
|
|
69
83
|
case "cursor":
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
describeWaitLadder
|
|
4
|
+
} from "../chunk-IIENZE2J.js";
|
|
2
5
|
import {
|
|
3
6
|
claudeWired,
|
|
4
7
|
codexWired,
|
|
5
8
|
geminiWired
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import {
|
|
8
|
-
describeWaitLadder
|
|
9
|
-
} from "../chunk-IIENZE2J.js";
|
|
9
|
+
} from "../chunk-XW5CHAQX.js";
|
|
10
10
|
import {
|
|
11
11
|
readDaemonStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-SJVLFIYP.js";
|
|
13
13
|
import {
|
|
14
14
|
agentProbes,
|
|
15
15
|
detectAgent,
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
isDetected,
|
|
19
19
|
isPluginRegistered,
|
|
20
20
|
vscodeSettingsTargets
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-LT2VLPUK.js";
|
|
22
22
|
import {
|
|
23
23
|
GEMINI_HOOK_BINARY,
|
|
24
24
|
hasGeminiHooks,
|
|
25
25
|
missingGeminiHookEvents
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-ZZE6FN7T.js";
|
|
27
27
|
import "../chunk-XHKBHWLX.js";
|
|
28
28
|
import {
|
|
29
29
|
execNpm
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
claudeSkillDir,
|
|
35
35
|
codexAgentsMd,
|
|
36
36
|
codexConfigToml,
|
|
37
|
+
codexHookPositions,
|
|
37
38
|
codexHooksJson,
|
|
38
39
|
codexSkillDir,
|
|
39
40
|
cursorPluginDir,
|
|
@@ -46,10 +47,10 @@ import {
|
|
|
46
47
|
readCodexMcpAuth,
|
|
47
48
|
untrustedCodexHookEvents,
|
|
48
49
|
vscodePluginDir
|
|
49
|
-
} from "../chunk-
|
|
50
|
+
} from "../chunk-B3V2H6SA.js";
|
|
50
51
|
import {
|
|
51
52
|
readLedgerSummary
|
|
52
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-7MBDFNUC.js";
|
|
53
54
|
import {
|
|
54
55
|
getMachineId
|
|
55
56
|
} from "../chunk-RN3NOEJF.js";
|
|
@@ -59,19 +60,19 @@ import {
|
|
|
59
60
|
fetchChannels,
|
|
60
61
|
reachVerdict,
|
|
61
62
|
verifyRoundTrip
|
|
62
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-A3PFIWWN.js";
|
|
63
64
|
import "../chunk-3EGEA4KH.js";
|
|
64
65
|
import {
|
|
65
66
|
checkApiKey,
|
|
66
67
|
describeKeyCheck
|
|
67
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-A4I5JGCW.js";
|
|
68
69
|
import {
|
|
69
70
|
createIo
|
|
70
71
|
} from "../chunk-5RUIFDTP.js";
|
|
71
72
|
import {
|
|
72
73
|
keyPrefix,
|
|
73
74
|
readKeySource
|
|
74
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-OT4YD54Q.js";
|
|
75
76
|
import {
|
|
76
77
|
parseFlags
|
|
77
78
|
} from "../chunk-GMXKITVA.js";
|
|
@@ -89,7 +90,7 @@ import {
|
|
|
89
90
|
sendMcpRequest
|
|
90
91
|
} from "../chunk-BSZYIAZL.js";
|
|
91
92
|
import "../chunk-SAF6HGAA.js";
|
|
92
|
-
import "../chunk-
|
|
93
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
93
94
|
import {
|
|
94
95
|
UsageError
|
|
95
96
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -99,7 +100,7 @@ import {
|
|
|
99
100
|
import {
|
|
100
101
|
getBaseUrl
|
|
101
102
|
} from "../chunk-2UMNXADU.js";
|
|
102
|
-
import "../chunk-
|
|
103
|
+
import "../chunk-7YJS2VTG.js";
|
|
103
104
|
|
|
104
105
|
// bin/pushary-doctor.ts
|
|
105
106
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -463,7 +464,12 @@ var main = async () => {
|
|
|
463
464
|
console.log(` ${warn} Codex: stale legacy notify entry ${dim("(double-push risk, re-run setup to remove it)")}`);
|
|
464
465
|
}
|
|
465
466
|
if (hookCommand) {
|
|
466
|
-
const untrusted = untrustedCodexHookEvents(
|
|
467
|
+
const untrusted = untrustedCodexHookEvents(
|
|
468
|
+
codexParsed,
|
|
469
|
+
codexHooksPath,
|
|
470
|
+
hookCommand,
|
|
471
|
+
codexHookPositions(codexHooksConfig)
|
|
472
|
+
);
|
|
467
473
|
check(untrusted.length === 0, "Codex: hooks trusted", untrusted.length === 0 ? "all events trusted" : `untrusted (${untrusted.join(", ")}) \u2014 type /hooks in Codex and trust them, once`);
|
|
468
474
|
}
|
|
469
475
|
} else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
5
|
+
import {
|
|
6
|
+
isDeferAnswer
|
|
7
|
+
} from "../chunk-YHG74UFF.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_SESSION,
|
|
10
|
+
askUser,
|
|
11
|
+
cancelQuestion,
|
|
12
|
+
pollForAnswer,
|
|
13
|
+
savePendingQuestion
|
|
14
|
+
} from "../chunk-J3YDT4HM.js";
|
|
15
|
+
import {
|
|
16
|
+
getMachineId
|
|
17
|
+
} from "../chunk-RN3NOEJF.js";
|
|
18
|
+
import "../chunk-BSZYIAZL.js";
|
|
19
|
+
import "../chunk-SAF6HGAA.js";
|
|
20
|
+
import "../chunk-7QLSKOSU.js";
|
|
21
|
+
import "../chunk-KZERVKTD.js";
|
|
22
|
+
import {
|
|
23
|
+
getApiKey
|
|
24
|
+
} from "../chunk-2UMNXADU.js";
|
|
25
|
+
import {
|
|
26
|
+
effectiveWaitSeconds,
|
|
27
|
+
hookWaitDeadline,
|
|
28
|
+
parseAgentQuestionAnswers,
|
|
29
|
+
renderElicitationOutput
|
|
30
|
+
} from "../chunk-7YJS2VTG.js";
|
|
31
|
+
|
|
32
|
+
// bin/pushary-elicitation-hook.ts
|
|
33
|
+
import { basename } from "path";
|
|
34
|
+
|
|
35
|
+
// src/elicitation.ts
|
|
36
|
+
var ANSWERABLE_MODE = "form";
|
|
37
|
+
var MIN_OPTIONS = 2;
|
|
38
|
+
var MAX_MULTI_QUESTIONS = 4;
|
|
39
|
+
var MAX_MULTI_OPTIONS = 4;
|
|
40
|
+
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
41
|
+
var labelFor = (name, property) => typeof property.title === "string" && property.title.trim() ? property.title.trim() : name;
|
|
42
|
+
var stringEnum = (property) => {
|
|
43
|
+
if (!Array.isArray(property.enum)) return null;
|
|
44
|
+
const members = property.enum.filter((member) => typeof member === "string");
|
|
45
|
+
return members.length === property.enum.length && members.length >= MIN_OPTIONS ? members : null;
|
|
46
|
+
};
|
|
47
|
+
var readElicitationFields = (schema) => {
|
|
48
|
+
const record = asRecord(schema);
|
|
49
|
+
const properties = asRecord(record?.properties);
|
|
50
|
+
if (!properties) return null;
|
|
51
|
+
const entries = Object.entries(properties);
|
|
52
|
+
if (entries.length === 0) return null;
|
|
53
|
+
const fields = [];
|
|
54
|
+
for (const [name, raw] of entries) {
|
|
55
|
+
const property = asRecord(raw);
|
|
56
|
+
if (!property) return null;
|
|
57
|
+
const label = labelFor(name, property);
|
|
58
|
+
if ("enum" in property) {
|
|
59
|
+
const options = stringEnum(property);
|
|
60
|
+
if (!options) return null;
|
|
61
|
+
fields.push({ kind: "choice", name, label, options });
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
switch (property.type) {
|
|
65
|
+
case "string":
|
|
66
|
+
fields.push({ kind: "text", name, label });
|
|
67
|
+
break;
|
|
68
|
+
case "number":
|
|
69
|
+
fields.push({ kind: "number", name, label, integer: false });
|
|
70
|
+
break;
|
|
71
|
+
case "integer":
|
|
72
|
+
fields.push({ kind: "number", name, label, integer: true });
|
|
73
|
+
break;
|
|
74
|
+
case "boolean":
|
|
75
|
+
fields.push({ kind: "boolean", name, label });
|
|
76
|
+
break;
|
|
77
|
+
// An enum with one member, a nested object, an array, an absent type: all
|
|
78
|
+
// shapes whose value we would be inventing rather than collecting.
|
|
79
|
+
default:
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return fields;
|
|
84
|
+
};
|
|
85
|
+
var questionText = (message, field, alone) => alone ? message : `${message} \u2014 ${field.label}`;
|
|
86
|
+
var planElicitationAsk = (message, fields) => {
|
|
87
|
+
if (fields.length === 1) {
|
|
88
|
+
const field = fields[0];
|
|
89
|
+
const question = questionText(message, field, true);
|
|
90
|
+
switch (field.kind) {
|
|
91
|
+
case "choice":
|
|
92
|
+
return { kind: "select", field, question, options: field.options };
|
|
93
|
+
case "boolean":
|
|
94
|
+
return { kind: "confirm", field, question };
|
|
95
|
+
case "text":
|
|
96
|
+
case "number":
|
|
97
|
+
return { kind: "input", field, question };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (fields.length > MAX_MULTI_QUESTIONS) return null;
|
|
101
|
+
if (!fields.every((field) => field.kind === "choice" && field.options.length <= MAX_MULTI_OPTIONS)) return null;
|
|
102
|
+
const questions = fields.map((field) => ({
|
|
103
|
+
question: questionText(message, field, false),
|
|
104
|
+
header: field.label.slice(0, 12),
|
|
105
|
+
multiSelect: false,
|
|
106
|
+
options: field.options.map((label) => ({ label }))
|
|
107
|
+
}));
|
|
108
|
+
return new Set(questions.map((question) => question.question)).size === questions.length ? { kind: "questions", fields, questions } : null;
|
|
109
|
+
};
|
|
110
|
+
var CONFIRMED = /* @__PURE__ */ new Set(["yes", "true", "approve", "approved", "allow"]);
|
|
111
|
+
var REFUSED = /* @__PURE__ */ new Set(["no", "false", "deny", "denied", "reject"]);
|
|
112
|
+
var numberFrom = (raw, integer) => {
|
|
113
|
+
const trimmed = raw.trim();
|
|
114
|
+
if (!/^-?\d+(\.\d+)?$/.test(trimmed)) return null;
|
|
115
|
+
const value = Number(trimmed);
|
|
116
|
+
if (!Number.isFinite(value)) return null;
|
|
117
|
+
return integer && !Number.isInteger(value) ? null : value;
|
|
118
|
+
};
|
|
119
|
+
var elicitationContent = (ask, answer) => {
|
|
120
|
+
const value = answer.trim();
|
|
121
|
+
if (!value) return null;
|
|
122
|
+
if (ask.kind === "input") {
|
|
123
|
+
if (ask.field.kind === "number") {
|
|
124
|
+
const parsed = numberFrom(value, ask.field.integer);
|
|
125
|
+
return parsed === null ? null : { [ask.field.name]: parsed };
|
|
126
|
+
}
|
|
127
|
+
return { [ask.field.name]: value };
|
|
128
|
+
}
|
|
129
|
+
if (ask.kind === "confirm") {
|
|
130
|
+
const lowered = value.toLowerCase();
|
|
131
|
+
if (CONFIRMED.has(lowered)) return { [ask.field.name]: true };
|
|
132
|
+
if (REFUSED.has(lowered)) return { [ask.field.name]: false };
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
if (ask.kind === "select") {
|
|
136
|
+
return ask.options.includes(value) ? { [ask.field.name]: value } : null;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
};
|
|
140
|
+
var elicitationContentFromAnswers = (ask, answers) => {
|
|
141
|
+
const content = {};
|
|
142
|
+
for (const [index, field] of ask.fields.entries()) {
|
|
143
|
+
if (field.kind !== "choice") return null;
|
|
144
|
+
const chosen = answers[ask.questions[index].question];
|
|
145
|
+
if (typeof chosen !== "string" || !field.options.includes(chosen)) return null;
|
|
146
|
+
content[field.name] = chosen;
|
|
147
|
+
}
|
|
148
|
+
return content;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// bin/pushary-elicitation-hook.ts
|
|
152
|
+
var START_MS = Date.now();
|
|
153
|
+
var answered = (ask, answer) => {
|
|
154
|
+
if (!answer.answered || isDeferAnswer(answer.value)) return null;
|
|
155
|
+
if (ask.kind === "questions") {
|
|
156
|
+
const values = answer.value ? parseAgentQuestionAnswers([...ask.questions], answer.value) : null;
|
|
157
|
+
return values ? elicitationContentFromAnswers(ask, values) : null;
|
|
158
|
+
}
|
|
159
|
+
return answer.value ? elicitationContent(ask, answer.value) : null;
|
|
160
|
+
};
|
|
161
|
+
var main = async () => {
|
|
162
|
+
const input = await readHookInput("claude", "Elicitation");
|
|
163
|
+
if (!input || input.hook_event_name !== "Elicitation") return;
|
|
164
|
+
if (input.mode !== ANSWERABLE_MODE) return;
|
|
165
|
+
const message = (input.message ?? "").trim();
|
|
166
|
+
if (!message) return;
|
|
167
|
+
const fields = readElicitationFields(input.requested_schema);
|
|
168
|
+
if (!fields) return;
|
|
169
|
+
const ask = planElicitationAsk(message, fields);
|
|
170
|
+
if (!ask) return;
|
|
171
|
+
const apiKey = getApiKey();
|
|
172
|
+
if (!apiKey) return;
|
|
173
|
+
const project = basename(input.cwd ?? process.cwd());
|
|
174
|
+
const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
|
|
175
|
+
let created;
|
|
176
|
+
try {
|
|
177
|
+
created = await askUser(apiKey, {
|
|
178
|
+
question: ask.kind === "questions" ? ask.questions[0].question : ask.question,
|
|
179
|
+
type: ask.kind === "questions" ? "select" : ask.kind,
|
|
180
|
+
...ask.kind === "select" ? { options: [...ask.options] } : {},
|
|
181
|
+
...ask.kind === "questions" ? { options: ask.questions[0].options.map((option) => option.label), questions: [...ask.questions] } : {},
|
|
182
|
+
context: `${input.mcp_server_name ?? "An MCP server"} is asking for input`,
|
|
183
|
+
agentName: `Claude Code - ${project}`,
|
|
184
|
+
sessionId: input.session_id,
|
|
185
|
+
machineId: getMachineId(),
|
|
186
|
+
toolName: "Elicitation",
|
|
187
|
+
toolTarget: input.mcp_server_name,
|
|
188
|
+
// The elicitation's own id, so a retried create is the same decision rather
|
|
189
|
+
// than a second question on the same lock screen.
|
|
190
|
+
toolUseId: input.elicitation_id
|
|
191
|
+
});
|
|
192
|
+
} catch {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (created.suppressed || created.noDevices) {
|
|
196
|
+
await cancelQuestion(apiKey, created.correlationId).catch(() => {
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const answer = await pollForAnswer(apiKey, created.correlationId, deadline);
|
|
201
|
+
const content = answered(ask, answer);
|
|
202
|
+
if (!content) {
|
|
203
|
+
savePendingQuestion(input.session_id || DEFAULT_SESSION, created.correlationId);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const output = renderElicitationOutput("Elicitation", "accept", content);
|
|
207
|
+
if (output) process.stdout.write(output);
|
|
208
|
+
};
|
|
209
|
+
main().catch(() => {
|
|
210
|
+
});
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
postLiveSession,
|
|
6
6
|
postLiveSessionUntilAccepted,
|
|
7
7
|
startLiveSessionHeartbeat
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-WLLBFDVY.js";
|
|
9
|
+
import "../chunk-ECEUMWBH.js";
|
|
10
10
|
import {
|
|
11
11
|
startProcessOwnership,
|
|
12
12
|
withSpawnProcessOwnership
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-QBWYNVKY.js";
|
|
14
14
|
import {
|
|
15
15
|
spawnClaude
|
|
16
16
|
} from "../chunk-XHKBHWLX.js";
|
|
17
17
|
import {
|
|
18
18
|
resolveBinary
|
|
19
19
|
} from "../chunk-VT4IVERX.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-B3V2H6SA.js";
|
|
21
21
|
import {
|
|
22
22
|
getMachineId
|
|
23
23
|
} from "../chunk-RN3NOEJF.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
getApiKey,
|
|
27
27
|
getBaseUrl
|
|
28
28
|
} from "../chunk-2UMNXADU.js";
|
|
29
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-7YJS2VTG.js";
|
|
30
30
|
|
|
31
31
|
// bin/pushary-gemini-bridge.ts
|
|
32
32
|
import { existsSync } from "fs";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isGatingMoment,
|
|
4
4
|
recordKeylessMoment
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-7MBDFNUC.js";
|
|
6
6
|
import {
|
|
7
7
|
readHookInput
|
|
8
8
|
} from "../chunk-6CUUA7HO.js";
|
|
@@ -11,9 +11,6 @@ import {
|
|
|
11
11
|
isDeferAnswer
|
|
12
12
|
} from "../chunk-YHG74UFF.js";
|
|
13
13
|
import {
|
|
14
|
-
DEFAULT_SESSION,
|
|
15
|
-
askUser,
|
|
16
|
-
cancelQuestion,
|
|
17
14
|
deriveActionBody,
|
|
18
15
|
deriveBlocker,
|
|
19
16
|
deriveToolTarget,
|
|
@@ -28,17 +25,22 @@ import {
|
|
|
28
25
|
readLastUserPrompt,
|
|
29
26
|
repoKeyFor,
|
|
30
27
|
reportEvent,
|
|
28
|
+
scopePathFor
|
|
29
|
+
} from "../chunk-V2XPF77V.js";
|
|
30
|
+
import {
|
|
31
|
+
DEFAULT_SESSION,
|
|
32
|
+
askUser,
|
|
33
|
+
cancelQuestion,
|
|
31
34
|
savePendingQuestion,
|
|
32
|
-
scopePathFor,
|
|
33
35
|
sendNotification,
|
|
34
36
|
waitForAnswer
|
|
35
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-J3YDT4HM.js";
|
|
36
38
|
import {
|
|
37
39
|
getMachineId
|
|
38
40
|
} from "../chunk-RN3NOEJF.js";
|
|
39
41
|
import "../chunk-BSZYIAZL.js";
|
|
40
42
|
import "../chunk-SAF6HGAA.js";
|
|
41
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
42
44
|
import "../chunk-7QLSKOSU.js";
|
|
43
45
|
import "../chunk-KZERVKTD.js";
|
|
44
46
|
import {
|
|
@@ -52,7 +54,7 @@ import {
|
|
|
52
54
|
hookWaitClamped,
|
|
53
55
|
hookWaitDeadline,
|
|
54
56
|
resolveGate
|
|
55
|
-
} from "../chunk-
|
|
57
|
+
} from "../chunk-7YJS2VTG.js";
|
|
56
58
|
|
|
57
59
|
// bin/pushary-gemini-hook.ts
|
|
58
60
|
import { basename } from "path";
|
package/dist/bin/pushary-hook.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePreToolUse
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-HJ44HIUW.js";
|
|
5
5
|
import "../chunk-ATBKJNWS.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-7MBDFNUC.js";
|
|
7
7
|
import {
|
|
8
8
|
readHookInput
|
|
9
9
|
} from "../chunk-6CUUA7HO.js";
|
|
10
10
|
import "../chunk-YHG74UFF.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-V2XPF77V.js";
|
|
12
|
+
import "../chunk-J3YDT4HM.js";
|
|
12
13
|
import "../chunk-RN3NOEJF.js";
|
|
13
14
|
import {
|
|
14
15
|
exitOnHelpFlag
|
|
@@ -17,11 +18,11 @@ import "../chunk-GOEXZ5QJ.js";
|
|
|
17
18
|
import "../chunk-DINDL2CF.js";
|
|
18
19
|
import "../chunk-BSZYIAZL.js";
|
|
19
20
|
import "../chunk-SAF6HGAA.js";
|
|
20
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
21
22
|
import "../chunk-7QLSKOSU.js";
|
|
22
23
|
import "../chunk-KZERVKTD.js";
|
|
23
24
|
import "../chunk-2UMNXADU.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-7YJS2VTG.js";
|
|
25
26
|
|
|
26
27
|
// bin/pushary-hook.ts
|
|
27
28
|
exitOnHelpFlag("hook");
|
|
@@ -6,14 +6,14 @@ import "../chunk-3EGEA4KH.js";
|
|
|
6
6
|
import {
|
|
7
7
|
checkApiKey,
|
|
8
8
|
describeKeyCheck
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-A4I5JGCW.js";
|
|
10
10
|
import {
|
|
11
11
|
createIo
|
|
12
12
|
} from "../chunk-5RUIFDTP.js";
|
|
13
13
|
import {
|
|
14
14
|
readKeySource,
|
|
15
15
|
writeKey
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-OT4YD54Q.js";
|
|
17
17
|
import {
|
|
18
18
|
parseFlags
|
|
19
19
|
} from "../chunk-GMXKITVA.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "../chunk-DINDL2CF.js";
|
|
28
28
|
import "../chunk-6MTNS63X.js";
|
|
29
29
|
import "../chunk-SAF6HGAA.js";
|
|
30
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
31
31
|
import {
|
|
32
32
|
UsageError
|
|
33
33
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import "../chunk-2UMNXADU.js";
|
|
38
38
|
import {
|
|
39
39
|
isValidApiKey
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-7YJS2VTG.js";
|
|
41
41
|
|
|
42
42
|
// bin/pushary-login.ts
|
|
43
43
|
exitOnHelpFlag("login");
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
codexConfigToml,
|
|
5
5
|
cursorUserMcp,
|
|
6
6
|
geminiSettings
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-B3V2H6SA.js";
|
|
8
8
|
import {
|
|
9
9
|
createIo
|
|
10
10
|
} from "../chunk-5RUIFDTP.js";
|
|
11
11
|
import {
|
|
12
12
|
clearKey,
|
|
13
13
|
readKeySource
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-OT4YD54Q.js";
|
|
15
15
|
import {
|
|
16
16
|
parseFlags
|
|
17
17
|
} from "../chunk-GMXKITVA.js";
|
|
@@ -22,7 +22,7 @@ import "../chunk-GOEXZ5QJ.js";
|
|
|
22
22
|
import "../chunk-BC3VCZ3E.js";
|
|
23
23
|
import "../chunk-DINDL2CF.js";
|
|
24
24
|
import "../chunk-6MTNS63X.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-Y3UTTFTZ.js";
|
|
26
26
|
import {
|
|
27
27
|
UsageError
|
|
28
28
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
getBaseUrl
|
|
34
34
|
} from "../chunk-2UMNXADU.js";
|
|
35
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-7YJS2VTG.js";
|
|
36
36
|
|
|
37
37
|
// bin/pushary-logout.ts
|
|
38
38
|
import { existsSync } from "fs";
|
package/dist/bin/pushary-mode.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
exitOnFailedResponse
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-JAICP7BA.js";
|
|
5
|
+
import "../chunk-A4I5JGCW.js";
|
|
6
6
|
import {
|
|
7
7
|
createIo
|
|
8
8
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
getApiKey,
|
|
26
26
|
getBaseUrl
|
|
27
27
|
} from "../chunk-2UMNXADU.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-7YJS2VTG.js";
|
|
29
29
|
|
|
30
30
|
// bin/pushary-mode.ts
|
|
31
31
|
exitOnHelpFlag("mode");
|