@vite-hub/runtime 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/core-BfUEli_0.d.ts +304 -0
  2. package/dist/core-DpLK9dQt.js +1105 -0
  3. package/dist/durability.d.ts +2 -2
  4. package/dist/durability.js +4 -1
  5. package/dist/hosted-console-ZfMo5MW4.d.ts +30 -0
  6. package/dist/index-DsisbCNa.d.ts +364 -0
  7. package/dist/index.d.ts +7 -5
  8. package/dist/index.js +5 -4
  9. package/dist/internal/console.d.ts +7 -0
  10. package/dist/internal/console.js +2 -0
  11. package/dist/internal/context.d.ts +2 -0
  12. package/dist/internal/context.js +2 -0
  13. package/dist/internal/error-diagnostics.d.ts +2 -0
  14. package/dist/internal/error-diagnostics.js +2 -0
  15. package/dist/internal/execution-budget.d.ts +3 -2
  16. package/dist/internal/execution-budget.js +226 -1
  17. package/dist/internal/grant.js +1 -1
  18. package/dist/internal/h3.d.ts +2 -2
  19. package/dist/internal/h3.js +1 -7
  20. package/dist/internal/node.d.ts +1 -1
  21. package/dist/internal/public-url.d.ts +2 -2
  22. package/dist/internal/public-url.js +2 -2
  23. package/dist/internal/response.d.ts +2 -0
  24. package/dist/internal/response.js +2 -0
  25. package/dist/internal/run-failed.js +0 -1
  26. package/dist/internal/runtime-type.js +1 -1
  27. package/dist/internal/shutdown.js +17 -19
  28. package/dist/internal/test-mode-setup.js +0 -4
  29. package/dist/internal/trace.d.ts +6 -0
  30. package/dist/internal/trace.js +2 -0
  31. package/dist/operations.d.ts +8 -2
  32. package/dist/operations.js +6 -2
  33. package/dist/{public-url-1WeOw54Z.d.ts → public-url-BCFhTiTM.d.ts} +6 -1
  34. package/dist/{public-url-ByAmAjbP.js → public-url-DizC8CFs.js} +25 -17
  35. package/dist/request-context-Dmsliqan.js +687 -0
  36. package/dist/response-Be5M4WIn.js +432 -0
  37. package/dist/response-iONbTI0E.d.ts +33 -0
  38. package/dist/{runtime-type-BftydMAf.js → runtime-type-CHYQYwDx.js} +0 -7
  39. package/package.json +26 -1
  40. package/dist/index-C1DoYfCf.d.ts +0 -733
  41. package/dist/request-context-uRQpodgl.js +0 -2433
@@ -27,9 +27,9 @@ export interface DurabilityContext {
27
27
  env: Record<string, string | undefined>;
28
28
  /**
29
29
  * The report of another primitive in this server, such as the Database that a KV store keeps its rows in. `name`
30
- * defaults to the default store. `undefined` when that primitive is off.
30
+ * defaults to the default store. Pass `onlyIfUnambiguous` to fall back to the sole report when no default is set.
31
31
  */
32
- find: (primitive: string, name?: string) => Durability | undefined;
32
+ find: (primitive: string, name?: string, onlyIfUnambiguous?: boolean) => Durability | undefined;
33
33
  }
34
34
  /**
35
35
  * A primitive's durability reporter. The build passes the resolved configuration of the primitive as `input`. The
@@ -19,7 +19,10 @@ function collectDurability(entries, env) {
19
19
  };
20
20
  const context = {
21
21
  env,
22
- find: (primitive, name = "default") => entries.filter((entry) => entry.primitive === primitive).flatMap(run).find((report) => (report.name ?? "default") === name)
22
+ find: (primitive, name = "default", onlyIfUnambiguous = false) => {
23
+ const reports = entries.filter((entry) => entry.primitive === primitive).flatMap(run);
24
+ return reports.find((report) => (report.name ?? "default") === name) ?? (onlyIfUnambiguous && reports.length === 1 ? reports[0] : void 0);
25
+ }
23
26
  };
24
27
  return entries.flatMap((entry) => [...run(entry)]);
25
28
  }
@@ -0,0 +1,30 @@
1
+ //#region src/hosted-console.d.ts
2
+ /** The origin of the hosted Console. */
3
+ declare const hostedConsoleOrigin = "https://console.vitehub.dev";
4
+ /**
5
+ * The Console path of a link, such as `/agents/bot/invocations/abc?tab=trace`, or `undefined` when the value is not a
6
+ * Console path. A Console path starts with one `/`. Absolute URLs, protocol-relative URLs, and backslashes are not
7
+ * Console paths, so a link cannot send the browser to another site. A path that starts with `/_vitehub`, as on a
8
+ * Console that the app serves, loses that prefix.
9
+ */
10
+ declare function normalizeConsolePath(path: string): string | undefined;
11
+ /**
12
+ * The project URL of a link: the app origin and its application mount, such as `https://app.example.com/portal`, or
13
+ * `undefined` when the URL cannot be a project. A project URL is `https:`, or `http:` on a loopback host, and has no
14
+ * user name or password.
15
+ */
16
+ declare function normalizeConsoleProjectUrl(projectUrl: string): string | undefined;
17
+ /**
18
+ * The hosted Console URL that opens one page of a project, such as
19
+ * `https://console.vitehub.dev/open?project=https%3A%2F%2Fapp.example.com&path=%2Fkv`.
20
+ *
21
+ * `projectUrl` is the app origin with its application mount, such as `https://app.example.com/portal`. `path` is the
22
+ * Console path, such as `/agents/bot/invocations/abc`. The hosted Console switches to the project when this browser
23
+ * linked it, or asks the person to link it first. The URL holds no secret.
24
+ *
25
+ * Throws `RUNTIME_CONSOLE_PROJECT_URL_INVALID` when `projectUrl` is not `https:` (or `http:` on a loopback host), and
26
+ * `RUNTIME_CONSOLE_PATH_INVALID` when `path` is not a Console path.
27
+ */
28
+ declare function hostedConsoleUrl(projectUrl: string, path: string, consoleOrigin?: string): string;
29
+ //#endregion
30
+ export { normalizeConsoleProjectUrl as i, hostedConsoleUrl as n, normalizeConsolePath as r, hostedConsoleOrigin as t };
@@ -0,0 +1,364 @@
1
+ import { O as RuntimeContextInput, dt as ViteHubContext, g as MaybePromise, k as RuntimeHostContext, p as CreatedRuntimeContext, pt as ViteHubStandardProps } from "./core-BfUEli_0.js";
2
+ import "./execution-budget-BPXbISEt.js";
3
+ import { Diagnostic, DiagnosticDefinition, DiagnosticJSON, Diagnostics } from "nostics";
4
+ //#region src/result.d.ts
5
+ /**
6
+ * Error of a ViteHub operation. It is a Nostics diagnostic with a typed `code`.
7
+ *
8
+ * - `code` names the failure, for example `KV_INVALID_CURSOR`. `name` has the same code.
9
+ * - `why` tells what went wrong. `message` has the same text.
10
+ * - `fix` tells what to do next.
11
+ * - `docs` links to the code on vitehub.dev.
12
+ * - `cause` keeps the lower-level error, for example the provider error.
13
+ * - `data` keeps catalog metadata in memory. Its type is inferred by `defineErrors()`.
14
+ * - `status` is the HTTP status that `toResponse(error)` answers, when the catalog code sets one. Without it, 500.
15
+ */
16
+ interface ResultError<TCode extends string = string, TData = unknown> extends Diagnostic<TData, TCode> {
17
+ /** HTTP status of the code, for example 409 for a conflict. `toResponse(error)` answers 500 without it. */
18
+ readonly status?: number;
19
+ /** Retains the Nostics serializer type for compatibility; runtime JSON is redacted. */
20
+ toJSON(): DiagnosticJSON<TData> & {
21
+ code: TCode;
22
+ name: TCode;
23
+ why: string;
24
+ fix: string | undefined;
25
+ docs: string | undefined;
26
+ };
27
+ }
28
+ /**
29
+ * `[error, data]` tuple that each ViteHub runtime operation returns.
30
+ * Check `error` first. When `error` is `undefined`, `data` has the value.
31
+ */
32
+ type Result<TData, TCode extends string = string> = [error: ResultError<TCode>, data: undefined] | [error: undefined, data: TData];
33
+ /**
34
+ * Code map that `defineErrors()` accepts. `is` is reserved for `ErrorCatalog.is`.
35
+ * `status` is the HTTP status that `toResponse(error)` answers for the code, such as 409 for a conflict. Without it, 500.
36
+ */
37
+ type ErrorCodes = Record<string, DiagnosticDefinition & {
38
+ status?: number;
39
+ }> & {
40
+ is?: never;
41
+ };
42
+ type CatalogCode<TCodes> = Exclude<keyof TCodes, "is"> & string;
43
+ type CatalogHandles<TCodes extends Record<string, DiagnosticDefinition>> = Diagnostics<TCodes, []>;
44
+ type CatalogData<TCodes extends Record<string, DiagnosticDefinition>, TCode extends CatalogCode<TCodes>> = ReturnType<CatalogHandles<TCodes>[TCode]>["data"];
45
+ /** One code of an error catalog. Call it to create the error, or use `is` to check an error. */
46
+ interface ErrorHandle<TArgs extends unknown[], TCode extends string, TData> {
47
+ (...args: TArgs): ResultError<TCode, TData>;
48
+ /**
49
+ * Checks if `error` is a live Nostics error with this code, and narrows its `data`.
50
+ * It reads `code`, so it also accepts an error from another copy of the package or another realm.
51
+ * Safe to pass unbound, for example `errors.filter(catalog.CODE.is)`.
52
+ */
53
+ is: (error: unknown) => error is ResultError<TCode, TData>;
54
+ }
55
+ /**
56
+ * Error catalog of one package. Each code creates a `ResultError` with that code.
57
+ * `is` checks if an error has a code of this catalog. `is` is not enumerable, so `Object.keys()` gives only the codes.
58
+ * Use `InferDiagnosticCodes<typeof catalog>` from `nostics` for the union of the codes.
59
+ */
60
+ type ErrorCatalog<TCodes extends Record<string, DiagnosticDefinition>> = {
61
+ /**
62
+ * Checks if `error` is a live Nostics error with a code of this catalog, and narrows its `code` and `data`.
63
+ * It reads `code`, so it also accepts an error from another copy of the package or another realm.
64
+ */
65
+ is: (error: unknown) => error is { [TCode in CatalogCode<TCodes>]: ResultError<TCode, CatalogData<TCodes, TCode>>; }[CatalogCode<TCodes>];
66
+ } & { [TCode in CatalogCode<TCodes>]: ErrorHandle<Parameters<CatalogHandles<TCodes>[TCode]>, TCode, CatalogData<TCodes, TCode>>; };
67
+ interface DefineErrorsOptions<TCodes extends Record<string, DiagnosticDefinition>> {
68
+ /** Each code with a `why` and a `fix`, and an optional HTTP `status`. */
69
+ codes: TCodes;
70
+ /** Base URL of the diagnostics pages, which have one page for each code. The `docs` URL of an error is `<docs>/<code in lowercase>`. */
71
+ docs: string;
72
+ }
73
+ /**
74
+ * Prepares a recognized diagnostic for a result, keeping its metadata in memory.
75
+ * Reuses mutable diagnostics; copies diagnostics whose name or serializer cannot be replaced.
76
+ * Sets name to code to match the result contract, including diagnostics renamed by their owner.
77
+ * The caller owns code allowlisting and the public text. JSON includes only the public fields.
78
+ */
79
+ declare function toResultError<TCode extends string, TData>(error: (Diagnostic<TData> | ResultError<string, TData>) & {
80
+ readonly code: TCode;
81
+ }): ResultError<TCode, TData>;
82
+ /**
83
+ * Defines the error catalog of a package with Nostics.
84
+ * Return runtime errors as `[error, undefined]`. Throw definition and config errors.
85
+ */
86
+ declare function defineErrors<const TCodes extends ErrorCodes>(options: DefineErrorsOptions<TCodes>): ErrorCatalog<TCodes>;
87
+ //#endregion
88
+ //#region src/lease.d.ts
89
+ type LeaseOperation = "acquire" | "get" | "release" | "renew";
90
+ /** The codes that lease operations return. */
91
+ type LeaseErrorCode = "RUNTIME_LEASE_FAILED" | "RUNTIME_LEASE_INVALID_TTL";
92
+ /** One live lease as the store keeps it. */
93
+ interface LeaseRecord {
94
+ /** The value that the caller locks, such as `schedule:daily:2026-11-09`. */
95
+ key: string;
96
+ /** A new random ID for each acquire. Release and renew act only when the stored ID is still this one. */
97
+ id: string;
98
+ /** The label from `acquire()`, such as an instance name. It is for inspection only. */
99
+ owner?: string;
100
+ /** When the lease ends, from the clock of the store. */
101
+ expiresAt: Date;
102
+ }
103
+ /** A lease that this caller holds. */
104
+ interface Lease extends LeaseRecord {
105
+ /**
106
+ * Moves the end of the lease to `ttl` seconds from now. The default is the TTL of `acquire()`. Resolves `false` when
107
+ * the lease is no longer this caller's, because another caller acquired it after it expired. On `true`, `expiresAt`
108
+ * has the new end.
109
+ */
110
+ renew(options?: {
111
+ ttl?: number;
112
+ }): Promise<Result<boolean, LeaseErrorCode>>;
113
+ /** Frees the lease. Resolves `false` and changes nothing when another caller holds the key now. */
114
+ release(): Promise<Result<boolean, "RUNTIME_LEASE_FAILED">>;
115
+ }
116
+ interface LeaseAcquireOptions {
117
+ /** Seconds until the lease ends when the holder does not renew or release it. Fractions are allowed. */
118
+ ttl: number;
119
+ /** A label for the holder. The default is `getInstanceId()`. Acquire does not compare it. */
120
+ owner?: string;
121
+ }
122
+ /**
123
+ * Gives one caller at a time a lease on a key. A lease ends at `release()` or when its TTL passes, so a holder that
124
+ * crashes blocks the key only until then. Leases are not reentrant: a held key refuses every other acquire, also from
125
+ * the same owner.
126
+ */
127
+ interface LeaseStore {
128
+ /** Takes the lease when the key is free or its lease expired. Resolves `null` when another caller holds it. */
129
+ acquire(key: string, options: LeaseAcquireOptions): Promise<Result<Lease | null, LeaseErrorCode>>;
130
+ /** The live lease on the key, or `null`. */
131
+ get(key: string): Promise<Result<LeaseRecord | null, "RUNTIME_LEASE_FAILED">>;
132
+ }
133
+ /**
134
+ * Leases in the memory of this process. Use it for one instance and for tests. Several instances need a shared store,
135
+ * such as `createSqlLeaseStore()`.
136
+ */
137
+ declare function createMemoryLeaseStore(): LeaseStore;
138
+ /**
139
+ * The SQL connection that `createSqlLeaseStore()` uses. `query()` runs one statement with positional parameters and
140
+ * resolves its rows as objects keyed by column name.
141
+ *
142
+ * - `postgresql`: the SQL text uses `$1`, `$2`, and so on, like postgres.js `sql.unsafe(text, params)`.
143
+ * - `sqlite`: the SQL text uses `?`, like libSQL `client.execute({ sql, args })`. The store runs a statement that fails
144
+ * with `SQLITE_BUSY` again. Across several processes, use Postgres, remote libSQL, or `node:sqlite`. A local libSQL
145
+ * `file:` client is for one process only: after `SQLITE_BUSY` it can lose writes that it reported as done.
146
+ */
147
+ interface LeaseSqlClient {
148
+ dialect: "postgresql" | "sqlite";
149
+ query(sql: string, params: LeaseSqlParam[]): Promise<readonly Record<string, unknown>[]>;
150
+ }
151
+ /** The parameter values that the lease statements pass. */
152
+ type LeaseSqlParam = string | number | null;
153
+ /**
154
+ * Leases in a SQL table, shared by every process that uses the same Database. Each operation is one statement, so
155
+ * two processes that acquire a key at the same time get one winner. Expiry uses the clock of the Database, not the
156
+ * clocks of the hosts. Works on Postgres and on SQLite 3.35 or later, such as libSQL.
157
+ */
158
+ declare function createSqlLeaseStore(client: LeaseSqlClient): LeaseStore;
159
+ //#endregion
160
+ //#region src/instance.d.ts
161
+ /** The environment variable that names this server instance. */
162
+ declare const instanceIdEnv = "VITEHUB_INSTANCE_ID";
163
+ /**
164
+ * The owner label of this server instance: `VITEHUB_INSTANCE_ID` when it is set, else `<hostname>:<pid>:<random>`, made
165
+ * once for each process. Leases record it as their `owner`, and Agent Invocation claims start with it, so you can see
166
+ * which instance holds a key or runs an Invocation. Give each instance its own value, such as the pod or machine name.
167
+ */
168
+ declare function getInstanceId(): string;
169
+ //#endregion
170
+ //#region src/duration.d.ts
171
+ /** The units of a {@link Duration}, short and long. Case does not matter at runtime. */
172
+ type DurationUnit = "ms" | "millisecond" | "milliseconds" | "s" | "sec" | "secs" | "second" | "seconds" | "m" | "min" | "mins" | "minute" | "minutes" | "h" | "hr" | "hrs" | "hour" | "hours" | "d" | "day" | "days" | "w" | "week" | "weeks";
173
+ /** A length of time as a number and a unit, such as `"30s"`, `"5m"`, `"2 hours"`, or `"1 day"`. */
174
+ type Duration = `${number}${DurationUnit}` | `${number} ${DurationUnit}`;
175
+ /**
176
+ * Reads a {@link Duration} such as `"30s"`, `"5m"`, or `"1 day"` and returns its milliseconds. A number, a negative
177
+ * value, an unknown unit, or a value too large for a number throws `RUNTIME_DURATION_INVALID`. Pass `option`, such as
178
+ * `"debounce"`, so the error names the option. Pass `"ceil"` to round up to whole milliseconds before converting
179
+ * to a number. For a number, the fix shows the same time as a string. Pass `"s"` as `legacyUnit` when the option took a
180
+ * number of seconds before, so `60` gets the fix `"1m"` and not `"60ms"`. It changes only the fix text.
181
+ *
182
+ * ```ts
183
+ * parseDuration("90s") // 90000
184
+ * parseDuration("1 day") // 86400000
185
+ * ```
186
+ */
187
+ declare function parseDuration(value: Duration, option?: string, round?: "ceil", legacyUnit?: "ms" | "s"): number;
188
+ //#endregion
189
+ //#region src/diagnostics.d.ts
190
+ type RuntimeDiagnosticLevel = "debug" | "error" | "info" | "warn";
191
+ type RuntimeResourceScope = "container" | "host" | "process" | "service" | "workload";
192
+ type RuntimeResourceUnit = "bytes" | "count" | "microseconds" | "ratio";
193
+ interface RuntimeDiagnosticError {
194
+ cause?: RuntimeDiagnosticError;
195
+ code?: number | string;
196
+ details?: Readonly<Record<string, unknown>>;
197
+ docs?: string;
198
+ errors?: readonly RuntimeDiagnosticError[];
199
+ fix?: string;
200
+ message: string;
201
+ name?: string;
202
+ requestId?: string;
203
+ sources?: readonly string[];
204
+ stack?: string;
205
+ status?: number | string;
206
+ statusCode?: number | string;
207
+ }
208
+ interface RuntimeDiagnosticEvent {
209
+ attributes?: Readonly<Record<string, unknown>>;
210
+ component: string;
211
+ error?: RuntimeDiagnosticError;
212
+ level: RuntimeDiagnosticLevel;
213
+ name: string;
214
+ timestamp: string;
215
+ }
216
+ type RuntimeDiagnosticReporter = (event: RuntimeDiagnosticEvent) => MaybePromise<void>;
217
+ interface RuntimeResourceObservation {
218
+ name: string;
219
+ scope: RuntimeResourceScope;
220
+ source: string;
221
+ unit: RuntimeResourceUnit;
222
+ value: number;
223
+ }
224
+ interface RuntimeResourceSupport {
225
+ reason?: "collection-failed" | "not-isolated" | "permission-denied" | "unsupported-runtime" | (string & {});
226
+ scope: RuntimeResourceScope;
227
+ source: string;
228
+ supported: boolean;
229
+ }
230
+ interface RuntimeResourceSnapshot {
231
+ observedAt: string;
232
+ observations: readonly RuntimeResourceObservation[];
233
+ support?: readonly RuntimeResourceSupport[];
234
+ }
235
+ interface RuntimeResourceInspector {
236
+ inspect(options?: {
237
+ signal?: AbortSignal;
238
+ }): MaybePromise<RuntimeResourceSnapshot>;
239
+ }
240
+ interface RuntimeDiagnosticErrorOptions {
241
+ includeStack?: boolean;
242
+ maxDepth?: number;
243
+ maxErrors?: number;
244
+ maxStringLength?: number;
245
+ }
246
+ /**
247
+ * Recognizes a live Nostics error across bundled copies. This does not make its fields safe for public responses.
248
+ * nostics' own check matches only its own copy (https://github.com/vercel-labs/nostics/pull/40).
249
+ */
250
+ declare function isRuntimeDiagnostic(error: unknown): error is Diagnostic<unknown> | ResultError;
251
+ /** Formats bounded developer diagnostics without exposing causes or stacks. */
252
+ declare function formatRuntimeDiagnosticError(error: unknown): string;
253
+ declare function normalizeRuntimeDiagnosticError(error: unknown, options?: RuntimeDiagnosticErrorOptions): RuntimeDiagnosticError;
254
+ //#endregion
255
+ //#region src/errors.d.ts
256
+ type ViteHubErrorDetail = boolean | null | number | string | readonly ViteHubErrorDetail[] | {
257
+ readonly [key: string]: ViteHubErrorDetail | undefined;
258
+ };
259
+ type ViteHubErrorDetails = Readonly<Record<string, ViteHubErrorDetail | undefined>>;
260
+ interface ViteHubErrorShape<TCode extends string = string, TDetails extends ViteHubErrorDetails = ViteHubErrorDetails> {
261
+ code: TCode;
262
+ details?: TDetails;
263
+ message: string;
264
+ name: "ViteHubError";
265
+ requestId?: string;
266
+ }
267
+ interface ViteHubErrorOptions<TDetails extends ViteHubErrorDetails = ViteHubErrorDetails> extends ErrorOptions {
268
+ details?: TDetails;
269
+ requestId?: string;
270
+ }
271
+ declare class ViteHubError<TCode extends string = string, TDetails extends ViteHubErrorDetails = ViteHubErrorDetails> extends Error {
272
+ readonly code: TCode;
273
+ readonly details?: TDetails;
274
+ readonly requestId?: string;
275
+ constructor(code: TCode, message: string, options?: ViteHubErrorOptions<TDetails>);
276
+ toJSON(): ViteHubErrorShape<TCode, TDetails>;
277
+ }
278
+ declare function getViteHubErrorShape(value: unknown): ViteHubErrorShape | undefined;
279
+ declare function isViteHubError(value: unknown): value is ViteHubErrorShape;
280
+ //#endregion
281
+ //#region src/request-context.d.ts
282
+ type RuntimeName = "cloudflare-agents" | "deno" | "unknown" | "vercel" | "vite";
283
+ type RuntimeContextOptions = Omit<RuntimeContextInput, "event" | "runtime"> & {
284
+ runtime?: RuntimeName;
285
+ };
286
+ type RequestRuntimeContext<TOptions extends RuntimeContextOptions = {}> = CreatedRuntimeContext<TOptions & {
287
+ cloudflare?: RuntimeHostContext["cloudflare"];
288
+ event: ViteHubContext;
289
+ request: Request;
290
+ runtime: RuntimeName;
291
+ vercel?: RuntimeHostContext["vercel"];
292
+ }>;
293
+ /** Keep one Standard Context per Request, even when it cannot be extended. A value set by the host stays. */
294
+ declare function installRequestStandardContext(request: Request, standard?: ViteHubStandardProps): ViteHubStandardProps;
295
+ /**
296
+ * Return the Standard Context of a web Request or of a request event. In a Fetchable server entry, pass the
297
+ * Request: `getStandardContext(request)`. In a ViteHub app, Nitro sets `~standard` on each event and on its
298
+ * Request, so ViteHub keeps the response headers that primitives set. Throws `RUNTIME_R0015` for an event without
299
+ * Standard Context.
300
+ */
301
+ declare function getStandardContext(value: Request | ViteHubContext): ViteHubStandardProps;
302
+ /**
303
+ * Adds the prepared response of a plain Fetch host to the Response that a ViteHub route returns, as H3 adds it in a
304
+ * ViteHub app: `set-cookie` values join the ones of the Response, and other headers replace them. The headers move,
305
+ * so a host that also copies `res.headers` does not send them twice. With another vendor, such as H3, the host adds
306
+ * the prepared response, and `response` comes back as it is.
307
+ */
308
+ declare function sendPreparedResponse(request: Request, response: Response): Response;
309
+ /**
310
+ * Adapt one request. Pass the Request of a Fetchable handler or the event of a ViteHub app.
311
+ * Await `flushWaitUntil()` when the host has no lifetime API.
312
+ */
313
+ declare function getRuntimeContext(value: Request | ViteHubContext): RequestRuntimeContext;
314
+ declare function getRuntimeContext<const TOptions extends RuntimeContextOptions>(value: Request | ViteHubContext, options: TOptions): RequestRuntimeContext<TOptions>;
315
+ //#endregion
316
+ //#region ../internal/dist/deployment.d.ts
317
+ //#region src/deployment.d.ts
318
+ /** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
319
+ type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
320
+ //#endregion
321
+ //#region src/host.d.ts
322
+ declare global {
323
+ namespace Cloudflare {
324
+ interface Env {}
325
+ }
326
+ }
327
+ /** The codes that `getHostBinding()` returns. */
328
+ type HostBindingErrorCode = "RUNTIME_HOST_BINDING_NOT_FOUND" | "RUNTIME_HOST_BINDINGS_UNAVAILABLE";
329
+ /**
330
+ * Returns the host that this code builds or runs on, or `undefined` when nothing names one.
331
+ * It reads `VITEHUB_HOST`, `NITRO_PRESET`, `SERVER_PRESET`, then the build variables of Cloudflare Workers Builds
332
+ * (`WORKERS_CI`), Netlify, Vercel, and Deno Deploy. Inside a Cloudflare Worker, it returns `"cloudflare"`.
333
+ * `vitehub()` uses the same detection when `host` is omitted.
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * import { detectHost } from "vite-hub/runtime"
338
+ *
339
+ * const host = detectHost() ?? "node"
340
+ * ```
341
+ */
342
+ declare function detectHost(env?: Record<string, string | undefined>): ViteHubHost | undefined;
343
+ /**
344
+ * Reads one raw binding of the host, such as an R2 bucket, a Durable Object namespace, or a variable of a Cloudflare
345
+ * Worker. Use it for host features that no ViteHub primitive covers. It works in request handlers, Schedules, Queues,
346
+ * and Workflows. Pass the request `event` when you have one: an H3 event, a Standard Context, or a host context with `env`.
347
+ *
348
+ * Run `wrangler types` to type the result from the app's bindings.
349
+ * Returns `RUNTIME_HOST_BINDINGS_UNAVAILABLE` when the code runs without host bindings, such as on Node, and
350
+ * `RUNTIME_HOST_BINDING_NOT_FOUND` when the Worker has no binding with that name.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * import { getHostBinding } from "vite-hub/runtime"
355
+ *
356
+ * const [error, bucket] = getHostBinding("VIDEOS", event)
357
+ * if (error) return new Response(null, { status: 404 })
358
+ * const object = await bucket.get("intro.mp4")
359
+ * ```
360
+ */
361
+ declare function getHostBinding<TName extends keyof Cloudflare.Env & string>(name: TName, event?: object): Result<Cloudflare.Env[TName], HostBindingErrorCode>;
362
+ declare function getHostBinding<T = unknown>(name: string, event?: object): Result<T, HostBindingErrorCode>;
363
+ //#endregion
364
+ export { ResultError as $, formatRuntimeDiagnosticError as A, LeaseErrorCode as B, RuntimeDiagnosticReporter as C, RuntimeResourceSnapshot as D, RuntimeResourceScope as E, parseDuration as F, LeaseStore as G, LeaseRecord as H, getInstanceId as I, DefineErrorsOptions as J, createMemoryLeaseStore as K, instanceIdEnv as L, normalizeRuntimeDiagnosticError as M, Duration as N, RuntimeResourceSupport as O, DurationUnit as P, Result as Q, Lease as R, RuntimeDiagnosticLevel as S, RuntimeResourceObservation as T, LeaseSqlClient as U, LeaseOperation as V, LeaseSqlParam as W, ErrorCodes as X, ErrorCatalog as Y, ErrorHandle as Z, getViteHubErrorShape as _, RequestRuntimeContext as a, RuntimeDiagnosticErrorOptions as b, getRuntimeContext as c, sendPreparedResponse as d, defineErrors as et, ViteHubError as f, ViteHubErrorShape as g, ViteHubErrorOptions as h, ViteHubHost as i, isRuntimeDiagnostic as j, RuntimeResourceUnit as k, getStandardContext as l, ViteHubErrorDetails as m, detectHost as n, RuntimeContextOptions as o, ViteHubErrorDetail as p, createSqlLeaseStore as q, getHostBinding as r, RuntimeName as s, HostBindingErrorCode as t, toResultError as tt, installRequestStandardContext as u, isViteHubError as v, RuntimeResourceInspector as w, RuntimeDiagnosticEvent as x, RuntimeDiagnosticError as y, LeaseAcquireOptions as z };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { t as runtimeErrorDiagnostics } from "./error-diagnostics-0sYgKTT8.js";
2
- import { $ as emitTraceEvent, $t as decodeRouteSegment, A as RuntimeWaitUntil, At as ViteHubErrorDetails, B as TraceEventLogOptions, Bt as RuntimeResourceInspector, C as PolicyDecision, Cn as isTraceContentAttributeKey, Ct as RuntimeName, D as RuntimeCapabilityHandle, E as RuntimeCapabilities, En as ViteHubStandardProps, F as TraceContext, Ft as RuntimeDiagnosticError, G as TraceStepStatus, Gt as RuntimeResourceUnit, H as TracePayloadVisibility, Ht as RuntimeResourceScope, I as TraceEvent, It as RuntimeDiagnosticErrorOptions, J as createRuntimeContext, Jt as normalizeRuntimeDiagnosticError, K as TraceStepView, Kt as formatRuntimeDiagnosticError, L as TraceEventContentPolicy, Lt as RuntimeDiagnosticEvent, M as TraceActivityContext, Mt as ViteHubErrorShape, N as TraceActivityOwner, Nt as getViteHubErrorShape, O as RuntimeContextInput, Ot as ViteHubError, P as TraceActivityPhase, Pt as isViteHubError, Q as deriveTraceRuns, Qt as normalizeConsoleProjectUrl, R as TraceEventLog, Rt as RuntimeDiagnosticLevel, S as PolicyContext, Sn as toResultError, St as RuntimeContextOptions, T as RunLifecycleHooks, Tn as ViteHubRuntime, Tt as getStandardContext, U as TraceRunStatus, Ut as RuntimeResourceSnapshot, V as TraceEventPayload, Vt as RuntimeResourceObservation, W as TraceRunView, Wt as RuntimeResourceSupport, X as createTraceEventLog, Xt as hostedConsoleUrl, Y as createRuntimeWaitUntilController, Yt as hostedConsoleOrigin, Z as defineCapability, Zt as normalizeConsolePath, _ as MaybeResolvable, _n as ErrorCodes, _t as isResponse, a as AnonymousAccessAuthorizationContext, an as LeaseAcquireOptions, at as normalizeExecutionAuthority, b as OpenTelemetrySpanView, bn as ResultError, bt as toResponse, c as ApprovalRequest, cn as LeaseRecord, ct as traceEventsToOpenTelemetryLogRecords, d as CapabilityHandle, dn as LeaseStore, dt as HostBindingErrorCode, en as encodeRouteSegment, et as getCapability, f as CapabilityPolicy, fn as createMemoryLeaseStore, ft as detectHost, g as MaybePromise, gn as ErrorCatalog, gt as deserializeResponse, h as ExecutionContext, hn as DefineErrorsOptions, ht as SerializedResponse, i as AccessAuthorizeResult, in as Lease, it as noExecutionAuthority, j as RuntimeWaitUntilController, jt as ViteHubErrorOptions, k as RuntimeHostContext, kt as ViteHubErrorDetail, l as ApprovalState, ln as LeaseSqlClient, lt as traceEventsToOpenTelemetrySpans, m as ExecutionAuthority, mn as leaseTable, mt as ViteHubHost, n as AccessAuthorize, nn as DurationUnit, nt as isExecutionAuthority, o as AnonymousAccessAuthorize, on as LeaseErrorCode, ot as resolveCapabilityPolicy, p as CreatedRuntimeContext, pn as createSqlLeaseStore, pt as getHostBinding, q as createExecutionContext, qt as isRuntimeDiagnostic, r as AccessAuthorizeOption, rn as parseDuration, rt as isResolvable, s as ApprovalDecision, sn as LeaseOperation, st as resolveRuntimeValue, t as AccessAuthorizationContext, tn as Duration, tt as hasCapability, u as CapabilityDefinition, un as LeaseSqlParam, ut as unknownExecutionAuthority, v as OpenTelemetryLogRecordView, vn as ErrorHandle, vt as isSerializedResponse, w as Resolvable, wn as ViteHubContext, wt as getRuntimeContext, x as OpenTelemetrySpanViewOptions, xn as defineErrors, xt as RequestRuntimeContext, y as OpenTelemetrySpanEventView, yn as Result, yt as serializeResponse, z as TraceEventLogEntry, zt as RuntimeDiagnosticReporter } from "./index-C1DoYfCf.js";
3
- import { a as ExecutionBudgetOptions, c as createExecutionBudget, i as ExecutionBudgetLimits, l as isExecutionBudgetExceededError, n as ExecutionBudgetCounter, o as ExecutionBudgetSnapshot, r as ExecutionBudgetExceededError, s as ExecutionBudgetUsage, t as ExecutionBudget } from "./execution-budget-BPXbISEt.js";
4
- import { a as resolvePublicUrl, n as consoleInvocationUrl, t as PublicUrlConfig } from "./public-url-1WeOw54Z.js";
5
- export { AccessAuthorizationContext, AccessAuthorize, AccessAuthorizeOption, AccessAuthorizeResult, AnonymousAccessAuthorizationContext, AnonymousAccessAuthorize, ApprovalDecision, ApprovalRequest, ApprovalState, CapabilityDefinition, CapabilityHandle, CapabilityPolicy, CreatedRuntimeContext, type DefineErrorsOptions, type Duration, type DurationUnit, type ErrorCatalog, type ErrorCodes, type ErrorHandle, ExecutionAuthority, type ExecutionBudget, type ExecutionBudgetCounter, type ExecutionBudgetExceededError, type ExecutionBudgetLimits, type ExecutionBudgetOptions, type ExecutionBudgetSnapshot, type ExecutionBudgetUsage, ExecutionContext, type HostBindingErrorCode, type Lease, type LeaseAcquireOptions, type LeaseErrorCode, type LeaseOperation, type LeaseRecord, type LeaseSqlClient, type LeaseSqlParam, type LeaseStore, MaybePromise, MaybeResolvable, OpenTelemetryLogRecordView, OpenTelemetrySpanEventView, OpenTelemetrySpanView, OpenTelemetrySpanViewOptions, PolicyContext, PolicyDecision, type PublicUrlConfig, type RequestRuntimeContext, Resolvable, type Result, type ResultError, RunLifecycleHooks, RuntimeCapabilities, RuntimeCapabilityHandle, RuntimeContextInput, type RuntimeContextOptions, type RuntimeDiagnosticError, type RuntimeDiagnosticErrorOptions, type RuntimeDiagnosticEvent, type RuntimeDiagnosticLevel, type RuntimeDiagnosticReporter, RuntimeHostContext, type RuntimeName, type RuntimeResourceInspector, type RuntimeResourceObservation, type RuntimeResourceScope, type RuntimeResourceSnapshot, type RuntimeResourceSupport, type RuntimeResourceUnit, RuntimeWaitUntil, RuntimeWaitUntilController, type SerializedResponse, TraceActivityContext, TraceActivityOwner, TraceActivityPhase, TraceContext, TraceEvent, TraceEventContentPolicy, TraceEventLog, TraceEventLogEntry, TraceEventLogOptions, TraceEventPayload, TracePayloadVisibility, TraceRunStatus, TraceRunView, TraceStepStatus, TraceStepView, type ViteHubContext, ViteHubError, type ViteHubErrorDetail, type ViteHubErrorDetails, type ViteHubErrorOptions, type ViteHubErrorShape, type ViteHubHost, type ViteHubRuntime, type ViteHubStandardProps, consoleInvocationUrl, createExecutionBudget, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createRuntimeWaitUntilController, createSqlLeaseStore, createTraceEventLog, decodeRouteSegment, defineCapability, defineErrors, deriveTraceRuns, deserializeResponse, detectHost, emitTraceEvent, encodeRouteSegment, formatRuntimeDiagnosticError, getCapability, getHostBinding, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleOrigin, hostedConsoleUrl, isExecutionAuthority, isExecutionBudgetExceededError, isResolvable, isResponse, isRuntimeDiagnostic, isSerializedResponse, isTraceContentAttributeKey, isViteHubError, leaseTable, noExecutionAuthority, normalizeConsolePath, normalizeConsoleProjectUrl, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, resolveRuntimeValue, runtimeErrorDiagnostics, serializeResponse, toResponse, toResultError, traceEventsToOpenTelemetryLogRecords, traceEventsToOpenTelemetrySpans, unknownExecutionAuthority };
1
+ import { A as RuntimeWaitUntil, B as TraceEventLogOptions, C as PolicyDecision, D as RuntimeCapabilityHandle, E as RuntimeCapabilities, F as TraceContext, G as TraceStepStatus, H as TracePayloadVisibility, I as TraceEvent, J as createRuntimeContext, K as TraceStepView, L as TraceEventContentPolicy, M as TraceActivityContext, N as TraceActivityOwner, O as RuntimeContextInput, P as TraceActivityPhase, Q as deriveTraceRuns, R as TraceEventLog, S as PolicyContext, T as RunLifecycleHooks, U as TraceRunStatus, V as TraceEventPayload, W as TraceRunView, X as createTraceEventLog, Z as defineCapability, _ as MaybeResolvable, a as AnonymousAccessAuthorizationContext, at as normalizeExecutionAuthority, b as OpenTelemetrySpanView, c as ApprovalRequest, d as CapabilityHandle, dt as ViteHubContext, et as getCapability, f as CapabilityPolicy, ft as ViteHubRuntime, g as MaybePromise, h as ExecutionContext, i as AccessAuthorizeResult, it as noExecutionAuthority, j as RuntimeWaitUntilController, k as RuntimeHostContext, l as ApprovalState, m as ExecutionAuthority, n as AccessAuthorize, nt as isExecutionAuthority, o as AnonymousAccessAuthorize, ot as resolveCapabilityPolicy, p as CreatedRuntimeContext, pt as ViteHubStandardProps, q as createExecutionContext, r as AccessAuthorizeOption, s as ApprovalDecision, t as AccessAuthorizationContext, tt as hasCapability, u as CapabilityDefinition, ut as unknownExecutionAuthority, v as OpenTelemetryLogRecordView, w as Resolvable, x as OpenTelemetrySpanViewOptions, y as OpenTelemetrySpanEventView, z as TraceEventLogEntry } from "./core-BfUEli_0.js";
2
+ import { $ as ResultError, A as formatRuntimeDiagnosticError, B as LeaseErrorCode, C as RuntimeDiagnosticReporter, D as RuntimeResourceSnapshot, E as RuntimeResourceScope, F as parseDuration, G as LeaseStore, H as LeaseRecord, I as getInstanceId, J as DefineErrorsOptions, K as createMemoryLeaseStore, L as instanceIdEnv, M as normalizeRuntimeDiagnosticError, N as Duration, O as RuntimeResourceSupport, P as DurationUnit, Q as Result, R as Lease, S as RuntimeDiagnosticLevel, T as RuntimeResourceObservation, U as LeaseSqlClient, V as LeaseOperation, W as LeaseSqlParam, X as ErrorCodes, Y as ErrorCatalog, Z as ErrorHandle, _ as getViteHubErrorShape, a as RequestRuntimeContext, b as RuntimeDiagnosticErrorOptions, c as getRuntimeContext, et as defineErrors, f as ViteHubError, g as ViteHubErrorShape, h as ViteHubErrorOptions, i as ViteHubHost, j as isRuntimeDiagnostic, k as RuntimeResourceUnit, l as getStandardContext, m as ViteHubErrorDetails, n as detectHost, o as RuntimeContextOptions, p as ViteHubErrorDetail, q as createSqlLeaseStore, r as getHostBinding, s as RuntimeName, t as HostBindingErrorCode, tt as toResultError, v as isViteHubError, w as RuntimeResourceInspector, x as RuntimeDiagnosticEvent, y as RuntimeDiagnosticError, z as LeaseAcquireOptions } from "./index-DsisbCNa.js";
3
+ import { n as hostedConsoleUrl } from "./hosted-console-ZfMo5MW4.js";
4
+ import { o as resolvePublicUrl, t as PublicUrlConfig } from "./public-url-BCFhTiTM.js";
5
+ import { a as ExecutionBudgetOptions, i as ExecutionBudgetLimits, n as ExecutionBudgetCounter, o as ExecutionBudgetSnapshot, r as ExecutionBudgetExceededError, s as ExecutionBudgetUsage, t as ExecutionBudget } from "./execution-budget-BPXbISEt.js";
6
+ import { o as toResponse, t as SerializedResponse } from "./response-iONbTI0E.js";
7
+ export { type AccessAuthorizationContext, type AccessAuthorize, type AccessAuthorizeOption, type AccessAuthorizeResult, type AnonymousAccessAuthorizationContext, type AnonymousAccessAuthorize, type ApprovalDecision, type ApprovalRequest, type ApprovalState, type CapabilityDefinition, type CapabilityHandle, type CapabilityPolicy, type CreatedRuntimeContext, type DefineErrorsOptions, type Duration, type DurationUnit, type ErrorCatalog, type ErrorCodes, type ErrorHandle, type ExecutionAuthority, type ExecutionBudget, type ExecutionBudgetCounter, type ExecutionBudgetExceededError, type ExecutionBudgetLimits, type ExecutionBudgetOptions, type ExecutionBudgetSnapshot, type ExecutionBudgetUsage, type ExecutionContext, type HostBindingErrorCode, type Lease, type LeaseAcquireOptions, type LeaseErrorCode, type LeaseOperation, type LeaseRecord, type LeaseSqlClient, type LeaseSqlParam, type LeaseStore, type MaybePromise, type MaybeResolvable, type OpenTelemetryLogRecordView, type OpenTelemetrySpanEventView, type OpenTelemetrySpanView, type OpenTelemetrySpanViewOptions, type PolicyContext, type PolicyDecision, type PublicUrlConfig, type RequestRuntimeContext, type Resolvable, type Result, type ResultError, type RunLifecycleHooks, type RuntimeCapabilities, type RuntimeCapabilityHandle, type RuntimeContextInput, type RuntimeContextOptions, type RuntimeDiagnosticError, type RuntimeDiagnosticErrorOptions, type RuntimeDiagnosticEvent, type RuntimeDiagnosticLevel, type RuntimeDiagnosticReporter, type RuntimeHostContext, type RuntimeName, type RuntimeResourceInspector, type RuntimeResourceObservation, type RuntimeResourceScope, type RuntimeResourceSnapshot, type RuntimeResourceSupport, type RuntimeResourceUnit, type RuntimeWaitUntil, type RuntimeWaitUntilController, type SerializedResponse, type TraceActivityContext, type TraceActivityOwner, type TraceActivityPhase, type TraceContext, type TraceEvent, type TraceEventContentPolicy, type TraceEventLog, type TraceEventLogEntry, type TraceEventLogOptions, type TraceEventPayload, type TracePayloadVisibility, type TraceRunStatus, type TraceRunView, type TraceStepStatus, type TraceStepView, type ViteHubContext, ViteHubError, type ViteHubErrorDetail, type ViteHubErrorDetails, type ViteHubErrorOptions, type ViteHubErrorShape, type ViteHubHost, type ViteHubRuntime, type ViteHubStandardProps, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createSqlLeaseStore, createTraceEventLog, defineCapability, defineErrors, deriveTraceRuns, detectHost, formatRuntimeDiagnosticError, getCapability, getHostBinding, getInstanceId, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleUrl, instanceIdEnv, isExecutionAuthority, isRuntimeDiagnostic, isViteHubError, noExecutionAuthority, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, toResponse, toResultError, unknownExecutionAuthority };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { A as isResponse, B as formatRuntimeDiagnosticError, C as resolveRuntimeValue, D as detectHost, E as unknownExecutionAuthority, F as createMemoryLeaseStore, G as isTraceContentAttributeKey, H as normalizeRuntimeDiagnosticError, I as createSqlLeaseStore, L as leaseTable, M as serializeResponse, N as toResponse, O as getHostBinding, P as parseDuration, R as defineErrors, S as resolveCapabilityPolicy, T as traceEventsToOpenTelemetrySpans, U as createExecutionBudget, V as isRuntimeDiagnostic, W as isExecutionBudgetExceededError, _ as hasCapability, b as noExecutionAuthority, d as createRuntimeWaitUntilController, f as createTraceEventLog, g as getCapability, h as emitTraceEvent, i as getStandardContext, j as isSerializedResponse, k as deserializeResponse, l as createExecutionContext, m as deriveTraceRuns, p as defineCapability, r as getRuntimeContext, u as createRuntimeContext, v as isExecutionAuthority, w as traceEventsToOpenTelemetryLogRecords, x as normalizeExecutionAuthority, y as isResolvable, z as toResultError } from "./request-context-uRQpodgl.js";
2
- import { t as runtimeErrorDiagnostics } from "./error-diagnostics-BM9W4pBg.js";
1
+ import { _ as instanceIdEnv, d as parseDuration, f as createMemoryLeaseStore, g as getInstanceId, h as toResultError, i as getStandardContext, l as detectHost, m as defineErrors, p as createSqlLeaseStore, r as getRuntimeContext, u as getHostBinding } from "./request-context-Dmsliqan.js";
3
2
  import { n as getViteHubErrorShape, r as isViteHubError, t as ViteHubError } from "./errors-BQ0ofIL4.js";
4
- import { a as hostedConsoleOrigin, c as normalizeConsoleProjectUrl, i as resolvePublicUrl, l as decodeRouteSegment, o as hostedConsoleUrl, s as normalizeConsolePath, t as consoleInvocationUrl, u as encodeRouteSegment } from "./public-url-ByAmAjbP.js";
5
- export { ViteHubError, consoleInvocationUrl, createExecutionBudget, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createRuntimeWaitUntilController, createSqlLeaseStore, createTraceEventLog, decodeRouteSegment, defineCapability, defineErrors, deriveTraceRuns, deserializeResponse, detectHost, emitTraceEvent, encodeRouteSegment, formatRuntimeDiagnosticError, getCapability, getHostBinding, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleOrigin, hostedConsoleUrl, isExecutionAuthority, isExecutionBudgetExceededError, isResolvable, isResponse, isRuntimeDiagnostic, isSerializedResponse, isTraceContentAttributeKey, isViteHubError, leaseTable, noExecutionAuthority, normalizeConsolePath, normalizeConsoleProjectUrl, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, resolveRuntimeValue, runtimeErrorDiagnostics, serializeResponse, toResponse, toResultError, traceEventsToOpenTelemetryLogRecords, traceEventsToOpenTelemetrySpans, unknownExecutionAuthority };
3
+ import { a as defineCapability, c as getCapability, f as noExecutionAuthority, i as createTraceEventLog, l as hasCapability, m as resolveCapabilityPolicy, n as createRuntimeContext, o as deriveTraceRuns, p as normalizeExecutionAuthority, t as createExecutionContext, u as isExecutionAuthority, v as unknownExecutionAuthority } from "./core-DpLK9dQt.js";
4
+ import { a as toResponse, c as normalizeRuntimeDiagnosticError, o as formatRuntimeDiagnosticError, s as isRuntimeDiagnostic } from "./response-Be5M4WIn.js";
5
+ import { a as resolvePublicUrl, l as hostedConsoleUrl } from "./public-url-DizC8CFs.js";
6
+ export { ViteHubError, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createSqlLeaseStore, createTraceEventLog, defineCapability, defineErrors, deriveTraceRuns, detectHost, formatRuntimeDiagnosticError, getCapability, getHostBinding, getInstanceId, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleUrl, instanceIdEnv, isExecutionAuthority, isRuntimeDiagnostic, isViteHubError, noExecutionAuthority, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, toResponse, toResultError, unknownExecutionAuthority };
@@ -0,0 +1,7 @@
1
+ import { i as normalizeConsoleProjectUrl, r as normalizeConsolePath, t as hostedConsoleOrigin } from "../hosted-console-ZfMo5MW4.js";
2
+ import { r as consoleInvocationUrl } from "../public-url-BCFhTiTM.js";
3
+ //#region src/route-segment.d.ts
4
+ export declare function encodeRouteSegment(value: string): string;
5
+ export declare function decodeRouteSegment(segment: string): string | undefined;
6
+ //#endregion
7
+ export { consoleInvocationUrl, hostedConsoleOrigin, normalizeConsolePath, normalizeConsoleProjectUrl };
@@ -0,0 +1,2 @@
1
+ import { c as hostedConsoleOrigin, d as normalizeConsoleProjectUrl, n as consoleInvocationUrl, o as decodeRouteSegment, s as encodeRouteSegment, u as normalizeConsolePath } from "../public-url-DizC8CFs.js";
2
+ export { consoleInvocationUrl, decodeRouteSegment, encodeRouteSegment, hostedConsoleOrigin, normalizeConsolePath, normalizeConsoleProjectUrl };
@@ -0,0 +1,2 @@
1
+ import { Y as createRuntimeWaitUntilController, rt as isResolvable, st as resolveRuntimeValue } from "../core-BfUEli_0.js";
2
+ export { createRuntimeWaitUntilController, isResolvable, resolveRuntimeValue };
@@ -0,0 +1,2 @@
1
+ import { d as isResolvable, h as resolveRuntimeValue, r as createRuntimeWaitUntilController } from "../core-DpLK9dQt.js";
2
+ export { createRuntimeWaitUntilController, isResolvable, resolveRuntimeValue };
@@ -0,0 +1,2 @@
1
+ import { t as runtimeErrorDiagnostics } from "../error-diagnostics-0sYgKTT8.js";
2
+ export { runtimeErrorDiagnostics };
@@ -0,0 +1,2 @@
1
+ import { t as runtimeErrorDiagnostics } from "../error-diagnostics-BM9W4pBg.js";
2
+ export { runtimeErrorDiagnostics };
@@ -1,4 +1,4 @@
1
- import { t as ExecutionBudget } from "../execution-budget-BPXbISEt.js";
1
+ import { c as createExecutionBudget, l as isExecutionBudgetExceededError, t as ExecutionBudget } from "../execution-budget-BPXbISEt.js";
2
2
  //#region src/internal/execution-budget.d.ts
3
3
  /** Internal context key used when a budget-owned tool is reused by another Invocation. */
4
4
  export declare const executionBudgetOverride: unique symbol;
@@ -7,4 +7,5 @@ export declare const executionBudgetCharged: unique symbol;
7
7
  export declare function markExecutionBudgetHandled(tool: object, budget: ExecutionBudget): void;
8
8
  export declare function isExecutionBudgetHandled(tool: object, budget: ExecutionBudget): boolean;
9
9
  export declare function executionBudgetHandledBy(tool: object): ExecutionBudget | undefined;
10
- //#endregion
10
+ //#endregion
11
+ export { createExecutionBudget, isExecutionBudgetExceededError };