pushary 1.9.225 → 1.9.227
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 +11 -0
- package/dist/{api-XGUBV6TG.js → api-6XUVXHCP.js} +11 -11
- package/dist/bin/pushary-audit.js +3 -3
- package/dist/bin/pushary-bell-hook.js +28 -28
- package/dist/bin/pushary-bell.js +12 -12
- package/dist/bin/pushary-calls.js +15 -15
- package/dist/bin/pushary-claude.js +26 -26
- package/dist/bin/pushary-clean.js +39 -39
- package/dist/bin/pushary-codex-bridge.js +23 -23
- package/dist/bin/pushary-codex-hook.js +34 -34
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +16 -16
- package/dist/bin/pushary-connect.js +35 -35
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +46 -46
- package/dist/bin/pushary-disconnect.js +30 -30
- package/dist/bin/pushary-display-hook.js +10 -1
- package/dist/bin/pushary-doctor.js +47 -47
- package/dist/bin/pushary-elicitation-hook.js +27 -27
- package/dist/bin/pushary-gemini-bridge.js +18 -18
- package/dist/bin/pushary-gemini-hook.js +31 -31
- package/dist/bin/pushary-hook.js +34 -34
- package/dist/bin/pushary-login.js +22 -22
- package/dist/bin/pushary-logout.js +30 -30
- package/dist/bin/pushary-mcp.js +12 -12
- package/dist/bin/pushary-mode.js +16 -16
- package/dist/bin/pushary-notification-hook.js +27 -27
- package/dist/bin/pushary-opencode-bridge.js +22 -22
- package/dist/bin/pushary-opencode-hook.js +32 -32
- package/dist/bin/pushary-permission-denied-hook.js +34 -34
- package/dist/bin/pushary-permission-hook.js +34 -34
- package/dist/bin/pushary-post-hook.js +28 -28
- package/dist/bin/pushary-prompt-hook.js +27 -27
- package/dist/bin/pushary-session-end-hook.js +27 -27
- package/dist/bin/pushary-session-start-hook.js +39 -39
- package/dist/bin/pushary-sessions.js +12 -12
- package/dist/bin/pushary-setup.js +57 -57
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +36 -36
- package/dist/bin/pushary-stop-hook.js +27 -27
- package/dist/bin/pushary-stopfailure-hook.js +27 -27
- package/dist/bin/pushary-suggestions.js +16 -16
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +25 -25
- package/dist/bin/pushary-upgrade.js +46 -46
- package/dist/bin/pushary-wait.js +16 -16
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-66JT67XZ.js → chunk-2AY4DSZT.js} +16 -16
- package/dist/{chunk-W456LKRF.js → chunk-2HCM3SOV.js} +1 -1
- package/dist/{chunk-I3F2RT6H.js → chunk-2TLSNTYA.js} +3 -3
- package/dist/{chunk-YIMMMBLU.js → chunk-35ZGLC3I.js} +3 -3
- package/dist/{chunk-THE2SPHY.js → chunk-3EMACK2X.js} +3 -3
- package/dist/{chunk-QYNBB5OO.js → chunk-3ZEWNB5K.js} +2 -2
- package/dist/{chunk-EPJQPPBU.js → chunk-4SLIHG3G.js} +60 -13
- package/dist/{chunk-JTWSDHDB.js → chunk-55OJQNBO.js} +3 -3
- package/dist/{chunk-V5JRLAHZ.js → chunk-7FNVZ4TK.js} +1 -1
- package/dist/{chunk-4DKVCK2C.js → chunk-7KRQTNPA.js} +199 -9
- package/dist/{chunk-WA737SQM.js → chunk-7Z2BZV5Y.js} +4 -4
- package/dist/{chunk-LMP5K32O.js → chunk-AA2WZCB3.js} +6 -6
- package/dist/{chunk-XRF2QECS.js → chunk-AAFL6HUL.js} +1 -1
- package/dist/{chunk-ZOJCQT65.js → chunk-BAZEM6A5.js} +1 -1
- package/dist/{chunk-BBDFTX3K.js → chunk-BBDK7TVJ.js} +1 -1
- package/dist/{chunk-SP5YAAFD.js → chunk-CBJQSI2W.js} +1 -1
- package/dist/{chunk-OA4BOYDG.js → chunk-CWOQOTRL.js} +1 -1
- package/dist/{chunk-TKAHYLOH.js → chunk-DFVMNFBY.js} +2 -2
- package/dist/{chunk-JOR5C5EN.js → chunk-DRVYUPFL.js} +5 -5
- package/dist/{chunk-W5SKLM2R.js → chunk-DUM5HISL.js} +4 -4
- package/dist/{chunk-BMQMT2LQ.js → chunk-DXRKQEH5.js} +12 -12
- package/dist/{chunk-TUACBIHO.js → chunk-E6JFMLST.js} +2 -2
- package/dist/{chunk-HZH5X3D6.js → chunk-ETFYH5IZ.js} +5 -5
- package/dist/{chunk-V2BCZ2HN.js → chunk-F7M3NBZX.js} +4 -4
- package/dist/{chunk-DUUE36M5.js → chunk-FEQWWCVR.js} +3 -3
- package/dist/{chunk-IPGEDXFD.js → chunk-FN62QEJF.js} +5 -5
- package/dist/{chunk-NUPW3G4F.js → chunk-FNCKAFWK.js} +5 -5
- package/dist/{chunk-5C55SFEG.js → chunk-FVUPVLZT.js} +2 -2
- package/dist/{chunk-H4QSDEVU.js → chunk-G3JSEZFW.js} +4 -4
- package/dist/{chunk-5HGY2GS7.js → chunk-GKDDUXW3.js} +1 -1
- package/dist/{chunk-MSAFTQ5S.js → chunk-GLEJK3WC.js} +7 -7
- package/dist/{chunk-YCDBEW2Q.js → chunk-GWLFYYZP.js} +10 -10
- package/dist/{chunk-TYD3HCOZ.js → chunk-H2M655JV.js} +1 -1
- package/dist/{chunk-OOHHMEYX.js → chunk-HJALQSTD.js} +2 -2
- package/dist/{chunk-VQKDSIJ6.js → chunk-HK3O5JVJ.js} +7 -7
- package/dist/{chunk-7D2FYVBW.js → chunk-HTOT6MTO.js} +3 -3
- package/dist/{chunk-6W25WVDD.js → chunk-HYY7VUA2.js} +1 -1
- package/dist/{chunk-XOMANR2K.js → chunk-I3MBDNDM.js} +1 -1
- package/dist/{chunk-4DP54WUK.js → chunk-IDLGCJ3P.js} +1 -1
- package/dist/{chunk-Z2WM6DAC.js → chunk-ILHFZD2P.js} +2 -2
- package/dist/{chunk-DKI5QA46.js → chunk-IOTFP3WG.js} +4 -4
- package/dist/{chunk-67NX2ZEC.js → chunk-ITOYJTIT.js} +5 -5
- package/dist/{chunk-5IGIQ6FR.js → chunk-JALBF3NN.js} +2 -2
- package/dist/{chunk-LVB2UNTX.js → chunk-JBZHTBVZ.js} +5 -5
- package/dist/{chunk-3P2VKDFP.js → chunk-JKZNJDPI.js} +2 -2
- package/dist/{chunk-FOABNWRY.js → chunk-KGWZIM42.js} +3 -3
- package/dist/{chunk-5DLPB6VD.js → chunk-KIDOILM5.js} +1 -1
- package/dist/{chunk-K6JUQVL6.js → chunk-KLZCRA4D.js} +2 -2
- package/dist/{chunk-WKTGDK5J.js → chunk-KPXHLZFB.js} +2 -2
- package/dist/{chunk-JDWRKP73.js → chunk-LAPLQ7M7.js} +4 -4
- package/dist/{chunk-I5K4M6RO.js → chunk-LSKWAWUO.js} +1 -1
- package/dist/{chunk-PPIPBJR2.js → chunk-M46PBEZN.js} +1 -1
- package/dist/{chunk-3LNGHZ2A.js → chunk-ME6HK32L.js} +1 -1
- package/dist/{chunk-KMBUWYIF.js → chunk-MV53KPOV.js} +12 -12
- package/dist/{chunk-GPLEY6JL.js → chunk-O5SZYNKA.js} +5 -5
- package/dist/{chunk-YMMRJK2S.js → chunk-OCOOPIFG.js} +5 -5
- package/dist/{chunk-2GQWSBX2.js → chunk-OPZYY6W5.js} +8 -8
- package/dist/{chunk-LOJ7U6VW.js → chunk-PMAS2AZ7.js} +2 -2
- package/dist/{chunk-WUOJXMOM.js → chunk-PSK2AWNC.js} +4 -4
- package/dist/{chunk-UC5LKWWC.js → chunk-PXBL4P2Y.js} +2 -2
- package/dist/{chunk-UC3CPRDS.js → chunk-PZEU7LBD.js} +2 -2
- package/dist/{chunk-PCWVQ6PT.js → chunk-QJNK3Z2M.js} +9 -9
- package/dist/{chunk-ABUIWYET.js → chunk-QUKCWMP7.js} +6 -6
- package/dist/{chunk-3ZF74CHU.js → chunk-RONHATBY.js} +6 -6
- package/dist/{chunk-L3OZKXAH.js → chunk-RWELN5CR.js} +1 -1
- package/dist/{chunk-2HHQA42H.js → chunk-SIOCR3MZ.js} +3 -3
- package/dist/{chunk-VYPGDTD5.js → chunk-SJZUG2UF.js} +1 -1
- package/dist/{chunk-ZK3GC5X6.js → chunk-SZS5GQ4P.js} +6 -6
- package/dist/{chunk-3BGYVYXJ.js → chunk-UC66ONKT.js} +5 -5
- package/dist/{chunk-BTFQLHZ2.js → chunk-VAIWWB5C.js} +4 -4
- package/dist/{chunk-IZHCLPRX.js → chunk-VRBCELDH.js} +6 -6
- package/dist/{chunk-UNHODOXL.js → chunk-XNZRHX5Q.js} +2 -2
- package/dist/{chunk-2RKHIDZJ.js → chunk-XVHETKVC.js} +3 -3
- package/dist/{chunk-F4G22HS4.js → chunk-Y7EVC2RD.js} +1 -1
- package/dist/{chunk-2MAPVRYT.js → chunk-YSJIEIOP.js} +4 -4
- package/dist/{chunk-FGEPXL5K.js → chunk-YSRKSUA6.js} +3 -3
- package/dist/{chunk-6LNEYLGC.js → chunk-YT7ZMEFE.js} +5 -5
- package/dist/{chunk-JYNIBOW6.js → chunk-YZGKBT6I.js} +1 -1
- package/dist/{chunk-QCZEPAHW.js → chunk-ZVZI7MRB.js} +1 -1
- package/dist/{codex-app-cards-switch-R5F7XIWI.js → codex-app-cards-switch-NBQ67I4A.js} +11 -11
- package/dist/{codex-card-routing-JODZRLQ6.js → codex-card-routing-NI7PPFQX.js} +2 -2
- package/dist/{codex-desktop-launch-7DSOU5NE.js → codex-desktop-launch-HJHD5DVS.js} +1 -1
- package/dist/{codex-session-launch-SZ5TQPGZ.js → codex-session-launch-OO6WJMCA.js} +20 -20
- package/dist/{config-ZH3LNGIR.js → config-RBQEVYOH.js} +3 -3
- package/dist/{global-upgrade-PE7BP5QH.js → global-upgrade-TF2D2VMG.js} +9 -9
- package/dist/{identity-2EITAH3V.js → identity-7YMAJTX6.js} +4 -4
- package/dist/{live-capabilities-CMWLJFZO.js → live-capabilities-FOOBZAR5.js} +4 -4
- package/dist/{paths-YDAYO6TG.js → paths-BKI4YSPZ.js} +3 -3
- package/dist/reapply-VQAXPC7J.js +74 -0
- package/dist/src/index.js +33 -33
- package/dist/{upgrade-lock-46BLXPXN.js → upgrade-lock-ABZFJEJV.js} +4 -4
- package/dist/{usage-GEWJJOAD.js → usage-BXXD7A4W.js} +3 -3
- package/package.json +1 -1
- package/dist/reapply-MCB2MIQN.js +0 -74
|
@@ -2,30 +2,30 @@ import {
|
|
|
2
2
|
forgetPhoneApproval,
|
|
3
3
|
rememberPhoneApproval,
|
|
4
4
|
takePhoneApproval
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3ZEWNB5K.js";
|
|
6
6
|
import {
|
|
7
7
|
claudeSettingsLocationFor,
|
|
8
8
|
readClaudePermissionRules
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KLZCRA4D.js";
|
|
10
10
|
import {
|
|
11
11
|
defersToNativeMode
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HYY7VUA2.js";
|
|
13
13
|
import {
|
|
14
14
|
reportMachineDenial
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LAPLQ7M7.js";
|
|
16
16
|
import {
|
|
17
17
|
isGatingMoment,
|
|
18
18
|
recordKeylessMoment
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZVZI7MRB.js";
|
|
20
20
|
import {
|
|
21
21
|
isAdmitted,
|
|
22
22
|
readAdmissionRules
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FN62QEJF.js";
|
|
24
24
|
import {
|
|
25
25
|
activeHookSource,
|
|
26
26
|
activeIdentity,
|
|
27
27
|
namedSource
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-JBZHTBVZ.js";
|
|
29
29
|
import {
|
|
30
30
|
DEFAULT_SESSION,
|
|
31
31
|
allow,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
storedWaitDeadline,
|
|
67
67
|
sweepFilesOlderThan,
|
|
68
68
|
userScope
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-MV53KPOV.js";
|
|
70
70
|
import {
|
|
71
71
|
UNNAMED_ACTION,
|
|
72
72
|
deriveAction,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
patchDeletesFiles,
|
|
78
78
|
permissionDeniedAction,
|
|
79
79
|
scopePathFor
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-AAFL6HUL.js";
|
|
81
81
|
import {
|
|
82
82
|
askUser,
|
|
83
83
|
cancelQuestion,
|
|
@@ -92,30 +92,30 @@ import {
|
|
|
92
92
|
sendNotification,
|
|
93
93
|
waitForQuestion,
|
|
94
94
|
withdrawQuestion
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-RONHATBY.js";
|
|
96
96
|
import {
|
|
97
97
|
branchFor,
|
|
98
98
|
projectNameFor,
|
|
99
99
|
repoKeyFor,
|
|
100
100
|
repositoryScopeFor
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-M46PBEZN.js";
|
|
102
102
|
import {
|
|
103
103
|
getMachineId
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-2HCM3SOV.js";
|
|
105
105
|
import {
|
|
106
106
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-PZEU7LBD.js";
|
|
108
108
|
import {
|
|
109
109
|
getApiKey,
|
|
110
110
|
getBaseUrl,
|
|
111
111
|
isMalformedApiKeyError
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-FVUPVLZT.js";
|
|
113
113
|
import {
|
|
114
114
|
writeFileAtomic
|
|
115
115
|
} from "./chunk-PM2NRK6Y.js";
|
|
116
116
|
import {
|
|
117
117
|
NPX_LATEST_COMMAND
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-IDLGCJ3P.js";
|
|
119
119
|
import {
|
|
120
120
|
AGENT_QUESTION_STRATEGY,
|
|
121
121
|
AGENT_QUESTION_TOOL,
|
|
@@ -183,7 +183,7 @@ import {
|
|
|
183
183
|
terminalStaysLiveForTheCall,
|
|
184
184
|
timeoutActionWithoutLocalPrompt,
|
|
185
185
|
unapprovedScopeReason
|
|
186
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-7KRQTNPA.js";
|
|
187
187
|
|
|
188
188
|
// src/terminal-answer-watch.ts
|
|
189
189
|
import { closeSync, openSync, readSync, statSync } from "fs";
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
NpmMissingError,
|
|
4
4
|
NpmPermissionError,
|
|
5
5
|
NpmReleaseAgeError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G3JSEZFW.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
9
|
} from "./chunk-PM2NRK6Y.js";
|
|
10
10
|
import {
|
|
11
11
|
NPX_LATEST_COMMAND
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IDLGCJ3P.js";
|
|
13
13
|
import {
|
|
14
14
|
readSetupAgentFailures
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7KRQTNPA.js";
|
|
16
16
|
|
|
17
17
|
// src/setup/config-write.ts
|
|
18
18
|
var AgentConfigWriteError = class extends Error {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-P6DUWKAO.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchAsCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LSKWAWUO.js";
|
|
8
8
|
import {
|
|
9
9
|
getBaseUrl
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FVUPVLZT.js";
|
|
11
11
|
import {
|
|
12
12
|
writeJsonAtomicDurable
|
|
13
13
|
} from "./chunk-PM2NRK6Y.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
compressTranscriptRecord,
|
|
16
16
|
redactSecretsFromContent,
|
|
17
17
|
transcriptRecordPlaintext
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-7KRQTNPA.js";
|
|
19
19
|
|
|
20
20
|
// src/transcript-recipient-pin.ts
|
|
21
21
|
import { createHash } from "crypto";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
OPENCLAW_ENVIRONMENT_KEYS,
|
|
6
6
|
openClawEnvironmentOf,
|
|
7
7
|
openClawPathsFrom
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PZEU7LBD.js";
|
|
9
9
|
import {
|
|
10
10
|
resolvePathBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G3JSEZFW.js";
|
|
12
12
|
import {
|
|
13
13
|
isRecord
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7KRQTNPA.js";
|
|
15
15
|
|
|
16
16
|
// src/openclaw/wiring-state.ts
|
|
17
17
|
var OPENCLAW_PLUGIN_ID = "pushary";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
callDecisionStore,
|
|
3
3
|
identifyingToolInput
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MV53KPOV.js";
|
|
5
5
|
import {
|
|
6
6
|
canonicalJson
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PZEU7LBD.js";
|
|
8
8
|
|
|
9
9
|
// src/phone-approval.ts
|
|
10
10
|
import { createHash } from "crypto";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
uninstallOpenClawPlugin,
|
|
14
14
|
unsetOpenClawEntry,
|
|
15
15
|
writeOpenClawEntry
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3EMACK2X.js";
|
|
17
17
|
import {
|
|
18
18
|
needsShell
|
|
19
19
|
} from "./chunk-3PSNUHC5.js";
|
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
openClawDirectoriesToLookIn,
|
|
26
26
|
openClawPluginFolder,
|
|
27
27
|
openClawSetupReceiptDirectory
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PZEU7LBD.js";
|
|
29
29
|
import {
|
|
30
30
|
resolvePathBinary
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-G3JSEZFW.js";
|
|
32
32
|
import {
|
|
33
33
|
readJsonSafe,
|
|
34
34
|
writeJsonAtomic
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
} from "./chunk-CXQWDQCJ.js";
|
|
40
40
|
import {
|
|
41
41
|
isRecord
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-7KRQTNPA.js";
|
|
43
43
|
|
|
44
44
|
// src/hermes/plugin-payload.ts
|
|
45
45
|
import { createHash } from "crypto";
|
|
@@ -208,18 +208,39 @@ def _redact_outbound_text(text: str) -> str:
|
|
|
208
208
|
return REDACTION_UNAVAILABLE
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
def
|
|
211
|
+
def _redacted_arg_lines(args):
|
|
212
212
|
if not isinstance(args, dict) or not args:
|
|
213
|
+
return []
|
|
214
|
+
return [_redact_outbound_text(f"{key}: {value}") for key, value in args.items()]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def _summary_of(lines):
|
|
218
|
+
if not lines:
|
|
213
219
|
return None
|
|
214
220
|
parts = []
|
|
215
|
-
for
|
|
216
|
-
rendered = _redact_outbound_text(f"{key}: {value}")
|
|
221
|
+
for rendered in lines:
|
|
217
222
|
if len(rendered) > 200:
|
|
218
223
|
rendered = rendered[:200] + "\u2026"
|
|
219
224
|
parts.append(rendered)
|
|
220
225
|
return "\\n".join(parts)[:500]
|
|
221
226
|
|
|
222
227
|
|
|
228
|
+
def _summarize_args(args):
|
|
229
|
+
return _summary_of(_redacted_arg_lines(args))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _shell_command_body_of(lines):
|
|
233
|
+
return approval.cut_action_body("\\n".join(lines)) if lines else None
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def _runs_hermes_shell(tool_name):
|
|
237
|
+
return (tool_name or "").lower() == approval_coverage.HERMES_SHELL_TOOL
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def _gated_call_action_body(tool_name, lines):
|
|
241
|
+
return _shell_command_body_of(lines) if _runs_hermes_shell(tool_name) else _summary_of(lines)
|
|
242
|
+
|
|
243
|
+
|
|
223
244
|
def _arg_target(args):
|
|
224
245
|
if not isinstance(args, dict):
|
|
225
246
|
return None
|
|
@@ -300,15 +321,15 @@ def _on_pre_tool_call(tool_name=None, args=None, session_id=None, **kwargs):
|
|
|
300
321
|
|
|
301
322
|
try:
|
|
302
323
|
budget_ms = int(host.gate_budget_seconds(_requested_gate_seconds()) * 1000)
|
|
303
|
-
|
|
324
|
+
lines = _redacted_arg_lines(args)
|
|
304
325
|
result = json.loads(tools.pushary_ask({
|
|
305
326
|
"question": f"Allow Hermes to run \`{tool_name}\`?",
|
|
306
327
|
"type": "confirm",
|
|
307
|
-
"context":
|
|
328
|
+
"context": _summary_of(lines),
|
|
308
329
|
"agent_name": identity.agent_name(),
|
|
309
330
|
"tool_name": tool_name,
|
|
310
331
|
"tool_target": _arg_target(args),
|
|
311
|
-
"action_body":
|
|
332
|
+
"action_body": _gated_call_action_body(tool_name, lines),
|
|
312
333
|
"wait": True,
|
|
313
334
|
"timeout_ms": budget_ms,
|
|
314
335
|
}))
|
|
@@ -991,6 +1012,8 @@ logger = logging.getLogger(__name__)
|
|
|
991
1012
|
|
|
992
1013
|
DECISION_LINE_MAX = 500
|
|
993
1014
|
ACTION_BODY_MAX = 4000
|
|
1015
|
+
ACTION_BODY_TRUNCATION_MARKER = "\\n\u2026 [truncated]"
|
|
1016
|
+
UTF16_SINGLE_UNIT_MAX = 0xFFFF
|
|
994
1017
|
|
|
995
1018
|
POLL_CEILING_SECONDS = 50.0
|
|
996
1019
|
WITHDRAW_RESERVE_SECONDS = 10.0
|
|
@@ -1036,6 +1059,30 @@ def _command_head(command):
|
|
|
1036
1059
|
return " ".join(str(command or "").split()[:2])[:80]
|
|
1037
1060
|
|
|
1038
1061
|
|
|
1062
|
+
def _utf16_units(character: str) -> int:
|
|
1063
|
+
return 2 if ord(character) > UTF16_SINGLE_UNIT_MAX else 1
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
def _utf16_length(text: str) -> int:
|
|
1067
|
+
return sum(_utf16_units(character) for character in text)
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
def _prefix_within_utf16_units(text: str, units: int) -> str:
|
|
1071
|
+
used = 0
|
|
1072
|
+
for index, character in enumerate(text):
|
|
1073
|
+
used += _utf16_units(character)
|
|
1074
|
+
if used > units:
|
|
1075
|
+
return text[:index]
|
|
1076
|
+
return text
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
def cut_action_body(text: str) -> str:
|
|
1080
|
+
if len(_prefix_within_utf16_units(text, ACTION_BODY_MAX)) == len(text):
|
|
1081
|
+
return text
|
|
1082
|
+
kept = _prefix_within_utf16_units(text, ACTION_BODY_MAX - _utf16_length(ACTION_BODY_TRUNCATION_MARKER))
|
|
1083
|
+
return kept + ACTION_BODY_TRUNCATION_MARKER
|
|
1084
|
+
|
|
1085
|
+
|
|
1039
1086
|
def _command_summary(command):
|
|
1040
1087
|
collapsed = " ".join(str(command or "").split())
|
|
1041
1088
|
if len(collapsed) <= QUESTION_COMMAND_MAX:
|
|
@@ -1081,7 +1128,7 @@ def _open_question(request, offered, uses_select):
|
|
|
1081
1128
|
tool_name=HERMES_SHELL_TOOL,
|
|
1082
1129
|
tool_target=_command_head(command),
|
|
1083
1130
|
action=command[:DECISION_LINE_MAX] or None,
|
|
1084
|
-
action_body=command
|
|
1131
|
+
action_body=cut_action_body(command) or None,
|
|
1085
1132
|
blocker=(
|
|
1086
1133
|
f"Hermes flagged this command as {request.pattern_key}"[:DECISION_LINE_MAX]
|
|
1087
1134
|
if request.pattern_key
|
|
@@ -1341,7 +1388,7 @@ def _await_decision(request, created, correlation_id: str, offered, uses_select:
|
|
|
1341
1388
|
return _decided(request, correlation_id, "deny", None)
|
|
1342
1389
|
` },
|
|
1343
1390
|
{ path: "cancellation.py", contents: 'from __future__ import annotations\n\nfrom typing import Literal, Mapping, Tuple\n\nCancellation = Literal[\n "withdrawn_by_this_call",\n "cancelled_unproven",\n "already_cancelled",\n "not_pending",\n "unreachable",\n]\n\nWITHDRAWN_BY_THIS_CALL: Cancellation = "withdrawn_by_this_call"\nCANCELLED_UNPROVEN: Cancellation = "cancelled_unproven"\nALREADY_CANCELLED: Cancellation = "already_cancelled"\nNOT_PENDING: Cancellation = "not_pending"\nUNREACHABLE: Cancellation = "unreachable"\nCANCELLATIONS: Tuple[Cancellation, ...] = (\n WITHDRAWN_BY_THIS_CALL,\n CANCELLED_UNPROVEN,\n ALREADY_CANCELLED,\n NOT_PENDING,\n UNREACHABLE,\n)\n\nUNAVAILABLE_STATUS = "unavailable"\nSTOP_HANDOFF = "stop"\n\n\ndef classify_cancellation(response: object) -> Cancellation:\n if not isinstance(response, Mapping):\n return UNREACHABLE\n fields: Mapping[object, object] = response\n cancelled = fields.get("cancelled")\n by_this_call = fields.get("cancelledByThisCall")\n if (\n not isinstance(cancelled, bool)\n or fields.get("status") == UNAVAILABLE_STATUS\n or fields.get("handoffAction") == STOP_HANDOFF\n or (by_this_call is not None and not isinstance(by_this_call, bool))\n or (by_this_call is True and not cancelled)\n ):\n return UNREACHABLE\n if not cancelled:\n return NOT_PENDING\n if by_this_call is None:\n return CANCELLED_UNPROVEN\n return WITHDRAWN_BY_THIS_CALL if by_this_call else ALREADY_CANCELLED\n' },
|
|
1344
|
-
{ path: "dashboard/manifest.json", contents: '{\n "name": "pushary",\n "label": "Pushary",\n "description": "Approvals Pushary is carrying to your phone, answerable from Hermes Desktop",\n "version": "1.0.
|
|
1391
|
+
{ path: "dashboard/manifest.json", contents: '{\n "name": "pushary",\n "label": "Pushary",\n "description": "Approvals Pushary is carrying to your phone, answerable from Hermes Desktop",\n "version": "1.0.9",\n "tab": { "hidden": true },\n "entry": "web.js",\n "api": "plugin_api.py"\n}\n' },
|
|
1345
1392
|
{ path: "dashboard/plugin_api.py", contents: `import importlib
|
|
1346
1393
|
import sys
|
|
1347
1394
|
import time
|
|
@@ -2253,7 +2300,7 @@ def record_plugin_load(approval_transport_registered, home=None, pid=None, now=N
|
|
|
2253
2300
|
logger.debug("[pushary] could not record the plugin load: %s", exc)
|
|
2254
2301
|
return None
|
|
2255
2302
|
` },
|
|
2256
|
-
{ path: "plugin.yaml", contents: 'name: pushary\nversion: 1.0.
|
|
2303
|
+
{ path: "plugin.yaml", contents: 'name: pushary\nversion: 1.0.9\ndescription: Push notifications and human-in-the-loop for Hermes Agent via Pushary\nauthor: RalphNex OU\nrequires_env:\n - name: PUSHARY_API_KEY\n description: Your Pushary API key\n url: https://pushary.com/sign-up?from=hermes\n secret: true\nconfig_schema:\n api_key:\n type: secret\n env: PUSHARY_API_KEY\n label: Pushary API key\n description: "Get one at pushary.com/sign-up?from=hermes"\n required: true\nprovides_tools:\n - pushary_remind\n - pushary_notify\n - pushary_ask\n - pushary_wait\n - pushary_cancel\n - pushary_propose_scope\n - pushary_enroll\n - pushary_ask_end_user\nprovides_hooks:\n - pre_llm_call\n - pre_tool_call\n - post_tool_call\n - on_session_start\n - on_session_end\n - on_session_finalize\n - post_approval_response\nprovides_approval_transports:\n - pushary\n' },
|
|
2257
2304
|
{ path: "README.md", contents: "# Pushary for Hermes\n\nAsk a question in Hermes and answer it on your phone. Try it with your own device before routing command approvals there.\n\n## Connect your phone\n\n1. [Set up your Pushary Agent account](https://pushary.com/sign-up?from=ai-coding&utm_source=hermes-plugin&utm_medium=quickstart&utm_campaign=first-question). Pair your phone with that account and get its API key from Agent settings.\n2. In your terminal, install the catalog plugin:\n\n ```sh\n hermes plugins install pushary\n ```\n\n3. Enter `PUSHARY_API_KEY` when Hermes prompts for it. If you missed the prompt, save the key in the plugin\u2019s settings in Hermes Desktop. Keep it out of chat. Start a new Hermes session (for a running gateway, use `hermes gateway restart`).\n\n## Try one question\n\nTell Hermes: **Use `pushary_ask` to ask me \u201CDid this test reach your phone?\u201D Report my answer and do nothing else.** Open the question on your paired phone and tap **Yes** or **No**. Hermes should report the answer you tapped.\n\nIf nothing arrives, check the account and notification permissions on your phone. A pending question is still live: wait for the same question rather than sending another. If Pushary hands it back to Hermes, answer the local prompt instead. No answer is not approval.\n\nCommand approvals are separate from this test. To route them to your phone, set `security.approval.transport` to `pushary`. Set `security.approval.transport_fallback` to `builtin` if you want Hermes\u2019s local prompt after a safe handoff; an unconfirmed withdrawal does not authorize the command. See the [plugin guide](https://github.com/Pushary/hermes-plugin-pushary#readme) for approval routing and what the plugin reads and sends.\n" },
|
|
2258
2305
|
{ path: "schemas.py", contents: `PUSHARY_REMIND = {
|
|
2259
2306
|
"name": "pushary_remind",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XNZRHX5Q.js";
|
|
4
4
|
import {
|
|
5
5
|
apiKeyInForce,
|
|
6
6
|
configFilePath,
|
|
7
7
|
keyPrefixToShow
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FVUPVLZT.js";
|
|
9
9
|
import {
|
|
10
10
|
backupFile,
|
|
11
11
|
backupFileInto,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
API_KEY_PREFIX_PATTERN,
|
|
18
18
|
isRecord,
|
|
19
19
|
isValidApiKey
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7KRQTNPA.js";
|
|
21
21
|
|
|
22
22
|
// src/shell-alias.ts
|
|
23
23
|
import { homedir } from "os";
|
|
@@ -4184,6 +4184,158 @@ var messageTextOf = (command, judge) => {
|
|
|
4184
4184
|
return EXPANSION_OR_SUBSTITUTION.test(withTextSpansSetAside(command, messageSpans)) ? NOT_ONLY_MESSAGE_STEPS : { kind: "read", messageSpans };
|
|
4185
4185
|
};
|
|
4186
4186
|
|
|
4187
|
+
// ../contracts/src/command-analysis/command-substitutions.ts
|
|
4188
|
+
var UNREADABLE4 = { kind: "unreadable" };
|
|
4189
|
+
var MAY_HOLD_A_SUBSTITUTION = /\$\(|`/;
|
|
4190
|
+
var SUBSTITUTION_OPENING = "$(";
|
|
4191
|
+
var BACKTICK2 = "`";
|
|
4192
|
+
var ESCAPE3 = "\\";
|
|
4193
|
+
var NEWLINE3 = "\n";
|
|
4194
|
+
var COMMENT_START3 = "#";
|
|
4195
|
+
var OPENING_PARENTHESIS = "(";
|
|
4196
|
+
var CLOSING_PARENTHESIS2 = ")";
|
|
4197
|
+
var REDIRECTION_START = "<";
|
|
4198
|
+
var ONE_PRINTED_WORD = "_";
|
|
4199
|
+
var DEEPEST_SUBSTITUTION_READ = 32;
|
|
4200
|
+
var OPENS_A_WORD_AFTER2 = /[\s;&|()]/;
|
|
4201
|
+
var HEREDOC_OPERATOR2 = /<<(?!<)-?[ \t]*([^\s;&|<>()]+)/y;
|
|
4202
|
+
var DELIMITER_QUOTING = /['"\\]/g;
|
|
4203
|
+
var opensASubstitutionAt2 = (text3, index) => text3.startsWith(SUBSTITUTION_OPENING, index) || text3.charAt(index) === BACKTICK2;
|
|
4204
|
+
var closingBacktickAt = (text3, from) => {
|
|
4205
|
+
for (let index = from; index < text3.length; index += 1) {
|
|
4206
|
+
const char = text3.charAt(index);
|
|
4207
|
+
if (char === ESCAPE3) index += 1;
|
|
4208
|
+
else if (char === BACKTICK2) return index;
|
|
4209
|
+
}
|
|
4210
|
+
return null;
|
|
4211
|
+
};
|
|
4212
|
+
var bodyOfTheSubstitution = (text3, start, end) => text3.slice(start + (text3.charAt(start) === BACKTICK2 ? BACKTICK2.length : SUBSTITUTION_OPENING.length), end);
|
|
4213
|
+
var heredocOperatorAt = (text3, index) => {
|
|
4214
|
+
if (text3.charAt(index - 1) === REDIRECTION_START) return null;
|
|
4215
|
+
HEREDOC_OPERATOR2.lastIndex = index;
|
|
4216
|
+
const match = HEREDOC_OPERATOR2.exec(text3);
|
|
4217
|
+
const written = match?.[1];
|
|
4218
|
+
if (match === null || written === void 0) return null;
|
|
4219
|
+
const delimiter = written.replace(DELIMITER_QUOTING, "");
|
|
4220
|
+
return { heredoc: { delimiter, expands: delimiter === written }, end: index + match[0].length };
|
|
4221
|
+
};
|
|
4222
|
+
var heredocBodyFrom = (text3, start, delimiter) => {
|
|
4223
|
+
for (let lineStart = start; lineStart < text3.length; ) {
|
|
4224
|
+
const newline = text3.indexOf(NEWLINE3, lineStart);
|
|
4225
|
+
const lineEnd = newline === -1 ? text3.length : newline;
|
|
4226
|
+
if (isHeredocTerminator(text3.slice(lineStart, lineEnd), delimiter)) {
|
|
4227
|
+
return { start, end: lineStart, after: newline === -1 ? text3.length : newline + 1 };
|
|
4228
|
+
}
|
|
4229
|
+
if (newline === -1) break;
|
|
4230
|
+
lineStart = newline + 1;
|
|
4231
|
+
}
|
|
4232
|
+
return { start, end: text3.length, after: text3.length };
|
|
4233
|
+
};
|
|
4234
|
+
var endOfTheSubstitutionAt = (text3, start, nesting) => {
|
|
4235
|
+
if (nesting >= DEEPEST_SUBSTITUTION_READ) return null;
|
|
4236
|
+
return text3.charAt(start) === BACKTICK2 ? closingBacktickAt(text3, start + BACKTICK2.length) : endOfShellText(text3, start + SUBSTITUTION_OPENING.length, true, nesting + 1, null);
|
|
4237
|
+
};
|
|
4238
|
+
var substitutionsOfAnExpandingHeredocBody = (text3, body, nesting, found) => {
|
|
4239
|
+
for (let index = body.start; index < body.end; index += 1) {
|
|
4240
|
+
if (text3.charAt(index) === ESCAPE3) {
|
|
4241
|
+
index += 1;
|
|
4242
|
+
continue;
|
|
4243
|
+
}
|
|
4244
|
+
if (!opensASubstitutionAt2(text3, index)) continue;
|
|
4245
|
+
const end = endOfTheSubstitutionAt(text3, index, nesting);
|
|
4246
|
+
if (end === null || end >= body.end) return false;
|
|
4247
|
+
found?.push({ start: index, end: end + 1, body: bodyOfTheSubstitution(text3, index, end) });
|
|
4248
|
+
index = end;
|
|
4249
|
+
}
|
|
4250
|
+
return true;
|
|
4251
|
+
};
|
|
4252
|
+
var endOfHeredocBodies = (text3, start, heredocs, nesting, found) => {
|
|
4253
|
+
let cursor = start;
|
|
4254
|
+
for (const { delimiter, expands } of heredocs) {
|
|
4255
|
+
const body = heredocBodyFrom(text3, cursor, delimiter);
|
|
4256
|
+
if (expands && !substitutionsOfAnExpandingHeredocBody(text3, body, nesting, found)) return null;
|
|
4257
|
+
cursor = body.after;
|
|
4258
|
+
}
|
|
4259
|
+
return cursor;
|
|
4260
|
+
};
|
|
4261
|
+
var endOfTheLineAt = (text3, index) => {
|
|
4262
|
+
const newline = text3.indexOf(NEWLINE3, index);
|
|
4263
|
+
return newline === -1 ? text3.length : newline;
|
|
4264
|
+
};
|
|
4265
|
+
var endOfShellText = (text3, from, closesOnAParenthesis, nesting, found) => {
|
|
4266
|
+
let quote = null;
|
|
4267
|
+
let depth = 0;
|
|
4268
|
+
let atWordStart = true;
|
|
4269
|
+
const pending = [];
|
|
4270
|
+
for (let index = from; index < text3.length; index += 1) {
|
|
4271
|
+
const char = text3.charAt(index);
|
|
4272
|
+
if (quote === "'") {
|
|
4273
|
+
if (char === "'") quote = null;
|
|
4274
|
+
continue;
|
|
4275
|
+
}
|
|
4276
|
+
if (char === ESCAPE3) {
|
|
4277
|
+
index += 1;
|
|
4278
|
+
atWordStart = false;
|
|
4279
|
+
continue;
|
|
4280
|
+
}
|
|
4281
|
+
if (opensASubstitutionAt2(text3, index)) {
|
|
4282
|
+
const end = endOfTheSubstitutionAt(text3, index, nesting);
|
|
4283
|
+
if (end === null) return null;
|
|
4284
|
+
found?.push({ start: index, end: end + 1, body: bodyOfTheSubstitution(text3, index, end) });
|
|
4285
|
+
index = end;
|
|
4286
|
+
atWordStart = false;
|
|
4287
|
+
continue;
|
|
4288
|
+
}
|
|
4289
|
+
if (quote === '"') {
|
|
4290
|
+
if (char === '"') quote = null;
|
|
4291
|
+
continue;
|
|
4292
|
+
}
|
|
4293
|
+
if (char === "'" || char === '"') {
|
|
4294
|
+
quote = char;
|
|
4295
|
+
atWordStart = false;
|
|
4296
|
+
continue;
|
|
4297
|
+
}
|
|
4298
|
+
if (char === COMMENT_START3 && atWordStart) {
|
|
4299
|
+
index = endOfTheLineAt(text3, index) - 1;
|
|
4300
|
+
continue;
|
|
4301
|
+
}
|
|
4302
|
+
const operator = char === REDIRECTION_START ? heredocOperatorAt(text3, index) : null;
|
|
4303
|
+
if (operator !== null) {
|
|
4304
|
+
pending.push(operator.heredoc);
|
|
4305
|
+
index = operator.end - 1;
|
|
4306
|
+
atWordStart = false;
|
|
4307
|
+
continue;
|
|
4308
|
+
}
|
|
4309
|
+
if (char === NEWLINE3 && pending.length > 0) {
|
|
4310
|
+
const after = endOfHeredocBodies(text3, index + 1, pending.splice(0), nesting, found);
|
|
4311
|
+
if (after === null) return null;
|
|
4312
|
+
index = after - 1;
|
|
4313
|
+
atWordStart = true;
|
|
4314
|
+
continue;
|
|
4315
|
+
}
|
|
4316
|
+
if (char === CLOSING_PARENTHESIS2 && depth === 0 && closesOnAParenthesis) return index;
|
|
4317
|
+
if (char === OPENING_PARENTHESIS) depth += 1;
|
|
4318
|
+
if (char === CLOSING_PARENTHESIS2) depth = Math.max(depth - 1, 0);
|
|
4319
|
+
atWordStart = OPENS_A_WORD_AFTER2.test(char);
|
|
4320
|
+
}
|
|
4321
|
+
return closesOnAParenthesis || quote !== null ? null : text3.length;
|
|
4322
|
+
};
|
|
4323
|
+
var withEachPrintingOneWord = (text3, substitutions) => {
|
|
4324
|
+
let reading = "";
|
|
4325
|
+
let copied = 0;
|
|
4326
|
+
for (const { start, end } of substitutions) {
|
|
4327
|
+
reading += text3.slice(copied, start) + ONE_PRINTED_WORD;
|
|
4328
|
+
copied = end;
|
|
4329
|
+
}
|
|
4330
|
+
return reading + text3.slice(copied);
|
|
4331
|
+
};
|
|
4332
|
+
var commandSubstitutionsOf = (command) => {
|
|
4333
|
+
if (!MAY_HOLD_A_SUBSTITUTION.test(command)) return { kind: "read", eachPrintingOneWord: command, bodies: [] };
|
|
4334
|
+
const found = [];
|
|
4335
|
+
if (endOfShellText(command, 0, false, 0, found) === null) return UNREADABLE4;
|
|
4336
|
+
return { kind: "read", eachPrintingOneWord: withEachPrintingOneWord(command, found), bodies: found.map((substitution) => substitution.body) };
|
|
4337
|
+
};
|
|
4338
|
+
|
|
4187
4339
|
// ../contracts/src/phone-call-setup.ts
|
|
4188
4340
|
var PHONE_CALL_SETUP_PATH = "/api/v1/server/calls";
|
|
4189
4341
|
var PHONE_CALL_SETUP_TEST_CALL_PARAM = "testCall";
|
|
@@ -7994,7 +8146,7 @@ var withoutShellGrouping = (segment) => {
|
|
|
7994
8146
|
while (closesAGroupItDidNotOpen(text3)) text3 = text3.slice(0, -1).trimEnd();
|
|
7995
8147
|
return text3;
|
|
7996
8148
|
};
|
|
7997
|
-
var
|
|
8149
|
+
var HEREDOC_OPERATOR3 = /(?<!<)\d*<<(?!<)-?[ \t]*(?:'([A-Za-z_]\w*)'|"([A-Za-z_]\w*)"|\\?([A-Za-z_]\w*))/g;
|
|
7998
8150
|
var HEREDOC_MARK = "\uE001";
|
|
7999
8151
|
var withHeredocBodiesSetAside = (command) => {
|
|
8000
8152
|
const lines = command.split("\n");
|
|
@@ -8002,8 +8154,8 @@ var withHeredocBodiesSetAside = (command) => {
|
|
|
8002
8154
|
const bodies = [];
|
|
8003
8155
|
for (let index = 0; index < lines.length; index += 1) {
|
|
8004
8156
|
const line = lines[index] ?? "";
|
|
8005
|
-
const delimiters = [...line.matchAll(
|
|
8006
|
-
kept.push(line.replace(
|
|
8157
|
+
const delimiters = [...line.matchAll(HEREDOC_OPERATOR3)].map((match) => match[1] ?? match[2] ?? match[3] ?? "");
|
|
8158
|
+
kept.push(line.replace(HEREDOC_OPERATOR3, ` ${HEREDOC_MARK} `));
|
|
8007
8159
|
for (const delimiter of delimiters) {
|
|
8008
8160
|
const body = [];
|
|
8009
8161
|
for (index += 1; index < lines.length && !mightEndAHeredoc(lines[index] ?? "", delimiter); index += 1) {
|
|
@@ -8309,7 +8461,18 @@ var parsedSpelledSegment = (segment) => {
|
|
|
8309
8461
|
return { text: text3, invocation: invocationOf(text3), heredocs: [], feedsASubstitution: false };
|
|
8310
8462
|
};
|
|
8311
8463
|
var roughSpelledSegment = ({ invocation, heredocs, feedsASubstitution }) => ({ text: verbatimInvocationText(invocation), invocation, heredocs, feedsASubstitution });
|
|
8312
|
-
var
|
|
8464
|
+
var shellCommandAfterTheBangOf = (setting) => {
|
|
8465
|
+
const separator = setting.indexOf(FLAG_VALUE_SEPARATOR);
|
|
8466
|
+
const value = setting.slice(separator + 1);
|
|
8467
|
+
return separator > 0 && GIT_SETTING_THAT_RUNS_A_COMMAND_AFTER_A_BANG.test(setting.slice(0, separator)) && RUNS_A_SHELL_COMMAND.test(value) ? [value.slice(1)] : [];
|
|
8468
|
+
};
|
|
8469
|
+
var shellCommandsOfOneCommandGitSettings = ({ program, args }) => {
|
|
8470
|
+
if (program === void 0 || basenameOf(program.text) !== GIT) return [];
|
|
8471
|
+
const globalOptions = args.slice(0, args.length - argsAfterGitGlobalOptions(args).length);
|
|
8472
|
+
return globalOptions.flatMap((option, index) => globalOptions[index - 1]?.text === GIT_ONE_COMMAND_SETTING_FLAG ? shellCommandAfterTheBangOf(option.text) : []);
|
|
8473
|
+
};
|
|
8474
|
+
var setsAOneCommandGitShellCommand = (invocation) => shellCommandsOfOneCommandGitSettings(invocation).length > 0;
|
|
8475
|
+
var segmentHidesWhatItRuns = (segment, innermost, scripts, programIsReadable) => programIsHidden(innermost) && !programIsReadable || scripts.kind === "hidden" || segment.feedsASubstitution && (passesAnInlineScript(innermost) || setsAOneCommandGitShellCommand(innermost));
|
|
8313
8476
|
var commandsNestedIn = (innermost, scripts) => [
|
|
8314
8477
|
...scripts.kind === "readable" ? scripts.scripts : [],
|
|
8315
8478
|
...commandsRunByFind(innermost).map(verbatimInvocationText)
|
|
@@ -8697,6 +8860,12 @@ var addSpelledForm = (accumulator, form) => {
|
|
|
8697
8860
|
var addSpelledForms = (accumulator, forms) => {
|
|
8698
8861
|
for (const form of forms) addSpelledForm(accumulator, form);
|
|
8699
8862
|
};
|
|
8863
|
+
var spellingHidesWhatItRuns = (command, depth, reach) => {
|
|
8864
|
+
const aside = { forms: [], hidesWhatItRuns: false, truncated: false };
|
|
8865
|
+
spellCommandInto(aside, command, depth, reach);
|
|
8866
|
+
return aside.hidesWhatItRuns || aside.truncated;
|
|
8867
|
+
};
|
|
8868
|
+
var aOneCommandGitShellCommandHidesWhatItRuns = (innermost, depth, reach) => shellCommandsOfOneCommandGitSettings(innermost).some((shellCommand) => spellingHidesWhatItRuns(shellCommand, depth + 1, reach));
|
|
8700
8869
|
var spellCommandInto = (accumulator, command, depth, reach) => {
|
|
8701
8870
|
if (depth > MAX_SPELLING_DEPTH) {
|
|
8702
8871
|
accumulator.hidesWhatItRuns = true;
|
|
@@ -8718,7 +8887,7 @@ var spellCommandInto = (accumulator, command, depth, reach) => {
|
|
|
8718
8887
|
const programIsReadable = depth === 0 && index === 0 && commandStartsWithProgramUnderHomeOrPwd(command, segment.invocation, innermost);
|
|
8719
8888
|
addSpelledForm(accumulator, segment.text);
|
|
8720
8889
|
addSpelledForms(accumulator, spellingsOfAnInvocation(segment.invocation, innermost));
|
|
8721
|
-
accumulator.hidesWhatItRuns ||= segmentHidesWhatItRuns(segment, innermost, scripts, programIsReadable);
|
|
8890
|
+
accumulator.hidesWhatItRuns ||= segmentHidesWhatItRuns(segment, innermost, scripts, programIsReadable) || aOneCommandGitShellCommandHidesWhatItRuns(innermost, depth, reach);
|
|
8722
8891
|
for (const nested of commandsNestedIn(innermost, scripts)) spellNested(nested);
|
|
8723
8892
|
const ranOnBehalf = readsCommandRunners(reach) ? runnerReadingOf(innermost) : NO_INLINE_SCRIPT;
|
|
8724
8893
|
accumulator.hidesWhatItRuns ||= ranOnBehalf.kind === "hidden" || readsCommandRunners(reach) && runnerRunsWhatASubstitutionPrints(segment, innermost);
|
|
@@ -8742,14 +8911,35 @@ var commandSpellings = (command, reach) => {
|
|
|
8742
8911
|
var passesItsInputToSomethingThatCanAct = (segment) => segment.readsInput && !isSafeReadOnlyCommand(verbatimInvocationText(segment.invocation));
|
|
8743
8912
|
var feedsTextToSomethingThatCanAct = (command) => roughSegmentsOf(command).some(passesItsInputToSomethingThatCanAct);
|
|
8744
8913
|
var NOT_READ_IN_FULL = { kind: "not_read_in_full" };
|
|
8745
|
-
var
|
|
8914
|
+
var NOTHING_FURTHER_TO_READ = { kind: "read", readings: [] };
|
|
8915
|
+
var MOST_SUBSTITUTIONS_READ_ON_THEIR_OWN = 32;
|
|
8916
|
+
var readingsOfEach = (commands, depth) => {
|
|
8917
|
+
const readings = [];
|
|
8918
|
+
for (const command of commands) {
|
|
8919
|
+
const reading = readingsThatCanActAt(command, depth);
|
|
8920
|
+
if (reading.kind === "not_read_in_full") return NOT_READ_IN_FULL;
|
|
8921
|
+
readings.push(...reading.readings);
|
|
8922
|
+
}
|
|
8923
|
+
return { kind: "read", readings };
|
|
8924
|
+
};
|
|
8925
|
+
var readingsAroundCommandSubstitutions = (command, depth) => {
|
|
8926
|
+
if (depth >= MAX_SPELLING_DEPTH) return NOTHING_FURTHER_TO_READ;
|
|
8927
|
+
const substitutions = commandSubstitutionsOf(withHeredocSubstitutionsAsQuotedText(command));
|
|
8928
|
+
if (substitutions.kind === "unreadable" || substitutions.bodies.length === 0) return NOTHING_FURTHER_TO_READ;
|
|
8929
|
+
const bodiesReadOnTheirOwn = substitutions.bodies.slice(0, MOST_SUBSTITUTIONS_READ_ON_THEIR_OWN);
|
|
8930
|
+
return readingsOfEach([substitutions.eachPrintingOneWord, ...bodiesReadOnTheirOwn], depth + 1);
|
|
8931
|
+
};
|
|
8932
|
+
var readingsThatCanActAt = (command, depth) => {
|
|
8746
8933
|
const spellings = commandSpellings(command, SPELLS_COMMAND_RUNNERS_TOO);
|
|
8747
8934
|
if (!spellingsAreComplete(spellings)) return NOT_READ_IN_FULL;
|
|
8935
|
+
const around = readingsAroundCommandSubstitutions(command, depth);
|
|
8936
|
+
if (around.kind === "not_read_in_full") return NOT_READ_IN_FULL;
|
|
8748
8937
|
const readsTheWholeCommand = feedsTextToSomethingThatCanAct(command) || spellings.forms.some(setsMessageTextAside);
|
|
8749
|
-
|
|
8938
|
+
const own = readsTheWholeCommand ? [command, ...spellings.forms] : spellings.forms;
|
|
8939
|
+
return { kind: "read", readings: [...own, ...around.readings] };
|
|
8750
8940
|
};
|
|
8751
8941
|
var aReadingIsDestructive = (toolName, command) => {
|
|
8752
|
-
const readings =
|
|
8942
|
+
const readings = readingsThatCanActAt(command, 0);
|
|
8753
8943
|
return readings.kind === "not_read_in_full" || readings.readings.some((reading) => classifyDecisionRisk(toolNameForAPosixReading(toolName), reading) === "destructive");
|
|
8754
8944
|
};
|
|
8755
8945
|
var withoutSessionToolGrants = (config) => ({
|
|
@@ -9315,7 +9505,7 @@ var DESTRUCTIVE_ACTION_RISK_PATTERNS = [
|
|
|
9315
9505
|
{ pattern: new RegExp(String.raw`${gitCallOf("clean")}${textBeforeTheNextCall(COMMAND_RUN, gitCallAfterItsG("clean"))}\s(?:${gitLongOptionOrAnAbbreviation("force", 1)}|-[a-z]*f)`, "i"), reason: RISK_REASON.deletesUntrackedFiles },
|
|
9316
9506
|
{ pattern: new RegExp(String.raw`\bgit${ANY_GIT_GLOBAL_OPTIONS}\s+branch\b${sameCommandBeforeAnother("git")}\s-[a-zA-Z]*D`), reason: RISK_REASON.deletesABranch },
|
|
9317
9507
|
{ pattern: new RegExp(String.raw`\bgit${ANY_GIT_GLOBAL_OPTIONS}\s+branch\b(?=${sameCommandBeforeAnother("git")}\s(?:--delete|-[a-z]*d[a-z]*)\b)(?=${sameCommandBeforeAnother("git")}\s(?:--force|-[a-z]*f[a-z]*)\b)`), reason: RISK_REASON.deletesABranch },
|
|
9318
|
-
{ pattern: new RegExp(String.raw`\bgit${ANY_GIT_GLOBAL_OPTIONS}\s+push\b${sameCommandBeforeAnother("git")}\s(?:--delete\b|-d\b|:[^\s:])`), reason: RISK_REASON.deletesABranch },
|
|
9508
|
+
{ pattern: new RegExp(String.raw`\bgit${ANY_GIT_GLOBAL_OPTIONS}\s+push\b${sameCommandBeforeAnother("git")}\s(?:--delete\b|-d\b|:[^\s:]|${gitLongOptionOrAnAbbreviation("prune", 3)})`), reason: RISK_REASON.deletesABranch },
|
|
9319
9509
|
{ pattern: /\bdrop\s+(table|database|schema)\b/i, reason: RISK_REASON.dropsATableOrDatabase },
|
|
9320
9510
|
{ pattern: /\bdelete\s+from\b/i, reason: RISK_REASON.deletesRows },
|
|
9321
9511
|
{ pattern: /\btruncate\b/i, reason: RISK_REASON.truncates },
|