@sqlrooms/ai-config 0.29.0-rc.0 → 0.29.0-rc.2
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/AiSliceConfig.d.ts +76 -4
- package/dist/AiSliceConfig.d.ts.map +1 -1
- package/dist/AiSliceConfig.js +0 -1
- package/dist/AiSliceConfig.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/migration/AnalysisSession-v0.26.0.d.ts +2 -4
- package/dist/migration/AnalysisSession-v0.26.0.d.ts.map +1 -1
- package/dist/migration/AnalysisSession-v0.26.0.js +69 -70
- package/dist/migration/AnalysisSession-v0.26.0.js.map +1 -1
- package/dist/schema/AnalysisSessionSchema.d.ts +76 -4
- package/dist/schema/AnalysisSessionSchema.d.ts.map +1 -1
- package/dist/schema/AnalysisSessionSchema.js +2 -1
- package/dist/schema/AnalysisSessionSchema.js.map +1 -1
- package/dist/schema/UIMessageSchema.d.ts +255 -8
- package/dist/schema/UIMessageSchema.d.ts.map +1 -1
- package/dist/schema/UIMessageSchema.js +60 -5
- package/dist/schema/UIMessageSchema.js.map +1 -1
- package/package.json +3 -3
package/dist/AiSliceConfig.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare const AiSliceConfig: z.ZodObject<{
|
|
|
40
40
|
done: "done";
|
|
41
41
|
}>>;
|
|
42
42
|
providerMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
43
|
-
}, z.core.$strip>, z.
|
|
43
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
44
44
|
type: z.ZodString;
|
|
45
45
|
toolCallId: z.ZodString;
|
|
46
46
|
state: z.ZodLiteral<"input-streaming">;
|
|
@@ -71,7 +71,43 @@ export declare const AiSliceConfig: z.ZodObject<{
|
|
|
71
71
|
errorText: z.ZodString;
|
|
72
72
|
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
73
73
|
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
74
|
-
}, z.core.$strip
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
type: z.ZodString;
|
|
76
|
+
toolCallId: z.ZodString;
|
|
77
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
78
|
+
input: z.ZodUnknown;
|
|
79
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
80
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
approval: z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
type: z.ZodString;
|
|
88
|
+
toolCallId: z.ZodString;
|
|
89
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
90
|
+
input: z.ZodUnknown;
|
|
91
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
92
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
approval: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
approved: z.ZodBoolean;
|
|
96
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
type: z.ZodString;
|
|
100
|
+
toolCallId: z.ZodString;
|
|
101
|
+
state: z.ZodLiteral<"output-denied">;
|
|
102
|
+
input: z.ZodUnknown;
|
|
103
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
104
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
approval: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
approved: z.ZodBoolean;
|
|
108
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
}, z.core.$strip>], "state">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
75
111
|
type: z.ZodLiteral<"dynamic-tool">;
|
|
76
112
|
toolName: z.ZodString;
|
|
77
113
|
toolCallId: z.ZodString;
|
|
@@ -100,7 +136,43 @@ export declare const AiSliceConfig: z.ZodObject<{
|
|
|
100
136
|
state: z.ZodLiteral<"output-error">;
|
|
101
137
|
input: z.ZodUnknown;
|
|
102
138
|
errorText: z.ZodString;
|
|
103
|
-
}, z.core.$strip
|
|
139
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
141
|
+
toolName: z.ZodString;
|
|
142
|
+
toolCallId: z.ZodString;
|
|
143
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
144
|
+
input: z.ZodUnknown;
|
|
145
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
146
|
+
approval: z.ZodObject<{
|
|
147
|
+
id: z.ZodString;
|
|
148
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
153
|
+
toolName: z.ZodString;
|
|
154
|
+
toolCallId: z.ZodString;
|
|
155
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
156
|
+
input: z.ZodUnknown;
|
|
157
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
158
|
+
approval: z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
approved: z.ZodBoolean;
|
|
161
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
165
|
+
toolName: z.ZodString;
|
|
166
|
+
toolCallId: z.ZodString;
|
|
167
|
+
state: z.ZodLiteral<"output-denied">;
|
|
168
|
+
input: z.ZodUnknown;
|
|
169
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
170
|
+
approval: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
approved: z.ZodBoolean;
|
|
173
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
}, z.core.$strip>], "state">, z.ZodObject<{
|
|
104
176
|
type: z.ZodLiteral<"step-start">;
|
|
105
177
|
}, z.core.$strip>, z.ZodObject<{
|
|
106
178
|
type: z.ZodLiteral<"source-url">;
|
|
@@ -128,11 +200,11 @@ export declare const AiSliceConfig: z.ZodObject<{
|
|
|
128
200
|
data: z.ZodUnknown;
|
|
129
201
|
}, z.core.$strip>]>>;
|
|
130
202
|
}, z.core.$strip>>;
|
|
131
|
-
toolAdditionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
203
|
messagesRevision: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
133
204
|
prompt: z.ZodDefault<z.ZodString>;
|
|
134
205
|
isRunning: z.ZodDefault<z.ZodBoolean>;
|
|
135
206
|
lastOpenedAt: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
agentProgress: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>>;
|
|
136
208
|
}, z.core.$strip>>>;
|
|
137
209
|
currentSessionId: z.ZodOptional<z.ZodString>;
|
|
138
210
|
openSessionTabs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiSliceConfig.d.ts","sourceRoot":"","sources":["../src/AiSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"AiSliceConfig.d.ts","sourceRoot":"","sources":["../src/AiSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAgB,qBAAqB,CACnC,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7B,aAAa,CAsBf"}
|
package/dist/AiSliceConfig.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiSliceConfig.js","sourceRoot":"","sources":["../src/AiSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IACxC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,4CAA4C;IAC5C,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAGH,MAAM,UAAU,qBAAqB,CACnC,KAA8B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Y,EAAE,IAAI,CAAC,GAAG,EAAE;aACzB;SACF;QACD,gBAAgB,EAAE,gBAAgB;QAClC,eAAe,EAAE,CAAC,gBAAgB,CAAC;QACnC,GAAG,KAAK;KACT,CAAC;AACJ,CAAC","sourcesContent":["import {z} from 'zod';\nimport {AnalysisSessionSchema} from './schema/AnalysisSessionSchema';\nimport {createId} from '@paralleldrive/cuid2';\n\nexport const AiSliceConfig = z.object({\n sessions: z.array(AnalysisSessionSchema),\n currentSessionId: z.string().optional(),\n /** IDs of sessions that are open as tabs */\n openSessionTabs: z.array(z.string()).optional(),\n});\nexport type AiSliceConfig = z.infer<typeof AiSliceConfig>;\n\nexport function createDefaultAiConfig(\n props?: Partial<AiSliceConfig>,\n): AiSliceConfig {\n const defaultSessionId = createId();\n return {\n sessions: [\n {\n id: defaultSessionId,\n name: 'Default Session',\n modelProvider: 'openai',\n model: 'gpt-4.1',\n analysisResults: [],\n createdAt: new Date(),\n uiMessages: [],\n messagesRevision: 0,\n prompt: '',\n isRunning: false,\n lastOpenedAt: Date.now(),\n },\n ],\n currentSessionId: defaultSessionId,\n openSessionTabs: [defaultSessionId],\n ...props,\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AiSliceConfig, createDefaultAiConfig } from './AiSliceConfig';
|
|
2
2
|
export { AiSettingsSliceConfig } from './AiSettingsSliceConfig';
|
|
3
3
|
export { AnalysisSessionSchema, AnalysisResultSchema, ErrorMessageSchema, } from './schema/AnalysisSessionSchema';
|
|
4
|
-
export type { ToolUIPart, UIMessagePart } from './schema/UIMessageSchema';
|
|
4
|
+
export type { DynamicToolUIPart, ToolUIPart, UIMessagePart, } from './schema/UIMessageSchema';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,aAAa,GACd,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC","sourcesContent":["export {AiSliceConfig, createDefaultAiConfig} from './AiSliceConfig';\nexport {AiSettingsSliceConfig} from './AiSettingsSliceConfig';\nexport {\n AnalysisSessionSchema,\n AnalysisResultSchema,\n ErrorMessageSchema,\n} from './schema/AnalysisSessionSchema';\nexport type {ToolUIPart
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC","sourcesContent":["export {AiSliceConfig, createDefaultAiConfig} from './AiSliceConfig';\nexport {AiSettingsSliceConfig} from './AiSettingsSliceConfig';\nexport {\n AnalysisSessionSchema,\n AnalysisResultSchema,\n ErrorMessageSchema,\n} from './schema/AnalysisSessionSchema';\nexport type {\n DynamicToolUIPart,\n ToolUIPart,\n UIMessagePart,\n} from './schema/UIMessageSchema';\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Changes:
|
|
7
7
|
* - add uiMessages (AI SDK v5) to AnalysisSession along with legacy analysisResults
|
|
8
|
-
* -
|
|
8
|
+
* - remove toolAdditionalData (in-chat editing removed)
|
|
9
9
|
* - deprecate the following properties in AnalysisResult:
|
|
10
10
|
* - streamMessage
|
|
11
11
|
*
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
* errorMessage?: { error: string },
|
|
44
44
|
* }>,
|
|
45
45
|
* uiMessages: Array<UIMessageSchema>, //<-- NEW FIELD
|
|
46
|
-
* toolAdditionalData: Record<string, unknown>, //<-- NEW FIELD
|
|
47
46
|
* messagesRevision?: number, //<-- NEW FIELD
|
|
48
47
|
* prompt: string, //<-- NEW FIELD
|
|
49
48
|
* isRunning: boolean, //<-- NEW FIELD
|
|
@@ -52,13 +51,12 @@
|
|
|
52
51
|
type UnknownRecord = Record<string, unknown>;
|
|
53
52
|
/** Detect if session needs migration to UI messages */
|
|
54
53
|
declare function needsV0_26_0Migration(data: unknown): boolean;
|
|
55
|
-
/** Perform migration to AI SDK v5 uiMessages
|
|
54
|
+
/** Perform migration to AI SDK v5 uiMessages, strip toolAdditionalData */
|
|
56
55
|
declare function migrateFromV0_26_0(data: unknown): {
|
|
57
56
|
analysisResults: {
|
|
58
57
|
[x: string]: unknown;
|
|
59
58
|
}[];
|
|
60
59
|
uiMessages: UnknownRecord[];
|
|
61
|
-
toolAdditionalData: UnknownRecord;
|
|
62
60
|
prompt: string;
|
|
63
61
|
isRunning: boolean;
|
|
64
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalysisSession-v0.26.0.d.ts","sourceRoot":"","sources":["../../src/migration/AnalysisSession-v0.26.0.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AnalysisSession-v0.26.0.d.ts","sourceRoot":"","sources":["../../src/migration/AnalysisSession-v0.26.0.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAM7C,uDAAuD;AACvD,iBAAS,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAUrD;AAED,0EAA0E;AAC1E,iBAAS,kBAAkB,CAAC,IAAI,EAAE,OAAO;;;;;;;EA6FxC;AAED,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Changes:
|
|
7
7
|
* - add uiMessages (AI SDK v5) to AnalysisSession along with legacy analysisResults
|
|
8
|
-
* -
|
|
8
|
+
* - remove toolAdditionalData (in-chat editing removed)
|
|
9
9
|
* - deprecate the following properties in AnalysisResult:
|
|
10
10
|
* - streamMessage
|
|
11
11
|
*
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
* errorMessage?: { error: string },
|
|
44
44
|
* }>,
|
|
45
45
|
* uiMessages: Array<UIMessageSchema>, //<-- NEW FIELD
|
|
46
|
-
* toolAdditionalData: Record<string, unknown>, //<-- NEW FIELD
|
|
47
46
|
* messagesRevision?: number, //<-- NEW FIELD
|
|
48
47
|
* prompt: string, //<-- NEW FIELD
|
|
49
48
|
* isRunning: boolean, //<-- NEW FIELD
|
|
@@ -56,82 +55,83 @@ function isObject(value) {
|
|
|
56
55
|
function needsV0_26_0Migration(data) {
|
|
57
56
|
if (!isObject(data))
|
|
58
57
|
return false;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const d = data;
|
|
59
|
+
// Needs migration if uiMessages is missing, or if legacy toolAdditionalData is present
|
|
60
|
+
const hasUiMessages = 'uiMessages' in d;
|
|
61
|
+
const hasLegacyToolData = 'toolAdditionalData' in d;
|
|
62
|
+
return !hasUiMessages || hasLegacyToolData;
|
|
63
63
|
}
|
|
64
|
-
/** Perform migration to AI SDK v5 uiMessages
|
|
64
|
+
/** Perform migration to AI SDK v5 uiMessages, strip toolAdditionalData */
|
|
65
65
|
function migrateFromV0_26_0(data) {
|
|
66
|
-
const
|
|
66
|
+
const { toolAdditionalData: _legacyToolAdditionalData, ...session } = {
|
|
67
|
+
...data,
|
|
68
|
+
};
|
|
67
69
|
const analysisResults = session.analysisResults || [];
|
|
68
70
|
const existingUiMessages = session.uiMessages || [];
|
|
69
|
-
|
|
71
|
+
// Only synthesize messages from legacy analysisResults when uiMessages is
|
|
72
|
+
// absent entirely. If it's already present (e.g. only key cleanup is needed),
|
|
73
|
+
// skip synthesis to avoid duplicating messages.
|
|
70
74
|
const synthesizedMessages = [];
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const assistantParts = [];
|
|
88
|
-
for (const part of parts) {
|
|
89
|
-
if (part.type === 'text') {
|
|
90
|
-
const text = part.text;
|
|
91
|
-
assistantParts.push({ type: 'text', text });
|
|
75
|
+
const needsMessageSynthesis = !('uiMessages' in data);
|
|
76
|
+
if (needsMessageSynthesis) {
|
|
77
|
+
for (const result of analysisResults) {
|
|
78
|
+
if (!isObject(result))
|
|
79
|
+
continue;
|
|
80
|
+
const id = result.id || '';
|
|
81
|
+
const prompt = result.prompt || '';
|
|
82
|
+
const streamMessage = result.streamMessage || {};
|
|
83
|
+
const parts = streamMessage.parts || [];
|
|
84
|
+
// Create user message for the prompt
|
|
85
|
+
if (prompt) {
|
|
86
|
+
synthesizedMessages.push({
|
|
87
|
+
id,
|
|
88
|
+
role: 'user',
|
|
89
|
+
parts: [{ type: 'text', text: prompt }],
|
|
90
|
+
});
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
92
|
+
// Create assistant message mapping the parts
|
|
93
|
+
const assistantParts = [];
|
|
94
|
+
for (const part of parts) {
|
|
95
|
+
if (part.type === 'text') {
|
|
96
|
+
const text = part.text;
|
|
97
|
+
assistantParts.push({ type: 'text', text });
|
|
98
|
+
}
|
|
99
|
+
else if (part.type === 'tool-invocation') {
|
|
100
|
+
const toolInvocation = part.toolInvocation;
|
|
101
|
+
if (isObject(toolInvocation)) {
|
|
102
|
+
const toolCallId = toolInvocation.toolCallId;
|
|
103
|
+
const toolName = toolInvocation.toolName;
|
|
104
|
+
const state = toolInvocation.state;
|
|
105
|
+
const args = toolInvocation.args;
|
|
106
|
+
const llmResult = toolInvocation.result;
|
|
107
|
+
// Map state to AI SDK v5 tool-* parts
|
|
108
|
+
if (state === 'call') {
|
|
109
|
+
assistantParts.push({
|
|
110
|
+
type: `tool-${toolName}`,
|
|
111
|
+
toolCallId,
|
|
112
|
+
state: 'input-available',
|
|
113
|
+
input: args,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
assistantParts.push({
|
|
118
|
+
type: `tool-${toolName}`,
|
|
119
|
+
toolCallId,
|
|
120
|
+
state: 'output-available',
|
|
121
|
+
input: args,
|
|
122
|
+
output: llmResult,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
128
|
+
if (assistantParts.length > 0) {
|
|
129
|
+
synthesizedMessages.push({
|
|
130
|
+
id: `${id}-assistant`,
|
|
131
|
+
role: 'assistant',
|
|
132
|
+
parts: assistantParts,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
// Remove deprecated streamMessage field from analysisResults
|
|
@@ -145,7 +145,6 @@ function migrateFromV0_26_0(data) {
|
|
|
145
145
|
...session,
|
|
146
146
|
analysisResults: cleanedAnalysisResults,
|
|
147
147
|
uiMessages: [...existingUiMessages, ...synthesizedMessages],
|
|
148
|
-
toolAdditionalData,
|
|
149
148
|
prompt: '',
|
|
150
149
|
isRunning: false,
|
|
151
150
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalysisSession-v0.26.0.js","sourceRoot":"","sources":["../../src/migration/AnalysisSession-v0.26.0.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AnalysisSession-v0.26.0.js","sourceRoot":"","sources":["../../src/migration/AnalysisSession-v0.26.0.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK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U;gCACV,KAAK,EAAE,kBAAkB;gCACzB,KAAK,EAAE,IAAI;gCACX,MAAM,EAAE,SAAS;6BAClB,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,mBAAmB,CAAC,IAAI,CAAC;oBACvB,EAAE,EAAE,GAAG,EAAE,YAAY;oBACrB,IAAI,EAAE,WAAW;oBACjB,KAAK,EAAE,cAAc;iBACtB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,6DAA6D;IAC7D,MAAM,sBAAsB,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC5D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;QAErC,MAAM,EAAC,aAAa,EAAE,GAAG,IAAI,EAAC,GAAG,MAEhC,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO;QACV,eAAe,EAAE,sBAAsB;QACvC,UAAU,EAAE,CAAC,GAAG,kBAAkB,EAAE,GAAG,mBAAmB,CAAC;QAC3D,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC;AAED,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAC","sourcesContent":["/**\n * Migration function to convert old AnalysisSession to new format\n *\n * Version: 0.26.x\n *\n * Changes:\n * - add uiMessages (AI SDK v5) to AnalysisSession along with legacy analysisResults\n * - remove toolAdditionalData (in-chat editing removed)\n * - deprecate the following properties in AnalysisResult:\n * - streamMessage\n *\n * OLD SCHEMA (legacy format):\n * {\n * id: string,\n * name: string,\n * modelProvider: string,\n * model: string,\n * customModelName?: string,\n * baseUrl?: string,\n * createdAt?: Date\n * analysisResults: Array<{\n * id: string,\n * prompt: string,\n * isCompleted: boolean,\n * errorMessage?: { error: string },\n * streamMessage: StreamMessageSchema, //<-- OLD FIELD, DEPRECATED\n * }>,\n * }\n *\n * NEW SCHEMA (current format):\n * {\n * id: string,\n * name: string,\n * modelProvider: string,\n * model: string,\n * customModelName?: string,\n * baseUrl?: string,\n * createdAt?: Date\n * analysisResults: Array<{\n * id: string,\n * prompt: string,\n * isCompleted: boolean,\n * errorMessage?: { error: string },\n * }>,\n * uiMessages: Array<UIMessageSchema>, //<-- NEW FIELD\n * messagesRevision?: number, //<-- NEW FIELD\n * prompt: string, //<-- NEW FIELD\n * isRunning: boolean, //<-- NEW FIELD\n * }\n */\n\ntype UnknownRecord = Record<string, unknown>;\n\nfunction isObject(value: unknown): value is UnknownRecord {\n return typeof value === 'object' && value !== null;\n}\n\n/** Detect if session needs migration to UI messages */\nfunction needsV0_26_0Migration(data: unknown): boolean {\n if (!isObject(data)) return false;\n\n const d = data as UnknownRecord;\n\n // Needs migration if uiMessages is missing, or if legacy toolAdditionalData is present\n const hasUiMessages = 'uiMessages' in d;\n const hasLegacyToolData = 'toolAdditionalData' in d;\n\n return !hasUiMessages || hasLegacyToolData;\n}\n\n/** Perform migration to AI SDK v5 uiMessages, strip toolAdditionalData */\nfunction migrateFromV0_26_0(data: unknown) {\n const {toolAdditionalData: _legacyToolAdditionalData, ...session} = {\n ...(data as UnknownRecord),\n };\n const analysisResults = (session.analysisResults as UnknownRecord[]) || [];\n const existingUiMessages = (session.uiMessages as UnknownRecord[]) || [];\n\n // Only synthesize messages from legacy analysisResults when uiMessages is\n // absent entirely. If it's already present (e.g. only key cleanup is needed),\n // skip synthesis to avoid duplicating messages.\n const synthesizedMessages: UnknownRecord[] = [];\n const needsMessageSynthesis = !('uiMessages' in (data as UnknownRecord));\n\n if (needsMessageSynthesis) {\n for (const result of analysisResults) {\n if (!isObject(result)) continue;\n const id = (result.id as string) || '';\n const prompt = (result.prompt as string) || '';\n const streamMessage = (result.streamMessage as UnknownRecord) || {};\n const parts = (streamMessage.parts as UnknownRecord[]) || [];\n\n // Create user message for the prompt\n if (prompt) {\n synthesizedMessages.push({\n id,\n role: 'user',\n parts: [{type: 'text', text: prompt}],\n });\n }\n\n // Create assistant message mapping the parts\n const assistantParts: UnknownRecord[] = [];\n for (const part of parts) {\n if (part.type === 'text') {\n const text = part.text as string;\n assistantParts.push({type: 'text', text});\n } else if (part.type === 'tool-invocation') {\n const toolInvocation = part.toolInvocation;\n if (isObject(toolInvocation)) {\n const toolCallId = toolInvocation.toolCallId as string;\n const toolName = toolInvocation.toolName as string;\n const state = toolInvocation.state as string;\n const args = toolInvocation.args;\n const llmResult = toolInvocation.result;\n\n // Map state to AI SDK v5 tool-* parts\n if (state === 'call') {\n assistantParts.push({\n type: `tool-${toolName}`,\n toolCallId,\n state: 'input-available',\n input: args,\n });\n } else {\n assistantParts.push({\n type: `tool-${toolName}`,\n toolCallId,\n state: 'output-available',\n input: args,\n output: llmResult,\n });\n }\n }\n }\n }\n\n if (assistantParts.length > 0) {\n synthesizedMessages.push({\n id: `${id}-assistant`,\n role: 'assistant',\n parts: assistantParts,\n });\n }\n }\n }\n\n // Remove deprecated streamMessage field from analysisResults\n const cleanedAnalysisResults = analysisResults.map((result) => {\n if (!isObject(result)) return result;\n\n const {streamMessage, ...rest} = result as UnknownRecord & {\n streamMessage?: unknown;\n };\n return rest;\n });\n\n return {\n ...session,\n analysisResults: cleanedAnalysisResults,\n uiMessages: [...existingUiMessages, ...synthesizedMessages],\n prompt: '',\n isRunning: false,\n };\n}\n\nexport {needsV0_26_0Migration, migrateFromV0_26_0};\n"]}
|
|
@@ -52,7 +52,7 @@ export declare const AnalysisSessionSchema: z.ZodPipe<z.ZodTransform<unknown, un
|
|
|
52
52
|
done: "done";
|
|
53
53
|
}>>;
|
|
54
54
|
providerMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
-
}, z.core.$strip>, z.
|
|
55
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
56
|
type: z.ZodString;
|
|
57
57
|
toolCallId: z.ZodString;
|
|
58
58
|
state: z.ZodLiteral<"input-streaming">;
|
|
@@ -83,7 +83,43 @@ export declare const AnalysisSessionSchema: z.ZodPipe<z.ZodTransform<unknown, un
|
|
|
83
83
|
errorText: z.ZodString;
|
|
84
84
|
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
85
85
|
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
86
|
-
}, z.core.$strip
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
type: z.ZodString;
|
|
88
|
+
toolCallId: z.ZodString;
|
|
89
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
90
|
+
input: z.ZodUnknown;
|
|
91
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
92
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
approval: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
type: z.ZodString;
|
|
100
|
+
toolCallId: z.ZodString;
|
|
101
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
102
|
+
input: z.ZodUnknown;
|
|
103
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
104
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
approval: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
approved: z.ZodBoolean;
|
|
108
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
type: z.ZodString;
|
|
112
|
+
toolCallId: z.ZodString;
|
|
113
|
+
state: z.ZodLiteral<"output-denied">;
|
|
114
|
+
input: z.ZodUnknown;
|
|
115
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
116
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
approval: z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
approved: z.ZodBoolean;
|
|
120
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>], "state">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
87
123
|
type: z.ZodLiteral<"dynamic-tool">;
|
|
88
124
|
toolName: z.ZodString;
|
|
89
125
|
toolCallId: z.ZodString;
|
|
@@ -112,7 +148,43 @@ export declare const AnalysisSessionSchema: z.ZodPipe<z.ZodTransform<unknown, un
|
|
|
112
148
|
state: z.ZodLiteral<"output-error">;
|
|
113
149
|
input: z.ZodUnknown;
|
|
114
150
|
errorText: z.ZodString;
|
|
115
|
-
}, z.core.$strip
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
153
|
+
toolName: z.ZodString;
|
|
154
|
+
toolCallId: z.ZodString;
|
|
155
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
156
|
+
input: z.ZodUnknown;
|
|
157
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
158
|
+
approval: z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
165
|
+
toolName: z.ZodString;
|
|
166
|
+
toolCallId: z.ZodString;
|
|
167
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
168
|
+
input: z.ZodUnknown;
|
|
169
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
170
|
+
approval: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
approved: z.ZodBoolean;
|
|
173
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
177
|
+
toolName: z.ZodString;
|
|
178
|
+
toolCallId: z.ZodString;
|
|
179
|
+
state: z.ZodLiteral<"output-denied">;
|
|
180
|
+
input: z.ZodUnknown;
|
|
181
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
182
|
+
approval: z.ZodObject<{
|
|
183
|
+
id: z.ZodString;
|
|
184
|
+
approved: z.ZodBoolean;
|
|
185
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
}, z.core.$strip>], "state">, z.ZodObject<{
|
|
116
188
|
type: z.ZodLiteral<"step-start">;
|
|
117
189
|
}, z.core.$strip>, z.ZodObject<{
|
|
118
190
|
type: z.ZodLiteral<"source-url">;
|
|
@@ -140,11 +212,11 @@ export declare const AnalysisSessionSchema: z.ZodPipe<z.ZodTransform<unknown, un
|
|
|
140
212
|
data: z.ZodUnknown;
|
|
141
213
|
}, z.core.$strip>]>>;
|
|
142
214
|
}, z.core.$strip>>;
|
|
143
|
-
toolAdditionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
144
215
|
messagesRevision: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
145
216
|
prompt: z.ZodDefault<z.ZodString>;
|
|
146
217
|
isRunning: z.ZodDefault<z.ZodBoolean>;
|
|
147
218
|
lastOpenedAt: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
agentProgress: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnknown>>>;
|
|
148
220
|
}, z.core.$strip>>;
|
|
149
221
|
export type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;
|
|
150
222
|
//# sourceMappingURL=AnalysisSessionSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalysisSessionSchema.d.ts","sourceRoot":"","sources":["../../src/schema/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAetB,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB;;;;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AnalysisSessionSchema.d.ts","sourceRoot":"","sources":["../../src/schema/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAetB,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB;;;;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAiDxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAyB,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -22,7 +22,6 @@ const AnalysisSessionBaseSchema = z.object({
|
|
|
22
22
|
analysisResults: z.array(AnalysisResultSchema),
|
|
23
23
|
createdAt: z.coerce.date().optional(),
|
|
24
24
|
uiMessages: z.array(UIMessageSchema),
|
|
25
|
-
toolAdditionalData: z.record(z.string(), z.unknown()).optional(),
|
|
26
25
|
/** Revision counter that increments when messages are deleted, used to force useChat reset */
|
|
27
26
|
messagesRevision: z.number().optional().default(0),
|
|
28
27
|
/** Per-session analysis prompt text */
|
|
@@ -31,6 +30,8 @@ const AnalysisSessionBaseSchema = z.object({
|
|
|
31
30
|
isRunning: z.boolean().default(false),
|
|
32
31
|
/** Last time the session was opened/selected (epoch ms) */
|
|
33
32
|
lastOpenedAt: z.number().optional(),
|
|
33
|
+
/** Persisted sub-agent tool call trees, keyed by parent toolCallId */
|
|
34
|
+
agentProgress: z.record(z.string(), z.array(z.unknown())).optional(),
|
|
34
35
|
});
|
|
35
36
|
/**
|
|
36
37
|
* Apply all migrations in sequence from oldest to newest.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalysisSessionSchema.js","sourceRoot":"","sources":["../../src/schema/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAG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AC,QAAQ,EAAE;IACnC,sEAAsE;IACtE,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;CACrE,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE;IACnD,IAAI,QAAQ,GAAG,IAAI,CAAC;IAEpB,qDAAqD;IACrD,IAAI,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,wDAAwD;IACxD,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,kEAAkE;IAClE,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,EAAE,yBAAyB,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC","sourcesContent":["import {z} from 'zod';\nimport {UIMessageSchema} from './UIMessageSchema';\nimport {\n needsV0_24_14Migration,\n migrateFromV0_24_14,\n} from '../migration/AnalysisSession-v0.24.14';\nimport {\n needsV0_25_0Migration,\n migrateFromV0_25_0,\n} from '../migration/AnalysisSession-v0.25.0';\nimport {\n needsV0_26_0Migration,\n migrateFromV0_26_0,\n} from '../migration/AnalysisSession-v0.26.0';\n\nexport const ErrorMessageSchema = z.object({\n error: z.string(),\n});\nexport type ErrorMessageSchema = z.infer<typeof ErrorMessageSchema>;\n\nexport const AnalysisResultSchema = z.object({\n id: z.string(), // allow any string ID to match UI message ID from AI SDK v5\n prompt: z.string(),\n errorMessage: ErrorMessageSchema.optional(),\n isCompleted: z.boolean(),\n});\nexport type AnalysisResultSchema = z.infer<typeof AnalysisResultSchema>;\n\nconst AnalysisSessionBaseSchema = z.object({\n id: z.string(),\n name: z.string(),\n modelProvider: z.string(),\n model: z.string(),\n customModelName: z.string().optional(),\n baseUrl: z.string().optional(),\n analysisResults: z.array(AnalysisResultSchema),\n createdAt: z.coerce.date().optional(),\n uiMessages: z.array(UIMessageSchema),\n /** Revision counter that increments when messages are deleted, used to force useChat reset */\n messagesRevision: z.number().optional().default(0),\n /** Per-session analysis prompt text */\n prompt: z.string().default(''),\n /** Per-session flag indicating if analysis is running */\n isRunning: z.boolean().default(false),\n /** Last time the session was opened/selected (epoch ms) */\n lastOpenedAt: z.number().optional(),\n /** Persisted sub-agent tool call trees, keyed by parent toolCallId */\n agentProgress: z.record(z.string(), z.array(z.unknown())).optional(),\n});\n\n/**\n * Apply all migrations in sequence from oldest to newest.\n * This ensures that old data can be migrated through multiple versions.\n */\nconst migrateAnalysisSession = z.preprocess((data) => {\n let migrated = data;\n\n // Apply v0.24.14 migration (ollamaBaseUrl → baseUrl)\n if (needsV0_24_14Migration(migrated)) {\n migrated = migrateFromV0_24_14(migrated);\n }\n\n // Apply v0.25.0 migration (streamMessage format change)\n if (needsV0_25_0Migration(migrated)) {\n migrated = migrateFromV0_25_0(migrated);\n }\n\n // Apply v0.26.0 migration (add uiMessages and toolAdditionalData)\n if (needsV0_26_0Migration(migrated)) {\n migrated = migrateFromV0_26_0(migrated);\n }\n\n return migrated;\n}, AnalysisSessionBaseSchema);\n\nexport const AnalysisSessionSchema = migrateAnalysisSession;\nexport type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const ToolUIPartSchema: z.
|
|
2
|
+
declare const ToolUIPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
3
|
type: z.ZodString;
|
|
4
4
|
toolCallId: z.ZodString;
|
|
5
5
|
state: z.ZodLiteral<"input-streaming">;
|
|
@@ -30,8 +30,110 @@ declare const ToolUIPartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
30
30
|
errorText: z.ZodString;
|
|
31
31
|
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
32
32
|
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
33
|
-
}, z.core.$strip
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
type: z.ZodString;
|
|
35
|
+
toolCallId: z.ZodString;
|
|
36
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
37
|
+
input: z.ZodUnknown;
|
|
38
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
39
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
approval: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodString;
|
|
47
|
+
toolCallId: z.ZodString;
|
|
48
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
49
|
+
input: z.ZodUnknown;
|
|
50
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
51
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
approval: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
approved: z.ZodBoolean;
|
|
55
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodString;
|
|
59
|
+
toolCallId: z.ZodString;
|
|
60
|
+
state: z.ZodLiteral<"output-denied">;
|
|
61
|
+
input: z.ZodUnknown;
|
|
62
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
63
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
approval: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
approved: z.ZodBoolean;
|
|
67
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
}, z.core.$strip>], "state">;
|
|
34
70
|
export type ToolUIPart = z.infer<typeof ToolUIPartSchema>;
|
|
71
|
+
declare const DynamicToolUIPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
73
|
+
toolName: z.ZodString;
|
|
74
|
+
toolCallId: z.ZodString;
|
|
75
|
+
state: z.ZodLiteral<"input-streaming">;
|
|
76
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
79
|
+
toolName: z.ZodString;
|
|
80
|
+
toolCallId: z.ZodString;
|
|
81
|
+
state: z.ZodLiteral<"input-available">;
|
|
82
|
+
input: z.ZodUnknown;
|
|
83
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
86
|
+
toolName: z.ZodString;
|
|
87
|
+
toolCallId: z.ZodString;
|
|
88
|
+
state: z.ZodLiteral<"output-available">;
|
|
89
|
+
input: z.ZodUnknown;
|
|
90
|
+
output: z.ZodUnknown;
|
|
91
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
92
|
+
preliminary: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
95
|
+
toolName: z.ZodString;
|
|
96
|
+
toolCallId: z.ZodString;
|
|
97
|
+
state: z.ZodLiteral<"output-error">;
|
|
98
|
+
input: z.ZodUnknown;
|
|
99
|
+
errorText: z.ZodString;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
102
|
+
toolName: z.ZodString;
|
|
103
|
+
toolCallId: z.ZodString;
|
|
104
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
105
|
+
input: z.ZodUnknown;
|
|
106
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
107
|
+
approval: z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
114
|
+
toolName: z.ZodString;
|
|
115
|
+
toolCallId: z.ZodString;
|
|
116
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
117
|
+
input: z.ZodUnknown;
|
|
118
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
119
|
+
approval: z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
approved: z.ZodBoolean;
|
|
122
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
126
|
+
toolName: z.ZodString;
|
|
127
|
+
toolCallId: z.ZodString;
|
|
128
|
+
state: z.ZodLiteral<"output-denied">;
|
|
129
|
+
input: z.ZodUnknown;
|
|
130
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
131
|
+
approval: z.ZodObject<{
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
approved: z.ZodBoolean;
|
|
134
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>], "state">;
|
|
35
137
|
export declare const UIMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
36
138
|
type: z.ZodLiteral<"text">;
|
|
37
139
|
text: z.ZodString;
|
|
@@ -48,7 +150,7 @@ export declare const UIMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
48
150
|
done: "done";
|
|
49
151
|
}>>;
|
|
50
152
|
providerMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
51
|
-
}, z.core.$strip>, z.
|
|
153
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
52
154
|
type: z.ZodString;
|
|
53
155
|
toolCallId: z.ZodString;
|
|
54
156
|
state: z.ZodLiteral<"input-streaming">;
|
|
@@ -79,7 +181,43 @@ export declare const UIMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
79
181
|
errorText: z.ZodString;
|
|
80
182
|
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
81
183
|
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
82
|
-
}, z.core.$strip
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
type: z.ZodString;
|
|
186
|
+
toolCallId: z.ZodString;
|
|
187
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
188
|
+
input: z.ZodUnknown;
|
|
189
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
190
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
+
approval: z.ZodObject<{
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
type: z.ZodString;
|
|
198
|
+
toolCallId: z.ZodString;
|
|
199
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
200
|
+
input: z.ZodUnknown;
|
|
201
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
202
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
approval: z.ZodObject<{
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
approved: z.ZodBoolean;
|
|
206
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
209
|
+
type: z.ZodString;
|
|
210
|
+
toolCallId: z.ZodString;
|
|
211
|
+
state: z.ZodLiteral<"output-denied">;
|
|
212
|
+
input: z.ZodUnknown;
|
|
213
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
214
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
215
|
+
approval: z.ZodObject<{
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
approved: z.ZodBoolean;
|
|
218
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
}, z.core.$strip>], "state">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
221
|
type: z.ZodLiteral<"dynamic-tool">;
|
|
84
222
|
toolName: z.ZodString;
|
|
85
223
|
toolCallId: z.ZodString;
|
|
@@ -108,7 +246,43 @@ export declare const UIMessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
108
246
|
state: z.ZodLiteral<"output-error">;
|
|
109
247
|
input: z.ZodUnknown;
|
|
110
248
|
errorText: z.ZodString;
|
|
111
|
-
}, z.core.$strip
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
251
|
+
toolName: z.ZodString;
|
|
252
|
+
toolCallId: z.ZodString;
|
|
253
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
254
|
+
input: z.ZodUnknown;
|
|
255
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
256
|
+
approval: z.ZodObject<{
|
|
257
|
+
id: z.ZodString;
|
|
258
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
259
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
263
|
+
toolName: z.ZodString;
|
|
264
|
+
toolCallId: z.ZodString;
|
|
265
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
266
|
+
input: z.ZodUnknown;
|
|
267
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
268
|
+
approval: z.ZodObject<{
|
|
269
|
+
id: z.ZodString;
|
|
270
|
+
approved: z.ZodBoolean;
|
|
271
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
275
|
+
toolName: z.ZodString;
|
|
276
|
+
toolCallId: z.ZodString;
|
|
277
|
+
state: z.ZodLiteral<"output-denied">;
|
|
278
|
+
input: z.ZodUnknown;
|
|
279
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
280
|
+
approval: z.ZodObject<{
|
|
281
|
+
id: z.ZodString;
|
|
282
|
+
approved: z.ZodBoolean;
|
|
283
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
}, z.core.$strip>], "state">, z.ZodObject<{
|
|
112
286
|
type: z.ZodLiteral<"step-start">;
|
|
113
287
|
}, z.core.$strip>, z.ZodObject<{
|
|
114
288
|
type: z.ZodLiteral<"source-url">;
|
|
@@ -159,7 +333,7 @@ export declare const UIMessageSchema: z.ZodObject<{
|
|
|
159
333
|
done: "done";
|
|
160
334
|
}>>;
|
|
161
335
|
providerMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
162
|
-
}, z.core.$strip>, z.
|
|
336
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
163
337
|
type: z.ZodString;
|
|
164
338
|
toolCallId: z.ZodString;
|
|
165
339
|
state: z.ZodLiteral<"input-streaming">;
|
|
@@ -190,7 +364,43 @@ export declare const UIMessageSchema: z.ZodObject<{
|
|
|
190
364
|
errorText: z.ZodString;
|
|
191
365
|
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
192
366
|
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
193
|
-
}, z.core.$strip
|
|
367
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
368
|
+
type: z.ZodString;
|
|
369
|
+
toolCallId: z.ZodString;
|
|
370
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
371
|
+
input: z.ZodUnknown;
|
|
372
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
373
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
374
|
+
approval: z.ZodObject<{
|
|
375
|
+
id: z.ZodString;
|
|
376
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
377
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
378
|
+
}, z.core.$strip>;
|
|
379
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
380
|
+
type: z.ZodString;
|
|
381
|
+
toolCallId: z.ZodString;
|
|
382
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
383
|
+
input: z.ZodUnknown;
|
|
384
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
385
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
approval: z.ZodObject<{
|
|
387
|
+
id: z.ZodString;
|
|
388
|
+
approved: z.ZodBoolean;
|
|
389
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
392
|
+
type: z.ZodString;
|
|
393
|
+
toolCallId: z.ZodString;
|
|
394
|
+
state: z.ZodLiteral<"output-denied">;
|
|
395
|
+
input: z.ZodUnknown;
|
|
396
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
397
|
+
providerExecuted: z.ZodOptional<z.ZodBoolean>;
|
|
398
|
+
approval: z.ZodObject<{
|
|
399
|
+
id: z.ZodString;
|
|
400
|
+
approved: z.ZodBoolean;
|
|
401
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
402
|
+
}, z.core.$strip>;
|
|
403
|
+
}, z.core.$strip>], "state">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
194
404
|
type: z.ZodLiteral<"dynamic-tool">;
|
|
195
405
|
toolName: z.ZodString;
|
|
196
406
|
toolCallId: z.ZodString;
|
|
@@ -219,7 +429,43 @@ export declare const UIMessageSchema: z.ZodObject<{
|
|
|
219
429
|
state: z.ZodLiteral<"output-error">;
|
|
220
430
|
input: z.ZodUnknown;
|
|
221
431
|
errorText: z.ZodString;
|
|
222
|
-
}, z.core.$strip
|
|
432
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
433
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
434
|
+
toolName: z.ZodString;
|
|
435
|
+
toolCallId: z.ZodString;
|
|
436
|
+
state: z.ZodLiteral<"approval-requested">;
|
|
437
|
+
input: z.ZodUnknown;
|
|
438
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
439
|
+
approval: z.ZodObject<{
|
|
440
|
+
id: z.ZodString;
|
|
441
|
+
approved: z.ZodOptional<z.ZodBoolean>;
|
|
442
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
443
|
+
}, z.core.$strip>;
|
|
444
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
445
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
446
|
+
toolName: z.ZodString;
|
|
447
|
+
toolCallId: z.ZodString;
|
|
448
|
+
state: z.ZodLiteral<"approval-responded">;
|
|
449
|
+
input: z.ZodUnknown;
|
|
450
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
451
|
+
approval: z.ZodObject<{
|
|
452
|
+
id: z.ZodString;
|
|
453
|
+
approved: z.ZodBoolean;
|
|
454
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
455
|
+
}, z.core.$strip>;
|
|
456
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
457
|
+
type: z.ZodLiteral<"dynamic-tool">;
|
|
458
|
+
toolName: z.ZodString;
|
|
459
|
+
toolCallId: z.ZodString;
|
|
460
|
+
state: z.ZodLiteral<"output-denied">;
|
|
461
|
+
input: z.ZodUnknown;
|
|
462
|
+
callProviderMetadata: z.ZodOptional<z.ZodUnknown>;
|
|
463
|
+
approval: z.ZodObject<{
|
|
464
|
+
id: z.ZodString;
|
|
465
|
+
approved: z.ZodBoolean;
|
|
466
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
467
|
+
}, z.core.$strip>;
|
|
468
|
+
}, z.core.$strip>], "state">, z.ZodObject<{
|
|
223
469
|
type: z.ZodLiteral<"step-start">;
|
|
224
470
|
}, z.core.$strip>, z.ZodObject<{
|
|
225
471
|
type: z.ZodLiteral<"source-url">;
|
|
@@ -248,5 +494,6 @@ export declare const UIMessageSchema: z.ZodObject<{
|
|
|
248
494
|
}, z.core.$strip>]>>;
|
|
249
495
|
}, z.core.$strip>;
|
|
250
496
|
export type UIMessagePart = z.infer<typeof UIMessagePartSchema>;
|
|
497
|
+
export type DynamicToolUIPart = z.infer<typeof DynamicToolUIPartSchema>;
|
|
251
498
|
export {};
|
|
252
499
|
//# sourceMappingURL=UIMessageSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIMessageSchema.d.ts","sourceRoot":"","sources":["../../src/schema/UIMessageSchema.ts"],"names":[],"mappings":"A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} from 'zod';
|
|
2
|
-
// AI SDK
|
|
2
|
+
// AI SDK v6 UIMessage schemas
|
|
3
3
|
const ProviderMetadataSchema = z.unknown();
|
|
4
4
|
const TextUIPartSchema = z.object({
|
|
5
5
|
type: z.literal('text'),
|
|
@@ -45,11 +45,45 @@ const ToolUIPartOutputErrorSchema = ToolUIPartBaseSchema.extend({
|
|
|
45
45
|
providerExecuted: z.boolean().optional(),
|
|
46
46
|
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
47
47
|
});
|
|
48
|
-
const
|
|
48
|
+
const ToolUIPartApprovalPendingSchema = z.object({
|
|
49
|
+
id: z.string(),
|
|
50
|
+
approved: z.boolean().optional(),
|
|
51
|
+
reason: z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
const ToolUIPartApprovalResolvedSchema = z.object({
|
|
54
|
+
id: z.string(),
|
|
55
|
+
approved: z.boolean(),
|
|
56
|
+
reason: z.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
const ToolUIPartApprovalRequestedSchema = ToolUIPartBaseSchema.extend({
|
|
59
|
+
state: z.literal('approval-requested'),
|
|
60
|
+
input: z.unknown(),
|
|
61
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
62
|
+
providerExecuted: z.boolean().optional(),
|
|
63
|
+
approval: ToolUIPartApprovalPendingSchema,
|
|
64
|
+
});
|
|
65
|
+
const ToolUIPartApprovalRespondedSchema = ToolUIPartBaseSchema.extend({
|
|
66
|
+
state: z.literal('approval-responded'),
|
|
67
|
+
input: z.unknown(),
|
|
68
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
69
|
+
providerExecuted: z.boolean().optional(),
|
|
70
|
+
approval: ToolUIPartApprovalResolvedSchema,
|
|
71
|
+
});
|
|
72
|
+
const ToolUIPartOutputDeniedSchema = ToolUIPartBaseSchema.extend({
|
|
73
|
+
state: z.literal('output-denied'),
|
|
74
|
+
input: z.unknown(),
|
|
75
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
76
|
+
providerExecuted: z.boolean().optional(),
|
|
77
|
+
approval: ToolUIPartApprovalResolvedSchema,
|
|
78
|
+
});
|
|
79
|
+
const ToolUIPartSchema = z.discriminatedUnion('state', [
|
|
49
80
|
ToolUIPartInputStreamingSchema,
|
|
50
81
|
ToolUIPartInputAvailableSchema,
|
|
51
82
|
ToolUIPartOutputAvailableSchema,
|
|
52
83
|
ToolUIPartOutputErrorSchema,
|
|
84
|
+
ToolUIPartApprovalRequestedSchema,
|
|
85
|
+
ToolUIPartApprovalRespondedSchema,
|
|
86
|
+
ToolUIPartOutputDeniedSchema,
|
|
53
87
|
]);
|
|
54
88
|
// dynamic-tool parts
|
|
55
89
|
const DynamicToolUIPartBaseSchema = z.object({
|
|
@@ -78,13 +112,34 @@ const DynamicToolOutputErrorSchema = DynamicToolUIPartBaseSchema.extend({
|
|
|
78
112
|
input: z.unknown(),
|
|
79
113
|
errorText: z.string(),
|
|
80
114
|
});
|
|
81
|
-
const
|
|
115
|
+
const DynamicToolApprovalRequestedSchema = DynamicToolUIPartBaseSchema.extend({
|
|
116
|
+
state: z.literal('approval-requested'),
|
|
117
|
+
input: z.unknown(),
|
|
118
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
119
|
+
approval: ToolUIPartApprovalPendingSchema,
|
|
120
|
+
});
|
|
121
|
+
const DynamicToolApprovalRespondedSchema = DynamicToolUIPartBaseSchema.extend({
|
|
122
|
+
state: z.literal('approval-responded'),
|
|
123
|
+
input: z.unknown(),
|
|
124
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
125
|
+
approval: ToolUIPartApprovalResolvedSchema,
|
|
126
|
+
});
|
|
127
|
+
const DynamicToolOutputDeniedSchema = DynamicToolUIPartBaseSchema.extend({
|
|
128
|
+
state: z.literal('output-denied'),
|
|
129
|
+
input: z.unknown(),
|
|
130
|
+
callProviderMetadata: ProviderMetadataSchema.optional(),
|
|
131
|
+
approval: ToolUIPartApprovalResolvedSchema,
|
|
132
|
+
});
|
|
133
|
+
const DynamicToolUIPartSchema = z.discriminatedUnion('state', [
|
|
82
134
|
DynamicToolInputStreamingSchema,
|
|
83
135
|
DynamicToolInputAvailableSchema,
|
|
84
136
|
DynamicToolOutputAvailableSchema,
|
|
85
137
|
DynamicToolOutputErrorSchema,
|
|
138
|
+
DynamicToolApprovalRequestedSchema,
|
|
139
|
+
DynamicToolApprovalRespondedSchema,
|
|
140
|
+
DynamicToolOutputDeniedSchema,
|
|
86
141
|
]);
|
|
87
|
-
// Additional UIPart types from AI SDK
|
|
142
|
+
// Additional UIPart types from AI SDK v6
|
|
88
143
|
const StepStartUIPartSchema = z.object({
|
|
89
144
|
type: z.literal('step-start'),
|
|
90
145
|
});
|
|
@@ -128,7 +183,7 @@ export const UIMessagePartSchema = z.union([
|
|
|
128
183
|
FileUIPartSchema,
|
|
129
184
|
DataUIPartSchema,
|
|
130
185
|
]);
|
|
131
|
-
// Create a Zod schema for UIMessage (AI SDK
|
|
186
|
+
// Create a Zod schema for UIMessage (AI SDK v6)
|
|
132
187
|
export const UIMessageSchema = z.object({
|
|
133
188
|
id: z.string(),
|
|
134
189
|
role: z.enum(['system', 'user', 'assistant']),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIMessageSchema.js","sourceRoot":"","sources":["../../src/schema/UIMessageSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,8BAA8B;AAC9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C,gBAAgB,EAAE,s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;IACrB,qBAAqB;IACrB,0BAA0B;IAC1B,gBAAgB;IAChB,gBAAgB;CACjB,CAAC,CAAC;AAEH,gDAAgD;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;CACpC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\n// AI SDK v5 UIMessage schemas\nconst ProviderMetadataSchema = z.unknown();\n\nconst TextUIPartSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n state: z.enum(['streaming', 'done']).optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ReasoningUIPartSchema = z.object({\n type: z.literal('reasoning'),\n text: z.string(),\n state: z.enum(['streaming', 'done']).optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\n// tool-* parts (generic over tool name); model the state variants\nconst ToolUIPartBaseSchema = z.object({\n type: z.string().regex(/^tool-/),\n toolCallId: z.string(),\n});\n\nconst ToolUIPartInputStreamingSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('input-streaming'),\n input: z.unknown().optional(),\n providerExecuted: z.boolean().optional(),\n});\n\nconst ToolUIPartInputAvailableSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('input-available'),\n input: z.unknown(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ToolUIPartOutputAvailableSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('output-available'),\n input: z.unknown(),\n output: z.unknown(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n preliminary: z.boolean().optional(),\n});\n\nconst ToolUIPartOutputErrorSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('output-error'),\n input: z.unknown().optional(),\n rawInput: z.unknown().optional(),\n errorText: z.string(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ToolUIPartSchema = z.union([\n ToolUIPartInputStreamingSchema,\n ToolUIPartInputAvailableSchema,\n ToolUIPartOutputAvailableSchema,\n ToolUIPartOutputErrorSchema,\n]);\n\nexport type ToolUIPart = z.infer<typeof ToolUIPartSchema>;\n\n// dynamic-tool parts\nconst DynamicToolUIPartBaseSchema = z.object({\n type: z.literal('dynamic-tool'),\n toolName: z.string(),\n toolCallId: z.string(),\n});\n\nconst DynamicToolInputStreamingSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('input-streaming'),\n input: z.unknown().optional(),\n});\n\nconst DynamicToolInputAvailableSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('input-available'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst DynamicToolOutputAvailableSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('output-available'),\n input: z.unknown(),\n output: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n preliminary: z.boolean().optional(),\n});\n\nconst DynamicToolOutputErrorSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('output-error'),\n input: z.unknown(),\n errorText: z.string(),\n});\n\nconst DynamicToolUIPartSchema = z.union([\n DynamicToolInputStreamingSchema,\n DynamicToolInputAvailableSchema,\n DynamicToolOutputAvailableSchema,\n DynamicToolOutputErrorSchema,\n]);\n\n// Additional UIPart types from AI SDK v5\nconst StepStartUIPartSchema = z.object({\n type: z.literal('step-start'),\n});\n\nconst SourceUrlUIPartSchema = z.object({\n type: z.literal('source-url'),\n sourceId: z.string(),\n url: z.string(),\n title: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst SourceDocumentUIPartSchema = z.object({\n type: z.literal('source-document'),\n sourceId: z.string(),\n mediaType: z.string(),\n title: z.string(),\n filename: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst FileUIPartSchema = z.object({\n type: z.literal('file'),\n mediaType: z.string(),\n filename: z.string().optional(),\n url: z.string().optional(),\n data: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\n// Generic data part schema (for data-* types)\nconst DataUIPartSchema = z.object({\n type: z.string().regex(/^data-/),\n id: z.string().optional(),\n data: z.unknown(),\n});\n\nexport const UIMessagePartSchema = z.union([\n TextUIPartSchema,\n ReasoningUIPartSchema,\n ToolUIPartSchema,\n DynamicToolUIPartSchema,\n StepStartUIPartSchema,\n SourceUrlUIPartSchema,\n SourceDocumentUIPartSchema,\n FileUIPartSchema,\n DataUIPartSchema,\n]);\n\n// Create a Zod schema for UIMessage (AI SDK v5)\nexport const UIMessageSchema = z.object({\n id: z.string(),\n role: z.enum(['system', 'user', 'assistant']),\n metadata: z.unknown().optional(),\n parts: z.array(UIMessagePartSchema),\n});\n\n// Export the type for UIMessagePart\nexport type UIMessagePart = z.infer<typeof UIMessagePartSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"UIMessageSchema.js","sourceRoot":"","sources":["../../src/schema/UIMessageSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,8BAA8B;AAC9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C,gBAAgB,EAAE,sBAAsB,CAAC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AAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;CACpC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\n// AI SDK v6 UIMessage schemas\nconst ProviderMetadataSchema = z.unknown();\n\nconst TextUIPartSchema = z.object({\n type: z.literal('text'),\n text: z.string(),\n state: z.enum(['streaming', 'done']).optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ReasoningUIPartSchema = z.object({\n type: z.literal('reasoning'),\n text: z.string(),\n state: z.enum(['streaming', 'done']).optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\n// tool-* parts (generic over tool name); model the state variants\nconst ToolUIPartBaseSchema = z.object({\n type: z.string().regex(/^tool-/),\n toolCallId: z.string(),\n});\n\nconst ToolUIPartInputStreamingSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('input-streaming'),\n input: z.unknown().optional(),\n providerExecuted: z.boolean().optional(),\n});\n\nconst ToolUIPartInputAvailableSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('input-available'),\n input: z.unknown(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ToolUIPartOutputAvailableSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('output-available'),\n input: z.unknown(),\n output: z.unknown(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n preliminary: z.boolean().optional(),\n});\n\nconst ToolUIPartOutputErrorSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('output-error'),\n input: z.unknown().optional(),\n rawInput: z.unknown().optional(),\n errorText: z.string(),\n providerExecuted: z.boolean().optional(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst ToolUIPartApprovalPendingSchema = z.object({\n id: z.string(),\n approved: z.boolean().optional(),\n reason: z.string().optional(),\n});\n\nconst ToolUIPartApprovalResolvedSchema = z.object({\n id: z.string(),\n approved: z.boolean(),\n reason: z.string().optional(),\n});\n\nconst ToolUIPartApprovalRequestedSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('approval-requested'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n providerExecuted: z.boolean().optional(),\n approval: ToolUIPartApprovalPendingSchema,\n});\n\nconst ToolUIPartApprovalRespondedSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('approval-responded'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n providerExecuted: z.boolean().optional(),\n approval: ToolUIPartApprovalResolvedSchema,\n});\n\nconst ToolUIPartOutputDeniedSchema = ToolUIPartBaseSchema.extend({\n state: z.literal('output-denied'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n providerExecuted: z.boolean().optional(),\n approval: ToolUIPartApprovalResolvedSchema,\n});\n\nconst ToolUIPartSchema = z.discriminatedUnion('state', [\n ToolUIPartInputStreamingSchema,\n ToolUIPartInputAvailableSchema,\n ToolUIPartOutputAvailableSchema,\n ToolUIPartOutputErrorSchema,\n ToolUIPartApprovalRequestedSchema,\n ToolUIPartApprovalRespondedSchema,\n ToolUIPartOutputDeniedSchema,\n]);\n\nexport type ToolUIPart = z.infer<typeof ToolUIPartSchema>;\n\n// dynamic-tool parts\nconst DynamicToolUIPartBaseSchema = z.object({\n type: z.literal('dynamic-tool'),\n toolName: z.string(),\n toolCallId: z.string(),\n});\n\nconst DynamicToolInputStreamingSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('input-streaming'),\n input: z.unknown().optional(),\n});\n\nconst DynamicToolInputAvailableSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('input-available'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst DynamicToolOutputAvailableSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('output-available'),\n input: z.unknown(),\n output: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n preliminary: z.boolean().optional(),\n});\n\nconst DynamicToolOutputErrorSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('output-error'),\n input: z.unknown(),\n errorText: z.string(),\n});\n\nconst DynamicToolApprovalRequestedSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('approval-requested'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n approval: ToolUIPartApprovalPendingSchema,\n});\n\nconst DynamicToolApprovalRespondedSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('approval-responded'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n approval: ToolUIPartApprovalResolvedSchema,\n});\n\nconst DynamicToolOutputDeniedSchema = DynamicToolUIPartBaseSchema.extend({\n state: z.literal('output-denied'),\n input: z.unknown(),\n callProviderMetadata: ProviderMetadataSchema.optional(),\n approval: ToolUIPartApprovalResolvedSchema,\n});\n\nconst DynamicToolUIPartSchema = z.discriminatedUnion('state', [\n DynamicToolInputStreamingSchema,\n DynamicToolInputAvailableSchema,\n DynamicToolOutputAvailableSchema,\n DynamicToolOutputErrorSchema,\n DynamicToolApprovalRequestedSchema,\n DynamicToolApprovalRespondedSchema,\n DynamicToolOutputDeniedSchema,\n]);\n\n// Additional UIPart types from AI SDK v6\nconst StepStartUIPartSchema = z.object({\n type: z.literal('step-start'),\n});\n\nconst SourceUrlUIPartSchema = z.object({\n type: z.literal('source-url'),\n sourceId: z.string(),\n url: z.string(),\n title: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst SourceDocumentUIPartSchema = z.object({\n type: z.literal('source-document'),\n sourceId: z.string(),\n mediaType: z.string(),\n title: z.string(),\n filename: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\nconst FileUIPartSchema = z.object({\n type: z.literal('file'),\n mediaType: z.string(),\n filename: z.string().optional(),\n url: z.string().optional(),\n data: z.string().optional(),\n providerMetadata: ProviderMetadataSchema.optional(),\n});\n\n// Generic data part schema (for data-* types)\nconst DataUIPartSchema = z.object({\n type: z.string().regex(/^data-/),\n id: z.string().optional(),\n data: z.unknown(),\n});\n\nexport const UIMessagePartSchema = z.union([\n TextUIPartSchema,\n ReasoningUIPartSchema,\n ToolUIPartSchema,\n DynamicToolUIPartSchema,\n StepStartUIPartSchema,\n SourceUrlUIPartSchema,\n SourceDocumentUIPartSchema,\n FileUIPartSchema,\n DataUIPartSchema,\n]);\n\n// Create a Zod schema for UIMessage (AI SDK v6)\nexport const UIMessageSchema = z.object({\n id: z.string(),\n role: z.enum(['system', 'user', 'assistant']),\n metadata: z.unknown().optional(),\n parts: z.array(UIMessagePartSchema),\n});\n\n// Export the type for UIMessagePart\nexport type UIMessagePart = z.infer<typeof UIMessagePartSchema>;\n\n// Export DynamicToolUIPart type (union of all dynamic-tool states)\nexport type DynamicToolUIPart = z.infer<typeof DynamicToolUIPartSchema>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/ai-config",
|
|
3
|
-
"version": "0.29.0-rc.
|
|
3
|
+
"version": "0.29.0-rc.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/sqlrooms/sqlrooms.git"
|
|
13
|
+
"url": "git+https://github.com/sqlrooms/sqlrooms.git"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"typedoc": "typedoc"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "5d511631992c1af8852ea79ced488867aad4a555"
|
|
33
33
|
}
|