@tonyclaw/agent-inspector 3.0.15 → 3.0.17
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/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-UaIxykqz.js → CompareDrawer-Lx-WeJNC.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-DlpfcX56.js → ProxyViewerContainer-BNehwMI0.js} +31 -31
- package/.output/public/assets/{ReplayDialog-BFFomU1m.js → ReplayDialog-CADaXFPE.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-DKQJBt_c.js → RequestAnatomy-CGoL8ACh.js} +1 -1
- package/.output/public/assets/{ResponseView-D7yotmne.js → ResponseView-BSwM1dCH.js} +2 -2
- package/.output/public/assets/{StreamingChunkSequence-Da-6WNFG.js → StreamingChunkSequence-qhWtSx3D.js} +1 -1
- package/.output/public/assets/{_sessionId-ByTXLS-w.js → _sessionId-2uq_HB8p.js} +1 -1
- package/.output/public/assets/index-BHXN1Fsx.css +1 -0
- package/.output/public/assets/{index-BrM8t5mc.js → index-DPc2wzgW.js} +1 -1
- package/.output/public/assets/index-T0u1foYL.js +1 -0
- package/.output/public/assets/{json-viewer-DyjXQdVu.js → json-viewer-uIwLntt-.js} +1 -1
- package/.output/public/assets/{main-Zv_gjZMb.js → main-DuFBHsus.js} +7 -7
- package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +2658 -0
- package/.output/server/_libs/agent-base.mjs +234 -0
- package/.output/server/_libs/anthropic-ai__sdk.mjs +6042 -0
- package/.output/server/_libs/atomically.mjs +3 -0
- package/.output/server/_libs/base64-js.mjs +102 -0
- package/.output/server/_libs/bignumber.js.mjs +1353 -0
- package/.output/server/_libs/buffer-equal-constant-time.mjs +38 -0
- package/.output/server/_libs/data-uri-to-buffer.mjs +39 -0
- package/.output/server/_libs/debug.mjs +547 -0
- package/.output/server/_libs/ecdsa-sig-formatter.mjs +162 -0
- package/.output/server/_libs/extend.mjs +2 -1
- package/.output/server/_libs/fetch-blob.mjs +287 -0
- package/.output/server/_libs/formdata-polyfill.mjs +88 -0
- package/.output/server/_libs/gaxios.mjs +927 -0
- package/.output/server/_libs/gcp-metadata.mjs +322 -0
- package/.output/server/_libs/google-auth-library.mjs +6339 -0
- package/.output/server/_libs/google-logging-utils.mjs +385 -0
- package/.output/server/_libs/google__genai.mjs +18034 -0
- package/.output/server/_libs/has-flag.mjs +16 -0
- package/.output/server/_libs/https-proxy-agent.mjs +280 -0
- package/.output/server/_libs/json-bigint.mjs +413 -0
- package/.output/server/_libs/jwa.mjs +233 -0
- package/.output/server/_libs/jws.mjs +298 -0
- package/.output/server/_libs/lucide-react.mjs +261 -226
- package/.output/server/_libs/mariozechner__pi-agent-core.mjs +824 -0
- package/.output/server/_libs/mariozechner__pi-ai.mjs +22889 -0
- package/.output/server/_libs/mistralai__mistralai.mjs +32045 -0
- package/.output/server/_libs/ms.mjs +120 -0
- package/.output/server/_libs/node-domexception.mjs +17 -0
- package/.output/server/_libs/node-fetch.mjs +1578 -0
- package/.output/server/_libs/ohash.mjs +1 -1
- package/.output/server/_libs/openai.mjs +6766 -0
- package/.output/server/_libs/opentelemetry__api.mjs +1678 -0
- package/.output/server/_libs/p-retry.mjs +87 -0
- package/.output/server/_libs/partial-json.mjs +244 -0
- package/.output/server/_libs/react-dom.mjs +5 -5
- package/.output/server/_libs/react-markdown.mjs +2 -2
- package/.output/server/_libs/react.mjs +30 -0
- package/.output/server/_libs/readable-stream.mjs +5 -5
- package/.output/server/_libs/retry.mjs +236 -0
- package/.output/server/_libs/safe-buffer.mjs +63 -1
- package/.output/server/_libs/srvx.mjs +2 -2
- package/.output/server/_libs/supports-color.mjs +108 -0
- package/.output/server/_libs/tanstack__router-core.mjs +1 -1
- package/.output/server/_libs/typebox.mjs +6596 -0
- package/.output/server/_libs/util-deprecate.mjs +2 -2
- package/.output/server/_libs/vfile.mjs +2 -2
- package/.output/server/_libs/web-streams-polyfill.mjs +4282 -0
- package/.output/server/_libs/ws.mjs +3715 -0
- package/.output/server/_libs/zod-to-json-schema.mjs +1207 -0
- package/.output/server/_libs/zod.mjs +597 -9
- package/.output/server/{_sessionId-GcFhWT0i.mjs → _sessionId-DL2JQJwR.mjs} +14 -13
- package/.output/server/_ssr/{CompareDrawer-BV7dw1TN.mjs → CompareDrawer-hPTOTmyU.mjs} +14 -13
- package/.output/server/_ssr/{ProxyViewerContainer-CcgfvaS4.mjs → ProxyViewerContainer-k0mFaufl.mjs} +161 -91
- package/.output/server/_ssr/{ReplayDialog-B7sBKxIO.mjs → ReplayDialog-t6QdwnZh.mjs} +15 -14
- package/.output/server/_ssr/{RequestAnatomy-s_9Veje2.mjs → RequestAnatomy-BnvWxyac.mjs} +14 -13
- package/.output/server/_ssr/{ResponseView-DsOFPCvF.mjs → ResponseView-BhhozRRl.mjs} +14 -13
- package/.output/server/_ssr/{StreamingChunkSequence-CyA1XtiF.mjs → StreamingChunkSequence-Dl_laTbX.mjs} +14 -13
- package/.output/server/_ssr/{index-CDDRt201.mjs → index-D1-t1D8F.mjs} +25 -15
- package/.output/server/_ssr/index.mjs +4 -4
- package/.output/server/_ssr/{json-viewer-BFV-xtRM.mjs → json-viewer-D5Lh2yBU.mjs} +14 -13
- package/.output/server/_ssr/{router-B2Q7vHPM.mjs → router-DaLFEeWW.mjs} +597 -100
- package/.output/server/_tanstack-start-manifest_v-DsSiD2gY.mjs +4 -0
- package/.output/server/index.mjs +77 -77
- package/package.json +4 -1
- package/src/components/ProxyViewer.tsx +12 -4
- package/src/components/pi-agent/PiAgentPanel.tsx +204 -0
- package/src/lib/chunkLoadRecovery.ts +83 -0
- package/src/lib/piAgentContract.ts +21 -0
- package/src/routes/__root.tsx +6 -3
- package/src/routes/api/pi-agent.ts +29 -0
- package/src/routes/index.tsx +25 -1
- package/src/routes/session/$sessionId.tsx +1 -0
- package/src/services/piAgent.ts +390 -0
- package/.output/public/assets/index-CGpPRty8.js +0 -1
- package/.output/public/assets/index-HRfrFVYw.css +0 -1
- package/.output/server/_tanstack-start-manifest_v-Dm_GmuRz.mjs +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createRouter, a as createRootRoute, b as createFileRoute, l as lazyRouteComponent, O as Outlet, H as HeadContent, S as Scripts } from "../_libs/tanstack__react-router.mjs";
|
|
2
|
-
import { j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
+
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
3
3
|
import { S as SWRConfig } from "../_libs/swr.mjs";
|
|
4
4
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, renameSync, copyFileSync, unlinkSync, createReadStream, readdirSync, statSync, rmSync, cpSync, createWriteStream } from "node:fs";
|
|
5
5
|
import fs, { mkdir, appendFile, readFile, writeFile, readdir, open, stat, unlink, rm, rename } from "node:fs/promises";
|
|
@@ -16,16 +16,16 @@ import { Worker } from "node:worker_threads";
|
|
|
16
16
|
import { M as McpServer, W as WebStandardStreamableHTTPServerTransport, R as ResourceTemplate } from "../_libs/modelcontextprotocol__server.mjs";
|
|
17
17
|
import { J as JSZip } from "../_libs/jszip.mjs";
|
|
18
18
|
import { homedir } from "node:os";
|
|
19
|
-
import { d as object, b as string, a as array, r as record, _ as _enum, u as union,
|
|
19
|
+
import { d as object, b as string, a as array, n as number, r as record, _ as _enum, u as union, c as boolean, e as unknown, l as literal, h as _null, k as lazy, g as discriminatedUnion } from "../_libs/zod.mjs";
|
|
20
20
|
import "../_libs/tiny-warning.mjs";
|
|
21
21
|
import "../_libs/tanstack__router-core.mjs";
|
|
22
22
|
import "../_libs/cookie-es.mjs";
|
|
23
23
|
import "../_libs/seroval.mjs";
|
|
24
24
|
import "../_libs/seroval-plugins.mjs";
|
|
25
|
+
import "node:stream";
|
|
25
26
|
import "../_libs/tanstack__history.mjs";
|
|
26
27
|
import "../_libs/tiny-invariant.mjs";
|
|
27
28
|
import "node:stream/web";
|
|
28
|
-
import "node:stream";
|
|
29
29
|
import "../_libs/react-dom.mjs";
|
|
30
30
|
import "util";
|
|
31
31
|
import "async_hooks";
|
|
@@ -38,6 +38,7 @@ import "node:assert";
|
|
|
38
38
|
import "../_libs/dot-prop.mjs";
|
|
39
39
|
import "../_libs/env-paths.mjs";
|
|
40
40
|
import "../_libs/atomically.mjs";
|
|
41
|
+
import "node:events";
|
|
41
42
|
import "../_libs/stubborn-fs.mjs";
|
|
42
43
|
import "../_libs/stubborn-utils.mjs";
|
|
43
44
|
import "../_libs/when-exit.mjs";
|
|
@@ -65,8 +66,76 @@ import "../_libs/immediate.mjs";
|
|
|
65
66
|
import "../_libs/setimmediate.mjs";
|
|
66
67
|
import "../_libs/pako.mjs";
|
|
67
68
|
const faviconSvg = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Agent%20Inspector'%3e%3cg%20fill='none'%20stroke='%23f59e0b'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20%3e%3cpath%20d='M5%2013%20C5%209%208%207%2012%207%20C16%207%2019%209%2019%2013%20C19%2016%2016%2018%2012%2018%20C8%2018%205%2016%205%2013%20Z'%20/%3e%3cpath%20d='M5%2011%20C3.5%209.5%201.5%2010%202%2012.5%20C2.5%2014%204%2013.5%205%2012.5'%20/%3e%3cpath%20d='M19%2011%20C20.5%209.5%2022.5%2010%2022%2012.5%20C21.5%2014%2020%2013.5%2019%2012.5'%20/%3e%3cline%20x1='10'%20y1='7'%20x2='9.5'%20y2='5'%20/%3e%3cline%20x1='14'%20y1='7'%20x2='14.5'%20y2='5'%20/%3e%3cline%20x1='6.5'%20y1='16'%20x2='4.5'%20y2='19.5'%20/%3e%3cline%20x1='9'%20y1='17.5'%20x2='8'%20y2='20.5'%20/%3e%3cline%20x1='15'%20y1='17.5'%20x2='16'%20y2='20.5'%20/%3e%3cline%20x1='17.5'%20y1='16'%20x2='19.5'%20y2='19.5'%20/%3e%3c/g%3e%3ccircle%20cx='9.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3ccircle%20cx='14.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3c/svg%3e";
|
|
68
|
-
const appCss = "/assets/index-
|
|
69
|
-
const
|
|
69
|
+
const appCss = "/assets/index-BHXN1Fsx.css";
|
|
70
|
+
const CHUNK_LOAD_RELOAD_AT_KEY = "agent-inspector.chunkLoadReloadAt";
|
|
71
|
+
const CHUNK_LOAD_RELOAD_WINDOW_MS = 15e3;
|
|
72
|
+
const CHUNK_LOAD_FAILURE_PATTERNS = [
|
|
73
|
+
"failed to fetch dynamically imported module",
|
|
74
|
+
"failed to load module script",
|
|
75
|
+
"importing a module script failed",
|
|
76
|
+
"error loading dynamically imported module",
|
|
77
|
+
"loading chunk",
|
|
78
|
+
"unable to preload css"
|
|
79
|
+
];
|
|
80
|
+
function messageFromReason(reason) {
|
|
81
|
+
if (reason instanceof Error) {
|
|
82
|
+
return reason.message;
|
|
83
|
+
}
|
|
84
|
+
if (typeof reason === "string") {
|
|
85
|
+
return reason;
|
|
86
|
+
}
|
|
87
|
+
return "";
|
|
88
|
+
}
|
|
89
|
+
function isChunkLoadFailureMessage(message) {
|
|
90
|
+
const normalizedMessage = message.toLowerCase();
|
|
91
|
+
return CHUNK_LOAD_FAILURE_PATTERNS.some((pattern) => normalizedMessage.includes(pattern));
|
|
92
|
+
}
|
|
93
|
+
function readLastReloadAt() {
|
|
94
|
+
const storedValue = window.sessionStorage.getItem(CHUNK_LOAD_RELOAD_AT_KEY);
|
|
95
|
+
if (storedValue === null) {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
const parsedValue = Number(storedValue);
|
|
99
|
+
return Number.isFinite(parsedValue) ? parsedValue : 0;
|
|
100
|
+
}
|
|
101
|
+
function reloadOnceForChunkFailure() {
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
const lastReloadAt = readLastReloadAt();
|
|
104
|
+
if (now - lastReloadAt < CHUNK_LOAD_RELOAD_WINDOW_MS) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
window.sessionStorage.setItem(CHUNK_LOAD_RELOAD_AT_KEY, String(now));
|
|
108
|
+
window.location.reload();
|
|
109
|
+
}
|
|
110
|
+
function installChunkLoadRecovery() {
|
|
111
|
+
if (typeof window === "undefined") {
|
|
112
|
+
return () => {
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const handleUnhandledRejection = (event) => {
|
|
116
|
+
const message = messageFromReason(event.reason);
|
|
117
|
+
if (!isChunkLoadFailureMessage(message)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
reloadOnceForChunkFailure();
|
|
122
|
+
};
|
|
123
|
+
const handleError = (event) => {
|
|
124
|
+
const message = event.message !== "" ? event.message : messageFromReason(event.error);
|
|
125
|
+
if (!isChunkLoadFailureMessage(message)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
reloadOnceForChunkFailure();
|
|
130
|
+
};
|
|
131
|
+
window.addEventListener("unhandledrejection", handleUnhandledRejection);
|
|
132
|
+
window.addEventListener("error", handleError);
|
|
133
|
+
return () => {
|
|
134
|
+
window.removeEventListener("unhandledrejection", handleUnhandledRejection);
|
|
135
|
+
window.removeEventListener("error", handleError);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const Route$M = createRootRoute({
|
|
70
139
|
head: () => ({
|
|
71
140
|
meta: [
|
|
72
141
|
{ charSet: "utf-8" },
|
|
@@ -82,6 +151,7 @@ const Route$L = createRootRoute({
|
|
|
82
151
|
notFoundComponent: RootNotFoundComponent
|
|
83
152
|
});
|
|
84
153
|
function RootComponent() {
|
|
154
|
+
reactExports.useEffect(() => installChunkLoadRecovery(), []);
|
|
85
155
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(RootDocument, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {}) });
|
|
86
156
|
}
|
|
87
157
|
function RootNotFoundComponent() {
|
|
@@ -100,16 +170,17 @@ function RootNotFoundComponent() {
|
|
|
100
170
|
] }) }) }) });
|
|
101
171
|
}
|
|
102
172
|
function RootDocument({ children }) {
|
|
103
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("html", { lang: "en", className: "dark", children: [
|
|
173
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("html", { lang: "en", className: "dark", suppressHydrationWarning: true, children: [
|
|
104
174
|
/* @__PURE__ */ jsxRuntimeExports.jsx("head", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeadContent, {}) }),
|
|
105
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("body", { children: [
|
|
175
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("body", { suppressHydrationWarning: true, children: [
|
|
106
176
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SWRConfig, { value: { revalidateOnFocus: false, revalidateIfStale: false }, children }),
|
|
107
177
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Scripts, {})
|
|
108
178
|
] })
|
|
109
179
|
] });
|
|
110
180
|
}
|
|
111
|
-
const $$splitComponentImporter$1 = () => import("./index-
|
|
112
|
-
const Route$
|
|
181
|
+
const $$splitComponentImporter$1 = () => import("./index-D1-t1D8F.mjs");
|
|
182
|
+
const Route$L = createFileRoute("/")({
|
|
183
|
+
ssr: false,
|
|
113
184
|
component: lazyRouteComponent($$splitComponentImporter$1, "component")
|
|
114
185
|
});
|
|
115
186
|
const B64URL_RE = /^[A-Za-z0-9_-]+$/;
|
|
@@ -151,8 +222,9 @@ function decodeSessionIdFromPath(encoded) {
|
|
|
151
222
|
function getSessionPath(sessionId) {
|
|
152
223
|
return `/session/${encodeSessionIdForPath(sessionId)}`;
|
|
153
224
|
}
|
|
154
|
-
const $$splitComponentImporter = () => import("../_sessionId-
|
|
155
|
-
const Route$
|
|
225
|
+
const $$splitComponentImporter = () => import("../_sessionId-DL2JQJwR.mjs");
|
|
226
|
+
const Route$K = createFileRoute("/session/$sessionId")({
|
|
227
|
+
ssr: false,
|
|
156
228
|
component: lazyRouteComponent($$splitComponentImporter, "component"),
|
|
157
229
|
parseParams: (params) => ({
|
|
158
230
|
sessionId: decodeSessionIdFromPath(params.sessionId)
|
|
@@ -1061,7 +1133,7 @@ function objectFromUnknown$1(value) {
|
|
|
1061
1133
|
if (typeof value === "object" || typeof value === "function") return value;
|
|
1062
1134
|
return null;
|
|
1063
1135
|
}
|
|
1064
|
-
function readProperty$
|
|
1136
|
+
function readProperty$5(value, name2) {
|
|
1065
1137
|
let current = objectFromUnknown$1(value);
|
|
1066
1138
|
while (current !== null) {
|
|
1067
1139
|
const desc = Object.getOwnPropertyDescriptor(current, name2);
|
|
@@ -1075,7 +1147,7 @@ function readProperty$4(value, name2) {
|
|
|
1075
1147
|
return void 0;
|
|
1076
1148
|
}
|
|
1077
1149
|
function readFunction$1(value, name2) {
|
|
1078
|
-
const property = readProperty$
|
|
1150
|
+
const property = readProperty$5(value, name2);
|
|
1079
1151
|
return typeof property === "function" ? property : null;
|
|
1080
1152
|
}
|
|
1081
1153
|
function callMethod$1(target, methodName, args) {
|
|
@@ -1117,7 +1189,7 @@ function execSql$1(db, sql) {
|
|
|
1117
1189
|
return result !== void 0;
|
|
1118
1190
|
}
|
|
1119
1191
|
function sqliteConstructorFromModule$1(moduleValue, exportName) {
|
|
1120
|
-
const exportedValue = readProperty$
|
|
1192
|
+
const exportedValue = readProperty$5(moduleValue, exportName);
|
|
1121
1193
|
if (typeof exportedValue === "function") {
|
|
1122
1194
|
return (path2) => Reflect.construct(exportedValue, [path2]);
|
|
1123
1195
|
}
|
|
@@ -1260,11 +1332,11 @@ function entryParams(entry) {
|
|
|
1260
1332
|
];
|
|
1261
1333
|
}
|
|
1262
1334
|
function readNumber$1(row, name2) {
|
|
1263
|
-
const value = readProperty$
|
|
1335
|
+
const value = readProperty$5(row, name2);
|
|
1264
1336
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1265
1337
|
}
|
|
1266
1338
|
function readString$2(row, name2) {
|
|
1267
|
-
const value = readProperty$
|
|
1339
|
+
const value = readProperty$5(row, name2);
|
|
1268
1340
|
return typeof value === "string" ? value : null;
|
|
1269
1341
|
}
|
|
1270
1342
|
function readBoolean(row, name2) {
|
|
@@ -2130,7 +2202,7 @@ function objectFromUnknown(value) {
|
|
|
2130
2202
|
if (typeof value === "object" || typeof value === "function") return value;
|
|
2131
2203
|
return null;
|
|
2132
2204
|
}
|
|
2133
|
-
function readProperty$
|
|
2205
|
+
function readProperty$4(value, name2) {
|
|
2134
2206
|
let current = objectFromUnknown(value);
|
|
2135
2207
|
while (current !== null) {
|
|
2136
2208
|
const desc = Object.getOwnPropertyDescriptor(current, name2);
|
|
@@ -2144,7 +2216,7 @@ function readProperty$3(value, name2) {
|
|
|
2144
2216
|
return void 0;
|
|
2145
2217
|
}
|
|
2146
2218
|
function readFunction(value, name2) {
|
|
2147
|
-
const property = readProperty$
|
|
2219
|
+
const property = readProperty$4(value, name2);
|
|
2148
2220
|
return typeof property === "function" ? property : null;
|
|
2149
2221
|
}
|
|
2150
2222
|
function callMethod(target, methodName, args) {
|
|
@@ -2182,7 +2254,7 @@ function closeDatabase(db) {
|
|
|
2182
2254
|
callMethod(db, "close", []);
|
|
2183
2255
|
}
|
|
2184
2256
|
function sqliteConstructorFromModule(moduleValue, exportName) {
|
|
2185
|
-
const exportedValue = readProperty$
|
|
2257
|
+
const exportedValue = readProperty$4(moduleValue, exportName);
|
|
2186
2258
|
if (typeof exportedValue === "function") {
|
|
2187
2259
|
return (path2) => Reflect.construct(exportedValue, [path2]);
|
|
2188
2260
|
}
|
|
@@ -2273,11 +2345,11 @@ async function archiveSessionLog(log) {
|
|
|
2273
2345
|
}
|
|
2274
2346
|
}
|
|
2275
2347
|
function readString$1(row, name2) {
|
|
2276
|
-
const value = readProperty$
|
|
2348
|
+
const value = readProperty$4(row, name2);
|
|
2277
2349
|
return typeof value === "string" ? value : null;
|
|
2278
2350
|
}
|
|
2279
2351
|
function readNumber(row, name2) {
|
|
2280
|
-
const value = readProperty$
|
|
2352
|
+
const value = readProperty$4(row, name2);
|
|
2281
2353
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
2282
2354
|
}
|
|
2283
2355
|
function logFromJson(value) {
|
|
@@ -4117,24 +4189,24 @@ const anthropicProvider = {
|
|
|
4117
4189
|
};
|
|
4118
4190
|
registry.register(anthropicProvider);
|
|
4119
4191
|
const MAX_CHUNKS = 1e3;
|
|
4120
|
-
function readProperty$
|
|
4192
|
+
function readProperty$3(value, key) {
|
|
4121
4193
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
4122
4194
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
4123
4195
|
}
|
|
4124
4196
|
function readStringProperty$2(value, key) {
|
|
4125
|
-
const property = readProperty$
|
|
4197
|
+
const property = readProperty$3(value, key);
|
|
4126
4198
|
return typeof property === "string" ? property : null;
|
|
4127
4199
|
}
|
|
4128
4200
|
function readNumberProperty(value, key) {
|
|
4129
|
-
const property = readProperty$
|
|
4201
|
+
const property = readProperty$3(value, key);
|
|
4130
4202
|
return typeof property === "number" && Number.isFinite(property) ? property : null;
|
|
4131
4203
|
}
|
|
4132
4204
|
function readObjectProperty(value, key) {
|
|
4133
|
-
const property = readProperty$
|
|
4205
|
+
const property = readProperty$3(value, key);
|
|
4134
4206
|
return property !== null && typeof property === "object" && !Array.isArray(property) ? property : null;
|
|
4135
4207
|
}
|
|
4136
4208
|
function readArrayProperty$1(value, key) {
|
|
4137
|
-
const property = readProperty$
|
|
4209
|
+
const property = readProperty$3(value, key);
|
|
4138
4210
|
return Array.isArray(property) ? property : [];
|
|
4139
4211
|
}
|
|
4140
4212
|
function parseSseEvents(raw) {
|
|
@@ -4326,7 +4398,7 @@ function extractChatCompletionsStream(events, log, fallbackModel, collectChunks)
|
|
|
4326
4398
|
}
|
|
4327
4399
|
function parseResponsesResponse(value) {
|
|
4328
4400
|
const fromResponseProperty = OpenAIResponsesResponseSchema.safeParse(
|
|
4329
|
-
readProperty$
|
|
4401
|
+
readProperty$3(value, "response")
|
|
4330
4402
|
);
|
|
4331
4403
|
if (fromResponseProperty.success) return fromResponseProperty.data;
|
|
4332
4404
|
const direct = OpenAIResponsesResponseSchema.safeParse(value);
|
|
@@ -6338,30 +6410,30 @@ function parseJson$1(raw) {
|
|
|
6338
6410
|
return { ok: false };
|
|
6339
6411
|
}
|
|
6340
6412
|
}
|
|
6341
|
-
function isRecord$
|
|
6413
|
+
function isRecord$2(value) {
|
|
6342
6414
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6343
6415
|
}
|
|
6344
|
-
function readProperty$
|
|
6345
|
-
if (!isRecord$
|
|
6416
|
+
function readProperty$2(value, key) {
|
|
6417
|
+
if (!isRecord$2(value)) return void 0;
|
|
6346
6418
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
6347
6419
|
}
|
|
6348
6420
|
function hasOwnProperty(value, key) {
|
|
6349
6421
|
return Object.getOwnPropertyDescriptor(value, key) !== void 0;
|
|
6350
6422
|
}
|
|
6351
6423
|
function readString(value, key) {
|
|
6352
|
-
const property = readProperty$
|
|
6424
|
+
const property = readProperty$2(value, key);
|
|
6353
6425
|
return typeof property === "string" ? property : null;
|
|
6354
6426
|
}
|
|
6355
6427
|
function readArray(value, key) {
|
|
6356
|
-
const property = readProperty$
|
|
6428
|
+
const property = readProperty$2(value, key);
|
|
6357
6429
|
return Array.isArray(property) ? property : [];
|
|
6358
6430
|
}
|
|
6359
6431
|
function readStringArray(value, key) {
|
|
6360
6432
|
return readArray(value, key).filter((item) => typeof item === "string");
|
|
6361
6433
|
}
|
|
6362
6434
|
function readObject(value, key) {
|
|
6363
|
-
const property = readProperty$
|
|
6364
|
-
return isRecord$
|
|
6435
|
+
const property = readProperty$2(value, key);
|
|
6436
|
+
return isRecord$2(property) ? property : null;
|
|
6365
6437
|
}
|
|
6366
6438
|
function normalizeExpectedType(typeName) {
|
|
6367
6439
|
switch (typeName) {
|
|
@@ -6378,7 +6450,7 @@ function normalizeExpectedType(typeName) {
|
|
|
6378
6450
|
}
|
|
6379
6451
|
}
|
|
6380
6452
|
function schemaTypes(schema) {
|
|
6381
|
-
const typeValue = readProperty$
|
|
6453
|
+
const typeValue = readProperty$2(schema, "type");
|
|
6382
6454
|
const rawTypes = Array.isArray(typeValue) ? typeValue : [typeValue];
|
|
6383
6455
|
const types = [];
|
|
6384
6456
|
for (const rawType of rawTypes) {
|
|
@@ -6406,7 +6478,7 @@ function actualType(value) {
|
|
|
6406
6478
|
case "function":
|
|
6407
6479
|
case "object":
|
|
6408
6480
|
case "symbol":
|
|
6409
|
-
return isRecord$
|
|
6481
|
+
return isRecord$2(value) ? "object" : "unknown";
|
|
6410
6482
|
}
|
|
6411
6483
|
return "unknown";
|
|
6412
6484
|
}
|
|
@@ -6423,7 +6495,7 @@ function matchesExpectedType(value, expected) {
|
|
|
6423
6495
|
case "number":
|
|
6424
6496
|
return typeof value === "number" && Number.isFinite(value);
|
|
6425
6497
|
case "object":
|
|
6426
|
-
return isRecord$
|
|
6498
|
+
return isRecord$2(value);
|
|
6427
6499
|
case "string":
|
|
6428
6500
|
return typeof value === "string";
|
|
6429
6501
|
}
|
|
@@ -6468,7 +6540,7 @@ function schemaAllowsObjectValidation(schema, expectedTypes) {
|
|
|
6468
6540
|
return expectedTypes.includes("object");
|
|
6469
6541
|
}
|
|
6470
6542
|
function schemaAllowsArrayValidation(schema, expectedTypes) {
|
|
6471
|
-
if (expectedTypes.length === 0) return readProperty$
|
|
6543
|
+
if (expectedTypes.length === 0) return readProperty$2(schema, "items") !== void 0;
|
|
6472
6544
|
return expectedTypes.includes("array");
|
|
6473
6545
|
}
|
|
6474
6546
|
function addTypeWarning(warnings, toolName, path2, expectedTypes, value) {
|
|
@@ -6501,7 +6573,7 @@ function validateObjectSchema(schema, value, toolName, path2, warnings) {
|
|
|
6501
6573
|
}
|
|
6502
6574
|
}
|
|
6503
6575
|
function validateArraySchema(schema, value, toolName, path2, warnings) {
|
|
6504
|
-
const itemsSchema = readProperty$
|
|
6576
|
+
const itemsSchema = readProperty$2(schema, "items");
|
|
6505
6577
|
if (itemsSchema === void 0) return;
|
|
6506
6578
|
let index = 0;
|
|
6507
6579
|
for (const item of value) {
|
|
@@ -6510,7 +6582,7 @@ function validateArraySchema(schema, value, toolName, path2, warnings) {
|
|
|
6510
6582
|
}
|
|
6511
6583
|
}
|
|
6512
6584
|
function validateEnum(schema, value, toolName, path2, warnings) {
|
|
6513
|
-
const enumValue = readProperty$
|
|
6585
|
+
const enumValue = readProperty$2(schema, "enum");
|
|
6514
6586
|
if (Array.isArray(enumValue) && enumValue.length > 0 && !enumMatches(value, enumValue)) {
|
|
6515
6587
|
warnings.push(
|
|
6516
6588
|
`Tool call "${toolName}" ${pathLabel(path2)} expected one of ${formatJsonValue(
|
|
@@ -6528,7 +6600,7 @@ function validateEnum(schema, value, toolName, path2, warnings) {
|
|
|
6528
6600
|
}
|
|
6529
6601
|
}
|
|
6530
6602
|
function validateValueAgainstSchema(schema, value, toolName, path2, warnings) {
|
|
6531
|
-
if (!isRecord$
|
|
6603
|
+
if (!isRecord$2(schema)) return;
|
|
6532
6604
|
const expectedTypes = schemaTypes(schema);
|
|
6533
6605
|
if (expectedTypes.length > 0 && !matchesAnyExpectedType(value, expectedTypes)) {
|
|
6534
6606
|
addTypeWarning(warnings, toolName, path2, expectedTypes, value);
|
|
@@ -6536,7 +6608,7 @@ function validateValueAgainstSchema(schema, value, toolName, path2, warnings) {
|
|
|
6536
6608
|
}
|
|
6537
6609
|
validateEnum(schema, value, toolName, path2, warnings);
|
|
6538
6610
|
if (schemaAllowsObjectValidation(schema, expectedTypes)) {
|
|
6539
|
-
if (isRecord$
|
|
6611
|
+
if (isRecord$2(value)) {
|
|
6540
6612
|
validateObjectSchema(schema, value, toolName, path2, warnings);
|
|
6541
6613
|
} else if (expectedTypes.length === 0) {
|
|
6542
6614
|
warnings.push(
|
|
@@ -6557,7 +6629,7 @@ function validateValueAgainstSchema(schema, value, toolName, path2, warnings) {
|
|
|
6557
6629
|
function extractAnthropicToolSchemas(request) {
|
|
6558
6630
|
const tools = /* @__PURE__ */ new Map();
|
|
6559
6631
|
for (const tool of readArray(request, "tools")) {
|
|
6560
|
-
if (!isRecord$
|
|
6632
|
+
if (!isRecord$2(tool)) continue;
|
|
6561
6633
|
const name2 = readString(tool, "name");
|
|
6562
6634
|
if (name2 === null || name2 === "") continue;
|
|
6563
6635
|
tools.set(name2, {
|
|
@@ -6627,7 +6699,7 @@ function extractOpenAIToolCalls(response) {
|
|
|
6627
6699
|
for (const call of readArray(message, "tool_calls")) {
|
|
6628
6700
|
const functionCall = readObject(call, "function");
|
|
6629
6701
|
const name2 = functionCall === null ? null : readString(functionCall, "name");
|
|
6630
|
-
const parsedArguments = functionCall === null ? { value: {}, issue: "function block is missing" } : parseOpenAIArguments(readProperty$
|
|
6702
|
+
const parsedArguments = functionCall === null ? { value: {}, issue: "function block is missing" } : parseOpenAIArguments(readProperty$2(functionCall, "arguments"));
|
|
6631
6703
|
calls.push({
|
|
6632
6704
|
name: name2,
|
|
6633
6705
|
arguments: parsedArguments.value,
|
|
@@ -6638,7 +6710,7 @@ function extractOpenAIToolCalls(response) {
|
|
|
6638
6710
|
}
|
|
6639
6711
|
const legacyFunctionCall = readObject(message, "function_call");
|
|
6640
6712
|
if (legacyFunctionCall !== null) {
|
|
6641
|
-
const parsedArguments = parseOpenAIArguments(readProperty$
|
|
6713
|
+
const parsedArguments = parseOpenAIArguments(readProperty$2(legacyFunctionCall, "arguments"));
|
|
6642
6714
|
calls.push({
|
|
6643
6715
|
name: readString(legacyFunctionCall, "name"),
|
|
6644
6716
|
arguments: parsedArguments.value,
|
|
@@ -6654,7 +6726,7 @@ function extractOpenAIToolCalls(response) {
|
|
|
6654
6726
|
outputIndex++;
|
|
6655
6727
|
continue;
|
|
6656
6728
|
}
|
|
6657
|
-
const parsedArguments = parseOpenAIArguments(readProperty$
|
|
6729
|
+
const parsedArguments = parseOpenAIArguments(readProperty$2(item, "arguments"));
|
|
6658
6730
|
calls.push({
|
|
6659
6731
|
name: readString(item, "name"),
|
|
6660
6732
|
arguments: parsedArguments.value,
|
|
@@ -6675,7 +6747,7 @@ function extractAnthropicToolCalls(response) {
|
|
|
6675
6747
|
}
|
|
6676
6748
|
calls.push({
|
|
6677
6749
|
name: readString(block, "name"),
|
|
6678
|
-
arguments: readProperty$
|
|
6750
|
+
arguments: readProperty$2(block, "input") ?? {},
|
|
6679
6751
|
argumentIssue: null,
|
|
6680
6752
|
location: `content[${contentIndex}]`
|
|
6681
6753
|
});
|
|
@@ -7625,7 +7697,7 @@ async function handleProxy(req) {
|
|
|
7625
7697
|
}
|
|
7626
7698
|
return handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log, captureFullDetails);
|
|
7627
7699
|
}
|
|
7628
|
-
const Route$
|
|
7700
|
+
const Route$J = createFileRoute("/proxy/$")({
|
|
7629
7701
|
server: {
|
|
7630
7702
|
handlers: {
|
|
7631
7703
|
GET: ({ request }) => handleProxy(request),
|
|
@@ -7646,7 +7718,7 @@ function parsePositiveInt$4(value) {
|
|
|
7646
7718
|
function parseBooleanFlag(value) {
|
|
7647
7719
|
return value === "1" || value === "true";
|
|
7648
7720
|
}
|
|
7649
|
-
const Route$
|
|
7721
|
+
const Route$I = createFileRoute("/api/sessions")({
|
|
7650
7722
|
server: {
|
|
7651
7723
|
handlers: {
|
|
7652
7724
|
GET: async ({ request }) => {
|
|
@@ -9111,7 +9183,7 @@ function parsePositiveInt$3(value, fallback) {
|
|
|
9111
9183
|
if (!Number.isInteger(parsed) || parsed < 1) return fallback;
|
|
9112
9184
|
return parsed;
|
|
9113
9185
|
}
|
|
9114
|
-
const Route$
|
|
9186
|
+
const Route$H = createFileRoute("/api/runs")({
|
|
9115
9187
|
server: {
|
|
9116
9188
|
handlers: {
|
|
9117
9189
|
GET: ({ request }) => {
|
|
@@ -9157,7 +9229,7 @@ const ProviderInputSchema = object({
|
|
|
9157
9229
|
modelMetadata: array(ProviderModelMetadataSchema).optional(),
|
|
9158
9230
|
source: _enum(["company", "personal"]).optional()
|
|
9159
9231
|
});
|
|
9160
|
-
const Route$
|
|
9232
|
+
const Route$G = createFileRoute("/api/providers")({
|
|
9161
9233
|
server: {
|
|
9162
9234
|
handlers: {
|
|
9163
9235
|
GET: ({ request }) => {
|
|
@@ -9192,6 +9264,422 @@ const Route$F = createFileRoute("/api/providers")({
|
|
|
9192
9264
|
}
|
|
9193
9265
|
}
|
|
9194
9266
|
});
|
|
9267
|
+
const PiAgentRequestSchema = object({
|
|
9268
|
+
question: string().trim().min(1).max(4e3),
|
|
9269
|
+
sessionId: string().trim().min(1).optional(),
|
|
9270
|
+
providerId: string().trim().min(1).optional(),
|
|
9271
|
+
model: string().trim().min(1).optional(),
|
|
9272
|
+
logLimit: number().int().min(1).max(80).optional()
|
|
9273
|
+
});
|
|
9274
|
+
const PiAgentResponseSchema = object({
|
|
9275
|
+
answer: string(),
|
|
9276
|
+
providerId: string(),
|
|
9277
|
+
providerName: string(),
|
|
9278
|
+
model: string(),
|
|
9279
|
+
protocol: _enum(["openaiResponses", "openaiChat", "anthropic"]),
|
|
9280
|
+
logCount: number().int().nonnegative()
|
|
9281
|
+
});
|
|
9282
|
+
function isRecord$1(value) {
|
|
9283
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9284
|
+
}
|
|
9285
|
+
function normalizeAnthropicStopReason(value) {
|
|
9286
|
+
switch (value) {
|
|
9287
|
+
case "end_turn":
|
|
9288
|
+
case "tool_use":
|
|
9289
|
+
return value;
|
|
9290
|
+
case "max_tokens":
|
|
9291
|
+
return "length";
|
|
9292
|
+
default:
|
|
9293
|
+
return null;
|
|
9294
|
+
}
|
|
9295
|
+
}
|
|
9296
|
+
function normalizeOpenAIFinishReason(value) {
|
|
9297
|
+
switch (value) {
|
|
9298
|
+
case "stop":
|
|
9299
|
+
case "length":
|
|
9300
|
+
return value;
|
|
9301
|
+
case "max_tokens":
|
|
9302
|
+
return "length";
|
|
9303
|
+
default:
|
|
9304
|
+
return null;
|
|
9305
|
+
}
|
|
9306
|
+
}
|
|
9307
|
+
function isResponsesLengthLimitReason(value) {
|
|
9308
|
+
switch (value) {
|
|
9309
|
+
case "max_output_tokens":
|
|
9310
|
+
case "max_tokens":
|
|
9311
|
+
return true;
|
|
9312
|
+
default:
|
|
9313
|
+
return false;
|
|
9314
|
+
}
|
|
9315
|
+
}
|
|
9316
|
+
function extractStopReason(log) {
|
|
9317
|
+
if (log.responseText === null) return null;
|
|
9318
|
+
try {
|
|
9319
|
+
let json = JSON.parse(log.responseText);
|
|
9320
|
+
if (typeof json === "string") {
|
|
9321
|
+
json = JSON.parse(json);
|
|
9322
|
+
}
|
|
9323
|
+
if (!isRecord$1(json)) return null;
|
|
9324
|
+
if (typeof json.stop_reason === "string") {
|
|
9325
|
+
return normalizeAnthropicStopReason(json.stop_reason);
|
|
9326
|
+
}
|
|
9327
|
+
if (Array.isArray(json.choices)) {
|
|
9328
|
+
for (const choice of json.choices) {
|
|
9329
|
+
if (!isRecord$1(choice) || typeof choice.finish_reason !== "string") continue;
|
|
9330
|
+
const reason = normalizeOpenAIFinishReason(choice.finish_reason);
|
|
9331
|
+
if (reason !== null) return reason;
|
|
9332
|
+
}
|
|
9333
|
+
}
|
|
9334
|
+
if (Array.isArray(json.output)) {
|
|
9335
|
+
for (const item of json.output) {
|
|
9336
|
+
if (isRecord$1(item) && item.type === "function_call") {
|
|
9337
|
+
return "tool_use";
|
|
9338
|
+
}
|
|
9339
|
+
}
|
|
9340
|
+
if (json.status === "completed") {
|
|
9341
|
+
return "stop";
|
|
9342
|
+
}
|
|
9343
|
+
}
|
|
9344
|
+
if (json.status === "incomplete" && isRecord$1(json.incomplete_details)) {
|
|
9345
|
+
const reason = json.incomplete_details.reason;
|
|
9346
|
+
if (typeof reason === "string" && isResponsesLengthLimitReason(reason)) {
|
|
9347
|
+
return "length";
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9350
|
+
return null;
|
|
9351
|
+
} catch {
|
|
9352
|
+
return null;
|
|
9353
|
+
}
|
|
9354
|
+
}
|
|
9355
|
+
function isTurnBoundary(stopReason) {
|
|
9356
|
+
return stopReason === "end_turn" || stopReason === "stop" || stopReason === "length";
|
|
9357
|
+
}
|
|
9358
|
+
const DEFAULT_LOG_LIMIT = 24;
|
|
9359
|
+
const MAX_TEXT_SNIPPET = 900;
|
|
9360
|
+
const MAX_CONTEXT_CHARS = 18e3;
|
|
9361
|
+
const PI_AGENT_MAX_OUTPUT_TOKENS = 900;
|
|
9362
|
+
const DEFAULT_CONTEXT_WINDOW = 128e3;
|
|
9363
|
+
function nonEmpty(value) {
|
|
9364
|
+
return value !== void 0 && value.trim() !== "" ? value.trim() : void 0;
|
|
9365
|
+
}
|
|
9366
|
+
function firstModel(provider) {
|
|
9367
|
+
const explicitModel = nonEmpty(provider.model);
|
|
9368
|
+
if (explicitModel !== void 0) return explicitModel;
|
|
9369
|
+
for (const model of provider.models) {
|
|
9370
|
+
const trimmed = nonEmpty(model);
|
|
9371
|
+
if (trimmed !== void 0) return trimmed;
|
|
9372
|
+
}
|
|
9373
|
+
return void 0;
|
|
9374
|
+
}
|
|
9375
|
+
function providerCandidates(request) {
|
|
9376
|
+
if (request.providerId === void 0) {
|
|
9377
|
+
return getProviders().toSorted((left, right) => {
|
|
9378
|
+
const leftCompanyRank = left.source === "company" ? 0 : 1;
|
|
9379
|
+
const rightCompanyRank = right.source === "company" ? 0 : 1;
|
|
9380
|
+
if (leftCompanyRank !== rightCompanyRank) return leftCompanyRank - rightCompanyRank;
|
|
9381
|
+
return left.name.localeCompare(right.name);
|
|
9382
|
+
});
|
|
9383
|
+
}
|
|
9384
|
+
const provider = getProvider(request.providerId);
|
|
9385
|
+
return provider === void 0 ? [] : [provider];
|
|
9386
|
+
}
|
|
9387
|
+
function selectProvider(request) {
|
|
9388
|
+
for (const provider of providerCandidates(request)) {
|
|
9389
|
+
const modelName = request.model ?? firstModel(provider);
|
|
9390
|
+
if (modelName === void 0) continue;
|
|
9391
|
+
const responsesBaseUrl = nonEmpty(provider.openaiResponsesBaseUrl);
|
|
9392
|
+
if (responsesBaseUrl !== void 0) {
|
|
9393
|
+
return {
|
|
9394
|
+
provider,
|
|
9395
|
+
modelName,
|
|
9396
|
+
protocol: "openaiResponses",
|
|
9397
|
+
api: "openai-responses",
|
|
9398
|
+
baseUrl: responsesBaseUrl,
|
|
9399
|
+
upstreamPath: "/v1/responses"
|
|
9400
|
+
};
|
|
9401
|
+
}
|
|
9402
|
+
const openaiBaseUrl = nonEmpty(provider.openaiBaseUrl);
|
|
9403
|
+
if (openaiBaseUrl !== void 0) {
|
|
9404
|
+
return {
|
|
9405
|
+
provider,
|
|
9406
|
+
modelName,
|
|
9407
|
+
protocol: "openaiChat",
|
|
9408
|
+
api: "openai-completions",
|
|
9409
|
+
baseUrl: openaiBaseUrl,
|
|
9410
|
+
upstreamPath: "/v1/chat/completions"
|
|
9411
|
+
};
|
|
9412
|
+
}
|
|
9413
|
+
const anthropicBaseUrl = nonEmpty(provider.anthropicBaseUrl);
|
|
9414
|
+
if (anthropicBaseUrl !== void 0) {
|
|
9415
|
+
return {
|
|
9416
|
+
provider,
|
|
9417
|
+
modelName,
|
|
9418
|
+
protocol: "anthropic",
|
|
9419
|
+
api: "anthropic-messages",
|
|
9420
|
+
baseUrl: anthropicBaseUrl,
|
|
9421
|
+
upstreamPath: "/v1/messages"
|
|
9422
|
+
};
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9425
|
+
return null;
|
|
9426
|
+
}
|
|
9427
|
+
function truncate$1(value, maxLength) {
|
|
9428
|
+
if (value.length <= maxLength) return value;
|
|
9429
|
+
return `${value.slice(0, maxLength)}
|
|
9430
|
+
...[truncated ${String(value.length - maxLength)} chars]`;
|
|
9431
|
+
}
|
|
9432
|
+
function readProperty$1(value, key) {
|
|
9433
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
9434
|
+
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
9435
|
+
}
|
|
9436
|
+
function collectStringProperties(value, keys, output) {
|
|
9437
|
+
if (value === null || typeof value !== "object") return;
|
|
9438
|
+
for (const key of keys) {
|
|
9439
|
+
const property = readProperty$1(value, key);
|
|
9440
|
+
if (typeof property === "string" && property.trim() !== "") {
|
|
9441
|
+
output.add(property.trim());
|
|
9442
|
+
}
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
function collectToolNamesFromUnknown(value, output, depth = 0) {
|
|
9446
|
+
if (depth > 5 || value === null || typeof value !== "object") return;
|
|
9447
|
+
collectStringProperties(value, ["name", "tool_name"], output);
|
|
9448
|
+
collectStringProperties(readProperty$1(value, "function"), ["name"], output);
|
|
9449
|
+
if (Array.isArray(value)) {
|
|
9450
|
+
for (const item of value) {
|
|
9451
|
+
collectToolNamesFromUnknown(item, output, depth + 1);
|
|
9452
|
+
}
|
|
9453
|
+
return;
|
|
9454
|
+
}
|
|
9455
|
+
for (const candidateKey of ["tools", "tool_calls", "content", "output", "input", "messages"]) {
|
|
9456
|
+
collectToolNamesFromUnknown(readProperty$1(value, candidateKey), output, depth + 1);
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9459
|
+
function collectToolNames(log) {
|
|
9460
|
+
const tools = /* @__PURE__ */ new Set();
|
|
9461
|
+
for (const raw of [log.rawRequestBody, log.responseText]) {
|
|
9462
|
+
if (raw === null || raw.trim() === "") continue;
|
|
9463
|
+
try {
|
|
9464
|
+
const parsed = JSON.parse(raw);
|
|
9465
|
+
collectToolNamesFromUnknown(parsed, tools);
|
|
9466
|
+
} catch {
|
|
9467
|
+
}
|
|
9468
|
+
}
|
|
9469
|
+
return [...tools].slice(0, 12);
|
|
9470
|
+
}
|
|
9471
|
+
function summarizeLog(log) {
|
|
9472
|
+
const stopReason = extractStopReason(log);
|
|
9473
|
+
const tools = collectToolNames(log);
|
|
9474
|
+
const requestSnippet = log.rawRequestBody !== null ? truncate$1(log.rawRequestBody, MAX_TEXT_SNIPPET) : "[not captured]";
|
|
9475
|
+
const responseSnippet = log.responseText !== null ? truncate$1(log.responseText, MAX_TEXT_SNIPPET) : "[not captured]";
|
|
9476
|
+
const warnings = log.warnings !== void 0 && log.warnings.length > 0 ? log.warnings : [];
|
|
9477
|
+
return [
|
|
9478
|
+
`Log #${String(log.id)} ${log.timestamp}`,
|
|
9479
|
+
`path=${log.path} format=${log.apiFormat} model=${log.model ?? "unknown"} provider=${log.providerName ?? "unknown"}`,
|
|
9480
|
+
`session=${log.sessionId ?? "unknown"} pid=${log.clientPid?.toString() ?? "unknown"} status=${log.responseStatus?.toString() ?? "pending"} streaming=${String(log.streaming)}`,
|
|
9481
|
+
`elapsedMs=${log.elapsedMs?.toString() ?? "unknown"} firstChunkMs=${log.firstChunkMs?.toString() ?? "unknown"} tokens=${log.inputTokens?.toString() ?? "?"}/${log.outputTokens?.toString() ?? "?"} stop=${stopReason ?? "unknown"}`,
|
|
9482
|
+
tools.length > 0 ? `tools=${tools.join(", ")}` : "tools=none detected",
|
|
9483
|
+
warnings.length > 0 ? `warnings=${warnings.join(" | ")}` : "warnings=none",
|
|
9484
|
+
log.error !== null && log.error !== void 0 ? `error=${log.error}` : "error=none",
|
|
9485
|
+
`requestSnippet:
|
|
9486
|
+
${requestSnippet}`,
|
|
9487
|
+
`responseSnippet:
|
|
9488
|
+
${responseSnippet}`
|
|
9489
|
+
].join("\n");
|
|
9490
|
+
}
|
|
9491
|
+
async function buildInspectorContext(request) {
|
|
9492
|
+
const limit = request.logLimit ?? DEFAULT_LOG_LIMIT;
|
|
9493
|
+
const page = await listLogsPage({
|
|
9494
|
+
sessionId: request.sessionId,
|
|
9495
|
+
offset: 0,
|
|
9496
|
+
limit,
|
|
9497
|
+
includeBodies: true
|
|
9498
|
+
});
|
|
9499
|
+
const logs = page.logs.slice(-limit);
|
|
9500
|
+
const context = truncate$1(logs.map(summarizeLog).join("\n\n---\n\n"), MAX_CONTEXT_CHARS);
|
|
9501
|
+
return { context, logCount: logs.length };
|
|
9502
|
+
}
|
|
9503
|
+
function buildSystemPrompt() {
|
|
9504
|
+
return [
|
|
9505
|
+
"You are Pi Agent, the built-in analysis agent inside TonyClaw Agent Inspector.",
|
|
9506
|
+
"Analyze AI coding tool requests, responses, provider behavior, sessions, turns, tools, token usage, and hanging interactions.",
|
|
9507
|
+
"Be concrete. Cite log ids when possible. Distinguish evidence from inference.",
|
|
9508
|
+
"Give a short diagnosis first, then the likely cause, then practical next actions.",
|
|
9509
|
+
"Do not invent raw data that is not present in the Inspector context."
|
|
9510
|
+
].join("\n");
|
|
9511
|
+
}
|
|
9512
|
+
function buildUserPrompt(question, context) {
|
|
9513
|
+
return [
|
|
9514
|
+
`User question:
|
|
9515
|
+
${question}`,
|
|
9516
|
+
"",
|
|
9517
|
+
"Inspector context:",
|
|
9518
|
+
context !== "" ? context : "No logs were loaded for this scope."
|
|
9519
|
+
].join("\n");
|
|
9520
|
+
}
|
|
9521
|
+
function stripUrlSuffix(value, suffix) {
|
|
9522
|
+
if (!value.endsWith(suffix)) return null;
|
|
9523
|
+
const stripped = value.slice(0, -suffix.length);
|
|
9524
|
+
return stripped === "" ? "/" : stripped;
|
|
9525
|
+
}
|
|
9526
|
+
function sdkBaseUrlFromFinalUrl(finalUrl, protocol) {
|
|
9527
|
+
try {
|
|
9528
|
+
const url = new URL(finalUrl);
|
|
9529
|
+
const pathname = url.pathname.replace(/\/+$/, "");
|
|
9530
|
+
const suffixes = protocol === "openaiResponses" ? ["/responses"] : protocol === "openaiChat" ? ["/chat/completions"] : ["/v1/messages", "/messages"];
|
|
9531
|
+
for (const suffix of suffixes) {
|
|
9532
|
+
const nextPath = stripUrlSuffix(pathname, suffix);
|
|
9533
|
+
if (nextPath !== null) {
|
|
9534
|
+
url.pathname = nextPath;
|
|
9535
|
+
return url.toString().replace(/\/+$/, "");
|
|
9536
|
+
}
|
|
9537
|
+
}
|
|
9538
|
+
} catch {
|
|
9539
|
+
}
|
|
9540
|
+
return finalUrl.replace(/\/+$/, "");
|
|
9541
|
+
}
|
|
9542
|
+
function buildPiBaseUrl(selected) {
|
|
9543
|
+
const finalUrl = buildUpstreamUrl(selected.baseUrl, selected.upstreamPath);
|
|
9544
|
+
return sdkBaseUrlFromFinalUrl(finalUrl, selected.protocol);
|
|
9545
|
+
}
|
|
9546
|
+
function modelMetadataFor(provider, modelName) {
|
|
9547
|
+
const metadata = provider.modelMetadata?.find((item) => item.model === modelName);
|
|
9548
|
+
return {
|
|
9549
|
+
contextWindow: metadata?.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
|
|
9550
|
+
outputLimit: metadata?.outputLimit ?? PI_AGENT_MAX_OUTPUT_TOKENS
|
|
9551
|
+
};
|
|
9552
|
+
}
|
|
9553
|
+
function buildPiHeaders(provider) {
|
|
9554
|
+
if (provider.authHeader !== AUTH_HEADER_X_API_KEY) return void 0;
|
|
9555
|
+
return { [AUTH_HEADER_X_API_KEY]: provider.apiKey };
|
|
9556
|
+
}
|
|
9557
|
+
function buildPiModel(selected) {
|
|
9558
|
+
const metadata = modelMetadataFor(selected.provider, selected.modelName);
|
|
9559
|
+
const usageModelName = getModelUsageName(selected.modelName, selected.provider.name);
|
|
9560
|
+
return {
|
|
9561
|
+
id: usageModelName,
|
|
9562
|
+
name: selected.modelName,
|
|
9563
|
+
api: selected.api,
|
|
9564
|
+
provider: selected.provider.name,
|
|
9565
|
+
baseUrl: buildPiBaseUrl(selected),
|
|
9566
|
+
reasoning: false,
|
|
9567
|
+
input: ["text"],
|
|
9568
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
9569
|
+
contextWindow: metadata.contextWindow,
|
|
9570
|
+
maxTokens: Math.max(metadata.outputLimit, PI_AGENT_MAX_OUTPUT_TOKENS),
|
|
9571
|
+
headers: buildPiHeaders(selected.provider)
|
|
9572
|
+
};
|
|
9573
|
+
}
|
|
9574
|
+
function textFromAssistantMessage(message) {
|
|
9575
|
+
const parts = [];
|
|
9576
|
+
for (const block of message.content) {
|
|
9577
|
+
if (block.type === "text" && block.text.trim() !== "") {
|
|
9578
|
+
parts.push(block.text);
|
|
9579
|
+
}
|
|
9580
|
+
}
|
|
9581
|
+
return parts.join("\n").trim();
|
|
9582
|
+
}
|
|
9583
|
+
function stripReasoningTags(value) {
|
|
9584
|
+
const stripped = value.replace(/<think>[\s\S]*?<\/think>/gi, "").trim();
|
|
9585
|
+
return stripped !== "" ? stripped : value.trim();
|
|
9586
|
+
}
|
|
9587
|
+
function lastAssistantMessage(messages) {
|
|
9588
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
9589
|
+
const message = messages[index];
|
|
9590
|
+
if (message !== void 0 && message.role === "assistant") return message;
|
|
9591
|
+
}
|
|
9592
|
+
return null;
|
|
9593
|
+
}
|
|
9594
|
+
function buildContext(question, inspectorContext) {
|
|
9595
|
+
return {
|
|
9596
|
+
systemPrompt: buildSystemPrompt(),
|
|
9597
|
+
messages: [
|
|
9598
|
+
{
|
|
9599
|
+
role: "user",
|
|
9600
|
+
content: buildUserPrompt(question, inspectorContext),
|
|
9601
|
+
timestamp: Date.now()
|
|
9602
|
+
}
|
|
9603
|
+
]
|
|
9604
|
+
};
|
|
9605
|
+
}
|
|
9606
|
+
async function askPi(selected, question, inspectorContext) {
|
|
9607
|
+
const { Agent } = await import(
|
|
9608
|
+
/* @vite-ignore */
|
|
9609
|
+
"../_libs/mariozechner__pi-agent-core.mjs"
|
|
9610
|
+
);
|
|
9611
|
+
const model = buildPiModel(selected);
|
|
9612
|
+
const agent = new Agent({
|
|
9613
|
+
initialState: {
|
|
9614
|
+
model,
|
|
9615
|
+
systemPrompt: buildSystemPrompt(),
|
|
9616
|
+
tools: []
|
|
9617
|
+
},
|
|
9618
|
+
getApiKey: () => selected.provider.apiKey,
|
|
9619
|
+
sessionId: selected.provider.id,
|
|
9620
|
+
maxRetryDelayMs: 1e4
|
|
9621
|
+
});
|
|
9622
|
+
const context = buildContext(question, inspectorContext);
|
|
9623
|
+
await agent.prompt(context.messages);
|
|
9624
|
+
const assistantMessage = lastAssistantMessage(agent.state.messages);
|
|
9625
|
+
if (assistantMessage === null) {
|
|
9626
|
+
return agent.state.errorMessage ?? "Pi Agent returned no assistant message.";
|
|
9627
|
+
}
|
|
9628
|
+
const answer = textFromAssistantMessage(assistantMessage);
|
|
9629
|
+
if (answer !== "") return stripReasoningTags(answer);
|
|
9630
|
+
return assistantMessage.errorMessage ?? "Pi Agent received an empty provider response.";
|
|
9631
|
+
}
|
|
9632
|
+
async function runPiAgent(request) {
|
|
9633
|
+
const selected = selectProvider(request);
|
|
9634
|
+
if (selected === null) {
|
|
9635
|
+
return {
|
|
9636
|
+
answer: "Pi Agent needs at least one Provider with OpenAI Responses, OpenAI Chat, or Anthropic Messages configured.",
|
|
9637
|
+
providerId: "",
|
|
9638
|
+
providerName: "No provider",
|
|
9639
|
+
model: "",
|
|
9640
|
+
protocol: "openaiChat",
|
|
9641
|
+
logCount: 0
|
|
9642
|
+
};
|
|
9643
|
+
}
|
|
9644
|
+
const { context, logCount } = await buildInspectorContext(request);
|
|
9645
|
+
let answer;
|
|
9646
|
+
try {
|
|
9647
|
+
answer = await askPi(selected, request.question, context);
|
|
9648
|
+
} catch (err) {
|
|
9649
|
+
answer = `Pi Agent provider request failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
9650
|
+
}
|
|
9651
|
+
return {
|
|
9652
|
+
answer,
|
|
9653
|
+
providerId: selected.provider.id,
|
|
9654
|
+
providerName: selected.provider.name,
|
|
9655
|
+
model: selected.modelName,
|
|
9656
|
+
protocol: selected.protocol,
|
|
9657
|
+
logCount
|
|
9658
|
+
};
|
|
9659
|
+
}
|
|
9660
|
+
const Route$F = createFileRoute("/api/pi-agent")({
|
|
9661
|
+
server: {
|
|
9662
|
+
handlers: {
|
|
9663
|
+
POST: async ({ request }) => {
|
|
9664
|
+
let body;
|
|
9665
|
+
try {
|
|
9666
|
+
body = await request.json();
|
|
9667
|
+
} catch {
|
|
9668
|
+
return Response.json({ error: "Invalid JSON body" }, { status: 400 });
|
|
9669
|
+
}
|
|
9670
|
+
const parsed = PiAgentRequestSchema.safeParse(body);
|
|
9671
|
+
if (!parsed.success) {
|
|
9672
|
+
return Response.json(
|
|
9673
|
+
{ error: "Invalid Pi-agent request", details: parsed.error.format() },
|
|
9674
|
+
{ status: 400 }
|
|
9675
|
+
);
|
|
9676
|
+
}
|
|
9677
|
+
const result = await runPiAgent(parsed.data);
|
|
9678
|
+
return Response.json(result);
|
|
9679
|
+
}
|
|
9680
|
+
}
|
|
9681
|
+
}
|
|
9682
|
+
});
|
|
9195
9683
|
const Route$E = createFileRoute("/api/models")({
|
|
9196
9684
|
server: {
|
|
9197
9685
|
handlers: {
|
|
@@ -9200,7 +9688,7 @@ const Route$E = createFileRoute("/api/models")({
|
|
|
9200
9688
|
}
|
|
9201
9689
|
});
|
|
9202
9690
|
const name = "@tonyclaw/agent-inspector";
|
|
9203
|
-
const version = "3.0.
|
|
9691
|
+
const version = "3.0.17";
|
|
9204
9692
|
const packageJson = {
|
|
9205
9693
|
name,
|
|
9206
9694
|
version
|
|
@@ -17598,70 +18086,75 @@ const Route = createFileRoute("/api/ecosystem/packages/$packageId/help")({
|
|
|
17598
18086
|
}
|
|
17599
18087
|
}
|
|
17600
18088
|
});
|
|
17601
|
-
const IndexRoute = Route$
|
|
18089
|
+
const IndexRoute = Route$L.update({
|
|
17602
18090
|
id: "/",
|
|
17603
18091
|
path: "/",
|
|
17604
|
-
getParentRoute: () => Route$
|
|
18092
|
+
getParentRoute: () => Route$M
|
|
17605
18093
|
});
|
|
17606
|
-
const SessionSessionIdRoute = Route$
|
|
18094
|
+
const SessionSessionIdRoute = Route$K.update({
|
|
17607
18095
|
id: "/session/$sessionId",
|
|
17608
18096
|
path: "/session/$sessionId",
|
|
17609
|
-
getParentRoute: () => Route$
|
|
18097
|
+
getParentRoute: () => Route$M
|
|
17610
18098
|
});
|
|
17611
|
-
const ProxySplatRoute = Route$
|
|
18099
|
+
const ProxySplatRoute = Route$J.update({
|
|
17612
18100
|
id: "/proxy/$",
|
|
17613
18101
|
path: "/proxy/$",
|
|
17614
|
-
getParentRoute: () => Route$
|
|
18102
|
+
getParentRoute: () => Route$M
|
|
17615
18103
|
});
|
|
17616
|
-
const ApiSessionsRoute = Route$
|
|
18104
|
+
const ApiSessionsRoute = Route$I.update({
|
|
17617
18105
|
id: "/api/sessions",
|
|
17618
18106
|
path: "/api/sessions",
|
|
17619
|
-
getParentRoute: () => Route$
|
|
18107
|
+
getParentRoute: () => Route$M
|
|
17620
18108
|
});
|
|
17621
|
-
const ApiRunsRoute = Route$
|
|
18109
|
+
const ApiRunsRoute = Route$H.update({
|
|
17622
18110
|
id: "/api/runs",
|
|
17623
18111
|
path: "/api/runs",
|
|
17624
|
-
getParentRoute: () => Route$
|
|
18112
|
+
getParentRoute: () => Route$M
|
|
17625
18113
|
});
|
|
17626
|
-
const ApiProvidersRoute = Route$
|
|
18114
|
+
const ApiProvidersRoute = Route$G.update({
|
|
17627
18115
|
id: "/api/providers",
|
|
17628
18116
|
path: "/api/providers",
|
|
17629
|
-
getParentRoute: () => Route$
|
|
18117
|
+
getParentRoute: () => Route$M
|
|
18118
|
+
});
|
|
18119
|
+
const ApiPiAgentRoute = Route$F.update({
|
|
18120
|
+
id: "/api/pi-agent",
|
|
18121
|
+
path: "/api/pi-agent",
|
|
18122
|
+
getParentRoute: () => Route$M
|
|
17630
18123
|
});
|
|
17631
18124
|
const ApiModelsRoute = Route$E.update({
|
|
17632
18125
|
id: "/api/models",
|
|
17633
18126
|
path: "/api/models",
|
|
17634
|
-
getParentRoute: () => Route$
|
|
18127
|
+
getParentRoute: () => Route$M
|
|
17635
18128
|
});
|
|
17636
18129
|
const ApiMcpRoute = Route$D.update({
|
|
17637
18130
|
id: "/api/mcp",
|
|
17638
18131
|
path: "/api/mcp",
|
|
17639
|
-
getParentRoute: () => Route$
|
|
18132
|
+
getParentRoute: () => Route$M
|
|
17640
18133
|
});
|
|
17641
18134
|
const ApiLogsRoute = Route$C.update({
|
|
17642
18135
|
id: "/api/logs",
|
|
17643
18136
|
path: "/api/logs",
|
|
17644
|
-
getParentRoute: () => Route$
|
|
18137
|
+
getParentRoute: () => Route$M
|
|
17645
18138
|
});
|
|
17646
18139
|
const ApiHealthRoute = Route$B.update({
|
|
17647
18140
|
id: "/api/health",
|
|
17648
18141
|
path: "/api/health",
|
|
17649
|
-
getParentRoute: () => Route$
|
|
18142
|
+
getParentRoute: () => Route$M
|
|
17650
18143
|
});
|
|
17651
18144
|
const ApiGroupsRoute = Route$A.update({
|
|
17652
18145
|
id: "/api/groups",
|
|
17653
18146
|
path: "/api/groups",
|
|
17654
|
-
getParentRoute: () => Route$
|
|
18147
|
+
getParentRoute: () => Route$M
|
|
17655
18148
|
});
|
|
17656
18149
|
const ApiConfigRoute = Route$z.update({
|
|
17657
18150
|
id: "/api/config",
|
|
17658
18151
|
path: "/api/config",
|
|
17659
|
-
getParentRoute: () => Route$
|
|
18152
|
+
getParentRoute: () => Route$M
|
|
17660
18153
|
});
|
|
17661
18154
|
const ApiAlertsRoute = Route$y.update({
|
|
17662
18155
|
id: "/api/alerts",
|
|
17663
18156
|
path: "/api/alerts",
|
|
17664
|
-
getParentRoute: () => Route$
|
|
18157
|
+
getParentRoute: () => Route$M
|
|
17665
18158
|
});
|
|
17666
18159
|
const ApiRunsRunIdRoute = Route$x.update({
|
|
17667
18160
|
id: "/$runId",
|
|
@@ -17706,17 +18199,17 @@ const ApiLogsIdRoute = Route$q.update({
|
|
|
17706
18199
|
const ApiKnowledgeSearchRoute = Route$p.update({
|
|
17707
18200
|
id: "/api/knowledge/search",
|
|
17708
18201
|
path: "/api/knowledge/search",
|
|
17709
|
-
getParentRoute: () => Route$
|
|
18202
|
+
getParentRoute: () => Route$M
|
|
17710
18203
|
});
|
|
17711
18204
|
const ApiKnowledgeProjectContextRoute = Route$o.update({
|
|
17712
18205
|
id: "/api/knowledge/project-context",
|
|
17713
18206
|
path: "/api/knowledge/project-context",
|
|
17714
|
-
getParentRoute: () => Route$
|
|
18207
|
+
getParentRoute: () => Route$M
|
|
17715
18208
|
});
|
|
17716
18209
|
const ApiKnowledgeCandidatesRoute = Route$n.update({
|
|
17717
18210
|
id: "/api/knowledge/candidates",
|
|
17718
18211
|
path: "/api/knowledge/candidates",
|
|
17719
|
-
getParentRoute: () => Route$
|
|
18212
|
+
getParentRoute: () => Route$M
|
|
17720
18213
|
});
|
|
17721
18214
|
const ApiGroupsGroupIdRoute = Route$m.update({
|
|
17722
18215
|
id: "/$groupId",
|
|
@@ -17726,12 +18219,12 @@ const ApiGroupsGroupIdRoute = Route$m.update({
|
|
|
17726
18219
|
const ApiEcosystemTasksRoute = Route$l.update({
|
|
17727
18220
|
id: "/api/ecosystem/tasks",
|
|
17728
18221
|
path: "/api/ecosystem/tasks",
|
|
17729
|
-
getParentRoute: () => Route$
|
|
18222
|
+
getParentRoute: () => Route$M
|
|
17730
18223
|
});
|
|
17731
18224
|
const ApiEcosystemPackagesRoute = Route$k.update({
|
|
17732
18225
|
id: "/api/ecosystem/packages",
|
|
17733
18226
|
path: "/api/ecosystem/packages",
|
|
17734
|
-
getParentRoute: () => Route$
|
|
18227
|
+
getParentRoute: () => Route$M
|
|
17735
18228
|
});
|
|
17736
18229
|
const ApiConfigPathsRoute = Route$j.update({
|
|
17737
18230
|
id: "/paths",
|
|
@@ -17801,7 +18294,7 @@ const ApiProvidersProviderIdTestLogRoute = Route$7.update({
|
|
|
17801
18294
|
const ApiKnowledgeSessionsSessionIdCandidatesRoute = Route$6.update({
|
|
17802
18295
|
id: "/api/knowledge/sessions/$sessionId/candidates",
|
|
17803
18296
|
path: "/api/knowledge/sessions/$sessionId/candidates",
|
|
17804
|
-
getParentRoute: () => Route$
|
|
18297
|
+
getParentRoute: () => Route$M
|
|
17805
18298
|
});
|
|
17806
18299
|
const ApiKnowledgeCandidatesCandidateIdPromoteRoute = Route$5.update({
|
|
17807
18300
|
id: "/promote",
|
|
@@ -17811,7 +18304,7 @@ const ApiKnowledgeCandidatesCandidateIdPromoteRoute = Route$5.update({
|
|
|
17811
18304
|
const ApiEcosystemRecipesRecipeIdRunRoute = Route$4.update({
|
|
17812
18305
|
id: "/api/ecosystem/recipes/$recipeId/run",
|
|
17813
18306
|
path: "/api/ecosystem/recipes/$recipeId/run",
|
|
17814
|
-
getParentRoute: () => Route$
|
|
18307
|
+
getParentRoute: () => Route$M
|
|
17815
18308
|
});
|
|
17816
18309
|
const ApiEcosystemPackagesPackageIdUpgradeRoute = Route$3.update({
|
|
17817
18310
|
id: "/$packageId/upgrade",
|
|
@@ -17934,6 +18427,7 @@ const rootRouteChildren = {
|
|
|
17934
18427
|
ApiLogsRoute: ApiLogsRouteWithChildren,
|
|
17935
18428
|
ApiMcpRoute,
|
|
17936
18429
|
ApiModelsRoute,
|
|
18430
|
+
ApiPiAgentRoute,
|
|
17937
18431
|
ApiProvidersRoute: ApiProvidersRouteWithChildren,
|
|
17938
18432
|
ApiRunsRoute: ApiRunsRouteWithChildren,
|
|
17939
18433
|
ApiSessionsRoute,
|
|
@@ -17947,7 +18441,7 @@ const rootRouteChildren = {
|
|
|
17947
18441
|
ApiEcosystemRecipesRecipeIdRunRoute,
|
|
17948
18442
|
ApiKnowledgeSessionsSessionIdCandidatesRoute
|
|
17949
18443
|
};
|
|
17950
|
-
const routeTree = Route$
|
|
18444
|
+
const routeTree = Route$M._addFileChildren(rootRouteChildren)._addFileTypes();
|
|
17951
18445
|
function getRouter() {
|
|
17952
18446
|
const router2 = createRouter({
|
|
17953
18447
|
routeTree,
|
|
@@ -17974,24 +18468,27 @@ const router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
17974
18468
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17975
18469
|
export {
|
|
17976
18470
|
AnthropicResponseSchema$1 as A,
|
|
17977
|
-
|
|
18471
|
+
previewUpstreamUrl as B,
|
|
17978
18472
|
CapturedLogSchema as C,
|
|
17979
18473
|
DEFAULT_CAPTURE_MODE as D,
|
|
17980
|
-
|
|
17981
|
-
|
|
18474
|
+
createPendingProviderTestResults as E,
|
|
18475
|
+
ProviderTestResultsSchema as F,
|
|
17982
18476
|
GroupEvidenceReadResponseSchema as G,
|
|
17983
|
-
|
|
18477
|
+
createFailedProviderTestResults as H,
|
|
17984
18478
|
InspectorGroupsListResponseSchema as I,
|
|
17985
|
-
|
|
18479
|
+
MAX_PROVIDER_TEST_TIMEOUT_SECONDS as J,
|
|
17986
18480
|
KnowledgeCandidateSchema as K,
|
|
17987
18481
|
LogBodyChunkSchema as L,
|
|
17988
18482
|
MAX_SLOW_RESPONSE_THRESHOLD_SECONDS as M,
|
|
17989
|
-
|
|
18483
|
+
PiAgentResponseSchema as N,
|
|
17990
18484
|
OpenAIRequestSchema as O,
|
|
17991
18485
|
ProviderConfigSchema as P,
|
|
17992
|
-
|
|
17993
|
-
|
|
18486
|
+
resolveProviderContextWindow as Q,
|
|
18487
|
+
Route$K as R,
|
|
18488
|
+
isPlainRecord as S,
|
|
17994
18489
|
TimeDisplayFormatSchema as T,
|
|
18490
|
+
StreamingChunkSchema$1 as U,
|
|
18491
|
+
router as V,
|
|
17995
18492
|
DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS as a,
|
|
17996
18493
|
DEFAULT_PROVIDER_TEST_TIMEOUT_SECONDS as b,
|
|
17997
18494
|
DEFAULT_TIME_DISPLAY_FORMAT as c,
|
|
@@ -18003,19 +18500,19 @@ export {
|
|
|
18003
18500
|
apiFormatForPath as i,
|
|
18004
18501
|
getSessionPath as j,
|
|
18005
18502
|
stripClaudeCodeBillingHeader as k,
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18503
|
+
isTurnBoundary as l,
|
|
18504
|
+
extractStopReason as m,
|
|
18505
|
+
AlertSummarySchema as n,
|
|
18506
|
+
AlertListResponseSchema as o,
|
|
18010
18507
|
packageJson as p,
|
|
18011
|
-
|
|
18012
|
-
|
|
18508
|
+
DeleteInspectorGroupsResponseSchema as q,
|
|
18509
|
+
GroupEvidenceExportResultSchema as r,
|
|
18013
18510
|
safeGetOwnProperty as s,
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18511
|
+
DeleteInspectorGroupResponseSchema as t,
|
|
18512
|
+
providerHasContextMetadata as u,
|
|
18513
|
+
maskApiKey as v,
|
|
18514
|
+
findProviderModelMetadata as w,
|
|
18515
|
+
PATH_V1_MESSAGES as x,
|
|
18516
|
+
PATH_V1_CHAT_COMPLETIONS as y,
|
|
18517
|
+
PATH_V1_RESPONSES as z
|
|
18021
18518
|
};
|