eve 0.47.7 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/src/channel/delivery-metadata.d.ts +1 -0
- package/dist/src/channel/delivery-metadata.js +1 -1
- package/dist/src/channel/types.d.ts +10 -8
- package/dist/src/chunks/{use-eve-agent-Dg5S44kG.js → use-eve-agent-BZnOzAVd.js} +25 -5
- package/dist/src/chunks/{use-eve-agent-B5zw1dwj.js → use-eve-agent-Bgp6INfi.js} +25 -5
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.d.ts +2 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +3 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/dev/command-options.d.ts +2 -0
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/blocks.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/registry-result-message.d.ts +17 -0
- package/dist/src/cli/dev/tui/registry-result-message.js +3 -0
- package/dist/src/cli/dev/tui/runner.d.ts +11 -4
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +9 -3
- package/dist/src/cli/dev/tui/setup-commands.js +2 -3
- package/dist/src/cli/dev/tui/setup-flow.d.ts +15 -5
- package/dist/src/cli/dev/tui/setup-panel.d.ts +6 -1
- package/dist/src/cli/dev/tui/setup-panel.js +4 -4
- package/dist/src/cli/dev/tui/setup-selection-input.d.ts +1 -0
- package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +3 -4
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/agent-info-schema.d.ts +1 -0
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/open-stream.d.ts +1 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -1
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +6 -0
- package/dist/src/compiled/@workflow/builders/LICENSE.md +201 -0
- package/dist/src/compiled/@workflow/builders/index.d.ts +62 -0
- package/dist/src/compiled/@workflow/builders/index.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +2 -2
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/context/keys.d.ts +3 -8
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/types.d.ts +7 -7
- package/dist/src/execution/accepted-delivery-deployment.d.ts +7 -0
- package/dist/src/execution/accepted-delivery-deployment.js +1 -0
- package/dist/src/execution/cancel-descendant-turns-step.d.ts +4 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/delegation-tool.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +7 -2
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-turn-step.js +1 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +2 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +1 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +25 -3
- package/dist/src/execution/durable-session-migrations/turn-workflow.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/finalize-terminal-session.d.ts +17 -0
- package/dist/src/execution/finalize-terminal-session.js +1 -0
- package/dist/src/execution/inline-turn.d.ts +29 -0
- package/dist/src/execution/inline-turn.js +1 -0
- package/dist/src/execution/next-driver-action.d.ts +4 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/pending-turn-state.d.ts +1 -0
- package/dist/src/execution/pending-turn-state.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +2 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/session-command-token.d.ts +2 -0
- package/dist/src/execution/session-command-token.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +12 -0
- package/dist/src/execution/stable-workflow-names.js +1 -0
- package/dist/src/execution/subagent-event-proxy-step.d.ts +3 -0
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -1
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/subagent-start-remote.d.ts +2 -0
- package/dist/src/execution/subagent-start-remote.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +2 -0
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.js +1 -1
- package/dist/src/execution/terminal-session-event.d.ts +13 -0
- package/dist/src/execution/terminal-session-event.js +1 -0
- package/dist/src/execution/terminal-session-failure-step.d.ts +1 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/tool-run/answer.d.ts +3 -0
- package/dist/src/execution/tool-run/answer.js +1 -0
- package/dist/src/execution/tool-run/background.d.ts +14 -0
- package/dist/src/execution/tool-run/background.js +1 -0
- package/dist/src/execution/tool-run/cancel.d.ts +7 -0
- package/dist/src/execution/tool-run/cancel.js +1 -0
- package/dist/src/execution/tool-run/dispatch.d.ts +24 -0
- package/dist/src/execution/tool-run/dispatch.js +1 -0
- package/dist/src/execution/tool-run/emit-run-report-step.d.ts +7 -0
- package/dist/src/execution/tool-run/emit-run-report-step.js +1 -0
- package/dist/src/execution/tool-run/messages.d.ts +70 -0
- package/dist/src/execution/tool-run/messages.js +1 -0
- package/dist/src/execution/tool-run/owner-channels.d.ts +29 -0
- package/dist/src/execution/tool-run/owner-channels.js +1 -0
- package/dist/src/execution/tool-run/owner-inbox.d.ts +11 -0
- package/dist/src/execution/tool-run/owner-inbox.js +1 -0
- package/dist/src/execution/tool-run/owner.d.ts +13 -0
- package/dist/src/execution/tool-run/owner.js +1 -0
- package/dist/src/execution/tool-run/resume-hook-step.d.ts +4 -0
- package/dist/src/execution/tool-run/resume-hook-step.js +1 -0
- package/dist/src/execution/tool-run/run-control.d.ts +18 -0
- package/dist/src/execution/tool-run/run-control.js +1 -0
- package/dist/src/execution/tool-run/start.d.ts +11 -0
- package/dist/src/execution/tool-run/start.js +1 -0
- package/dist/src/execution/tool-run/types.d.ts +21 -0
- package/dist/src/execution/tool-run/types.js +1 -0
- package/dist/src/execution/tool-run/workflow.d.ts +9 -0
- package/dist/src/execution/tool-run/workflow.js +1 -0
- package/dist/src/execution/tools/subagent/local.js +1 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +2 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +4 -2
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-execution-cursor.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +480 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +1 -0
- package/dist/src/execution/workflow-entry-finalization.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-registry.d.ts +5 -0
- package/dist/src/execution/workflow-registry.js +1 -0
- package/dist/src/execution/workflow-runtime.d.ts +9 -11
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-webhook-route.d.ts +4 -0
- package/dist/src/execution/workflow-webhook-route.js +1 -0
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +10 -0
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +2 -0
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tool-runs.d.ts +21 -0
- package/dist/src/harness/tool-runs.js +1 -0
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/instrumentation/content-policy.d.ts +3 -1
- package/dist/src/instrumentation/content-policy.js +1 -1
- package/dist/src/instrumentation/runtime.d.ts +2 -2
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/attachments/errors.d.ts +3 -0
- package/dist/src/internal/authored-module-loader.d.ts +7 -1
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/nitro/development-generation.d.ts +2 -0
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +17 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +19 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +17 -2
- package/dist/src/internal/workflow-bundle/builder-support.js +4 -3
- package/dist/src/internal/workflow-bundle/builder.d.ts +2 -2
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.d.ts +2 -0
- package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +3 -0
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +6 -2
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +3 -0
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.d.ts +7 -0
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -0
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +15 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -4
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/baggage.d.ts +6 -0
- package/dist/src/protocol/baggage.js +1 -0
- package/dist/src/public/channels/slack/attachments.js +1 -1
- package/dist/src/public/channels/teams/attachments.d.ts +2 -2
- package/dist/src/public/channels/teams/attachments.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/attachments.js +1 -1
- package/dist/src/public/definitions/remote-agent.d.ts +6 -3
- package/dist/src/public/workflow/index.d.ts +3 -0
- package/dist/src/public/workflow/index.js +1 -0
- package/dist/src/public/workflow-modules.d.js +1 -0
- package/dist/src/public/workflow-modules.d.ts +11 -0
- package/dist/src/runtime/actions/keys.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/setup/connection-connector.d.ts +4 -2
- package/dist/src/setup/connection-connector.js +2 -2
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.d.ts +5 -0
- package/dist/src/setup/flows/provider.js +4 -4
- package/dist/src/setup/flows/registry-session.d.ts +24 -7
- package/dist/src/setup/flows/registry-session.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +35 -29
- package/dist/src/setup/flows/registry.js +2 -1
- package/dist/src/setup/integrations/web/setup.d.ts +0 -2
- package/dist/src/setup/integrations/web/setup.js +1 -1
- package/dist/src/setup/prompter.d.ts +24 -4
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/dispatch-action.d.ts +6 -0
- package/dist/src/shared/forwarded-trace-policy.d.ts +28 -0
- package/dist/src/shared/forwarded-trace-policy.js +1 -0
- package/dist/src/shared/instrumentation-decision.d.ts +3 -0
- package/dist/src/shared/instrumentation-decision.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/behavior.d.ts +6 -0
- package/dist/src/tools/definition.d.ts +39 -3
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +5 -3
- package/dist/src/tracing/otel-registration.d.ts +1 -1
- package/dist/src/tracing/otel-registration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +2 -0
- package/docs/channels/eve.mdx +5 -1
- package/docs/channels/teams.mdx +6 -1
- package/docs/concepts/sessions-runs-and-streaming.md +4 -2
- package/docs/guides/auth-and-route-protection.md +5 -1
- package/docs/guides/client/messages.mdx +6 -0
- package/docs/guides/dev-tui.md +30 -18
- package/docs/guides/remote-agents.md +25 -0
- package/docs/reference/cli.md +2 -2
- package/docs/tools/meta.json +1 -1
- package/docs/tools/overview.mdx +7 -0
- package/docs/tools/workflows.mdx +288 -0
- package/package.json +12 -1
- package/dist/src/internal/authored-directive-prologue.d.ts +0 -4
- package/dist/src/internal/authored-directive-prologue.js +0 -1
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@vercel/sandbox-drives": "2.10.0-beta.0",
|
|
40
40
|
"@vercel/sandbox-delete": "3.2.0",
|
|
41
41
|
"@vercel/sandbox": "2.8.0",
|
|
42
|
+
"@workflow/builders": "5.0.0-beta.44",
|
|
42
43
|
"@workflow/core": "5.0.0-beta.43",
|
|
43
44
|
"@workflow/errors": "5.0.0-beta.17",
|
|
44
45
|
"@workflow/serde": "5.0.0-beta.2",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"zod": "4.5.4",
|
|
49
50
|
"zod-validation-error": "5.0.0"
|
|
50
51
|
},
|
|
51
|
-
"scriptHash": "
|
|
52
|
+
"scriptHash": "95959174b2dd580d42e5171408d20ef7639aa7b5be993a1f26ade991e7766330",
|
|
52
53
|
"toolVersions": {
|
|
53
54
|
"rolldown": "1.1.5"
|
|
54
55
|
}
|
|
@@ -130,6 +130,12 @@ export interface Meter {
|
|
|
130
130
|
|
|
131
131
|
export declare const metrics: {
|
|
132
132
|
getMeter(name: string, version?: string): Meter;
|
|
133
|
+
/**
|
|
134
|
+
* The globally registered meter provider, shared across API copies. The
|
|
135
|
+
* instance comes from whichever metrics SDK registered it, so callers must
|
|
136
|
+
* feature-detect lifecycle methods before invoking them.
|
|
137
|
+
*/
|
|
138
|
+
getMeterProvider(): unknown;
|
|
133
139
|
};
|
|
134
140
|
|
|
135
141
|
export declare enum SpanKind {
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
<http://www.apache.org/licenses/>
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Vercel Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for detecting files that need workflow transformation.
|
|
3
|
+
* Used by builders, rollup plugin, Next.js loader, and vite plugin.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useWorkflowPattern: RegExp;
|
|
6
|
+
export declare const useStepPattern: RegExp;
|
|
7
|
+
export declare const workflowSerdeImportPattern: RegExp;
|
|
8
|
+
export declare const workflowSerdeSymbolPattern: RegExp;
|
|
9
|
+
export declare const workflowSerdeComputedPropertyPattern: RegExp;
|
|
10
|
+
export declare const generatedWorkflowPathPattern: RegExp;
|
|
11
|
+
/**
|
|
12
|
+
* Detects workflow-related patterns in source code.
|
|
13
|
+
*/
|
|
14
|
+
export interface WorkflowPatternMatch {
|
|
15
|
+
/** File contains 'use workflow' directive */
|
|
16
|
+
hasUseWorkflow: boolean;
|
|
17
|
+
/** File contains 'use step' directive */
|
|
18
|
+
hasUseStep: boolean;
|
|
19
|
+
/** File contains @workflow/serde import */
|
|
20
|
+
hasSerdeImport: boolean;
|
|
21
|
+
/** File contains Symbol.for('workflow-serialize') or Symbol.for('workflow-deserialize') */
|
|
22
|
+
hasSerdeSymbol: boolean;
|
|
23
|
+
/** File contains any directive ('use workflow' or 'use step') */
|
|
24
|
+
hasDirective: boolean;
|
|
25
|
+
/** File contains any serde pattern (import or Symbol.for) */
|
|
26
|
+
hasSerde: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Detects workflow-related patterns in source code.
|
|
30
|
+
* @param source - The source code to analyze
|
|
31
|
+
* @returns Object with flags for each detected pattern
|
|
32
|
+
*/
|
|
33
|
+
export declare function detectWorkflowPatterns(source: string): WorkflowPatternMatch;
|
|
34
|
+
/**
|
|
35
|
+
* Determines if a file path is a generated workflow route file.
|
|
36
|
+
* @param filePath - The file path to check
|
|
37
|
+
* @returns true if the file is a generated workflow route
|
|
38
|
+
*/
|
|
39
|
+
export declare function isGeneratedWorkflowFile(filePath: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Determines if a file should be transformed based on its path and content patterns.
|
|
42
|
+
*
|
|
43
|
+
* Logic:
|
|
44
|
+
* - Generated workflow route files are never transformed
|
|
45
|
+
* - Files with directives ('use workflow' or 'use step') are always transformed
|
|
46
|
+
* - Files with serde patterns are always transformed; the SWC plugin performs
|
|
47
|
+
* AST-level extraction/filtering to determine whether they actually define
|
|
48
|
+
* serde classes
|
|
49
|
+
*
|
|
50
|
+
* @param filePath - The file path to check
|
|
51
|
+
* @param patterns - The detected patterns from detectWorkflowPatterns()
|
|
52
|
+
* @returns true if the file should be transformed
|
|
53
|
+
*/
|
|
54
|
+
export declare function shouldTransformFile(filePath: string, patterns: WorkflowPatternMatch): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Combined regex pattern for turbopack content matching.
|
|
57
|
+
* Uses backreferences to ensure matching quote types.
|
|
58
|
+
* Matches: 'use workflow', 'use step', @workflow/serde imports, Symbol.for serialization symbols,
|
|
59
|
+
* and WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE computed property usage
|
|
60
|
+
*/
|
|
61
|
+
export declare const turbopackContentPattern: RegExp;
|
|
62
|
+
//# sourceMappingURL=transform-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/^\s*(['"])use workflow\1;?\s*$/m,t=/^\s*(['"])use step\1;?\s*$/m,n=/from\s+(['"])@workflow\/serde\1/,r=/Symbol\.for\s*\(\s*(['"])workflow-(?:serialize|deserialize)\1\s*\)/,i=/\[\s*WORKFLOW_(?:SERIALIZE|DESERIALIZE)\s*\]/,a=/`(?:\\[\s\S]|[^`\\])*`/g,o=/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*/g,s=/^\s*(['"])(use workflow|use step)\1;?\s*$/,c=/^\s*(['"])[^'"]+\1;?\s*$/,l=/[/\\]\.well-known[/\\]workflow[/\\]/;function u(e,t){let n;for(let r of e.split(/\r?\n/)){let e=r.trim();if(e===``)continue;let i=s.exec(e);if(i){if(i[2]===t&&(n===void 0||n.endsWith(`{`)||c.test(n)))return!0;n=e;continue}n=e}return!1}function d(e){let t=(e.includes(`use workflow`)||e.includes(`use step`))&&(e.includes("`")||e.includes(`/`))?e.replace(a,e=>e.replace(/[^\r\n]/g,` `)).replace(o,e=>e.replace(/[^\r\n]/g,` `)):e,s=e.includes(`use workflow`)&&u(t,`use workflow`),c=e.includes(`use step`)&&u(t,`use step`),l=e.includes(`@workflow/serde`)&&n.test(e),d=(e.includes(`workflow-serialize`)||e.includes(`workflow-deserialize`))&&r.test(e),f=(e.includes(`WORKFLOW_SERIALIZE`)||e.includes(`WORKFLOW_DESERIALIZE`))&&i.test(e);return{hasUseWorkflow:s,hasUseStep:c,hasSerdeImport:l,hasSerdeSymbol:d,hasDirective:s||c,hasSerde:l||d||f}}function f(e){return l.test(e)}function p(e,t){return f(e)?!1:t.hasDirective||t.hasSerde}const m=/(use workflow|use step|from\s+(['"])@workflow\/serde\2|Symbol\.for\s*\(\s*(['"])workflow-(?:serialize|deserialize)\3\s*\)|\[\s*WORKFLOW_(?:SERIALIZE|DESERIALIZE)\s*\])/;export{d as detectWorkflowPatterns,l as generatedWorkflowPathPattern,f as isGeneratedWorkflowFile,p as shouldTransformFile,m as turbopackContentPattern,t as useStepPattern,e as useWorkflowPattern,i as workflowSerdeComputedPropertyPattern,n as workflowSerdeImportPattern,r as workflowSerdeSymbolPattern};
|
|
@@ -11,8 +11,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
11
11
|
readonly dropped: {};
|
|
12
12
|
};
|
|
13
13
|
readonly tool: {
|
|
14
|
-
readonly current:
|
|
15
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23];
|
|
14
|
+
readonly current: 24;
|
|
15
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24];
|
|
16
16
|
readonly dropped: {
|
|
17
17
|
readonly 15: "TaskExec replaces stageEffect with send";
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:
|
|
1
|
+
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:24,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24],dropped:{15:`TaskExec replaces stageEffect with send`}},dynamicTool:{current:21,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],dropped:{}},channel:{current:12,supported:[1,2,3,4,5,6,7,8,9,10,11,12],dropped:{}},schedule:{current:5,supported:[1,2,3,4,5],dropped:{}},subagent:{current:5,supported:[3,4,5],dropped:{1:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,2:`Persistent subagent sessions are now the default and the experimental opt-in was removed`}},connection:{current:10,supported:[1,2,3,4,5,6,7,8,10],dropped:{9:`Dynamic connection resolvers no longer receive conversation or channel continuation data`}},hook:{current:16,supported:[10,11,12,13,14,15,16],dropped:{1:`Model identity moved from session.started runtime metadata to step.started call attribution.`,2:`Model identity moved from session.started runtime metadata to step.started call attribution.`,3:`Model identity moved from session.started runtime metadata to step.started call attribution.`,4:`Model identity moved from session.started runtime metadata to step.started call attribution.`,5:`Model identity moved from session.started runtime metadata to step.started call attribution.`,6:`Model identity moved from session.started runtime metadata to step.started call attribution.`,7:`Model identity moved from session.started runtime metadata to step.started call attribution.`,8:`Model identity moved from session.started runtime metadata to step.started call attribution.`,9:`Model identity moved from session.started runtime metadata to step.started call attribution.`}},skill:{current:1,supported:[1],dropped:{}},dynamicSkill:{current:13,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13],dropped:{}},instructions:{current:2,supported:[1,2],dropped:{}},dynamicInstructions:{current:14,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14],dropped:{}},config:{current:1,supported:[1],dropped:{}},state:{current:4,supported:[1,2,3,4],dropped:{}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestV1Schema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict(),extensionCompatibilityManifestV2Schema=extensionCompatibilityManifestV1Schema.extend({formatVersion:z.literal(2),build:z.object({externalDependencies:z.array(z.string().min(1)).readonly()}).strict().optional()}),extensionCompatibilityManifestSchema=z.union([extensionCompatibilityManifestV1Schema,extensionCompatibilityManifestV2Schema]);function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(t){return parseExtensionCompatibilityManifest(await readFile(t,`utf8`),t)}async function writeExtensionCompatibilityManifest(e,n){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(n),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
|
|
@@ -22,7 +22,7 @@ export declare const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
|
|
|
22
22
|
/**
|
|
23
23
|
* Current compiled manifest schema version.
|
|
24
24
|
*/
|
|
25
|
-
export declare const COMPILED_AGENT_MANIFEST_VERSION =
|
|
25
|
+
export declare const COMPILED_AGENT_MANIFEST_VERSION = 47;
|
|
26
26
|
/**
|
|
27
27
|
* Compiled channel entry preserved in the compiled manifest.
|
|
28
28
|
*/
|
|
@@ -721,7 +721,7 @@ export declare const compiledAgentManifestSchema: z.ZodObject<{
|
|
|
721
721
|
sourceId: z.ZodString;
|
|
722
722
|
sourceKind: z.ZodLiteral<"module">;
|
|
723
723
|
}, z.core.$strict>>;
|
|
724
|
-
version: z.ZodLiteral<
|
|
724
|
+
version: z.ZodLiteral<47>;
|
|
725
725
|
workspaceResourceRoot: z.ZodObject<{
|
|
726
726
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
727
727
|
logicalPath: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{discoverDiagnosticsSummarySchema}from"#discover/diagnostics.js";import{compiledRemoteAgentNodeSchema}from"#compiler/remote-agent-node.js";import{jsonObjectSchema}from"#shared/json-schemas.js";import{validateCompiledAgentManifest,validateCompiledAgentResources}from"#compiler/validate-artifact.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=46,agentSourceOwnerSchema=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string().min(1),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string().min(1),packageName:z.string().min(1)}).strict()]),moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),filesystemModuleBackingSchema=z.object({externalDependencies:z.array(z.string()).readonly(),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),programmaticModuleBackingSchema=z.object({dependencies:z.record(z.string(),z.string()).readonly().optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:jsonObjectSchema.optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict(),resourceSourceBackingSchema=z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict(),agentModuleBackingSchema=z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema]),compiledModuleBindingSchema=z.object({backing:agentModuleBackingSchema,logicalPath:z.string(),owner:agentSourceOwnerSchema,usage:z.object({compile:z.boolean(),runtimeEntry:z.boolean()}).strict()}).strict(),agentSourceDescriptorSchema=z.object({backing:z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema,resourceSourceBackingSchema]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner:agentSourceOwnerSchema,sourceId:z.string()}).strict(),agentSourceCompositionSchema=z.object({entries:z.array(z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`shadowed`),source:agentSourceDescriptorSchema,winnerSourceId:z.string()}).strict(),z.object({kind:z.literal(`disabled`),source:agentSourceDescriptorSchema}).strict()])).readonly()}).strict(),compiledDynamicModelDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),channelMethodSchema=z.union([z.literal(`GET`),z.literal(`HEAD`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`OPTIONS`),z.literal(`WEBSOCKET`)]),compiledChannelCorsSchema=z.object({origin:z.union([z.literal(`*`),z.literal(`null`),z.array(z.string())]).optional(),methods:z.union([z.literal(`*`),z.array(z.string())]).optional(),allowHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),exposeHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),credentials:z.boolean().optional(),maxAge:z.union([z.string(),z.literal(!1)]).optional(),preflight:z.object({statusCode:z.number().int().min(100).max(599).optional()}).strict().optional()}).strict(),compiledChannelDefinitionSchema=z.object({kind:z.literal(`channel`),name:z.string(),logicalPath:z.string(),method:channelMethodSchema,urlPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional(),adapterKind:z.string().optional(),cors:compiledChannelCorsSchema.optional()}).strict(),compiledChannelPreflightDefinitionSchema=z.object({cors:compiledChannelCorsSchema,method:z.literal(`OPTIONS`),sourceIds:z.array(z.string()).readonly(),urlPath:z.string()}).strict(),compiledShadowedChannelRouteSchema=z.object({method:channelMethodSchema,source:agentSourceDescriptorSchema,urlPath:z.string(),winnerSourceId:z.string()}).strict(),compiledChannelRoutePlanSchema=z.object({effective:z.array(compiledChannelDefinitionSchema).readonly(),preflight:z.array(compiledChannelPreflightDefinitionSchema).readonly(),shadowed:z.array(compiledShadowedChannelRouteSchema).readonly()}).strict(),modelRoutingSchema=z.union([z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),compiledRuntimeModelReferenceSchema=z.object({contextWindowTokens:z.number().int().positive().optional(),id:z.string(),maxOutputTokens:z.number().int().positive().optional(),source:moduleSourceRefSchema.optional(),providerOptions:z.record(z.string(),jsonObjectSchema).optional(),routing:modelRoutingSchema}).strict(),compiledAgentBuildDefinitionSchema=z.object({externalDependencies:z.array(z.string()).optional()}).strict(),compiledAgentWorkflowWorldDefinitionSchema=z.string(),compiledAgentWorkflowDefinitionSchema=z.object({world:compiledAgentWorkflowWorldDefinitionSchema.optional()}).strict(),compiledAgentCompactionDefinitionSchema=z.object({model:compiledRuntimeModelReferenceSchema.optional(),thresholdPercent:z.number().finite().min(0).max(1).optional()}).strict(),sessionTokenLimitSchema=z.union([z.number().int().positive(),z.literal(!1)]),sessionTimeoutSchema=z.union([z.number().int().positive(),z.literal(!1)]),compiledAgentLimitsDefinitionSchema=z.object({maxInputTokensPerSession:sessionTokenLimitSchema.optional(),maxOutputTokensPerSession:sessionTokenLimitSchema.optional(),sessionTimeoutMs:sessionTimeoutSchema.optional()}).strict(),compiledWorkflowToolDefinitionSchema=z.object({exportName:z.string().optional(),logicalPath:z.string(),maxSubagents:z.number().int().positive().optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentConfigBaseFields={build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({instrumentationProviders:z.boolean().optional(),tasks:z.boolean().optional(),workflow:compiledAgentWorkflowDefinitionSchema.optional()}).strict().optional(),name:z.string(),outputSchema:jsonObjectSchema.optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),source:moduleSourceRefSchema,limits:compiledAgentLimitsDefinitionSchema.optional()},compiledAgentConfigSchema=z.union([z.object({...compiledAgentConfigBaseFields,model:compiledRuntimeModelReferenceSchema}).strict(),z.object({...compiledAgentConfigBaseFields,dynamicModel:compiledDynamicModelDefinitionSchema}).strict()]),compiledInstructionsBaseFields={content:z.string(),name:z.string(),logicalPath:z.string(),role:z.enum([`system`,`user`]),sourceId:z.string()},compiledInstructionsSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledInstructionsBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledInstructionsBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSkillBaseFields={name:z.string(),description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional(),sourceId:z.string(),logicalPath:z.string()},compiledSkillSourceSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`skill-package`),skillId:z.string(),skillFilePath:z.string(),rootPath:z.string(),assetsPath:z.string().optional(),referencesPath:z.string().optional(),scriptsPath:z.string().optional()}).strict()]),compiledScheduleBaseFields={cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string()},compiledScheduleDefinitionSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledScheduleBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledScheduleBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),inheritsParent:z.boolean().optional(),exportName:z.string().optional(),logicalPath:z.string(),revalidationKey:z.string().optional(),sourceHash:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSandboxWorkspaceSchema=z.object({logicalPath:z.string(),rootEntries:z.array(z.string()).readonly(),sourceId:z.string(),sourcePath:z.string()}).strict(),compiledWorkspaceResourceRootSchema=z.object({contentHash:z.string().optional(),logicalPath:z.string(),rootEntries:z.array(z.string()).readonly()}).strict(),compiledConnectionDefinitionSchema=z.object({connectionName:z.string(),description:z.string(),exportName:z.string().optional(),logicalPath:z.string(),protocol:z.enum([`mcp`,`openapi`]).default(`mcp`),sourceId:z.string(),sourceKind:z.literal(`module`),url:z.string(),vercelConnect:z.object({connector:z.string()}).strict().optional()}).strict(),compiledDynamicConnectionDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledToolBehaviorSchema=z.object({availability:z.array(z.enum([`delegated-task-child`,`requires-request-input`,`root-session`])).readonly(),handling:z.discriminatedUnion(`kind`,[z.object({action:z.enum([`self-agent`,`task-cancel`,`task-update`]),kind:z.literal(`dispatch`)}).strict(),z.object({kind:z.literal(`provider-tool`),provider:z.enum([`exa`,`parallel`])}).strict(),z.object({kind:z.literal(`request-input`),request:z.literal(`question`)}).strict()]).optional(),presentation:z.literal(`load-skill`).optional()}).strict(),compiledToolDefinitionSchema=z.object({behavior:compiledToolBehaviorSchema.optional(),description:z.string(),execution:z.literal(`background`).optional(),exportName:z.string().optional(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),requiresApproval:z.boolean(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicToolDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),rebindMissingCallbacks:z.boolean().optional(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledMemoryDefinitionSchema=z.object({description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),slot:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),visibility:z.enum([`scope`,`session`])}).strict(),compiledDynamicSkillDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicInstructionsDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledHookDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledExtensionMountSchema=z.object({externalDependencies:z.array(z.string()).readonly(),namespace:z.string(),packageName:z.string(),packageNamespace:z.string(),sourceRoot:z.string(),mountSourceId:z.string(),mountLogicalPath:z.string()}).strict(),compiledAgentResourceFields={agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),channelRoutes:compiledChannelRoutePlanSchema,connections:z.array(compiledConnectionDefinitionSchema),dynamicConnections:z.array(compiledDynamicConnectionDefinitionSchema).default([]),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,workflowTool:compiledWorkflowToolDefinitionSchema.optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),extensionMounts:z.array(compiledExtensionMountSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),memories:z.array(compiledMemoryDefinitionSchema).default([]),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema},compiledAgentResourcesSchema=z.object(compiledAgentResourceFields).strict(),compiledAgentNodeManifestSchema=z.object({...compiledAgentResourceFields,config:compiledAgentConfigSchema}).strict(),compiledSubagentNodeBaseFields={backing:resourceSourceBackingSchema,entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),owner:agentSourceOwnerSchema,parentNodeId:z.string(),rootPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional()},compiledDynamicSubagentDefinitionSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSubagentNodeSchema=z.union([z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentNodeManifestSchema,description:z.string()}).strict(),z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentResourcesSchema,configResolver:compiledDynamicSubagentDefinitionSchema}).strict()]),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channelRoutes:compiledChannelRoutePlanSchema,config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),dynamicConnections:z.array(compiledDynamicConnectionDefinitionSchema).default([]),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,workflowTool:compiledWorkflowToolDefinitionSchema.optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),memories:z.array(compiledMemoryDefinitionSchema).default([]),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagents:z.array(compiledSubagentNodeSchema),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(46),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentResources(e){return{agentRoot:e.agentRoot,appRoot:e.appRoot,bindings:{...e.bindings},channelRoutes:{effective:[...e.channelRoutes.effective],preflight:[...e.channelRoutes.preflight],shadowed:[...e.channelRoutes.shadowed]},connections:[...e.connections??[]],dynamicConnections:[...e.dynamicConnections??[]],diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},sourceComposition:{entries:[...e.sourceComposition.entries]},workflowTool:e.workflowTool===void 0?void 0:{...e.workflowTool},dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],hooks:[...e.hooks??[]],memories:[...e.memories??[]],instructions:[...e.instructions??[]],instrumentation:e.instrumentation===void 0?void 0:{...e.instrumentation},remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}}function createCompiledAgentNodeManifest(e){let t={...createCompiledAgentResources(e),config:cloneCompiledAgentDefinition(e.config)};return validateCompiledAgentResources(t,{allowUnknownResourceWinners:!0}),t}function cloneCompiledAgentDefinition(e){let t={build:e.build===void 0?void 0:{externalDependencies:e.build.externalDependencies===void 0?void 0:[...e.build.externalDependencies]},compaction:{model:e.compaction?.model===void 0?void 0:cloneCompiledRuntimeModelReference(e.compaction.model),thresholdPercent:e.compaction?.thresholdPercent},description:e.description,experimental:e.experimental===void 0?void 0:{instrumentationProviders:e.experimental.instrumentationProviders,tasks:e.experimental.tasks,workflow:e.experimental.workflow===void 0?void 0:{world:e.experimental.workflow.world}},name:e.name,outputSchema:e.outputSchema,reasoning:e.reasoning,limits:e.limits===void 0?void 0:{maxInputTokensPerSession:e.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.limits.sessionTimeoutMs},source:{...e.source}};return e.dynamicModel===void 0?{...t,model:cloneCompiledRuntimeModelReference(e.model)}:{...t,dynamicModel:{...e.dynamicModel}}}function deriveResourceRootEntries(e){let t=new Set;for(let n of e.sandboxWorkspaces??[])for(let e of n.rootEntries)t.add(e);return[...t].sort((e,t)=>e.localeCompare(t))}function createCompiledSubagentNodeId(e,t){return e===`__root__`?t:`${e}::${t}`}function createCompiledAgentManifest(e){let t={...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,extensionMounts:[...e.extensionMounts??[]],subagents:[...e.subagents??[]],version:46};return validateCompiledAgentManifest(t),t}function cloneCompiledRuntimeModelReference(e){let t={id:e.id,routing:cloneModelRouting(e.routing)};return e.contextWindowTokens!==void 0&&(t.contextWindowTokens=e.contextWindowTokens),e.maxOutputTokens!==void 0&&(t.maxOutputTokens=e.maxOutputTokens),e.providerOptions!==void 0&&(t.providerOptions={...e.providerOptions}),e.source!==void 0&&(t.source={...e.source}),t}function cloneModelRouting(e){return e.kind===`external`?{kind:`external`,provider:e.provider}:e.byok===void 0?{kind:`gateway`,target:e.target}:{kind:`gateway`,target:e.target,byok:e.byok}}export{COMPILED_AGENT_MANIFEST_KIND,COMPILED_AGENT_MANIFEST_VERSION,ROOT_COMPILED_AGENT_NODE_ID,compiledAgentManifestSchema,createCompiledAgentManifest,createCompiledAgentNodeManifest,createCompiledAgentResources,createCompiledSubagentNodeId,deriveResourceRootEntries};
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{discoverDiagnosticsSummarySchema}from"#discover/diagnostics.js";import{compiledRemoteAgentNodeSchema}from"#compiler/remote-agent-node.js";import{jsonObjectSchema}from"#shared/json-schemas.js";import{validateCompiledAgentManifest,validateCompiledAgentResources}from"#compiler/validate-artifact.js";const COMPILED_AGENT_MANIFEST_KIND=`eve-agent-compiled-manifest`,ROOT_COMPILED_AGENT_NODE_ID=`__root__`,COMPILED_AGENT_MANIFEST_VERSION=47,agentSourceOwnerSchema=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string().min(1),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string().min(1),packageName:z.string().min(1)}).strict()]),moduleSourceRefSchema=z.object({exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),filesystemModuleBackingSchema=z.object({externalDependencies:z.array(z.string()).readonly(),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),programmaticModuleBackingSchema=z.object({dependencies:z.record(z.string(),z.string()).readonly().optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:jsonObjectSchema.optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict(),resourceSourceBackingSchema=z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict(),agentModuleBackingSchema=z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema]),compiledModuleBindingSchema=z.object({backing:agentModuleBackingSchema,logicalPath:z.string(),owner:agentSourceOwnerSchema,usage:z.object({compile:z.boolean(),runtimeEntry:z.boolean()}).strict()}).strict(),agentSourceDescriptorSchema=z.object({backing:z.discriminatedUnion(`kind`,[filesystemModuleBackingSchema,programmaticModuleBackingSchema,resourceSourceBackingSchema]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner:agentSourceOwnerSchema,sourceId:z.string()}).strict(),agentSourceCompositionSchema=z.object({entries:z.array(z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`shadowed`),source:agentSourceDescriptorSchema,winnerSourceId:z.string()}).strict(),z.object({kind:z.literal(`disabled`),source:agentSourceDescriptorSchema}).strict()])).readonly()}).strict(),compiledDynamicModelDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),sourceKind:z.literal(`module`),logicalPath:z.string(),sourceId:z.string()}).strict(),channelMethodSchema=z.union([z.literal(`GET`),z.literal(`HEAD`),z.literal(`POST`),z.literal(`PUT`),z.literal(`PATCH`),z.literal(`DELETE`),z.literal(`OPTIONS`),z.literal(`WEBSOCKET`)]),compiledChannelCorsSchema=z.object({origin:z.union([z.literal(`*`),z.literal(`null`),z.array(z.string())]).optional(),methods:z.union([z.literal(`*`),z.array(z.string())]).optional(),allowHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),exposeHeaders:z.union([z.literal(`*`),z.array(z.string())]).optional(),credentials:z.boolean().optional(),maxAge:z.union([z.string(),z.literal(!1)]).optional(),preflight:z.object({statusCode:z.number().int().min(100).max(599).optional()}).strict().optional()}).strict(),compiledChannelDefinitionSchema=z.object({kind:z.literal(`channel`),name:z.string(),logicalPath:z.string(),method:channelMethodSchema,urlPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional(),adapterKind:z.string().optional(),cors:compiledChannelCorsSchema.optional()}).strict(),compiledChannelPreflightDefinitionSchema=z.object({cors:compiledChannelCorsSchema,method:z.literal(`OPTIONS`),sourceIds:z.array(z.string()).readonly(),urlPath:z.string()}).strict(),compiledShadowedChannelRouteSchema=z.object({method:channelMethodSchema,source:agentSourceDescriptorSchema,urlPath:z.string(),winnerSourceId:z.string()}).strict(),compiledChannelRoutePlanSchema=z.object({effective:z.array(compiledChannelDefinitionSchema).readonly(),preflight:z.array(compiledChannelPreflightDefinitionSchema).readonly(),shadowed:z.array(compiledShadowedChannelRouteSchema).readonly()}).strict(),modelRoutingSchema=z.union([z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),compiledRuntimeModelReferenceSchema=z.object({contextWindowTokens:z.number().int().positive().optional(),id:z.string(),maxOutputTokens:z.number().int().positive().optional(),source:moduleSourceRefSchema.optional(),providerOptions:z.record(z.string(),jsonObjectSchema).optional(),routing:modelRoutingSchema}).strict(),compiledAgentBuildDefinitionSchema=z.object({externalDependencies:z.array(z.string()).optional()}).strict(),compiledAgentWorkflowWorldDefinitionSchema=z.string(),compiledAgentWorkflowDefinitionSchema=z.object({world:compiledAgentWorkflowWorldDefinitionSchema.optional()}).strict(),compiledAgentCompactionDefinitionSchema=z.object({model:compiledRuntimeModelReferenceSchema.optional(),thresholdPercent:z.number().finite().min(0).max(1).optional()}).strict(),sessionTokenLimitSchema=z.union([z.number().int().positive(),z.literal(!1)]),sessionTimeoutSchema=z.union([z.number().int().positive(),z.literal(!1)]),compiledAgentLimitsDefinitionSchema=z.object({maxInputTokensPerSession:sessionTokenLimitSchema.optional(),maxOutputTokensPerSession:sessionTokenLimitSchema.optional(),sessionTimeoutMs:sessionTimeoutSchema.optional()}).strict(),compiledWorkflowToolDefinitionSchema=z.object({exportName:z.string().optional(),logicalPath:z.string(),maxSubagents:z.number().int().positive().optional(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledAgentConfigBaseFields={build:compiledAgentBuildDefinitionSchema.optional(),compaction:compiledAgentCompactionDefinitionSchema.optional(),description:z.string().optional(),experimental:z.object({instrumentationProviders:z.boolean().optional(),tasks:z.boolean().optional(),workflow:compiledAgentWorkflowDefinitionSchema.optional()}).strict().optional(),name:z.string(),outputSchema:jsonObjectSchema.optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),source:moduleSourceRefSchema,limits:compiledAgentLimitsDefinitionSchema.optional()},compiledAgentConfigSchema=z.union([z.object({...compiledAgentConfigBaseFields,model:compiledRuntimeModelReferenceSchema}).strict(),z.object({...compiledAgentConfigBaseFields,dynamicModel:compiledDynamicModelDefinitionSchema}).strict()]),compiledInstructionsBaseFields={content:z.string(),name:z.string(),logicalPath:z.string(),role:z.enum([`system`,`user`]),sourceId:z.string()},compiledInstructionsSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledInstructionsBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledInstructionsBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSkillBaseFields={name:z.string(),description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional(),sourceId:z.string(),logicalPath:z.string()},compiledSkillSourceSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledSkillBaseFields,sourceKind:z.literal(`module`),exportName:z.string().optional()}).strict(),z.object({...compiledSkillBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`skill-package`),skillId:z.string(),skillFilePath:z.string(),rootPath:z.string(),assetsPath:z.string().optional(),referencesPath:z.string().optional(),scriptsPath:z.string().optional()}).strict()]),compiledScheduleBaseFields={cron:z.string(),hasRun:z.boolean(),name:z.string(),logicalPath:z.string(),markdown:z.string().optional(),sourceId:z.string()},compiledScheduleDefinitionSchema=z.discriminatedUnion(`sourceKind`,[z.object({...compiledScheduleBaseFields,owner:agentSourceOwnerSchema,sourceKind:z.literal(`markdown`)}).strict(),z.object({...compiledScheduleBaseFields,sourceKind:z.literal(`module`)}).strict()]),compiledSandboxDefinitionSchema=z.object({backendName:z.string().optional(),description:z.string().optional(),inheritsParent:z.boolean().optional(),exportName:z.string().optional(),logicalPath:z.string(),revalidationKey:z.string().optional(),sourceHash:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSandboxWorkspaceSchema=z.object({logicalPath:z.string(),rootEntries:z.array(z.string()).readonly(),sourceId:z.string(),sourcePath:z.string()}).strict(),compiledWorkspaceResourceRootSchema=z.object({contentHash:z.string().optional(),logicalPath:z.string(),rootEntries:z.array(z.string()).readonly()}).strict(),compiledConnectionDefinitionSchema=z.object({connectionName:z.string(),description:z.string(),exportName:z.string().optional(),logicalPath:z.string(),protocol:z.enum([`mcp`,`openapi`]).default(`mcp`),sourceId:z.string(),sourceKind:z.literal(`module`),url:z.string(),vercelConnect:z.object({connector:z.string()}).strict().optional()}).strict(),compiledDynamicConnectionDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledToolBehaviorSchema=z.object({availability:z.array(z.enum([`delegated-task-child`,`requires-request-input`,`root-session`])).readonly(),handling:z.discriminatedUnion(`kind`,[z.object({action:z.enum([`self-agent`,`task-cancel`,`task-update`]),kind:z.literal(`dispatch`)}).strict(),z.object({kind:z.literal(`provider-tool`),provider:z.enum([`exa`,`parallel`])}).strict(),z.object({kind:z.literal(`request-input`),request:z.literal(`question`)}).strict(),z.object({kind:z.literal(`workflow-tool`),workflowId:z.string()}).strict()]).optional(),presentation:z.literal(`load-skill`).optional()}).strict(),compiledToolDefinitionSchema=z.object({behavior:compiledToolBehaviorSchema.optional(),description:z.string(),execution:z.literal(`background`).optional(),exportName:z.string().optional(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),inputSchema:jsonObjectSchema.nullable(),logicalPath:z.string(),name:z.string(),outputSchema:jsonObjectSchema.optional(),requiresApproval:z.boolean(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicToolDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),rebindMissingCallbacks:z.boolean().optional(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledMemoryDefinitionSchema=z.object({description:z.string().optional(),exportName:z.string().optional(),logicalPath:z.string(),slot:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),visibility:z.enum([`scope`,`session`])}).strict(),compiledDynamicSkillDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),extensionNamespace:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledDynamicInstructionsDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledHookDefinitionSchema=z.object({eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),slug:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledExtensionMountSchema=z.object({externalDependencies:z.array(z.string()).readonly(),namespace:z.string(),packageName:z.string(),packageNamespace:z.string(),sourceRoot:z.string(),mountSourceId:z.string(),mountLogicalPath:z.string()}).strict(),compiledAgentResourceFields={agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),channelRoutes:compiledChannelRoutePlanSchema,connections:z.array(compiledConnectionDefinitionSchema),dynamicConnections:z.array(compiledDynamicConnectionDefinitionSchema).default([]),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,workflowTool:compiledWorkflowToolDefinitionSchema.optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),extensionMounts:z.array(compiledExtensionMountSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),memories:z.array(compiledMemoryDefinitionSchema).default([]),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),remoteAgents:z.array(compiledRemoteAgentNodeSchema),skills:z.array(compiledSkillSourceSchema).readonly(),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),workspaceResourceRoot:compiledWorkspaceResourceRootSchema},compiledAgentResourcesSchema=z.object(compiledAgentResourceFields).strict(),compiledAgentNodeManifestSchema=z.object({...compiledAgentResourceFields,config:compiledAgentConfigSchema}).strict(),compiledSubagentNodeBaseFields={backing:resourceSourceBackingSchema,entryPath:z.string(),logicalPath:z.string(),name:z.string(),nodeId:z.string(),owner:agentSourceOwnerSchema,parentNodeId:z.string(),rootPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`),exportName:z.string().optional()},compiledDynamicSubagentDefinitionSchema=z.object({build:compiledAgentBuildDefinitionSchema.optional(),eventNames:z.array(z.string()).readonly(),exportName:z.string().optional(),logicalPath:z.string(),sourceId:z.string(),sourceKind:z.literal(`module`)}).strict(),compiledSubagentNodeSchema=z.union([z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentNodeManifestSchema,description:z.string()}).strict(),z.object({...compiledSubagentNodeBaseFields,agent:compiledAgentResourcesSchema,configResolver:compiledDynamicSubagentDefinitionSchema}).strict()]),compiledAgentManifestSchema=z.object({agentRoot:z.string(),appRoot:z.string(),bindings:z.record(z.string(),compiledModuleBindingSchema),extensionMounts:z.array(compiledExtensionMountSchema).default([]),channelRoutes:compiledChannelRoutePlanSchema,config:compiledAgentConfigSchema,connections:z.array(compiledConnectionDefinitionSchema),dynamicConnections:z.array(compiledDynamicConnectionDefinitionSchema).default([]),diagnosticsSummary:discoverDiagnosticsSummarySchema,sourceComposition:agentSourceCompositionSchema,workflowTool:compiledWorkflowToolDefinitionSchema.optional(),dynamicInstructions:z.array(compiledDynamicInstructionsDefinitionSchema).default([]),dynamicSkills:z.array(compiledDynamicSkillDefinitionSchema).default([]),dynamicTools:z.array(compiledDynamicToolDefinitionSchema).default([]),hooks:z.array(compiledHookDefinitionSchema),memories:z.array(compiledMemoryDefinitionSchema).default([]),kind:z.literal(COMPILED_AGENT_MANIFEST_KIND),remoteAgents:z.array(compiledRemoteAgentNodeSchema),sandbox:compiledSandboxDefinitionSchema,sandboxWorkspaces:z.array(compiledSandboxWorkspaceSchema),schedules:z.array(compiledScheduleDefinitionSchema),skills:z.array(compiledSkillSourceSchema).readonly(),subagents:z.array(compiledSubagentNodeSchema),instructions:z.array(compiledInstructionsSchema).readonly().default([]),instrumentation:moduleSourceRefSchema.optional(),tools:z.array(compiledToolDefinitionSchema),version:z.literal(47),workspaceResourceRoot:compiledWorkspaceResourceRootSchema}).strict();function createCompiledAgentResources(e){return{agentRoot:e.agentRoot,appRoot:e.appRoot,bindings:{...e.bindings},channelRoutes:{effective:[...e.channelRoutes.effective],preflight:[...e.channelRoutes.preflight],shadowed:[...e.channelRoutes.shadowed]},connections:[...e.connections??[]],dynamicConnections:[...e.dynamicConnections??[]],diagnosticsSummary:e.diagnosticsSummary??{errors:0,warnings:0},sourceComposition:{entries:[...e.sourceComposition.entries]},workflowTool:e.workflowTool===void 0?void 0:{...e.workflowTool},dynamicInstructions:[...e.dynamicInstructions??[]],dynamicSkills:[...e.dynamicSkills??[]],dynamicTools:[...e.dynamicTools??[]],extensionMounts:[...e.extensionMounts??[]],hooks:[...e.hooks??[]],memories:[...e.memories??[]],instructions:[...e.instructions??[]],instrumentation:e.instrumentation===void 0?void 0:{...e.instrumentation},remoteAgents:[...e.remoteAgents??[]],sandbox:e.sandbox,sandboxWorkspaces:[...e.sandboxWorkspaces??[]],schedules:[...e.schedules??[]],skills:[...e.skills??[]],tools:[...e.tools??[]],workspaceResourceRoot:e.workspaceResourceRoot??{logicalPath:``,rootEntries:deriveResourceRootEntries({sandboxWorkspaces:e.sandboxWorkspaces,skills:e.skills})}}}function createCompiledAgentNodeManifest(e){let t={...createCompiledAgentResources(e),config:cloneCompiledAgentDefinition(e.config)};return validateCompiledAgentResources(t,{allowUnknownResourceWinners:!0}),t}function cloneCompiledAgentDefinition(e){let t={build:e.build===void 0?void 0:{externalDependencies:e.build.externalDependencies===void 0?void 0:[...e.build.externalDependencies]},compaction:{model:e.compaction?.model===void 0?void 0:cloneCompiledRuntimeModelReference(e.compaction.model),thresholdPercent:e.compaction?.thresholdPercent},description:e.description,experimental:e.experimental===void 0?void 0:{instrumentationProviders:e.experimental.instrumentationProviders,tasks:e.experimental.tasks,workflow:e.experimental.workflow===void 0?void 0:{world:e.experimental.workflow.world}},name:e.name,outputSchema:e.outputSchema,reasoning:e.reasoning,limits:e.limits===void 0?void 0:{maxInputTokensPerSession:e.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.limits.sessionTimeoutMs},source:{...e.source}};return e.dynamicModel===void 0?{...t,model:cloneCompiledRuntimeModelReference(e.model)}:{...t,dynamicModel:{...e.dynamicModel}}}function deriveResourceRootEntries(e){let t=new Set;for(let n of e.sandboxWorkspaces??[])for(let e of n.rootEntries)t.add(e);return[...t].sort((e,t)=>e.localeCompare(t))}function createCompiledSubagentNodeId(e,t){return e===`__root__`?t:`${e}::${t}`}function createCompiledAgentManifest(e){let t={...createCompiledAgentNodeManifest(e),kind:COMPILED_AGENT_MANIFEST_KIND,extensionMounts:[...e.extensionMounts??[]],subagents:[...e.subagents??[]],version:47};return validateCompiledAgentManifest(t),t}function cloneCompiledRuntimeModelReference(e){let t={id:e.id,routing:cloneModelRouting(e.routing)};return e.contextWindowTokens!==void 0&&(t.contextWindowTokens=e.contextWindowTokens),e.maxOutputTokens!==void 0&&(t.maxOutputTokens=e.maxOutputTokens),e.providerOptions!==void 0&&(t.providerOptions={...e.providerOptions}),e.source!==void 0&&(t.source={...e.source}),t}function cloneModelRouting(e){return e.kind===`external`?{kind:`external`,provider:e.provider}:e.byok===void 0?{kind:`gateway`,target:e.target}:{kind:`gateway`,target:e.target,byok:e.byok}}export{COMPILED_AGENT_MANIFEST_KIND,COMPILED_AGENT_MANIFEST_VERSION,ROOT_COMPILED_AGENT_NODE_ID,compiledAgentManifestSchema,createCompiledAgentManifest,createCompiledAgentNodeManifest,createCompiledAgentResources,createCompiledSubagentNodeId,deriveResourceRootEntries};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stripLogicalPathExtension}from"#discover/filesystem.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{normalizeToolDefinition}from"#internal/authored-definition/schema-backed.js";async function compileToolEntry(
|
|
1
|
+
import{stripLogicalPathExtension}from"#discover/filesystem.js";import{resolveAuthoredPackageRoot}from"#internal/authored-module-loader.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{normalizeToolDefinition}from"#internal/authored-definition/schema-backed.js";import{readAuthoredExecuteWorkflowId}from"#internal/workflow-bundle/authored-workflow-modules.js";async function compileToolEntry(t,r,i){let a=normalizeToolDefinition(await loadModuleBackedDefinition({binding:i.binding,kind:`tool`,loadNamespace:i.loadNamespace,source:r}),`Expected the tool export "${r.exportName??`default`}" from "${r.logicalPath}" to match the public eve shape.`),o=stripLogicalPathExtension(r.logicalPath).replace(/^tools\//,``).replaceAll(`/`,`-`);if(a.kind===`disabled`)return{kind:`disabled`,name:o};if(a.kind===`workflow-tool`)return{kind:`workflow-tool`,maxSubagents:a.maxSubagents};if(a.kind===`web-search-tool`){if(o!==`web_search`)throw Error(`The webSearch() definition must be exported from "tools/web_search.ts", not "${r.logicalPath}".`);return{definition:{behavior:{availability:[],handling:{kind:`provider-tool`,provider:a.provider}},description:`Search the web for real-time information. Use this to find up-to-date information about current events, recent developments, or topics that may have changed since the knowledge cutoff.`,exportName:r.exportName,hasExecute:!1,hasModelOutputProjection:!1,inputSchema:null,logicalPath:r.logicalPath,name:o,sourceId:r.sourceId,sourceKind:`module`,requiresApproval:!1},kind:`web-search-tool`}}if(a.kind===`dynamic-tool`)return{kind:`dynamic-tool`,definition:{eventNames:[...a.eventNames],exportName:r.exportName,logicalPath:r.logicalPath,rebindMissingCallbacks:a.rebindMissingCallbacks||void 0,slug:o,sourceId:r.sourceId,sourceKind:`module`}};let s=await readToolWorkflowId(i.binding);return{kind:`tool`,definition:{behavior:s===void 0?a.definition.behavior:{availability:[],handling:{kind:`workflow-tool`,workflowId:s}},description:a.definition.description,execution:a.definition.execution,exportName:r.exportName,hasExecute:a.definition.hasExecute,hasModelOutputProjection:a.definition.hasModelOutputProjection,inputSchema:a.definition.inputSchema??null,logicalPath:r.logicalPath,name:o,outputSchema:a.definition.outputSchema,requiresApproval:a.definition.hasApproval,sourceId:r.sourceId,sourceKind:`module`}}}async function readToolWorkflowId(e){if(e.backing.kind!==`filesystem`)return;let n=e.backing.sourcePath;return await readAuthoredExecuteWorkflowId({appRoot:resolveAuthoredPackageRoot(n),filePath:n})}export{compileToolEntry};
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* `#runtime/sessions/runtime-context-keys.ts`.
|
|
5
5
|
*/
|
|
6
6
|
import type { LanguageModel, ModelMessage, SystemModelMessage } from "ai";
|
|
7
|
-
import type { InstrumentationDecision } from "#shared/instrumentation-decision.js";
|
|
8
7
|
import type { ActivityObserverConfig, ChannelDeliveryMetadata, ChannelInstrumentationProjection, SessionAuthContext, SessionCallback, SessionCapabilities, SessionParent, SessionTraceContext, SessionTurn } from "#channel/types.js";
|
|
9
8
|
import { ContextKey } from "#context/key.js";
|
|
10
9
|
import type { InstrumentationChannelDeliveryRef } from "#instrumentation/lifecycle.js";
|
|
@@ -73,17 +72,13 @@ export interface ActiveChannelDelivery {
|
|
|
73
72
|
}
|
|
74
73
|
export declare const ActiveChannelDeliveriesKey: ContextKey<readonly ActiveChannelDelivery[]>;
|
|
75
74
|
export declare const ChannelInstrumentationKey: ContextKey<ChannelInstrumentationProjection>;
|
|
75
|
+
/** Trace ceiling and immutable origin accepted from a trusted forwarding deployment. */
|
|
76
76
|
export declare const ModeKey: ContextKey<RunMode>;
|
|
77
77
|
export declare const ParentSessionKey: ContextKey<SessionParent>;
|
|
78
78
|
/** Separate from {@link ParentSessionKey} so it stays out of what extensions read. */
|
|
79
79
|
export declare const ParentTraceContextKey: ContextKey<SessionTraceContext>;
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
readonly traceId: string;
|
|
83
|
-
readonly spanId: string;
|
|
84
|
-
readonly traceFlags: number;
|
|
85
|
-
}
|
|
86
|
-
export declare const SessionTraceSeedKey: ContextKey<SessionTraceSeed>;
|
|
80
|
+
export type SessionTraceSeed = SessionTraceContext;
|
|
81
|
+
export declare const SessionTraceSeedKey: ContextKey<SessionTraceContext>;
|
|
87
82
|
export declare const OtelTraceEnabledKey: ContextKey<boolean>;
|
|
88
83
|
export declare const SubagentDepthKey: ContextKey<number>;
|
|
89
84
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_ACTIVITY_ROUTE_PATTERN,EVE_CALLBACK_ROUTE_PATTERN,EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,EVE_HEALTH_ROUTE_PATH,EVE_INFO_ROUTE_PATH,EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,EVE_SESSION_CANCEL_ROUTE_PATTERN,EVE_SESSION_CLEAR_ROUTE_PATTERN,EVE_SESSION_COMPACT_ROUTE_PATTERN,EVE_SESSION_RESET_ROUTE_PATTERN,EVE_SESSION_ROUTE_PATH,EVE_SESSION_ROUTE_PATTERN,EVE_SESSION_STREAM_ROUTE_PATTERN,EVE_SUBAGENT_STREAM_ROUTE_PATTERN,EVE_TASK_INPUT_ROUTE_PATTERN,createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{attachClientContext}from"#internal/client-context.js";import{createLogger,logError}from"#internal/logging.js";import{isRuntimeSessionOwnershipConflictError}from"#execution/runtime-errors.js";import{EVE_SESSION_ID_HEADER,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER}from"#protocol/message.js";import{GET,HEAD,POST,defineChannel}from"#public/definitions/channel.js";import{resolveForwardedPrincipal}from"#channel/forwarded-principal.js";import{handleConnectionCallbackRequest,handleLegacyConnectionCallbackRequest}from"#execution/connections/callback-route.js";import{handleActivityRequest}from"#execution/activity-route.js";import{handleSessionCallbackRequest}from"#execution/session-callback-route.js";import{handleTaskInputResponseRequest}from"#execution/task-input-response-route.js";import{readAgentInfoRouteResponse,readRemoteAgentStreamHeadersResolver,readRouteSessionCreator}from"#internal/nitro/routes/channel-route-context.js";import{parseTraceparent}from"#protocol/traceparent.js";import{routeAuth}from"#public/channels/auth.js";import{mergeUploadPolicy}from"#public/channels/upload-policy.js";import{checkUploadPolicy,createSessionStreamResponse,deriveOperationContinuationToken,parseCancelTurnBody,parseCreateBody,parseIncludeTailIndex,parseJsonRequest,parseResetBody,parseSessionControlBody,parseSessionMessageBody,parseStartIndex,rejectSessionContinuationToken,requireSessionId}from"#eve-channel/request.js";import{findRemoteSubagentBinding,healthResponse,normalizeEveCors,resolveOnMessage}from"#eve-channel/support.js";export*from"#eve-channel/types.js";const log=createLogger(`eve.channel`);function eveChannel(h){let g=mergeUploadPolicy(h.uploadPolicy);return defineChannel({cors:normalizeEveCors(h.cors),turnPolicy:h.turnPolicy,routes:[GET(EVE_HEALTH_ROUTE_PATH,async()=>healthResponse()),HEAD(EVE_HEALTH_ROUTE_PATH,async()=>healthResponse()),GET(EVE_INFO_ROUTE_PATH,async(e,t)=>{let n=await routeAuth(e,h.auth);if(n instanceof Response)return n;let r=readAgentInfoRouteResponse(t);return r===void 0?Response.json({error:`Agent info route requires internal channel dispatch context.`,ok:!1},{status:500}):await r()}),GET(EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,handleConnectionCallbackRequest),POST(EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,handleConnectionCallbackRequest),GET(EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,handleLegacyConnectionCallbackRequest),POST(EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,handleLegacyConnectionCallbackRequest),POST(EVE_ACTIVITY_ROUTE_PATTERN,handleActivityRequest),POST(EVE_CALLBACK_ROUTE_PATTERN,handleSessionCallbackRequest),POST(EVE_TASK_INPUT_ROUTE_PATTERN,handleTaskInputResponseRequest),POST(EVE_SESSION_ROUTE_PATH,async(e,t)=>{let n=await routeAuth(e,h.auth);if(n instanceof Response)return n;let r=await parseJsonRequest(e);if(r instanceof Response)return r;let i=rejectSessionContinuationToken(r);if(i!==null)return i;let a=await resolveForwardedPrincipal({trustedForwarders:h.trustedForwarders,forwarder:n,payload:r});if(a instanceof Response)return a;let o=parseCreateBody(r);if(o instanceof Response)return o;let s=o.callback===void 0?void 0:parseTraceparent(e.headers.get(`traceparent`)),c=checkUploadPolicy(o,g);if(c!==null)return c;if(o.operationId!==void 0&&a.auth.principalType===`anonymous`)return Response.json({error:`operationId requires an authenticated principal.`,ok:!1},{status:400});let l=o.operationId===void 0?void 0:await deriveOperationContinuationToken({auth:a.auth,operationId:o.operationId});if(l!==void 0){let e=await t.resolveSession(l);if(e!==void 0)return Response.json({ok:!0,sessionId:e.id,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:e.id},status:202})}let u=await resolveOnMessage({auth:a.auth,config:h,message:o.message,request:e});if(u instanceof Response)return u;let d=readRouteSessionCreator(t);if(d===void 0)return Response.json({error:`Session creation requires internal channel dispatch context.`,ok:!1},{status:500});let f;try{f=await d({activityObserver:o.activityObserver,auth:u.auth,capabilities:o.capabilities??(o.mode===`task`?void 0:{requestInput:!0}),callback:o.callback,continuationToken:l,initiatorAuth:a.accepted?a.initiatorAuth:void 0,input:attachClientContext({message:o.message,context:u.context,outputSchema:o.outputSchema},o.context),mode:o.mode??`conversation`,parentTraceContext:s,title:u.title})}catch(e){if(l!==void 0&&isRuntimeSessionOwnershipConflictError(e))return Response.json({ok:!0,sessionId:e.ownerSessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:e.ownerSessionId},status:202});let t=logError(log,`session-create request failed`,e);return Response.json({error:`Failed to create the session.`,errorId:t,ok:!1},{status:500})}return Response.json({ok:!0,sessionId:f.sessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:f.sessionId},status:202})}),POST(EVE_SESSION_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseJsonRequest(e);if(a instanceof Response)return a;let o=await resolveForwardedPrincipal({trustedForwarders:h.trustedForwarders,forwarder:r,payload:a});if(o instanceof Response)return o;let s=parseSessionMessageBody(a);if(s instanceof Response)return s;let c=checkUploadPolicy(s,g);if(c!==null)return c;let l,u=o.auth;if(s.message!==void 0){let t=await resolveOnMessage({auth:o.auth,config:h,message:s.message,request:e,sessionId:i});if(t instanceof Response)return t;l=t.context,u=t.auth}let d;try{let e=t(i),n=attachClientContext({activityObserver:s.activityObserver,auth:u,callback:s.callback,context:l,outputSchema:s.outputSchema,turnPolicy:s.turnPolicy},s.context);d=s.inputResponses===void 0?await e.send(s.message,n):await e.respond(s.inputResponses,n)}catch(e){let t=logError(log,`session-message request failed`,e,{sessionId:i});return Response.json({error:`Failed to send the session message.`,errorId:t,ok:!1},{status:500})}return d.status===`session_not_active`?Response.json({code:`session_not_active`,error:`The session is no longer active.`,ok:!1},{headers:{"cache-control":`no-store`},status:409}):Response.json({ok:!0,sessionId:d.sessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:d.sessionId},status:202})}),POST(EVE_SESSION_CANCEL_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseCancelTurnBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).cancel({taskId:a.taskId,turnId:a.turnId})}catch(e){let t=logError(log,`cancel-turn request failed`,e,{sessionId:i});return Response.json({error:`Failed to cancel the turn.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_turn`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_COMPACT_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseSessionControlBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).compact()}catch(e){let t=logError(log,`session-compaction request failed`,e,{sessionId:i});return Response.json({error:`Failed to compact the session.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_CLEAR_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseSessionControlBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).clear()}catch(e){let t=logError(log,`session-clear request failed`,e,{sessionId:i});return Response.json({error:`Failed to clear the session context.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_RESET_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseResetBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).reset({reason:a.reason})}catch(e){let t=logError(log,`session-reset request failed`,e,{sessionId:i});return Response.json({error:`Failed to reset the session.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`reset`?{ok:!0,previousSessionId:o.previousSessionId,status:`reset`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`}})}),GET(EVE_SESSION_STREAM_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,h.auth);if(r instanceof Response)return r;let i=requireSessionId(n);return i instanceof Response?i:await createSessionStreamResponse(e,t(i))}),GET(EVE_SUBAGENT_STREAM_ROUTE_PATTERN,async(e,t)=>{let n=await routeAuth(e,h.auth);if(n instanceof Response)return n;let r=t.params.parentSessionId,i=t.params.callId,a=t.params.childSessionId;if(!r||!i||!a)return Response.json({error:`Missing subagent stream coordinates.`,ok:!1},{status:400});let o=parseStartIndex(e);if(o instanceof Response)return o;let s=parseIncludeTailIndex(e),c=createEveSubagentStreamRoutePath({callId:i,childSessionId:a,parentSessionId:r}),l;try{let e=await findRemoteSubagentBinding({callId:i,childSessionId:a,childStreamPath:c,parentSessionId:r,parent:t.attachSession(r)});if(e===void 0)throw Error(`Remote subagent binding not found.`);l=e}catch{return Response.json({error:`Subagent stream not found.`,ok:!1},{status:404})}let u=readRemoteAgentStreamHeadersResolver(t);if(u===void 0)return Response.json({error:`Subagent stream proxy requires internal channel dispatch context.`,ok:!1},{status:500});let d;try{d=await u({name:l.data.toolName,resolverId:l.data.remote.resolverId,url:l.data.remote.url})}catch{return Response.json({error:`Subagent stream not found.`,ok:!1},{status:404})}let f=new URL(createEveSessionStreamRoutePath(a).replace(/^\/+/,``),`${l.data.remote.url.replace(/\/+$/,``)}/`);o!==void 0&&f.searchParams.set(`startIndex`,String(o)),s&&f.searchParams.set(`includeTailIndex`,`1`);let p=await fetch(f,{cache:`no-store`,headers:d,redirect:`manual`,signal:e.signal}),m=new Headers;for(let e of[`cache-control`,`content-type`,`x-accel-buffering`,EVE_SESSION_ID_HEADER,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER]){let t=p.headers.get(e);t!==null&&m.set(e,t)}return new Response(p.body,{headers:m,status:p.status,statusText:p.statusText})})],events:h.events})}export{eveChannel};
|
|
1
|
+
import{EVE_ACTIVITY_ROUTE_PATTERN,EVE_CALLBACK_ROUTE_PATTERN,EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,EVE_HEALTH_ROUTE_PATH,EVE_INFO_ROUTE_PATH,EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,EVE_SESSION_CANCEL_ROUTE_PATTERN,EVE_SESSION_CLEAR_ROUTE_PATTERN,EVE_SESSION_COMPACT_ROUTE_PATTERN,EVE_SESSION_RESET_ROUTE_PATTERN,EVE_SESSION_ROUTE_PATH,EVE_SESSION_ROUTE_PATTERN,EVE_SESSION_STREAM_ROUTE_PATTERN,EVE_SUBAGENT_STREAM_ROUTE_PATTERN,EVE_TASK_INPUT_ROUTE_PATTERN,createEveSessionStreamRoutePath,createEveSubagentStreamRoutePath}from"#protocol/routes.js";import{attachClientContext}from"#internal/client-context.js";import{createLogger,logError}from"#internal/logging.js";import{isRuntimeSessionOwnershipConflictError}from"#execution/runtime-errors.js";import{EVE_SESSION_ID_HEADER,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER}from"#protocol/message.js";import{DELETE,GET,HEAD,PATCH,POST,PUT,defineChannel}from"#public/definitions/channel.js";import{resolveForwardedPrincipal}from"#channel/forwarded-principal.js";import{handleConnectionCallbackRequest,handleLegacyConnectionCallbackRequest}from"#execution/connections/callback-route.js";import{handleActivityRequest}from"#execution/activity-route.js";import{handleSessionCallbackRequest}from"#execution/session-callback-route.js";import{handleTaskInputResponseRequest}from"#execution/task-input-response-route.js";import{WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest}from"#execution/workflow-webhook-route.js";import{readAgentInfoRouteResponse,readRemoteAgentStreamHeadersResolver,readRouteSessionCreator}from"#internal/nitro/routes/channel-route-context.js";import{parseTraceparent}from"#protocol/traceparent.js";import{readForwardedAudienceBaggage}from"#protocol/baggage.js";import{FAIL_CLOSED_FORWARDED_TRACE_ASSERTION,formatTraceContentCeiling}from"#shared/forwarded-trace-policy.js";import{routeAuth}from"#public/channels/auth.js";import{mergeUploadPolicy}from"#public/channels/upload-policy.js";import{checkUploadPolicy,createSessionStreamResponse,deriveOperationContinuationToken,parseCancelTurnBody,parseCreateBody,parseIncludeTailIndex,parseJsonRequest,parseResetBody,parseSessionControlBody,parseSessionMessageBody,parseStartIndex,rejectSessionContinuationToken,requireSessionId}from"#eve-channel/request.js";import{findRemoteSubagentBinding,healthResponse,normalizeEveCors,resolveOnMessage}from"#eve-channel/support.js";export*from"#eve-channel/types.js";const log=createLogger(`eve.channel`);function eveChannel(g){let _=mergeUploadPolicy(g.uploadPolicy);return defineChannel({cors:normalizeEveCors(g.cors),turnPolicy:g.turnPolicy,routes:[GET(EVE_HEALTH_ROUTE_PATH,async()=>healthResponse()),HEAD(EVE_HEALTH_ROUTE_PATH,async()=>healthResponse()),GET(EVE_INFO_ROUTE_PATH,async(e,t)=>{let n=await routeAuth(e,g.auth);if(n instanceof Response)return n;let r=readAgentInfoRouteResponse(t);return r===void 0?Response.json({error:`Agent info route requires internal channel dispatch context.`,ok:!1},{status:500}):await r()}),GET(EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,handleConnectionCallbackRequest),POST(EVE_CONNECTION_CALLBACK_ROUTE_PATTERN,handleConnectionCallbackRequest),GET(EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,handleLegacyConnectionCallbackRequest),POST(EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN,handleLegacyConnectionCallbackRequest),POST(EVE_ACTIVITY_ROUTE_PATTERN,handleActivityRequest),POST(EVE_CALLBACK_ROUTE_PATTERN,handleSessionCallbackRequest),POST(EVE_TASK_INPUT_ROUTE_PATTERN,handleTaskInputResponseRequest),GET(WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest),POST(WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest),PUT(WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest),PATCH(WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest),DELETE(WORKFLOW_WEBHOOK_ROUTE_PATTERN,handleWorkflowWebhookRequest),POST(EVE_SESSION_ROUTE_PATH,async(e,t)=>{let n=await routeAuth(e,g.auth);if(n instanceof Response)return n;let r=await parseJsonRequest(e);if(r instanceof Response)return r;let i=rejectSessionContinuationToken(r);if(i!==null)return i;let a=await resolveForwardedPrincipal({trustedForwarders:g.trustedForwarders,forwarder:n,payload:r});if(a instanceof Response)return a;let o=parseCreateBody(r);if(o instanceof Response)return o;let s=o.callback===void 0?void 0:parseTraceparent(e.headers.get(`traceparent`)),c=checkUploadPolicy(o,_);if(c!==null)return c;if(o.operationId!==void 0&&a.auth.principalType===`anonymous`)return Response.json({error:`operationId requires an authenticated principal.`,ok:!1},{status:400});let l=o.operationId===void 0?void 0:await deriveOperationContinuationToken({auth:a.auth,operationId:o.operationId});if(l!==void 0){let e=await t.resolveSession(l);if(e!==void 0)return Response.json({ok:!0,sessionId:e.id,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:e.id},status:202})}let u=s===void 0?`absent`:readForwardedAudienceBaggage(e.headers.get(`baggage`)),d=a.accepted&&s!==void 0&&(s.traceFlags&1)==1?typeof u==`object`?u:u===`malformed`?FAIL_CLOSED_FORWARDED_TRACE_ASSERTION:void 0:void 0,f=s;d!==void 0&&s!==void 0&&(f={...s,forwardedTracePolicy:d}),u===`malformed`?log.warn(`using metadata-only policy for malformed forwarded audience baggage`,{forwarder:n.principalId}):typeof u==`object`&&(d===void 0?log.warn(`ignoring forwarded trace policy without an accepted sampled principal`,{forwarder:n.principalId}):log.info(`accepted forwarded trace policy`,{audience:u.originAudience,ceiling:formatTraceContentCeiling(u.ceiling),forwarder:n.principalId}));let p=await resolveOnMessage({auth:a.auth,config:g,message:o.message,request:e});if(p instanceof Response)return p;let m=readRouteSessionCreator(t);if(m===void 0)return Response.json({error:`Session creation requires internal channel dispatch context.`,ok:!1},{status:500});let h;try{h=await m({activityObserver:o.activityObserver,auth:p.auth,capabilities:o.capabilities??(o.mode===`task`?void 0:{requestInput:!0}),callback:o.callback,continuationToken:l,initiatorAuth:a.accepted?a.initiatorAuth:void 0,input:attachClientContext({message:o.message,context:p.context,outputSchema:o.outputSchema},o.context),mode:o.mode??`conversation`,parentTraceContext:f,title:p.title})}catch(e){if(l!==void 0&&isRuntimeSessionOwnershipConflictError(e))return Response.json({ok:!0,sessionId:e.ownerSessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:e.ownerSessionId},status:202});let t=logError(log,`session-create request failed`,e);return Response.json({error:`Failed to create the session.`,errorId:t,ok:!1},{status:500})}return Response.json({ok:!0,sessionId:h.sessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:h.sessionId},status:202})}),POST(EVE_SESSION_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseJsonRequest(e);if(a instanceof Response)return a;let o=await resolveForwardedPrincipal({trustedForwarders:g.trustedForwarders,forwarder:r,payload:a});if(o instanceof Response)return o;let s=parseSessionMessageBody(a);if(s instanceof Response)return s;let c=checkUploadPolicy(s,_);if(c!==null)return c;let l,u=o.auth;if(s.message!==void 0){let t=await resolveOnMessage({auth:o.auth,config:g,message:s.message,request:e,sessionId:i});if(t instanceof Response)return t;l=t.context,u=t.auth}let d;try{let e=t(i),n=attachClientContext({activityObserver:s.activityObserver,auth:u,callback:s.callback,context:l,outputSchema:s.outputSchema,turnPolicy:s.turnPolicy},s.context);d=s.inputResponses===void 0?await e.send(s.message,n):await e.respond(s.inputResponses,n)}catch(e){let t=logError(log,`session-message request failed`,e,{sessionId:i});return Response.json({error:`Failed to send the session message.`,errorId:t,ok:!1},{status:500})}return d.status===`session_not_active`?Response.json({code:`session_not_active`,error:`The session is no longer active.`,ok:!1},{headers:{"cache-control":`no-store`},status:409}):Response.json({ok:!0,sessionId:d.sessionId,status:`accepted`},{headers:{"cache-control":`no-store`,[EVE_SESSION_ID_HEADER]:d.sessionId},status:202})}),POST(EVE_SESSION_CANCEL_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseCancelTurnBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).cancel({taskId:a.taskId,turnId:a.turnId})}catch(e){let t=logError(log,`cancel-turn request failed`,e,{sessionId:i});return Response.json({error:`Failed to cancel the turn.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_turn`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_COMPACT_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseSessionControlBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).compact()}catch(e){let t=logError(log,`session-compaction request failed`,e,{sessionId:i});return Response.json({error:`Failed to compact the session.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_CLEAR_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseSessionControlBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).clear()}catch(e){let t=logError(log,`session-clear request failed`,e,{sessionId:i});return Response.json({error:`Failed to clear the session context.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`accepted`?{ok:!0,sessionId:o.sessionId,status:`accepted`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`},status:o.status===`accepted`?202:200})}),POST(EVE_SESSION_RESET_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);if(i instanceof Response)return i;let a=await parseResetBody(e);if(a instanceof Response)return a;let o;try{o=await t(i).reset({reason:a.reason})}catch(e){let t=logError(log,`session-reset request failed`,e,{sessionId:i});return Response.json({error:`Failed to reset the session.`,errorId:t,ok:!1},{status:500})}return Response.json(o.status===`reset`?{ok:!0,previousSessionId:o.previousSessionId,status:`reset`}:{ok:!0,status:`no_active_session`},{headers:{"cache-control":`no-store`}})}),GET(EVE_SESSION_STREAM_ROUTE_PATTERN,async(e,{attachSession:t,params:n})=>{let r=await routeAuth(e,g.auth);if(r instanceof Response)return r;let i=requireSessionId(n);return i instanceof Response?i:await createSessionStreamResponse(e,t(i))}),GET(EVE_SUBAGENT_STREAM_ROUTE_PATTERN,async(e,t)=>{let n=await routeAuth(e,g.auth);if(n instanceof Response)return n;let r=t.params.parentSessionId,i=t.params.callId,a=t.params.childSessionId;if(!r||!i||!a)return Response.json({error:`Missing subagent stream coordinates.`,ok:!1},{status:400});let o=parseStartIndex(e);if(o instanceof Response)return o;let s=parseIncludeTailIndex(e),c=createEveSubagentStreamRoutePath({callId:i,childSessionId:a,parentSessionId:r}),l;try{let e=await findRemoteSubagentBinding({callId:i,childSessionId:a,childStreamPath:c,parentSessionId:r,parent:t.attachSession(r)});if(e===void 0)throw Error(`Remote subagent binding not found.`);l=e}catch{return Response.json({error:`Subagent stream not found.`,ok:!1},{status:404})}let u=readRemoteAgentStreamHeadersResolver(t);if(u===void 0)return Response.json({error:`Subagent stream proxy requires internal channel dispatch context.`,ok:!1},{status:500});let d;try{d=await u({name:l.data.toolName,resolverId:l.data.remote.resolverId,url:l.data.remote.url})}catch{return Response.json({error:`Subagent stream not found.`,ok:!1},{status:404})}let f=new URL(createEveSessionStreamRoutePath(a).replace(/^\/+/,``),`${l.data.remote.url.replace(/\/+$/,``)}/`);o!==void 0&&f.searchParams.set(`startIndex`,String(o)),s&&f.searchParams.set(`includeTailIndex`,`1`);let p=await fetch(f,{cache:`no-store`,headers:d,redirect:`manual`,signal:e.signal}),m=new Headers;for(let e of[`cache-control`,`content-type`,`x-accel-buffering`,EVE_SESSION_ID_HEADER,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER]){let t=p.headers.get(e);t!==null&&m.set(e,t)}return new Response(p.body,{headers:m,status:p.status,statusText:p.statusText})})],events:g.events})}export{eveChannel};
|
|
@@ -78,21 +78,21 @@ export interface EveChannelInput {
|
|
|
78
78
|
readonly auth: AuthFn<Request> | readonly AuthFn<Request>[];
|
|
79
79
|
/**
|
|
80
80
|
* The trusted-forwarders policy: which transport-authenticated callers may
|
|
81
|
-
* assert a forwarded principal
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* principal of the forwarder — who is asserting, never what is asserted —
|
|
85
|
-
* and must match it precisely (for example
|
|
81
|
+
* assert a forwarded principal or callback-marked public trace audience. The predicate
|
|
82
|
+
* receives the *verified* route-auth principal of the forwarder — who is
|
|
83
|
+
* asserting, never what is asserted — and must match it precisely (for example
|
|
86
84
|
* `(forwarder) => forwarder.subject === vercelSubject({ teamSlug, projectName })`).
|
|
87
85
|
* A permissive predicate lets any authenticated forwarder assert any
|
|
88
|
-
* principal.
|
|
86
|
+
* principal and public trace audience.
|
|
89
87
|
*
|
|
90
88
|
* When a trusted forwarder's assertion is accepted on session creation, the
|
|
91
89
|
* forwarded principal replaces `session.auth.current` and
|
|
92
90
|
* `session.auth.initiator`. On continuation, only `session.auth.current`
|
|
93
91
|
* changes; the initiator remains pinned to the session's creator. The
|
|
94
92
|
* forwarder is recorded on accepted contexts as the `eve:forwarded-by`
|
|
95
|
-
* attribute.
|
|
93
|
+
* attribute. An accepted public audience is evaluated by this deployment's
|
|
94
|
+
* trace policies; the default records model and tool content. Omit the option
|
|
95
|
+
* to reject forwarded principals with 403 and ignore forwarded audience.
|
|
96
96
|
*/
|
|
97
97
|
readonly trustedForwarders?: TrustedForwarders;
|
|
98
98
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HookPayload } from "#channel/types.js";
|
|
2
|
+
import type { TurnStepInput } from "#execution/durable-session-migrations/turn-workflow.js";
|
|
3
|
+
import type { DurableStepResult } from "#execution/next-driver-action.js";
|
|
4
|
+
/** Returns one trusted accepting deployment only when every delivery agrees. */
|
|
5
|
+
export declare function readAcceptedDeploymentId(input: HookPayload): string | undefined;
|
|
6
|
+
/** Defers a speculative inline step before mutation when it reached another deployment. */
|
|
7
|
+
export declare function deferMismatchedInlineTurnStep(input: TurnStepInput): DurableStepResult | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function readAcceptedDeploymentId(e){if(e.kind!==`deliver`||e.deliveryMetadata?.length===0)return;let t=e.deliveryMetadata?.[0]?.acceptedDeploymentId;if(!(t===void 0||t.length===0))return e.deliveryMetadata?.every(e=>e.acceptedDeploymentId===t)?t:void 0}function deferMismatchedInlineTurnStep(e){if(!(e.acceptedDeploymentId===void 0||process.env.VERCEL_DEPLOYMENT_ID?.trim()===e.acceptedDeploymentId))return{action:`continue`,requiresChildDispatch:!0,serializedContext:e.serializedContext,sessionState:e.sessionState}}export{deferMismatchedInlineTurnStep,readAcceptedDeploymentId};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type DurableSessionState } from "#execution/durable-session-store.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Cancels every running delegated child recorded in the agent handle store
|
|
4
|
+
* and every workflow tool run the turn is waiting on.
|
|
5
|
+
*/
|
|
3
6
|
export declare function cancelDescendantTurnsStep(input: {
|
|
4
7
|
readonly serializedContext: Record<string, unknown>;
|
|
5
8
|
readonly sessionState: DurableSessionState;
|