@chat-js/registry 0.1.2 → 0.2.0-beta.1
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 +60 -8
- package/dist/r/ai-titles.json +50 -0
- package/dist/r/akamai-storage.json +44 -0
- package/dist/r/alibaba-storage.json +44 -0
- package/dist/r/appwrite-storage.json +50 -0
- package/dist/r/archil-storage.json +52 -0
- package/dist/r/attachment-uploads.json +90 -0
- package/dist/r/azure-storage.json +51 -0
- package/dist/r/backblaze-b2-storage.json +44 -0
- package/dist/r/base/ai-titles.json +50 -0
- package/dist/r/base/akamai-storage.json +44 -0
- package/dist/r/base/alibaba-storage.json +44 -0
- package/dist/r/base/appwrite-storage.json +50 -0
- package/dist/r/base/archil-storage.json +52 -0
- package/dist/r/base/attachment-uploads.json +90 -0
- package/dist/r/base/azure-storage.json +51 -0
- package/dist/r/base/backblaze-b2-storage.json +44 -0
- package/dist/r/base/bunny-storage-storage.json +48 -0
- package/dist/r/base/cloudinary-storage.json +43 -0
- package/dist/r/base/code-documents.json +96 -0
- package/dist/r/base/code-execution-runtime.json +25 -0
- package/dist/r/base/code-execution-ui.json +32 -0
- package/dist/r/base/code-execution.json +69 -0
- package/dist/r/base/credits.json +103 -0
- package/dist/r/base/daytona-sandbox.json +55 -0
- package/dist/r/base/deep-research.json +224 -0
- package/dist/r/base/delete-document.json +58 -0
- package/dist/r/base/digitalocean-spaces-storage.json +44 -0
- package/dist/r/base/dropbox-storage.json +43 -0
- package/dist/r/base/exoscale-storage.json +44 -0
- package/dist/r/base/feedback.json +112 -0
- package/dist/r/base/filebase-storage.json +43 -0
- package/dist/r/base/firebase-storage-storage.json +52 -0
- package/dist/r/base/firecrawl-search.json +72 -0
- package/dist/r/base/followup-suggestions.json +152 -0
- package/dist/r/base/ftp-storage.json +54 -0
- package/dist/r/base/gcs-storage.json +33 -0
- package/dist/r/base/generate-image.json +101 -0
- package/dist/r/base/generate-video.json +70 -0
- package/dist/r/base/get-weather.json +52 -0
- package/dist/r/base/google-drive-storage.json +47 -0
- package/dist/r/base/hetzner-storage.json +44 -0
- package/dist/r/base/ibm-cos-storage.json +44 -0
- package/dist/r/base/idrive-e2-storage.json +44 -0
- package/dist/r/base/langfuse.json +63 -0
- package/dist/r/base/litellm-gateway.json +67 -0
- package/dist/r/base/mcp.json +320 -0
- package/dist/r/base/memory-storage.json +28 -0
- package/dist/r/base/minio-storage.json +44 -0
- package/dist/r/base/model-preferences.json +131 -0
- package/dist/r/base/neon-storage.json +44 -0
- package/dist/r/base/netlify-blobs-storage.json +31 -0
- package/dist/r/base/onedrive-storage.json +48 -0
- package/dist/r/base/openai-compatible-gateway.json +69 -0
- package/dist/r/base/openai-gateway.json +67 -0
- package/dist/r/base/openrouter-gateway.json +75 -0
- package/dist/r/base/oracle-cloud-storage.json +45 -0
- package/dist/r/base/ovhcloud-storage.json +44 -0
- package/dist/r/base/pocketbase-storage.json +50 -0
- package/dist/r/base/projects.json +275 -0
- package/dist/r/base/r2-storage.json +44 -0
- package/dist/r/base/read-document.json +34 -0
- package/dist/r/base/registry.json +4949 -0
- package/dist/r/base/retrieve-url.json +69 -0
- package/dist/r/base/s3-storage.json +44 -0
- package/dist/r/base/saved-code-execution.json +84 -0
- package/dist/r/base/scaleway-storage.json +44 -0
- package/dist/r/base/search.json +146 -0
- package/dist/r/base/sftp-storage.json +58 -0
- package/dist/r/base/sharepoint-storage.json +50 -0
- package/dist/r/base/sharing.json +144 -0
- package/dist/r/base/sheet-documents.json +94 -0
- package/dist/r/base/storj-storage.json +43 -0
- package/dist/r/base/supabase-storage.json +48 -0
- package/dist/r/base/tavily-search.json +72 -0
- package/dist/r/base/tencent-storage.json +44 -0
- package/dist/r/base/text-documents.json +117 -0
- package/dist/r/base/tigris-storage.json +43 -0
- package/dist/r/base/uploadthing-storage.json +38 -0
- package/dist/r/base/vercel-analytics.json +46 -0
- package/dist/r/base/vercel-blob-storage.json +42 -0
- package/dist/r/base/vercel-gateway.json +77 -0
- package/dist/r/base/vercel-sandbox.json +67 -0
- package/dist/r/base/vercel-speed-insights.json +46 -0
- package/dist/r/base/vultr-storage.json +44 -0
- package/dist/r/base/wasabi-storage.json +44 -0
- package/dist/r/base/webdav-storage.json +52 -0
- package/dist/r/base/word-count.json +51 -0
- package/dist/r/base/yandex-storage.json +43 -0
- package/dist/r/bunny-storage-storage.json +48 -0
- package/dist/r/cloudinary-storage.json +43 -0
- package/dist/r/code-documents.json +96 -0
- package/dist/r/code-execution-runtime.json +25 -0
- package/dist/r/code-execution-ui.json +32 -0
- package/dist/r/code-execution.json +69 -0
- package/dist/r/credits.json +103 -0
- package/dist/r/daytona-sandbox.json +55 -0
- package/dist/r/deep-research.json +224 -0
- package/dist/r/delete-document.json +58 -0
- package/dist/r/digitalocean-spaces-storage.json +44 -0
- package/dist/r/dropbox-storage.json +43 -0
- package/dist/r/exoscale-storage.json +44 -0
- package/dist/r/feedback.json +112 -0
- package/dist/r/filebase-storage.json +43 -0
- package/dist/r/firebase-storage-storage.json +52 -0
- package/dist/r/firecrawl-search.json +72 -0
- package/dist/r/followup-suggestions.json +152 -0
- package/dist/r/ftp-storage.json +54 -0
- package/dist/r/gcs-storage.json +33 -0
- package/dist/r/generate-image.json +101 -0
- package/dist/r/generate-video.json +70 -0
- package/dist/r/get-weather.json +52 -0
- package/dist/r/google-drive-storage.json +47 -0
- package/dist/r/hetzner-storage.json +44 -0
- package/dist/r/ibm-cos-storage.json +44 -0
- package/dist/r/idrive-e2-storage.json +44 -0
- package/dist/r/langfuse.json +63 -0
- package/dist/r/litellm-gateway.json +67 -0
- package/dist/r/mcp.json +320 -0
- package/dist/r/memory-storage.json +28 -0
- package/dist/r/minio-storage.json +44 -0
- package/dist/r/model-preferences.json +131 -0
- package/dist/r/neon-storage.json +44 -0
- package/dist/r/netlify-blobs-storage.json +31 -0
- package/dist/r/onedrive-storage.json +48 -0
- package/dist/r/openai-compatible-gateway.json +69 -0
- package/dist/r/openai-gateway.json +67 -0
- package/dist/r/openrouter-gateway.json +75 -0
- package/dist/r/oracle-cloud-storage.json +45 -0
- package/dist/r/ovhcloud-storage.json +44 -0
- package/dist/r/pocketbase-storage.json +50 -0
- package/dist/r/projects.json +275 -0
- package/dist/r/r2-storage.json +44 -0
- package/dist/r/radix/ai-titles.json +50 -0
- package/dist/r/radix/akamai-storage.json +44 -0
- package/dist/r/radix/alibaba-storage.json +44 -0
- package/dist/r/radix/appwrite-storage.json +50 -0
- package/dist/r/radix/archil-storage.json +52 -0
- package/dist/r/radix/attachment-uploads.json +90 -0
- package/dist/r/radix/azure-storage.json +51 -0
- package/dist/r/radix/backblaze-b2-storage.json +44 -0
- package/dist/r/radix/bunny-storage-storage.json +48 -0
- package/dist/r/radix/cloudinary-storage.json +43 -0
- package/dist/r/radix/code-documents.json +96 -0
- package/dist/r/radix/code-execution-runtime.json +25 -0
- package/dist/r/radix/code-execution-ui.json +32 -0
- package/dist/r/radix/code-execution.json +69 -0
- package/dist/r/radix/credits.json +103 -0
- package/dist/r/radix/daytona-sandbox.json +55 -0
- package/dist/r/radix/deep-research.json +224 -0
- package/dist/r/radix/delete-document.json +58 -0
- package/dist/r/radix/digitalocean-spaces-storage.json +44 -0
- package/dist/r/radix/dropbox-storage.json +43 -0
- package/dist/r/radix/exoscale-storage.json +44 -0
- package/dist/r/radix/feedback.json +112 -0
- package/dist/r/radix/filebase-storage.json +43 -0
- package/dist/r/radix/firebase-storage-storage.json +52 -0
- package/dist/r/radix/firecrawl-search.json +72 -0
- package/dist/r/radix/followup-suggestions.json +152 -0
- package/dist/r/radix/ftp-storage.json +54 -0
- package/dist/r/radix/gcs-storage.json +33 -0
- package/dist/r/radix/generate-image.json +101 -0
- package/dist/r/radix/generate-video.json +70 -0
- package/dist/r/radix/get-weather.json +52 -0
- package/dist/r/radix/google-drive-storage.json +47 -0
- package/dist/r/radix/hetzner-storage.json +44 -0
- package/dist/r/radix/ibm-cos-storage.json +44 -0
- package/dist/r/radix/idrive-e2-storage.json +44 -0
- package/dist/r/radix/langfuse.json +63 -0
- package/dist/r/radix/litellm-gateway.json +67 -0
- package/dist/r/radix/mcp.json +320 -0
- package/dist/r/radix/memory-storage.json +28 -0
- package/dist/r/radix/minio-storage.json +44 -0
- package/dist/r/radix/model-preferences.json +131 -0
- package/dist/r/radix/neon-storage.json +44 -0
- package/dist/r/radix/netlify-blobs-storage.json +31 -0
- package/dist/r/radix/onedrive-storage.json +48 -0
- package/dist/r/radix/openai-compatible-gateway.json +69 -0
- package/dist/r/radix/openai-gateway.json +67 -0
- package/dist/r/radix/openrouter-gateway.json +75 -0
- package/dist/r/radix/oracle-cloud-storage.json +45 -0
- package/dist/r/radix/ovhcloud-storage.json +44 -0
- package/dist/r/radix/pocketbase-storage.json +50 -0
- package/dist/r/radix/projects.json +275 -0
- package/dist/r/radix/r2-storage.json +44 -0
- package/dist/r/radix/read-document.json +34 -0
- package/dist/r/radix/registry.json +4949 -0
- package/dist/r/radix/retrieve-url.json +69 -0
- package/dist/r/radix/s3-storage.json +44 -0
- package/dist/r/radix/saved-code-execution.json +84 -0
- package/dist/r/radix/scaleway-storage.json +44 -0
- package/dist/r/radix/search.json +146 -0
- package/dist/r/radix/sftp-storage.json +58 -0
- package/dist/r/radix/sharepoint-storage.json +50 -0
- package/dist/r/radix/sharing.json +144 -0
- package/dist/r/radix/sheet-documents.json +94 -0
- package/dist/r/radix/storj-storage.json +43 -0
- package/dist/r/radix/supabase-storage.json +48 -0
- package/dist/r/radix/tavily-search.json +72 -0
- package/dist/r/radix/tencent-storage.json +44 -0
- package/dist/r/radix/text-documents.json +117 -0
- package/dist/r/radix/tigris-storage.json +43 -0
- package/dist/r/radix/uploadthing-storage.json +38 -0
- package/dist/r/radix/vercel-analytics.json +46 -0
- package/dist/r/radix/vercel-blob-storage.json +42 -0
- package/dist/r/radix/vercel-gateway.json +77 -0
- package/dist/r/radix/vercel-sandbox.json +67 -0
- package/dist/r/radix/vercel-speed-insights.json +46 -0
- package/dist/r/radix/vultr-storage.json +44 -0
- package/dist/r/radix/wasabi-storage.json +44 -0
- package/dist/r/radix/webdav-storage.json +52 -0
- package/dist/r/radix/word-count.json +51 -0
- package/dist/r/radix/yandex-storage.json +43 -0
- package/dist/r/read-document.json +34 -0
- package/dist/r/registry.json +4949 -0
- package/dist/r/retrieve-url.json +69 -0
- package/dist/r/s3-storage.json +44 -0
- package/dist/r/saved-code-execution.json +84 -0
- package/dist/r/scaleway-storage.json +44 -0
- package/dist/r/search.json +146 -0
- package/dist/r/sftp-storage.json +58 -0
- package/dist/r/sharepoint-storage.json +50 -0
- package/dist/r/sharing.json +144 -0
- package/dist/r/sheet-documents.json +94 -0
- package/dist/r/storj-storage.json +43 -0
- package/dist/r/supabase-storage.json +48 -0
- package/dist/r/tavily-search.json +72 -0
- package/dist/r/tencent-storage.json +44 -0
- package/dist/r/text-documents.json +117 -0
- package/dist/r/tigris-storage.json +43 -0
- package/dist/r/uploadthing-storage.json +38 -0
- package/dist/r/vercel-analytics.json +46 -0
- package/dist/r/vercel-blob-storage.json +42 -0
- package/dist/r/vercel-gateway.json +77 -0
- package/dist/r/vercel-sandbox.json +67 -0
- package/dist/r/vercel-speed-insights.json +46 -0
- package/dist/r/vultr-storage.json +44 -0
- package/dist/r/wasabi-storage.json +44 -0
- package/dist/r/webdav-storage.json +52 -0
- package/dist/r/word-count.json +51 -0
- package/dist/r/yandex-storage.json +43 -0
- package/package.json +113 -31
- package/index.d.ts +0 -4
- package/index.js +0 -1
- package/index.json +0 -19
- package/items/get-weather.json +0 -26
- package/items/retrieve-url.json +0 -35
- package/items/toolkit-renderer.json +0 -29
- package/items/word-count.json +0 -22
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "wasabi-storage",
|
|
4
|
+
"title": "Wasabi",
|
|
5
|
+
"description": "Wasabi Hot Cloud Storage via the S3-compatible API. AWS-style region names, Wasabi's own endpoints.",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"files-sdk@2.5.0",
|
|
8
|
+
"@aws-sdk/client-s3@^3.1079.0",
|
|
9
|
+
"@aws-sdk/s3-presigned-post@^3.700.0",
|
|
10
|
+
"@aws-sdk/s3-request-presigner@^3.700.0"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "src/storage/wasabi/storage-provider.ts",
|
|
15
|
+
"content": "export { wasabi as createStorageAdapter } from \"files-sdk/wasabi\";\n",
|
|
16
|
+
"type": "registry:file",
|
|
17
|
+
"target": "~/lib/storage-provider.ts"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"meta": {
|
|
21
|
+
"chatjs": {
|
|
22
|
+
"configKeys": [
|
|
23
|
+
"bucket",
|
|
24
|
+
"region"
|
|
25
|
+
],
|
|
26
|
+
"contractVersion": 1,
|
|
27
|
+
"envRequirements": [
|
|
28
|
+
{
|
|
29
|
+
"description": "Wasabi credentials",
|
|
30
|
+
"options": [
|
|
31
|
+
[
|
|
32
|
+
"WASABI_ACCESS_KEY_ID",
|
|
33
|
+
"WASABI_SECRET_ACCESS_KEY"
|
|
34
|
+
]
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"id": "wasabi",
|
|
39
|
+
"kind": "storage",
|
|
40
|
+
"optionalEnv": []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"type": "registry:item"
|
|
44
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "webdav-storage",
|
|
4
|
+
"title": "WebDAV",
|
|
5
|
+
"description": "WebDAV (Nextcloud, ownCloud, Apache mod_dav, …) via the webdav client. HTTP-based, with native server-side copy/move; url() needs an HTTP front (publicBaseUrl).",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"files-sdk@2.5.0",
|
|
8
|
+
"webdav@^5.10.0"
|
|
9
|
+
],
|
|
10
|
+
"files": [
|
|
11
|
+
{
|
|
12
|
+
"path": "src/storage/webdav/storage-provider.ts",
|
|
13
|
+
"content": "export { webdav as createStorageAdapter } from \"files-sdk/webdav\";\n",
|
|
14
|
+
"type": "registry:file",
|
|
15
|
+
"target": "~/lib/storage-provider.ts"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"meta": {
|
|
19
|
+
"chatjs": {
|
|
20
|
+
"configKeys": [
|
|
21
|
+
"baseUrl",
|
|
22
|
+
"root"
|
|
23
|
+
],
|
|
24
|
+
"contractVersion": 1,
|
|
25
|
+
"envRequirements": [
|
|
26
|
+
{
|
|
27
|
+
"description": "WebDAV configuration",
|
|
28
|
+
"options": [
|
|
29
|
+
[
|
|
30
|
+
"WEBDAV_URL"
|
|
31
|
+
]
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"description": "WebDAV credentials",
|
|
36
|
+
"options": [
|
|
37
|
+
[
|
|
38
|
+
"WEBDAV_USERNAME",
|
|
39
|
+
"WEBDAV_PASSWORD"
|
|
40
|
+
]
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"id": "webdav",
|
|
45
|
+
"kind": "storage",
|
|
46
|
+
"optionalEnv": [
|
|
47
|
+
"WEBDAV_AUTH_TYPE"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": "registry:item"
|
|
52
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "word-count",
|
|
4
|
+
"description": "Count words, characters, and sentences in text",
|
|
5
|
+
"dependencies": [
|
|
6
|
+
"ai@7.0.137",
|
|
7
|
+
"zod@4.5.4"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
{
|
|
11
|
+
"path": "src/tools/word-count/tool.ts",
|
|
12
|
+
"content": "import type { ToolUsage } from \"@/lib/eve/tool-usage\";\nimport { defineTool } from \"eve/tools\";\nimport { executeWithToolUsage } from \"@/lib/eve/tool-usage\";\nimport { toolResultToModelOutput } from \"@/lib/eve/tool-model-output\";\nimport { wordCountInput } from \"./schemas\";\nimport type { z } from \"zod\";\n\nconst UNBILLED_TOOL_COST_USD = 0;\nconst EMPTY_COUNT = 0;\nconst WORD_SPLIT_REGEX = /\\s+/u;\nconst SENTENCE_SPLIT_REGEX = /[.!?]+/u;\n\nexport const wordCount = defineTool({\n description: \"Count the words, characters, and sentences in a given text\",\n execute: async (\n { text }: Readonly<z.infer<typeof wordCountInput>>,\n context: Readonly<{ abortSignal: Readonly<AbortSignal> }>\n ) =>\n await executeWithToolUsage(\n context,\n (usage: Readonly<Pick<ToolUsage, \"addCostUsd\">>) => {\n usage.addCostUsd(UNBILLED_TOOL_COST_USD);\n const words =\n text.trim() === \"\"\n ? EMPTY_COUNT\n : text.trim().split(WORD_SPLIT_REGEX).length;\n const characters = text.length;\n const charactersNoSpaces = text.replaceAll(/\\s/gu, \"\").length;\n const sentences = text\n .split(SENTENCE_SPLIT_REGEX)\n .filter((sentence) => sentence.trim().length > EMPTY_COUNT).length;\n\n return { characters, charactersNoSpaces, sentences, words };\n }\n ),\n inputSchema: wordCountInput,\n toModelOutput: toolResultToModelOutput,\n});\n",
|
|
13
|
+
"type": "registry:file",
|
|
14
|
+
"target": "~/tools/chatjs/word-count/tool.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "src/tools/word-count/renderer.tsx",
|
|
18
|
+
"content": "\"use client\";\nimport { wordCountInput, wordCountResult } from \"./schemas\";\nimport React from \"react\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\nimport type { ToolRendererProps } from \"@/lib/ai/define-tool-renderer\";\nimport { defineToolRenderer } from \"@/lib/ai/define-tool-renderer\";\n\ntype WordCountRendererTool = ToolRendererProps<\n typeof wordCountInput,\n typeof wordCountResult\n>[\"tool\"];\n\nconst Stat = ({\n label,\n value,\n}: Readonly<{ label: string; value: number }>): React.JSX.Element => (\n <div className=\"flex flex-col items-center gap-1\">\n <span className=\"text-lg font-semibold\">{value}</span>\n <span className=\"text-muted-foreground text-xs\">{label}</span>\n </div>\n);\n\nconst WordCountView = ({\n tool,\n}: ReadonlyNativeSurface<{\n tool: WordCountRendererTool;\n messageId: string;\n isReadonly: boolean;\n}>): React.JSX.Element | null => {\n if (tool.state === \"input-available\") {\n return (\n <div className=\"text-muted-foreground rounded-lg border p-3 text-sm\">\n Counting words...\n </div>\n );\n }\n\n if (tool.state !== \"output-available\") {\n return null;\n }\n\n if (tool.output === undefined) {\n return null;\n }\n\n const { words, characters, charactersNoSpaces, sentences } = tool.output;\n\n return (\n <div className=\"grid grid-cols-2 gap-2 rounded-lg border p-3 text-sm sm:grid-cols-4\">\n <Stat label=\"Words\" value={words} />\n <Stat label=\"Characters\" value={characters} />\n <Stat label=\"No spaces\" value={charactersNoSpaces} />\n <Stat label=\"Sentences\" value={sentences} />\n </div>\n );\n};\n\nexport const WordCountRenderer = defineToolRenderer({\n inputSchema: wordCountInput,\n outputSchema: wordCountResult,\n render: WordCountView,\n});\n",
|
|
19
|
+
"type": "registry:file",
|
|
20
|
+
"target": "~/tools/chatjs/word-count/renderer.tsx"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "src/tools/word-count/schemas.ts",
|
|
24
|
+
"content": "import { z } from \"zod\";\n\nconst wordCountInput = z.object({\n text: z.string().describe(\"The text to analyze\"),\n});\n\nconst wordCountResult = z.object({\n characters: z.number(),\n charactersNoSpaces: z.number(),\n sentences: z.number(),\n words: z.number(),\n});\nexport { wordCountInput, wordCountResult };\n",
|
|
25
|
+
"type": "registry:file",
|
|
26
|
+
"target": "~/tools/chatjs/word-count/schemas.ts"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"path": "dist/source/word-count.json",
|
|
30
|
+
"content": "{\n \"envRequirements\": [],\n \"id\": \"word-count\",\n \"kind\": \"tool\",\n \"requiresTools\": [],\n \"tools\": [\n { \"rendererExport\": \"WordCountRenderer\", \"toolExport\": \"wordCount\" }\n ],\n \"contractVersion\": 1\n}\n",
|
|
31
|
+
"type": "registry:file",
|
|
32
|
+
"target": "~/tools/chatjs/word-count/chatjs.json"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"meta": {
|
|
36
|
+
"chatjs": {
|
|
37
|
+
"envRequirements": [],
|
|
38
|
+
"id": "word-count",
|
|
39
|
+
"kind": "tool",
|
|
40
|
+
"requiresTools": [],
|
|
41
|
+
"tools": [
|
|
42
|
+
{
|
|
43
|
+
"rendererExport": "WordCountRenderer",
|
|
44
|
+
"toolExport": "wordCount"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"contractVersion": 1
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"type": "registry:item"
|
|
51
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "yandex-storage",
|
|
4
|
+
"title": "Yandex Object Storage",
|
|
5
|
+
"description": "Yandex Object Storage via the S3-compatible API. Fixed global endpoint, region defaults to ru-central1.",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"files-sdk@2.5.0",
|
|
8
|
+
"@aws-sdk/client-s3@^3.1079.0",
|
|
9
|
+
"@aws-sdk/s3-presigned-post@^3.700.0",
|
|
10
|
+
"@aws-sdk/s3-request-presigner@^3.700.0"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "src/storage/yandex/storage-provider.ts",
|
|
15
|
+
"content": "export { yandex as createStorageAdapter } from \"files-sdk/yandex\";\n",
|
|
16
|
+
"type": "registry:file",
|
|
17
|
+
"target": "~/lib/storage-provider.ts"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"meta": {
|
|
21
|
+
"chatjs": {
|
|
22
|
+
"configKeys": [
|
|
23
|
+
"bucket"
|
|
24
|
+
],
|
|
25
|
+
"contractVersion": 1,
|
|
26
|
+
"envRequirements": [
|
|
27
|
+
{
|
|
28
|
+
"description": "Yandex Object Storage credentials",
|
|
29
|
+
"options": [
|
|
30
|
+
[
|
|
31
|
+
"YANDEX_ACCESS_KEY_ID",
|
|
32
|
+
"YANDEX_SECRET_ACCESS_KEY"
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"id": "yandex",
|
|
38
|
+
"kind": "storage",
|
|
39
|
+
"optionalEnv": []
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"type": "registry:item"
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,48 +1,130 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-js/registry",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "ChatJS tool and gateway registry items",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"ai",
|
|
8
|
+
"chatjs",
|
|
9
|
+
"registry",
|
|
10
|
+
"tools"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/FranciscoMoretti/chat-js/tree/main/packages/registry",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/FranciscoMoretti/chat-js/issues"
|
|
15
|
+
},
|
|
5
16
|
"license": "Apache-2.0",
|
|
6
17
|
"repository": {
|
|
7
18
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "git+https://github.com/FranciscoMoretti/chat-js.git",
|
|
9
20
|
"directory": "packages/registry"
|
|
10
21
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"url": "https://github.com/franciscomoretti/chat-js/issues"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"chatjs",
|
|
17
|
-
"ai",
|
|
18
|
-
"registry",
|
|
19
|
-
"tools"
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/r"
|
|
20
24
|
],
|
|
21
|
-
"private": false,
|
|
22
25
|
"type": "module",
|
|
23
26
|
"exports": {
|
|
24
|
-
"
|
|
25
|
-
"types": "./index.d.ts",
|
|
26
|
-
"default": "./index.js"
|
|
27
|
-
},
|
|
28
|
-
"./index.json": "./index.json",
|
|
29
|
-
"./items/*": "./items/*.json"
|
|
27
|
+
"./r/*": "./dist/r/*.json"
|
|
30
28
|
},
|
|
31
|
-
"types": "./index.d.ts",
|
|
32
|
-
"files": [
|
|
33
|
-
"index.d.ts",
|
|
34
|
-
"index.js",
|
|
35
|
-
"index.json",
|
|
36
|
-
"items"
|
|
37
|
-
],
|
|
38
29
|
"publishConfig": {
|
|
39
|
-
"access": "public"
|
|
30
|
+
"access": "public",
|
|
31
|
+
"tag": "beta"
|
|
40
32
|
},
|
|
41
33
|
"scripts": {
|
|
42
|
-
"build": "bun build.ts",
|
|
43
|
-
"prepublishOnly": "bun run build"
|
|
34
|
+
"build": "bun scripts/generate-composer-icons.ts && bun build.ts",
|
|
35
|
+
"prepublishOnly": "bun run build",
|
|
36
|
+
"test:types": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
|
|
37
|
+
"test:unit": "bun test src",
|
|
38
|
+
"test:installation": "bunx turbo run build --filter=@chat-js/gateways --filter=@chat-js/sandboxes --filter=@chat-js/thread && bun run --cwd ../cli template:sync && bun test --timeout 60000 test/installation-validation.test.ts",
|
|
39
|
+
"profile:validation": "bun scripts/validation-profile.ts",
|
|
40
|
+
"test:visual": "vitest run --config visual/vitest.config.ts",
|
|
41
|
+
"check": "bun run test:types && bun run test:unit && bun run test:visual",
|
|
42
|
+
"lint": "oxlint . && oxfmt --check .",
|
|
43
|
+
"format": "oxfmt --write .",
|
|
44
|
+
"demo:check": "bun test test/demo-check.test.ts",
|
|
45
|
+
"demo:sync": "bun scripts/demo-sync.ts"
|
|
44
46
|
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
|
|
47
|
+
"dependencies": {},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@ai-sdk/anthropic": "4.0.49",
|
|
50
|
+
"@ai-sdk/gateway": "4.0.110",
|
|
51
|
+
"@ai-sdk/google": "4.0.64",
|
|
52
|
+
"@ai-sdk/mcp": "2.0.73",
|
|
53
|
+
"@ai-sdk/openai": "4.0.59",
|
|
54
|
+
"@ai-sdk/openai-compatible": "3.0.44",
|
|
55
|
+
"@ai-sdk/provider": "4.0.26",
|
|
56
|
+
"@chat-js/gateways": "0.2.0",
|
|
57
|
+
"@chat-js/registry-validation": "0.0.0",
|
|
58
|
+
"@chat-js/sandboxes": "0.2.0",
|
|
59
|
+
"@codemirror/lang-javascript": "^6.2.2",
|
|
60
|
+
"@codemirror/lang-python": "^6.1.6",
|
|
61
|
+
"@codemirror/state": "^6.5.0",
|
|
62
|
+
"@codemirror/theme-one-dark": "^6.1.2",
|
|
63
|
+
"@codemirror/view": "^6.35.3",
|
|
64
|
+
"@daytona/sdk": "0.220.0",
|
|
65
|
+
"@hookform/resolvers": "^5.2.1",
|
|
66
|
+
"@lexical/code": "^0.32.1",
|
|
67
|
+
"@lexical/link": "^0.32.1",
|
|
68
|
+
"@lexical/list": "^0.32.1",
|
|
69
|
+
"@lexical/markdown": "^0.32.1",
|
|
70
|
+
"@lexical/react": "^0.32.1",
|
|
71
|
+
"@lexical/rich-text": "^0.32.1",
|
|
72
|
+
"@mendable/firecrawl-js": "1.29.1",
|
|
73
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
74
|
+
"@openrouter/ai-sdk-provider": "3.0.0",
|
|
75
|
+
"@supabase/storage-js": "2.117.2",
|
|
76
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
77
|
+
"@tanstack/react-query": "^5.104.1",
|
|
78
|
+
"@tavily/core": "^0.3.3",
|
|
79
|
+
"@trpc/client": "^11.1.2",
|
|
80
|
+
"@trpc/server": "^11.1.2",
|
|
81
|
+
"@types/bun": "latest",
|
|
82
|
+
"@types/node": "22.13.10",
|
|
83
|
+
"@types/papaparse": "^5.3.15",
|
|
84
|
+
"@types/react": "19.2.7",
|
|
85
|
+
"@types/react-dom": "19.2.3",
|
|
86
|
+
"@vercel/analytics": "^1.5.0",
|
|
87
|
+
"@vercel/blob": "2.4.0",
|
|
88
|
+
"@vercel/oidc": "3.2.0",
|
|
89
|
+
"@vercel/otel": "^2.1.0",
|
|
90
|
+
"@vercel/sandbox": "3.3.0",
|
|
91
|
+
"@vercel/speed-insights": "^1.3.1",
|
|
92
|
+
"ai": "7.0.137",
|
|
93
|
+
"ajv": "8.18.0",
|
|
94
|
+
"basic-ftp": "^5.0.5",
|
|
95
|
+
"browser-image-compression": "^2.0.2",
|
|
96
|
+
"codemirror": "^6.0.1",
|
|
97
|
+
"date-fns": "^4.1.0",
|
|
98
|
+
"diff": "^8.0.2",
|
|
99
|
+
"drizzle-orm": "^0.45.1",
|
|
100
|
+
"echarts": "6.0.0",
|
|
101
|
+
"echarts-for-react": "^3.0.2",
|
|
102
|
+
"eve": "npm:@chat-js/eve@0.80.1-chatjs.4",
|
|
103
|
+
"files-sdk": "2.5.0",
|
|
104
|
+
"geist": "^1.7.2",
|
|
105
|
+
"guarded-fetch": "^0.1.4",
|
|
106
|
+
"langfuse-vercel": "^3.37.0",
|
|
107
|
+
"lexical": "^0.32.1",
|
|
108
|
+
"lucide-react": "0.553.0",
|
|
109
|
+
"motion": "^12.23.24",
|
|
110
|
+
"next": "16.3.0",
|
|
111
|
+
"next-themes": "^0.4.6",
|
|
112
|
+
"nuqs": "^2.8.5",
|
|
113
|
+
"oxfmt": "0.71.0",
|
|
114
|
+
"papaparse": "^5.5.2",
|
|
115
|
+
"postgres": "^3.4.4",
|
|
116
|
+
"react": "19.2.3",
|
|
117
|
+
"react-data-grid": "7.0.0-beta.47",
|
|
118
|
+
"react-dom": "19.2.3",
|
|
119
|
+
"react-dropzone": "^14.3.8",
|
|
120
|
+
"react-hook-form": "^7.62.0",
|
|
121
|
+
"react-markdown": "^10.1.0",
|
|
122
|
+
"shadcn": "4.21.0",
|
|
123
|
+
"sonner": "^2.0.7",
|
|
124
|
+
"superjson": "^2.2.2",
|
|
125
|
+
"typescript": "6.0.2",
|
|
126
|
+
"ultracite": "8.0.0",
|
|
127
|
+
"vite": "8.1.4",
|
|
128
|
+
"zod": "4.5.4"
|
|
47
129
|
}
|
|
48
130
|
}
|
package/index.d.ts
DELETED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/index.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"name": "word-count",
|
|
4
|
-
"description": "Count words, characters, and sentences in text"
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"name": "retrieve-url",
|
|
8
|
-
"description": "Fetch structured information from a single URL"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "get-weather",
|
|
12
|
-
"description": "Get the current weather at a location"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"name": "toolkit-renderer",
|
|
16
|
-
"description": "Shared renderer helpers for installable ChatJS tools",
|
|
17
|
-
"hidden": true
|
|
18
|
-
}
|
|
19
|
-
]
|
package/items/get-weather.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "get-weather",
|
|
3
|
-
"description": "Get the current weather at a location",
|
|
4
|
-
"dependencies": [
|
|
5
|
-
"ai",
|
|
6
|
-
"date-fns",
|
|
7
|
-
"zod"
|
|
8
|
-
],
|
|
9
|
-
"registryDependencies": [
|
|
10
|
-
"toolkit-renderer"
|
|
11
|
-
],
|
|
12
|
-
"files": [
|
|
13
|
-
{
|
|
14
|
-
"path": "tool.ts",
|
|
15
|
-
"type": "tool",
|
|
16
|
-
"target": "get-weather/tool.ts",
|
|
17
|
-
"content": "import { tool } from \"ai\";\nimport { z } from \"zod\";\n\nexport const getWeather = tool({\n description: \"Get the current weather at a location\",\n inputSchema: z.object({\n latitude: z.number(),\n longitude: z.number(),\n }),\n execute: async ({\n latitude,\n longitude,\n }: {\n latitude: number;\n longitude: number;\n }) => {\n const response = await fetch(\n `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m&hourly=temperature_2m&daily=sunrise,sunset&timezone=auto`\n );\n\n const weatherData = await response.json();\n return weatherData as WeatherAtLocation;\n },\n});\n\nexport interface WeatherAtLocation {\n current: {\n time: string;\n interval: number;\n temperature_2m: number;\n };\n current_units: {\n time: string;\n interval: string;\n temperature_2m: string;\n };\n daily: {\n time: string[];\n sunrise: string[];\n sunset: string[];\n };\n daily_units: {\n time: string;\n sunrise: string;\n sunset: string;\n };\n elevation: number;\n generationtime_ms: number;\n hourly: {\n time: string[];\n temperature_2m: number[];\n };\n hourly_units: {\n time: string;\n temperature_2m: string;\n };\n latitude: number;\n longitude: number;\n timezone: string;\n timezone_abbreviation: string;\n utc_offset_seconds: number;\n}\n"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "renderer.tsx",
|
|
21
|
-
"type": "renderer",
|
|
22
|
-
"target": "get-weather/renderer.tsx",
|
|
23
|
-
"content": "\"use client\";\n\nimport { format, isWithinInterval } from \"date-fns\";\nimport { cx } from \"@toolkit/lib/cx\";\nimport type { TypelessToolPartFromTool } from \"@toolkit/lib/tool-part\";\nimport { useToolIsCompact } from \"@toolkit/hooks/use-tool-is-compact\";\nimport { getWeather, type WeatherAtLocation } from \"./tool\";\n\ntype GetWeatherRendererTool = TypelessToolPartFromTool<\n typeof getWeather\n>;\n\nconst SAMPLE = {\n latitude: 37.763_283,\n longitude: -122.412_86,\n generationtime_ms: 0.027_894_973_754_882_812,\n utc_offset_seconds: 0,\n timezone: \"GMT\",\n timezone_abbreviation: \"GMT\",\n elevation: 18,\n current_units: { time: \"iso8601\", interval: \"seconds\", temperature_2m: \"°C\" },\n current: { time: \"2024-10-07T19:30\", interval: 900, temperature_2m: 29.3 },\n hourly_units: { time: \"iso8601\", temperature_2m: \"°C\" },\n hourly: {\n time: [\n \"2024-10-07T19:00\",\n \"2024-10-07T20:00\",\n \"2024-10-07T21:00\",\n \"2024-10-07T22:00\",\n \"2024-10-07T23:00\",\n \"2024-10-08T00:00\",\n \"2024-10-08T01:00\",\n ],\n temperature_2m: [\n 33.9, 32.1, 28.9, 26.9, 25.2, 23, 21.1,\n ],\n },\n daily_units: {\n time: \"iso8601\",\n sunrise: \"iso8601\",\n sunset: \"iso8601\",\n },\n daily: {\n time: [\"2024-10-07\"],\n sunrise: [\"2024-10-07T07:15\"],\n sunset: [\"2024-10-07T19:00\"],\n },\n};\n\nfunction n(num: number): number {\n return Math.ceil(num);\n}\n\nfunction WeatherCard({\n weatherAtLocation,\n}: {\n weatherAtLocation: WeatherAtLocation;\n}) {\n const currentHigh = Math.max(\n ...weatherAtLocation.hourly.temperature_2m.slice(0, 24)\n );\n const currentLow = Math.min(\n ...weatherAtLocation.hourly.temperature_2m.slice(0, 24)\n );\n\n const isDay = isWithinInterval(new Date(weatherAtLocation.current.time), {\n start: new Date(weatherAtLocation.daily.sunrise[0]),\n end: new Date(weatherAtLocation.daily.sunset[0]),\n });\n\n const isCompact = useToolIsCompact();\n const hoursToShow = isCompact ? 5 : 6;\n const currentTimeIndex = weatherAtLocation.hourly.time.findIndex(\n (time) => new Date(time) >= new Date(weatherAtLocation.current.time)\n );\n const startIndex =\n currentTimeIndex >= 0\n ? currentTimeIndex\n : Math.max(0, weatherAtLocation.hourly.time.length - hoursToShow);\n const displayTimes = weatherAtLocation.hourly.time.slice(\n startIndex,\n startIndex + hoursToShow\n );\n const displayTemperatures = weatherAtLocation.hourly.temperature_2m.slice(\n startIndex,\n startIndex + hoursToShow\n );\n\n return (\n <div\n className={cx(\n \"skeleton-bg flex max-w-[500px] flex-col gap-4 rounded-2xl p-4\",\n isDay && \"bg-blue-400\",\n !isDay && \"bg-indigo-900\"\n )}\n >\n <div className=\"flex flex-row items-center justify-between\">\n <div className=\"flex flex-row items-center gap-2\">\n <div\n className={cx(\n \"skeleton-div size-10 rounded-full\",\n isDay && \"bg-yellow-300\",\n !isDay && \"bg-indigo-100\"\n )}\n />\n <div className=\"font-medium text-4xl text-blue-50\">\n {n(weatherAtLocation.current.temperature_2m)}\n {weatherAtLocation.current_units.temperature_2m}\n </div>\n </div>\n\n <div className=\"text-blue-50\">{`H:${n(currentHigh)}° L:${n(currentLow)}°`}</div>\n </div>\n\n <div className=\"flex flex-row justify-between\">\n {displayTimes.map((time, index) => (\n <div className=\"flex flex-col items-center gap-1\" key={time}>\n <div className=\"text-blue-100 text-xs\">\n {format(new Date(time), \"ha\")}\n </div>\n <div\n className={cx(\n \"skeleton-div size-6 rounded-full\",\n isDay && \"bg-yellow-300\",\n !isDay && \"bg-indigo-200\"\n )}\n />\n <div className=\"text-blue-50 text-sm\">\n {n(displayTemperatures[index])}\n {weatherAtLocation.hourly_units.temperature_2m}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nexport function GetWeatherRenderer({\n tool,\n}: {\n tool: GetWeatherRendererTool;\n messageId: string;\n isReadonly: boolean;\n}) {\n if (tool.state !== \"output-available\") {\n return (\n <div className=\"skeleton\" key={tool.toolCallId}>\n <WeatherCard weatherAtLocation={SAMPLE} />\n </div>\n );\n }\n\n if (!tool.output) {\n return <WeatherCard weatherAtLocation={SAMPLE} />;\n }\n\n return <WeatherCard weatherAtLocation={tool.output} />;\n}\n"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
package/items/retrieve-url.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "retrieve-url",
|
|
3
|
-
"description": "Fetch structured information from a single URL",
|
|
4
|
-
"dependencies": [
|
|
5
|
-
"@mendable/firecrawl-js",
|
|
6
|
-
"ai",
|
|
7
|
-
"lucide-react",
|
|
8
|
-
"react-markdown",
|
|
9
|
-
"zod"
|
|
10
|
-
],
|
|
11
|
-
"envRequirements": [
|
|
12
|
-
{
|
|
13
|
-
"description": "FIRECRAWL_API_KEY",
|
|
14
|
-
"options": [
|
|
15
|
-
[
|
|
16
|
-
"FIRECRAWL_API_KEY"
|
|
17
|
-
]
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"files": [
|
|
22
|
-
{
|
|
23
|
-
"path": "tool.ts",
|
|
24
|
-
"type": "tool",
|
|
25
|
-
"target": "retrieve-url/tool.ts",
|
|
26
|
-
"content": "import FirecrawlApp from \"@mendable/firecrawl-js\";\nimport { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { env } from \"@/lib/env\";\nimport { createModuleLogger } from \"@/lib/logger\";\n\ntype ToolEnvVars = {\n description?: string;\n options: string[][];\n}[];\n\nexport const toolEnvVars: ToolEnvVars = [\n {\n description: \"FIRECRAWL_API_KEY\",\n options: [[\"FIRECRAWL_API_KEY\"]],\n },\n];\n\nconst log = createModuleLogger(\"tools/retrieve-url\");\n\nconst app = env.FIRECRAWL_API_KEY\n ? new FirecrawlApp({ apiKey: env.FIRECRAWL_API_KEY })\n : null;\n\nfunction parseUrl(url: string): URL | null {\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction redactUrl(url: URL): string {\n return `${url.origin}${url.pathname}`;\n}\n\nexport const retrieveUrl = tool({\n description: `Fetch structured information from a single URL via Firecrawl.\n\nUse for:\n- Extract content from a specific URL supplied by the user\n\nAvoid:\n- General-purpose web searches`,\n inputSchema: z.object({\n url: z.string().describe(\"The URL to retrieve the information from.\"),\n }),\n execute: async ({ url }: { url: string }) => {\n try {\n if (!app) {\n return {\n error:\n \"Firecrawl is not configured. Set FIRECRAWL_API_KEY to enable retrieval.\",\n };\n }\n const parsedUrl = parseUrl(url);\n if (!parsedUrl) {\n return {\n error: \"Please provide a valid http:// or https:// URL.\",\n };\n }\n\n const redactedUrl = redactUrl(parsedUrl);\n const normalizedUrl = parsedUrl.toString();\n const content = await app.scrapeUrl(normalizedUrl);\n if (!(content.success && content.metadata)) {\n return {\n results: [\n {\n error: content.error,\n },\n ],\n };\n }\n\n const schema = z.object({\n title: z.string(),\n content: z.string(),\n description: z.string(),\n });\n\n let title = content.metadata.title;\n let description = content.metadata.description;\n let extractedContent = content.markdown;\n\n if (!(title && description && extractedContent)) {\n const extractResult = await app.extract([normalizedUrl], {\n prompt:\n \"Extract the page title, main content, and a brief description.\",\n schema,\n });\n\n if (extractResult.success && extractResult.data) {\n title = title || extractResult.data.title;\n description = description || extractResult.data.description;\n extractedContent = extractedContent || extractResult.data.content;\n }\n }\n\n return {\n results: [\n {\n title: title || \"Untitled\",\n content: extractedContent || \"\",\n url: redactedUrl,\n description: description || \"\",\n language: content.metadata.language,\n },\n ],\n };\n } catch (error) {\n const parsedUrl = parseUrl(url);\n log.error(\n { err: error, url: parsedUrl ? redactUrl(parsedUrl) : \"<invalid-url>\" },\n \"Firecrawl API error in retrieveUrl tool\"\n );\n return { error: \"Failed to retrieve content\" };\n }\n },\n});\n"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "renderer.tsx",
|
|
30
|
-
"type": "renderer",
|
|
31
|
-
"target": "retrieve-url/renderer.tsx",
|
|
32
|
-
"content": "\"use client\";\n\nimport { ChevronDown, ExternalLink, Globe, TextIcon } from \"lucide-react\";\nimport ReactMarkdown from \"react-markdown\";\nimport type { TypelessToolPartFromTool } from \"@/tools/chatjs/_shared/lib/tool-part\";\nimport type { retrieveUrl } from \"./tool\";\n\ntype RetrieveUrlRendererTool = TypelessToolPartFromTool<typeof retrieveUrl>;\n\nfunction LoadingState() {\n return (\n <div className=\"my-4 rounded-xl border border-border bg-card p-4\">\n <div className=\"flex items-center gap-4\">\n <div className=\"relative h-10 w-10\">\n <div className=\"absolute inset-0 animate-pulse rounded-full bg-primary/10\" />\n <Globe className=\"absolute inset-0 m-auto h-5 w-5 text-primary/70\" />\n </div>\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 w-36 animate-pulse rounded-md bg-muted-foreground/20\" />\n <div className=\"space-y-1.5\">\n <div className=\"h-3 w-full animate-pulse rounded-md bg-muted-foreground/15\" />\n <div className=\"h-3 w-2/3 animate-pulse rounded-md bg-muted-foreground/15\" />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nfunction ErrorState({ errorMessage }: { errorMessage: string | undefined }) {\n return (\n <div className=\"my-4 rounded-xl border border-red-200 bg-red-50 p-4 dark:border-red-500 dark:bg-red-950/50\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/50\">\n <Globe className=\"h-4 w-4 text-red-600 dark:text-red-300\" />\n </div>\n <div>\n <div className=\"font-medium text-red-700 text-sm dark:text-red-300\">\n Error retrieving content\n </div>\n <div className=\"mt-1 text-red-600/80 text-xs dark:text-red-400/80\">\n {errorMessage}\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nfunction getItemProperty<T>(\n item: unknown,\n property: string,\n defaultValue: T\n): T {\n if (item && typeof item === \"object\" && property in item) {\n const value = (item as Record<string, unknown>)[property];\n return (value as T) ?? defaultValue;\n }\n return defaultValue;\n}\n\nfunction RetrievedContentHeader({ firstItem }: { firstItem: unknown }) {\n const url = getItemProperty(firstItem, \"url\", \"\");\n const title = getItemProperty(firstItem, \"title\", \"Retrieved Content\");\n const description = getItemProperty(\n firstItem,\n \"description\",\n \"No description available\"\n );\n const language = getItemProperty(firstItem, \"language\", \"Unknown\");\n\n return (\n <div className=\"p-4\">\n <div className=\"flex items-start gap-4\">\n <div className=\"relative h-10 w-10 shrink-0\">\n <div className=\"absolute inset-0 rounded-lg bg-linear-to-br from-primary/10 to-transparent\" />\n <Globe className=\"absolute inset-0 m-auto h-5 w-5 text-primary/70\" />\n </div>\n <div className=\"min-w-0 flex-1 space-y-2\">\n <h2 className=\"truncate font-semibold text-foreground text-lg tracking-tight\">\n {title}\n </h2>\n <p className=\"line-clamp-2 text-muted-foreground text-sm\">\n {description}\n </p>\n <div className=\"flex items-center gap-3\">\n <span className=\"rounded-full bg-primary/10 px-2.5 py-0.5 font-medium text-primary text-xs\">\n {language}\n </span>\n <a\n className=\"inline-flex items-center gap-1.5 text-muted-foreground text-xs transition-colors hover:text-primary\"\n href={url || \"#\"}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n <ExternalLink className=\"h-3 w-3\" />\n View source\n </a>\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nfunction RetrievedContentDetails({ firstItem }: { firstItem: unknown }) {\n const content = getItemProperty(firstItem, \"content\", \"No content available\");\n\n return (\n <div className=\"border-border border-t\">\n <details className=\"group\">\n <summary className=\"flex w-full cursor-pointer items-center justify-between px-4 py-2 text-muted-foreground text-sm transition-colors hover:bg-muted\">\n <div className=\"flex items-center gap-2\">\n <TextIcon className=\"h-4 w-4 text-muted-foreground\" />\n <span>View content</span>\n </div>\n <ChevronDown className=\"h-4 w-4 transition-transform duration-200 group-open:rotate-180\" />\n </summary>\n <div className=\"max-h-[50vh] overflow-y-auto bg-muted/50 p-4\">\n <div className=\"prose prose-neutral dark:prose-invert prose-sm max-w-none\">\n <ReactMarkdown>{content}</ReactMarkdown>\n </div>\n </div>\n </details>\n </div>\n );\n}\n\nfunction getFirstItem(result: unknown): unknown {\n if (\n result &&\n typeof result === \"object\" &&\n \"results\" in result &&\n Array.isArray(result.results)\n ) {\n return result.results[0];\n }\n}\n\nfunction getErrorMessage(result: unknown, firstItem: unknown): string | null {\n const topLevelError =\n result && typeof result === \"object\" && \"error\" in result\n ? (result.error as string)\n : undefined;\n const firstItemError =\n firstItem && typeof firstItem === \"object\" && \"error\" in firstItem\n ? (firstItem.error as string)\n : undefined;\n\n return topLevelError ?? firstItemError ?? null;\n}\n\nexport function RetrieveUrlRenderer({\n tool,\n}: {\n tool: RetrieveUrlRendererTool;\n messageId: string;\n isReadonly: boolean;\n}) {\n if (tool.state === \"input-available\" || tool.state === \"input-streaming\") {\n return <LoadingState />;\n }\n\n if (tool.state !== \"output-available\") {\n return null;\n }\n\n if (!tool.output) {\n return null;\n }\n\n const { output: result } = tool;\n const firstItem = getFirstItem(result);\n const errorMessage = getErrorMessage(result, firstItem);\n\n if (errorMessage) {\n return <ErrorState errorMessage={errorMessage} />;\n }\n\n return (\n <div className=\"my-4 overflow-hidden rounded-xl border border-border bg-card\">\n <RetrievedContentHeader firstItem={firstItem} />\n <RetrievedContentDetails firstItem={firstItem} />\n </div>\n );\n}\n"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "toolkit-renderer",
|
|
3
|
-
"description": "Shared renderer helpers for installable ChatJS tools",
|
|
4
|
-
"hidden": true,
|
|
5
|
-
"dependencies": [
|
|
6
|
-
"ai",
|
|
7
|
-
"react"
|
|
8
|
-
],
|
|
9
|
-
"files": [
|
|
10
|
-
{
|
|
11
|
-
"path": "cx.ts",
|
|
12
|
-
"type": "lib",
|
|
13
|
-
"target": "_shared/lib/cx.ts",
|
|
14
|
-
"content": "export function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(\" \");\n}\n"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "tool-part.ts",
|
|
18
|
-
"type": "lib",
|
|
19
|
-
"target": "_shared/lib/tool-part.ts",
|
|
20
|
-
"content": "import type { Tool, UIToolInvocation } from \"ai\";\n\nexport type ToolPartFromTool<T extends Tool> = UIToolInvocation<T>;\n\nexport type TypelessToolPartFromTool<T extends Tool> = ToolPartFromTool<T>;\n"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"path": "use-tool-is-compact.ts",
|
|
24
|
-
"type": "hook",
|
|
25
|
-
"target": "_shared/hooks/use-tool-is-compact.ts",
|
|
26
|
-
"content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nconst COMPACT_BREAKPOINT = 640;\n\nexport function useToolIsCompact(): boolean {\n const [isCompact, setIsCompact] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(\n `(max-width: ${COMPACT_BREAKPOINT - 1}px)`\n );\n\n const update = () => setIsCompact(mediaQuery.matches);\n update();\n mediaQuery.addEventListener(\"change\", update);\n\n return () => mediaQuery.removeEventListener(\"change\", update);\n }, []);\n\n return isCompact;\n}\n"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
package/items/word-count.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "word-count",
|
|
3
|
-
"description": "Count words, characters, and sentences in text",
|
|
4
|
-
"dependencies": [
|
|
5
|
-
"ai",
|
|
6
|
-
"zod"
|
|
7
|
-
],
|
|
8
|
-
"files": [
|
|
9
|
-
{
|
|
10
|
-
"path": "tool.ts",
|
|
11
|
-
"type": "tool",
|
|
12
|
-
"target": "word-count/tool.ts",
|
|
13
|
-
"content": "import { tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst WORD_SPLIT_REGEX = /\\s+/;\nconst SENTENCE_SPLIT_REGEX = /[.!?]+/;\n\nexport const wordCount = tool({\n description: \"Count the words, characters, and sentences in a given text\",\n inputSchema: z.object({\n text: z.string().describe(\"The text to analyze\"),\n }),\n execute: ({ text }: { text: string }) => {\n const words =\n text.trim() === \"\" ? 0 : text.trim().split(WORD_SPLIT_REGEX).length;\n const characters = text.length;\n const charactersNoSpaces = text.replace(/\\s/g, \"\").length;\n const sentences = text\n .split(SENTENCE_SPLIT_REGEX)\n .filter((s) => s.trim().length > 0).length;\n\n return { words, characters, charactersNoSpaces, sentences };\n },\n});\n\nexport type WordCountOutput = {\n words: number;\n characters: number;\n charactersNoSpaces: number;\n sentences: number;\n};\n"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"path": "renderer.tsx",
|
|
17
|
-
"type": "renderer",
|
|
18
|
-
"target": "word-count/renderer.tsx",
|
|
19
|
-
"content": "\"use client\";\n\nimport type { TypelessToolPartFromTool } from \"@/tools/chatjs/_shared/lib/tool-part\";\nimport type { wordCount } from \"./tool\";\n\ntype WordCountRendererTool = TypelessToolPartFromTool<typeof wordCount>;\n\nexport function WordCountRenderer({\n tool,\n}: {\n tool: WordCountRendererTool;\n messageId: string;\n isReadonly: boolean;\n}) {\n if (tool.state === \"input-available\") {\n return (\n <div className=\"rounded-lg border p-3 text-muted-foreground text-sm\">\n Counting words...\n </div>\n );\n }\n\n if (tool.state !== \"output-available\") {\n return null;\n }\n\n if (!tool.output) {\n return null;\n }\n\n const { words, characters, charactersNoSpaces, sentences } = tool.output;\n\n return (\n <div className=\"grid grid-cols-2 gap-2 rounded-lg border p-3 text-sm sm:grid-cols-4\">\n <Stat label=\"Words\" value={words} />\n <Stat label=\"Characters\" value={characters} />\n <Stat label=\"No spaces\" value={charactersNoSpaces} />\n <Stat label=\"Sentences\" value={sentences} />\n </div>\n );\n}\n\nfunction Stat({ label, value }: { label: string; value: number }) {\n return (\n <div className=\"flex flex-col items-center gap-1\">\n <span className=\"font-semibold text-lg\">{value}</span>\n <span className=\"text-muted-foreground text-xs\">{label}</span>\n </div>\n );\n}\n"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|