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,167 @@
|
|
|
1
|
+
import { t as calculateCost } from "./models-DcT5qOEL.js";
|
|
2
|
+
import { n as providerHeadersToRecord, t as headersToRecord } from "./headers-BRNMVpzu.js";
|
|
3
|
+
import { t as retryProviderRequest } from "./provider-retry-DzKoh1X7.js";
|
|
4
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-CyiejW4b.js";
|
|
5
|
+
//#region node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js
|
|
6
|
+
function httpError(label, response, body) {
|
|
7
|
+
const error = /* @__PURE__ */ new Error(`${label} returned ${response.status}`);
|
|
8
|
+
error.status = response.status;
|
|
9
|
+
error.headers = response.headers;
|
|
10
|
+
error.body = body;
|
|
11
|
+
return error;
|
|
12
|
+
}
|
|
13
|
+
function timeoutError(timeoutMs) {
|
|
14
|
+
const error = /* @__PURE__ */ new Error(`Request timed out after ${timeoutMs}ms`);
|
|
15
|
+
error.name = "TimeoutError";
|
|
16
|
+
error.status = void 0;
|
|
17
|
+
error.headers = void 0;
|
|
18
|
+
error.body = "";
|
|
19
|
+
return error;
|
|
20
|
+
}
|
|
21
|
+
function isRecord(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function requiredNumber(label, value, field) {
|
|
25
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${label} returned an invalid ${field}`);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
function probabilities(label, value, id) {
|
|
29
|
+
if (!isRecord(value)) throw new Error(`${label} returned invalid probabilities for ${id}`);
|
|
30
|
+
return Object.fromEntries(Object.entries(value).map(([key, probability]) => [key, requiredNumber(label, probability, `probability for ${id}.${key}`)]));
|
|
31
|
+
}
|
|
32
|
+
function parseAnswers(label, value, context) {
|
|
33
|
+
if (!isRecord(value)) throw new Error(`${label} returned an unexpected response`);
|
|
34
|
+
const answers = [];
|
|
35
|
+
for (const [id, question] of Object.entries(context.questions)) {
|
|
36
|
+
const answer = value[id];
|
|
37
|
+
if (!isRecord(answer)) throw new Error(`${label} did not return an answer for ${id}`);
|
|
38
|
+
if (question.type === "choice") {
|
|
39
|
+
if (answer.type !== "choice" || typeof answer.choice !== "string") throw new Error(`${label} did not return a choice answer for ${id}`);
|
|
40
|
+
answers.push([id, {
|
|
41
|
+
type: "choice",
|
|
42
|
+
choice: answer.choice,
|
|
43
|
+
probabilities: probabilities(label, answer.probabilities, id),
|
|
44
|
+
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
45
|
+
}]);
|
|
46
|
+
} else if (question.type === "score") {
|
|
47
|
+
if (answer.type !== "score") throw new Error(`${label} did not return a score answer for ${id}`);
|
|
48
|
+
answers.push([id, {
|
|
49
|
+
type: "score",
|
|
50
|
+
score: requiredNumber(label, answer.score, `score for ${id}`),
|
|
51
|
+
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
52
|
+
}]);
|
|
53
|
+
} else {
|
|
54
|
+
if (answer.type !== "noul") throw new Error(`${label} did not return a bool answer for ${id}`);
|
|
55
|
+
answers.push([id, {
|
|
56
|
+
type: "bool",
|
|
57
|
+
probability: requiredNumber(label, answer.noul, `probability for ${id}`)
|
|
58
|
+
}]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return Object.fromEntries(answers);
|
|
62
|
+
}
|
|
63
|
+
function tokenCount(value) {
|
|
64
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Usage from System One's `{ input_tokens, output_tokens }`, priced from the model catalog like chat
|
|
68
|
+
* usage. A missing or malformed usage object leaves the result without usage instead of failing it.
|
|
69
|
+
*/
|
|
70
|
+
function parseUsage(value, model) {
|
|
71
|
+
if (!isRecord(value) || value.input_tokens === void 0 && value.output_tokens === void 0) return void 0;
|
|
72
|
+
const input = tokenCount(value.input_tokens);
|
|
73
|
+
const output = tokenCount(value.output_tokens);
|
|
74
|
+
const usage = {
|
|
75
|
+
input,
|
|
76
|
+
output,
|
|
77
|
+
cacheRead: 0,
|
|
78
|
+
cacheWrite: 0,
|
|
79
|
+
totalTokens: input + output,
|
|
80
|
+
cost: {
|
|
81
|
+
input: 0,
|
|
82
|
+
output: 0,
|
|
83
|
+
cacheRead: 0,
|
|
84
|
+
cacheWrite: 0,
|
|
85
|
+
total: 0
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
calculateCost(model, usage);
|
|
89
|
+
return usage;
|
|
90
|
+
}
|
|
91
|
+
/** Maps public `bool` questions to TypeSafe's wire-level `noul` type. */
|
|
92
|
+
function wireRequest(context) {
|
|
93
|
+
return {
|
|
94
|
+
state: context.state,
|
|
95
|
+
questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [id, question.type === "bool" ? {
|
|
96
|
+
...question,
|
|
97
|
+
type: "noul"
|
|
98
|
+
} : question]))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function requestHeaders(model, apiKey, optionsHeaders) {
|
|
102
|
+
return providerHeadersToRecord({
|
|
103
|
+
authorization: `Bearer ${apiKey}`,
|
|
104
|
+
"content-type": "application/json"
|
|
105
|
+
}, model.headers, optionsHeaders) ?? {};
|
|
106
|
+
}
|
|
107
|
+
/** Runs one System One classification over the given transport. */
|
|
108
|
+
async function classifySystemOne(transport, model, context, options) {
|
|
109
|
+
const output = {
|
|
110
|
+
api: model.api,
|
|
111
|
+
provider: model.provider,
|
|
112
|
+
model: model.id,
|
|
113
|
+
answers: {},
|
|
114
|
+
stopReason: "stop",
|
|
115
|
+
timestamp: Date.now()
|
|
116
|
+
};
|
|
117
|
+
try {
|
|
118
|
+
if (model.api !== transport.api) throw new Error(`Unsupported classifier API: ${model.api}`);
|
|
119
|
+
if (!options?.apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
120
|
+
const apiKey = options.apiKey;
|
|
121
|
+
let payload = transport.payload(model, wireRequest(context));
|
|
122
|
+
const transformed = await options.onPayload?.(payload, model);
|
|
123
|
+
if (transformed !== void 0) payload = transformed;
|
|
124
|
+
const requestFetch = options.fetch ?? globalThis.fetch;
|
|
125
|
+
const { response, body } = await retryProviderRequest(async () => {
|
|
126
|
+
const timeoutSignal = options.timeoutMs !== void 0 ? AbortSignal.timeout(options.timeoutMs) : void 0;
|
|
127
|
+
const signal = options.signal && timeoutSignal ? AbortSignal.any([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
|
|
128
|
+
try {
|
|
129
|
+
const next = await requestFetch(transport.url(model), {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: requestHeaders(model, apiKey, options.headers),
|
|
132
|
+
body: JSON.stringify(payload),
|
|
133
|
+
signal
|
|
134
|
+
});
|
|
135
|
+
if (!next.ok) throw httpError(transport.label, next, await next.text());
|
|
136
|
+
return {
|
|
137
|
+
response: next,
|
|
138
|
+
body: await next.json()
|
|
139
|
+
};
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (timeoutSignal?.aborted && !options.signal?.aborted) throw timeoutError(options.timeoutMs);
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
maxRetries: options.maxRetries ?? 2,
|
|
146
|
+
maxRetryDelayMs: options.maxRetryDelayMs,
|
|
147
|
+
signal: options.signal
|
|
148
|
+
});
|
|
149
|
+
await options.onResponse?.({
|
|
150
|
+
status: response.status,
|
|
151
|
+
headers: headersToRecord(response.headers)
|
|
152
|
+
}, model);
|
|
153
|
+
const result = transport.output(body);
|
|
154
|
+
const usage = parseUsage(result.usage, model);
|
|
155
|
+
if (usage) output.usage = usage;
|
|
156
|
+
output.answers = parseAnswers(transport.label, result.answers, context);
|
|
157
|
+
return output;
|
|
158
|
+
} catch (error) {
|
|
159
|
+
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
160
|
+
output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);
|
|
161
|
+
return output;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { isRecord as n, classifySystemOne as t };
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=system-one-shared-Dl10ZF7Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-one-shared-Dl10ZF7Z.js","names":[],"sources":["../node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js"],"sourcesContent":["import { calculateCost } from \"../models.js\";\nimport { formatProviderError, normalizeProviderError } from \"../utils/error-body.js\";\nimport { headersToRecord, providerHeadersToRecord } from \"../utils/headers.js\";\nimport { retryProviderRequest } from \"../utils/provider-retry.js\";\nfunction httpError(label, response, body) {\n const error = new Error(`${label} returned ${response.status}`);\n error.status = response.status;\n error.headers = response.headers;\n error.body = body;\n return error;\n}\nfunction timeoutError(timeoutMs) {\n const error = new Error(`Request timed out after ${timeoutMs}ms`);\n error.name = \"TimeoutError\";\n error.status = undefined;\n error.headers = undefined;\n error.body = \"\";\n return error;\n}\nexport function isRecord(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction requiredNumber(label, value, field) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new Error(`${label} returned an invalid ${field}`);\n }\n return value;\n}\nfunction probabilities(label, value, id) {\n if (!isRecord(value))\n throw new Error(`${label} returned invalid probabilities for ${id}`);\n return Object.fromEntries(Object.entries(value).map(([key, probability]) => [\n key,\n requiredNumber(label, probability, `probability for ${id}.${key}`),\n ]));\n}\nfunction parseAnswers(label, value, context) {\n if (!isRecord(value))\n throw new Error(`${label} returned an unexpected response`);\n const answers = [];\n for (const [id, question] of Object.entries(context.questions)) {\n const answer = value[id];\n if (!isRecord(answer))\n throw new Error(`${label} did not return an answer for ${id}`);\n if (question.type === \"choice\") {\n if (answer.type !== \"choice\" || typeof answer.choice !== \"string\") {\n throw new Error(`${label} did not return a choice answer for ${id}`);\n }\n answers.push([\n id,\n {\n type: \"choice\",\n choice: answer.choice,\n probabilities: probabilities(label, answer.probabilities, id),\n confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`),\n },\n ]);\n }\n else if (question.type === \"score\") {\n if (answer.type !== \"score\")\n throw new Error(`${label} did not return a score answer for ${id}`);\n answers.push([\n id,\n {\n type: \"score\",\n score: requiredNumber(label, answer.score, `score for ${id}`),\n confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`),\n },\n ]);\n }\n else {\n if (answer.type !== \"noul\")\n throw new Error(`${label} did not return a bool answer for ${id}`);\n answers.push([\n id,\n {\n type: \"bool\",\n probability: requiredNumber(label, answer.noul, `probability for ${id}`),\n },\n ]);\n }\n }\n return Object.fromEntries(answers);\n}\nfunction tokenCount(value) {\n return typeof value === \"number\" && Number.isFinite(value) && value > 0 ? value : 0;\n}\n/**\n * Usage from System One's `{ input_tokens, output_tokens }`, priced from the model catalog like chat\n * usage. A missing or malformed usage object leaves the result without usage instead of failing it.\n */\nfunction parseUsage(value, model) {\n if (!isRecord(value) || (value.input_tokens === undefined && value.output_tokens === undefined))\n return undefined;\n const input = tokenCount(value.input_tokens);\n const output = tokenCount(value.output_tokens);\n const usage = {\n input,\n output,\n cacheRead: 0,\n cacheWrite: 0,\n totalTokens: input + output,\n cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n };\n calculateCost(model, usage);\n return usage;\n}\n/** Maps public `bool` questions to TypeSafe's wire-level `noul` type. */\nfunction wireRequest(context) {\n return {\n state: context.state,\n questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [\n id,\n question.type === \"bool\" ? { ...question, type: \"noul\" } : question,\n ])),\n };\n}\nfunction requestHeaders(model, apiKey, optionsHeaders) {\n return (providerHeadersToRecord({ authorization: `Bearer ${apiKey}`, \"content-type\": \"application/json\" }, model.headers, optionsHeaders) ?? {});\n}\n/** Runs one System One classification over the given transport. */\nexport async function classifySystemOne(transport, model, context, options) {\n const output = {\n api: model.api,\n provider: model.provider,\n model: model.id,\n answers: {},\n stopReason: \"stop\",\n timestamp: Date.now(),\n };\n try {\n if (model.api !== transport.api)\n throw new Error(`Unsupported classifier API: ${model.api}`);\n if (!options?.apiKey)\n throw new Error(`No API key for provider: ${model.provider}`);\n const apiKey = options.apiKey;\n let payload = transport.payload(model, wireRequest(context));\n const transformed = await options.onPayload?.(payload, model);\n if (transformed !== undefined)\n payload = transformed;\n const requestFetch = options.fetch ?? globalThis.fetch;\n const { response, body } = await retryProviderRequest(async () => {\n const timeoutSignal = options.timeoutMs !== undefined ? AbortSignal.timeout(options.timeoutMs) : undefined;\n const signal = options.signal && timeoutSignal\n ? AbortSignal.any([options.signal, timeoutSignal])\n : (options.signal ?? timeoutSignal);\n try {\n const next = await requestFetch(transport.url(model), {\n method: \"POST\",\n headers: requestHeaders(model, apiKey, options.headers),\n body: JSON.stringify(payload),\n signal,\n });\n if (!next.ok)\n throw httpError(transport.label, next, await next.text());\n return { response: next, body: (await next.json()) };\n }\n catch (error) {\n if (timeoutSignal?.aborted && !options.signal?.aborted)\n throw timeoutError(options.timeoutMs);\n throw error;\n }\n }, {\n maxRetries: options.maxRetries ?? 2,\n maxRetryDelayMs: options.maxRetryDelayMs,\n signal: options.signal,\n });\n await options.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);\n const result = transport.output(body);\n // Set before parsing answers: a request with malformed answers was still billed.\n const usage = parseUsage(result.usage, model);\n if (usage)\n output.usage = usage;\n output.answers = parseAnswers(transport.label, result.answers, context);\n return output;\n }\n catch (error) {\n output.stopReason = options?.signal?.aborted ? \"aborted\" : \"error\";\n output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);\n return output;\n }\n}\n//# sourceMappingURL=system-one-shared.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;AAIA,SAAS,UAAU,OAAO,UAAU,MAAM;CACtC,MAAM,wBAAQ,IAAI,MAAM,GAAG,MAAM,YAAY,SAAS,QAAQ;CAC9D,MAAM,SAAS,SAAS;CACxB,MAAM,UAAU,SAAS;CACzB,MAAM,OAAO;CACb,OAAO;AACX;AACA,SAAS,aAAa,WAAW;CAC7B,MAAM,wBAAQ,IAAI,MAAM,2BAA2B,UAAU,GAAG;CAChE,MAAM,OAAO;CACb,MAAM,SAAS,KAAA;CACf,MAAM,UAAU,KAAA;CAChB,MAAM,OAAO;CACb,OAAO;AACX;AACA,SAAgB,SAAS,OAAO;CAC5B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC9E;AACA,SAAS,eAAe,OAAO,OAAO,OAAO;CACzC,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,GACnD,MAAM,IAAI,MAAM,GAAG,MAAM,uBAAuB,OAAO;CAE3D,OAAO;AACX;AACA,SAAS,cAAc,OAAO,OAAO,IAAI;CACrC,IAAI,CAAC,SAAS,KAAK,GACf,MAAM,IAAI,MAAM,GAAG,MAAM,sCAAsC,IAAI;CACvE,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,iBAAiB,CACxE,KACA,eAAe,OAAO,aAAa,mBAAmB,GAAG,GAAG,KAAK,CACrE,CAAC,CAAC;AACN;AACA,SAAS,aAAa,OAAO,O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
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as SiteRuntime, n as PagegraphOptions, r as RobotsPolicy, t as AppGraph } from "../graph-CBIY71w6.js";
|
|
1
|
+
import { a as SiteRuntime, c as AppGraph, i as SeoGraphLoader, l as PagegraphOptions, r as LoadedSeoGraph, u as RobotsPolicy } from "../vite-graph-loader-DZCwejuJ.js";
|
|
3
2
|
import { Plugin } from "vite";
|
|
4
3
|
//#region src/tanstack-start/plugin.d.ts
|
|
5
|
-
|
|
4
|
+
/** Start prerenders this private endpoint once; its callback writes public Markdown twins. */
|
|
5
|
+
interface MarkdownPrerenderPage {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly sitemap: {
|
|
8
|
+
readonly exclude: true;
|
|
9
|
+
};
|
|
10
|
+
readonly prerender: {
|
|
11
|
+
readonly onSuccess: (result: {
|
|
12
|
+
html: string;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
type PagegraphPlugins = Array<Plugin> & {
|
|
17
|
+
readonly prerenderPages: Array<MarkdownPrerenderPage>;
|
|
18
|
+
};
|
|
19
|
+
declare function pagegraph(options: PagegraphOptions): PagegraphPlugins;
|
|
6
20
|
//#endregion
|
|
7
21
|
//#region src/tanstack-start/load.d.ts
|
|
8
22
|
interface EvaluateAppGraphOptions {
|
|
9
|
-
/**
|
|
23
|
+
/** Directory used to find the Vite config and as its default root. */
|
|
10
24
|
readonly root: string;
|
|
25
|
+
/** Vite command to evaluate. Graph evaluation defaults to `serve`. */
|
|
26
|
+
readonly command?: "serve" | "build" | undefined;
|
|
11
27
|
/** The app's Vite config file. Defaults to Vite's lookup from `root`. */
|
|
12
28
|
readonly configFile?: string | undefined;
|
|
13
29
|
/**
|
|
@@ -17,24 +33,24 @@ interface EvaluateAppGraphOptions {
|
|
|
17
33
|
readonly mode?: string | undefined;
|
|
18
34
|
}
|
|
19
35
|
/**
|
|
20
|
-
* Resolve the app's Vite config
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* `mode` for the deployment the graph should describe.
|
|
36
|
+
* Resolve the app's Vite config, evaluate the graph in its `pagegraph`
|
|
37
|
+
* environment, and release it. The command defaults to `serve`; callers can
|
|
38
|
+
* request `build` to match the deployed site configuration.
|
|
24
39
|
*/
|
|
25
|
-
declare function evaluateAppGraph(options: EvaluateAppGraphOptions): Promise<AppGraph
|
|
40
|
+
declare function evaluateAppGraph(options: EvaluateAppGraphOptions): Promise<AppGraph & {
|
|
41
|
+
readonly pagegraph: NonNullable<LoadedSeoGraph["pagegraph"]>;
|
|
42
|
+
}>;
|
|
26
43
|
/**
|
|
27
|
-
* A `
|
|
28
|
-
*
|
|
44
|
+
* A `pagegraph.config.ts` graph loader for a TanStack Start app. It uses the
|
|
45
|
+
* built site's identity by default; pass `command: "serve"` for a dev host.
|
|
29
46
|
*
|
|
30
47
|
* ```ts
|
|
31
48
|
* export default defineSeoConfig({
|
|
32
|
-
* origin: "https://example.com",
|
|
33
49
|
* loadGraph: tanstackStartGraph({ root: import.meta.dirname }),
|
|
34
50
|
* });
|
|
35
51
|
* ```
|
|
36
52
|
*/
|
|
37
53
|
declare const tanstackStartGraph: (options: EvaluateAppGraphOptions) => SeoGraphLoader;
|
|
38
54
|
//#endregion
|
|
39
|
-
export { type AppGraph, type EvaluateAppGraphOptions, type PagegraphOptions, type RobotsPolicy, type SiteRuntime, evaluateAppGraph, pagegraph, tanstackStartGraph };
|
|
55
|
+
export { type AppGraph, type EvaluateAppGraphOptions, type MarkdownPrerenderPage, type PagegraphOptions, type PagegraphPlugins, type RobotsPolicy, type SiteRuntime, evaluateAppGraph, pagegraph, tanstackStartGraph };
|
|
40
56
|
//# sourceMappingURL=index.d.ts.map
|