@dexto/core 1.8.11 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approval/manager.cjs +37 -325
- package/dist/approval/manager.d.ts +10 -109
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +37 -316
- package/dist/approval/schemas.cjs +8 -51
- package/dist/approval/schemas.d.ts +5 -179
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +8 -47
- package/dist/approval/types.cjs +0 -6
- package/dist/approval/types.d.ts +2 -27
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +0 -6
- package/dist/context/content-clone.cjs +12 -8
- package/dist/context/content-clone.d.ts.map +1 -1
- package/dist/context/content-clone.js +12 -8
- package/dist/errors/DextoRuntimeError.cjs +3 -1
- package/dist/errors/DextoRuntimeError.d.ts +5 -3
- package/dist/errors/DextoRuntimeError.d.ts.map +1 -1
- package/dist/errors/DextoRuntimeError.js +3 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/types.d.ts +1 -0
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/llm/executor/provider-error.cjs +25 -4
- package/dist/llm/executor/provider-error.d.ts.map +1 -1
- package/dist/llm/executor/provider-error.js +25 -4
- package/dist/llm/executor/stream-processor.cjs +61 -0
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +61 -0
- package/dist/llm/executor/turn-executor.cjs +93 -26
- package/dist/llm/executor/turn-executor.d.ts +2 -0
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +93 -26
- package/dist/llm/formatters/vercel.cjs +66 -0
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +66 -0
- package/dist/llm/services/factory.cjs +3 -2
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +3 -2
- package/dist/llm/services/types.d.ts +8 -0
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +6 -1
- package/dist/llm/services/vercel.d.ts +3 -2
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +6 -1
- package/dist/session/chat-session.cjs +3 -0
- package/dist/session/chat-session.d.ts +2 -1
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +3 -0
- package/dist/session/message-queue.cjs +48 -75
- package/dist/session/message-queue.d.ts +1 -2
- package/dist/session/message-queue.d.ts.map +1 -1
- package/dist/session/message-queue.js +48 -75
- package/dist/session/session-manager.cjs +14 -32
- package/dist/session/session-manager.d.ts +5 -2
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +14 -32
- package/dist/storage/approvals/types.cjs +2 -9
- package/dist/storage/approvals/types.d.ts +4 -16
- package/dist/storage/approvals/types.d.ts.map +1 -1
- package/dist/storage/approvals/types.js +2 -8
- package/dist/storage/database/types.d.ts +5 -0
- package/dist/storage/database/types.d.ts.map +1 -1
- package/dist/storage/index.cjs +0 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -2
- package/dist/storage/message-queue/types.d.ts +14 -6
- package/dist/storage/message-queue/types.d.ts.map +1 -1
- package/dist/storage/stores/backend.cjs +68 -32
- package/dist/storage/stores/backend.d.ts +17 -8
- package/dist/storage/stores/backend.d.ts.map +1 -1
- package/dist/storage/stores/backend.js +69 -33
- package/dist/storage/stores/in-memory.cjs +26 -11
- package/dist/storage/stores/in-memory.d.ts.map +1 -1
- package/dist/storage/stores/in-memory.js +27 -12
- package/dist/test-utils/in-memory-storage.cjs +11 -0
- package/dist/test-utils/in-memory-storage.js +11 -0
- package/dist/test-utils/session-state-stores.cjs +25 -9
- package/dist/test-utils/session-state-stores.js +26 -10
- package/dist/tools/approval/tool-approval-policy.cjs +87 -0
- package/dist/tools/approval/tool-approval-policy.d.ts +34 -0
- package/dist/tools/approval/tool-approval-policy.d.ts.map +1 -0
- package/dist/tools/approval/tool-approval-policy.js +64 -0
- package/dist/tools/error-codes.cjs +0 -1
- package/dist/tools/error-codes.d.ts +0 -1
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +0 -1
- package/dist/tools/errors.cjs +0 -15
- package/dist/tools/errors.d.ts +0 -9
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +0 -15
- package/dist/tools/index.cjs +2 -0
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +5 -1
- package/dist/tools/tool-manager.cjs +94 -312
- package/dist/tools/tool-manager.d.ts +4 -19
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +95 -316
- package/dist/tools/types.d.ts +10 -9
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/service-initializer.cjs +3 -0
- package/dist/utils/service-initializer.d.ts +2 -1
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +3 -0
- package/package.json +2 -2
- package/dist/tools/pattern-utils.cjs +0 -33
- package/dist/tools/pattern-utils.d.ts +0 -20
- package/dist/tools/pattern-utils.d.ts.map +0 -1
- package/dist/tools/pattern-utils.js +0 -10
|
@@ -10,7 +10,6 @@ export declare const ApprovalTypeSchema: z.ZodEnum<{
|
|
|
10
10
|
tool_approval: "tool_approval";
|
|
11
11
|
command_approval: "command_approval";
|
|
12
12
|
elicitation: "elicitation";
|
|
13
|
-
directory_access: "directory_access";
|
|
14
13
|
}>;
|
|
15
14
|
/**
|
|
16
15
|
* Schema for approval status
|
|
@@ -32,41 +31,17 @@ export declare const DenialReasonSchema: z.ZodEnum<{
|
|
|
32
31
|
validation_failed: "validation_failed";
|
|
33
32
|
elicitation_disabled: "elicitation_disabled";
|
|
34
33
|
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Directory access metadata schema
|
|
37
|
-
* Used when a tool tries to access files outside the working directory
|
|
38
|
-
*/
|
|
39
|
-
export declare const DirectoryAccessMetadataSchema: z.ZodObject<{
|
|
40
|
-
path: z.ZodString;
|
|
41
|
-
parentDir: z.ZodString;
|
|
42
|
-
operation: z.ZodEnum<{
|
|
43
|
-
read: "read";
|
|
44
|
-
write: "write";
|
|
45
|
-
edit: "edit";
|
|
46
|
-
}>;
|
|
47
|
-
toolName: z.ZodString;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
34
|
/**
|
|
50
35
|
* Tool approval metadata schema
|
|
51
36
|
*/
|
|
52
37
|
export declare const ToolApprovalMetadataSchema: z.ZodObject<{
|
|
53
38
|
toolName: z.ZodString;
|
|
39
|
+
approvalKey: z.ZodOptional<z.ZodString>;
|
|
54
40
|
presentationSnapshot: z.ZodOptional<z.ZodCustom<ToolPresentationSnapshotV1, ToolPresentationSnapshotV1>>;
|
|
55
41
|
toolCallId: z.ZodString;
|
|
56
42
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
43
|
description: z.ZodOptional<z.ZodString>;
|
|
58
44
|
displayPreview: z.ZodOptional<z.ZodCustom<ToolDisplayData, ToolDisplayData>>;
|
|
59
|
-
directoryAccess: z.ZodOptional<z.ZodObject<{
|
|
60
|
-
path: z.ZodString;
|
|
61
|
-
parentDir: z.ZodString;
|
|
62
|
-
operation: z.ZodEnum<{
|
|
63
|
-
read: "read";
|
|
64
|
-
write: "write";
|
|
65
|
-
edit: "edit";
|
|
66
|
-
}>;
|
|
67
|
-
toolName: z.ZodString;
|
|
68
|
-
}, z.core.$strict>>;
|
|
69
|
-
suggestedPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
45
|
}, z.core.$strict>;
|
|
71
46
|
/**
|
|
72
47
|
* Command approval metadata schema
|
|
@@ -100,7 +75,6 @@ export declare const BaseApprovalRequestSchema: z.ZodObject<{
|
|
|
100
75
|
tool_approval: "tool_approval";
|
|
101
76
|
command_approval: "command_approval";
|
|
102
77
|
elicitation: "elicitation";
|
|
103
|
-
directory_access: "directory_access";
|
|
104
78
|
}>;
|
|
105
79
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
106
80
|
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
@@ -123,22 +97,12 @@ export declare const ToolApprovalRequestSchema: z.ZodObject<{
|
|
|
123
97
|
type: z.ZodLiteral<"tool_approval">;
|
|
124
98
|
metadata: z.ZodObject<{
|
|
125
99
|
toolName: z.ZodString;
|
|
100
|
+
approvalKey: z.ZodOptional<z.ZodString>;
|
|
126
101
|
presentationSnapshot: z.ZodOptional<z.ZodCustom<ToolPresentationSnapshotV1, ToolPresentationSnapshotV1>>;
|
|
127
102
|
toolCallId: z.ZodString;
|
|
128
103
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
129
104
|
description: z.ZodOptional<z.ZodString>;
|
|
130
105
|
displayPreview: z.ZodOptional<z.ZodCustom<ToolDisplayData, ToolDisplayData>>;
|
|
131
|
-
directoryAccess: z.ZodOptional<z.ZodObject<{
|
|
132
|
-
path: z.ZodString;
|
|
133
|
-
parentDir: z.ZodString;
|
|
134
|
-
operation: z.ZodEnum<{
|
|
135
|
-
read: "read";
|
|
136
|
-
write: "write";
|
|
137
|
-
edit: "edit";
|
|
138
|
-
}>;
|
|
139
|
-
toolName: z.ZodString;
|
|
140
|
-
}, z.core.$strict>>;
|
|
141
|
-
suggestedPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
142
106
|
}, z.core.$strict>;
|
|
143
107
|
}, z.core.$strict>;
|
|
144
108
|
/**
|
|
@@ -192,29 +156,6 @@ export declare const CustomApprovalRequestSchema: z.ZodObject<{
|
|
|
192
156
|
type: z.ZodLiteral<"custom">;
|
|
193
157
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
194
158
|
}, z.core.$strict>;
|
|
195
|
-
/**
|
|
196
|
-
* Directory access request schema
|
|
197
|
-
*/
|
|
198
|
-
export declare const DirectoryAccessRequestSchema: z.ZodObject<{
|
|
199
|
-
approvalId: z.ZodString;
|
|
200
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
201
|
-
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
202
|
-
ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
203
|
-
}, z.core.$strict>>;
|
|
204
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
205
|
-
timestamp: z.ZodCoercedDate<unknown>;
|
|
206
|
-
type: z.ZodLiteral<"directory_access">;
|
|
207
|
-
metadata: z.ZodObject<{
|
|
208
|
-
path: z.ZodString;
|
|
209
|
-
parentDir: z.ZodString;
|
|
210
|
-
operation: z.ZodEnum<{
|
|
211
|
-
read: "read";
|
|
212
|
-
write: "write";
|
|
213
|
-
edit: "edit";
|
|
214
|
-
}>;
|
|
215
|
-
toolName: z.ZodString;
|
|
216
|
-
}, z.core.$strict>;
|
|
217
|
-
}, z.core.$strict>;
|
|
218
159
|
/**
|
|
219
160
|
* Discriminated union for all approval requests
|
|
220
161
|
*/
|
|
@@ -229,22 +170,12 @@ export declare const ApprovalRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
229
170
|
type: z.ZodLiteral<"tool_approval">;
|
|
230
171
|
metadata: z.ZodObject<{
|
|
231
172
|
toolName: z.ZodString;
|
|
173
|
+
approvalKey: z.ZodOptional<z.ZodString>;
|
|
232
174
|
presentationSnapshot: z.ZodOptional<z.ZodCustom<ToolPresentationSnapshotV1, ToolPresentationSnapshotV1>>;
|
|
233
175
|
toolCallId: z.ZodString;
|
|
234
176
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
235
177
|
description: z.ZodOptional<z.ZodString>;
|
|
236
178
|
displayPreview: z.ZodOptional<z.ZodCustom<ToolDisplayData, ToolDisplayData>>;
|
|
237
|
-
directoryAccess: z.ZodOptional<z.ZodObject<{
|
|
238
|
-
path: z.ZodString;
|
|
239
|
-
parentDir: z.ZodString;
|
|
240
|
-
operation: z.ZodEnum<{
|
|
241
|
-
read: "read";
|
|
242
|
-
write: "write";
|
|
243
|
-
edit: "edit";
|
|
244
|
-
}>;
|
|
245
|
-
toolName: z.ZodString;
|
|
246
|
-
}, z.core.$strict>>;
|
|
247
|
-
suggestedPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
179
|
}, z.core.$strict>;
|
|
249
180
|
}, z.core.$strict>, z.ZodObject<{
|
|
250
181
|
approvalId: z.ZodString;
|
|
@@ -285,33 +216,12 @@ export declare const ApprovalRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
285
216
|
timestamp: z.ZodCoercedDate<unknown>;
|
|
286
217
|
type: z.ZodLiteral<"custom">;
|
|
287
218
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
288
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
289
|
-
approvalId: z.ZodString;
|
|
290
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
291
|
-
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
292
|
-
ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
293
|
-
}, z.core.$strict>>;
|
|
294
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
295
|
-
timestamp: z.ZodCoercedDate<unknown>;
|
|
296
|
-
type: z.ZodLiteral<"directory_access">;
|
|
297
|
-
metadata: z.ZodObject<{
|
|
298
|
-
path: z.ZodString;
|
|
299
|
-
parentDir: z.ZodString;
|
|
300
|
-
operation: z.ZodEnum<{
|
|
301
|
-
read: "read";
|
|
302
|
-
write: "write";
|
|
303
|
-
edit: "edit";
|
|
304
|
-
}>;
|
|
305
|
-
toolName: z.ZodString;
|
|
306
|
-
}, z.core.$strict>;
|
|
307
219
|
}, z.core.$strict>], "type">;
|
|
308
220
|
/**
|
|
309
221
|
* Tool approval response data schema
|
|
310
222
|
*/
|
|
311
223
|
export declare const ToolApprovalResponseDataSchema: z.ZodObject<{
|
|
312
224
|
rememberChoice: z.ZodOptional<z.ZodBoolean>;
|
|
313
|
-
rememberPattern: z.ZodOptional<z.ZodString>;
|
|
314
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
315
225
|
}, z.core.$strict>;
|
|
316
226
|
/**
|
|
317
227
|
* Command approval response data schema
|
|
@@ -327,12 +237,6 @@ export declare const ElicitationResponseDataSchema: z.ZodObject<{
|
|
|
327
237
|
* Custom approval response data schema
|
|
328
238
|
*/
|
|
329
239
|
export declare const CustomApprovalResponseDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
330
|
-
/**
|
|
331
|
-
* Directory access response data schema
|
|
332
|
-
*/
|
|
333
|
-
export declare const DirectoryAccessResponseDataSchema: z.ZodObject<{
|
|
334
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
335
|
-
}, z.core.$strict>;
|
|
336
240
|
/**
|
|
337
241
|
* Base approval response schema
|
|
338
242
|
*/
|
|
@@ -386,8 +290,6 @@ export declare const ToolApprovalResponseSchema: z.ZodObject<{
|
|
|
386
290
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
387
291
|
data: z.ZodOptional<z.ZodObject<{
|
|
388
292
|
rememberChoice: z.ZodOptional<z.ZodBoolean>;
|
|
389
|
-
rememberPattern: z.ZodOptional<z.ZodString>;
|
|
390
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
391
293
|
}, z.core.$strict>>;
|
|
392
294
|
}, z.core.$strict>;
|
|
393
295
|
/**
|
|
@@ -473,35 +375,6 @@ export declare const CustomApprovalResponseSchema: z.ZodObject<{
|
|
|
473
375
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
474
376
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
475
377
|
}, z.core.$strict>;
|
|
476
|
-
/**
|
|
477
|
-
* Directory access response schema
|
|
478
|
-
*/
|
|
479
|
-
export declare const DirectoryAccessResponseSchema: z.ZodObject<{
|
|
480
|
-
approvalId: z.ZodString;
|
|
481
|
-
status: z.ZodEnum<{
|
|
482
|
-
approved: "approved";
|
|
483
|
-
denied: "denied";
|
|
484
|
-
cancelled: "cancelled";
|
|
485
|
-
}>;
|
|
486
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
487
|
-
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
488
|
-
ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
489
|
-
}, z.core.$strict>>;
|
|
490
|
-
reason: z.ZodOptional<z.ZodEnum<{
|
|
491
|
-
timeout: "timeout";
|
|
492
|
-
user_denied: "user_denied";
|
|
493
|
-
system_denied: "system_denied";
|
|
494
|
-
user_cancelled: "user_cancelled";
|
|
495
|
-
system_cancelled: "system_cancelled";
|
|
496
|
-
validation_failed: "validation_failed";
|
|
497
|
-
elicitation_disabled: "elicitation_disabled";
|
|
498
|
-
}>>;
|
|
499
|
-
message: z.ZodOptional<z.ZodString>;
|
|
500
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
501
|
-
data: z.ZodOptional<z.ZodObject<{
|
|
502
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
503
|
-
}, z.core.$strict>>;
|
|
504
|
-
}, z.core.$strict>;
|
|
505
378
|
/**
|
|
506
379
|
* Union of all approval responses
|
|
507
380
|
*/
|
|
@@ -529,8 +402,6 @@ export declare const ApprovalResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
529
402
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
530
403
|
data: z.ZodOptional<z.ZodObject<{
|
|
531
404
|
rememberChoice: z.ZodOptional<z.ZodBoolean>;
|
|
532
|
-
rememberPattern: z.ZodOptional<z.ZodString>;
|
|
533
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
534
405
|
}, z.core.$strict>>;
|
|
535
406
|
}, z.core.$strict>, z.ZodObject<{
|
|
536
407
|
approvalId: z.ZodString;
|
|
@@ -603,31 +474,6 @@ export declare const ApprovalResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
603
474
|
message: z.ZodOptional<z.ZodString>;
|
|
604
475
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
605
476
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
606
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
607
|
-
approvalId: z.ZodString;
|
|
608
|
-
status: z.ZodEnum<{
|
|
609
|
-
approved: "approved";
|
|
610
|
-
denied: "denied";
|
|
611
|
-
cancelled: "cancelled";
|
|
612
|
-
}>;
|
|
613
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
614
|
-
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
615
|
-
ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
616
|
-
}, z.core.$strict>>;
|
|
617
|
-
reason: z.ZodOptional<z.ZodEnum<{
|
|
618
|
-
timeout: "timeout";
|
|
619
|
-
user_denied: "user_denied";
|
|
620
|
-
system_denied: "system_denied";
|
|
621
|
-
user_cancelled: "user_cancelled";
|
|
622
|
-
system_cancelled: "system_cancelled";
|
|
623
|
-
validation_failed: "validation_failed";
|
|
624
|
-
elicitation_disabled: "elicitation_disabled";
|
|
625
|
-
}>>;
|
|
626
|
-
message: z.ZodOptional<z.ZodString>;
|
|
627
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
628
|
-
data: z.ZodOptional<z.ZodObject<{
|
|
629
|
-
rememberDirectory: z.ZodOptional<z.ZodBoolean>;
|
|
630
|
-
}, z.core.$strict>>;
|
|
631
477
|
}, z.core.$strict>]>;
|
|
632
478
|
/**
|
|
633
479
|
* Approval request details schema for creating requests
|
|
@@ -638,7 +484,6 @@ export declare const ApprovalRequestDetailsSchema: z.ZodObject<{
|
|
|
638
484
|
tool_approval: "tool_approval";
|
|
639
485
|
command_approval: "command_approval";
|
|
640
486
|
elicitation: "elicitation";
|
|
641
|
-
directory_access: "directory_access";
|
|
642
487
|
}>;
|
|
643
488
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
644
489
|
hostRuntime: z.ZodOptional<z.ZodObject<{
|
|
@@ -647,22 +492,12 @@ export declare const ApprovalRequestDetailsSchema: z.ZodObject<{
|
|
|
647
492
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
648
493
|
metadata: z.ZodUnion<readonly [z.ZodObject<{
|
|
649
494
|
toolName: z.ZodString;
|
|
495
|
+
approvalKey: z.ZodOptional<z.ZodString>;
|
|
650
496
|
presentationSnapshot: z.ZodOptional<z.ZodCustom<ToolPresentationSnapshotV1, ToolPresentationSnapshotV1>>;
|
|
651
497
|
toolCallId: z.ZodString;
|
|
652
498
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
653
499
|
description: z.ZodOptional<z.ZodString>;
|
|
654
500
|
displayPreview: z.ZodOptional<z.ZodCustom<ToolDisplayData, ToolDisplayData>>;
|
|
655
|
-
directoryAccess: z.ZodOptional<z.ZodObject<{
|
|
656
|
-
path: z.ZodString;
|
|
657
|
-
parentDir: z.ZodString;
|
|
658
|
-
operation: z.ZodEnum<{
|
|
659
|
-
read: "read";
|
|
660
|
-
write: "write";
|
|
661
|
-
edit: "edit";
|
|
662
|
-
}>;
|
|
663
|
-
toolName: z.ZodString;
|
|
664
|
-
}, z.core.$strict>>;
|
|
665
|
-
suggestedPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
666
501
|
}, z.core.$strict>, z.ZodObject<{
|
|
667
502
|
toolName: z.ZodString;
|
|
668
503
|
command: z.ZodString;
|
|
@@ -672,16 +507,7 @@ export declare const ApprovalRequestDetailsSchema: z.ZodObject<{
|
|
|
672
507
|
prompt: z.ZodString;
|
|
673
508
|
serverName: z.ZodString;
|
|
674
509
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
675
|
-
}, z.core.$strict>, z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
676
|
-
path: z.ZodString;
|
|
677
|
-
parentDir: z.ZodString;
|
|
678
|
-
operation: z.ZodEnum<{
|
|
679
|
-
read: "read";
|
|
680
|
-
write: "write";
|
|
681
|
-
edit: "edit";
|
|
682
|
-
}>;
|
|
683
|
-
toolName: z.ZodString;
|
|
684
|
-
}, z.core.$strict>]>;
|
|
510
|
+
}, z.core.$strict>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
|
|
685
511
|
}, z.core.$strip>;
|
|
686
512
|
/**
|
|
687
513
|
* Type inference for validated schemas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/approval/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAMpE;;GAEG;AACH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/approval/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAMpE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;EAAyB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;EAA4B,CAAC;AAE9D;;GAEG;A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AAyB;;;;;;;;;;;;;;;;;;;;;;;;;kBAE3B,CAAC;AAEZ;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;kBAE9B,CAAC;AAEZ;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAKjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DnC,CAAC;AAEP;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAChF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACtF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACpF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/approval/schemas.js
CHANGED
|
@@ -16,14 +16,11 @@ const ToolPresentationSnapshotV1Schema = z.custom(
|
|
|
16
16
|
message: "Invalid ToolPresentationSnapshotV1"
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
|
-
const DirectoryAccessMetadataSchema = z.object({
|
|
20
|
-
path: z.string().describe("Full path being accessed"),
|
|
21
|
-
parentDir: z.string().describe("Parent directory (what gets approved for session)"),
|
|
22
|
-
operation: z.enum(["read", "write", "edit"]).describe("Type of file operation"),
|
|
23
|
-
toolName: z.string().describe("Name of the tool requesting access")
|
|
24
|
-
}).strict().describe("Directory access metadata");
|
|
25
19
|
const ToolApprovalMetadataSchema = z.object({
|
|
26
20
|
toolName: z.string().describe("Name of the tool to approve"),
|
|
21
|
+
approvalKey: z.string().min(1).optional().describe(
|
|
22
|
+
"Optional opaque key identifying the approval scope. Core stores keys exactly and does not interpret them."
|
|
23
|
+
),
|
|
27
24
|
presentationSnapshot: ToolPresentationSnapshotV1Schema.optional().describe(
|
|
28
25
|
"Optional UI-agnostic presentation snapshot for the tool call. Clients MUST ignore unknown fields."
|
|
29
26
|
),
|
|
@@ -32,12 +29,6 @@ const ToolApprovalMetadataSchema = z.object({
|
|
|
32
29
|
description: z.string().optional().describe("Description of the tool"),
|
|
33
30
|
displayPreview: ToolDisplayDataSchema.optional().describe(
|
|
34
31
|
"Preview display data for approval UI (e.g., diff preview)"
|
|
35
|
-
),
|
|
36
|
-
directoryAccess: DirectoryAccessMetadataSchema.optional().describe(
|
|
37
|
-
"Optional directory access metadata when the tool targets a path outside config-allowed roots"
|
|
38
|
-
),
|
|
39
|
-
suggestedPatterns: z.array(z.string()).optional().describe(
|
|
40
|
-
'Suggested patterns for session approval. Tools may provide patterns to allow approving a broader subset of future calls (e.g., ["git push *", "git *"]).'
|
|
41
32
|
)
|
|
42
33
|
}).strict().describe("Tool approval metadata");
|
|
43
34
|
const CommandApprovalMetadataSchema = z.object({
|
|
@@ -78,24 +69,15 @@ const CustomApprovalRequestSchema = BaseApprovalRequestSchema.extend({
|
|
|
78
69
|
type: z.literal(ApprovalType.CUSTOM),
|
|
79
70
|
metadata: CustomApprovalMetadataSchema
|
|
80
71
|
}).strict();
|
|
81
|
-
const DirectoryAccessRequestSchema = BaseApprovalRequestSchema.extend({
|
|
82
|
-
type: z.literal(ApprovalType.DIRECTORY_ACCESS),
|
|
83
|
-
metadata: DirectoryAccessMetadataSchema
|
|
84
|
-
}).strict();
|
|
85
72
|
const ApprovalRequestSchema = z.discriminatedUnion("type", [
|
|
86
73
|
ToolApprovalRequestSchema,
|
|
87
74
|
CommandApprovalRequestSchema,
|
|
88
75
|
ElicitationRequestSchema,
|
|
89
|
-
CustomApprovalRequestSchema
|
|
90
|
-
DirectoryAccessRequestSchema
|
|
76
|
+
CustomApprovalRequestSchema
|
|
91
77
|
]);
|
|
92
78
|
const ToolApprovalResponseDataSchema = z.object({
|
|
93
|
-
rememberChoice: z.boolean().optional().describe(
|
|
94
|
-
|
|
95
|
-
'Remember an approval pattern (e.g., "git *"). Only applicable when the tool provides pattern-based approval support.'
|
|
96
|
-
),
|
|
97
|
-
rememberDirectory: z.boolean().optional().describe(
|
|
98
|
-
"Remember this directory for the session (allows future access without prompting again)"
|
|
79
|
+
rememberChoice: z.boolean().optional().describe(
|
|
80
|
+
"Remember this approval scope for the session. If an approval key is present, only matching keys are remembered; otherwise all uses of this tool are approved."
|
|
99
81
|
)
|
|
100
82
|
}).strict().describe("Tool approval response data");
|
|
101
83
|
const CommandApprovalResponseDataSchema = z.object({
|
|
@@ -106,9 +88,6 @@ const ElicitationResponseDataSchema = z.object({
|
|
|
106
88
|
formData: z.record(z.string(), z.unknown()).describe("Form data matching schema")
|
|
107
89
|
}).strict().describe("Elicitation response data");
|
|
108
90
|
const CustomApprovalResponseDataSchema = z.record(z.string(), z.unknown()).describe("Custom response data");
|
|
109
|
-
const DirectoryAccessResponseDataSchema = z.object({
|
|
110
|
-
rememberDirectory: z.boolean().optional().describe("Remember this directory for the session (allows all file access within it)")
|
|
111
|
-
}).strict().describe("Directory access response data");
|
|
112
91
|
const BaseApprovalResponseSchema = z.object({
|
|
113
92
|
approvalId: z.string().uuid().describe("Must match request approvalId"),
|
|
114
93
|
status: ApprovalStatusSchema.describe("Approval status"),
|
|
@@ -134,15 +113,11 @@ const ElicitationResponseSchema = BaseApprovalResponseSchema.extend({
|
|
|
134
113
|
const CustomApprovalResponseSchema = BaseApprovalResponseSchema.extend({
|
|
135
114
|
data: CustomApprovalResponseDataSchema.optional()
|
|
136
115
|
}).strict();
|
|
137
|
-
const DirectoryAccessResponseSchema = BaseApprovalResponseSchema.extend({
|
|
138
|
-
data: DirectoryAccessResponseDataSchema.optional()
|
|
139
|
-
}).strict();
|
|
140
116
|
const ApprovalResponseSchema = z.union([
|
|
141
117
|
ToolApprovalResponseSchema,
|
|
142
118
|
CommandApprovalResponseSchema,
|
|
143
119
|
ElicitationResponseSchema,
|
|
144
|
-
CustomApprovalResponseSchema
|
|
145
|
-
DirectoryAccessResponseSchema
|
|
120
|
+
CustomApprovalResponseSchema
|
|
146
121
|
]);
|
|
147
122
|
const ApprovalRequestDetailsSchema = z.object({
|
|
148
123
|
type: ApprovalTypeSchema,
|
|
@@ -155,8 +130,7 @@ const ApprovalRequestDetailsSchema = z.object({
|
|
|
155
130
|
ToolApprovalMetadataSchema,
|
|
156
131
|
CommandApprovalMetadataSchema,
|
|
157
132
|
ElicitationMetadataSchema,
|
|
158
|
-
CustomApprovalMetadataSchema
|
|
159
|
-
DirectoryAccessMetadataSchema
|
|
133
|
+
CustomApprovalMetadataSchema
|
|
160
134
|
])
|
|
161
135
|
}).superRefine((data, ctx) => {
|
|
162
136
|
if (data.type === ApprovalType.TOOL_APPROVAL) {
|
|
@@ -186,15 +160,6 @@ const ApprovalRequestDetailsSchema = z.object({
|
|
|
186
160
|
path: ["metadata"]
|
|
187
161
|
});
|
|
188
162
|
}
|
|
189
|
-
} else if (data.type === ApprovalType.DIRECTORY_ACCESS) {
|
|
190
|
-
const result = DirectoryAccessMetadataSchema.safeParse(data.metadata);
|
|
191
|
-
if (!result.success) {
|
|
192
|
-
ctx.addIssue({
|
|
193
|
-
code: z.ZodIssueCode.custom,
|
|
194
|
-
message: "Metadata must match DirectoryAccessMetadataSchema for DIRECTORY_ACCESS type",
|
|
195
|
-
path: ["metadata"]
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
163
|
} else if (data.type === ApprovalType.CUSTOM) {
|
|
199
164
|
const result = CustomApprovalMetadataSchema.safeParse(data.metadata);
|
|
200
165
|
if (!result.success) {
|
|
@@ -223,10 +188,6 @@ export {
|
|
|
223
188
|
CustomApprovalResponseDataSchema,
|
|
224
189
|
CustomApprovalResponseSchema,
|
|
225
190
|
DenialReasonSchema,
|
|
226
|
-
DirectoryAccessMetadataSchema,
|
|
227
|
-
DirectoryAccessRequestSchema,
|
|
228
|
-
DirectoryAccessResponseDataSchema,
|
|
229
|
-
DirectoryAccessResponseSchema,
|
|
230
191
|
ElicitationMetadataSchema,
|
|
231
192
|
ElicitationRequestSchema,
|
|
232
193
|
ElicitationResponseDataSchema,
|
package/dist/approval/types.cjs
CHANGED
|
@@ -30,7 +30,6 @@ const APPROVAL_TYPES = [
|
|
|
30
30
|
"tool_approval",
|
|
31
31
|
"command_approval",
|
|
32
32
|
"elicitation",
|
|
33
|
-
"directory_access",
|
|
34
33
|
"custom"
|
|
35
34
|
];
|
|
36
35
|
const ApprovalTypeValues = {
|
|
@@ -50,11 +49,6 @@ const ApprovalTypeValues = {
|
|
|
50
49
|
* Metadata contains: schema, prompt, serverName, context
|
|
51
50
|
*/
|
|
52
51
|
ELICITATION: "elicitation",
|
|
53
|
-
/**
|
|
54
|
-
* Approval for accessing files outside the working directory
|
|
55
|
-
* Metadata contains: path, parentDir, operation, toolName
|
|
56
|
-
*/
|
|
57
|
-
DIRECTORY_ACCESS: "directory_access",
|
|
58
52
|
/**
|
|
59
53
|
* Custom approval types for extensibility
|
|
60
54
|
* Metadata format defined by consumer
|
package/dist/approval/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { ToolApprovalMetadataSchema, CommandApprovalMetadataSchema, ElicitationMetadataSchema, CustomApprovalMetadataSchema,
|
|
2
|
+
import type { ToolApprovalMetadataSchema, CommandApprovalMetadataSchema, ElicitationMetadataSchema, CustomApprovalMetadataSchema, BaseApprovalRequestSchema, ToolApprovalRequestSchema, CommandApprovalRequestSchema, ElicitationRequestSchema, CustomApprovalRequestSchema, ApprovalRequestSchema, ApprovalRequestDetailsSchema, ToolApprovalResponseDataSchema, CommandApprovalResponseDataSchema, ElicitationResponseDataSchema, CustomApprovalResponseDataSchema, BaseApprovalResponseSchema, ToolApprovalResponseSchema, CommandApprovalResponseSchema, ElicitationResponseSchema, CustomApprovalResponseSchema, ApprovalResponseSchema } from './schemas.js';
|
|
3
3
|
/**
|
|
4
4
|
* Types of approval requests supported by the system
|
|
5
5
|
*/
|
|
6
|
-
export declare const APPROVAL_TYPES: readonly ["tool_approval", "command_approval", "elicitation", "
|
|
6
|
+
export declare const APPROVAL_TYPES: readonly ["tool_approval", "command_approval", "elicitation", "custom"];
|
|
7
7
|
export type ApprovalType = (typeof APPROVAL_TYPES)[number];
|
|
8
8
|
declare const ApprovalTypeValues: {
|
|
9
9
|
/**
|
|
@@ -22,11 +22,6 @@ declare const ApprovalTypeValues: {
|
|
|
22
22
|
* Metadata contains: schema, prompt, serverName, context
|
|
23
23
|
*/
|
|
24
24
|
readonly ELICITATION: "elicitation";
|
|
25
|
-
/**
|
|
26
|
-
* Approval for accessing files outside the working directory
|
|
27
|
-
* Metadata contains: path, parentDir, operation, toolName
|
|
28
|
-
*/
|
|
29
|
-
readonly DIRECTORY_ACCESS: "directory_access";
|
|
30
25
|
/**
|
|
31
26
|
* Custom approval types for extensibility
|
|
32
27
|
* Metadata format defined by consumer
|
|
@@ -88,11 +83,6 @@ export type ElicitationMetadata = z.output<typeof ElicitationMetadataSchema>;
|
|
|
88
83
|
* Derived from CustomApprovalMetadataSchema
|
|
89
84
|
*/
|
|
90
85
|
export type CustomApprovalMetadata = z.output<typeof CustomApprovalMetadataSchema>;
|
|
91
|
-
/**
|
|
92
|
-
* Directory access metadata
|
|
93
|
-
* Derived from DirectoryAccessMetadataSchema
|
|
94
|
-
*/
|
|
95
|
-
export type DirectoryAccessMetadata = z.output<typeof DirectoryAccessMetadataSchema>;
|
|
96
86
|
/**
|
|
97
87
|
* Base approval request that all approvals extend
|
|
98
88
|
* Derived from BaseApprovalRequestSchema
|
|
@@ -118,11 +108,6 @@ export type ElicitationRequest = z.output<typeof ElicitationRequestSchema>;
|
|
|
118
108
|
* Derived from CustomApprovalRequestSchema
|
|
119
109
|
*/
|
|
120
110
|
export type CustomApprovalRequest = z.output<typeof CustomApprovalRequestSchema>;
|
|
121
|
-
/**
|
|
122
|
-
* Directory access request
|
|
123
|
-
* Derived from DirectoryAccessRequestSchema
|
|
124
|
-
*/
|
|
125
|
-
export type DirectoryAccessRequest = z.output<typeof DirectoryAccessRequestSchema>;
|
|
126
111
|
/**
|
|
127
112
|
* Union of all approval request types
|
|
128
113
|
* Derived from ApprovalRequestSchema
|
|
@@ -148,11 +133,6 @@ export type ElicitationResponseData = z.output<typeof ElicitationResponseDataSch
|
|
|
148
133
|
* Derived from CustomApprovalResponseDataSchema
|
|
149
134
|
*/
|
|
150
135
|
export type CustomApprovalResponseData = z.output<typeof CustomApprovalResponseDataSchema>;
|
|
151
|
-
/**
|
|
152
|
-
* Directory access response data
|
|
153
|
-
* Derived from DirectoryAccessResponseDataSchema
|
|
154
|
-
*/
|
|
155
|
-
export type DirectoryAccessResponseData = z.output<typeof DirectoryAccessResponseDataSchema>;
|
|
156
136
|
/**
|
|
157
137
|
* Base approval response
|
|
158
138
|
* Derived from BaseApprovalResponseSchema
|
|
@@ -178,11 +158,6 @@ export type ElicitationResponse = z.output<typeof ElicitationResponseSchema>;
|
|
|
178
158
|
* Derived from CustomApprovalResponseSchema
|
|
179
159
|
*/
|
|
180
160
|
export type CustomApprovalResponse = z.output<typeof CustomApprovalResponseSchema>;
|
|
181
|
-
/**
|
|
182
|
-
* Directory access response
|
|
183
|
-
* Derived from DirectoryAccessResponseSchema
|
|
184
|
-
*/
|
|
185
|
-
export type DirectoryAccessResponse = z.output<typeof DirectoryAccessResponseSchema>;
|
|
186
161
|
/**
|
|
187
162
|
* Union of all approval response types
|
|
188
163
|
* Derived from ApprovalResponseSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/approval/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,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gB,CAAC,CAAC;IAEtD;;;;OAIG;IACH,MAAM,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;OAGG;IACH,SAAS,CAAC,IAAI,IAAI,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,IAAI,MAAM,EAAE,CAAC;IAExB;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,eAAe,EAAE,CAAC;IAEzC;;;;;;;;;OASG;IACH,kBAAkB,CAAC,CACf,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,EAChD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,MAAM,CAAC;CACb"}
|
package/dist/approval/types.js
CHANGED
|
@@ -3,7 +3,6 @@ const APPROVAL_TYPES = [
|
|
|
3
3
|
"tool_approval",
|
|
4
4
|
"command_approval",
|
|
5
5
|
"elicitation",
|
|
6
|
-
"directory_access",
|
|
7
6
|
"custom"
|
|
8
7
|
];
|
|
9
8
|
const ApprovalTypeValues = {
|
|
@@ -23,11 +22,6 @@ const ApprovalTypeValues = {
|
|
|
23
22
|
* Metadata contains: schema, prompt, serverName, context
|
|
24
23
|
*/
|
|
25
24
|
ELICITATION: "elicitation",
|
|
26
|
-
/**
|
|
27
|
-
* Approval for accessing files outside the working directory
|
|
28
|
-
* Metadata contains: path, parentDir, operation, toolName
|
|
29
|
-
*/
|
|
30
|
-
DIRECTORY_ACCESS: "directory_access",
|
|
31
25
|
/**
|
|
32
26
|
* Custom approval types for extensibility
|
|
33
27
|
* Metadata format defined by consumer
|
|
@@ -98,23 +98,27 @@ function clonePromptContentPart(part) {
|
|
|
98
98
|
function cloneInternalMessage(message) {
|
|
99
99
|
switch (message.role) {
|
|
100
100
|
case "assistant": {
|
|
101
|
-
const
|
|
101
|
+
const { content, ...messageWithoutContent } = message;
|
|
102
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
102
103
|
return {
|
|
103
104
|
...cloned,
|
|
104
|
-
content:
|
|
105
|
+
content: content === null ? null : cloneContentParts(content)
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
case "system": {
|
|
108
|
-
const
|
|
109
|
-
|
|
109
|
+
const { content, ...messageWithoutContent } = message;
|
|
110
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
111
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
110
112
|
}
|
|
111
113
|
case "user": {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
+
const { content, ...messageWithoutContent } = message;
|
|
115
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
116
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
114
117
|
}
|
|
115
118
|
case "tool": {
|
|
116
|
-
const
|
|
117
|
-
|
|
119
|
+
const { content, ...messageWithoutContent } = message;
|
|
120
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
121
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-clone.d.ts","sourceRoot":"","sources":["../../src/context/content-clone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmC9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgC/D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAEvE;AAED,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GACtC,QAAQ,GAAG,SAAS,GAAG,QAAQ,CASjC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"content-clone.d.ts","sourceRoot":"","sources":["../../src/context/content-clone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmC9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgC/D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAEvE;AAED,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GACtC,QAAQ,GAAG,SAAS,GAAG,QAAQ,CASjC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CA0B9E;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAEpF"}
|
|
@@ -72,23 +72,27 @@ function clonePromptContentPart(part) {
|
|
|
72
72
|
function cloneInternalMessage(message) {
|
|
73
73
|
switch (message.role) {
|
|
74
74
|
case "assistant": {
|
|
75
|
-
const
|
|
75
|
+
const { content, ...messageWithoutContent } = message;
|
|
76
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
76
77
|
return {
|
|
77
78
|
...cloned,
|
|
78
|
-
content:
|
|
79
|
+
content: content === null ? null : cloneContentParts(content)
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
case "system": {
|
|
82
|
-
const
|
|
83
|
-
|
|
83
|
+
const { content, ...messageWithoutContent } = message;
|
|
84
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
85
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
84
86
|
}
|
|
85
87
|
case "user": {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
+
const { content, ...messageWithoutContent } = message;
|
|
89
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
90
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
88
91
|
}
|
|
89
92
|
case "tool": {
|
|
90
|
-
const
|
|
91
|
-
|
|
93
|
+
const { content, ...messageWithoutContent } = message;
|
|
94
|
+
const cloned = structuredClone(messageWithoutContent);
|
|
95
|
+
return { ...cloned, content: cloneContentParts(content) };
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
}
|