@finalai/agent-provider 0.8.0 → 0.10.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/HOSTING.md +334 -245
- package/README.md +93 -14
- package/dist/modules/canonical-json.d.mts +4 -0
- package/dist/modules/canonical-json.mjs +33 -0
- package/dist/modules/canonical-json.mjs.map +7 -0
- package/dist/modules/channel.d.mts +9 -3
- package/dist/modules/channel.mjs.map +2 -2
- package/dist/modules/code-host/host.d.mts +10 -0
- package/dist/modules/code-host/host.mjs +88 -0
- package/dist/modules/code-host/host.mjs.map +7 -0
- package/dist/modules/code-host/in-process.d.mts +24 -0
- package/dist/modules/code-host/in-process.mjs +89 -0
- package/dist/modules/code-host/in-process.mjs.map +7 -0
- package/dist/modules/code-host/index.d.mts +4 -0
- package/dist/modules/code-host/index.mjs +5 -0
- package/dist/modules/code-host/index.mjs.map +7 -0
- package/dist/modules/code-host/serverless.d.mts +63 -0
- package/dist/modules/code-host/serverless.mjs +27 -0
- package/dist/modules/code-host/serverless.mjs.map +7 -0
- package/dist/modules/code-host/types.d.mts +152 -0
- package/dist/modules/code-host/types.mjs +85 -0
- package/dist/modules/code-host/types.mjs.map +7 -0
- package/dist/modules/conformance/agent.mjs +72 -6
- package/dist/modules/conformance/agent.mjs.map +2 -2
- package/dist/modules/conformance/harness-kit.d.mts +9 -2
- package/dist/modules/conformance/harness-kit.mjs +224 -63
- package/dist/modules/conformance/harness-kit.mjs.map +3 -3
- package/dist/modules/conformance/local-harness.d.mts +1 -4
- package/dist/modules/conformance/local-harness.mjs +21 -22
- package/dist/modules/conformance/local-harness.mjs.map +2 -2
- package/dist/modules/conformance/protocol.d.mts +1 -0
- package/dist/modules/conformance/protocol.mjs +2 -0
- package/dist/modules/conformance/protocol.mjs.map +2 -2
- package/dist/modules/conformance/sandbox-kit.d.mts +12 -4
- package/dist/modules/conformance/sandbox-kit.mjs +189 -103
- package/dist/modules/conformance/sandbox-kit.mjs.map +2 -2
- package/dist/modules/conformance/scripted-model/chat-completions.mjs +1 -0
- package/dist/modules/conformance/scripted-model/chat-completions.mjs.map +2 -2
- package/dist/modules/conformance/scripted-model/directives.d.mts +3 -0
- package/dist/modules/conformance/scripted-model/directives.mjs +26 -10
- package/dist/modules/conformance/scripted-model/directives.mjs.map +2 -2
- package/dist/modules/conformance/scripted-model/messages.mjs +1 -0
- package/dist/modules/conformance/scripted-model/messages.mjs.map +2 -2
- package/dist/modules/conformance/scripted-model/responses.mjs +2 -0
- package/dist/modules/conformance/scripted-model/responses.mjs.map +2 -2
- package/dist/modules/conformance/stdio.d.mts +21 -0
- package/dist/modules/conformance/stdio.mjs +158 -0
- package/dist/modules/conformance/stdio.mjs.map +7 -0
- package/dist/modules/credential-routes.d.mts +2 -0
- package/dist/modules/credential-routes.mjs +2 -0
- package/dist/modules/credential-routes.mjs.map +2 -2
- package/dist/modules/document.d.mts +376 -0
- package/dist/modules/document.mjs +208 -0
- package/dist/modules/document.mjs.map +7 -0
- package/dist/modules/harness-configuration.d.mts +16 -0
- package/dist/modules/harness-configuration.mjs +83 -0
- package/dist/modules/harness-configuration.mjs.map +7 -0
- package/dist/modules/harness-definition.d.mts +280 -0
- package/dist/modules/harness-definition.mjs +430 -0
- package/dist/modules/harness-definition.mjs.map +7 -0
- package/dist/modules/harness-provider.d.mts +197 -0
- package/dist/modules/harness-provider.mjs +108 -0
- package/dist/modules/harness-provider.mjs.map +7 -0
- package/dist/modules/harness-requirements.d.mts +19 -0
- package/dist/modules/harness-requirements.mjs +40 -0
- package/dist/modules/harness-requirements.mjs.map +7 -0
- package/dist/modules/harness-start.d.mts +33 -0
- package/dist/modules/harness-start.mjs +107 -0
- package/dist/modules/harness-start.mjs.map +7 -0
- package/dist/modules/harness.d.mts +84 -109
- package/dist/modules/harness.mjs +56 -111
- package/dist/modules/harness.mjs.map +3 -3
- package/dist/modules/identity.d.mts +1 -0
- package/dist/modules/identity.mjs +2 -0
- package/dist/modules/identity.mjs.map +7 -0
- package/dist/modules/index.d.mts +12 -6
- package/dist/modules/index.mjs +12 -6
- package/dist/modules/index.mjs.map +2 -2
- package/dist/modules/inference.d.mts +35 -0
- package/dist/modules/inference.mjs +74 -0
- package/dist/modules/inference.mjs.map +7 -0
- package/dist/modules/local-channel-context.mjs +3 -1
- package/dist/modules/local-channel-context.mjs.map +2 -2
- package/dist/modules/requirements-check.d.mts +30 -0
- package/dist/modules/requirements-check.mjs +164 -0
- package/dist/modules/requirements-check.mjs.map +7 -0
- package/dist/modules/room-surface.d.mts +0 -5
- package/dist/modules/room-surface.mjs.map +2 -2
- package/dist/modules/sandbox/client.d.mts +3 -0
- package/dist/modules/sandbox/client.mjs +101 -18
- package/dist/modules/sandbox/client.mjs.map +2 -2
- package/dist/modules/sandbox/grant.d.mts +78 -0
- package/dist/modules/sandbox/grant.mjs +134 -0
- package/dist/modules/sandbox/grant.mjs.map +7 -0
- package/dist/modules/sandbox/index.d.mts +3 -3
- package/dist/modules/sandbox/index.mjs +4 -5
- package/dist/modules/sandbox/index.mjs.map +2 -2
- package/dist/modules/sandbox/mcp-hosted.d.mts +1 -1
- package/dist/modules/sandbox/mcp-hosted.mjs +4 -7
- package/dist/modules/sandbox/mcp-hosted.mjs.map +2 -2
- package/dist/modules/sandbox/mcp.d.mts +4 -2
- package/dist/modules/sandbox/mcp.mjs +14 -7
- package/dist/modules/sandbox/mcp.mjs.map +2 -2
- package/dist/modules/sandbox/memory-sandbox.d.mts +2 -1
- package/dist/modules/sandbox/memory-sandbox.mjs +71 -41
- package/dist/modules/sandbox/memory-sandbox.mjs.map +2 -2
- package/dist/modules/sandbox/networking.d.mts +7 -7
- package/dist/modules/sandbox/networking.mjs +16 -9
- package/dist/modules/sandbox/networking.mjs.map +2 -2
- package/dist/modules/sandbox/remote/adapter.d.mts +30 -0
- package/dist/modules/sandbox/remote/adapter.mjs +381 -0
- package/dist/modules/sandbox/remote/adapter.mjs.map +7 -0
- package/dist/modules/sandbox/remote/errors.d.mts +10 -0
- package/dist/modules/sandbox/remote/errors.mjs +62 -0
- package/dist/modules/sandbox/remote/errors.mjs.map +7 -0
- package/dist/modules/sandbox/remote/index.d.mts +5 -0
- package/dist/modules/sandbox/remote/index.mjs +6 -0
- package/dist/modules/sandbox/remote/index.mjs.map +7 -0
- package/dist/modules/sandbox/remote/ndjson.d.mts +6 -0
- package/dist/modules/sandbox/remote/ndjson.mjs +80 -0
- package/dist/modules/sandbox/remote/ndjson.mjs.map +7 -0
- package/dist/modules/sandbox/remote/platform-api.d.mts +8 -0
- package/dist/modules/sandbox/remote/platform-api.mjs +15 -0
- package/dist/modules/sandbox/remote/platform-api.mjs.map +7 -0
- package/dist/modules/sandbox/remote/preamble.d.mts +7 -0
- package/dist/modules/sandbox/remote/preamble.mjs +51 -0
- package/dist/modules/sandbox/remote/preamble.mjs.map +7 -0
- package/dist/modules/sandbox/remote/serve.d.mts +34 -0
- package/dist/modules/sandbox/remote/serve.mjs +519 -0
- package/dist/modules/sandbox/remote/serve.mjs.map +7 -0
- package/dist/modules/sandbox/remote/testing.d.mts +34 -0
- package/dist/modules/sandbox/remote/testing.mjs +275 -0
- package/dist/modules/sandbox/remote/testing.mjs.map +7 -0
- package/dist/modules/sandbox/seeds.d.mts +2 -2
- package/dist/modules/sandbox/seeds.mjs +2 -2
- package/dist/modules/sandbox/seeds.mjs.map +2 -2
- package/dist/modules/sandbox/server.d.mts +4 -6
- package/dist/modules/sandbox/server.mjs +93 -49
- package/dist/modules/sandbox/server.mjs.map +2 -2
- package/dist/modules/sandbox/setup/apply.d.mts +41 -0
- package/dist/modules/sandbox/setup/apply.mjs +204 -0
- package/dist/modules/sandbox/setup/apply.mjs.map +7 -0
- package/dist/modules/sandbox/setup/describe.d.mts +10 -0
- package/dist/modules/sandbox/setup/describe.mjs +62 -0
- package/dist/modules/sandbox/setup/describe.mjs.map +7 -0
- package/dist/modules/sandbox/setup/index.d.mts +6 -0
- package/dist/modules/sandbox/setup/index.mjs +17 -0
- package/dist/modules/sandbox/setup/index.mjs.map +7 -0
- package/dist/modules/sandbox/setup/paths.d.mts +8 -0
- package/dist/modules/sandbox/setup/paths.mjs +18 -0
- package/dist/modules/sandbox/setup/paths.mjs.map +7 -0
- package/dist/modules/sandbox/setup/schema.d.mts +42 -0
- package/dist/modules/sandbox/setup/schema.mjs +58 -0
- package/dist/modules/sandbox/setup/schema.mjs.map +7 -0
- package/dist/modules/sandbox/tool-policy.d.mts +1 -1
- package/dist/modules/sandbox/tool-policy.mjs +1 -1
- package/dist/modules/sandbox/tool-policy.mjs.map +2 -2
- package/dist/modules/sandbox/types.d.mts +117 -130
- package/dist/modules/sandbox/types.mjs +46 -50
- package/dist/modules/sandbox/types.mjs.map +3 -3
- package/dist/modules/sandbox/wire.d.mts +93 -6
- package/dist/modules/sandbox/wire.mjs +61 -38
- package/dist/modules/sandbox/wire.mjs.map +2 -2
- package/dist/modules/schemas.d.mts +5 -76
- package/dist/modules/schemas.mjs +18 -85
- package/dist/modules/schemas.mjs.map +2 -2
- package/dist/modules/tool-annotations.d.mts +15 -6
- package/dist/modules/tool-annotations.mjs +9 -3
- package/dist/modules/tool-annotations.mjs.map +2 -2
- package/dist/modules/tool-descriptor.d.mts +16 -0
- package/dist/modules/tool-descriptor.mjs +19 -0
- package/dist/modules/tool-descriptor.mjs.map +7 -0
- package/dist/modules/tool-patterns.d.mts +7 -7
- package/dist/modules/tool-patterns.mjs +10 -9
- package/dist/modules/tool-patterns.mjs.map +2 -2
- package/package.json +86 -36
- package/dist/modules/credentials.d.mts +0 -206
- package/dist/modules/credentials.mjs +0 -207
- package/dist/modules/credentials.mjs.map +0 -7
- package/dist/modules/dynamic.d.mts +0 -40
- package/dist/modules/dynamic.mjs +0 -79
- package/dist/modules/dynamic.mjs.map +0 -7
- package/dist/modules/hosted-bindings.d.mts +0 -15
- package/dist/modules/hosted-bindings.mjs +0 -21
- package/dist/modules/hosted-bindings.mjs.map +0 -7
- package/dist/modules/manifest.d.mts +0 -787
- package/dist/modules/manifest.mjs +0 -320
- package/dist/modules/manifest.mjs.map +0 -7
- package/dist/modules/provider-ref.d.mts +0 -29
- package/dist/modules/provider-ref.mjs +0 -55
- package/dist/modules/provider-ref.mjs.map +0 -7
- package/dist/modules/sandbox/open-scope-node.d.mts +0 -4
- package/dist/modules/sandbox/open-scope-node.mjs +0 -19
- package/dist/modules/sandbox/open-scope-node.mjs.map +0 -7
- package/dist/modules/sandbox/open-scope.d.mts +0 -16
- package/dist/modules/sandbox/open-scope.mjs +0 -66
- package/dist/modules/sandbox/open-scope.mjs.map +0 -7
- package/dist/modules/sandbox/workspace-identity.d.mts +0 -5
- package/dist/modules/sandbox/workspace-identity.mjs +0 -14
- package/dist/modules/sandbox/workspace-identity.mjs.map +0 -7
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { agentAvatarSchema } from "@finalai/agent-protocol";
|
|
3
|
-
import { containsDynamicSlot, DynamicEvent, maybeDynamic } from "./dynamic.mjs";
|
|
4
|
-
import { jsonObjectSchema, jsonSchemaSchema, jsonValueSchema } from "./json.mjs";
|
|
5
|
-
import { packageRef, providerRefSchema } from "./provider-ref.mjs";
|
|
6
|
-
import { agentAvatarSchema as agentAvatarSchema2, avatarMediaSchema } from "@finalai/agent-protocol";
|
|
7
|
-
const MANIFEST_VERSION = 4;
|
|
8
|
-
var BaseCapability = /* @__PURE__ */ ((BaseCapability2) => {
|
|
9
|
-
BaseCapability2["Shell"] = "shell";
|
|
10
|
-
BaseCapability2["Files"] = "files";
|
|
11
|
-
BaseCapability2["Process"] = "process";
|
|
12
|
-
BaseCapability2["Ports"] = "ports";
|
|
13
|
-
BaseCapability2["Browser"] = "browser";
|
|
14
|
-
BaseCapability2["ComputerUse"] = "computerUse";
|
|
15
|
-
return BaseCapability2;
|
|
16
|
-
})(BaseCapability || {});
|
|
17
|
-
var ToolApproval = /* @__PURE__ */ ((ToolApproval2) => {
|
|
18
|
-
ToolApproval2["Allow"] = "allow";
|
|
19
|
-
ToolApproval2["Ask"] = "ask";
|
|
20
|
-
return ToolApproval2;
|
|
21
|
-
})(ToolApproval || {});
|
|
22
|
-
var SandboxAccess = /* @__PURE__ */ ((SandboxAccess2) => {
|
|
23
|
-
SandboxAccess2["Read"] = "read";
|
|
24
|
-
SandboxAccess2["Execute"] = "execute";
|
|
25
|
-
SandboxAccess2["Write"] = "write";
|
|
26
|
-
return SandboxAccess2;
|
|
27
|
-
})(SandboxAccess || {});
|
|
28
|
-
const SANDBOX_ACCESS_RANK = {
|
|
29
|
-
["read" /* Read */]: 0,
|
|
30
|
-
["execute" /* Execute */]: 1,
|
|
31
|
-
["write" /* Write */]: 2
|
|
32
|
-
};
|
|
33
|
-
const sandboxAccessAtLeast = (access, floor) => SANDBOX_ACCESS_RANK[access] >= SANDBOX_ACCESS_RANK[floor];
|
|
34
|
-
const narrowerSandboxAccess = (a, b) => SANDBOX_ACCESS_RANK[a] <= SANDBOX_ACCESS_RANK[b] ? a : b;
|
|
35
|
-
var SandboxAttach = /* @__PURE__ */ ((SandboxAttach2) => {
|
|
36
|
-
SandboxAttach2["Lazy"] = "lazy";
|
|
37
|
-
SandboxAttach2["OnPrompt"] = "on-prompt";
|
|
38
|
-
return SandboxAttach2;
|
|
39
|
-
})(SandboxAttach || {});
|
|
40
|
-
var McpServerBindingKind = /* @__PURE__ */ ((McpServerBindingKind2) => {
|
|
41
|
-
McpServerBindingKind2["Worker"] = "worker";
|
|
42
|
-
McpServerBindingKind2["Http"] = "http";
|
|
43
|
-
return McpServerBindingKind2;
|
|
44
|
-
})(McpServerBindingKind || {});
|
|
45
|
-
var ScheduleTarget = /* @__PURE__ */ ((ScheduleTarget2) => {
|
|
46
|
-
ScheduleTarget2["OwnerDirect"] = "owner-direct";
|
|
47
|
-
ScheduleTarget2["BoundConversation"] = "bound-conversation";
|
|
48
|
-
return ScheduleTarget2;
|
|
49
|
-
})(ScheduleTarget || {});
|
|
50
|
-
var ScheduleDelivery = /* @__PURE__ */ ((ScheduleDelivery2) => {
|
|
51
|
-
ScheduleDelivery2["Always"] = "always";
|
|
52
|
-
ScheduleDelivery2["IfNeeded"] = "if_needed";
|
|
53
|
-
return ScheduleDelivery2;
|
|
54
|
-
})(ScheduleDelivery || {});
|
|
55
|
-
const identitySchema = z.object({
|
|
56
|
-
name: z.string().min(1).max(120),
|
|
57
|
-
description: z.string().max(2e3).nullable(),
|
|
58
|
-
avatar: agentAvatarSchema.optional()
|
|
59
|
-
});
|
|
60
|
-
var InputApprovalKind = /* @__PURE__ */ ((InputApprovalKind2) => {
|
|
61
|
-
InputApprovalKind2["Tool"] = "tool";
|
|
62
|
-
InputApprovalKind2["Connection"] = "connection";
|
|
63
|
-
return InputApprovalKind2;
|
|
64
|
-
})(InputApprovalKind || {});
|
|
65
|
-
const inputApprovalSchema = z.object({
|
|
66
|
-
kind: z.nativeEnum(InputApprovalKind),
|
|
67
|
-
export: z.string().min(1),
|
|
68
|
-
// Connection default when absent; otherwise tools.approval[policyKey].
|
|
69
|
-
policyKey: z.string().min(1).optional(),
|
|
70
|
-
dynamic: jsonObjectSchema.optional()
|
|
71
|
-
});
|
|
72
|
-
const toolDescriptorSchema = z.object({
|
|
73
|
-
name: z.string().min(1),
|
|
74
|
-
description: z.string(),
|
|
75
|
-
inputSchema: jsonSchemaSchema,
|
|
76
|
-
outputSchema: jsonSchemaSchema.optional(),
|
|
77
|
-
annotations: z.object({
|
|
78
|
-
title: z.string().optional(),
|
|
79
|
-
readOnlyHint: z.boolean().optional(),
|
|
80
|
-
destructiveHint: z.boolean().optional(),
|
|
81
|
-
idempotentHint: z.boolean().optional(),
|
|
82
|
-
openWorldHint: z.boolean().optional()
|
|
83
|
-
}).optional(),
|
|
84
|
-
// Bundle export implementing it ('tools/lookup_release_notes').
|
|
85
|
-
export: z.string().min(1).optional(),
|
|
86
|
-
// Boundary snapshot used to reconstruct dynamic tools after isolate eviction.
|
|
87
|
-
dynamic: jsonObjectSchema.optional(),
|
|
88
|
-
inputApproval: inputApprovalSchema.optional()
|
|
89
|
-
});
|
|
90
|
-
const mcpAuthSchema = z.union([
|
|
91
|
-
z.object({ secretKey: z.string().min(1), headerName: z.string().min(1).nullable() }),
|
|
92
|
-
// Resolved by the broker to a session-scoped grant (Final's own MCP server).
|
|
93
|
-
z.object({ kind: z.literal("final-session") })
|
|
94
|
-
]);
|
|
95
|
-
const toolApprovalsSchema = z.record(z.string(), z.nativeEnum(ToolApproval)).nullable();
|
|
96
|
-
const toolAnnotationSelectorSchema = z.strictObject({
|
|
97
|
-
readOnlyHint: z.boolean().optional(),
|
|
98
|
-
destructiveHint: z.boolean().optional(),
|
|
99
|
-
idempotentHint: z.boolean().optional(),
|
|
100
|
-
openWorldHint: z.boolean().optional()
|
|
101
|
-
}).refine((selector) => Object.keys(selector).length > 0, "Select at least one annotation");
|
|
102
|
-
const toolAnnotationRuleSchema = z.object({
|
|
103
|
-
match: toolAnnotationSelectorSchema,
|
|
104
|
-
approval: z.nativeEnum(ToolApproval),
|
|
105
|
-
inputApproval: inputApprovalSchema.optional()
|
|
106
|
-
});
|
|
107
|
-
const workerMcpServerBindingSchema = z.object({
|
|
108
|
-
key: z.string().min(1),
|
|
109
|
-
kind: z.literal("worker" /* Worker */),
|
|
110
|
-
tools: z.array(toolDescriptorSchema),
|
|
111
|
-
approvals: toolApprovalsSchema
|
|
112
|
-
});
|
|
113
|
-
const httpMcpServerBindingSchema = z.object({
|
|
114
|
-
key: z.string().min(1),
|
|
115
|
-
kind: z.literal("http" /* Http */),
|
|
116
|
-
url: z.string().url(),
|
|
117
|
-
auth: mcpAuthSchema.nullable(),
|
|
118
|
-
headers: z.record(z.string(), z.string()).default({}),
|
|
119
|
-
// Null allows every tool the server lists, each with the default approval.
|
|
120
|
-
// Keys are tool names or `*` patterns (./tool-patterns.ts); the most
|
|
121
|
-
// specific matching key governs a tool.
|
|
122
|
-
approvals: toolApprovalsSchema,
|
|
123
|
-
// Tool names or `*` patterns hidden even when `approvals` would expose them.
|
|
124
|
-
deny: z.array(z.string().min(1)).optional(),
|
|
125
|
-
// Exposed tools (names or `*` patterns) the harness lists up front. Absent
|
|
126
|
-
// lists every exposed tool; otherwise the host keeps the rest reachable
|
|
127
|
-
// through search (HOSTING.md).
|
|
128
|
-
load: z.array(z.string().min(1)).optional(),
|
|
129
|
-
// Tools also exposed by their MCP annotations; named tools keep `approvals`.
|
|
130
|
-
allowAnnotations: z.array(toolAnnotationRuleSchema).optional(),
|
|
131
|
-
// Tools hidden by their MCP annotations, whatever else exposes them.
|
|
132
|
-
denyAnnotations: z.array(toolAnnotationSelectorSchema).optional(),
|
|
133
|
-
// The authored resolver that produced this connection, for retained boundary values.
|
|
134
|
-
dynamicResolver: z.string().min(1).optional(),
|
|
135
|
-
inputApprovals: z.record(z.string(), inputApprovalSchema).optional()
|
|
136
|
-
});
|
|
137
|
-
const mcpServerBindingSchema = z.discriminatedUnion("kind", [
|
|
138
|
-
workerMcpServerBindingSchema,
|
|
139
|
-
httpMcpServerBindingSchema
|
|
140
|
-
]);
|
|
141
|
-
const sandboxCredentialRefSchema = z.strictObject({
|
|
142
|
-
secretRef: z.string().min(1).max(256)
|
|
143
|
-
});
|
|
144
|
-
const sandboxBindingSchema = z.object({
|
|
145
|
-
provider: providerRefSchema,
|
|
146
|
-
// Provider-defined environment options (`computer`: a setup guide reference or
|
|
147
|
-
// inline guide plus start-time parameters). Validated by the provider.
|
|
148
|
-
environment: maybeDynamic(jsonValueSchema),
|
|
149
|
-
access: z.nativeEnum(SandboxAccess).default("write" /* Write */),
|
|
150
|
-
attach: z.nativeEnum(SandboxAttach).default("lazy" /* Lazy */)
|
|
151
|
-
});
|
|
152
|
-
const baseToolsSchema = z.object({
|
|
153
|
-
base: z.partialRecord(z.nativeEnum(BaseCapability), z.object({ target: z.string().min(1) })),
|
|
154
|
-
// Capabilities declared on the harness's own host with no sandbox target
|
|
155
|
-
// (`baseTools({ shell: harnessHost })`): only a harness that
|
|
156
|
-
// provides them natively (host-disableable, host-fixed) can serve them.
|
|
157
|
-
host: z.array(z.nativeEnum(BaseCapability)).optional()
|
|
158
|
-
});
|
|
159
|
-
const channelCredentialsSchema = z.object({
|
|
160
|
-
app: z.string().nullable(),
|
|
161
|
-
secrets: z.array(z.string()).optional()
|
|
162
|
-
});
|
|
163
|
-
const channelSurfaceSchema = z.object({
|
|
164
|
-
routes: z.array(z.object({ method: z.string(), path: z.string() })),
|
|
165
|
-
listeners: z.array(z.string()),
|
|
166
|
-
placeKinds: z.array(z.string()),
|
|
167
|
-
resourceResolver: z.boolean().default(false)
|
|
168
|
-
});
|
|
169
|
-
const roomSurfaceBindingSchema = z.object({
|
|
170
|
-
channel: providerRefSchema,
|
|
171
|
-
config: jsonObjectSchema.default({}),
|
|
172
|
-
source: z.string().optional()
|
|
173
|
-
});
|
|
174
|
-
const channelBindingSchema = roomSurfaceBindingSchema.extend({
|
|
175
|
-
key: z.string().min(1),
|
|
176
|
-
credentials: channelCredentialsSchema.default({ app: null }),
|
|
177
|
-
surface: channelSurfaceSchema.default({
|
|
178
|
-
routes: [],
|
|
179
|
-
listeners: [],
|
|
180
|
-
placeKinds: [],
|
|
181
|
-
resourceResolver: false
|
|
182
|
-
}),
|
|
183
|
-
install: z.string().optional()
|
|
184
|
-
});
|
|
185
|
-
const hookBindingSchema = z.object({
|
|
186
|
-
slug: z.string().min(1),
|
|
187
|
-
export: z.string().min(1),
|
|
188
|
-
events: z.array(z.string().min(1)).min(1)
|
|
189
|
-
});
|
|
190
|
-
const scheduleDefinitionSchema = z.object({
|
|
191
|
-
key: z.string().min(1),
|
|
192
|
-
cron: z.string().min(1),
|
|
193
|
-
timezone: z.string().min(1),
|
|
194
|
-
prompt: z.string().min(1),
|
|
195
|
-
target: z.nativeEnum(ScheduleTarget)
|
|
196
|
-
});
|
|
197
|
-
const bundleSchema = z.object({
|
|
198
|
-
// Absent on historical revisions: the host must inspect their resources.
|
|
199
|
-
hasPreparationFiles: z.boolean().optional(),
|
|
200
|
-
hash: z.string().min(1),
|
|
201
|
-
// Dynamic slot path → resolver export and events.
|
|
202
|
-
resolvers: z.record(
|
|
203
|
-
z.string(),
|
|
204
|
-
z.object({ export: z.string().min(1), events: z.array(z.nativeEnum(DynamicEvent)).min(1) })
|
|
205
|
-
)
|
|
206
|
-
});
|
|
207
|
-
const harnessBindingSchema = z.object({
|
|
208
|
-
harness: providerRefSchema,
|
|
209
|
-
// Validated against the harness's configSchema; may contain dynamic slots at
|
|
210
|
-
// any depth (an instruction fragment, the model).
|
|
211
|
-
config: maybeDynamic(jsonValueSchema)
|
|
212
|
-
});
|
|
213
|
-
const agentManifestSchema = z.object({
|
|
214
|
-
// Earlier versions stay readable: their channel entries take the defaults below.
|
|
215
|
-
version: z.union([z.literal(2), z.literal(3), z.literal(MANIFEST_VERSION)]),
|
|
216
|
-
identity: identitySchema,
|
|
217
|
-
harness: harnessBindingSchema,
|
|
218
|
-
mcpServers: maybeDynamic(z.array(mcpServerBindingSchema)),
|
|
219
|
-
sandboxes: maybeDynamic(z.record(z.string(), sandboxBindingSchema)),
|
|
220
|
-
tools: baseToolsSchema,
|
|
221
|
-
toolPolicy: z.record(z.string(), z.nativeEnum(ToolApproval)),
|
|
222
|
-
// Secrets this agent may read, by name (`secrets.get`, MCP `secretKey`,
|
|
223
|
-
// `apiKey({ secret })`). Nothing else is readable.
|
|
224
|
-
secrets: z.array(z.string().min(1)).default([]),
|
|
225
|
-
channels: z.array(channelBindingSchema),
|
|
226
|
-
roomSurface: roomSurfaceBindingSchema.optional(),
|
|
227
|
-
channelSources: z.record(z.string(), z.object({ path: z.string(), source: z.string(), disabled: z.boolean() })).optional(),
|
|
228
|
-
hooks: z.array(hookBindingSchema),
|
|
229
|
-
schedules: z.array(scheduleDefinitionSchema),
|
|
230
|
-
bundle: bundleSchema.nullable()
|
|
231
|
-
});
|
|
232
|
-
const resolvedAgentManifestSchema = agentManifestSchema.extend({
|
|
233
|
-
harness: z.object({ harness: providerRefSchema, config: jsonValueSchema }),
|
|
234
|
-
mcpServers: z.array(mcpServerBindingSchema),
|
|
235
|
-
sandboxes: z.record(z.string(), sandboxBindingSchema.extend({ environment: jsonValueSchema }))
|
|
236
|
-
}).superRefine((manifest, ctx) => {
|
|
237
|
-
if (containsDynamicSlot(manifest)) {
|
|
238
|
-
ctx.addIssue({
|
|
239
|
-
code: "custom",
|
|
240
|
-
message: "a resolved manifest must not contain dynamic slots"
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
var InstructionRole = /* @__PURE__ */ ((InstructionRole2) => {
|
|
245
|
-
InstructionRole2["System"] = "system";
|
|
246
|
-
InstructionRole2["User"] = "user";
|
|
247
|
-
return InstructionRole2;
|
|
248
|
-
})(InstructionRole || {});
|
|
249
|
-
const instructionFragmentSchema = z.object({
|
|
250
|
-
role: z.nativeEnum(InstructionRole),
|
|
251
|
-
content: z.string(),
|
|
252
|
-
// Source file, for the compatibility report and Build.
|
|
253
|
-
source: z.string().optional()
|
|
254
|
-
});
|
|
255
|
-
const skillFileSchema = z.object({ path: z.string().min(1), content: z.string() });
|
|
256
|
-
const skillBundleSchema = z.object({
|
|
257
|
-
key: z.string().min(1),
|
|
258
|
-
description: z.string().optional(),
|
|
259
|
-
files: z.array(skillFileSchema)
|
|
260
|
-
});
|
|
261
|
-
const emptyManifest = (name) => ({
|
|
262
|
-
version: MANIFEST_VERSION,
|
|
263
|
-
identity: { name, description: null },
|
|
264
|
-
harness: {
|
|
265
|
-
harness: packageRef("@finalai/final-agent-provider/harnesses/serverless-final"),
|
|
266
|
-
config: {}
|
|
267
|
-
},
|
|
268
|
-
mcpServers: [],
|
|
269
|
-
sandboxes: {},
|
|
270
|
-
tools: { base: {} },
|
|
271
|
-
toolPolicy: {},
|
|
272
|
-
secrets: [],
|
|
273
|
-
channels: [],
|
|
274
|
-
hooks: [],
|
|
275
|
-
schedules: [],
|
|
276
|
-
bundle: null
|
|
277
|
-
});
|
|
278
|
-
export {
|
|
279
|
-
BaseCapability,
|
|
280
|
-
InputApprovalKind,
|
|
281
|
-
InstructionRole,
|
|
282
|
-
MANIFEST_VERSION,
|
|
283
|
-
McpServerBindingKind,
|
|
284
|
-
SandboxAccess,
|
|
285
|
-
SandboxAttach,
|
|
286
|
-
ScheduleDelivery,
|
|
287
|
-
ScheduleTarget,
|
|
288
|
-
ToolApproval,
|
|
289
|
-
agentAvatarSchema2 as agentAvatarSchema,
|
|
290
|
-
agentManifestSchema,
|
|
291
|
-
avatarMediaSchema,
|
|
292
|
-
baseToolsSchema,
|
|
293
|
-
bundleSchema,
|
|
294
|
-
channelBindingSchema,
|
|
295
|
-
channelCredentialsSchema,
|
|
296
|
-
channelSurfaceSchema,
|
|
297
|
-
emptyManifest,
|
|
298
|
-
harnessBindingSchema,
|
|
299
|
-
hookBindingSchema,
|
|
300
|
-
httpMcpServerBindingSchema,
|
|
301
|
-
identitySchema,
|
|
302
|
-
inputApprovalSchema,
|
|
303
|
-
instructionFragmentSchema,
|
|
304
|
-
mcpAuthSchema,
|
|
305
|
-
mcpServerBindingSchema,
|
|
306
|
-
narrowerSandboxAccess,
|
|
307
|
-
resolvedAgentManifestSchema,
|
|
308
|
-
roomSurfaceBindingSchema,
|
|
309
|
-
sandboxAccessAtLeast,
|
|
310
|
-
sandboxBindingSchema,
|
|
311
|
-
sandboxCredentialRefSchema,
|
|
312
|
-
scheduleDefinitionSchema,
|
|
313
|
-
skillBundleSchema,
|
|
314
|
-
skillFileSchema,
|
|
315
|
-
toolAnnotationRuleSchema,
|
|
316
|
-
toolAnnotationSelectorSchema,
|
|
317
|
-
toolDescriptorSchema,
|
|
318
|
-
workerMcpServerBindingSchema
|
|
319
|
-
};
|
|
320
|
-
//# sourceMappingURL=manifest.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\nimport { agentAvatarSchema } from '@finalai/agent-protocol';\nimport { containsDynamicSlot, DynamicEvent, maybeDynamic } from \"./dynamic.mjs\";\nimport { jsonObjectSchema, jsonSchemaSchema, jsonValueSchema } from \"./json.mjs\";\nimport { packageRef, providerRefSchema } from \"./provider-ref.mjs\";\n\nexport { agentAvatarSchema, avatarMediaSchema } from '@finalai/agent-protocol';\nexport type { AgentAvatarIface, AvatarMedia, AvatarState } from '@finalai/agent-protocol';\n\n// The Agent Manifest. It lives in the provider contract\n// package because it is what harnesses, sandboxes and channels receive;\n// @finalai/agent-definition compiles directories into it and re-exports it.\n//\n// A harness owns its loop, native tools, prompt assembly, models, permission\n// modes, memory and compaction: all of that is `harness.config`, typed by the\n// harness's own configSchema. What ACP standardizes (MCP servers, prompts,\n// permissions, cancellation) is session input, identical for every harness.\n\nexport const MANIFEST_VERSION = 4;\n\n// Base tool capability classes, one to one with sandbox handle capabilities.\nexport enum BaseCapability {\n Shell = 'shell',\n Files = 'files',\n Process = 'process',\n Ports = 'ports',\n Browser = 'browser',\n ComputerUse = 'computerUse',\n}\n\nexport enum ToolApproval {\n Allow = 'allow',\n Ask = 'ask',\n}\n\n// What a session may do on a sandbox target: read files; also run\n// processes (execute, without file writes); or everything (write).\nexport enum SandboxAccess {\n Read = 'read',\n Execute = 'execute',\n Write = 'write',\n}\n\nconst SANDBOX_ACCESS_RANK = {\n [SandboxAccess.Read]: 0,\n [SandboxAccess.Execute]: 1,\n [SandboxAccess.Write]: 2,\n} satisfies Record<SandboxAccess, number>;\n\n// Each access includes the ones before it: read < execute < write.\nexport const sandboxAccessAtLeast = (access: SandboxAccess, floor: SandboxAccess): boolean =>\n SANDBOX_ACCESS_RANK[access] >= SANDBOX_ACCESS_RANK[floor];\n\nexport const narrowerSandboxAccess = (a: SandboxAccess, b: SandboxAccess): SandboxAccess =>\n SANDBOX_ACCESS_RANK[a] <= SANDBOX_ACCESS_RANK[b] ? a : b;\n\nexport enum SandboxAttach {\n Lazy = 'lazy',\n OnPrompt = 'on-prompt',\n}\n\nexport enum McpServerBindingKind {\n // Authored tools, served from the agent's Worker isolate behind the MCP host.\n Worker = 'worker',\n Http = 'http',\n}\n\nexport enum ScheduleTarget {\n OwnerDirect = 'owner-direct',\n BoundConversation = 'bound-conversation',\n}\n\n// Whether a schedule's firing must get a visible reply. Values match the schedules API.\nexport enum ScheduleDelivery {\n Always = 'always',\n // The agent replies only when there is something to say; an empty turn posts nothing.\n IfNeeded = 'if_needed',\n}\n\nexport const identitySchema = z.object({\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable(),\n avatar: agentAvatarSchema.optional(),\n});\n\nexport enum InputApprovalKind {\n Tool = 'tool',\n Connection = 'connection',\n}\n\nexport const inputApprovalSchema = z.object({\n kind: z.nativeEnum(InputApprovalKind),\n export: z.string().min(1),\n // Connection default when absent; otherwise tools.approval[policyKey].\n policyKey: z.string().min(1).optional(),\n dynamic: jsonObjectSchema.optional(),\n});\nexport type InputApprovalIface = z.infer<typeof inputApprovalSchema>;\n\n// Tool descriptors are stored statically so `tools/list` never needs the isolate.\nexport const toolDescriptorSchema = z.object({\n name: z.string().min(1),\n description: z.string(),\n inputSchema: jsonSchemaSchema,\n outputSchema: jsonSchemaSchema.optional(),\n annotations: z\n .object({\n title: z.string().optional(),\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .optional(),\n // Bundle export implementing it ('tools/lookup_release_notes').\n export: z.string().min(1).optional(),\n // Boundary snapshot used to reconstruct dynamic tools after isolate eviction.\n dynamic: jsonObjectSchema.optional(),\n inputApproval: inputApprovalSchema.optional(),\n});\n\nexport const mcpAuthSchema = z.union([\n z.object({ secretKey: z.string().min(1), headerName: z.string().min(1).nullable() }),\n // Resolved by the broker to a session-scoped grant (Final's own MCP server).\n z.object({ kind: z.literal('final-session') }),\n]);\n\nconst toolApprovalsSchema = z.record(z.string(), z.nativeEnum(ToolApproval)).nullable();\n\n// MCP tool annotation hints a connection policy selects on (./tool-annotations.ts).\nexport const toolAnnotationSelectorSchema = z\n .strictObject({\n readOnlyHint: z.boolean().optional(),\n destructiveHint: z.boolean().optional(),\n idempotentHint: z.boolean().optional(),\n openWorldHint: z.boolean().optional(),\n })\n .refine((selector) => Object.keys(selector).length > 0, 'Select at least one annotation');\n\n// Tools exposed because their annotations match, with the approval (and the\n// connection default's input predicate) they run under.\nexport const toolAnnotationRuleSchema = z.object({\n match: toolAnnotationSelectorSchema,\n approval: z.nativeEnum(ToolApproval),\n inputApproval: inputApprovalSchema.optional(),\n});\n\nexport const workerMcpServerBindingSchema = z.object({\n key: z.string().min(1),\n kind: z.literal(McpServerBindingKind.Worker),\n tools: z.array(toolDescriptorSchema),\n approvals: toolApprovalsSchema,\n});\n\nexport const httpMcpServerBindingSchema = z.object({\n key: z.string().min(1),\n kind: z.literal(McpServerBindingKind.Http),\n url: z.string().url(),\n auth: mcpAuthSchema.nullable(),\n headers: z.record(z.string(), z.string()).default({}),\n // Null allows every tool the server lists, each with the default approval.\n // Keys are tool names or `*` patterns (./tool-patterns.ts); the most\n // specific matching key governs a tool.\n approvals: toolApprovalsSchema,\n // Tool names or `*` patterns hidden even when `approvals` would expose them.\n deny: z.array(z.string().min(1)).optional(),\n // Exposed tools (names or `*` patterns) the harness lists up front. Absent\n // lists every exposed tool; otherwise the host keeps the rest reachable\n // through search (HOSTING.md).\n load: z.array(z.string().min(1)).optional(),\n // Tools also exposed by their MCP annotations; named tools keep `approvals`.\n allowAnnotations: z.array(toolAnnotationRuleSchema).optional(),\n // Tools hidden by their MCP annotations, whatever else exposes them.\n denyAnnotations: z.array(toolAnnotationSelectorSchema).optional(),\n // The authored resolver that produced this connection, for retained boundary values.\n dynamicResolver: z.string().min(1).optional(),\n inputApprovals: z.record(z.string(), inputApprovalSchema).optional(),\n});\n\nexport const mcpServerBindingSchema = z.discriminatedUnion('kind', [\n workerMcpServerBindingSchema,\n httpMcpServerBindingSchema,\n]);\n\n// A sandbox provider's credential by reference: `secretRef` is the name of a secret,\n// never its value. Providers take it as `credential` in their environment options.\nexport const sandboxCredentialRefSchema = z.strictObject({\n secretRef: z.string().min(1).max(256),\n});\n\nexport type SandboxCredentialRefIface = z.infer<typeof sandboxCredentialRefSchema>;\n\nexport const sandboxBindingSchema = z.object({\n provider: providerRefSchema,\n // Provider-defined environment options (`computer`: a setup guide reference or\n // inline guide plus start-time parameters). Validated by the provider.\n environment: maybeDynamic(jsonValueSchema),\n access: z.nativeEnum(SandboxAccess).default(SandboxAccess.Write),\n attach: z.nativeEnum(SandboxAttach).default(SandboxAttach.Lazy),\n});\n\nexport const baseToolsSchema = z.object({\n base: z.partialRecord(z.nativeEnum(BaseCapability), z.object({ target: z.string().min(1) })),\n // Capabilities declared on the harness's own host with no sandbox target\n // (`baseTools({ shell: harnessHost })`): only a harness that\n // provides them natively (host-disableable, host-fixed) can serve them.\n host: z.array(z.nativeEnum(BaseCapability)).optional(),\n});\n\nexport const channelCredentialsSchema = z.object({\n app: z.string().nullable(),\n secrets: z.array(z.string()).optional(),\n});\nexport const channelSurfaceSchema = z.object({\n routes: z.array(z.object({ method: z.string(), path: z.string() })),\n listeners: z.array(z.string()),\n placeKinds: z.array(z.string()),\n resourceResolver: z.boolean().default(false),\n});\nexport const roomSurfaceBindingSchema = z.object({\n channel: providerRefSchema,\n config: jsonObjectSchema.default({}),\n source: z.string().optional(),\n});\nexport const channelBindingSchema = roomSurfaceBindingSchema.extend({\n key: z.string().min(1),\n credentials: channelCredentialsSchema.default({ app: null }),\n surface: channelSurfaceSchema.default({\n routes: [],\n listeners: [],\n placeKinds: [],\n resourceResolver: false,\n }),\n install: z.string().optional(),\n});\n\nexport const hookBindingSchema = z.object({\n slug: z.string().min(1),\n export: z.string().min(1),\n events: z.array(z.string().min(1)).min(1),\n});\n\nexport const scheduleDefinitionSchema = z.object({\n key: z.string().min(1),\n cron: z.string().min(1),\n timezone: z.string().min(1),\n prompt: z.string().min(1),\n target: z.nativeEnum(ScheduleTarget),\n});\n\nexport const bundleSchema = z.object({\n // Absent on historical revisions: the host must inspect their resources.\n hasPreparationFiles: z.boolean().optional(),\n hash: z.string().min(1),\n // Dynamic slot path \u2192 resolver export and events.\n resolvers: z.record(\n z.string(),\n z.object({ export: z.string().min(1), events: z.array(z.nativeEnum(DynamicEvent)).min(1) }),\n ),\n});\n\nexport const harnessBindingSchema = z.object({\n harness: providerRefSchema,\n // Validated against the harness's configSchema; may contain dynamic slots at\n // any depth (an instruction fragment, the model).\n config: maybeDynamic(jsonValueSchema),\n});\n\nexport const agentManifestSchema = z.object({\n // Earlier versions stay readable: their channel entries take the defaults below.\n version: z.union([z.literal(2), z.literal(3), z.literal(MANIFEST_VERSION)]),\n identity: identitySchema,\n harness: harnessBindingSchema,\n mcpServers: maybeDynamic(z.array(mcpServerBindingSchema)),\n sandboxes: maybeDynamic(z.record(z.string(), sandboxBindingSchema)),\n tools: baseToolsSchema,\n toolPolicy: z.record(z.string(), z.nativeEnum(ToolApproval)),\n // Secrets this agent may read, by name (`secrets.get`, MCP `secretKey`,\n // `apiKey({ secret })`). Nothing else is readable.\n secrets: z.array(z.string().min(1)).default([]),\n channels: z.array(channelBindingSchema),\n roomSurface: roomSurfaceBindingSchema.optional(),\n channelSources: z\n .record(z.string(), z.object({ path: z.string(), source: z.string(), disabled: z.boolean() }))\n .optional(),\n hooks: z.array(hookBindingSchema),\n schedules: z.array(scheduleDefinitionSchema),\n bundle: bundleSchema.nullable(),\n});\n\n// What one session actually got: every dynamic slot replaced by its resolved\n// value (stored in agent.session_manifests).\nexport const resolvedAgentManifestSchema = agentManifestSchema\n .extend({\n harness: z.object({ harness: providerRefSchema, config: jsonValueSchema }),\n mcpServers: z.array(mcpServerBindingSchema),\n sandboxes: z.record(z.string(), sandboxBindingSchema.extend({ environment: jsonValueSchema })),\n })\n .superRefine((manifest, ctx) => {\n if (containsDynamicSlot(manifest)) {\n ctx.addIssue({\n code: 'custom',\n message: 'a resolved manifest must not contain dynamic slots',\n });\n }\n });\n\nexport type IdentityIface = z.infer<typeof identitySchema>;\nexport type ToolDescriptorIface = z.infer<typeof toolDescriptorSchema>;\nexport type McpAuth = z.infer<typeof mcpAuthSchema>;\nexport type WorkerMcpServerBindingIface = z.infer<typeof workerMcpServerBindingSchema>;\nexport type HttpMcpServerBindingIface = z.infer<typeof httpMcpServerBindingSchema>;\nexport type ToolAnnotationSelectorIface = z.infer<typeof toolAnnotationSelectorSchema>;\nexport type ToolAnnotationRuleIface = z.infer<typeof toolAnnotationRuleSchema>;\nexport type McpServerBinding = z.infer<typeof mcpServerBindingSchema>;\nexport type SandboxBindingIface = z.infer<typeof sandboxBindingSchema>;\nexport type BaseToolsIface = z.infer<typeof baseToolsSchema>;\nexport type ChannelBindingIface = z.infer<typeof channelBindingSchema>;\nexport type HookBindingIface = z.infer<typeof hookBindingSchema>;\nexport type ScheduleDefinitionIface = z.infer<typeof scheduleDefinitionSchema>;\nexport type BundleIface = z.infer<typeof bundleSchema>;\nexport type HarnessBindingIface = z.infer<typeof harnessBindingSchema>;\nexport type AgentManifestIface = z.infer<typeof agentManifestSchema>;\nexport type ResolvedAgentManifestIface = z.infer<typeof resolvedAgentManifestSchema>;\nexport type ResolvedSandboxBindingIface = ResolvedAgentManifestIface['sandboxes'][string];\n\n// The fields of a harness config the platform itself reads through the shared\n// schema fragments; everything else is opaque to the platform.\nexport enum InstructionRole {\n System = 'system',\n User = 'user',\n}\n\nexport const instructionFragmentSchema = z.object({\n role: z.nativeEnum(InstructionRole),\n content: z.string(),\n // Source file, for the compatibility report and Build.\n source: z.string().optional(),\n});\n\nexport const skillFileSchema = z.object({ path: z.string().min(1), content: z.string() });\nexport const skillBundleSchema = z.object({\n key: z.string().min(1),\n description: z.string().optional(),\n files: z.array(skillFileSchema),\n});\n\nexport type InstructionFragmentIface = z.infer<typeof instructionFragmentSchema>;\nexport type SkillBundleIface = z.infer<typeof skillBundleSchema>;\n\nexport const emptyManifest = (name: string): AgentManifestIface => ({\n version: MANIFEST_VERSION,\n identity: { name, description: null },\n harness: {\n harness: packageRef('@finalai/final-agent-provider/harnesses/serverless-final'),\n config: {},\n },\n mcpServers: [],\n sandboxes: {},\n tools: { base: {} },\n toolPolicy: {},\n secrets: [],\n channels: [],\n hooks: [],\n schedules: [],\n bundle: null,\n});\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,OAAO;AACnB,SAAS,yBAAyB;AAClC,SAAS,qBAAqB,cAAc,oBAAoB;AAChE,SAAS,kBAAkB,kBAAkB,uBAAuB;AACpE,SAAS,YAAY,yBAAyB;AAE9C,SAAS,qBAAAA,oBAAmB,yBAAyB;AAY9C,MAAM,mBAAmB;AAGzB,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,iBAAc;AANJ,SAAAA;AAAA,GAAA;AASL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;AAOL,IAAK,gBAAL,kBAAKC,mBAAL;AACL,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,aAAU;AACV,EAAAA,eAAA,WAAQ;AAHE,SAAAA;AAAA,GAAA;AAMZ,MAAM,sBAAsB;AAAA,EAC1B,CAAC,iBAAkB,GAAG;AAAA,EACtB,CAAC,uBAAqB,GAAG;AAAA,EACzB,CAAC,mBAAmB,GAAG;AACzB;AAGO,MAAM,uBAAuB,CAAC,QAAuB,UAC1D,oBAAoB,MAAM,KAAK,oBAAoB,KAAK;AAEnD,MAAM,wBAAwB,CAAC,GAAkB,MACtD,oBAAoB,CAAC,KAAK,oBAAoB,CAAC,IAAI,IAAI;AAElD,IAAK,gBAAL,kBAAKC,mBAAL;AACL,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IA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EAAE,IAAI,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC;AACjF,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACrB,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,OAAO,EAAE,MAAM,eAAe;AAChC,CAAC;AAKM,MAAM,gBAAgB,CAAC,UAAsC;AAAA,EAClE,SAAS;AAAA,EACT,UAAU,EAAE,MAAM,aAAa,KAAK;AAAA,EACpC,SAAS;AAAA,IACP,SAAS,WAAW,0DAA0D;AAAA,IAC9E,QAAQ,CAAC;AAAA,EACX;AAAA,EACA,YAAY,CAAC;AAAA,EACb,WAAW,CAAC;AAAA,EACZ,OAAO,EAAE,MAAM,CAAC,EAAE;AAAA,EAClB,YAAY,CAAC;AAAA,EACb,SAAS,CAAC;AAAA,EACV,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,WAAW,CAAC;AAAA,EACZ,QAAQ;AACV;",
|
|
6
|
-
"names": ["agentAvatarSchema", "BaseCapability", "ToolApproval", "SandboxAccess", "SandboxAttach", "McpServerBindingKind", "ScheduleTarget", "ScheduleDelivery", "InputApprovalKind", "InstructionRole"]
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
export declare enum ProviderRefKind {
|
|
3
|
-
Package = "package",
|
|
4
|
-
Bundle = "bundle"
|
|
5
|
-
}
|
|
6
|
-
export declare const packageProviderRefSchema: z.ZodObject<{
|
|
7
|
-
kind: z.ZodLiteral<ProviderRefKind.Package>;
|
|
8
|
-
specifier: z.ZodString;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
export declare const bundleProviderRefSchema: z.ZodObject<{
|
|
11
|
-
kind: z.ZodLiteral<ProviderRefKind.Bundle>;
|
|
12
|
-
export: z.ZodString;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
export declare const providerRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
-
kind: z.ZodLiteral<ProviderRefKind.Package>;
|
|
16
|
-
specifier: z.ZodString;
|
|
17
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
18
|
-
kind: z.ZodLiteral<ProviderRefKind.Bundle>;
|
|
19
|
-
export: z.ZodString;
|
|
20
|
-
}, z.core.$strip>], "kind">;
|
|
21
|
-
export type PackageProviderRefIface = z.infer<typeof packageProviderRefSchema>;
|
|
22
|
-
export type BundleProviderRefIface = z.infer<typeof bundleProviderRefSchema>;
|
|
23
|
-
export type ProviderRef = z.infer<typeof providerRefSchema>;
|
|
24
|
-
export declare const packageRef: (specifier: string) => PackageProviderRefIface;
|
|
25
|
-
export declare const bundleRef: (exportName: string) => BundleProviderRefIface;
|
|
26
|
-
export declare const formatProviderRef: (ref: ProviderRef) => string;
|
|
27
|
-
export declare const parseProviderRef: (text: string) => ProviderRef | null;
|
|
28
|
-
export declare const providerRefsEqual: (a: ProviderRef, b: ProviderRef) => boolean;
|
|
29
|
-
export declare const providerRefTextMatches: (text: string, ref: ProviderRef) => boolean;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
var ProviderRefKind = /* @__PURE__ */ ((ProviderRefKind2) => {
|
|
3
|
-
ProviderRefKind2["Package"] = "package";
|
|
4
|
-
ProviderRefKind2["Bundle"] = "bundle";
|
|
5
|
-
return ProviderRefKind2;
|
|
6
|
-
})(ProviderRefKind || {});
|
|
7
|
-
const packageProviderRefSchema = z.object({
|
|
8
|
-
kind: z.literal("package" /* Package */),
|
|
9
|
-
specifier: z.string().min(1)
|
|
10
|
-
});
|
|
11
|
-
const bundleProviderRefSchema = z.object({
|
|
12
|
-
kind: z.literal("bundle" /* Bundle */),
|
|
13
|
-
export: z.string().min(1)
|
|
14
|
-
});
|
|
15
|
-
const providerRefSchema = z.discriminatedUnion("kind", [
|
|
16
|
-
packageProviderRefSchema,
|
|
17
|
-
bundleProviderRefSchema
|
|
18
|
-
]);
|
|
19
|
-
const packageRef = (specifier) => ({
|
|
20
|
-
kind: "package" /* Package */,
|
|
21
|
-
specifier
|
|
22
|
-
});
|
|
23
|
-
const bundleRef = (exportName) => ({
|
|
24
|
-
kind: "bundle" /* Bundle */,
|
|
25
|
-
export: exportName
|
|
26
|
-
});
|
|
27
|
-
const formatProviderRef = (ref) => ref.kind === "package" /* Package */ ? `package:${ref.specifier}` : `bundle:${ref.export}`;
|
|
28
|
-
const parseProviderRef = (text) => {
|
|
29
|
-
const separator = text.indexOf(":");
|
|
30
|
-
if (separator <= 0) return null;
|
|
31
|
-
const kind = text.slice(0, separator);
|
|
32
|
-
const value = text.slice(separator + 1);
|
|
33
|
-
if (value.length === 0) return null;
|
|
34
|
-
if (kind === "package" /* Package */) return packageRef(value);
|
|
35
|
-
if (kind === "bundle" /* Bundle */) return bundleRef(value);
|
|
36
|
-
return null;
|
|
37
|
-
};
|
|
38
|
-
const providerRefsEqual = (a, b) => formatProviderRef(a) === formatProviderRef(b);
|
|
39
|
-
const providerRefTextMatches = (text, ref) => {
|
|
40
|
-
const parsed = parseProviderRef(text);
|
|
41
|
-
return parsed != null && providerRefsEqual(parsed, ref);
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
ProviderRefKind,
|
|
45
|
-
bundleProviderRefSchema,
|
|
46
|
-
bundleRef,
|
|
47
|
-
formatProviderRef,
|
|
48
|
-
packageProviderRefSchema,
|
|
49
|
-
packageRef,
|
|
50
|
-
parseProviderRef,
|
|
51
|
-
providerRefSchema,
|
|
52
|
-
providerRefTextMatches,
|
|
53
|
-
providerRefsEqual
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=provider-ref.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/provider-ref.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\n\n// Provider implementation references. Installed packages use an import specifier\n// ('@finalai/final-agent-provider/harnesses/serverless-pi'); providers declared in\n// a definition's authored bundle are referenced by export name, scoped to the\n// revision the reference is stored with.\nexport enum ProviderRefKind {\n Package = 'package',\n Bundle = 'bundle',\n}\n\nexport const packageProviderRefSchema = z.object({\n kind: z.literal(ProviderRefKind.Package),\n specifier: z.string().min(1),\n});\n\nexport const bundleProviderRefSchema = z.object({\n kind: z.literal(ProviderRefKind.Bundle),\n export: z.string().min(1),\n});\n\nexport const providerRefSchema = z.discriminatedUnion('kind', [\n packageProviderRefSchema,\n bundleProviderRefSchema,\n]);\n\nexport type PackageProviderRefIface = z.infer<typeof packageProviderRefSchema>;\nexport type BundleProviderRefIface = z.infer<typeof bundleProviderRefSchema>;\nexport type ProviderRef = z.infer<typeof providerRefSchema>;\n\nexport const packageRef = (specifier: string): PackageProviderRefIface => ({\n kind: ProviderRefKind.Package,\n specifier,\n});\n\nexport const bundleRef = (exportName: string): BundleProviderRefIface => ({\n kind: ProviderRefKind.Bundle,\n export: exportName,\n});\n\n// Stable text form for telemetry, logs and the `harness_ref` / `provider_ref`\n// columns: 'package:<specifier>' or 'bundle:<export>'.\nexport const formatProviderRef = (ref: ProviderRef): string =>\n ref.kind === ProviderRefKind.Package ? `package:${ref.specifier}` : `bundle:${ref.export}`;\n\nexport const parseProviderRef = (text: string): ProviderRef | null => {\n const separator = text.indexOf(':');\n if (separator <= 0) return null;\n const kind = text.slice(0, separator);\n const value = text.slice(separator + 1);\n if (value.length === 0) return null;\n if (kind === ProviderRefKind.Package) return packageRef(value);\n if (kind === ProviderRefKind.Bundle) return bundleRef(value);\n return null;\n};\n\nexport const providerRefsEqual = (a: ProviderRef, b: ProviderRef): boolean =>\n formatProviderRef(a) === formatProviderRef(b);\n\nexport const providerRefTextMatches = (text: string, ref: ProviderRef): boolean => {\n const parsed = parseProviderRef(text);\n return parsed != null && providerRefsEqual(parsed, ref);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,OAAO;AAMZ,IAAK,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": ["ProviderRefKind"]
|
|
7
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SandboxOpener, SandboxOpenScopeGlobalIface, SandboxOpenScopeIface } from "./open-scope.mjs";
|
|
2
|
-
export declare const sandboxOpenScope: SandboxOpenScopeIface;
|
|
3
|
-
export declare const installSandboxOpenScope: (target: SandboxOpenScopeGlobalIface) => void;
|
|
4
|
-
export declare const withSandboxOpener: <T>(opener: SandboxOpener, run: () => T) => Promise<Awaited<T>>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
const openers = new AsyncLocalStorage();
|
|
3
|
-
const sandboxOpenScope = {
|
|
4
|
-
current: () => openers.getStore() ?? null
|
|
5
|
-
};
|
|
6
|
-
const installSandboxOpenScope = (target) => {
|
|
7
|
-
target.__finalSandboxOpenScope = sandboxOpenScope;
|
|
8
|
-
};
|
|
9
|
-
const withSandboxOpener = (opener, run) => {
|
|
10
|
-
if (globalThis.__finalSandboxOpenScope !== sandboxOpenScope) installSandboxOpenScope(globalThis);
|
|
11
|
-
const settle = async () => await run();
|
|
12
|
-
return openers.run(opener, settle);
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
installSandboxOpenScope,
|
|
16
|
-
sandboxOpenScope,
|
|
17
|
-
withSandboxOpener
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=open-scope-node.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/sandbox/open-scope-node.ts"],
|
|
4
|
-
"sourcesContent": ["import { AsyncLocalStorage } from 'node:async_hooks';\nimport type {\n SandboxOpener,\n SandboxOpenScopeGlobalIface,\n SandboxOpenScopeIface,\n} from \"./open-scope.mjs\";\n\n// The runtime half of open-scope.ts, for isolate runtimes with\n// AsyncLocalStorage (Node, workerd with nodejs_compat): runs a sandbox.ts\n// selector with its opener as the current one, so concurrent selectors in one\n// isolate each open their own session's target.\n\nconst openers = new AsyncLocalStorage<SandboxOpener>();\n\nexport const sandboxOpenScope: SandboxOpenScopeIface = {\n current: () => openers.getStore() ?? null,\n};\n\n// Installs the scope on a global object (the isolate's, or a local realm's).\nexport const installSandboxOpenScope = (target: SandboxOpenScopeGlobalIface): void => {\n target.__finalSandboxOpenScope = sandboxOpenScope;\n};\n\n// Settles inside the scope, so a selector that returns an open request\n// (`() => computer().open()`) is opened by its own opener too.\nexport const withSandboxOpener = <T>(opener: SandboxOpener, run: () => T): Promise<Awaited<T>> => {\n if (globalThis.__finalSandboxOpenScope !== sandboxOpenScope) installSandboxOpenScope(globalThis);\n const settle = async (): Promise<Awaited<T>> => await run();\n return openers.run(opener, settle);\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,yBAAyB;AAYlC,MAAM,UAAU,IAAI,kBAAiC;AAE9C,MAAM,mBAA0C;AAAA,EACrD,SAAS,MAAM,QAAQ,SAAS,KAAK;AACvC;AAGO,MAAM,0BAA0B,CAAC,WAA8C;AACpF,SAAO,0BAA0B;AACnC;AAIO,MAAM,oBAAoB,CAAI,QAAuB,QAAsC;AAChG,MAAI,WAAW,4BAA4B,iBAAkB,yBAAwB,UAAU;AAC/F,QAAM,SAAS,YAAiC,MAAM,IAAI;AAC1D,SAAO,QAAQ,IAAI,QAAQ,MAAM;AACnC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod';
|
|
2
|
-
import type { NetworkSandboxSessionIface, SandboxOpenRequestIface } from "./types.mjs";
|
|
3
|
-
export type SandboxOpener = (request: SandboxOpenRequestIface<unknown, unknown>) => Promise<NetworkSandboxSessionIface>;
|
|
4
|
-
export interface SandboxOpenScopeIface {
|
|
5
|
-
current(): SandboxOpener | null;
|
|
6
|
-
}
|
|
7
|
-
declare global {
|
|
8
|
-
var __finalSandboxOpenScope: unknown;
|
|
9
|
-
}
|
|
10
|
-
export interface SandboxOpenScopeGlobalIface {
|
|
11
|
-
__finalSandboxOpenScope?: unknown;
|
|
12
|
-
}
|
|
13
|
-
export type AwaitableSandboxOpenRequestIface<EnvOptions, OpenOptions> = SandboxOpenRequestIface<EnvOptions, OpenOptions> & PromiseLike<NetworkSandboxSessionIface>;
|
|
14
|
-
export declare const unopenedRequestOf: (cause: unknown) => SandboxOpenRequestIface<unknown, unknown> | null;
|
|
15
|
-
export declare const awaitableOpenRequest: <T extends SandboxOpenRequestIface<unknown, unknown>>(request: T) => T & PromiseLike<NetworkSandboxSessionIface>;
|
|
16
|
-
export declare const sandboxSessionSchema: z.ZodCustom<NetworkSandboxSessionIface, NetworkSandboxSessionIface>;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
const openRequestFieldsSchema = z.looseObject({
|
|
3
|
-
providerName: z.string(),
|
|
4
|
-
environmentOptions: z.unknown(),
|
|
5
|
-
openOptions: z.unknown()
|
|
6
|
-
});
|
|
7
|
-
const unopenedSchema = z.object({
|
|
8
|
-
unopenedRequest: openRequestFieldsSchema
|
|
9
|
-
});
|
|
10
|
-
const unopenedRequestOf = (cause) => {
|
|
11
|
-
const parsed = unopenedSchema.safeParse(cause);
|
|
12
|
-
return parsed.success ? parsed.data.unopenedRequest : null;
|
|
13
|
-
};
|
|
14
|
-
const scopeMethodsSchema = z.looseObject({ current: z.function() });
|
|
15
|
-
const sandboxOpenScopeSchema = z.custom(
|
|
16
|
-
(value) => scopeMethodsSchema.safeParse(value).success
|
|
17
|
-
);
|
|
18
|
-
const awaitableOpenRequest = (request) => {
|
|
19
|
-
const then = (onFulfilled, onRejected) => {
|
|
20
|
-
const scope = sandboxOpenScopeSchema.safeParse(globalThis.__finalSandboxOpenScope).data;
|
|
21
|
-
const opener = scope?.current() ?? null;
|
|
22
|
-
const opened = opener == null ? Promise.reject(
|
|
23
|
-
Object.assign(
|
|
24
|
-
new Error(
|
|
25
|
-
`awaiting ${request.providerName}.open() opens a sandbox only inside a defineSandbox selector`
|
|
26
|
-
),
|
|
27
|
-
{ unopenedRequest: { ...request } }
|
|
28
|
-
)
|
|
29
|
-
) : opener(request);
|
|
30
|
-
return opened.then(onFulfilled, onRejected);
|
|
31
|
-
};
|
|
32
|
-
const awaitable = Object.assign(request, { then });
|
|
33
|
-
Object.defineProperty(awaitable, "then", { enumerable: false });
|
|
34
|
-
return awaitable;
|
|
35
|
-
};
|
|
36
|
-
const sessionMethodsSchema = z.looseObject({
|
|
37
|
-
id: z.string(),
|
|
38
|
-
description: z.string(),
|
|
39
|
-
defaultWorkingDirectory: z.string(),
|
|
40
|
-
ports: z.array(z.number()),
|
|
41
|
-
readFile: z.function(),
|
|
42
|
-
readBinaryFile: z.function(),
|
|
43
|
-
readTextFile: z.function(),
|
|
44
|
-
writeFile: z.function(),
|
|
45
|
-
writeBinaryFile: z.function(),
|
|
46
|
-
writeTextFile: z.function(),
|
|
47
|
-
spawn: z.function(),
|
|
48
|
-
run: z.function(),
|
|
49
|
-
stat: z.function(),
|
|
50
|
-
readDir: z.function(),
|
|
51
|
-
resolvePath: z.function(),
|
|
52
|
-
removePath: z.function(),
|
|
53
|
-
getPortEndpoint: z.function(),
|
|
54
|
-
getPortUrl: z.function(),
|
|
55
|
-
stop: z.function(),
|
|
56
|
-
destroy: z.function()
|
|
57
|
-
});
|
|
58
|
-
const sandboxSessionSchema = z.custom(
|
|
59
|
-
(value) => sessionMethodsSchema.safeParse(value).success
|
|
60
|
-
);
|
|
61
|
-
export {
|
|
62
|
-
awaitableOpenRequest,
|
|
63
|
-
sandboxSessionSchema,
|
|
64
|
-
unopenedRequestOf
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=open-scope.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/sandbox/open-scope.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\nimport type { NetworkSandboxSessionIface, SandboxOpenRequestIface } from \"./types.mjs\";\n\n// sandbox.ts's default `defineSandbox` selector awaits an environment's\n// `open(...)` to get the live sandbox it prepares:\n//\n// export default defineSandbox(async ({ session }) => {\n// const sandbox = await computer.open({ access: 'write' });\n// await sandbox.writeTextFile({ path: '.final/session', content: session.id });\n// return sandbox;\n// });\n//\n// The isolate runtime that calls the selector installs an opener scope on the\n// isolate's global (the authored bundle and the runtime are separate modules\n// that share only the global); a request awaited while a selector runs opens\n// through it. Everywhere else (compiling, dynamic resolvers) an open request\n// is a plain description, not awaited.\n\n// Returns the live session for the request.\nexport type SandboxOpener = (\n request: SandboxOpenRequestIface<unknown, unknown>,\n) => Promise<NetworkSandboxSessionIface>;\n\nexport interface SandboxOpenScopeIface {\n // The opener of the selector running in the current async context.\n current(): SandboxOpener | null;\n}\n\ndeclare global {\n // Installed by the isolate runtime (open-scope-node.ts); absent elsewhere.\n var __finalSandboxOpenScope: unknown;\n}\n\n// A global object the scope is installed on: the isolate's, or a local realm's.\nexport interface SandboxOpenScopeGlobalIface {\n __finalSandboxOpenScope?: unknown;\n}\n\n// What `environment.open(...)` returns: the open request, awaitable inside a\n// selector, where awaiting it opens the sandbox and yields its live session.\nexport type AwaitableSandboxOpenRequestIface<EnvOptions, OpenOptions> = SandboxOpenRequestIface<\n EnvOptions,\n OpenOptions\n> &\n PromiseLike<NetworkSandboxSessionIface>;\n\n// Outside a selector there is nothing to open. Awaiting a request there\n// rejects with this error, which carries the plain request: an async dynamic\n// resolver's `return environment.open(...)` awaits it implicitly, and the\n// resolver runtime takes the request back (`unopenedRequestOf`).\nconst openRequestFieldsSchema = z.looseObject({\n providerName: z.string(),\n environmentOptions: z.unknown(),\n openOptions: z.unknown(),\n});\nconst unopenedSchema = z.object({\n unopenedRequest: openRequestFieldsSchema,\n});\n\nexport const unopenedRequestOf = (\n cause: unknown,\n): SandboxOpenRequestIface<unknown, unknown> | null => {\n const parsed = unopenedSchema.safeParse(cause);\n return parsed.success ? parsed.data.unopenedRequest : null;\n};\n\n// Packed entrypoints each own their declarations; the shared global must not name a private type.\nconst scopeMethodsSchema = z.looseObject({ current: z.function() });\nconst sandboxOpenScopeSchema = z.custom<SandboxOpenScopeIface>(\n (value) => scopeMethodsSchema.safeParse(value).success,\n);\n\nexport const awaitableOpenRequest = <T extends SandboxOpenRequestIface<unknown, unknown>>(\n request: T,\n): T & PromiseLike<NetworkSandboxSessionIface> => {\n const then: PromiseLike<NetworkSandboxSessionIface>['then'] = (onFulfilled, onRejected) => {\n const scope = sandboxOpenScopeSchema.safeParse(globalThis.__finalSandboxOpenScope).data;\n const opener = scope?.current() ?? null;\n const opened: Promise<NetworkSandboxSessionIface> =\n opener == null\n ? Promise.reject(\n Object.assign(\n new Error(\n `awaiting ${request.providerName}.open() opens a sandbox only inside a defineSandbox selector`,\n ),\n { unopenedRequest: { ...request } },\n ),\n )\n : opener(request);\n return opened.then(onFulfilled, onRejected);\n };\n // oxlint-disable-next-line unicorn/no-thenable -- awaiting the request inside a selector is the API.\n const awaitable = Object.assign(request, { then });\n // Non-enumerable: lowering, spreading and JSON never see it.\n // oxlint-disable-next-line unicorn/no-thenable -- the same property, made non-enumerable.\n Object.defineProperty(awaitable, 'then', { enumerable: false });\n return awaitable;\n};\n\n// Runtimes hand selectors their own sandbox clients; enough of the session\n// surface to be sure one is a session before the selector gets it.\nconst sessionMethodsSchema = z.looseObject({\n id: z.string(),\n description: z.string(),\n defaultWorkingDirectory: z.string(),\n ports: z.array(z.number()),\n readFile: z.function(),\n readBinaryFile: z.function(),\n readTextFile: z.function(),\n writeFile: z.function(),\n writeBinaryFile: z.function(),\n writeTextFile: z.function(),\n spawn: z.function(),\n run: z.function(),\n stat: z.function(),\n readDir: z.function(),\n resolvePath: z.function(),\n removePath: z.function(),\n getPortEndpoint: z.function(),\n getPortUrl: z.function(),\n stop: z.function(),\n destroy: z.function(),\n});\n\nexport const sandboxSessionSchema = z.custom<NetworkSandboxSessionIface>(\n (value) => sessionMethods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AE,MAAM,EAAE,OAAO,CAAC;AAAA,EACzB,UAAU,EAAE,SAAS;AAAA,EACrB,gBAAgB,EAAE,SAAS;AAAA,EAC3B,cAAc,EAAE,SAAS;AAAA,EACzB,WAAW,EAAE,SAAS;AAAA,EACtB,iBAAiB,EAAE,SAAS;AAAA,EAC5B,eAAe,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,SAAS;AAAA,EAClB,KAAK,EAAE,SAAS;AAAA,EAChB,MAAM,EAAE,SAAS;AAAA,EACjB,SAAS,EAAE,SAAS;AAAA,EACpB,aAAa,EAAE,SAAS;AAAA,EACxB,YAAY,EAAE,SAAS;AAAA,EACvB,iBAAiB,EAAE,SAAS;AAAA,EAC5B,YAAY,EAAE,SAAS;AAAA,EACvB,MAAM,EAAE,SAAS;AAAA,EACjB,SAAS,EAAE,SAAS;AACtB,CAAC;AAEM,MAAM,uBAAuB,EAAE;AAAA,EACpC,CAAC,UAAU,qBAAqB,UAAU,KAAK,EAAE;AACnD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SandboxWorkspace, type SandboxStartContextIface } from "./types.mjs";
|
|
2
|
-
export declare const sandboxWorkspaceId: (args: {
|
|
3
|
-
session: Pick<SandboxStartContextIface["session"], "bindingId" | "conversationId" | "target" | "workspaceId">;
|
|
4
|
-
workspace: SandboxWorkspace;
|
|
5
|
-
}) => string;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SandboxWorkspace } from "./types.mjs";
|
|
2
|
-
const encodeIdentityPart = (value) => {
|
|
3
|
-
if (!value.isWellFormed()) throw new Error("Workspace identity must contain valid Unicode");
|
|
4
|
-
return encodeURIComponent(value);
|
|
5
|
-
};
|
|
6
|
-
const sandboxWorkspaceId = (args) => {
|
|
7
|
-
const id = args.session.workspaceId ?? (args.workspace === SandboxWorkspace.Conversation && args.session.conversationId != null ? `conversation:${encodeIdentityPart(args.session.conversationId)}:${encodeIdentityPart(args.session.target)}` : `binding:${encodeIdentityPart(args.session.bindingId)}`);
|
|
8
|
-
if (id.length === 0) throw new Error("Supply a nonempty stable workspaceId");
|
|
9
|
-
return id;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
sandboxWorkspaceId
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=workspace-identity.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/sandbox/workspace-identity.ts"],
|
|
4
|
-
"sourcesContent": ["import { SandboxWorkspace, type SandboxStartContextIface } from \"./types.mjs\";\n\nconst encodeIdentityPart = (value: string): string => {\n if (!value.isWellFormed()) throw new Error('Workspace identity must contain valid Unicode');\n return encodeURIComponent(value);\n};\n\n// Conversation workspaces survive replacement bindings; other workspaces belong to their binding.\nexport const sandboxWorkspaceId = (args: {\n session: Pick<\n SandboxStartContextIface['session'],\n 'bindingId' | 'conversationId' | 'target' | 'workspaceId'\n >;\n workspace: SandboxWorkspace;\n}): string => {\n const id =\n args.session.workspaceId ??\n (args.workspace === SandboxWorkspace.Conversation && args.session.conversationId != null\n ? `conversation:${encodeIdentityPart(args.session.conversationId)}:${encodeIdentityPart(args.session.target)}`\n : `binding:${encodeIdentityPart(args.session.bindingId)}`);\n if (id.length === 0) throw new Error('Supply a nonempty stable workspaceId');\n return id;\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,wBAAuD;AAEhE,MAAM,qBAAqB,CAAC,UAA0B;AACpD,MAAI,CAAC,MAAM,aAAa,EAAG,OAAM,IAAI,MAAM,+CAA+C;AAC1F,SAAO,mBAAmB,KAAK;AACjC;AAGO,MAAM,qBAAqB,CAAC,SAMrB;AACZ,QAAM,KACJ,KAAK,QAAQ,gBACZ,KAAK,cAAc,iBAAiB,gBAAgB,KAAK,QAAQ,kBAAkB,OAChF,gBAAgB,mBAAmB,KAAK,QAAQ,cAAc,CAAC,IAAI,mBAAmB,KAAK,QAAQ,MAAM,CAAC,KAC1G,WAAW,mBAAmB,KAAK,QAAQ,SAAS,CAAC;AAC3D,MAAI,GAAG,WAAW,EAAG,OAAM,IAAI,MAAM,sCAAsC;AAC3E,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|