@trayai/helix-sdk 0.113.0 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +91 -2
- package/dist/broker/index.d.ts +7 -7
- package/dist/broker/index.js +1 -1
- package/dist/chunk-CYG3GXE2.js +7 -0
- package/dist/chunk-HEA646WT.js +1 -0
- package/dist/config-loader-BqIGpFg8.d.ts +383 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +3 -3
- package/dist/internal/index.d.ts +46 -23
- package/dist/internal/index.js +1 -1
- package/dist/region-schema-COfWyGI9.d.ts +9 -0
- package/dist/testing/index.d.ts +3 -1
- package/dist/testing/index.js +1 -1
- package/dist/{types-DoNQWbb9.d.ts → types-B9ZTUx-H.d.ts} +113 -1
- package/package.json +9 -1
- package/dist/chunk-KUXDW5ED.js +0 -1
- package/dist/chunk-QWCCRTLO.js +0 -7
- package/dist/env-schema-DkgTG5b0.d.ts +0 -9
- package/dist/sdk-config-DU6cWbLW.d.ts +0 -217
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
interface SdkRuntimeConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Execution mode. `"lambda"` is set via `setSdkConfig({ mode: "lambda", ... })`
|
|
6
|
+
* before the first handler invocation. `"dev"` is the default for `helix dev`
|
|
7
|
+
* and local invocations.
|
|
8
|
+
*/
|
|
9
|
+
mode: "lambda" | "dev";
|
|
10
|
+
/**
|
|
11
|
+
* Execution ID for the current invocation. Set via `setSdkConfig(...)` at
|
|
12
|
+
* handler entry in lambda mode. In `dev` mode, define-function falls back to
|
|
13
|
+
* the `x-tray-execution-id` header (or a random UUID).
|
|
14
|
+
*/
|
|
15
|
+
executionId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* User ID for the current invocation. Set via `setSdkConfig(...)` at handler
|
|
18
|
+
* entry in lambda mode. In `dev` mode, define-function reads from the
|
|
19
|
+
* `x-tray-user-id` header.
|
|
20
|
+
*/
|
|
21
|
+
userId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Deployment ID for the current invocation. Set via `setSdkConfig(...)` at
|
|
24
|
+
* handler entry. Only meaningful in `lambda` mode; `dev` mode has no
|
|
25
|
+
* deployment concept yet.
|
|
26
|
+
*/
|
|
27
|
+
deploymentId?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Running dev server's own base URL (e.g. `http://localhost:3000`). Set by
|
|
30
|
+
* the CLI's `sdk-context` Nitro plugin in `dev` mode so `ctx.files()` can
|
|
31
|
+
* build local signed URLs pointing at `/_helix/files/**`. Absent in `lambda`
|
|
32
|
+
* mode — production signed URLs point at the platform API host instead.
|
|
33
|
+
*/
|
|
34
|
+
devServerUrl?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Absolute path to the project root in `dev` mode, set by the CLI's
|
|
37
|
+
* `sdk-context` Nitro plugin. Used by `ctx.files()`'s local dev store to
|
|
38
|
+
* resolve `.helix/files/` on disk. Absent in `lambda` mode.
|
|
39
|
+
*/
|
|
40
|
+
projectRoot?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The calling execution's id, set via `setSdkConfig(...)` only for a
|
|
43
|
+
* function-call-triggered invocation (`ctx.callFunctionAsync`, SUR-929).
|
|
44
|
+
* The shim explicitly clears this (passes `undefined`) on every other
|
|
45
|
+
* invocation kind so a warm container never leaks a prior call's parentage.
|
|
46
|
+
*/
|
|
47
|
+
parentExecutionId?: string | null;
|
|
48
|
+
}
|
|
49
|
+
interface BrokerSecrets {
|
|
50
|
+
internalJwt?: string;
|
|
51
|
+
helixExecutionJwt?: string;
|
|
52
|
+
devToken?: string;
|
|
53
|
+
}
|
|
54
|
+
interface SdkConfigInput extends Partial<SdkRuntimeConfig>, BrokerSecrets {
|
|
55
|
+
}
|
|
56
|
+
declare function setSdkConfig(options: SdkConfigInput): void;
|
|
57
|
+
declare function getSdkConfig(): Readonly<SdkRuntimeConfig>;
|
|
58
|
+
|
|
59
|
+
declare const projectIdSchema: z.ZodString;
|
|
60
|
+
declare const workspaceIdSchema: z.ZodString;
|
|
61
|
+
/**
|
|
62
|
+
* AI provider declaration (helix-spec 11). The Vercel AI SDK builds
|
|
63
|
+
* provider-native requests client-side, so `ctx.ai(alias)` must know which
|
|
64
|
+
* `@ai-sdk/*` package serves the alias BEFORE any request exists — and
|
|
65
|
+
* platform authentications carry no service identifier, so the project
|
|
66
|
+
* declares it here: `aiProviders: { <authAlias>: "<service>" }`. The
|
|
67
|
+
* `openai-compatible` service (self-hosted vLLM, Ollama, …) additionally
|
|
68
|
+
* needs the endpoint base URL, so it uses the object form.
|
|
69
|
+
*
|
|
70
|
+
* `baseUrl` must be https: every `ctx.ai` request egresses through the
|
|
71
|
+
* credentials broker's raw forward proxy, and `createBrokerFetch` rejects
|
|
72
|
+
* non-https destinations unconditionally (no dev/local exception) — so an
|
|
73
|
+
* http endpoint (a bare local Ollama/vLLM instance, say) would load fine here
|
|
74
|
+
* and then fail on every request. Catching it in the schema turns that into
|
|
75
|
+
* one clear config error instead of a confusing first-call failure.
|
|
76
|
+
*/
|
|
77
|
+
declare const AI_SERVICES: readonly ["openai", "anthropic", "google", "mistral", "cohere", "openai-compatible"];
|
|
78
|
+
type AiService = (typeof AI_SERVICES)[number];
|
|
79
|
+
declare const aiProviderEntrySchema: z.ZodUnion<[z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere"]>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
80
|
+
service: z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere", "openai-compatible"]>;
|
|
81
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
84
|
+
baseUrl?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
87
|
+
baseUrl?: string | undefined;
|
|
88
|
+
}>, {
|
|
89
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
90
|
+
baseUrl?: string | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
93
|
+
baseUrl?: string | undefined;
|
|
94
|
+
}>, {
|
|
95
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
96
|
+
baseUrl?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
99
|
+
baseUrl?: string | undefined;
|
|
100
|
+
}>]>;
|
|
101
|
+
type AiProviderEntry = z.infer<typeof aiProviderEntrySchema>;
|
|
102
|
+
declare const trayConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
106
|
+
region: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated Renamed to `region` (SUR-1069). `env`'s only legal value,
|
|
109
|
+
* pre-rename, was `"production"` (the sole environment before regions
|
|
110
|
+
* existed) — which is exactly the same physical region as `region`'s
|
|
111
|
+
* default, `"us1"`. So `env`'s value never needs translating: its mere
|
|
112
|
+
* presence (validated below) is enough to keep old configs building;
|
|
113
|
+
* the transform below defaults `region` to `"us1"` whether `env` was
|
|
114
|
+
* `"production"` or simply absent. Kept for one release cycle.
|
|
115
|
+
*/
|
|
116
|
+
env: z.ZodOptional<z.ZodLiteral<"production">>;
|
|
117
|
+
authentications: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
118
|
+
config: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
119
|
+
aiProviders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere"]>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
120
|
+
service: z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere", "openai-compatible"]>;
|
|
121
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
124
|
+
baseUrl?: string | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
127
|
+
baseUrl?: string | undefined;
|
|
128
|
+
}>, {
|
|
129
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
130
|
+
baseUrl?: string | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
133
|
+
baseUrl?: string | undefined;
|
|
134
|
+
}>, {
|
|
135
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
136
|
+
baseUrl?: string | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
139
|
+
baseUrl?: string | undefined;
|
|
140
|
+
}>]>>>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
name: string;
|
|
143
|
+
authentications: Record<string, string>;
|
|
144
|
+
config: Record<string, unknown>;
|
|
145
|
+
projectId?: string | undefined;
|
|
146
|
+
workspaceId?: string | undefined;
|
|
147
|
+
region?: string | undefined;
|
|
148
|
+
env?: "production" | undefined;
|
|
149
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
150
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
151
|
+
baseUrl?: string | undefined;
|
|
152
|
+
}> | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
name: string;
|
|
155
|
+
projectId?: string | undefined;
|
|
156
|
+
workspaceId?: string | undefined;
|
|
157
|
+
region?: string | undefined;
|
|
158
|
+
env?: "production" | undefined;
|
|
159
|
+
authentications?: Record<string, string> | undefined;
|
|
160
|
+
config?: Record<string, unknown> | undefined;
|
|
161
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
162
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
163
|
+
baseUrl?: string | undefined;
|
|
164
|
+
}> | undefined;
|
|
165
|
+
}>, {
|
|
166
|
+
region: string;
|
|
167
|
+
name: string;
|
|
168
|
+
authentications: Record<string, string>;
|
|
169
|
+
config: Record<string, unknown>;
|
|
170
|
+
projectId?: string | undefined;
|
|
171
|
+
workspaceId?: string | undefined;
|
|
172
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
173
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
174
|
+
baseUrl?: string | undefined;
|
|
175
|
+
}> | undefined;
|
|
176
|
+
}, {
|
|
177
|
+
name: string;
|
|
178
|
+
projectId?: string | undefined;
|
|
179
|
+
workspaceId?: string | undefined;
|
|
180
|
+
region?: string | undefined;
|
|
181
|
+
env?: "production" | undefined;
|
|
182
|
+
authentications?: Record<string, string> | undefined;
|
|
183
|
+
config?: Record<string, unknown> | undefined;
|
|
184
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
185
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
186
|
+
baseUrl?: string | undefined;
|
|
187
|
+
}> | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
/** User-facing config type — auth/config optional; Zod defaults fill at load time. */
|
|
190
|
+
type TrayConfig = z.input<typeof trayConfigSchema>;
|
|
191
|
+
/**
|
|
192
|
+
* Runtime validator for the LoadedTrayConfig discriminated union.
|
|
193
|
+
* Used to validate BroadcastChannel payloads before calling setActiveConfig —
|
|
194
|
+
* prevents malformed cross-channel data from corrupting the worker-local
|
|
195
|
+
* config slot.
|
|
196
|
+
*/
|
|
197
|
+
declare const loadedTrayConfigSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
198
|
+
name: z.ZodString;
|
|
199
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
200
|
+
region: z.ZodEffects<z.ZodString, string, string>;
|
|
201
|
+
authentications: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
202
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
203
|
+
aiProviders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere"]>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
204
|
+
service: z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere", "openai-compatible"]>;
|
|
205
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
208
|
+
baseUrl?: string | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
211
|
+
baseUrl?: string | undefined;
|
|
212
|
+
}>, {
|
|
213
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
214
|
+
baseUrl?: string | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
217
|
+
baseUrl?: string | undefined;
|
|
218
|
+
}>, {
|
|
219
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
220
|
+
baseUrl?: string | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
223
|
+
baseUrl?: string | undefined;
|
|
224
|
+
}>]>>>;
|
|
225
|
+
} & {
|
|
226
|
+
kind: z.ZodLiteral<"provisioned">;
|
|
227
|
+
projectId: z.ZodString;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
kind: "provisioned";
|
|
230
|
+
name: string;
|
|
231
|
+
projectId: string;
|
|
232
|
+
region: string;
|
|
233
|
+
authentications: Record<string, string>;
|
|
234
|
+
config: Record<string, unknown>;
|
|
235
|
+
workspaceId?: string | undefined;
|
|
236
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
237
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
238
|
+
baseUrl?: string | undefined;
|
|
239
|
+
}> | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
kind: "provisioned";
|
|
242
|
+
name: string;
|
|
243
|
+
projectId: string;
|
|
244
|
+
region: string;
|
|
245
|
+
authentications: Record<string, string>;
|
|
246
|
+
config: Record<string, unknown>;
|
|
247
|
+
workspaceId?: string | undefined;
|
|
248
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
249
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
250
|
+
baseUrl?: string | undefined;
|
|
251
|
+
}> | undefined;
|
|
252
|
+
}>, z.ZodObject<{
|
|
253
|
+
name: z.ZodString;
|
|
254
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
255
|
+
region: z.ZodEffects<z.ZodString, string, string>;
|
|
256
|
+
authentications: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
257
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
258
|
+
aiProviders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere"]>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
259
|
+
service: z.ZodEnum<["openai", "anthropic", "google", "mistral", "cohere", "openai-compatible"]>;
|
|
260
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
263
|
+
baseUrl?: string | undefined;
|
|
264
|
+
}, {
|
|
265
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
266
|
+
baseUrl?: string | undefined;
|
|
267
|
+
}>, {
|
|
268
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
269
|
+
baseUrl?: string | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
272
|
+
baseUrl?: string | undefined;
|
|
273
|
+
}>, {
|
|
274
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
275
|
+
baseUrl?: string | undefined;
|
|
276
|
+
}, {
|
|
277
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
278
|
+
baseUrl?: string | undefined;
|
|
279
|
+
}>]>>>;
|
|
280
|
+
} & {
|
|
281
|
+
kind: z.ZodLiteral<"unprovisioned">;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
kind: "unprovisioned";
|
|
284
|
+
name: string;
|
|
285
|
+
region: string;
|
|
286
|
+
authentications: Record<string, string>;
|
|
287
|
+
config: Record<string, unknown>;
|
|
288
|
+
workspaceId?: string | undefined;
|
|
289
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
290
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
291
|
+
baseUrl?: string | undefined;
|
|
292
|
+
}> | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
kind: "unprovisioned";
|
|
295
|
+
name: string;
|
|
296
|
+
region: string;
|
|
297
|
+
authentications: Record<string, string>;
|
|
298
|
+
config: Record<string, unknown>;
|
|
299
|
+
workspaceId?: string | undefined;
|
|
300
|
+
aiProviders?: Record<string, "openai" | "anthropic" | "google" | "mistral" | "cohere" | {
|
|
301
|
+
service: "openai" | "anthropic" | "google" | "mistral" | "cohere" | "openai-compatible";
|
|
302
|
+
baseUrl?: string | undefined;
|
|
303
|
+
}> | undefined;
|
|
304
|
+
}>]>;
|
|
305
|
+
/** Base fields on all config variants — schema output minus projectId. */
|
|
306
|
+
type LoadedTrayConfigBase = Omit<z.output<typeof trayConfigSchema>, "projectId">;
|
|
307
|
+
/**
|
|
308
|
+
* Discriminated union returned by loadConfig / ConfigService#get.
|
|
309
|
+
* - "provisioned" — projectId present, no optional-chaining needed.
|
|
310
|
+
* - "unprovisioned" — `projectId?: never` structurally excludes it.
|
|
311
|
+
* workspaceId is optional on both variants — independent of provisioning.
|
|
312
|
+
*/
|
|
313
|
+
type LoadedTrayConfig = ({
|
|
314
|
+
kind: "provisioned";
|
|
315
|
+
projectId: string;
|
|
316
|
+
} & LoadedTrayConfigBase) | ({
|
|
317
|
+
kind: "unprovisioned";
|
|
318
|
+
projectId?: never;
|
|
319
|
+
} & LoadedTrayConfigBase);
|
|
320
|
+
type ProvisionedTrayConfig = Extract<LoadedTrayConfig, {
|
|
321
|
+
kind: "provisioned";
|
|
322
|
+
}>;
|
|
323
|
+
type UnprovisionedTrayConfig = Extract<LoadedTrayConfig, {
|
|
324
|
+
kind: "unprovisioned";
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* Env var naming an alternate config file (relative paths resolve against cwd).
|
|
328
|
+
* Sits between the explicit `configFile` option (the CLI's `--config` flag) and
|
|
329
|
+
* the `helix.config.ts` default in resolution precedence.
|
|
330
|
+
*/
|
|
331
|
+
declare const HELIX_CONFIG_ENV = "HELIX_CONFIG";
|
|
332
|
+
/** Options accepted by every config entry point that resolves the config file. */
|
|
333
|
+
interface ConfigFileOptions {
|
|
334
|
+
/**
|
|
335
|
+
* Explicit config file path (the CLI's `--config` flag). Resolution
|
|
336
|
+
* precedence: this option → `HELIX_CONFIG` env var → `helix.config.ts`
|
|
337
|
+
* (then legacy `tray.config.*`) in cwd.
|
|
338
|
+
*/
|
|
339
|
+
configFile?: string;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* The effective config-file override, if any: the explicit `configFile` option
|
|
343
|
+
* (CLI `--config` flag) wins over the `HELIX_CONFIG` env var. Returns the raw
|
|
344
|
+
* (possibly relative) path — callers resolve it against their cwd.
|
|
345
|
+
*/
|
|
346
|
+
declare function resolveConfigOverride(configFile?: string): string | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* Absolute path of the project config file in `cwd`, preferring `helix.config.*`
|
|
349
|
+
* and falling back to a legacy `tray.config.*`. Returns undefined when neither exists.
|
|
350
|
+
* A config-file override (option or HELIX_CONFIG) replaces the default search
|
|
351
|
+
* entirely: only the named file is considered.
|
|
352
|
+
*/
|
|
353
|
+
declare function resolveConfigFile(cwd: string, options?: ConfigFileOptions): string | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* One-shot stateless read of the project config. NO caching — every call hits disk.
|
|
356
|
+
* Reads `helix.config.ts` (legacy `tray.config.*` fallback) unless an override
|
|
357
|
+
* names another file — `options.configFile` (CLI `--config` flag) first, then
|
|
358
|
+
* the `HELIX_CONFIG` env var. For hot-reload or stable snapshot, use
|
|
359
|
+
* {@link createConfigService} instead.
|
|
360
|
+
*/
|
|
361
|
+
declare function loadConfig(cwd?: string, options?: ConfigFileOptions): Promise<LoadedTrayConfig>;
|
|
362
|
+
/** Phase that surfaced an error inside ConfigService watcher. */
|
|
363
|
+
type WatchErrorPhase = "attach" | "reload" | "validation";
|
|
364
|
+
/** Stable code on errors thrown by {@link requireWorkspaceId}. Narrow by this, not instanceof. */
|
|
365
|
+
declare const WORKSPACE_ID_REQUIRED_CODE: "WORKSPACE_ID_REQUIRED";
|
|
366
|
+
/**
|
|
367
|
+
* Shape of errors thrown by {@link requireWorkspaceId}.
|
|
368
|
+
* Type alias — no class hierarchy; callers narrow via `error.code === WORKSPACE_ID_REQUIRED_CODE`.
|
|
369
|
+
*
|
|
370
|
+
* The thrown message references CLI (`helix workspace select` / `helix workspace set`)
|
|
371
|
+
* and MCP (`tray_list_workspaces` / `tray_set_workspace_id`) commands — keep those
|
|
372
|
+
* names in sync with the message literal in requireWorkspaceId.
|
|
373
|
+
*/
|
|
374
|
+
type WorkspaceIdRequiredError = Error & {
|
|
375
|
+
readonly code: typeof WORKSPACE_ID_REQUIRED_CODE;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Returns workspaceId from config, or throws a plain Error with code WORKSPACE_ID_REQUIRED.
|
|
379
|
+
* Pure, no I/O. workspaceId is independent of provisioning state.
|
|
380
|
+
*/
|
|
381
|
+
declare function requireWorkspaceId(config: LoadedTrayConfig): string;
|
|
382
|
+
|
|
383
|
+
export { AI_SERVICES as A, type ConfigFileOptions as C, HELIX_CONFIG_ENV as H, type LoadedTrayConfig as L, type ProvisionedTrayConfig as P, type SdkRuntimeConfig as S, type TrayConfig as T, type UnprovisionedTrayConfig as U, type WatchErrorPhase as W, type AiProviderEntry as a, type AiService as b, WORKSPACE_ID_REQUIRED_CODE as c, type WorkspaceIdRequiredError as d, aiProviderEntrySchema as e, loadedTrayConfigSchema as f, getSdkConfig as g, resolveConfigFile as h, resolveConfigOverride as i, type SdkConfigInput as j, loadConfig as l, projectIdSchema as p, requireWorkspaceId as r, setSdkConfig as s, workspaceIdSchema as w };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { ZodType } from 'zod';
|
|
3
|
-
import { F as FunctionHandler, D as DefineFunctionOptions, a as DefineScheduleConfig, S as ScheduleDefinition, P as PlatformContext } from './types-
|
|
4
|
-
export { B as BrokerAuthedClient,
|
|
5
|
-
import { T as TrayConfig, L as LoadedTrayConfig, W as WatchErrorPhase } from './
|
|
6
|
-
export { C as ConfigFileOptions, H as HELIX_CONFIG_ENV, P as ProvisionedTrayConfig, S as SdkRuntimeConfig, U as UnprovisionedTrayConfig,
|
|
7
|
-
export { a as
|
|
3
|
+
import { F as FunctionHandler, D as DefineFunctionOptions, a as DefineScheduleConfig, S as ScheduleDefinition, P as PlatformContext } from './types-B9ZTUx-H.js';
|
|
4
|
+
export { A as AiEmbeddingModelInstance, b as AiImageModelInstance, c as AiLanguageModelInstance, d as AiSpeechModelInstance, e as AiTranscriptionModelInstance, B as BrokerAuthedClient, f as BrokerCallOptions, g as BrokerCallResult, C as CallFunctionAsync, h as DbCallParameters, i as DbClient, j as FileSystemClient, H as HelixAI, k as HelixAIProvider, l as HelixCost, m as HelixResultMeta, n as HttpClient, K as KeyValueStore, L as Logger, o as S3SignOptions, p as S3SignResult, q as ScheduleContext, r as ScheduleHandler, s as ScheduleTrigger, t as SqlBuilder, T as TrayContext, U as UnvalidatedInput } from './types-B9ZTUx-H.js';
|
|
5
|
+
import { T as TrayConfig, L as LoadedTrayConfig, W as WatchErrorPhase } from './config-loader-BqIGpFg8.js';
|
|
6
|
+
export { A as AI_SERVICES, a as AiProviderEntry, b as AiService, C as ConfigFileOptions, H as HELIX_CONFIG_ENV, P as ProvisionedTrayConfig, S as SdkRuntimeConfig, U as UnprovisionedTrayConfig, c as WORKSPACE_ID_REQUIRED_CODE, d as WorkspaceIdRequiredError, e as aiProviderEntrySchema, g as getSdkConfig, l as loadConfig, f as loadedTrayConfigSchema, p as projectIdSchema, r as requireWorkspaceId, h as resolveConfigFile, i as resolveConfigOverride, w as workspaceIdSchema } from './config-loader-BqIGpFg8.js';
|
|
7
|
+
export { a as REGION_VALUES, R as Region, r as regionSchema } from './region-schema-COfWyGI9.js';
|
|
8
|
+
export { EmbedManyResult, EmbedResult, EmbeddingModel, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextResult, ImageModel, LanguageModel, LanguageModelUsage, ModelMessage, Output, PrepareStepFunction, SpeechModel, SpeechResult, StopCondition, StreamObjectResult, StreamTextResult, TextStreamPart, ToolChoice, ToolSet, TranscriptionModel, TranscriptionResult, UIMessage, convertToModelMessages, cosineSimilarity, dynamicTool, hasToolCall, jsonSchema, smoothStream, stepCountIs, tool, zodSchema } from 'ai';
|
|
8
9
|
import 'ky';
|
|
10
|
+
import '@ai-sdk/provider';
|
|
9
11
|
|
|
10
12
|
declare function defineFunction<TInput extends ZodType | undefined = undefined, TOutput extends ZodType | undefined = undefined>(handler: FunctionHandler<TInput extends ZodType ? ReturnType<TInput["parse"]> : Record<string, unknown>>, schemaOrOptions?: ZodType | DefineFunctionOptions<TInput, TOutput>): h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
11
13
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as ke,B as Se,C as xe,D as _e,b as R,h as M,i as F,j as Z,k as E,l as B,m as K,n as V,o as z,p as Ee,q as J,r as Q,s as Y,t as ee,u as te,y as re,z as ne}from"./chunk-QWCCRTLO.js";import{a as G,b as we}from"./chunk-WUCX7RZO.js";import{b as U,e as $,i as q,l as g,m as X}from"./chunk-KUXDW5ED.js";import{randomUUID as je}from"crypto";import{SpanStatusCode as de,SpanKind as De}from"@opentelemetry/api";import{defineEventHandler as Ae,getMethod as He,getRequestURL as We,getHeaders as ue,getHeader as ce}from"h3";import{readBody as Ie,getQuery as be,getRouterParams as Te}from"h3";async function oe(e,t){let r=await Re(e),n=be(e),o=Te(e)??{},i={...n,...r,...o};return t?Fe(i,t):i}async function Re(e){try{let t=await Ie(e);return t&&typeof t=="object"?t:(t!=null&&t!==""&&console.warn("[helix-sdk] Request body present but not a JSON object \u2014 ignored"),{})}catch(t){if(t instanceof Error&&"statusCode"in t&&t.statusCode===400){let n=new Error("Malformed request body");throw n.statusCode=400,n.data={message:"Request body is not valid JSON"},n}let r=e.method?.toUpperCase();if(r==="GET"||r==="HEAD"||r==="DELETE")return{};throw t}}function Fe(e,t){let r=t.safeParse(e);if(!r.success){let n=new Error("Input validation failed");throw n.statusCode=400,n.data=r.error.flatten(),n}return r.data}var w=class extends Error{statusCode;constructor(t,r){super(r),this.statusCode=t,this.name="HttpError"}};function ie(e){return t=>{e.node.res.statusCode=t}}function se(){return(e,t)=>{throw new w(e,t)}}function ae(e,t){let{statusCode:r,message:n}=Pe(t.detail);return e.node.res.statusCode=r,{error:n,statusCode:r}}function Pe(e){switch(e.kind){case"unknown_alias":return{statusCode:400,message:"Unknown authentication alias"};case"input_validation_failed":return{statusCode:400,message:"Input validation failed"};case"output_validation_failed":return{statusCode:500,message:"Internal server error"};case"config_load_failed":return{statusCode:500,message:"Configuration error"};case"broker_error":return{statusCode:502,message:"Broker error"};case"unsupported_body_type":return{statusCode:400,message:"Unsupported request body type"};case"unsupported_scheme":return{statusCode:400,message:"Unsupported URL scheme"};case"missing_execution_credentials":return{statusCode:401,message:"Missing execution credentials"};case"missing_tray_token":return{statusCode:500,message:"Missing Tray token"};case"db_call_failed":return{statusCode:502,message:e.message};case"db_query_failed":return{statusCode:502,message:`Database query failed: ${e.message}`};case"db_invalid_parameters":return{statusCode:400,message:e.message};case"kv_key_invalid":return{statusCode:400,message:e.message};case"kv_value_invalid":return{statusCode:400,message:e.message};case"kv_value_too_large":return{statusCode:400,message:e.message};case"kv_ttl_invalid":return{statusCode:400,message:e.message};case"kv_not_available":return{statusCode:501,message:"Key-value store is not available in this environment"};case"kv_call_failed":return{statusCode:502,message:"Key-value store request failed"};case"kv_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"files_path_invalid":return{statusCode:400,message:e.message};case"files_value_invalid":return{statusCode:400,message:e.message};case"files_value_too_large":return{statusCode:400,message:e.message};case"files_not_available":return{statusCode:501,message:"File storage is not available in this environment"};case"files_call_failed":return{statusCode:502,message:"File storage request failed"};case"files_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"call_function_path_invalid":return{statusCode:400,message:e.message};case"call_function_call_failed":return{statusCode:502,message:"Async function call failed"};case"call_function_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"call_function_not_available":return{statusCode:501,message:"callFunctionAsync is not available in this environment"};case"call_function_missing_execution_jwt":return{statusCode:401,message:"Missing execution credentials"};default:return{statusCode:500,message:`Unhandled error kind: ${e.kind}`}}}var Le=["authorization","x-tray-token","set-cookie","x-kong-request-id","traceparent","x-real-ip","cookie"];function Oe(e){return e.toLowerCase().includes("tray_lid")}function P(e){let t={};for(let[r,n]of Object.entries(e))if(!Le.includes(r.toLowerCase())){if(r.toLowerCase()==="cookie"&&n){let o=n.split(";").map(i=>i.trim()).filter(i=>{let d=i.split("=")[0].trim();return!Oe(d)}).join("; ");o&&(t[r]=o);continue}t[r]=n}return t}function Ne(e,t){let{inputSchema:r,outputSchema:n}=Be(t),o=e;return Ae(async i=>{let d=R(),{executionId:s,userId:a,deploymentId:f}=Ke(d,i),l=d.mode==="lambda"?d.parentExecutionId??null:null,y=Date.now(),S=new Date().toISOString(),p=He(i),u=We(i).pathname,C=Q(),v=J(),Ce=`${p} ${u}`;B();let N={hasDb:!1,hasExternal:!1,hasAuth:!1,hasError:!1};return Ue(()=>F.run(N,()=>M.run(s,async()=>{let x=await $e(i,r);if(!x.ok)return{response:x.response,errored:!1,errorMessage:null};let ve=ze(i,x.input,C,v,p,u,s,f,a,l);return qe(o,ve,n,i,v,s,f,{method:p,path:u,rawInput:x.input})})),{executionId:s,deploymentId:f,routeOrJob:Ce,startedAt:S,startMs:y,userId:a,flags:N})})}async function Ue(e,t){let r=!1,n=null;try{let o=await e();return r=o.errored,n=o.errorMessage,o.response}finally{z({...t,errored:r,errorMessage:n}),await K()}}async function $e(e,t){try{return{ok:!0,input:await oe(e,t)}}catch(r){let n=Ve(e,r);if(n)return{ok:!1,response:n};throw r}}async function qe(e,t,r,n,o,i,d,s){return V.startActiveSpan("function",{root:!0,kind:De.SERVER,attributes:{method:s.method,route:s.path,executionId:i,...d?{deploymentId:d}:{}}},async a=>{t.traceId=a.spanContext().traceId;let f=P(ue(n));E(a,"input",s.rawInput),E(a,"request",{method:s.method,path:s.path,headers:f,body:s.rawInput});let l=!1,y=null,S,p;try{let u=await G.run(t,()=>e(t));if(S=u,u==null)n.node.res.statusCode=204,p="";else if(u instanceof Response)p=u;else if(r){let C=r.safeParse(u);if(!C.success){let v=Object.keys(C.error.flatten().fieldErrors);throw o.error("Output validation failed",{fields:v,executionId:i}),g.outputValidationFailed(v)}p=C.data}else p=u}catch(u){l=!0,y=u instanceof Error?u.message:String(u),Z("hasError"),p=Me(u,n,o,i)}finally{Ze(a,n,{errored:l,errorMessage:y,handlerResult:S,response:p})}return{response:p,errored:l,errorMessage:y}})}function Me(e,t,r,n){if(e instanceof w)return t.node.res.statusCode=e.statusCode,{error:e.message,statusCode:e.statusCode};if(X(e))return ae(t,e);r.error("Unhandled error in handler",{error:e instanceof Error?e.message:String(e),executionId:n}),t.node.res.statusCode=500;let o=process.env.NODE_ENV==="development";return{error:o&&e instanceof Error?e.message:"Internal server error",statusCode:500,...o&&e instanceof Error&&e.stack?{stack:e.stack}:{}}}function Ze(e,t,r){e.setAttribute("statusCode",t.node.res.statusCode),!r.errored&&r.handlerResult!==void 0&&E(e,"output",r.handlerResult),E(e,"response",r.response);let n=F.getStore();e.setAttribute("hasAuth",n?.hasAuth??!1),e.setAttribute("hasExternal",n?.hasExternal??!1),e.setAttribute("hasDb",n?.hasDb??!1),e.setAttribute("status",r.errored?"error":"success");let o=r.errored||(n?.hasError??!1);e.setStatus({code:o?de.ERROR:de.OK,...r.errorMessage?{message:r.errorMessage}:{}}),e.end()}function Be(e){if(!e)return{inputSchema:void 0,outputSchema:void 0};if(e instanceof Object&&"_def"in e)return{inputSchema:e,outputSchema:void 0};if(typeof e=="object"&&("input"in e||"output"in e)){let t=e;return{inputSchema:t.input,outputSchema:t.output}}return{inputSchema:e,outputSchema:void 0}}function Ke(e,t){let r=e.mode==="lambda",n=(r?e.executionId:ce(t,"x-tray-execution-id"))??je(),o=(r?e.userId:ce(t,"x-tray-user-id"))??null,i=r?e.deploymentId??null:null;return{executionId:n,userId:o,deploymentId:i}}function Ve(e,t){if(!(t instanceof Error)||!("statusCode"in t)||!("data"in t))return null;let r=t.statusCode,n=t.data;e.node.res.statusCode=r;let o=n&&typeof n=="object"&&"fieldErrors"in n?n.fieldErrors:void 0;return{error:"Input validation failed",statusCode:r,...o?{fields:Object.keys(o)}:{}}}function ze(e,t,r,n,o,i,d,s,a,f){return{input:t,method:o,path:i,headers:P(ue(e)),http:Y(),db:l=>ee(l),kv:()=>te(),files:()=>re(),callFunctionAsync:ne(),log:n,config:r,status:ie(e),error:se(),state:{},request:e,executionId:d,deploymentId:s,userId:a,parentExecutionId:f,identity:a!==null?{user:{id:a}}:null,traceId:""}}function Ge(e){return e}import{resolve as m}from"path";import{existsSync as I,realpathSync as fe}from"fs";import{loadConfig as Xe}from"c12";import{z as c}from"zod";import{z as Je}from"zod";var Qe=["production"],_=Je.string().refine(e=>U(e),e=>({message:`Invalid enum value. Expected ${$().map(t=>`'${t}'`).join(" | ")}, received '${e}'`}));var L=c.string().uuid("projectId must be a valid UUID"),O=c.string().min(1,"workspaceId must be a non-empty string"),Ye=c.object({name:c.string().min(1,"name is required"),projectId:L.optional(),workspaceId:O.optional(),env:_.default("production"),authentications:c.record(c.string()).optional().default({}),config:c.record(c.unknown()).optional().default({})}),le=c.object({name:c.string().min(1,"name is required"),workspaceId:O.optional(),env:_,authentications:c.record(c.string()),config:c.record(c.unknown())}),et=c.discriminatedUnion("kind",[le.extend({kind:c.literal("provisioned"),projectId:L}),le.extend({kind:c.literal("unprovisioned")})]),pe=["helix","tray"],ge=["ts","mts","cts","js","mjs","cjs"],j="HELIX_CONFIG";function h(e){let t=e?.trim();return t||process.env[j]?.trim()||void 0}function b(e,t){let r=h(t?.configFile);if(r!==void 0){let n=m(e,r);return I(n)?n:void 0}for(let n of pe)for(let o of ge){let i=m(e,`${n}.config.${o}`);if(I(i))return i}}function tt(e){for(let t of pe)if(ge.some(r=>I(m(e,`${t}.config.${r}`))))return t;return"helix"}function rt(e,t){return m(e,t).replace(/\.(?:m|c)?[jt]s$/,"")}function D(e,t){let r=h(t?.configFile);return{name:tt(e),cwd:e,...r!==void 0?{configFile:rt(e,r)}:{},rcFile:!1,globalRc:!1,packageJson:!1,dotenv:!1,extend:!1}}function A(e,t){if(e!==null&&typeof e=="object"&&"extends"in e)throw g.configLoadFailed(`helix.config.ts at ${t}: 'extends' is not supported \u2014 remove the field`);let r=Ye.safeParse(e);if(!r.success){let f=r.error.issues.map(l=>l.message).join("; ");throw g.configLoadFailed(`Invalid helix.config.ts at ${t}: ${f}`)}let{projectId:n,workspaceId:o,...i}=r.data,d=o!==void 0?{workspaceId:o}:{},s=q(),a=s!==void 0?{...i,env:s}:i;return n!==void 0?{kind:"provisioned",projectId:n,...a,...d}:{kind:"unprovisioned",...a,...d}}async function k(e,t){let r=e??process.cwd(),n=h(t?.configFile),o=n!==void 0?m(r,n):void 0;if(o!==void 0&&!I(o)){let s=t?.configFile?.trim()?"":` (from ${j})`;throw g.configLoadFailed(`Config file not found: ${o}${s}`)}let i;try{i=await Xe(D(r,t))}catch(s){throw g.configLoadFailed(`Failed to load helix.config.ts: ${s instanceof Error?s.message:String(s)}`)}let d=i._configFile??b(r,t);if(!d)throw g.configLoadFailed(`helix.config.ts not found at ${m(r,"helix.config.ts")}`);if(o!==void 0&&i._configFile!==void 0){let s=fe(o);if(fe(m(i._configFile))!==s)throw g.configLoadFailed(`Config file conflict: requested ${o} but ${m(i._configFile)} takes extension-resolution precedence \u2014 remove or rename the sibling file`)}return A(i.config,d)}var me="WORKSPACE_ID_REQUIRED";function nt(e){if(e.workspaceId===void 0)throw Object.assign(new Error("No workspaceId found in helix.config.ts. Discover & choose one \u2014 self-serve fix: run `helix workspace select`; agent-driven fix: call the `tray_list_workspaces` MCP tool. Already know the id? Run `helix workspace set <id>` or call the `tray_set_workspace_id` MCP tool. deploy cannot proceed without a workspace."),{code:me});return e.workspaceId}import{existsSync as ot,watch as it,writeSync as st}from"fs";import{basename as at,dirname as dt,join as ct,resolve as T}from"path";import{watchConfig as ut}from"c12";function ft(e,t){let r=e instanceof Error?e.message:String(e);st(2,`[helix-watch] ${t.phase} error: ${r}
|
|
2
|
-
`)}function
|
|
1
|
+
import{A as ce,B as le,C as fe,D as pe,E as ge,F as me,G as _,H as x,I as V,J as z,K as y,L as he,M as ye,N as B,O as Ce,P as ve,Q as we,R as Se,f as P,g as k,h as A,i as h,j as H,k as F,l as L,m as O,n as ae,o as M,p as D,q,r as Z,s as N,w as $,x as K,y as de,z as ue}from"./chunk-CYG3GXE2.js";import{a as j,b as ie}from"./chunk-WUCX7RZO.js";import{d as E,r as W,s as U}from"./chunk-HEA646WT.js";import{randomUUID as Pe}from"crypto";import{SpanStatusCode as Y,SpanKind as Ae}from"@opentelemetry/api";import{defineEventHandler as He,getMethod as Fe,getRequestURL as Le,getHeaders as te,getHeader as ee}from"h3";import{readBody as Ee,getQuery as ke,getRouterParams as _e}from"h3";async function G(e,t){let r=await xe(e),n=ke(e),o=_e(e)??{},s={...n,...r,...o};return t?be(s,t):s}async function xe(e){try{let t=await Ee(e);return t&&typeof t=="object"?t:(t!=null&&t!==""&&console.warn("[helix-sdk] Request body present but not a JSON object \u2014 ignored"),{})}catch(t){if(t instanceof Error&&"statusCode"in t&&t.statusCode===400){let n=new Error("Malformed request body");throw n.statusCode=400,n.data={message:"Request body is not valid JSON"},n}let r=e.method?.toUpperCase();if(r==="GET"||r==="HEAD"||r==="DELETE")return{};throw t}}function be(e,t){let r=t.safeParse(e);if(!r.success){let n=new Error("Input validation failed");throw n.statusCode=400,n.data=r.error.flatten(),n}return r.data}var C=class extends Error{statusCode;constructor(t,r){super(r),this.statusCode=t,this.name="HttpError"}};function J(e){return t=>{e.node.res.statusCode=t}}function Q(){return(e,t)=>{throw new C(e,t)}}function X(e,t){let{statusCode:r,message:n}=Te(t.detail);return e.node.res.statusCode=r,{error:n,statusCode:r}}function Te(e){switch(e.kind){case"unknown_alias":return{statusCode:400,message:"Unknown authentication alias"};case"input_validation_failed":return{statusCode:400,message:"Input validation failed"};case"output_validation_failed":return{statusCode:500,message:"Internal server error"};case"config_load_failed":return{statusCode:500,message:"Configuration error"};case"broker_error":return{statusCode:502,message:"Broker error"};case"unsupported_body_type":return{statusCode:400,message:"Unsupported request body type"};case"unsupported_scheme":return{statusCode:400,message:"Unsupported URL scheme"};case"missing_execution_credentials":return{statusCode:401,message:"Missing execution credentials"};case"missing_tray_token":return{statusCode:500,message:"Missing Tray token"};case"db_call_failed":return{statusCode:502,message:e.message};case"db_query_failed":return{statusCode:502,message:`Database query failed: ${e.message}`};case"db_invalid_parameters":return{statusCode:400,message:e.message};case"kv_key_invalid":return{statusCode:400,message:e.message};case"kv_value_invalid":return{statusCode:400,message:e.message};case"kv_value_too_large":return{statusCode:400,message:e.message};case"kv_ttl_invalid":return{statusCode:400,message:e.message};case"kv_not_available":return{statusCode:501,message:"Key-value store is not available in this environment"};case"kv_call_failed":return{statusCode:502,message:"Key-value store request failed"};case"kv_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"files_path_invalid":return{statusCode:400,message:e.message};case"files_value_invalid":return{statusCode:400,message:e.message};case"files_value_too_large":return{statusCode:400,message:e.message};case"files_not_available":return{statusCode:501,message:"File storage is not available in this environment"};case"files_call_failed":return{statusCode:502,message:"File storage request failed"};case"files_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"call_function_path_invalid":return{statusCode:400,message:e.message};case"call_function_call_failed":return{statusCode:502,message:"Async function call failed"};case"call_function_requires_provisioning":return{statusCode:500,message:"Internal server error"};case"call_function_not_available":return{statusCode:501,message:"callFunctionAsync is not available in this environment"};case"call_function_missing_execution_jwt":return{statusCode:401,message:"Missing execution credentials"};case"ai_unsupported_service":case"ai_model_id_required":case"ai_model_instance_required":case"ai_provider_not_configured":case"ai_foreign_model_rejected":return{statusCode:500,message:e.kind==="ai_unsupported_service"?`AI service not supported for alias "${e.alias}"`:"Internal server error"};default:return{statusCode:500,message:`Unhandled error kind: ${e.kind}`}}}var Ie=["authorization","x-tray-token","set-cookie","x-kong-request-id","traceparent","x-real-ip","cookie"];function Re(e){return e.toLowerCase().includes("tray_lid")}function b(e){let t={};for(let[r,n]of Object.entries(e))if(!Ie.includes(r.toLowerCase())){if(r.toLowerCase()==="cookie"&&n){let o=n.split(";").map(s=>s.trim()).filter(s=>{let d=s.split("=")[0].trim();return!Re(d)}).join("; ");o&&(t[r]=o);continue}t[r]=n}return t}function Oe(e,t){let{inputSchema:r,outputSchema:n}=qe(t),o=e;return He(async s=>{let d=E(),{executionId:i,userId:a,deploymentId:l}=Ze(d,s),f=d.mode==="lambda"?d.parentExecutionId??null:null,p=Date.now(),v=new Date().toISOString(),c=Fe(s),u=Le(s).pathname,g=D(),m=M(),oe=`${c} ${u}`;H();let R={hasDb:!1,hasExternal:!1,hasAuth:!1,hasAi:!1,hasError:!1};return je(()=>k.run(R,()=>P.run(i,async()=>{let w=await Me(s,r);if(!w.ok)return{response:w.response,errored:!1,errorMessage:null};let se=$e(s,w.input,g,m,c,u,i,l,a,f);return De(o,se,n,s,m,i,l,{method:c,path:u,rawInput:w.input})})),{executionId:i,deploymentId:l,routeOrJob:oe,startedAt:v,startMs:p,userId:a,flags:R})})}async function je(e,t){let r=!1,n=null;try{let o=await e();return r=o.errored,n=o.errorMessage,o.response}finally{O({...t,errored:r,errorMessage:n}),await F()}}async function Me(e,t){try{return{ok:!0,input:await G(e,t)}}catch(r){let n=Ne(e,r);if(n)return{ok:!1,response:n};throw r}}async function De(e,t,r,n,o,s,d,i){return L.startActiveSpan("function",{root:!0,kind:Ae.SERVER,attributes:{method:i.method,route:i.path,executionId:s,...d?{deploymentId:d}:{}}},async a=>{t.traceId=a.spanContext().traceId;let l=b(te(n));h(a,"input",i.rawInput),h(a,"request",{method:i.method,path:i.path,headers:l,body:i.rawInput});let f=!1,p=null,v,c;try{let u=await j.run(t,()=>e(t));if(v=u,u==null)n.node.res.statusCode=204,c="";else if(u instanceof Response)c=u;else if(r){let g=r.safeParse(u);if(!g.success){let m=Object.keys(g.error.flatten().fieldErrors);throw o.error("Output validation failed",{fields:m,executionId:s}),W.outputValidationFailed(m)}c=g.data}else c=u}catch(u){f=!0,p=u instanceof Error?u.message:String(u),A("hasError"),c=We(u,n,o,s)}finally{Ue(a,n,{errored:f,errorMessage:p,handlerResult:v,response:c})}return{response:c,errored:f,errorMessage:p}})}function We(e,t,r,n){if(e instanceof C)return t.node.res.statusCode=e.statusCode,{error:e.message,statusCode:e.statusCode};if(U(e))return X(t,e);r.error("Unhandled error in handler",{error:e instanceof Error?e.message:String(e),executionId:n}),t.node.res.statusCode=500;let o=process.env.NODE_ENV==="development";return{error:o&&e instanceof Error?e.message:"Internal server error",statusCode:500,...o&&e instanceof Error&&e.stack?{stack:e.stack}:{}}}function Ue(e,t,r){e.setAttribute("statusCode",t.node.res.statusCode),!r.errored&&r.handlerResult!==void 0&&h(e,"output",r.handlerResult),h(e,"response",r.response);let n=k.getStore();e.setAttribute("hasAuth",n?.hasAuth??!1),e.setAttribute("hasAi",n?.hasAi??!1),e.setAttribute("hasExternal",n?.hasExternal??!1),e.setAttribute("hasDb",n?.hasDb??!1),e.setAttribute("status",r.errored?"error":"success");let o=r.errored||(n?.hasError??!1);e.setStatus({code:o?Y.ERROR:Y.OK,...r.errorMessage?{message:r.errorMessage}:{}}),e.end()}function qe(e){if(!e)return{inputSchema:void 0,outputSchema:void 0};if(e instanceof Object&&"_def"in e)return{inputSchema:e,outputSchema:void 0};if(typeof e=="object"&&("input"in e||"output"in e)){let t=e;return{inputSchema:t.input,outputSchema:t.output}}return{inputSchema:e,outputSchema:void 0}}function Ze(e,t){let r=e.mode==="lambda",n=(r?e.executionId:ee(t,"x-tray-execution-id"))??Pe(),o=(r?e.userId:ee(t,"x-tray-user-id"))??null,s=r?e.deploymentId??null:null;return{executionId:n,userId:o,deploymentId:s}}function Ne(e,t){if(!(t instanceof Error)||!("statusCode"in t)||!("data"in t))return null;let r=t.statusCode,n=t.data;e.node.res.statusCode=r;let o=n&&typeof n=="object"&&"fieldErrors"in n?n.fieldErrors:void 0;return{error:"Input validation failed",statusCode:r,...o?{fields:Object.keys(o)}:{}}}function $e(e,t,r,n,o,s,d,i,a,l){return{input:t,method:o,path:s,headers:b(te(e)),http:q(),db:f=>Z(f),kv:()=>N(),files:()=>$(),callFunctionAsync:K(),ai:B(),log:n,config:r,status:J(e),error:Q(),state:{},request:e,executionId:d,deploymentId:i,userId:a,parentExecutionId:l,identity:a!==null?{user:{id:a}}:null,traceId:""}}function Ke(e){return e}import{existsSync as Ve,watch as ze,writeSync as Be}from"fs";import{basename as Ge,dirname as Je,join as Qe,resolve as S}from"path";import{watchConfig as Xe}from"c12";function Ye(e,t){let r=e instanceof Error?e.message:String(e);Be(2,`[helix-watch] ${t.phase} error: ${r}
|
|
2
|
+
`)}function T(){return{kind:"unprovisioned",name:"",authentications:{},config:{},region:"us1"}}var et=/^(?:helix|tray)\.config\.(?:m|c)?[jt]s$/,re=new Set;function ne(e,t){return x(e,{configFile:t})!==void 0}async function tt(e,t,r){if(ne(e.cwd,t))try{return{current:await y(e.cwd,{configFile:t}),initialLoadSucceeded:!0}}catch(n){return r(n,{phase:"reload"}),{current:T(),initialLoadSucceeded:!1}}if(e.watch){let n=t!==void 0?S(e.cwd,t):S(e.cwd);re.has(n)||(process.stderr.write(t!==void 0?`warning: config file ${S(e.cwd,t)} not found; tray running with default config
|
|
3
3
|
`:`warning: no helix.config.ts found at ${e.cwd}; tray running with default config \u2014 create one via \`helix init\`
|
|
4
|
-
`),
|
|
4
|
+
`),re.add(n))}return{current:T(),initialLoadSucceeded:!1}}var I=class{constructor(t,r,n,o){this.cwd=t;this.configFile=r;this.onError=n;this.emit=o}cwd;configFile;onError;emit;stopped=!1;directoryWatcher=null;c12Unwatch=null;c12AttachPromise=null;updateChain=Promise.resolve();start(t){t?this.attachC12Watcher():this.attachCreationWatcher()}watcherReady(){return this.c12AttachPromise===null?Promise.resolve():this.c12AttachPromise.catch(()=>{})}async stop(){this.stopped=!0,this.directoryWatcher&&(this.directoryWatcher.close(),this.directoryWatcher=null),this.c12AttachPromise&&await this.c12AttachPromise.catch(t=>this.onError(t,{phase:"attach"})),this.c12Unwatch&&(await this.c12Unwatch(),this.c12Unwatch=null)}attachC12Watcher(){this.c12AttachPromise===null&&(this.c12AttachPromise=Xe({...V(this.cwd,{configFile:this.configFile}),onUpdate:({newConfig:t})=>{this.stopped||(this.updateChain=this.updateChain.then(async()=>{if(this.stopped)return;let r;try{r=z(t.config,this.cwd)}catch(n){this.onError(n,{phase:"validation"});return}try{this.emit(r)}catch(n){this.onError(n,{phase:"reload"})}}))}}).then(async t=>{if(this.stopped){t.unwatch();return}this.c12Unwatch=t.unwatch;let{watch:r}=await import("chokidar"),n=r(this.cwd,{persistent:!1,depth:0});try{await new Promise((o,s)=>{n.once("ready",o),n.once("error",s)})}finally{await n.close()}}).catch(t=>{this.onError(t,{phase:"attach"})}))}attachCreationWatcher(){let t=this.configFile!==void 0?S(this.cwd,this.configFile):void 0,r=t!==void 0?Je(t):this.cwd;try{this.directoryWatcher=ze(r,{persistent:!1},(n,o)=>{if(this.stopped||!o)return;let s=o.toString();if(t!==void 0){if(s!==Ge(t))return}else if(!et.test(s))return;Ve(Qe(r,s))&&(this.updateChain=this.updateChain.then(async()=>{if(this.stopped)return;let d;try{d=await y(this.cwd,{configFile:this.configFile})}catch(a){this.onError(a,{phase:"reload"});return}if(this.stopped)return;this.emit(d);let i=this.directoryWatcher;i&&(this.directoryWatcher=null,i.close()),this.attachC12Watcher()}))}),this.directoryWatcher.on("error",n=>{this.onError(n,{phase:"attach"})})}catch(n){this.onError(n,{phase:"attach"})}}};async function rt(e){let t=e.onError??Ye,r=new Set,n=_(e.configFile),o=await tt(e,n,t),s=o.current;function d(a){s=a;for(let l of[...r])try{l(a)}catch(f){t(f,{phase:"reload"})}}let i=new I(e.cwd,n,t,d);return e.watch&&i.start(o.initialLoadSucceeded),{get(){return s},async reload(){if(!ne(e.cwd,n)){let a=T();return d(a),a}try{let a=await y(e.cwd,{configFile:n});return d(a),a}catch(a){return t(a,{phase:"reload"}),s}},subscribe(a){return r.add(a),()=>{r.delete(a)}},async stop(){r.clear(),await i.stop()},ready(){return i.watcherReady()}}}import{tool as Vt,dynamicTool as zt,jsonSchema as Bt,zodSchema as Gt,stepCountIs as Jt,hasToolCall as Qt,convertToModelMessages as Xt,cosineSimilarity as Yt,smoothStream as er,Output as tr}from"ai";export{fe as AI_SERVICES,me as HELIX_CONFIG_ENV,tr as Output,de as REGION_VALUES,Ce as SCHEDULE_DEFINITION_KIND,ve as ScheduleConfigError,he as WORKSPACE_ID_REQUIRED_CODE,pe as aiProviderEntrySchema,Xt as convertToModelMessages,Yt as cosineSimilarity,rt as createConfigService,Ke as defineConfig,Oe as defineFunction,we as defineSchedule,zt as dynamicTool,ie as getContext,E as getSdkConfig,Qt as hasToolCall,Se as isScheduleDefinition,Bt as jsonSchema,y as loadConfig,ge as loadedTrayConfigSchema,ce as projectIdSchema,ue as regionSchema,ye as requireWorkspaceId,x as resolveConfigFile,_ as resolveConfigOverride,ae as runWithinAppSpan,er as smoothStream,Jt as stepCountIs,Vt as tool,le as workspaceIdSchema,Gt as zodSchema};
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoadedTrayConfig } from '../
|
|
2
|
-
export {
|
|
1
|
+
import { L as LoadedTrayConfig } from '../config-loader-BqIGpFg8.js';
|
|
2
|
+
export { j as SdkConfigInput, s as setSdkConfig } from '../config-loader-BqIGpFg8.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/** BroadcastChannel name for parent→worker config updates. */
|
|
@@ -140,6 +140,24 @@ type SdkErrorDetail = {
|
|
|
140
140
|
readonly kind: "call_function_not_available";
|
|
141
141
|
} | {
|
|
142
142
|
readonly kind: "call_function_missing_execution_jwt";
|
|
143
|
+
} | {
|
|
144
|
+
readonly kind: "ai_unsupported_service";
|
|
145
|
+
alias: string;
|
|
146
|
+
service: string;
|
|
147
|
+
supported: string[];
|
|
148
|
+
} | {
|
|
149
|
+
readonly kind: "ai_model_id_required";
|
|
150
|
+
alias: string;
|
|
151
|
+
operation: string;
|
|
152
|
+
} | {
|
|
153
|
+
readonly kind: "ai_model_instance_required";
|
|
154
|
+
modelId: string;
|
|
155
|
+
} | {
|
|
156
|
+
readonly kind: "ai_provider_not_configured";
|
|
157
|
+
alias: string;
|
|
158
|
+
supported: string[];
|
|
159
|
+
} | {
|
|
160
|
+
readonly kind: "ai_foreign_model_rejected";
|
|
143
161
|
};
|
|
144
162
|
declare class SdkError extends Error {
|
|
145
163
|
readonly detail: SdkErrorDetail;
|
|
@@ -175,6 +193,11 @@ declare class SdkError extends Error {
|
|
|
175
193
|
static callFunctionRequiresProvisioning(): SdkError;
|
|
176
194
|
static callFunctionNotAvailable(): SdkError;
|
|
177
195
|
static callFunctionMissingExecutionJwt(): SdkError;
|
|
196
|
+
static aiUnsupportedService(alias: string, service: string, supported: string[]): SdkError;
|
|
197
|
+
static aiModelIdRequired(alias: string, operation: string): SdkError;
|
|
198
|
+
static aiModelInstanceRequired(modelId: string): SdkError;
|
|
199
|
+
static aiProviderNotConfigured(alias: string, supported: string[]): SdkError;
|
|
200
|
+
static aiForeignModelRejected(): SdkError;
|
|
178
201
|
}
|
|
179
202
|
declare function isSdkError(err: unknown): err is SdkError;
|
|
180
203
|
|
|
@@ -182,7 +205,7 @@ declare function isSdkError(err: unknown): err is SdkError;
|
|
|
182
205
|
declare function contentFilePath(projectRoot: string, path: string): string;
|
|
183
206
|
declare function metaFilePath(projectRoot: string, path: string): string;
|
|
184
207
|
|
|
185
|
-
interface
|
|
208
|
+
interface RegionHosts {
|
|
186
209
|
api: string;
|
|
187
210
|
broker: string;
|
|
188
211
|
ingest: string;
|
|
@@ -192,38 +215,38 @@ interface EnvironmentHosts {
|
|
|
192
215
|
dashboard: string;
|
|
193
216
|
auth?: string;
|
|
194
217
|
}
|
|
195
|
-
interface
|
|
218
|
+
interface RegionLoginInfo {
|
|
196
219
|
storePrefix: string;
|
|
197
220
|
appUrl: string;
|
|
198
221
|
cookieName: string;
|
|
199
222
|
cookieDomain: string;
|
|
200
223
|
}
|
|
201
|
-
interface
|
|
224
|
+
interface RegionProfile {
|
|
202
225
|
name: string;
|
|
203
226
|
exposedName: string;
|
|
204
227
|
displayName: string;
|
|
205
|
-
hosts:
|
|
206
|
-
login:
|
|
228
|
+
hosts: RegionHosts;
|
|
229
|
+
login: RegionLoginInfo;
|
|
207
230
|
}
|
|
208
231
|
/**
|
|
209
|
-
* Register
|
|
232
|
+
* Register a region profile. Idempotent when the same profile is
|
|
210
233
|
* registered again; throws if a different profile reuses the same `name` or
|
|
211
234
|
* `exposedName`.
|
|
212
235
|
*/
|
|
213
|
-
declare function
|
|
214
|
-
declare function
|
|
215
|
-
declare function
|
|
216
|
-
declare function
|
|
236
|
+
declare function registerRegionProfile(profile: RegionProfile): void;
|
|
237
|
+
declare function isKnownRegion(name: string): boolean;
|
|
238
|
+
declare function getRegionProfile(name: string): RegionProfile | undefined;
|
|
239
|
+
declare function requireRegionProfile(name: string): RegionProfile;
|
|
217
240
|
/** Internal config env names currently registered (includes built-ins). */
|
|
218
|
-
declare function
|
|
219
|
-
/** User-facing `--
|
|
220
|
-
declare function
|
|
221
|
-
/** Resolve user-facing `--
|
|
222
|
-
declare function
|
|
223
|
-
declare function
|
|
224
|
-
declare function
|
|
225
|
-
declare function
|
|
226
|
-
/** Test helper: drop non-builtin profiles and restore
|
|
227
|
-
declare function
|
|
241
|
+
declare function listRegionNames(): string[];
|
|
242
|
+
/** User-facing `--region` values for all registered profiles. */
|
|
243
|
+
declare function listExposedRegionNames(): string[];
|
|
244
|
+
/** Resolve user-facing `--region` value → internal region name. */
|
|
245
|
+
declare function parseExposedRegionName(value: string): string | undefined;
|
|
246
|
+
declare function setForcedRegion(name: string | undefined): void;
|
|
247
|
+
declare function resolveForcedRegion(): string | undefined;
|
|
248
|
+
declare function getAdditionalRegionProfiles(): RegionProfile[];
|
|
249
|
+
/** Test helper: drop non-builtin profiles and restore the built-in regions. */
|
|
250
|
+
declare function resetRegionRegistryForTests(): void;
|
|
228
251
|
|
|
229
|
-
export { CONFIG_BRIDGE_CHANNEL, DEV_TOKEN_BRIDGE_CHANNEL, type
|
|
252
|
+
export { CONFIG_BRIDGE_CHANNEL, DEV_TOKEN_BRIDGE_CHANNEL, type RegionProfile, type ScheduleInvocation, ScheduleInvocationError, assertValidPath, clearActiveConfig, contentFilePath, getActiveConfig, getAdditionalRegionProfiles, getRegionProfile, isKnownRegion, isSdkError, listExposedRegionNames, listRegionNames, metaFilePath, parseExposedRegionName, registerRegionProfile, requireRegionProfile, resetRegionRegistryForTests, resolveForcedRegion, runScheduledFunction, setActiveConfig, setForcedRegion };
|
package/dist/internal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{N as P,R as O,a as G,b as J,c as U,d as V,e as B,f as g,g as h,h as p,i as S,j as A,k as x,l as y,m as E,o as I,p as w,q as R,r as C,s as D,t as se,u as ie,v as ae,w as F,x as N}from"../chunk-CYG3GXE2.js";import{a as b}from"../chunk-WUCX7RZO.js";import{c as T,d as m,g as q,h as z,i as Q,j as W,k as X,l as Y,m as Z,n as ee,o as te,p as re,q as oe,s as ne}from"../chunk-HEA646WT.js";import{randomUUID as le}from"crypto";import{SpanStatusCode as k,SpanKind as ce}from"@opentelemetry/api";var r=class extends Error{constructor(e){super(`runScheduledFunction: ${e}`),this.name="ScheduleInvocationError"}};async function ue(i,e){if(typeof e!="object"||e===null)throw new r("`invocation` must be an object");let{schedulePath:o}=e;if(typeof o!="string"||o.length===0)throw new r("`schedulePath` must be a non-empty string");if(typeof e.isManual!="boolean")throw new r("`isManual` must be a boolean");if(!O(i))throw new r(`default export of "${o}" is not a defineSchedule definition`);let j=M("scheduledAt",e.scheduledAt),$=M("firedAt",e.firedAt),d=m(),a=d.executionId??le(),l=d.deploymentId??null,H=Date.now(),K=new Date().toISOString(),_=w(),v=I();A();let s={hasDb:!1,hasExternal:!1,hasAuth:!1,hasAi:!1,hasError:!1},c=!1,u=null;try{await h.run(s,()=>g.run(a,()=>y.startActiveSpan("schedule",{root:!0,kind:ce.SERVER,attributes:{method:"SCHEDULE",route:o,executionId:a,...l?{deploymentId:l}:{}}},async t=>{let L={type:"schedule",scheduledAt:j,firedAt:$,isManual:e.isManual},f={http:R(),db:n=>C(n),kv:()=>D(),files:()=>F(),callFunctionAsync:N(),ai:P(),log:v,config:_,state:{},executionId:a,deploymentId:l,traceId:t.spanContext().traceId,parentExecutionId:null,trigger:L};S(t,"input",{scheduledAt:e.scheduledAt,firedAt:e.firedAt,isManual:e.isManual});try{await b.run(f,()=>i.handler(f))}catch(n){throw c=!0,u=n instanceof Error?n.message:String(n),p("hasError"),n}finally{t.setAttribute("hasAuth",s.hasAuth),t.setAttribute("hasAi",s.hasAi),t.setAttribute("hasExternal",s.hasExternal),t.setAttribute("hasDb",s.hasDb),t.setAttribute("status",c?"error":"success");let n=c||s.hasError;t.setStatus({code:n?k.ERROR:k.OK,...u?{message:u}:{}}),t.end()}})))}finally{E({executionId:a,deploymentId:l,triggerType:"schedule",routeOrJob:o,startedAt:K,startMs:H,errored:c,errorMessage:u,userId:null,flags:s}),await x()}}function M(i,e){if(typeof e!="string"||e.length===0)throw new r(`\`${i}\` must be a timestamp string; got ${JSON.stringify(e)}`);let o=new Date(e);if(Number.isNaN(o.getTime()))throw new r(`\`${i}\` must be a Date-parseable timestamp; got ${JSON.stringify(e)}`);return o}export{G as CONFIG_BRIDGE_CHANNEL,J as DEV_TOKEN_BRIDGE_CHANNEL,r as ScheduleInvocationError,se as assertValidPath,B as clearActiveConfig,ie as contentFilePath,V as getActiveConfig,re as getAdditionalRegionProfiles,Q as getRegionProfile,z as isKnownRegion,ne as isSdkError,Y as listExposedRegionNames,X as listRegionNames,ae as metaFilePath,Z as parseExposedRegionName,q as registerRegionProfile,W as requireRegionProfile,oe as resetRegionRegistryForTests,te as resolveForcedRegion,ue as runScheduledFunction,U as setActiveConfig,ee as setForcedRegion,T as setSdkConfig};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Built-in regions shipped in the published SDK. */
|
|
4
|
+
declare const REGION_VALUES: readonly ["us1", "eu1", "ap1", "ap2"];
|
|
5
|
+
/** Runtime region name (built-ins plus any registered profiles). */
|
|
6
|
+
type Region = string;
|
|
7
|
+
declare const regionSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
8
|
+
|
|
9
|
+
export { type Region as R, REGION_VALUES as a, regionSchema as r };
|