eve 0.33.2 → 0.34.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 +28 -0
- package/dist/src/channel/channel-address.d.ts +3 -6
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/channel-operations.d.ts +2 -3
- package/dist/src/channel/delivery-metadata.d.ts +9 -0
- package/dist/src/channel/delivery-metadata.js +1 -0
- package/dist/src/channel/routes.d.ts +1 -0
- package/dist/src/channel/session.d.ts +3 -4
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +20 -3
- package/dist/src/chunks/{use-eve-agent-B-Hky2f4.js → use-eve-agent-BNdcle_M.js} +33 -0
- package/dist/src/chunks/{use-eve-agent-3oBnxzhV.js → use-eve-agent-FJkEMXYk.js} +33 -0
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +32 -3
- package/dist/src/compiled/@vercel/otel/index.d.ts +45 -2
- package/dist/src/compiler/extension-compatibility.d.ts +12 -12
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/context/build-dynamic-tools.d.ts +7 -0
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.d.ts +7 -0
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +13 -1
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/filesystem.d.ts +1 -1
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +1 -5
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-turn-step.d.ts +5 -0
- package/dist/src/execution/dispatch-turn-step.js +1 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.d.ts +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +2 -1
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/route-child-delivery.d.ts +3 -4
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/route-proxied-deliver-step.d.ts +34 -0
- package/dist/src/execution/route-proxied-deliver-step.js +1 -0
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +2 -2
- package/dist/src/execution/session-command-wire.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-adapter.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/tool-auth.d.ts +9 -0
- package/dist/src/execution/tool-auth.js +1 -1
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +1 -27
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/ai-sdk-telemetry.d.ts +19 -0
- package/dist/src/harness/ai-sdk-telemetry.js +1 -0
- package/dist/src/harness/approval-candidates.d.ts +109 -0
- package/dist/src/harness/approval-candidates.js +1 -0
- package/dist/src/harness/approval-delivery-coordinator.d.ts +39 -0
- package/dist/src/harness/approval-delivery-coordinator.js +1 -0
- package/dist/src/harness/authorization.d.ts +1 -0
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.d.ts +25 -0
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -0
- package/dist/src/harness/execute-tool.d.ts +1 -0
- package/dist/src/harness/hitl/approval-input-requests.js +1 -1
- package/dist/src/harness/hitl/pending-input-resolution.d.ts +3 -0
- package/dist/src/harness/hitl/pending-input-resolution.js +1 -1
- package/dist/src/harness/hitl/question-input-requests.js +1 -1
- package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-request-resolution.d.ts +22 -0
- package/dist/src/harness/input-request-resolution.js +1 -0
- package/dist/src/harness/input-requests.d.ts +1 -0
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/instrumentation-config.d.ts +9 -4
- package/dist/src/harness/instrumentation-config.js +1 -1
- package/dist/src/harness/instrumentation-content.d.ts +5 -0
- package/dist/src/harness/instrumentation-content.js +1 -0
- package/dist/src/harness/instrumentation-dispatch.d.ts +2 -0
- package/dist/src/harness/instrumentation-dispatch.js +1 -0
- package/dist/src/harness/instrumentation-lifecycle.d.ts +388 -65
- package/dist/src/harness/instrumentation-lifecycle.js +1 -1
- package/dist/src/harness/instrumentation-native-events.d.ts +10 -1
- package/dist/src/harness/instrumentation-native-events.js +1 -1
- package/dist/src/harness/instrumentation-providers.d.ts +50 -0
- package/dist/src/harness/instrumentation-providers.js +1 -0
- package/dist/src/harness/instrumentation-runtime.d.ts +3 -0
- package/dist/src/harness/instrumentation-runtime.js +1 -1
- package/dist/src/harness/instrumentation-setup-context.d.ts +12 -0
- package/dist/src/harness/instrumentation-setup-context.js +1 -0
- package/dist/src/harness/instrumentation-state.d.ts +59 -0
- package/dist/src/harness/instrumentation-state.js +1 -0
- package/dist/src/harness/messages.d.ts +2 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/pending-input-batches.d.ts +2 -0
- package/dist/src/harness/pending-input-batches.js +1 -1
- package/dist/src/harness/runtime-action-settlement-state.d.ts +3 -0
- package/dist/src/harness/runtime-action-settlement-state.js +1 -0
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/tool-call-action.d.ts +9 -0
- package/dist/src/harness/tool-call-action.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/types.d.ts +15 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +13 -4
- package/dist/src/internal/application/compiled-artifacts.js +5 -4
- package/dist/src/internal/application/dev-environment.d.ts +12 -0
- package/dist/src/internal/application/dev-environment.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/approval.d.ts +3 -0
- package/dist/src/internal/authored-definition/approval.js +1 -0
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/instrumentation-layout.d.ts +28 -0
- package/dist/src/internal/instrumentation-layout.js +1 -0
- package/dist/src/internal/materialized-authored-modules.d.ts +13 -2
- package/dist/src/internal/materialized-authored-modules.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/host/local-tracing-runtime-plugin.d.ts +5 -1
- package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +2 -3
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/message.d.ts +36 -1
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/protocol/traceparent.d.ts +10 -0
- package/dist/src/protocol/traceparent.js +1 -0
- package/dist/src/public/channels/eve.js +1 -1
- package/dist/src/public/channels/github/defaults.d.ts +1 -0
- package/dist/src/public/channels/github/defaults.js +5 -2
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +3 -3
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/inbound.d.ts +0 -3
- package/dist/src/public/channels/github/inbound.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +11 -3
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/definitions/approval.d.ts +57 -16
- package/dist/src/public/definitions/approval.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/hook.d.ts +4 -2
- package/dist/src/public/instrumentation/index.d.ts +32 -17
- package/dist/src/public/instrumentation/index.js +1 -1
- package/dist/src/public/instrumentation/otel.d.ts +31 -0
- package/dist/src/public/instrumentation/otel.js +1 -0
- package/dist/src/public/instrumentation/provider.d.ts +117 -0
- package/dist/src/public/instrumentation/provider.js +1 -0
- package/dist/src/public/tools/approval/approval-helpers.d.ts +4 -4
- package/dist/src/public/tools/index.d.ts +1 -1
- package/dist/src/runtime/actions/results.d.ts +3 -3
- package/dist/src/runtime/attributes/emit.js +1 -1
- package/dist/src/runtime/connections/principal.d.ts +3 -0
- package/dist/src/runtime/connections/principal.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +3 -5
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/connections/types.d.ts +5 -0
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/setup/index.d.ts +1 -0
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/setup/verified-remote-agent.d.ts +30 -0
- package/dist/src/setup/verified-remote-agent.js +1 -0
- package/dist/src/shared/agent-definition.d.ts +9 -0
- package/dist/src/shared/channel-definition.d.ts +3 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.d.ts +31 -0
- package/dist/src/tracing/agent-action-instrumentation.js +1 -0
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +13 -0
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -0
- package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +13 -0
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -0
- package/dist/src/tracing/agent-otel-content.d.ts +6 -0
- package/dist/src/tracing/agent-otel-content.js +2 -2
- package/dist/src/tracing/agent-otel-provider.d.ts +7 -7
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-usage.d.ts +4 -0
- package/dist/src/tracing/agent-otel-usage.js +1 -0
- package/dist/src/tracing/agent-span-id-generator.d.ts +2 -0
- package/dist/src/tracing/agent-span-id-generator.js +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.d.ts +28 -0
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -0
- package/dist/src/tracing/agent-trace-context-store.d.ts +8 -1
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/agent-trace-span-processor.d.ts +0 -1
- package/dist/src/tracing/agent-trace-span-processor.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +33 -3
- package/dist/src/tracing/agent-trace-state.js +1 -1
- package/dist/src/tracing/batch-span-processor.d.ts +20 -0
- package/dist/src/tracing/batch-span-processor.js +1 -0
- package/dist/src/tracing/content-attributes.d.ts +28 -0
- package/dist/src/tracing/content-attributes.js +1 -0
- package/dist/src/tracing/content-span-processor.d.ts +19 -0
- package/dist/src/tracing/content-span-processor.js +1 -0
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +19 -0
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -0
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-traces.d.ts +56 -0
- package/dist/src/tracing/local-traces.js +1 -0
- package/dist/src/tracing/otel-declaration.d.ts +150 -0
- package/dist/src/tracing/otel-declaration.js +1 -0
- package/dist/src/tracing/otel-registration.d.ts +21 -0
- package/dist/src/tracing/otel-registration.js +1 -0
- package/dist/src/tracing/vercel-runtime-span-exporter.d.ts +5 -0
- package/dist/src/tracing/vercel-runtime-span-exporter.js +1 -0
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/guides/instrumentation.md +22 -0
- package/package.json +7 -1
- package/dist/src/harness/otel-integration.d.ts +0 -12
- package/dist/src/harness/otel-integration.js +0 -1
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
2
|
+
import type { SessionParent, SessionTurn } from "#context/keys.js";
|
|
3
|
+
import type { ToolAuthOptions, ToolAuthProvider } from "#public/definitions/tool.js";
|
|
1
4
|
import type { SessionContext } from "#public/definitions/callback-context.js";
|
|
5
|
+
import type { TokenResult } from "#runtime/connections/types.js";
|
|
2
6
|
type ApprovalToolInput<TInput> = TInput extends object ? Readonly<TInput> : TInput;
|
|
3
7
|
/**
|
|
4
|
-
* Context passed to an {@link
|
|
8
|
+
* Context passed to an {@link ApprovalPolicy} function.
|
|
5
9
|
*
|
|
6
10
|
* Extends {@link SessionContext} so approval policies can make decisions from
|
|
7
11
|
* the active session, current caller, and turn.
|
|
8
|
-
*
|
|
9
|
-
* `approvedTools` is the set of tool names (or compound approval keys)
|
|
10
|
-
* already approved at least once in the current session. `toolName` is the
|
|
11
|
-
* runtime name of the tool being evaluated. `toolInput` is the raw input the
|
|
12
|
-
* model passed, available for input-aware decisions. `callId` is the id of
|
|
13
|
-
* the call being evaluated — the same `callId` carried by the call's stream
|
|
14
|
-
* events and its `execute` context.
|
|
15
12
|
*/
|
|
16
13
|
export interface ApprovalContext<TInput = Record<string, unknown>> extends SessionContext {
|
|
17
14
|
readonly approvedTools: ReadonlySet<string>;
|
|
@@ -19,12 +16,7 @@ export interface ApprovalContext<TInput = Record<string, unknown>> extends Sessi
|
|
|
19
16
|
readonly toolInput?: ApprovalToolInput<TInput>;
|
|
20
17
|
readonly toolName: string;
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Approval decision returned by an {@link Approval} function.
|
|
24
|
-
*
|
|
25
|
-
* AI SDK 7 statuses are accepted directly. For compatibility, `true` maps to
|
|
26
|
-
* `"user-approval"` and `false` maps to `"not-applicable"`.
|
|
27
|
-
*/
|
|
19
|
+
/** Request-time approval decision returned by an {@link ApprovalPolicy}. */
|
|
28
20
|
export type ApprovalStatus = undefined | boolean | "not-applicable" | "approved" | "denied" | "user-approval" | {
|
|
29
21
|
readonly type: "not-applicable";
|
|
30
22
|
readonly reason?: never;
|
|
@@ -38,6 +30,55 @@ export type ApprovalStatus = undefined | boolean | "not-applicable" | "approved"
|
|
|
38
30
|
readonly type: "user-approval";
|
|
39
31
|
readonly reason?: never;
|
|
40
32
|
};
|
|
41
|
-
/**
|
|
42
|
-
export type
|
|
33
|
+
/** Request-time approval policy shared by authored tools and connections. */
|
|
34
|
+
export type ApprovalPolicy<TInput = Record<string, unknown>> = (ctx: ApprovalContext<TInput>) => ApprovalStatus | Promise<ApprovalStatus>;
|
|
35
|
+
/** Stable tool request passed to a response authorizer. */
|
|
36
|
+
export interface ApprovalRequest<TInput = Record<string, unknown>> {
|
|
37
|
+
readonly callId: string;
|
|
38
|
+
readonly requestId: string;
|
|
39
|
+
readonly toolInput?: ApprovalToolInput<TInput>;
|
|
40
|
+
readonly toolName: string;
|
|
41
|
+
}
|
|
42
|
+
/** Read-only session identity and lineage available to a response authorizer. */
|
|
43
|
+
export interface ApprovalResponseSession {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly initiator: SessionAuthContext | null;
|
|
46
|
+
readonly parent?: SessionParent;
|
|
47
|
+
readonly turn: SessionTurn;
|
|
48
|
+
}
|
|
49
|
+
/** Narrow authorization capability available while validating a responder. */
|
|
50
|
+
export interface ApprovalResponseAuth {
|
|
51
|
+
getToken(provider: ToolAuthProvider, options?: ToolAuthOptions): Promise<TokenResult>;
|
|
52
|
+
requireAuth(provider: ToolAuthProvider, options?: ToolAuthOptions): never;
|
|
53
|
+
}
|
|
54
|
+
/** Submitted decision passed to an approval response policy. */
|
|
55
|
+
export interface ApprovalResponse {
|
|
56
|
+
readonly decision: "approve";
|
|
57
|
+
}
|
|
58
|
+
/** Context passed to an approval response policy. */
|
|
59
|
+
export interface ApprovalResponseContext<TInput = Record<string, unknown>> {
|
|
60
|
+
readonly auth: ApprovalResponseAuth;
|
|
61
|
+
readonly request: ApprovalRequest<TInput>;
|
|
62
|
+
readonly response: ApprovalResponse;
|
|
63
|
+
readonly responder: SessionAuthContext;
|
|
64
|
+
readonly session: ApprovalResponseSession;
|
|
65
|
+
}
|
|
66
|
+
/** Response policy decision. Rejection keeps the shared request pending. */
|
|
67
|
+
export type ApprovalResponseDecision = {
|
|
68
|
+
readonly status: "allowed";
|
|
69
|
+
} | {
|
|
70
|
+
readonly reason: string;
|
|
71
|
+
readonly status: "rejected";
|
|
72
|
+
};
|
|
73
|
+
/** Decides whether an authenticated responder may approve one request. */
|
|
74
|
+
export type ApprovalResponsePolicy<TInput = Record<string, unknown>> = (ctx: ApprovalResponseContext<TInput>) => ApprovalResponseDecision | Promise<ApprovalResponseDecision>;
|
|
75
|
+
/** Approval definition with request- and response-time policy. */
|
|
76
|
+
export interface ApprovalConfiguration<TInput = Record<string, unknown>> {
|
|
77
|
+
readonly request: ApprovalPolicy<TInput>;
|
|
78
|
+
readonly response?: ApprovalResponsePolicy<TInput>;
|
|
79
|
+
}
|
|
80
|
+
/** Shared approval definition used by authored tools and connections. */
|
|
81
|
+
export type Approval<TInput = Record<string, unknown>> = ApprovalPolicy<TInput> | ApprovalConfiguration<TInput>;
|
|
82
|
+
/** Returns the request-time policy from either approval authoring shape. */
|
|
83
|
+
export declare function resolveApprovalPolicy<TInput>(approval: Approval<TInput>): ApprovalPolicy<TInput>;
|
|
43
84
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
function resolveApprovalPolicy(e){return typeof e==`function`?e:e.request}export{resolveApprovalPolicy};
|
|
@@ -3,7 +3,6 @@ import { type ChannelCorsOptions } from "#channel/cors.js";
|
|
|
3
3
|
import type { ChannelFrom, ChannelReceiveContext, ChannelResolveSession, ChannelRespondOptions, ChannelSendOptions, ChannelSource } from "#channel/channel-operations.js";
|
|
4
4
|
import type { RouteDefinition } from "#channel/routes.js";
|
|
5
5
|
import type { Session } from "#channel/session.js";
|
|
6
|
-
import type { TurnPolicy } from "#channel/types.js";
|
|
7
6
|
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
|
|
8
7
|
import type { SessionContext } from "#public/definitions/callback-context.js";
|
|
9
8
|
import type { GenericChannelDefinition, GenericReceiveInput } from "#shared/channel-definition.js";
|
|
@@ -111,6 +110,8 @@ type ChannelSessionFailedHandler<TCtx> = (data: EventData<"session.failed">, cha
|
|
|
111
110
|
* and the channel context, with no `ctx`; its data includes `sessionId`.
|
|
112
111
|
*/
|
|
113
112
|
export interface ChannelEvents<TCtx = void> {
|
|
113
|
+
readonly "approval.candidate"?: ChannelEventHandler<"approval.candidate", TCtx>;
|
|
114
|
+
readonly "approval.settled"?: ChannelEventHandler<"approval.settled", TCtx>;
|
|
114
115
|
readonly "context.cleared"?: ChannelEventHandler<"context.cleared", TCtx>;
|
|
115
116
|
readonly "compaction.requested"?: ChannelEventHandler<"compaction.requested", TCtx>;
|
|
116
117
|
readonly "compaction.completed"?: ChannelEventHandler<"compaction.completed", TCtx>;
|
|
@@ -161,7 +162,6 @@ export interface Channel<TState = undefined, TReceiveTarget = Record<string, unk
|
|
|
161
162
|
readonly routes: readonly RouteDefinition<TState>[];
|
|
162
163
|
readonly cors?: ChannelCorsOptions;
|
|
163
164
|
readonly receive?: (input: ReceiveInput<TReceiveTarget>, ctx: ChannelReceiveContext<TState>) => Promise<Session>;
|
|
164
|
-
readonly turnPolicy?: TurnPolicy;
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Extracts the metadata projection type (`TMetadata`) from a {@link Channel}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CHANNEL_SENTINEL}from"#channel/compiled-channel.js";import{defaultDeliverResult}from"#channel/adapter.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{normalizeChannelCors}from"#channel/cors.js";import{HTTP_ADAPTER_KIND}from"#channel/http.js";import{DELETE,GET,PATCH,POST,PUT,WS}from"#channel/routes.js";const DISABLED_ROUTE_SENTINEL_KIND=`eve:disabled-channel`;function disableRoute(){return{kind:DISABLED_ROUTE_SENTINEL_KIND}}function isDisabledRouteSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_ROUTE_SENTINEL_KIND}function defineChannel(t){let n=buildAdapter(t),i=normalizeChannelCors(t.cors);return{__kind:CHANNEL_SENTINEL,routes:t.routes,adapter:n,cors:i,receive:t.receive
|
|
1
|
+
import{CHANNEL_SENTINEL}from"#channel/compiled-channel.js";import{defaultDeliverResult}from"#channel/adapter.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{normalizeChannelCors}from"#channel/cors.js";import{HTTP_ADAPTER_KIND}from"#channel/http.js";import{DELETE,GET,PATCH,POST,PUT,WS}from"#channel/routes.js";const DISABLED_ROUTE_SENTINEL_KIND=`eve:disabled-channel`;function disableRoute(){return{kind:DISABLED_ROUTE_SENTINEL_KIND}}function isDisabledRouteSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_ROUTE_SENTINEL_KIND}function defineChannel(t){let n=buildAdapter(t),i=normalizeChannelCors(t.cors);return{__kind:CHANNEL_SENTINEL,routes:t.routes,adapter:n,cors:i,receive:t.receive}}const eventTypes=Object.keys({"approval.candidate":null,"approval.settled":null,"context.cleared":null,"compaction.requested":null,"compaction.completed":null,"turn.started":null,"actions.requested":null,"action.partial":null,"action.result":null,"message.completed":null,"message.appended":null,"reasoning.appended":null,"reasoning.completed":null,"input.requested":null,"turn.failed":null,"turn.completed":null,"turn.cancelled":null,"session.failed":null,"session.completed":null,"session.waiting":null,"authorization.required":null,"authorization.completed":null});function buildAdapter(e){let r=e.state!=null,a=e.context!=null,o=e.fetchFile!==void 0,s=e.metadata,c=r||a||s!==void 0,l={},u=!1,d=e.events;for(let e of eventTypes){let t=d?.[e];t&&(u=!0,l[e]=(r,i)=>{let{session:a,...o}=i,s={...o,continuation:a?.continuation===void 0?void 0:{token:a.continuation.token,rekey:e=>a.continuation?.rekey(e)}};if(e===`session.failed`)return t(r,s);let c=buildCallbackContext();return t(r,s,c)})}return!c&&!u&&!o?{kind:e.kindHint??HTTP_ADAPTER_KIND}:{kind:e.kindHint??`defineChannel`,state:r?{...e.state}:{},fetchFile:e.fetchFile,instrumentation:s===void 0?void 0:{metadata(e){return s(e)}},createAdapterContext(t){let n=t.state,r=t.session;return{...a?e.context(n,r):{},state:n,ctx:t.ctx,session:r}},deliver(n,r){return e.deliver===void 0?defaultDeliverResult(n):e.deliver(n,r)},...l}}export{DELETE,GET,PATCH,POST,PUT,WS,defineChannel,disableRoute,isDisabledRouteSentinel};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HandleMessageStreamEvent } from "../../protocol/message.js";
|
|
2
2
|
import type { SessionContext } from "./callback-context.js";
|
|
3
3
|
import type { ExactDefinition } from "./exact.js";
|
|
4
|
-
type ProtocolEvent<TType extends
|
|
4
|
+
type ProtocolEvent<TType extends HandleMessageStreamEvent["type"]> = Extract<HandleMessageStreamEvent, {
|
|
5
5
|
type: TType;
|
|
6
6
|
}>;
|
|
7
7
|
/**
|
|
@@ -14,6 +14,8 @@ type ProtocolEvent<TType extends MessageStreamEvent["type"]> = Extract<MessageSt
|
|
|
14
14
|
export interface HookEventMap {
|
|
15
15
|
readonly "action.partial": ProtocolEvent<"action.partial">;
|
|
16
16
|
readonly "action.result": ProtocolEvent<"action.result">;
|
|
17
|
+
readonly "approval.candidate": ProtocolEvent<"approval.candidate">;
|
|
18
|
+
readonly "approval.settled": ProtocolEvent<"approval.settled">;
|
|
17
19
|
readonly "actions.requested": ProtocolEvent<"actions.requested">;
|
|
18
20
|
readonly "authorization.completed": ProtocolEvent<"authorization.completed">;
|
|
19
21
|
readonly "authorization.required": ProtocolEvent<"authorization.required">;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import type { ExactDefinition } from "#public/definitions/exact.js";
|
|
2
1
|
/**
|
|
3
|
-
* Instrumentation authoring helpers for `agent/instrumentation.ts
|
|
2
|
+
* Instrumentation authoring helpers for `agent/instrumentation.ts` and, with
|
|
3
|
+
* `experimental.instrumentationProviders` on, `agent/instrumentation/`.
|
|
4
4
|
*/
|
|
5
5
|
import type { ModelMessage, SystemModelMessage } from "ai";
|
|
6
6
|
import type { SessionAuthContext, SessionParent } from "#channel/types.js";
|
|
7
7
|
import type { InstrumentationChannel } from "#public/channels/index.js";
|
|
8
|
+
import { PROVIDER, type ProviderDefinition, type ProviderSetupContext } from "#public/instrumentation/provider.js";
|
|
8
9
|
import type { JsonObject } from "#shared/json.js";
|
|
10
|
+
export * from "#public/instrumentation/provider.js";
|
|
9
11
|
export { isChannel, type InstrumentationChannel, type InstrumentationChannelForChannel, type InstrumentationChannelForKind, type InstrumentationChannelKind, type InstrumentationChannelMetadata, } from "#public/channels/index.js";
|
|
10
12
|
/**
|
|
11
13
|
* Context passed to the {@link InstrumentationDefinition.setup} callback.
|
|
14
|
+
*
|
|
15
|
+
* The same context both layouts receive. Keeping one type is what gives
|
|
16
|
+
* {@link defineInstrumentation}'s union a contextual signature for `setup`;
|
|
17
|
+
* two divergent ones would leave every authored `setup(context)` parameter an
|
|
18
|
+
* implicit `any`.
|
|
12
19
|
*/
|
|
13
|
-
export interface InstrumentationSetupContext {
|
|
14
|
-
/**
|
|
15
|
-
* The agent name declared by `defineAgent`. Use as the `serviceName` for
|
|
16
|
-
* `registerOTel` instead of a hard-coded string.
|
|
17
|
-
*/
|
|
18
|
-
readonly agentName: string;
|
|
20
|
+
export interface InstrumentationSetupContext extends ProviderSetupContext {
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* User-authored runtime context values attached to AI SDK telemetry spans.
|
|
@@ -136,16 +138,29 @@ export interface InstrumentationDefinition {
|
|
|
136
138
|
*/
|
|
137
139
|
readonly traceChannelRequests?: boolean;
|
|
138
140
|
/**
|
|
139
|
-
* Setup callback invoked at server startup
|
|
140
|
-
*
|
|
141
|
-
*
|
|
141
|
+
* Setup callback invoked at server startup, before the first request. Use it
|
|
142
|
+
* to call `registerOTel` or other OTel provider setup; `context.agentName`
|
|
143
|
+
* comes from `defineAgent`. A returned promise is awaited.
|
|
142
144
|
*/
|
|
143
|
-
readonly setup?: (context: InstrumentationSetupContext) => void
|
|
145
|
+
readonly setup?: (context: InstrumentationSetupContext) => void | PromiseLike<void>;
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
148
|
+
* Declares instrumentation, in either of eve's two layouts.
|
|
149
|
+
*
|
|
150
|
+
* Export the result as the default export of `agent/instrumentation.ts`, or —
|
|
151
|
+
* with `experimental.instrumentationProviders` on — of one file under
|
|
152
|
+
* `agent/instrumentation/`. The layout decides how eve reads the value; the two
|
|
153
|
+
* are mutually exclusive builds, so only one can apply. `setup` runs at server
|
|
154
|
+
* startup, not during this call.
|
|
155
|
+
*
|
|
156
|
+
* The parameter is a union because a provider and a legacy config overlap on
|
|
157
|
+
* `events` and `setup`, so no value-level check separates them. One consequence
|
|
158
|
+
* is that excess-property checking is weaker here than it was against the
|
|
159
|
+
* config shape alone, and a misspelled key can reach `eve build` rather than
|
|
160
|
+
* failing at `tsc`.
|
|
150
161
|
*/
|
|
151
|
-
export declare function defineInstrumentation<
|
|
162
|
+
export declare function defineInstrumentation<const TDefinition extends InstrumentationDefinition | ProviderDefinition>(definition: TDefinition): InstrumentationDeclaration<TDefinition>;
|
|
163
|
+
/** The branded result of {@link defineInstrumentation}. */
|
|
164
|
+
export type InstrumentationDeclaration<TDefinition extends InstrumentationDefinition | ProviderDefinition = InstrumentationDefinition | ProviderDefinition> = TDefinition & {
|
|
165
|
+
readonly [PROVIDER]: true;
|
|
166
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isChannel}from"#public/channels/index.js";function defineInstrumentation(e){return
|
|
1
|
+
import{PROVIDER}from"#public/instrumentation/provider.js";import{isChannel}from"#public/channels/index.js";export*from"#public/instrumentation/provider.js";function defineInstrumentation(e){return{...e,[PROVIDER]:!0}}export{defineInstrumentation,isChannel};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OpenTelemetry authoring surface for `agent/instrumentation/`.
|
|
3
|
+
*
|
|
4
|
+
* Two halves, because OpenTelemetry has two: `otel()` is the settings a process
|
|
5
|
+
* can only hold one of, and an integration is a destination, of which there may
|
|
6
|
+
* be as many as there are files.
|
|
7
|
+
*
|
|
8
|
+
* Reachable only with `experimental.instrumentationProviders` on. With the flag
|
|
9
|
+
* off nothing discovers that directory, so these compile but never run.
|
|
10
|
+
*/
|
|
11
|
+
import { type ContentOptions, type OtelIntegration } from "#tracing/otel-declaration.js";
|
|
12
|
+
export { isOtelDeclaration, isOtelIntegration, otel, otelIntegration, type ContentOptions, type OtelDeclaration, type OtelIntegration, type OtelIntegrationOptions, type OtelOptions, } from "#tracing/otel-declaration.js";
|
|
13
|
+
export type { SpanExporter, SpanProcessor } from "#compiled/@vercel/otel/index.js";
|
|
14
|
+
/**
|
|
15
|
+
* Vercel Agent Runs, enabled by default in production.
|
|
16
|
+
*
|
|
17
|
+
* Export it from `agent/instrumentation/agent-runs.ts` to narrow content, or
|
|
18
|
+
* export `disableInstrumentation()` from that file to turn it off.
|
|
19
|
+
*/
|
|
20
|
+
export declare function agentRuns(options?: ContentOptions): OtelIntegration;
|
|
21
|
+
/**
|
|
22
|
+
* The local trace spool `eve dev` reads, as a destination.
|
|
23
|
+
*
|
|
24
|
+
* Export it from `agent/instrumentation/local.ts` to keep it alongside a hosted
|
|
25
|
+
* backend, or export `disableInstrumentation()` from that file to turn it off.
|
|
26
|
+
* Omitting the file leaves eve's default in place.
|
|
27
|
+
*
|
|
28
|
+
* `EVE_TRACES_CONTENT=off` narrows this destination and no other, so declining
|
|
29
|
+
* content locally leaves what a hosted backend receives alone.
|
|
30
|
+
*/
|
|
31
|
+
export declare function localTraces(options?: ContentOptions): OtelIntegration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{agentRunsIntegration,isOtelDeclaration,isOtelIntegration,otel,otelIntegration,otelIntegration as otelIntegration$1}from"#tracing/otel-declaration.js";import{createLocalTracesProcessor,resolveLocalTracesContent}from"#tracing/local-traces.js";function agentRuns(t={}){return agentRunsIntegration(t)}function localTraces(e={}){return otelIntegration$1({...resolveLocalTracesContent(e),spanProcessors:[createLocalTracesProcessor()]})}export{agentRuns,isOtelDeclaration,isOtelIntegration,localTraces,otel,otelIntegration};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The provider contract authored under `agent/instrumentation/`.
|
|
3
|
+
*
|
|
4
|
+
* Reachable only with `experimental.instrumentationProviders` on. With the flag
|
|
5
|
+
* off nothing discovers that directory, so these types compile but never run.
|
|
6
|
+
*/
|
|
7
|
+
import type { InstrumentationCapture, InstrumentationEvent } from "#harness/instrumentation-lifecycle.js";
|
|
8
|
+
import type { JsonValue } from "#public/types/json.js";
|
|
9
|
+
export type { JsonValue } from "#public/types/json.js";
|
|
10
|
+
export type { InstrumentationActionCompletedEvent, InstrumentationActionFailedEvent, InstrumentationActionKind, InstrumentationActionOutcome, InstrumentationActionOutput, InstrumentationActionStartedEvent, InstrumentationAttemptScope, InstrumentationCapture, InstrumentationChannelDeliveryInput, InstrumentationChannelDeliveryOutcome, InstrumentationChannelDeliveryRef, InstrumentationChannelDeliveryStartedEvent, InstrumentationChannelDeliveryTerminalEvent, InstrumentationContentPart, InstrumentationEvent, InstrumentationInputKind, InstrumentationInputOption, InstrumentationInputOutcome, InstrumentationInputRequest, InstrumentationInputRequestedEvent, InstrumentationInputResolvedEvent, InstrumentationInputResponse, InstrumentationModelCallCompletedEvent, InstrumentationModelCallFailedEvent, InstrumentationModelCallStartedEvent, InstrumentationModelRef, InstrumentationOperationRef, InstrumentationParentLineage, InstrumentationSessionFailedEvent, InstrumentationSessionSettledEvent, InstrumentationSessionStartedEvent, InstrumentationSessionTransitionEvent, InstrumentationStepAttemptMetadataEvent, InstrumentationStepAttemptCompletedEvent, InstrumentationStepAttemptFailedEvent, InstrumentationStepAttemptStartedEvent, InstrumentationStepAttemptTerminalEvent, InstrumentationToolCallCompletedEvent, InstrumentationToolCallFailedEvent, InstrumentationToolCallStartedEvent, InstrumentationToolOutput, InstrumentationTraceContext, InstrumentationTurnFailedEvent, InstrumentationTurnSettledEvent, InstrumentationTurnStartedEvent, InstrumentationTurnTerminalEvent, InstrumentationUsage, } from "#harness/instrumentation-lifecycle.js";
|
|
11
|
+
/**
|
|
12
|
+
* Marks a value as having come from `defineInstrumentation` or a built-in
|
|
13
|
+
* factory.
|
|
14
|
+
*
|
|
15
|
+
* It does not say which layout the value belongs to: a provider and a legacy
|
|
16
|
+
* config both carry `events` and `setup`, so no value-level check separates
|
|
17
|
+
* them. The layout decides — `agent/instrumentation.ts` is read as a config and
|
|
18
|
+
* `agent/instrumentation/*.ts` as providers, and the two are mutually exclusive
|
|
19
|
+
* builds. The brand's job is only to catch a default export that never went
|
|
20
|
+
* through eve at all.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROVIDER: unique symbol;
|
|
23
|
+
/** Marks a slot the author turned off rather than configured. */
|
|
24
|
+
export declare const DISABLED: unique symbol;
|
|
25
|
+
/** Where the agent is running when `setup` fires. */
|
|
26
|
+
export type InstrumentationEnvironment = "development" | "preview" | "production";
|
|
27
|
+
/** The local eval run this server was started to serve. */
|
|
28
|
+
export interface EvaluationRef {
|
|
29
|
+
readonly runId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Passed to {@link InstrumentationProvider.setup} once at server startup,
|
|
33
|
+
* before any event is published.
|
|
34
|
+
*/
|
|
35
|
+
export interface ProviderSetupContext {
|
|
36
|
+
/** The agent name declared by `defineAgent`. */
|
|
37
|
+
readonly agentName: string;
|
|
38
|
+
/** Always supplied at runtime; optional for legacy setup-context compatibility. */
|
|
39
|
+
readonly environment?: InstrumentationEnvironment;
|
|
40
|
+
/** Present only when this server was started for a local `eve eval` run. */
|
|
41
|
+
readonly evaluation?: EvaluationRef;
|
|
42
|
+
/** The eve version running the agent. */
|
|
43
|
+
/** Always supplied at runtime; optional for legacy setup-context compatibility. */
|
|
44
|
+
readonly frameworkVersion?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ProviderState {
|
|
47
|
+
get(): JsonValue | undefined;
|
|
48
|
+
/** Stages a JSON value; `undefined` releases this operation's slot. */
|
|
49
|
+
set(value: JsonValue | undefined): void;
|
|
50
|
+
}
|
|
51
|
+
export interface ProviderContext {
|
|
52
|
+
readonly state: ProviderState;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One event handler.
|
|
56
|
+
*
|
|
57
|
+
* A handler can carry durable JSON state from a start to its terminal through
|
|
58
|
+
* `ctx.state`. eve scopes and releases that state by provider and operation.
|
|
59
|
+
*/
|
|
60
|
+
export type Handler<TEvent> = (event: TEvent, ctx: ProviderContext) => void | PromiseLike<void>;
|
|
61
|
+
type EventForType<TEvent, TType> = TEvent extends {
|
|
62
|
+
readonly type: infer TEventType;
|
|
63
|
+
} ? TType extends TEventType ? TEvent & {
|
|
64
|
+
readonly type: TType;
|
|
65
|
+
} : never : never;
|
|
66
|
+
/**
|
|
67
|
+
* The events a provider may handle, one optional handler per event type.
|
|
68
|
+
*
|
|
69
|
+
* Derived from the event union rather than written out, so a new event reaches
|
|
70
|
+
* providers the moment the bus can publish it.
|
|
71
|
+
*/
|
|
72
|
+
export type ProviderEvents = {
|
|
73
|
+
readonly [TType in InstrumentationEvent["type"]]?: Handler<EventForType<InstrumentationEvent, TType>>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* What an author writes for one file under `agent/instrumentation/`.
|
|
77
|
+
*
|
|
78
|
+
* Setup runs in slot order, but event handlers across authored providers run
|
|
79
|
+
* concurrently and are failure-isolated. Do not coordinate providers through
|
|
80
|
+
* completion order.
|
|
81
|
+
*/
|
|
82
|
+
export interface ProviderDefinition {
|
|
83
|
+
/**
|
|
84
|
+
* How much of each event this provider is handed. Defaults to `"metadata"`:
|
|
85
|
+
* structure, identity, usage, and timing, but not what was said.
|
|
86
|
+
*
|
|
87
|
+
* `"content"` adds the prompt, the response, tool arguments, and tool
|
|
88
|
+
* results. Asking is what makes eve build the projection at all, so a
|
|
89
|
+
* directory in which nobody asks never serializes a prompt.
|
|
90
|
+
*/
|
|
91
|
+
readonly capture?: InstrumentationCapture;
|
|
92
|
+
readonly events?: ProviderEvents;
|
|
93
|
+
/** Runs once at server startup, before any event is published. */
|
|
94
|
+
readonly setup?: (context: ProviderSetupContext) => void | PromiseLike<void>;
|
|
95
|
+
/** Drains anything buffered. eve calls this before a session goes idle. */
|
|
96
|
+
readonly flush?: () => void | PromiseLike<void>;
|
|
97
|
+
/** Releases resources when the process is going away. */
|
|
98
|
+
readonly shutdown?: () => void | PromiseLike<void>;
|
|
99
|
+
}
|
|
100
|
+
/** A {@link ProviderDefinition} that has been through `defineInstrumentation`. */
|
|
101
|
+
export type InstrumentationProvider = ProviderDefinition & {
|
|
102
|
+
readonly [PROVIDER]: true;
|
|
103
|
+
};
|
|
104
|
+
/** A slot the author turned off. eve registers nothing for it. */
|
|
105
|
+
export interface InstrumentationDisabled {
|
|
106
|
+
readonly [DISABLED]: true;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Turns off the slot the file it is exported from names.
|
|
110
|
+
*
|
|
111
|
+
* Export it as the default of `agent/instrumentation/local.ts` to stop eve
|
|
112
|
+
* spooling local traces, for instance. Omitting the file entirely leaves eve's
|
|
113
|
+
* default in place, which is why turning one off takes a value.
|
|
114
|
+
*/
|
|
115
|
+
export declare function disableInstrumentation(): InstrumentationDisabled;
|
|
116
|
+
export declare function isInstrumentationProvider(value: unknown): value is InstrumentationProvider;
|
|
117
|
+
export declare function isInstrumentationDisabled(value: unknown): value is InstrumentationDisabled;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const PROVIDER=Symbol.for(`eve.instrumentation.provider`),DISABLED=Symbol.for(`eve.instrumentation.disabled`);function disableInstrumentation(){return{[DISABLED]:!0}}function isInstrumentationProvider(t){return typeof t==`object`&&!!t&&t[PROVIDER]===!0}function isInstrumentationDisabled(e){return typeof e==`object`&&!!e&&e[DISABLED]===!0}export{DISABLED,PROVIDER,disableInstrumentation,isInstrumentationDisabled,isInstrumentationProvider};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApprovalPolicy } from "#public/definitions/approval.js";
|
|
2
2
|
/**
|
|
3
3
|
* Returns an `approval` callback that always requires user approval before
|
|
4
4
|
* the tool executes.
|
|
5
5
|
*/
|
|
6
|
-
export declare function always<TInput = unknown>():
|
|
6
|
+
export declare function always<TInput = unknown>(): ApprovalPolicy<TInput>;
|
|
7
7
|
/**
|
|
8
8
|
* Returns an `approval` callback that never requires user approval before
|
|
9
9
|
* the tool executes.
|
|
10
10
|
*/
|
|
11
|
-
export declare function never<TInput = unknown>():
|
|
11
|
+
export declare function never<TInput = unknown>(): ApprovalPolicy<TInput>;
|
|
12
12
|
/**
|
|
13
13
|
* Returns an `approval` callback that requires approval until the user
|
|
14
14
|
* approves this tool once in the current session. A tool is recorded as
|
|
@@ -16,4 +16,4 @@ export declare function never<TInput = unknown>(): Approval<TInput>;
|
|
|
16
16
|
* responding) leaves it unrecorded, so the next call prompts again. Keys off
|
|
17
17
|
* the bare tool name, so it ignores compound approval keys.
|
|
18
18
|
*/
|
|
19
|
-
export declare function once<TInput = unknown>():
|
|
19
|
+
export declare function once<TInput = unknown>(): ApprovalPolicy<TInput>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { type DisabledToolSentinel, type ExperimentalWorkflowToolDefinition, type ExperimentalWorkflowToolInput, defineDynamic, defineTool, disableTool, experimental_workflow, isDisabledToolSentinel, isExperimentalWorkflowToolDefinition, type ToolAuthOptions, type ToolAuthProvider, type ToolDefinition, type ToolContext, type ToolModelOutput, type ToolModelOutputPart, } from "#public/definitions/tool.js";
|
|
5
5
|
export { toolOutput, toolOutputPart } from "#public/tools/output-builders.js";
|
|
6
|
-
export type { Approval, ApprovalContext, ApprovalStatus } from "#public/definitions/approval.js";
|
|
6
|
+
export type { Approval, ApprovalConfiguration, ApprovalContext, ApprovalPolicy, ApprovalRequest, ApprovalResponse, ApprovalResponseAuth, ApprovalResponseContext, ApprovalResponseDecision, ApprovalResponsePolicy, ApprovalResponseSession, ApprovalStatus, } from "#public/definitions/approval.js";
|
|
7
7
|
export type { DynamicToolEntry, DynamicEvents, DynamicToolEvents, DynamicResolveContext, DynamicSentinel, DynamicToolSet, DynamicToolResult, } from "#shared/dynamic-tool-definition.js";
|
|
8
8
|
export { type SessionContext } from "#public/definitions/callback-context.js";
|
|
9
9
|
export { toolResultFrom, type MatchedConnectionResult, type MatchedToolResult, type ToolResultFromFn, } from "#public/tool-result-narrowing.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RuntimeActionResult } from "#runtime/actions/types.js";
|
|
2
2
|
/** Returns results in pending-key order once every requested action has completed. */
|
|
3
|
-
export declare function resolveRuntimeActionResultsForKeys(input: {
|
|
3
|
+
export declare function resolveRuntimeActionResultsForKeys<TResult extends RuntimeActionResult>(input: {
|
|
4
4
|
readonly pendingKeys: readonly string[];
|
|
5
|
-
readonly results: readonly
|
|
6
|
-
}):
|
|
5
|
+
readonly results: readonly TResult[];
|
|
6
|
+
}): TResult[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_ATTRIBUTE_VALUE_MAX_BYTES,normalizeEveAttributes,truncateForTag}from"#runtime/attributes/normalize.js";import"#internal/workflow/builtins.js";let WARNED_ABOUT_TAG_FAILURE=!1;async function setEveAttributes(e){let t=normalizeEveAttributes(e);if(Object.keys(t).length!==0)try{let{setAttributes:e}=await import(`#compiled/@workflow/core/index.js`);await e(t,{allowReservedAttributes:!0})}catch(e){WARNED_ABOUT_TAG_FAILURE||(WARNED_ABOUT_TAG_FAILURE=!0,console.warn(`[eve] setEveAttributes failed; suppressing further warnings this process.`,{keys:Object.keys(t),error:e.message}))}}export{EVE_ATTRIBUTE_VALUE_MAX_BYTES,setEveAttributes,truncateForTag};
|
|
1
|
+
import{EVE_ATTRIBUTE_VALUE_MAX_BYTES,normalizeEveAttributes,truncateForTag}from"#runtime/attributes/normalize.js";import"#internal/workflow/builtins.js";let WARNED_ABOUT_TAG_FAILURE=!1;async function setEveAttributes(e){let t=normalizeEveAttributes(e);if(Object.keys(t).length!==0)try{let{setAttributes:e}=await import(`#compiled/@workflow/core/index.js`);await e(t,{allowReservedAttributes:!0})}catch(e){if(isTerminalRunAttributeError(e))return;WARNED_ABOUT_TAG_FAILURE||(WARNED_ABOUT_TAG_FAILURE=!0,console.warn(`[eve] setEveAttributes failed; suppressing further warnings this process.`,{keys:Object.keys(t),error:e.message}))}}function isTerminalRunAttributeError(e){return e instanceof Error&&e.message.startsWith(`Cannot set attributes on run in terminal state`)}export{EVE_ATTRIBUTE_VALUE_MAX_BYTES,setEveAttributes,truncateForTag};
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* by principal routes through {@link principalKey}.
|
|
11
11
|
*/
|
|
12
12
|
import { type AlsContext } from "#context/container.js";
|
|
13
|
+
import { type SessionAuthContext } from "#context/keys.js";
|
|
13
14
|
import type { AuthorizationDefinition, ConnectionPrincipal } from "#runtime/connections/types.js";
|
|
14
15
|
/**
|
|
15
16
|
* Stable string key identifying one principal within a connection's
|
|
@@ -66,3 +67,5 @@ export declare function principalKey(principal: ConnectionPrincipal): string;
|
|
|
66
67
|
* the definition shape beyond reading `principalType`.
|
|
67
68
|
*/
|
|
68
69
|
export declare function resolveConnectionPrincipal(connectionName: string, authorization: AuthorizationDefinition, ctx?: AlsContext | undefined): ConnectionPrincipal;
|
|
70
|
+
/** Resolves a connection principal from an explicitly bound session identity. */
|
|
71
|
+
export declare function resolveConnectionPrincipalFromAuth(connectionName: string, authorization: AuthorizationDefinition, current: SessionAuthContext | null | undefined, ctx?: AlsContext): ConnectionPrincipal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AuthKey}from"#context/keys.js";import{contextStorage}from"#context/container.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";function principalKey(e){return e.type===`app`?`app`:e.issuer===void 0?`user:${e.id}`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(r,i
|
|
1
|
+
import{AuthKey}from"#context/keys.js";import{contextStorage}from"#context/container.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";function principalKey(e){return e.type===`app`?`app`:e.issuer===void 0?`user:${e.id}`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(n,r,i=contextStorage.getStore()){return resolveConnectionPrincipalFromAuth(n,r,i?.get(AuthKey),i)}function resolveConnectionPrincipalFromAuth(e,t,r,i){if(t.principalType===`app`)return{type:`app`};if(r==null||r.principalType!==`user`)throw new ConnectionAuthorizationFailedError(e,{message:buildUserPrincipalRequiredMessage(e,t,i,r),reason:`principal_required`,retryable:!1});return t.vercelConnect!==void 0&&isVercelDevelopmentUser(r)?{attributes:r.attributes,id:r.subject??r.principalId,type:`user`}:{attributes:r.attributes,id:r.principalId,issuer:r.issuer??r.authenticator,type:`user`}}function isVercelDevelopmentUser(e){return e.authenticator===`oidc`&&e.issuer?.startsWith(`https://oidc.vercel.com/`)===!0&&e.attributes.environment===`development`&&e.subject===e.attributes.user_id}function buildUserPrincipalRequiredMessage(e,t,n,r){let i;return i=n===void 0?`it was invoked outside an eve context, so no authenticated user can be resolved.`:r==null?`the active session has no authenticated user.`:t.vercelConnect!==void 0&&r.authenticator===`local-dev`?`the local request fell back to local development access instead of authenticating a Vercel user. Ensure this directory is linked and the Vercel CLI can mint a Vercel OIDC token, then retry.`:`the active session is scoped to "${r.principalType}", not an authenticated user.`,`Connection "${e}" is user-scoped, but ${i} User-scoped connections require route auth that resolves an authenticated user. If this connection should use credentials shared by the agent instead, configure it as an app-scoped connection.`}export{principalKey,resolveConnectionPrincipal,resolveConnectionPrincipalFromAuth};
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { ConnectionAuthorizationChallenge } from "#public/connections/errors.js";
|
|
13
13
|
import { type AuthorizationSignal } from "#harness/authorization.js";
|
|
14
|
+
import type { SessionAuthContext } from "#context/keys.js";
|
|
14
15
|
import { type AuthorizationDefinition, type ConnectionAuthorizationContext, type TokenResult } from "#runtime/connections/types.js";
|
|
15
16
|
/**
|
|
16
17
|
* Everything the scoped authorization helpers need to drive one
|
|
@@ -19,6 +20,7 @@ import { type AuthorizationDefinition, type ConnectionAuthorizationContext, type
|
|
|
19
20
|
* {@link ConnectionAuthorizationContext} handed to every callback.
|
|
20
21
|
*/
|
|
21
22
|
export interface ScopedAuthorization {
|
|
23
|
+
readonly boundResponder?: SessionAuthContext;
|
|
22
24
|
readonly scope: string;
|
|
23
25
|
readonly authorization: Readonly<AuthorizationDefinition>;
|
|
24
26
|
readonly connection: ConnectionAuthorizationContext;
|
|
@@ -78,11 +80,7 @@ export declare function completeScopedAuthorization(input: ScopedAuthorization):
|
|
|
78
80
|
* callers can fall through to rethrowing the original `Required` error.
|
|
79
81
|
*/
|
|
80
82
|
export declare function startScopedAuthorization(input: ScopedAuthorization): Promise<AuthorizationSignal | undefined>;
|
|
81
|
-
/**
|
|
82
|
-
* Vercel Connect accepts local HTTP callback URLs only when their hostname is
|
|
83
|
-
* literally `localhost`. Other authorization providers keep the framework's
|
|
84
|
-
* original callback URL so their registered redirect URI remains unchanged.
|
|
85
|
-
*/
|
|
83
|
+
/** Normalizes callback URLs for providers with localhost requirements. */
|
|
86
84
|
export declare function resolveAuthorizationCallbackUrl(input: {
|
|
87
85
|
readonly authorization: Readonly<AuthorizationDefinition>;
|
|
88
86
|
readonly callbackUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{contextStorage,loadContext}from"#context/container.js";import{consumeAuthorizationResult,createAuthorizationAttempt,requestAuthorization}from"#harness/authorization.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";import{evictCachedToken,readCachedToken,writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal}from"#runtime/connections/principal.js";const LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES=new Set([`127.0.0.1`,`[::1]`]);async function resolveScopedToken(t){let{scope:n,authorization:r,connection:i}=t,a=contextStorage.getStore(),o=
|
|
1
|
+
import{contextStorage,loadContext}from"#context/container.js";import{consumeAuthorizationResult,createAuthorizationAttempt,requestAuthorization}from"#harness/authorization.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";import{evictCachedToken,readCachedToken,writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal,resolveConnectionPrincipalFromAuth}from"#runtime/connections/principal.js";const LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES=new Set([`127.0.0.1`,`[::1]`]);async function resolveScopedToken(t){let{scope:n,authorization:r,connection:i}=t,a=contextStorage.getStore(),o=resolveScopedPrincipal(t,a);if(a===void 0)return await r.getToken({connection:i,principal:o});let u=principalKey(o),d=readCachedToken(a,n,u);if(d!==void 0)return d;let f=await r.getToken({connection:i,principal:o});return writeCachedToken(a,n,u,f),f}async function evictScopedToken(t){let{scope:n,authorization:r,connection:i}=t,a=contextStorage.getStore();if(a===void 0)return;let s;try{s=resolveScopedPrincipal(t,a),evictCachedToken(a,n,principalKey(s))}catch{return}try{await r.evict?.({connection:i,principal:s})}catch{}}async function completeScopedAuthorization(e){let{scope:r,authorization:i,connection:o}=e;if(!supportsInteractiveAuthorization(i))return!1;let s=consumeAuthorizationResult(r);if(s===void 0)return!1;let u=i,d=loadContext(),f=s.principal??resolveScopedPrincipal(e,d),p=await u.completeAuthorization({callbackUrl:s.hookUrl,connection:o,principal:f,resume:s.resume,callback:s.callback});return writeCachedToken(d,r,principalKey(f),p),!0}async function startScopedAuthorization(e){let{scope:t,authorization:n,connection:o}=e;if(!supportsInteractiveAuthorization(n))return;let s=createAuthorizationAttempt(t);if(s===void 0)return;let c=n,l=resolveScopedPrincipal(e),u=resolveAuthorizationCallbackUrl({authorization:n,callbackUrl:s.hookUrl}),{challenge:d,resume:f}=await c.startAuthorization({callbackUrl:u,connection:o,principal:l});return requestAuthorization([{attemptId:s.attemptId,challenge:stampChallengeDisplayName(d,n),hookUrl:u,name:t,principal:l,resume:f}])}function resolveScopedPrincipal(e,t){return e.boundResponder===void 0?resolveConnectionPrincipal(e.scope,e.authorization,t):resolveConnectionPrincipalFromAuth(e.scope,e.authorization,e.boundResponder,t)}function resolveAuthorizationCallbackUrl(e){if(e.authorization.vercelConnect===void 0)return e.callbackUrl;let t;try{t=new URL(e.callbackUrl)}catch{return e.callbackUrl}return t.protocol!==`http:`||!LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES.has(t.hostname)?e.callbackUrl:(t.hostname=`localhost`,t.toString())}function stampChallengeDisplayName(e,t){let n=t.displayName??e.displayName;return n===e.displayName?e:{...e,displayName:n}}export{completeScopedAuthorization,evictScopedToken,resolveAuthorizationCallbackUrl,resolveScopedToken,stampChallengeDisplayName,startScopedAuthorization};
|
|
@@ -20,10 +20,15 @@ import type { ResolvedConnectionDefinition } from "#runtime/types.js";
|
|
|
20
20
|
* `expiresAt` is an optional absolute expiration in **milliseconds since
|
|
21
21
|
* the Unix epoch** ({@link Date.now}). Advisory: the runtime may refresh a
|
|
22
22
|
* cached token before the next call based on it, but is not required to.
|
|
23
|
+
*
|
|
24
|
+
* `providerSubject` is the stable subject of the provider account represented
|
|
25
|
+
* by this credential. It is scoped to the provider and must not be compared
|
|
26
|
+
* across providers without provider context.
|
|
23
27
|
*/
|
|
24
28
|
export interface TokenResult {
|
|
25
29
|
readonly token: string;
|
|
26
30
|
readonly expiresAt?: number;
|
|
31
|
+
readonly providerSubject?: string;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* Wire protocol a connection speaks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ResolveAgentError,createResolvedModuleSourceRef}from"#runtime/resolve-helpers.js";import{resolveDynamicToolDefinition}from"#runtime/resolve-dynamic-tool.js";import{resolveChannelDefinition}from"#runtime/resolve-channel.js";import{resolveConnectionDefinition}from"#runtime/resolve-connection.js";import{resolveHookDefinition}from"#runtime/resolve-hook.js";import{resolveSandboxDefinition}from"#runtime/resolve-sandbox.js";import{resolveDynamicInstructionsDefinition}from"#runtime/resolve-dynamic-instructions.js";import{resolveDynamicSkillDefinition}from"#runtime/resolve-dynamic-skill.js";import{resolveToolDefinition}from"#runtime/resolve-tool.js";async function resolveAgent(e){let t=e.manifest.skills.map(e=>({...e,metadata:e.metadata===void 0?void 0:{...e.metadata}})),i=[],a=[];for(let t of e.manifest.channels){if(t.kind===`disabled`){a.push(t.name);continue}i.push(await resolveChannelDefinition(t,e.moduleMap,e.nodeId))}let o=await Promise.all(e.manifest.tools.map(t=>resolveToolDefinition(t,e.moduleMap,e.nodeId))),s=await Promise.all((e.manifest.dynamicInstructions??[]).map(t=>resolveDynamicInstructionsDefinition(t,e.moduleMap,e.nodeId))),c=await Promise.all((e.manifest.dynamicSkills??[]).map(t=>resolveDynamicSkillDefinition(t,e.moduleMap,e.nodeId))),l=await Promise.all(e.manifest.dynamicTools.map(t=>resolveDynamicToolDefinition(t,e.moduleMap,e.nodeId))),u=await Promise.all(e.manifest.hooks.map(t=>resolveHookDefinition(t,e.moduleMap,e.nodeId))),d=await Promise.all(e.manifest.connections.map(t=>resolveConnectionDefinition(t,e.moduleMap,e.nodeId))),f=e.manifest.sandbox===null?null:await resolveSandboxDefinition(e.manifest.sandbox,e.moduleMap,e.nodeId),p=createResolvedInstructionsDefinition(e.manifest.instructions),m=e.manifest.workspaceResourceRoot,h={channels:i,connections:d,disabledFrameworkChannels:a,disabledFrameworkTools:[...e.manifest.disabledFrameworkTools],workflowTool:e.manifest.workflowTool===void 0?void 0:{maxSubagents:e.manifest.workflowTool.maxSubagents},webSearchProvider:e.manifest.webSearchProvider,dynamicInstructionsResolvers:s,dynamicSkillResolvers:c,dynamicToolResolvers:l,hooks:u,metadata:{agentRoot:e.manifest.agentRoot,appRoot:e.manifest.appRoot,diagnosticsSummary:e.manifest.diagnosticsSummary},sandbox:f,workspaceResourceRoot:m,skills:t,tools:o,workspaceSpec:{rootEntries:[...m.rootEntries]}},g=p===void 0?h:{...h,instructions:p};return`config`in e.manifest?{...g,config:createResolvedAgentConfig(e.manifest)}:g}function createResolvedInstructionsDefinition(e){if(e!==void 0)return{name:e.name,logicalPath:e.logicalPath,markdown:e.markdown,sourceId:e.sourceId,sourceKind:e.sourceKind}}function createResolvedAgentConfig(e){let n={name:e.config.name};if(e.config.compaction!==void 0){let t={};e.config.compaction.model!==void 0&&(t.model=e.config.compaction.model.source===void 0?{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions}:{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions,source:{exportName:e.config.compaction.model.source.exportName,sourceKind:`module`,logicalPath:e.config.compaction.model.source.logicalPath,sourceId:e.config.compaction.model.source.sourceId}}),e.config.compaction.thresholdPercent!==void 0&&(t.thresholdPercent=e.config.compaction.thresholdPercent),n.compaction=t}if(e.config.experimental!==void 0&&(n.experimental={subagentPersistentSessions:e.config.experimental.subagentPersistentSessions,workflow:e.config.experimental.workflow===void 0?void 0:{world:e.config.experimental.workflow.world}}),e.config.outputSchema!==void 0&&(n.outputSchema=e.config.outputSchema),e.config.reasoning!==void 0&&(n.reasoning=e.config.reasoning),e.config.source!==void 0&&(n.source=createResolvedModuleSourceRef(e.config.source)),e.config.limits!==void 0&&(n.limits={maxInputTokensPerSession:e.config.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.config.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.config.limits.sessionTimeoutMs}),e.config.dynamicModel!==void 0)return{...n,dynamicModel:{...createResolvedModuleSourceRef(e.config.dynamicModel),eventNames:[...e.config.dynamicModel.eventNames]}};let r=e.config.model;return{...n,model:r.source===void 0?{id:r.id,contextWindowTokens:r.contextWindowTokens,maxOutputTokens:r.maxOutputTokens,providerOptions:r.providerOptions}:{contextWindowTokens:r.contextWindowTokens,id:r.id,maxOutputTokens:r.maxOutputTokens,providerOptions:r.providerOptions,source:{exportName:r.source.exportName,sourceKind:`module`,logicalPath:r.source.logicalPath,sourceId:r.source.sourceId}}}}export{ResolveAgentError,resolveAgent};
|
|
1
|
+
import{ResolveAgentError,createResolvedModuleSourceRef}from"#runtime/resolve-helpers.js";import{resolveDynamicToolDefinition}from"#runtime/resolve-dynamic-tool.js";import{resolveChannelDefinition}from"#runtime/resolve-channel.js";import{resolveConnectionDefinition}from"#runtime/resolve-connection.js";import{resolveHookDefinition}from"#runtime/resolve-hook.js";import{resolveSandboxDefinition}from"#runtime/resolve-sandbox.js";import{resolveDynamicInstructionsDefinition}from"#runtime/resolve-dynamic-instructions.js";import{resolveDynamicSkillDefinition}from"#runtime/resolve-dynamic-skill.js";import{resolveToolDefinition}from"#runtime/resolve-tool.js";async function resolveAgent(e){let t=e.manifest.skills.map(e=>({...e,metadata:e.metadata===void 0?void 0:{...e.metadata}})),i=[],a=[];for(let t of e.manifest.channels){if(t.kind===`disabled`){a.push(t.name);continue}i.push(await resolveChannelDefinition(t,e.moduleMap,e.nodeId))}let o=await Promise.all(e.manifest.tools.map(t=>resolveToolDefinition(t,e.moduleMap,e.nodeId))),s=await Promise.all((e.manifest.dynamicInstructions??[]).map(t=>resolveDynamicInstructionsDefinition(t,e.moduleMap,e.nodeId))),c=await Promise.all((e.manifest.dynamicSkills??[]).map(t=>resolveDynamicSkillDefinition(t,e.moduleMap,e.nodeId))),l=await Promise.all(e.manifest.dynamicTools.map(t=>resolveDynamicToolDefinition(t,e.moduleMap,e.nodeId))),u=await Promise.all(e.manifest.hooks.map(t=>resolveHookDefinition(t,e.moduleMap,e.nodeId))),d=await Promise.all(e.manifest.connections.map(t=>resolveConnectionDefinition(t,e.moduleMap,e.nodeId))),f=e.manifest.sandbox===null?null:await resolveSandboxDefinition(e.manifest.sandbox,e.moduleMap,e.nodeId),p=createResolvedInstructionsDefinition(e.manifest.instructions),m=e.manifest.workspaceResourceRoot,h={channels:i,connections:d,disabledFrameworkChannels:a,disabledFrameworkTools:[...e.manifest.disabledFrameworkTools],workflowTool:e.manifest.workflowTool===void 0?void 0:{maxSubagents:e.manifest.workflowTool.maxSubagents},webSearchProvider:e.manifest.webSearchProvider,dynamicInstructionsResolvers:s,dynamicSkillResolvers:c,dynamicToolResolvers:l,hooks:u,metadata:{agentRoot:e.manifest.agentRoot,appRoot:e.manifest.appRoot,diagnosticsSummary:e.manifest.diagnosticsSummary},sandbox:f,workspaceResourceRoot:m,skills:t,tools:o,workspaceSpec:{rootEntries:[...m.rootEntries]}},g=p===void 0?h:{...h,instructions:p};return`config`in e.manifest?{...g,config:createResolvedAgentConfig(e.manifest)}:g}function createResolvedInstructionsDefinition(e){if(e!==void 0)return{name:e.name,logicalPath:e.logicalPath,markdown:e.markdown,sourceId:e.sourceId,sourceKind:e.sourceKind}}function createResolvedAgentConfig(e){let n={name:e.config.name};if(e.config.compaction!==void 0){let t={};e.config.compaction.model!==void 0&&(t.model=e.config.compaction.model.source===void 0?{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions}:{contextWindowTokens:e.config.compaction.model.contextWindowTokens,id:e.config.compaction.model.id,maxOutputTokens:e.config.compaction.model.maxOutputTokens,providerOptions:e.config.compaction.model.providerOptions,source:{exportName:e.config.compaction.model.source.exportName,sourceKind:`module`,logicalPath:e.config.compaction.model.source.logicalPath,sourceId:e.config.compaction.model.source.sourceId}}),e.config.compaction.thresholdPercent!==void 0&&(t.thresholdPercent=e.config.compaction.thresholdPercent),n.compaction=t}if(e.config.experimental!==void 0&&(n.experimental={instrumentationProviders:e.config.experimental.instrumentationProviders,subagentPersistentSessions:e.config.experimental.subagentPersistentSessions,workflow:e.config.experimental.workflow===void 0?void 0:{world:e.config.experimental.workflow.world}}),e.config.outputSchema!==void 0&&(n.outputSchema=e.config.outputSchema),e.config.reasoning!==void 0&&(n.reasoning=e.config.reasoning),e.config.source!==void 0&&(n.source=createResolvedModuleSourceRef(e.config.source)),e.config.limits!==void 0&&(n.limits={maxInputTokensPerSession:e.config.limits.maxInputTokensPerSession,maxOutputTokensPerSession:e.config.limits.maxOutputTokensPerSession,sessionTimeoutMs:e.config.limits.sessionTimeoutMs}),e.config.dynamicModel!==void 0)return{...n,dynamicModel:{...createResolvedModuleSourceRef(e.config.dynamicModel),eventNames:[...e.config.dynamicModel.eventNames]}};let r=e.config.model;return{...n,model:r.source===void 0?{id:r.id,contextWindowTokens:r.contextWindowTokens,maxOutputTokens:r.maxOutputTokens,providerOptions:r.providerOptions}:{contextWindowTokens:r.contextWindowTokens,id:r.id,maxOutputTokens:r.maxOutputTokens,providerOptions:r.providerOptions,source:{exportName:r.source.exportName,sourceKind:`module`,logicalPath:r.source.logicalPath,sourceId:r.source.sourceId}}}}export{ResolveAgentError,resolveAgent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#shared/tool-schema.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{registerDefinitionSource,stampDefinitionKey}from"#public/tool-result-narrowing.js";async function resolveToolDefinition(
|
|
1
|
+
import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#shared/tool-schema.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{registerDefinitionSource,stampDefinitionKey}from"#public/tool-result-narrowing.js";async function resolveToolDefinition(i,o,s){try{let n=expectObjectRecord(await loadResolvedModuleExport({definition:i,kindLabel:`tool`,moduleMap:o,nodeId:s}),describe(i,`to return an object`)),a={kind:`tool`,logicalPath:i.logicalPath,name:i.name},c=`tool-source:${i.sourceId}`;stampDefinitionKey(n,c),registerDefinitionSource(c,a),registerDefinitionSource(`tool:${n.description}`,a);let l=expectFunction(n.execute,describe(i,`to provide an execute function`)),u=isToolSchema(n.inputSchema)?n.inputSchema:toInputSchema(i.inputSchema),d=isToolSchema(n.outputSchema)?n.outputSchema:toOutputSchema(i.outputSchema);return{description:i.description,execute:l,exportName:i.exportName,inputSchema:u,logicalPath:i.logicalPath,name:i.name,outputSchema:d,sourceId:i.sourceId,sourceKind:`module`,...extractOptionalHooks(n,i)}}catch(e){throw e instanceof ResolveAgentError?e:new ResolveAgentError(`Failed to attach the tool execute function from "${i.logicalPath}": ${toErrorMessage(e)}`,{logicalPath:i.logicalPath,sourceId:i.sourceId})}}function extractOptionalHooks(t,n){let r={};return t.approval!==void 0&&(r.approval=normalizeApproval(t.approval,describe(n,`to provide a valid approval definition`))),t.toModelOutput!==void 0&&(r.toModelOutput=expectFunction(t.toModelOutput,describe(n,`to provide a toModelOutput function`))),r}function describe(e,t){return`Expected the tool export "${e.exportName??`default`}" from "${e.logicalPath}" ${t}.`}export{resolveToolDefinition};
|
|
@@ -10,5 +10,6 @@ export { detectDeployment, detectProjectResolution, projectProductionUrlFromReso
|
|
|
10
10
|
export { runVercelEnvPull } from "./run-vercel-link.js";
|
|
11
11
|
export { provisionSlackbot, reconcileSlackUid, type ProvisionSlackbotResult } from "./slackbot.js";
|
|
12
12
|
export { runRemoteAuthFlow } from "../cli/dev/tui/remote-auth.js";
|
|
13
|
+
export { inspectVerifiedRemoteAgent, type InspectVerifiedRemoteAgentDeps, type VerifiedRemoteAgentInspection, } from "./verified-remote-agent.js";
|
|
13
14
|
export { setupConnectionConnector, type SetupConnectionConnectorOptions, type SetupConnectionConnectorResult, } from "./connection-connector.js";
|
|
14
15
|
export { linkProject, requireAuth, resolveProjectByNameOrId, resolveTeam, } from "./vercel-project.js";
|
package/dist/src/setup/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{runRemoteAuthFlow}from"../cli/dev/tui/remote-auth.js";import{InteractionRequired}from"./ask-signals.js";import"./ask.js";import{runVercel}from"./primitives/run-vercel.js";import{detectDeployment,detectProjectResolution,projectProductionUrlFromResolution}from"./project-resolution.js";import{runVercelEnvPull}from"./run-vercel-link.js";import{createDefaultSetupState,requireProjectPath,snapshotSetupState}from"./state.js";import{getPackageManagerStrategy}from"./primitives/pm/index.js";import{linkProject,requireAuth,resolveProjectByNameOrId,resolveTeam}from"./vercel-project.js";import{createPromptCommandOutput}from"./cli/command-output.js";import"./cli/index.js";import{setupConnectionConnector}from"./connection-connector.js";import{WizardCancelledError}from"./step.js";import{runHeadless,runInteractive}from"./runner.js";import{HeadlessPromptError,createHeadlessPrompter,formatHeadlessEvent}from"./headless.js";import{createPrompter}from"./prompter.js";import{runPackageManagerInstall,runPnpmInstall,spawnPackageManager,spawnPnpm}from"./primitives/pm/run.js";import"./primitives/index.js";import{provisionSlackbot,reconcileSlackUid}from"./slackbot.js";export{HeadlessPromptError,InteractionRequired,WizardCancelledError,createDefaultSetupState,createHeadlessPrompter,createPromptCommandOutput,createPrompter,detectDeployment,detectProjectResolution,formatHeadlessEvent,getPackageManagerStrategy,linkProject,projectProductionUrlFromResolution,provisionSlackbot,reconcileSlackUid,requireAuth,requireProjectPath,resolveProjectByNameOrId,resolveTeam,runHeadless,runInteractive,runPackageManagerInstall,runPnpmInstall,runRemoteAuthFlow,runVercel,runVercelEnvPull,setupConnectionConnector,snapshotSetupState,spawnPackageManager,spawnPnpm};
|
|
1
|
+
import{runRemoteAuthFlow}from"../cli/dev/tui/remote-auth.js";import{InteractionRequired}from"./ask-signals.js";import"./ask.js";import{runVercel}from"./primitives/run-vercel.js";import{detectDeployment,detectProjectResolution,projectProductionUrlFromResolution}from"./project-resolution.js";import{runVercelEnvPull}from"./run-vercel-link.js";import{createDefaultSetupState,requireProjectPath,snapshotSetupState}from"./state.js";import{getPackageManagerStrategy}from"./primitives/pm/index.js";import{linkProject,requireAuth,resolveProjectByNameOrId,resolveTeam}from"./vercel-project.js";import{createPromptCommandOutput}from"./cli/command-output.js";import"./cli/index.js";import{setupConnectionConnector}from"./connection-connector.js";import{WizardCancelledError}from"./step.js";import{runHeadless,runInteractive}from"./runner.js";import{HeadlessPromptError,createHeadlessPrompter,formatHeadlessEvent}from"./headless.js";import{createPrompter}from"./prompter.js";import{runPackageManagerInstall,runPnpmInstall,spawnPackageManager,spawnPnpm}from"./primitives/pm/run.js";import"./primitives/index.js";import{provisionSlackbot,reconcileSlackUid}from"./slackbot.js";import{inspectVerifiedRemoteAgent}from"./verified-remote-agent.js";export{HeadlessPromptError,InteractionRequired,WizardCancelledError,createDefaultSetupState,createHeadlessPrompter,createPromptCommandOutput,createPrompter,detectDeployment,detectProjectResolution,formatHeadlessEvent,getPackageManagerStrategy,inspectVerifiedRemoteAgent,linkProject,projectProductionUrlFromResolution,provisionSlackbot,reconcileSlackUid,requireAuth,requireProjectPath,resolveProjectByNameOrId,resolveTeam,runHeadless,runInteractive,runPackageManagerInstall,runPnpmInstall,runRemoteAuthFlow,runVercel,runVercelEnvPull,setupConnectionConnector,snapshotSetupState,spawnPackageManager,spawnPnpm};
|