@dexto/core 1.6.26 → 1.7.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.
Files changed (160) hide show
  1. package/dist/agent/DextoAgent.cjs +75 -90
  2. package/dist/agent/DextoAgent.d.ts +7 -7
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +76 -91
  5. package/dist/agent/error-codes.cjs +1 -0
  6. package/dist/agent/error-codes.d.ts +1 -0
  7. package/dist/agent/error-codes.d.ts.map +1 -1
  8. package/dist/agent/error-codes.js +1 -0
  9. package/dist/agent/errors.cjs +13 -0
  10. package/dist/agent/errors.d.ts +6 -0
  11. package/dist/agent/errors.d.ts.map +1 -1
  12. package/dist/agent/errors.js +13 -0
  13. package/dist/agent/index.d.ts +1 -0
  14. package/dist/agent/index.d.ts.map +1 -1
  15. package/dist/agent/schemas.cjs +5 -5
  16. package/dist/agent/schemas.d.ts +69 -980
  17. package/dist/agent/schemas.d.ts.map +1 -1
  18. package/dist/agent/schemas.js +5 -5
  19. package/dist/agent/types.d.ts +11 -0
  20. package/dist/agent/types.d.ts.map +1 -1
  21. package/dist/approval/factory.cjs +1 -0
  22. package/dist/approval/factory.d.ts.map +1 -1
  23. package/dist/approval/factory.js +1 -0
  24. package/dist/approval/manager.cjs +19 -6
  25. package/dist/approval/manager.d.ts +6 -0
  26. package/dist/approval/manager.d.ts.map +1 -1
  27. package/dist/approval/manager.js +19 -6
  28. package/dist/approval/schemas.cjs +16 -6
  29. package/dist/approval/schemas.d.ts +373 -1044
  30. package/dist/approval/schemas.d.ts.map +1 -1
  31. package/dist/approval/schemas.js +16 -6
  32. package/dist/approval/session-approval-store.cjs +1 -1
  33. package/dist/approval/session-approval-store.d.ts +12 -30
  34. package/dist/approval/session-approval-store.d.ts.map +1 -1
  35. package/dist/approval/session-approval-store.js +1 -1
  36. package/dist/events/index.cjs +210 -75
  37. package/dist/events/index.d.ts +44 -181
  38. package/dist/events/index.d.ts.map +1 -1
  39. package/dist/events/index.js +206 -74
  40. package/dist/hooks/manager.cjs +5 -2
  41. package/dist/hooks/manager.d.ts +2 -0
  42. package/dist/hooks/manager.d.ts.map +1 -1
  43. package/dist/hooks/manager.js +5 -2
  44. package/dist/hooks/types.d.ts +3 -0
  45. package/dist/hooks/types.d.ts.map +1 -1
  46. package/dist/index.browser.d.ts +1 -0
  47. package/dist/index.browser.d.ts.map +1 -1
  48. package/dist/index.cjs +3 -1
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -0
  52. package/dist/llm/executor/turn-executor.cjs +8 -4
  53. package/dist/llm/executor/turn-executor.d.ts +3 -1
  54. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  55. package/dist/llm/executor/turn-executor.js +8 -4
  56. package/dist/llm/providers/local/schemas.d.ts +102 -262
  57. package/dist/llm/providers/local/schemas.d.ts.map +1 -1
  58. package/dist/llm/registry/index.d.ts +5 -3
  59. package/dist/llm/registry/index.d.ts.map +1 -1
  60. package/dist/llm/resolver.cjs +0 -1
  61. package/dist/llm/resolver.d.ts.map +1 -1
  62. package/dist/llm/resolver.js +0 -1
  63. package/dist/llm/schemas.d.ts +95 -199
  64. package/dist/llm/schemas.d.ts.map +1 -1
  65. package/dist/llm/services/vercel.cjs +29 -6
  66. package/dist/llm/services/vercel.d.ts +3 -0
  67. package/dist/llm/services/vercel.d.ts.map +1 -1
  68. package/dist/llm/services/vercel.js +27 -5
  69. package/dist/logger/default-logger-factory.d.ts +28 -256
  70. package/dist/logger/default-logger-factory.d.ts.map +1 -1
  71. package/dist/logger/v2/schemas.d.ts +18 -120
  72. package/dist/logger/v2/schemas.d.ts.map +1 -1
  73. package/dist/mcp/manager.cjs +7 -2
  74. package/dist/mcp/manager.d.ts +3 -1
  75. package/dist/mcp/manager.d.ts.map +1 -1
  76. package/dist/mcp/manager.js +7 -2
  77. package/dist/mcp/mcp-client.cjs +71 -62
  78. package/dist/mcp/mcp-client.d.ts +3 -2
  79. package/dist/mcp/mcp-client.d.ts.map +1 -1
  80. package/dist/mcp/mcp-client.js +71 -62
  81. package/dist/mcp/schemas.cjs +4 -4
  82. package/dist/mcp/schemas.d.ts +77 -270
  83. package/dist/mcp/schemas.d.ts.map +1 -1
  84. package/dist/mcp/schemas.js +4 -4
  85. package/dist/memory/schemas.d.ts +37 -117
  86. package/dist/memory/schemas.d.ts.map +1 -1
  87. package/dist/prompts/schemas.d.ts +46 -190
  88. package/dist/prompts/schemas.d.ts.map +1 -1
  89. package/dist/resources/handlers/filesystem-handler.cjs +22 -3
  90. package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
  91. package/dist/resources/handlers/filesystem-handler.js +22 -3
  92. package/dist/resources/schemas.d.ts +14 -68
  93. package/dist/resources/schemas.d.ts.map +1 -1
  94. package/dist/runtime/host-runtime.cjs +163 -0
  95. package/dist/runtime/host-runtime.d.ts +19 -0
  96. package/dist/runtime/host-runtime.d.ts.map +1 -0
  97. package/dist/runtime/host-runtime.js +133 -0
  98. package/dist/runtime/index.cjs +42 -0
  99. package/dist/runtime/index.d.ts +2 -0
  100. package/dist/runtime/index.d.ts.map +1 -0
  101. package/dist/runtime/index.js +21 -0
  102. package/dist/runtime/run-context.cjs +53 -0
  103. package/dist/runtime/run-context.d.ts +13 -0
  104. package/dist/runtime/run-context.d.ts.map +1 -0
  105. package/dist/runtime/run-context.js +34 -0
  106. package/dist/session/chat-session.cjs +30 -32
  107. package/dist/session/chat-session.d.ts +5 -15
  108. package/dist/session/chat-session.d.ts.map +1 -1
  109. package/dist/session/chat-session.js +31 -33
  110. package/dist/session/error-codes.cjs +1 -0
  111. package/dist/session/error-codes.d.ts +2 -1
  112. package/dist/session/error-codes.d.ts.map +1 -1
  113. package/dist/session/error-codes.js +1 -0
  114. package/dist/session/errors.cjs +13 -0
  115. package/dist/session/errors.d.ts +6 -0
  116. package/dist/session/errors.d.ts.map +1 -1
  117. package/dist/session/errors.js +13 -0
  118. package/dist/session/schemas.d.ts +1 -7
  119. package/dist/session/schemas.d.ts.map +1 -1
  120. package/dist/systemPrompt/schemas.cjs +2 -10
  121. package/dist/systemPrompt/schemas.d.ts +53 -343
  122. package/dist/systemPrompt/schemas.d.ts.map +1 -1
  123. package/dist/systemPrompt/schemas.js +2 -10
  124. package/dist/telemetry/decorators.cjs +75 -57
  125. package/dist/telemetry/decorators.d.ts +2 -0
  126. package/dist/telemetry/decorators.d.ts.map +1 -1
  127. package/dist/telemetry/decorators.js +75 -57
  128. package/dist/telemetry/schemas.cjs +1 -1
  129. package/dist/telemetry/schemas.d.ts +9 -44
  130. package/dist/telemetry/schemas.d.ts.map +1 -1
  131. package/dist/telemetry/schemas.js +1 -1
  132. package/dist/telemetry/utils.cjs +9 -6
  133. package/dist/telemetry/utils.d.ts +3 -0
  134. package/dist/telemetry/utils.d.ts.map +1 -1
  135. package/dist/telemetry/utils.js +9 -6
  136. package/dist/tools/schemas.cjs +1 -1
  137. package/dist/tools/schemas.d.ts +19 -62
  138. package/dist/tools/schemas.d.ts.map +1 -1
  139. package/dist/tools/schemas.js +1 -1
  140. package/dist/tools/session-tool-preferences-store.d.ts +3 -9
  141. package/dist/tools/session-tool-preferences-store.d.ts.map +1 -1
  142. package/dist/tools/tool-manager.cjs +92 -36
  143. package/dist/tools/tool-manager.d.ts +12 -3
  144. package/dist/tools/tool-manager.d.ts.map +1 -1
  145. package/dist/tools/tool-manager.js +92 -36
  146. package/dist/tools/types.d.ts +7 -1
  147. package/dist/tools/types.d.ts.map +1 -1
  148. package/dist/utils/result.cjs +11 -8
  149. package/dist/utils/result.d.ts +6 -6
  150. package/dist/utils/result.d.ts.map +1 -1
  151. package/dist/utils/result.js +12 -9
  152. package/dist/utils/schema.cjs +6 -2
  153. package/dist/utils/schema.d.ts +2 -7
  154. package/dist/utils/schema.d.ts.map +1 -1
  155. package/dist/utils/schema.js +6 -2
  156. package/dist/utils/zod-schema-converter.cjs +66 -66
  157. package/dist/utils/zod-schema-converter.d.ts +3 -2
  158. package/dist/utils/zod-schema-converter.d.ts.map +1 -1
  159. package/dist/utils/zod-schema-converter.js +66 -66
  160. package/package.json +4 -5
@@ -1,259 +1,81 @@
1
1
  import { z } from 'zod';
2
- export declare const ContributorConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2
+ export declare const ContributorConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  priority: z.ZodNumber;
5
5
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
6
- } & {
7
6
  type: z.ZodLiteral<"static">;
8
7
  content: z.ZodString;
9
- }, "strict", z.ZodTypeAny, {
10
- type: "static";
11
- enabled: boolean;
12
- content: string;
13
- id: string;
14
- priority: number;
15
- }, {
16
- type: "static";
17
- content: string;
18
- id: string;
19
- priority: number;
20
- enabled?: boolean | undefined;
21
- }>, z.ZodObject<{
8
+ }, z.core.$strict>, z.ZodObject<{
22
9
  id: z.ZodString;
23
10
  priority: z.ZodNumber;
24
11
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
25
- } & {
26
12
  type: z.ZodLiteral<"dynamic">;
27
- source: z.ZodEnum<["date", "env", "resources"]>;
28
- }, "strict", z.ZodTypeAny, {
29
- type: "dynamic";
30
- enabled: boolean;
31
- id: string;
32
- priority: number;
33
- source: "date" | "env" | "resources";
34
- }, {
35
- type: "dynamic";
36
- id: string;
37
- priority: number;
38
- source: "date" | "env" | "resources";
39
- enabled?: boolean | undefined;
40
- }>, z.ZodObject<{
13
+ source: z.ZodEnum<{
14
+ date: "date";
15
+ env: "env";
16
+ resources: "resources";
17
+ }>;
18
+ }, z.core.$strict>, z.ZodObject<{
41
19
  id: z.ZodString;
42
20
  priority: z.ZodNumber;
43
21
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
44
- } & {
45
22
  type: z.ZodLiteral<"file">;
46
- files: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
47
- options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
23
+ files: z.ZodArray<z.ZodString>;
24
+ options: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
48
25
  includeFilenames: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
49
26
  separator: z.ZodDefault<z.ZodOptional<z.ZodString>>;
50
- errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<["skip", "error"]>>>;
27
+ errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
28
+ error: "error";
29
+ skip: "skip";
30
+ }>>>;
51
31
  maxFileSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
52
32
  includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
53
- }, "strict", z.ZodTypeAny, {
54
- includeFilenames: boolean;
55
- separator: string;
56
- errorHandling: "error" | "skip";
57
- maxFileSize: number;
58
- includeMetadata: boolean;
59
- }, {
60
- includeFilenames?: boolean | undefined;
61
- separator?: string | undefined;
62
- errorHandling?: "error" | "skip" | undefined;
63
- maxFileSize?: number | undefined;
64
- includeMetadata?: boolean | undefined;
65
- }>>>;
66
- }, "strict", z.ZodTypeAny, {
67
- type: "file";
68
- options: {
69
- includeFilenames: boolean;
70
- separator: string;
71
- errorHandling: "error" | "skip";
72
- maxFileSize: number;
73
- includeMetadata: boolean;
74
- };
75
- enabled: boolean;
76
- id: string;
77
- priority: number;
78
- files: string[];
79
- }, {
80
- type: "file";
81
- id: string;
82
- priority: number;
83
- files: string[];
84
- options?: {
85
- includeFilenames?: boolean | undefined;
86
- separator?: string | undefined;
87
- errorHandling?: "error" | "skip" | undefined;
88
- maxFileSize?: number | undefined;
89
- includeMetadata?: boolean | undefined;
90
- } | undefined;
91
- enabled?: boolean | undefined;
92
- }>]>;
33
+ }, z.core.$strict>>>;
34
+ }, z.core.$strict>], "type">;
93
35
  export type ContributorConfig = z.input<typeof ContributorConfigSchema>;
94
36
  export type ValidatedContributorConfig = z.output<typeof ContributorConfigSchema>;
95
37
  export declare const SessionPromptContributorSchema: z.ZodObject<{
96
38
  id: z.ZodString;
97
39
  priority: z.ZodNumber;
98
40
  content: z.ZodString;
99
- }, "strict", z.ZodTypeAny, {
100
- content: string;
101
- id: string;
102
- priority: number;
103
- }, {
104
- content: string;
105
- id: string;
106
- priority: number;
107
- }>;
41
+ }, z.core.$strict>;
108
42
  export type SessionPromptContributor = z.output<typeof SessionPromptContributorSchema>;
109
43
  export declare const SystemPromptContributorsSchema: z.ZodObject<{
110
- contributors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
44
+ contributors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
111
45
  id: z.ZodString;
112
46
  priority: z.ZodNumber;
113
47
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
114
- } & {
115
48
  type: z.ZodLiteral<"static">;
116
49
  content: z.ZodString;
117
- }, "strict", z.ZodTypeAny, {
118
- type: "static";
119
- enabled: boolean;
120
- content: string;
121
- id: string;
122
- priority: number;
123
- }, {
124
- type: "static";
125
- content: string;
126
- id: string;
127
- priority: number;
128
- enabled?: boolean | undefined;
129
- }>, z.ZodObject<{
50
+ }, z.core.$strict>, z.ZodObject<{
130
51
  id: z.ZodString;
131
52
  priority: z.ZodNumber;
132
53
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
133
- } & {
134
54
  type: z.ZodLiteral<"dynamic">;
135
- source: z.ZodEnum<["date", "env", "resources"]>;
136
- }, "strict", z.ZodTypeAny, {
137
- type: "dynamic";
138
- enabled: boolean;
139
- id: string;
140
- priority: number;
141
- source: "date" | "env" | "resources";
142
- }, {
143
- type: "dynamic";
144
- id: string;
145
- priority: number;
146
- source: "date" | "env" | "resources";
147
- enabled?: boolean | undefined;
148
- }>, z.ZodObject<{
55
+ source: z.ZodEnum<{
56
+ date: "date";
57
+ env: "env";
58
+ resources: "resources";
59
+ }>;
60
+ }, z.core.$strict>, z.ZodObject<{
149
61
  id: z.ZodString;
150
62
  priority: z.ZodNumber;
151
63
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
152
- } & {
153
64
  type: z.ZodLiteral<"file">;
154
- files: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
155
- options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
65
+ files: z.ZodArray<z.ZodString>;
66
+ options: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
156
67
  includeFilenames: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
157
68
  separator: z.ZodDefault<z.ZodOptional<z.ZodString>>;
158
- errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<["skip", "error"]>>>;
69
+ errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
70
+ error: "error";
71
+ skip: "skip";
72
+ }>>>;
159
73
  maxFileSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
160
74
  includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
161
- }, "strict", z.ZodTypeAny, {
162
- includeFilenames: boolean;
163
- separator: string;
164
- errorHandling: "error" | "skip";
165
- maxFileSize: number;
166
- includeMetadata: boolean;
167
- }, {
168
- includeFilenames?: boolean | undefined;
169
- separator?: string | undefined;
170
- errorHandling?: "error" | "skip" | undefined;
171
- maxFileSize?: number | undefined;
172
- includeMetadata?: boolean | undefined;
173
- }>>>;
174
- }, "strict", z.ZodTypeAny, {
175
- type: "file";
176
- options: {
177
- includeFilenames: boolean;
178
- separator: string;
179
- errorHandling: "error" | "skip";
180
- maxFileSize: number;
181
- includeMetadata: boolean;
182
- };
183
- enabled: boolean;
184
- id: string;
185
- priority: number;
186
- files: string[];
187
- }, {
188
- type: "file";
189
- id: string;
190
- priority: number;
191
- files: string[];
192
- options?: {
193
- includeFilenames?: boolean | undefined;
194
- separator?: string | undefined;
195
- errorHandling?: "error" | "skip" | undefined;
196
- maxFileSize?: number | undefined;
197
- includeMetadata?: boolean | undefined;
198
- } | undefined;
199
- enabled?: boolean | undefined;
200
- }>]>, "many">>;
201
- }, "strict", z.ZodTypeAny, {
202
- contributors: ({
203
- type: "static";
204
- enabled: boolean;
205
- content: string;
206
- id: string;
207
- priority: number;
208
- } | {
209
- type: "dynamic";
210
- enabled: boolean;
211
- id: string;
212
- priority: number;
213
- source: "date" | "env" | "resources";
214
- } | {
215
- type: "file";
216
- options: {
217
- includeFilenames: boolean;
218
- separator: string;
219
- errorHandling: "error" | "skip";
220
- maxFileSize: number;
221
- includeMetadata: boolean;
222
- };
223
- enabled: boolean;
224
- id: string;
225
- priority: number;
226
- files: string[];
227
- })[];
228
- }, {
229
- contributors?: ({
230
- type: "static";
231
- content: string;
232
- id: string;
233
- priority: number;
234
- enabled?: boolean | undefined;
235
- } | {
236
- type: "dynamic";
237
- id: string;
238
- priority: number;
239
- source: "date" | "env" | "resources";
240
- enabled?: boolean | undefined;
241
- } | {
242
- type: "file";
243
- id: string;
244
- priority: number;
245
- files: string[];
246
- options?: {
247
- includeFilenames?: boolean | undefined;
248
- separator?: string | undefined;
249
- errorHandling?: "error" | "skip" | undefined;
250
- maxFileSize?: number | undefined;
251
- includeMetadata?: boolean | undefined;
252
- } | undefined;
253
- enabled?: boolean | undefined;
254
- })[] | undefined;
255
- }>;
256
- export declare const SystemPromptConfigSchema: z.ZodBranded<z.ZodUnion<[z.ZodEffects<z.ZodString, {
75
+ }, z.core.$strict>>>;
76
+ }, z.core.$strict>], "type">>>;
77
+ }, z.core.$strict>;
78
+ export declare const SystemPromptConfigSchema: z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<{
257
79
  contributors: {
258
80
  id: string;
259
81
  type: "static";
@@ -261,153 +83,41 @@ export declare const SystemPromptConfigSchema: z.ZodBranded<z.ZodUnion<[z.ZodEff
261
83
  priority: number;
262
84
  enabled: boolean;
263
85
  }[];
264
- }, string>, z.ZodObject<{
265
- contributors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
86
+ }, string>>, z.ZodObject<{
87
+ contributors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
266
88
  id: z.ZodString;
267
89
  priority: z.ZodNumber;
268
90
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
269
- } & {
270
91
  type: z.ZodLiteral<"static">;
271
92
  content: z.ZodString;
272
- }, "strict", z.ZodTypeAny, {
273
- type: "static";
274
- enabled: boolean;
275
- content: string;
276
- id: string;
277
- priority: number;
278
- }, {
279
- type: "static";
280
- content: string;
281
- id: string;
282
- priority: number;
283
- enabled?: boolean | undefined;
284
- }>, z.ZodObject<{
93
+ }, z.core.$strict>, z.ZodObject<{
285
94
  id: z.ZodString;
286
95
  priority: z.ZodNumber;
287
96
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
288
- } & {
289
97
  type: z.ZodLiteral<"dynamic">;
290
- source: z.ZodEnum<["date", "env", "resources"]>;
291
- }, "strict", z.ZodTypeAny, {
292
- type: "dynamic";
293
- enabled: boolean;
294
- id: string;
295
- priority: number;
296
- source: "date" | "env" | "resources";
297
- }, {
298
- type: "dynamic";
299
- id: string;
300
- priority: number;
301
- source: "date" | "env" | "resources";
302
- enabled?: boolean | undefined;
303
- }>, z.ZodObject<{
98
+ source: z.ZodEnum<{
99
+ date: "date";
100
+ env: "env";
101
+ resources: "resources";
102
+ }>;
103
+ }, z.core.$strict>, z.ZodObject<{
304
104
  id: z.ZodString;
305
105
  priority: z.ZodNumber;
306
106
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
307
- } & {
308
107
  type: z.ZodLiteral<"file">;
309
- files: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
310
- options: z.ZodDefault<z.ZodOptional<z.ZodObject<{
108
+ files: z.ZodArray<z.ZodString>;
109
+ options: z.ZodPrefault<z.ZodOptional<z.ZodObject<{
311
110
  includeFilenames: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
312
111
  separator: z.ZodDefault<z.ZodOptional<z.ZodString>>;
313
- errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<["skip", "error"]>>>;
112
+ errorHandling: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
113
+ error: "error";
114
+ skip: "skip";
115
+ }>>>;
314
116
  maxFileSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
315
117
  includeMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
316
- }, "strict", z.ZodTypeAny, {
317
- includeFilenames: boolean;
318
- separator: string;
319
- errorHandling: "error" | "skip";
320
- maxFileSize: number;
321
- includeMetadata: boolean;
322
- }, {
323
- includeFilenames?: boolean | undefined;
324
- separator?: string | undefined;
325
- errorHandling?: "error" | "skip" | undefined;
326
- maxFileSize?: number | undefined;
327
- includeMetadata?: boolean | undefined;
328
- }>>>;
329
- }, "strict", z.ZodTypeAny, {
330
- type: "file";
331
- options: {
332
- includeFilenames: boolean;
333
- separator: string;
334
- errorHandling: "error" | "skip";
335
- maxFileSize: number;
336
- includeMetadata: boolean;
337
- };
338
- enabled: boolean;
339
- id: string;
340
- priority: number;
341
- files: string[];
342
- }, {
343
- type: "file";
344
- id: string;
345
- priority: number;
346
- files: string[];
347
- options?: {
348
- includeFilenames?: boolean | undefined;
349
- separator?: string | undefined;
350
- errorHandling?: "error" | "skip" | undefined;
351
- maxFileSize?: number | undefined;
352
- includeMetadata?: boolean | undefined;
353
- } | undefined;
354
- enabled?: boolean | undefined;
355
- }>]>, "many">>;
356
- }, "strict", z.ZodTypeAny, {
357
- contributors: ({
358
- type: "static";
359
- enabled: boolean;
360
- content: string;
361
- id: string;
362
- priority: number;
363
- } | {
364
- type: "dynamic";
365
- enabled: boolean;
366
- id: string;
367
- priority: number;
368
- source: "date" | "env" | "resources";
369
- } | {
370
- type: "file";
371
- options: {
372
- includeFilenames: boolean;
373
- separator: string;
374
- errorHandling: "error" | "skip";
375
- maxFileSize: number;
376
- includeMetadata: boolean;
377
- };
378
- enabled: boolean;
379
- id: string;
380
- priority: number;
381
- files: string[];
382
- })[];
383
- }, {
384
- contributors?: ({
385
- type: "static";
386
- content: string;
387
- id: string;
388
- priority: number;
389
- enabled?: boolean | undefined;
390
- } | {
391
- type: "dynamic";
392
- id: string;
393
- priority: number;
394
- source: "date" | "env" | "resources";
395
- enabled?: boolean | undefined;
396
- } | {
397
- type: "file";
398
- id: string;
399
- priority: number;
400
- files: string[];
401
- options?: {
402
- includeFilenames?: boolean | undefined;
403
- separator?: string | undefined;
404
- errorHandling?: "error" | "skip" | undefined;
405
- maxFileSize?: number | undefined;
406
- includeMetadata?: boolean | undefined;
407
- } | undefined;
408
- enabled?: boolean | undefined;
409
- })[] | undefined;
410
- }>]>, "ValidatedSystemPromptConfig">;
118
+ }, z.core.$strict>>>;
119
+ }, z.core.$strict>], "type">>>;
120
+ }, z.core.$strict>]>, "ValidatedSystemPromptConfig", "out">;
411
121
  export type SystemPromptConfig = z.input<typeof SystemPromptConfigSchema>;
412
122
  export type ValidatedSystemPromptConfig = z.output<typeof SystemPromptConfigSchema>;
413
123
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/systemPrompt/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0FxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkB/B,CAAC;AAGN,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAElF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAY9B,CAAC;AAEd,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEvF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B9B,CAAC;AAGd,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAUM,CAAC;AAG5C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/systemPrompt/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0FxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAU/B,CAAC;AAGN,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAElF,eAAO,MAAM,8BAA8B;;;;kBAY9B,CAAC;AAEd,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEvF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8B9B,CAAC;AAGd,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DAUM,CAAC;AAG5C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -39,22 +39,14 @@ const FileContributorSchema = BaseContributorSchema.extend({
39
39
  includeMetadata: z.boolean().optional().default(false).describe(
40
40
  "Whether to include file metadata (size, modification time) in the context"
41
41
  )
42
- }).strict().optional().default({})
42
+ }).strict().optional().prefault({})
43
43
  }).strict();
44
44
  const ContributorConfigSchema = z.discriminatedUnion(
45
45
  "type",
46
46
  // The field to discriminate on
47
47
  [StaticContributorSchema, DynamicContributorSchema, FileContributorSchema],
48
48
  {
49
- // Optional: Custom error message for invalid discriminator
50
- errorMap: (issue, ctx) => {
51
- if (issue.code === z.ZodIssueCode.invalid_union_discriminator) {
52
- return {
53
- message: `Invalid contributor type. Expected 'static', 'dynamic', or 'file'. Note: memory contributors are now configured via the top-level 'memories' config.`
54
- };
55
- }
56
- return { message: ctx.defaultError };
57
- }
49
+ error: `Invalid contributor type. Expected 'static', 'dynamic', or 'file'. Note: memory contributors are now configured via the top-level 'memories' config.`
58
50
  }
59
51
  ).describe(
60
52
  "Configuration for a system prompt contributor. Type 'static' requires 'content', type 'dynamic' requires 'source', type 'file' requires 'files'."
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(decorators_exports);
25
25
  var import_api = require("@opentelemetry/api");
26
26
  var import_utils = require("./utils.js");
27
27
  var import_safe_stringify = require("../utils/safe-stringify.js");
28
+ var import_runtime = require("../runtime/index.js");
28
29
  function withSpan(options) {
29
30
  return function(_target, propertyKey, descriptor) {
30
31
  if (!descriptor || typeof descriptor === "number") return;
@@ -53,7 +54,15 @@ function withSpan(options) {
53
54
  args.forEach((arg, index) => {
54
55
  span.setAttribute(`${spanName}.argument.${index}`, (0, import_safe_stringify.safeStringify)(arg, 8192));
55
56
  });
56
- const { requestId, componentName, runId, threadId, resourceId, sessionId } = (0, import_utils.getBaggageValues)(ctx);
57
+ const {
58
+ requestId,
59
+ componentName,
60
+ runId,
61
+ threadId,
62
+ resourceId,
63
+ sessionId,
64
+ hostRuntime
65
+ } = (0, import_utils.getBaggageValues)(ctx);
57
66
  if (sessionId) {
58
67
  span.setAttribute("sessionId", sessionId);
59
68
  span.setAttribute("baggage.sessionId", sessionId);
@@ -74,65 +83,73 @@ function withSpan(options) {
74
83
  span.setAttribute("runId", String(runId));
75
84
  span.setAttribute("baggage.runId", String(runId));
76
85
  }
86
+ for (const [key, value] of Object.entries((0, import_runtime.getHostRuntimeAttributes)(hostRuntime))) {
87
+ span.setAttribute(key, value);
88
+ }
89
+ const inferredComponentName = options?.componentName;
90
+ const effectiveHostRuntime = hostRuntime;
91
+ const effectiveRunId = effectiveHostRuntime?.ids?.runId ?? runId;
77
92
  if (componentName) {
78
93
  span.setAttribute("componentName", componentName);
79
94
  span.setAttribute("baggage.componentName", componentName);
80
- } else if (this && typeof this === "object") {
81
- const contextObj = this;
82
- const inferredName = contextObj.name ?? contextObj.constructor?.name;
83
- if (inferredName) {
84
- span.setAttribute("componentName", inferredName);
85
- }
86
- if (contextObj.runId) {
87
- span.setAttribute("runId", contextObj.runId);
88
- span.setAttribute("baggage.runId", contextObj.runId);
89
- }
90
- const existingBaggage = import_api.propagation.getBaggage(ctx);
91
- const baggageEntries = {};
92
- if (existingBaggage) {
93
- existingBaggage.getAllEntries().forEach(([key, entry]) => {
94
- baggageEntries[key] = entry;
95
- });
96
- }
97
- if (sessionId !== void 0) {
98
- baggageEntries.sessionId = {
99
- ...baggageEntries.sessionId,
100
- value: String(sessionId)
101
- };
102
- }
103
- if (requestId !== void 0) {
104
- baggageEntries["http.request_id"] = {
105
- ...baggageEntries["http.request_id"],
106
- value: String(requestId)
107
- };
108
- }
109
- if (threadId !== void 0) {
110
- baggageEntries.threadId = {
111
- ...baggageEntries.threadId,
112
- value: String(threadId)
113
- };
114
- }
115
- if (resourceId !== void 0) {
116
- baggageEntries.resourceId = {
117
- ...baggageEntries.resourceId,
118
- value: String(resourceId)
119
- };
120
- }
121
- if (inferredName !== void 0) {
122
- baggageEntries.componentName = {
123
- ...baggageEntries.componentName,
124
- value: String(inferredName)
125
- };
126
- }
127
- if (contextObj.runId !== void 0) {
128
- baggageEntries.runId = {
129
- ...baggageEntries.runId,
130
- value: String(contextObj.runId)
131
- };
132
- }
133
- if (Object.keys(baggageEntries).length > 0) {
134
- ctx = import_api.propagation.setBaggage(ctx, import_api.propagation.createBaggage(baggageEntries));
135
- }
95
+ } else if (inferredComponentName) {
96
+ span.setAttribute("componentName", inferredComponentName);
97
+ }
98
+ if (effectiveRunId !== void 0) {
99
+ span.setAttribute("runId", String(effectiveRunId));
100
+ span.setAttribute("baggage.runId", String(effectiveRunId));
101
+ }
102
+ for (const [key, value] of Object.entries(
103
+ (0, import_runtime.getHostRuntimeAttributes)(effectiveHostRuntime)
104
+ )) {
105
+ span.setAttribute(key, value);
106
+ }
107
+ const existingBaggage = import_api.propagation.getBaggage(ctx);
108
+ const baggageEntries = {};
109
+ if (existingBaggage) {
110
+ existingBaggage.getAllEntries().forEach(([key, entry]) => {
111
+ baggageEntries[key] = entry;
112
+ });
113
+ }
114
+ if (sessionId !== void 0) {
115
+ baggageEntries.sessionId = {
116
+ ...baggageEntries.sessionId,
117
+ value: String(sessionId)
118
+ };
119
+ }
120
+ if (requestId !== void 0) {
121
+ baggageEntries["http.request_id"] = {
122
+ ...baggageEntries["http.request_id"],
123
+ value: String(requestId)
124
+ };
125
+ }
126
+ if (threadId !== void 0) {
127
+ baggageEntries.threadId = {
128
+ ...baggageEntries.threadId,
129
+ value: String(threadId)
130
+ };
131
+ }
132
+ if (resourceId !== void 0) {
133
+ baggageEntries.resourceId = {
134
+ ...baggageEntries.resourceId,
135
+ value: String(resourceId)
136
+ };
137
+ }
138
+ if (componentName === void 0 && inferredComponentName !== void 0) {
139
+ baggageEntries.componentName = {
140
+ ...baggageEntries.componentName,
141
+ value: String(inferredComponentName)
142
+ };
143
+ }
144
+ if (effectiveRunId !== void 0) {
145
+ baggageEntries.runId = {
146
+ ...baggageEntries.runId,
147
+ value: String(effectiveRunId)
148
+ };
149
+ }
150
+ Object.assign(baggageEntries, (0, import_runtime.getHostRuntimeBaggageEntries)(effectiveHostRuntime));
151
+ if (Object.keys(baggageEntries).length > 0) {
152
+ ctx = import_api.propagation.setBaggage(ctx, import_api.propagation.createBaggage(baggageEntries));
136
153
  }
137
154
  let result;
138
155
  try {
@@ -197,6 +214,7 @@ function InstrumentClass(options) {
197
214
  spanName: options?.prefix ? `${options.prefix}.${method}` : method,
198
215
  skipIfNoTelemetry: true,
199
216
  spanKind: options?.spanKind || import_api.SpanKind.INTERNAL,
217
+ componentName: options?.componentName ?? target.name,
200
218
  ...options?.tracerName !== void 0 && {
201
219
  tracerName: options.tracerName
202
220
  }
@@ -1,12 +1,14 @@
1
1
  import { SpanKind } from '@opentelemetry/api';
2
2
  export declare function withSpan(options: {
3
3
  spanName?: string;
4
+ componentName?: string;
4
5
  skipIfNoTelemetry?: boolean;
5
6
  spanKind?: SpanKind;
6
7
  tracerName?: string;
7
8
  }): any;
8
9
  export declare function InstrumentClass(options?: {
9
10
  prefix?: string;
11
+ componentName?: string;
10
12
  spanKind?: SpanKind;
11
13
  excludeMethods?: string[];
12
14
  methodFilter?: (methodName: string) => boolean;