@finalai/agent-provider 0.5.0 → 0.6.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 +7 -7
- package/README.md +54 -0
- package/dist/modules/channel-socket.d.mts +8 -4
- package/dist/modules/channel-socket.mjs +39 -2
- package/dist/modules/channel-socket.mjs.map +2 -2
- package/dist/modules/channel.d.mts +323 -363
- package/dist/modules/channel.mjs +60 -145
- package/dist/modules/channel.mjs.map +3 -3
- package/dist/modules/credentials.mjs.map +2 -2
- package/dist/modules/index.d.mts +0 -1
- package/dist/modules/index.mjs +0 -1
- package/dist/modules/index.mjs.map +2 -2
- package/dist/modules/local-channel-context.d.mts +10 -0
- package/dist/modules/local-channel-context.mjs +55 -0
- package/dist/modules/local-channel-context.mjs.map +7 -0
- package/dist/modules/local-channel-socket.d.mts +8 -4
- package/dist/modules/local-channel-socket.mjs +1 -13
- package/dist/modules/local-channel-socket.mjs.map +2 -2
- package/dist/modules/manifest.d.mts +92 -4
- package/dist/modules/manifest.mjs +29 -9
- package/dist/modules/manifest.mjs.map +2 -2
- package/dist/modules/room-surface.d.mts +370 -0
- package/dist/modules/room-surface.mjs +156 -0
- package/dist/modules/room-surface.mjs.map +7 -0
- package/dist/modules/sandbox/networking.mjs +1 -0
- package/dist/modules/sandbox/networking.mjs.map +2 -2
- package/dist/modules/sandbox/types.d.mts +20 -0
- package/dist/modules/sandbox/types.mjs +6 -0
- package/dist/modules/sandbox/types.mjs.map +2 -2
- package/dist/modules/semantic-events.d.mts +69 -1
- package/dist/modules/semantic-events.mjs +14 -1
- package/dist/modules/semantic-events.mjs.map +2 -2
- package/package.json +14 -9
- package/dist/modules/channel-context.d.mts +0 -106
- package/dist/modules/channel-context.mjs +0 -45
- package/dist/modules/channel-context.mjs.map +0 -7
package/HOSTING.md
CHANGED
|
@@ -7,13 +7,13 @@ resolve against dev and production configuration without source edits.
|
|
|
7
7
|
## Selecting a deployment
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
export FINAL_API_HOST=https
|
|
11
|
-
export FINAL_API_KEY=<dev-
|
|
10
|
+
export FINAL_API_HOST=https://<dev-agents-api-host>/api
|
|
11
|
+
export FINAL_API_KEY=<dev-api-key>
|
|
12
12
|
pnpm exec final-agents build ./agent
|
|
13
13
|
pnpm exec final-agents publish ./agent --agent my-agent
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Choose production by changing the host and
|
|
16
|
+
Choose production by changing the host and API key. `--host` overrides
|
|
17
17
|
`FINAL_API_HOST`; without either, the existing production default remains. Build
|
|
18
18
|
compiles locally and optionally checks installed-harness compatibility. Publish
|
|
19
19
|
compiles again and sends source/release requests to the selected deployment.
|
|
@@ -240,7 +240,7 @@ before running. Shared manifest resolution rejects null results for required slo
|
|
|
240
240
|
even if a host catches a resolver exception and returns null. Hosts must propagate
|
|
241
241
|
that failure to startup. Session-started values stay pinned across turns and resume.
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
Hosts can use the compiled requirements to show
|
|
244
244
|
which names need configuration and return an actionable deployment-specific error.
|
|
245
245
|
|
|
246
246
|
## Host integration
|
|
@@ -269,6 +269,6 @@ Optional readers preserve source compatibility with existing hosts. Definitions
|
|
|
269
269
|
requesting bindings fail clearly if hosting does not provide them. Installing these
|
|
270
270
|
packages alone does not change Final's deployed service wiring or provision secrets.
|
|
271
271
|
|
|
272
|
-
New compiles emit manifest version
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
New compiles emit manifest version 4. Hosts and stored revisions must use v4;
|
|
273
|
+
recompile older definitions before loading them. Upgrade hosting before
|
|
274
|
+
publishing newly compiled agents.
|
package/README.md
CHANGED
|
@@ -21,6 +21,11 @@ a one-time startup check is insufficient. Custom `attach` implementations own
|
|
|
21
21
|
equivalent admission, deferred setup and failure cleanup. Namespace-only adapters
|
|
22
22
|
must disclose the startup traffic window when their provider cannot fence boot.
|
|
23
23
|
|
|
24
|
+
Hosts pass `credentials` (`SandboxCredentialsIface`) on sandbox contexts:
|
|
25
|
+
`computersAccess()`, `deviceAccess({ actingUserId })` and `secret({ secretRef })`.
|
|
26
|
+
Providers that need a third-party key take `credential: { secretRef }`
|
|
27
|
+
(`sandboxCredentialRefSchema`) in their environment options.
|
|
28
|
+
|
|
24
29
|
Implement the public provider interfaces and use `/conformance` to exercise them.
|
|
25
30
|
Use leaf entrypoints for sandbox wire clients, servers, MCP adapters, and local
|
|
26
31
|
channel sockets. These helpers adapt your integration to the provider contracts.
|
|
@@ -71,3 +76,52 @@ unguarded URL endpoints; attempts receive an explicit negotiation error.
|
|
|
71
76
|
Confined reads require a trusted system `python3` in `/usr/bin` or `/usr/local/bin`. Images with only conda, pyenv or nix Python must provide that prerequisite. Hosts supplying `authorizeOperation` own the complete RPC authorization decision, including Egress consent; audit-only hooks must delegate to an authorization policy. Egress capabilities are offered only when a host explicitly composes networking.
|
|
72
77
|
|
|
73
78
|
Acquiring a hosted MCP endpoint or channel is foreground work: it may start a server and perform deferred workspace setup. Catalog polling on an acquired channel is background maintenance and does not start setup. Abortable operations pass their signal to admission; cancellation rejects pending admission and prevents dispatch even if a host policy settles later.
|
|
79
|
+
|
|
80
|
+
## Channels v2
|
|
81
|
+
|
|
82
|
+
`ChannelDefinitionIface<Config, Inbound, State>` describes a provider namespace,
|
|
83
|
+
its application credentials, identity proof, place kinds, routes/listeners,
|
|
84
|
+
receive function, and typed semantic event handlers. Channels resolve people and
|
|
85
|
+
places through `ChannelReceiveContextIface`; they do not supply Final user,
|
|
86
|
+
conversation or agent IDs. A host validates every opaque person/conversation
|
|
87
|
+
handle against its binding and invocation.
|
|
88
|
+
|
|
89
|
+
`post` records a linked person's message. `input` without `principal` is a
|
|
90
|
+
nonhuman event; `input` with a principal represents an unlinked person and requires
|
|
91
|
+
an explicitly configured `anyone` audience. A shared place cannot target Home.
|
|
92
|
+
`attach` records content without dispatching a turn. It supports recordings and
|
|
93
|
+
other channel-produced attachments. Explicit `anyone`/`group` defaults let `places.resolve`
|
|
94
|
+
create a Shared chat for a new anonymous call. Input idempotency keys are scoped to
|
|
95
|
+
the selected route; never derive a key from a temporary handle. `places.observers` returns scoped observe
|
|
96
|
+
routes for resource notifications. An anonymous `turns.cancel` may cancel only an
|
|
97
|
+
anonymous turn started by this binding and route. Supply `turnId` to target an
|
|
98
|
+
accepted turn; a host must refuse cancellation if stopping its shared execution
|
|
99
|
+
would also interrupt unrelated requests. Hosts must check these rules on
|
|
100
|
+
every operation, including on retries after membership or link revocation.
|
|
101
|
+
|
|
102
|
+
Semantic events cover messages, tools, plans, decisions and turn completion, plus
|
|
103
|
+
origin-bearing edits/removals/reactions. Completion events include the reply and
|
|
104
|
+
are delivered at least once; channels persist provider reply IDs in `store` for
|
|
105
|
+
deduplication. `replies: all` enables `message.posted` mirroring. Raw ACP updates
|
|
106
|
+
belong to harnesses and the separately typed Final room surface.
|
|
107
|
+
|
|
108
|
+
`observe` streams deltas directly and accepts a cancellation signal. Media
|
|
109
|
+
operations stream transcription and synthesis and accept an optional `signal` to
|
|
110
|
+
abort pending provider work on hangup or interruption. HTTP and binary WebSocket routes
|
|
111
|
+
receive the same capabilities; listeners additionally receive an abort signal.
|
|
112
|
+
Package execution obtains shared OAuth/signing metadata with `appInfo()` and
|
|
113
|
+
selects a tenant API credential with `app({tenant})`. `appInfo()` never returns an access token.
|
|
114
|
+
`app()` and `appInfo()` are available only in package execution. Isolated code
|
|
115
|
+
uses the host's credential-injecting fetch and explicitly declared project secrets
|
|
116
|
+
through `secret(name)`.
|
|
117
|
+
A host must fail ambiguous tenant selection rather than choosing an arbitrary
|
|
118
|
+
credential. Tenant-wide `people.revoke` with reason `uninstalled` or
|
|
119
|
+
`provider-revoked` and no principal also disconnects that tenant's places. Omitting
|
|
120
|
+
the tenant applies this lifecycle change to the binding's namespace. A socket handler may attach its buffered recording during a ten-second
|
|
121
|
+
cleanup grace after disconnect; every other operation is revoked immediately, and all
|
|
122
|
+
capabilities end when the handler returns. Attachment authorization still applies.
|
|
123
|
+
|
|
124
|
+
Manifest v4 records channel credentials and `surface` routes/listeners/place kinds.
|
|
125
|
+
The `roomSurface` field describes `channels/final.ts` separately. The old address,
|
|
126
|
+
attached-session, handoff and bound-conversation channel API is removed. Existing
|
|
127
|
+
channel authors must migrate and republish their definitions.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChannelSocketIface } from "./channel.mjs";
|
|
3
3
|
import { type JsonValue } from "./json.mjs";
|
|
4
4
|
export declare const CHANNEL_SOCKET_MAX_MESSAGE_BYTES: number;
|
|
5
5
|
export declare const CHANNEL_SOCKET_MAX_LINE_BYTES: number;
|
|
@@ -55,9 +55,13 @@ export declare const channelSocketData: (message: {
|
|
|
55
55
|
data: string;
|
|
56
56
|
binary: boolean;
|
|
57
57
|
}) => string | Uint8Array;
|
|
58
|
-
export declare const runChannelSocketHandler:
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
export declare const runChannelSocketHandler: <Context extends {
|
|
59
|
+
request: Request;
|
|
60
|
+
}>(args: {
|
|
61
|
+
handler: (context: Context & {
|
|
62
|
+
socket: ChannelSocketIface;
|
|
63
|
+
}) => Promise<Response | void>;
|
|
64
|
+
context: Context;
|
|
61
65
|
messages: AsyncIterable<string | Uint8Array>;
|
|
62
66
|
signal: AbortSignal;
|
|
63
67
|
emit: (action: ChannelSocketAction) => void;
|
|
@@ -53,10 +53,35 @@ const channelSocketData = (message) => {
|
|
|
53
53
|
channelSocketMessage(data);
|
|
54
54
|
return data;
|
|
55
55
|
};
|
|
56
|
+
const guardContext = (value, authorize) => new Proxy(value, {
|
|
57
|
+
get: (target, key, receiver) => {
|
|
58
|
+
const member = Reflect.get(target, key, receiver);
|
|
59
|
+
if (typeof member === "function")
|
|
60
|
+
return (...args) => {
|
|
61
|
+
authorize(key);
|
|
62
|
+
const result = Reflect.apply(member, target, args);
|
|
63
|
+
return result != null && typeof result === "object" && Object.getPrototypeOf(result) === Object.prototype ? guardContext(result, authorize) : result;
|
|
64
|
+
};
|
|
65
|
+
return member != null && typeof member === "object" && Object.getPrototypeOf(member) === Object.prototype ? guardContext(member, authorize) : member;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
56
68
|
const runChannelSocketHandler = async (args) => {
|
|
57
69
|
args.signal.throwIfAborted();
|
|
58
70
|
let accepted = false;
|
|
59
71
|
let closed = false;
|
|
72
|
+
let alive = true;
|
|
73
|
+
let cleanupUntil = null;
|
|
74
|
+
const allowCleanup = () => {
|
|
75
|
+
cleanupUntil = Date.now() + 1e4;
|
|
76
|
+
};
|
|
77
|
+
args.signal.addEventListener("abort", allowCleanup, { once: true });
|
|
78
|
+
const authorize = (key) => {
|
|
79
|
+
if (!alive) throw new Error("Channel invocation has ended");
|
|
80
|
+
if (!args.signal.aborted) return;
|
|
81
|
+
if ((key === "conversation" || key === "attach") && cleanupUntil != null && Date.now() <= cleanupUntil)
|
|
82
|
+
return;
|
|
83
|
+
args.signal.throwIfAborted();
|
|
84
|
+
};
|
|
60
85
|
const socket = {
|
|
61
86
|
signal: args.signal,
|
|
62
87
|
messages: args.messages,
|
|
@@ -86,7 +111,7 @@ const runChannelSocketHandler = async (args) => {
|
|
|
86
111
|
}
|
|
87
112
|
};
|
|
88
113
|
try {
|
|
89
|
-
const response = await args.handler({ ...args.context, socket });
|
|
114
|
+
const response = await args.handler({ ...guardContext(args.context, authorize), socket });
|
|
90
115
|
if (args.signal.aborted) return;
|
|
91
116
|
if (!accepted) {
|
|
92
117
|
const rejected = response ?? new Response("No channel socket accepted", { status: 400 });
|
|
@@ -98,7 +123,16 @@ const runChannelSocketHandler = async (args) => {
|
|
|
98
123
|
});
|
|
99
124
|
} else socket.close();
|
|
100
125
|
} catch {
|
|
101
|
-
if (args.signal.aborted)
|
|
126
|
+
if (args.signal.aborted) {
|
|
127
|
+
const diagnostic = Reflect.get(args.context, "log");
|
|
128
|
+
if (typeof diagnostic === "function") {
|
|
129
|
+
try {
|
|
130
|
+
Reflect.apply(diagnostic, args.context, ["Channel socket cleanup failed."]);
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
102
136
|
if (accepted) socket.close(1011, "Channel socket failed");
|
|
103
137
|
else
|
|
104
138
|
args.emit({
|
|
@@ -107,6 +141,9 @@ const runChannelSocketHandler = async (args) => {
|
|
|
107
141
|
headers: {},
|
|
108
142
|
body: bytesToBase64(new TextEncoder().encode("Channel socket failed"))
|
|
109
143
|
});
|
|
144
|
+
} finally {
|
|
145
|
+
alive = false;
|
|
146
|
+
args.signal.removeEventListener("abort", allowCleanup);
|
|
110
147
|
}
|
|
111
148
|
};
|
|
112
149
|
const readRejectionBody = async (response) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/channel-socket.ts"],
|
|
4
|
-
"sourcesContent": ["import * as z from 'zod';\nimport type { ChannelSocketIface, WebSocketChannelRouteDefinitionIface } from \"./channel.mjs\";\nimport { jsonValueSchema, type JsonValue } from \"./json.mjs\";\nimport { base64ToBytes, bytesToBase64 } from \"./sandbox/bytes.mjs\";\n\nexport const CHANNEL_SOCKET_MAX_MESSAGE_BYTES = 1024 * 1024;\nexport const CHANNEL_SOCKET_MAX_LINE_BYTES = 8 * 1024 * 1024;\n\nexport enum ChannelSocketCommandKind {\n Message = 'message',\n Close = 'close',\n Context = 'context',\n}\n\nexport enum ChannelSocketActionKind {\n Accept = 'accept',\n Message = 'message',\n Close = 'close',\n Reject = 'reject',\n}\n\nconst messageFields = { data: z.string(), binary: z.boolean() };\nexport const validChannelSocketClose = (code: number): boolean =>\n code === 1000 ||\n code === 1001 ||\n code === 1002 ||\n code === 1003 ||\n (code >= 1007 && code <= 1014) ||\n (code >= 3000 && code <= 4999);\n\nconst closeFields = {\n code: z.number().int().refine(validChannelSocketClose).optional(),\n reason: z\n .string()\n .refine((value) => new TextEncoder().encode(value).byteLength <= 123)\n .optional(),\n};\nexport const channelSocketCommandSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal(ChannelSocketCommandKind.Message), ...messageFields }),\n z.object({ kind: z.literal(ChannelSocketCommandKind.Close), ...closeFields }),\n z.object({ kind: z.literal(ChannelSocketCommandKind.Context), token: z.string() }),\n]);\nexport const channelSocketActionSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal(ChannelSocketActionKind.Accept),\n protocol: z.string().optional(),\n metadata: jsonValueSchema.optional(),\n }),\n z.object({ kind: z.literal(ChannelSocketActionKind.Message), ...messageFields }),\n z.object({ kind: z.literal(ChannelSocketActionKind.Close), ...closeFields }),\n z.object({\n kind: z.literal(ChannelSocketActionKind.Reject),\n status: z.number().int().min(200).max(599),\n headers: z.record(z.string(), z.string()),\n body: z.string(),\n }),\n]);\nexport type ChannelSocketCommand = z.infer<typeof channelSocketCommandSchema>;\nexport type ChannelSocketAction = z.infer<typeof channelSocketActionSchema>;\n\nexport const channelSocketMessage = (\n data: string | Uint8Array,\n): { data: string; binary: boolean } => {\n const size =\n data instanceof Uint8Array ? data.byteLength : new TextEncoder().encode(data).byteLength;\n if (size > CHANNEL_SOCKET_MAX_MESSAGE_BYTES)\n throw new Error('Channel socket message exceeds 1 MiB');\n return data instanceof Uint8Array\n ? { data: bytesToBase64(data), binary: true }\n : { data, binary: false };\n};\nexport const channelSocketData = (message: {\n data: string;\n binary: boolean;\n}): string | Uint8Array => {\n const data = message.binary ? base64ToBytes(message.data) : message.data;\n channelSocketMessage(data);\n return data;\n};\n\nexport const runChannelSocketHandler = async (args: {\n handler: WebSocketChannelRouteDefinitionIface['handler'];\n context: Omit<Parameters<WebSocketChannelRouteDefinitionIface['handler']>[0], 'socket'>;\n messages: AsyncIterable<string | Uint8Array>;\n signal: AbortSignal;\n emit: (action: ChannelSocketAction) => void;\n}): Promise<void> => {\n args.signal.throwIfAborted();\n let accepted = false;\n let closed = false;\n const socket: ChannelSocketIface = {\n signal: args.signal,\n messages: args.messages,\n accept: (options) => {\n args.signal.throwIfAborted();\n if (accepted || closed) throw new Error('Channel socket already accepted or closed');\n const protocol = options?.protocol;\n if (\n protocol != null &&\n (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(protocol) ||\n !(args.context.request.headers.get('sec-websocket-protocol') ?? '')\n .split(',')\n .map((part) => part.trim())\n .includes(protocol))\n )\n throw new Error('Channel socket selected a protocol the caller did not offer');\n accepted = true;\n args.emit(\n protocol == null\n ? { kind: ChannelSocketActionKind.Accept }\n : { kind: ChannelSocketActionKind.Accept, protocol },\n );\n },\n send: (data) => {\n args.signal.throwIfAborted();\n if (!accepted || closed) throw new Error('Channel socket is not open');\n args.emit({ kind: ChannelSocketActionKind.Message, ...channelSocketMessage(data) });\n },\n close: (code = 1000, reason = '') => {\n if (closed || args.signal.aborted) return;\n if (!accepted) throw new Error('Reject the handshake with an HTTP response before accepting');\n if (!validChannelSocketClose(code) || new TextEncoder().encode(reason).byteLength > 123)\n throw new Error('Invalid channel socket close');\n closed = true;\n args.emit({ kind: ChannelSocketActionKind.Close, code, reason });\n },\n };\n try {\n const response = await args.handler({ ...args.context, socket });\n if (args.signal.aborted) return;\n if (!accepted) {\n const rejected = response ?? new Response('No channel socket accepted', { status: 400 });\n args.emit({\n kind: ChannelSocketActionKind.Reject,\n status: rejected.status,\n headers: Object.fromEntries(rejected.headers),\n body: bytesToBase64(await readRejectionBody(rejected)),\n });\n } else socket.close();\n } catch {\n if (args.signal.aborted) return;\n if (accepted) socket.close(1011, 'Channel socket failed');\n else\n args.emit({\n kind: ChannelSocketActionKind.Reject,\n status: 500,\n headers: {},\n body: bytesToBase64(new TextEncoder().encode('Channel socket failed')),\n });\n }\n};\n\nconst readRejectionBody = async (response: Response): Promise<Uint8Array> => {\n if (response.body == null) return new Uint8Array();\n const reader = response.body.getReader();\n const chunks: Uint8Array[] = [];\n let length = 0;\n try {\n for (;;) {\n const item = await reader.read();\n if (item.done) break;\n length += item.value.byteLength;\n if (length > CHANNEL_SOCKET_MAX_MESSAGE_BYTES)\n throw new Error('Channel socket rejection exceeds 1 MiB');\n chunks.push(item.value);\n }\n const body = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n body.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return body;\n } finally {\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n};\n\n// Byte streams can cross Worker RPC. Each bounded line keeps one socket message intact.\nexport async function* readChannelSocketLines(\n body: ReadableStream<Uint8Array>,\n signal?: AbortSignal,\n): AsyncGenerator<JsonValue> {\n const reader = body.getReader();\n const cancel = () => {\n void reader.cancel().catch(() => undefined);\n };\n signal?.addEventListener('abort', cancel, { once: true });\n if (signal?.aborted === true) cancel();\n const decoder = new TextDecoder('utf-8', { fatal: true });\n const encoder = new TextEncoder();\n let buffer = '';\n try {\n for (;;) {\n const item = await reader.read();\n if (item.done) break;\n buffer += decoder.decode(item.value, { stream: true });\n let newline = buffer.indexOf('\\n');\n while (newline >= 0) {\n if (encoder.encode(buffer.slice(0, newline)).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n const line = buffer.slice(0, newline);\n buffer = buffer.slice(newline + 1);\n if (line.length > 0) yield jsonValueSchema.parse(JSON.parse(line));\n newline = buffer.indexOf('\\n');\n }\n if (encoder.encode(buffer).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n }\n buffer += decoder.decode();\n if (encoder.encode(buffer).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n if (buffer.length > 0) yield jsonValueSchema.parse(JSON.parse(buffer));\n } finally {\n signal?.removeEventListener('abort', cancel);\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,OAAO;AAEnB,SAAS,uBAAuC;AAChD,SAAS,eAAe,qBAAqB;AAEtC,M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AC9B,UAAU,gBAAgB,SAAS;AAAA,EACrC,CAAC;AAAA,EACD,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,uBAA+B,GAAG,GAAG,cAAc,CAAC;AAAA,EAC/E,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,mBAA6B,GAAG,GAAG,YAAY,CAAC;AAAA,EAC3E,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,QAAQ,qBAA8B;AAAA,IAC9C,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,IAAI,GAAG;AAAA,IACzC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAAA,IACxC,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,MAAM,uBAAuB,CAClC,SACsC;AACtC,QAAM,OACJ,gBAAgB,aAAa,KAAK,aAAa,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAChF,MAAI,OAAO;AACT,UAAM,IAAI,MAAM,sCAAsC;AACxD,SAAO,gBAAgB,aACnB,EAAE,MAAM,cAAc,IAAI,GAAG,QAAQ,KAAK,IAC1C,EAAE,MAAM,QAAQ,MAAM;AAC5B;AACO,MAAM,oBAAoB,CAAC,YAGP;AACzB,QAAM,OAAO,QAAQ,SAAS,cAAc,QAAQ,IAAI,IAAI,QAAQ;AACpE,uBAAqB,IAAI;AACzB,SAAO;AACT;
|
|
4
|
+
"sourcesContent": ["import * as z from 'zod';\nimport type { ChannelSocketIface } from \"./channel.mjs\";\nimport { jsonValueSchema, type JsonValue } from \"./json.mjs\";\nimport { base64ToBytes, bytesToBase64 } from \"./sandbox/bytes.mjs\";\n\nexport const CHANNEL_SOCKET_MAX_MESSAGE_BYTES = 1024 * 1024;\nexport const CHANNEL_SOCKET_MAX_LINE_BYTES = 8 * 1024 * 1024;\n\nexport enum ChannelSocketCommandKind {\n Message = 'message',\n Close = 'close',\n Context = 'context',\n}\n\nexport enum ChannelSocketActionKind {\n Accept = 'accept',\n Message = 'message',\n Close = 'close',\n Reject = 'reject',\n}\n\nconst messageFields = { data: z.string(), binary: z.boolean() };\nexport const validChannelSocketClose = (code: number): boolean =>\n code === 1000 ||\n code === 1001 ||\n code === 1002 ||\n code === 1003 ||\n (code >= 1007 && code <= 1014) ||\n (code >= 3000 && code <= 4999);\n\nconst closeFields = {\n code: z.number().int().refine(validChannelSocketClose).optional(),\n reason: z\n .string()\n .refine((value) => new TextEncoder().encode(value).byteLength <= 123)\n .optional(),\n};\nexport const channelSocketCommandSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal(ChannelSocketCommandKind.Message), ...messageFields }),\n z.object({ kind: z.literal(ChannelSocketCommandKind.Close), ...closeFields }),\n z.object({ kind: z.literal(ChannelSocketCommandKind.Context), token: z.string() }),\n]);\nexport const channelSocketActionSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal(ChannelSocketActionKind.Accept),\n protocol: z.string().optional(),\n metadata: jsonValueSchema.optional(),\n }),\n z.object({ kind: z.literal(ChannelSocketActionKind.Message), ...messageFields }),\n z.object({ kind: z.literal(ChannelSocketActionKind.Close), ...closeFields }),\n z.object({\n kind: z.literal(ChannelSocketActionKind.Reject),\n status: z.number().int().min(200).max(599),\n headers: z.record(z.string(), z.string()),\n body: z.string(),\n }),\n]);\nexport type ChannelSocketCommand = z.infer<typeof channelSocketCommandSchema>;\nexport type ChannelSocketAction = z.infer<typeof channelSocketActionSchema>;\n\nexport const channelSocketMessage = (\n data: string | Uint8Array,\n): { data: string; binary: boolean } => {\n const size =\n data instanceof Uint8Array ? data.byteLength : new TextEncoder().encode(data).byteLength;\n if (size > CHANNEL_SOCKET_MAX_MESSAGE_BYTES)\n throw new Error('Channel socket message exceeds 1 MiB');\n return data instanceof Uint8Array\n ? { data: bytesToBase64(data), binary: true }\n : { data, binary: false };\n};\nexport const channelSocketData = (message: {\n data: string;\n binary: boolean;\n}): string | Uint8Array => {\n const data = message.binary ? base64ToBytes(message.data) : message.data;\n channelSocketMessage(data);\n return data;\n};\n\n// Retained capability objects must stop accepting work after their socket closes.\nconst guardContext = <Value extends object>(\n value: Value,\n authorize: (key: PropertyKey) => void,\n): Value =>\n new Proxy(value, {\n get: (target, key, receiver) => {\n const member: unknown = Reflect.get(target, key, receiver);\n if (typeof member === 'function')\n return (...args: unknown[]) => {\n authorize(key);\n const result: unknown = Reflect.apply(member, target, args);\n return result != null &&\n typeof result === 'object' &&\n Object.getPrototypeOf(result) === Object.prototype\n ? guardContext(result, authorize)\n : result;\n };\n return member != null &&\n typeof member === 'object' &&\n Object.getPrototypeOf(member) === Object.prototype\n ? guardContext(member, authorize)\n : member;\n },\n });\n\nexport const runChannelSocketHandler = async <Context extends { request: Request }>(args: {\n handler: (context: Context & { socket: ChannelSocketIface }) => Promise<Response | void>;\n context: Context;\n messages: AsyncIterable<string | Uint8Array>;\n signal: AbortSignal;\n emit: (action: ChannelSocketAction) => void;\n}): Promise<void> => {\n args.signal.throwIfAborted();\n let accepted = false;\n let closed = false;\n let alive = true;\n let cleanupUntil: number | null = null;\n const allowCleanup = () => {\n cleanupUntil = Date.now() + 10_000;\n };\n args.signal.addEventListener('abort', allowCleanup, { once: true });\n const authorize = (key: PropertyKey): void => {\n if (!alive) throw new Error('Channel invocation has ended');\n if (!args.signal.aborted) return;\n if (\n (key === 'conversation' || key === 'attach') &&\n cleanupUntil != null &&\n Date.now() <= cleanupUntil\n )\n return;\n args.signal.throwIfAborted();\n };\n const socket: ChannelSocketIface = {\n signal: args.signal,\n messages: args.messages,\n accept: (options) => {\n args.signal.throwIfAborted();\n if (accepted || closed) throw new Error('Channel socket already accepted or closed');\n const protocol = options?.protocol;\n if (\n protocol != null &&\n (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(protocol) ||\n !(args.context.request.headers.get('sec-websocket-protocol') ?? '')\n .split(',')\n .map((part) => part.trim())\n .includes(protocol))\n )\n throw new Error('Channel socket selected a protocol the caller did not offer');\n accepted = true;\n args.emit(\n protocol == null\n ? { kind: ChannelSocketActionKind.Accept }\n : { kind: ChannelSocketActionKind.Accept, protocol },\n );\n },\n send: (data) => {\n args.signal.throwIfAborted();\n if (!accepted || closed) throw new Error('Channel socket is not open');\n args.emit({ kind: ChannelSocketActionKind.Message, ...channelSocketMessage(data) });\n },\n close: (code = 1000, reason = '') => {\n if (closed || args.signal.aborted) return;\n if (!accepted) throw new Error('Reject the handshake with an HTTP response before accepting');\n if (!validChannelSocketClose(code) || new TextEncoder().encode(reason).byteLength > 123)\n throw new Error('Invalid channel socket close');\n closed = true;\n args.emit({ kind: ChannelSocketActionKind.Close, code, reason });\n },\n };\n try {\n const response = await args.handler({ ...guardContext(args.context, authorize), socket });\n if (args.signal.aborted) return;\n if (!accepted) {\n const rejected = response ?? new Response('No channel socket accepted', { status: 400 });\n args.emit({\n kind: ChannelSocketActionKind.Reject,\n status: rejected.status,\n headers: Object.fromEntries(rejected.headers),\n body: bytesToBase64(await readRejectionBody(rejected)),\n });\n } else socket.close();\n } catch {\n if (args.signal.aborted) {\n const diagnostic: unknown = Reflect.get(args.context, 'log');\n if (typeof diagnostic === 'function') {\n try {\n Reflect.apply(diagnostic, args.context, ['Channel socket cleanup failed.']);\n } catch {\n /* Diagnostics must not restart a closed socket. */\n }\n }\n return;\n }\n if (accepted) socket.close(1011, 'Channel socket failed');\n else\n args.emit({\n kind: ChannelSocketActionKind.Reject,\n status: 500,\n headers: {},\n body: bytesToBase64(new TextEncoder().encode('Channel socket failed')),\n });\n } finally {\n alive = false;\n args.signal.removeEventListener('abort', allowCleanup);\n }\n};\n\nconst readRejectionBody = async (response: Response): Promise<Uint8Array> => {\n if (response.body == null) return new Uint8Array();\n const reader = response.body.getReader();\n const chunks: Uint8Array[] = [];\n let length = 0;\n try {\n for (;;) {\n const item = await reader.read();\n if (item.done) break;\n length += item.value.byteLength;\n if (length > CHANNEL_SOCKET_MAX_MESSAGE_BYTES)\n throw new Error('Channel socket rejection exceeds 1 MiB');\n chunks.push(item.value);\n }\n const body = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n body.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return body;\n } finally {\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n};\n\n// Byte streams can cross Worker RPC. Each bounded line keeps one socket message intact.\nexport async function* readChannelSocketLines(\n body: ReadableStream<Uint8Array>,\n signal?: AbortSignal,\n): AsyncGenerator<JsonValue> {\n const reader = body.getReader();\n const cancel = () => {\n void reader.cancel().catch(() => undefined);\n };\n signal?.addEventListener('abort', cancel, { once: true });\n if (signal?.aborted === true) cancel();\n const decoder = new TextDecoder('utf-8', { fatal: true });\n const encoder = new TextEncoder();\n let buffer = '';\n try {\n for (;;) {\n const item = await reader.read();\n if (item.done) break;\n buffer += decoder.decode(item.value, { stream: true });\n let newline = buffer.indexOf('\\n');\n while (newline >= 0) {\n if (encoder.encode(buffer.slice(0, newline)).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n const line = buffer.slice(0, newline);\n buffer = buffer.slice(newline + 1);\n if (line.length > 0) yield jsonValueSchema.parse(JSON.parse(line));\n newline = buffer.indexOf('\\n');\n }\n if (encoder.encode(buffer).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n }\n buffer += decoder.decode();\n if (encoder.encode(buffer).byteLength > CHANNEL_SOCKET_MAX_LINE_BYTES)\n throw new Error('Channel socket line exceeds its limit');\n if (buffer.length > 0) yield jsonValueSchema.parse(JSON.parse(buffer));\n } finally {\n signal?.removeEventListener('abort', cancel);\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,OAAO;AAEnB,SAAS,uBAAuC;AAChD,SAAS,eAAe,qBAAqB;AAEtC,MAAM,mCAAmC,OAAO;AAChD,MAAM,gCAAgC,IAAI,OAAO;AAEjD,IAAK,2BAAL,kBAAKA,8BAAL;A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