experimental-ash 0.24.2 → 0.25.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 +12 -0
- package/dist/docs/public/typescript-api.md +0 -12
- package/dist/src/channel/adapter.d.ts +5 -18
- package/dist/src/channel/adapter.js +2 -8
- package/dist/src/channel/cross-channel-receive.d.ts +10 -1
- package/dist/src/channel/cross-channel-receive.js +21 -3
- package/dist/src/channel/routes.d.ts +2 -1
- package/dist/src/channel/routes.js +6 -3
- package/dist/src/channel/schedule.js +2 -2
- package/dist/src/channel/types.d.ts +1 -1
- package/dist/src/chunks/{client-DLHAGI2g.js → client-BShLWzR6.js} +3 -3
- package/dist/src/chunks/compile-agent-75wLLW-E.js +5 -0
- package/dist/src/chunks/dev-authored-source-watcher-DqoJsDup.js +1 -0
- package/dist/src/chunks/host-JVy7fewA.js +70 -0
- package/dist/src/chunks/paths-DNjq5JOy.js +85 -0
- package/dist/src/chunks/{token-D98SQdvs.js → token-BOkIxJeV.js} +1 -1
- package/dist/src/chunks/types-CjIyrcYo.js +1 -0
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/dev/environment.d.ts +0 -5
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/repl.d.ts +1 -1
- package/dist/src/cli/dev/repl.js +3 -3
- package/dist/src/cli/run.d.ts +0 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/message-reducer.js +13 -25
- package/dist/src/client/message-response.d.ts +2 -1
- package/dist/src/client/open-stream.d.ts +3 -3
- package/dist/src/client/open-stream.js +1 -2
- package/dist/src/client/session.d.ts +2 -1
- package/dist/src/client/session.js +0 -3
- package/dist/src/client/types.d.ts +3 -2
- package/dist/src/compiler/artifacts.d.ts +7 -10
- package/dist/src/compiler/artifacts.js +3 -3
- package/dist/src/compiler/manifest.d.ts +6 -15
- package/dist/src/compiler/manifest.js +3 -3
- package/dist/src/compiler/normalize-agent-config.js +12 -10
- package/dist/src/compiler/normalize-manifest.js +3 -2
- package/dist/src/context/container.d.ts +1 -16
- package/dist/src/context/container.js +1 -24
- package/dist/src/context/hook-lifecycle.d.ts +2 -7
- package/dist/src/context/hook-lifecycle.js +0 -6
- package/dist/src/context/provider.d.ts +1 -11
- package/dist/src/context/providers/sandbox.js +4 -1
- package/dist/src/context/run-step.d.ts +2 -4
- package/dist/src/context/run-step.js +4 -17
- package/dist/src/context/seed-keys.d.ts +1 -1
- package/dist/src/discover/connections.d.ts +2 -1
- package/dist/src/discover/diagnostics.d.ts +0 -8
- package/dist/src/discover/diagnostics.js +4 -16
- package/dist/src/discover/discover-agent.d.ts +3 -13
- package/dist/src/discover/discover-agent.js +1 -11
- package/dist/src/discover/discover-subagent.d.ts +3 -2
- package/dist/src/discover/discover-subagent.js +1 -1
- package/dist/src/discover/filesystem.d.ts +0 -37
- package/dist/src/discover/filesystem.js +0 -115
- package/dist/src/discover/grammar.d.ts +10 -20
- package/dist/src/discover/grammar.js +11 -33
- package/dist/src/discover/lib.d.ts +3 -2
- package/dist/src/discover/manifest.d.ts +3 -3
- package/dist/src/discover/markdown.d.ts +2 -1
- package/dist/src/discover/sandbox.d.ts +2 -1
- package/dist/src/discover/schedules.d.ts +3 -2
- package/dist/src/discover/schedules.js +1 -1
- package/dist/src/discover/skills.d.ts +3 -2
- package/dist/src/discover/skills.js +1 -1
- package/dist/src/discover/slots.d.ts +3 -2
- package/dist/src/evals/cli/eval.d.ts +0 -6
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/loaders/index.d.ts +2 -22
- package/dist/src/evals/loaders/index.js +1 -1
- package/dist/src/evals/reporters/index.d.ts +2 -14
- package/dist/src/evals/reporters/index.js +1 -1
- package/dist/src/evals/runner/discover.d.ts +0 -6
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-case.d.ts +2 -1
- package/dist/src/evals/runner/execute-suite.d.ts +2 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/resolve-git-metadata.d.ts +3 -3
- package/dist/src/evals/scorers/autoevals-client.d.ts +2 -2
- package/dist/src/execution/connection-auth-steps.d.ts +1 -5
- package/dist/src/execution/connection-auth-steps.js +4 -5
- package/dist/src/execution/node-step.d.ts +1 -1
- package/dist/src/execution/skills/instructions.d.ts +2 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +1 -1
- package/dist/src/execution/subagent-tool.d.ts +0 -8
- package/dist/src/execution/subagent-tool.js +9 -16
- package/dist/src/execution/tool-compaction.js +0 -2
- package/dist/src/execution/turn-workflow.d.ts +1 -1
- package/dist/src/execution/turn-workflow.js +2 -2
- package/dist/src/execution/web-fetch/tool.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +17 -1
- package/dist/src/execution/workflow-steps.js +5 -6
- package/dist/src/harness/action-result-helpers.d.ts +0 -12
- package/dist/src/harness/action-result-helpers.js +1 -1
- package/dist/src/harness/emission.d.ts +2 -2
- package/dist/src/harness/execute-tool.d.ts +2 -1
- package/dist/src/harness/input-requests.d.ts +2 -1
- package/dist/src/harness/prompt-cache.d.ts +1 -9
- package/dist/src/harness/prompt-cache.js +0 -12
- package/dist/src/harness/runtime-actions.d.ts +2 -11
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +3 -2
- package/dist/src/harness/step-hooks.js +3 -7
- package/dist/src/harness/tool-loop.js +0 -2
- package/dist/src/harness/types.d.ts +1 -1
- package/dist/src/internal/application/package.js +2 -2
- package/dist/src/internal/application/runtime-compiled-artifacts-source.js +0 -1
- package/dist/src/internal/attachments/errors.d.ts +8 -2
- package/dist/src/internal/attachments/url-refs.d.ts +0 -1
- package/dist/src/internal/attachments/url-refs.js +1 -1
- package/dist/src/internal/authored-definition/channel.d.ts +0 -5
- package/dist/src/internal/authored-definition/channel.js +1 -10
- package/dist/src/internal/authored-definition/sandbox.d.ts +2 -1
- package/dist/src/internal/authored-definition/schema-backed.d.ts +3 -2
- package/dist/src/internal/authored-module-loader.d.ts +0 -6
- package/dist/src/internal/authored-module-loader.js +0 -9
- package/dist/src/internal/authored-module.d.ts +0 -4
- package/dist/src/internal/authored-module.js +0 -10
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +2 -10
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/{public → internal}/helpers/markdown.d.ts +2 -23
- package/dist/src/{public → internal}/helpers/markdown.js +1 -1
- package/dist/src/internal/logging.d.ts +2 -8
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +2 -2
- package/dist/src/internal/nitro/routes/channel-dispatch.js +2 -2
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +0 -1
- package/dist/src/internal/node-esm-compat-banner.d.ts +1 -1
- package/dist/src/internal/runtime-registry.d.ts +2 -1
- package/dist/src/{protocol → internal}/vercel-agent-summary.d.ts +1 -1
- package/dist/src/protocol/message.d.ts +0 -34
- package/dist/src/protocol/message.js +0 -30
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/slack/api.d.ts +1 -7
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/connections.d.ts +2 -6
- package/dist/src/public/channels/slack/hitl.d.ts +3 -2
- package/dist/src/public/channels/slack/inbound.d.ts +0 -35
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/defineChannel.d.ts +1 -1
- package/dist/src/public/definitions/defineChannel.js +1 -1
- package/dist/src/public/definitions/instructions.d.ts +0 -11
- package/dist/src/public/definitions/instructions.js +0 -5
- package/dist/src/public/definitions/tool.d.ts +3 -7
- package/dist/src/public/definitions/tool.js +1 -1
- package/dist/src/public/instructions/index.d.ts +1 -5
- package/dist/src/public/instructions/index.js +1 -3
- package/dist/src/public/tool-result-narrowing.d.ts +2 -1
- package/dist/src/react/use-ash-agent.d.ts +2 -1
- package/dist/src/react/use-ash-agent.js +1 -5
- package/dist/src/runtime/actions/types.d.ts +8 -50
- package/dist/src/runtime/actions/types.js +5 -21
- package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +2 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/channels/registry.js +3 -8
- package/dist/src/runtime/compiled-artifacts-source.d.ts +4 -11
- package/dist/src/runtime/compiled-artifacts-source.js +3 -7
- package/dist/src/runtime/connections/authorization-tokens.d.ts +1 -14
- package/dist/src/runtime/connections/authorization-tokens.js +2 -28
- package/dist/src/runtime/connections/principal-context.d.ts +3 -2
- package/dist/src/runtime/connections/validate-authorization.d.ts +0 -11
- package/dist/src/runtime/connections/validate-authorization.js +0 -16
- package/dist/src/runtime/framework-channels/index.d.ts +0 -1
- package/dist/src/runtime/framework-channels/index.js +1 -1
- package/dist/src/runtime/framework-tools/index.d.ts +2 -1
- package/dist/src/runtime/framework-tools/index.js +2 -1
- package/dist/src/runtime/framework-tools/skill.d.ts +0 -13
- package/dist/src/runtime/framework-tools/skill.js +1 -1
- package/dist/src/runtime/governance/auth/token-claims.d.ts +1 -16
- package/dist/src/runtime/governance/auth/token-claims.js +3 -3
- package/dist/src/runtime/governance/auth/types.d.ts +0 -4
- package/dist/src/runtime/governance/network/ip-allow-list.d.ts +0 -17
- package/dist/src/runtime/governance/network/ip-allow-list.js +0 -39
- package/dist/src/runtime/hooks/registry.d.ts +7 -4
- package/dist/src/runtime/hooks/registry.js +4 -2
- package/dist/src/runtime/loaders/bundled-artifacts.d.ts +0 -5
- package/dist/src/runtime/loaders/bundled-artifacts.js +0 -7
- package/dist/src/runtime/loaders/compile-metadata.d.ts +3 -10
- package/dist/src/runtime/loaders/compile-metadata.js +6 -8
- package/dist/src/runtime/loaders/manifest.d.ts +2 -2
- package/dist/src/runtime/loaders/manifest.js +4 -5
- package/dist/src/runtime/loaders/module-map.d.ts +2 -2
- package/dist/src/runtime/loaders/module-map.js +3 -4
- package/dist/src/runtime/prompt/compose.d.ts +2 -1
- package/dist/src/runtime/resolve-agent-graph.d.ts +2 -15
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/sandbox/keys.d.ts +2 -1
- package/dist/src/runtime/sandbox/registry.d.ts +3 -3
- package/dist/src/runtime/schedules/resolve-schedule.d.ts +3 -12
- package/dist/src/runtime/schedules/resolve-schedule.js +1 -1
- package/dist/src/runtime/sessions/auth.d.ts +2 -13
- package/dist/src/runtime/sessions/auth.js +1 -11
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/sessions/runtime-session.d.ts +0 -6
- package/dist/src/runtime/sessions/runtime-session.js +0 -13
- package/dist/src/runtime/sessions/turn.d.ts +2 -2
- package/dist/src/runtime/subagents/registry.d.ts +2 -5
- package/dist/src/runtime/subagents/registry.js +0 -6
- package/dist/src/runtime/tools/registry.d.ts +2 -1
- package/dist/src/runtime/tools/registry.js +1 -4
- package/dist/src/runtime/types.d.ts +4 -3
- package/dist/src/runtime/workspace/seed-files.d.ts +2 -1
- package/dist/src/services/dev-client/request-headers.d.ts +37 -8
- package/dist/src/services/dev-client/request-headers.js +71 -46
- package/dist/src/services/dev-client/stream.d.ts +0 -19
- package/dist/src/services/dev-client/stream.js +0 -37
- package/dist/src/services/dev-client/url.d.ts +3 -7
- package/dist/src/services/dev-client/url.js +4 -10
- package/dist/src/services/dev-client.d.ts +0 -12
- package/dist/src/services/dev-client.js +6 -92
- package/dist/src/shared/agent-definition.d.ts +1 -1
- package/dist/src/shared/json.d.ts +0 -4
- package/dist/src/shared/json.js +0 -38
- package/dist/src/shared/skill-definition.d.ts +0 -2
- package/package.json +1 -6
- package/dist/src/chunks/dev-authored-source-watcher-CBID_Dwh.js +0 -1
- package/dist/src/chunks/host-zBy9FyyX.js +0 -70
- package/dist/src/chunks/package-HUaeub_D.js +0 -1
- package/dist/src/chunks/paths-CebY5GCi.js +0 -89
- package/dist/src/chunks/types-DDA2QUED.js +0 -1
- package/dist/src/compiler/resource-files.d.ts +0 -19
- package/dist/src/compiler/resource-files.js +0 -28
- package/dist/src/execution/subagent-invocation.d.ts +0 -19
- package/dist/src/execution/subagent-invocation.js +0 -17
- package/dist/src/execution/task-mode.d.ts +0 -9
- package/dist/src/execution/task-mode.js +0 -12
- package/dist/src/execution/types.d.ts +0 -20
- package/dist/src/execution/types.js +0 -1
- package/dist/src/internal/logical-paths.d.ts +0 -13
- package/dist/src/internal/logical-paths.js +0 -25
- package/dist/src/runtime/sessions/messages.d.ts +0 -140
- package/dist/src/runtime/sessions/messages.js +0 -170
- package/dist/src/runtime/standard-schema.d.ts +0 -27
- package/dist/src/runtime/standard-schema.js +0 -64
- package/dist/src/services/dev-client/live-stream.d.ts +0 -35
- package/dist/src/services/dev-client/live-stream.js +0 -157
- package/dist/src/services/dev-client/send-message.d.ts +0 -24
- package/dist/src/services/dev-client/send-message.js +0 -185
- package/dist/src/services/dev-client/session.d.ts +0 -54
- package/dist/src/services/dev-client/session.js +0 -52
- package/dist/src/services/host.d.ts +0 -14
- package/dist/src/services/host.js +0 -13
- /package/dist/src/{package-name.d.ts → internal/package-name.d.ts} +0 -0
- /package/dist/src/{package-name.js → internal/package-name.js} +0 -0
- /package/dist/src/{protocol → internal}/vercel-agent-summary.js +0 -0
- /package/dist/src/{run-mode.d.ts → shared/run-mode.d.ts} +0 -0
- /package/dist/src/{run-mode.js → shared/run-mode.js} +0 -0
|
@@ -5,26 +5,13 @@ import { type ResolvedAgentGraphBundle } from "#runtime/graph.js";
|
|
|
5
5
|
* Input for resolving the compiled authored manifest and flattened module graph
|
|
6
6
|
* into a runtime-owned recursive agent graph.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
interface ResolveRuntimeAgentGraphInput {
|
|
9
9
|
manifest: CompiledAgentManifest;
|
|
10
10
|
moduleMap: CompiledModuleMap;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Error raised when the flattened compiled authored graph cannot be hydrated
|
|
14
|
-
* into a runtime-owned agent graph.
|
|
15
|
-
*/
|
|
16
|
-
export declare class ResolveRuntimeAgentGraphError extends Error {
|
|
17
|
-
readonly logicalPath?: string;
|
|
18
|
-
readonly nodeId?: string;
|
|
19
|
-
readonly sourceId?: string;
|
|
20
|
-
constructor(message: string, input?: {
|
|
21
|
-
logicalPath?: string;
|
|
22
|
-
nodeId?: string;
|
|
23
|
-
sourceId?: string;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
12
|
/**
|
|
27
13
|
* Resolves the compiled authored manifest and flattened module graph into one
|
|
28
14
|
* runtime-owned bundle of agent nodes.
|
|
29
15
|
*/
|
|
30
16
|
export declare function resolveRuntimeAgentGraph(input: ResolveRuntimeAgentGraphInput): Promise<ResolvedAgentGraphBundle>;
|
|
17
|
+
export {};
|
|
@@ -16,7 +16,7 @@ import { createRuntimeToolRegistry } from "#runtime/tools/registry.js";
|
|
|
16
16
|
* Error raised when the flattened compiled authored graph cannot be hydrated
|
|
17
17
|
* into a runtime-owned agent graph.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
class ResolveRuntimeAgentGraphError extends Error {
|
|
20
20
|
logicalPath;
|
|
21
21
|
nodeId;
|
|
22
22
|
sourceId;
|
|
@@ -2,7 +2,7 @@ import { type RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts
|
|
|
2
2
|
/**
|
|
3
3
|
* Input for deriving the stable runtime keys used for one sandbox definition.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
interface CreateRuntimeSandboxKeysInput {
|
|
6
6
|
readonly backendName: string;
|
|
7
7
|
readonly compiledArtifactsSource: RuntimeCompiledArtifactsSource;
|
|
8
8
|
readonly nodeId: string;
|
|
@@ -31,3 +31,4 @@ export declare function createRuntimeSandboxTemplateKey(input: {
|
|
|
31
31
|
readonly nodeId: string;
|
|
32
32
|
readonly sourceId: string;
|
|
33
33
|
}): Promise<string>;
|
|
34
|
+
export {};
|
|
@@ -32,11 +32,11 @@ export interface RuntimeRegisteredSandbox {
|
|
|
32
32
|
* Every agent owns exactly one sandbox, so the registry is just a
|
|
33
33
|
* single record. When the author provides a `sandbox.<ext>` (or
|
|
34
34
|
* `sandbox/sandbox.<ext>`) override, that authored definition replaces
|
|
35
|
-
* the framework default.
|
|
36
|
-
* a
|
|
35
|
+
* the framework default. Production always populates it; tests that
|
|
36
|
+
* need a `null` sandbox cast through `as RuntimeSandboxRegistry`.
|
|
37
37
|
*/
|
|
38
38
|
export interface RuntimeSandboxRegistry {
|
|
39
|
-
readonly sandbox: RuntimeRegisteredSandbox
|
|
39
|
+
readonly sandbox: RuntimeRegisteredSandbox;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Builds the runtime-owned registry for one resolved authored agent's
|
|
@@ -4,26 +4,16 @@ import type { ResolvedSchedule } from "#runtime/types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Input for resolving authored schedules from the compiled manifest.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
interface ResolveSchedulesInput {
|
|
8
8
|
manifest: CompiledAgentManifest;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Explicit compiled-artifact source used to resolve schedules from runtime
|
|
12
12
|
* artifacts.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
interface LoadResolvedCompiledSchedulesInput {
|
|
15
15
|
readonly compiledArtifactsSource: RuntimeCompiledArtifactsSource;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Error raised when compiled authored schedules cannot be hydrated into one
|
|
19
|
-
* runtime-owned schedule model.
|
|
20
|
-
*/
|
|
21
|
-
export declare class ResolveScheduleError extends Error {
|
|
22
|
-
readonly taskName?: string;
|
|
23
|
-
constructor(message: string, input?: {
|
|
24
|
-
taskName?: string;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
17
|
/**
|
|
28
18
|
* Resolves runtime-owned schedules from the compiled manifest.
|
|
29
19
|
*/
|
|
@@ -38,3 +28,4 @@ export declare function loadResolvedCompiledSchedules(input: LoadResolvedCompile
|
|
|
38
28
|
* task name.
|
|
39
29
|
*/
|
|
40
30
|
export declare function loadResolvedCompiledScheduleByTaskName(taskName: string, input: LoadResolvedCompiledSchedulesInput): Promise<ResolvedSchedule>;
|
|
31
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { createScheduleRegistrations } from "#runtime/schedules/register.js";
|
|
|
4
4
|
* Error raised when compiled authored schedules cannot be hydrated into one
|
|
5
5
|
* runtime-owned schedule model.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
class ResolveScheduleError extends Error {
|
|
8
8
|
taskName;
|
|
9
9
|
constructor(message, input = {}) {
|
|
10
10
|
super(message);
|
|
@@ -15,17 +15,10 @@ export type RuntimeSessionAuthAttributes = Readonly<Record<string, string | read
|
|
|
15
15
|
* Serializable auth context projected onto one runtime session turn.
|
|
16
16
|
*/
|
|
17
17
|
export type RuntimeSessionAuthContext = z.infer<typeof runtimeSessionAuthContextSchema>;
|
|
18
|
-
/**
|
|
19
|
-
* Typed durable auth state preserved across one runtime session.
|
|
20
|
-
*/
|
|
21
|
-
export interface RuntimeSessionAuthState {
|
|
22
|
-
readonly current: RuntimeSessionAuthContext | null;
|
|
23
|
-
readonly initiator: RuntimeSessionAuthContext | null;
|
|
24
|
-
}
|
|
25
18
|
/**
|
|
26
19
|
* Zod schema for one serializable runtime session auth context.
|
|
27
20
|
*/
|
|
28
|
-
|
|
21
|
+
declare const runtimeSessionAuthContextSchema: z.ZodObject<{
|
|
29
22
|
attributes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString>>]>>>;
|
|
30
23
|
authenticator: z.ZodEnum<{
|
|
31
24
|
"http-basic": "http-basic";
|
|
@@ -43,8 +36,4 @@ export declare const runtimeSessionAuthContextSchema: z.ZodObject<{
|
|
|
43
36
|
}>;
|
|
44
37
|
subject: z.ZodOptional<z.ZodString>;
|
|
45
38
|
}, z.core.$strict>;
|
|
46
|
-
|
|
47
|
-
* Creates the empty route-auth snapshot for one public or unauthenticated
|
|
48
|
-
* runtime session.
|
|
49
|
-
*/
|
|
50
|
-
export declare function createEmptyRuntimeSessionAuthState(): RuntimeSessionAuthState;
|
|
39
|
+
export {};
|
|
@@ -6,7 +6,7 @@ const runtimeSessionAuthAttributeValueSchema = z.union([
|
|
|
6
6
|
/**
|
|
7
7
|
* Zod schema for one serializable runtime session auth context.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
const runtimeSessionAuthContextSchema = z
|
|
10
10
|
.object({
|
|
11
11
|
attributes: z.record(z.string(), runtimeSessionAuthAttributeValueSchema).readonly(),
|
|
12
12
|
authenticator: z.enum(["http-basic", "jwt-hmac", "jwt-ecdsa", "oidc"]),
|
|
@@ -16,13 +16,3 @@ export const runtimeSessionAuthContextSchema = z
|
|
|
16
16
|
subject: z.string().optional(),
|
|
17
17
|
})
|
|
18
18
|
.strict();
|
|
19
|
-
/**
|
|
20
|
-
* Creates the empty route-auth snapshot for one public or unauthenticated
|
|
21
|
-
* runtime session.
|
|
22
|
-
*/
|
|
23
|
-
export function createEmptyRuntimeSessionAuthState() {
|
|
24
|
-
return {
|
|
25
|
-
current: null,
|
|
26
|
-
initiator: null,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -31,7 +31,7 @@ async function loadFullBundle(compiledArtifactsSource) {
|
|
|
31
31
|
}
|
|
32
32
|
async function loadRuntimeCompiledModuleMap(compiledArtifactsSource) {
|
|
33
33
|
if (compiledArtifactsSource.kind === "disk" &&
|
|
34
|
-
compiledArtifactsSource.
|
|
34
|
+
compiledArtifactsSource.moduleMapLoaderPath !== undefined) {
|
|
35
35
|
return await loadAuthoredSourceCompiledModuleMap(compiledArtifactsSource);
|
|
36
36
|
}
|
|
37
37
|
return await loadCompiledModuleMap({ compiledArtifactsSource });
|
|
@@ -50,9 +50,3 @@ export declare function getActiveRuntimeSession(): RuntimeSession;
|
|
|
50
50
|
* process-default session is untouched.
|
|
51
51
|
*/
|
|
52
52
|
export declare function withRuntimeSession<T>(session: RuntimeSession, fn: () => Promise<T> | T): Promise<T>;
|
|
53
|
-
/**
|
|
54
|
-
* Clears the process-default session. Used by runtime tear-down paths to
|
|
55
|
-
* discard installed artifacts and the bundle cache without touching any
|
|
56
|
-
* scoped session set via {@link withRuntimeSession}.
|
|
57
|
-
*/
|
|
58
|
-
export declare function clearProcessDefaultRuntimeSession(): void;
|
|
@@ -48,16 +48,3 @@ export function getActiveRuntimeSession() {
|
|
|
48
48
|
export async function withRuntimeSession(session, fn) {
|
|
49
49
|
return await runtimeSessionStorage.run(session, async () => await fn());
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Clears the process-default session. Used by runtime tear-down paths to
|
|
53
|
-
* discard installed artifacts and the bundle cache without touching any
|
|
54
|
-
* scoped session set via {@link withRuntimeSession}.
|
|
55
|
-
*/
|
|
56
|
-
export function clearProcessDefaultRuntimeSession() {
|
|
57
|
-
const previous = globalContainer[RUNTIME_SESSION_DEFAULT_GLOBAL_KEY];
|
|
58
|
-
if (previous !== undefined) {
|
|
59
|
-
previous.compiledArtifacts = null;
|
|
60
|
-
previous.bundleCache.clear();
|
|
61
|
-
previous.bundleCacheKeyBySourceKey.clear();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -15,12 +15,12 @@ type PreparedRuntimeDelegationToolBase<TKind extends "remote" | "subagent"> = Re
|
|
|
15
15
|
* Serializable local subagent descriptor prepared by the runtime for one
|
|
16
16
|
* harness turn.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
type PreparedRuntimeSubagentTool = PreparedRuntimeDelegationToolBase<"subagent">;
|
|
19
19
|
/**
|
|
20
20
|
* Serializable remote subagent descriptor prepared by the runtime for one
|
|
21
21
|
* harness turn.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
type PreparedRuntimeRemoteAgentTool = PreparedRuntimeDelegationToolBase<"remote">;
|
|
24
24
|
/**
|
|
25
25
|
* Serializable delegation descriptor prepared by the runtime for one harness
|
|
26
26
|
* turn.
|
|
@@ -3,7 +3,7 @@ import type { ResolvedRuntimeDelegationNode } from "#runtime/types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* One runtime-owned subagent tracked by the prepared registry.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
interface RuntimeRegisteredSubagent {
|
|
7
7
|
readonly definition: ResolvedRuntimeDelegationNode;
|
|
8
8
|
readonly prepared: PreparedRuntimeDelegationTool;
|
|
9
9
|
}
|
|
@@ -23,7 +23,4 @@ export declare function createRuntimeSubagentRegistry(input: {
|
|
|
23
23
|
readonly reservedToolNames?: readonly string[];
|
|
24
24
|
readonly subagents: readonly ResolvedRuntimeDelegationNode[];
|
|
25
25
|
}): RuntimeSubagentRegistry;
|
|
26
|
-
|
|
27
|
-
* Looks up one prepared runtime subagent by its model-visible name.
|
|
28
|
-
*/
|
|
29
|
-
export declare function findRegisteredRuntimeSubagent(registry: RuntimeSubagentRegistry, subagentName: string): RuntimeRegisteredSubagent | null;
|
|
26
|
+
export {};
|
|
@@ -49,12 +49,6 @@ export function createRuntimeSubagentRegistry(input) {
|
|
|
49
49
|
subagentsByNodeId,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Looks up one prepared runtime subagent by its model-visible name.
|
|
54
|
-
*/
|
|
55
|
-
export function findRegisteredRuntimeSubagent(registry, subagentName) {
|
|
56
|
-
return registry.subagentsByName.get(subagentName) ?? null;
|
|
57
|
-
}
|
|
58
52
|
function createPreparedRuntimeSubagentTool(definition) {
|
|
59
53
|
return {
|
|
60
54
|
description: definition.description,
|
|
@@ -3,7 +3,7 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* One executable authored tool tracked by the runtime-owned registry.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
interface RuntimeRegisteredTool {
|
|
7
7
|
readonly definition: ResolvedToolDefinition;
|
|
8
8
|
readonly prepared: PreparedRuntimeAuthoredTool;
|
|
9
9
|
}
|
|
@@ -27,3 +27,4 @@ export declare function createRuntimeToolRegistry(definitions: {
|
|
|
27
27
|
* Looks up one authored tool by name from the runtime-owned registry.
|
|
28
28
|
*/
|
|
29
29
|
export declare function findRegisteredRuntimeTool(registry: RuntimeToolRegistry, toolName: string): RuntimeRegisteredTool | null;
|
|
30
|
+
export {};
|
|
@@ -31,13 +31,10 @@ export function findRegisteredRuntimeTool(registry, toolName) {
|
|
|
31
31
|
async function createPreparedRuntimeTool(definition) {
|
|
32
32
|
return {
|
|
33
33
|
description: definition.description,
|
|
34
|
-
inputSchema:
|
|
34
|
+
inputSchema: definition.inputSchema,
|
|
35
35
|
kind: "authored-tool",
|
|
36
36
|
logicalPath: definition.logicalPath,
|
|
37
37
|
name: definition.name,
|
|
38
38
|
sourceId: definition.sourceId,
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
async function resolvePreparedToolInputSchema(definition) {
|
|
42
|
-
return definition.inputSchema;
|
|
43
|
-
}
|
|
@@ -14,7 +14,7 @@ import type { WorkspaceRuntimeSpec } from "#runtime/workspace/types.js";
|
|
|
14
14
|
import type { Optional } from "#shared/optional.js";
|
|
15
15
|
import type { Node } from "#shared/node.js";
|
|
16
16
|
import type { SourceRef, ModuleSourceRef, SkillPackageSourceRef, MarkdownSourceRef } from "#shared/source-ref.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type { NamedSkillDefinition } from "#shared/skill-definition.js";
|
|
18
18
|
import type { InternalAgentDefinition } from "#shared/agent-definition.js";
|
|
19
19
|
import type { InternalToolDefinitionWithExecuteFn } from "#shared/tool-definition.js";
|
|
20
20
|
import type { SandboxBackend } from "#shared/sandbox-backend.js";
|
|
@@ -39,7 +39,7 @@ export type ResolvedInstructions = Readonly<SourceRef & {
|
|
|
39
39
|
* Runtime-owned skill metadata resolved from markdown, TypeScript, or a skill
|
|
40
40
|
* package manifest entry.
|
|
41
41
|
*/
|
|
42
|
-
export type ResolvedSkillDefinition = Readonly<
|
|
42
|
+
export type ResolvedSkillDefinition = Readonly<NamedSkillDefinition & (Omit<MarkdownSourceRef<undefined>, "definition"> | ModuleSourceRef | SkillPackageSourceRef) & {
|
|
43
43
|
metadata?: Readonly<Record<string, string>>;
|
|
44
44
|
}>;
|
|
45
45
|
/**
|
|
@@ -250,7 +250,7 @@ export type ResolvedAgentDefinition = Readonly<Omit<InternalAgentDefinition, "bu
|
|
|
250
250
|
/**
|
|
251
251
|
* Stable runtime metadata preserved alongside the resolved authored agent.
|
|
252
252
|
*/
|
|
253
|
-
|
|
253
|
+
interface ResolvedAgentMetadata {
|
|
254
254
|
readonly agentRoot: string;
|
|
255
255
|
readonly appRoot: string;
|
|
256
256
|
readonly diagnosticsSummary: DiscoverDiagnosticsSummary;
|
|
@@ -300,3 +300,4 @@ export interface ResolvedAgent {
|
|
|
300
300
|
readonly tools: readonly ResolvedToolDefinition[];
|
|
301
301
|
readonly workspaceSpec: WorkspaceRuntimeSpec;
|
|
302
302
|
}
|
|
303
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* One concrete file materialized from a workspace seed directory for
|
|
3
3
|
* sandbox template preparation.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
interface MaterializedWorkspaceFile {
|
|
6
6
|
readonly content: Buffer;
|
|
7
7
|
readonly path: string;
|
|
8
8
|
}
|
|
@@ -12,3 +12,4 @@ export interface MaterializedWorkspaceFile {
|
|
|
12
12
|
* `/workspace` root for the resulting seed file paths.
|
|
13
13
|
*/
|
|
14
14
|
export declare function materializeWorkspaceDirectory(sourceDirectoryPath: string): Promise<readonly MaterializedWorkspaceFile[]>;
|
|
15
|
+
export {};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether `serverUrl` targets one of the recognized local
|
|
3
|
+
* development hostnames. Invalid URLs return `false` so callers can
|
|
4
|
+
* always proceed as if the target is remote.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isLocalDevelopmentServerUrl(serverUrl: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves a Vercel OIDC token for the development client.
|
|
9
|
+
*
|
|
10
|
+
* Tries the `@vercel/oidc` SDK first (refreshes a freshly-issued token
|
|
11
|
+
* when the CLI is linked to a Vercel project), then falls back to the
|
|
12
|
+
* `VERCEL_OIDC_TOKEN` environment variable. Returns an empty string
|
|
13
|
+
* when no token is available so callers can proceed without auth.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveDevelopmentOidcToken(): Promise<string>;
|
|
1
16
|
/**
|
|
2
17
|
* Vercel header used to bypass preview protection for framework-owned routes
|
|
3
18
|
* during local CLI development. Paired with a Protection Bypass for
|
|
@@ -25,14 +40,6 @@ export declare const VERCEL_OIDC_TOKEN_HEADER = "x-vercel-oidc-token";
|
|
|
25
40
|
* Header values accepted by Ash's development client helpers.
|
|
26
41
|
*/
|
|
27
42
|
export type DevelopmentRequestHeaders = Headers | ReadonlyArray<readonly [string, string]> | Record<string, string>;
|
|
28
|
-
/**
|
|
29
|
-
* Creates request headers for one service-issued development request,
|
|
30
|
-
* including Vercel preview-bypass and OIDC promotion for Ash-owned routes.
|
|
31
|
-
*/
|
|
32
|
-
export declare function createDevelopmentRequestHeaders(input: {
|
|
33
|
-
headers?: DevelopmentRequestHeaders;
|
|
34
|
-
resourceUrl: URL;
|
|
35
|
-
}): Headers;
|
|
36
43
|
/**
|
|
37
44
|
* Creates request headers for one service-issued development request and
|
|
38
45
|
* opportunistically refreshes a linked local Vercel OIDC token for Ash-owned
|
|
@@ -42,3 +49,25 @@ export declare function createDevelopmentRequestHeadersAsync(input: {
|
|
|
42
49
|
headers?: DevelopmentRequestHeaders;
|
|
43
50
|
resourceUrl: URL;
|
|
44
51
|
}): Promise<Headers>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolves the per-request custom headers used by the development client
|
|
54
|
+
* when constructing requests against a configured server URL.
|
|
55
|
+
*
|
|
56
|
+
* - {@link VERCEL_PROTECTION_BYPASS_HEADER} is attached when
|
|
57
|
+
* `VERCEL_AUTOMATION_BYPASS_SECRET` is set.
|
|
58
|
+
* - {@link VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER} is attached when a Vercel
|
|
59
|
+
* OIDC token is available locally (either via `vercel link` +
|
|
60
|
+
* `@vercel/oidc` or via the `VERCEL_OIDC_TOKEN` environment variable).
|
|
61
|
+
* This lets the CLI bypass Vercel Deployment Protection without the user
|
|
62
|
+
* creating a project-scoped Bypass for Automation token first.
|
|
63
|
+
*
|
|
64
|
+
* Both headers are sent when both sources are available; the platform
|
|
65
|
+
* accepts whichever it can validate.
|
|
66
|
+
*
|
|
67
|
+
* Local dev servers skip the OIDC token entirely — the framework's
|
|
68
|
+
* default channel auth falls back to `none()` off Vercel infrastructure,
|
|
69
|
+
* so attaching the bypass token would be wasted work.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveDevelopmentClientHeaders(input: {
|
|
72
|
+
readonly serverUrl: string;
|
|
73
|
+
}): Promise<Record<string, string>>;
|
|
@@ -18,6 +18,39 @@ const LOCAL_HOSTNAMES = new Set([
|
|
|
18
18
|
function isLocalAshServerUrl(url) {
|
|
19
19
|
return LOCAL_HOSTNAMES.has(url.hostname);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns whether `serverUrl` targets one of the recognized local
|
|
23
|
+
* development hostnames. Invalid URLs return `false` so callers can
|
|
24
|
+
* always proceed as if the target is remote.
|
|
25
|
+
*/
|
|
26
|
+
export function isLocalDevelopmentServerUrl(serverUrl) {
|
|
27
|
+
try {
|
|
28
|
+
return isLocalAshServerUrl(new URL(serverUrl));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolves a Vercel OIDC token for the development client.
|
|
36
|
+
*
|
|
37
|
+
* Tries the `@vercel/oidc` SDK first (refreshes a freshly-issued token
|
|
38
|
+
* when the CLI is linked to a Vercel project), then falls back to the
|
|
39
|
+
* `VERCEL_OIDC_TOKEN` environment variable. Returns an empty string
|
|
40
|
+
* when no token is available so callers can proceed without auth.
|
|
41
|
+
*/
|
|
42
|
+
export async function resolveDevelopmentOidcToken() {
|
|
43
|
+
try {
|
|
44
|
+
const token = (await getVercelOidcToken()).trim();
|
|
45
|
+
if (token.length > 0) {
|
|
46
|
+
return token;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Fall through to env var.
|
|
51
|
+
}
|
|
52
|
+
return process.env.VERCEL_OIDC_TOKEN?.trim() ?? "";
|
|
53
|
+
}
|
|
21
54
|
/**
|
|
22
55
|
* Vercel header used to bypass preview protection for framework-owned routes
|
|
23
56
|
* during local CLI development. Paired with a Protection Bypass for
|
|
@@ -45,18 +78,6 @@ function isAshRouteUrl(url) {
|
|
|
45
78
|
return (url.pathname.endsWith(ASH_ROUTE_PREFIX) ||
|
|
46
79
|
url.pathname.includes(ASH_ROUTE_PREFIX_WITH_SEPARATOR));
|
|
47
80
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Creates request headers for one service-issued development request,
|
|
50
|
-
* including Vercel preview-bypass and OIDC promotion for Ash-owned routes.
|
|
51
|
-
*/
|
|
52
|
-
export function createDevelopmentRequestHeaders(input) {
|
|
53
|
-
const headers = createBaseDevelopmentRequestHeaders(input);
|
|
54
|
-
const oidcToken = resolveAshRouteOidcTokenSync(headers, input.resourceUrl);
|
|
55
|
-
if (oidcToken !== null) {
|
|
56
|
-
attachAshRouteOidcHeaders(headers, oidcToken);
|
|
57
|
-
}
|
|
58
|
-
return headers;
|
|
59
|
-
}
|
|
60
81
|
/**
|
|
61
82
|
* Creates request headers for one service-issued development request and
|
|
62
83
|
* opportunistically refreshes a linked local Vercel OIDC token for Ash-owned
|
|
@@ -92,30 +113,10 @@ function attachAshRouteOidcHeaders(headers, oidcToken) {
|
|
|
92
113
|
headers.set(VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER, oidcToken);
|
|
93
114
|
}
|
|
94
115
|
/**
|
|
95
|
-
*
|
|
96
|
-
* synchronously-available sources (forwarded runtime header or
|
|
97
|
-
* `VERCEL_OIDC_TOKEN`). Returns `null` when the request targets a non-Ash
|
|
98
|
-
* route, a local dev server, or no token is available.
|
|
99
|
-
*/
|
|
100
|
-
function resolveAshRouteOidcTokenSync(headers, resourceUrl) {
|
|
101
|
-
if (!shouldResolveAshRouteOidcToken(resourceUrl)) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
const requestToken = headers.get(VERCEL_OIDC_TOKEN_HEADER)?.trim();
|
|
105
|
-
if (requestToken) {
|
|
106
|
-
return requestToken;
|
|
107
|
-
}
|
|
108
|
-
const environmentToken = process.env.VERCEL_OIDC_TOKEN?.trim();
|
|
109
|
-
if (environmentToken) {
|
|
110
|
-
return environmentToken;
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Async variant of {@link resolveAshRouteOidcTokenSync} that also asks
|
|
116
|
+
* Resolves an OIDC token for an Ash-owned request, asking
|
|
116
117
|
* `@vercel/oidc` for a freshly-issued token when the CLI is linked to a
|
|
117
|
-
* Vercel project. Falls back to
|
|
118
|
-
*
|
|
118
|
+
* Vercel project. Falls back to the forwarded runtime header or the
|
|
119
|
+
* `VERCEL_OIDC_TOKEN` environment variable.
|
|
119
120
|
*/
|
|
120
121
|
async function resolveAshRouteOidcToken(headers, resourceUrl) {
|
|
121
122
|
if (!shouldResolveAshRouteOidcToken(resourceUrl)) {
|
|
@@ -146,17 +147,8 @@ function shouldResolveAshRouteOidcToken(resourceUrl) {
|
|
|
146
147
|
return true;
|
|
147
148
|
}
|
|
148
149
|
async function resolveLocalDevelopmentOidcToken() {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
const token = (await getVercelOidcToken()).trim();
|
|
152
|
-
if (token.length > 0) {
|
|
153
|
-
return token;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return environmentToken ?? null;
|
|
158
|
-
}
|
|
159
|
-
return environmentToken ?? null;
|
|
150
|
+
const token = await resolveDevelopmentOidcToken();
|
|
151
|
+
return token.length > 0 ? token : null;
|
|
160
152
|
}
|
|
161
153
|
function resolveDevelopmentHeadersInit(headers) {
|
|
162
154
|
if (headers === undefined) {
|
|
@@ -170,3 +162,36 @@ function resolveDevelopmentHeadersInit(headers) {
|
|
|
170
162
|
}
|
|
171
163
|
return headers;
|
|
172
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Resolves the per-request custom headers used by the development client
|
|
167
|
+
* when constructing requests against a configured server URL.
|
|
168
|
+
*
|
|
169
|
+
* - {@link VERCEL_PROTECTION_BYPASS_HEADER} is attached when
|
|
170
|
+
* `VERCEL_AUTOMATION_BYPASS_SECRET` is set.
|
|
171
|
+
* - {@link VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER} is attached when a Vercel
|
|
172
|
+
* OIDC token is available locally (either via `vercel link` +
|
|
173
|
+
* `@vercel/oidc` or via the `VERCEL_OIDC_TOKEN` environment variable).
|
|
174
|
+
* This lets the CLI bypass Vercel Deployment Protection without the user
|
|
175
|
+
* creating a project-scoped Bypass for Automation token first.
|
|
176
|
+
*
|
|
177
|
+
* Both headers are sent when both sources are available; the platform
|
|
178
|
+
* accepts whichever it can validate.
|
|
179
|
+
*
|
|
180
|
+
* Local dev servers skip the OIDC token entirely — the framework's
|
|
181
|
+
* default channel auth falls back to `none()` off Vercel infrastructure,
|
|
182
|
+
* so attaching the bypass token would be wasted work.
|
|
183
|
+
*/
|
|
184
|
+
export async function resolveDevelopmentClientHeaders(input) {
|
|
185
|
+
const headers = {};
|
|
186
|
+
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
|
|
187
|
+
if (bypassSecret) {
|
|
188
|
+
headers[VERCEL_PROTECTION_BYPASS_HEADER] = bypassSecret;
|
|
189
|
+
}
|
|
190
|
+
if (!isLocalDevelopmentServerUrl(input.serverUrl)) {
|
|
191
|
+
const oidcToken = await resolveDevelopmentOidcToken();
|
|
192
|
+
if (oidcToken.length > 0) {
|
|
193
|
+
headers[VERCEL_TRUSTED_OIDC_IDP_TOKEN_HEADER] = oidcToken;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return headers;
|
|
197
|
+
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
2
|
-
/**
|
|
3
|
-
* Reads newline-delimited message workflow events from the current response
|
|
4
|
-
* body.
|
|
5
|
-
*/
|
|
6
|
-
export declare function readMessageStreamEvents(input: {
|
|
7
|
-
onEvent?(event: HandleMessageStreamEvent): void;
|
|
8
|
-
response: Response;
|
|
9
|
-
startAfterBoundaryCount?: number;
|
|
10
|
-
stopWhen?(event: HandleMessageStreamEvent): boolean;
|
|
11
|
-
}): Promise<HandleMessageStreamEvent[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Extracts the final completed assistant message text from a streamed message
|
|
14
|
-
* workflow result.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extractCompletedMessage(events: HandleMessageStreamEvent[]): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Counts boundary events in one stream slice.
|
|
19
|
-
*/
|
|
20
|
-
export declare function countCurrentTurnBoundaryEvents(events: readonly HandleMessageStreamEvent[]): number;
|
|
21
2
|
/**
|
|
22
3
|
* Returns the last boundary event observed for the current streamed turn slice.
|
|
23
4
|
*/
|
|
@@ -1,41 +1,4 @@
|
|
|
1
1
|
import { isCurrentTurnBoundaryEvent } from "#protocol/message.js";
|
|
2
|
-
import { openDevelopmentMessageStream } from "#services/dev-client/live-stream.js";
|
|
3
|
-
function isMessageCompletedEvent(event) {
|
|
4
|
-
return event.type === "message.completed";
|
|
5
|
-
}
|
|
6
|
-
function isFinalMessageCompletedEvent(event) {
|
|
7
|
-
return isMessageCompletedEvent(event) && event.data.finishReason !== "tool-calls";
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Reads newline-delimited message workflow events from the current response
|
|
11
|
-
* body.
|
|
12
|
-
*/
|
|
13
|
-
export async function readMessageStreamEvents(input) {
|
|
14
|
-
const stream = openDevelopmentMessageStream({
|
|
15
|
-
resourceUrl: "",
|
|
16
|
-
response: input.response,
|
|
17
|
-
});
|
|
18
|
-
try {
|
|
19
|
-
return await stream.readEvents(input);
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
await stream.close();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Extracts the final completed assistant message text from a streamed message
|
|
27
|
-
* workflow result.
|
|
28
|
-
*/
|
|
29
|
-
export function extractCompletedMessage(events) {
|
|
30
|
-
const completedEvent = [...events].reverse().find(isFinalMessageCompletedEvent);
|
|
31
|
-
return completedEvent?.data.message ?? undefined;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Counts boundary events in one stream slice.
|
|
35
|
-
*/
|
|
36
|
-
export function countCurrentTurnBoundaryEvents(events) {
|
|
37
|
-
return events.filter(isCurrentTurnBoundaryEvent).length;
|
|
38
|
-
}
|
|
39
2
|
/**
|
|
40
3
|
* Returns the last boundary event observed for the current streamed turn slice.
|
|
41
4
|
*/
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves one Ash route against the configured development server URL.
|
|
3
|
-
*/
|
|
4
|
-
export declare function resolveDevelopmentServerRouteUrl(input: {
|
|
5
|
-
routePath: string;
|
|
6
|
-
serverUrl: string;
|
|
7
|
-
}): URL;
|
|
8
1
|
/**
|
|
9
2
|
* Resolves one server-provided resource reference against the configured
|
|
10
3
|
* development server URL.
|
|
4
|
+
*
|
|
5
|
+
* Absolute resource URLs are returned untouched; relative routes are
|
|
6
|
+
* resolved against the development server base.
|
|
11
7
|
*/
|
|
12
8
|
export declare function resolveDevelopmentServerResourceUrl(input: {
|
|
13
9
|
resource: string;
|
|
@@ -7,15 +7,12 @@ function createDevelopmentServerBaseUrl(serverUrl) {
|
|
|
7
7
|
}
|
|
8
8
|
return url;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Resolves one Ash route against the configured development server URL.
|
|
12
|
-
*/
|
|
13
|
-
export function resolveDevelopmentServerRouteUrl(input) {
|
|
14
|
-
return new URL(input.routePath.replace(/^\/+/, ""), createDevelopmentServerBaseUrl(input.serverUrl));
|
|
15
|
-
}
|
|
16
10
|
/**
|
|
17
11
|
* Resolves one server-provided resource reference against the configured
|
|
18
12
|
* development server URL.
|
|
13
|
+
*
|
|
14
|
+
* Absolute resource URLs are returned untouched; relative routes are
|
|
15
|
+
* resolved against the development server base.
|
|
19
16
|
*/
|
|
20
17
|
export function resolveDevelopmentServerResourceUrl(input) {
|
|
21
18
|
const resource = input.resource.trim();
|
|
@@ -23,9 +20,6 @@ export function resolveDevelopmentServerResourceUrl(input) {
|
|
|
23
20
|
return new URL(resource);
|
|
24
21
|
}
|
|
25
22
|
catch {
|
|
26
|
-
return
|
|
27
|
-
routePath: resource,
|
|
28
|
-
serverUrl: input.serverUrl,
|
|
29
|
-
});
|
|
23
|
+
return new URL(resource.replace(/^\/+/, ""), createDevelopmentServerBaseUrl(input.serverUrl));
|
|
30
24
|
}
|
|
31
25
|
}
|