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,188 @@
|
|
|
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/@earendil-works/pi-ai/dist/utils/retry.js
|
|
7
|
+
function buildProviderErrorPattern(patterns) {
|
|
8
|
+
return new RegExp(patterns.join("|"), "i");
|
|
9
|
+
}
|
|
10
|
+
__name(buildProviderErrorPattern, "buildProviderErrorPattern");
|
|
11
|
+
var NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN = buildProviderErrorPattern([
|
|
12
|
+
// OpenCode Go/free-tier limits returned as 429 JSON error types by OpenCode's
|
|
13
|
+
// Zen API. These are subscription/account limits, not transient throttles.
|
|
14
|
+
"GoUsageLimitError",
|
|
15
|
+
"FreeUsageLimitError",
|
|
16
|
+
// OpenCode Go subscription-limit text asks users to enable available-balance
|
|
17
|
+
// usage after rolling/weekly/monthly limits are reached.
|
|
18
|
+
"Monthly usage limit reached",
|
|
19
|
+
"available balance",
|
|
20
|
+
// Generic quota/budget/billing exhaustion. `insufficient_quota` is OpenAI's
|
|
21
|
+
// quota/billing error code; the other strings cover common gateway wording.
|
|
22
|
+
"insufficient_quota",
|
|
23
|
+
"out of budget",
|
|
24
|
+
"quota exceeded",
|
|
25
|
+
"billing",
|
|
26
|
+
// Sign in with ChatGPT: the subscription's shared usage limit, which resets
|
|
27
|
+
// after hours rather than seconds.
|
|
28
|
+
"subscription_sharing_usage_limit_exceeded"
|
|
29
|
+
]);
|
|
30
|
+
var RETRYABLE_PROVIDER_ERROR_PATTERN = buildProviderErrorPattern([
|
|
31
|
+
// Generic provider load, HTTP status, and server-side transient failures.
|
|
32
|
+
"overloaded",
|
|
33
|
+
"server_busy",
|
|
34
|
+
"servers are currently busy",
|
|
35
|
+
"currently experiencing high demand",
|
|
36
|
+
"model is at capacity",
|
|
37
|
+
"rate.?limit",
|
|
38
|
+
"too many requests",
|
|
39
|
+
"429",
|
|
40
|
+
"500",
|
|
41
|
+
"502",
|
|
42
|
+
"503",
|
|
43
|
+
"504",
|
|
44
|
+
"520",
|
|
45
|
+
"524",
|
|
46
|
+
// Also matches "The service is temporarily unavailable" (#10965).
|
|
47
|
+
"service.?(?:is.?)?(?:temporarily.?)?unavailable",
|
|
48
|
+
"server.?error",
|
|
49
|
+
"internal.?error",
|
|
50
|
+
// Wrapper/provider text for transient upstream failures, including OpenRouter
|
|
51
|
+
// "Provider returned error" responses (#2264) and gateway wording such as
|
|
52
|
+
// "The upstream provider returned an error" (#10842).
|
|
53
|
+
"provider.?returned.?(?:an.?)?error",
|
|
54
|
+
"exceeded request buffer limit while retrying upstream",
|
|
55
|
+
// Gateway failure relaying the upstream response stream, sent as an OpenAI
|
|
56
|
+
// Responses `response.failed` event without an error code (#10920).
|
|
57
|
+
"unable to forward upstream",
|
|
58
|
+
// Network, proxy, and fetch transport failures. This includes OpenAI Codex
|
|
59
|
+
// raw-fetch failures such as "upstream connect", "connection refused", and
|
|
60
|
+
// "reset before headers" (#733), plus OpenRouter connection drops (#3317).
|
|
61
|
+
"network.?error",
|
|
62
|
+
"connection.?error",
|
|
63
|
+
"connection.?refused",
|
|
64
|
+
"connection.?lost",
|
|
65
|
+
"other side closed",
|
|
66
|
+
"fetch failed",
|
|
67
|
+
"getaddrinfo",
|
|
68
|
+
"ENOTFOUND",
|
|
69
|
+
"EAI_AGAIN",
|
|
70
|
+
"upstream.?connect",
|
|
71
|
+
"reset before headers",
|
|
72
|
+
"socket hang up",
|
|
73
|
+
"socket connection was closed",
|
|
74
|
+
"timed? out",
|
|
75
|
+
"timeout",
|
|
76
|
+
"terminated",
|
|
77
|
+
// WebSocket transports can report close/error text instead of HTTP/fetch text.
|
|
78
|
+
"websocket.?closed",
|
|
79
|
+
"websocket.?error",
|
|
80
|
+
// Premature stream endings from SDKs and transports. Anthropic can throw
|
|
81
|
+
// "stream ended without ..." and "Anthropic stream ended before message_stop"
|
|
82
|
+
// (#4433); Bedrock/Smithy can throw an HTTP/2 no-response error (#3594).
|
|
83
|
+
"ended without",
|
|
84
|
+
"stream ended before message_stop",
|
|
85
|
+
"stream ended before a terminal response event",
|
|
86
|
+
"http2 request did not get a response",
|
|
87
|
+
// Node ERR_HTTP2_STREAM_CANCEL: the HTTP/2 session died before the request was
|
|
88
|
+
// sent, e.g. after the Bedrock SDK's 5-minute session timeout (#10379).
|
|
89
|
+
"pending stream has been canceled",
|
|
90
|
+
// Provider-requested retry delay cap failures should flow through the outer
|
|
91
|
+
// retry policy so callers can surface/abort the backoff (#1123).
|
|
92
|
+
"retry delay",
|
|
93
|
+
// Explicit retry guidance emitted mid-stream by OpenAI Responses and Bedrock
|
|
94
|
+
// stream exceptions (#6019).
|
|
95
|
+
"you can retry your request",
|
|
96
|
+
"try your request again",
|
|
97
|
+
"please retry your request",
|
|
98
|
+
// gRPC based providers (e.g. NVIDIA NIM)
|
|
99
|
+
"ResourceExhausted",
|
|
100
|
+
// Sign in with ChatGPT: usage or user data temporarily unavailable. Usage
|
|
101
|
+
// failures can arrive mid-stream without an HTTP 503 in the message.
|
|
102
|
+
"subscription_sharing_usage_unavailable",
|
|
103
|
+
"subscription_sharing_user_unavailable"
|
|
104
|
+
]);
|
|
105
|
+
var DEFAULT_MAX_AGENT_RETRY_DELAY_MS = 6e4;
|
|
106
|
+
function retryDelayMs(policy, attempt) {
|
|
107
|
+
const delay = policy.baseDelayMs * 2 ** Math.max(0, attempt - 1);
|
|
108
|
+
const safeDelay = Number.isSafeInteger(delay) ? delay : Number.MAX_SAFE_INTEGER;
|
|
109
|
+
return Math.min(safeDelay, policy.maxAgentDelayMs ?? DEFAULT_MAX_AGENT_RETRY_DELAY_MS);
|
|
110
|
+
}
|
|
111
|
+
__name(retryDelayMs, "retryDelayMs");
|
|
112
|
+
var RetrySleepAbortError = class extends Error {
|
|
113
|
+
static {
|
|
114
|
+
__name(this, "RetrySleepAbortError");
|
|
115
|
+
}
|
|
116
|
+
constructor() {
|
|
117
|
+
super("Aborted");
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function sleep(ms, signal) {
|
|
121
|
+
return new Promise((resolve, reject) => {
|
|
122
|
+
if (signal?.aborted) {
|
|
123
|
+
reject(new RetrySleepAbortError());
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const timeout = setTimeout(resolve, ms);
|
|
127
|
+
signal?.addEventListener("abort", () => {
|
|
128
|
+
clearTimeout(timeout);
|
|
129
|
+
reject(new RetrySleepAbortError());
|
|
130
|
+
}, { once: true });
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
__name(sleep, "sleep");
|
|
134
|
+
async function retryAssistantCall(produce, policy, signal, callbacks) {
|
|
135
|
+
const maxAttempts = policy?.enabled ? policy.maxRetries : 0;
|
|
136
|
+
let attempt = 0;
|
|
137
|
+
let lastRetry;
|
|
138
|
+
for (; ; ) {
|
|
139
|
+
const response = await produce();
|
|
140
|
+
if (response.stopReason === "aborted") {
|
|
141
|
+
if (lastRetry)
|
|
142
|
+
await callbacks?.onRetryFinished?.(false, lastRetry.attempt);
|
|
143
|
+
return response;
|
|
144
|
+
}
|
|
145
|
+
if (response.stopReason !== "error") {
|
|
146
|
+
if (lastRetry)
|
|
147
|
+
await callbacks?.onRetryFinished?.(true, lastRetry.attempt);
|
|
148
|
+
return response;
|
|
149
|
+
}
|
|
150
|
+
if (attempt >= maxAttempts || !isRetryableAssistantError(response)) {
|
|
151
|
+
if (lastRetry)
|
|
152
|
+
await callbacks?.onRetryFinished?.(false, lastRetry.attempt, response.errorMessage);
|
|
153
|
+
return response;
|
|
154
|
+
}
|
|
155
|
+
attempt++;
|
|
156
|
+
lastRetry = { attempt, errorMessage: response.errorMessage || "Unknown error" };
|
|
157
|
+
const delayMs = retryDelayMs(policy, attempt);
|
|
158
|
+
await callbacks?.onRetryScheduled?.(attempt, maxAttempts, delayMs, lastRetry.errorMessage);
|
|
159
|
+
try {
|
|
160
|
+
await sleep(delayMs, signal);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
await callbacks?.onRetryFinished?.(false, attempt, lastRetry.errorMessage);
|
|
163
|
+
if (error instanceof RetrySleepAbortError) {
|
|
164
|
+
const { errorMessage: _errorMessage, ...rest } = response;
|
|
165
|
+
return { ...rest, stopReason: "aborted" };
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
await callbacks?.onRetryAttemptStart?.();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
__name(retryAssistantCall, "retryAssistantCall");
|
|
173
|
+
function isRetryableAssistantError(message) {
|
|
174
|
+
if (message.stopReason !== "error" || !message.errorMessage)
|
|
175
|
+
return false;
|
|
176
|
+
const errorMessage = message.errorMessage;
|
|
177
|
+
if (NON_RETRYABLE_PROVIDER_LIMIT_ERROR_PATTERN.test(errorMessage))
|
|
178
|
+
return false;
|
|
179
|
+
return RETRYABLE_PROVIDER_ERROR_PATTERN.test(errorMessage);
|
|
180
|
+
}
|
|
181
|
+
__name(isRetryableAssistantError, "isRetryableAssistantError");
|
|
182
|
+
|
|
183
|
+
export {
|
|
184
|
+
DEFAULT_MAX_AGENT_RETRY_DELAY_MS,
|
|
185
|
+
retryDelayMs,
|
|
186
|
+
retryAssistantCall,
|
|
187
|
+
isRetryableAssistantError
|
|
188
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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/@earendil-works/pi-ai/dist/utils/hash.js
|
|
7
|
+
function shortHash(str) {
|
|
8
|
+
let h1 = 3735928559;
|
|
9
|
+
let h2 = 1103547991;
|
|
10
|
+
for (let i = 0; i < str.length; i++) {
|
|
11
|
+
const ch = str.charCodeAt(i);
|
|
12
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
13
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
14
|
+
}
|
|
15
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
16
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
17
|
+
return (h2 >>> 0).toString(36) + (h1 >>> 0).toString(36);
|
|
18
|
+
}
|
|
19
|
+
__name(shortHash, "shortHash");
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
shortHash
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 "./c-CN77DCGF.mjs";
|
|
3
|
+
|
|
4
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/jiti-loader.js
|
|
5
|
+
import { createJiti } from "jiti";
|
|
6
|
+
export {
|
|
7
|
+
createJiti
|
|
8
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Agent,
|
|
4
|
+
agentLoop,
|
|
5
|
+
agentLoopContinue,
|
|
6
|
+
runAgentLoop,
|
|
7
|
+
runAgentLoopContinue,
|
|
8
|
+
runToolCall,
|
|
9
|
+
setDefaultStreamFn,
|
|
10
|
+
streamProxy
|
|
11
|
+
} from "./c-UPBH5AXY.mjs";
|
|
12
|
+
import "./c-YRDO2WEF.mjs";
|
|
13
|
+
import "./c-BHNIF2AR.mjs";
|
|
14
|
+
import "./c-ABXULAFL.mjs";
|
|
15
|
+
import "./c-DEE67DJO.mjs";
|
|
16
|
+
import "./c-WO3QSZUU.mjs";
|
|
17
|
+
import "./c-S2RVHR3M.mjs";
|
|
18
|
+
import "./c-CN77DCGF.mjs";
|
|
19
|
+
export {
|
|
20
|
+
Agent,
|
|
21
|
+
agentLoop,
|
|
22
|
+
agentLoopContinue,
|
|
23
|
+
runAgentLoop,
|
|
24
|
+
runAgentLoopContinue,
|
|
25
|
+
runToolCall,
|
|
26
|
+
setDefaultStreamFn,
|
|
27
|
+
streamProxy
|
|
28
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
BRAVE_API_KEY_ENV_VAR,
|
|
4
|
+
BRAVE_PROVIDER_META,
|
|
5
|
+
BraveProvider,
|
|
6
|
+
EXA_API_KEY_ENV_VAR,
|
|
7
|
+
EXA_PROVIDER_META,
|
|
8
|
+
ExaProvider,
|
|
9
|
+
FIRECRAWL_API_KEY_ENV_VAR,
|
|
10
|
+
FIRECRAWL_PROVIDER_META,
|
|
11
|
+
FirecrawlProvider,
|
|
12
|
+
GITHUB_TOKEN_ENV_VAR,
|
|
13
|
+
GitHubInterceptor,
|
|
14
|
+
JINA_API_KEY_ENV_VAR,
|
|
15
|
+
JINA_PROVIDER_META,
|
|
16
|
+
JinaProvider,
|
|
17
|
+
OLLAMA_API_KEY_ENV_VAR,
|
|
18
|
+
OLLAMA_DEFAULT_URL,
|
|
19
|
+
OLLAMA_HOST_ENV_VAR,
|
|
20
|
+
OLLAMA_PROVIDER_META,
|
|
21
|
+
OllamaProvider,
|
|
22
|
+
PERPLEXITY_API_KEY_ENV_VAR,
|
|
23
|
+
PERPLEXITY_PROVIDER_META,
|
|
24
|
+
PROVIDERS,
|
|
25
|
+
PerplexityProvider,
|
|
26
|
+
SEARXNG_API_KEY_ENV_VAR,
|
|
27
|
+
SEARXNG_DEFAULT_URL,
|
|
28
|
+
SEARXNG_PROVIDER_META,
|
|
29
|
+
SEARXNG_URL_ENV_VAR,
|
|
30
|
+
SERPER_API_KEY_ENV_VAR,
|
|
31
|
+
SERPER_PROVIDER_META,
|
|
32
|
+
SearxngProvider,
|
|
33
|
+
SerperProvider,
|
|
34
|
+
TAVILY_API_KEY_ENV_VAR,
|
|
35
|
+
TAVILY_PROVIDER_META,
|
|
36
|
+
TavilyProvider,
|
|
37
|
+
YOUCOM_API_KEY_ENV_VAR,
|
|
38
|
+
YOUCOM_PROVIDER_META,
|
|
39
|
+
YouComProvider,
|
|
40
|
+
clearCloneCache,
|
|
41
|
+
configureOllama,
|
|
42
|
+
configureSearxng,
|
|
43
|
+
createSearchProvider,
|
|
44
|
+
parseGitHubUrl
|
|
45
|
+
} from "./c-6FUXKHOK.mjs";
|
|
46
|
+
import "./c-6LOBR4I6.mjs";
|
|
47
|
+
import "./c-RQJJ26T4.mjs";
|
|
48
|
+
import "./c-L5GHWG5G.mjs";
|
|
49
|
+
import "./c-CN77DCGF.mjs";
|
|
50
|
+
export {
|
|
51
|
+
BRAVE_API_KEY_ENV_VAR,
|
|
52
|
+
BRAVE_PROVIDER_META,
|
|
53
|
+
BraveProvider,
|
|
54
|
+
EXA_API_KEY_ENV_VAR,
|
|
55
|
+
EXA_PROVIDER_META,
|
|
56
|
+
ExaProvider,
|
|
57
|
+
FIRECRAWL_API_KEY_ENV_VAR,
|
|
58
|
+
FIRECRAWL_PROVIDER_META,
|
|
59
|
+
FirecrawlProvider,
|
|
60
|
+
GITHUB_TOKEN_ENV_VAR,
|
|
61
|
+
GitHubInterceptor,
|
|
62
|
+
JINA_API_KEY_ENV_VAR,
|
|
63
|
+
JINA_PROVIDER_META,
|
|
64
|
+
JinaProvider,
|
|
65
|
+
OLLAMA_API_KEY_ENV_VAR,
|
|
66
|
+
OLLAMA_DEFAULT_URL,
|
|
67
|
+
OLLAMA_HOST_ENV_VAR,
|
|
68
|
+
OLLAMA_PROVIDER_META,
|
|
69
|
+
OllamaProvider,
|
|
70
|
+
PERPLEXITY_API_KEY_ENV_VAR,
|
|
71
|
+
PERPLEXITY_PROVIDER_META,
|
|
72
|
+
PROVIDERS,
|
|
73
|
+
PerplexityProvider,
|
|
74
|
+
SEARXNG_API_KEY_ENV_VAR,
|
|
75
|
+
SEARXNG_DEFAULT_URL,
|
|
76
|
+
SEARXNG_PROVIDER_META,
|
|
77
|
+
SEARXNG_URL_ENV_VAR,
|
|
78
|
+
SERPER_API_KEY_ENV_VAR,
|
|
79
|
+
SERPER_PROVIDER_META,
|
|
80
|
+
SearxngProvider,
|
|
81
|
+
SerperProvider,
|
|
82
|
+
TAVILY_API_KEY_ENV_VAR,
|
|
83
|
+
TAVILY_PROVIDER_META,
|
|
84
|
+
TavilyProvider,
|
|
85
|
+
YOUCOM_API_KEY_ENV_VAR,
|
|
86
|
+
YOUCOM_PROVIDER_META,
|
|
87
|
+
YouComProvider,
|
|
88
|
+
clearCloneCache,
|
|
89
|
+
configureOllama,
|
|
90
|
+
configureSearxng,
|
|
91
|
+
createSearchProvider,
|
|
92
|
+
parseGitHubUrl
|
|
93
|
+
};
|