experimental-ash 0.16.2 → 0.17.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 +36 -0
- package/dist/docs/public/channels/README.md +71 -0
- package/dist/docs/public/schedules.md +35 -0
- package/dist/src/channel/cross-channel-receive.d.ts +61 -0
- package/dist/src/channel/cross-channel-receive.js +50 -0
- package/dist/src/channel/receive-args.d.ts +17 -0
- package/dist/src/channel/receive-args.js +1 -0
- package/dist/src/channel/routes.d.ts +9 -0
- package/dist/src/channel/schedule.js +8 -15
- package/dist/src/chunks/{dev-authored-source-watcher-D2Lz_4ud.js → dev-authored-source-watcher-B5J6JK7p.js} +1 -1
- package/dist/src/chunks/{host-B2D2qXsD.js → host-ByUKG--q.js} +2 -2
- package/dist/src/chunks/{paths-BYA-Yank.js → paths-CFoo44rU.js} +3 -3
- package/dist/src/chunks/{prewarm-C4x0CPRP.js → prewarm-BLFoNX7E.js} +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +8 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -2
- package/dist/src/execution/sandbox/bindings/vercel.js +8 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +3 -0
- package/dist/src/public/channels/ash.d.ts +2 -2
- package/dist/src/public/channels/slack/attachments.d.ts +3 -0
- package/dist/src/public/channels/slack/attachments.js +6 -1
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +24 -4
- package/dist/src/public/channels/slack/slackChannel.js +26 -4
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +2 -1
- package/dist/src/public/channels/upload-policy.d.ts +23 -16
- package/dist/src/public/channels/upload-policy.js +26 -9
- package/dist/src/public/definitions/sandbox.d.ts +3 -3
- package/dist/src/public/definitions/schedule.d.ts +2 -16
- package/dist/src/public/sandbox/backends/vercel.d.ts +5 -5
- package/dist/src/public/sandbox/backends/vercel.js +3 -3
- package/dist/src/public/sandbox/index.d.ts +2 -2
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +13 -0
- package/dist/src/runtime/resolve-channel.js +1 -0
- package/dist/src/runtime/types.d.ts +8 -0
- package/dist/src/shared/sandbox-backend.d.ts +7 -7
- package/dist/src/shared/sandbox-definition.d.ts +7 -12
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TypedReceiveRoute } from "#channel/receive-args.js";
|
|
1
2
|
import type { SessionAuthContext } from "#channel/types.js";
|
|
2
3
|
import type { HandleMessageStreamEvent } from "#protocol/message.js";
|
|
3
4
|
import { type TwilioApiOptions, type TwilioApiResponse, type TwilioCredentials } from "#public/channels/twilio/api.js";
|
|
@@ -172,7 +173,7 @@ export interface TwilioSendMessageOptions {
|
|
|
172
173
|
readonly statusCallbackUrl?: string;
|
|
173
174
|
}
|
|
174
175
|
/** Concrete return type of {@link twilioChannel}. */
|
|
175
|
-
export interface TwilioChannel extends Channel<TwilioChannelState> {
|
|
176
|
+
export interface TwilioChannel extends Channel<TwilioChannelState>, TypedReceiveRoute<TwilioReceiveArgs> {
|
|
176
177
|
}
|
|
177
178
|
/** Twilio channel factory for SMS and speech-transcribed inbound calls. */
|
|
178
179
|
export declare function twilioChannel(config: TwilioChannelConfig): TwilioChannel;
|
|
@@ -3,25 +3,29 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { FilePart, UserContent } from "ai";
|
|
5
5
|
/**
|
|
6
|
-
* Framework policy for inbound attachments.
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* Framework policy for inbound attachments. Either the literal
|
|
7
|
+
* `"disabled"` (reject every attachment) or a structural config.
|
|
8
|
+
*/
|
|
9
|
+
export type UploadPolicy = "disabled" | UploadPolicyConfig;
|
|
10
|
+
/**
|
|
11
|
+
* - `maxBytes` caps the decoded payload size. Zero also rejects every
|
|
12
|
+
* attachment; negative values are invalid.
|
|
13
|
+
* - `allowedMediaTypes` is either `"*"` or a list of exact or wildcard
|
|
14
|
+
* patterns. A pattern ending in `/*` matches any subtype (e.g.
|
|
15
|
+
* `image/*` matches `image/png`).
|
|
14
16
|
*/
|
|
15
|
-
export interface
|
|
17
|
+
export interface UploadPolicyConfig {
|
|
16
18
|
readonly maxBytes: number;
|
|
17
19
|
readonly allowedMediaTypes: readonly string[] | "*";
|
|
18
20
|
}
|
|
21
|
+
/** Author-facing input accepted by channel factories. */
|
|
22
|
+
export type UploadPolicyInput = "disabled" | Partial<UploadPolicyConfig>;
|
|
19
23
|
/**
|
|
20
24
|
* Framework default: 25 MB cap, unrestricted media types. Channels
|
|
21
25
|
* override this per-route; authors override per-channel /
|
|
22
26
|
* channel factory call via the `uploadPolicy` option.
|
|
23
27
|
*/
|
|
24
|
-
export declare const DEFAULT_UPLOAD_POLICY:
|
|
28
|
+
export declare const DEFAULT_UPLOAD_POLICY: UploadPolicyConfig;
|
|
25
29
|
/**
|
|
26
30
|
* Describes the reason one inbound `FilePart` failed the policy check.
|
|
27
31
|
*
|
|
@@ -43,13 +47,16 @@ export type UploadPolicyViolation = {
|
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* Produces a final {@link UploadPolicy} by merging an optional partial
|
|
46
|
-
* override on top of {@link DEFAULT_UPLOAD_POLICY}
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
* override on top of `base` (default: {@link DEFAULT_UPLOAD_POLICY}).
|
|
51
|
+
* Returns `"disabled"` unchanged when passed as the override.
|
|
52
|
+
*/
|
|
53
|
+
export declare function mergeUploadPolicy(override?: UploadPolicyInput, base?: UploadPolicyConfig): UploadPolicy;
|
|
54
|
+
/**
|
|
55
|
+
* Returns `true` when `policy` rejects every attachment — the explicit
|
|
56
|
+
* `"disabled"` literal, `maxBytes: 0`, or an empty `allowedMediaTypes`
|
|
57
|
+
* array. Channels use this to skip attachment-discovery work.
|
|
51
58
|
*/
|
|
52
|
-
export declare function
|
|
59
|
+
export declare function isUploadsDisabled(policy: UploadPolicy): boolean;
|
|
53
60
|
/**
|
|
54
61
|
* Returns `true` if `mediaType` is accepted under `policy`.
|
|
55
62
|
*/
|
|
@@ -13,16 +13,14 @@ export const DEFAULT_UPLOAD_POLICY = Object.freeze({
|
|
|
13
13
|
});
|
|
14
14
|
/**
|
|
15
15
|
* Produces a final {@link UploadPolicy} by merging an optional partial
|
|
16
|
-
* override on top of {@link DEFAULT_UPLOAD_POLICY}
|
|
17
|
-
*
|
|
18
|
-
* Unset fields fall through to the base policy. Callers must validate
|
|
19
|
-
* structural invariants (`maxBytes >= 0`) upstream — this helper only
|
|
20
|
-
* does field-level merge.
|
|
16
|
+
* override on top of `base` (default: {@link DEFAULT_UPLOAD_POLICY}).
|
|
17
|
+
* Returns `"disabled"` unchanged when passed as the override.
|
|
21
18
|
*/
|
|
22
19
|
export function mergeUploadPolicy(override, base = DEFAULT_UPLOAD_POLICY) {
|
|
23
|
-
if (override ===
|
|
20
|
+
if (override === "disabled")
|
|
21
|
+
return "disabled";
|
|
22
|
+
if (override === undefined)
|
|
24
23
|
return base;
|
|
25
|
-
}
|
|
26
24
|
const maxBytes = override.maxBytes ?? base.maxBytes;
|
|
27
25
|
const allowedMediaTypes = override.allowedMediaTypes ?? base.allowedMediaTypes;
|
|
28
26
|
if (maxBytes < 0 || !Number.isFinite(maxBytes)) {
|
|
@@ -30,10 +28,26 @@ export function mergeUploadPolicy(override, base = DEFAULT_UPLOAD_POLICY) {
|
|
|
30
28
|
}
|
|
31
29
|
return { allowedMediaTypes, maxBytes };
|
|
32
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns `true` when `policy` rejects every attachment — the explicit
|
|
33
|
+
* `"disabled"` literal, `maxBytes: 0`, or an empty `allowedMediaTypes`
|
|
34
|
+
* array. Channels use this to skip attachment-discovery work.
|
|
35
|
+
*/
|
|
36
|
+
export function isUploadsDisabled(policy) {
|
|
37
|
+
if (policy === "disabled")
|
|
38
|
+
return true;
|
|
39
|
+
if (policy.maxBytes === 0)
|
|
40
|
+
return true;
|
|
41
|
+
if (Array.isArray(policy.allowedMediaTypes) && policy.allowedMediaTypes.length === 0)
|
|
42
|
+
return true;
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
33
45
|
/**
|
|
34
46
|
* Returns `true` if `mediaType` is accepted under `policy`.
|
|
35
47
|
*/
|
|
36
48
|
export function isMediaTypeAllowed(mediaType, policy) {
|
|
49
|
+
if (policy === "disabled")
|
|
50
|
+
return false;
|
|
37
51
|
if (policy.allowedMediaTypes === "*") {
|
|
38
52
|
return true;
|
|
39
53
|
}
|
|
@@ -64,9 +78,12 @@ export function isMediaTypeAllowed(mediaType, policy) {
|
|
|
64
78
|
* proxies enforce policy.
|
|
65
79
|
*/
|
|
66
80
|
export function evaluateFilePart(part, policy) {
|
|
67
|
-
if (!isMediaTypeAllowed(part.mediaType, policy)) {
|
|
81
|
+
if (policy === "disabled" || !isMediaTypeAllowed(part.mediaType, policy)) {
|
|
82
|
+
const allowedMediaTypes = policy === "disabled" || policy.allowedMediaTypes === "*"
|
|
83
|
+
? []
|
|
84
|
+
: [...policy.allowedMediaTypes];
|
|
68
85
|
const violation = {
|
|
69
|
-
allowedMediaTypes
|
|
86
|
+
allowedMediaTypes,
|
|
70
87
|
kind: "disallowed-media-type",
|
|
71
88
|
mediaType: part.mediaType,
|
|
72
89
|
};
|
|
@@ -2,9 +2,9 @@ import type { Optional } from "#shared/optional.js";
|
|
|
2
2
|
import type { SandboxSession } from "#shared/sandbox-session.js";
|
|
3
3
|
import type { SandboxDefinition as SharedSandboxDefinition } from "#shared/sandbox-definition.js";
|
|
4
4
|
export type { SandboxCommandOptions, SandboxCommandResult, SandboxReadTextFileOptions, SandboxSession, SandboxWriteTextFileOptions, } from "#shared/sandbox-session.js";
|
|
5
|
-
export type {
|
|
6
|
-
export type SandboxDefinition<S extends SandboxSession = SandboxSession,
|
|
5
|
+
export type { SandboxBootstrapUseFn, SandboxSessionUseFn, SandboxBootstrapContext, SandboxSessionContext, } from "#shared/sandbox-definition.js";
|
|
6
|
+
export type SandboxDefinition<S extends SandboxSession = SandboxSession, BO = Record<string, never>, SO = Record<string, never>> = Optional<SharedSandboxDefinition<S, BO, SO>, "backend">;
|
|
7
7
|
/**
|
|
8
8
|
* Defines a sandbox configuration.
|
|
9
9
|
*/
|
|
10
|
-
export declare function defineSandbox<S extends SandboxSession = SandboxSession,
|
|
10
|
+
export declare function defineSandbox<S extends SandboxSession = SandboxSession, BO = Record<string, never>, SO = Record<string, never>>(definition: SandboxDefinition<S, BO, SO>): SandboxDefinition<S, BO, SO>;
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* A route that declares its receive args type. Channel route factories
|
|
4
|
-
* return this so {@link receive} can infer the
|
|
5
|
-
* correct args type from the channel import.
|
|
6
|
-
*
|
|
7
|
-
* Accepts both old Route-style and new CompiledChannel values.
|
|
8
|
-
*/
|
|
9
|
-
export interface TypedReceiveRoute<TArgs = Record<string, unknown>> {
|
|
10
|
-
readonly [receiveArgsMarker]?: TArgs;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Extracts the receive args type from a channel value.
|
|
14
|
-
*/
|
|
15
|
-
type InferReceiveArgs<TChannel> = TChannel extends TypedReceiveRoute<infer TArgs> ? TArgs : Record<string, unknown>;
|
|
1
|
+
import type { InferReceiveArgs, TypedReceiveRoute } from "#channel/receive-args.js";
|
|
2
|
+
export type { InferReceiveArgs, TypedReceiveRoute } from "#channel/receive-args.js";
|
|
16
3
|
/**
|
|
17
4
|
* A channel reference with typed args, produced by {@link receive}.
|
|
18
5
|
* Carries the route/channel object for identity resolution at compile time
|
|
@@ -80,4 +67,3 @@ export interface ScheduleDefinition {
|
|
|
80
67
|
* ```
|
|
81
68
|
*/
|
|
82
69
|
export declare function defineSchedule<TSchedule extends ScheduleDefinition>(definition: TSchedule): TSchedule;
|
|
83
|
-
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
|
|
2
|
-
import type { VercelSandbox, VercelSandboxSessionUseOptions } from "#public/sandbox/vercel-sandbox.js";
|
|
2
|
+
import type { VercelSandbox, VercelSandboxBootstrapUseOptions, VercelSandboxSessionUseOptions } from "#public/sandbox/vercel-sandbox.js";
|
|
3
3
|
/**
|
|
4
4
|
* Constructs the built-in Vercel sandbox backend.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
6
|
+
* `bootstrap({ use })` applies its options to the template via
|
|
7
|
+
* `sandbox.update(...)`; those settings persist into the snapshot.
|
|
8
|
+
* `onSession({ use })` applies its options to the live session via
|
|
9
9
|
* `VercelSandbox.update()`.
|
|
10
10
|
*/
|
|
11
|
-
export declare function vercelBackend(): SandboxBackend<VercelSandbox, VercelSandboxSessionUseOptions>;
|
|
11
|
+
export declare function vercelBackend(): SandboxBackend<VercelSandbox, VercelSandboxBootstrapUseOptions, VercelSandboxSessionUseOptions>;
|
|
@@ -2,9 +2,9 @@ import { createVercelSandboxBackend } from "#execution/sandbox/bindings/vercel.j
|
|
|
2
2
|
/**
|
|
3
3
|
* Constructs the built-in Vercel sandbox backend.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
5
|
+
* `bootstrap({ use })` applies its options to the template via
|
|
6
|
+
* `sandbox.update(...)`; those settings persist into the snapshot.
|
|
7
|
+
* `onSession({ use })` applies its options to the live session via
|
|
8
8
|
* `VercelSandbox.update()`.
|
|
9
9
|
*/
|
|
10
10
|
export function vercelBackend() {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* `agent/sandbox/sandbox.ts` when paired with a `workspace/` folder).
|
|
4
4
|
*/
|
|
5
5
|
export { getSandbox } from "#context/accessors.js";
|
|
6
|
-
export { defineSandbox, type SandboxBootstrapContext, type SandboxBootstrapUseFn, type
|
|
6
|
+
export { defineSandbox, type SandboxBootstrapContext, type SandboxBootstrapUseFn, type SandboxCommandOptions, type SandboxCommandResult, type SandboxDefinition, type SandboxReadTextFileOptions, type SandboxSession, type SandboxSessionContext, type SandboxSessionUseFn, type SandboxWriteTextFileOptions, } from "#public/definitions/sandbox.js";
|
|
7
7
|
export type { SandboxBackend, SandboxBackendCreateInput, SandboxBackendHandle, SandboxBackendPrewarmInput, SandboxBackendRuntimeContext, SandboxBackendSessionState, SandboxSeedFile, } from "#public/definitions/sandbox-backend.js";
|
|
8
8
|
export { SandboxTemplateNotProvisionedError } from "#public/definitions/sandbox-backend.js";
|
|
9
9
|
export { defaultBackend } from "#public/sandbox/backends/default.js";
|
|
10
10
|
export { localBackend } from "#public/sandbox/backends/local.js";
|
|
11
11
|
export { vercelBackend } from "#public/sandbox/backends/vercel.js";
|
|
12
|
-
export type { VercelSandbox, VercelSandboxSessionUseOptions, } from "#public/sandbox/vercel-sandbox.js";
|
|
12
|
+
export type { VercelSandbox, VercelSandboxBootstrapUseOptions, VercelSandboxSessionUseOptions, } from "#public/sandbox/vercel-sandbox.js";
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { SandboxUpdateParams } from "#compiled/@vercel/sandbox/index.js";
|
|
2
2
|
import type { SandboxSession } from "#public/definitions/sandbox.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options accepted by the Vercel backend's `bootstrap({ use })` hook.
|
|
5
|
+
* Aliases the Vercel SDK's `SandboxUpdateParams` because bootstrap
|
|
6
|
+
* applies its options to the template via `sandbox.update(...)` after
|
|
7
|
+
* `Sandbox.create()` and before the snapshot is captured. The Vercel
|
|
8
|
+
* SDK persists `update`-d settings on the sandbox so they survive into
|
|
9
|
+
* the snapshot, which becomes the seed for every later session.
|
|
10
|
+
*
|
|
11
|
+
* Today this is the same shape as
|
|
12
|
+
* {@link VercelSandboxSessionUseOptions}; both are exposed as separate
|
|
13
|
+
* named aliases so future divergence is non-breaking.
|
|
14
|
+
*/
|
|
15
|
+
export type VercelSandboxBootstrapUseOptions = SandboxUpdateParams;
|
|
3
16
|
/**
|
|
4
17
|
* Options accepted by the Vercel backend's `onSession({ use })` hook
|
|
5
18
|
* and `VercelSandbox.update()`. Aliases the Vercel SDK's
|
|
@@ -187,6 +187,14 @@ export interface ResolvedChannelDefinition extends ResolvedModuleSourceRef {
|
|
|
187
187
|
* accepting a different shape.
|
|
188
188
|
*/
|
|
189
189
|
readonly receive?: CompiledChannel["receive"];
|
|
190
|
+
/**
|
|
191
|
+
* Reference to the authored {@link CompiledChannel} value the channel
|
|
192
|
+
* module exported. Preserved so callers of `args.receive(channel, …)`
|
|
193
|
+
* can identify a target by the same imported reference. `undefined`
|
|
194
|
+
* for framework-internal channels constructed without going through
|
|
195
|
+
* `defineChannel`.
|
|
196
|
+
*/
|
|
197
|
+
readonly definition?: CompiledChannel;
|
|
190
198
|
/**
|
|
191
199
|
* New-style route handler from CompiledChannel. When present, the
|
|
192
200
|
* dispatch layer uses this instead of `fetch`.
|
|
@@ -7,9 +7,9 @@ import type { SandboxSession } from "#shared/sandbox-session.js";
|
|
|
7
7
|
* runtime orchestrator can persist reconnect metadata and release
|
|
8
8
|
* resources.
|
|
9
9
|
*/
|
|
10
|
-
export interface SandboxBackendHandle<S extends SandboxSession = SandboxSession,
|
|
10
|
+
export interface SandboxBackendHandle<S extends SandboxSession = SandboxSession, SO = Record<string, never>> {
|
|
11
11
|
readonly session: SandboxSession;
|
|
12
|
-
readonly useSessionFn: SandboxSessionUseFn<S,
|
|
12
|
+
readonly useSessionFn: SandboxSessionUseFn<S, SO>;
|
|
13
13
|
captureState(): Promise<SandboxBackendSessionState>;
|
|
14
14
|
dispose(): Promise<void>;
|
|
15
15
|
}
|
|
@@ -79,9 +79,9 @@ export interface SandboxBackendCreateInput {
|
|
|
79
79
|
* `bootstrap` hook and `seedFiles`, then `backend.create(...)` opens
|
|
80
80
|
* durable sessions from that snapshot.
|
|
81
81
|
*/
|
|
82
|
-
export interface SandboxBackendPrewarmInput {
|
|
82
|
+
export interface SandboxBackendPrewarmInput<BO = Record<string, never>> {
|
|
83
83
|
readonly templateKey: string;
|
|
84
|
-
readonly bootstrap?: (input: SandboxBootstrapContext) => void | Promise<void>;
|
|
84
|
+
readonly bootstrap?: (input: SandboxBootstrapContext<BO>) => void | Promise<void>;
|
|
85
85
|
readonly runtimeContext: SandboxBackendRuntimeContext;
|
|
86
86
|
readonly seedFiles: ReadonlyArray<SandboxSeedFile>;
|
|
87
87
|
}
|
|
@@ -97,7 +97,7 @@ export interface SandboxBackendPrewarmInput {
|
|
|
97
97
|
* Each backend owns the full template-then-session lifecycle internally;
|
|
98
98
|
* callers only need a single `create` call.
|
|
99
99
|
*/
|
|
100
|
-
export interface SandboxBackend<S extends SandboxSession = SandboxSession,
|
|
100
|
+
export interface SandboxBackend<S extends SandboxSession = SandboxSession, BO = Record<string, never>, SO = Record<string, never>> {
|
|
101
101
|
/**
|
|
102
102
|
* Stable identifier for this backend implementation.
|
|
103
103
|
*
|
|
@@ -113,12 +113,12 @@ export interface SandboxBackend<S extends SandboxSession = SandboxSession, O = R
|
|
|
113
113
|
* {@link SandboxTemplateNotProvisionedError} when the requested
|
|
114
114
|
* template is missing.
|
|
115
115
|
*/
|
|
116
|
-
create(input: SandboxBackendCreateInput): Promise<SandboxBackendHandle<S,
|
|
116
|
+
create(input: SandboxBackendCreateInput): Promise<SandboxBackendHandle<S, SO>>;
|
|
117
117
|
/**
|
|
118
118
|
* Build-time prewarm hook. Ash invokes this for every authored
|
|
119
119
|
* sandbox in the compiled graph before serving traffic so the backend
|
|
120
120
|
* can capture a reusable template snapshot. Idempotent against an
|
|
121
121
|
* existing snapshot keyed by `templateKey`.
|
|
122
122
|
*/
|
|
123
|
-
prewarm(input: SandboxBackendPrewarmInput): Promise<void>;
|
|
123
|
+
prewarm(input: SandboxBackendPrewarmInput<BO>): Promise<void>;
|
|
124
124
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { SandboxSession } from "#shared/sandbox-session.js";
|
|
2
2
|
import type { SandboxBackend } from "#shared/sandbox-backend.js";
|
|
3
|
-
export
|
|
4
|
-
readonly runtime?: string;
|
|
5
|
-
readonly ports?: number[];
|
|
6
|
-
readonly env?: Record<string, string>;
|
|
7
|
-
}
|
|
8
|
-
export type SandboxBootstrapUseFn = (options?: SandboxBootstrapUseOptions) => Promise<SandboxSession>;
|
|
3
|
+
export type SandboxBootstrapUseFn<O = Record<string, never>> = (options?: O) => Promise<SandboxSession>;
|
|
9
4
|
export type SandboxSessionUseFn<S extends SandboxSession = SandboxSession, O = Record<string, never>> = (options?: O) => Promise<S>;
|
|
10
|
-
export interface SandboxBootstrapContext {
|
|
11
|
-
readonly use: SandboxBootstrapUseFn
|
|
5
|
+
export interface SandboxBootstrapContext<O = Record<string, never>> {
|
|
6
|
+
readonly use: SandboxBootstrapUseFn<O>;
|
|
12
7
|
}
|
|
13
8
|
export interface SandboxSessionContext<S extends SandboxSession = SandboxSession, O = Record<string, never>> {
|
|
14
9
|
readonly use: SandboxSessionUseFn<S, O>;
|
|
@@ -26,7 +21,7 @@ export interface SandboxSessionContext<S extends SandboxSession = SandboxSession
|
|
|
26
21
|
* `subagents/<name>/sandbox.ts` (or the folder form) and do not inherit
|
|
27
22
|
* their parent's sandbox (skill seeds differ per agent).
|
|
28
23
|
*/
|
|
29
|
-
export interface SandboxDefinition<S extends SandboxSession = SandboxSession,
|
|
24
|
+
export interface SandboxDefinition<S extends SandboxSession = SandboxSession, BO = Record<string, never>, SO = Record<string, never>> {
|
|
30
25
|
/**
|
|
31
26
|
* Backend that runs this sandbox.
|
|
32
27
|
*
|
|
@@ -36,7 +31,7 @@ export interface SandboxDefinition<S extends SandboxSession = SandboxSession, O
|
|
|
36
31
|
* everywhere else. Set `backend` explicitly to pin the sandbox to a
|
|
37
32
|
* specific backend regardless of environment.
|
|
38
33
|
*/
|
|
39
|
-
backend: SandboxBackend<S,
|
|
40
|
-
bootstrap?(input: SandboxBootstrapContext): Promise<void> | void;
|
|
41
|
-
onSession?(input: SandboxSessionContext<S,
|
|
34
|
+
backend: SandboxBackend<S, BO, SO>;
|
|
35
|
+
bootstrap?(input: SandboxBootstrapContext<BO>): Promise<void> | void;
|
|
36
|
+
onSession?(input: SandboxSessionContext<S, SO>): Promise<void> | void;
|
|
42
37
|
}
|