eve 0.38.0 → 0.38.2
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 +17 -0
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +5 -5
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +97 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +35 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +127 -93
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +8 -9
- package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +143 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +27 -12
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +39 -8
- package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +6 -5
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +81 -0
- package/dist/src/compiled/@workflow/core/test-support/orchestrator-context.d.ts +25 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +18 -2
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +9 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +76 -87
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +45 -45
- package/dist/src/compiled/@workflow/world/queue.d.ts +86 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +15 -0
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +30 -18
- package/dist/src/compiled/@workflow/world/test-support/duplicate-event-fixtures.d.ts +41 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DZtQkszH.js → attribute-changes-B8K0pwpH.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-CPlyFOVo.js → dist-BRGbNjhD.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-xQXN70ED.js → dist-CqvWKNQv.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/frames-DoexhtxJ.js +3 -0
- package/dist/src/compiled/_chunks/workflow/private-z_2Kcwee.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-DO_MuJlY.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-lq7-eG0l.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-7TgF3i-e.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-BPSgt1Wg.js +15 -0
- package/dist/src/compiled/_chunks/workflow/ws-transport-TYZ9zwoZ.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +5 -0
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/model-catalog.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-extension.d.ts +10 -1
- package/dist/src/compiler/normalize-extension.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-subagent.d.ts +1 -0
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/discover-subagent.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +1 -0
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/session-callback-step.d.ts +8 -0
- package/dist/src/execution/session-callback-step.js +1 -1
- package/dist/src/execution/session.d.ts +2 -0
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/task-event-callback.d.ts +5 -6
- package/dist/src/execution/task-event-callback.js +1 -1
- package/dist/src/execution/tasks/child/instructions.d.ts +3 -0
- package/dist/src/execution/tasks/child/instructions.js +1 -0
- package/dist/src/execution/tasks/child/steps.d.ts +7 -1
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update.d.ts +10 -0
- package/dist/src/execution/tasks/child/update.js +1 -0
- package/dist/src/execution/tasks/child/workflow.d.ts +3 -3
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/agent-views.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.d.ts +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.d.ts +5 -3
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +3 -0
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/public/channels/mcp.d.ts +2 -2
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/tasks.d.ts +6 -7
- package/dist/src/runtime/framework-tools/tasks.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/session-callback-route.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/tasks/task-id.d.ts +1 -2
- package/dist/src/tasks/task-id.js +1 -1
- package/dist/src/tasks/task-inbox-token.d.ts +2 -0
- package/dist/src/tasks/task-inbox-token.js +1 -0
- package/dist/src/tasks/types.d.ts +9 -1
- package/dist/src/tasks/wire.d.ts +2 -3
- package/docs/channels/custom.mdx +1 -0
- package/docs/channels/mcp.mdx +185 -0
- package/docs/channels/meta.json +1 -0
- package/docs/channels/overview.mdx +6 -1
- package/docs/extensions.md +14 -6
- package/docs/guides/auth-and-route-protection.md +1 -0
- package/docs/guides/dev-tui.md +1 -0
- package/docs/instructions.mdx +1 -0
- package/docs/subagents/index.mdx +3 -1
- package/package.json +6 -6
- package/dist/src/compiled/_chunks/workflow/frames-BBs-9k1d.js +0 -3
- package/dist/src/compiled/_chunks/workflow/private-UQtz8ZcW.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-CYtSorp6.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-Cjo0A3NO.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wait-until-CT1ve8qB.js +0 -15
- package/dist/src/compiled/_chunks/workflow/ws-transport-beXxD0s_.js +0 -1
- package/dist/src/execution/tasks/parent/send.d.ts +0 -25
- package/dist/src/execution/tasks/parent/send.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.58`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.3`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.38.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.58`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.3`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.38.2`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t)),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
2
|
|
|
3
3
|
export default defineAgent({
|
|
4
4
|
model: "__EVE_INIT_MODEL__",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";
|
|
1
2
|
/**
|
|
2
3
|
* Derives the stable task id for one originating subagent call.
|
|
3
4
|
*
|
|
@@ -30,5 +31,3 @@ export declare function deriveTaskInboxToken(input: {
|
|
|
30
31
|
readonly parentContinuationToken: string;
|
|
31
32
|
readonly taskId: string;
|
|
32
33
|
}): string;
|
|
33
|
-
/** Reads the non-secret task id embedded in a private task inbox token. */
|
|
34
|
-
export declare function readTaskIdFromInboxToken(token: string): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{deriveAgentOperationId}from"#harness/handles/operation-id.js";function deriveTaskId(e){return`task_${deriveAgentOperationId(e).slice(0,24)}`}function deriveTaskInboxToken(t){return`task:${t.taskId}:${createHash(`sha256`).update(`${t.taskId}\0${t.parentContinuationToken}`).digest(`hex`).slice(0,32)}`}
|
|
1
|
+
import{createHash}from"node:crypto";import{deriveAgentOperationId}from"#harness/handles/operation-id.js";import{readTaskIdFromInboxToken}from"#tasks/task-inbox-token.js";function deriveTaskId(e){return`task_${deriveAgentOperationId(e).slice(0,24)}`}function deriveTaskInboxToken(t){return`task:${t.taskId}:${createHash(`sha256`).update(`${t.taskId}\0${t.parentContinuationToken}`).digest(`hex`).slice(0,32)}`}export{deriveTaskId,deriveTaskInboxToken,readTaskIdFromInboxToken};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function readTaskIdFromInboxToken(e){return/^task:(task_[^:]+):[a-f0-9]{32}$/.exec(e)?.[1]}export{readTaskIdFromInboxToken};
|
|
@@ -257,6 +257,14 @@ export interface TaskInboundTurnStarted {
|
|
|
257
257
|
readonly kind: "turn-started";
|
|
258
258
|
readonly taskId: string;
|
|
259
259
|
}
|
|
260
|
+
/** Intermediate progress sent by a running child to its parent agent. */
|
|
261
|
+
export interface TaskInboundUpdate {
|
|
262
|
+
readonly callId: string;
|
|
263
|
+
readonly childStepIndex: number;
|
|
264
|
+
readonly childTurnId: string;
|
|
265
|
+
readonly kind: "task-update";
|
|
266
|
+
readonly message: string;
|
|
267
|
+
}
|
|
260
268
|
/**
|
|
261
269
|
* Arrives when the delegated child emits `authorization.required` or
|
|
262
270
|
* `authorization.completed`. The former exposes an authorization blocker in
|
|
@@ -285,7 +293,7 @@ export interface TaskInboundAnswerInput {
|
|
|
285
293
|
readonly taskId: string;
|
|
286
294
|
}
|
|
287
295
|
/** Everything a task run's inbound continuation hook may receive. */
|
|
288
|
-
export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundChildResult | TaskInboundInputRequest | TaskInboundTurnStarted | TaskInboundAuthorizationEvent | TaskInboundAnswerInput;
|
|
296
|
+
export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundChildResult | TaskInboundInputRequest | TaskInboundTurnStarted | TaskInboundUpdate | TaskInboundAuthorizationEvent | TaskInboundAnswerInput;
|
|
289
297
|
/** Namespaced run stream carrying appended `TaskView` records. */
|
|
290
298
|
export declare const TASK_VIEW_STREAM_NAMESPACE = "eve.task";
|
|
291
299
|
/** True when the status can never change again. */
|
package/dist/src/tasks/wire.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { TaskCommand, TaskRunInboundPayload } from "#tasks/types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Translates one inbound hook payload into a lifecycle command.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* that used to resume the parent turn arrive here instead:
|
|
5
|
+
* Delegated dispatch hands children the task run's hook token, so the
|
|
6
|
+
* payloads that used to resume the parent turn arrive here instead:
|
|
8
7
|
*
|
|
9
8
|
* - a settled child turn (local notification or remote callback)
|
|
10
9
|
* carries an explicit outcome — its result status decides
|
package/docs/channels/custom.mdx
CHANGED
|
@@ -395,3 +395,4 @@ The framework handles staging bytes to the sandbox, enforcing upload policy, hyd
|
|
|
395
395
|
- [Channels overview](./overview)
|
|
396
396
|
- [Dynamic capabilities](../guides/dynamic-capabilities)
|
|
397
397
|
- [Auth & route protection](../guides/auth-and-route-protection)
|
|
398
|
+
- [Universal Commerce Protocol (UCP)](../protocols/ucp): serve a UCP profile from a custom channel
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MCP"
|
|
3
|
+
description: "Publish an eve agent as a durable MCP invocation service with route authentication and OAuth discovery."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
The MCP channel lets clients such as Claude Code delegate durable work to an eve agent through four tools: `agent_start`, `agent_get`, `agent_update`, and `agent_cancel`.
|
|
7
|
+
|
|
8
|
+
Use an [MCP connection](../connections/mcp) instead when your eve agent needs to call someone else's MCP server.
|
|
9
|
+
|
|
10
|
+
## Configure the channel
|
|
11
|
+
|
|
12
|
+
Create `agent/channels/mcp.ts`. Authentication is required explicitly, even during development.
|
|
13
|
+
|
|
14
|
+
```ts title="agent/channels/mcp.ts"
|
|
15
|
+
import { localDev, vercelOidc } from "eve/channels/auth";
|
|
16
|
+
import { mcpChannel } from "eve/channels/mcp";
|
|
17
|
+
|
|
18
|
+
export default mcpChannel({
|
|
19
|
+
auth: [vercelOidc(), localDev()],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This accepts Vercel-issued bearer tokens in a deployment and admits a synthetic local principal under `eve dev` or `vercel dev`. `localDev()` checks the running environment, not the request hostname: accessing an `eve start` production process through localhost does not activate it.
|
|
24
|
+
|
|
25
|
+
### Routes
|
|
26
|
+
|
|
27
|
+
The default Streamable HTTP endpoint is `/eve/v1/mcp`. Set `route` when the application should publish it somewhere else:
|
|
28
|
+
|
|
29
|
+
```ts title="agent/channels/mcp.ts"
|
|
30
|
+
import { none } from "eve/channels/auth";
|
|
31
|
+
import { mcpChannel } from "eve/channels/mcp";
|
|
32
|
+
|
|
33
|
+
export default mcpChannel({
|
|
34
|
+
auth: none(),
|
|
35
|
+
route: "/mcp",
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`none()` makes the endpoint public; use it only when anonymous access is intentional. The channel registers `GET`, `POST`, and `DELETE` at the selected route.
|
|
40
|
+
|
|
41
|
+
## Interactive OAuth
|
|
42
|
+
|
|
43
|
+
For an MCP client that should open a sign-in flow, configure eve as an OAuth protected resource. Wrap the access-token verifier in `oauthResource()`:
|
|
44
|
+
|
|
45
|
+
```ts title="agent/channels/mcp.ts"
|
|
46
|
+
import { oauthResource, oidc } from "eve/channels/auth";
|
|
47
|
+
import { mcpChannel } from "eve/channels/mcp";
|
|
48
|
+
|
|
49
|
+
const issuer = "https://auth.example.com";
|
|
50
|
+
const resource = "https://agent.example.com/eve/v1/mcp";
|
|
51
|
+
|
|
52
|
+
export default mcpChannel({
|
|
53
|
+
auth: oauthResource(
|
|
54
|
+
oidc({
|
|
55
|
+
audiences: [resource],
|
|
56
|
+
issuer,
|
|
57
|
+
}),
|
|
58
|
+
{
|
|
59
|
+
issuer,
|
|
60
|
+
resource,
|
|
61
|
+
scopes: ["agent:invoke"],
|
|
62
|
+
},
|
|
63
|
+
),
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The authorization server identified by `issuer` must issue tokens accepted by the wrapped verifier. `scopes` advertises what clients should request; the verifier remains responsible for signature, expiration, audience/resource, and scope enforcement.
|
|
68
|
+
|
|
69
|
+
`oauthResource()` does not issue tokens or run an authorization server. It decorates an ordinary inbound `AuthFn` with OAuth protected-resource metadata so `mcpChannel()` can publish discovery and add `resource_metadata` to Bearer challenges. Client registration, consent, token issuance, and authorization-server metadata remain the identity provider's responsibility.
|
|
70
|
+
|
|
71
|
+
### Verify the bearer token yourself
|
|
72
|
+
|
|
73
|
+
Use a custom `AuthFn` when token verification needs application-specific logic:
|
|
74
|
+
|
|
75
|
+
```ts title="agent/channels/mcp.ts"
|
|
76
|
+
import { extractBearerToken, oauthResource, verifyOidc } from "eve/channels/auth";
|
|
77
|
+
import { mcpChannel } from "eve/channels/mcp";
|
|
78
|
+
|
|
79
|
+
const issuer = "https://auth.example.com";
|
|
80
|
+
const resource = "https://agent.example.com/eve/v1/mcp";
|
|
81
|
+
|
|
82
|
+
async function verifyToken(request: Request) {
|
|
83
|
+
const token = extractBearerToken(request.headers.get("authorization"));
|
|
84
|
+
const result = await verifyOidc(token, {
|
|
85
|
+
audiences: [resource],
|
|
86
|
+
issuer,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return result.ok ? result.sessionAuth : null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default mcpChannel({
|
|
93
|
+
auth: oauthResource(verifyToken, {
|
|
94
|
+
issuer,
|
|
95
|
+
resource,
|
|
96
|
+
scopes: ["agent:invoke"],
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`verifyOidc()` uses the issuer's discovery document to validate the token signature and claims. Returning `sessionAuth` accepts the request and binds invocation ownership to that verified principal. Returning `null` lets the auth walk continue; when no strategy accepts the request, eve returns `401`.
|
|
102
|
+
|
|
103
|
+
You can wrap any strategy in `oauthResource()`, including `vercelOidc()`, but the advertised authorization server must issue tokens that strategy accepts. `vercelOidc()` by itself is preconfigured Vercel workload identity and does not advertise an interactive login.
|
|
104
|
+
|
|
105
|
+
### Protected-resource metadata
|
|
106
|
+
|
|
107
|
+
By default, eve derives the metadata path from the complete MCP resource identifier according to RFC 9728:
|
|
108
|
+
|
|
109
|
+
| MCP resource | Protected-resource metadata |
|
|
110
|
+
| -------------------------------------- | --------------------------------------------------------------------------- |
|
|
111
|
+
| `https://agent.example.com/eve/v1/mcp` | `https://agent.example.com/.well-known/oauth-protected-resource/eve/v1/mcp` |
|
|
112
|
+
| `https://agent.example.com/mcp` | `https://agent.example.com/.well-known/oauth-protected-resource/mcp` |
|
|
113
|
+
|
|
114
|
+
Set `resource` when the public resource identifier cannot be derived from the incoming request. Set `metadataPath` only when discovery must live at a non-derived location:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
oauthResource(verifyToken, {
|
|
118
|
+
issuer,
|
|
119
|
+
metadataPath: "/.well-known/custom-resource",
|
|
120
|
+
resource: "https://agent.example.com/eve/v1/mcp",
|
|
121
|
+
scopes: ["agent:invoke"],
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The metadata endpoint serves cross-origin `GET`, `HEAD`, and `OPTIONS` requests so browser-hosted clients can discover the authorization server. MCP protocol requests remain same-origin.
|
|
126
|
+
|
|
127
|
+
## Other authentication modes
|
|
128
|
+
|
|
129
|
+
`mcpChannel()` accepts the same inbound auth strategies as other eve channels: Basic auth, HMAC or ECDSA JWTs, generic OIDC, Vercel OIDC, custom `AuthFn` policies, or an ordered array of them. These modes do not automatically produce an interactive login unless wrapped in `oauthResource()`; configure credentials in the MCP client out of band.
|
|
130
|
+
|
|
131
|
+
When a protected request has no accepted credentials, eve returns a Bearer challenge. A supplied Bearer token rejected by every strategy gets `error="invalid_token"`. To report a verified caller that lacks the necessary scopes, throw `ForbiddenError` with an `error="insufficient_scope"` Bearer challenge. The MCP channel preserves that challenge and adds the protected-resource metadata URL.
|
|
132
|
+
|
|
133
|
+
For the complete strategy and auth-walk model, see [Authentication](../guides/auth-and-route-protection).
|
|
134
|
+
|
|
135
|
+
## HTTP security
|
|
136
|
+
|
|
137
|
+
The MCP transport validates the request before authentication:
|
|
138
|
+
|
|
139
|
+
- Remote endpoints require HTTPS; HTTP is accepted only on loopback.
|
|
140
|
+
- `Host` must match the request URL.
|
|
141
|
+
- Browser protocol requests must have an exact same-origin `Origin`.
|
|
142
|
+
|
|
143
|
+
When a gateway or reverse proxy changes the public origin or path, set `resource` explicitly so metadata and authentication challenges advertise the client-facing MCP resource.
|
|
144
|
+
|
|
145
|
+
The protected-resource metadata endpoint is intentionally CORS-readable. The MCP transport itself does not enable cross-origin browser access; place a same-origin backend or authenticated server-side proxy in front of it when a browser application needs to connect.
|
|
146
|
+
|
|
147
|
+
The endpoint serves MCP `2026-07-28` directly and retains stateless `2025-11-25` Streamable HTTP compatibility. eve does not keep an MCP transport session in either mode.
|
|
148
|
+
|
|
149
|
+
## Invoke the agent
|
|
150
|
+
|
|
151
|
+
MCP clients receive four tools:
|
|
152
|
+
|
|
153
|
+
| Tool | Input | Purpose |
|
|
154
|
+
| -------------- | ----------------------------- | ----------------------------------------------------------- |
|
|
155
|
+
| `agent_start` | `{ message, outputSchema? }` | Start durable work and immediately return an invocation ID. |
|
|
156
|
+
| `agent_get` | `{ invocationId }` | Read the invocation's complete current state. |
|
|
157
|
+
| `agent_update` | `{ invocationId, responses }` | Answer the complete pending human-input batch. |
|
|
158
|
+
| `agent_cancel` | `{ invocationId }` | Request cooperative cancellation of non-terminal work. |
|
|
159
|
+
|
|
160
|
+
`agent_start` creates one task-mode eve session and returns after durable acceptance. Keep its `invocationId`, then call `agent_get` until the invocation reaches a terminal state. While the status is `working`, wait at least `pollAfterMs` before polling again.
|
|
161
|
+
|
|
162
|
+
The invocation response is discriminated by `status`:
|
|
163
|
+
|
|
164
|
+
- `working`: work is active; continue polling according to `pollAfterMs`.
|
|
165
|
+
- `input_required`: present `inputRequests`, then send the complete answer batch through `agent_update`. A successful update returns fresh `working` state.
|
|
166
|
+
- `authorization_required`: present the returned sign-in URL, user code, or instructions. The connection callback resumes the invocation automatically; continue polling.
|
|
167
|
+
- `completed`: consume the optional `result`.
|
|
168
|
+
- `failed`: inspect the structured `error`.
|
|
169
|
+
- `cancelled`: cancellation reached a terminal state.
|
|
170
|
+
|
|
171
|
+
Cancellation is cooperative, so call `agent_get` after `agent_cancel` until the state becomes terminal.
|
|
172
|
+
|
|
173
|
+
Optional output schemas are limited to 64 KiB, 32 levels, and 2,048 nodes. External `$ref` values are rejected.
|
|
174
|
+
|
|
175
|
+
## Invocation ownership
|
|
176
|
+
|
|
177
|
+
Every MCP operation reruns the configured auth policy. With authenticated policies, an invocation belongs to the principal that started it; knowing its ID is not sufficient. Bearer tokens are not stored with the invocation or forwarded to the agent's tools.
|
|
178
|
+
|
|
179
|
+
With `none()`, every caller shares the anonymous principal, so the random invocation ID becomes a bearer capability. Keep it out of logs and URLs and treat it as usable until workflow retention expires. Responses include `expiresAt` when the workflow backend reports a retention deadline.
|
|
180
|
+
|
|
181
|
+
## What to read next
|
|
182
|
+
|
|
183
|
+
- [Authentication](../guides/auth-and-route-protection): configure inbound route authentication
|
|
184
|
+
- [MCP connections](../connections/mcp): let an eve agent call another MCP server
|
|
185
|
+
- [Sessions, runs & streaming](../concepts/sessions-runs-and-streaming): understand the durable sessions behind invocations
|
package/docs/channels/meta.json
CHANGED
|
@@ -69,6 +69,7 @@ eve's first-class channels use eve-owned runtimes for webhook handling, verifica
|
|
|
69
69
|
| ------------------------------------------- | ---------------------------------------------------------- |
|
|
70
70
|
| A web app / browser chat UI | eve channel + [`useEveAgent`](../guides/frontend/overview) |
|
|
71
71
|
| Local tooling, SDK clients, `curl` | [eve HTTP channel](./eve) (default) |
|
|
72
|
+
| MCP clients delegating durable work | [MCP](./mcp) |
|
|
72
73
|
| Slack mentions, DMs, buttons | [Slack](./slack) |
|
|
73
74
|
| iMessage | [Photon](./photon) |
|
|
74
75
|
| Discord slash commands, components | [Discord](./discord) |
|
|
@@ -84,11 +85,15 @@ eve's first-class channels use eve-owned runtimes for webhook handling, verifica
|
|
|
84
85
|
|
|
85
86
|
As the deployer, it is your responsibility to ensure your agent complies with applicable laws.
|
|
86
87
|
|
|
87
|
-
Where an eve agent communicates with people, you may be required to disclose that they are interacting with an automated AI system where law requires it. eve does not add this disclosure automatically; configure it in your instructions and/or channel responses.
|
|
88
|
+
Where an eve agent communicates with people, you may be required to disclose that they are interacting with an automated AI system where law requires it. eve does not add this disclosure automatically; configure it in your instructions and/or channel responses. See [Responsible use](../responsible-use) for the full deployer responsibilities.
|
|
88
89
|
|
|
89
90
|
## What to read next
|
|
90
91
|
|
|
92
|
+
- [eve HTTP channel](./eve): the default session API behind the TUI, SDK clients, and browser UIs
|
|
91
93
|
- [Slack](./slack): the most common platform channel, end to end
|
|
94
|
+
- [MCP](./mcp): expose the agent as a durable invocation service
|
|
95
|
+
- [Photon](./photon), [Discord](./discord), [Teams](./teams), [Telegram](./telegram), [Twilio](./twilio), [GitHub](./github), and [Linear](./linear): the other first-class platform channels
|
|
96
|
+
- [Chat SDK adapters](./chat-sdk): reach services eve has no first-class channel for
|
|
92
97
|
- [Custom channels](./custom): build a channel for any surface with `defineChannel`
|
|
93
98
|
- [Frontend](../guides/frontend/overview): browser chat on the eve channel with `useEveAgent`
|
|
94
99
|
- [Integrations](/integrations): browse every built-in channel in one gallery using the Channels filter
|
package/docs/extensions.md
CHANGED
|
@@ -3,7 +3,7 @@ title: "Extensions"
|
|
|
3
3
|
description: "Package reusable eve capabilities and mount them from npm or a monorepo workspace."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Extensions package eve tools, channels, connections, skills, schedules, instruction fragments, and hooks. An author builds an extension package; each agent that uses it declares the package as a dependency and mounts it. The package can be published to a package registry or kept private inside a monorepo workspace.
|
|
6
|
+
Extensions package eve tools, channels, connections, skills, schedules, subagents, instruction fragments, and hooks. An author builds an extension package; each agent that uses it declares the package as a dependency and mounts it. The package can be published to a package registry or kept private inside a monorepo workspace.
|
|
7
7
|
|
|
8
8
|
Ready-made extensions can also be distributed through an eve integration registry. See [Add Integrations](./install-integrations) to discover and add one with `eve add`; this page explains how extension packages are authored, mounted, configured, and overridden.
|
|
9
9
|
|
|
@@ -33,6 +33,7 @@ An extension uses the same file conventions as an agent for its contributions:
|
|
|
33
33
|
connections/api.ts
|
|
34
34
|
skills/triage/SKILL.md
|
|
35
35
|
schedules/sync.ts
|
|
36
|
+
subagents/reviewer/agent.ts
|
|
36
37
|
instructions.md
|
|
37
38
|
hooks/audit.ts
|
|
38
39
|
lib/http.ts
|
|
@@ -40,9 +41,9 @@ An extension uses the same file conventions as an agent for its contributions:
|
|
|
40
41
|
|
|
41
42
|
Each listed slot accepts the same authored forms as its agent counterpart. Static and dynamic tools, skills, and instructions all work in an extension: `extension/instructions.ts` is as valid as `extension/instructions.md`, and `extension/tools/` can contain `defineDynamic(...)`.
|
|
42
43
|
|
|
43
|
-
Names come from paths, so call the tool `search`, not `crm_search`; the consumer's mount adds the `crm__` prefix. The same prefix applies to channel and
|
|
44
|
+
Names come from paths, so call the tool `search`, not `crm_search`; the consumer's mount adds the `crm__` prefix. The same prefix applies to channel, schedule, and parent-visible subagent IDs, while channel route paths and schedule cron expressions stay unchanged. Keep shared code in `extension/lib/`.
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
The extension root cannot declare agent configuration, a sandbox, or nested extensions. A subagent contributed under `extension/subagents/` owns its own agent configuration and sandbox like any other [declared subagent](./subagents).
|
|
46
47
|
|
|
47
48
|
### Add configuration and contributions
|
|
48
49
|
|
|
@@ -82,6 +83,12 @@ If no configuration is needed, export `defineExtension()` and let consumers re-e
|
|
|
82
83
|
|
|
83
84
|
`defineState` is automatically scoped to the extension package, so the same state name does not collide with the consumer or another extension.
|
|
84
85
|
|
|
86
|
+
### Add a subagent
|
|
87
|
+
|
|
88
|
+
Author a subagent under `extension/subagents/<id>/` using the same files as a subagent declared by an agent. Mounting the extension as `crm` exposes `extension/subagents/reviewer/` to the consuming agent node as `crm__reviewer`. The subagent's own tools, connections, skills, hooks, instructions, sandbox, and nested subagents remain isolated inside its node and keep their path-derived names.
|
|
89
|
+
|
|
90
|
+
Modules inside the contributed subagent can import the extension handle. For example, a tool under `extension/subagents/reviewer/tools/` can read the configuration bound by the consumer's `agent/extensions/crm.ts` mount.
|
|
91
|
+
|
|
85
92
|
### Build and optionally publish
|
|
86
93
|
|
|
87
94
|
The scaffold's `package.json` declares separate source and distribution roots:
|
|
@@ -170,7 +177,7 @@ export default crm({ apiKey: process.env.CRM_API_KEY! });
|
|
|
170
177
|
|
|
171
178
|
Set `CRM_API_KEY` in the consumer's environment, such as `.env.local` for local development.
|
|
172
179
|
|
|
173
|
-
The mount adds `crm__` to named contributions: `tools/search.ts` becomes `crm__search`, `channels/webhook.ts` becomes `crm__webhook`, `schedules/sync.ts` becomes `crm__sync`,
|
|
180
|
+
The mount adds `crm__` to named contributions: `tools/search.ts` becomes `crm__search`, `channels/webhook.ts` becomes `crm__webhook`, `schedules/sync.ts` becomes `crm__sync`, `connections/api.ts` becomes `crm__api`, and `subagents/reviewer/` becomes `crm__reviewer`. Channels keep their declared route paths, and schedules keep their cron expressions.
|
|
174
181
|
|
|
175
182
|
For an extension with no configuration, mount its default export directly:
|
|
176
183
|
|
|
@@ -276,7 +283,7 @@ import crm from "@acme/crm";
|
|
|
276
283
|
export default crm({ apiKey: process.env.CRM_API_KEY! });
|
|
277
284
|
```
|
|
278
285
|
|
|
279
|
-
A same-named consumer channel, tool, connection, skill, or
|
|
286
|
+
A same-named consumer channel, tool, connection, skill, schedule, or subagent wins. To adjust an extension tool, import it from the package's `./tools` export and define it again:
|
|
280
287
|
|
|
281
288
|
```ts title="agent/extensions/crm/tools/search.ts"
|
|
282
289
|
import { search } from "@acme/crm/tools";
|
|
@@ -296,7 +303,7 @@ export default disableTool();
|
|
|
296
303
|
|
|
297
304
|
Hooks and instruction fragments are additive, so they cannot be replaced. To replace a dynamic tool, use a dynamic definition in the same slot; dynamic tools win over same-named static tools at runtime. `disableTool()` removes either kind.
|
|
298
305
|
|
|
299
|
-
The `crm__` prefix is reserved for this directory mount. A consumer cannot override the extension from `agent/tools/`, `agent/connections/`, or another agent-root slot.
|
|
306
|
+
The `crm__` prefix is reserved for this directory mount. A consumer cannot override the extension from `agent/tools/`, `agent/connections/`, `agent/subagents/`, or another agent-root slot.
|
|
300
307
|
|
|
301
308
|
### Use an extension tool result in a hook
|
|
302
309
|
|
|
@@ -333,4 +340,5 @@ At build time, eve checks the extension's generated capability metadata. If the
|
|
|
333
340
|
- [Connections](/docs/connections): integrate external services
|
|
334
341
|
- [Channels](/docs/channels/overview): receive messages and expose routes
|
|
335
342
|
- [Schedules](/docs/schedules): run the agent on a cron cadence
|
|
343
|
+
- [Subagents](/docs/subagents): delegate to declared specialists
|
|
336
344
|
- [Hooks](/docs/guides/hooks): observe agent events
|
|
@@ -392,4 +392,5 @@ Inline providers derive a stable tool-qualified auth key from Vercel Connect met
|
|
|
392
392
|
|
|
393
393
|
- [Security model](../concepts/security-model): trust boundaries and the pre-production checklist
|
|
394
394
|
- [Connections](../connections): connection auth shapes (`connect()` vs static token)
|
|
395
|
+
- [Multi-tenant outbound auth](../patterns/multi-tenant-auth): select tenant-scoped outbound credentials from the verified inbound identity
|
|
395
396
|
- [Deployment](./deployment/overview): where route-auth secrets live in production
|
package/docs/guides/dev-tui.md
CHANGED
|
@@ -86,3 +86,4 @@ For a Vercel deployment that needs authentication, run `/vc:login` and follow th
|
|
|
86
86
|
|
|
87
87
|
- [Instrumentation](./instrumentation): traces, OpenTelemetry, and diagnostics.
|
|
88
88
|
- [CLI](../reference/cli): commands and flags.
|
|
89
|
+
- [Agent Client Protocol (ACP)](../protocols/acp): drive the same agent from ACP clients such as Zed instead of the TUI.
|
package/docs/instructions.mdx
CHANGED
|
@@ -97,3 +97,4 @@ Where an eve agent communicates with people, you may be required to disclose tha
|
|
|
97
97
|
- [Tools](./tools): typed actions, the next capability to add
|
|
98
98
|
- [Context control](./concepts/context-control): all the levers for what the model sees
|
|
99
99
|
- [Skills](./skills): on-demand procedures, the counterpart to always-on instructions
|
|
100
|
+
- [Multi-tenant memory](./patterns/multi-tenant-memory): dynamic instructions that load per-tenant memories each turn
|
package/docs/subagents/index.mdx
CHANGED
|
@@ -50,6 +50,8 @@ export default defineAgent({
|
|
|
50
50
|
|
|
51
51
|
`description` is required. The parent reads it to decide whether to delegate, so the compiler rejects any subagent whose `agent.ts` leaves it out.
|
|
52
52
|
|
|
53
|
+
A mounted extension can also contribute declared subagents from `extension/subagents/`. The mount namespace prefixes the subagent visible to the consuming agent node: mounting an extension as `crm` exposes its `reviewer` subagent as `crm__reviewer`. The contributed subagent keeps its own isolated tools, connections, skills, hooks, instructions, sandbox, and nested subagents, and its modules can read configuration from the extension handle. See [Extensions](./extensions#add-a-subagent) for the authoring and override behavior.
|
|
54
|
+
|
|
53
55
|
### Conditional availability
|
|
54
56
|
|
|
55
57
|
To expose a declared subagent only for certain sessions or turns, export
|
|
@@ -153,7 +155,7 @@ Declared subagents can call nested subagents defined under their own directories
|
|
|
153
155
|
|
|
154
156
|
`Workflow` is also root-only. Child sessions can still call their own declared or remote subagents, but they receive neither `Workflow` nor the built-in `agent`. The Workflow tool's `maxSubagents` option caps the number of calls made by one program (default 100); see [Workflow Tool](./subagents/workflow-tool).
|
|
155
157
|
|
|
156
|
-
A declared subagent's tool name is the bare path-derived name, with no prefix. `agent/subagents/researcher/` registers as the tool `researcher`.
|
|
158
|
+
A directly declared subagent's tool name is the bare path-derived name, with no prefix. `agent/subagents/researcher/` registers as the tool `researcher`. A subagent supplied by a mounted extension includes the mount namespace, such as `crm__reviewer`. The model, approvals, logs, and evals reference the resulting name. Its input schema is:
|
|
157
159
|
|
|
158
160
|
```ts
|
|
159
161
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -333,13 +333,13 @@
|
|
|
333
333
|
"@vercel/sandbox": "2.8.0",
|
|
334
334
|
"@vercel/sandbox-drives": "npm:@vercel/sandbox@2.10.0-beta.0",
|
|
335
335
|
"@vercel/sdk": "1.28.8",
|
|
336
|
-
"@workflow/core": "5.0.0-beta.
|
|
337
|
-
"@workflow/errors": "5.0.0-beta.
|
|
336
|
+
"@workflow/core": "5.0.0-beta.42",
|
|
337
|
+
"@workflow/errors": "5.0.0-beta.17",
|
|
338
338
|
"@workflow/serde": "5.0.0-beta.2",
|
|
339
339
|
"@workflow/utils": "5.0.0-beta.8",
|
|
340
|
-
"@workflow/world": "5.0.0-beta.
|
|
341
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
342
|
-
"@workflow/world-vercel": "5.0.0-beta.
|
|
340
|
+
"@workflow/world": "5.0.0-beta.27",
|
|
341
|
+
"@workflow/world-local": "5.0.0-beta.36",
|
|
342
|
+
"@workflow/world-vercel": "5.0.0-beta.38",
|
|
343
343
|
"ai": "^7.0.58",
|
|
344
344
|
"autoevals": "0.0.132",
|
|
345
345
|
"chat": "4.34.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,t as n}from"./rolldown-runtime-8V8biNmG.js";import{O as r,_ as i,c as a,d as o,g as s,r as c}from"./dist-xQXN70ED.js";import{Ir as l,Yr as u,jr as d}from"./dist-CPlyFOVo.js";import{t as f}from"./env-config-DxamfI7T.js";import{t as p}from"./undici-BBG5cZTy.js";import{n as m,r as h,t as g}from"./token-util-DjMgNdXS.js";import{createRequire as _}from"module";import{inspect as v}from"node:util";import y from"node:os";var b=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),x=n(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>m}),n.exports=l(u);var d=b(),f=h();async function p(t){let n=``,r;try{n=m()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`./token-util-DjMgNdXS.js`).then(t=>e(t.t())),await import(`./token-DGzfw-Vb.js`).then(t=>e(t.default))]);(!n||i(r(n),t?.expirationBufferMs))&&(await a(t),n=m())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
2
|
-
${e.message}`),t?new f.VercelOidcTokenError(t):e}return n}function m(){let e=(0,d.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?`);return e}0&&(n.exports={getVercelOidcToken:p,getVercelOidcTokenSync:m})})),S=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>f.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>f.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>u.getVercelOidcTokenSync,getVercelToken:()=>p.getVercelToken}),t.exports=c(l);var u=x(),d=b(),f=m(),p=g();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken})})),C=S();let ee;try{ee=new TextDecoder}catch{}let w,T,E=0;const te=[],ne=57337,D={};let re=11281e4,O=1681e4,k=te,ie=0,A={},j,ae,oe=0,M=0,N,P,F=[],se=[],I,L,ce,le={useRecords:!1,mapsAsObjects:!0},ue=!1,de=2;try{Function(``)}catch{de=1/0}var fe=class e{constructor(e){if(e&&((e.keyMap||e._keyMap)&&!e.useRecords&&(e.useRecords=!1,e.mapsAsObjects=!0),e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||e.constructor.name!=`Map`)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach((e,n)=>t[z(this._mapKey.has(n)?this._mapKey.get(n):n)]=e),t}mapDecode(e,t){let n=this.decode(e);if(this._keyMap)switch(n.constructor.name){case`Array`:return n.map(e=>this.decodeKeys(e))}return n}decode(t,n){if(w)return Pe(()=>(Fe(),this?this.decode(t,n):e.prototype.decode.call(le,t,n)));T=n>-1?n:t.length,E=0,ie=0,M=0,ae=null,k=te,N=null,w=t;try{L=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw w=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(A=this,I=this.sharedValues&&(this.pack?Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return j=this.structures,pe();(!j||j.length>0)&&(j=[])}else A=le,(!j||j.length>0)&&(j=[]),I=null;return pe()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;ue=!0;let a=this?this.decode(e,i):Le.decode(e,i);if(t){if(t(a)===!1)return;for(;E<i;)if(r=E,t(pe())===!1)return}else{for(n=[a];E<i;)r=E,n.push(pe());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{ue=!1,Fe()}}};function pe(){try{let e=R();if(N){if(E>=N.postBundlePosition){let e=Error(`Unexpected bundle position`);throw e.incomplete=!0,e}E=N.postBundlePosition,N=null}if(E==T)j=null,w=null,P&&=null;else if(E>T){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}else if(!ue)throw Error(`Data read, but end of buffer not reached`);return e}catch(e){throw Fe(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`))&&(e.incomplete=!0),e}}function R(){let e=w[E++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=w[E++];break;case 25:if(t==7)return we();e=L.getUint16(E),E+=2;break;case 26:if(t==7){let e=L.getFloat32(E);if(A.useFloat32>2){let t=Ie[(w[E]&127)<<1|w[E+1]>>7];return E+=4,(t*e+(e>0?.5:-.5)>>0)/t}return E+=4,e}e=L.getUint32(E),E+=4;break;case 27:if(t==7){let e=L.getFloat64(E);return E+=8,e}if(t>1){if(L.getUint32(E)>0)throw Error(`JavaScript does not support arrays, maps, or strings with length over 4294967295`);e=L.getUint32(E+4)}else A.int64AsNumber?(e=L.getUint32(E)*4294967296,e+=L.getUint32(E+4)):e=L.getBigUint64(E);E+=8;break;case 31:switch(t){case 2:case 3:throw Error(`Indefinite length not supported for byte or text strings`);case 4:let e=[],n,r=0;for(;(n=R())!=D;){if(r>=re)throw Error(`Array length exceeds ${re}`);e[r++]=n}return t==4?e:t==3?e.join(``):Buffer.concat(e);case 5:let i;if(A.mapsAsObjects){let e={},t=0;if(A.keyMap)for(;(i=R())!=D;){if(t++>=O)throw Error(`Property count exceeds ${O}`);e[z(A.decodeKey(i))]=R()}else for(;(i=R())!=D;){if(t++>=O)throw Error(`Property count exceeds ${O}`);e[z(i)]=R()}return e}else{ce&&=(A.mapsAsObjects=!0,!1);let e=new Map;if(A.keyMap){let t=0;for(;(i=R())!=D;){if(t++>=O)throw Error(`Map size exceeds ${O}`);e.set(A.decodeKey(i),R())}}else{let t=0;for(;(i=R())!=D;){if(t++>=O)throw Error(`Map size exceeds ${O}`);e.set(i,R())}}return e}case 7:return D;default:throw Error(`Invalid major type for indefinite length `+t)}default:throw Error(`Unknown token `+e)}switch(t){case 0:return e;case 1:return~e;case 2:return xe(e);case 3:if(M>=E)return ae.slice(E-oe,(E+=e)-oe);if(M==0&&T<140&&e<32){let t=e<16?be(e):ye(e);if(t!=null)return t}return ge(e);case 4:if(e>=re)throw Error(`Array length exceeds ${re}`);let t=Array(e);for(let n=0;n<e;n++)t[n]=R();return t;case 5:if(e>=O)throw Error(`Map size exceeds ${re}`);if(A.mapsAsObjects){let t={};if(A.keyMap)for(let n=0;n<e;n++)t[z(A.decodeKey(R()))]=R();else for(let n=0;n<e;n++)t[z(R())]=R();return t}else{ce&&=(A.mapsAsObjects=!0,!1);let t=new Map;if(A.keyMap)for(let n=0;n<e;n++)t.set(A.decodeKey(R()),R());else for(let n=0;n<e;n++)t.set(R(),R());return t}case 6:if(e>=ne){let t=j[e&8191];if(t)return t.read||=he(t),t.read();if(e<65536){if(e==57343){let e=W(),t=R(),n=R();Te(t,n);let r={};if(A.keyMap)for(let t=2;t<e;t++){let e=A.decodeKey(n[t-2]);r[z(e)]=R()}else for(let t=2;t<e;t++){let e=n[t-2];r[z(e)]=R()}return r}else if(e==57342){let e=W(),t=R();for(let n=2;n<e;n++)Te(t++,R());return R()}else if(e==ne)return Me();if(A.getShared&&(Ne(),t=j[e&8191],t))return t.read||=he(t),t.read()}}let n=F[e];if(n)return n.handlesRead?n(R):n(R());{let t=R();for(let n=0;n<se.length;n++){let r=se[n](e,t);if(r!==void 0)return r}return new V(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(I||U())[e];if(t!==void 0)return t;throw Error(`Unknown token `+e)}default:if(isNaN(e)){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}throw Error(`Unknown CBOR token `+e)}}const me=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function he(e){if(!e)throw Error(`Structure is required in record definition`);function t(){let e=w[E++];if(e&=31,e>23)switch(e){case 24:e=w[E++];break;case 25:e=L.getUint16(E),E+=2;break;case 26:e=L.getUint32(E),E+=4;break;default:throw Error(`Expected array header, but got `+w[E-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(R);t=t.next}if(this.slowReads++>=de){let n=this.length==e?this:this.slice(0,e);return t=A.keyMap?Function(`r`,`return {`+n.map(e=>A.decodeKey(e)).map(e=>me.test(e)?z(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`):Function(`r`,`return {`+n.map(e=>me.test(e)?z(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(R)}let n={};if(A.keyMap)for(let t=0;t<e;t++)n[z(A.decodeKey(this[t]))]=R();else for(let t=0;t<e;t++)n[z(this[t])]=R();return n}return e.slowReads=0,t}function z(e){if(typeof e==`string`)return e===`__proto__`?`__proto_`:e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;throw Error(`Invalid property name type `+typeof e)}let ge=ve;function _e(e){ge=t(1);function t(t){return function(t){let n=k[ie++];if(n==null){if(N)return ve(t);let r=e(E,T,t,w);if(typeof r==`string`)n=r,k=te;else if(k=r,ie=1,M=1,n=k[0],n===void 0)throw Error(`Unexpected end of buffer`)}let r=n.length;return r<=t?(E+=t,n):(ae=n,oe=E,M=E+r,E+=t,n.slice(0,t))}}}function ve(e){let t;if(e<16&&(t=be(e)))return t;if(e>64&&ee)return ee.decode(w.subarray(E,E+=e));let n=E+e,r=[];for(t=``;E<n;){let e=w[E++];if(!(e&128))r.push(e);else if((e&224)==192){let t=w[E++]&63;r.push((e&31)<<6|t)}else if((e&240)==224){let t=w[E++]&63,n=w[E++]&63;r.push((e&31)<<12|t<<6|n)}else if((e&248)==240){let t=w[E++]&63,n=w[E++]&63,i=w[E++]&63,a=(e&7)<<18|t<<12|n<<6|i;a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a)}else r.push(e);r.length>=4096&&(t+=B.apply(String,r),r.length=0)}return r.length>0&&(t+=B.apply(String,r)),t}let B=String.fromCharCode;function ye(e){let t=E,n=Array(e);for(let r=0;r<e;r++){let e=w[E++];if((e&128)>0){E=t;return}n[r]=e}return B.apply(String,n)}function be(e){if(e<4)if(e<2){if(e===0)return``;{let e=w[E++];if((e&128)>1){--E;return}return B(e)}}else{let t=w[E++],n=w[E++];if((t&128)>0||(n&128)>0){E-=2;return}if(e<3)return B(t,n);let r=w[E++];if((r&128)>0){E-=3;return}return B(t,n,r)}else{let t=w[E++],n=w[E++],r=w[E++],i=w[E++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){E-=4;return}if(e<6){if(e===4)return B(t,n,r,i);{let e=w[E++];if((e&128)>0){E-=5;return}return B(t,n,r,i,e)}}else if(e<8){let a=w[E++],o=w[E++];if((a&128)>0||(o&128)>0){E-=6;return}if(e<7)return B(t,n,r,i,a,o);let s=w[E++];if((s&128)>0){E-=7;return}return B(t,n,r,i,a,o,s)}else{let a=w[E++],o=w[E++],s=w[E++],c=w[E++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){E-=8;return}if(e<10){if(e===8)return B(t,n,r,i,a,o,s,c);{let e=w[E++];if((e&128)>0){E-=9;return}return B(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=w[E++],u=w[E++];if((l&128)>0||(u&128)>0){E-=10;return}if(e<11)return B(t,n,r,i,a,o,s,c,l,u);let d=w[E++];if((d&128)>0){E-=11;return}return B(t,n,r,i,a,o,s,c,l,u,d)}else{let l=w[E++],u=w[E++],d=w[E++],f=w[E++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){E-=12;return}if(e<14){if(e===12)return B(t,n,r,i,a,o,s,c,l,u,d,f);{let e=w[E++];if((e&128)>0){E-=13;return}return B(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=w[E++],m=w[E++];if((p&128)>0||(m&128)>0){E-=14;return}if(e<15)return B(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=w[E++];if((h&128)>0){E-=15;return}return B(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function xe(e){return A.copyBuffers?Uint8Array.prototype.slice.call(w,E,E+=e):w.subarray(E,E+=e)}let Se=new Float32Array(1),Ce=new Uint8Array(Se.buffer,0,4);function we(){let e=w[E++],t=w[E++],n=(e&127)>>2;if(n===31)return t||e&3?NaN:e&128?-1/0:1/0;if(n===0){let n=((e&3)<<8|t)/(1<<24);return e&128?-n:n}return Ce[3]=e&128|(n>>1)+56,Ce[2]=(e&7)<<5|t>>3,Ce[1]=t<<5,Ce[0]=0,Se[0]}Array(4096);var V=class{constructor(e,t){this.value=e,this.tag=t}};F[0]=e=>new Date(e),F[1]=e=>new Date(Math.round(e*1e3)),F[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+(t<<BigInt(8));return t},F[3]=e=>BigInt(-1)-F[2](e),F[4]=e=>+(e[1]+`e`+e[0]),F[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const Te=(e,t)=>{e-=57344;let n=j[e];n&&n.isShared&&((j.restoreStructures||=[])[e]=n),j[e]=t,t.read=he(t)};F[105]=e=>{let t=e.length,n=e[1];Te(e[0],n);let r={};for(let i=2;i<t;i++){let t=n[i-2];r[z(t)]=e[i]}return r},F[14]=e=>N?N[0].slice(N.position0,N.position0+=e):new V(e,14),F[15]=e=>N?N[1].slice(N.position1,N.position1+=e):new V(e,15);let Ee={Error,RegExp};F[27]=e=>(Ee[e[0]]||Error)(e[1],e[2]);const De=e=>{if(w[E++]!=132){let e=Error(`Packed values structure must be followed by a 4 element array`);throw w.length<E&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=Error(`Packed values structure must be followed by a 4 element array`);throw e.incomplete=!0,e}return I=I?t.concat(I.slice(t.length)):t,I.prefixes=e(),I.suffixes=e(),e()};De.handlesRead=!0,F[51]=De,F[6]=e=>{if(!I)if(A.getShared)Ne();else return new V(e,6);if(typeof e==`number`)return I[16+(e>=0?2*e:-2*e-1)];let t=Error(`No support for non-integer packed references yet`);throw e===void 0&&(t.incomplete=!0),t},F[28]=e=>{P||(P=new Map,P.id=0);let t=P.id++,n=E,r=w[E],i;i=r>>5==4?[]:{};let a={target:i};P.set(t,a);let o=e();return a.used?(Object.getPrototypeOf(i)!==Object.getPrototypeOf(o)&&(E=n,i=o,P.set(t,{target:i}),o=e()),Object.assign(i,o)):(a.target=o,o)},F[28].handlesRead=!0,F[29]=e=>{let t=P.get(e);return t.used=!0,t.target},F[258]=e=>new Set(e),(F[259]=e=>(A.mapsAsObjects&&(A.mapsAsObjects=!1,ce=!0),e())).handlesRead=!0;function H(e,t){return typeof e==`string`?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function U(){if(!I)if(A.getShared)Ne();else throw Error(`No packed values available`);return I}se.push((e,t)=>{if(e>=225&&e<=255)return H(U().prefixes[e-224],t);if(e>=28704&&e<=32767)return H(U().prefixes[e-28672],t);if(e>=1879052288&&e<=2147483647)return H(U().prefixes[e-1879048192],t);if(e>=216&&e<=223)return H(t,U().suffixes[e-216]);if(e>=27647&&e<=28671)return H(t,U().suffixes[e-27639]);if(e>=1811940352&&e<=1879048191)return H(t,U().suffixes[e-1811939328]);if(e==1399353956)return{packedValues:I,structures:j.slice(0),version:t};if(e==55799)return t});const Oe=new Uint8Array(new Uint16Array([1]).buffer)[0]==1,ke=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?{name:`BigUint64Array`}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?{name:`BigInt64Array`}:BigInt64Array,Float32Array,Float64Array],Ae=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<ke.length;e++)je(ke[e],Ae[e]);function je(e,t){let n=`get`+e.name.slice(0,-5),r;typeof e==`function`?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&r==1)continue;let a=r==2?1:r==4?2:r==8?3:0;F[i?t:t-4]=r==1||i==Oe?n=>{if(!e)throw Error(`Could not find typed array for code `+t);return!A.copyBuffers&&(r===1||r===2&&!(n.byteOffset&1)||r===4&&!(n.byteOffset&3)||r===8&&!(n.byteOffset&7))?new e(n.buffer,n.byteOffset,n.byteLength>>a):new e(Uint8Array.prototype.slice.call(n,0).buffer)}:r=>{if(!e)throw Error(`Could not find typed array for code `+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=r.length>>a,c=new e(s),l=o[n];for(let e=0;e<s;e++)c[e]=l.call(o,e<<a,i);return c}}}function Me(){let e=W(),t=E+R();for(let t=2;t<e;t++){let e=W();E+=e}let n=E;return E=t,N=[ve(W()),ve(W())],N.position0=0,N.position1=0,N.postBundlePosition=E,E=n,R()}function W(){let e=w[E++]&31;if(e>23)switch(e){case 24:e=w[E++];break;case 25:e=L.getUint16(E),E+=2;break;case 26:e=L.getUint32(E),E+=4;break}return e}function Ne(){if(A.getShared){let e=Pe(()=>(w=null,A.getShared()))||{},t=e.structures||[];A.sharedVersion=e.version,I=A.sharedValues=e.packedValues,j===!0?A.structures=j=t:j.splice.apply(j,[0,t.length].concat(t))}}function Pe(e){let t=T,n=E,r=ie,i=oe,a=M,o=ae,s=k,c=P,l=N,u=new Uint8Array(w.slice(0,T)),d=j,f=A,p=ue,m=e();return T=t,E=n,ie=r,oe=i,M=a,ae=o,k=s,P=c,N=l,w=u,ue=p,j=d,A=f,L=new DataView(w.buffer,w.byteOffset,w.byteLength),m}function Fe(){w=null,P=null,j=null}const Ie=Array(147);for(let e=0;e<256;e++)Ie[e]=+(`1e`+Math.floor(45.15-e*.30103));let Le=new fe({useRecords:!1});const Re=Le.decode;Le.decodeMultiple;const ze={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let Be;try{Be=new TextEncoder}catch{}let Ve,He;const Ue=typeof globalThis==`object`&&globalThis.Buffer,We=Ue!==void 0,Ge=We?Ue.allocUnsafeSlow:Uint8Array,Ke=We?Ue:Uint8Array,qe=We?4294967296:2144337920;let Je,G,K,q=0,J,Y=null;const Ye=/[\u0080-\uFFFF]/,X=Symbol(`record-id`);var Xe=class extends fe{constructor(e){super(e),this.offset=0;let t,n,r,i,a;e||={};let o=Ke.prototype.utf8Write?function(e,t,n){return G.utf8Write(e,t,n)}:Be&&Be.encodeInto?function(e,t){return Be.encodeInto(e,G.subarray(t)).written}:!1,s=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?128:0,l>8190)throw Error(`Maximum maxSharedStructure is 8190`);let u=e.sequential;u&&(l=0),this.structures||=[],this.saveStructures&&(this.saveShared=this.saveStructures);let d,f,p=e.sharedValues,m;if(p){m=Object.create(null);for(let e=0,t=p.length;e<t;e++)m[p[e]]=e}let h=[],g=0,_=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped)switch(e.constructor.name){case`Array`:e=e.map(e=>this.encodeKeys(e));break}return this.encode(e,t)},this.encode=function(o,c){if(G||(G=new Ge(8192),K=new DataView(G.buffer,0,8192),q=0),J=G.length-10,J-q<2048?(G=new Ge(G.length),K=new DataView(G.buffer,0,G.length),J=G.length-10,q=0):c===512&&(q=q+7&2147483640),t=q,s.useSelfDescribedHeader&&(K.setUint32(q,3654940416),q+=3),a=s.structuredClone?new Map:null,s.bundleStrings&&typeof o!=`string`?(Y=[],Y.size=1/0):Y=null,n=s.structures,n){if(n.uninitialized){let e=s.getShared()||{};s.structures=n=e.structures||[],s.sharedVersion=e.version;let t=s.sharedValues=e.packedValues;if(t){m={};for(let e=0,n=t.length;e<n;e++)m[t[e]]=e}}let e=n.length;if(e>l&&!u&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let n=0,a=e.length;n<a;n++){i[X]===void 0&&(i[X]=t);let a=e[n];r=i[a],r||=i[a]=Object.create(null),i=r}i[X]=t|1048576}}u||(n.nextId=e)}if(r&&=!1,i=n||[],f=m,e.pack){let t=new Map;if(t.values=[],t.encoder=s,t.maxValues=e.maxPrivatePackedValues||(m?16:1/0),t.objectMap=m||!1,t.samplingPackedValues=d,tt(o,t),t.values.length>0){G[q++]=216,G[q++]=51,Z(4);let e=t.values;v(e),Z(0),Z(0),f=Object.create(m||null);for(let t=0,n=e.length;t<n;t++)f[e[t]]=t}}Je=c&ft;try{if(Je)return;if(v(o),Y&&at(t,v),s.offset=q,a&&a.idsToInsert){q+=a.idsToInsert.length*2,q>J&&b(q),s.offset=q;let e=it(G.subarray(t,q),a.idsToInsert);return a=null,e}return c&512?(G.start=t,G.end=q,G):G.subarray(t,q)}finally{if(n){if(_<10&&_++,n.length>l&&(n.length=l),g>1e4)n.transitions=null,_=0,g=0,h.length>0&&(h=[]);else if(h.length>0&&!u){for(let e=0,t=h.length;e<t;e++)h[e][X]=void 0;h=[]}}if(r&&s.saveShared){s.structures.length>l&&(s.structures=s.structures.slice(0,l));let e=G.subarray(t,q);return s.updateSharedData()===!1?s.encode(o):e}c&1024&&(q=t)}},this.findCommonStringsToPack=()=>(d=new Map,m||=Object.create(null),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;p||=this.sharedValues=[];for(let[e,i]of d)i.count>t&&(m[e]=n++,p.push(e),r=!0);for(;this.saveShared&&this.updateSharedData()===!1;);d=null});let v=n=>{q>J&&(G=b(q));var r=typeof n,i;if(r===`string`){if(f){let t=f[n];if(t>=0){t<16?G[q++]=t+224:(G[q++]=198,t&1?v(15-t>>1):v(t-16>>1));return}else if(d&&!e.pack){let e=d.get(n);e?e.count++:d.set(n,{count:1})}}let r=n.length;if(Y&&r>=4&&r<1024){if((Y.size+=r)>61440){let e,n=(Y[0]?Y[0].length*3+Y[1].length:0)+10;q+n>J&&(G=b(q+n)),G[q++]=217,G[q++]=223,G[q++]=249,G[q++]=Y.position?132:130,G[q++]=26,e=q-t,q+=4,Y.position&&at(t,v),Y=[``,``],Y.size=0,Y.position=e}let e=Ye.test(n);Y[+!e]+=n,G[q++]=e?206:207,v(r);return}let a;a=r<32?1:r<256?2:r<65536?3:5;let s=r*3;if(q+s>J&&(G=b(q+s)),r<64||!o){let e,t,o,s=q+a;for(e=0;e<r;e++)t=n.charCodeAt(e),t<128?G[s++]=t:t<2048?(G[s++]=t>>6|192,G[s++]=t&63|128):(t&64512)==55296&&((o=n.charCodeAt(e+1))&64512)==56320?(t=65536+((t&1023)<<10)+(o&1023),e++,G[s++]=t>>18|240,G[s++]=t>>12&63|128,G[s++]=t>>6&63|128,G[s++]=t&63|128):(G[s++]=t>>12|224,G[s++]=t>>6&63|128,G[s++]=t&63|128);i=s-q-a}else i=o(n,q+a,s);i<24?G[q++]=96|i:i<256?(a<2&&G.copyWithin(q+2,q+1,q+1+i),G[q++]=120,G[q++]=i):i<65536?(a<3&&G.copyWithin(q+3,q+2,q+2+i),G[q++]=121,G[q++]=i>>8,G[q++]=i&255):(a<5&&G.copyWithin(q+5,q+3,q+3+i),G[q++]=122,K.setUint32(q,i),q+=4),q+=i}else if(r===`number`)if(!this.alwaysUseFloat&&n>>>0===n)n<24?G[q++]=n:n<256?(G[q++]=24,G[q++]=n):n<65536?(G[q++]=25,G[q++]=n>>8,G[q++]=n&255):(G[q++]=26,K.setUint32(q,n),q+=4);else if(!this.alwaysUseFloat&&n>>0===n)n>=-24?G[q++]=31-n:n>=-256?(G[q++]=56,G[q++]=~n):n>=-65536?(G[q++]=57,K.setUint16(q,~n),q+=2):(G[q++]=58,K.setUint32(q,~n),q+=4);else{let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){G[q++]=250,K.setFloat32(q,n);let t;if(e<4||(t=n*Ie[(G[q]&127)<<1|G[q+1]>>7])>>0===t){q+=4;return}else q--}G[q++]=251,K.setFloat64(q,n),q+=8}else if(r===`object`)if(!n)G[q++]=246;else{if(a){let e=a.get(n);if(e){if(G[q++]=216,G[q++]=29,G[q++]=25,!e.references){let t=a.idsToInsert||=[];e.references=[],t.push(e)}e.references.push(q-t),q+=2;return}else a.set(n,{offset:q-t})}let e=n.constructor;if(e===Object)y(n);else if(e===Array){i=n.length,i<24?G[q++]=128|i:Z(i);for(let e=0;e<i;e++)v(n[e])}else if(e===Map)if((this.mapsAsObjects?this.useTag259ForMaps!==!1:this.useTag259ForMaps)&&(G[q++]=217,G[q++]=1,G[q++]=3),i=n.size,i<24?G[q++]=160|i:i<256?(G[q++]=184,G[q++]=i):i<65536?(G[q++]=185,G[q++]=i>>8,G[q++]=i&255):(G[q++]=186,K.setUint32(q,i),q+=4),s.keyMap)for(let[e,t]of n)v(s.encodeKey(e)),v(t);else for(let[e,t]of n)v(e),v(t);else{for(let e=0,t=Ve.length;e<t;e++){let t=He[e];if(n instanceof t){let t=Ve[e],r=t.tag;r??=t.getTag&&t.getTag.call(this,n),r<24?G[q++]=192|r:r<256?(G[q++]=216,G[q++]=r):r<65536?(G[q++]=217,G[q++]=r>>8,G[q++]=r&255):r>-1&&(G[q++]=218,K.setUint32(q,r),q+=4),t.encode.call(this,n,v,b);return}}if(n[Symbol.iterator]){if(Je){let e=Error(`Iterable should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}G[q++]=159;for(let e of n)v(e);G[q++]=255;return}if(n[Symbol.asyncIterator]||et(n)){let e=Error(`Iterable/blob should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){let e=n.toJSON();if(e!==n)return v(e)}y(n)}}else if(r===`boolean`)G[q++]=n?245:244;else if(r===`bigint`){if(n<BigInt(1)<<BigInt(64)&&n>=0)G[q++]=27,K.setBigUint64(q,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)G[q++]=59,K.setBigUint64(q,-n-BigInt(1));else if(this.largeBigIntToFloat)G[q++]=251,K.setFloat64(q,Number(n));else{n>=BigInt(0)?G[q++]=194:(G[q++]=195,n=BigInt(-1)-n);let e=[];for(;n;)e.push(Number(n&BigInt(255))),n>>=BigInt(8);rt(new Uint8Array(e.reverse()),b);return}q+=8}else if(r===`undefined`)G[q++]=247;else throw Error(`Unknown type: `+r)},y=this.useRecords===!1?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?G[q++]=160|r:r<256?(G[q++]=184,G[q++]=r):r<65536?(G[q++]=185,G[q++]=r>>8,G[q++]=r&255):(G[q++]=186,K.setUint32(q,r),q+=4),s.keyMap)for(let e=0;e<r;e++)v(s.encodeKey(t[e])),v(n[e]);else for(let e=0;e<r;e++)v(t[e]),v(n[e])}:e=>{G[q++]=185;let n=q-t;q+=2;let r=0;if(s.keyMap)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(s.encodeKey(t)),v(e[t]),r++);else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(t),v(e[t]),r++);G[n+++t]=r>>8,G[n+t]=r&255}:(e,t)=>{let n,a=i.transitions||=Object.create(null),o=0,s=0,c,u;if(this.keyMap){u=Object.keys(e).map(e=>this.encodeKey(e)),s=u.length;for(let e=0;e<s;e++){let t=u[e];n=a[t],n||(n=a[t]=Object.create(null),o++),a=n}}else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(n=a[t],n||(a[X]&1048576&&(c=a[X]&65535),n=a[t]=Object.create(null),o++),a=n,s++);let d=a[X];if(d!==void 0)d&=65535,G[q++]=217,G[q++]=d>>8|224,G[q++]=d&255;else if(u||=a.__keys__||=Object.keys(e),c===void 0?(d=i.nextId++,d||(d=0,i.nextId=1),d>=256&&(i.nextId=(d=l)+1)):d=c,i[d]=u,d<l){G[q++]=217,G[q++]=d>>8|224,G[q++]=d&255,a=i.transitions;for(let e=0;e<s;e++)(a[X]===void 0||a[X]&1048576)&&(a[X]=d),a=a[u[e]];a[X]=d|1048576,r=!0}else{if(a[X]=d,K.setUint32(q,3655335680),q+=3,o&&(g+=_*o),h.length>=256-l&&(h.shift()[X]=void 0),h.push(a),Z(s+2),v(57344+d),v(u),t)return;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t]);return}if(s<24?G[q++]=128|s:Z(s),!t)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t])},b=e=>{let n;if(e>16777216){if(e-t>qe)throw Error(`Encoded buffer would be larger than maximum buffer size`);n=Math.min(qe,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,G.length-1)>>12)+1<<12;let r=new Ge(n);return K=new DataView(r.buffer,0,n),G.copy?G.copy(r,0,t,e):r.set(G.slice(t,e)),q-=t,t=0,J=r.length-10,G=r},x=100,S=1e3;this.encodeAsIterable=function(e,t){return T(e,t,C)},this.encodeAsAsyncIterable=function(e,t){return T(e,t,E)};function*C(e,n,r){let i=e.constructor;if(i===Object){let t=s.useRecords!==!1;t?y(e,!0):Ze(Object.keys(e).length,160);for(let r in e){let i=e[r];t||v(r),i&&typeof i==`object`?n[r]?yield*C(i,n[r]):yield*ee(i,n,r):v(i)}}else if(i===Array){let r=e.length;Z(r);for(let i=0;i<r;i++){let r=e[i];r&&(typeof r==`object`||q-t>x)?n.element?yield*C(r,n.element):yield*ee(r,n,`element`):v(r)}}else if(e[Symbol.iterator]&&!e.buffer){G[q++]=159;for(let r of e)r&&(typeof r==`object`||q-t>x)?n.element?yield*C(r,n.element):yield*ee(r,n,`element`):v(r);G[q++]=255}else et(e)?(Ze(e.size,64),yield G.subarray(t,q),yield e,w()):e[Symbol.asyncIterator]?(G[q++]=159,yield G.subarray(t,q),yield e,w(),G[q++]=255):v(e);r&&q>t?yield G.subarray(t,q):q-t>x&&(yield G.subarray(t,q),w())}function*ee(e,n,r){let i=q-t;try{v(e),q-t>x&&(yield G.subarray(t,q),w())}catch(a){if(a.iteratorNotHandled)n[r]={},q=t+i,yield*C.call(this,e,n[r]);else throw a}}function w(){x=S,s.encode(null,ft)}function T(e,t,n){return x=t&&t.chunkThreshold?S=t.chunkThreshold:100,e&&typeof e==`object`?(s.encode(null,ft),n(e,s.iterateProperties||={},!0)):[s.encode(e)]}async function*E(e,t){for(let n of C(e,t,!0)){let e=n.constructor;if(e===Ke||e===Uint8Array)yield n;else if(et(n)){let e=n.stream().getReader(),t;for(;!(t=await e.read()).done;)yield t.value}else if(n[Symbol.asyncIterator])for await(let e of n)w(),e?yield*E(e,t.async||={}):yield s.encode(e);else yield n}}}useBuffer(e){G=e,K=new DataView(G.buffer,G.byteOffset,G.byteLength),q=0}clearSharedData(){this.structures&&=[],this.sharedValues&&=void 0}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new Qe(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,t=>(t&&t.version||0)==e);return r===!1?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach((e,t)=>this.structures[t]=e),r}};function Ze(e,t){e<24?G[q++]=t|e:e<256?(G[q++]=t|24,G[q++]=e):e<65536?(G[q++]=t|25,G[q++]=e>>8,G[q++]=e&255):(G[q++]=t|26,K.setUint32(q,e),q+=4)}var Qe=class{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}};function Z(e){e<24?G[q++]=128|e:e<256?(G[q++]=152,G[q++]=e):e<65536?(G[q++]=153,G[q++]=e>>8,G[q++]=e&255):(G[q++]=154,K.setUint32(q,e),q+=4)}const $e=typeof Blob>`u`?function(){}:Blob;function et(e){if(e instanceof $e)return!0;let t=e[Symbol.toStringTag];return t===`Blob`||t===`File`}function tt(e,t){switch(typeof e){case`string`:if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)++n.count==2&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case`object`:if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)tt(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&tt(n,t),tt(e[n],t))}break;case`function`:console.log(e)}}const nt=new Uint8Array(new Uint16Array([1]).buffer)[0]==1;He=[Date,Set,Error,RegExp,V,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?function(){}:BigInt64Array,Float32Array,Float64Array,Qe],Ve=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||e.getMilliseconds()===0)&&n>=0&&n<4294967296?(G[q++]=26,K.setUint32(q,n),q+=4):(G[q++]=251,K.setFloat64(q,n),q+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t([`RegExp`,e.source,e.flags])}},{getTag(e){return e.tag},encode(e,t){t(e.value)}},{encode(e,t,n){rt(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||We&&this.tagUint8Array!==!1))return 64},encode(e,t,n){rt(e,n)}},Q(68,1),Q(69,2),Q(70,4),Q(71,8),Q(72,1),Q(77,2),Q(78,4),Q(79,8),Q(85,4),Q(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){G[q++]=216,G[q++]=51,Z(4);let e=n.values;t(e),Z(0),Z(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){K.setUint32(q,3655335424),q+=3;let n=r.slice(0);n.unshift(57344),n.push(new V(e.version,1399353956)),t(n)}else t(new V(e.version,1399353956))}}];function Q(e,t){return!nt&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,i=e.buffer||e;t(We?Ue.from(i,r,n):new Uint8Array(i,r,n))}}}function rt(e,t){let n=e.byteLength;n<24?G[q++]=64+n:n<256?(G[q++]=88,G[q++]=n):n<65536?(G[q++]=89,G[q++]=n>>8,G[q++]=n&255):(G[q++]=90,K.setUint32(q,n),q+=4),q+n>=G.length&&t(q+n),G.set(e.buffer?e:new Uint8Array(e),q),q+=n}function it(e,t){let n,r=t.length*2,i=e.length-r;t.sort((e,t)=>e.offset>t.offset?1:-1);for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=n&255}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,i),r-=2;let a=t+r;e[a++]=216,e[a++]=28,i=t}return e}function at(e,t){K.setUint32(Y.position+e,q-Y.position-e+1);let n=Y;Y=null,t(n[0]),t(n[1])}let ot=new Xe({useRecords:!1});const st=ot.encode;ot.encodeAsIterable,ot.encodeAsAsyncIterable;const{NEVER:ct,ALWAYS:lt,DECIMAL_ROUND:ut,DECIMAL_FIT:dt}=ze,ft=2048;if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let e;try{e=typeof t==`function`?t(`cbor-extract`):_(import.meta.url)(`cbor-extract`),e&&_e(e.extractStrings)}catch{}}var pt=p();let mt,ht,gt;const _t={connections:8,keepAliveTimeout:1e4},vt={..._t,allowH2:!1,pipelining:1},yt={..._t,allowH2:!0,pipelining:100,initialWindowSize:4194304,connectionWindowSize:16777216},bt={..._t,allowH2:!1,pipelining:1},xt={..._t,allowH2:!0,pipelining:1},St={retryAfter:!0,statusCodes:[500,502,503,504]},Ct={retryAfter:!0,methods:[`PUT`],statusCodes:[429]},wt={retryAfter:!0,methods:[`PUT`],statusCodes:[429,500,502,503,504]};function Tt(){return process.env.WORKFLOW_H2_MULTIPLEX!==`0`}function Et(e){if(!e||typeof e!=`object`||Array.isArray(e))return NaN;let t=e,n=t[`content-length`]??t[`Content-Length`];return typeof n==`string`||typeof n==`number`?Number(n):NaN}function Dt(e){return(t,n)=>{let r=t.body,i=!!r&&typeof r!=`string`&&!Buffer.isBuffer(r)&&typeof r[Symbol.asyncIterator]==`function`,a=Et(t.headers);return!i||!(a>=0)||a>1048576?e({...t,idempotent:!0},n):((async()=>{try{let i=[];for await(let e of r)i.push(Buffer.from(e));e({...t,body:Buffer.concat(i),idempotent:!0},n)}catch(e){n.onError?.(e)}})(),!0)}}const Ot=new Set([`UND_ERR_INFO`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`]);function kt(e){let t=e;for(let e=0;t&&e<8;e++){let e=t.code;if(typeof e==`string`&&Ot.has(e))return!0;t=t.cause}return!1}function At(e,t){let n,r=0,i=0;function a(e){let t=setTimeout(()=>{Promise.resolve(e.close?.()).catch(()=>void 0)},5e3),n=setTimeout(()=>{Promise.resolve(e.destroy?.()).catch(()=>void 0)},6e4);t.unref?.(),n.unref?.()}return{get(){return n??=e(),n},note(e,o){if(!n||e!==n)return;if(o===void 0){r=0;return}if(!kt(o)||(r++,r<3))return;let s=Date.now();if(s-i<5e3)return;i=s,r=0;let c=n;n=void 0,console.warn(`[workflow] ${t}: rebuilding connection pool after 3 consecutive transport failures`),a(c)}}}const jt=At(()=>Rt(),`events transport`);function Mt(e,t){jt.note(e,t)}function Nt(e){return e?.dispatcher??Vt()}function Pt(e){return e?.dispatcher??jt.get()}function Ft(e){return e?.dispatcher??Ht()}function It(e){return e?.dispatcher??Ut()}function Lt(e,t){return new pt.RetryAgent(new pt.Agent(e),t)}function Rt(e){let t=Tt(),n=new pt.RetryAgent(new pt.Agent({...t?yt:bt,...e}),St);return t?zt(n,n.compose(Dt)):n}function zt(e,t){return new Proxy(t,{get:(t,n)=>n===`close`||n===`destroy`?e[n].bind(e):t[n]})}function Bt(e,t){return new pt.RetryAgent(new pt.Agent({...xt,...t}),e)}function Vt(){return mt??=Lt(vt,St),mt}function Ht(){return ht??=Bt(Ct),ht}function Ut(){return gt??=Bt(wt),gt}let Wt=null;async function Gt(){return Wt||=import(`../../@opentelemetry/api/index.js`).catch(e=>(typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)&&console.warn(`[workflow] @opentelemetry/api unavailable — world-vercel spans disabled:`,e instanceof Error?e.message:e),null)),Wt}let Kt=null;function qt(){return typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)}let Jt=!1;function Yt(e,t){if(!(Jt||!qt())){Jt=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.world_vercel`);console.warn(`[workflow:otel-diag] world-vercel`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] world-vercel failed:`,e instanceof Error?e.message:e)}}}async function Xt(){return Kt||=Gt().then(e=>{if(!e)return null;let t=e.trace.getTracer(`workflow`);return Yt(e,t),t}),Kt}async function Zt(e,...t){let[n,r]=await Promise.all([Xt(),Gt()]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function Qt(e){let t=await Gt();if(t)return t.SpanKind[e]}async function $t(e){let t=await Gt();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function $(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const en=$(`http.request.method`),tn=$(`url.full`),nn=$(`server.address`),rn=$(`server.port`),an=$(`http.response.status_code`),on=$(`error.type`),sn=$(`workflow.world.parse.format`),cn=$(`peer.service`),ln=$(`rpc.system`),un=$(`rpc.service`),dn=$(`rpc.method`),fn=$(`workflow.run.id`),pn=$(`step.id`),mn=$(`workflow.stream.name`),hn=$(`workflow.stream.operation`),gn=$(`workflow.stream.start_index`),_n=()=>f(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1}),vn=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),yn=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function bn(e){return yn.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function xn(e){let t=bn(e);return t.length>0?` (${t.join(`; `)})`:``}function Sn(e,t,n,r){if(!vn)return;let i=bn(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function Cn(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function wn(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function Tn(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}function En(e,t,n={}){let{retryAfter:l,code:u,url:d,mitigated:f,details:p}=n;return e===409?new c(t):e===410?new o(t):e===412?new a(t,{retryAfter:l,details:p}):e===425?new i(t,{retryAfter:l}):e===429?Dn(e,f)?new r(`${t} (x-vercel-mitigated=challenge)`,{url:d,status:e,code:`TRANSPORT`,retryAfter:l}):new s(t,{retryAfter:l}):new r(t,{url:d,status:e,code:u,retryAfter:l})}function Dn(e,t){return e===429&&t===`challenge`}async function On(e){return e?.token??process.env.VERCEL_TOKEN??await(0,C.getVercelOidcToken)().catch(()=>null)}function kn(e){try{let t=new URL(e);return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):t.protocol===`https:`?443:80}}catch{return{}}}function An(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=kn(n);return{...en(t),...tn(n),...i?nn(i):{},...a?rn(a):{},...cn(r),...ln(`http`),...un(r)}}async function jn(e){let{method:t,url:n,headers:i,body:a,dispatcher:o,peerService:s=`workflow-server`,timeoutMs:c=_n(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g,onTransportOutcome:_}=e,v=f??n;return Zt(m??`http ${t}`,{kind:await Qt(`CLIENT`)},async e=>{if(m&&vn&&e){let t=e.spanContext();console.warn(`[workflow:otel-diag] span-open`,JSON.stringify({spanName:m,traceId:t.traceId,spanId:t.spanId,recording:e.isRecording()}))}e?.setAttributes(An({method:t,url:n,peerService:s})),h&&e?.setAttributes(h),u&&await $t(i),d&&i.set(`X-Request-Time`,Date.now().toString());let f=c==null?void 0:AbortSignal.timeout(c),y=l&&f?AbortSignal.any([l,f]):l??f,b=Date.now(),x;try{x=await fetch(n,{method:t,headers:i,body:a,signal:y,dispatcher:o})}catch(i){let a=Date.now()-b;if(_?.(i),i instanceof Error&&(i.name===`TimeoutError`||i.name===`AbortError`)){let o=new r(`${t} ${v} timed out after ${a}ms`,{url:n,cause:i});throw e?.setAttributes({...on(`TIMEOUT`)}),e?.recordException?.(o),o}throw i}let S=Date.now()-b;if(_?.(),Sn(t,v,x,S),e?.setAttributes({...an(x.status)}),g&&e?.setAttributes({[g]:S}),!x.ok){if(e?.setAttributes({...on(`HTTP ${x.status}`)}),Cn(t,n,i),p){let t=await p(x);throw e?.recordException?.(t),t}let r=await x.text().catch(()=>``),a=En(x.status,`${t} ${v} -> HTTP ${x.status}: ${x.statusText}${r?` ${r}`:``}${xn(x.headers)}`,{url:n,retryAfter:wn(x.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return x})}const Mn=`5.0.0-beta.37`,Nn=new Set([`GET`,`HEAD`]),Pn=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`]);function Fn(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&Pn.has(e))return e}t=t?.cause}}const In=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,Ln=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function Rn(e){return e}const zn=(...e)=>e.filter(Boolean).join(` `),Bn=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${Mn} node-${process.version} ${y.platform()} (${y.arch()}) ${e}`:`@workflow/world-vercel/${Mn} node-${process.version} ${y.platform()} (${y.arch()})`},Vn=e=>{let t=e?.projectConfig,n=In()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},Hn=e=>{let t=e?.projectConfig;return t?t.environment||`production`:process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV||void 0},Un=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,zn(Bn(),r.get(`User-Agent`)));let i=Ln();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,Hn(e)),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=In();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function Wn(e){let{baseUrl:t,usingProxy:n}=Vn(e),r=Un(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,C.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function Gn({endpoint:e,options:t={},config:n={},schema:i,data:a,onResponse:o,retryConnectTimeout:s=!1}){let c=t.method||`GET`,{baseUrl:l,headers:u}=await Wn(n),d=`${l}${e}`;return Zt(`http ${c}`,{kind:await Qt(`CLIENT`)},async l=>{l?.setAttributes(An({method:c,url:d,peerService:`workflow-server`})),u.set(`Accept`,`application/cbor`),await $t(u);let f;a!==void 0&&(u.set(`Content-Type`,`application/cbor`),f=st(a));let p=Nn.has(c.toUpperCase()),m,h=``;for(let i=0;;i++){u.set(`X-Request-Time`,Date.now().toString());let a=AbortSignal.timeout(_n()),g=t.signal?AbortSignal.any([t.signal,a]):a,_=new Request(d,{...t,body:f,headers:u,signal:g}),v=Date.now(),y;try{y=await fetch(_,{dispatcher:Nt(n)})}catch(t){let n=Date.now()-v;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let i=new r(`${c} ${e} timed out after ${n}ms`,{url:d,code:`TIMEOUT`,cause:t});throw l?.setAttributes({...on(`TIMEOUT`)}),l?.recordException?.(i),i}let a=Fn(t);if(a){if(s&&p&&a===`UND_ERR_CONNECT_TIMEOUT`&&i===0){await new Promise(e=>setTimeout(e,100));continue}let o=new r(`${c} ${e} transport failure after ${n}ms (${a})`,{url:d,code:`TRANSPORT`,cause:t});throw l?.setAttributes({...on(`TRANSPORT`)}),l?.recordException?.(o),o}throw t}let b=Date.now()-v;if(h=xn(y.headers),Sn(c,e,y,b),l?.setAttributes({...an(y.status)}),!y.ok){let t=await qn(y).then(e=>e.data).catch(()=>({})),n=t.code??t.error;Cn(_.method,d,u);let r=wn(y.headers.get(`Retry-After`)),i=(t.message||`${_.method} ${e} -> HTTP ${y.status}: ${y.statusText}`)+h,a=En(y.status,i,{url:d,code:n,retryAfter:r,mitigated:y.headers.get(`x-vercel-mitigated`)});throw l?.setAttributes({...on(n||`HTTP ${y.status}`)}),l?.recordException?.(a),a}o?.(y);try{m=await Zt(`world.parse`,async e=>{let t=await qn(y),n=(y.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...sn(n?`cbor`:`json`)}),t});break}catch(t){if(p&&i<2){let n=100*2**i;l?.setAttributes({...on(`PARSE_ERROR_RETRYING`)}),vn&&console.debug(`[workflow:world-vercel:http] ${c} ${e} body parse failed (attempt ${i+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=y.headers.get(`Content-Type`)||`unknown`;throw new r(`Failed to parse response body for ${c} ${e}${h} (Content-Type: ${n}):\n\n${t}`,{url:d,code:`PARSE_ERROR`,cause:t})}}return await Zt(`world.validate`,async()=>{let t=i.safeParse(m.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
3
|
-
`),i=process.env.DEBUG?`\n\nResponse context: ${m.getDebugContext()}`:``;throw new r(`Schema validation failed for ${c} ${e}${h}:\n${n}${i}`,{url:d,code:`SCHEMA_VALIDATION`,cause:t.error})}return t.data})})}function Kn(e){let t=v(e,{depth:3,maxArrayLength:10,breakLength:120});return t.length>500?`${t.slice(0,500)}...`:t}async function qn(e){let t=e.headers.get(`Content-Type`)||``;if(t.includes(`application/cbor`)){let n=await e.arrayBuffer(),r=Re(new Uint8Array(n));return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.byteLength} bytes (CBOR), preview: ${Kn(r)}`}}let n=await e.text(),r=JSON.parse(n);return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.length} bytes, preview: ${Kn(r)}`}}function Jn(){return process.env.WORKFLOW_EVENTS_TRANSPORT===`ws`}const Yn=`application/vnd.workflow.v4-frames`,Xn=d(l(),u());function Zn(e,t){let n=new Uint8Array(st(e)),r=new Uint8Array(4+n.byteLength+4+t.byteLength),i=new DataView(r.buffer);return i.setUint32(0,n.byteLength,!1),r.set(n,4),i.setUint32(4+n.byteLength,t.byteLength,!1),r.set(t,4+n.byteLength+4),r}async function*Qn(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():er(e.getReader()),n=new Uint8Array,r=async e=>{for(;n.byteLength<e;){let{done:e,value:r}=await t.next();if(e)return!1;if(!r||r.byteLength===0)continue;let i=new Uint8Array(n.byteLength+r.byteLength);i.set(n,0),i.set(r,n.byteLength),n=i}return!0},i=e=>{let t=n.subarray(0,e);return n=n.subarray(e),t};try{for(;;){if(!await r(4))return;let e=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),!await r(e))throw Error(`decodeFrames: truncated meta block`);let t=Xn.parse(Re(i(e)));if(!await r(4))throw Error(`decodeFrames: truncated body length`);let a=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),a>0&&!await r(a))throw Error(`decodeFrames: truncated body bytes`);if(yield{meta:t,body:n.slice(0,a)},i(a),t._end===1)return}}finally{$n(()=>t.return?.())}}function $n(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}async function*er(e){try{for(;;){let{done:t,value:n}=await e.read();if(t)return;n&&(yield n)}}finally{$n(()=>e.cancel())}}export{Nt as A,fn as C,Qt as D,gn as E,st as F,Re as I,S as L,It as M,Ft as N,$t as O,Mt as P,pn as S,hn as T,On as _,Rn as a,un as b,Vn as c,En as d,_n as f,wn as g,jn as h,Jn as i,Pt as j,Zt as k,Gn as l,Tn as m,Qn as n,Un as o,bn as p,Zn as r,Wn as s,Yn as t,Hn as u,cn as v,mn as w,ln as x,dn as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-DpYyXbJv.js";function e(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function t(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}const n=Symbol.for(`@workflow/core//registeredSteps`),r=globalThis,i=r[n]??=new Map,a=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function o(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function s(e){if(a.has(e)){for(let[t,n]of i.entries())if(t.endsWith(`//${e}`))return n}}function c(e,t){i.set(e,t),t.stepId=e}function l(e){let t=i.get(e);if(t)return t;for(let t of o(e)){let e=i.get(t);if(e)return e}let n=s(e);if(n)return n}const u={hook:[`wait`,`step`],wait:[`hook`,`step`],step:[`wait`,`hook`,`step`]};function d(e,t,n,r){return n>=t||!u[e].includes(r.kind)?!1:!(e===`step`&&!r.armed)}function f(e,t,n,r){let i=r.get(t);if(i!==void 0)return i;let a=p(e,t,n,r);return r.set(t,a),a}function p(e,t,n,r){if(!n.armed)return!1;for(let[i,a]of e)if(d(n.kind,t,i,a)&&!f(e,i,a,r))return!1;return!0}async function m(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=e.pendingDeliveryBarriers,i=[];for(let[e,a]of r)d(n,t,e,a)&&i.push(a.delivered);i.length>0&&(await Promise.all(i),await new Promise(e=>setTimeout(e,0)))}function h(t,n,r,i={}){let a=t.pendingDeliveryBarriers;if(!a||n===void 0)return{markDelivered:()=>{},arm:()=>{}};let o=!1,{promise:s,resolve:c}=e(),l={kind:r,delivered:s,armed:i.armed??!0};a.set(n,l);let u=()=>{o||(o=!0,a.get(n)===l&&a.delete(n),c())};return v(t,u),{markDelivered:u,arm:()=>{l.armed=!0}}}function g(e){let t=e.pendingDeliveryBarriers;if(!t||t.size===0)return!1;let n=new Map;for(let[e,r]of t)if(f(t,e,r,n))return!0;return!1}function _(e){return e.pendingDeliveries===0&&!g(e)}function v(e,t){let n=()=>{_(e)?t():e.promiseQueue.then(()=>{setTimeout(n,0)})};setTimeout(n,0)}export{h as a,t as c,_ as i,e as l,l as n,c as o,g as r,v as s,m as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-8V8biNmG.js";import{A as t,Hn as n,L as r,Nn as i,Pn as a,S as o,Wn as s,Z as c,_t as l,a as u,bn as ee,cn as d,ct as f,gt as p,jn as m,n as h,ot as g,sr as _,t as v,tr as y,vt as b,w as x,xt as S}from"./wait-until-CT1ve8qB.js";import{D as C,d as w,n as T,o as E,r as D}from"./dist-xQXN70ED.js";import{I as O,o as k}from"./dist-CPlyFOVo.js";import{t as A}from"./spec-version-DBUVfF_R.js";var j=e({getHookByToken:()=>R,resumeHook:()=>z,resumeWebhook:()=>V});const M=k();async function N(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}function P(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function F(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await s()).runs.get(e.runId);return{resumeContext:P(t),source:`run_fallback`,run:t}}async function I(e,t){let n=await s(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await _(r):void 0}async function L(e){let t=await s(),n=await t.hooks.getByToken(e),i;if(n.metadata!==void 0){let e=await F(n),a=e.run?await t.getEncryptionKeyForRun?.(e.run):await t.getEncryptionKeyForRun?.(n.runId,{deploymentId:e.resumeContext.deploymentId});i=a?await m(a):void 0,n.metadata=await r(n.metadata,n.runId,i)}return{hook:n,encryptionKey:i}}async function R(e){let{hook:t}=await L(e);return t}async function z(e,t,n){return B(e,t,n,!1)}async function B(e,r,m,_){return await h(()=>f(`hook.resume`,async f=>{let h=await s();try{let s=typeof e==`string`,p=s?await h.hooks.getByToken(e):e,y=s||_,C=await F(p),{resumeContext:T}=C;if(f?.setAttributes({...S(p.token),...l(p.hookId),...ee(p.runId),"workflow.hook.resume_context_source":C.source}),C.run&&O(C.run.status))throw new E(p.token);let k=x(T.workflowCoreVersion),j,P=m?void 0:n(T.encryptionPublicKey);if(P)j=i(P);else{let e=m??await I(p,C);k.supportedFormats.has(a.ENCRYPTED)||(e=void 0),j=e}let L=(T.runSpecVersion??0)>=5&&k.supportedFormats.has(a.GZIP),R=[],z=A(p.specVersion),B=await t(r,p.runId,j,R,globalThis,z,k.framedByteStreams,L);v(Promise.all(R),e=>{e!==void 0&&c.warn(`Background flush of hook payload ops failed`,{workflowRunId:p.runId,hookId:p.hookId,error:e instanceof Error?e.message:String(e)})}),f?.setAttributes({...d(T.workflowName)});let V=await g(T.traceCarrier);V&&f?.addLink?.(V);let H={...z?{}:{token:p.token},payload:B},U=u(T.workflowName),W={deploymentId:T.deploymentId,specVersion:T.runSpecVersion??1},G=process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME===`1`,K=(y?p.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||h.capabilities?.hookResumeDedup===!0,q=G?`disabled`:K?(T.hookResumeInputVersion??0)<1?`consumer_unsupported`:z?`legacy`:(T.runSpecVersion??0)<3?`non_cbor_transport`:B instanceof Uint8Array?B.byteLength>131072?`oversized`:null:`non_bytes`:`backend_unsupported`,J=q===null;f?.setAttributes({"workflow.hook.resume_strategy":J?`parallel`:`sequential`,...q?{"workflow.hook.resume_fallback_reason":q}:{}});let te=e=>E.is(e)||D.is(e)||w.is(e);if(!J){try{await h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z})}catch(e){throw te(e)?new E(p.token):e}return await h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0},W),p}let Y=M(),X=await N(B);f?.setAttributes({"workflow.hook.resume_id":Y});let[Z,Q]=await Promise.allSettled([h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z,resumeId:Y,resumePayloadDigest:X}),h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0,hookInput:{resumeId:Y,hookId:p.hookId,token:p.token,payload:B,payloadDigest:X,deploymentId:T.deploymentId}},W)]);if(Q.status===`rejected`)throw Q.reason;let $=!1;if(Z.status===`rejected`){let e=Z.reason;if(E.is(e)||w.is(e))throw new E(p.token);if(D.is(e)||o(e))$=!0,f?.setAttributes({...b(!0),"workflow.hook.resume_event_write_recovered":!0,"workflow.hook.resume_event_write_error":e instanceof Error?e.name:`unknown`}),c.warn(`Hook resume event write failed, but the run was re-triggered via the queue. The hook_received event will be ensured by the queue consumer.`,{workflowRunId:p.runId,hookId:p.hookId,resumeId:Y,error:e instanceof Error?e.message:String(e)});else throw e}return $?{...p,resilientResume:!0}:p}catch(t){throw f?.setAttributes({...S(typeof e==`string`?e:e.token),...p(!1)}),t}}))}async function V(e,t){let{hook:n,encryptionKey:r}=await L(e);if(n.isWebhook===!1)throw new E(e);let i,a;if(n.metadata&&typeof n.metadata==`object`&&`respondWith`in n.metadata)if(n.metadata.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;a=e,t[y]=n}else if(n.metadata.respondWith instanceof Response)i=n.metadata.respondWith;else throw new C(`Invalid \`respondWith\` value: ${n.metadata.respondWith}`,{slug:T.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else i=new Response(null,{status:202});if(await B(n,t,r,!0),a){let e=a.getReader(),t=await e.read();t.value&&(i=t.value),e.cancel()}if(!i)throw new C(`Workflow run did not send a response`,{slug:T.WEBHOOK_RESPONSE_NOT_SENT});return i}export{j as i,z as n,V as r,R as t};
|