@ai-sdk/devtools 1.0.0-beta.8 → 1.0.0-canary.20
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/dist/client/assets/index-B1quREL_.css +1 -0
- package/dist/client/assets/index-DYruJ8X0.js +181 -0
- package/dist/client/index.html +2 -2
- package/dist/index.d.ts +19 -1
- package/dist/index.js +342 -3
- package/dist/viewer/server.js +42 -5
- package/package.json +28 -4
- package/src/db.ts +32 -5
- package/src/index.ts +1 -0
- package/src/integration.ts +509 -0
- package/src/middleware.ts +5 -5
- package/src/viewer/client/app.tsx +97 -1878
- package/src/viewer/client/components/message-components.tsx +342 -0
- package/src/viewer/client/components/output-components.tsx +145 -0
- package/src/viewer/client/components/shared-components.tsx +691 -0
- package/src/viewer/client/components/step-card.tsx +472 -0
- package/src/viewer/client/components/trace-timeline.tsx +529 -0
- package/src/viewer/client/components/ui/badge.tsx +0 -1
- package/src/viewer/client/components/ui/button.tsx +0 -1
- package/src/viewer/client/types.ts +183 -0
- package/src/viewer/client/utils.ts +708 -0
- package/src/viewer/server.ts +49 -5
- package/dist/client/assets/index-BkyOIjbt.css +0 -1
- package/dist/client/assets/index-BwqXGbSV.js +0 -176
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export interface Run {
|
|
2
|
+
id: string;
|
|
3
|
+
started_at: string;
|
|
4
|
+
stepCount: number;
|
|
5
|
+
firstMessage?: string;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
isInProgress?: boolean;
|
|
8
|
+
type?: 'generate' | 'stream';
|
|
9
|
+
function_id?: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Step {
|
|
13
|
+
id: string;
|
|
14
|
+
run_id: string;
|
|
15
|
+
step_number: number;
|
|
16
|
+
type: 'generate' | 'stream';
|
|
17
|
+
model_id: string;
|
|
18
|
+
provider: string | null;
|
|
19
|
+
started_at: string;
|
|
20
|
+
duration_ms: number | null;
|
|
21
|
+
input: string;
|
|
22
|
+
output: string | null;
|
|
23
|
+
usage: string | null;
|
|
24
|
+
error: string | null;
|
|
25
|
+
raw_request: string | null;
|
|
26
|
+
raw_response: string | null;
|
|
27
|
+
raw_chunks: string | null;
|
|
28
|
+
provider_options: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ChildRun {
|
|
32
|
+
run: {
|
|
33
|
+
id: string;
|
|
34
|
+
started_at: string;
|
|
35
|
+
parent_run_id: string | null;
|
|
36
|
+
parent_step_id: string | null;
|
|
37
|
+
isInProgress?: boolean;
|
|
38
|
+
function_id?: string | null;
|
|
39
|
+
};
|
|
40
|
+
steps: Step[];
|
|
41
|
+
childRuns?: ChildRun[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RunDetail {
|
|
45
|
+
run: {
|
|
46
|
+
id: string;
|
|
47
|
+
started_at: string;
|
|
48
|
+
isInProgress?: boolean;
|
|
49
|
+
function_id?: string | null;
|
|
50
|
+
};
|
|
51
|
+
steps: Step[];
|
|
52
|
+
childRuns?: ChildRun[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type StepType = 'tool-calls' | 'response' | 'error';
|
|
56
|
+
|
|
57
|
+
export interface StepSummary {
|
|
58
|
+
type: StepType;
|
|
59
|
+
icon: 'wrench' | 'message' | 'alert';
|
|
60
|
+
label: string;
|
|
61
|
+
toolDetails?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface StepInputSummary {
|
|
65
|
+
type: 'user' | 'tool';
|
|
66
|
+
label: string;
|
|
67
|
+
fullText?: string;
|
|
68
|
+
toolDetails?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface InputTokenBreakdown {
|
|
72
|
+
total: number;
|
|
73
|
+
noCache?: number;
|
|
74
|
+
cacheRead?: number;
|
|
75
|
+
cacheWrite?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface OutputTokenBreakdown {
|
|
79
|
+
total: number;
|
|
80
|
+
text?: number;
|
|
81
|
+
reasoning?: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type SpanKind =
|
|
85
|
+
| 'step'
|
|
86
|
+
| 'child-run'
|
|
87
|
+
| 'thinking'
|
|
88
|
+
| 'tool-call'
|
|
89
|
+
| 'text'
|
|
90
|
+
| 'error';
|
|
91
|
+
|
|
92
|
+
export interface TraceSpan {
|
|
93
|
+
id: string;
|
|
94
|
+
stepId: string;
|
|
95
|
+
label: string;
|
|
96
|
+
sublabel?: string;
|
|
97
|
+
startMs: number;
|
|
98
|
+
durationMs: number;
|
|
99
|
+
depth: number;
|
|
100
|
+
kind: SpanKind;
|
|
101
|
+
tokens?: { input: number; output: number };
|
|
102
|
+
modelId?: string;
|
|
103
|
+
isInProgress?: boolean;
|
|
104
|
+
toolCallId?: string;
|
|
105
|
+
thinkingText?: string;
|
|
106
|
+
textContent?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// --- Parsed JSON structures (deserialized from Step string fields) ---
|
|
110
|
+
|
|
111
|
+
export interface TextContentPart {
|
|
112
|
+
type: 'text';
|
|
113
|
+
text: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ToolCallContentPart {
|
|
117
|
+
type: 'tool-call';
|
|
118
|
+
toolName: string;
|
|
119
|
+
toolCallId?: string;
|
|
120
|
+
args?: Record<string, unknown> | string;
|
|
121
|
+
input?: Record<string, unknown> | string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ToolResultContentPart {
|
|
125
|
+
type: 'tool-result';
|
|
126
|
+
toolName?: string;
|
|
127
|
+
toolCallId?: string;
|
|
128
|
+
result?: unknown;
|
|
129
|
+
output?: unknown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ReasoningContentPart {
|
|
133
|
+
type: 'reasoning' | 'thinking';
|
|
134
|
+
text?: string;
|
|
135
|
+
thinking?: string;
|
|
136
|
+
reasoning?: string;
|
|
137
|
+
toolCallId?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type ContentPart =
|
|
141
|
+
| TextContentPart
|
|
142
|
+
| ToolCallContentPart
|
|
143
|
+
| ToolResultContentPart
|
|
144
|
+
| ReasoningContentPart;
|
|
145
|
+
|
|
146
|
+
export type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
147
|
+
|
|
148
|
+
export interface PromptMessage {
|
|
149
|
+
role: MessageRole;
|
|
150
|
+
content: string | ContentPart[];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ParsedInput {
|
|
154
|
+
prompt?: PromptMessage[];
|
|
155
|
+
tools?: ToolDefinition[];
|
|
156
|
+
temperature?: number;
|
|
157
|
+
maxOutputTokens?: number;
|
|
158
|
+
topP?: number;
|
|
159
|
+
topK?: number;
|
|
160
|
+
toolChoice?: string | { type: string };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface ToolDefinition {
|
|
164
|
+
name: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
parameters?: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ParsedOutput {
|
|
170
|
+
finishReason?: string | { unified?: string; raw?: string };
|
|
171
|
+
toolCalls?: ToolCallContentPart[];
|
|
172
|
+
textParts?: TextContentPart[];
|
|
173
|
+
reasoningParts?: ReasoningContentPart[];
|
|
174
|
+
content?: ContentPart[];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface ParsedUsage {
|
|
178
|
+
inputTokens?: number | InputTokenBreakdown;
|
|
179
|
+
outputTokens?: number | OutputTokenBreakdown;
|
|
180
|
+
raw?: unknown;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type ParseJson = (str: string | null) => unknown;
|