@pushary/agent-hooks 1.9.36 → 1.9.38
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 +12 -0
- package/dist/bin/pushary-bell-hook.js +25 -25
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +24 -24
- package/dist/bin/pushary-clean.js +29 -29
- package/dist/bin/pushary-codex-bridge.js +40 -29
- package/dist/bin/pushary-codex-hook.js +66 -41
- package/dist/bin/pushary-codex.js +12 -12
- package/dist/bin/pushary-connect.js +24 -24
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +32 -32
- package/dist/bin/pushary-disconnect.js +24 -24
- package/dist/bin/pushary-doctor.js +33 -33
- package/dist/bin/pushary-elicitation-hook.js +25 -25
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +27 -27
- package/dist/bin/pushary-hook.js +29 -29
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +24 -24
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +12 -12
- package/dist/bin/pushary-notification-hook.js +24 -24
- package/dist/bin/pushary-opencode-hook.js +26 -26
- package/dist/bin/pushary-permission-denied-hook.js +29 -29
- package/dist/bin/pushary-permission-hook.js +28 -28
- package/dist/bin/pushary-post-hook.js +24 -24
- package/dist/bin/pushary-prompt-hook.js +24 -24
- package/dist/bin/pushary-session-end-hook.js +24 -24
- package/dist/bin/pushary-session-start-hook.js +28 -28
- package/dist/bin/pushary-setup.js +35 -35
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +26 -26
- package/dist/bin/pushary-stop-hook.js +24 -24
- package/dist/bin/pushary-stopfailure-hook.js +24 -24
- package/dist/bin/pushary-suggestions.js +12 -12
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +30 -30
- package/dist/bin/pushary-wait.js +12 -12
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-NE5OPCD5.js → chunk-3DXDJL4K.js} +4 -4
- package/dist/{chunk-EGTVN6YV.js → chunk-3HUHP4A4.js} +1 -1
- package/dist/{chunk-H3MOTS2C.js → chunk-4D54LZGF.js} +1 -1
- package/dist/{chunk-K5X25GUV.js → chunk-4GEHVRV3.js} +9 -6
- package/dist/{chunk-UDHT3W7I.js → chunk-5DC2PRVT.js} +2 -2
- package/dist/{chunk-VRALPR4B.js → chunk-5KVL4AP5.js} +4 -4
- package/dist/{chunk-SHLLDMPM.js → chunk-7GSOIBVM.js} +4 -4
- package/dist/{chunk-FBKGGIFB.js → chunk-7O5U5TED.js} +5 -5
- package/dist/{chunk-EH635XAR.js → chunk-7P43CI6G.js} +2 -2
- package/dist/{chunk-BS64ZHTB.js → chunk-ABDGTGBT.js} +5 -4
- package/dist/{chunk-7GQILLZD.js → chunk-AI2YBW42.js} +5 -5
- package/dist/{chunk-Y5FCB66K.js → chunk-AJIH4JGB.js} +5 -5
- package/dist/{chunk-MBBPLF5T.js → chunk-B54Q4I7T.js} +2 -2
- package/dist/{chunk-CRZ4CP7C.js → chunk-BMHD2NEH.js} +3 -3
- package/dist/chunk-CHRRBADC.js +184 -0
- package/dist/{chunk-ML42WKI7.js → chunk-CW3IJD2H.js} +3 -3
- package/dist/{chunk-JWURAYXK.js → chunk-D2G6HWEA.js} +2 -2
- package/dist/{chunk-PRKH662J.js → chunk-D322CKL2.js} +1 -1
- package/dist/{chunk-HCKBZYBW.js → chunk-D5IAEPFA.js} +2 -2
- package/dist/{chunk-QHL3Y6D2.js → chunk-DDRLK67P.js} +2 -2
- package/dist/{chunk-TRNSODJ6.js → chunk-FLEWP4BV.js} +1 -1
- package/dist/{chunk-EQXMVKKD.js → chunk-FZEQWY7Q.js} +1 -1
- package/dist/{chunk-J36W6ARB.js → chunk-G3CNMCQS.js} +1 -1
- package/dist/{chunk-ULDOQF4Q.js → chunk-GBNG6QEV.js} +3 -3
- package/dist/{chunk-GTEF64CJ.js → chunk-HCXBAF43.js} +1 -1
- package/dist/{chunk-U2PUHT4W.js → chunk-IBUAVM6X.js} +1 -1
- package/dist/{chunk-CHWJ7ZXI.js → chunk-J2APHNZL.js} +5 -5
- package/dist/{chunk-5ML6E3L7.js → chunk-JVKY6ILU.js} +1 -1
- package/dist/{chunk-42FTY5II.js → chunk-JWMCGL3P.js} +3 -3
- package/dist/{chunk-4E4PZQFE.js → chunk-K2CZJBUS.js} +4 -4
- package/dist/{chunk-YRAPCLOB.js → chunk-KBMQYMGG.js} +6 -6
- package/dist/{chunk-6LKIK7V2.js → chunk-L5WOYQT7.js} +8 -8
- package/dist/{chunk-ETGGQWBR.js → chunk-LZZ3EKKI.js} +4 -4
- package/dist/{chunk-26AEFJSK.js → chunk-MBTNHQCI.js} +2 -2
- package/dist/{chunk-5S2P2CK6.js → chunk-MIENLS7P.js} +2 -2
- package/dist/{chunk-LL256PHP.js → chunk-MXEDMQLC.js} +1 -1
- package/dist/{chunk-RNRCOOQZ.js → chunk-N2I7RMC6.js} +34 -109
- package/dist/{chunk-RYXSY3RH.js → chunk-NRVZNZVE.js} +5 -5
- package/dist/{chunk-GNESC5EF.js → chunk-OLS4DTFN.js} +3 -3
- package/dist/{chunk-L25KSDIB.js → chunk-PA3OZGIA.js} +8 -8
- package/dist/{chunk-QPUTCMAK.js → chunk-QC7ZNZMZ.js} +1 -1
- package/dist/{chunk-2DZBIELP.js → chunk-QOUW57RT.js} +170 -67
- package/dist/{chunk-55XIK7YS.js → chunk-QZ4KOMFE.js} +1 -1
- package/dist/{chunk-CRZKFEEO.js → chunk-RISJLN3O.js} +2 -2
- package/dist/{chunk-CHNSFTD5.js → chunk-RULJMNY7.js} +2 -2
- package/dist/{chunk-556JCOMK.js → chunk-STXWIYAY.js} +4 -4
- package/dist/{chunk-IPYCRJGM.js → chunk-TEG2JL5M.js} +7 -7
- package/dist/{chunk-KCUTE3EB.js → chunk-VITJTFFT.js} +2 -2
- package/dist/{chunk-DC6KHRVH.js → chunk-W2TXFM6O.js} +1 -1
- package/dist/{chunk-JAA7YJJZ.js → chunk-WASCAI2U.js} +4 -4
- package/dist/{chunk-7MOFAAZ3.js → chunk-WLQENMOW.js} +4 -4
- package/dist/{chunk-X4BPD5RD.js → chunk-WR3GKYKD.js} +1 -1
- package/dist/{chunk-F5W7B7YT.js → chunk-Y3XF324T.js} +1 -1
- package/dist/{chunk-4NMDFPK7.js → chunk-ZFJAZBBF.js} +5 -5
- package/dist/{global-upgrade-EF6RZBPU.js → global-upgrade-ROZHFAO5.js} +6 -6
- package/dist/{paths-F645XTFZ.js → paths-FSFFGRRU.js} +2 -2
- package/dist/{reapply-HJOTWJAN.js → reapply-WY5LHIR4.js} +20 -20
- package/dist/src/index.js +19 -19
- package/dist/{upgrade-lock-APUN7YKQ.js → upgrade-lock-6PYOTF4X.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-MNXHKEXB.js +0 -71
|
@@ -1562,41 +1562,33 @@ var DOTNET_DOWNLOAD = /\.Download(?:String|Data|File)(?:Async|TaskAsync)?\s*\(/i
|
|
|
1562
1562
|
var SCRIPTBLOCK_FROM_TEXT = /\[(?:System\.Management\.Automation\.)?ScriptBlock\]::Create\s*\(/i;
|
|
1563
1563
|
var POWERSHELL_HOSTS = /* @__PURE__ */ new Set(["powershell", "pwsh", "powershell_ise"]);
|
|
1564
1564
|
var WINDOWS_POWERSHELL_HOST = "powershell";
|
|
1565
|
-
var
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
"
|
|
1572
|
-
"
|
|
1573
|
-
"
|
|
1574
|
-
"
|
|
1575
|
-
"
|
|
1576
|
-
]
|
|
1577
|
-
|
|
1578
|
-
"
|
|
1579
|
-
"
|
|
1580
|
-
"
|
|
1581
|
-
"
|
|
1582
|
-
"
|
|
1583
|
-
"
|
|
1584
|
-
"
|
|
1585
|
-
"
|
|
1586
|
-
"
|
|
1587
|
-
"
|
|
1588
|
-
"
|
|
1589
|
-
"-if",
|
|
1590
|
-
"-outputformat",
|
|
1591
|
-
"-of",
|
|
1592
|
-
"-o",
|
|
1593
|
-
"-version",
|
|
1594
|
-
"-v",
|
|
1595
|
-
"-settingsfile",
|
|
1596
|
-
"-custompipename",
|
|
1597
|
-
"-psconsolefile"
|
|
1565
|
+
var POWERSHELL_HOST_COMMAND_PARAMETER = "command";
|
|
1566
|
+
var POWERSHELL_HOST_COMMAND_WITH_ARGS_PARAMETERS = /* @__PURE__ */ new Set(["commandwithargs", "cwa"]);
|
|
1567
|
+
var POWERSHELL_HOST_FILE_PARAMETER = "file";
|
|
1568
|
+
var POWERSHELL_HOST_ENCODED_PARAMETER = "encodedcommand";
|
|
1569
|
+
var POWERSHELL_HOST_ENCODED_ALIAS = "ec";
|
|
1570
|
+
var POWERSHELL_HOST_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Map([
|
|
1571
|
+
["executionpolicy", "ex"],
|
|
1572
|
+
["ep", "ep"],
|
|
1573
|
+
["windowstyle", "w"],
|
|
1574
|
+
["workingdirectory", "wo"],
|
|
1575
|
+
["wd", "wd"],
|
|
1576
|
+
["configurationname", "config"],
|
|
1577
|
+
["configurationfile", "configurationfile"],
|
|
1578
|
+
["custompipename", "cus"],
|
|
1579
|
+
["inputformat", "inp"],
|
|
1580
|
+
["if", "if"],
|
|
1581
|
+
["outputformat", "o"],
|
|
1582
|
+
["of", "of"],
|
|
1583
|
+
["version", "v"],
|
|
1584
|
+
["settingsfile", "settings"],
|
|
1585
|
+
["psconsolefile", "ps"],
|
|
1586
|
+
["token", "to"],
|
|
1587
|
+
["encodedarguments", "encodeda"],
|
|
1588
|
+
["ea", "ea"]
|
|
1598
1589
|
]);
|
|
1599
|
-
var POWERSHELL_HOST_SWITCH = /^[
|
|
1590
|
+
var POWERSHELL_HOST_SWITCH = /^[-/–—―]/;
|
|
1591
|
+
var POWERSHELL_HOST_SWITCH_PREFIX = /^([-–—―])\1?|^\//;
|
|
1600
1592
|
var POWERSHELL_FILE_RUNNERS = /* @__PURE__ */ new Set(["start-process", "invoke-item", "msiexec"]);
|
|
1601
1593
|
var WINDOWS_SWITCH = /^[-/–—―]/;
|
|
1602
1594
|
var CMD_PROGRAM = "cmd";
|
|
@@ -1752,23 +1744,33 @@ var runsADownloadedFile = (stages, judge) => {
|
|
|
1752
1744
|
});
|
|
1753
1745
|
};
|
|
1754
1746
|
var invokedExpressionsOf = (command) => command.cmdlet === INVOKE_EXPRESSION ? positionalTextsOf(command) : [];
|
|
1755
|
-
var
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
index += POWERSHELL_HOST_OPTIONS_WITH_A_VALUE.has((texts[index] ?? "").toLowerCase()) ? 2 : 1;
|
|
1747
|
+
var hostOptionTakesValue = (option) => {
|
|
1748
|
+
for (const [name, shortest] of POWERSHELL_HOST_OPTIONS_WITH_A_VALUE) {
|
|
1749
|
+
if (option.length >= shortest.length && name.startsWith(option)) return true;
|
|
1759
1750
|
}
|
|
1760
|
-
return
|
|
1751
|
+
return false;
|
|
1761
1752
|
};
|
|
1762
1753
|
var hostedPowerShellScriptOf = (command) => {
|
|
1763
|
-
if (!POWERSHELL_HOSTS.has(command.name)) return
|
|
1754
|
+
if (!POWERSHELL_HOSTS.has(command.name)) return { kind: "none" };
|
|
1764
1755
|
const texts = command.args.map((arg) => arg.text);
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1756
|
+
for (let index = 0; index < texts.length; index += 1) {
|
|
1757
|
+
const text = (texts[index] ?? "").trim();
|
|
1758
|
+
if (!text) continue;
|
|
1759
|
+
if (!POWERSHELL_HOST_SWITCH.test(text)) {
|
|
1760
|
+
return command.name === WINDOWS_POWERSHELL_HOST ? { kind: "script", script: texts.slice(index).join(" ") } : { kind: "none" };
|
|
1761
|
+
}
|
|
1762
|
+
const option = text.toLowerCase().replace(POWERSHELL_HOST_SWITCH_PREFIX, "");
|
|
1763
|
+
if (option && (POWERSHELL_HOST_ENCODED_PARAMETER.startsWith(option) || option === POWERSHELL_HOST_ENCODED_ALIAS)) {
|
|
1764
|
+
return { kind: "incomplete", reason: "encoded_command" };
|
|
1765
|
+
}
|
|
1766
|
+
if (option && POWERSHELL_HOST_COMMAND_PARAMETER.startsWith(option)) {
|
|
1767
|
+
return { kind: "script", script: texts.slice(index + 1).join(" ") };
|
|
1768
|
+
}
|
|
1769
|
+
if (POWERSHELL_HOST_COMMAND_WITH_ARGS_PARAMETERS.has(option)) return { kind: "script", script: texts[index + 1] ?? "" };
|
|
1770
|
+
if (option && POWERSHELL_HOST_FILE_PARAMETER.startsWith(option)) return { kind: "none" };
|
|
1771
|
+
if (hostOptionTakesValue(option)) index += 1;
|
|
1770
1772
|
}
|
|
1771
|
-
return
|
|
1773
|
+
return { kind: "none" };
|
|
1772
1774
|
};
|
|
1773
1775
|
var cmdScriptOf = (command) => {
|
|
1774
1776
|
if (command.name !== CMD_PROGRAM) return void 0;
|
|
@@ -1818,38 +1820,51 @@ var scriptsInsideTheStage = (stage) => {
|
|
|
1818
1820
|
const groups = [...stage.words, ...stage.redirectTargets].flatMap((word) => word.nested);
|
|
1819
1821
|
const command = powerShellCommandOf(stage);
|
|
1820
1822
|
if (command === null) return { ...NO_SCRIPTS_INSIDE, powerShell: groups };
|
|
1823
|
+
const hosted = hostedPowerShellScriptOf(command);
|
|
1824
|
+
if (hosted.kind === "incomplete") return hosted;
|
|
1821
1825
|
const cmd = presentOnly(cmdScriptOf(command));
|
|
1822
1826
|
return {
|
|
1823
|
-
powerShell: [...groups, ...invokedExpressionsOf(command), ...
|
|
1827
|
+
powerShell: [...groups, ...invokedExpressionsOf(command), ...hosted.kind === "script" ? [hosted.script] : [], ...cmd.flatMap(cmdPiecesOf)],
|
|
1824
1828
|
cmd,
|
|
1825
1829
|
posix: presentOnly(wslCommandWordsOf(command))
|
|
1826
1830
|
};
|
|
1827
1831
|
};
|
|
1828
1832
|
var powerShellReadingAt = (command, depth) => {
|
|
1829
1833
|
const statements = powerShellStatementsOf(command);
|
|
1830
|
-
if (statements === null) return
|
|
1831
|
-
const inside =
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
+
if (statements === null) return { kind: "incomplete", reason: "syntax" };
|
|
1835
|
+
const inside = [];
|
|
1836
|
+
for (const stage of statements.flatMap((statement) => statement.stages)) {
|
|
1837
|
+
const scripts = scriptsInsideTheStage(stage);
|
|
1838
|
+
if ("kind" in scripts) return scripts;
|
|
1839
|
+
inside.push(scripts);
|
|
1840
|
+
}
|
|
1841
|
+
const nested = inside.flatMap((scripts) => scripts.powerShell);
|
|
1842
|
+
if (nested.length > 0 && depth >= MAX_NESTED_SCRIPT_DEPTH) return { kind: "incomplete", reason: "nesting_limit" };
|
|
1843
|
+
const readings = [];
|
|
1844
|
+
for (const script of nested) {
|
|
1845
|
+
const analysis = powerShellReadingAt(script, depth + 1);
|
|
1846
|
+
if (analysis.kind === "incomplete") return analysis;
|
|
1847
|
+
readings.push(analysis.reading);
|
|
1848
|
+
}
|
|
1834
1849
|
return {
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
...
|
|
1840
|
-
|
|
1841
|
-
]
|
|
1850
|
+
kind: "complete",
|
|
1851
|
+
reading: {
|
|
1852
|
+
statements: [...statements, ...readings.flatMap((reading) => reading.statements)],
|
|
1853
|
+
cmdScripts: [...inside.flatMap((scripts) => scripts.cmd), ...readings.flatMap((reading) => reading.cmdScripts)],
|
|
1854
|
+
posixCommands: [...inside.flatMap((scripts) => scripts.posix), ...readings.flatMap((reading) => reading.posixCommands)]
|
|
1855
|
+
}
|
|
1842
1856
|
};
|
|
1843
1857
|
};
|
|
1844
1858
|
var stagesOfTheReading = (reading) => reading.statements.flatMap((statement) => statement.stages);
|
|
1845
|
-
var powerShellReadingIsDestructive = (reading, judge) => stagesOfTheReading(reading).some((stage) => stageIsDestructive(stage, judge)) || reading.cmdScripts.some(cmdScriptRemovesRecursively)
|
|
1859
|
+
var powerShellReadingIsDestructive = (reading, judge) => stagesOfTheReading(reading).some((stage) => stageIsDestructive(stage, judge)) || reading.cmdScripts.some(cmdScriptRemovesRecursively);
|
|
1846
1860
|
var powerShellCommandIsDestructive = (command, judge) => {
|
|
1847
|
-
const
|
|
1848
|
-
return
|
|
1861
|
+
const analysis = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
|
|
1862
|
+
return analysis.kind === "incomplete" || powerShellReadingIsDestructive(analysis.reading, judge);
|
|
1849
1863
|
};
|
|
1850
1864
|
var powerShellCommandHasAVisibleConsequence = (command, judge) => {
|
|
1851
|
-
const
|
|
1852
|
-
if (
|
|
1865
|
+
const analysis = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
|
|
1866
|
+
if (analysis.kind === "incomplete") return true;
|
|
1867
|
+
const { reading } = analysis;
|
|
1853
1868
|
const stages = stagesOfTheReading(reading);
|
|
1854
1869
|
return powerShellReadingIsDestructive(reading, judge) || stages.some((stage) => stageHasAVisibleConsequence(stage, judge)) || reading.statements.some(listsRecursivelyIntoARemoval) || runsFetchedPowerShellCode(stages, judge) || runsADownloadedFile(stages, judge) || reading.posixCommands.some((words) => judge.commandShowsAConsequence(words));
|
|
1855
1870
|
};
|
|
@@ -2509,11 +2524,25 @@ var isAutoUpdateResult = (value) => typeof value === "string" && AUTO_UPDATE_RES
|
|
|
2509
2524
|
// ../contracts/src/answer-drafts.ts
|
|
2510
2525
|
var ANSWER_DRAFT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
2511
2526
|
|
|
2527
|
+
// ../contracts/src/decision-lifetime.ts
|
|
2528
|
+
var DECISION_REMINDER_DELAY_MS = 10 * 60 * 1e3;
|
|
2529
|
+
var DECISION_CACHE_TTL_SECONDS = 10 * 60;
|
|
2530
|
+
|
|
2512
2531
|
// ../contracts/src/index.ts
|
|
2513
2532
|
var KEY_SCOPES = ["full_access", "agent", "connector", "bound"];
|
|
2514
2533
|
var normalizeKeyScope = (value) => typeof value === "string" && KEY_SCOPES.includes(value) ? value : null;
|
|
2515
2534
|
var APPROVAL_MODES = ["push_only", "terminal_only", "push_first", "notify_only"];
|
|
2516
2535
|
var isApprovalMode = (value) => typeof value === "string" && APPROVAL_MODES.includes(value);
|
|
2536
|
+
var approvalWaitsAtTheAgentsPrompt = (mode) => {
|
|
2537
|
+
switch (mode) {
|
|
2538
|
+
case "push_first":
|
|
2539
|
+
case "push_only":
|
|
2540
|
+
return false;
|
|
2541
|
+
case "notify_only":
|
|
2542
|
+
case "terminal_only":
|
|
2543
|
+
return true;
|
|
2544
|
+
}
|
|
2545
|
+
};
|
|
2517
2546
|
var approvalModeWithoutLocalPrompt = (mode) => {
|
|
2518
2547
|
switch (mode) {
|
|
2519
2548
|
case "push_first":
|
|
@@ -2560,6 +2589,25 @@ var parseAgentQuestions = (toolInput) => {
|
|
|
2560
2589
|
}
|
|
2561
2590
|
return parsed;
|
|
2562
2591
|
};
|
|
2592
|
+
var isAgentQuestionSet = (value) => {
|
|
2593
|
+
if (!Array.isArray(value) || value.length === 0 || value.length > 4) return false;
|
|
2594
|
+
const questions = /* @__PURE__ */ new Set();
|
|
2595
|
+
for (const item of value) {
|
|
2596
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return false;
|
|
2597
|
+
const question = item;
|
|
2598
|
+
if (typeof question.question !== "string" || question.question.length === 0 || questions.has(question.question) || question.header !== void 0 && typeof question.header !== "string" || typeof question.multiSelect !== "boolean" || question.allowOther !== void 0 && typeof question.allowOther !== "boolean" || !Array.isArray(question.options) || question.options.length < 2 || question.options.length > 4) return false;
|
|
2599
|
+
const labels = /* @__PURE__ */ new Set();
|
|
2600
|
+
for (const option of question.options) {
|
|
2601
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) return false;
|
|
2602
|
+
const record = option;
|
|
2603
|
+
const label = record.label;
|
|
2604
|
+
if (typeof label !== "string" || label.length === 0 || labels.has(label) || record.description !== void 0 && typeof record.description !== "string") return false;
|
|
2605
|
+
labels.add(label);
|
|
2606
|
+
}
|
|
2607
|
+
questions.add(question.question);
|
|
2608
|
+
}
|
|
2609
|
+
return true;
|
|
2610
|
+
};
|
|
2563
2611
|
var parseAgentQuestionAnswers = (questions, value) => {
|
|
2564
2612
|
let parsed;
|
|
2565
2613
|
try {
|
|
@@ -2591,6 +2639,29 @@ var parseAgentQuestionAnswers = (questions, value) => {
|
|
|
2591
2639
|
}
|
|
2592
2640
|
return answers;
|
|
2593
2641
|
};
|
|
2642
|
+
var isQuestionRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2643
|
+
var codexAsyncQuestionFields = (raw) => {
|
|
2644
|
+
if (!isQuestionRecord(raw)) return void 0;
|
|
2645
|
+
const labels = Array.isArray(raw.options) ? raw.options : [];
|
|
2646
|
+
return { question: raw.title, options: labels.map((label) => ({ label })) };
|
|
2647
|
+
};
|
|
2648
|
+
var codexBlockingQuestionFields = (raw) => isQuestionRecord(raw) && raw.isOther === false ? { ...raw, allowOther: false } : raw;
|
|
2649
|
+
var asksForASecret = (questions) => questions.some((question) => isQuestionRecord(question) && question.isSecret === true);
|
|
2650
|
+
var parseCodexQuestions = (toolName, toolInput) => {
|
|
2651
|
+
const raw = Array.isArray(toolInput.questions) ? toolInput.questions : [];
|
|
2652
|
+
if (asksForASecret(raw)) return void 0;
|
|
2653
|
+
const questions = raw.map(toolName === CODEX_ASYNC_QUESTION_TOOL ? codexAsyncQuestionFields : codexBlockingQuestionFields);
|
|
2654
|
+
const parsed = parseAgentQuestions({ questions });
|
|
2655
|
+
return parsed && isAgentQuestionSet(parsed) ? parsed : void 0;
|
|
2656
|
+
};
|
|
2657
|
+
var CODEX_QUESTION_ANSWERED_IN_PUSHARY = "The user already answered this question in Pushary, so it was not shown again";
|
|
2658
|
+
var CODEX_QUESTION_CONTINUE = "Continue with this answer and do not ask it again";
|
|
2659
|
+
var quotedAnswerPair = ([question, answer]) => `${JSON.stringify(question)}: ${JSON.stringify(answer)}`;
|
|
2660
|
+
var codexQuestionAnswerReason = (answers) => {
|
|
2661
|
+
const pairs = Object.entries(answers);
|
|
2662
|
+
const answered = pairs.length === 1 ? `Their answer: ${JSON.stringify(pairs[0]?.[1] ?? "")}` : `Their answers: ${pairs.map(quotedAnswerPair).join("; ")}`;
|
|
2663
|
+
return `${CODEX_QUESTION_ANSWERED_IN_PUSHARY}. ${answered}. ${CODEX_QUESTION_CONTINUE}`;
|
|
2664
|
+
};
|
|
2594
2665
|
var INSTALL_SOURCES = [
|
|
2595
2666
|
/** `npx pushary@latest ...`, the documented one-liner. */
|
|
2596
2667
|
"npx",
|
|
@@ -5224,19 +5295,32 @@ var shouldDeferToNativeMode = (permissionMode, toolName, options = {}) => {
|
|
|
5224
5295
|
return false;
|
|
5225
5296
|
};
|
|
5226
5297
|
var AGENT_QUESTION_TOOL = "AskUserQuestion";
|
|
5227
|
-
var AGENT_QUESTION_STRATEGY = {
|
|
5298
|
+
var AGENT_QUESTION_STRATEGY = {
|
|
5299
|
+
native: "native_dialog",
|
|
5300
|
+
updatedInput: "updated_input",
|
|
5301
|
+
answeredInRefusal: "answered_in_refusal",
|
|
5302
|
+
none: "not_a_question"
|
|
5303
|
+
};
|
|
5228
5304
|
var UPDATED_INPUT_QUESTION_SOURCES = /* @__PURE__ */ new Set(["claude", "qoder", "codebuddy", "droid"]);
|
|
5229
5305
|
var GROK_NATIVE_DIALOG_TOOLS = /* @__PURE__ */ new Set(["ask_user_question", "exit_plan_mode"]);
|
|
5306
|
+
var CODEX_QUESTION_TOOL = "request_user_input";
|
|
5307
|
+
var CODEX_ASYNC_QUESTION_TOOL = "request_user_input_async";
|
|
5308
|
+
var CODEX_QUESTION_TOOLS = [CODEX_QUESTION_TOOL, CODEX_ASYNC_QUESTION_TOOL];
|
|
5309
|
+
var CODEX_QUESTION_TOOL_NAMES = new Set(CODEX_QUESTION_TOOLS);
|
|
5310
|
+
var isCodexQuestionTool = (toolName) => typeof toolName === "string" && CODEX_QUESTION_TOOL_NAMES.has(toolName);
|
|
5311
|
+
var isCodexQuestionCall = (source, event, toolName) => source === "codex" && event === "PreToolUse" && isCodexQuestionTool(toolName);
|
|
5312
|
+
var codexQuestionGoesToPushary = (verdict) => verdict.kind === "gate" && !approvalWaitsAtTheAgentsPrompt(verdict.policy.mode);
|
|
5230
5313
|
function agentQuestionStrategy(source, event, toolName) {
|
|
5231
5314
|
if (source === "grok" && GROK_NATIVE_DIALOG_TOOLS.has(toolName)) return AGENT_QUESTION_STRATEGY.native;
|
|
5315
|
+
if (isCodexQuestionCall(source, event, toolName)) return AGENT_QUESTION_STRATEGY.answeredInRefusal;
|
|
5232
5316
|
if (toolName !== AGENT_QUESTION_TOOL) return AGENT_QUESTION_STRATEGY.none;
|
|
5233
5317
|
if (source !== null && event === "PreToolUse" && UPDATED_INPUT_QUESTION_SOURCES.has(source)) return AGENT_QUESTION_STRATEGY.updatedInput;
|
|
5234
5318
|
return AGENT_QUESTION_STRATEGY.native;
|
|
5235
5319
|
}
|
|
5236
|
-
var questionHandedToTheTerminal = (toolName, modeState) => toolName === AGENT_QUESTION_TOOL && modeState.askHandoff === true;
|
|
5320
|
+
var questionHandedToTheTerminal = (toolName, modeState) => (toolName === AGENT_QUESTION_TOOL || isCodexQuestionTool(toolName)) && modeState.askHandoff === true;
|
|
5237
5321
|
var EXIT_PLAN_MODE_TOOL = "ExitPlanMode";
|
|
5238
5322
|
var ASKED_IN_EVERY_MODE_TOOLS = [AGENT_QUESTION_TOOL, EXIT_PLAN_MODE_TOOL];
|
|
5239
|
-
var ASKED_IN_EVERY_MODE = new Set(ASKED_IN_EVERY_MODE_TOOLS);
|
|
5323
|
+
var ASKED_IN_EVERY_MODE = /* @__PURE__ */ new Set([...ASKED_IN_EVERY_MODE_TOOLS, ...CODEX_QUESTION_TOOLS]);
|
|
5240
5324
|
var isAskedInEveryMode = (toolName) => ASKED_IN_EVERY_MODE.has(toolName);
|
|
5241
5325
|
var NATIVE_BLOCK_EVENTS = /* @__PURE__ */ new Set(["PermissionDenied"]);
|
|
5242
5326
|
var isNativeBlockEvent = (event) => typeof event === "string" && NATIVE_BLOCK_EVENTS.has(event);
|
|
@@ -5351,7 +5435,20 @@ var editsAFileThatNeedsAPerson = ({ toolName, toolInputs }) => toolInputs.some((
|
|
|
5351
5435
|
const path = extractPolicyArg(toolName, toolInput);
|
|
5352
5436
|
return path !== void 0 && fileEditNeedsAPerson(toolName, path);
|
|
5353
5437
|
});
|
|
5438
|
+
var runsADestructiveCommand = ({ toolName, toolInputs }) => SHELL_DIALECT_BY_TOOL.has(toolName) && toolInputs.some((toolInput) => {
|
|
5439
|
+
const command = extractPolicyArg(toolName, toolInput);
|
|
5440
|
+
return command !== void 0 && classifyDecisionRisk(toolName, command) === "destructive";
|
|
5441
|
+
});
|
|
5442
|
+
var codexCallIsDestructive = (input, call) => call.deletesFiles || runsADestructiveCommand(input);
|
|
5354
5443
|
var codexCallNeedsAPerson = (input, verdict, call) => onlyCodexPreToolUseCanAsk(verdict, call.permissionMode) || verdict.kind === "gate" && (aChosenRuleGoverns(input) || call.deletesFiles || runsACommandThatNeedsAPerson(input) || editsAFileThatNeedsAPerson(input));
|
|
5444
|
+
var CODEX_PRE_TOOL_USE_PASSES = { kind: "pass" };
|
|
5445
|
+
var codexPreToolUseDelivery = (input, verdict, call) => {
|
|
5446
|
+
if (verdict.kind !== "gate" || !codexCallNeedsAPerson(input, verdict, call)) return CODEX_PRE_TOOL_USE_PASSES;
|
|
5447
|
+
const noPromptOfItsOwn = codexHasNoPromptOfItsOwn(scopeBreachReasonOf(verdict), call.permissionMode);
|
|
5448
|
+
const mode = noPromptOfItsOwn ? approvalModeWithoutLocalPrompt(verdict.policy.mode) : verdict.policy.mode;
|
|
5449
|
+
if (mode === "push_first" && !codexCallIsDestructive(input, call)) return CODEX_PRE_TOOL_USE_PASSES;
|
|
5450
|
+
return { kind: "ask", policy: { ...verdict.policy, mode }, agentPromptFollows: !noPromptOfItsOwn };
|
|
5451
|
+
};
|
|
5355
5452
|
var MAX_AGENT_PERMISSION_RULES_PER_KIND = 256;
|
|
5356
5453
|
var MAX_AGENT_PERMISSION_RULE_LENGTH = 512;
|
|
5357
5454
|
var isAgentPermissionRule = (value) => typeof value === "string" && value.length > 0 && value.length <= MAX_AGENT_PERMISSION_RULE_LENGTH;
|
|
@@ -5949,6 +6046,8 @@ export {
|
|
|
5949
6046
|
parseAgentQuestion,
|
|
5950
6047
|
parseAgentQuestions,
|
|
5951
6048
|
parseAgentQuestionAnswers,
|
|
6049
|
+
parseCodexQuestions,
|
|
6050
|
+
codexQuestionAnswerReason,
|
|
5952
6051
|
normalizeInstallSource,
|
|
5953
6052
|
HOOK_BUDGETS,
|
|
5954
6053
|
HOOK_HOLD_BUDGET_ENV,
|
|
@@ -5988,7 +6087,11 @@ export {
|
|
|
5988
6087
|
KILL_REASON,
|
|
5989
6088
|
isPusharyOwnTool,
|
|
5990
6089
|
shouldDeferToNativeMode,
|
|
6090
|
+
AGENT_QUESTION_TOOL,
|
|
5991
6091
|
AGENT_QUESTION_STRATEGY,
|
|
6092
|
+
CODEX_QUESTION_TOOLS,
|
|
6093
|
+
isCodexQuestionTool,
|
|
6094
|
+
codexQuestionGoesToPushary,
|
|
5992
6095
|
agentQuestionStrategy,
|
|
5993
6096
|
questionHandedToTheTerminal,
|
|
5994
6097
|
CODEX_RESCUE_TOOL_NAME,
|
|
@@ -6009,7 +6112,7 @@ export {
|
|
|
6009
6112
|
HAND_BACK_WITHOUT_A_PROMPT,
|
|
6010
6113
|
codexDeferredPreToolUse,
|
|
6011
6114
|
scopeBreachReasonOf,
|
|
6012
|
-
|
|
6115
|
+
codexPreToolUseDelivery,
|
|
6013
6116
|
claudePermissionRulesFromSettings,
|
|
6014
6117
|
claudeConsultsItsAllowlist,
|
|
6015
6118
|
agentRulesAllowEveryInput,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4GEHVRV3.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe,
|
|
6
6
|
writeFileAtomic
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeDeclinedAgents,
|
|
14
14
|
withDeclinedAgent,
|
|
15
15
|
withoutDeclinedAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QOUW57RT.js";
|
|
17
17
|
|
|
18
18
|
// src/declined-agents-file.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
codexHooksJsonIn,
|
|
9
9
|
isPusharyCodexCommand,
|
|
10
10
|
resolvePathBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4GEHVRV3.js";
|
|
12
12
|
import {
|
|
13
13
|
getPackageVersion
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QOUW57RT.js";
|
|
15
15
|
|
|
16
16
|
// src/codex-app-server.ts
|
|
17
17
|
import { existsSync, realpathSync } from "fs";
|
|
@@ -14,19 +14,19 @@ import {
|
|
|
14
14
|
} from "./chunk-FO3MDD26.js";
|
|
15
15
|
import {
|
|
16
16
|
callMcpTool
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ABDGTGBT.js";
|
|
18
18
|
import {
|
|
19
19
|
reportedInstallSource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MIENLS7P.js";
|
|
21
21
|
import {
|
|
22
22
|
NPX_LATEST_COMMAND
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MXEDMQLC.js";
|
|
24
24
|
import {
|
|
25
25
|
NO_PAIRING_COMPUTER,
|
|
26
26
|
PAIR_TTL_SECONDS,
|
|
27
27
|
classifyConfirmResponse,
|
|
28
28
|
isAnswerSource
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-QOUW57RT.js";
|
|
30
30
|
|
|
31
31
|
// src/reach.ts
|
|
32
32
|
var reachVerdict = (channels) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureCodexTrustsPusharyHooks
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RULJMNY7.js";
|
|
4
4
|
import {
|
|
5
5
|
detectClaudeVersion
|
|
6
6
|
} from "./chunk-RIVNNBEK.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
openCodeHookArgv,
|
|
13
13
|
openCodePluginDir,
|
|
14
14
|
openCodeWired
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-J2APHNZL.js";
|
|
16
16
|
import {
|
|
17
17
|
addClaudeMcpServer,
|
|
18
18
|
addCompatibleHooks,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
addPusharyToolPermissions,
|
|
21
21
|
compatibleConfigFile,
|
|
22
22
|
hasCompatibleHooks
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7GSOIBVM.js";
|
|
24
24
|
import {
|
|
25
25
|
claudeUnprovenHolds,
|
|
26
26
|
claudeWired,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
codexWired,
|
|
29
29
|
geminiWired,
|
|
30
30
|
planHooks
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZFJAZBBF.js";
|
|
32
32
|
import {
|
|
33
33
|
CLAUDE_HOOK_BINARY,
|
|
34
34
|
CLAUDE_HOOK_EVENTS,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
needsReregistration,
|
|
40
40
|
registrationSignatures,
|
|
41
41
|
supportedClaudeEvents
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-GBNG6QEV.js";
|
|
43
43
|
import {
|
|
44
44
|
formatVersion
|
|
45
45
|
} from "./chunk-6ICPEJY5.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
resolveGlobalBinDir,
|
|
64
64
|
resolveGlobalBinary,
|
|
65
65
|
vscodePluginMcp
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-4GEHVRV3.js";
|
|
67
67
|
import {
|
|
68
68
|
readJsonSafe,
|
|
69
69
|
writeFileAtomic,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
HOOK_COMPATIBLE_PROFILES,
|
|
74
74
|
isCompatibleAgentType,
|
|
75
75
|
isRecord
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-QOUW57RT.js";
|
|
77
77
|
|
|
78
78
|
// src/reapply.ts
|
|
79
79
|
import { dirname, join } from "path";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compatibleConfigFile,
|
|
3
3
|
hasCompatibleHooks
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7GSOIBVM.js";
|
|
5
5
|
import {
|
|
6
6
|
pusharyHookExecutable
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZFJAZBBF.js";
|
|
8
8
|
import {
|
|
9
9
|
isProtectedByScope,
|
|
10
10
|
registerHookEntry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4GEHVRV3.js";
|
|
12
12
|
import {
|
|
13
13
|
isRecord
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QOUW57RT.js";
|
|
15
15
|
|
|
16
16
|
// src/cursor-config.ts
|
|
17
17
|
var hookCommandOf = (entry) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PA3OZGIA.js";
|
|
4
4
|
import {
|
|
5
5
|
namedEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7GSOIBVM.js";
|
|
7
7
|
import {
|
|
8
8
|
writeDegraded
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7O5U5TED.js";
|
|
10
10
|
import {
|
|
11
11
|
claudeShapedHookInput,
|
|
12
12
|
hookCompatibleProfileBySource,
|
|
13
13
|
isGrokHookPayload,
|
|
14
14
|
isGrokSessionEndStop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QOUW57RT.js";
|
|
16
16
|
|
|
17
17
|
// src/tool-hook-input.ts
|
|
18
18
|
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GBNG6QEV.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_CHOICES
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FZEQWY7Q.js";
|
|
9
9
|
import {
|
|
10
10
|
BELL_HOOK_BINARY
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JVKY6ILU.js";
|
|
12
12
|
import {
|
|
13
13
|
CODEX_HOOK_EVENTS,
|
|
14
14
|
hasCodexHooks,
|
|
15
15
|
holdBudgetOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4GEHVRV3.js";
|
|
17
17
|
import {
|
|
18
18
|
CURSOR_GATE_EVENTS,
|
|
19
19
|
HOOK_LOCATOR_BINARY,
|
|
20
20
|
hookCommandHoldBudget
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QOUW57RT.js";
|
|
22
22
|
|
|
23
23
|
// src/diagnostics/bridge.ts
|
|
24
24
|
import { execFileSync } from "child_process";
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
readGlobalUpgradeSubject,
|
|
6
6
|
upgradeInstalledPackage,
|
|
7
7
|
withUpgradeLock
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-NRVZNZVE.js";
|
|
9
|
+
import "./chunk-QZ4KOMFE.js";
|
|
10
|
+
import "./chunk-D5IAEPFA.js";
|
|
11
11
|
import "./chunk-POFBE6ZY.js";
|
|
12
12
|
import "./chunk-KZERVKTD.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-4GEHVRV3.js";
|
|
14
14
|
import "./chunk-AQFEP65J.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-MXEDMQLC.js";
|
|
16
|
+
import "./chunk-QOUW57RT.js";
|
|
17
17
|
export {
|
|
18
18
|
finishGlobalUpgrade,
|
|
19
19
|
finishUpgradeWithLock,
|