@tokenite/shared 1.0.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.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/catalog/agent-runtime.d.ts +3 -0
- package/dist/catalog/agent-runtime.js +3 -0
- package/dist/catalog/bindings/anthropic.d.ts +2 -0
- package/dist/catalog/bindings/anthropic.js +11 -0
- package/dist/catalog/bindings/bedrock.d.ts +2 -0
- package/dist/catalog/bindings/bedrock.js +10 -0
- package/dist/catalog/bindings/google.d.ts +2 -0
- package/dist/catalog/bindings/google.js +12 -0
- package/dist/catalog/bindings/grok.d.ts +2 -0
- package/dist/catalog/bindings/grok.js +14 -0
- package/dist/catalog/bindings/index.d.ts +18 -0
- package/dist/catalog/bindings/index.js +36 -0
- package/dist/catalog/bindings/openai.d.ts +2 -0
- package/dist/catalog/bindings/openai.js +14 -0
- package/dist/catalog/bindings/types.d.ts +15 -0
- package/dist/catalog/bindings/types.js +11 -0
- package/dist/catalog/capabilities.d.ts +12 -0
- package/dist/catalog/capabilities.js +9 -0
- package/dist/catalog/flavors/anthropic.d.ts +3 -0
- package/dist/catalog/flavors/anthropic.js +26 -0
- package/dist/catalog/flavors/gemini.d.ts +3 -0
- package/dist/catalog/flavors/gemini.js +16 -0
- package/dist/catalog/flavors/index.d.ts +10 -0
- package/dist/catalog/flavors/index.js +10 -0
- package/dist/catalog/flavors/openai.d.ts +3 -0
- package/dist/catalog/flavors/openai.js +20 -0
- package/dist/catalog/flavors/types.d.ts +22 -0
- package/dist/catalog/flavors/types.js +2 -0
- package/dist/catalog/helpers.d.ts +5 -0
- package/dist/catalog/helpers.js +5 -0
- package/dist/catalog/index.d.ts +9 -0
- package/dist/catalog/index.js +8 -0
- package/dist/catalog/models/anthropic.d.ts +7 -0
- package/dist/catalog/models/anthropic.js +10 -0
- package/dist/catalog/models/google.d.ts +8 -0
- package/dist/catalog/models/google.js +11 -0
- package/dist/catalog/models/grok.d.ts +10 -0
- package/dist/catalog/models/grok.js +13 -0
- package/dist/catalog/models/index.d.ts +20 -0
- package/dist/catalog/models/index.js +19 -0
- package/dist/catalog/models/openai.d.ts +12 -0
- package/dist/catalog/models/openai.js +15 -0
- package/dist/catalog/models/types.d.ts +17 -0
- package/dist/catalog/models/types.js +45 -0
- package/dist/catalog/providers/anthropic.d.ts +2 -0
- package/dist/catalog/providers/anthropic.js +13 -0
- package/dist/catalog/providers/bedrock.d.ts +2 -0
- package/dist/catalog/providers/bedrock.js +20 -0
- package/dist/catalog/providers/google.d.ts +2 -0
- package/dist/catalog/providers/google.js +12 -0
- package/dist/catalog/providers/grok.d.ts +2 -0
- package/dist/catalog/providers/grok.js +12 -0
- package/dist/catalog/providers/index.d.ts +17 -0
- package/dist/catalog/providers/index.js +28 -0
- package/dist/catalog/providers/openai.d.ts +2 -0
- package/dist/catalog/providers/openai.js +12 -0
- package/dist/catalog/providers/types.d.ts +32 -0
- package/dist/catalog/providers/types.js +2 -0
- package/dist/catalog/tiers.d.ts +12 -0
- package/dist/catalog/tiers.js +9 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +11 -0
- package/dist/constants.d.ts +31 -0
- package/dist/constants.js +11 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/parse.d.ts +2 -0
- package/dist/parse.js +12 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +3 -0
- package/dist/result.d.ts +18 -0
- package/dist/result.js +9 -0
- package/dist/schemas/access-token.d.ts +32 -0
- package/dist/schemas/access-token.js +20 -0
- package/dist/schemas/account-invitation.d.ts +39 -0
- package/dist/schemas/account-invitation.js +20 -0
- package/dist/schemas/account-member.d.ts +19 -0
- package/dist/schemas/account-member.js +15 -0
- package/dist/schemas/account.d.ts +45 -0
- package/dist/schemas/account.js +25 -0
- package/dist/schemas/api-key.d.ts +44 -0
- package/dist/schemas/api-key.js +17 -0
- package/dist/schemas/app.d.ts +185 -0
- package/dist/schemas/app.js +41 -0
- package/dist/schemas/budget.d.ts +10 -0
- package/dist/schemas/budget.js +9 -0
- package/dist/schemas/cli-login.d.ts +42 -0
- package/dist/schemas/cli-login.js +25 -0
- package/dist/schemas/discovery.d.ts +7 -0
- package/dist/schemas/discovery.js +6 -0
- package/dist/schemas/error-codes.d.ts +154 -0
- package/dist/schemas/error-codes.js +62 -0
- package/dist/schemas/error.d.ts +20 -0
- package/dist/schemas/error.js +12 -0
- package/dist/schemas/provider.d.ts +11 -0
- package/dist/schemas/provider.js +4 -0
- package/dist/schemas/proxy-response.d.ts +49 -0
- package/dist/schemas/proxy-response.js +15 -0
- package/dist/schemas/sponsored-api-key.d.ts +65 -0
- package/dist/schemas/sponsored-api-key.js +30 -0
- package/dist/schemas/usage.d.ts +25 -0
- package/dist/schemas/usage.js +19 -0
- package/dist/schemas/user.d.ts +20 -0
- package/dist/schemas/user.js +13 -0
- package/package.json +60 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const apiKeySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
userId: z.ZodString;
|
|
5
|
+
provider: z.ZodEnum<{
|
|
6
|
+
anthropic: "anthropic";
|
|
7
|
+
openai: "openai";
|
|
8
|
+
bedrock: "bedrock";
|
|
9
|
+
google: "google";
|
|
10
|
+
grok: "grok";
|
|
11
|
+
}>;
|
|
12
|
+
encryptedKey: z.ZodString;
|
|
13
|
+
keyHint: z.ZodString;
|
|
14
|
+
isActive: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
createdAt: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type ApiKey = z.infer<typeof apiKeySchema>;
|
|
18
|
+
export declare const addApiKeyRequest: z.ZodObject<{
|
|
19
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
anthropic: "anthropic";
|
|
21
|
+
openai: "openai";
|
|
22
|
+
bedrock: "bedrock";
|
|
23
|
+
google: "google";
|
|
24
|
+
grok: "grok";
|
|
25
|
+
}>>;
|
|
26
|
+
apiKey: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type AddApiKeyRequest = z.infer<typeof addApiKeyRequest>;
|
|
29
|
+
export declare const apiKeyResponse: z.ZodObject<{
|
|
30
|
+
provider: z.ZodEnum<{
|
|
31
|
+
anthropic: "anthropic";
|
|
32
|
+
openai: "openai";
|
|
33
|
+
bedrock: "bedrock";
|
|
34
|
+
google: "google";
|
|
35
|
+
grok: "grok";
|
|
36
|
+
}>;
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
createdAt: z.ZodString;
|
|
39
|
+
userId: z.ZodString;
|
|
40
|
+
keyHint: z.ZodString;
|
|
41
|
+
isActive: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type ApiKeyResponse = z.infer<typeof apiKeyResponse>;
|
|
44
|
+
//# sourceMappingURL=api-key.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { providerSchema } from './provider.js';
|
|
3
|
+
export const apiKeySchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
userId: z.string().uuid(),
|
|
6
|
+
provider: providerSchema,
|
|
7
|
+
encryptedKey: z.string(),
|
|
8
|
+
keyHint: z.string().max(8),
|
|
9
|
+
isActive: z.boolean().default(true),
|
|
10
|
+
createdAt: z.string().datetime(),
|
|
11
|
+
});
|
|
12
|
+
export const addApiKeyRequest = z.object({
|
|
13
|
+
provider: providerSchema.optional(),
|
|
14
|
+
apiKey: z.string().min(1),
|
|
15
|
+
});
|
|
16
|
+
export const apiKeyResponse = apiKeySchema.omit({ encryptedKey: true });
|
|
17
|
+
//# sourceMappingURL=api-key.js.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const modelStrategySchema: z.ZodEnum<{
|
|
3
|
+
any: "any";
|
|
4
|
+
tier: "tier";
|
|
5
|
+
models: "models";
|
|
6
|
+
}>;
|
|
7
|
+
export type ModelStrategy = z.infer<typeof modelStrategySchema>;
|
|
8
|
+
export declare const tierSchema: z.ZodEnum<{
|
|
9
|
+
cheap: "cheap";
|
|
10
|
+
fast: "fast";
|
|
11
|
+
smart: "smart";
|
|
12
|
+
reasoning: "reasoning";
|
|
13
|
+
}>;
|
|
14
|
+
export type RequiredTier = z.infer<typeof tierSchema>;
|
|
15
|
+
export declare const appSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
builderId: z.ZodString;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
callbackUrl: z.ZodString;
|
|
20
|
+
requiredProviders: z.ZodArray<z.ZodEnum<{
|
|
21
|
+
anthropic: "anthropic";
|
|
22
|
+
openai: "openai";
|
|
23
|
+
bedrock: "bedrock";
|
|
24
|
+
google: "google";
|
|
25
|
+
grok: "grok";
|
|
26
|
+
}>>;
|
|
27
|
+
preferredProviders: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
28
|
+
anthropic: "anthropic";
|
|
29
|
+
openai: "openai";
|
|
30
|
+
bedrock: "bedrock";
|
|
31
|
+
google: "google";
|
|
32
|
+
grok: "grok";
|
|
33
|
+
}>>>;
|
|
34
|
+
allowSubstitution: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
+
allowedModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
modelStrategy: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
any: "any";
|
|
38
|
+
tier: "tier";
|
|
39
|
+
models: "models";
|
|
40
|
+
}>>;
|
|
41
|
+
requiredTier: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
cheap: "cheap";
|
|
43
|
+
fast: "fast";
|
|
44
|
+
smart: "smart";
|
|
45
|
+
reasoning: "reasoning";
|
|
46
|
+
}>>;
|
|
47
|
+
allowsManagedAgents: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
websiteUrl: z.ZodOptional<z.ZodString>;
|
|
49
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
|
+
iconUrl: z.ZodOptional<z.ZodString>;
|
|
51
|
+
appSecret: z.ZodString;
|
|
52
|
+
createdAt: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type App = z.infer<typeof appSchema>;
|
|
55
|
+
export declare const createAppRequestBase: z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
callbackUrl: z.ZodString;
|
|
58
|
+
requiredProviders: z.ZodArray<z.ZodEnum<{
|
|
59
|
+
anthropic: "anthropic";
|
|
60
|
+
openai: "openai";
|
|
61
|
+
bedrock: "bedrock";
|
|
62
|
+
google: "google";
|
|
63
|
+
grok: "grok";
|
|
64
|
+
}>>;
|
|
65
|
+
preferredProviders: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
66
|
+
anthropic: "anthropic";
|
|
67
|
+
openai: "openai";
|
|
68
|
+
bedrock: "bedrock";
|
|
69
|
+
google: "google";
|
|
70
|
+
grok: "grok";
|
|
71
|
+
}>>>;
|
|
72
|
+
allowSubstitution: z.ZodDefault<z.ZodBoolean>;
|
|
73
|
+
allowedModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
modelStrategy: z.ZodDefault<z.ZodEnum<{
|
|
75
|
+
any: "any";
|
|
76
|
+
tier: "tier";
|
|
77
|
+
models: "models";
|
|
78
|
+
}>>;
|
|
79
|
+
requiredTier: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
cheap: "cheap";
|
|
81
|
+
fast: "fast";
|
|
82
|
+
smart: "smart";
|
|
83
|
+
reasoning: "reasoning";
|
|
84
|
+
}>>;
|
|
85
|
+
allowsManagedAgents: z.ZodDefault<z.ZodBoolean>;
|
|
86
|
+
websiteUrl: z.ZodOptional<z.ZodString>;
|
|
87
|
+
description: z.ZodOptional<z.ZodString>;
|
|
88
|
+
iconUrl: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const createAppRequest: z.ZodType<{
|
|
91
|
+
name: string;
|
|
92
|
+
callbackUrl: string;
|
|
93
|
+
requiredProviders: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[];
|
|
94
|
+
preferredProviders: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[];
|
|
95
|
+
allowSubstitution: boolean;
|
|
96
|
+
modelStrategy: "any" | "tier" | "models";
|
|
97
|
+
allowsManagedAgents: boolean;
|
|
98
|
+
allowedModels?: string[] | undefined;
|
|
99
|
+
requiredTier?: "cheap" | "fast" | "smart" | "reasoning" | undefined;
|
|
100
|
+
websiteUrl?: string | undefined;
|
|
101
|
+
description?: string | undefined;
|
|
102
|
+
iconUrl?: string | undefined;
|
|
103
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
104
|
+
name: string;
|
|
105
|
+
callbackUrl: string;
|
|
106
|
+
requiredProviders: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[];
|
|
107
|
+
preferredProviders: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[];
|
|
108
|
+
allowSubstitution: boolean;
|
|
109
|
+
modelStrategy: "any" | "tier" | "models";
|
|
110
|
+
allowsManagedAgents: boolean;
|
|
111
|
+
allowedModels?: string[] | undefined;
|
|
112
|
+
requiredTier?: "cheap" | "fast" | "smart" | "reasoning" | undefined;
|
|
113
|
+
websiteUrl?: string | undefined;
|
|
114
|
+
description?: string | undefined;
|
|
115
|
+
iconUrl?: string | undefined;
|
|
116
|
+
}, unknown>>;
|
|
117
|
+
export type CreateAppRequest = z.infer<typeof createAppRequest>;
|
|
118
|
+
export declare const updateAppRequest: z.ZodType<{
|
|
119
|
+
name?: string | undefined;
|
|
120
|
+
callbackUrl?: string | undefined;
|
|
121
|
+
requiredProviders?: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[] | undefined;
|
|
122
|
+
preferredProviders?: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[] | undefined;
|
|
123
|
+
allowSubstitution?: boolean | undefined;
|
|
124
|
+
allowedModels?: string[] | undefined;
|
|
125
|
+
modelStrategy?: "any" | "tier" | "models" | undefined;
|
|
126
|
+
requiredTier?: "cheap" | "fast" | "smart" | "reasoning" | undefined;
|
|
127
|
+
allowsManagedAgents?: boolean | undefined;
|
|
128
|
+
websiteUrl?: string | undefined;
|
|
129
|
+
description?: string | undefined;
|
|
130
|
+
iconUrl?: string | undefined;
|
|
131
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
132
|
+
name?: string | undefined;
|
|
133
|
+
callbackUrl?: string | undefined;
|
|
134
|
+
requiredProviders?: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[] | undefined;
|
|
135
|
+
preferredProviders?: ("anthropic" | "openai" | "bedrock" | "google" | "grok")[] | undefined;
|
|
136
|
+
allowSubstitution?: boolean | undefined;
|
|
137
|
+
allowedModels?: string[] | undefined;
|
|
138
|
+
modelStrategy?: "any" | "tier" | "models" | undefined;
|
|
139
|
+
requiredTier?: "cheap" | "fast" | "smart" | "reasoning" | undefined;
|
|
140
|
+
allowsManagedAgents?: boolean | undefined;
|
|
141
|
+
websiteUrl?: string | undefined;
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
iconUrl?: string | undefined;
|
|
144
|
+
}, unknown>>;
|
|
145
|
+
export type UpdateAppRequest = z.infer<typeof updateAppRequest>;
|
|
146
|
+
export declare const appResponse: z.ZodObject<{
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
createdAt: z.ZodString;
|
|
150
|
+
builderId: z.ZodString;
|
|
151
|
+
callbackUrl: z.ZodString;
|
|
152
|
+
requiredProviders: z.ZodArray<z.ZodEnum<{
|
|
153
|
+
anthropic: "anthropic";
|
|
154
|
+
openai: "openai";
|
|
155
|
+
bedrock: "bedrock";
|
|
156
|
+
google: "google";
|
|
157
|
+
grok: "grok";
|
|
158
|
+
}>>;
|
|
159
|
+
preferredProviders: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
160
|
+
anthropic: "anthropic";
|
|
161
|
+
openai: "openai";
|
|
162
|
+
bedrock: "bedrock";
|
|
163
|
+
google: "google";
|
|
164
|
+
grok: "grok";
|
|
165
|
+
}>>>;
|
|
166
|
+
allowSubstitution: z.ZodDefault<z.ZodBoolean>;
|
|
167
|
+
allowedModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
modelStrategy: z.ZodDefault<z.ZodEnum<{
|
|
169
|
+
any: "any";
|
|
170
|
+
tier: "tier";
|
|
171
|
+
models: "models";
|
|
172
|
+
}>>;
|
|
173
|
+
requiredTier: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
cheap: "cheap";
|
|
175
|
+
fast: "fast";
|
|
176
|
+
smart: "smart";
|
|
177
|
+
reasoning: "reasoning";
|
|
178
|
+
}>>;
|
|
179
|
+
allowsManagedAgents: z.ZodDefault<z.ZodBoolean>;
|
|
180
|
+
websiteUrl: z.ZodOptional<z.ZodString>;
|
|
181
|
+
description: z.ZodOptional<z.ZodString>;
|
|
182
|
+
iconUrl: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
export type AppResponse = z.infer<typeof appResponse>;
|
|
185
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { providerSchema } from './provider.js';
|
|
3
|
+
export const modelStrategySchema = z.enum(['any', 'tier', 'models']);
|
|
4
|
+
export const tierSchema = z.enum(['cheap', 'fast', 'smart', 'reasoning']);
|
|
5
|
+
export const appSchema = z.object({
|
|
6
|
+
id: z.string().uuid(),
|
|
7
|
+
builderId: z.string().uuid(),
|
|
8
|
+
name: z.string().min(1).max(100),
|
|
9
|
+
callbackUrl: z.string().url(),
|
|
10
|
+
requiredProviders: z.array(providerSchema),
|
|
11
|
+
preferredProviders: z.array(providerSchema).default([]),
|
|
12
|
+
allowSubstitution: z.boolean().default(false),
|
|
13
|
+
allowedModels: z.array(z.string()).optional(),
|
|
14
|
+
modelStrategy: modelStrategySchema.default('any'),
|
|
15
|
+
requiredTier: tierSchema.optional(),
|
|
16
|
+
allowsManagedAgents: z.boolean().default(false),
|
|
17
|
+
websiteUrl: z.string().url().optional(),
|
|
18
|
+
description: z.string().max(500).optional(),
|
|
19
|
+
iconUrl: z.string().url().optional(),
|
|
20
|
+
appSecret: z.string(),
|
|
21
|
+
createdAt: z.string().datetime(),
|
|
22
|
+
});
|
|
23
|
+
export const createAppRequestBase = z.object({
|
|
24
|
+
name: z.string().min(1).max(100),
|
|
25
|
+
callbackUrl: z.string().url(),
|
|
26
|
+
requiredProviders: z.array(providerSchema).min(1),
|
|
27
|
+
preferredProviders: z.array(providerSchema).default([]),
|
|
28
|
+
allowSubstitution: z.boolean().default(false),
|
|
29
|
+
allowedModels: z.array(z.string()).optional(),
|
|
30
|
+
modelStrategy: modelStrategySchema.default('any'),
|
|
31
|
+
requiredTier: tierSchema.optional(),
|
|
32
|
+
allowsManagedAgents: z.boolean().default(false),
|
|
33
|
+
websiteUrl: z.string().url().optional(),
|
|
34
|
+
description: z.string().max(500).optional(),
|
|
35
|
+
iconUrl: z.string().url().optional(),
|
|
36
|
+
});
|
|
37
|
+
const refineStrategy = (s) => s.refine((v) => v.modelStrategy !== 'tier' || !!v.requiredTier, { message: "modelStrategy='tier' requires requiredTier", path: ['requiredTier'] }).refine((v) => v.modelStrategy !== 'models' || (v.allowedModels?.length ?? 0) > 0, { message: "modelStrategy='models' requires non-empty allowedModels", path: ['allowedModels'] });
|
|
38
|
+
export const createAppRequest = refineStrategy(createAppRequestBase);
|
|
39
|
+
export const updateAppRequest = refineStrategy(createAppRequestBase.partial());
|
|
40
|
+
export const appResponse = appSchema.omit({ appSecret: true });
|
|
41
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const budgetSchema: z.ZodObject<{
|
|
3
|
+
limit: z.ZodNumber;
|
|
4
|
+
spent: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type Budget = z.infer<typeof budgetSchema>;
|
|
7
|
+
export declare const DEBT_TOLERANCE_USD = 0.01;
|
|
8
|
+
export declare const isBudgetAvailable: (budget: Budget) => boolean;
|
|
9
|
+
export declare const remainingBudget: (budget: Budget) => number;
|
|
10
|
+
//# sourceMappingURL=budget.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const budgetSchema = z.object({
|
|
3
|
+
limit: z.number().positive(),
|
|
4
|
+
spent: z.number().default(0),
|
|
5
|
+
});
|
|
6
|
+
export const DEBT_TOLERANCE_USD = 0.01;
|
|
7
|
+
export const isBudgetAvailable = (budget) => budget.spent < budget.limit + DEBT_TOLERANCE_USD;
|
|
8
|
+
export const remainingBudget = (budget) => Math.max(0, budget.limit - budget.spent);
|
|
9
|
+
//# sourceMappingURL=budget.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CliLoopbackHost: {
|
|
3
|
+
readonly V4: "127.0.0.1";
|
|
4
|
+
readonly V6: "[::1]";
|
|
5
|
+
readonly Localhost: "localhost";
|
|
6
|
+
};
|
|
7
|
+
export type CliLoopbackHost = typeof CliLoopbackHost[keyof typeof CliLoopbackHost];
|
|
8
|
+
export declare const cliLoginParamsSchema: z.ZodObject<{
|
|
9
|
+
port: z.ZodCoercedNumber<unknown>;
|
|
10
|
+
state: z.ZodString;
|
|
11
|
+
host: z.ZodEnum<{
|
|
12
|
+
"127.0.0.1": "127.0.0.1";
|
|
13
|
+
"[::1]": "[::1]";
|
|
14
|
+
localhost: "localhost";
|
|
15
|
+
}>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type CliLoginParams = z.infer<typeof cliLoginParamsSchema>;
|
|
18
|
+
export declare const cliLoginMintRequestSchema: z.ZodObject<{
|
|
19
|
+
port: z.ZodCoercedNumber<unknown>;
|
|
20
|
+
state: z.ZodString;
|
|
21
|
+
host: z.ZodEnum<{
|
|
22
|
+
"127.0.0.1": "127.0.0.1";
|
|
23
|
+
"[::1]": "[::1]";
|
|
24
|
+
localhost: "localhost";
|
|
25
|
+
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type CliLoginMintRequest = z.infer<typeof cliLoginMintRequestSchema>;
|
|
28
|
+
export declare const cliLoginMintResponseSchema: z.ZodObject<{
|
|
29
|
+
redirect_to: z.ZodString;
|
|
30
|
+
code: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type CliLoginMintResponse = z.infer<typeof cliLoginMintResponseSchema>;
|
|
33
|
+
export declare const cliLoginExchangeRequestSchema: z.ZodObject<{
|
|
34
|
+
code: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type CliLoginExchangeRequest = z.infer<typeof cliLoginExchangeRequestSchema>;
|
|
37
|
+
export declare const cliLoginExchangeResponseSchema: z.ZodObject<{
|
|
38
|
+
token: z.ZodString;
|
|
39
|
+
email: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type CliLoginExchangeResponse = z.infer<typeof cliLoginExchangeResponseSchema>;
|
|
42
|
+
//# sourceMappingURL=cli-login.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CliLoopbackHost = {
|
|
3
|
+
V4: '127.0.0.1',
|
|
4
|
+
V6: '[::1]',
|
|
5
|
+
Localhost: 'localhost',
|
|
6
|
+
};
|
|
7
|
+
const cliLoopbackHostSchema = z.enum([CliLoopbackHost.V4, CliLoopbackHost.V6, CliLoopbackHost.Localhost]);
|
|
8
|
+
export const cliLoginParamsSchema = z.object({
|
|
9
|
+
port: z.coerce.number().int().min(1).max(65535),
|
|
10
|
+
state: z.string().min(8).max(128),
|
|
11
|
+
host: cliLoopbackHostSchema,
|
|
12
|
+
});
|
|
13
|
+
export const cliLoginMintRequestSchema = cliLoginParamsSchema;
|
|
14
|
+
export const cliLoginMintResponseSchema = z.object({
|
|
15
|
+
redirect_to: z.string().url(),
|
|
16
|
+
code: z.string(),
|
|
17
|
+
});
|
|
18
|
+
export const cliLoginExchangeRequestSchema = z.object({
|
|
19
|
+
code: z.string().min(1),
|
|
20
|
+
});
|
|
21
|
+
export const cliLoginExchangeResponseSchema = z.object({
|
|
22
|
+
token: z.string(),
|
|
23
|
+
email: z.string().email(),
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=cli-login.js.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export declare const proxyErrorCodes: {
|
|
2
|
+
readonly TOKEN_INVALID: {
|
|
3
|
+
readonly code: "TOKEN_INVALID";
|
|
4
|
+
readonly status: 401;
|
|
5
|
+
readonly message: "Invalid access token";
|
|
6
|
+
};
|
|
7
|
+
readonly TOKEN_REVOKED: {
|
|
8
|
+
readonly code: "TOKEN_REVOKED";
|
|
9
|
+
readonly status: 401;
|
|
10
|
+
readonly message: "Access token has been revoked";
|
|
11
|
+
};
|
|
12
|
+
readonly TOKEN_SUSPENDED: {
|
|
13
|
+
readonly code: "TOKEN_SUSPENDED";
|
|
14
|
+
readonly status: 403;
|
|
15
|
+
readonly message: "Access has been suspended by the user";
|
|
16
|
+
};
|
|
17
|
+
readonly TOKEN_EXPIRED: {
|
|
18
|
+
readonly code: "TOKEN_EXPIRED";
|
|
19
|
+
readonly status: 401;
|
|
20
|
+
readonly message: "Access token has expired";
|
|
21
|
+
};
|
|
22
|
+
readonly BUDGET_EXCEEDED: {
|
|
23
|
+
readonly code: "BUDGET_EXCEEDED";
|
|
24
|
+
readonly status: 402;
|
|
25
|
+
readonly message: "Budget limit exceeded";
|
|
26
|
+
};
|
|
27
|
+
readonly POOL_EXHAUSTED: {
|
|
28
|
+
readonly code: "POOL_EXHAUSTED";
|
|
29
|
+
readonly status: 402;
|
|
30
|
+
readonly message: "Account pool budget exhausted";
|
|
31
|
+
};
|
|
32
|
+
readonly PROVIDER_KEY_MISSING: {
|
|
33
|
+
readonly code: "PROVIDER_KEY_MISSING";
|
|
34
|
+
readonly status: 402;
|
|
35
|
+
readonly message: "No API key or credits available for required provider";
|
|
36
|
+
};
|
|
37
|
+
readonly CREDITS_DEPLETED: {
|
|
38
|
+
readonly code: "CREDITS_DEPLETED";
|
|
39
|
+
readonly status: 402;
|
|
40
|
+
readonly message: "Insufficient credits";
|
|
41
|
+
};
|
|
42
|
+
readonly APP_NOT_FOUND: {
|
|
43
|
+
readonly code: "APP_NOT_FOUND";
|
|
44
|
+
readonly status: 404;
|
|
45
|
+
readonly message: "Application not found";
|
|
46
|
+
};
|
|
47
|
+
readonly MODEL_NOT_ALLOWED: {
|
|
48
|
+
readonly code: "MODEL_NOT_ALLOWED";
|
|
49
|
+
readonly status: 403;
|
|
50
|
+
readonly message: "Model not in allowed models list";
|
|
51
|
+
};
|
|
52
|
+
readonly AGENT_SCOPE_MISSING: {
|
|
53
|
+
readonly code: "AGENT_SCOPE_MISSING";
|
|
54
|
+
readonly status: 403;
|
|
55
|
+
readonly message: "App does not have the managed-agents scope";
|
|
56
|
+
};
|
|
57
|
+
readonly SPONSORED_POOL_EXHAUSTED: {
|
|
58
|
+
readonly code: "SPONSORED_POOL_EXHAUSTED";
|
|
59
|
+
readonly status: 402;
|
|
60
|
+
readonly message: "Sponsored credits pool is exhausted";
|
|
61
|
+
};
|
|
62
|
+
readonly SPONSORED_KEY_UNAVAILABLE: {
|
|
63
|
+
readonly code: "SPONSORED_KEY_UNAVAILABLE";
|
|
64
|
+
readonly status: 402;
|
|
65
|
+
readonly message: "Sponsored key is no longer active";
|
|
66
|
+
};
|
|
67
|
+
readonly SPONSORED_PROVIDER_MISMATCH: {
|
|
68
|
+
readonly code: "SPONSORED_PROVIDER_MISMATCH";
|
|
69
|
+
readonly status: 402;
|
|
70
|
+
readonly message: "Sponsored key does not cover requested provider";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const providerErrorCodes: {
|
|
74
|
+
readonly RATE_LIMITED: {
|
|
75
|
+
readonly code: "RATE_LIMITED";
|
|
76
|
+
readonly status: 429;
|
|
77
|
+
readonly message: "Rate limited by the LLM provider";
|
|
78
|
+
};
|
|
79
|
+
readonly CONTEXT_LENGTH_EXCEEDED: {
|
|
80
|
+
readonly code: "CONTEXT_LENGTH_EXCEEDED";
|
|
81
|
+
readonly status: 400;
|
|
82
|
+
readonly message: "Request exceeds model context length";
|
|
83
|
+
};
|
|
84
|
+
readonly INVALID_REQUEST: {
|
|
85
|
+
readonly code: "INVALID_REQUEST";
|
|
86
|
+
readonly status: 400;
|
|
87
|
+
readonly message: "Invalid request rejected by the LLM provider";
|
|
88
|
+
};
|
|
89
|
+
readonly AUTHENTICATION_FAILED: {
|
|
90
|
+
readonly code: "AUTHENTICATION_FAILED";
|
|
91
|
+
readonly status: 401;
|
|
92
|
+
readonly message: "LLM provider rejected the API key";
|
|
93
|
+
};
|
|
94
|
+
readonly PROVIDER_OVERLOADED: {
|
|
95
|
+
readonly code: "PROVIDER_OVERLOADED";
|
|
96
|
+
readonly status: 503;
|
|
97
|
+
readonly message: "LLM provider is temporarily overloaded";
|
|
98
|
+
};
|
|
99
|
+
readonly CONTENT_FILTERED: {
|
|
100
|
+
readonly code: "CONTENT_FILTERED";
|
|
101
|
+
readonly status: 400;
|
|
102
|
+
readonly message: "Content blocked by the LLM provider safety filter";
|
|
103
|
+
};
|
|
104
|
+
readonly PROVIDER_TIMEOUT: {
|
|
105
|
+
readonly code: "PROVIDER_TIMEOUT";
|
|
106
|
+
readonly status: 504;
|
|
107
|
+
readonly message: "LLM provider did not respond";
|
|
108
|
+
};
|
|
109
|
+
readonly PROVIDER_ERROR: {
|
|
110
|
+
readonly code: "PROVIDER_ERROR";
|
|
111
|
+
readonly status: 502;
|
|
112
|
+
readonly message: "LLM provider returned an error";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export declare const apiErrorCodes: {
|
|
116
|
+
readonly VALIDATION: "VALIDATION";
|
|
117
|
+
readonly FORBIDDEN: "FORBIDDEN";
|
|
118
|
+
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
119
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
120
|
+
readonly INTERNAL: "INTERNAL";
|
|
121
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
122
|
+
readonly INSUFFICIENT_ROLE: "INSUFFICIENT_ROLE";
|
|
123
|
+
readonly EMAIL_TAKEN: "EMAIL_TAKEN";
|
|
124
|
+
readonly WRONG_EMAIL: "WRONG_EMAIL";
|
|
125
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
126
|
+
readonly INVALID_CLIENT: "INVALID_CLIENT";
|
|
127
|
+
readonly INVALID_CODE: "INVALID_CODE";
|
|
128
|
+
readonly INVALID_INVITATION: "INVALID_INVITATION";
|
|
129
|
+
readonly INVITATION_EXPIRED: "INVITATION_EXPIRED";
|
|
130
|
+
readonly INVITE_PENDING: "INVITE_PENDING";
|
|
131
|
+
readonly ALREADY_CLAIMED: "ALREADY_CLAIMED";
|
|
132
|
+
readonly ALREADY_MEMBER: "ALREADY_MEMBER";
|
|
133
|
+
readonly PAT_NOT_FOUND: "PAT_NOT_FOUND";
|
|
134
|
+
readonly UNKNOWN_PROVIDER: "UNKNOWN_PROVIDER";
|
|
135
|
+
readonly CANNOT_DELETE_PERSONAL: "CANNOT_DELETE_PERSONAL";
|
|
136
|
+
readonly CANNOT_INVITE_TO_PERSONAL: "CANNOT_INVITE_TO_PERSONAL";
|
|
137
|
+
readonly TEAM_CANNOT_BUILD: "TEAM_CANNOT_BUILD";
|
|
138
|
+
readonly CANNOT_REMOVE_SELF: "CANNOT_REMOVE_SELF";
|
|
139
|
+
readonly SOLE_OWNER: "SOLE_OWNER";
|
|
140
|
+
readonly NO_KEY: "NO_KEY";
|
|
141
|
+
readonly NOT_ACTIVE: "NOT_ACTIVE";
|
|
142
|
+
readonly SPONSORED_INELIGIBLE: "SPONSORED_INELIGIBLE";
|
|
143
|
+
readonly BUDGET_UPDATE_FAILED: "BUDGET_UPDATE_FAILED";
|
|
144
|
+
readonly SPONSORED_POOL_UPDATE_FAILED: "SPONSORED_POOL_UPDATE_FAILED";
|
|
145
|
+
readonly ENCRYPTION_FAILED: "ENCRYPTION_FAILED";
|
|
146
|
+
readonly DECRYPTION_FAILED: "DECRYPTION_FAILED";
|
|
147
|
+
readonly DB_INSERT_FAILED: "DB_INSERT_FAILED";
|
|
148
|
+
readonly FETCH_FAILED: "FETCH_FAILED";
|
|
149
|
+
};
|
|
150
|
+
export type ProxyErrorCode = keyof typeof proxyErrorCodes;
|
|
151
|
+
export type ProviderErrorCode = keyof typeof providerErrorCodes;
|
|
152
|
+
export type ApiErrorCode = keyof typeof apiErrorCodes;
|
|
153
|
+
export type ErrorCode = ProxyErrorCode | ProviderErrorCode | ApiErrorCode;
|
|
154
|
+
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const proxyErrorCodes = {
|
|
2
|
+
TOKEN_INVALID: { code: 'TOKEN_INVALID', status: 401, message: 'Invalid access token' },
|
|
3
|
+
TOKEN_REVOKED: { code: 'TOKEN_REVOKED', status: 401, message: 'Access token has been revoked' },
|
|
4
|
+
TOKEN_SUSPENDED: { code: 'TOKEN_SUSPENDED', status: 403, message: 'Access has been suspended by the user' },
|
|
5
|
+
TOKEN_EXPIRED: { code: 'TOKEN_EXPIRED', status: 401, message: 'Access token has expired' },
|
|
6
|
+
BUDGET_EXCEEDED: { code: 'BUDGET_EXCEEDED', status: 402, message: 'Budget limit exceeded' },
|
|
7
|
+
POOL_EXHAUSTED: { code: 'POOL_EXHAUSTED', status: 402, message: 'Account pool budget exhausted' },
|
|
8
|
+
PROVIDER_KEY_MISSING: { code: 'PROVIDER_KEY_MISSING', status: 402, message: 'No API key or credits available for required provider' },
|
|
9
|
+
CREDITS_DEPLETED: { code: 'CREDITS_DEPLETED', status: 402, message: 'Insufficient credits' },
|
|
10
|
+
APP_NOT_FOUND: { code: 'APP_NOT_FOUND', status: 404, message: 'Application not found' },
|
|
11
|
+
MODEL_NOT_ALLOWED: { code: 'MODEL_NOT_ALLOWED', status: 403, message: 'Model not in allowed models list' },
|
|
12
|
+
AGENT_SCOPE_MISSING: { code: 'AGENT_SCOPE_MISSING', status: 403, message: 'App does not have the managed-agents scope' },
|
|
13
|
+
SPONSORED_POOL_EXHAUSTED: { code: 'SPONSORED_POOL_EXHAUSTED', status: 402, message: 'Sponsored credits pool is exhausted' },
|
|
14
|
+
SPONSORED_KEY_UNAVAILABLE: { code: 'SPONSORED_KEY_UNAVAILABLE', status: 402, message: 'Sponsored key is no longer active' },
|
|
15
|
+
SPONSORED_PROVIDER_MISMATCH: { code: 'SPONSORED_PROVIDER_MISMATCH', status: 402, message: 'Sponsored key does not cover requested provider' },
|
|
16
|
+
};
|
|
17
|
+
export const providerErrorCodes = {
|
|
18
|
+
RATE_LIMITED: { code: 'RATE_LIMITED', status: 429, message: 'Rate limited by the LLM provider' },
|
|
19
|
+
CONTEXT_LENGTH_EXCEEDED: { code: 'CONTEXT_LENGTH_EXCEEDED', status: 400, message: 'Request exceeds model context length' },
|
|
20
|
+
INVALID_REQUEST: { code: 'INVALID_REQUEST', status: 400, message: 'Invalid request rejected by the LLM provider' },
|
|
21
|
+
AUTHENTICATION_FAILED: { code: 'AUTHENTICATION_FAILED', status: 401, message: 'LLM provider rejected the API key' },
|
|
22
|
+
PROVIDER_OVERLOADED: { code: 'PROVIDER_OVERLOADED', status: 503, message: 'LLM provider is temporarily overloaded' },
|
|
23
|
+
CONTENT_FILTERED: { code: 'CONTENT_FILTERED', status: 400, message: 'Content blocked by the LLM provider safety filter' },
|
|
24
|
+
PROVIDER_TIMEOUT: { code: 'PROVIDER_TIMEOUT', status: 504, message: 'LLM provider did not respond' },
|
|
25
|
+
PROVIDER_ERROR: { code: 'PROVIDER_ERROR', status: 502, message: 'LLM provider returned an error' },
|
|
26
|
+
};
|
|
27
|
+
export const apiErrorCodes = {
|
|
28
|
+
VALIDATION: 'VALIDATION',
|
|
29
|
+
FORBIDDEN: 'FORBIDDEN',
|
|
30
|
+
UNAUTHORIZED: 'UNAUTHORIZED',
|
|
31
|
+
NOT_FOUND: 'NOT_FOUND',
|
|
32
|
+
INTERNAL: 'INTERNAL',
|
|
33
|
+
UNKNOWN: 'UNKNOWN',
|
|
34
|
+
INSUFFICIENT_ROLE: 'INSUFFICIENT_ROLE',
|
|
35
|
+
EMAIL_TAKEN: 'EMAIL_TAKEN',
|
|
36
|
+
WRONG_EMAIL: 'WRONG_EMAIL',
|
|
37
|
+
INVALID_CREDENTIALS: 'INVALID_CREDENTIALS',
|
|
38
|
+
INVALID_CLIENT: 'INVALID_CLIENT',
|
|
39
|
+
INVALID_CODE: 'INVALID_CODE',
|
|
40
|
+
INVALID_INVITATION: 'INVALID_INVITATION',
|
|
41
|
+
INVITATION_EXPIRED: 'INVITATION_EXPIRED',
|
|
42
|
+
INVITE_PENDING: 'INVITE_PENDING',
|
|
43
|
+
ALREADY_CLAIMED: 'ALREADY_CLAIMED',
|
|
44
|
+
ALREADY_MEMBER: 'ALREADY_MEMBER',
|
|
45
|
+
PAT_NOT_FOUND: 'PAT_NOT_FOUND',
|
|
46
|
+
UNKNOWN_PROVIDER: 'UNKNOWN_PROVIDER',
|
|
47
|
+
CANNOT_DELETE_PERSONAL: 'CANNOT_DELETE_PERSONAL',
|
|
48
|
+
CANNOT_INVITE_TO_PERSONAL: 'CANNOT_INVITE_TO_PERSONAL',
|
|
49
|
+
TEAM_CANNOT_BUILD: 'TEAM_CANNOT_BUILD',
|
|
50
|
+
CANNOT_REMOVE_SELF: 'CANNOT_REMOVE_SELF',
|
|
51
|
+
SOLE_OWNER: 'SOLE_OWNER',
|
|
52
|
+
NO_KEY: 'NO_KEY',
|
|
53
|
+
NOT_ACTIVE: 'NOT_ACTIVE',
|
|
54
|
+
SPONSORED_INELIGIBLE: 'SPONSORED_INELIGIBLE',
|
|
55
|
+
BUDGET_UPDATE_FAILED: 'BUDGET_UPDATE_FAILED',
|
|
56
|
+
SPONSORED_POOL_UPDATE_FAILED: 'SPONSORED_POOL_UPDATE_FAILED',
|
|
57
|
+
ENCRYPTION_FAILED: 'ENCRYPTION_FAILED',
|
|
58
|
+
DECRYPTION_FAILED: 'DECRYPTION_FAILED',
|
|
59
|
+
DB_INSERT_FAILED: 'DB_INSERT_FAILED',
|
|
60
|
+
FETCH_FAILED: 'FETCH_FAILED',
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=error-codes.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { proxyErrorCodes, providerErrorCodes, apiErrorCodes, type ProxyErrorCode, type ProviderErrorCode, type ApiErrorCode, type ErrorCode, } from './error-codes.js';
|
|
3
|
+
export declare const errorSourceSchema: z.ZodEnum<{
|
|
4
|
+
proxy: "proxy";
|
|
5
|
+
provider: "provider";
|
|
6
|
+
}>;
|
|
7
|
+
export type ErrorSource = z.infer<typeof errorSourceSchema>;
|
|
8
|
+
export declare const errorResponseSchema: z.ZodObject<{
|
|
9
|
+
error: z.ZodObject<{
|
|
10
|
+
code: z.ZodString;
|
|
11
|
+
message: z.ZodString;
|
|
12
|
+
source: z.ZodEnum<{
|
|
13
|
+
proxy: "proxy";
|
|
14
|
+
provider: "provider";
|
|
15
|
+
}>;
|
|
16
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ErrorResponse = z.infer<typeof errorResponseSchema>;
|
|
20
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { proxyErrorCodes, providerErrorCodes, apiErrorCodes, } from './error-codes.js';
|
|
3
|
+
export const errorSourceSchema = z.enum(['proxy', 'provider']);
|
|
4
|
+
export const errorResponseSchema = z.object({
|
|
5
|
+
error: z.object({
|
|
6
|
+
code: z.string(),
|
|
7
|
+
message: z.string(),
|
|
8
|
+
source: errorSourceSchema,
|
|
9
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ProviderId } from '../catalog/providers/index.js';
|
|
3
|
+
export declare const providerSchema: z.ZodEnum<{
|
|
4
|
+
anthropic: "anthropic";
|
|
5
|
+
openai: "openai";
|
|
6
|
+
bedrock: "bedrock";
|
|
7
|
+
google: "google";
|
|
8
|
+
grok: "grok";
|
|
9
|
+
}>;
|
|
10
|
+
export type Provider = ProviderId;
|
|
11
|
+
//# sourceMappingURL=provider.d.ts.map
|