pushary 1.9.118 → 1.9.119
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/dist/{api-Q2HBBRLT.js → api-WWB7ZOLK.js} +11 -11
- package/dist/bin/pushary-audit.js +3 -3
- package/dist/bin/pushary-bell-hook.js +27 -27
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +25 -25
- package/dist/bin/pushary-clean.js +43 -43
- package/dist/bin/pushary-codex-bridge.js +21 -21
- package/dist/bin/pushary-codex-hook.js +36 -36
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +15 -15
- package/dist/bin/pushary-connect.js +28 -28
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +44 -44
- package/dist/bin/pushary-disconnect.js +27 -27
- package/dist/bin/pushary-display-hook.js +17 -17
- package/dist/bin/pushary-doctor.js +47 -47
- package/dist/bin/pushary-elicitation-hook.js +27 -27
- package/dist/bin/pushary-gemini-bridge.js +15 -15
- package/dist/bin/pushary-gemini-hook.js +33 -33
- package/dist/bin/pushary-hook.js +33 -33
- package/dist/bin/pushary-login.js +22 -22
- package/dist/bin/pushary-logout.js +26 -26
- package/dist/bin/pushary-mcp.js +12 -12
- package/dist/bin/pushary-mode.js +15 -15
- package/dist/bin/pushary-notification-hook.js +26 -26
- package/dist/bin/pushary-opencode-hook.js +30 -30
- package/dist/bin/pushary-permission-denied-hook.js +33 -33
- package/dist/bin/pushary-permission-hook.js +33 -33
- package/dist/bin/pushary-post-hook.js +26 -26
- package/dist/bin/pushary-prompt-hook.js +26 -26
- package/dist/bin/pushary-session-end-hook.js +26 -26
- package/dist/bin/pushary-session-start-hook.js +35 -35
- package/dist/bin/pushary-setup.js +90 -90
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +32 -32
- package/dist/bin/pushary-stop-hook.js +26 -26
- package/dist/bin/pushary-stopfailure-hook.js +26 -26
- package/dist/bin/pushary-suggestions.js +15 -15
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +25 -25
- package/dist/bin/pushary-upgrade.js +43 -43
- package/dist/bin/pushary-wait.js +17 -17
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-H7B6LLP4.js → chunk-2C45MJGK.js} +5 -5
- package/dist/{chunk-CUQOWRYT.js → chunk-2UE2NDCX.js} +1 -1
- package/dist/{chunk-2WCARUXQ.js → chunk-3B7S2H4R.js} +1 -1
- package/dist/{chunk-FAL7WRMM.js → chunk-3IESC326.js} +3 -3
- package/dist/{chunk-BBLXVKW2.js → chunk-4D23TNCL.js} +4 -4
- package/dist/{chunk-QQ24SUBD.js → chunk-4HDX77ND.js} +3 -3
- package/dist/{chunk-FLBMCN45.js → chunk-4SZM2HRA.js} +6 -6
- package/dist/{chunk-X4UWBBFI.js → chunk-5HKU4VUL.js} +3 -3
- package/dist/{chunk-P2H6TDL4.js → chunk-5T5T4YXM.js} +1 -1
- package/dist/{chunk-T5N42XDU.js → chunk-67I7QRQB.js} +1 -1
- package/dist/{chunk-5FJPEDMZ.js → chunk-6KX2H4I5.js} +3 -3
- package/dist/{chunk-RPW7LX2L.js → chunk-6YLVNFQZ.js} +3 -3
- package/dist/{chunk-KWDQI7TI.js → chunk-7CJ7W2RH.js} +4 -4
- package/dist/{chunk-WZZHWX7Q.js → chunk-AGXOTZID.js} +5 -5
- package/dist/{chunk-RMUKFMT3.js → chunk-B7BOENW7.js} +1 -1
- package/dist/{chunk-NPMVVR6I.js → chunk-BQ673OOD.js} +2 -2
- package/dist/{chunk-A23GIPWY.js → chunk-CBLFIWPI.js} +2 -2
- package/dist/{chunk-LWY2U7NZ.js → chunk-COXNQUDP.js} +4 -4
- package/dist/{chunk-Q64D24NF.js → chunk-CXIYGD33.js} +2 -2
- package/dist/{chunk-ZGYLMVNB.js → chunk-DXJUASTS.js} +2 -2
- package/dist/{chunk-R4BBSIUK.js → chunk-EFFH2FYG.js} +2 -2
- package/dist/{chunk-SAISSZZA.js → chunk-EISUEJDT.js} +6 -6
- package/dist/{chunk-XSUNHOAP.js → chunk-EP6I3MQY.js} +4 -4
- package/dist/{chunk-F5C6XZZ7.js → chunk-FPG7X2GS.js} +4 -4
- package/dist/{chunk-UNXVORET.js → chunk-G4OVFWU4.js} +12 -12
- package/dist/{chunk-C664L36M.js → chunk-G5FQU2XF.js} +6 -6
- package/dist/{chunk-D3PHTY54.js → chunk-GAOUWLYN.js} +3 -3
- package/dist/{chunk-MG5WFAND.js → chunk-GBVTVTDF.js} +1 -1
- package/dist/{chunk-GAYUSL24.js → chunk-GW3PE52Q.js} +1 -1
- package/dist/{chunk-UKCCVMI2.js → chunk-HYTDNEXV.js} +1 -1
- package/dist/{chunk-UXVCDVPL.js → chunk-ISVHV2DP.js} +1 -1
- package/dist/{chunk-FNT4VWXV.js → chunk-JJNF6QU4.js} +1 -1
- package/dist/{chunk-CVIJBTGE.js → chunk-JKS4MN47.js} +6 -6
- package/dist/{chunk-VIR7SCIQ.js → chunk-K5WTTEIQ.js} +5 -5
- package/dist/{chunk-WLXXEFHA.js → chunk-KILSIJTF.js} +15 -15
- package/dist/{chunk-IKX4X4LJ.js → chunk-KOZBVXXC.js} +3 -3
- package/dist/{chunk-CTBNVQND.js → chunk-KVDN4U6W.js} +10 -10
- package/dist/{chunk-M2PLZ5V3.js → chunk-L3MCQSES.js} +5 -5
- package/dist/{chunk-SMBFZFVN.js → chunk-MEPYLTWF.js} +10 -10
- package/dist/{chunk-QO6SWGLH.js → chunk-MYNLU6DV.js} +2 -2
- package/dist/{chunk-YQVZQM53.js → chunk-NASQPMXW.js} +9 -9
- package/dist/{chunk-BUNRL7QV.js → chunk-NVV3YUTX.js} +2 -2
- package/dist/{chunk-K5H4YAMZ.js → chunk-PDAOZ2NF.js} +10 -10
- package/dist/{chunk-CKR43BBJ.js → chunk-PJSFKKZ5.js} +1 -1
- package/dist/{chunk-GX3QCU32.js → chunk-PNSIMPC7.js} +6 -6
- package/dist/{chunk-KOEQIRDA.js → chunk-R3RTISDD.js} +1 -1
- package/dist/{chunk-UJ6UCGY4.js → chunk-R67NTMBY.js} +8 -8
- package/dist/{chunk-FEP7FXBP.js → chunk-RGXFBS56.js} +3 -3
- package/dist/{chunk-AN6AKKHO.js → chunk-RIAELZYW.js} +2 -2
- package/dist/{chunk-WELDACYF.js → chunk-SE7P5BBK.js} +1 -1
- package/dist/{chunk-QASBFNVD.js → chunk-SNKC2IQZ.js} +2 -2
- package/dist/{chunk-XWVEAAZO.js → chunk-SQRS4IF2.js} +3 -3
- package/dist/{chunk-6UN3AUIS.js → chunk-SSBETUYZ.js} +3 -3
- package/dist/{chunk-EJYLQNMC.js → chunk-TLCJCP5R.js} +1 -1
- package/dist/{chunk-I7LP4DKM.js → chunk-TRDHHF3A.js} +324 -37
- package/dist/{chunk-A2TAWW5L.js → chunk-TZYVXTLN.js} +1 -1
- package/dist/{chunk-7K6DZPYV.js → chunk-U32N5JZO.js} +1 -1
- package/dist/{chunk-4PXJ2LBU.js → chunk-UHAUC7EO.js} +2 -2
- package/dist/{chunk-7YQPI4UE.js → chunk-V52J2THT.js} +1 -1
- package/dist/{chunk-5UIRDDJN.js → chunk-VFZ2PE6U.js} +3 -3
- package/dist/{chunk-46ZIEQGC.js → chunk-VMM6JCNQ.js} +2 -2
- package/dist/{chunk-NJSCVQ6S.js → chunk-VRZOUCIK.js} +2 -2
- package/dist/{chunk-H6YES2DS.js → chunk-W5ZUDPKV.js} +5 -5
- package/dist/{chunk-PZLNBKMS.js → chunk-W6LKC5YD.js} +5 -5
- package/dist/{chunk-B6HPULOG.js → chunk-XBH6OKHD.js} +3 -3
- package/dist/{chunk-BQVB563P.js → chunk-XNCKBVZX.js} +5 -5
- package/dist/{chunk-TOUMNM7M.js → chunk-YCCLWG7G.js} +6 -6
- package/dist/{chunk-JBWEGNKE.js → chunk-YZ7V2LVG.js} +3 -3
- package/dist/{chunk-OP2ZDOBR.js → chunk-YZESBU7F.js} +5 -5
- package/dist/{chunk-MTG3JLMP.js → chunk-Z3OG44Z4.js} +4 -4
- package/dist/{chunk-WCSPOQ5W.js → chunk-ZLUAXGAA.js} +4 -4
- package/dist/{chunk-TUQ6R6DD.js → chunk-ZTVBM3EZ.js} +4 -4
- package/dist/{codex-app-cards-switch-45UK7FRY.js → codex-app-cards-switch-J6EULXO5.js} +12 -12
- package/dist/{codex-card-routing-7B77ISR2.js → codex-card-routing-XNJB6573.js} +2 -2
- package/dist/{codex-desktop-launch-DWC7Q5A6.js → codex-desktop-launch-46ELENBQ.js} +1 -1
- package/dist/{codex-session-launch-MK2CXFRQ.js → codex-session-launch-R5FHFWAG.js} +18 -18
- package/dist/{config-OHLNHWP4.js → config-RKWDMDRY.js} +3 -3
- package/dist/{global-upgrade-KKFYAQVO.js → global-upgrade-E65GJQS6.js} +9 -9
- package/dist/{identity-AKGGBW3A.js → identity-JRGY2KS6.js} +4 -4
- package/dist/{live-capabilities-O6MAYZZS.js → live-capabilities-SOO6PD7Y.js} +4 -4
- package/dist/{paths-5XEJTZAS.js → paths-G7NZODAY.js} +3 -3
- package/dist/{reapply-VQFRLS3P.js → reapply-YKN5BKIP.js} +28 -28
- package/dist/src/index.js +32 -32
- package/dist/{upgrade-lock-6HGNG7RT.js → upgrade-lock-YKAZI3BH.js} +4 -4
- package/dist/{usage-ATA2A3TZ.js → usage-QWYNOIU6.js} +3 -3
- package/package.json +2 -2
|
@@ -1378,14 +1378,29 @@ function parseCommitId(value) {
|
|
|
1378
1378
|
// ../contracts/src/conversation-text.ts
|
|
1379
1379
|
var INTERNAL_ENVELOPE = /(^|\n) {0,3}(?:<(total_tokens|task-notification)>[\s\S]*?(?:<\/\2>|$)[\t ]*)+/g;
|
|
1380
1380
|
var INCOMPLETE_ENVELOPE = /(^|\n) {0,3}<(?:total_tokens|task-notification)$/g;
|
|
1381
|
+
var AGENT_MESSAGE_OPENING = /^ {0,3}<agent-message from=/;
|
|
1382
|
+
var AGENT_MESSAGE_CLOSING = "</agent-message>";
|
|
1381
1383
|
var SUGGESTION_REQUEST = /^This is an app-generated request for a suggested next user(?: message| prompt)/;
|
|
1382
1384
|
var visibleProse = (text3) => text3.replace(INTERNAL_ENVELOPE, "$1").replace(INCOMPLETE_ENVELOPE, "$1");
|
|
1385
|
+
var textAfterAgentMessage = (line) => {
|
|
1386
|
+
const closing = line.indexOf(AGENT_MESSAGE_CLOSING);
|
|
1387
|
+
return closing === -1 ? null : line.slice(closing + AGENT_MESSAGE_CLOSING.length);
|
|
1388
|
+
};
|
|
1383
1389
|
function conversationText(text3) {
|
|
1384
1390
|
if (SUGGESTION_REQUEST.test(text3.trimStart())) return "";
|
|
1385
1391
|
const output = [];
|
|
1386
1392
|
let prose = [];
|
|
1387
1393
|
let fence = null;
|
|
1388
|
-
|
|
1394
|
+
let insideAgentMessage = false;
|
|
1395
|
+
const lines = text3.split("\n").reverse();
|
|
1396
|
+
while (lines.length > 0) {
|
|
1397
|
+
const line = lines.pop() ?? "";
|
|
1398
|
+
if (insideAgentMessage || !fence && AGENT_MESSAGE_OPENING.test(line)) {
|
|
1399
|
+
const after = textAfterAgentMessage(line);
|
|
1400
|
+
insideAgentMessage = after === null;
|
|
1401
|
+
if (after?.trim()) lines.push(after);
|
|
1402
|
+
continue;
|
|
1403
|
+
}
|
|
1389
1404
|
const marker = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];
|
|
1390
1405
|
if (fence) {
|
|
1391
1406
|
output.push(line);
|
|
@@ -1599,6 +1614,65 @@ var SEGMENT_SEPARATORS = /* @__PURE__ */ new Set([";", "\n", "&", "|"]);
|
|
|
1599
1614
|
var DOUBLED_SEPARATORS = /* @__PURE__ */ new Set(["&", "|"]);
|
|
1600
1615
|
var UNDECOMPOSABLE = /* @__PURE__ */ new Set(["`", "<", ">"]);
|
|
1601
1616
|
var LITERAL_IN_DOUBLE_QUOTES = /* @__PURE__ */ new Set([";", "|", "&", "<", ">", "*", "?", "[", "\\"]);
|
|
1617
|
+
var OPENS_A_WORD_AFTER = /[ \t\n;&|()`]/;
|
|
1618
|
+
var COMMENT_OR_ANSI_C_QUOTE = /#|\$'/;
|
|
1619
|
+
var INERT_ANSI_C_ESCAPE = "__";
|
|
1620
|
+
var runLengthBefore = (text3, index, char) => {
|
|
1621
|
+
let length = 0;
|
|
1622
|
+
while (text3.charAt(index - 1 - length) === char) length += 1;
|
|
1623
|
+
return length;
|
|
1624
|
+
};
|
|
1625
|
+
var opensAnsiCQuote = (text3, index) => {
|
|
1626
|
+
const dollars = runLengthBefore(text3, index, "$");
|
|
1627
|
+
const backslashes = runLengthBefore(text3, index - dollars, "\\");
|
|
1628
|
+
return text3.charAt(index) === "'" && (dollars - backslashes % 2) % 2 === 1;
|
|
1629
|
+
};
|
|
1630
|
+
var readingWithoutCommentsOrAnsiEscapes = (text3) => {
|
|
1631
|
+
if (!COMMENT_OR_ANSI_C_QUOTE.test(text3)) return null;
|
|
1632
|
+
let reading = "";
|
|
1633
|
+
let changed = false;
|
|
1634
|
+
let quote = null;
|
|
1635
|
+
let ansiC = false;
|
|
1636
|
+
let inComment = false;
|
|
1637
|
+
let atWordStart = true;
|
|
1638
|
+
for (let index = 0; index < text3.length; index += 1) {
|
|
1639
|
+
const char = text3.charAt(index);
|
|
1640
|
+
const next = text3.charAt(index + 1);
|
|
1641
|
+
if (inComment && char !== "\n") continue;
|
|
1642
|
+
inComment = false;
|
|
1643
|
+
if (ansiC && char === "\\" && next) {
|
|
1644
|
+
reading += INERT_ANSI_C_ESCAPE;
|
|
1645
|
+
changed = true;
|
|
1646
|
+
index += 1;
|
|
1647
|
+
} else if (char === "\\" && quote !== "'") {
|
|
1648
|
+
reading += char + next;
|
|
1649
|
+
atWordStart = next === "\n" ? atWordStart : false;
|
|
1650
|
+
index += 1;
|
|
1651
|
+
} else if (quote === "'") {
|
|
1652
|
+
reading += char;
|
|
1653
|
+
if (char === quote) {
|
|
1654
|
+
quote = null;
|
|
1655
|
+
ansiC = false;
|
|
1656
|
+
}
|
|
1657
|
+
atWordStart = false;
|
|
1658
|
+
} else if (char === "'" || char === '"') {
|
|
1659
|
+
reading += char;
|
|
1660
|
+
if (quote === char) quote = null;
|
|
1661
|
+
else if (quote === null) {
|
|
1662
|
+
ansiC = opensAnsiCQuote(text3, index);
|
|
1663
|
+
quote = char;
|
|
1664
|
+
}
|
|
1665
|
+
atWordStart = false;
|
|
1666
|
+
} else if (quote === null && atWordStart && char === COMMENT_START) {
|
|
1667
|
+
inComment = true;
|
|
1668
|
+
changed = true;
|
|
1669
|
+
} else {
|
|
1670
|
+
reading += char;
|
|
1671
|
+
atWordStart = quote === null && OPENS_A_WORD_AFTER.test(char);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return changed ? reading : null;
|
|
1675
|
+
};
|
|
1602
1676
|
var scanShell = (command) => {
|
|
1603
1677
|
const lexemes = [];
|
|
1604
1678
|
let quote = null;
|
|
@@ -1642,6 +1716,112 @@ var splitShellSegments = (command) => {
|
|
|
1642
1716
|
const present = segments.filter((segment) => segment.text.length > 0);
|
|
1643
1717
|
return present.length > 0 ? present : null;
|
|
1644
1718
|
};
|
|
1719
|
+
var COMMAND_POSITION = String.raw`(^[ \t]*|[;&|(` + "`" + String.raw`\n][ \t]*|\b(?:then|do|else|elif|if|while|until)[ \t]+|[{!][ \t]+)`;
|
|
1720
|
+
var COMMAND_PREFIXES = String.raw`(?:[A-Za-z_]\w*=\S*[ \t]+|(?:sudo|env|exec|command|builtin|nohup|time|nice(?:[ \t]+-n[ \t]+\S+)?|timeout[ \t]+\S+)(?:[ \t]+-[^\s<]*){0,4}[ \t]+){0,8}`;
|
|
1721
|
+
var A_SHELL_RUNNING_A_SUBSTITUTION = new RegExp(
|
|
1722
|
+
String.raw`${COMMAND_POSITION}${COMMAND_PREFIXES}(?:[^\s;&|()<>` + "`" + String.raw`]*/)?(?:sh|bash|zsh|dash|ksh|source|\.)(?:[ \t]+-[^\s<]*){0,8}[ \t]+(?:<[ \t]*)?[<=](?=\()`,
|
|
1723
|
+
"g"
|
|
1724
|
+
);
|
|
1725
|
+
var AN_EVAL_THAT_RUNS = new RegExp(String.raw`${COMMAND_POSITION}${COMMAND_PREFIXES}eval[ \t]+`, "g");
|
|
1726
|
+
var CASE_HEAD = /(^|[\s;&|(])case[ \t]+(?:"[^"\n]*"|'[^'\n]*'|\S+)[ \t\n]+in(?=[\s;])/g;
|
|
1727
|
+
var CASE_ARM_OPENING = /;[;&]{0,2}[ \t\n]*\(?[^()\s;][^()\n;]*\)[ \t\n]*/g;
|
|
1728
|
+
var CASE_ARM_ENDING = /;;&?|;&/g;
|
|
1729
|
+
var CASE_WORD = /\bcase\b/;
|
|
1730
|
+
var ESAC_WORD = /\besac\b/g;
|
|
1731
|
+
var COPROC_PREFIX = /(^|[\s;&|(])coproc[ \t]+(?:[A-Za-z_]\w*[ \t]+(?=[{(]))?/g;
|
|
1732
|
+
var A_FUNCTION_WITH_A_SUBSHELL_BODY = /(^|[\s;&|])(?:function[ \t]+[\w.:-]+(?:[ \t]*\(\))?|[\w.:-]+[ \t]*\(\))[ \t\n]*(?=\()/g;
|
|
1733
|
+
var NPX_GIVEN_A_COMMAND_STRING = /(^|[\s;&|(])npx(?:[ \t]+(?:(?:-p|--package)[ \t]+[^\s;&|]+|(?!-c\b|--call\b)-[^\s;&|]+)){0,8}?[ \t]+(?:-c|--call)(?:[ \t]+|=)/g;
|
|
1734
|
+
var SU_GIVEN_A_COMMAND_STRING = /(^|[\s;&|(])su(?:[ \t]+(?!-c\b|--command\b)[^\s;&|]+){0,8}?[ \t]+(?:-c|--command)(?:[ \t]+|=)/g;
|
|
1735
|
+
var PARALLEL_PREFIX = /(^|[\s;&|(])parallel[ \t]+(?=[^-\s])/g;
|
|
1736
|
+
var closingParenthesisOf = (text3, open) => {
|
|
1737
|
+
let depth = 0;
|
|
1738
|
+
let quote = null;
|
|
1739
|
+
for (let index = open; index < text3.length; index += 1) {
|
|
1740
|
+
const char = text3.charAt(index);
|
|
1741
|
+
if (quote === "'") {
|
|
1742
|
+
if (char === "'") quote = null;
|
|
1743
|
+
} else if (char === "\\") {
|
|
1744
|
+
index += 1;
|
|
1745
|
+
} else if (quote === '"') {
|
|
1746
|
+
if (char === '"') quote = null;
|
|
1747
|
+
} else if (char === "'" || char === '"') {
|
|
1748
|
+
quote = char;
|
|
1749
|
+
} else if (char === "(") {
|
|
1750
|
+
depth += 1;
|
|
1751
|
+
} else if (char === ")") {
|
|
1752
|
+
depth -= 1;
|
|
1753
|
+
if (depth === 0) return index;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return null;
|
|
1757
|
+
};
|
|
1758
|
+
var withSubstitutionsPipedIntoAShell = (text3) => {
|
|
1759
|
+
let reading = "";
|
|
1760
|
+
let from = 0;
|
|
1761
|
+
for (const match of text3.matchAll(A_SHELL_RUNNING_A_SUBSTITUTION)) {
|
|
1762
|
+
const open = match.index + match[0].length;
|
|
1763
|
+
const close = match.index < from ? null : closingParenthesisOf(text3, open);
|
|
1764
|
+
if (close !== null) {
|
|
1765
|
+
reading += `${text3.slice(from, match.index)}${match[1]}${text3.slice(open + 1, close)} | sh`;
|
|
1766
|
+
from = close + 1;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
return reading + text3.slice(from);
|
|
1770
|
+
};
|
|
1771
|
+
var withCaseArmsAsCommands = (text3) => CASE_WORD.test(text3) && text3.search(ESAC_WORD) !== -1 ? text3.replace(CASE_HEAD, "$1true;").replace(CASE_ARM_OPENING, ";").replace(CASE_ARM_ENDING, ";").replace(ESAC_WORD, "true") : text3;
|
|
1772
|
+
var withoutCoprocPrefix = (text3) => text3.replace(COPROC_PREFIX, "$1");
|
|
1773
|
+
var withFunctionSubshellBodiesExposed = (text3) => text3.replace(A_FUNCTION_WITH_A_SUBSHELL_BODY, "$1");
|
|
1774
|
+
var withCommandStringsRunByAShell = (text3) => text3.replace(NPX_GIVEN_A_COMMAND_STRING, "$1sh -c ").replace(SU_GIVEN_A_COMMAND_STRING, "$1sh -c ");
|
|
1775
|
+
var withoutParallelPrefix = (text3) => text3.replace(PARALLEL_PREFIX, "$1");
|
|
1776
|
+
var SHELL_FORM_REWRITES = [
|
|
1777
|
+
withSubstitutionsPipedIntoAShell,
|
|
1778
|
+
withCaseArmsAsCommands,
|
|
1779
|
+
withoutCoprocPrefix,
|
|
1780
|
+
withFunctionSubshellBodiesExposed,
|
|
1781
|
+
withCommandStringsRunByAShell,
|
|
1782
|
+
withoutParallelPrefix
|
|
1783
|
+
];
|
|
1784
|
+
var readingWithShellFormsSpelledOut = (text3) => {
|
|
1785
|
+
const reading = SHELL_FORM_REWRITES.reduce((current, rewrite) => rewrite(current), text3);
|
|
1786
|
+
return reading === text3 ? null : reading;
|
|
1787
|
+
};
|
|
1788
|
+
var SHELLS_THAT_RUN_A_SCRIPT_ARGUMENT = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
1789
|
+
var SHORT_FLAGS_WITH_THE_COMMAND_FLAG = /^-[A-Za-z]*c[A-Za-z]*$/;
|
|
1790
|
+
var SHELL_LONG_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Set(["--rcfile", "--init-file"]);
|
|
1791
|
+
var SHELL_SHORT_FLAGS_ENDING_IN_AN_OPTION_NAME = /^[-+][A-Za-z]*[oO]$/;
|
|
1792
|
+
var SHELL_OPTION_WORD = /^[-+]/;
|
|
1793
|
+
var COMMAND_SEPARATOR_INSIDE_A_WORD = /[;&|()`]/;
|
|
1794
|
+
var DEEPEST_NESTED_SCRIPT_READ = 3;
|
|
1795
|
+
var MOST_SCRIPTS_READ_FROM_ONE_COMMAND = 16;
|
|
1796
|
+
var programNamedBy = (word) => basenameOf(word.split(COMMAND_SEPARATOR_INSIDE_A_WORD).filter((piece) => piece !== "").pop() ?? "");
|
|
1797
|
+
var scriptArgumentOfAShellAt = (words, index) => {
|
|
1798
|
+
if (!SHELLS_THAT_RUN_A_SCRIPT_ARGUMENT.has(programNamedBy(words[index]?.text ?? ""))) return void 0;
|
|
1799
|
+
for (let next = index + 1; SHELL_OPTION_WORD.test(words[next]?.text ?? ""); next += 1) {
|
|
1800
|
+
const option = words[next]?.text ?? "";
|
|
1801
|
+
if (SHORT_FLAGS_WITH_THE_COMMAND_FLAG.test(option)) return words[next + 1]?.text;
|
|
1802
|
+
if (SHELL_LONG_OPTIONS_WITH_A_VALUE.has(option) || SHELL_SHORT_FLAGS_ENDING_IN_AN_OPTION_NAME.test(option)) next += 1;
|
|
1803
|
+
}
|
|
1804
|
+
return void 0;
|
|
1805
|
+
};
|
|
1806
|
+
var scriptsOfShellsIn = (text3) => {
|
|
1807
|
+
const words = shellWordsOf(text3);
|
|
1808
|
+
return words === null ? [] : words.flatMap((_, index) => scriptArgumentOfAShellAt(words, index) ?? []);
|
|
1809
|
+
};
|
|
1810
|
+
var scriptOfAnEvalEndingAt = (text3, end) => {
|
|
1811
|
+
const words = shellWordsOf(text3.slice(end));
|
|
1812
|
+
return words === null ? [] : [words.map((word) => word.text).join(" ")];
|
|
1813
|
+
};
|
|
1814
|
+
var scriptsOfEvalsIn = (text3) => [...text3.matchAll(AN_EVAL_THAT_RUNS)].slice(0, MOST_SCRIPTS_READ_FROM_ONE_COMMAND).flatMap((match) => scriptOfAnEvalEndingAt(text3, match.index + match[0].length));
|
|
1815
|
+
var scriptsDirectlyInside = (text3) => [...scriptsOfEvalsIn(text3), ...scriptsOfShellsIn(text3)];
|
|
1816
|
+
var scriptsPassedToAShell = (text3) => {
|
|
1817
|
+
const found = [];
|
|
1818
|
+
let level = [text3];
|
|
1819
|
+
for (let depth = 0; depth < DEEPEST_NESTED_SCRIPT_READ && level.length > 0 && found.length < MOST_SCRIPTS_READ_FROM_ONE_COMMAND; depth += 1) {
|
|
1820
|
+
level = level.flatMap(scriptsDirectlyInside).slice(0, MOST_SCRIPTS_READ_FROM_ONE_COMMAND - found.length);
|
|
1821
|
+
found.push(...level);
|
|
1822
|
+
}
|
|
1823
|
+
return found;
|
|
1824
|
+
};
|
|
1645
1825
|
var shellCommandSegments = (command) => splitShellSegments(command)?.map((segment) => segment.text) ?? null;
|
|
1646
1826
|
var shellSegmentsReadingAPipe = (command) => splitShellSegments(command)?.filter((segment) => segment.readsPipe).map((segment) => segment.text) ?? null;
|
|
1647
1827
|
var SUBSTITUTION_OPEN = "$(";
|
|
@@ -3488,10 +3668,14 @@ var readSetupOutcomeProperties = (body) => {
|
|
|
3488
3668
|
// ../contracts/src/policy-capabilities.ts
|
|
3489
3669
|
var POLICY_REQUEST_CAPABILITIES_HEADER = "x-pushary-policy-capabilities";
|
|
3490
3670
|
var POLICY_REQUEST_CAPABILITY = {
|
|
3491
|
-
readsCommandRunnersAndAVersionedCache: "command-runners-1"
|
|
3671
|
+
readsCommandRunnersAndAVersionedCache: "command-runners-1",
|
|
3672
|
+
readsWhereAPushLands: "push-destinations-1"
|
|
3492
3673
|
};
|
|
3493
3674
|
var KNOWN_POLICY_REQUEST_CAPABILITIES = Object.values(POLICY_REQUEST_CAPABILITY);
|
|
3494
|
-
var CLI_POLICY_REQUEST_CAPABILITIES = [
|
|
3675
|
+
var CLI_POLICY_REQUEST_CAPABILITIES = [
|
|
3676
|
+
POLICY_REQUEST_CAPABILITY.readsCommandRunnersAndAVersionedCache,
|
|
3677
|
+
POLICY_REQUEST_CAPABILITY.readsWhereAPushLands
|
|
3678
|
+
];
|
|
3495
3679
|
var POLICY_REQUEST_CAPABILITY_SEPARATOR = ",";
|
|
3496
3680
|
var policyRequestCapabilitiesHeaderValue = (capabilities) => capabilities.join(POLICY_REQUEST_CAPABILITY_SEPARATOR);
|
|
3497
3681
|
|
|
@@ -7939,8 +8123,10 @@ var denyReasonFrom = (value, note) => {
|
|
|
7939
8123
|
if (trimmed) return `${PHONE_DENIAL_PREFIX}${trimmed}`;
|
|
7940
8124
|
return value && value !== DENY_ANSWER && value !== APPROVE_ANSWER ? `${PHONE_DENIAL_PREFIX}${value}` : PHONE_DENIAL_REASON;
|
|
7941
8125
|
};
|
|
7942
|
-
var
|
|
7943
|
-
var
|
|
8126
|
+
var APPROVE_RESPONSE_WORDS = [APPROVE_ANSWER, "approve", "approved"];
|
|
8127
|
+
var DENY_RESPONSE_WORDS = [DENY_ANSWER, "deny", "denied", "reject", "rejected"];
|
|
8128
|
+
var APPROVE_RESPONSES = new Set(APPROVE_RESPONSE_WORDS);
|
|
8129
|
+
var DENY_RESPONSES = new Set(DENY_RESPONSE_WORDS);
|
|
7944
8130
|
var DEFER_RESPONSES = /* @__PURE__ */ new Set([DEFER_ANSWER]);
|
|
7945
8131
|
var classifyConfirmResponse = (response) => {
|
|
7946
8132
|
const normalized = (response ?? "").trim().toLowerCase();
|
|
@@ -8473,13 +8659,24 @@ var bypassModeApplies = (input) => isBypassPermissionMode(input.permissionMode)
|
|
|
8473
8659
|
var bypassModeAllows = (input) => bypassModeApplies(input) && (bypassStopsOf(input.config) === "nothing" ? !aChosenRuleGovernsInEitherRepository(input, ruleAsksOrRefuses) : bypassModeCoversEveryInput(input));
|
|
8474
8660
|
var PERMISSIONS_OFF_ASK_REASON = "Permissions are off in your agent, so Pushary only stops for risky steps like this one. You can change this in Settings on pushary.com.";
|
|
8475
8661
|
var permissionsOffLineAppliesTo = (agentType) => agentType === CLAUDE_CODE_AGENT_TYPE;
|
|
8476
|
-
var
|
|
8662
|
+
var PATTERN_PREFIX_WILDCARD = /(?::\*|\*)?\)$/;
|
|
8663
|
+
var CONTINUES_A_COMMAND_WORD = /^[ :]/;
|
|
8664
|
+
var ruleNarrowsThePattern = (ruleTool, pattern) => {
|
|
8665
|
+
if (ruleTool === pattern) return false;
|
|
8666
|
+
if (!pattern.includes("(")) return ruleTool.includes("(");
|
|
8667
|
+
const prefix = pattern.replace(PATTERN_PREFIX_WILDCARD, "");
|
|
8668
|
+
return ruleTool.startsWith(prefix) && CONTINUES_A_COMMAND_WORD.test(ruleTool.slice(prefix.length));
|
|
8669
|
+
};
|
|
8670
|
+
var askAtTheRouteOfAPush = (input, repoKey, allowedBy) => {
|
|
8477
8671
|
const routes = approvalRoutesOf(input.config);
|
|
8478
|
-
if (routes === null
|
|
8672
|
+
if (routes === null) return void 0;
|
|
8673
|
+
const askRows = input.config.policies.filter((policy) => restricts(policy) && !isAutoDeny(policy) && appliesToThisCall(policy, repoKey, input.sessionId));
|
|
8674
|
+
const routesWithAnAsk = routes.filter((route) => askRows.some((policy) => policy.tool === route.toolPattern));
|
|
8675
|
+
const routesTheAllowDoesNotNarrow = routesWithAnAsk.filter((route) => !ruleNarrowsThePattern(allowedBy.tool, route.toolPattern));
|
|
8676
|
+
const bestOf = (candidates, spellings) => spellings.length === 0 ? void 0 : findBestRoute(candidates, input.toolName, spellings, repoKey);
|
|
8479
8677
|
for (const toolInput of input.toolInputs) {
|
|
8480
|
-
const
|
|
8481
|
-
const
|
|
8482
|
-
const ask = route && input.config.policies.find((policy) => policy.tool === route.toolPattern && restricts(policy) && !isAutoDeny(policy) && appliesToThisCall(policy, repoKey, input.sessionId));
|
|
8678
|
+
const route = bestOf(routesWithAnAsk, pushesOfTheCurrentBranchIn(input, toolInput)) ?? bestOf(routesTheAllowDoesNotNarrow, pushSpellingsBeyondTheWrittenOnesIn(input, toolInput));
|
|
8679
|
+
const ask = route && askRows.find((policy) => policy.tool === route.toolPattern);
|
|
8483
8680
|
if (ask) {
|
|
8484
8681
|
const mode = input.modeState.mode ?? input.config.modeOverride ?? ask.mode;
|
|
8485
8682
|
return { ...ask, mode };
|
|
@@ -8495,7 +8692,30 @@ var policyForScopeQuestion = (policy) => policy.timeoutAction === "approve" ? {
|
|
|
8495
8692
|
timeoutAction: "wait",
|
|
8496
8693
|
pushFirstSeconds: policy.pushFirstSeconds > 0 ? policy.pushFirstSeconds : SCOPE_QUESTION_FIRST_WAIT_SECONDS
|
|
8497
8694
|
} : policy;
|
|
8498
|
-
var
|
|
8695
|
+
var isAReading = (reading) => reading !== null && reading.trim() !== "";
|
|
8696
|
+
var extraReadingsOf = (toolInput) => {
|
|
8697
|
+
const { command } = toolInput;
|
|
8698
|
+
if (typeof command !== "string" || command.length > LONGEST_COMMAND_READ_FOR_A_PUSH) return [];
|
|
8699
|
+
const commentFree = readingWithoutCommentsOrAnsiEscapes(command);
|
|
8700
|
+
const spelledOut = [command, commentFree].filter(isAReading).map(readingWithShellFormsSpelledOut);
|
|
8701
|
+
const readings = [
|
|
8702
|
+
commentFree,
|
|
8703
|
+
...spelledOut,
|
|
8704
|
+
...[command, commentFree, ...spelledOut].filter(isAReading).flatMap((text3) => scriptsPassedToAShell(text3)).map(readingWithoutCommentsOrAnsiEscapes)
|
|
8705
|
+
];
|
|
8706
|
+
return readings.filter(isAReading).map((reading) => ({ ...toolInput, command: reading }));
|
|
8707
|
+
};
|
|
8708
|
+
var readingsNotYetJudged = (toolInputs) => {
|
|
8709
|
+
const judged = new Set(toolInputs.map((toolInput) => toolInput.command));
|
|
8710
|
+
return toolInputs.flatMap(extraReadingsOf).filter((reading) => {
|
|
8711
|
+
const isNew = !judged.has(reading.command);
|
|
8712
|
+
judged.add(reading.command);
|
|
8713
|
+
return isNew;
|
|
8714
|
+
});
|
|
8715
|
+
};
|
|
8716
|
+
var withExtraReadings = (input) => shellDialectOf(input.toolName) !== void 0 ? { ...input, toolInputs: [...input.toolInputs, ...readingsNotYetJudged(input.toolInputs)] } : input;
|
|
8717
|
+
var resolveGate = (rawInput) => {
|
|
8718
|
+
const input = withExtraReadings(rawInput);
|
|
8499
8719
|
const { modeState, config, toolName, toolInputs, cwd, sessionId } = input;
|
|
8500
8720
|
const repoKey = input.sharedRepoKey ?? input.repoKey;
|
|
8501
8721
|
if (isPusharyOwnTool(toolName)) {
|
|
@@ -8510,31 +8730,34 @@ var resolveGate = (input) => {
|
|
|
8510
8730
|
const legacyPolicy = (toolInputs.length ? toolInputs : [void 0]).map((toolInput) => resolvePolicy(config, toolName, modeState.mode, toolInput, cwd, input.repoKey, sessionId)).find((policy2) => policy2.repoKey === input.repoKey && verdictForPolicy(policy2) === "deny");
|
|
8511
8731
|
if (legacyPolicy) return { kind: "deny", policy: legacyPolicy, reason: `Denied by policy for ${legacyPolicy.tool}` };
|
|
8512
8732
|
}
|
|
8513
|
-
const policy =
|
|
8733
|
+
const policy = toolInputs.slice(rawInput.toolInputs.length).map((reading) => resolvePolicy(config, toolName, modeState.mode, reading, cwd, repoKey, sessionId)).reduce(
|
|
8734
|
+
(strictest, reading) => strictestReadingOf(reading, strictest),
|
|
8735
|
+
resolvePolicyAcross(config, toolName, modeState.mode, rawInput.toolInputs, cwd, repoKey, sessionId)
|
|
8736
|
+
);
|
|
8514
8737
|
const verdict = verdictForPolicy(policy);
|
|
8515
8738
|
const autoDenies = verdict === "deny";
|
|
8516
8739
|
const allowedByBypassMode = !autoDenies && verdict !== "allow" && bypassModeAllows(input);
|
|
8517
|
-
const askBesideARoutedPush = verdict === "allow" ?
|
|
8740
|
+
const askBesideARoutedPush = verdict === "allow" ? askAtTheRouteOfAPush(input, repoKey, policy) : void 0;
|
|
8518
8741
|
const autoApproves = (verdict === "allow" || allowedByBypassMode) && askBesideARoutedPush === void 0;
|
|
8519
8742
|
const askedPolicy = askBesideARoutedPush ?? policy;
|
|
8520
8743
|
if (autoDenies) return { kind: "deny", policy, reason: `Denied by policy for ${policy.tool}` };
|
|
8521
8744
|
if (isAskedInEveryMode(toolName)) return { kind: "gate", policy };
|
|
8522
8745
|
if (isModeStateDegraded(modeState)) {
|
|
8523
8746
|
if (autoApproves) {
|
|
8524
|
-
return survivesDegraded(config, toolName, toolInputs, cwd, repoKey, sessionId) ? { kind: "allow", policy, source: "allowlist" } : { kind: "defer", policy };
|
|
8747
|
+
return survivesDegraded(config, toolName, rawInput.toolInputs, cwd, repoKey, sessionId) ? { kind: "allow", policy, source: "allowlist" } : { kind: "defer", policy };
|
|
8525
8748
|
}
|
|
8526
8749
|
return { kind: "gate", policy: askedPolicy };
|
|
8527
8750
|
}
|
|
8528
8751
|
const scopeVerdict = modeState.scope ? strictestScopeVerdict(modeState.scope, input.scopePaths ?? []) : { outcome: "no_contract" };
|
|
8529
8752
|
if (autoApproves) {
|
|
8530
8753
|
if (!scopeRequiresHuman(scopeVerdict)) {
|
|
8531
|
-
if (config.knownSuperseded === true && !survivesDegraded(config, toolName, toolInputs, cwd, repoKey, sessionId)) {
|
|
8754
|
+
if (config.knownSuperseded === true && !survivesDegraded(config, toolName, rawInput.toolInputs, cwd, repoKey, sessionId)) {
|
|
8532
8755
|
return { kind: "defer", policy };
|
|
8533
8756
|
}
|
|
8534
8757
|
return {
|
|
8535
8758
|
kind: "allow",
|
|
8536
8759
|
policy: allowedByBypassMode ? autoApprove(policy.tool) : policy,
|
|
8537
|
-
source: toolInputs.length === 1 && resolveAutoResolveOrigin(config, toolName, toolInputs[0], cwd, repoKey, sessionId) === "safe_readonly" ? "allowlist" : "policy"
|
|
8760
|
+
source: rawInput.toolInputs.length === 1 && resolveAutoResolveOrigin(config, toolName, rawInput.toolInputs[0], cwd, repoKey, sessionId) === "safe_readonly" ? "allowlist" : "policy"
|
|
8538
8761
|
};
|
|
8539
8762
|
}
|
|
8540
8763
|
}
|
|
@@ -8655,13 +8878,17 @@ var approvalRoutesOf = (config) => {
|
|
|
8655
8878
|
const routes = config.approvalRoutes ?? [];
|
|
8656
8879
|
return Array.isArray(routes) && routes.every(isApprovalRoutePattern) ? routes : null;
|
|
8657
8880
|
};
|
|
8658
|
-
var GIT_PUSH_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Set(["
|
|
8659
|
-
var
|
|
8660
|
-
var
|
|
8881
|
+
var GIT_PUSH_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Set(["--push-option", "--repo", "--receive-pack", "--exec", "--recurse-submodules"]);
|
|
8882
|
+
var GIT_PUSH_OPTION_WITH_ITS_VALUE_ATTACHED = /^--(?:push-option|repo|receive-pack|exec|recurse-submodules)=/;
|
|
8883
|
+
var GIT_PUSH_SHORT_FLAGS_ENDING_IN_THE_OPTION_FLAG = /^-[A-Za-np-z]*o$/;
|
|
8884
|
+
var GIT_PUSH_DRY_RUN_FLAG = "--dry-run";
|
|
8885
|
+
var GIT_PUSH_TAGS_FLAG = "--tags";
|
|
8886
|
+
var GIT_PUSH_SHORT_FLAGS_WITH_A_DRY_RUN = /^-[A-Za-mp-z]*n[A-Za-z]*$/;
|
|
8661
8887
|
var HEAD_REFSPECS = /* @__PURE__ */ new Set(["HEAD", "@"]);
|
|
8662
8888
|
var MOVES_BEFORE_A_PUSH = /^(?:(?:if|elif|while|until)\s+)?(?:(?:cd|pushd|popd)(?:\s|$)|git\s+(?:checkout|switch)(?:\s|$))/;
|
|
8663
8889
|
var LONGEST_COMMAND_READ_FOR_A_PUSH = 16 * 1024;
|
|
8664
|
-
var
|
|
8890
|
+
var isADryRunFlag = (word) => word === GIT_PUSH_DRY_RUN_FLAG || GIT_PUSH_SHORT_FLAGS_WITH_A_DRY_RUN.test(word);
|
|
8891
|
+
var takesTheNextWordAsItsValue = (word) => GIT_PUSH_OPTIONS_WITH_A_VALUE.has(word) || GIT_PUSH_SHORT_FLAGS_ENDING_IN_THE_OPTION_FLAG.test(word);
|
|
8665
8892
|
var pointsGitAtAnotherRepository = (form) => {
|
|
8666
8893
|
const [program, ...words] = form.split(" ");
|
|
8667
8894
|
if (program !== "git") return false;
|
|
@@ -8672,44 +8899,86 @@ var pointsGitAtAnotherRepository = (form) => {
|
|
|
8672
8899
|
}
|
|
8673
8900
|
return false;
|
|
8674
8901
|
};
|
|
8902
|
+
var wordsBeforeAComment = (form) => {
|
|
8903
|
+
const words = shellWordsOf(form);
|
|
8904
|
+
if (words === null) return form.split(" ");
|
|
8905
|
+
const firstComment = words.findIndex((word) => word.comment);
|
|
8906
|
+
return (firstComment === -1 ? words : words.slice(0, firstComment)).map((word) => word.text);
|
|
8907
|
+
};
|
|
8675
8908
|
var gitPushWordsOf = (form) => {
|
|
8676
|
-
const [program, subcommand, ...words] = form
|
|
8909
|
+
const [program, subcommand, ...words] = wordsBeforeAComment(form);
|
|
8677
8910
|
if (program !== "git" || subcommand !== "push") return null;
|
|
8678
8911
|
const flags = [];
|
|
8679
8912
|
const operands = [];
|
|
8680
8913
|
for (let index = 0; index < words.length; index += 1) {
|
|
8681
8914
|
const word = words[index] ?? "";
|
|
8682
|
-
if (
|
|
8683
|
-
if (
|
|
8684
|
-
|
|
8685
|
-
|
|
8915
|
+
if (isADryRunFlag(word)) return null;
|
|
8916
|
+
if (takesTheNextWordAsItsValue(word)) {
|
|
8917
|
+
if (GIT_PUSH_FORCING_FLAG.test(word)) flags.push(word);
|
|
8918
|
+
index += 1;
|
|
8919
|
+
} else if (word.startsWith("-")) {
|
|
8920
|
+
if (!GIT_PUSH_OPTION_WITH_ITS_VALUE_ATTACHED.test(word)) flags.push(word);
|
|
8921
|
+
} else {
|
|
8922
|
+
operands.push(word);
|
|
8923
|
+
}
|
|
8686
8924
|
}
|
|
8687
8925
|
return { flags, operands };
|
|
8688
8926
|
};
|
|
8689
8927
|
var pushNamesNoBranch = ({ operands }) => operands.length <= 1 || operands.length === 2 && HEAD_REFSPECS.has(operands[1] ?? "");
|
|
8928
|
+
var GIT_PUSH_FORCING_FLAG = /^(?:--force(?:-with-lease|-if-includes)?(?:=.*)?|-[A-Za-z]*f[A-Za-z]*)$/;
|
|
8929
|
+
var GIT_PUSH_FORCE_SPELLINGS = ["--force", "-f"];
|
|
8930
|
+
var FORCED_REFSPEC_MARK = "+";
|
|
8931
|
+
var REFSPEC_SEPARATOR = ":";
|
|
8932
|
+
var BRANCH_REF_PREFIXES = ["refs/heads/", "heads/"];
|
|
8933
|
+
var DEFAULT_PUSH_REMOTE = "origin";
|
|
8934
|
+
var destinationOfRefspec = (refspec) => {
|
|
8935
|
+
const forced = refspec.startsWith(FORCED_REFSPEC_MARK);
|
|
8936
|
+
const spec = forced ? refspec.slice(FORCED_REFSPEC_MARK.length) : refspec;
|
|
8937
|
+
const destination = spec.slice(spec.lastIndexOf(REFSPEC_SEPARATOR) + 1);
|
|
8938
|
+
const prefix = BRANCH_REF_PREFIXES.find((candidate) => destination.startsWith(candidate));
|
|
8939
|
+
return { branch: prefix === void 0 ? destination : destination.slice(prefix.length), forced };
|
|
8940
|
+
};
|
|
8941
|
+
var spellingsOfAPushToADestination = (remote, { branch, forced }, flagsForce) => [
|
|
8942
|
+
`git push ${remote} ${branch}`,
|
|
8943
|
+
...forced || flagsForce ? GIT_PUSH_FORCE_SPELLINGS.map((flag) => `git push ${flag} ${remote} ${branch}`) : []
|
|
8944
|
+
];
|
|
8945
|
+
var flagsForceThePush = ({ flags }) => flags.some((flag) => GIT_PUSH_FORCING_FLAG.test(flag));
|
|
8946
|
+
var spellingsOfAPushToItsDestinations = (form) => {
|
|
8947
|
+
const push = gitPushWordsOf(form);
|
|
8948
|
+
if (push === null) return [];
|
|
8949
|
+
const forced = flagsForceThePush(push) ? GIT_PUSH_FORCE_SPELLINGS.map((flag) => `git push ${flag}`) : [];
|
|
8950
|
+
if (pushNamesNoBranch(push)) return forced;
|
|
8951
|
+
const [remote = DEFAULT_PUSH_REMOTE, ...refspecs] = push.operands;
|
|
8952
|
+
return [...forced, ...refspecs.map(destinationOfRefspec).flatMap((destination) => spellingsOfAPushToADestination(remote, destination, flagsForceThePush(push)))];
|
|
8953
|
+
};
|
|
8690
8954
|
var spellingsOfAPushOfTheBranch = (form, branch) => {
|
|
8691
8955
|
const push = gitPushWordsOf(form);
|
|
8692
|
-
if (push === null || !pushNamesNoBranch(push)) return [];
|
|
8693
|
-
const remote = push.operands[0] ??
|
|
8956
|
+
if (push === null || push.flags.includes(GIT_PUSH_TAGS_FLAG) || !pushNamesNoBranch(push)) return [];
|
|
8957
|
+
const remote = push.operands[0] ?? DEFAULT_PUSH_REMOTE;
|
|
8694
8958
|
return [.../* @__PURE__ */ new Set([`git push ${remote} ${branch}`, ["git push", ...push.flags, remote, branch].join(" ")])];
|
|
8695
8959
|
};
|
|
8960
|
+
var forcedSpellingsOfAPushOfTheBranch = (form, branch) => {
|
|
8961
|
+
const push = gitPushWordsOf(form);
|
|
8962
|
+
if (push === null || !flagsForceThePush(push)) return [];
|
|
8963
|
+
return spellingsOfAPushOfTheBranch(form, branch).length === 0 ? [] : GIT_PUSH_FORCE_SPELLINGS.map((flag) => `git push ${flag} ${push.operands[0] ?? DEFAULT_PUSH_REMOTE} ${branch}`);
|
|
8964
|
+
};
|
|
8696
8965
|
var commandReadForAPush = (input, toolInput) => {
|
|
8697
8966
|
const command = POSIX_SHELL_TOOLS.has(input.toolName) ? extractPolicyArg(input.toolName, toolInput) : void 0;
|
|
8698
8967
|
return command !== void 0 && command.length <= LONGEST_COMMAND_READ_FOR_A_PUSH ? command : void 0;
|
|
8699
8968
|
};
|
|
8700
|
-
var pushesInSegmentsBeforeAMove = (command, branch) => {
|
|
8969
|
+
var pushesInSegmentsBeforeAMove = (command, branch, spellingsOf) => {
|
|
8701
8970
|
const pushes = [];
|
|
8702
8971
|
for (const segment of spelledSegmentsOf(command)) {
|
|
8703
8972
|
const { forms } = commandSpellings(segment.text, SPELLS_COMMAND_RUNNERS_TOO);
|
|
8704
8973
|
if (forms.some((form) => MOVES_BEFORE_A_PUSH.test(form))) break;
|
|
8705
|
-
if (!forms.some(pointsGitAtAnotherRepository)) pushes.push(...forms.flatMap((form) =>
|
|
8974
|
+
if (!forms.some(pointsGitAtAnotherRepository)) pushes.push(...forms.flatMap((form) => spellingsOf(form, branch)));
|
|
8706
8975
|
}
|
|
8707
8976
|
return [...new Set(pushes)];
|
|
8708
8977
|
};
|
|
8709
|
-
var pushesOfTheCurrentBranchIn = (input, toolInput) => {
|
|
8978
|
+
var pushesOfTheCurrentBranchIn = (input, toolInput, spellingsOf = spellingsOfAPushOfTheBranch) => {
|
|
8710
8979
|
const branch = input.currentBranch;
|
|
8711
8980
|
const command = branch !== void 0 && isGitBranch(branch) ? commandReadForAPush(input, toolInput) : void 0;
|
|
8712
|
-
return branch === void 0 || command === void 0 ? [] : pushesInSegmentsBeforeAMove(command, branch);
|
|
8981
|
+
return branch === void 0 || command === void 0 ? [] : pushesInSegmentsBeforeAMove(command, branch, spellingsOf);
|
|
8713
8982
|
};
|
|
8714
8983
|
var MENTIONS_A_GIT_PUSH = /\bgit\b[\s\S]*\bpush\b/;
|
|
8715
8984
|
var toolInputMayPushTheCurrentBranch = (toolName, toolInput) => {
|
|
@@ -8717,13 +8986,20 @@ var toolInputMayPushTheCurrentBranch = (toolName, toolInput) => {
|
|
|
8717
8986
|
return command !== void 0 && command.length <= LONGEST_COMMAND_READ_FOR_A_PUSH && MENTIONS_A_GIT_PUSH.test(command);
|
|
8718
8987
|
};
|
|
8719
8988
|
var callMayPushTheCurrentBranch = (toolName, toolInputs) => POSIX_SHELL_TOOLS.has(toolName) && toolInputs.some((toolInput) => toolInputMayPushTheCurrentBranch(toolName, toolInput));
|
|
8720
|
-
var
|
|
8989
|
+
var pushDestinationSpellingsIn = (input, toolInput) => {
|
|
8990
|
+
const command = commandReadForAPush(input, toolInput);
|
|
8991
|
+
if (command === void 0 || !MENTIONS_A_GIT_PUSH.test(command)) return [];
|
|
8992
|
+
return [...new Set(spelledSegmentsOf(command).flatMap((segment) => commandSpellings(segment.text, SPELLS_COMMAND_RUNNERS_TOO).forms.flatMap(spellingsOfAPushToItsDestinations)))];
|
|
8993
|
+
};
|
|
8994
|
+
var pushSpellingsBeyondTheWrittenOnesIn = (input, toolInput) => [...pushesOfTheCurrentBranchIn(input, toolInput, forcedSpellingsOfAPushOfTheBranch), ...pushDestinationSpellingsIn(input, toolInput)];
|
|
8995
|
+
var writtenRouteArgumentsOf = (input, toolInput) => [...policyArgForms(input.toolName, toolInput, input.cwd), ...pushesOfTheCurrentBranchIn(input, toolInput)];
|
|
8996
|
+
var routeArgumentsOf = (input, toolInput) => [...writtenRouteArgumentsOf(input, toolInput), ...pushSpellingsBeyondTheWrittenOnesIn(input, toolInput)];
|
|
8721
8997
|
var everyRule = () => true;
|
|
8722
8998
|
var aChosenRuleGoverns = (input, counts = everyRule) => {
|
|
8723
8999
|
const chosen = input.config.policies.filter((policy) => !isDefaultRule(policy));
|
|
8724
9000
|
const routes = approvalRoutesOf(input.config);
|
|
8725
9001
|
if (routes === null) return true;
|
|
8726
|
-
return input.toolInputs.some((toolInput) => {
|
|
9002
|
+
return withExtraReadings(input).toolInputs.some((toolInput) => {
|
|
8727
9003
|
const args = policyArgForms(input.toolName, toolInput, input.cwd);
|
|
8728
9004
|
const reading = policyReadingOf(chosen, input.toolName, args, SPELLS_COMMAND_RUNNERS_TOO);
|
|
8729
9005
|
const governing = governingRuleForReading(chosen, input.toolName, args, reading, input.repoKey, input.sessionId);
|
|
@@ -8731,16 +9007,27 @@ var aChosenRuleGoverns = (input, counts = everyRule) => {
|
|
|
8731
9007
|
});
|
|
8732
9008
|
};
|
|
8733
9009
|
var AUTO_PERMISSION_MODE = "auto";
|
|
8734
|
-
var
|
|
9010
|
+
var routeWaitsForSomeoneElse = (route) => route.answeredBySomeoneElse === true;
|
|
9011
|
+
var routeDeliveredFor = (input, routes, toolInput) => {
|
|
9012
|
+
const repoKey = input.sharedRepoKey ?? input.repoKey;
|
|
9013
|
+
const written = writtenRouteArgumentsOf(input, toolInput);
|
|
9014
|
+
const writtenRoute = findBestRoute(routes, input.toolName, written, repoKey);
|
|
9015
|
+
if (writtenRoute?.answeredBySomeoneElse === true) return writtenRoute;
|
|
9016
|
+
const spelled = pushSpellingsBeyondTheWrittenOnesIn(input, toolInput).filter((spelling) => !written.includes(spelling));
|
|
9017
|
+
if (spelled.length === 0) return writtenRoute;
|
|
9018
|
+
const heldSpelledRoute = findBestRoute(routes.filter(routeWaitsForSomeoneElse), input.toolName, spelled, repoKey);
|
|
9019
|
+
if (heldSpelledRoute !== void 0 && heldSpelledRoute.toolPattern.length > (writtenRoute?.toolPattern.length ?? -1)) return heldSpelledRoute;
|
|
9020
|
+
return writtenRoute ?? findBestRoute(routes, input.toolName, spelled, repoKey);
|
|
9021
|
+
};
|
|
8735
9022
|
var callWaitsForSomeoneElse = (input) => {
|
|
8736
9023
|
const routes = approvalRoutesOf(input.config);
|
|
8737
9024
|
if (routes === null) return false;
|
|
8738
|
-
return input.toolInputs.some((toolInput) => routeDeliveredFor(input, routes, toolInput)?.answeredBySomeoneElse === true);
|
|
9025
|
+
return withExtraReadings(input).toolInputs.some((toolInput) => routeDeliveredFor(input, routes, toolInput)?.answeredBySomeoneElse === true);
|
|
8739
9026
|
};
|
|
8740
9027
|
var namedRouteWaitsForSomeoneElse = (input) => {
|
|
8741
9028
|
const routes = approvalRoutesOf(input.config);
|
|
8742
9029
|
if (routes === null) return false;
|
|
8743
|
-
return input.toolInputs.some((toolInput) => {
|
|
9030
|
+
return withExtraReadings(input).toolInputs.some((toolInput) => {
|
|
8744
9031
|
const route = routeDeliveredFor(input, routes, toolInput);
|
|
8745
9032
|
return route?.answeredBySomeoneElse === true && patternToolName(route.toolPattern) === input.toolName;
|
|
8746
9033
|
});
|
|
@@ -8748,7 +9035,7 @@ var namedRouteWaitsForSomeoneElse = (input) => {
|
|
|
8748
9035
|
var matchedRouteOf = (input) => {
|
|
8749
9036
|
const routes = approvalRoutesOf(input.config);
|
|
8750
9037
|
if (routes === null) return void 0;
|
|
8751
|
-
const matched = input.toolInputs.flatMap((toolInput) => routeDeliveredFor(input, routes, toolInput) ?? []);
|
|
9038
|
+
const matched = withExtraReadings(input).toolInputs.flatMap((toolInput) => routeDeliveredFor(input, routes, toolInput) ?? []);
|
|
8752
9039
|
const route = matched.find((candidate) => candidate.answeredBySomeoneElse === true) ?? matched[0];
|
|
8753
9040
|
if (route === void 0) return void 0;
|
|
8754
9041
|
return route.repoKey ? { toolPattern: route.toolPattern, repoKey: route.repoKey } : { toolPattern: route.toolPattern };
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YZ7V2LVG.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PJSFKKZ5.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
claimThrottle,
|
|
5
5
|
releaseThrottle,
|
|
6
6
|
reportEvent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G4OVFWU4.js";
|
|
8
8
|
import {
|
|
9
9
|
deriveToolTarget,
|
|
10
10
|
permissionDeniedAction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GW3PE52Q.js";
|
|
12
12
|
import {
|
|
13
13
|
machineDecisionFor,
|
|
14
14
|
wireVerdictFor
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TRDHHF3A.js";
|
|
16
16
|
|
|
17
17
|
// src/machine-decision-audit.ts
|
|
18
18
|
import { basename } from "path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBLFIWPI.js";
|
|
4
4
|
import {
|
|
5
5
|
readRegularJsonFile,
|
|
6
6
|
writeFileAtomic
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeDeclinedAgents,
|
|
14
14
|
withDeclinedAgent,
|
|
15
15
|
withoutDeclinedAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TRDHHF3A.js";
|
|
17
17
|
|
|
18
18
|
// src/declined-agents-file.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readMacAppAgentKey
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FPG7X2GS.js";
|
|
4
4
|
import {
|
|
5
5
|
API_KEYS_PATH
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BQ673OOD.js";
|
|
7
7
|
import {
|
|
8
8
|
absoluteUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4HDX77ND.js";
|
|
10
10
|
import {
|
|
11
11
|
findExportedKeyLines,
|
|
12
12
|
isAdoptedMacAppKey,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
readConfigFileKey,
|
|
17
17
|
readKeySource,
|
|
18
18
|
readMacAppKeyPrefix
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YZ7V2LVG.js";
|
|
20
20
|
import {
|
|
21
21
|
isValidApiKey
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TRDHHF3A.js";
|
|
23
23
|
|
|
24
24
|
// src/key-revocation.ts
|
|
25
25
|
var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
|