@chat-js/registry 0.2.0-beta.0 → 0.2.0-beta.10
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 +16 -12
- package/dist/r/ai-titles.json +17 -17
- package/dist/r/akamai-storage.json +13 -1
- package/dist/r/alibaba-storage.json +13 -1
- package/dist/r/appwrite-storage.json +8 -1
- package/dist/r/archil-storage.json +8 -1
- package/dist/r/attach-workspace-file.json +82 -0
- package/dist/r/attachment-uploads.json +26 -34
- package/dist/r/azure-storage.json +8 -1
- package/dist/r/backblaze-b2-storage.json +13 -1
- package/dist/r/base/ai-titles.json +47 -0
- package/dist/r/base/akamai-storage.json +56 -0
- package/dist/r/base/alibaba-storage.json +56 -0
- package/dist/r/base/appwrite-storage.json +57 -0
- package/dist/r/base/archil-storage.json +59 -0
- package/dist/r/base/attach-workspace-file.json +82 -0
- package/dist/r/base/attachment-uploads.json +79 -0
- package/dist/r/base/azure-storage.json +58 -0
- package/dist/r/base/backblaze-b2-storage.json +56 -0
- package/dist/r/base/bunny-storage-storage.json +49 -0
- package/dist/r/base/cloudinary-storage.json +44 -0
- package/dist/r/base/credits.json +81 -0
- package/dist/r/base/deep-research.json +138 -0
- package/dist/r/base/default-sandbox.json +35 -0
- package/dist/r/base/desktop.json +129 -0
- package/dist/r/base/digitalocean-spaces-storage.json +56 -0
- package/dist/r/base/docker-sandbox.json +35 -0
- package/dist/r/base/dropbox-storage.json +44 -0
- package/dist/r/base/exoscale-storage.json +56 -0
- package/dist/r/base/feedback.json +90 -0
- package/dist/r/base/filebase-storage.json +50 -0
- package/dist/r/base/firebase-storage-storage.json +53 -0
- package/dist/r/base/followup-suggestions.json +130 -0
- package/dist/r/base/ftp-storage.json +71 -0
- package/dist/r/base/gcs-storage.json +40 -0
- package/dist/r/base/generate-image.json +107 -0
- package/dist/r/base/generate-video.json +76 -0
- package/dist/r/base/google-drive-storage.json +48 -0
- package/dist/r/base/guest-chat.json +166 -0
- package/dist/r/base/hetzner-storage.json +56 -0
- package/dist/r/base/ibm-cos-storage.json +56 -0
- package/dist/r/base/idrive-e2-storage.json +56 -0
- package/dist/r/base/image-viewer.json +49 -0
- package/dist/r/base/just-bash-sandbox.json +32 -0
- package/dist/r/base/litellm-gateway.json +64 -0
- package/dist/r/base/mcp.json +327 -0
- package/dist/r/base/memory-storage.json +30 -0
- package/dist/r/base/minio-storage.json +56 -0
- package/dist/r/base/model-preferences.json +117 -0
- package/dist/r/base/neon-storage.json +51 -0
- package/dist/r/base/netlify-blobs-storage.json +39 -0
- package/dist/r/base/onedrive-storage.json +49 -0
- package/dist/r/base/openai-compatible-gateway.json +66 -0
- package/dist/r/base/openai-gateway.json +64 -0
- package/dist/r/base/openrouter-gateway.json +71 -0
- package/dist/r/base/oracle-cloud-storage.json +62 -0
- package/dist/r/base/ovhcloud-storage.json +56 -0
- package/dist/r/base/pocketbase-storage.json +51 -0
- package/dist/r/base/projects.json +274 -0
- package/dist/r/base/r2-storage.json +52 -0
- package/dist/r/base/registry.json +4734 -0
- package/dist/r/base/s3-storage.json +58 -0
- package/dist/r/base/scaleway-storage.json +56 -0
- package/dist/r/base/search.json +154 -0
- package/dist/r/base/sftp-storage.json +75 -0
- package/dist/r/base/sharepoint-storage.json +51 -0
- package/dist/r/base/sharing.json +138 -0
- package/dist/r/base/spreadsheet-grid.json +20 -0
- package/dist/r/base/spreadsheet-viewer.json +62 -0
- package/dist/r/base/storj-storage.json +50 -0
- package/dist/r/base/streamdown-math.json +35 -0
- package/dist/r/base/streamdown-mermaid.json +34 -0
- package/dist/r/base/supabase-storage.json +55 -0
- package/dist/r/base/tencent-storage.json +56 -0
- package/dist/r/base/tigris-storage.json +50 -0
- package/dist/r/base/uploadthing-storage.json +39 -0
- package/dist/r/base/vercel-blob-storage.json +44 -0
- package/dist/r/base/vercel-gateway.json +75 -0
- package/dist/r/base/vercel-sandbox.json +49 -0
- package/dist/r/base/video-viewer.json +42 -0
- package/dist/r/base/vultr-storage.json +56 -0
- package/dist/r/base/wasabi-storage.json +56 -0
- package/dist/r/base/webdav-storage.json +64 -0
- package/dist/r/base/yandex-storage.json +50 -0
- package/dist/r/bunny-storage-storage.json +2 -1
- package/dist/r/cloudinary-storage.json +2 -1
- package/dist/r/credits.json +29 -46
- package/dist/r/deep-research.json +56 -138
- package/dist/r/default-sandbox.json +35 -0
- package/dist/r/desktop.json +129 -0
- package/dist/r/digitalocean-spaces-storage.json +13 -1
- package/dist/r/docker-sandbox.json +35 -0
- package/dist/r/dropbox-storage.json +2 -1
- package/dist/r/eve/deep-research.json +47 -0
- package/dist/r/eve/registry.json +53 -0
- package/dist/r/exoscale-storage.json +13 -1
- package/dist/r/feedback.json +38 -53
- package/dist/r/filebase-storage.json +8 -1
- package/dist/r/firebase-storage-storage.json +2 -1
- package/dist/r/followup-suggestions.json +49 -66
- package/dist/r/ftp-storage.json +18 -1
- package/dist/r/gcs-storage.json +8 -1
- package/dist/r/generate-image.json +24 -18
- package/dist/r/generate-video.json +17 -11
- package/dist/r/google-drive-storage.json +2 -1
- package/dist/r/guest-chat.json +166 -0
- package/dist/r/hetzner-storage.json +13 -1
- package/dist/r/ibm-cos-storage.json +13 -1
- package/dist/r/idrive-e2-storage.json +13 -1
- package/dist/r/image-viewer.json +49 -0
- package/dist/r/just-bash-sandbox.json +32 -0
- package/dist/r/litellm-gateway.json +5 -8
- package/dist/r/mcp.json +143 -120
- package/dist/r/memory-storage.json +5 -3
- package/dist/r/minio-storage.json +13 -1
- package/dist/r/model-preferences.json +47 -55
- package/dist/r/neon-storage.json +8 -1
- package/dist/r/netlify-blobs-storage.json +10 -2
- package/dist/r/onedrive-storage.json +2 -1
- package/dist/r/openai-compatible-gateway.json +6 -9
- package/dist/r/openai-gateway.json +6 -9
- package/dist/r/openrouter-gateway.json +5 -9
- package/dist/r/oracle-cloud-storage.json +18 -1
- package/dist/r/ovhcloud-storage.json +13 -1
- package/dist/r/pocketbase-storage.json +2 -1
- package/dist/r/projects.json +116 -108
- package/dist/r/r2-storage.json +9 -1
- package/dist/r/radix/ai-titles.json +47 -0
- package/dist/r/radix/akamai-storage.json +56 -0
- package/dist/r/radix/alibaba-storage.json +56 -0
- package/dist/r/radix/appwrite-storage.json +57 -0
- package/dist/r/radix/archil-storage.json +59 -0
- package/dist/r/radix/attach-workspace-file.json +82 -0
- package/dist/r/radix/attachment-uploads.json +79 -0
- package/dist/r/radix/azure-storage.json +58 -0
- package/dist/r/radix/backblaze-b2-storage.json +56 -0
- package/dist/r/radix/bunny-storage-storage.json +49 -0
- package/dist/r/radix/cloudinary-storage.json +44 -0
- package/dist/r/radix/credits.json +81 -0
- package/dist/r/radix/deep-research.json +138 -0
- package/dist/r/radix/default-sandbox.json +35 -0
- package/dist/r/radix/desktop.json +129 -0
- package/dist/r/radix/digitalocean-spaces-storage.json +56 -0
- package/dist/r/radix/docker-sandbox.json +35 -0
- package/dist/r/radix/dropbox-storage.json +44 -0
- package/dist/r/radix/exoscale-storage.json +56 -0
- package/dist/r/radix/feedback.json +90 -0
- package/dist/r/radix/filebase-storage.json +50 -0
- package/dist/r/radix/firebase-storage-storage.json +53 -0
- package/dist/r/radix/followup-suggestions.json +130 -0
- package/dist/r/radix/ftp-storage.json +71 -0
- package/dist/r/radix/gcs-storage.json +40 -0
- package/dist/r/radix/generate-image.json +107 -0
- package/dist/r/radix/generate-video.json +76 -0
- package/dist/r/radix/google-drive-storage.json +48 -0
- package/dist/r/radix/guest-chat.json +166 -0
- package/dist/r/radix/hetzner-storage.json +56 -0
- package/dist/r/radix/ibm-cos-storage.json +56 -0
- package/dist/r/radix/idrive-e2-storage.json +56 -0
- package/dist/r/radix/image-viewer.json +49 -0
- package/dist/r/radix/just-bash-sandbox.json +32 -0
- package/dist/r/radix/litellm-gateway.json +64 -0
- package/dist/r/radix/mcp.json +327 -0
- package/dist/r/radix/memory-storage.json +30 -0
- package/dist/r/radix/minio-storage.json +56 -0
- package/dist/r/radix/model-preferences.json +117 -0
- package/dist/r/radix/neon-storage.json +51 -0
- package/dist/r/radix/netlify-blobs-storage.json +39 -0
- package/dist/r/radix/onedrive-storage.json +49 -0
- package/dist/r/radix/openai-compatible-gateway.json +66 -0
- package/dist/r/radix/openai-gateway.json +64 -0
- package/dist/r/radix/openrouter-gateway.json +71 -0
- package/dist/r/radix/oracle-cloud-storage.json +62 -0
- package/dist/r/radix/ovhcloud-storage.json +56 -0
- package/dist/r/radix/pocketbase-storage.json +51 -0
- package/dist/r/radix/projects.json +274 -0
- package/dist/r/radix/r2-storage.json +52 -0
- package/dist/r/radix/registry.json +4734 -0
- package/dist/r/radix/s3-storage.json +58 -0
- package/dist/r/radix/scaleway-storage.json +56 -0
- package/dist/r/radix/search.json +154 -0
- package/dist/r/radix/sftp-storage.json +75 -0
- package/dist/r/radix/sharepoint-storage.json +51 -0
- package/dist/r/radix/sharing.json +138 -0
- package/dist/r/radix/spreadsheet-grid.json +20 -0
- package/dist/r/radix/spreadsheet-viewer.json +62 -0
- package/dist/r/radix/storj-storage.json +50 -0
- package/dist/r/radix/streamdown-math.json +35 -0
- package/dist/r/radix/streamdown-mermaid.json +34 -0
- package/dist/r/radix/supabase-storage.json +55 -0
- package/dist/r/radix/tencent-storage.json +56 -0
- package/dist/r/radix/tigris-storage.json +50 -0
- package/dist/r/radix/uploadthing-storage.json +39 -0
- package/dist/r/radix/vercel-blob-storage.json +44 -0
- package/dist/r/radix/vercel-gateway.json +75 -0
- package/dist/r/radix/vercel-sandbox.json +49 -0
- package/dist/r/radix/video-viewer.json +42 -0
- package/dist/r/radix/vultr-storage.json +56 -0
- package/dist/r/radix/wasabi-storage.json +56 -0
- package/dist/r/radix/webdav-storage.json +64 -0
- package/dist/r/radix/yandex-storage.json +50 -0
- package/dist/r/registry.json +2006 -2142
- package/dist/r/s3-storage.json +15 -1
- package/dist/r/scaleway-storage.json +13 -1
- package/dist/r/search.json +80 -66
- package/dist/r/sftp-storage.json +18 -1
- package/dist/r/sharepoint-storage.json +2 -1
- package/dist/r/sharing.json +65 -64
- package/dist/r/spreadsheet-grid.json +20 -0
- package/dist/r/spreadsheet-viewer.json +62 -0
- package/dist/r/storj-storage.json +8 -1
- package/dist/r/streamdown-math.json +35 -0
- package/dist/r/streamdown-mermaid.json +34 -0
- package/dist/r/supabase-storage.json +8 -1
- package/dist/r/tencent-storage.json +13 -1
- package/dist/r/tigris-storage.json +8 -1
- package/dist/r/uploadthing-storage.json +2 -1
- package/dist/r/vercel-blob-storage.json +3 -1
- package/dist/r/vercel-gateway.json +7 -9
- package/dist/r/vercel-sandbox.json +8 -26
- package/dist/r/video-viewer.json +42 -0
- package/dist/r/vultr-storage.json +13 -1
- package/dist/r/wasabi-storage.json +13 -1
- package/dist/r/webdav-storage.json +13 -1
- package/dist/r/yandex-storage.json +8 -1
- package/package.json +20 -38
- 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 -31
- 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/read-document.json +0 -34
- package/dist/r/retrieve-url.json +0 -67
- package/dist/r/saved-code-execution.json +0 -81
- package/dist/r/sheet-documents.json +0 -93
- package/dist/r/tavily-search.json +0 -72
- package/dist/r/text-documents.json +0 -116
- 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
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
"path": "src/storage/uploadthing/storage-provider.ts",
|
|
13
13
|
"content": "export { uploadthing as createStorageAdapter } from \"files-sdk/uploadthing\";\n",
|
|
14
14
|
"type": "registry:file",
|
|
15
|
-
"target": "~/
|
|
15
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"meta": {
|
|
19
19
|
"chatjs": {
|
|
20
20
|
"configKeys": [],
|
|
21
|
+
"configFields": [],
|
|
21
22
|
"contractVersion": 1,
|
|
22
23
|
"envRequirements": [
|
|
23
24
|
{
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
"path": "src/storage/vercel-blob/storage-provider.ts",
|
|
13
13
|
"content": "import type { VercelBlobAdapterOptions } from \"files-sdk/vercel-blob\";\nimport { vercelBlob } from \"files-sdk/vercel-blob\";\n\nconst privateDownloadExpirySeconds = 300;\n\nexport const createStorageAdapter = (\n options: Readonly<VercelBlobAdapterOptions> = {}\n): ReturnType<typeof vercelBlob> =>\n vercelBlob({\n ...options,\n access: \"private\",\n defaultUrlExpiresIn: privateDownloadExpirySeconds,\n });\n",
|
|
14
14
|
"type": "registry:file",
|
|
15
|
-
"target": "~/
|
|
15
|
+
"target": "~/chatjs/providers/storage.ts"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"meta": {
|
|
19
|
+
"icon": "setup/vercel",
|
|
19
20
|
"chatjs": {
|
|
20
21
|
"configKeys": [],
|
|
22
|
+
"configFields": [],
|
|
21
23
|
"contractVersion": 1,
|
|
22
24
|
"envRequirements": [
|
|
23
25
|
{
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "vercel-gateway",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Vercel AI Gateway",
|
|
5
5
|
"dependencies": [
|
|
6
|
-
"@
|
|
7
|
-
"@
|
|
6
|
+
"@ai-sdk/gateway@4.0.145",
|
|
7
|
+
"@vercel/oidc@3.2.0",
|
|
8
|
+
"zod@4.5.4"
|
|
8
9
|
],
|
|
9
10
|
"files": [
|
|
10
11
|
{
|
|
11
12
|
"path": "src/gateways/vercel/gateway.ts",
|
|
12
|
-
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n
|
|
13
|
+
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n aiGatewayModelSchema,\n isAiGatewayModelType,\n} from \"@/chatjs/core/gateway/models\";\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\nimport type { ImageModel } from \"ai\";\n\nimport { createGateway } from \"@ai-sdk/gateway\";\nimport type { gateway } from \"@ai-sdk/gateway\";\nimport { getVercelOidcToken } from \"@vercel/oidc\";\nimport { z } from \"zod\";\n\nconst MODEL_DISCOVERY_TIMEOUT_MS = 10_000;\nconst MODEL_ID_PARAMETER_INDEX = 0;\ntype VercelImageModelId = Parameters<\n (typeof gateway)[\"imageModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\ntype VercelVideoModelId = Parameters<\n (typeof gateway)[\"videoModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\n\nconst EMPTY_MODEL_TYPE_COUNT = 0;\nconst modelDiscriminatorSchema = z.object({ type: z.string() });\nconst modelsEnvelopeSchema = z.object({\n data: z.array(z.unknown()),\n object: z.literal(\"list\"),\n});\nconst modelAvailability = z.object({\n model_eligibility: z\n .object({\n status: z.string(),\n category: z.string().optional(),\n })\n .optional(),\n});\n\nclass VercelGateway\n extends GatewayRuntime\n implements GatewayProvider<\"vercel\">\n{\n public readonly type = \"vercel\" as const;\n\n public createLanguageModel(\n modelId: Parameters<\n (typeof gateway)[\"languageModel\"]\n >[typeof MODEL_ID_PARAMETER_INDEX]\n ): LanguageModelV4 {\n return this.getProvider()(modelId);\n }\n\n public createImageModel(modelId: VercelImageModelId): ImageModel {\n return this.getProvider().imageModel(modelId);\n }\n\n public createVideoModel(\n modelId: VercelVideoModelId\n ): Experimental_VideoModelV4 {\n return this.getProvider().videoModel(modelId);\n }\n\n private provider?: ReturnType<typeof createGateway>;\n\n private getProvider(): ReturnType<typeof createGateway> {\n this.provider ??= createGateway({ apiKey: this.env.AI_GATEWAY_API_KEY });\n return this.provider;\n }\n\n private async getApiKey(): Promise<string | null> {\n const apiKey = this.env.AI_GATEWAY_API_KEY;\n\n if (typeof apiKey === \"string\" && apiKey !== \"\") {\n return apiKey;\n }\n const oidcToken = this.env.VERCEL_OIDC_TOKEN;\n if (typeof oidcToken === \"string\" && oidcToken !== \"\") {\n return oidcToken;\n }\n return await getVercelOidcToken().catch(() => null);\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = await this.getApiKey();\n const catalogUrl = \"https://ai-gateway.vercel.sh/v1/models\";\n const url =\n apiKey === null ? catalogUrl : `${catalogUrl}?include_availability`;\n this.log.debug({ url }, \"Fetching models from Vercel AI Gateway\");\n\n const response = await this.fetch(url, {\n headers:\n apiKey === null ? undefined : { Authorization: `Bearer ${apiKey}` },\n signal: AbortSignal.timeout(MODEL_DISCOVERY_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"Vercel AI Gateway returned non-OK response\"\n );\n throw new Error(\n `Failed to fetch models: ${response.status} ${response.statusText}`\n );\n }\n\n const bodyRaw: unknown = await response.json();\n const body = modelsEnvelopeSchema.parse(bodyRaw);\n const unsupportedTypes = new Set<string>();\n const models: AiGatewayModel[] = [];\n\n for (const candidate of body.data) {\n const { type } = modelDiscriminatorSchema.parse(candidate);\n if (isAiGatewayModelType(type)) {\n const availability = modelAvailability.safeParse(candidate);\n const eligibility = availability.data?.model_eligibility;\n if (\n eligibility?.status === \"ineligible\" &&\n (eligibility.category === \"policy\" ||\n eligibility.category === \"configuration\")\n ) {\n continue;\n }\n models.push(aiGatewayModelSchema.parse(candidate));\n } else {\n unsupportedTypes.add(type);\n }\n }\n\n if (unsupportedTypes.size > EMPTY_MODEL_TYPE_COUNT) {\n this.log.warn(\n {\n modelCount: body.data.length,\n skippedModelCount: body.data.length - models.length,\n unsupportedTypes: [...unsupportedTypes],\n },\n \"Skipping models with unsupported types from Vercel AI Gateway\"\n );\n }\n\n this.log.info(\n { modelCount: models.length },\n \"Successfully fetched models from Vercel AI Gateway\"\n );\n return models;\n }\n}\nexport { VercelGateway as Gateway, VercelGateway };\n",
|
|
13
14
|
"type": "registry:file",
|
|
14
|
-
"target": "~/
|
|
15
|
+
"target": "~/chatjs/providers/gateway.ts"
|
|
15
16
|
}
|
|
16
17
|
],
|
|
17
18
|
"meta": {
|
|
19
|
+
"icon": "setup/vercel",
|
|
18
20
|
"chatjs": {
|
|
19
21
|
"capabilities": {
|
|
20
22
|
"image": true,
|
|
@@ -22,10 +24,6 @@
|
|
|
22
24
|
},
|
|
23
25
|
"contractVersion": 1,
|
|
24
26
|
"defaults": {
|
|
25
|
-
"anonymousModels": [
|
|
26
|
-
"google/gemini-2.5-flash-lite",
|
|
27
|
-
"openai/gpt-5-nano"
|
|
28
|
-
],
|
|
29
27
|
"curatedDefaults": [
|
|
30
28
|
"openai/gpt-5-nano",
|
|
31
29
|
"openai/gpt-5-mini",
|
|
@@ -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.1.1-chatjs.0"
|
|
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,42 @@
|
|
|
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/chat-ui.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 chatUi = definePlugin({\n id: \"video-viewer\",\n slots: [slot(ArtifactViewerActions, VideoViewerAction)],\n});\n",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"target": "~/chatjs/plugins/video-viewer/chat-ui.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 \"contractVersion\": 3,\n \"uiBase\": \"base\",\n \"id\": \"video-viewer\",\n \"kind\": \"plugin\",\n \"files\": [\n \"chatjs/plugins/video-viewer/chat-ui.ts\",\n \"chatjs/plugins/video-viewer/viewer-action.tsx\"\n ]\n}\n",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"target": "~/chatjs/plugins/video-viewer/plugin.json"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"meta": {
|
|
30
|
+
"chatjs": {
|
|
31
|
+
"contractVersion": 3,
|
|
32
|
+
"uiBase": "base",
|
|
33
|
+
"id": "video-viewer",
|
|
34
|
+
"kind": "plugin",
|
|
35
|
+
"files": [
|
|
36
|
+
"chatjs/plugins/video-viewer/chat-ui.ts",
|
|
37
|
+
"chatjs/plugins/video-viewer/viewer-action.tsx"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"type": "registry:item"
|
|
42
|
+
}
|
|
@@ -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": {
|
|
@@ -23,6 +23,18 @@
|
|
|
23
23
|
"bucket",
|
|
24
24
|
"region"
|
|
25
25
|
],
|
|
26
|
+
"configFields": [
|
|
27
|
+
{
|
|
28
|
+
"key": "bucket",
|
|
29
|
+
"label": "bucket",
|
|
30
|
+
"type": "text"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"key": "region",
|
|
34
|
+
"label": "region",
|
|
35
|
+
"type": "text"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
26
38
|
"contractVersion": 1,
|
|
27
39
|
"envRequirements": [
|
|
28
40
|
{
|
|
@@ -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": {
|
|
@@ -23,6 +23,18 @@
|
|
|
23
23
|
"bucket",
|
|
24
24
|
"region"
|
|
25
25
|
],
|
|
26
|
+
"configFields": [
|
|
27
|
+
{
|
|
28
|
+
"key": "bucket",
|
|
29
|
+
"label": "bucket",
|
|
30
|
+
"type": "text"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"key": "region",
|
|
34
|
+
"label": "region",
|
|
35
|
+
"type": "text"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
26
38
|
"contractVersion": 1,
|
|
27
39
|
"envRequirements": [
|
|
28
40
|
{
|
|
@@ -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": {
|
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
"baseUrl",
|
|
22
22
|
"root"
|
|
23
23
|
],
|
|
24
|
+
"configFields": [
|
|
25
|
+
{
|
|
26
|
+
"key": "baseUrl",
|
|
27
|
+
"label": "baseUrl",
|
|
28
|
+
"type": "text"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"key": "root",
|
|
32
|
+
"label": "root",
|
|
33
|
+
"type": "text"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
24
36
|
"contractVersion": 1,
|
|
25
37
|
"envRequirements": [
|
|
26
38
|
{
|
|
@@ -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": {
|
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
"configKeys": [
|
|
23
23
|
"bucket"
|
|
24
24
|
],
|
|
25
|
+
"configFields": [
|
|
26
|
+
{
|
|
27
|
+
"key": "bucket",
|
|
28
|
+
"label": "bucket",
|
|
29
|
+
"type": "text"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
25
32
|
"contractVersion": 1,
|
|
26
33
|
"envRequirements": [
|
|
27
34
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-js/registry",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ChatJS tool and gateway registry items",
|
|
6
6
|
"keywords": [
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"prepublishOnly": "bun run build",
|
|
36
36
|
"test:types": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
|
|
37
37
|
"test:unit": "bun test src",
|
|
38
|
+
"test:native": "bun run build && bun test --timeout 180000 test/native-eve.test.ts",
|
|
39
|
+
"test:installation": "bunx turbo run build --filter=@chat-js/thread && bun run --cwd ../cli template:sync && bun test --timeout 60000 test/installation-validation.test.ts",
|
|
40
|
+
"profile:validation": "bun scripts/validation-profile.ts",
|
|
38
41
|
"test:visual": "vitest run --config visual/vitest.config.ts",
|
|
39
42
|
"check": "bun run test:types && bun run test:unit && bun run test:visual",
|
|
40
43
|
"lint": "oxlint . && oxfmt --check .",
|
|
@@ -42,37 +45,24 @@
|
|
|
42
45
|
"demo:check": "bun test test/demo-check.test.ts",
|
|
43
46
|
"demo:sync": "bun scripts/demo-sync.ts"
|
|
44
47
|
},
|
|
45
|
-
"dependencies": {},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@ai-sdk/anthropic": "4.0.
|
|
48
|
-
"@ai-sdk/gateway": "4.0.
|
|
49
|
-
"@ai-sdk/google": "4.0.
|
|
50
|
-
"@ai-sdk/mcp": "2.0.
|
|
51
|
-
"@ai-sdk/openai": "4.0.
|
|
52
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
53
|
-
"@ai-sdk/provider": "4.0.
|
|
54
|
-
"@
|
|
55
|
-
"@chat-js/
|
|
56
|
-
"@codemirror/lang-javascript": "^6.2.2",
|
|
57
|
-
"@codemirror/lang-python": "^6.1.6",
|
|
58
|
-
"@codemirror/state": "^6.5.0",
|
|
59
|
-
"@codemirror/theme-one-dark": "^6.1.2",
|
|
60
|
-
"@codemirror/view": "^6.35.3",
|
|
61
|
-
"@daytona/sdk": "0.220.0",
|
|
49
|
+
"@ai-sdk/anthropic": "4.0.104",
|
|
50
|
+
"@ai-sdk/gateway": "4.0.145",
|
|
51
|
+
"@ai-sdk/google": "4.0.120",
|
|
52
|
+
"@ai-sdk/mcp": "2.0.99",
|
|
53
|
+
"@ai-sdk/openai": "4.0.117",
|
|
54
|
+
"@ai-sdk/openai-compatible": "3.0.92",
|
|
55
|
+
"@ai-sdk/provider": "4.0.38",
|
|
56
|
+
"@better-auth/electron": "1.6.2",
|
|
57
|
+
"@chat-js/registry-validation": "workspace:*",
|
|
62
58
|
"@hookform/resolvers": "^5.2.1",
|
|
63
|
-
"@lexical/code": "^0.32.1",
|
|
64
|
-
"@lexical/link": "^0.32.1",
|
|
65
|
-
"@lexical/list": "^0.32.1",
|
|
66
|
-
"@lexical/markdown": "^0.32.1",
|
|
67
|
-
"@lexical/react": "^0.32.1",
|
|
68
|
-
"@lexical/rich-text": "^0.32.1",
|
|
69
|
-
"@mendable/firecrawl-js": "1.29.1",
|
|
70
59
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
71
60
|
"@openrouter/ai-sdk-provider": "3.0.0",
|
|
61
|
+
"@streamdown/math": "^1.0.2",
|
|
62
|
+
"@streamdown/mermaid": "^1.0.2",
|
|
72
63
|
"@supabase/storage-js": "2.117.2",
|
|
73
64
|
"@tailwindcss/typography": "^0.5.19",
|
|
74
65
|
"@tanstack/react-query": "^5.104.1",
|
|
75
|
-
"@tavily/core": "^0.3.3",
|
|
76
66
|
"@trpc/client": "^11.1.2",
|
|
77
67
|
"@trpc/server": "^11.1.2",
|
|
78
68
|
"@types/bun": "latest",
|
|
@@ -80,28 +70,20 @@
|
|
|
80
70
|
"@types/papaparse": "^5.3.15",
|
|
81
71
|
"@types/react": "19.2.7",
|
|
82
72
|
"@types/react-dom": "19.2.3",
|
|
83
|
-
"@vercel/analytics": "^1.5.0",
|
|
84
73
|
"@vercel/blob": "2.4.0",
|
|
85
74
|
"@vercel/oidc": "3.2.0",
|
|
86
|
-
"
|
|
87
|
-
"@vercel/sandbox": "3.3.0",
|
|
88
|
-
"@vercel/speed-insights": "^1.3.1",
|
|
89
|
-
"ai": "7.0.137",
|
|
75
|
+
"ai": "7.0.172",
|
|
90
76
|
"ajv": "8.18.0",
|
|
91
77
|
"basic-ftp": "^5.0.5",
|
|
78
|
+
"better-auth": "1.6.2",
|
|
92
79
|
"browser-image-compression": "^2.0.2",
|
|
93
|
-
"codemirror": "^6.0.1",
|
|
94
80
|
"date-fns": "^4.1.0",
|
|
95
|
-
"diff": "^8.0.2",
|
|
96
81
|
"drizzle-orm": "^0.45.1",
|
|
97
|
-
"
|
|
98
|
-
"echarts-for-react": "^3.0.2",
|
|
99
|
-
"eve": "npm:@chat-js/eve@0.80.1-chatjs.4",
|
|
82
|
+
"eve": "npm:@chat-js/eve@1.1.1-chatjs.0",
|
|
100
83
|
"files-sdk": "2.5.0",
|
|
101
84
|
"geist": "^1.7.2",
|
|
102
85
|
"guarded-fetch": "^0.1.4",
|
|
103
|
-
"
|
|
104
|
-
"lexical": "^0.32.1",
|
|
86
|
+
"katex": "0.16.45",
|
|
105
87
|
"lucide-react": "0.553.0",
|
|
106
88
|
"motion": "^12.23.24",
|
|
107
89
|
"next": "16.3.0",
|
|
@@ -113,9 +95,9 @@
|
|
|
113
95
|
"react": "19.2.3",
|
|
114
96
|
"react-data-grid": "7.0.0-beta.47",
|
|
115
97
|
"react-dom": "19.2.3",
|
|
116
|
-
"react-dropzone": "^14.3.8",
|
|
117
98
|
"react-hook-form": "^7.62.0",
|
|
118
99
|
"react-markdown": "^10.1.0",
|
|
100
|
+
"read-excel-file": "9.3.17",
|
|
119
101
|
"shadcn": "4.21.0",
|
|
120
102
|
"sonner": "^2.0.7",
|
|
121
103
|
"superjson": "^2.2.2",
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
-
"name": "code-documents",
|
|
4
|
-
"description": "Create and edit code documents with their editor UI",
|
|
5
|
-
"dependencies": [
|
|
6
|
-
"@codemirror/lang-javascript@^6.2.2",
|
|
7
|
-
"@codemirror/lang-python@^6.1.6",
|
|
8
|
-
"@codemirror/state@^6.5.0",
|
|
9
|
-
"@codemirror/theme-one-dark@^6.1.2",
|
|
10
|
-
"@codemirror/view@^6.35.3",
|
|
11
|
-
"codemirror@^6.0.1"
|
|
12
|
-
],
|
|
13
|
-
"registryDependencies": [
|
|
14
|
-
"@chatjs/read-document"
|
|
15
|
-
],
|
|
16
|
-
"files": [
|
|
17
|
-
{
|
|
18
|
-
"path": "src/tools/code-documents/tool.ts",
|
|
19
|
-
"content": "import {\n eveDocumentCreateInput,\n eveDocumentEditInput,\n eveDocumentWriteResult,\n} from \"@/lib/eve/document-contracts\";\nimport type { ToolContext } from \"eve/tools\";\nimport { codeGuidelines } from \"./guidelines\";\nimport { defineTool } from \"eve/tools\";\nimport { executeEveDocumentTool } from \"@/lib/eve/document-tools\";\nimport type { z } from \"zod\";\n\ntype CreateCodeDocumentInput = Readonly<\n Omit<z.infer<typeof eveDocumentCreateInput>, \"fileIds\"> & {\n fileIds: readonly string[];\n }\n>;\n\ntype EditCodeDocumentInput = Readonly<\n Omit<z.infer<typeof eveDocumentEditInput>, \"fileIds\"> & {\n fileIds: readonly string[];\n }\n>;\n\ntype ReadonlyDocumentToolContext = Readonly<\n Pick<ToolContext, \"callId\" | \"session\"> & {\n abortSignal: Readonly<AbortSignal>;\n }\n>;\n\nconst createCodeDocument = defineTool({\n description: `Create a new code document in this conversation. Supply the complete content and a descriptive title. ${codeGuidelines}`,\n execute: async (\n input: CreateCodeDocumentInput,\n context: ReadonlyDocumentToolContext\n ) =>\n eveDocumentWriteResult.parse(\n await executeEveDocumentTool(\"createCodeDocument\", input, context)\n ),\n inputSchema: eveDocumentCreateInput,\n outputSchema: eveDocumentWriteResult,\n});\nconst editCodeDocument = defineTool({\n description: `Edit an existing code document in this conversation. Read the document first and supply its revision ID. Supply the complete replacement content. ${codeGuidelines}`,\n execute: async (\n input: EditCodeDocumentInput,\n context: ReadonlyDocumentToolContext\n ) =>\n eveDocumentWriteResult.parse(\n await executeEveDocumentTool(\"editCodeDocument\", input, context)\n ),\n inputSchema: eveDocumentEditInput,\n outputSchema: eveDocumentWriteResult,\n});\nexport { createCodeDocument, editCodeDocument };\n",
|
|
20
|
-
"type": "registry:file",
|
|
21
|
-
"target": "~/tools/chatjs/code-documents/tool.ts"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "src/tools/code-documents/guidelines.ts",
|
|
25
|
-
"content": "export const codeGuidelines = `\nGuidelines for Python code:\n- Each snippet should be complete and runnable on its own\n- Prefer using print() statements to display outputs\n- Include helpful comments explaining the code\n- Keep snippets concise (generally under 15 lines)\n- Avoid external dependencies - use Python standard library\n- Handle potential errors gracefully\n- Return meaningful output that demonstrates the code's functionality\n- Don't use input() or other interactive functions\n- Don't access files or network resources\n- Don't use infinite loops\n\nThe title MUST include the file extension (e.g., \"script.py\", \"App.tsx\", \"utils.js\").\nThis extension determines syntax highlighting.`;\n",
|
|
26
|
-
"type": "registry:file",
|
|
27
|
-
"target": "~/tools/chatjs/code-documents/guidelines.ts"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "src/tools/code-documents/configuration-schema.ts",
|
|
31
|
-
"content": "import { z } from \"zod\";\nimport { languageModelSchema, modelRoles } from \"@/lib/config-models\";\n\nconst configSchema = z\n .strictObject({ edits: languageModelSchema.default(modelRoles.balanced) })\n .prefault({});\nexport { configSchema };\n",
|
|
32
|
-
"type": "registry:file",
|
|
33
|
-
"target": "~/tools/chatjs/code-documents/configuration-schema.ts"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "src/tools/code-documents/assistant-actions.ts",
|
|
37
|
-
"content": "import type { DocumentAssistantAction } from \"@/lib/eve/document-contracts\";\nimport { config } from \"@/lib/config\";\n\nconst documentAssistantActions = (): DocumentAssistantAction[] => [\n {\n instruction: \"Add comments to the code for understanding.\",\n label: \"Add comments\",\n modelId: config.ai.tools.code.edits,\n },\n {\n instruction: \"Add logs to the code for debugging.\",\n label: \"Add logs\",\n modelId: config.ai.tools.code.edits,\n },\n];\nexport { documentAssistantActions };\n",
|
|
38
|
-
"type": "registry:file",
|
|
39
|
-
"target": "~/tools/chatjs/code-documents/assistant-actions.ts"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "src/tools/code-documents/document.tsx",
|
|
43
|
-
"content": "\"use client\";\nimport type { DocumentBodyProps, DocumentUi } from \"@/lib/eve/document-ui\";\nimport React from \"react\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport dynamic from \"next/dynamic\";\nimport { getLanguageFromFileName } from \"@/lib/file-language\";\n\nconst CodeEditor = dynamic(\n async () => {\n const { CodeEditor: Editor } = await import(\"./editor\");\n return Editor;\n },\n {\n ssr: false,\n }\n);\n\nexport const documentUi: DocumentUi = {\n Body: ({ title, editorProps }: ReadonlyNativeSurface<DocumentBodyProps>) => (\n <ScrollArea className=\"min-h-0 flex-1\">\n <CodeEditor\n {...editorProps}\n language={getLanguageFromFileName(title) || \"python\"}\n />\n </ScrollArea>\n ),\n};\n",
|
|
44
|
-
"type": "registry:file",
|
|
45
|
-
"target": "~/tools/chatjs/code-documents/document.tsx"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "src/tools/code-documents/editor.tsx",
|
|
49
|
-
"content": "\"use client\";\n\nimport { Compartment, EditorState, Transaction } from \"@codemirror/state\";\nimport React, { memo, useEffect, useRef } from \"react\";\nimport { EditorView } from \"@codemirror/view\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\nimport type { ViewUpdate } from \"@codemirror/view\";\nimport { javascript } from \"@codemirror/lang-javascript\";\nimport { python } from \"@codemirror/lang-python\";\nimport { oneDark } from \"@codemirror/theme-one-dark\";\nimport { basicSetup } from \"codemirror\";\n\ninterface EditorProps {\n content: string;\n currentVersionIndex: number;\n isCurrentVersion: boolean;\n isReadonly?: boolean;\n language?: string;\n onSaveContent: (updatedContent: string, debounce: boolean) => void;\n status: \"streaming\" | \"idle\";\n}\n\nconst getLanguageExtension = (language: string): ReturnType<typeof python> => {\n switch (language) {\n case \"typescript\": {\n return javascript({ jsx: false, typescript: true });\n }\n case \"javascript\": {\n return javascript({ jsx: false, typescript: false });\n }\n case \"jsx\": {\n return javascript({ jsx: true, typescript: false });\n }\n case \"tsx\": {\n return javascript({ jsx: true, typescript: true });\n }\n default: {\n return python();\n }\n }\n};\n\nconst PureCodeEditor = ({\n content,\n onSaveContent,\n isReadonly,\n language = \"python\",\n}: ReadonlyNativeSurface<EditorProps>): React.JSX.Element => {\n const containerRef = useRef<HTMLDivElement>(null);\n const editorRef = useRef<EditorView | null>(null);\n\n const configuration = useRef(new Compartment());\n\n useEffect((): (() => void) | undefined => {\n if (!containerRef.current) {\n return undefined;\n }\n const view = new EditorView({\n parent: containerRef.current,\n state: EditorState.create({\n extensions: [basicSetup, oneDark, configuration.current.of([])],\n }),\n });\n editorRef.current = view;\n return (): void => {\n view.destroy();\n editorRef.current = null;\n };\n }, []);\n\n useEffect((): void => {\n editorRef.current?.dispatch({\n effects: configuration.current.reconfigure([\n getLanguageExtension(language),\n EditorView.editable.of(!(isReadonly === true)),\n EditorState.readOnly.of(Boolean(isReadonly)),\n EditorView.updateListener.of(\n (\n update: ReadonlyNativeSurface<\n Pick<ViewUpdate, \"docChanged\" | \"state\" | \"transactions\">\n >\n ): void => {\n if (\n update.docChanged &&\n isReadonly !== true &&\n update.transactions.some(\n (transaction: ReadonlyNativeSurface<Transaction>): boolean =>\n transaction.annotation(Transaction.remote) !== true\n )\n ) {\n onSaveContent(update.state.doc.toString(), true);\n }\n }\n ),\n ]),\n });\n }, [onSaveContent, isReadonly, language]);\n\n useEffect((): void => {\n const view = editorRef.current;\n if (!view) {\n return;\n }\n const currentContent = view.state.doc.toString();\n if (currentContent !== content) {\n view.dispatch({\n annotations: [Transaction.remote.of(true)],\n changes: { from: 0, insert: content, to: currentContent.length },\n });\n }\n }, [content]);\n\n return (\n <div className=\"not-prose relative w-full text-sm\" ref={containerRef} />\n );\n};\n\nconst areEqual = (\n prevProps: ReadonlyNativeSurface<EditorProps>,\n nextProps: ReadonlyNativeSurface<EditorProps>\n): boolean => {\n if (prevProps.currentVersionIndex !== nextProps.currentVersionIndex) {\n return false;\n }\n if (prevProps.isCurrentVersion !== nextProps.isCurrentVersion) {\n return false;\n }\n if (prevProps.status === \"streaming\" && nextProps.status === \"streaming\") {\n return false;\n }\n if (prevProps.content !== nextProps.content) {\n return false;\n }\n if (prevProps.isReadonly !== nextProps.isReadonly) {\n return false;\n }\n if (prevProps.language !== nextProps.language) {\n return false;\n }\n\n return true;\n};\n\nexport const CodeEditor = memo(PureCodeEditor, areEqual);\n",
|
|
50
|
-
"type": "registry:file",
|
|
51
|
-
"target": "~/tools/chatjs/code-documents/editor.tsx"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "dist/source/code-documents.json",
|
|
55
|
-
"content": "{\n \"config\": { \"key\": \"code\" },\n \"documentActions\": true,\n \"documentKind\": \"code\",\n \"envRequirements\": [],\n \"id\": \"code-documents\",\n \"kind\": \"tool\",\n \"requiresTools\": [\"readDocument\"],\n \"tools\": [\n {\n \"composer\": { \"icon\": \"Edit3\", \"name\": \"Canvas\", \"shortName\": \"Canvas\" },\n \"toolExport\": \"createCodeDocument\"\n },\n {\n \"composer\": { \"icon\": \"Edit3\", \"name\": \"Canvas\", \"shortName\": \"Canvas\" },\n \"toolExport\": \"editCodeDocument\"\n }\n ],\n \"contractVersion\": 2,\n \"uiBase\": \"base\"\n}\n",
|
|
56
|
-
"type": "registry:file",
|
|
57
|
-
"target": "~/tools/chatjs/code-documents/chatjs.json"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"meta": {
|
|
61
|
-
"chatjs": {
|
|
62
|
-
"config": {
|
|
63
|
-
"key": "code"
|
|
64
|
-
},
|
|
65
|
-
"documentActions": true,
|
|
66
|
-
"documentKind": "code",
|
|
67
|
-
"envRequirements": [],
|
|
68
|
-
"id": "code-documents",
|
|
69
|
-
"kind": "tool",
|
|
70
|
-
"requiresTools": [
|
|
71
|
-
"readDocument"
|
|
72
|
-
],
|
|
73
|
-
"tools": [
|
|
74
|
-
{
|
|
75
|
-
"composer": {
|
|
76
|
-
"icon": "Edit3",
|
|
77
|
-
"name": "Canvas",
|
|
78
|
-
"shortName": "Canvas"
|
|
79
|
-
},
|
|
80
|
-
"toolExport": "createCodeDocument"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"composer": {
|
|
84
|
-
"icon": "Edit3",
|
|
85
|
-
"name": "Canvas",
|
|
86
|
-
"shortName": "Canvas"
|
|
87
|
-
},
|
|
88
|
-
"toolExport": "editCodeDocument"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"contractVersion": 2,
|
|
92
|
-
"uiBase": "base"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"type": "registry:item"
|
|
96
|
-
}
|