pagegraph 0.12.0 → 0.14.0
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 +325 -66
- package/dist/anthropic-messages-TqKpKmfW.js +1067 -0
- package/dist/anthropic-messages-TqKpKmfW.js.map +1 -0
- package/dist/audit.d.ts +4 -2
- package/dist/audit.js +5 -5
- package/dist/audit.js.map +1 -1
- package/dist/azure-openai-responses-DJjBLwoI.js +231 -0
- package/dist/azure-openai-responses-DJjBLwoI.js.map +1 -0
- package/dist/build-only/audit.js +1 -1
- package/dist/build-only/claims.d.ts +1 -0
- package/dist/build-only/claims.js +6 -0
- package/dist/build-only/claims.js.map +1 -0
- package/dist/build-only/config.js +1 -1
- package/dist/build-only/oxlint.d.ts +1 -0
- package/dist/build-only/oxlint.js +6 -0
- package/dist/build-only/oxlint.js.map +1 -0
- package/dist/build-only/tanstack-start.js +1 -1
- package/dist/build-only/vite.js +1 -1
- package/dist/{checks-uZk5Em9A.js → checks-BS-aDXB_.js} +2 -2
- package/dist/checks-BS-aDXB_.js.map +1 -0
- package/dist/claims-Bch7Lxlo.d.ts +92 -0
- package/dist/claims-Bv7voeEV.js +431 -0
- package/dist/claims-Bv7voeEV.js.map +1 -0
- package/dist/claims.d.ts +94 -0
- package/dist/claims.js +2 -0
- package/dist/cli.js +17607 -43387
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js +41 -0
- package/dist/cloudflare-workers-ai-system-one-f3ZrvNYZ.js.map +1 -0
- package/dist/config.d.ts +9 -29
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/{content-kcEnQdfi.js → content-CHd0X4s6.js} +2 -2
- package/dist/{content-kcEnQdfi.js.map → content-CHd0X4s6.js.map} +1 -1
- package/dist/{content-B1cPtL8b.d.ts → content-DgNr7apS.d.ts} +4 -5
- package/dist/declare-D5o7hwmv.js.map +1 -1
- package/dist/diagnostics-Wt5faNDM.js +108 -0
- package/dist/diagnostics-Wt5faNDM.js.map +1 -0
- package/dist/dist-B6zg_Z3Z.js +4794 -0
- package/dist/dist-B6zg_Z3Z.js.map +1 -0
- package/dist/document-CztEu3Vd.d.ts +109 -0
- package/dist/document-Dvemcv7V.js +379 -0
- package/dist/document-Dvemcv7V.js.map +1 -0
- package/dist/env-api-keys-C-OA0yM-.js +124 -0
- package/dist/env-api-keys-C-OA0yM-.js.map +1 -0
- package/dist/error-body-CyiejW4b.js +103 -0
- package/dist/error-body-CyiejW4b.js.map +1 -0
- package/dist/facts-1OKclPOk.js +115 -0
- package/dist/facts-1OKclPOk.js.map +1 -0
- package/dist/github-copilot-headers-CEpMOpQF.js +24 -0
- package/dist/github-copilot-headers-CEpMOpQF.js.map +1 -0
- package/dist/google-generative-ai-BxABKIKO.js +330 -0
- package/dist/google-generative-ai-BxABKIKO.js.map +1 -0
- package/dist/google-shared-0gpM2jFi.js +19471 -0
- package/dist/google-shared-0gpM2jFi.js.map +1 -0
- package/dist/google-vertex-D8Eb5cbu.js +376 -0
- package/dist/google-vertex-D8Eb5cbu.js.map +1 -0
- package/dist/{declare-DVgdEdOL.d.ts → graph-D1PIndsC.d.ts} +117 -6
- package/dist/{graph-Bcsourlv.js → graph-DMNOLXLu.js} +23 -13
- package/dist/graph-DMNOLXLu.js.map +1 -0
- package/dist/hash-Dp7EzZUo.js +18 -0
- package/dist/hash-Dp7EzZUo.js.map +1 -0
- package/dist/headers-BRNMVpzu.js +19 -0
- package/dist/headers-BRNMVpzu.js.map +1 -0
- package/dist/index-C5w9ripz.d.ts +204 -0
- package/dist/index.d.ts +6 -160
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/inline-BbS93GAT.js +682 -0
- package/dist/inline-BbS93GAT.js.map +1 -0
- package/dist/json-parse-C10znB7l.js +383 -0
- package/dist/json-parse-C10znB7l.js.map +1 -0
- package/dist/llms-Dhr_5u2O.js +19 -0
- package/dist/llms-Dhr_5u2O.js.map +1 -0
- package/dist/markdown-C6dRE9zD.js +168 -0
- package/dist/markdown-C6dRE9zD.js.map +1 -0
- package/dist/markdown-path-lJB9BAVZ.js +6 -0
- package/dist/markdown-path-lJB9BAVZ.js.map +1 -0
- package/dist/{message-DT_CjUdt.js → message-CuBjgZ74.js} +2 -2
- package/dist/{message-DT_CjUdt.js.map → message-CuBjgZ74.js.map} +1 -1
- package/dist/mistral-conversations-CvaqBWjR.js +690 -0
- package/dist/mistral-conversations-CvaqBWjR.js.map +1 -0
- package/dist/models-DcT5qOEL.js +1203 -0
- package/dist/models-DcT5qOEL.js.map +1 -0
- package/dist/node-Ccvru9GE.js +26 -0
- package/dist/node-Ccvru9GE.js.map +1 -0
- package/dist/node-MEosBOF2.js +2403 -0
- package/dist/node-MEosBOF2.js.map +1 -0
- package/dist/openai-BCBEd2eO.js +17350 -0
- package/dist/openai-BCBEd2eO.js.map +1 -0
- package/dist/openai-codex-responses-vJqxeeRC.js +1268 -0
- package/dist/openai-codex-responses-vJqxeeRC.js.map +1 -0
- package/dist/openai-completions-Cb_fRAbI.js +989 -0
- package/dist/openai-completions-Cb_fRAbI.js.map +1 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +10 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js.map +1 -0
- package/dist/openai-responses-sDuh82G5.js +268 -0
- package/dist/openai-responses-sDuh82G5.js.map +1 -0
- package/dist/openai-responses-shared-mhuo1Jov.js +599 -0
- package/dist/openai-responses-shared-mhuo1Jov.js.map +1 -0
- package/dist/openrouter-images-CRmBkzpX.js +127 -0
- package/dist/openrouter-images-CRmBkzpX.js.map +1 -0
- package/dist/oxlint.d.ts +58 -0
- package/dist/oxlint.js +202 -0
- package/dist/oxlint.js.map +1 -0
- package/dist/page-heads-BfjWQvau.d.ts +108 -0
- package/dist/{page-heads-6y-CARRQ.js → page-heads-BgbaIjj9.js} +3 -3
- package/dist/page-heads-BgbaIjj9.js.map +1 -0
- package/dist/pi-Bvw6J0gh.js +56795 -0
- package/dist/pi-Bvw6J0gh.js.map +1 -0
- package/dist/pi-messages-CejiVYvO.js +308 -0
- package/dist/pi-messages-CejiVYvO.js.map +1 -0
- package/dist/{projections-DeEFe7XT.d.ts → projections-Bk-qOOsR.d.ts} +2 -2
- package/dist/provider-env-t38GK5FF.js +39 -0
- package/dist/provider-env-t38GK5FF.js.map +1 -0
- package/dist/provider-retry-DzKoh1X7.js +80 -0
- package/dist/provider-retry-DzKoh1X7.js.map +1 -0
- package/dist/react.d.ts +3 -2
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -1
- package/dist/rolldown-runtime-B-lAHAz2.js +37 -0
- package/dist/sanitize-unicode-Ds14l9Om.js +28 -0
- package/dist/sanitize-unicode-Ds14l9Om.js.map +1 -0
- package/dist/sdk-C9_wiO6w.js +12503 -0
- package/dist/sdk-C9_wiO6w.js.map +1 -0
- package/dist/state-BuJP_3Lr.js +28102 -0
- package/dist/state-BuJP_3Lr.js.map +1 -0
- package/dist/system-one-shared-Dl10ZF7Z.js +167 -0
- package/dist/system-one-shared-Dl10ZF7Z.js.map +1 -0
- package/dist/tanstack-start/index.d.ts +29 -13
- package/dist/tanstack-start/index.js +391 -42
- package/dist/tanstack-start/index.js.map +1 -1
- package/dist/tanstack-start/markdown.d.ts +12 -0
- package/dist/tanstack-start/markdown.js +149 -0
- package/dist/tanstack-start/markdown.js.map +1 -0
- package/dist/tanstack-start/prerender-worker.d.ts +2 -0
- package/dist/tanstack-start/prerender-worker.js +7 -0
- package/dist/tanstack-start/prerender-worker.js.map +1 -0
- package/dist/tanstack-start/react.d.ts +7 -0
- package/dist/tanstack-start/react.js +12 -0
- package/dist/tanstack-start/react.js.map +1 -0
- package/dist/tanstack-start/server.d.ts +9 -3
- package/dist/tanstack-start/server.js +26 -2
- package/dist/tanstack-start/server.js.map +1 -1
- package/dist/transform-messages-BLJ8EfK6.js +468 -0
- package/dist/transform-messages-BLJ8EfK6.js.map +1 -0
- package/dist/typesafe-system-one-CwEWMV8P.js +25 -0
- package/dist/typesafe-system-one-CwEWMV8P.js.map +1 -0
- package/dist/{vite-graph-loader-01p1WxEq.js → vite-graph-loader-CsGiYNWE.js} +6 -5
- package/dist/vite-graph-loader-CsGiYNWE.js.map +1 -0
- package/dist/vite-graph-loader-DZCwejuJ.d.ts +133 -0
- package/package.json +47 -10
- package/dist/checks-uZk5Em9A.js.map +0 -1
- package/dist/graph-Bcsourlv.js.map +0 -1
- package/dist/graph-BxCY90vq.d.ts +0 -104
- package/dist/graph-CBIY71w6.d.ts +0 -57
- package/dist/page-heads-6y-CARRQ.js.map +0 -1
- package/dist/page-heads-DNkjMUEN.d.ts +0 -21
- package/dist/vite-graph-loader-01p1WxEq.js.map +0 -1
- package/dist/vite-graph-loader-Btgjz5RH.d.ts +0 -56
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { t as getProviderEnvValue } from "./provider-env-t38GK5FF.js";
|
|
2
|
+
import { a as AssistantMessageEventStream, n as createAssistantMessageDiagnostic, t as appendAssistantMessageDiagnostic } from "./diagnostics-Wt5faNDM.js";
|
|
3
|
+
import { n as providerHeadersToRecord, t as headersToRecord } from "./headers-BRNMVpzu.js";
|
|
4
|
+
import { n as parseStreamingJson } from "./json-parse-C10znB7l.js";
|
|
5
|
+
//#region node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js
|
|
6
|
+
/**
|
|
7
|
+
* pi-messages API implementation.
|
|
8
|
+
*
|
|
9
|
+
* Streams pi's own message protocol directly to a backend: the request is a
|
|
10
|
+
* single POST of `{ model, context, options }` to `<baseUrl>/messages`, the
|
|
11
|
+
* response is an SSE stream of serialized assistant-message events plus a
|
|
12
|
+
* terminal `done`/`error` event. This is the wire protocol spoken by the
|
|
13
|
+
* Radius gateway, but any backend implementing it can be used, e.g. via a
|
|
14
|
+
* models.json custom provider with `"api": "pi-messages"`.
|
|
15
|
+
*/
|
|
16
|
+
var PiMessagesResponseError = class extends Error {
|
|
17
|
+
code;
|
|
18
|
+
diagnosticDetails;
|
|
19
|
+
constructor(message, code, diagnosticDetails) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "PiMessagesResponseError";
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.diagnosticDetails = diagnosticDetails;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function parsePiMessagesErrorBody(body) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(body);
|
|
29
|
+
const error = parsed?.error;
|
|
30
|
+
return parsed && typeof error === "object" && error !== null && !Array.isArray(error) ? parsed : void 0;
|
|
31
|
+
} catch {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function truncateDiagnosticString(value) {
|
|
36
|
+
const maxLength = 8192;
|
|
37
|
+
return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
|
|
38
|
+
}
|
|
39
|
+
function formatPiMessagesResponseError(response, body, errorBody) {
|
|
40
|
+
const message = typeof errorBody?.error?.message === "string" ? errorBody.error.message : void 0;
|
|
41
|
+
const code = typeof errorBody?.error?.code === "string" ? errorBody.error.code : void 0;
|
|
42
|
+
const suffix = message ?? body;
|
|
43
|
+
const codeSuffix = code ? ` (${code})` : "";
|
|
44
|
+
return `${response.status} ${response.statusText}: ${suffix}${codeSuffix}`;
|
|
45
|
+
}
|
|
46
|
+
function createPiMessagesResponseError(model, url, response, body) {
|
|
47
|
+
const errorBody = parsePiMessagesErrorBody(body);
|
|
48
|
+
const code = typeof errorBody?.error?.code === "string" ? errorBody.error.code : void 0;
|
|
49
|
+
return new PiMessagesResponseError(formatPiMessagesResponseError(response, body, errorBody), code, {
|
|
50
|
+
version: 1,
|
|
51
|
+
provider: model.provider,
|
|
52
|
+
model: model.id,
|
|
53
|
+
url: url.toString(),
|
|
54
|
+
status: response.status,
|
|
55
|
+
statusText: response.statusText,
|
|
56
|
+
...errorBody?.error === void 0 ? {} : { error: errorBody.error },
|
|
57
|
+
...errorBody ? {} : { body: truncateDiagnosticString(body) },
|
|
58
|
+
timestampMs: Date.now()
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function createEmptyUsage() {
|
|
62
|
+
return {
|
|
63
|
+
input: 0,
|
|
64
|
+
output: 0,
|
|
65
|
+
cacheRead: 0,
|
|
66
|
+
cacheWrite: 0,
|
|
67
|
+
totalTokens: 0,
|
|
68
|
+
cost: {
|
|
69
|
+
input: 0,
|
|
70
|
+
output: 0,
|
|
71
|
+
cacheRead: 0,
|
|
72
|
+
cacheWrite: 0,
|
|
73
|
+
total: 0
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function appendRewriteDiagnostic(message, rewrite) {
|
|
78
|
+
if (!rewrite) return;
|
|
79
|
+
appendAssistantMessageDiagnostic(message, {
|
|
80
|
+
type: "pi_messages_rewrite",
|
|
81
|
+
timestamp: Date.now(),
|
|
82
|
+
details: { ...rewrite }
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function createEventConverter(model) {
|
|
86
|
+
const partial = {
|
|
87
|
+
role: "assistant",
|
|
88
|
+
content: [],
|
|
89
|
+
api: model.api,
|
|
90
|
+
provider: model.provider,
|
|
91
|
+
model: model.id,
|
|
92
|
+
usage: createEmptyUsage(),
|
|
93
|
+
stopReason: "pending",
|
|
94
|
+
timestamp: Date.now()
|
|
95
|
+
};
|
|
96
|
+
const toolJson = /* @__PURE__ */ new Map();
|
|
97
|
+
return (event) => {
|
|
98
|
+
switch (event.type) {
|
|
99
|
+
case "done":
|
|
100
|
+
Object.assign(partial, {
|
|
101
|
+
stopReason: event.reason,
|
|
102
|
+
usage: event.usage,
|
|
103
|
+
responseId: event.responseId
|
|
104
|
+
});
|
|
105
|
+
if (event.providerThinkingLevel !== void 0) partial.providerThinkingLevel = event.providerThinkingLevel;
|
|
106
|
+
appendRewriteDiagnostic(partial, event.rewrite);
|
|
107
|
+
return {
|
|
108
|
+
type: "done",
|
|
109
|
+
reason: event.reason,
|
|
110
|
+
message: partial
|
|
111
|
+
};
|
|
112
|
+
case "error":
|
|
113
|
+
Object.assign(partial, {
|
|
114
|
+
stopReason: event.reason,
|
|
115
|
+
usage: event.usage,
|
|
116
|
+
errorMessage: event.errorMessage,
|
|
117
|
+
responseId: event.responseId
|
|
118
|
+
});
|
|
119
|
+
if (event.providerThinkingLevel !== void 0) partial.providerThinkingLevel = event.providerThinkingLevel;
|
|
120
|
+
appendRewriteDiagnostic(partial, event.rewrite);
|
|
121
|
+
return {
|
|
122
|
+
type: "error",
|
|
123
|
+
reason: event.reason,
|
|
124
|
+
error: partial
|
|
125
|
+
};
|
|
126
|
+
case "start": break;
|
|
127
|
+
case "text_start":
|
|
128
|
+
partial.content[event.contentIndex] = {
|
|
129
|
+
type: "text",
|
|
130
|
+
text: ""
|
|
131
|
+
};
|
|
132
|
+
break;
|
|
133
|
+
case "text_delta":
|
|
134
|
+
partial.content[event.contentIndex].text += event.delta;
|
|
135
|
+
break;
|
|
136
|
+
case "text_end":
|
|
137
|
+
Object.assign(partial.content[event.contentIndex], {
|
|
138
|
+
text: event.content,
|
|
139
|
+
textSignature: event.contentSignature
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case "thinking_start":
|
|
143
|
+
partial.content[event.contentIndex] = {
|
|
144
|
+
type: "thinking",
|
|
145
|
+
thinking: ""
|
|
146
|
+
};
|
|
147
|
+
break;
|
|
148
|
+
case "thinking_delta":
|
|
149
|
+
partial.content[event.contentIndex].thinking += event.delta;
|
|
150
|
+
break;
|
|
151
|
+
case "thinking_end":
|
|
152
|
+
Object.assign(partial.content[event.contentIndex], {
|
|
153
|
+
thinking: event.content,
|
|
154
|
+
thinkingSignature: event.contentSignature,
|
|
155
|
+
redacted: event.redacted
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
case "toolcall_start":
|
|
159
|
+
partial.content[event.contentIndex] = {
|
|
160
|
+
type: "toolCall",
|
|
161
|
+
id: event.id,
|
|
162
|
+
name: event.toolName,
|
|
163
|
+
arguments: {}
|
|
164
|
+
};
|
|
165
|
+
toolJson.set(event.contentIndex, "");
|
|
166
|
+
break;
|
|
167
|
+
case "toolcall_delta": {
|
|
168
|
+
const json = `${toolJson.get(event.contentIndex) ?? ""}${event.delta}`;
|
|
169
|
+
toolJson.set(event.contentIndex, json);
|
|
170
|
+
partial.content[event.contentIndex].arguments = parseStreamingJson(json);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
case "toolcall_end":
|
|
174
|
+
Object.assign(partial.content[event.contentIndex], event.toolCall);
|
|
175
|
+
toolJson.delete(event.contentIndex);
|
|
176
|
+
return {
|
|
177
|
+
type: "toolcall_end",
|
|
178
|
+
contentIndex: event.contentIndex,
|
|
179
|
+
toolCall: partial.content[event.contentIndex],
|
|
180
|
+
partial
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
...event,
|
|
185
|
+
partial
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
async function* readPiMessagesEvents(stream) {
|
|
190
|
+
const decoder = new TextDecoder();
|
|
191
|
+
const reader = stream.getReader();
|
|
192
|
+
let buffer = "";
|
|
193
|
+
try {
|
|
194
|
+
while (true) {
|
|
195
|
+
const { done, value } = await reader.read();
|
|
196
|
+
buffer += done ? decoder.decode() : decoder.decode(value, { stream: true });
|
|
197
|
+
buffer = buffer.replace(/\r\n/g, "\n");
|
|
198
|
+
let split = buffer.indexOf("\n\n");
|
|
199
|
+
while (split !== -1) {
|
|
200
|
+
const event = parsePiMessagesEvent(buffer.slice(0, split));
|
|
201
|
+
if (event) yield event;
|
|
202
|
+
buffer = buffer.slice(split + 2);
|
|
203
|
+
split = buffer.indexOf("\n\n");
|
|
204
|
+
}
|
|
205
|
+
if (done) break;
|
|
206
|
+
}
|
|
207
|
+
if (buffer.trim()) {
|
|
208
|
+
const event = parsePiMessagesEvent(buffer);
|
|
209
|
+
if (event) yield event;
|
|
210
|
+
}
|
|
211
|
+
} finally {
|
|
212
|
+
reader.releaseLock();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function parsePiMessagesEvent(raw) {
|
|
216
|
+
const data = raw.split("\n").find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
217
|
+
return data && data !== "[DONE]" ? JSON.parse(data) : void 0;
|
|
218
|
+
}
|
|
219
|
+
function createErrorEvent(model, error, aborted) {
|
|
220
|
+
const reason = aborted ? "aborted" : "error";
|
|
221
|
+
const assistantMessage = {
|
|
222
|
+
role: "assistant",
|
|
223
|
+
content: [],
|
|
224
|
+
api: model.api,
|
|
225
|
+
provider: model.provider,
|
|
226
|
+
model: model.id,
|
|
227
|
+
usage: createEmptyUsage(),
|
|
228
|
+
stopReason: reason,
|
|
229
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
230
|
+
timestamp: Date.now()
|
|
231
|
+
};
|
|
232
|
+
if (!aborted && error instanceof PiMessagesResponseError) appendAssistantMessageDiagnostic(assistantMessage, createAssistantMessageDiagnostic("pi_messages_response_failure", error, error.diagnosticDetails));
|
|
233
|
+
return {
|
|
234
|
+
type: "error",
|
|
235
|
+
reason,
|
|
236
|
+
error: assistantMessage
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function resolveCacheRetention(cacheRetention, env) {
|
|
240
|
+
if (cacheRetention) return cacheRetention;
|
|
241
|
+
return getProviderEnvValue("PI_CACHE_RETENTION", env) === "long" ? "long" : void 0;
|
|
242
|
+
}
|
|
243
|
+
const stream = (model, context, options) => {
|
|
244
|
+
const eventStream = new AssistantMessageEventStream();
|
|
245
|
+
const convertEvent = createEventConverter(model);
|
|
246
|
+
(async () => {
|
|
247
|
+
try {
|
|
248
|
+
const apiKey = options?.apiKey;
|
|
249
|
+
if (!apiKey) throw new Error(`No API key provided for provider "${model.provider}"`);
|
|
250
|
+
const url = new URL(`${model.baseUrl.replace(/\/+$/u, "")}/messages`);
|
|
251
|
+
if (options?.debug) url.searchParams.set("debug", "1");
|
|
252
|
+
let payload = {
|
|
253
|
+
model: model.id,
|
|
254
|
+
context,
|
|
255
|
+
options: {
|
|
256
|
+
temperature: options?.temperature,
|
|
257
|
+
maxTokens: options?.maxTokens,
|
|
258
|
+
reasoning: options?.reasoning,
|
|
259
|
+
cacheRetention: resolveCacheRetention(options?.cacheRetention, options?.env),
|
|
260
|
+
sessionId: options?.sessionId,
|
|
261
|
+
toolChoice: options?.toolChoice
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const nextPayload = await options?.onPayload?.(payload, model);
|
|
265
|
+
if (nextPayload !== void 0) payload = nextPayload;
|
|
266
|
+
const response = await (options?.fetch ?? globalThis.fetch)(url, {
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: {
|
|
269
|
+
authorization: `Bearer ${apiKey}`,
|
|
270
|
+
accept: "text/event-stream",
|
|
271
|
+
"content-type": "application/json",
|
|
272
|
+
...providerHeadersToRecord(options?.headers)
|
|
273
|
+
},
|
|
274
|
+
body: JSON.stringify(payload),
|
|
275
|
+
signal: options?.signal
|
|
276
|
+
});
|
|
277
|
+
await options?.onResponse?.({
|
|
278
|
+
status: response.status,
|
|
279
|
+
headers: headersToRecord(response.headers)
|
|
280
|
+
}, model);
|
|
281
|
+
if (!response.ok) throw createPiMessagesResponseError(model, url, response, await response.text());
|
|
282
|
+
if (!response.body) throw new Error(`${model.provider} response has no body`);
|
|
283
|
+
for await (const piEvent of readPiMessagesEvents(response.body)) {
|
|
284
|
+
await options?.onProviderStreamEvent?.(piEvent, model);
|
|
285
|
+
const event = convertEvent(piEvent);
|
|
286
|
+
eventStream.push(event);
|
|
287
|
+
if (event.type === "done" || event.type === "error") return;
|
|
288
|
+
}
|
|
289
|
+
throw new Error(`${model.provider} stream ended without a terminal event`);
|
|
290
|
+
} catch (error) {
|
|
291
|
+
eventStream.push(createErrorEvent(model, error, options?.signal?.aborted ?? false));
|
|
292
|
+
}
|
|
293
|
+
})();
|
|
294
|
+
return eventStream;
|
|
295
|
+
};
|
|
296
|
+
const streamSimple = (model, context, options) => {
|
|
297
|
+
const extra = options;
|
|
298
|
+
return stream(model, context, {
|
|
299
|
+
...options,
|
|
300
|
+
reasoning: options?.reasoning,
|
|
301
|
+
toolChoice: options?.toolChoice,
|
|
302
|
+
debug: extra?.debug
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
//#endregion
|
|
306
|
+
export { PiMessagesResponseError, stream, streamSimple };
|
|
307
|
+
|
|
308
|
+
//# sourceMappingURL=pi-messages-CejiVYvO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi-messages-CejiVYvO.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js"],"sourcesContent":["/**\n * pi-messages API implementation.\n *\n * Streams pi's own message protocol directly to a backend: the request is a\n * single POST of `{ model, context, options }` to `<baseUrl>/messages`, the\n * response is an SSE stream of serialized assistant-message events plus a\n * terminal `done`/`error` event. This is the wire protocol spoken by the\n * Radius gateway, but any backend implementing it can be used, e.g. via a\n * models.json custom provider with `\"api\": \"pi-messages\"`.\n */\nimport { appendAssistantMessageDiagnostic, createAssistantMessageDiagnostic } from \"../utils/diagnostics.js\";\nimport { AssistantMessageEventStream } from \"../utils/event-stream.js\";\nimport { headersToRecord, providerHeadersToRecord } from \"../utils/headers.js\";\nimport { parseStreamingJson } from \"../utils/json-parse.js\";\nimport { getProviderEnvValue } from \"../utils/provider-env.js\";\nexport class PiMessagesResponseError extends Error {\n code;\n diagnosticDetails;\n constructor(message, code, diagnosticDetails) {\n super(message);\n this.name = \"PiMessagesResponseError\";\n this.code = code;\n this.diagnosticDetails = diagnosticDetails;\n }\n}\nfunction parsePiMessagesErrorBody(body) {\n try {\n const parsed = JSON.parse(body);\n const error = parsed?.error;\n return parsed && typeof error === \"object\" && error !== null && !Array.isArray(error) ? parsed : undefined;\n }\n catch {\n return undefined;\n }\n}\nfunction truncateDiagnosticString(value) {\n const maxLength = 8192;\n return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;\n}\nfunction formatPiMessagesResponseError(response, body, errorBody) {\n const message = typeof errorBody?.error?.message === \"string\" ? errorBody.error.message : undefined;\n const code = typeof errorBody?.error?.code === \"string\" ? errorBody.error.code : undefined;\n const suffix = message ?? body;\n const codeSuffix = code ? ` (${code})` : \"\";\n return `${response.status} ${response.statusText}: ${suffix}${codeSuffix}`;\n}\nfunction createPiMessagesResponseError(model, url, response, body) {\n const errorBody = parsePiMessagesErrorBody(body);\n const code = typeof errorBody?.error?.code === \"string\" ? errorBody.error.code : undefined;\n return new PiMessagesResponseError(formatPiMessagesResponseError(response, body, errorBody), code, {\n version: 1,\n provider: model.provider,\n model: model.id,\n url: url.toString(),\n status: response.status,\n statusText: response.statusText,\n ...(errorBody?.error === undefined ? {} : { error: errorBody.error }),\n ...(errorBody ? {} : { body: truncateDiagnosticString(body) }),\n timestampMs: Date.now(),\n });\n}\nfunction createEmptyUsage() {\n return {\n input: 0,\n output: 0,\n cacheRead: 0,\n cacheWrite: 0,\n totalTokens: 0,\n cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n };\n}\nfunction appendRewriteDiagnostic(message, rewrite) {\n if (!rewrite) {\n return;\n }\n appendAssistantMessageDiagnostic(message, {\n type: \"pi_messages_rewrite\",\n timestamp: Date.now(),\n details: { ...rewrite },\n });\n}\nfunction createEventConverter(model) {\n const partial = {\n role: \"assistant\",\n content: [],\n api: model.api,\n provider: model.provider,\n model: model.id,\n usage: createEmptyUsage(),\n stopReason: \"pending\",\n timestamp: Date.now(),\n };\n const toolJson = new Map();\n return (event) => {\n switch (event.type) {\n case \"done\":\n Object.assign(partial, {\n stopReason: event.reason,\n usage: event.usage,\n responseId: event.responseId,\n });\n if (event.providerThinkingLevel !== undefined) {\n partial.providerThinkingLevel = event.providerThinkingLevel;\n }\n appendRewriteDiagnostic(partial, event.rewrite);\n return { type: \"done\", reason: event.reason, message: partial };\n case \"error\":\n Object.assign(partial, {\n stopReason: event.reason,\n usage: event.usage,\n errorMessage: event.errorMessage,\n responseId: event.responseId,\n });\n if (event.providerThinkingLevel !== undefined) {\n partial.providerThinkingLevel = event.providerThinkingLevel;\n }\n appendRewriteDiagnostic(partial, event.rewrite);\n return { type: \"error\", reason: event.reason, error: partial };\n case \"start\":\n break;\n case \"text_start\":\n partial.content[event.contentIndex] = { type: \"text\", text: \"\" };\n break;\n case \"text_delta\":\n partial.content[event.contentIndex].text += event.delta;\n break;\n case \"text_end\":\n Object.assign(partial.content[event.contentIndex], {\n text: event.content,\n textSignature: event.contentSignature,\n });\n break;\n case \"thinking_start\":\n partial.content[event.contentIndex] = { type: \"thinking\", thinking: \"\" };\n break;\n case \"thinking_delta\":\n partial.content[event.contentIndex].thinking += event.delta;\n break;\n case \"thinking_end\":\n Object.assign(partial.content[event.contentIndex], {\n thinking: event.content,\n thinkingSignature: event.contentSignature,\n redacted: event.redacted,\n });\n break;\n case \"toolcall_start\":\n partial.content[event.contentIndex] = {\n type: \"toolCall\",\n id: event.id,\n name: event.toolName,\n arguments: {},\n };\n toolJson.set(event.contentIndex, \"\");\n break;\n case \"toolcall_delta\": {\n const json = `${toolJson.get(event.contentIndex) ?? \"\"}${event.delta}`;\n toolJson.set(event.contentIndex, json);\n partial.content[event.contentIndex].arguments =\n parseStreamingJson(json);\n break;\n }\n case \"toolcall_end\":\n Object.assign(partial.content[event.contentIndex], event.toolCall);\n toolJson.delete(event.contentIndex);\n return {\n type: \"toolcall_end\",\n contentIndex: event.contentIndex,\n toolCall: partial.content[event.contentIndex],\n partial,\n };\n }\n return { ...event, partial };\n };\n}\nasync function* readPiMessagesEvents(stream) {\n const decoder = new TextDecoder();\n const reader = stream.getReader();\n let buffer = \"\";\n try {\n while (true) {\n const { done, value } = await reader.read();\n buffer += done ? decoder.decode() : decoder.decode(value, { stream: true });\n buffer = buffer.replace(/\\r\\n/g, \"\\n\");\n let split = buffer.indexOf(\"\\n\\n\");\n while (split !== -1) {\n const event = parsePiMessagesEvent(buffer.slice(0, split));\n if (event) {\n yield event;\n }\n buffer = buffer.slice(split + 2);\n split = buffer.indexOf(\"\\n\\n\");\n }\n if (done) {\n break;\n }\n }\n if (buffer.trim()) {\n const event = parsePiMessagesEvent(buffer);\n if (event) {\n yield event;\n }\n }\n }\n finally {\n reader.releaseLock();\n }\n}\nfunction parsePiMessagesEvent(raw) {\n const data = raw\n .split(\"\\n\")\n .find((line) => line.startsWith(\"data:\"))\n ?.slice(5)\n .trim();\n return data && data !== \"[DONE]\" ? JSON.parse(data) : undefined;\n}\nfunction createErrorEvent(model, error, aborted) {\n const reason = aborted ? \"aborted\" : \"error\";\n const assistantMessage = {\n role: \"assistant\",\n content: [],\n api: model.api,\n provider: model.provider,\n model: model.id,\n usage: createEmptyUsage(),\n stopReason: reason,\n errorMessage: error instanceof Error ? error.message : String(error),\n timestamp: Date.now(),\n };\n if (!aborted && error instanceof PiMessagesResponseError) {\n appendAssistantMessageDiagnostic(assistantMessage, createAssistantMessageDiagnostic(\"pi_messages_response_failure\", error, error.diagnosticDetails));\n }\n return { type: \"error\", reason, error: assistantMessage };\n}\nfunction resolveCacheRetention(cacheRetention, env) {\n if (cacheRetention) {\n return cacheRetention;\n }\n // Backend defaults apply when unset; only the legacy env opt-in is mapped.\n return getProviderEnvValue(\"PI_CACHE_RETENTION\", env) === \"long\" ? \"long\" : undefined;\n}\nexport const stream = (model, context, options) => {\n const eventStream = new AssistantMessageEventStream();\n const convertEvent = createEventConverter(model);\n void (async () => {\n try {\n const apiKey = options?.apiKey;\n if (!apiKey) {\n throw new Error(`No API key provided for provider \"${model.provider}\"`);\n }\n const url = new URL(`${model.baseUrl.replace(/\\/+$/u, \"\")}/messages`);\n if (options?.debug) {\n url.searchParams.set(\"debug\", \"1\");\n }\n let payload = {\n model: model.id,\n context,\n options: {\n temperature: options?.temperature,\n maxTokens: options?.maxTokens,\n reasoning: options?.reasoning,\n cacheRetention: resolveCacheRetention(options?.cacheRetention, options?.env),\n sessionId: options?.sessionId,\n toolChoice: options?.toolChoice,\n },\n };\n const nextPayload = await options?.onPayload?.(payload, model);\n if (nextPayload !== undefined) {\n payload = nextPayload;\n }\n const response = await (options?.fetch ?? globalThis.fetch)(url, {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${apiKey}`,\n accept: \"text/event-stream\",\n \"content-type\": \"application/json\",\n ...providerHeadersToRecord(options?.headers),\n },\n body: JSON.stringify(payload),\n signal: options?.signal,\n });\n await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n if (!response.ok) {\n const body = await response.text();\n throw createPiMessagesResponseError(model, url, response, body);\n }\n if (!response.body) {\n throw new Error(`${model.provider} response has no body`);\n }\n for await (const piEvent of readPiMessagesEvents(response.body)) {\n await options?.onProviderStreamEvent?.(piEvent, model);\n const event = convertEvent(piEvent);\n eventStream.push(event);\n if (event.type === \"done\" || event.type === \"error\") {\n return;\n }\n }\n throw new Error(`${model.provider} stream ended without a terminal event`);\n }\n catch (error) {\n eventStream.push(createErrorEvent(model, error, options?.signal?.aborted ?? false));\n }\n })();\n return eventStream;\n};\nexport const streamSimple = (model, context, options) => {\n const extra = options;\n return stream(model, context, {\n ...options,\n reasoning: options?.reasoning,\n toolChoice: options?.toolChoice,\n debug: extra?.debug,\n });\n};\n//# sourceMappingURL=pi-messages.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;AAeA,IAAa,0BAAb,cAA6C,MAAM;CAC/C;CACA;CACA,YAAY,SAAS,MAAM,mBAAmB;EAC1C,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,oBAAoB;CAC7B;AACJ;AACA,SAAS,yBAAyB,MAAM;CACpC,IAAI;EACA,MAAM,SAAS,KAAK,MAAM,IAAI;EAC9B,MAAM,QAAQ,QAAQ;EACtB,OAAO,UAAU,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IAAI,SAAS,KAAA;CACrG,QACM;EACF;CACJ;AACJ;AACA,SAAS,yBAAyB,OAAO;CACrC,MAAM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AAgB,OAAO,SAAS,YAAY;CACrD,MAAM,QAAQ;CACd,OAAO,OAAO,OAAO,SAAS;EAC1B,GAAG;EACH,WAAW,SAAS;EACpB,YAAY,SAAS;EACrB,OAAO,OAAO;CAClB,CAAC;AACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SeoGraph, r as SeoEdge, s as SeoNode } from "./graph-
|
|
1
|
+
import { a as SeoGraph, r as SeoEdge, s as SeoNode } from "./graph-D1PIndsC.js";
|
|
2
2
|
//#region src/core/projections.d.ts
|
|
3
3
|
interface ProjectionConfig {
|
|
4
4
|
origin: string;
|
|
@@ -75,4 +75,4 @@ declare function renderRobots(_graph: SeoGraph, cfg: RobotsConfig): string;
|
|
|
75
75
|
declare function inspectNode(graph: SeoGraph, path: string): NodeReport | undefined;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { inspectNode as a, renderRobots as c, contentSignal as i, renderSitemap as l, ProjectionConfig as n, isSitemapEligible as o, RobotsConfig as r, lastModified as s, NodeReport as t };
|
|
78
|
-
//# sourceMappingURL=projections-
|
|
78
|
+
//# sourceMappingURL=projections-Bk-qOOsR.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { r as __require } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
|
+
//#region node_modules/@earendil-works/pi-ai/dist/utils/provider-env.js
|
|
3
|
+
let procEnvCache = null;
|
|
4
|
+
/**
|
|
5
|
+
* Fallback for https://github.com/oven-sh/bun/issues/27802.
|
|
6
|
+
* Bun compiled binaries can expose an empty process.env inside Linux sandboxes
|
|
7
|
+
* even though /proc/self/environ contains the environment.
|
|
8
|
+
*
|
|
9
|
+
* This intentionally duplicates restoreSandboxEnv() in
|
|
10
|
+
* packages/coding-agent/src/bun/restore-sandbox-env.ts. The ai package can be
|
|
11
|
+
* used directly, without going through that entrypoint, so provider env lookup
|
|
12
|
+
* must not depend on process.env having been patched.
|
|
13
|
+
*/
|
|
14
|
+
function getBunSandboxEnvValue(name) {
|
|
15
|
+
if (typeof process === "undefined" || !process.versions?.bun || Object.keys(process.env).length > 0) return;
|
|
16
|
+
if (procEnvCache === null) {
|
|
17
|
+
procEnvCache = /* @__PURE__ */ new Map();
|
|
18
|
+
try {
|
|
19
|
+
const { readFileSync } = __require("node:fs");
|
|
20
|
+
const data = readFileSync("/proc/self/environ", "utf-8");
|
|
21
|
+
for (const entry of data.split("\0")) {
|
|
22
|
+
const idx = entry.indexOf("=");
|
|
23
|
+
if (idx > 0) procEnvCache.set(entry.slice(0, idx), entry.slice(idx + 1));
|
|
24
|
+
}
|
|
25
|
+
} catch {}
|
|
26
|
+
}
|
|
27
|
+
return procEnvCache.get(name);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a provider env value from scoped overrides, normal process.env, then
|
|
31
|
+
* the duplicated Bun sandbox fallback for direct pi-ai consumers.
|
|
32
|
+
*/
|
|
33
|
+
function getProviderEnvValue(name, env) {
|
|
34
|
+
return env?.[name] || (typeof process !== "undefined" ? process.env[name] : void 0) || getBunSandboxEnvValue(name) || void 0;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getProviderEnvValue as t };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=provider-env-t38GK5FF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-env-t38GK5FF.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/utils/provider-env.js"],"sourcesContent":["let procEnvCache = null;\n/**\n * Fallback for https://github.com/oven-sh/bun/issues/27802.\n * Bun compiled binaries can expose an empty process.env inside Linux sandboxes\n * even though /proc/self/environ contains the environment.\n *\n * This intentionally duplicates restoreSandboxEnv() in\n * packages/coding-agent/src/bun/restore-sandbox-env.ts. The ai package can be\n * used directly, without going through that entrypoint, so provider env lookup\n * must not depend on process.env having been patched.\n */\nfunction getBunSandboxEnvValue(name) {\n if (typeof process === \"undefined\" || !process.versions?.bun || Object.keys(process.env).length > 0) {\n return undefined;\n }\n if (procEnvCache === null) {\n procEnvCache = new Map();\n try {\n const { readFileSync } = require(\"node:fs\");\n const data = readFileSync(\"/proc/self/environ\", \"utf-8\");\n for (const entry of data.split(\"\\0\")) {\n const idx = entry.indexOf(\"=\");\n if (idx > 0) {\n procEnvCache.set(entry.slice(0, idx), entry.slice(idx + 1));\n }\n }\n }\n catch {\n // /proc/self/environ may not exist or may not be readable.\n }\n }\n return procEnvCache.get(name);\n}\n/**\n * Resolve a provider env value from scoped overrides, normal process.env, then\n * the duplicated Bun sandbox fallback for direct pi-ai consumers.\n */\nexport function getProviderEnvValue(name, env) {\n return (env?.[name] ||\n (typeof process !== \"undefined\" ? process.env[name] : undefined) ||\n getBunSandboxEnvValue(name) ||\n undefined);\n}\n//# sourceMappingURL=provider-env.js.map"],"x_google_ignoreList":[0],"mappings":";;AAAA,IAAI,eAAe;;;;;;;;;;;AAWnB,SAAS,sBAAsB,MAAM;CACjC,IAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,UAAU,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,SAAS,GAC9F;CAEJ,IAAI,iBAAiB,MAAM;EACvB,+BAAe,IAAI,IAAI;EACvB,IAAI;GACA,MAAM,EAAE,iBAAA,UAAyB,SAAS;GAC1C,MAAM,OAAO,aAAa,sBAAsB,OAAO;GACvD,KAAK,MAAM,SAAS,KAAK,MAAM,IAAI,GAAG;IAClC,MAAM,MAAM,MAAM,QAAQ,GAAG;IAC7B,IAAI,MAAM,GACN,aAAa,IAAI,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,MAAM,MAAM,CAAC,CAAC;GAElE;EACJ,QACM,CAEN;CACJ;CACA,OAAO,aAAa,IAAI,IAAI;AAChC;;;;;AAKA,SAAgB,oBAAoB,MAAM,KAAK;CAC3C,OAAQ,MAAM,UACT,OAAO,YAAY,cAAc,QAAQ,IAAI,QAAQ,KAAA,MACtD,sBAAsB,IAAI,KAC1B,KAAA;AACR"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js
|
|
2
|
+
const DEFAULT_MAX_RETRY_DELAY_MS = 6e4;
|
|
3
|
+
function isProviderError(error) {
|
|
4
|
+
if (!(error instanceof Error) || !("status" in error) || !("headers" in error)) return false;
|
|
5
|
+
return (error.status === void 0 || typeof error.status === "number") && (error.headers === void 0 || error.headers instanceof Headers);
|
|
6
|
+
}
|
|
7
|
+
/** Mirrors the pinned OpenAI/Anthropic SDK retry policy; review when either SDK is upgraded. */
|
|
8
|
+
function isRetryableProviderError(error) {
|
|
9
|
+
const shouldRetry = error.headers?.get("x-should-retry");
|
|
10
|
+
if (shouldRetry === "true") return true;
|
|
11
|
+
if (shouldRetry === "false") return false;
|
|
12
|
+
if (error.status === void 0) return true;
|
|
13
|
+
return error.status === 408 || error.status === 409 || error.status === 429 || typeof error.status === "number" && error.status >= 500;
|
|
14
|
+
}
|
|
15
|
+
function validateServerRetryDelayMs(delayMs, maxRetryDelayMs, providerErrorMessage) {
|
|
16
|
+
const maxDelayMs = maxRetryDelayMs ?? DEFAULT_MAX_RETRY_DELAY_MS;
|
|
17
|
+
if (maxDelayMs > 0 && delayMs > maxDelayMs) throw new Error(`Server requested ${Math.ceil(delayMs / 1e3)}s retry delay (max: ${Math.ceil(maxDelayMs / 1e3)}s). ${providerErrorMessage}`);
|
|
18
|
+
return delayMs;
|
|
19
|
+
}
|
|
20
|
+
function getRetryDelayMs(error, retryIndex, maxRetryDelayMs) {
|
|
21
|
+
const retryAfterMs = error.headers?.get("retry-after-ms");
|
|
22
|
+
if (retryAfterMs) {
|
|
23
|
+
const value = Number.parseFloat(retryAfterMs);
|
|
24
|
+
if (Number.isFinite(value)) return validateServerRetryDelayMs(value, maxRetryDelayMs, error.message);
|
|
25
|
+
}
|
|
26
|
+
const retryAfter = error.headers?.get("retry-after");
|
|
27
|
+
if (retryAfter) {
|
|
28
|
+
const seconds = Number.parseFloat(retryAfter);
|
|
29
|
+
const delayMs = Number.isNaN(seconds) ? Date.parse(retryAfter) - Date.now() : seconds * 1e3;
|
|
30
|
+
if (Number.isFinite(delayMs)) return validateServerRetryDelayMs(delayMs, maxRetryDelayMs, error.message);
|
|
31
|
+
}
|
|
32
|
+
return Math.min(.5 * 2 ** retryIndex, 8) * 1e3 * (1 - Math.random() * .25);
|
|
33
|
+
}
|
|
34
|
+
function createAbortError() {
|
|
35
|
+
const error = /* @__PURE__ */ new Error("Request aborted");
|
|
36
|
+
error.name = "AbortError";
|
|
37
|
+
return error;
|
|
38
|
+
}
|
|
39
|
+
function abortableSleep(ms, signal) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
if (signal?.aborted) {
|
|
42
|
+
reject(createAbortError());
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const onAbort = () => {
|
|
46
|
+
clearTimeout(timeout);
|
|
47
|
+
reject(createAbortError());
|
|
48
|
+
};
|
|
49
|
+
const timeout = setTimeout(() => {
|
|
50
|
+
signal?.removeEventListener("abort", onAbort);
|
|
51
|
+
resolve();
|
|
52
|
+
}, Math.max(0, ms));
|
|
53
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reproduce the retry behavior used by the OpenAI and Anthropic SDKs while making
|
|
58
|
+
* their backoff sleep interruptible. Their built-in retry timers ignore the
|
|
59
|
+
* request AbortSignal, so callers must invoke the SDK with `maxRetries: 0` and
|
|
60
|
+
* wrap the request with this helper. Provider-requested delays above
|
|
61
|
+
* `maxRetryDelayMs` fail immediately (60 seconds by default); set it to zero to
|
|
62
|
+
* disable the limit.
|
|
63
|
+
*/
|
|
64
|
+
async function retryProviderRequest(request, options = {}) {
|
|
65
|
+
const maxRetries = options.maxRetries ?? 0;
|
|
66
|
+
let retriesRemaining = maxRetries;
|
|
67
|
+
for (;;) try {
|
|
68
|
+
return await request();
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (options.signal?.aborted) throw createAbortError();
|
|
71
|
+
if (retriesRemaining <= 0 || !isProviderError(error) || !isRetryableProviderError(error)) throw error;
|
|
72
|
+
const retryIndex = maxRetries - retriesRemaining;
|
|
73
|
+
retriesRemaining--;
|
|
74
|
+
await abortableSleep(getRetryDelayMs(error, retryIndex, options.maxRetryDelayMs), options.signal);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { retryProviderRequest as t };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=provider-retry-DzKoh1X7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-retry-DzKoh1X7.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js"],"sourcesContent":["const DEFAULT_MAX_RETRY_DELAY_MS = 60_000;\nfunction isProviderError(error) {\n if (!(error instanceof Error) || !(\"status\" in error) || !(\"headers\" in error))\n return false;\n return ((error.status === undefined || typeof error.status === \"number\") &&\n (error.headers === undefined || error.headers instanceof Headers));\n}\n/** Mirrors the pinned OpenAI/Anthropic SDK retry policy; review when either SDK is upgraded. */\nfunction isRetryableProviderError(error) {\n const shouldRetry = error.headers?.get(\"x-should-retry\");\n if (shouldRetry === \"true\")\n return true;\n if (shouldRetry === \"false\")\n return false;\n if (error.status === undefined)\n return true;\n return (error.status === 408 ||\n error.status === 409 ||\n error.status === 429 ||\n (typeof error.status === \"number\" && error.status >= 500));\n}\nfunction validateServerRetryDelayMs(delayMs, maxRetryDelayMs, providerErrorMessage) {\n const maxDelayMs = maxRetryDelayMs ?? DEFAULT_MAX_RETRY_DELAY_MS;\n if (maxDelayMs > 0 && delayMs > maxDelayMs) {\n throw new Error(`Server requested ${Math.ceil(delayMs / 1000)}s retry delay (max: ${Math.ceil(maxDelayMs / 1000)}s). ${providerErrorMessage}`);\n }\n return delayMs;\n}\nfunction getRetryDelayMs(error, retryIndex, maxRetryDelayMs) {\n const retryAfterMs = error.headers?.get(\"retry-after-ms\");\n if (retryAfterMs) {\n const value = Number.parseFloat(retryAfterMs);\n if (Number.isFinite(value))\n return validateServerRetryDelayMs(value, maxRetryDelayMs, error.message);\n }\n const retryAfter = error.headers?.get(\"retry-after\");\n if (retryAfter) {\n const seconds = Number.parseFloat(retryAfter);\n const delayMs = Number.isNaN(seconds) ? Date.parse(retryAfter) - Date.now() : seconds * 1000;\n if (Number.isFinite(delayMs))\n return validateServerRetryDelayMs(delayMs, maxRetryDelayMs, error.message);\n }\n const exponentialDelay = Math.min(0.5 * 2 ** retryIndex, 8) * 1000;\n return exponentialDelay * (1 - Math.random() * 0.25);\n}\nfunction createAbortError() {\n const error = new Error(\"Request aborted\");\n error.name = \"AbortError\";\n return error;\n}\nfunction abortableSleep(ms, signal) {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(createAbortError());\n return;\n }\n const onAbort = () => {\n clearTimeout(timeout);\n reject(createAbortError());\n };\n const timeout = setTimeout(() => {\n signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, Math.max(0, ms));\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n/**\n * Reproduce the retry behavior used by the OpenAI and Anthropic SDKs while making\n * their backoff sleep interruptible. Their built-in retry timers ignore the\n * request AbortSignal, so callers must invoke the SDK with `maxRetries: 0` and\n * wrap the request with this helper. Provider-requested delays above\n * `maxRetryDelayMs` fail immediately (60 seconds by default); set it to zero to\n * disable the limit.\n */\nexport async function retryProviderRequest(request, options = {}) {\n const maxRetries = options.maxRetries ?? 0;\n let retriesRemaining = maxRetries;\n for (;;) {\n try {\n // Each retry is a fresh SDK request, so X-Stainless-Retry-Count remains zero.\n return await request();\n }\n catch (error) {\n if (options.signal?.aborted)\n throw createAbortError();\n if (retriesRemaining <= 0 || !isProviderError(error) || !isRetryableProviderError(error))\n throw error;\n const retryIndex = maxRetries - retriesRemaining;\n retriesRemaining--;\n await abortableSleep(getRetryDelayMs(error, retryIndex, options.maxR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UAAU;EACxF,IAAI,OAAO,SAAS,OAAO,GACvB,OAAO,2BAA2B,SAAS,iBAAiB,MAAM,OAAO;CACjF;CAEA,OADyB,KAAK,IAAI,KAAM,KAAK,YAAY,CAAC,IAAI,OACnC,IAAI,KAAK,OAAO,IAAI;AACnD;AACA,SAAS,mBAAmB;CACxB,MAAM,wBAAQ,IAAI,MAAM,iBAAiB;CACzC,MAAM,OAAO;CACb,OAAO;AACX;AACA,SAAS,eAAe,IAAI,QAAQ;CAChC,OAAO,IAAI,SAAS,SAAS,WAAW;EACpC,IAAI,QAAQ,SAAS;GACjB,OAAO,iBAAiB,CAAC;GACzB;EACJ;EACA,MAAM,gBAAgB;GAClB,aAAa,OAAO;GACpB,OAAO,iBAAiB,CAAC;EAC7B;EACA,MAAM,UAAU,iBAAiB;GAC7B,QAAQ,oBAAoB,SAAS,OAAO;GAC5C,QAAQ;EACZ,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC;EAClB,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CAC7D,CAAC;AACL;;;;;;;;;AASA,eAAsB,qBAAqB,SAAS,UAAU,CAAC,GAAG;CAC9D,MAAM,aAAa,QAAQ,cAAc;CACzC,IAAI,mBAAmB;CACvB,SACI,IAAI;EAEA,OAAO,MAAM,QAAQ;CACzB,SACO,OAAO;EACV,IAAI,QAAQ,QAAQ,SAChB,MAAM,iBAAiB;EAC3B,IAAI,oBAAoB,KAAK,CAAC,gBAAgB,KAAK,KAAK,CAAC,yBAAyB,KAAK,GACnF,MAAM;EACV,MAAM,aAAa,aAAa;EAChC;EACA,MAAM,eAAe,gBAAgB,OAAO,YAAY,QAAQ,eAAe,GAAG,QAAQ,MAAM;CACpG;AAER"}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as WithContext, C as FAQPage, D as Service, E as Organization, O as Thing, S as BreadcrumbList, T as ItemList, f as JsonLdDocument, g as SeoFaq, j as IdReference, k as WebSite, v as SeoPageHead, w as Graph, x as Article } from "./graph-D1PIndsC.js";
|
|
2
|
+
import { a as Fact, c as ForHumans, d as Title, f as Visual, g as useCapturePage, h as messageText, i as DocumentProvider, l as Section, m as finishDocument, n as CaptureRequest, o as FactId, p as createCollector, r as Collector, s as ForAgents, t as CaptureAnchor, u as T } from "./document-CztEu3Vd.js";
|
|
2
3
|
import { AnyRouteMatch } from "@tanstack/react-router";
|
|
3
4
|
//#region src/react/json-ld-composition.d.ts
|
|
4
5
|
/** Any schema.org entity accepted by `schema-dts`. */
|
|
@@ -223,5 +224,5 @@ declare function Breadcrumbs({ className }: {
|
|
|
223
224
|
className?: string | undefined;
|
|
224
225
|
}): import("react").JSX.Element | null;
|
|
225
226
|
//#endregion
|
|
226
|
-
export { type ArticleParams, type BreadcrumbItem, Breadcrumbs, type CrumbTrailItem, type ItemListEntry, type JsonLd, type JsonLdDocument, type JsonLdEntityIds, type JsonLdEntry, type JsonLdNode, type JsonLdTransform, type JsonLdTransformContext, type JsonLdTransformResult, type Seo, type SeoConfig, type SeoFaq, type SeoHead, type SeoHeadCtx, type SeoJsonLdConfig, type SeoOrganization, type SeoPageHead, type SeoPostalAddress, type SeoSite, type SeoWebsite, type ServiceParams, composeJsonLd, createSeo, defineJsonLd, extendJsonLd, jsonLdGraph, jsonLdRef, resolveCrumbTrail };
|
|
227
|
+
export { type ArticleParams, type BreadcrumbItem, Breadcrumbs, CaptureAnchor, CaptureRequest, type Collector, type CrumbTrailItem, DocumentProvider, Fact, type FactId, ForAgents, ForHumans, type ItemListEntry, type JsonLd, type JsonLdDocument, type JsonLdEntityIds, type JsonLdEntry, type JsonLdNode, type JsonLdTransform, type JsonLdTransformContext, type JsonLdTransformResult, Section, type Seo, type SeoConfig, type SeoFaq, type SeoHead, type SeoHeadCtx, type SeoJsonLdConfig, type SeoOrganization, type SeoPageHead, type SeoPostalAddress, type SeoSite, type SeoWebsite, type ServiceParams, T, Title, Visual, composeJsonLd, createCollector, createSeo, defineJsonLd, extendJsonLd, finishDocument, jsonLdGraph, jsonLdRef, messageText, resolveCrumbTrail, useCapturePage };
|
|
227
228
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as applyTitleTemplate } from "./declare-D5o7hwmv.js";
|
|
2
|
+
import { a as ForAgents, c as T, d as createCollector, f as finishDocument, i as Fact, l as Title, m as useCapturePage, n as CaptureRequest, o as ForHumans, p as messageText, r as DocumentProvider, s as Section, t as CaptureAnchor, u as Visual } from "./document-Dvemcv7V.js";
|
|
2
3
|
import { Link, useMatches } from "@tanstack/react-router";
|
|
3
4
|
import { Fragment } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -415,6 +416,6 @@ function createSeo(config) {
|
|
|
415
416
|
};
|
|
416
417
|
}
|
|
417
418
|
//#endregion
|
|
418
|
-
export { Breadcrumbs, composeJsonLd, createSeo, defineJsonLd, extendJsonLd, jsonLdGraph, jsonLdRef, resolveCrumbTrail };
|
|
419
|
+
export { Breadcrumbs, CaptureAnchor, CaptureRequest, DocumentProvider, Fact, ForAgents, ForHumans, Section, T, Title, Visual, composeJsonLd, createCollector, createSeo, defineJsonLd, extendJsonLd, finishDocument, jsonLdGraph, jsonLdRef, messageText, resolveCrumbTrail, useCapturePage };
|
|
419
420
|
|
|
420
421
|
//# sourceMappingURL=react.js.map
|