privateer-agent 0.15.4 → 0.15.6
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/README.md +11 -0
- package/bin/boot-bundle.d.mts +2 -0
- package/bin/boot-bundle.mjs +44 -0
- package/bin/fresh-supervisor.d.mts +5 -1
- package/bin/fresh-supervisor.mjs +47 -10
- package/bin/privateer-launch.mjs +27 -3
- package/bin/privateer-subagent.mjs +5 -2
- package/bin/privateer-verify.mjs +12 -0
- package/bin/session-recovery.d.mts +53 -0
- package/bin/session-recovery.mjs +240 -0
- package/bin/session-seal-preload.mjs +17 -0
- package/bin/session-seal.d.mts +25 -0
- package/bin/session-seal.mjs +242 -0
- package/dist-boot/boot.mjs +3 -0
- package/dist-boot/c-27JKSMWL.mjs +1460 -0
- package/dist-boot/c-2BMRFV24.mjs +269 -0
- package/dist-boot/c-2CTF6JA3.mjs +166 -0
- package/dist-boot/c-2G3BBHRJ.mjs +84 -0
- package/dist-boot/c-2IDLKXX6.mjs +250 -0
- package/dist-boot/c-2NJD5VYM.mjs +8 -0
- package/dist-boot/c-2S5EEQPW.mjs +1602 -0
- package/dist-boot/c-2WRDCUVI.mjs +25 -0
- package/dist-boot/c-2YN3M256.mjs +14 -0
- package/dist-boot/c-37GM3GMU.mjs +187 -0
- package/dist-boot/c-3STKRSVO.mjs +2480 -0
- package/dist-boot/c-3TPV6TQQ.mjs +2320 -0
- package/dist-boot/c-3UVHLQDJ.mjs +225 -0
- package/dist-boot/c-42PUUZYC.mjs +697 -0
- package/dist-boot/c-4D5UMWVW.mjs +683 -0
- package/dist-boot/c-4ETZRMTA.mjs +46 -0
- package/dist-boot/c-4QT25BD5.mjs +1482 -0
- package/dist-boot/c-4WVR32AP.mjs +2579 -0
- package/dist-boot/c-5EMM567G.mjs +152 -0
- package/dist-boot/c-5FA4CV63.mjs +145 -0
- package/dist-boot/c-5GV3X3RB.mjs +14 -0
- package/dist-boot/c-5JCEPRIY.mjs +52 -0
- package/dist-boot/c-5NDKIIWT.mjs +16 -0
- package/dist-boot/c-5QL3AR26.mjs +4665 -0
- package/dist-boot/c-5XY6MFKN.mjs +5142 -0
- package/dist-boot/c-65UZIZC7.mjs +2897 -0
- package/dist-boot/c-6FUXKHOK.mjs +1969 -0
- package/dist-boot/c-6JHWQE4V.mjs +18242 -0
- package/dist-boot/c-6LOBR4I6.mjs +5280 -0
- package/dist-boot/c-6QHOZXKQ.mjs +14394 -0
- package/dist-boot/c-6ZO2SADQ.mjs +178 -0
- package/dist-boot/c-6ZORVVZP.mjs +1449 -0
- package/dist-boot/c-76QH4UCP.mjs +2441 -0
- package/dist-boot/c-77GO5L5Y.mjs +20982 -0
- package/dist-boot/c-7M23XFTN.mjs +5052 -0
- package/dist-boot/c-7TC367E2.mjs +32 -0
- package/dist-boot/c-7UOG7POX.mjs +1524 -0
- package/dist-boot/c-7VHP3FLN.mjs +376 -0
- package/dist-boot/c-A73JHZP2.mjs +13207 -0
- package/dist-boot/c-ABXULAFL.mjs +71 -0
- package/dist-boot/c-ANDD2AQO.mjs +74 -0
- package/dist-boot/c-AOY77AZL.mjs +1430 -0
- package/dist-boot/c-AXEPZ22I.mjs +108 -0
- package/dist-boot/c-B2Y7VNHU.mjs +427 -0
- package/dist-boot/c-B7VJUH73.mjs +77 -0
- package/dist-boot/c-BFW6CDVL.mjs +24 -0
- package/dist-boot/c-BHNIF2AR.mjs +188 -0
- package/dist-boot/c-BKF2O6BL.mjs +23 -0
- package/dist-boot/c-BOZXFTZN.mjs +8 -0
- package/dist-boot/c-BRNYJWZL.mjs +28 -0
- package/dist-boot/c-C3N4Z2HO.mjs +93 -0
- package/dist-boot/c-C4IV7ZFG.mjs +717 -0
- package/dist-boot/c-C5NK6UYV.mjs +793 -0
- package/dist-boot/c-C67644MB.mjs +1659 -0
- package/dist-boot/c-C6S2YB53.mjs +620 -0
- package/dist-boot/c-CDBEJSBF.mjs +37 -0
- package/dist-boot/c-CG47HBKU.mjs +435 -0
- package/dist-boot/c-CKCTWCT5.mjs +51 -0
- package/dist-boot/c-CN77DCGF.mjs +60 -0
- package/dist-boot/c-CRBXNKFO.mjs +1795 -0
- package/dist-boot/c-CRIHASQ6.mjs +973 -0
- package/dist-boot/c-CU4NGAUO.mjs +3786 -0
- package/dist-boot/c-CWRFLGQU.mjs +1883 -0
- package/dist-boot/c-CYQB2USO.mjs +32 -0
- package/dist-boot/c-DEE67DJO.mjs +379 -0
- package/dist-boot/c-DIFDBYOP.mjs +1258 -0
- package/dist-boot/c-DOSGVXDZ.mjs +34879 -0
- package/dist-boot/c-DR7XQI32.mjs +381 -0
- package/dist-boot/c-DTGPSB46.mjs +14666 -0
- package/dist-boot/c-DTHDNA4P.mjs +320 -0
- package/dist-boot/c-E4Z3Y5B5.mjs +3864 -0
- package/dist-boot/c-E66Z2TI7.mjs +203 -0
- package/dist-boot/c-EBU6RLRV.mjs +1527 -0
- package/dist-boot/c-EBZZNGSF.mjs +432 -0
- package/dist-boot/c-EC3LJ2KF.mjs +1032 -0
- package/dist-boot/c-EQBKXWNX.mjs +15829 -0
- package/dist-boot/c-EUEPIW4S.mjs +574 -0
- package/dist-boot/c-EX4YVWAT.mjs +378 -0
- package/dist-boot/c-EYZGSAJU.mjs +98 -0
- package/dist-boot/c-F75VRKY4.mjs +172 -0
- package/dist-boot/c-FH4NXKHV.mjs +177 -0
- package/dist-boot/c-FHNUCTEM.mjs +140 -0
- package/dist-boot/c-FJ5T42DS.mjs +5349 -0
- package/dist-boot/c-FPCNRL7G.mjs +1728 -0
- package/dist-boot/c-G4DLN7Q4.mjs +8 -0
- package/dist-boot/c-G56GYQFZ.mjs +2507 -0
- package/dist-boot/c-GLIOERDQ.mjs +1200 -0
- package/dist-boot/c-GMJ5HUBM.mjs +14 -0
- package/dist-boot/c-H3HSGMAQ.mjs +461 -0
- package/dist-boot/c-HIKTO6P7.mjs +275 -0
- package/dist-boot/c-I2MCJ34O.mjs +464 -0
- package/dist-boot/c-I3C6LBW4.mjs +765 -0
- package/dist-boot/c-I54OKQHW.mjs +387 -0
- package/dist-boot/c-IFSP3R4D.mjs +80 -0
- package/dist-boot/c-IZK77VB7.mjs +171 -0
- package/dist-boot/c-J3Y25UGE.mjs +54 -0
- package/dist-boot/c-J5IESS7W.mjs +27750 -0
- package/dist-boot/c-JJWZBY7L.mjs +254 -0
- package/dist-boot/c-JKTFXTGF.mjs +463 -0
- package/dist-boot/c-JN57AXQ4.mjs +77 -0
- package/dist-boot/c-KFIO6LUW.mjs +1096 -0
- package/dist-boot/c-KIEMEFWW.mjs +478 -0
- package/dist-boot/c-KIVXWBYD.mjs +28 -0
- package/dist-boot/c-KP6CRIP4.mjs +580 -0
- package/dist-boot/c-L26VOJX4.mjs +11558 -0
- package/dist-boot/c-L5GHWG5G.mjs +5988 -0
- package/dist-boot/c-M7NSQAKK.mjs +353 -0
- package/dist-boot/c-MCEWOPBW.mjs +56 -0
- package/dist-boot/c-MGPIEG7I.mjs +20 -0
- package/dist-boot/c-NREXJV3M.mjs +393 -0
- package/dist-boot/c-O5PP6CTX.mjs +162 -0
- package/dist-boot/c-OBQDHSXM.mjs +1774 -0
- package/dist-boot/c-OLQHHDD4.mjs +21 -0
- package/dist-boot/c-OXW4JQQH.mjs +319 -0
- package/dist-boot/c-P3D7ZUWN.mjs +1288 -0
- package/dist-boot/c-P4PQZVV5.mjs +948 -0
- package/dist-boot/c-P63T3XL2.mjs +26373 -0
- package/dist-boot/c-P6N5DQGZ.mjs +194 -0
- package/dist-boot/c-P7MLKQFC.mjs +58 -0
- package/dist-boot/c-PB3PZJL5.mjs +1276 -0
- package/dist-boot/c-PTN4S6G2.mjs +1259 -0
- package/dist-boot/c-PYCE5J7U.mjs +1083 -0
- package/dist-boot/c-Q4HYCRLB.mjs +19410 -0
- package/dist-boot/c-QUXMETGG.mjs +68 -0
- package/dist-boot/c-RDMJZCOX.mjs +356 -0
- package/dist-boot/c-ROGJK76M.mjs +17 -0
- package/dist-boot/c-RQJJ26T4.mjs +708 -0
- package/dist-boot/c-RSKCUPJF.mjs +7559 -0
- package/dist-boot/c-RVJU4O6P.mjs +37 -0
- package/dist-boot/c-S2RVHR3M.mjs +165 -0
- package/dist-boot/c-SKMK3PEE.mjs +91120 -0
- package/dist-boot/c-TI7SM4EG.mjs +20 -0
- package/dist-boot/c-TILJ6GXD.mjs +1235 -0
- package/dist-boot/c-TT6BCUJD.mjs +114 -0
- package/dist-boot/c-U4ITOXAN.mjs +2107 -0
- package/dist-boot/c-UGERXVO2.mjs +7120 -0
- package/dist-boot/c-UPBH5AXY.mjs +1363 -0
- package/dist-boot/c-US2PUNZL.mjs +597 -0
- package/dist-boot/c-UU4WZPPE.mjs +20 -0
- package/dist-boot/c-UWVIYPQS.mjs +39 -0
- package/dist-boot/c-V4RHQBPQ.mjs +17683 -0
- package/dist-boot/c-V5MRVK47.mjs +351 -0
- package/dist-boot/c-V6CL266R.mjs +1755 -0
- package/dist-boot/c-VJTMFKYE.mjs +14975 -0
- package/dist-boot/c-VJTRUKIB.mjs +773 -0
- package/dist-boot/c-W4IFSHPW.mjs +43 -0
- package/dist-boot/c-WETGB2CF.mjs +113 -0
- package/dist-boot/c-WO3QSZUU.mjs +1337 -0
- package/dist-boot/c-WQLH73TY.mjs +242 -0
- package/dist-boot/c-XL735JW5.mjs +500 -0
- package/dist-boot/c-Y7HADL5B.mjs +1107 -0
- package/dist-boot/c-YGQHSVSK.mjs +41 -0
- package/dist-boot/c-YMP2AMEB.mjs +10350 -0
- package/dist-boot/c-YRDO2WEF.mjs +12012 -0
- package/dist-boot/c-YUSTRATJ.mjs +8 -0
- package/dist-boot/c-Z2262R22.mjs +2697 -0
- package/dist-boot/c-Z4ALQMJC.mjs +709 -0
- package/dist-boot/c-Z5ZUQVUY.mjs +62 -0
- package/dist-boot/c-ZDZUKXF7.mjs +874 -0
- package/dist-boot/c-ZJYLGIC3.mjs +32 -0
- package/dist-boot/c-ZNA5CDMI.mjs +77 -0
- package/dist-boot/c-ZSO6DI3M.mjs +204 -0
- package/dist-boot/c-ZWUVHKMK.mjs +100 -0
- package/dist-boot/c-ZY4MESEW.mjs +832 -0
- package/dist-boot/c-ZZ5REI4L.mjs +329 -0
- package/dist-boot/cli.mjs +51 -0
- package/dist-boot/ext-anthropic-attribution.mjs +207 -0
- package/dist-boot/ext-pi-background-tasks.mjs +7234 -0
- package/dist-boot/ext-pi-subagents.mjs +37 -0
- package/dist-boot/ext-privateer-account.mjs +4426 -0
- package/dist-boot/ext-privateer-brand.mjs +5274 -0
- package/dist-boot/ext-privateer-codemode.mjs +37 -0
- package/dist-boot/ext-privateer-computer.mjs +626 -0
- package/dist-boot/ext-privateer-connect.mjs +1862 -0
- package/dist-boot/ext-privateer-context.mjs +323 -0
- package/dist-boot/ext-privateer-desktop.mjs +92 -0
- package/dist-boot/ext-privateer-final-audit.mjs +48 -0
- package/dist-boot/ext-privateer-fresh.mjs +81 -0
- package/dist-boot/ext-privateer-gate.mjs +5959 -0
- package/dist-boot/ext-privateer-hints.mjs +236 -0
- package/dist-boot/ext-privateer-media.mjs +2626 -0
- package/dist-boot/ext-privateer-models.mjs +3397 -0
- package/dist-boot/ext-privateer-posture.mjs +3006 -0
- package/dist-boot/ext-privateer-privacy.mjs +4578 -0
- package/dist-boot/ext-privateer-recovery.mjs +287 -0
- package/dist-boot/ext-privateer-speak.mjs +4754 -0
- package/dist-boot/ext-privateer-terminals.mjs +725 -0
- package/dist-boot/ext-privateer-tools.mjs +528 -0
- package/dist-boot/ext-privateer-truncation.mjs +74 -0
- package/dist-boot/ext-privateer-update.mjs +210 -0
- package/dist-boot/ext-privateer-vision.mjs +148 -0
- package/dist-boot/ext-privateer-web.mjs +543 -0
- package/dist-boot/ext-rpiv-ask-user-question.mjs +710 -0
- package/dist-boot/manifest.json +9 -0
- package/extensions/privateer-brand.ts +3 -1
- package/extensions/privateer-context.ts +4 -2
- package/extensions/privateer-final-audit.ts +17 -0
- package/extensions/privateer-gate.ts +55 -9
- package/extensions/privateer-recovery.ts +175 -0
- package/extensions/privateer-web.ts +4 -4
- package/package.json +3 -1
- package/patches/@earendil-works+pi-coding-agent+1.3.0.patch +199 -2
- package/patches/pi-background-tasks+2.6.10.patch +91 -7
- package/src/cli/chat.ts +7 -1
- package/src/config/moatManifest.json +2 -0
- package/src/config/whatsNew.json +4 -4
- package/src/context.ts +33 -5
- package/src/engine/finalAudit.ts +38 -0
- package/src/engine/stallWatchdog.ts +8 -1
- package/src/providers/account.ts +34 -3
- package/src/remote/attentionPush.ts +40 -0
- package/src/remote/liveTaskSession.ts +7 -1
- package/src/remote/relayClient.ts +38 -4
- package/src/remote/remoteBridge.ts +17 -0
- package/src/remote/transcriptSnapshot.ts +104 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import{createRequire as __pvCR}from"node:module";import{fileURLToPath as __pvF}from"node:url";import{dirname as __pvD}from"node:path";const require=__pvCR(import.meta.url);const __pvUrl=(r)=>new URL(r,import.meta.url).href;const __pvFile=(r)=>__pvF(new URL(r,import.meta.url));
|
|
2
|
+
import {
|
|
3
|
+
CODE_ONLY_OPTIONS,
|
|
4
|
+
DEFAULT_ALLOW,
|
|
5
|
+
DEFAULT_BADGE_SINKS,
|
|
6
|
+
NEARAI_BASE_URL,
|
|
7
|
+
PII_COMMAND_WORDS,
|
|
8
|
+
PRIVACY_PROVIDERS,
|
|
9
|
+
PROVIDER_BY_ID,
|
|
10
|
+
SECRET_TYPES,
|
|
11
|
+
TIERS,
|
|
12
|
+
TINFOIL_BASE_URL,
|
|
13
|
+
UNNAMED_HOST,
|
|
14
|
+
assessDowngrade,
|
|
15
|
+
assessToolCall,
|
|
16
|
+
capabilityTier,
|
|
17
|
+
capturedHosts,
|
|
18
|
+
clampProjectConfig,
|
|
19
|
+
classifyTool,
|
|
20
|
+
compileAllow,
|
|
21
|
+
createLedger,
|
|
22
|
+
detectPii,
|
|
23
|
+
dispatcherTransport,
|
|
24
|
+
downgradeWarning,
|
|
25
|
+
effectiveTier,
|
|
26
|
+
exposureLevel,
|
|
27
|
+
extension_default,
|
|
28
|
+
fetchAttestation,
|
|
29
|
+
fetchTinfoilAttestation,
|
|
30
|
+
firstRemoteUrl,
|
|
31
|
+
getCapturedCert,
|
|
32
|
+
hasPii,
|
|
33
|
+
hasSecrets,
|
|
34
|
+
hostOf,
|
|
35
|
+
httpsTransport,
|
|
36
|
+
installAttestationDispatcher,
|
|
37
|
+
interpretReport,
|
|
38
|
+
interpretTinfoilDoc,
|
|
39
|
+
isLocalEndpoint,
|
|
40
|
+
isRepoSupplied,
|
|
41
|
+
ledgerHosts,
|
|
42
|
+
ledgerReport,
|
|
43
|
+
loadConfig,
|
|
44
|
+
makePiPrivacyExtension,
|
|
45
|
+
maskPii,
|
|
46
|
+
mergePiiBaseline,
|
|
47
|
+
nearApiKey,
|
|
48
|
+
newPii,
|
|
49
|
+
observationLine,
|
|
50
|
+
openRouterZdrPatch,
|
|
51
|
+
optionsFromEnv,
|
|
52
|
+
parsePiiCommand,
|
|
53
|
+
payloadText,
|
|
54
|
+
pickerEntry,
|
|
55
|
+
pickerOptionLabel,
|
|
56
|
+
piiDetail,
|
|
57
|
+
piiInline,
|
|
58
|
+
postureBadge,
|
|
59
|
+
providerConfig,
|
|
60
|
+
randomNonce,
|
|
61
|
+
rankModels,
|
|
62
|
+
rankSurface,
|
|
63
|
+
recordEgress,
|
|
64
|
+
redactPayloadPii,
|
|
65
|
+
redactPii,
|
|
66
|
+
redactToolResultContent,
|
|
67
|
+
registerable,
|
|
68
|
+
renderBadgeTo,
|
|
69
|
+
runPiiCommand,
|
|
70
|
+
sanitizeConfig,
|
|
71
|
+
scanPii,
|
|
72
|
+
secretHits,
|
|
73
|
+
sensitiveFileRefs,
|
|
74
|
+
splitCommands,
|
|
75
|
+
summarizePii,
|
|
76
|
+
summarizeSurface,
|
|
77
|
+
surfaceLine,
|
|
78
|
+
surfaceReport,
|
|
79
|
+
teePosture,
|
|
80
|
+
tierFromTeePosture,
|
|
81
|
+
tierRank,
|
|
82
|
+
tinfoilTeePosture,
|
|
83
|
+
toolProvenance,
|
|
84
|
+
toolReach,
|
|
85
|
+
toolResultText,
|
|
86
|
+
veniceRequestPatch,
|
|
87
|
+
verifyModelPosture
|
|
88
|
+
} from "./c-76QH4UCP.mjs";
|
|
89
|
+
import "./c-P63T3XL2.mjs";
|
|
90
|
+
import "./c-CN77DCGF.mjs";
|
|
91
|
+
export {
|
|
92
|
+
CODE_ONLY_OPTIONS,
|
|
93
|
+
DEFAULT_ALLOW,
|
|
94
|
+
DEFAULT_BADGE_SINKS,
|
|
95
|
+
NEARAI_BASE_URL,
|
|
96
|
+
PII_COMMAND_WORDS,
|
|
97
|
+
PRIVACY_PROVIDERS,
|
|
98
|
+
PROVIDER_BY_ID,
|
|
99
|
+
SECRET_TYPES,
|
|
100
|
+
TIERS,
|
|
101
|
+
TINFOIL_BASE_URL,
|
|
102
|
+
UNNAMED_HOST,
|
|
103
|
+
assessDowngrade,
|
|
104
|
+
assessToolCall,
|
|
105
|
+
capabilityTier,
|
|
106
|
+
capturedHosts,
|
|
107
|
+
clampProjectConfig,
|
|
108
|
+
classifyTool,
|
|
109
|
+
compileAllow,
|
|
110
|
+
createLedger,
|
|
111
|
+
detectPii,
|
|
112
|
+
dispatcherTransport,
|
|
113
|
+
downgradeWarning,
|
|
114
|
+
effectiveTier,
|
|
115
|
+
exposureLevel,
|
|
116
|
+
fetchAttestation,
|
|
117
|
+
fetchTinfoilAttestation,
|
|
118
|
+
firstRemoteUrl,
|
|
119
|
+
getCapturedCert,
|
|
120
|
+
hasPii,
|
|
121
|
+
hasSecrets,
|
|
122
|
+
hostOf,
|
|
123
|
+
httpsTransport,
|
|
124
|
+
installAttestationDispatcher,
|
|
125
|
+
interpretReport,
|
|
126
|
+
interpretTinfoilDoc,
|
|
127
|
+
isLocalEndpoint,
|
|
128
|
+
isRepoSupplied,
|
|
129
|
+
ledgerHosts,
|
|
130
|
+
ledgerReport,
|
|
131
|
+
loadConfig,
|
|
132
|
+
makePiPrivacyExtension,
|
|
133
|
+
maskPii,
|
|
134
|
+
mergePiiBaseline,
|
|
135
|
+
nearApiKey,
|
|
136
|
+
newPii,
|
|
137
|
+
observationLine,
|
|
138
|
+
openRouterZdrPatch,
|
|
139
|
+
optionsFromEnv,
|
|
140
|
+
parsePiiCommand,
|
|
141
|
+
payloadText,
|
|
142
|
+
extension_default as piPrivacyExtension,
|
|
143
|
+
pickerEntry,
|
|
144
|
+
pickerOptionLabel,
|
|
145
|
+
piiDetail,
|
|
146
|
+
piiInline,
|
|
147
|
+
postureBadge,
|
|
148
|
+
providerConfig,
|
|
149
|
+
randomNonce,
|
|
150
|
+
rankModels,
|
|
151
|
+
rankSurface,
|
|
152
|
+
recordEgress,
|
|
153
|
+
redactPayloadPii,
|
|
154
|
+
redactPii,
|
|
155
|
+
redactToolResultContent,
|
|
156
|
+
registerable,
|
|
157
|
+
renderBadgeTo,
|
|
158
|
+
runPiiCommand,
|
|
159
|
+
sanitizeConfig,
|
|
160
|
+
scanPii,
|
|
161
|
+
secretHits,
|
|
162
|
+
sensitiveFileRefs,
|
|
163
|
+
splitCommands,
|
|
164
|
+
summarizePii,
|
|
165
|
+
summarizeSurface,
|
|
166
|
+
surfaceLine,
|
|
167
|
+
surfaceReport,
|
|
168
|
+
teePosture,
|
|
169
|
+
tierFromTeePosture,
|
|
170
|
+
tierRank,
|
|
171
|
+
tinfoilTeePosture,
|
|
172
|
+
toolProvenance,
|
|
173
|
+
toolReach,
|
|
174
|
+
toolResultText,
|
|
175
|
+
veniceRequestPatch,
|
|
176
|
+
verifyModelPosture
|
|
177
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import{createRequire as __pvCR}from"node:module";import{fileURLToPath as __pvF}from"node:url";import{dirname as __pvD}from"node:path";const require=__pvCR(import.meta.url);const __pvUrl=(r)=>new URL(r,import.meta.url).href;const __pvFile=(r)=>__pvF(new URL(r,import.meta.url));
|
|
2
|
+
import {
|
|
3
|
+
__name
|
|
4
|
+
} from "./c-CN77DCGF.mjs";
|
|
5
|
+
|
|
6
|
+
// node_modules/tinfoil/dist/user-cache-secret-store.js
|
|
7
|
+
import { closeSync, constants, fstatSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
var USER_CACHE_SECRET_DIR_NAME = ".tinfoil";
|
|
12
|
+
var USER_CACHE_SECRET_FILE_NAME = "user_cache_secret";
|
|
13
|
+
var HAS_POSIX_PERMISSIONS = process.platform !== "win32";
|
|
14
|
+
function posixReadFlags() {
|
|
15
|
+
return constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK;
|
|
16
|
+
}
|
|
17
|
+
__name(posixReadFlags, "posixReadFlags");
|
|
18
|
+
function trimPersistenceWhitespace(value) {
|
|
19
|
+
return value.replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$", "gu"), "");
|
|
20
|
+
}
|
|
21
|
+
__name(trimPersistenceWhitespace, "trimPersistenceWhitespace");
|
|
22
|
+
function isExpectedWindowsPath(path, expectedType) {
|
|
23
|
+
try {
|
|
24
|
+
const stats = lstatSync(path);
|
|
25
|
+
if (stats.isSymbolicLink()) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return expectedType === "directory" ? stats.isDirectory() : stats.isFile();
|
|
29
|
+
} catch (err) {
|
|
30
|
+
return err?.code === "ENOENT" ? void 0 : false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
__name(isExpectedWindowsPath, "isExpectedWindowsPath");
|
|
34
|
+
function readSecretFile(path) {
|
|
35
|
+
let fd;
|
|
36
|
+
try {
|
|
37
|
+
if (!HAS_POSIX_PERMISSIONS) {
|
|
38
|
+
const pathState = isExpectedWindowsPath(path, "file");
|
|
39
|
+
if (pathState !== true) {
|
|
40
|
+
return pathState === void 0 ? void 0 : null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
fd = openSync(path, HAS_POSIX_PERMISSIONS ? posixReadFlags() : "r");
|
|
44
|
+
if (HAS_POSIX_PERMISSIONS) {
|
|
45
|
+
if (!fstatSync(fd).isFile()) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let secret;
|
|
50
|
+
try {
|
|
51
|
+
secret = trimPersistenceWhitespace(new TextDecoder("utf-8", { fatal: true }).decode(readFileSync(fd)));
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return secret === "" ? null : secret;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
return err?.code === "ENOENT" ? void 0 : null;
|
|
58
|
+
} finally {
|
|
59
|
+
if (fd !== void 0) {
|
|
60
|
+
try {
|
|
61
|
+
closeSync(fd);
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__name(readSecretFile, "readSecretFile");
|
|
68
|
+
function loadOrPersistUserCacheSecret(generateSecret) {
|
|
69
|
+
let home;
|
|
70
|
+
try {
|
|
71
|
+
home = homedir();
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
if (!home) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const dir = join(home, USER_CACHE_SECRET_DIR_NAME);
|
|
79
|
+
const path = join(dir, USER_CACHE_SECRET_FILE_NAME);
|
|
80
|
+
try {
|
|
81
|
+
if (!HAS_POSIX_PERMISSIONS && isExpectedWindowsPath(dir, "directory") === false) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
85
|
+
if (HAS_POSIX_PERMISSIONS) {
|
|
86
|
+
let dirFd;
|
|
87
|
+
try {
|
|
88
|
+
dirFd = openSync(dir, posixReadFlags() | constants.O_DIRECTORY);
|
|
89
|
+
if (!fstatSync(dirFd).isDirectory()) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
} finally {
|
|
93
|
+
if (dirFd !== void 0) {
|
|
94
|
+
closeSync(dirFd);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
} else if (isExpectedWindowsPath(dir, "directory") !== true) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const existing = readSecretFile(path);
|
|
104
|
+
if (existing === null) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
if (existing !== void 0) {
|
|
108
|
+
return existing;
|
|
109
|
+
}
|
|
110
|
+
const secret = generateSecret();
|
|
111
|
+
if (secret === "") {
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
const candidatePath = join(dir, `${USER_CACHE_SECRET_FILE_NAME}.${process.pid}.${randomUUID()}.tmp`);
|
|
115
|
+
try {
|
|
116
|
+
writeFileSync(candidatePath, secret, { encoding: "utf8", flag: "wx", mode: 384 });
|
|
117
|
+
try {
|
|
118
|
+
linkSync(candidatePath, path);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
if (err?.code !== "EEXIST") {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const persisted = readSecretFile(path);
|
|
125
|
+
return persisted ?? null;
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
} finally {
|
|
129
|
+
try {
|
|
130
|
+
unlinkSync(candidatePath);
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
__name(loadOrPersistUserCacheSecret, "loadOrPersistUserCacheSecret");
|
|
136
|
+
export {
|
|
137
|
+
USER_CACHE_SECRET_DIR_NAME,
|
|
138
|
+
USER_CACHE_SECRET_FILE_NAME,
|
|
139
|
+
loadOrPersistUserCacheSecret
|
|
140
|
+
};
|