@chat-js/registry 0.2.0-beta.2 → 0.2.0-beta.4
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/README.md +15 -11
- package/dist/r/ai-titles.json +10 -10
- package/dist/r/akamai-storage.json +1 -1
- package/dist/r/alibaba-storage.json +1 -1
- package/dist/r/appwrite-storage.json +1 -1
- package/dist/r/archil-storage.json +1 -1
- package/dist/r/attach-workspace-file.json +82 -0
- package/dist/r/attachment-uploads.json +19 -21
- package/dist/r/azure-storage.json +1 -1
- package/dist/r/backblaze-b2-storage.json +1 -1
- package/dist/r/base/ai-titles.json +10 -10
- package/dist/r/base/akamai-storage.json +1 -1
- package/dist/r/base/alibaba-storage.json +1 -1
- package/dist/r/base/appwrite-storage.json +1 -1
- package/dist/r/base/archil-storage.json +1 -1
- package/dist/r/base/attach-workspace-file.json +82 -0
- package/dist/r/base/attachment-uploads.json +19 -21
- package/dist/r/base/azure-storage.json +1 -1
- package/dist/r/base/backblaze-b2-storage.json +1 -1
- package/dist/r/base/bunny-storage-storage.json +1 -1
- package/dist/r/base/cloudinary-storage.json +1 -1
- package/dist/r/base/credits.json +22 -22
- package/dist/r/base/deep-research.json +57 -139
- package/dist/r/base/default-sandbox.json +35 -0
- package/dist/r/base/desktop.json +144 -0
- package/dist/r/base/digitalocean-spaces-storage.json +1 -1
- package/dist/r/base/docker-sandbox.json +35 -0
- package/dist/r/base/dropbox-storage.json +1 -1
- package/dist/r/base/exoscale-storage.json +1 -1
- package/dist/r/base/feedback.json +25 -25
- package/dist/r/base/filebase-storage.json +1 -1
- package/dist/r/base/firebase-storage-storage.json +1 -1
- package/dist/r/base/followup-suggestions.json +40 -40
- package/dist/r/base/ftp-storage.json +1 -1
- package/dist/r/base/gcs-storage.json +1 -1
- package/dist/r/base/generate-image.json +21 -15
- package/dist/r/base/generate-video.json +15 -9
- package/dist/r/base/google-drive-storage.json +1 -1
- package/dist/r/base/guest-chat.json +181 -0
- package/dist/r/base/hetzner-storage.json +1 -1
- package/dist/r/base/ibm-cos-storage.json +1 -1
- package/dist/r/base/idrive-e2-storage.json +1 -1
- package/dist/r/base/image-viewer.json +55 -0
- package/dist/r/base/just-bash-sandbox.json +32 -0
- package/dist/r/base/litellm-gateway.json +2 -5
- package/dist/r/base/mcp.json +123 -93
- package/dist/r/base/memory-storage.json +1 -1
- package/dist/r/base/minio-storage.json +1 -1
- package/dist/r/base/model-preferences.json +35 -28
- package/dist/r/base/neon-storage.json +1 -1
- package/dist/r/base/netlify-blobs-storage.json +1 -1
- package/dist/r/base/onedrive-storage.json +1 -1
- package/dist/r/base/openai-compatible-gateway.json +2 -5
- package/dist/r/base/openai-gateway.json +2 -5
- package/dist/r/base/openrouter-gateway.json +2 -6
- package/dist/r/base/oracle-cloud-storage.json +1 -1
- package/dist/r/base/ovhcloud-storage.json +1 -1
- package/dist/r/base/pocketbase-storage.json +1 -1
- package/dist/r/base/projects.json +104 -83
- package/dist/r/base/r2-storage.json +1 -1
- package/dist/r/base/registry.json +1725 -2117
- package/dist/r/base/s3-storage.json +1 -1
- package/dist/r/base/scaleway-storage.json +1 -1
- package/dist/r/base/search.json +70 -40
- package/dist/r/base/sftp-storage.json +1 -1
- package/dist/r/base/sharepoint-storage.json +1 -1
- package/dist/r/base/sharing.json +55 -39
- package/dist/r/base/spreadsheet-grid.json +20 -0
- package/dist/r/base/spreadsheet-viewer.json +68 -0
- package/dist/r/base/storj-storage.json +1 -1
- package/dist/r/base/supabase-storage.json +1 -1
- package/dist/r/base/tencent-storage.json +1 -1
- package/dist/r/base/tigris-storage.json +1 -1
- package/dist/r/base/uploadthing-storage.json +1 -1
- package/dist/r/base/vercel-blob-storage.json +1 -1
- package/dist/r/base/vercel-gateway.json +2 -6
- package/dist/r/base/vercel-sandbox.json +8 -26
- package/dist/r/base/video-viewer.json +48 -0
- package/dist/r/base/vultr-storage.json +1 -1
- package/dist/r/base/wasabi-storage.json +1 -1
- package/dist/r/base/webdav-storage.json +1 -1
- package/dist/r/base/yandex-storage.json +1 -1
- package/dist/r/bunny-storage-storage.json +1 -1
- package/dist/r/cloudinary-storage.json +1 -1
- package/dist/r/credits.json +22 -22
- package/dist/r/deep-research.json +57 -139
- package/dist/r/default-sandbox.json +35 -0
- package/dist/r/desktop.json +144 -0
- package/dist/r/digitalocean-spaces-storage.json +1 -1
- package/dist/r/docker-sandbox.json +35 -0
- package/dist/r/dropbox-storage.json +1 -1
- package/dist/r/eve/deep-research.json +47 -0
- package/dist/r/eve/registry.json +53 -0
- package/dist/r/exoscale-storage.json +1 -1
- package/dist/r/feedback.json +25 -25
- package/dist/r/filebase-storage.json +1 -1
- package/dist/r/firebase-storage-storage.json +1 -1
- package/dist/r/followup-suggestions.json +40 -40
- package/dist/r/ftp-storage.json +1 -1
- package/dist/r/gcs-storage.json +1 -1
- package/dist/r/generate-image.json +21 -15
- package/dist/r/generate-video.json +15 -9
- package/dist/r/google-drive-storage.json +1 -1
- package/dist/r/guest-chat.json +181 -0
- package/dist/r/hetzner-storage.json +1 -1
- package/dist/r/ibm-cos-storage.json +1 -1
- package/dist/r/idrive-e2-storage.json +1 -1
- package/dist/r/image-viewer.json +55 -0
- package/dist/r/just-bash-sandbox.json +32 -0
- package/dist/r/litellm-gateway.json +2 -5
- package/dist/r/mcp.json +123 -93
- package/dist/r/memory-storage.json +1 -1
- package/dist/r/minio-storage.json +1 -1
- package/dist/r/model-preferences.json +35 -28
- package/dist/r/neon-storage.json +1 -1
- package/dist/r/netlify-blobs-storage.json +1 -1
- package/dist/r/onedrive-storage.json +1 -1
- package/dist/r/openai-compatible-gateway.json +2 -5
- package/dist/r/openai-gateway.json +2 -5
- package/dist/r/openrouter-gateway.json +2 -6
- package/dist/r/oracle-cloud-storage.json +1 -1
- package/dist/r/ovhcloud-storage.json +1 -1
- package/dist/r/pocketbase-storage.json +1 -1
- package/dist/r/projects.json +104 -83
- package/dist/r/r2-storage.json +1 -1
- package/dist/r/radix/ai-titles.json +10 -10
- package/dist/r/radix/akamai-storage.json +1 -1
- package/dist/r/radix/alibaba-storage.json +1 -1
- package/dist/r/radix/appwrite-storage.json +1 -1
- package/dist/r/radix/archil-storage.json +1 -1
- package/dist/r/radix/attach-workspace-file.json +82 -0
- package/dist/r/radix/attachment-uploads.json +19 -21
- package/dist/r/radix/azure-storage.json +1 -1
- package/dist/r/radix/backblaze-b2-storage.json +1 -1
- package/dist/r/radix/bunny-storage-storage.json +1 -1
- package/dist/r/radix/cloudinary-storage.json +1 -1
- package/dist/r/radix/credits.json +22 -22
- package/dist/r/radix/deep-research.json +57 -139
- package/dist/r/radix/default-sandbox.json +35 -0
- package/dist/r/radix/desktop.json +144 -0
- package/dist/r/radix/digitalocean-spaces-storage.json +1 -1
- package/dist/r/radix/docker-sandbox.json +35 -0
- package/dist/r/radix/dropbox-storage.json +1 -1
- package/dist/r/radix/exoscale-storage.json +1 -1
- package/dist/r/radix/feedback.json +25 -25
- package/dist/r/radix/filebase-storage.json +1 -1
- package/dist/r/radix/firebase-storage-storage.json +1 -1
- package/dist/r/radix/followup-suggestions.json +40 -40
- package/dist/r/radix/ftp-storage.json +1 -1
- package/dist/r/radix/gcs-storage.json +1 -1
- package/dist/r/radix/generate-image.json +21 -15
- package/dist/r/radix/generate-video.json +15 -9
- package/dist/r/radix/google-drive-storage.json +1 -1
- package/dist/r/radix/guest-chat.json +181 -0
- package/dist/r/radix/hetzner-storage.json +1 -1
- package/dist/r/radix/ibm-cos-storage.json +1 -1
- package/dist/r/radix/idrive-e2-storage.json +1 -1
- package/dist/r/radix/image-viewer.json +55 -0
- package/dist/r/radix/just-bash-sandbox.json +32 -0
- package/dist/r/radix/litellm-gateway.json +2 -5
- package/dist/r/radix/mcp.json +123 -93
- package/dist/r/radix/memory-storage.json +1 -1
- package/dist/r/radix/minio-storage.json +1 -1
- package/dist/r/radix/model-preferences.json +35 -28
- package/dist/r/radix/neon-storage.json +1 -1
- package/dist/r/radix/netlify-blobs-storage.json +1 -1
- package/dist/r/radix/onedrive-storage.json +1 -1
- package/dist/r/radix/openai-compatible-gateway.json +2 -5
- package/dist/r/radix/openai-gateway.json +2 -5
- package/dist/r/radix/openrouter-gateway.json +2 -6
- package/dist/r/radix/oracle-cloud-storage.json +1 -1
- package/dist/r/radix/ovhcloud-storage.json +1 -1
- package/dist/r/radix/pocketbase-storage.json +1 -1
- package/dist/r/radix/projects.json +104 -83
- package/dist/r/radix/r2-storage.json +1 -1
- package/dist/r/radix/registry.json +1728 -2120
- package/dist/r/radix/s3-storage.json +1 -1
- package/dist/r/radix/scaleway-storage.json +1 -1
- package/dist/r/radix/search.json +70 -40
- package/dist/r/radix/sftp-storage.json +1 -1
- package/dist/r/radix/sharepoint-storage.json +1 -1
- package/dist/r/radix/sharing.json +55 -39
- package/dist/r/radix/spreadsheet-grid.json +20 -0
- package/dist/r/radix/spreadsheet-viewer.json +68 -0
- package/dist/r/radix/storj-storage.json +1 -1
- package/dist/r/radix/supabase-storage.json +1 -1
- package/dist/r/radix/tencent-storage.json +1 -1
- package/dist/r/radix/tigris-storage.json +1 -1
- package/dist/r/radix/uploadthing-storage.json +1 -1
- package/dist/r/radix/vercel-blob-storage.json +1 -1
- package/dist/r/radix/vercel-gateway.json +2 -6
- package/dist/r/radix/vercel-sandbox.json +8 -26
- package/dist/r/radix/video-viewer.json +48 -0
- package/dist/r/radix/vultr-storage.json +1 -1
- package/dist/r/radix/wasabi-storage.json +1 -1
- package/dist/r/radix/webdav-storage.json +1 -1
- package/dist/r/radix/yandex-storage.json +1 -1
- package/dist/r/registry.json +1725 -2117
- package/dist/r/s3-storage.json +1 -1
- package/dist/r/scaleway-storage.json +1 -1
- package/dist/r/search.json +70 -40
- package/dist/r/sftp-storage.json +1 -1
- package/dist/r/sharepoint-storage.json +1 -1
- package/dist/r/sharing.json +55 -39
- package/dist/r/spreadsheet-grid.json +20 -0
- package/dist/r/spreadsheet-viewer.json +68 -0
- package/dist/r/storj-storage.json +1 -1
- package/dist/r/supabase-storage.json +1 -1
- package/dist/r/tencent-storage.json +1 -1
- package/dist/r/tigris-storage.json +1 -1
- package/dist/r/uploadthing-storage.json +1 -1
- package/dist/r/vercel-blob-storage.json +1 -1
- package/dist/r/vercel-gateway.json +2 -6
- package/dist/r/vercel-sandbox.json +8 -26
- package/dist/r/video-viewer.json +48 -0
- package/dist/r/vultr-storage.json +1 -1
- package/dist/r/wasabi-storage.json +1 -1
- package/dist/r/webdav-storage.json +1 -1
- package/dist/r/yandex-storage.json +1 -1
- package/package.json +9 -30
- package/dist/r/base/code-documents.json +0 -96
- package/dist/r/base/code-execution-runtime.json +0 -25
- package/dist/r/base/code-execution-ui.json +0 -32
- package/dist/r/base/code-execution.json +0 -69
- package/dist/r/base/daytona-sandbox.json +0 -55
- package/dist/r/base/delete-document.json +0 -58
- package/dist/r/base/firecrawl-search.json +0 -72
- package/dist/r/base/get-weather.json +0 -52
- package/dist/r/base/langfuse.json +0 -63
- package/dist/r/base/read-document.json +0 -34
- package/dist/r/base/retrieve-url.json +0 -69
- package/dist/r/base/saved-code-execution.json +0 -84
- package/dist/r/base/sheet-documents.json +0 -94
- package/dist/r/base/tavily-search.json +0 -72
- package/dist/r/base/text-documents.json +0 -117
- package/dist/r/base/vercel-analytics.json +0 -46
- package/dist/r/base/vercel-speed-insights.json +0 -46
- package/dist/r/base/word-count.json +0 -51
- package/dist/r/code-documents.json +0 -96
- package/dist/r/code-execution-runtime.json +0 -25
- package/dist/r/code-execution-ui.json +0 -32
- package/dist/r/code-execution.json +0 -69
- package/dist/r/daytona-sandbox.json +0 -55
- package/dist/r/delete-document.json +0 -58
- package/dist/r/firecrawl-search.json +0 -72
- package/dist/r/get-weather.json +0 -52
- package/dist/r/langfuse.json +0 -63
- package/dist/r/radix/code-documents.json +0 -96
- package/dist/r/radix/code-execution-runtime.json +0 -25
- package/dist/r/radix/code-execution-ui.json +0 -32
- package/dist/r/radix/code-execution.json +0 -69
- package/dist/r/radix/daytona-sandbox.json +0 -55
- package/dist/r/radix/delete-document.json +0 -58
- package/dist/r/radix/firecrawl-search.json +0 -72
- package/dist/r/radix/get-weather.json +0 -52
- package/dist/r/radix/langfuse.json +0 -63
- package/dist/r/radix/read-document.json +0 -34
- package/dist/r/radix/retrieve-url.json +0 -69
- package/dist/r/radix/saved-code-execution.json +0 -84
- package/dist/r/radix/sheet-documents.json +0 -94
- package/dist/r/radix/tavily-search.json +0 -72
- package/dist/r/radix/text-documents.json +0 -117
- package/dist/r/radix/vercel-analytics.json +0 -46
- package/dist/r/radix/vercel-speed-insights.json +0 -46
- package/dist/r/radix/word-count.json +0 -51
- package/dist/r/read-document.json +0 -34
- package/dist/r/retrieve-url.json +0 -69
- package/dist/r/saved-code-execution.json +0 -84
- package/dist/r/sheet-documents.json +0 -94
- package/dist/r/tavily-search.json +0 -72
- package/dist/r/text-documents.json +0 -117
- package/dist/r/vercel-analytics.json +0 -46
- package/dist/r/vercel-speed-insights.json +0 -46
- package/dist/r/word-count.json +0 -51
|
@@ -2,35 +2,16 @@
|
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "vercel-sandbox",
|
|
4
4
|
"title": "Vercel Sandbox",
|
|
5
|
+
"description": "Hosted sandbox with native Python and Node processes.",
|
|
5
6
|
"dependencies": [
|
|
6
|
-
"@chat-js/
|
|
7
|
-
"@vercel/sandbox@3.3.0",
|
|
8
|
-
"@vercel/oidc@3.2.0"
|
|
7
|
+
"eve@npm:@chat-js/eve@1.0.0-rc.6-chatjs.1"
|
|
9
8
|
],
|
|
10
9
|
"files": [
|
|
11
10
|
{
|
|
12
|
-
"path": "src/sandboxes/vercel/
|
|
13
|
-
"content": "import {
|
|
11
|
+
"path": "src/sandboxes/vercel/sandbox.ts",
|
|
12
|
+
"content": "import { defineSandbox } from \"eve/sandbox\";\nimport { VercelSandbox } from \"eve/sandbox/vercel\";\n\nexport const environment = VercelSandbox.environment();\nexport default defineSandbox(async () => await environment.open());\n",
|
|
14
13
|
"type": "registry:file",
|
|
15
|
-
"target": "~/
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"path": "src/sandboxes/vercel/vercel-sandbox-env.ts",
|
|
19
|
-
"content": "import { z } from \"zod\";\n\nconst environmentSchema = z.object({\n VERCEL_TEAM_ID: z.string().optional(),\n VERCEL_PROJECT_ID: z.string().optional(),\n VERCEL_TOKEN: z.string().optional(),\n});\n\nconst readSandboxEnvironment = (\n environment: Readonly<NodeJS.ProcessEnv> = process.env\n) => environmentSchema.parse(environment);\n\nconst imageEnvironmentSchema = z.object({\n VERCEL_SANDBOX_IMAGE_JAVASCRIPT: z.string().nonempty().optional(),\n VERCEL_SANDBOX_IMAGE_PYTHON: z.string().nonempty().optional(),\n});\n\nconst readSandboxImageEnvironment = (\n environment: Readonly<NodeJS.ProcessEnv> = process.env\n) => imageEnvironmentSchema.parse(environment);\n\nexport { readSandboxEnvironment, readSandboxImageEnvironment };\n",
|
|
20
|
-
"type": "registry:file",
|
|
21
|
-
"target": "~/lib/sandbox/vercel-sandbox-env.ts"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "src/sandboxes/vercel/adapter.ts",
|
|
25
|
-
"content": "import type { SandboxProvider } from \"@chat-js/sandboxes/provider\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\nimport { getVercelOidcTokenSync } from \"@vercel/oidc\";\nimport { APIError, Sandbox } from \"@vercel/sandbox\";\nimport {\n readSandboxEnvironment,\n readSandboxImageEnvironment,\n} from \"./vercel-sandbox-env\";\nimport { createModuleLogger } from \"@/lib/logger\";\n\ntype SupportedExecutionLanguage = \"python\" | \"javascript\";\n\nconst JWT_PART_COUNT = 3;\nconst JWT_PAYLOAD_INDEX = 1;\nconst SANDBOX_VCPUS = 2;\nconst SANDBOX_TIMEOUT_MS = 300_000;\nconst CLEANUP_TIMEOUT_MS = 30_000;\nconst LOOKUP_TIMEOUT_MS = 15_000;\nconst NOT_FOUND_STATUS = 404;\n\ninterface SandboxAuth {\n projectId: string;\n teamId: string;\n token: string;\n}\n\nconst tokenClaims = (\n token: string\n): { projectId: string; teamId: string } | undefined => {\n const parts = token.split(\".\");\n if (parts.length !== JWT_PART_COUNT) {\n return undefined;\n }\n let payload: unknown;\n try {\n payload = JSON.parse(\n Buffer.from(parts[JWT_PAYLOAD_INDEX] ?? \"\", \"base64url\").toString(\"utf-8\")\n );\n } catch {\n throw new Error(\"Sandbox provider identity is unavailable.\");\n }\n if (\n !(\n payload !== null &&\n typeof payload === \"object\" &&\n \"owner_id\" in payload &&\n \"project_id\" in payload\n )\n ) {\n throw new Error(\"Sandbox provider identity is unavailable.\");\n }\n if (\n typeof payload.owner_id !== \"string\" ||\n !payload.owner_id ||\n typeof payload.project_id !== \"string\" ||\n !payload.project_id\n ) {\n throw new Error(\"Sandbox provider identity is unavailable.\");\n }\n return { projectId: payload.project_id, teamId: payload.owner_id };\n};\n\nconst getTokenAuth = (): Partial<SandboxAuth> => {\n const { VERCEL_TEAM_ID, VERCEL_PROJECT_ID, VERCEL_TOKEN } =\n readSandboxEnvironment();\n if (\n typeof VERCEL_TEAM_ID === \"string\" &&\n VERCEL_TEAM_ID !== \"\" &&\n typeof VERCEL_PROJECT_ID === \"string\" &&\n VERCEL_PROJECT_ID !== \"\" &&\n typeof VERCEL_TOKEN === \"string\" &&\n VERCEL_TOKEN !== \"\"\n ) {\n return {\n projectId: VERCEL_PROJECT_ID,\n teamId: VERCEL_TEAM_ID,\n token: VERCEL_TOKEN,\n };\n }\n return {};\n};\n\n/**\n * Resolve the exact provider scope before a durable allocation is reserved.\n * @returns {SandboxAuth} Provider credentials bound to one project and team.\n */\nconst resolveSandboxAuth = (): SandboxAuth => {\n const configured = getTokenAuth();\n if (\n typeof configured.projectId === \"string\" &&\n configured.projectId !== \"\" &&\n typeof configured.teamId === \"string\" &&\n configured.teamId !== \"\" &&\n typeof configured.token === \"string\" &&\n configured.token !== \"\"\n ) {\n const identity = tokenClaims(configured.token);\n if (\n identity &&\n (identity.projectId !== configured.projectId ||\n identity.teamId !== configured.teamId)\n ) {\n throw new Error(\n \"Sandbox token and configured provider scope do not match.\"\n );\n }\n return {\n projectId: configured.projectId,\n teamId: configured.teamId,\n token: configured.token,\n };\n }\n // Vercel supplies production tokens through the current request context.\n let token: string;\n try {\n token = getVercelOidcTokenSync();\n } catch {\n throw new Error(\"Sandbox provider identity is unavailable.\");\n }\n const identity = token ? tokenClaims(token) : undefined;\n if (!(identity && token)) {\n throw new Error(\"Sandbox provider identity is unavailable.\");\n }\n return { ...identity, token };\n};\n\nconst getSandboxImage = (language: SupportedExecutionLanguage): string => {\n const images = readSandboxImageEnvironment();\n if (language === \"javascript\") {\n return images.VERCEL_SANDBOX_IMAGE_JAVASCRIPT ?? \"vercel/sandbox/node:22\";\n }\n\n return images.VERCEL_SANDBOX_IMAGE_PYTHON ?? \"vercel/sandbox/python:3.14\";\n};\n\nconst createSandbox = async (\n image: string,\n signal?: ReadonlyNativeSurface<AbortSignal>,\n name?: string,\n auth?: Readonly<SandboxAuth>\n): Promise<Sandbox> =>\n await Sandbox.create({\n name,\n persistent: false,\n resources: { vcpus: SANDBOX_VCPUS },\n image,\n signal,\n timeout: SANDBOX_TIMEOUT_MS,\n ...(auth ?? getTokenAuth()),\n });\n\nconst cleanupSandbox = async (\n sandbox: Pick<Sandbox, \"delete\" | \"stop\"> | undefined,\n log: Pick<ReturnType<typeof createModuleLogger>, \"info\" | \"warn\">,\n requestId: string\n): Promise<void> => {\n if (!sandbox) {\n return;\n }\n try {\n try {\n await sandbox.stop({ signal: AbortSignal.timeout(CLEANUP_TIMEOUT_MS) });\n } finally {\n await sandbox.delete({\n deleteOrphanSnapshots: true,\n signal: AbortSignal.timeout(CLEANUP_TIMEOUT_MS),\n });\n }\n log.info({ requestId }, \"sandbox closed\");\n } catch (closeError) {\n log.warn({ closeError, requestId }, \"failed to close sandbox\");\n throw closeError;\n }\n};\n\nconst findSandboxForCleanup = async (\n name: string,\n auth: Readonly<SandboxAuth>\n): Promise<Sandbox | undefined> => {\n try {\n return await Sandbox.get({\n name,\n resume: false,\n signal: AbortSignal.timeout(LOOKUP_TIMEOUT_MS),\n ...auth,\n });\n } catch (error) {\n if (\n error instanceof APIError &&\n error.response.status === NOT_FOUND_STATUS\n ) {\n return undefined;\n }\n throw error;\n }\n};\n\nconst createCleanupSession = (\n auth: SandboxAuth = resolveSandboxAuth()\n): {\n deleteAndConfirmAbsent: SandboxProvider[\"deleteAndConfirmAbsent\"];\n provider: SandboxAuth;\n} => {\n const log = createModuleLogger(\"eve-code-sandbox-cleanup\");\n return {\n async deleteAndConfirmAbsent(name): Promise<void> {\n const sandbox = await findSandboxForCleanup(name, auth);\n if (sandbox) {\n if (sandbox.name !== name || sandbox.persistent) {\n throw new Error(\n \"Code sandbox identity or persistence needs reconciliation.\"\n );\n }\n await cleanupSandbox(sandbox, log, name);\n if (await findSandboxForCleanup(name, auth)) {\n throw new Error(\"Code sandbox remains available after deletion.\");\n }\n }\n },\n provider: auth,\n };\n};\n\nexport {\n cleanupSandbox,\n createCleanupSession,\n createSandbox,\n getSandboxImage,\n getTokenAuth,\n resolveSandboxAuth,\n};\nexport type { SandboxAuth };\n",
|
|
26
|
-
"type": "registry:file",
|
|
27
|
-
"target": "~/lib/sandbox/adapter.ts"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "src/sandboxes/vercel/persistent.ts",
|
|
31
|
-
"content": "import type {\n PersistentSandbox,\n PersistentSandboxProvider,\n} from \"@chat-js/sandboxes/persistent\";\nimport { APIError, Sandbox } from \"@vercel/sandbox\";\nimport pathModule from \"node:path\";\nimport type { SandboxAuth } from \"./adapter\";\n\nconst { posix } = pathModule;\n\nconst OPERATION_TIMEOUT_MS = 30_000;\nconst SESSION_TIMEOUT_MS = 1_800_000;\nconst NOT_FOUND = 404;\nconst resolvePath = (path: string): string => posix.resolve(\"/workspace\", path);\nconst signal = (upstream?: AbortSignal): AbortSignal =>\n AbortSignal.any([\n AbortSignal.timeout(OPERATION_TIMEOUT_MS),\n ...(upstream ? [upstream] : []),\n ]);\n\nconst session = (sandbox: Sandbox): PersistentSandbox => {\n const read: PersistentSandbox[\"readBinaryFile\"] = async (options) =>\n await sandbox.readFileToBuffer(\n { path: resolvePath(options.path) },\n { signal: signal(options.abortSignal) }\n );\n const write: PersistentSandbox[\"writeBinaryFile\"] = async (options) => {\n const path = resolvePath(options.path);\n await sandbox.fs.mkdir(posix.dirname(path), {\n recursive: true,\n signal: signal(options.abortSignal),\n });\n await sandbox.writeFiles(\n [{ path, content: Buffer.from(options.content) }],\n { signal: signal(options.abortSignal) }\n );\n };\n return {\n name: sandbox.name,\n resolvePath,\n readBinaryFile: read,\n writeBinaryFile: write,\n async readFile(options) {\n const bytes = await read(options);\n return bytes === null\n ? null\n : new ReadableStream({\n start(controller) {\n controller.enqueue(bytes);\n controller.close();\n },\n });\n },\n async readTextFile(options) {\n const bytes = await read(options);\n if (bytes === null) {\n return null;\n }\n const text = new TextDecoder(options.encoding ?? \"utf-8\", {\n fatal: true,\n }).decode(bytes);\n if (options.startLine === undefined && options.endLine === undefined) {\n return text;\n }\n return text\n .split(\"\\n\")\n .slice(Math.max(0, (options.startLine ?? 1) - 1), options.endLine)\n .join(\"\\n\");\n },\n async writeFile(options) {\n const bytes = new Uint8Array(\n await new Response(options.content).arrayBuffer()\n );\n await write({ ...options, content: bytes });\n },\n async writeTextFile(options) {\n const encoding = options.encoding ?? \"utf-8\";\n if (!Buffer.isEncoding(encoding)) {\n throw new Error(\"Unsupported sandbox text encoding.\");\n }\n await write({\n ...options,\n content: Buffer.from(options.content, encoding),\n });\n },\n async removePath(options) {\n await sandbox.fs.rm(resolvePath(options.path), {\n force: options.force,\n recursive: options.recursive,\n signal: signal(options.abortSignal),\n });\n },\n async run(options) {\n const deadline = signal(options.abortSignal);\n const result = await sandbox.runCommand({\n cmd: \"bash\",\n args: [\"-lc\", options.command],\n cwd: resolvePath(options.workingDirectory ?? \".\"),\n env: options.env,\n signal: deadline,\n });\n const [stdout, stderr] = await Promise.all([\n result.stdout({ signal: deadline }),\n result.stderr({ signal: deadline }),\n ]);\n return { exitCode: result.exitCode, stdout, stderr };\n },\n async spawn(options) {\n const command = await sandbox.runCommand({\n cmd: \"bash\",\n args: [\"-lc\", options.command],\n cwd: resolvePath(options.workingDirectory ?? \".\"),\n env: options.env,\n signal: signal(options.abortSignal),\n detached: true,\n });\n // Read remote output only on consumer demand; the app fences every pull.\n const logs = command.logs({ signal: signal(options.abortSignal) });\n const iterator = logs[Symbol.asyncIterator]();\n const buffers: Record<\"stdout\" | \"stderr\", string[]> = {\n stdout: [],\n stderr: [],\n };\n const cancelled = { stdout: false, stderr: false };\n let done = false;\n let pending: Promise<void> | undefined;\n const advance = async (): Promise<void> => {\n pending ??= (async () => {\n const next = await iterator.next();\n if (next.done === true) {\n done = true;\n } else if (!cancelled[next.value.stream]) {\n buffers[next.value.stream].push(next.value.data);\n }\n })();\n const current = pending;\n try {\n await current;\n } finally {\n if (pending === current) {\n pending = undefined;\n }\n }\n };\n const encoder = new TextEncoder();\n const output = (\n target: \"stdout\" | \"stderr\"\n ): ReadableStream<Uint8Array> =>\n new ReadableStream(\n {\n async pull(controller) {\n while (buffers[target].length === 0) {\n if (done) {\n break;\n }\n // oxlint-disable-next-line eslint/no-await-in-loop -- Preserve multiplexed output order until this consumer has a chunk.\n await advance();\n }\n const chunk = buffers[target].shift();\n if (chunk === undefined) {\n controller.close();\n } else {\n controller.enqueue(encoder.encode(chunk));\n }\n },\n async cancel() {\n cancelled[target] = true;\n buffers[target] = [];\n if (cancelled.stdout && cancelled.stderr) {\n await iterator.return?.();\n }\n },\n },\n { highWaterMark: 0 }\n );\n const stdout = output(\"stdout\");\n const stderr = output(\"stderr\");\n return {\n stdout,\n stderr,\n async wait() {\n const result = await command.wait({\n signal: signal(options.abortSignal),\n });\n return { exitCode: result.exitCode };\n },\n async kill() {\n await command.kill(undefined, { abortSignal: signal() });\n },\n };\n },\n };\n};\n\n/** The original credential scope must be verified by the durable owner before use. */\nexport const createPersistentProvider = (\n auth: SandboxAuth\n): PersistentSandboxProvider => {\n const find = async (name: string): Promise<Sandbox | null> => {\n try {\n const sandbox = await Sandbox.get({\n name,\n resume: false,\n signal: signal(),\n ...auth,\n });\n if (sandbox.name !== name || !sandbox.persistent) {\n throw new Error(\"Persistent sandbox identity mismatch.\");\n }\n return sandbox;\n } catch (error) {\n if (error instanceof APIError && error.response.status === NOT_FOUND) {\n return null;\n }\n throw error;\n }\n };\n return {\n async create({ name, signal: abortSignal }) {\n const sandbox = await Sandbox.create({\n name,\n persistent: true,\n image: \"vcr.vercel.com/vercel/eve/base:0.80.1\",\n timeout: SESSION_TIMEOUT_MS,\n signal: signal(abortSignal),\n ...auth,\n });\n if (sandbox.name !== name || !sandbox.persistent) {\n throw new Error(\"Persistent sandbox identity mismatch.\");\n }\n return session(sandbox);\n },\n async open(name) {\n const sandbox = await find(name);\n if (sandbox === null) {\n throw new Error(\n \"Persistent sandbox is missing; replacement is forbidden.\"\n );\n }\n return session(sandbox);\n },\n async stop(name) {\n const sandbox = await find(name);\n if (sandbox !== null) {\n await sandbox.stop({ signal: signal() });\n }\n },\n async deleteAndConfirmAbsent(name) {\n const sandbox = await find(name);\n if (sandbox !== null) {\n await sandbox.delete({ deleteOrphanSnapshots: true, signal: signal() });\n }\n if (await find(name)) {\n throw new Error(\"Persistent sandbox deletion is unconfirmed.\");\n }\n },\n };\n};\n",
|
|
32
|
-
"type": "registry:file",
|
|
33
|
-
"target": "~/lib/sandbox/persistent.ts"
|
|
14
|
+
"target": "~/agent/sandbox.ts"
|
|
34
15
|
}
|
|
35
16
|
],
|
|
36
17
|
"meta": {
|
|
@@ -39,12 +20,13 @@
|
|
|
39
20
|
"kind": "sandbox",
|
|
40
21
|
"id": "vercel",
|
|
41
22
|
"capabilities": {
|
|
23
|
+
"persistent": true,
|
|
42
24
|
"runtimes": [
|
|
43
25
|
"python",
|
|
44
26
|
"javascript"
|
|
45
27
|
],
|
|
46
|
-
"cleanup": "
|
|
47
|
-
"cancellation": "
|
|
28
|
+
"cleanup": "eve-session",
|
|
29
|
+
"cancellation": "eve"
|
|
48
30
|
},
|
|
49
31
|
"envRequirements": [
|
|
50
32
|
{
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "video-viewer",
|
|
4
|
+
"title": "Video viewer",
|
|
5
|
+
"description": "Open video artifacts in a larger player. Optional for video generation.",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"lucide-react@0.553.0"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
{
|
|
11
|
+
"path": "src/plugins/video-viewer/src/client-plugin.ts",
|
|
12
|
+
"content": "\"use client\";\nimport { definePlugin, slot } from \"@/chatjs/core/ui/slots\";\nimport { ArtifactViewerActions } from \"@/components/artifact-actions\";\nimport { VideoViewerAction } from \"./viewer-action\";\n\nexport const videoViewerClient = definePlugin({\n id: \"video-viewer\",\n slots: [slot(ArtifactViewerActions, VideoViewerAction)],\n});\n",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"target": "~/chatjs/plugins/video-viewer/client-plugin.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "src/plugins/video-viewer/src/viewer-action.tsx",
|
|
18
|
+
"content": "\"use client\";\n\nimport { ExpandIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nimport type { ArtifactReference } from \"@/components/artifact-actions\";\nimport { ArtifactDownloadAction } from \"@/components/artifact-download-action\";\nimport { VideoPlayer } from \"@/components/video-player\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogTitle,\n} from \"@/components/ui/dialog\";\n\nexport const VideoViewerAction = ({\n artifact,\n onOpen,\n}: {\n readonly artifact: ArtifactReference;\n readonly onOpen?: () => void;\n}) => {\n const [open, setOpen] = useState(false);\n if (!artifact.mediaType.startsWith(\"video/\")) {\n return null;\n }\n return (\n <>\n <Button\n aria-label=\"Open video\"\n title=\"Open video\"\n size=\"icon-sm\"\n variant=\"ghost\"\n onClick={() => {\n onOpen?.();\n setOpen(true);\n }}\n >\n <ExpandIcon size={16} />\n </Button>\n {open && (\n <Dialog open onOpenChange={setOpen}>\n <DialogContent className=\"w-[calc(100%-2rem)] max-w-5xl sm:max-w-5xl\">\n <DialogTitle className=\"pe-8\">Video preview</DialogTitle>\n <DialogDescription className=\"line-clamp-2\">\n {artifact.name}\n </DialogDescription>\n <VideoPlayer\n src={artifact.url}\n name={artifact.name}\n className=\"rounded-md\"\n />\n <div className=\"flex justify-end\">\n <ArtifactDownloadAction\n artifact={artifact}\n label=\"Download video\"\n />\n </div>\n </DialogContent>\n </Dialog>\n )}\n </>\n );\n};\n",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"target": "~/chatjs/plugins/video-viewer/viewer-action.tsx"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "dist/source/video-viewer.json",
|
|
24
|
+
"content": "{\n \"id\": \"video-viewer\",\n \"kind\": \"plugin\",\n \"files\": [\n \"chatjs/plugins/video-viewer/client-plugin.ts\",\n \"chatjs/plugins/video-viewer/viewer-action.tsx\"\n ],\n \"client\": {\n \"export\": \"videoViewerClient\",\n \"composerControls\": [],\n \"settingsItems\": [],\n \"chat\": true\n },\n \"contractVersion\": 2,\n \"uiBase\": \"radix\"\n}\n",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"target": "~/chatjs/plugins/video-viewer/chatjs.json"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"meta": {
|
|
30
|
+
"chatjs": {
|
|
31
|
+
"id": "video-viewer",
|
|
32
|
+
"kind": "plugin",
|
|
33
|
+
"files": [
|
|
34
|
+
"chatjs/plugins/video-viewer/client-plugin.ts",
|
|
35
|
+
"chatjs/plugins/video-viewer/viewer-action.tsx"
|
|
36
|
+
],
|
|
37
|
+
"client": {
|
|
38
|
+
"export": "videoViewerClient",
|
|
39
|
+
"composerControls": [],
|
|
40
|
+
"settingsItems": [],
|
|
41
|
+
"chat": true
|
|
42
|
+
},
|
|
43
|
+
"contractVersion": 2,
|
|
44
|
+
"uiBase": "radix"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"type": "registry:item"
|
|
48
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"path": "src/storage/vultr/storage-provider.ts",
|
|
15
15
|
"content": "export { vultr as createStorageAdapter } from \"files-sdk/vultr\";\n",
|
|
16
16
|
"type": "registry:file",
|
|
17
|
-
"target": "~/
|
|
17
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
20
|
"meta": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"path": "src/storage/wasabi/storage-provider.ts",
|
|
15
15
|
"content": "export { wasabi as createStorageAdapter } from \"files-sdk/wasabi\";\n",
|
|
16
16
|
"type": "registry:file",
|
|
17
|
-
"target": "~/
|
|
17
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
20
|
"meta": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"path": "src/storage/webdav/storage-provider.ts",
|
|
13
13
|
"content": "export { webdav as createStorageAdapter } from \"files-sdk/webdav\";\n",
|
|
14
14
|
"type": "registry:file",
|
|
15
|
-
"target": "~/
|
|
15
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"meta": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"path": "src/storage/yandex/storage-provider.ts",
|
|
15
15
|
"content": "export { yandex as createStorageAdapter } from \"files-sdk/yandex\";\n",
|
|
16
16
|
"type": "registry:file",
|
|
17
|
-
"target": "~/
|
|
17
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
20
|
"meta": {
|