@dexto/core 1.6.27 → 1.7.1

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.
Files changed (79) hide show
  1. package/dist/agent/DextoAgent.d.ts +3 -3
  2. package/dist/agent/DextoAgent.d.ts.map +1 -1
  3. package/dist/agent/schemas.cjs +5 -5
  4. package/dist/agent/schemas.d.ts +69 -980
  5. package/dist/agent/schemas.d.ts.map +1 -1
  6. package/dist/agent/schemas.js +5 -5
  7. package/dist/approval/schemas.cjs +6 -6
  8. package/dist/approval/schemas.d.ts +316 -1292
  9. package/dist/approval/schemas.d.ts.map +1 -1
  10. package/dist/approval/schemas.js +6 -6
  11. package/dist/approval/session-approval-store.cjs +1 -1
  12. package/dist/approval/session-approval-store.d.ts +12 -30
  13. package/dist/approval/session-approval-store.d.ts.map +1 -1
  14. package/dist/approval/session-approval-store.js +1 -1
  15. package/dist/llm/formatters/vercel.cjs +43 -29
  16. package/dist/llm/formatters/vercel.d.ts.map +1 -1
  17. package/dist/llm/formatters/vercel.js +49 -30
  18. package/dist/llm/providers/local/schemas.d.ts +102 -262
  19. package/dist/llm/providers/local/schemas.d.ts.map +1 -1
  20. package/dist/llm/registry/index.d.ts +5 -3
  21. package/dist/llm/registry/index.d.ts.map +1 -1
  22. package/dist/llm/registry/models.generated.cjs +967 -201
  23. package/dist/llm/registry/models.generated.d.ts +317 -27
  24. package/dist/llm/registry/models.generated.d.ts.map +1 -1
  25. package/dist/llm/registry/models.generated.js +967 -201
  26. package/dist/llm/resolver.cjs +0 -1
  27. package/dist/llm/resolver.d.ts.map +1 -1
  28. package/dist/llm/resolver.js +0 -1
  29. package/dist/llm/schemas.d.ts +95 -199
  30. package/dist/llm/schemas.d.ts.map +1 -1
  31. package/dist/logger/default-logger-factory.d.ts +28 -256
  32. package/dist/logger/default-logger-factory.d.ts.map +1 -1
  33. package/dist/logger/v2/schemas.d.ts +18 -120
  34. package/dist/logger/v2/schemas.d.ts.map +1 -1
  35. package/dist/mcp/schemas.cjs +4 -4
  36. package/dist/mcp/schemas.d.ts +77 -270
  37. package/dist/mcp/schemas.d.ts.map +1 -1
  38. package/dist/mcp/schemas.js +4 -4
  39. package/dist/memory/schemas.d.ts +37 -117
  40. package/dist/memory/schemas.d.ts.map +1 -1
  41. package/dist/prompts/schemas.d.ts +46 -190
  42. package/dist/prompts/schemas.d.ts.map +1 -1
  43. package/dist/resources/schemas.d.ts +14 -68
  44. package/dist/resources/schemas.d.ts.map +1 -1
  45. package/dist/runtime/host-runtime.d.ts +1 -5
  46. package/dist/runtime/host-runtime.d.ts.map +1 -1
  47. package/dist/session/history/database.cjs +37 -54
  48. package/dist/session/history/database.d.ts +3 -18
  49. package/dist/session/history/database.d.ts.map +1 -1
  50. package/dist/session/history/database.js +37 -54
  51. package/dist/session/schemas.d.ts +1 -7
  52. package/dist/session/schemas.d.ts.map +1 -1
  53. package/dist/systemPrompt/schemas.cjs +2 -10
  54. package/dist/systemPrompt/schemas.d.ts +53 -343
  55. package/dist/systemPrompt/schemas.d.ts.map +1 -1
  56. package/dist/systemPrompt/schemas.js +2 -10
  57. package/dist/telemetry/schemas.cjs +1 -1
  58. package/dist/telemetry/schemas.d.ts +9 -44
  59. package/dist/telemetry/schemas.d.ts.map +1 -1
  60. package/dist/telemetry/schemas.js +1 -1
  61. package/dist/tools/schemas.cjs +1 -1
  62. package/dist/tools/schemas.d.ts +19 -62
  63. package/dist/tools/schemas.d.ts.map +1 -1
  64. package/dist/tools/schemas.js +1 -1
  65. package/dist/tools/session-tool-preferences-store.d.ts +3 -9
  66. package/dist/tools/session-tool-preferences-store.d.ts.map +1 -1
  67. package/dist/utils/result.cjs +11 -8
  68. package/dist/utils/result.d.ts +6 -6
  69. package/dist/utils/result.d.ts.map +1 -1
  70. package/dist/utils/result.js +12 -9
  71. package/dist/utils/schema.cjs +6 -2
  72. package/dist/utils/schema.d.ts +2 -7
  73. package/dist/utils/schema.d.ts.map +1 -1
  74. package/dist/utils/schema.js +6 -2
  75. package/dist/utils/zod-schema-converter.cjs +66 -66
  76. package/dist/utils/zod-schema-converter.d.ts +3 -2
  77. package/dist/utils/zod-schema-converter.d.ts.map +1 -1
  78. package/dist/utils/zod-schema-converter.js +66 -66
  79. package/package.json +4 -5
@@ -22,41 +22,14 @@ export declare const InlinePromptSchema: z.ZodObject<{
22
22
  showInStarters: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
23
23
  'disable-model-invocation': z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
24
24
  'user-invocable': z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
25
- 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
+ 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString>>;
26
26
  model: z.ZodOptional<z.ZodString>;
27
- context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["inline", "fork"]>>>;
27
+ context: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
28
+ inline: "inline";
29
+ fork: "fork";
30
+ }>>>;
28
31
  agent: z.ZodOptional<z.ZodString>;
29
- }, "strict", z.ZodTypeAny, {
30
- context: "inline" | "fork";
31
- prompt: string;
32
- description: string;
33
- type: "inline";
34
- id: string;
35
- priority: number;
36
- category: string;
37
- showInStarters: boolean;
38
- 'disable-model-invocation': boolean;
39
- 'user-invocable': boolean;
40
- agent?: string | undefined;
41
- title?: string | undefined;
42
- model?: string | undefined;
43
- 'allowed-tools'?: string[] | undefined;
44
- }, {
45
- prompt: string;
46
- type: "inline";
47
- id: string;
48
- agent?: string | undefined;
49
- context?: "inline" | "fork" | undefined;
50
- description?: string | undefined;
51
- title?: string | undefined;
52
- model?: string | undefined;
53
- priority?: number | undefined;
54
- category?: string | undefined;
55
- showInStarters?: boolean | undefined;
56
- 'disable-model-invocation'?: boolean | undefined;
57
- 'user-invocable'?: boolean | undefined;
58
- 'allowed-tools'?: string[] | undefined;
59
- }>;
32
+ }, z.core.$strict>;
60
33
  /**
61
34
  * Schema for file-based prompts - loaded from markdown files
62
35
  */
@@ -66,39 +39,20 @@ export declare const FilePromptSchema: z.ZodObject<{
66
39
  showInStarters: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
67
40
  'disable-model-invocation': z.ZodOptional<z.ZodBoolean>;
68
41
  'user-invocable': z.ZodOptional<z.ZodBoolean>;
69
- 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString>>;
70
43
  model: z.ZodOptional<z.ZodString>;
71
- context: z.ZodOptional<z.ZodEnum<["inline", "fork"]>>;
44
+ context: z.ZodOptional<z.ZodEnum<{
45
+ inline: "inline";
46
+ fork: "fork";
47
+ }>>;
72
48
  agent: z.ZodOptional<z.ZodString>;
73
49
  namespace: z.ZodOptional<z.ZodString>;
74
- }, "strict", z.ZodTypeAny, {
75
- file: string;
76
- type: "file";
77
- showInStarters: boolean;
78
- agent?: string | undefined;
79
- context?: "inline" | "fork" | undefined;
80
- model?: string | undefined;
81
- 'disable-model-invocation'?: boolean | undefined;
82
- 'user-invocable'?: boolean | undefined;
83
- 'allowed-tools'?: string[] | undefined;
84
- namespace?: string | undefined;
85
- }, {
86
- file: string;
87
- type: "file";
88
- agent?: string | undefined;
89
- context?: "inline" | "fork" | undefined;
90
- model?: string | undefined;
91
- showInStarters?: boolean | undefined;
92
- 'disable-model-invocation'?: boolean | undefined;
93
- 'user-invocable'?: boolean | undefined;
94
- 'allowed-tools'?: string[] | undefined;
95
- namespace?: string | undefined;
96
- }>;
50
+ }, z.core.$strict>;
97
51
  /**
98
52
  * Unified prompts schema - array of inline or file-based prompts
99
53
  * Replaces the old StarterPromptsSchema
100
54
  */
101
- export declare const PromptsSchema: z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
55
+ export declare const PromptsSchema: z.ZodDefault<z.ZodPipe<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
102
56
  type: z.ZodLiteral<"inline">;
103
57
  id: z.ZodString;
104
58
  title: z.ZodOptional<z.ZodString>;
@@ -109,178 +63,80 @@ export declare const PromptsSchema: z.ZodDefault<z.ZodEffects<z.ZodEffects<z.Zod
109
63
  showInStarters: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
110
64
  'disable-model-invocation': z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
111
65
  'user-invocable': z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
- 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
66
+ 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString>>;
113
67
  model: z.ZodOptional<z.ZodString>;
114
- context: z.ZodDefault<z.ZodOptional<z.ZodEnum<["inline", "fork"]>>>;
68
+ context: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
69
+ inline: "inline";
70
+ fork: "fork";
71
+ }>>>;
115
72
  agent: z.ZodOptional<z.ZodString>;
116
- }, "strict", z.ZodTypeAny, {
117
- context: "inline" | "fork";
118
- prompt: string;
119
- description: string;
120
- type: "inline";
121
- id: string;
122
- priority: number;
123
- category: string;
124
- showInStarters: boolean;
125
- 'disable-model-invocation': boolean;
126
- 'user-invocable': boolean;
127
- agent?: string | undefined;
128
- title?: string | undefined;
129
- model?: string | undefined;
130
- 'allowed-tools'?: string[] | undefined;
131
- }, {
132
- prompt: string;
133
- type: "inline";
134
- id: string;
135
- agent?: string | undefined;
136
- context?: "inline" | "fork" | undefined;
137
- description?: string | undefined;
138
- title?: string | undefined;
139
- model?: string | undefined;
140
- priority?: number | undefined;
141
- category?: string | undefined;
142
- showInStarters?: boolean | undefined;
143
- 'disable-model-invocation'?: boolean | undefined;
144
- 'user-invocable'?: boolean | undefined;
145
- 'allowed-tools'?: string[] | undefined;
146
- }>, z.ZodObject<{
73
+ }, z.core.$strict>, z.ZodObject<{
147
74
  type: z.ZodLiteral<"file">;
148
75
  file: z.ZodString;
149
76
  showInStarters: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
150
77
  'disable-model-invocation': z.ZodOptional<z.ZodBoolean>;
151
78
  'user-invocable': z.ZodOptional<z.ZodBoolean>;
152
- 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
+ 'allowed-tools': z.ZodOptional<z.ZodArray<z.ZodString>>;
153
80
  model: z.ZodOptional<z.ZodString>;
154
- context: z.ZodOptional<z.ZodEnum<["inline", "fork"]>>;
81
+ context: z.ZodOptional<z.ZodEnum<{
82
+ inline: "inline";
83
+ fork: "fork";
84
+ }>>;
155
85
  agent: z.ZodOptional<z.ZodString>;
156
86
  namespace: z.ZodOptional<z.ZodString>;
157
- }, "strict", z.ZodTypeAny, {
158
- file: string;
87
+ }, z.core.$strict>], "type">>, z.ZodTransform<({
159
88
  type: "file";
89
+ file: string;
160
90
  showInStarters: boolean;
161
- agent?: string | undefined;
162
- context?: "inline" | "fork" | undefined;
163
- model?: string | undefined;
164
91
  'disable-model-invocation'?: boolean | undefined;
165
92
  'user-invocable'?: boolean | undefined;
166
93
  'allowed-tools'?: string[] | undefined;
167
- namespace?: string | undefined;
168
- }, {
169
- file: string;
170
- type: "file";
171
- agent?: string | undefined;
172
- context?: "inline" | "fork" | undefined;
173
94
  model?: string | undefined;
174
- showInStarters?: boolean | undefined;
175
- 'disable-model-invocation'?: boolean | undefined;
176
- 'user-invocable'?: boolean | undefined;
177
- 'allowed-tools'?: string[] | undefined;
95
+ context?: "inline" | "fork" | undefined;
96
+ agent?: string | undefined;
178
97
  namespace?: string | undefined;
179
- }>]>, "many">, ({
180
- context: "inline" | "fork";
181
- prompt: string;
182
- description: string;
98
+ } | {
99
+ title: string;
183
100
  type: "inline";
184
101
  id: string;
185
- priority: number;
102
+ description: string;
103
+ prompt: string;
186
104
  category: string;
105
+ priority: number;
187
106
  showInStarters: boolean;
188
107
  'disable-model-invocation': boolean;
189
108
  'user-invocable': boolean;
190
- agent?: string | undefined;
191
- title?: string | undefined;
192
- model?: string | undefined;
109
+ context: "inline" | "fork";
193
110
  'allowed-tools'?: string[] | undefined;
194
- } | {
195
- file: string;
196
- type: "file";
197
- showInStarters: boolean;
198
- agent?: string | undefined;
199
- context?: "inline" | "fork" | undefined;
200
111
  model?: string | undefined;
201
- 'disable-model-invocation'?: boolean | undefined;
202
- 'user-invocable'?: boolean | undefined;
203
- 'allowed-tools'?: string[] | undefined;
204
- namespace?: string | undefined;
112
+ agent?: string | undefined;
205
113
  })[], ({
206
- prompt: string;
207
114
  type: "inline";
208
115
  id: string;
209
- agent?: string | undefined;
210
- context?: "inline" | "fork" | undefined;
211
- description?: string | undefined;
212
- title?: string | undefined;
213
- model?: string | undefined;
214
- priority?: number | undefined;
215
- category?: string | undefined;
216
- showInStarters?: boolean | undefined;
217
- 'disable-model-invocation'?: boolean | undefined;
218
- 'user-invocable'?: boolean | undefined;
219
- 'allowed-tools'?: string[] | undefined;
220
- } | {
221
- file: string;
222
- type: "file";
223
- agent?: string | undefined;
224
- context?: "inline" | "fork" | undefined;
225
- model?: string | undefined;
226
- showInStarters?: boolean | undefined;
227
- 'disable-model-invocation'?: boolean | undefined;
228
- 'user-invocable'?: boolean | undefined;
229
- 'allowed-tools'?: string[] | undefined;
230
- namespace?: string | undefined;
231
- })[]>, ({
232
- file: string;
233
- type: "file";
234
- showInStarters: boolean;
235
- agent?: string | undefined;
236
- context?: "inline" | "fork" | undefined;
237
- model?: string | undefined;
238
- 'disable-model-invocation'?: boolean | undefined;
239
- 'user-invocable'?: boolean | undefined;
240
- 'allowed-tools'?: string[] | undefined;
241
- namespace?: string | undefined;
242
- } | {
243
- title: string;
244
- context: "inline" | "fork";
245
- prompt: string;
246
116
  description: string;
247
- type: "inline";
248
- id: string;
249
- priority: number;
117
+ prompt: string;
250
118
  category: string;
119
+ priority: number;
251
120
  showInStarters: boolean;
252
121
  'disable-model-invocation': boolean;
253
122
  'user-invocable': boolean;
254
- agent?: string | undefined;
255
- model?: string | undefined;
256
- 'allowed-tools'?: string[] | undefined;
257
- })[], ({
258
- prompt: string;
259
- type: "inline";
260
- id: string;
261
- agent?: string | undefined;
262
- context?: "inline" | "fork" | undefined;
263
- description?: string | undefined;
123
+ context: "inline" | "fork";
264
124
  title?: string | undefined;
265
- model?: string | undefined;
266
- priority?: number | undefined;
267
- category?: string | undefined;
268
- showInStarters?: boolean | undefined;
269
- 'disable-model-invocation'?: boolean | undefined;
270
- 'user-invocable'?: boolean | undefined;
271
125
  'allowed-tools'?: string[] | undefined;
126
+ model?: string | undefined;
127
+ agent?: string | undefined;
272
128
  } | {
273
- file: string;
274
129
  type: "file";
275
- agent?: string | undefined;
276
- context?: "inline" | "fork" | undefined;
277
- model?: string | undefined;
278
- showInStarters?: boolean | undefined;
130
+ file: string;
131
+ showInStarters: boolean;
279
132
  'disable-model-invocation'?: boolean | undefined;
280
133
  'user-invocable'?: boolean | undefined;
281
134
  'allowed-tools'?: string[] | undefined;
135
+ model?: string | undefined;
136
+ context?: "inline" | "fork" | undefined;
137
+ agent?: string | undefined;
282
138
  namespace?: string | undefined;
283
- })[]>>;
139
+ })[]>>>;
284
140
  /**
285
141
  * Type for a single inline prompt (validated)
286
142
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/prompts/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DoC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CiC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;OA6BgC,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -4,26 +4,12 @@ import { z } from 'zod';
4
4
  */
5
5
  declare const FileSystemResourceSchema: z.ZodObject<{
6
6
  type: z.ZodLiteral<"filesystem">;
7
- paths: z.ZodArray<z.ZodString, "many">;
7
+ paths: z.ZodArray<z.ZodString>;
8
8
  maxDepth: z.ZodDefault<z.ZodNumber>;
9
9
  maxFiles: z.ZodDefault<z.ZodNumber>;
10
10
  includeHidden: z.ZodDefault<z.ZodBoolean>;
11
- includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
12
- }, "strict", z.ZodTypeAny, {
13
- type: "filesystem";
14
- maxFiles: number;
15
- paths: string[];
16
- maxDepth: number;
17
- includeHidden: boolean;
18
- includeExtensions: string[];
19
- }, {
20
- type: "filesystem";
21
- paths: string[];
22
- maxFiles?: number | undefined;
23
- maxDepth?: number | undefined;
24
- includeHidden?: boolean | undefined;
25
- includeExtensions?: string[] | undefined;
26
- }>;
11
+ includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString>>;
12
+ }, z.core.$strict>;
27
13
  /**
28
14
  * Validated filesystem resource configuration type
29
15
  */
@@ -37,11 +23,7 @@ export type ValidatedFileSystemResourceConfig = z.output<typeof FileSystemResour
37
23
  */
38
24
  declare const BlobResourceSchema: z.ZodObject<{
39
25
  type: z.ZodLiteral<"blob">;
40
- }, "strict", z.ZodTypeAny, {
41
- type: "blob";
42
- }, {
43
- type: "blob";
44
- }>;
26
+ }, z.core.$strict>;
45
27
  /**
46
28
  * Validated blob resource configuration type
47
29
  */
@@ -49,34 +31,16 @@ export type ValidatedBlobResourceConfig = z.output<typeof BlobResourceSchema>;
49
31
  /**
50
32
  * Union schema for all internal resource types (composed from individual schemas)
51
33
  */
52
- export declare const ResourceConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
34
+ export declare const ResourceConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
35
  type: z.ZodLiteral<"filesystem">;
54
- paths: z.ZodArray<z.ZodString, "many">;
36
+ paths: z.ZodArray<z.ZodString>;
55
37
  maxDepth: z.ZodDefault<z.ZodNumber>;
56
38
  maxFiles: z.ZodDefault<z.ZodNumber>;
57
39
  includeHidden: z.ZodDefault<z.ZodBoolean>;
58
- includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
59
- }, "strict", z.ZodTypeAny, {
60
- type: "filesystem";
61
- maxFiles: number;
62
- paths: string[];
63
- maxDepth: number;
64
- includeHidden: boolean;
65
- includeExtensions: string[];
66
- }, {
67
- type: "filesystem";
68
- paths: string[];
69
- maxFiles?: number | undefined;
70
- maxDepth?: number | undefined;
71
- includeHidden?: boolean | undefined;
72
- includeExtensions?: string[] | undefined;
73
- }>, z.ZodObject<{
40
+ includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ }, z.core.$strict>, z.ZodObject<{
74
42
  type: z.ZodLiteral<"blob">;
75
- }, "strict", z.ZodTypeAny, {
76
- type: "blob";
77
- }, {
78
- type: "blob";
79
- }>]>;
43
+ }, z.core.$strict>], "type">;
80
44
  /**
81
45
  * Validated union type for all internal resource configurations
82
46
  */
@@ -86,34 +50,16 @@ export type ValidatedResourceConfig = z.output<typeof ResourceConfigSchema>;
86
50
  *
87
51
  * Omit or set to [] to disable agent-managed resources.
88
52
  */
89
- export declare const ResourcesConfigSchema: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
53
+ export declare const ResourcesConfigSchema: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
90
54
  type: z.ZodLiteral<"filesystem">;
91
- paths: z.ZodArray<z.ZodString, "many">;
55
+ paths: z.ZodArray<z.ZodString>;
92
56
  maxDepth: z.ZodDefault<z.ZodNumber>;
93
57
  maxFiles: z.ZodDefault<z.ZodNumber>;
94
58
  includeHidden: z.ZodDefault<z.ZodBoolean>;
95
- includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
96
- }, "strict", z.ZodTypeAny, {
97
- type: "filesystem";
98
- maxFiles: number;
99
- paths: string[];
100
- maxDepth: number;
101
- includeHidden: boolean;
102
- includeExtensions: string[];
103
- }, {
104
- type: "filesystem";
105
- paths: string[];
106
- maxFiles?: number | undefined;
107
- maxDepth?: number | undefined;
108
- includeHidden?: boolean | undefined;
109
- includeExtensions?: string[] | undefined;
110
- }>, z.ZodObject<{
59
+ includeExtensions: z.ZodDefault<z.ZodArray<z.ZodString>>;
60
+ }, z.core.$strict>, z.ZodObject<{
111
61
  type: z.ZodLiteral<"blob">;
112
- }, "strict", z.ZodTypeAny, {
113
- type: "blob";
114
- }, {
115
- type: "blob";
116
- }>]>, "many">>;
62
+ }, z.core.$strict>], "type">>>;
117
63
  export type ResourcesConfig = z.input<typeof ResourcesConfigSchema>;
118
64
  export type ValidatedResourcesConfig = z.output<typeof ResourcesConfigSchema>;
119
65
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/resources/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAsDjB,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1F;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB;;;;;;EAOnB,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGmB,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/resources/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,QAAA,MAAM,wBAAwB;;;;;;;kBAsDjB,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1F;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB;;kBAOnB,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;4BAG/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;8BAGmB,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -3,11 +3,7 @@ import { z } from 'zod';
3
3
  export declare const HostRuntimeIdsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
4
4
  export declare const HostRuntimeContextSchema: z.ZodObject<{
5
5
  ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
6
- }, "strict", z.ZodTypeAny, {
7
- ids?: Record<string, string> | undefined;
8
- }, {
9
- ids?: Record<string, string> | undefined;
10
- }>;
6
+ }, z.core.$strict>;
11
7
  export type HostRuntimeIds = z.output<typeof HostRuntimeIdsSchema>;
12
8
  export type HostRuntimeContext = z.output<typeof HostRuntimeContextSchema>;
13
9
  export declare function normalizeHostRuntimeContext(input: z.input<typeof HostRuntimeContextSchema> | undefined): HostRuntimeContext | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"host-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/host-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,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AC;AAEN,eAAO,MAAM,wBAAwB;;kBAO2C,CAAC;AAEjF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAQ3E,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,GAAG,SAAS,GAC5D,kBAAkB,GAAG,SAAS,CAWhC;AAED,wBAAgB,yBAAyB,CAAC,EACtC,SAAS,EACT,QAAQ,EACR,KAAK,GACR,EAAE;IACC,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,GAAG,kBAAkB,GAAG,SAAS,CAYjC;AAQD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D;AAOD,wBAAgB,4BAA4B,CACxC,WAAW,CAAC,EAAE,kBAAkB,GACjC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAe9B;AAED,wBAAgB,wBAAwB,CAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAejG;AAED,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CA0C7F"}
@@ -33,7 +33,7 @@ class DatabaseHistoryProvider {
33
33
  logger;
34
34
  // Cache state
35
35
  cache = null;
36
- dirty = false;
36
+ pendingUpdates = /* @__PURE__ */ new Map();
37
37
  flushTimer = null;
38
38
  flushPromise = null;
39
39
  // Flush configuration
@@ -49,25 +49,25 @@ class DatabaseHistoryProvider {
49
49
  `DatabaseHistoryProvider: Session ${this.sessionId} hit message limit (${limit}), history may be truncated`
50
50
  );
51
51
  }
52
- const seen = /* @__PURE__ */ new Set();
52
+ const seenIndexes = /* @__PURE__ */ new Map();
53
53
  this.cache = [];
54
54
  let duplicateCount = 0;
55
55
  for (const msg of rawMessages) {
56
- if (msg.id && seen.has(msg.id)) {
56
+ const seenIndex = msg.id ? seenIndexes.get(msg.id) : void 0;
57
+ if (seenIndex !== void 0) {
57
58
  duplicateCount++;
59
+ this.cache[seenIndex] = msg;
58
60
  continue;
59
61
  }
60
62
  if (msg.id) {
61
- seen.add(msg.id);
63
+ seenIndexes.set(msg.id, this.cache.length);
62
64
  }
63
65
  this.cache.push(msg);
64
66
  }
65
67
  if (duplicateCount > 0) {
66
68
  this.logger.warn(
67
- `DatabaseHistoryProvider: Found ${duplicateCount} duplicate messages for session ${this.sessionId}, deduped to ${this.cache.length}`
69
+ `DatabaseHistoryProvider: Found ${duplicateCount} duplicate message updates for session ${this.sessionId}, deduped to ${this.cache.length}`
68
70
  );
69
- this.dirty = true;
70
- this.scheduleFlush();
71
71
  } else {
72
72
  this.logger.debug(
73
73
  `DatabaseHistoryProvider: Loaded ${this.cache.length} messages for session ${this.sessionId}`
@@ -125,10 +125,14 @@ class DatabaseHistoryProvider {
125
125
  if (this.cache === null) {
126
126
  await this.getHistory();
127
127
  }
128
- const index = this.cache.findIndex((m) => m.id === message.id);
128
+ const cache = this.cache;
129
+ if (cache === null) {
130
+ return;
131
+ }
132
+ const index = cache.findIndex((m) => m.id === message.id);
129
133
  if (index !== -1) {
130
- this.cache[index] = message;
131
- this.dirty = true;
134
+ cache[index] = message;
135
+ this.pendingUpdates.set(message.id, message);
132
136
  this.scheduleFlush();
133
137
  this.logger.debug(
134
138
  `DatabaseHistoryProvider: Updated message ${message.id} in cache for session ${this.sessionId}`
@@ -142,7 +146,7 @@ class DatabaseHistoryProvider {
142
146
  async clearHistory() {
143
147
  this.cancelPendingFlush();
144
148
  this.cache = [];
145
- this.dirty = false;
149
+ this.pendingUpdates.clear();
146
150
  const key = this.getMessagesKey();
147
151
  try {
148
152
  await this.database.delete(key);
@@ -159,67 +163,49 @@ class DatabaseHistoryProvider {
159
163
  );
160
164
  }
161
165
  }
162
- /**
163
- * Flush any pending updates to the database.
164
- * Should be called at turn boundaries to ensure durability.
165
- */
166
166
  async flush() {
167
167
  if (this.flushPromise) {
168
168
  await this.flushPromise;
169
- return;
170
169
  }
171
170
  this.cancelPendingFlush();
172
- if (!this.dirty || !this.cache) {
173
- return;
174
- }
175
- this.flushPromise = this.doFlush();
176
- try {
177
- await this.flushPromise;
178
- } finally {
179
- this.flushPromise = null;
171
+ while (this.pendingUpdates.size > 0) {
172
+ this.flushPromise = this.flushPendingUpdates();
173
+ try {
174
+ await this.flushPromise;
175
+ } finally {
176
+ this.flushPromise = null;
177
+ }
180
178
  }
181
179
  }
182
- /**
183
- * Internal flush implementation.
184
- * Writes entire cache to DB (delete + re-append all).
185
- */
186
- async doFlush() {
187
- if (!this.dirty || !this.cache) {
188
- return;
189
- }
180
+ async flushPendingUpdates() {
190
181
  const key = this.getMessagesKey();
191
- const snapshot = [...this.cache];
192
- const messageCount = snapshot.length;
182
+ const updates = [...this.pendingUpdates.values()];
183
+ this.pendingUpdates.clear();
193
184
  this.logger.debug(
194
- `DatabaseHistoryProvider: FLUSH START key=${key} snapshotSize=${messageCount} ids=[${snapshot.map((m) => m.id).join(",")}]`
185
+ `DatabaseHistoryProvider: FLUSH UPDATES key=${key} count=${updates.length} ids=[${updates.map((m) => m.id).join(",")}]`
195
186
  );
187
+ let failedIndex = updates.length;
196
188
  try {
197
- await this.database.delete(key);
198
- this.logger.debug(`DatabaseHistoryProvider: FLUSH DELETED key=${key}`);
199
- for (const msg of snapshot) {
200
- await this.database.append(key, msg);
201
- }
202
- this.logger.debug(
203
- `DatabaseHistoryProvider: FLUSH REAPPENDED key=${key} count=${messageCount}`
204
- );
205
- if (!this.flushTimer) {
206
- this.dirty = false;
189
+ for (const [index, message] of updates.entries()) {
190
+ failedIndex = index;
191
+ await this.database.append(key, message);
207
192
  }
208
193
  } catch (error) {
194
+ for (const message of updates.slice(failedIndex)) {
195
+ if (message.id && !this.pendingUpdates.has(message.id)) {
196
+ this.pendingUpdates.set(message.id, message);
197
+ }
198
+ }
209
199
  this.logger.error(
210
- `DatabaseHistoryProvider: Error flushing messages for session ${this.sessionId}: ${error instanceof Error ? error.message : String(error)}`
200
+ `DatabaseHistoryProvider: Error flushing message updates for session ${this.sessionId}: ${error instanceof Error ? error.message : String(error)}`
211
201
  );
212
202
  throw import_errors.SessionError.storageFailed(
213
203
  this.sessionId,
214
- "flush messages",
204
+ "flush message updates",
215
205
  error instanceof Error ? error.message : String(error)
216
206
  );
217
207
  }
218
208
  }
219
- /**
220
- * Schedule a debounced flush.
221
- * Batches rapid updateMessage() calls into a single DB write.
222
- */
223
209
  scheduleFlush() {
224
210
  if (this.flushTimer) {
225
211
  return;
@@ -230,9 +216,6 @@ class DatabaseHistoryProvider {
230
216
  });
231
217
  }, DatabaseHistoryProvider.FLUSH_DELAY_MS);
232
218
  }
233
- /**
234
- * Cancel any pending scheduled flush.
235
- */
236
219
  cancelPendingFlush() {
237
220
  if (this.flushTimer) {
238
221
  clearTimeout(this.flushTimer);
@@ -10,7 +10,7 @@ import type { ConversationHistoryProvider } from './types.js';
10
10
  * - getHistory(): Returns cached messages after first load (eliminates repeated DB reads)
11
11
  * - saveMessage(): Updates cache AND writes to DB immediately (new messages are critical)
12
12
  * - updateMessage(): Updates cache immediately, debounces DB writes (batches rapid updates)
13
- * - flush(): Forces all pending updates to DB (called at turn boundaries)
13
+ * - flush(): Appends the latest pending updates to DB (called at turn boundaries)
14
14
  * - clearHistory(): Clears cache and DB immediately
15
15
  *
16
16
  * Durability guarantees:
@@ -23,7 +23,7 @@ export declare class DatabaseHistoryProvider implements ConversationHistoryProvi
23
23
  private database;
24
24
  private logger;
25
25
  private cache;
26
- private dirty;
26
+ private pendingUpdates;
27
27
  private flushTimer;
28
28
  private flushPromise;
29
29
  private static readonly FLUSH_DELAY_MS;
@@ -32,24 +32,9 @@ export declare class DatabaseHistoryProvider implements ConversationHistoryProvi
32
32
  saveMessage(message: InternalMessage): Promise<void>;
33
33
  updateMessage(message: InternalMessage): Promise<void>;
34
34
  clearHistory(): Promise<void>;
35
- /**
36
- * Flush any pending updates to the database.
37
- * Should be called at turn boundaries to ensure durability.
38
- */
39
35
  flush(): Promise<void>;
40
- /**
41
- * Internal flush implementation.
42
- * Writes entire cache to DB (delete + re-append all).
43
- */
44
- private doFlush;
45
- /**
46
- * Schedule a debounced flush.
47
- * Batches rapid updateMessage() calls into a single DB write.
48
- */
36
+ private flushPendingUpdates;
49
37
  private scheduleFlush;
50
- /**
51
- * Cancel any pending scheduled flush.
52
- */
53
38
  private cancelPendingFlush;
54
39
  private getMessagesKey;
55
40
  }