@tonyclaw/agent-inspector 2.1.13 → 2.1.14
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-DjgjIFx7.js +1 -0
- package/.output/public/assets/ProxyViewerContainer-CWUQZLYy.js +106 -0
- package/.output/public/assets/{ReplayDialog-sBA1KAYD.js → ReplayDialog-CU0Tbb2c.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-BjlBT-Cy.js → RequestAnatomy-BNahe83D.js} +1 -1
- package/.output/public/assets/ResponseView-DSOnGqi6.js +3 -0
- package/.output/public/assets/{StreamingChunkSequence-D2_SMhlE.js → StreamingChunkSequence-BEKTDklB.js} +1 -1
- package/.output/public/assets/_sessionId-Cif8JZdn.js +1 -0
- package/.output/public/assets/index-DWOkqdCa.js +14 -0
- package/.output/public/assets/index-D_WfwzUi.js +1 -0
- package/.output/public/assets/index-DtLuQrs0.css +1 -0
- package/.output/public/assets/json-viewer-C2JpgcW0.js +1 -0
- package/.output/public/assets/{main-Dtspb4Ui.js → main-CSONBwwn.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +20 -20
- package/.output/server/_libs/react-markdown.mjs +90 -2
- package/.output/server/{_sessionId-CXDcLuvi.mjs → _sessionId-CPAa37n5.mjs} +6 -57
- package/.output/server/_ssr/{CompareDrawer-CMoCAoeq.mjs → CompareDrawer-ceW5VxMo.mjs} +17 -62
- package/.output/server/_ssr/{ProxyViewerContainer-BW2vVCBN.mjs → ProxyViewerContainer-CDfEE_w-.mjs} +872 -688
- package/.output/server/_ssr/{ReplayDialog-ChXL1t8H.mjs → ReplayDialog-V0s_eEbR.mjs} +8 -59
- package/.output/server/_ssr/{RequestAnatomy-DtKzIlfU.mjs → RequestAnatomy-f1ccwR9d.mjs} +6 -57
- package/.output/server/_ssr/{ResponseView-B5I8drzc.mjs → ResponseView-BIRrqG4H.mjs} +138 -60
- package/.output/server/_ssr/{StreamingChunkSequence-DvwjQNcO.mjs → StreamingChunkSequence-V3JFjCgX.mjs} +13 -58
- package/.output/server/_ssr/{index-D_ZHtRfl.mjs → index-DsykulzS.mjs} +6 -57
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/json-viewer-Dcnm0Ivf.mjs +478 -0
- package/.output/server/_ssr/{router-DhL9Wp3N.mjs → router-4bdm6Mt2.mjs} +674 -173
- package/.output/server/{_tanstack-start-manifest_v-BHgoAmxZ.mjs → _tanstack-start-manifest_v-Xp4CO64V.mjs} +1 -1
- package/.output/server/index.mjs +76 -62
- package/package.json +1 -1
- package/src/components/ProxyViewerContainer.tsx +25 -17
- package/src/components/providers/ImportWizardDialog.tsx +7 -1
- package/src/components/providers/ProviderCard.tsx +10 -1
- package/src/components/providers/ProviderForm.tsx +157 -41
- package/src/components/providers/ProvidersPanel.tsx +5 -1
- package/src/components/proxy-viewer/AnswerMarkdown.tsx +8 -3
- package/src/components/proxy-viewer/CompareDrawer.tsx +20 -6
- package/src/components/proxy-viewer/ConversationGroup.tsx +11 -15
- package/src/components/proxy-viewer/LogEntry.tsx +31 -11
- package/src/components/proxy-viewer/LogEntryHeader.tsx +111 -40
- package/src/components/proxy-viewer/RequestToolsPanel.tsx +19 -13
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +9 -3
- package/src/components/proxy-viewer/TurnGroup.tsx +53 -7
- package/src/components/proxy-viewer/TurnGroupList.tsx +153 -0
- package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +74 -2
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +13 -7
- package/src/components/proxy-viewer/formats/index.tsx +10 -3
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +185 -17
- package/src/components/proxy-viewer/log-formats/openai.ts +107 -15
- package/src/components/proxy-viewer/logFocus.ts +15 -2
- package/src/components/proxy-viewer/requestTools.ts +7 -3
- package/src/components/proxy-viewer/viewerState.ts +72 -3
- package/src/components/ui/json-viewer-bulk.ts +41 -6
- package/src/components/ui/json-viewer.tsx +9 -8
- package/src/contracts/index.ts +15 -1
- package/src/contracts/openai.ts +94 -0
- package/src/lib/providerContract.ts +1 -0
- package/src/lib/providerModelMetadata.ts +7 -1
- package/src/lib/stopReason.ts +12 -0
- package/src/lib/upstreamUrl.ts +46 -0
- package/src/mcp/previewExtractor.ts +73 -3
- package/src/mcp/server.ts +2 -0
- package/src/mcp/toolHandlers.ts +2 -0
- package/src/proxy/constants.ts +2 -0
- package/src/proxy/formats/openai/handler.ts +40 -9
- package/src/proxy/formats/openai/index.ts +7 -0
- package/src/proxy/formats/openai/schemas.ts +15 -1
- package/src/proxy/formats/openai/stream.ts +529 -135
- package/src/proxy/formats/registry.ts +9 -1
- package/src/proxy/providerImporters.ts +45 -5
- package/src/proxy/providers.ts +31 -11
- package/src/proxy/schemas.ts +6 -0
- package/src/proxy/toolSchemaWarnings.ts +25 -3
- package/src/proxy/upstream.ts +18 -37
- package/src/routes/api/providers.$providerId.ts +1 -0
- package/src/routes/api/providers.ts +2 -0
- package/.output/public/assets/CompareDrawer-Cz_1vIpR.js +0 -1
- package/.output/public/assets/ProxyViewerContainer-7QSiluMf.js +0 -117
- package/.output/public/assets/ResponseView-PtEKzml9.js +0 -1
- package/.output/public/assets/_sessionId-DZfB4ruK.js +0 -1
- package/.output/public/assets/index-B-QQLbpz.js +0 -1
- package/.output/public/assets/index-CmtfjQPv.css +0 -1
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import type { FormatHandler, ParsedRequest } from "../handler";
|
|
2
2
|
import type { CapturedLog, TokenUsage } from "../../schemas";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
OpenAIRequestSchema,
|
|
5
|
+
OpenAIResponsesRequestSchema,
|
|
6
|
+
parseOpenAIResponsesResponse,
|
|
7
|
+
parseOpenAIResponse,
|
|
8
|
+
} from "./schemas";
|
|
4
9
|
import { extractOpenAIStream } from "./stream";
|
|
5
10
|
|
|
11
|
+
function emptyTokens(): TokenUsage {
|
|
12
|
+
return {
|
|
13
|
+
inputTokens: null,
|
|
14
|
+
outputTokens: null,
|
|
15
|
+
cacheCreationInputTokens: null,
|
|
16
|
+
cacheReadInputTokens: null,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export const OpenAIFormatHandler: FormatHandler = {
|
|
7
21
|
format: "openai",
|
|
8
22
|
|
|
@@ -16,6 +30,13 @@ export const OpenAIFormatHandler: FormatHandler = {
|
|
|
16
30
|
sessionId: headers?.get("x-session-affinity") ?? null,
|
|
17
31
|
};
|
|
18
32
|
}
|
|
33
|
+
const responsesResult = OpenAIResponsesRequestSchema.safeParse(json);
|
|
34
|
+
if (responsesResult.success) {
|
|
35
|
+
return {
|
|
36
|
+
model: responsesResult.data.model,
|
|
37
|
+
sessionId: headers?.get("x-session-affinity") ?? null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
19
40
|
return null;
|
|
20
41
|
} catch {
|
|
21
42
|
return null;
|
|
@@ -62,12 +83,17 @@ export const OpenAIFormatHandler: FormatHandler = {
|
|
|
62
83
|
cacheReadInputTokens,
|
|
63
84
|
};
|
|
64
85
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
const responsesParsed = parseOpenAIResponsesResponse(responseBody);
|
|
87
|
+
if (responsesParsed !== null) {
|
|
88
|
+
const usage = responsesParsed.usage;
|
|
89
|
+
return {
|
|
90
|
+
inputTokens: usage?.input_tokens ?? null,
|
|
91
|
+
outputTokens: usage?.output_tokens ?? null,
|
|
92
|
+
cacheCreationInputTokens: null,
|
|
93
|
+
cacheReadInputTokens: usage?.input_tokens_details?.cached_tokens ?? null,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return emptyTokens();
|
|
71
97
|
},
|
|
72
98
|
|
|
73
99
|
extractStream(
|
|
@@ -85,8 +111,13 @@ export const OpenAIFormatHandler: FormatHandler = {
|
|
|
85
111
|
const json: unknown = JSON.parse(rawBody);
|
|
86
112
|
if (typeof json === "object" && json !== null && !Array.isArray(json)) {
|
|
87
113
|
const keys = Object.keys(json);
|
|
88
|
-
// OpenAI has `model` and `messages`
|
|
89
|
-
|
|
114
|
+
// OpenAI has `model` and either Chat `messages` or Responses `input`,
|
|
115
|
+
// but not Anthropic's top-level `system`.
|
|
116
|
+
return (
|
|
117
|
+
keys.includes("model") &&
|
|
118
|
+
(keys.includes("messages") || keys.includes("input")) &&
|
|
119
|
+
!keys.includes("system")
|
|
120
|
+
);
|
|
90
121
|
}
|
|
91
122
|
return false;
|
|
92
123
|
} catch {
|
|
@@ -9,8 +9,15 @@ export {
|
|
|
9
9
|
OpenAIMessage,
|
|
10
10
|
OpenAIMessageContent,
|
|
11
11
|
OpenAIToolDefinition,
|
|
12
|
+
OpenAIResponsesRequestSchema,
|
|
13
|
+
OpenAIResponsesResponseSchema,
|
|
14
|
+
OpenAIResponsesSSEventSchema,
|
|
15
|
+
OpenAIResponsesToolDefinition,
|
|
16
|
+
OpenAIResponsesUsageSchema,
|
|
17
|
+
OpenAIResponsesOutputItemSchema,
|
|
12
18
|
OpenAIChoice,
|
|
13
19
|
OpenAIChoiceDelta,
|
|
20
|
+
parseOpenAIResponsesResponse,
|
|
14
21
|
parseOpenAIResponse,
|
|
15
22
|
} from "./schemas";
|
|
16
23
|
|
|
@@ -5,10 +5,24 @@ export {
|
|
|
5
5
|
OpenAIMessage,
|
|
6
6
|
OpenAIMessageContent,
|
|
7
7
|
OpenAIRequestSchema,
|
|
8
|
+
OpenAIResponsesRequestSchema,
|
|
9
|
+
OpenAIResponsesResponseSchema,
|
|
10
|
+
OpenAIResponsesSSEventSchema,
|
|
11
|
+
OpenAIResponsesToolDefinition,
|
|
12
|
+
OpenAIResponsesUsageSchema,
|
|
13
|
+
OpenAIResponsesOutputItemSchema,
|
|
8
14
|
OpenAIResponseSchema,
|
|
9
15
|
OpenAISSERawChunkSchema,
|
|
10
16
|
OpenAIToolCallSchema,
|
|
11
17
|
OpenAIToolDefinition,
|
|
18
|
+
parseOpenAIResponsesResponse,
|
|
12
19
|
parseOpenAIResponse,
|
|
13
20
|
} from "../../../contracts/openai";
|
|
14
|
-
export type {
|
|
21
|
+
export type {
|
|
22
|
+
OpenAIResponse,
|
|
23
|
+
OpenAIResponsesRequest,
|
|
24
|
+
OpenAIResponsesResponse,
|
|
25
|
+
OpenAIResponsesSSEvent,
|
|
26
|
+
OpenAIResponsesOutputItem,
|
|
27
|
+
OpenAIToolCall,
|
|
28
|
+
} from "../../../contracts/openai";
|