pushary 1.9.281 → 1.9.282

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.282
4
+
5
+ - `pushary doctor`'s Wait Ladder now shows what the Claude Code hook will do. It reads your mode the way the hook does and applies it to every line, so under Always (Every time) a risky command reads "wait for your phone up to 590s" instead of "ask your phone for 20s". When a mode override is active it says so once, and that it is your own mode, since one session can still have its own.
6
+ - Instead of the first four rules, the ladder shows the rule a risky command such as `rm -rf build` resolves to, for example `Bash(rm:*)`. `pushary wait status` still lists every rule.
7
+ - When agents are stopped from Pushary, the ladder says only that: every call is refused and nothing waits. When your mode cannot be read, it says so, and warns that the waits shown may be shorter than what the hook does, instead of showing them as if no override were set.
8
+
3
9
  ## 1.9.281
4
10
 
5
11
  - `pushary clean` now finishes on a computer with no background-service manager, such as a Docker container, CI or Linux without systemd, when no background service was ever installed there. It removes the hooks, the MCP entries and `~/.pushary` as usual, and stops a Pushary daemon that is still running on its own. Before, it printed "could not stop or uninstall: Native background-service manager is unavailable" and removed nothing, so Pushary could not be uninstalled there. When a background service is installed and cannot be removed, clean still stops before changing anything.
@@ -14,9 +14,15 @@ import {
14
14
  hermesRepairStep
15
15
  } from "../chunk-MYXHCXD3.js";
16
16
  import {
17
- describeWaitLadder,
17
+ CLAUDE_CODE_HOOK_BUDGET,
18
+ RISKY_EXAMPLE_CALL,
19
+ STOPPED_FROM_PUSHARY_LADDER,
20
+ UNREAD_MODE_LADDER,
21
+ describeGateVerdictWait,
22
+ describeHookWaitLadder,
23
+ gateVerdictRuleOf,
18
24
  waitRuleLabelOf
19
- } from "../chunk-2SMGO6SE.js";
25
+ } from "../chunk-7DZ7UZQE.js";
20
26
  import {
21
27
  writeJsonError,
22
28
  writeStdoutFully
@@ -180,7 +186,11 @@ import {
180
186
  missingGeminiHookEvents,
181
187
  pusharyHookExecutable
182
188
  } from "../chunk-YEQF4H76.js";
183
- import "../chunk-OVUJLLPD.js";
189
+ import {
190
+ CLAUDE_CODE_AGENT,
191
+ fetchModeState,
192
+ getPolicy
193
+ } from "../chunk-OVUJLLPD.js";
184
194
  import "../chunk-2562EGWD.js";
185
195
  import "../chunk-DI7VQ4PL.js";
186
196
  import "../chunk-Z25VDYAL.js";
@@ -313,12 +323,15 @@ import {
313
323
  MAX_HOOK_ACTIVATION_EVIDENCE_ROWS,
314
324
  SUPPORT_DISCORD,
315
325
  SUPPORT_EMAIL,
326
+ WILDCARD_TOOL_PATTERN,
316
327
  computerOsOfPlatform,
317
328
  hookActivationResult,
318
329
  hookCompatibleProfile,
319
330
  isHookActivationReport,
320
331
  isValidApiKey,
321
- redactSecretsFromContent
332
+ redactSecretsFromContent,
333
+ resolveGate,
334
+ resolvePolicy
322
335
  } from "../chunk-LE2GNKVF.js";
323
336
  import "../chunk-MLKGABMK.js";
324
337
 
@@ -1022,6 +1035,21 @@ var skipped = (label, why) => {
1022
1035
  var checking = (label) => {
1023
1036
  agentsChecked.push(label);
1024
1037
  };
1038
+ var printResolvedWaitLadder = (modeState, config) => {
1039
+ const modeOverride = modeState.mode ?? config.modeOverride ?? null;
1040
+ if (modeState.degraded) {
1041
+ console.log(` ${warn} ${UNREAD_MODE_LADDER} ${dim("(pushary mode status)")}`);
1042
+ } else if (modeOverride) {
1043
+ console.log(` ${warn} mode override active: ${cyan(modeOverride)}, applied below ${dim("(your own mode; one session can still differ \xB7 pushary mode status)")}`);
1044
+ }
1045
+ const defaultRule = resolvePolicy(config, WILDCARD_TOOL_PATTERN, modeOverride);
1046
+ const defaultWindow = modeOverride ? "" : `${cyan(`${defaultRule.pushFirstSeconds}s`)} ${dim("\xB7")} `;
1047
+ console.log(` ${dim("\xB7")} default: ${defaultWindow}${describeHookWaitLadder(defaultRule, CLAUDE_CODE_HOOK_BUDGET)}`);
1048
+ const risky = resolveGate({ modeState, config, toolName: RISKY_EXAMPLE_CALL.toolName, toolInputs: [RISKY_EXAMPLE_CALL.toolInput] });
1049
+ const riskyRule = gateVerdictRuleOf(risky);
1050
+ const riskyLabel = riskyRule === null ? RISKY_EXAMPLE_CALL.toolName : waitRuleLabelOf(riskyRule);
1051
+ console.log(` ${dim("\xB7")} ${riskyLabel} ${dim(`(${RISKY_EXAMPLE_CALL.toolInput.command})`)}: ${describeGateVerdictWait(risky, CLAUDE_CODE_HOOK_BUDGET)}`);
1052
+ };
1025
1053
  var main = async () => {
1026
1054
  console.log();
1027
1055
  console.log(` ${bold("Pushary Doctor")}`);
@@ -1806,27 +1834,16 @@ var main = async () => {
1806
1834
  }
1807
1835
  if (apiKey) {
1808
1836
  try {
1809
- const res = await fetch(`${getBaseUrl()}/api/mcp/policy`, {
1810
- headers: { Authorization: `Bearer ${apiKey}` },
1811
- signal: AbortSignal.timeout(1e4)
1812
- });
1813
- if (res.ok) {
1814
- const policy = await res.json();
1815
- console.log();
1816
- console.log(` ${dim("Wait Ladder")} ${dim("(what happens when you don't answer)")}`);
1817
- const wildcard = policy.policies?.find((p) => p.tool === "*");
1818
- const defaultWindow = policy.defaultPushFirstSeconds ?? 20;
1819
- const defaultLadder = describeWaitLadder(wildcard ?? { tool: "*", mode: "push_first", pushFirstSeconds: defaultWindow, timeoutSeconds: 0, timeoutAction: "escalate" });
1820
- console.log(` ${dim("\xB7")} default: ${cyan(`${defaultWindow}s`)} ${dim("\xB7")} ${defaultLadder}`);
1821
- if (policy.modeOverride) {
1822
- console.log(` ${warn} mode override active: ${cyan(policy.modeOverride)} ${dim("(pushary mode status)")}`);
1823
- }
1824
- const overrides = (policy.policies ?? []).filter((p) => p.tool !== "*").slice(0, 4);
1825
- for (const p of overrides) {
1826
- console.log(` ${dim("\xB7")} ${waitRuleLabelOf(p.tool)}: ${describeWaitLadder(p)}`);
1827
- }
1828
- console.log(` ${dim("Tune it:")} ${cyan(pushWindowChangeStep(keyScope, getBaseUrl()))} ${dim("\xB7 full ladder:")} ${cyan("pushary wait status")}`);
1837
+ const modeState = await fetchModeState(apiKey);
1838
+ const config = await getPolicy(apiKey, modeState, CLAUDE_CODE_AGENT.type, true);
1839
+ console.log();
1840
+ console.log(` ${dim("Wait Ladder")} ${dim("(what happens when you don't answer)")}`);
1841
+ if (modeState.kill) {
1842
+ console.log(` ${warn} ${STOPPED_FROM_PUSHARY_LADDER} ${dim("(pushary mode status)")}`);
1843
+ } else {
1844
+ printResolvedWaitLadder(modeState, config);
1829
1845
  }
1846
+ console.log(` ${dim("Tune it:")} ${cyan(pushWindowChangeStep(keyScope, getBaseUrl()))} ${dim("\xB7 full ladder:")} ${cyan("pushary wait status")}`);
1830
1847
  } catch {
1831
1848
  }
1832
1849
  }
@@ -109,7 +109,7 @@ import {
109
109
  } from "../chunk-MYXHCXD3.js";
110
110
  import {
111
111
  describeWaitLadder
112
- } from "../chunk-2SMGO6SE.js";
112
+ } from "../chunk-7DZ7UZQE.js";
113
113
  import {
114
114
  writeJsonError,
115
115
  writeStdoutFully
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  describeWaitLadder,
8
8
  waitRuleLabelOf
9
- } from "../chunk-2SMGO6SE.js";
9
+ } from "../chunk-7DZ7UZQE.js";
10
10
  import {
11
11
  exitOnFailedSettingsRequest
12
12
  } from "../chunk-GS6XPW45.js";
@@ -0,0 +1,68 @@
1
+ import {
2
+ MCP_TOOLS_THAT_SEND_SOMETHING_OUT_LABEL,
3
+ MCP_TOOLS_THAT_SEND_SOMETHING_OUT_PATTERN,
4
+ WILDCARD_TOOL_PATTERN,
5
+ effectiveWaitSeconds,
6
+ hookMaxWaitSeconds
7
+ } from "./chunk-LE2GNKVF.js";
8
+
9
+ // src/wait-ladder.ts
10
+ var WAIT_RULE_LABELS = {
11
+ [WILDCARD_TOOL_PATTERN]: "default (*)",
12
+ [MCP_TOOLS_THAT_SEND_SOMETHING_OUT_PATTERN]: MCP_TOOLS_THAT_SEND_SOMETHING_OUT_LABEL
13
+ };
14
+ var waitRuleLabelOf = (tool) => Object.hasOwn(WAIT_RULE_LABELS, tool) ? WAIT_RULE_LABELS[tool] ?? tool : tool;
15
+ var HAND_BACK = "then hand back to the agent's own prompt";
16
+ var describeWaitLadder = (p) => {
17
+ if (p.mode === "terminal_only") return "no approval alerts, the agent's own prompt decides";
18
+ if (p.mode === "notify_only") return "send an approval alert, then the agent's own prompt decides";
19
+ if (p.mode === "push_only") {
20
+ if (p.timeoutAction === "wait") return `wait for your phone, ${HAND_BACK}`;
21
+ const tail = p.timeoutAction === "approve" ? "then auto-approve" : p.timeoutAction === "deny" ? "then auto-deny" : HAND_BACK;
22
+ return `wait for your phone up to ${p.timeoutSeconds}s, ${tail}`;
23
+ }
24
+ return `when you are away or Pushary cannot tell, ask your phone for ${p.pushFirstSeconds}s, ${HAND_BACK}`;
25
+ };
26
+ var HANDED_BACK_ACTION = "escalate";
27
+ var CLAUDE_CODE_HOOK_BUDGET = "claude";
28
+ var RISKY_EXAMPLE_CALL = { toolName: "Bash", toolInput: { command: "rm -rf build" } };
29
+ var outlastsTheHookBudget = (requestedSeconds, agent) => requestedSeconds > hookMaxWaitSeconds(agent);
30
+ var servedPushOnlyWait = (p, agent) => {
31
+ const requestedSeconds = effectiveWaitSeconds(p.timeoutAction, p.timeoutSeconds, agent);
32
+ const handsBack = p.timeoutAction === "wait" || outlastsTheHookBudget(requestedSeconds, agent);
33
+ return {
34
+ ...p,
35
+ timeoutSeconds: Math.min(requestedSeconds, hookMaxWaitSeconds(agent)),
36
+ timeoutAction: handsBack ? HANDED_BACK_ACTION : p.timeoutAction
37
+ };
38
+ };
39
+ var describeHookWaitLadder = (p, agent) => describeWaitLadder(p.mode === "push_only" ? servedPushOnlyWait(p, agent) : p);
40
+ var STOPPED_FROM_PUSHARY_LADDER = "agents are stopped from Pushary, every call is refused and nothing waits";
41
+ var UNREAD_MODE_LADDER = "your mode could not be read, so the waits below may be shorter than what the hook does";
42
+ var describeGateVerdictWait = (verdict, agent) => {
43
+ switch (verdict.kind) {
44
+ case "kill":
45
+ return STOPPED_FROM_PUSHARY_LADDER;
46
+ case "deny":
47
+ return "refused by a rule, nothing is asked";
48
+ case "allow":
49
+ return "approved by a rule, nothing is asked";
50
+ case "defer":
51
+ return "the agent's own prompt decides";
52
+ case "gate":
53
+ return describeHookWaitLadder(verdict.policy, agent);
54
+ }
55
+ };
56
+ var gateVerdictRuleOf = (verdict) => verdict.kind === "kill" ? null : verdict.policy.tool;
57
+
58
+ export {
59
+ waitRuleLabelOf,
60
+ describeWaitLadder,
61
+ CLAUDE_CODE_HOOK_BUDGET,
62
+ RISKY_EXAMPLE_CALL,
63
+ describeHookWaitLadder,
64
+ STOPPED_FROM_PUSHARY_LADDER,
65
+ UNREAD_MODE_LADDER,
66
+ describeGateVerdictWait,
67
+ gateVerdictRuleOf
68
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushary",
3
- "version": "1.9.281",
3
+ "version": "1.9.282",
4
4
  "description": "Human-in-the-loop (HITL) for AI agents: ask a person for approvals or answers by push notification. One command connects Claude Code, Codex, Cursor, Gemini CLI and more.",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,28 +0,0 @@
1
- import {
2
- MCP_TOOLS_THAT_SEND_SOMETHING_OUT_LABEL,
3
- MCP_TOOLS_THAT_SEND_SOMETHING_OUT_PATTERN,
4
- WILDCARD_TOOL_PATTERN
5
- } from "./chunk-LE2GNKVF.js";
6
-
7
- // src/wait-ladder.ts
8
- var WAIT_RULE_LABELS = {
9
- [WILDCARD_TOOL_PATTERN]: "default (*)",
10
- [MCP_TOOLS_THAT_SEND_SOMETHING_OUT_PATTERN]: MCP_TOOLS_THAT_SEND_SOMETHING_OUT_LABEL
11
- };
12
- var waitRuleLabelOf = (tool) => Object.hasOwn(WAIT_RULE_LABELS, tool) ? WAIT_RULE_LABELS[tool] ?? tool : tool;
13
- var HAND_BACK = "then hand back to the agent's own prompt";
14
- var describeWaitLadder = (p) => {
15
- if (p.mode === "terminal_only") return "no approval alerts, the agent's own prompt decides";
16
- if (p.mode === "notify_only") return "send an approval alert, then the agent's own prompt decides";
17
- if (p.mode === "push_only") {
18
- if (p.timeoutAction === "wait") return `wait for your phone, ${HAND_BACK}`;
19
- const tail = p.timeoutAction === "approve" ? "then auto-approve" : p.timeoutAction === "deny" ? "then auto-deny" : HAND_BACK;
20
- return `wait for your phone up to ${p.timeoutSeconds}s, ${tail}`;
21
- }
22
- return `when you are away or Pushary cannot tell, ask your phone for ${p.pushFirstSeconds}s, ${HAND_BACK}`;
23
- };
24
-
25
- export {
26
- waitRuleLabelOf,
27
- describeWaitLadder
28
- };