pushary 1.9.199 → 1.9.200
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 +4 -0
- package/dist/bin/pushary-claude.js +3 -5
- package/dist/bin/pushary-setup.js +139 -34
- package/dist/chunk-AVFPHV4N.js +10 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.200
|
|
4
|
+
|
|
5
|
+
- Setup's agent question no longer sets up an agent you unticked. Since 1.9.186, when no key was pressed there for 20 seconds, setup used the agents it detected, even if you had changed the ticks first. An agent you unticked was set up anyway, and an agent you ticked by hand was left out. Now, if you pressed any key, setup uses exactly what is ticked on screen when the 20 seconds run out, and says so. Each key still restarts the 20 seconds. If nothing is ticked, setup configures no agents, keeps your key, says how to finish, and exits with code 5; when no agent was detected either, it says so, as before. If no key was pressed at all, setup uses the detected agents as before, so an agent running setup in a terminal still never waits forever. `--agents`, `--yes`, `--json` and runs with nobody at the terminal are unchanged.
|
|
6
|
+
|
|
3
7
|
## 1.9.199
|
|
4
8
|
|
|
5
9
|
- When setup finishes and has reached your phone, it gives you one thing to try: a line to paste into a new agent session that has the agent ask you a multiple-choice question through Pushary and wait for your answer. It appears only when nothing still needs fixing and at least one agent with a Pushary question tool was set up.
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
scheduleWithTimer
|
|
4
|
+
} from "../chunk-AVFPHV4N.js";
|
|
2
5
|
import {
|
|
3
6
|
WRAPPER_ACTIVE_ENV,
|
|
4
7
|
findClaudeBinary
|
|
@@ -1439,11 +1442,6 @@ var runLocalLeg = (session, deps = {}) => {
|
|
|
1439
1442
|
|
|
1440
1443
|
// src/wrapper/remoteLoop.ts
|
|
1441
1444
|
var errMsg = (err) => err instanceof Error ? err.message : String(err);
|
|
1442
|
-
var scheduleWithTimer = (fire, delayMs) => {
|
|
1443
|
-
const timer = setTimeout(fire, delayMs);
|
|
1444
|
-
timer.unref?.();
|
|
1445
|
-
return () => clearTimeout(timer);
|
|
1446
|
-
};
|
|
1447
1445
|
var isTurnActivity = (message) => message.type !== "system" && message.type !== "result";
|
|
1448
1446
|
var isInit = (message) => message.type === "system" && message.subtype === "init";
|
|
1449
1447
|
var DEFAULT_MAX_RESTARTS = 5;
|
|
@@ -129,6 +129,9 @@ import {
|
|
|
129
129
|
import {
|
|
130
130
|
ensureCodexTrustsPusharyHooks
|
|
131
131
|
} from "../chunk-HQUYQOWZ.js";
|
|
132
|
+
import {
|
|
133
|
+
scheduleWithTimer
|
|
134
|
+
} from "../chunk-AVFPHV4N.js";
|
|
132
135
|
import {
|
|
133
136
|
describeSetupSideEffects,
|
|
134
137
|
installAgentSkill,
|
|
@@ -507,13 +510,114 @@ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync, cpSy
|
|
|
507
510
|
import { join as join5, dirname as dirname3, basename } from "path";
|
|
508
511
|
import { homedir, hostname } from "os";
|
|
509
512
|
import { execSync } from "child_process";
|
|
510
|
-
import {
|
|
513
|
+
import { input, confirm } from "@inquirer/prompts";
|
|
511
514
|
import { fileURLToPath } from "url";
|
|
512
515
|
import { parse as parseTOML, stringify as stringifyTOML } from "smol-toml";
|
|
513
516
|
|
|
514
517
|
// src/cli/exit.ts
|
|
515
518
|
var isExitPromptError = (err) => err instanceof Error && (err.name === "ExitPromptError" || err.message.includes("User force closed") || /force closed the prompt/i.test(err.message));
|
|
516
|
-
|
|
519
|
+
|
|
520
|
+
// src/setup/agent-picker.ts
|
|
521
|
+
import {
|
|
522
|
+
createPrompt,
|
|
523
|
+
isDownKey,
|
|
524
|
+
isEnterKey,
|
|
525
|
+
isNumberKey,
|
|
526
|
+
isSpaceKey,
|
|
527
|
+
isUpKey,
|
|
528
|
+
makeTheme,
|
|
529
|
+
useEffect,
|
|
530
|
+
useKeypress,
|
|
531
|
+
usePagination,
|
|
532
|
+
usePrefix,
|
|
533
|
+
useState
|
|
534
|
+
} from "@inquirer/core";
|
|
535
|
+
import { cursorHide } from "@inquirer/ansi";
|
|
536
|
+
import figures from "@inquirer/figures";
|
|
537
|
+
import { styleText } from "util";
|
|
538
|
+
var PAGE_SIZE = 7;
|
|
539
|
+
var SELECT_ALL_KEY = "a";
|
|
540
|
+
var INVERT_KEY = "i";
|
|
541
|
+
var KEY_HELP = [
|
|
542
|
+
["\u2191\u2193", "navigate"],
|
|
543
|
+
["space", "select"],
|
|
544
|
+
[SELECT_ALL_KEY, "all"],
|
|
545
|
+
[INVERT_KEY, "invert"],
|
|
546
|
+
["\u23CE", "submit"]
|
|
547
|
+
];
|
|
548
|
+
var tickedAgents = (choices) => choices.filter((choice) => choice.checked).map((choice) => choice.value);
|
|
549
|
+
var withToggleAt = (choices, position) => choices.map((choice, index) => index === position ? { ...choice, checked: !choice.checked } : choice);
|
|
550
|
+
var withEveryChoiceSetTo = (choices, checked) => choices.map((choice) => ({ ...choice, checked }));
|
|
551
|
+
var withSelectAllApplied = (choices) => withEveryChoiceSetTo(choices, choices.some((choice) => !choice.checked));
|
|
552
|
+
var withEveryChoiceFlipped = (choices) => choices.map((choice) => ({ ...choice, checked: !choice.checked }));
|
|
553
|
+
var cursorMovedBy = (active, offset, length) => (active + offset + length) % length;
|
|
554
|
+
var outcomeWhenIdle = (keystrokes, choices) => keystrokes === 0 ? { kind: "idle-before-any-key" } : { kind: "idle-after-keys", agents: tickedAgents(choices) };
|
|
555
|
+
var PICKER_THEME = makeTheme();
|
|
556
|
+
var renderedRow = ({ item, isActive }) => {
|
|
557
|
+
const cursor = isActive ? figures.pointer : " ";
|
|
558
|
+
const box = item.checked ? styleText("green", figures.circleFilled) : figures.circle;
|
|
559
|
+
const row = `${cursor}${box} ${item.name}`;
|
|
560
|
+
return isActive ? PICKER_THEME.style.highlight(row) : row;
|
|
561
|
+
};
|
|
562
|
+
var renderedKeyHelp = () => KEY_HELP.map(([key, action]) => `${styleText("bold", key)} ${styleText("dim", action)}`).join(styleText("dim", " \u2022 "));
|
|
563
|
+
var renderedAnswer = (choices) => PICKER_THEME.style.answer(choices.filter((choice) => choice.checked).map((choice) => choice.short).join(", "));
|
|
564
|
+
var renderAgentPicker = (config, done) => {
|
|
565
|
+
const [status, setStatus] = useState("idle");
|
|
566
|
+
const [choices, setChoices] = useState(config.choices);
|
|
567
|
+
const [active, setActive] = useState(0);
|
|
568
|
+
const [error, setError] = useState(void 0);
|
|
569
|
+
const [keystrokes, setKeystrokes] = useState(0);
|
|
570
|
+
const prefix = usePrefix({ status, theme: PICKER_THEME });
|
|
571
|
+
const scheduleIdle = config.scheduleIdle ?? scheduleWithTimer;
|
|
572
|
+
const settle = (outcome) => {
|
|
573
|
+
setStatus("done");
|
|
574
|
+
done(outcome);
|
|
575
|
+
};
|
|
576
|
+
useEffect(() => scheduleIdle(() => settle(outcomeWhenIdle(keystrokes, choices)), config.idleLimitMs), [keystrokes]);
|
|
577
|
+
const submit = () => {
|
|
578
|
+
const picked = tickedAgents(choices);
|
|
579
|
+
const verdict = config.validate(picked);
|
|
580
|
+
if (verdict === true) settle({ kind: "answered", agents: picked });
|
|
581
|
+
else setError(verdict);
|
|
582
|
+
};
|
|
583
|
+
const moveCursor = (offset) => {
|
|
584
|
+
setError(void 0);
|
|
585
|
+
setActive(cursorMovedBy(active, offset, choices.length));
|
|
586
|
+
};
|
|
587
|
+
const toggleActiveChoice = () => {
|
|
588
|
+
setError(void 0);
|
|
589
|
+
setChoices(withToggleAt(choices, active));
|
|
590
|
+
};
|
|
591
|
+
const toggleNumberedChoice = (key) => {
|
|
592
|
+
const position = Number(key.name) - 1;
|
|
593
|
+
if (position < 0 || position >= choices.length) return;
|
|
594
|
+
setActive(position);
|
|
595
|
+
setChoices(withToggleAt(choices, position));
|
|
596
|
+
};
|
|
597
|
+
const respondToKey = (key) => {
|
|
598
|
+
setKeystrokes(keystrokes + 1);
|
|
599
|
+
if (isEnterKey(key)) submit();
|
|
600
|
+
else if (isUpKey(key)) moveCursor(-1);
|
|
601
|
+
else if (isDownKey(key)) moveCursor(1);
|
|
602
|
+
else if (isSpaceKey(key)) toggleActiveChoice();
|
|
603
|
+
else if (isNumberKey(key)) toggleNumberedChoice(key);
|
|
604
|
+
else if (key.name === SELECT_ALL_KEY) setChoices(withSelectAllApplied(choices));
|
|
605
|
+
else if (key.name === INVERT_KEY) setChoices(withEveryChoiceFlipped(choices));
|
|
606
|
+
};
|
|
607
|
+
useKeypress(respondToKey);
|
|
608
|
+
const message = PICKER_THEME.style.message(config.message, status);
|
|
609
|
+
const page = usePagination({ items: choices, active, renderItem: renderedRow, pageSize: PAGE_SIZE, loop: true });
|
|
610
|
+
if (status === "done") return [prefix, message, renderedAnswer(choices)].filter(Boolean).join(" ");
|
|
611
|
+
const lines = [
|
|
612
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
613
|
+
page,
|
|
614
|
+
" ",
|
|
615
|
+
error ? PICKER_THEME.style.error(error) : "",
|
|
616
|
+
renderedKeyHelp()
|
|
617
|
+
].filter(Boolean).join("\n").trimEnd();
|
|
618
|
+
return `${lines}${cursorHide}`;
|
|
619
|
+
};
|
|
620
|
+
var pickAgentsUntilIdle = createPrompt(renderAgentPicker);
|
|
517
621
|
|
|
518
622
|
// src/setup/agent-targets.ts
|
|
519
623
|
import { join } from "path";
|
|
@@ -2471,25 +2575,8 @@ var detectAgents = () => {
|
|
|
2471
2575
|
var canRunBrowserLogin = () => process.stdout.isTTY === true && !isCI();
|
|
2472
2576
|
var AGENT_PICKER_IDLE_LIMIT_MS = 2e4;
|
|
2473
2577
|
var answeredWith = (agents) => ({ agents, nobodyAnswered: false });
|
|
2474
|
-
var
|
|
2475
|
-
|
|
2476
|
-
const expire = () => controller.abort();
|
|
2477
|
-
let timer = setTimeout(expire, idleMs);
|
|
2478
|
-
timer.unref();
|
|
2479
|
-
const restart = () => {
|
|
2480
|
-
clearTimeout(timer);
|
|
2481
|
-
timer = setTimeout(expire, idleMs);
|
|
2482
|
-
timer.unref();
|
|
2483
|
-
};
|
|
2484
|
-
process.stdin.on("keypress", restart);
|
|
2485
|
-
return {
|
|
2486
|
-
signal: controller.signal,
|
|
2487
|
-
stop: () => {
|
|
2488
|
-
clearTimeout(timer);
|
|
2489
|
-
process.stdin.off("keypress", restart);
|
|
2490
|
-
}
|
|
2491
|
-
};
|
|
2492
|
-
};
|
|
2578
|
+
var AGENT_PICKER_IDLE_SECONDS = AGENT_PICKER_IDLE_LIMIT_MS / 1e3;
|
|
2579
|
+
var CHOOSE_WITH_AGENTS_FLAG = "(--agents to choose)";
|
|
2493
2580
|
var selectDetectedAgents = async (detected) => {
|
|
2494
2581
|
const picked = Object.keys(detected).filter((agent) => detected[agent].found);
|
|
2495
2582
|
if (picked.length === 0) {
|
|
@@ -2498,9 +2585,32 @@ var selectDetectedAgents = async (detected) => {
|
|
|
2498
2585
|
console.log();
|
|
2499
2586
|
process.exit(await abortWith("no-agents-detected", EXIT.PROBLEMS_FOUND));
|
|
2500
2587
|
}
|
|
2501
|
-
console.log(` ${check} Selected automatically: ${picked.map((a) => AGENT_NAMES[a]).join(", ")} ${dim(
|
|
2588
|
+
console.log(` ${check} Selected automatically: ${picked.map((a) => AGENT_NAMES[a]).join(", ")} ${dim(CHOOSE_WITH_AGENTS_FLAG)}`);
|
|
2502
2589
|
return picked;
|
|
2503
2590
|
};
|
|
2591
|
+
var noAgentDetected = (detected) => !Object.values(detected).some((agent) => agent.found);
|
|
2592
|
+
var selectAgentsTickedWhenIdle = async (ticked, detected) => {
|
|
2593
|
+
if (ticked.length === 0 && noAgentDetected(detected)) return selectDetectedAgents(detected);
|
|
2594
|
+
if (ticked.length === 0) {
|
|
2595
|
+
console.log(` ${yellow("!")} Nothing was pressed for ${AGENT_PICKER_IDLE_SECONDS} seconds and no agent was ticked, so nothing was configured. Your API key is saved.`);
|
|
2596
|
+
console.log(` ${dim("Re-run setup and tick one, name one with --agents <id>, or pass --agents none to accept this.")}`);
|
|
2597
|
+
console.log();
|
|
2598
|
+
process.exit(await abortWith("interrupted", EXIT.PROBLEMS_FOUND));
|
|
2599
|
+
}
|
|
2600
|
+
console.log(` ${yellow("!")} Nothing was pressed for ${AGENT_PICKER_IDLE_SECONDS} seconds, so setup is using what you ticked: ${ticked.map((agent) => AGENT_NAMES[agent]).join(", ")} ${dim(CHOOSE_WITH_AGENTS_FLAG)}`);
|
|
2601
|
+
return ticked;
|
|
2602
|
+
};
|
|
2603
|
+
var agentResolutionFromPicker = async (outcome, detected) => {
|
|
2604
|
+
switch (outcome.kind) {
|
|
2605
|
+
case "answered":
|
|
2606
|
+
return answeredWith(outcome.agents);
|
|
2607
|
+
case "idle-before-any-key":
|
|
2608
|
+
console.log(` ${yellow("!")} Nothing was pressed at the agent question for ${AGENT_PICKER_IDLE_SECONDS} seconds.`);
|
|
2609
|
+
return { agents: await selectDetectedAgents(detected), nobodyAnswered: true };
|
|
2610
|
+
case "idle-after-keys":
|
|
2611
|
+
return { agents: await selectAgentsTickedWhenIdle(outcome.agents, detected), nobodyAnswered: true };
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2504
2614
|
var resolveAgents = async (options) => {
|
|
2505
2615
|
if (options.agents.kind === "none") return answeredWith([]);
|
|
2506
2616
|
if (options.agents.kind === "explicit") {
|
|
@@ -2520,9 +2630,8 @@ var resolveAgents = async (options) => {
|
|
|
2520
2630
|
});
|
|
2521
2631
|
if (selection.kind === "auto") return answeredWith(await selectDetectedAgents(detected));
|
|
2522
2632
|
const hint = hasDetectedAgents ? "(detected agents pre-selected)" : "(space = toggle, enter = confirm)";
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
return answeredWith(await checkbox({
|
|
2633
|
+
return agentResolutionFromPicker(
|
|
2634
|
+
await pickAgentsUntilIdle({
|
|
2526
2635
|
message: "Which agents do you use? " + dim(hint),
|
|
2527
2636
|
choices: Object.keys(AGENT_LABELS).map((agent) => ({
|
|
2528
2637
|
// The evidence rides along so a detection the user disagrees with is
|
|
@@ -2533,15 +2642,11 @@ var resolveAgents = async (options) => {
|
|
|
2533
2642
|
checked: detected[agent].found
|
|
2534
2643
|
})),
|
|
2535
2644
|
// Today an empty selection skips the loop and still prints "Setup complete."
|
|
2536
|
-
validate: (picked) => picked.length > 0 || "Select at least one agent, or re-run with --agents none."
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
return { agents: await selectDetectedAgents(detected), nobodyAnswered: true };
|
|
2542
|
-
} finally {
|
|
2543
|
-
deadline.stop();
|
|
2544
|
-
}
|
|
2645
|
+
validate: (picked) => picked.length > 0 || "Select at least one agent, or re-run with --agents none.",
|
|
2646
|
+
idleLimitMs: AGENT_PICKER_IDLE_LIMIT_MS
|
|
2647
|
+
}),
|
|
2648
|
+
detected
|
|
2649
|
+
);
|
|
2545
2650
|
};
|
|
2546
2651
|
var AGENT_TARGETS = agentSetupTargets(existsSync2);
|
|
2547
2652
|
var reportDryRun = (apiKey, agents, keyCheck, controlMode) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pushary",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.200",
|
|
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",
|
|
@@ -100,6 +100,9 @@
|
|
|
100
100
|
"gen:hooks-spec": "bun scripts/generate-hooks-spec.ts"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
+
"@inquirer/ansi": "^2.0.5",
|
|
104
|
+
"@inquirer/core": "^11.1.9",
|
|
105
|
+
"@inquirer/figures": "^2.0.5",
|
|
103
106
|
"@inquirer/prompts": "^8.4.2",
|
|
104
107
|
"qrcode-terminal": "^0.12.0",
|
|
105
108
|
"smol-toml": "^1.6.1",
|