@dexto/core 1.6.21 → 1.6.24
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/agent/DextoAgent.cjs +159 -51
- package/dist/agent/DextoAgent.d.ts +3 -1
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +162 -53
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/context/manager.cjs +147 -35
- package/dist/context/manager.d.ts +6 -0
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +149 -36
- package/dist/context/types.cjs +5 -0
- package/dist/context/types.d.ts +24 -1
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/types.js +4 -0
- package/dist/context/utils.cjs +85 -25
- package/dist/context/utils.d.ts +5 -3
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +84 -25
- package/dist/events/index.d.ts +14 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.cjs +38 -6
- package/dist/llm/executor/stream-processor.d.ts +2 -0
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +38 -6
- package/dist/llm/executor/turn-executor.cjs +5 -2
- package/dist/llm/executor/turn-executor.d.ts +1 -1
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +5 -2
- package/dist/llm/formatters/vercel.cjs +3 -1
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +3 -1
- package/dist/llm/providers/local/schemas.d.ts +2 -2
- package/dist/llm/registry/index.cjs +44 -13
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/registry/index.js +44 -13
- package/dist/llm/registry/models.generated.cjs +1270 -1324
- package/dist/llm/registry/models.generated.d.ts +617 -210
- package/dist/llm/registry/models.generated.d.ts.map +1 -1
- package/dist/llm/registry/models.generated.js +1270 -1324
- package/dist/llm/registry/sync.cjs +5 -0
- package/dist/llm/registry/sync.d.ts.map +1 -1
- package/dist/llm/registry/sync.js +5 -0
- package/dist/llm/schemas.d.ts +50 -50
- package/dist/llm/services/factory.cjs +19 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +19 -1
- package/dist/llm/types.cjs +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -1
- package/dist/llm/usage-metadata.cjs +4 -2
- package/dist/llm/usage-metadata.d.ts +2 -0
- package/dist/llm/usage-metadata.d.ts.map +1 -1
- package/dist/llm/usage-metadata.js +8 -3
- package/dist/resources/handlers/filesystem-handler.cjs +55 -9
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +55 -9
- package/dist/resources/reference-parser.cjs +47 -12
- package/dist/resources/reference-parser.d.ts +6 -3
- package/dist/resources/reference-parser.d.ts.map +1 -1
- package/dist/resources/reference-parser.js +47 -12
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.cjs +1 -1
- package/dist/tools/tool-call-metadata.d.ts +1 -1
- package/dist/tools/tool-call-metadata.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.js +1 -1
- package/dist/tools/tool-manager.cjs +3 -0
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +7 -1
- package/dist/tools/types.d.ts +2 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +25 -0
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +25 -0
- package/package.json +1 -1
|
@@ -167,6 +167,11 @@ function getSupportedFileTypesFromModel(provider, model) {
|
|
|
167
167
|
if (inputModalities.includes("pdf")) fileTypes.push("pdf");
|
|
168
168
|
if (inputModalities.includes("image")) fileTypes.push("image");
|
|
169
169
|
if (inputModalities.includes("audio")) fileTypes.push("audio");
|
|
170
|
+
if (inputModalities.includes("video")) fileTypes.push("video");
|
|
171
|
+
const supportsDocumentInputs = provider === "openai" && (inputModalities.includes("image") || inputModalities.includes("pdf")) || (provider === "google" || provider === "vertex") && (inputModalities.includes("image") || inputModalities.includes("audio") || inputModalities.includes("video") || inputModalities.includes("pdf")) || provider === "openrouter" && (model.id.startsWith("openai/") && (inputModalities.includes("image") || inputModalities.includes("pdf")) || model.id.startsWith("google/") && (inputModalities.includes("image") || inputModalities.includes("audio") || inputModalities.includes("video") || inputModalities.includes("pdf")));
|
|
172
|
+
if (supportsDocumentInputs && !fileTypes.includes("document")) {
|
|
173
|
+
fileTypes.push("document");
|
|
174
|
+
}
|
|
170
175
|
if (provider === "openai" && model.attachment === true && inputModalities.includes("image")) {
|
|
171
176
|
if (!fileTypes.includes("pdf")) fileTypes.unshift("pdf");
|
|
172
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/llm/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAE5D,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACtD,KAAK,iBAAiB,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,c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es("pdf")) fileTypes.push("pdf");
|
|
143
143
|
if (inputModalities.includes("image")) fileTypes.push("image");
|
|
144
144
|
if (inputModalities.includes("audio")) fileTypes.push("audio");
|
|
145
|
+
if (inputModalities.includes("video")) fileTypes.push("video");
|
|
146
|
+
const supportsDocumentInputs = provider === "openai" && (inputModalities.includes("image") || inputModalities.includes("pdf")) || (provider === "google" || provider === "vertex") && (inputModalities.includes("image") || inputModalities.includes("audio") || inputModalities.includes("video") || inputModalities.includes("pdf")) || provider === "openrouter" && (model.id.startsWith("openai/") && (inputModalities.includes("image") || inputModalities.includes("pdf")) || model.id.startsWith("google/") && (inputModalities.includes("image") || inputModalities.includes("audio") || inputModalities.includes("video") || inputModalities.includes("pdf")));
|
|
147
|
+
if (supportsDocumentInputs && !fileTypes.includes("document")) {
|
|
148
|
+
fileTypes.push("document");
|
|
149
|
+
}
|
|
145
150
|
if (provider === "openai" && model.attachment === true && inputModalities.includes("image")) {
|
|
146
151
|
if (!fileTypes.includes("pdf")) fileTypes.unshift("pdf");
|
|
147
152
|
}
|
package/dist/llm/schemas.d.ts
CHANGED
|
@@ -24,30 +24,30 @@ export declare const LLMConfigBaseSchema: z.ZodObject<{
|
|
|
24
24
|
model: string;
|
|
25
25
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
26
26
|
apiKey?: string | undefined;
|
|
27
|
+
maxIterations?: number | undefined;
|
|
28
|
+
baseURL?: string | undefined;
|
|
27
29
|
maxInputTokens?: number | undefined;
|
|
30
|
+
maxOutputTokens?: number | undefined;
|
|
31
|
+
temperature?: number | undefined;
|
|
32
|
+
allowedMediaTypes?: string[] | undefined;
|
|
28
33
|
reasoning?: {
|
|
29
34
|
variant: string;
|
|
30
35
|
budgetTokens?: number | undefined;
|
|
31
36
|
} | undefined;
|
|
32
|
-
temperature?: number | undefined;
|
|
33
|
-
maxIterations?: number | undefined;
|
|
34
|
-
baseURL?: string | undefined;
|
|
35
|
-
maxOutputTokens?: number | undefined;
|
|
36
|
-
allowedMediaTypes?: string[] | undefined;
|
|
37
37
|
}, {
|
|
38
38
|
model: string;
|
|
39
39
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
40
40
|
apiKey?: string | undefined;
|
|
41
|
+
maxIterations?: number | undefined;
|
|
42
|
+
baseURL?: string | undefined;
|
|
41
43
|
maxInputTokens?: number | undefined;
|
|
44
|
+
maxOutputTokens?: number | undefined;
|
|
45
|
+
temperature?: number | undefined;
|
|
46
|
+
allowedMediaTypes?: string[] | undefined;
|
|
42
47
|
reasoning?: {
|
|
43
48
|
variant: string;
|
|
44
49
|
budgetTokens?: number | undefined;
|
|
45
50
|
} | undefined;
|
|
46
|
-
temperature?: number | undefined;
|
|
47
|
-
maxIterations?: number | undefined;
|
|
48
|
-
baseURL?: string | undefined;
|
|
49
|
-
maxOutputTokens?: number | undefined;
|
|
50
|
-
allowedMediaTypes?: string[] | undefined;
|
|
51
51
|
}>;
|
|
52
52
|
/**
|
|
53
53
|
* LLM config schema.
|
|
@@ -80,58 +80,58 @@ export declare const LLMConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
80
80
|
model: string;
|
|
81
81
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
82
82
|
apiKey?: string | undefined;
|
|
83
|
+
maxIterations?: number | undefined;
|
|
84
|
+
baseURL?: string | undefined;
|
|
83
85
|
maxInputTokens?: number | undefined;
|
|
86
|
+
maxOutputTokens?: number | undefined;
|
|
87
|
+
temperature?: number | undefined;
|
|
88
|
+
allowedMediaTypes?: string[] | undefined;
|
|
84
89
|
reasoning?: {
|
|
85
90
|
variant: string;
|
|
86
91
|
budgetTokens?: number | undefined;
|
|
87
92
|
} | undefined;
|
|
88
|
-
temperature?: number | undefined;
|
|
89
|
-
maxIterations?: number | undefined;
|
|
90
|
-
baseURL?: string | undefined;
|
|
91
|
-
maxOutputTokens?: number | undefined;
|
|
92
|
-
allowedMediaTypes?: string[] | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
model: string;
|
|
95
95
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
96
96
|
apiKey?: string | undefined;
|
|
97
|
+
maxIterations?: number | undefined;
|
|
98
|
+
baseURL?: string | undefined;
|
|
97
99
|
maxInputTokens?: number | undefined;
|
|
100
|
+
maxOutputTokens?: number | undefined;
|
|
101
|
+
temperature?: number | undefined;
|
|
102
|
+
allowedMediaTypes?: string[] | undefined;
|
|
98
103
|
reasoning?: {
|
|
99
104
|
variant: string;
|
|
100
105
|
budgetTokens?: number | undefined;
|
|
101
106
|
} | undefined;
|
|
102
|
-
temperature?: number | undefined;
|
|
103
|
-
maxIterations?: number | undefined;
|
|
104
|
-
baseURL?: string | undefined;
|
|
105
|
-
maxOutputTokens?: number | undefined;
|
|
106
|
-
allowedMediaTypes?: string[] | undefined;
|
|
107
107
|
}>, {
|
|
108
108
|
model: string;
|
|
109
109
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
110
110
|
apiKey?: string | undefined;
|
|
111
|
+
maxIterations?: number | undefined;
|
|
112
|
+
baseURL?: string | undefined;
|
|
111
113
|
maxInputTokens?: number | undefined;
|
|
114
|
+
maxOutputTokens?: number | undefined;
|
|
115
|
+
temperature?: number | undefined;
|
|
116
|
+
allowedMediaTypes?: string[] | undefined;
|
|
112
117
|
reasoning?: {
|
|
113
118
|
variant: string;
|
|
114
119
|
budgetTokens?: number | undefined;
|
|
115
120
|
} | undefined;
|
|
116
|
-
temperature?: number | undefined;
|
|
117
|
-
maxIterations?: number | undefined;
|
|
118
|
-
baseURL?: string | undefined;
|
|
119
|
-
maxOutputTokens?: number | undefined;
|
|
120
|
-
allowedMediaTypes?: string[] | undefined;
|
|
121
121
|
}, {
|
|
122
122
|
model: string;
|
|
123
123
|
provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
124
124
|
apiKey?: string | undefined;
|
|
125
|
+
maxIterations?: number | undefined;
|
|
126
|
+
baseURL?: string | undefined;
|
|
125
127
|
maxInputTokens?: number | undefined;
|
|
128
|
+
maxOutputTokens?: number | undefined;
|
|
129
|
+
temperature?: number | undefined;
|
|
130
|
+
allowedMediaTypes?: string[] | undefined;
|
|
126
131
|
reasoning?: {
|
|
127
132
|
variant: string;
|
|
128
133
|
budgetTokens?: number | undefined;
|
|
129
134
|
} | undefined;
|
|
130
|
-
temperature?: number | undefined;
|
|
131
|
-
maxIterations?: number | undefined;
|
|
132
|
-
baseURL?: string | undefined;
|
|
133
|
-
maxOutputTokens?: number | undefined;
|
|
134
|
-
allowedMediaTypes?: string[] | undefined;
|
|
135
135
|
}>;
|
|
136
136
|
export type LLMConfig = z.input<typeof LLMConfigSchema>;
|
|
137
137
|
export type ValidatedLLMConfig = z.output<typeof LLMConfigSchema>;
|
|
@@ -159,58 +159,58 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
|
|
|
159
159
|
apiKey?: string | undefined;
|
|
160
160
|
model?: string | undefined;
|
|
161
161
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
162
|
+
maxIterations?: number | undefined;
|
|
163
|
+
baseURL?: string | undefined;
|
|
162
164
|
maxInputTokens?: number | undefined;
|
|
165
|
+
maxOutputTokens?: number | undefined;
|
|
166
|
+
temperature?: number | undefined;
|
|
167
|
+
allowedMediaTypes?: string[] | undefined;
|
|
163
168
|
reasoning?: {
|
|
164
169
|
variant: string;
|
|
165
170
|
budgetTokens?: number | undefined;
|
|
166
171
|
} | null | undefined;
|
|
167
|
-
temperature?: number | undefined;
|
|
168
|
-
maxIterations?: number | undefined;
|
|
169
|
-
baseURL?: string | undefined;
|
|
170
|
-
maxOutputTokens?: number | undefined;
|
|
171
|
-
allowedMediaTypes?: string[] | undefined;
|
|
172
172
|
}, {
|
|
173
173
|
apiKey?: string | undefined;
|
|
174
174
|
model?: string | undefined;
|
|
175
175
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
176
|
+
maxIterations?: number | undefined;
|
|
177
|
+
baseURL?: string | undefined;
|
|
176
178
|
maxInputTokens?: number | undefined;
|
|
179
|
+
maxOutputTokens?: number | undefined;
|
|
180
|
+
temperature?: number | undefined;
|
|
181
|
+
allowedMediaTypes?: string[] | undefined;
|
|
177
182
|
reasoning?: {
|
|
178
183
|
variant: string;
|
|
179
184
|
budgetTokens?: number | undefined;
|
|
180
185
|
} | null | undefined;
|
|
181
|
-
temperature?: number | undefined;
|
|
182
|
-
maxIterations?: number | undefined;
|
|
183
|
-
baseURL?: string | undefined;
|
|
184
|
-
maxOutputTokens?: number | undefined;
|
|
185
|
-
allowedMediaTypes?: string[] | undefined;
|
|
186
186
|
}>, {
|
|
187
187
|
apiKey?: string | undefined;
|
|
188
188
|
model?: string | undefined;
|
|
189
189
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
190
|
+
maxIterations?: number | undefined;
|
|
191
|
+
baseURL?: string | undefined;
|
|
190
192
|
maxInputTokens?: number | undefined;
|
|
193
|
+
maxOutputTokens?: number | undefined;
|
|
194
|
+
temperature?: number | undefined;
|
|
195
|
+
allowedMediaTypes?: string[] | undefined;
|
|
191
196
|
reasoning?: {
|
|
192
197
|
variant: string;
|
|
193
198
|
budgetTokens?: number | undefined;
|
|
194
199
|
} | null | undefined;
|
|
195
|
-
temperature?: number | undefined;
|
|
196
|
-
maxIterations?: number | undefined;
|
|
197
|
-
baseURL?: string | undefined;
|
|
198
|
-
maxOutputTokens?: number | undefined;
|
|
199
|
-
allowedMediaTypes?: string[] | undefined;
|
|
200
200
|
}, {
|
|
201
201
|
apiKey?: string | undefined;
|
|
202
202
|
model?: string | undefined;
|
|
203
203
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
204
|
+
maxIterations?: number | undefined;
|
|
205
|
+
baseURL?: string | undefined;
|
|
204
206
|
maxInputTokens?: number | undefined;
|
|
207
|
+
maxOutputTokens?: number | undefined;
|
|
208
|
+
temperature?: number | undefined;
|
|
209
|
+
allowedMediaTypes?: string[] | undefined;
|
|
205
210
|
reasoning?: {
|
|
206
211
|
variant: string;
|
|
207
212
|
budgetTokens?: number | undefined;
|
|
208
213
|
} | null | undefined;
|
|
209
|
-
temperature?: number | undefined;
|
|
210
|
-
maxIterations?: number | undefined;
|
|
211
|
-
baseURL?: string | undefined;
|
|
212
|
-
maxOutputTokens?: number | undefined;
|
|
213
|
-
allowedMediaTypes?: string[] | undefined;
|
|
214
214
|
}>;
|
|
215
215
|
export type LLMUpdates = z.input<typeof LLMUpdatesSchema>;
|
|
216
216
|
export type { LLMUpdateContext } from '../llm/types.js';
|
|
@@ -48,6 +48,24 @@ function isLanguageModel(value) {
|
|
|
48
48
|
const candidate = value;
|
|
49
49
|
return typeof candidate["modelId"] === "string" && (typeof candidate["doGenerate"] === "function" || typeof candidate["doStream"] === "function");
|
|
50
50
|
}
|
|
51
|
+
const DEFAULT_DEXTO_GATEWAY_BASE_URL = "https://api.dexto.ai/v1";
|
|
52
|
+
function trimTrailingSlash(value) {
|
|
53
|
+
return value.trim().replace(/\/$/, "");
|
|
54
|
+
}
|
|
55
|
+
function resolveDextoGatewayBaseURL(baseURL) {
|
|
56
|
+
if (baseURL?.trim()) {
|
|
57
|
+
return trimTrailingSlash(baseURL);
|
|
58
|
+
}
|
|
59
|
+
const envBaseURL = process.env.DEXTO_API_URL?.trim();
|
|
60
|
+
if (!envBaseURL) {
|
|
61
|
+
return DEFAULT_DEXTO_GATEWAY_BASE_URL;
|
|
62
|
+
}
|
|
63
|
+
const normalizedEnvBaseURL = trimTrailingSlash(envBaseURL);
|
|
64
|
+
if (normalizedEnvBaseURL.endsWith("/v1")) {
|
|
65
|
+
return normalizedEnvBaseURL;
|
|
66
|
+
}
|
|
67
|
+
return `${normalizedEnvBaseURL}/v1`;
|
|
68
|
+
}
|
|
51
69
|
const DEXTO_GATEWAY_HEADERS = {
|
|
52
70
|
SESSION_ID: "X-Dexto-Session-ID",
|
|
53
71
|
CLIENT_SOURCE: "X-Dexto-Source",
|
|
@@ -126,7 +144,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
126
144
|
return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: glamaBaseURL }).chat(model);
|
|
127
145
|
}
|
|
128
146
|
case "dexto-nova": {
|
|
129
|
-
const dextoBaseURL =
|
|
147
|
+
const dextoBaseURL = resolveDextoGatewayBaseURL(baseURL);
|
|
130
148
|
const headers = {
|
|
131
149
|
[DEXTO_GATEWAY_HEADERS.CLIENT_SOURCE]: context?.clientSource ?? "cli"
|
|
132
150
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAYnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAYnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AA2C5E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACrC,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,uBAAuB;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3D,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAUD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,aAAa,CAyOf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,2BAA2B,EAC5C,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,uBAA4B,GACtC,gBAAgB,CA4BlB"}
|
|
@@ -30,6 +30,24 @@ function isLanguageModel(value) {
|
|
|
30
30
|
const candidate = value;
|
|
31
31
|
return typeof candidate["modelId"] === "string" && (typeof candidate["doGenerate"] === "function" || typeof candidate["doStream"] === "function");
|
|
32
32
|
}
|
|
33
|
+
const DEFAULT_DEXTO_GATEWAY_BASE_URL = "https://api.dexto.ai/v1";
|
|
34
|
+
function trimTrailingSlash(value) {
|
|
35
|
+
return value.trim().replace(/\/$/, "");
|
|
36
|
+
}
|
|
37
|
+
function resolveDextoGatewayBaseURL(baseURL) {
|
|
38
|
+
if (baseURL?.trim()) {
|
|
39
|
+
return trimTrailingSlash(baseURL);
|
|
40
|
+
}
|
|
41
|
+
const envBaseURL = process.env.DEXTO_API_URL?.trim();
|
|
42
|
+
if (!envBaseURL) {
|
|
43
|
+
return DEFAULT_DEXTO_GATEWAY_BASE_URL;
|
|
44
|
+
}
|
|
45
|
+
const normalizedEnvBaseURL = trimTrailingSlash(envBaseURL);
|
|
46
|
+
if (normalizedEnvBaseURL.endsWith("/v1")) {
|
|
47
|
+
return normalizedEnvBaseURL;
|
|
48
|
+
}
|
|
49
|
+
return `${normalizedEnvBaseURL}/v1`;
|
|
50
|
+
}
|
|
33
51
|
const DEXTO_GATEWAY_HEADERS = {
|
|
34
52
|
SESSION_ID: "X-Dexto-Session-ID",
|
|
35
53
|
CLIENT_SOURCE: "X-Dexto-Source",
|
|
@@ -108,7 +126,7 @@ function createVercelModel(llmConfig, context) {
|
|
|
108
126
|
return createOpenAI({ apiKey: apiKey ?? "", baseURL: glamaBaseURL }).chat(model);
|
|
109
127
|
}
|
|
110
128
|
case "dexto-nova": {
|
|
111
|
-
const dextoBaseURL =
|
|
129
|
+
const dextoBaseURL = resolveDextoGatewayBaseURL(baseURL);
|
|
112
130
|
const headers = {
|
|
113
131
|
[DEXTO_GATEWAY_HEADERS.CLIENT_SOURCE]: context?.clientSource ?? "cli"
|
|
114
132
|
};
|
package/dist/llm/types.cjs
CHANGED
|
@@ -46,7 +46,7 @@ const LLM_PROVIDERS = [
|
|
|
46
46
|
// Dexto gateway - routes through api.dexto.ai/v1 with billing
|
|
47
47
|
];
|
|
48
48
|
const LLM_PRICING_STATUSES = ["estimated", "unpriced"];
|
|
49
|
-
const SUPPORTED_FILE_TYPES = ["pdf", "image", "audio"];
|
|
49
|
+
const SUPPORTED_FILE_TYPES = ["pdf", "image", "audio", "video", "document"];
|
|
50
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
51
|
0 && (module.exports = {
|
|
52
52
|
LLM_PRICING_STATUSES,
|
package/dist/llm/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const LLM_PROVIDERS: readonly ["openai", "openai-compatible", "an
|
|
|
2
2
|
export type LLMProvider = (typeof LLM_PROVIDERS)[number];
|
|
3
3
|
export declare const LLM_PRICING_STATUSES: readonly ["estimated", "unpriced"];
|
|
4
4
|
export type LLMPricingStatus = (typeof LLM_PRICING_STATUSES)[number];
|
|
5
|
-
export declare const SUPPORTED_FILE_TYPES: readonly ["pdf", "image", "audio"];
|
|
5
|
+
export declare const SUPPORTED_FILE_TYPES: readonly ["pdf", "image", "audio", "video", "document"];
|
|
6
6
|
export type SupportedFileType = (typeof SUPPORTED_FILE_TYPES)[number];
|
|
7
7
|
export type ReasoningVariant = string;
|
|
8
8
|
export interface LLMReasoningConfig {
|
package/dist/llm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,oMAkBhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,oMAkBhB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,oBAAoB,yDAA0D,CAAC;AAC5F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAItE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACvB,mDAAmD;IACnD,QAAQ,EAAE,WAAW,CAAC;IAEtB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
package/dist/llm/types.js
CHANGED
|
@@ -22,7 +22,7 @@ const LLM_PROVIDERS = [
|
|
|
22
22
|
// Dexto gateway - routes through api.dexto.ai/v1 with billing
|
|
23
23
|
];
|
|
24
24
|
const LLM_PRICING_STATUSES = ["estimated", "unpriced"];
|
|
25
|
-
const SUPPORTED_FILE_TYPES = ["pdf", "image", "audio"];
|
|
25
|
+
const SUPPORTED_FILE_TYPES = ["pdf", "image", "audio", "video", "document"];
|
|
26
26
|
export {
|
|
27
27
|
LLM_PRICING_STATUSES,
|
|
28
28
|
LLM_PROVIDERS,
|
|
@@ -38,9 +38,11 @@ function getUsagePricingMetadata(config) {
|
|
|
38
38
|
if (!pricing) {
|
|
39
39
|
return { pricingStatus: "unpriced" };
|
|
40
40
|
}
|
|
41
|
+
const costBreakdown = (0, import_registry.calculateCostBreakdown)(tokenUsage, pricing);
|
|
41
42
|
return {
|
|
42
|
-
estimatedCost:
|
|
43
|
-
pricingStatus: "estimated"
|
|
43
|
+
estimatedCost: costBreakdown.totalUsd,
|
|
44
|
+
pricingStatus: "estimated",
|
|
45
|
+
costBreakdown
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type TokenUsageCostBreakdown } from './registry/index.js';
|
|
1
2
|
import type { LLMProvider, LLMPricingStatus, TokenUsage } from './types.js';
|
|
2
3
|
export interface LLMUsagePricingMetadata {
|
|
3
4
|
estimatedCost?: number;
|
|
4
5
|
pricingStatus?: LLMPricingStatus;
|
|
6
|
+
costBreakdown?: TokenUsageCostBreakdown;
|
|
5
7
|
}
|
|
6
8
|
export declare function hasMeaningfulTokenUsage(tokenUsage: TokenUsage | undefined): boolean;
|
|
7
9
|
export declare function getUsagePricingMetadata(config: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-metadata.d.ts","sourceRoot":"","sources":["../../src/llm/usage-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usage-metadata.d.ts","sourceRoot":"","sources":["../../src/llm/usage-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,uBAAuB,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,WAAW,uBAAuB;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,aAAa,CAAC,EAAE,uBAAuB,CAAC;CAC3C;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAanF;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC5C,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;CAC3B,GAAG,uBAAuB,CAqB1B"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import "../chunk-PTJYTZNU.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
calculateCostBreakdown,
|
|
4
|
+
getModelPricing
|
|
5
|
+
} from "./registry/index.js";
|
|
3
6
|
function hasMeaningfulTokenUsage(tokenUsage) {
|
|
4
7
|
if (!tokenUsage) {
|
|
5
8
|
return false;
|
|
@@ -15,9 +18,11 @@ function getUsagePricingMetadata(config) {
|
|
|
15
18
|
if (!pricing) {
|
|
16
19
|
return { pricingStatus: "unpriced" };
|
|
17
20
|
}
|
|
21
|
+
const costBreakdown = calculateCostBreakdown(tokenUsage, pricing);
|
|
18
22
|
return {
|
|
19
|
-
estimatedCost:
|
|
20
|
-
pricingStatus: "estimated"
|
|
23
|
+
estimatedCost: costBreakdown.totalUsd,
|
|
24
|
+
pricingStatus: "estimated",
|
|
25
|
+
costBreakdown
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
export {
|
|
@@ -69,7 +69,7 @@ class FileSystemResourceHandler {
|
|
|
69
69
|
return Array.from(this.resourcesCache.values());
|
|
70
70
|
}
|
|
71
71
|
canHandle(uri) {
|
|
72
|
-
return uri.startsWith("fs://");
|
|
72
|
+
return uri.startsWith("fs://") || import_path.default.isAbsolute(uri);
|
|
73
73
|
}
|
|
74
74
|
isPathAllowed(canonicalPath) {
|
|
75
75
|
return this.canonicalRoots.some((root) => {
|
|
@@ -94,7 +94,7 @@ class FileSystemResourceHandler {
|
|
|
94
94
|
if (!this.canHandle(uri)) {
|
|
95
95
|
throw import_errors.ResourceError.noSuitableProvider(uri);
|
|
96
96
|
}
|
|
97
|
-
const filePath = uri.replace("fs://", "");
|
|
97
|
+
const filePath = uri.startsWith("fs://") ? uri.replace("fs://", "") : uri;
|
|
98
98
|
const resolvedPath = import_path.default.resolve(filePath);
|
|
99
99
|
let canonicalPath;
|
|
100
100
|
try {
|
|
@@ -111,18 +111,21 @@ class FileSystemResourceHandler {
|
|
|
111
111
|
throw import_errors.ResourceError.readFailed(uri, `File too large (${stat.size} bytes)`);
|
|
112
112
|
}
|
|
113
113
|
if (this.isBinaryFile(canonicalPath)) {
|
|
114
|
+
const mimeType = this.getMimeType(canonicalPath);
|
|
115
|
+
const content2 = await import_fs.promises.readFile(canonicalPath);
|
|
114
116
|
return {
|
|
115
117
|
contents: [
|
|
116
118
|
{
|
|
117
119
|
uri,
|
|
118
|
-
mimeType
|
|
119
|
-
|
|
120
|
+
mimeType,
|
|
121
|
+
blob: content2.toString("base64")
|
|
120
122
|
}
|
|
121
123
|
],
|
|
122
124
|
_meta: {
|
|
123
125
|
isBinary: true,
|
|
124
126
|
size: stat.size,
|
|
125
|
-
originalMimeType:
|
|
127
|
+
originalMimeType: mimeType,
|
|
128
|
+
originalName: import_path.default.basename(canonicalPath)
|
|
126
129
|
}
|
|
127
130
|
};
|
|
128
131
|
}
|
|
@@ -135,7 +138,7 @@ class FileSystemResourceHandler {
|
|
|
135
138
|
text: content
|
|
136
139
|
}
|
|
137
140
|
],
|
|
138
|
-
_meta: { size: stat.size }
|
|
141
|
+
_meta: { size: stat.size, originalName: import_path.default.basename(canonicalPath) }
|
|
139
142
|
};
|
|
140
143
|
} catch (error) {
|
|
141
144
|
throw import_errors.ResourceError.readFailed(uri, error);
|
|
@@ -160,14 +163,24 @@ class FileSystemResourceHandler {
|
|
|
160
163
|
".ico",
|
|
161
164
|
".tiff",
|
|
162
165
|
".webp",
|
|
166
|
+
".svg",
|
|
167
|
+
".avif",
|
|
163
168
|
".mp3",
|
|
169
|
+
".wav",
|
|
170
|
+
".ogg",
|
|
171
|
+
".oga",
|
|
172
|
+
".m4a",
|
|
173
|
+
".aac",
|
|
174
|
+
".flac",
|
|
164
175
|
".mp4",
|
|
176
|
+
".m4v",
|
|
165
177
|
".avi",
|
|
166
178
|
".mov",
|
|
167
179
|
".wmv",
|
|
168
180
|
".flv",
|
|
169
181
|
".mkv",
|
|
170
182
|
".webm",
|
|
183
|
+
".ogv",
|
|
171
184
|
".pdf",
|
|
172
185
|
".zip",
|
|
173
186
|
".tar",
|
|
@@ -243,14 +256,17 @@ class FileSystemResourceHandler {
|
|
|
243
256
|
const stat = await import_fs.promises.stat(canonical);
|
|
244
257
|
if (stat.isFile()) {
|
|
245
258
|
if (!this.shouldIncludeFile(canonical, includeExtensions, includeHidden)) return;
|
|
246
|
-
const uri =
|
|
259
|
+
const uri = canonical.replace(/\\/g, "/");
|
|
247
260
|
this.resourcesCache.set(uri, {
|
|
248
261
|
uri,
|
|
249
262
|
name: this.generateCleanFileName(canonical),
|
|
250
263
|
description: "Filesystem resource",
|
|
251
264
|
source: "internal",
|
|
252
265
|
size: stat.size,
|
|
253
|
-
lastModified: stat.mtime
|
|
266
|
+
lastModified: stat.mtime,
|
|
267
|
+
metadata: {
|
|
268
|
+
originalUri: canonical.replace(/\\/g, "/")
|
|
269
|
+
}
|
|
254
270
|
});
|
|
255
271
|
this.fileCount++;
|
|
256
272
|
return;
|
|
@@ -375,6 +391,7 @@ class FileSystemResourceHandler {
|
|
|
375
391
|
".tsx": "text/typescript",
|
|
376
392
|
".vue": "text/x-vue",
|
|
377
393
|
".json": "application/json",
|
|
394
|
+
".jsonc": "application/json",
|
|
378
395
|
".xml": "text/xml",
|
|
379
396
|
".yaml": "text/yaml",
|
|
380
397
|
".yml": "text/yaml",
|
|
@@ -382,6 +399,8 @@ class FileSystemResourceHandler {
|
|
|
382
399
|
".ini": "text/plain",
|
|
383
400
|
".cfg": "text/plain",
|
|
384
401
|
".conf": "text/plain",
|
|
402
|
+
".csv": "text/csv",
|
|
403
|
+
".log": "text/plain",
|
|
385
404
|
".py": "text/x-python",
|
|
386
405
|
".rb": "text/x-ruby",
|
|
387
406
|
".php": "text/x-php",
|
|
@@ -401,7 +420,34 @@ class FileSystemResourceHandler {
|
|
|
401
420
|
".sql": "text/x-sql",
|
|
402
421
|
".rst": "text/x-rst",
|
|
403
422
|
".tex": "text/x-tex",
|
|
404
|
-
".dockerfile": "text/x-dockerfile"
|
|
423
|
+
".dockerfile": "text/x-dockerfile",
|
|
424
|
+
".pdf": "application/pdf",
|
|
425
|
+
".jpg": "image/jpeg",
|
|
426
|
+
".jpeg": "image/jpeg",
|
|
427
|
+
".png": "image/png",
|
|
428
|
+
".gif": "image/gif",
|
|
429
|
+
".bmp": "image/bmp",
|
|
430
|
+
".ico": "image/x-icon",
|
|
431
|
+
".tif": "image/tiff",
|
|
432
|
+
".tiff": "image/tiff",
|
|
433
|
+
".webp": "image/webp",
|
|
434
|
+
".svg": "image/svg+xml",
|
|
435
|
+
".avif": "image/avif",
|
|
436
|
+
".mp3": "audio/mpeg",
|
|
437
|
+
".wav": "audio/wav",
|
|
438
|
+
".ogg": "audio/ogg",
|
|
439
|
+
".oga": "audio/ogg",
|
|
440
|
+
".m4a": "audio/mp4",
|
|
441
|
+
".aac": "audio/aac",
|
|
442
|
+
".flac": "audio/flac",
|
|
443
|
+
".weba": "audio/webm",
|
|
444
|
+
".mp4": "video/mp4",
|
|
445
|
+
".m4v": "video/mp4",
|
|
446
|
+
".webm": "video/webm",
|
|
447
|
+
".mov": "video/quicktime",
|
|
448
|
+
".avi": "video/x-msvideo",
|
|
449
|
+
".mkv": "video/x-matroska",
|
|
450
|
+
".ogv": "video/ogg"
|
|
405
451
|
};
|
|
406
452
|
return mimeTypes[ext] || "text/plain";
|
|
407
453
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-handler.d.ts","sourceRoot":"","sources":["../../../src/resources/handlers/filesystem-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEpF,qBAAa,yBAA0B,YAAW,uBAAuB;IACrE,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,MAAM,CAAS;gBAGnB,MAAM,EAAE,iCAAiC,EACzC,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM;IAO5B,OAAO,IAAI,MAAM;IAIX,UAAU,CAAC,SAAS,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB9D,aAAa,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIlD,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI/B,OAAO,CAAC,aAAa;IAWrB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAexB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem-handler.d.ts","sourceRoot":"","sources":["../../../src/resources/handlers/filesystem-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD,O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