@chat-js/registry 0.1.2 → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +60 -8
  2. package/dist/r/ai-titles.json +47 -0
  3. package/dist/r/akamai-storage.json +44 -0
  4. package/dist/r/alibaba-storage.json +44 -0
  5. package/dist/r/appwrite-storage.json +50 -0
  6. package/dist/r/archil-storage.json +52 -0
  7. package/dist/r/attachment-uploads.json +87 -0
  8. package/dist/r/azure-storage.json +51 -0
  9. package/dist/r/backblaze-b2-storage.json +44 -0
  10. package/dist/r/bunny-storage-storage.json +48 -0
  11. package/dist/r/cloudinary-storage.json +43 -0
  12. package/dist/r/code-documents.json +96 -0
  13. package/dist/r/code-execution-runtime.json +25 -0
  14. package/dist/r/code-execution-ui.json +31 -0
  15. package/dist/r/code-execution.json +69 -0
  16. package/dist/r/credits.json +98 -0
  17. package/dist/r/daytona-sandbox.json +55 -0
  18. package/dist/r/deep-research.json +220 -0
  19. package/dist/r/delete-document.json +58 -0
  20. package/dist/r/digitalocean-spaces-storage.json +44 -0
  21. package/dist/r/dropbox-storage.json +43 -0
  22. package/dist/r/exoscale-storage.json +44 -0
  23. package/dist/r/feedback.json +105 -0
  24. package/dist/r/filebase-storage.json +43 -0
  25. package/dist/r/firebase-storage-storage.json +52 -0
  26. package/dist/r/firecrawl-search.json +72 -0
  27. package/dist/r/followup-suggestions.json +147 -0
  28. package/dist/r/ftp-storage.json +54 -0
  29. package/dist/r/gcs-storage.json +33 -0
  30. package/dist/r/generate-image.json +101 -0
  31. package/dist/r/generate-video.json +70 -0
  32. package/dist/r/get-weather.json +52 -0
  33. package/dist/r/google-drive-storage.json +47 -0
  34. package/dist/r/hetzner-storage.json +44 -0
  35. package/dist/r/ibm-cos-storage.json +44 -0
  36. package/dist/r/idrive-e2-storage.json +44 -0
  37. package/dist/r/langfuse.json +63 -0
  38. package/dist/r/litellm-gateway.json +67 -0
  39. package/dist/r/mcp.json +304 -0
  40. package/dist/r/memory-storage.json +28 -0
  41. package/dist/r/minio-storage.json +44 -0
  42. package/dist/r/model-preferences.json +125 -0
  43. package/dist/r/neon-storage.json +44 -0
  44. package/dist/r/netlify-blobs-storage.json +31 -0
  45. package/dist/r/onedrive-storage.json +48 -0
  46. package/dist/r/openai-compatible-gateway.json +69 -0
  47. package/dist/r/openai-gateway.json +67 -0
  48. package/dist/r/openrouter-gateway.json +75 -0
  49. package/dist/r/oracle-cloud-storage.json +45 -0
  50. package/dist/r/ovhcloud-storage.json +44 -0
  51. package/dist/r/pocketbase-storage.json +50 -0
  52. package/dist/r/projects.json +266 -0
  53. package/dist/r/r2-storage.json +44 -0
  54. package/dist/r/read-document.json +34 -0
  55. package/dist/r/registry.json +4870 -0
  56. package/dist/r/retrieve-url.json +67 -0
  57. package/dist/r/s3-storage.json +44 -0
  58. package/dist/r/saved-code-execution.json +81 -0
  59. package/dist/r/scaleway-storage.json +44 -0
  60. package/dist/r/search.json +140 -0
  61. package/dist/r/sftp-storage.json +58 -0
  62. package/dist/r/sharepoint-storage.json +50 -0
  63. package/dist/r/sharing.json +137 -0
  64. package/dist/r/sheet-documents.json +93 -0
  65. package/dist/r/storj-storage.json +43 -0
  66. package/dist/r/supabase-storage.json +48 -0
  67. package/dist/r/tavily-search.json +72 -0
  68. package/dist/r/tencent-storage.json +44 -0
  69. package/dist/r/text-documents.json +116 -0
  70. package/dist/r/tigris-storage.json +43 -0
  71. package/dist/r/uploadthing-storage.json +38 -0
  72. package/dist/r/vercel-analytics.json +46 -0
  73. package/dist/r/vercel-blob-storage.json +42 -0
  74. package/dist/r/vercel-gateway.json +77 -0
  75. package/dist/r/vercel-sandbox.json +67 -0
  76. package/dist/r/vercel-speed-insights.json +46 -0
  77. package/dist/r/vultr-storage.json +44 -0
  78. package/dist/r/wasabi-storage.json +44 -0
  79. package/dist/r/webdav-storage.json +52 -0
  80. package/dist/r/word-count.json +51 -0
  81. package/dist/r/yandex-storage.json +43 -0
  82. package/package.json +110 -31
  83. package/index.d.ts +0 -4
  84. package/index.js +0 -1
  85. package/index.json +0 -19
  86. package/items/get-weather.json +0 -26
  87. package/items/retrieve-url.json +0 -35
  88. package/items/toolkit-renderer.json +0 -29
  89. package/items/word-count.json +0 -22
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "generate-image",
4
+ "description": "Generate and edit images using the selected gateway and storage",
5
+ "dependencies": [
6
+ "ai",
7
+ "zod",
8
+ "lucide-react"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/tools/generate-image/configuration-schema.ts",
13
+ "content": "import { z } from \"zod\";\nimport { imageModelSchema, modelRoles } from \"@/lib/config-models\";\n\nconst configSchema = z\n .strictObject({\n default: imageModelSchema.optional().prefault(modelRoles.image),\n })\n .prefault({});\nexport { configSchema };\n",
14
+ "type": "registry:file",
15
+ "target": "~/tools/chatjs/generate-image/configuration-schema.ts"
16
+ },
17
+ {
18
+ "path": "src/tools/generate-image/tool.ts",
19
+ "content": "import type { ImageRequestContext } from \"./image-request\";\nimport { defineTool } from \"eve/tools\";\nimport { generateImageInput } from \"./schemas\";\nimport { runImageRequest } from \"./image-request\";\nimport { toolResultToModelOutput } from \"@/lib/eve/tool-model-output\";\nimport type { z } from \"zod\";\n\nexport const generateImageTool = defineTool({\n description: `Generate an image from a user-provided prompt.\n\nThe assistant may make small, neutral adjustments to improve clarity, composition, or technical quality, while strictly preserving the user’s original intent, meaning, and message.\n\nThe assistant must not add new subjects, claims, branding, or alter the tone or intent of the prompt.\n`,\n execute: async (\n { prompt }: Readonly<z.infer<typeof generateImageInput>>,\n context: Readonly<ImageRequestContext>\n ) => await runImageRequest(prompt, context),\n inputSchema: generateImageInput,\n toModelOutput: toolResultToModelOutput,\n});\n",
20
+ "type": "registry:file",
21
+ "target": "~/tools/chatjs/generate-image/tool.ts"
22
+ },
23
+ {
24
+ "path": "src/tools/generate-image/renderer.tsx",
25
+ "content": "\"use client\";\nimport { ImageActions, ImageModal } from \"@/components/image-modal\";\nimport React, { useState } from \"react\";\nimport { generateImageInput, generateImageResult } from \"./schemas\";\nimport Image from \"next/image\";\nimport { ImageOffIcon } from \"lucide-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\";\nimport { useImageLoadError } from \"@/hooks/use-image-load-error\";\n\ntype GenerateImageTool = ToolRendererProps<\n typeof generateImageInput,\n typeof generateImageResult\n>[\"tool\"];\n\nconst GenerateImageView = ({\n tool,\n}: ReadonlyNativeSurface<{\n tool: GenerateImageTool;\n}>): React.JSX.Element | null => {\n const [dialogOpen, setDialogOpen] = useState(false);\n const imageUrl = tool.output?.imageUrl;\n const { handleImageError, imageUnavailable } = useImageLoadError(imageUrl);\n\n if (tool.state === \"input-streaming\" || tool.state === \"input-available\") {\n return (\n <div className=\"flex w-full flex-col items-center justify-center gap-4 rounded-lg border p-8\">\n <div className=\"bg-muted-foreground/20 h-64 w-full animate-pulse rounded-lg\" />\n <div className=\"text-muted-foreground\">\n Generating image: &quot;\n {tool.input?.prompt ?? \"Preparing prompt…\"}\n &quot;\n </div>\n </div>\n );\n }\n const { output } = tool;\n if (output === undefined) {\n return null;\n }\n\n return (\n <>\n <div className=\"flex w-full flex-col gap-4 overflow-hidden rounded-lg border\">\n <div className=\"group relative\">\n {imageUnavailable ? (\n <output className=\"bg-muted/30 text-muted-foreground flex min-h-64 w-full flex-col items-center justify-center gap-2\">\n <ImageOffIcon className=\"size-8\" />\n <span>Generated image unavailable</span>\n </output>\n ) : (\n <>\n <button\n className=\"w-full cursor-pointer text-left\"\n onClick={(): void => {\n setDialogOpen(true);\n }}\n type=\"button\"\n >\n <Image\n alt={output.prompt}\n loading=\"eager\"\n unoptimized\n className=\"h-auto w-full max-w-full\"\n height={512}\n onError={handleImageError}\n src={output.imageUrl}\n width={512}\n />\n </button>\n <ImageActions\n className=\"absolute top-2 right-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100\"\n imageUrl={output.imageUrl}\n />\n </>\n )}\n </div>\n <div className=\"p-4 pt-0\">\n <p className=\"text-muted-foreground text-sm\">\n Generated from: &quot;{output.prompt}&quot;\n </p>\n </div>\n </div>\n\n <ImageModal\n imageName={output.prompt}\n imageUrl={output.imageUrl}\n isOpen={dialogOpen}\n onClose={(): void => {\n setDialogOpen(false);\n }}\n />\n </>\n );\n};\n\nexport const GenerateImageRenderer = defineToolRenderer({\n inputSchema: generateImageInput,\n outputSchema: generateImageResult,\n render: GenerateImageView,\n});\n",
26
+ "type": "registry:file",
27
+ "target": "~/tools/chatjs/generate-image/renderer.tsx"
28
+ },
29
+ {
30
+ "path": "src/tools/generate-image/schemas.ts",
31
+ "content": "import { z } from \"zod\";\n\nconst generateImageInput = z.object({\n prompt: z\n .string()\n .describe(\n \"The user’s image prompt. The original intent, message, and meaning must remain unchanged. No new ideas, claims, or content may be introduced.\"\n ),\n});\n\nconst generateImageResult = z.object({\n fileId: z.string().optional(),\n imageUrl: z.string(),\n prompt: z.string(),\n});\nexport { generateImageInput, generateImageResult };\n",
32
+ "type": "registry:file",
33
+ "target": "~/tools/chatjs/generate-image/schemas.ts"
34
+ },
35
+ {
36
+ "path": "src/tools/generate-image/image-model.ts",
37
+ "content": "import type { ToolModelProvider } from \"@/lib/ai/tool-context\";\nimport { config } from \"@/lib/config\";\n\ntype ImageModelSelection =\n | {\n modelId: string;\n multimodal: true;\n usageModelId: Awaited<\n ReturnType<ToolModelProvider[\"getModelDefinition\"]>\n >[\"id\"];\n }\n | { modelId: string; multimodal: false; usageModelId?: never };\nconst findMultimodalModel = async (\n provider: Readonly<ToolModelProvider>,\n modelId: unknown\n): Promise<\n Extract<ImageModelSelection, { multimodal: true }> | { multimodal: false }\n> => {\n if (typeof modelId !== \"string\" || modelId === \"\") {\n return { multimodal: false };\n }\n try {\n const model = await provider.getModelDefinition(modelId);\n if (model.output.image) {\n return {\n modelId: model.apiModelId,\n multimodal: true,\n usageModelId: model.id,\n };\n }\n } catch {\n /* A model absent from the dynamic registry may be a dedicated image model. */\n }\n return { multimodal: false };\n};\nconst resolveImageModel = async (\n provider: Readonly<ToolModelProvider>,\n selectedModel: unknown\n): Promise<ImageModelSelection> => {\n const selected = await findMultimodalModel(provider, selectedModel);\n if (selected.multimodal) {\n return selected;\n }\n const defaultId = config.ai.tools.image.default;\n if (typeof defaultId !== \"string\") {\n throw new TypeError(\n \"Set ai.tools.image.default to an image model supported by your gateway.\"\n );\n }\n const fallback = await findMultimodalModel(provider, defaultId);\n\n if (fallback.multimodal) {\n return fallback;\n }\n return { modelId: defaultId, multimodal: false };\n};\nexport { resolveImageModel };\nexport type { ImageModelSelection };\n",
38
+ "type": "registry:file",
39
+ "target": "~/tools/chatjs/generate-image/image-model.ts"
40
+ },
41
+ {
42
+ "path": "src/tools/generate-image/image-input.ts",
43
+ "content": "import type { FileUIPart } from \"ai\";\nimport { downloadFile } from \"@/lib/file-storage\";\nimport { getBaseUrl } from \"@/lib/url\";\nimport { keyFromFileUrl } from \"@/lib/file-url\";\n\nconst INLINE_IMAGE =\n /^data:image\\/(?:png|jpeg|webp|gif);base64,(?<base64>[A-Za-z0-9+/=]+)$/u;\n\nconst fetchImageBuffer = async (value: string): Promise<Buffer> => {\n // Inline images do not initiate a network request.\n const { groups } = INLINE_IMAGE.exec(value) ?? {};\n if (groups && typeof groups.base64 === \"string\" && groups.base64 !== \"\") {\n return Buffer.from(groups.base64, \"base64\");\n }\n const url = new URL(value, getBaseUrl());\n const { origin } = new URL(getBaseUrl());\n const key = keyFromFileUrl(value);\n if (\n url.origin !== origin ||\n url.username !== \"\" ||\n url.password !== \"\" ||\n !(typeof key === \"string\" && key !== \"\")\n ) {\n throw new Error(\n \"Image editing only accepts uploaded ChatJS files or inline images.\"\n );\n }\n // Read the configured storage directly. Never follow user-supplied URLs or redirects.\n const file = await downloadFile(key);\n return Buffer.from(await file.arrayBuffer());\n};\nconst collectEditImages = async ({\n imageParts,\n lastGeneratedImage,\n}: Readonly<{\n imageParts: readonly Readonly<Pick<FileUIPart, \"url\">>[];\n lastGeneratedImage: Readonly<{ imageUrl: string }> | null;\n}>): Promise<Buffer[]> =>\n await Promise.all([\n ...(lastGeneratedImage\n ? [fetchImageBuffer(lastGeneratedImage.imageUrl)]\n : []),\n ...imageParts.map(\n async (imagePart) => await fetchImageBuffer(imagePart.url)\n ),\n ]);\nexport { collectEditImages };\n",
44
+ "type": "registry:file",
45
+ "target": "~/tools/chatjs/generate-image/image-input.ts"
46
+ },
47
+ {
48
+ "path": "src/tools/generate-image/image-errors.ts",
49
+ "content": "const ABSENT_DIAGNOSTIC_VALUE = undefined;\n\nconst serializeError = (\n error: unknown\n): { name?: string; message: string; stack?: string; raw?: unknown } => {\n if (error instanceof Error) {\n return { message: error.message, name: error.name, stack: error.stack };\n }\n if (typeof error === \"object\" && error !== null && \"then\" in error) {\n return { message: \"Error was a Promise - check raw\", raw: error };\n }\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n const message = String(error.message);\n const hasName = Boolean(Reflect.get(error, \"name\"));\n const name: unknown = hasName\n ? Reflect.get(error, \"name\")\n : ABSENT_DIAGNOSTIC_VALUE;\n return { message, name: hasName ? String(name) : ABSENT_DIAGNOSTIC_VALUE };\n }\n return { message: String(error), raw: error };\n};\nconst resolveError = async (thrownValue: unknown): Promise<unknown> => {\n if (\n typeof thrownValue === \"object\" &&\n thrownValue !== null &&\n \"then\" in thrownValue\n ) {\n try {\n return await Promise.resolve(thrownValue);\n } catch (resolvedError) {\n return resolvedError;\n }\n }\n return thrownValue;\n};\nconst constructorName = (value: unknown): unknown => {\n if (value === null || value === ABSENT_DIAGNOSTIC_VALUE) {\n return ABSENT_DIAGNOSTIC_VALUE;\n }\n const constructor: unknown = Reflect.get(new Object(value), \"constructor\");\n if (constructor === null || constructor === ABSENT_DIAGNOSTIC_VALUE) {\n return ABSENT_DIAGNOSTIC_VALUE;\n }\n return Reflect.get(new Object(constructor), \"name\");\n};\nconst getErrorDebugInfo = (\n error: unknown\n): { errorConstructor: unknown; errorKeys: string[]; errorType: string } => ({\n errorConstructor: constructorName(error),\n errorKeys:\n typeof error === \"object\" && error !== null ? Object.keys(error) : [],\n errorType: typeof error,\n});\nexport {\n serializeError,\n resolveError,\n getErrorDebugInfo,\n ABSENT_DIAGNOSTIC_VALUE,\n};\n",
50
+ "type": "registry:file",
51
+ "target": "~/tools/chatjs/generate-image/image-errors.ts"
52
+ },
53
+ {
54
+ "path": "src/tools/generate-image/image-generation.ts",
55
+ "content": "import { generateImage, generateText } from \"ai\";\nimport type { FileUIPart } from \"ai\";\nimport type { FileUploader } from \"@/lib/file-storage\";\nimport type { ImageModelSelection } from \"./image-model\";\nimport type { ToolModelProvider } from \"@/lib/ai/tool-context\";\nimport type { createEveToolCost } from \"@/lib/eve/tool-cost\";\nimport { createModuleLogger } from \"@/lib/logger\";\nimport { collectEditImages } from \"./image-input\";\nimport type { generateImageResult } from \"./schemas\";\nimport type { z } from \"zod\";\n\nconst log = createModuleLogger(\"ai.tools.generate-image\");\nconst EMPTY_IMAGE_BYTES = 0;\nconst GENERATED_IMAGE_COUNT = 1;\nconst NO_GENERATED_IMAGES = 0;\ntype ReadonlyNativeSurface<Value> = Value extends\n | string\n | number\n | bigint\n | boolean\n | symbol\n | null\n | undefined\n ? Value\n : Value extends (...parameters: readonly never[]) => unknown\n ? Value\n : Value extends abstract new (...parameters: readonly never[]) => unknown\n ? Value\n : Value extends object\n ? {\n readonly [Property in keyof Value]: ReadonlyNativeSurface<\n Value[Property]\n >;\n }\n : Value;\ntype ImageStoreFile = (\n filename: string,\n body: ReadonlyNativeSurface<Buffer>,\n mediaType?: string\n) => ReturnType<FileUploader>;\ntype ImageMode = \"edit\" | \"generate\";\ninterface ImageGenerationOptions {\n readonly mode: ImageMode;\n readonly prompt: string;\n readonly imageParts: readonly Readonly<Pick<FileUIPart, \"url\">>[];\n readonly lastGeneratedImage: Readonly<{\n imageUrl: string;\n name: string;\n }> | null;\n readonly startMs: number;\n readonly costAccumulator?: Readonly<ReturnType<typeof createEveToolCost>>;\n readonly abortSignal?: Readonly<AbortSignal>;\n readonly storeFile: ImageStoreFile;\n readonly modelProvider: Readonly<ToolModelProvider>;\n}\ntype GeneratedImageResult = Required<z.infer<typeof generateImageResult>>;\nconst traditionalPrompt = async (\n options: Readonly<ImageGenerationOptions>\n): Promise<string | { text: string; images: Buffer[] }> => {\n if (options.mode !== \"edit\") {\n return options.prompt;\n }\n log.debug(\n {\n attachmentCount: options.imageParts.length,\n lastGeneratedCount: options.lastGeneratedImage\n ? GENERATED_IMAGE_COUNT\n : NO_GENERATED_IMAGES,\n note: \"OpenAI edit mode\",\n },\n \"generateImage: preparing edit images\"\n );\n return { images: await collectEditImages(options), text: options.prompt };\n};\nconst storeImage = async (\n options: Readonly<ImageGenerationOptions>,\n image: Readonly<{\n buffer: ReadonlyNativeSurface<Buffer>;\n filename: string;\n mediaType: string;\n }>,\n model: Readonly<{ modelId: string; multimodal: boolean }>\n): Promise<GeneratedImageResult> => {\n const result = await options.storeFile(\n image.filename,\n image.buffer,\n image.mediaType\n );\n log.info(\n {\n imageUrl: result.url,\n mode: options.mode,\n ms: Date.now() - options.startMs,\n uploadedFilename: image.filename,\n ...(model.multimodal ? { modelId: model.modelId } : {}),\n },\n model.multimodal\n ? \"generateImage: multimodal success\"\n : \"generateImage: success\"\n );\n return {\n fileId: result.fileId,\n imageUrl: result.url,\n prompt: options.prompt,\n };\n};\nconst runGenerateImageTraditional = async (\n options: Readonly<ImageGenerationOptions>,\n modelId: string\n): Promise<GeneratedImageResult> => {\n const prompt = await traditionalPrompt(options);\n const res = await generateImage({\n abortSignal: options.abortSignal,\n model: options.modelProvider.createImageModel(modelId),\n prompt,\n providerOptions: { telemetry: { isEnabled: true } },\n });\n const [firstImage] = res.images;\n log.debug(\n {\n base64Length: firstImage?.base64?.length ?? EMPTY_IMAGE_BYTES,\n mode: options.mode,\n },\n \"generateImage: provider response received\"\n );\n const buffer = Buffer.from(firstImage.base64, \"base64\");\n const filename = `generated-image-${Date.now()}.png`;\n // Provider usage remains billable if the subsequent storage upload fails.\n const { costAccumulator } = options;\n if (costAccumulator) {\n costAccumulator.addImageCost(\n modelId,\n res.images.length,\n res.usage ?? {},\n \"generateImage-traditional\"\n );\n }\n return await storeImage(\n options,\n { buffer, filename, mediaType: \"image/png\" },\n { modelId, multimodal: false }\n );\n};\ninterface ImageContent {\n image: Readonly<Buffer>;\n type: \"image\";\n}\ninterface TextContent {\n text: string;\n type: \"text\";\n}\nconst multimodalContent = async (\n options: Readonly<ImageGenerationOptions>\n): Promise<(ImageContent | TextContent)[]> => {\n const buffers =\n options.mode === \"edit\" ? await collectEditImages(options) : [];\n const images = buffers.map(\n (image: ReadonlyNativeSurface<Buffer>): ImageContent => ({\n image,\n type: \"image\",\n })\n );\n return [\n ...images,\n {\n text:\n options.mode === \"edit\"\n ? `Based on the provided image(s), ${options.prompt}`\n : `Generate an image: ${options.prompt}`,\n type: \"text\",\n },\n ];\n};\nconst storeMultimodalImage = async (\n options: Readonly<ImageGenerationOptions>,\n selection: Readonly<Extract<ImageModelSelection, { multimodal: true }>>,\n imageFile: ReadonlyNativeSurface<{\n mediaType: string;\n base64: string;\n uint8Array: Uint8Array;\n }>\n): Promise<GeneratedImageResult> => {\n log.debug(\n {\n hasBase64: Boolean(imageFile.base64),\n mediaType: imageFile.mediaType,\n mode: options.mode,\n },\n \"generateImage: multimodal response received\"\n );\n const buffer = Buffer.from(imageFile.uint8Array);\n const timestamp = Date.now();\n const [, subtype] = imageFile.mediaType.split(\"/\");\n const ext = typeof subtype === \"string\" && subtype !== \"\" ? subtype : \"png\";\n return await storeImage(\n options,\n {\n buffer,\n filename: `generated-image-${timestamp}.${ext}`,\n mediaType: imageFile.mediaType,\n },\n selection\n );\n};\nconst multimodalProviderOptions = (\n modelId: string\n): {\n google?: { responseModalities: string[] };\n openai?: { modalities: string[] };\n} => ({\n ...((modelId.startsWith(\"google/\") || modelId.includes(\"gemini\")) && {\n google: { responseModalities: [\"TEXT\", \"IMAGE\"] },\n }),\n ...(modelId.startsWith(\"openai/\") && {\n openai: { modalities: [\"text\", \"image\"] },\n }),\n});\nconst runGenerateImageMultimodal = async (\n options: Readonly<ImageGenerationOptions>,\n selection: Readonly<Extract<ImageModelSelection, { multimodal: true }>>\n): Promise<GeneratedImageResult> => {\n const userContent = await multimodalContent(options);\n log.debug(\n {\n imageCount: userContent.filter(\n (part: Readonly<{ type: string }>): boolean => part.type === \"image\"\n ).length,\n mode: options.mode,\n modelId: selection.modelId,\n },\n \"generateImage: using multimodal model\"\n );\n const res = await generateText({\n abortSignal: options.abortSignal,\n messages: [{ content: userContent, role: \"user\" }],\n model: options.modelProvider.createLanguageModel(selection.modelId),\n providerOptions: multimodalProviderOptions(selection.modelId),\n });\n const { costAccumulator } = options;\n if (costAccumulator) {\n costAccumulator.addLLMCost(\n selection.usageModelId,\n res.usage,\n \"generateImage-multimodal\"\n );\n }\n const imageFile = (res.files ?? []).find(\n (file: Readonly<{ mediaType: string }>): boolean =>\n file.mediaType.startsWith(\"image/\")\n );\n if (!imageFile) {\n throw new Error(\"No image generated by multimodal model\");\n }\n return await storeMultimodalImage(options, selection, imageFile);\n};\nexport { runGenerateImageTraditional, runGenerateImageMultimodal };\nexport type { ImageGenerationOptions, GeneratedImageResult, ImageStoreFile };\n",
56
+ "type": "registry:file",
57
+ "target": "~/tools/chatjs/generate-image/image-generation.ts"
58
+ },
59
+ {
60
+ "path": "src/tools/generate-image/image-request.ts",
61
+ "content": "import {\n ABSENT_DIAGNOSTIC_VALUE,\n getErrorDebugInfo,\n resolveError,\n serializeError,\n} from \"./image-errors\";\nimport type {\n GeneratedImageResult,\n ImageGenerationOptions,\n ImageStoreFile,\n} from \"./image-generation\";\nimport type { ToolUsage } from \"@/lib/eve/tool-usage\";\nimport { eveGeneratedFileUploader } from \"@/lib/eve/generated-files\";\nimport { createEveToolCost } from \"@/lib/eve/tool-cost\";\nimport { createModuleLogger } from \"@/lib/logger\";\nimport { eveToolImageContext } from \"@/lib/eve/tool-image-context\";\nimport { eveToolModelProvider } from \"@/lib/eve/tool-models\";\nimport {\n runGenerateImageMultimodal,\n runGenerateImageTraditional,\n} from \"./image-generation\";\nimport { executeWithToolUsage } from \"@/lib/eve/tool-usage\";\nimport { resolveImageModel } from \"./image-model\";\n\nconst log = createModuleLogger(\"ai.tools.generate-image\");\nconst NO_IMAGE_ATTACHMENTS = 0;\ninterface ImageRequestContext {\n readonly abortSignal: Readonly<AbortSignal>;\n readonly session: Readonly<{\n id: string;\n auth: Readonly<{\n current: Readonly<{\n attributes: Readonly<Record<string, unknown>>;\n }> | null;\n initiator: Readonly<{ principalId: string }> | null;\n }>;\n }>;\n}\ninterface ImageRequest {\n readonly options: Readonly<ImageGenerationOptions>;\n readonly selectedModel: string | undefined;\n}\nconst createImageRequest = (\n prompt: string,\n context: Readonly<ImageRequestContext>,\n usage: Readonly<ToolUsage>\n): ImageRequest => {\n const costAccumulator = createEveToolCost(usage);\n const uploadFile = eveGeneratedFileUploader(context);\n // A provider generation followed by storage failure is an explicit domain result.\n const storeFile: ImageStoreFile = async (filename, body, mediaType) => {\n try {\n return await uploadFile(filename, body, mediaType);\n } catch {\n return usage.fail();\n }\n };\n const { current } = context.session.auth;\n const selected = current && current.attributes.modelId;\n const selectedModel =\n typeof selected === \"string\" ? selected : ABSENT_DIAGNOSTIC_VALUE;\n const { attachments, lastGeneratedImage } = eveToolImageContext.get();\n const startMs = Date.now();\n const imageParts = attachments.filter(\n (part: Readonly<{ type: string; mediaType?: string }>): boolean =>\n part.type === \"file\" && (part.mediaType ?? \"\").startsWith(\"image/\")\n );\n return {\n options: {\n abortSignal: context.abortSignal,\n costAccumulator,\n imageParts,\n lastGeneratedImage,\n mode:\n imageParts.length > NO_IMAGE_ATTACHMENTS || lastGeneratedImage !== null\n ? \"edit\"\n : \"generate\",\n modelProvider: eveToolModelProvider,\n prompt,\n startMs,\n storeFile,\n },\n selectedModel,\n };\n};\nconst executeImageRequest = async (\n request: Readonly<ImageRequest>\n): Promise<GeneratedImageResult> => {\n const { options, selectedModel } = request;\n log.info(\n {\n attachmentCount: options.imageParts.length,\n hasLastGeneratedImage: options.lastGeneratedImage !== null,\n mode: options.mode,\n promptLength: options.prompt.length,\n selectedModel,\n },\n \"generateImage: start\"\n );\n try {\n const selection = await resolveImageModel(\n options.modelProvider,\n selectedModel\n );\n\n if (selection.multimodal) {\n return await runGenerateImageMultimodal(options, selection);\n }\n return await runGenerateImageTraditional(options, selection.modelId);\n } catch (error) {\n const resolvedError = await resolveError(error);\n log.error(\n {\n error: serializeError(resolvedError),\n mode: options.mode,\n ms: Date.now() - options.startMs,\n selectedModel,\n ...getErrorDebugInfo(resolvedError),\n },\n \"generateImage: failure\"\n );\n throw resolvedError;\n }\n};\nconst runImageRequest = async (\n prompt: string,\n context: Readonly<ImageRequestContext>\n): Promise<\n Awaited<ReturnType<typeof executeWithToolUsage<GeneratedImageResult>>>\n> =>\n await executeWithToolUsage(\n context,\n async (usage: Readonly<ToolUsage>) =>\n await executeImageRequest(createImageRequest(prompt, context, usage))\n );\nexport { runImageRequest };\nexport type { ImageRequestContext };\n",
62
+ "type": "registry:file",
63
+ "target": "~/tools/chatjs/generate-image/image-request.ts"
64
+ },
65
+ {
66
+ "path": "dist/source/generate-image.json",
67
+ "content": "{\n \"config\": { \"key\": \"image\" },\n \"envRequirements\": [],\n \"id\": \"generate-image\",\n \"kind\": \"tool\",\n \"requiresGateway\": [\"image\"],\n \"requiresStorage\": true,\n \"requiresTools\": [],\n \"slot\": \"generateImage\",\n \"tools\": [\n {\n \"composer\": {\n \"icon\": \"Images\",\n \"name\": \"Create an image\",\n \"shortName\": \"Image\"\n },\n \"rendererExport\": \"GenerateImageRenderer\",\n \"toolExport\": \"generateImageTool\"\n }\n ],\n \"contractVersion\": 1\n}\n",
68
+ "type": "registry:file",
69
+ "target": "~/tools/chatjs/generate-image/chatjs.json"
70
+ }
71
+ ],
72
+ "meta": {
73
+ "chatjs": {
74
+ "config": {
75
+ "key": "image"
76
+ },
77
+ "envRequirements": [],
78
+ "id": "generate-image",
79
+ "kind": "tool",
80
+ "requiresGateway": [
81
+ "image"
82
+ ],
83
+ "requiresStorage": true,
84
+ "requiresTools": [],
85
+ "slot": "generateImage",
86
+ "tools": [
87
+ {
88
+ "composer": {
89
+ "icon": "Images",
90
+ "name": "Create an image",
91
+ "shortName": "Image"
92
+ },
93
+ "rendererExport": "GenerateImageRenderer",
94
+ "toolExport": "generateImageTool"
95
+ }
96
+ ],
97
+ "contractVersion": 1
98
+ }
99
+ },
100
+ "type": "registry:item"
101
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "generate-video",
4
+ "description": "Generate videos using the selected gateway and storage",
5
+ "dependencies": [
6
+ "ai",
7
+ "zod"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/tools/generate-video/configuration-schema.ts",
12
+ "content": "import { z } from \"zod\";\nimport { videoModelSchema, modelRoles } from \"@/lib/config-models\";\n\nconst configSchema = z\n .strictObject({\n default: videoModelSchema.optional().prefault(modelRoles.video),\n })\n .prefault({});\nexport { configSchema };\n",
13
+ "type": "registry:file",
14
+ "target": "~/tools/chatjs/generate-video/configuration-schema.ts"
15
+ },
16
+ {
17
+ "path": "src/tools/generate-video/tool.ts",
18
+ "content": "import type { ToolContext } from \"eve/tools\";\nimport { defineTool } from \"eve/tools\";\nimport { experimental_generateVideo as generateVideo } from \"ai\";\n\nimport { config } from \"@/lib/config\";\nimport { eveGeneratedFileUploader } from \"@/lib/eve/generated-files\";\nimport { createEveToolCost } from \"@/lib/eve/tool-cost\";\nimport { createModuleLogger } from \"@/lib/logger\";\nimport { eveToolModelProvider } from \"@/lib/eve/tool-models\";\nimport { executeWithToolUsage } from \"@/lib/eve/tool-usage\";\n\nimport { generateVideoInput } from \"./schemas\";\nimport { toolResultToModelOutput } from \"@/lib/eve/tool-model-output\";\n\n// Fixed estimate — not yet available from provider API\nconst COST_CENTS = 50;\n\nconst log = createModuleLogger(\"ai.tools.generate-video\");\nconst DEFAULT_ASPECT_RATIO = \"16:9\";\nconst DEFAULT_DURATION_SECONDS = 5;\nconst FIRST_SUBTYPE_INDEX = 0;\nconst FIRST_PARAMETER_INDEX = 0;\nconst videoExtensions: ReadonlyMap<string, string> = new Map([\n [\"mp4\", \"mp4\"],\n [\"webm\", \"webm\"],\n [\"mov\", \"mov\"],\n [\"quicktime\", \"mov\"],\n]);\n\nconst resolveVideoExtension = (mediaType?: string): string => {\n if (!(typeof mediaType === \"string\" && mediaType !== \"\")) {\n return \"mp4\";\n }\n\n const [, subtypeWithParams] = mediaType.split(\"/\");\n if (!subtypeWithParams) {\n return \"mp4\";\n }\n\n const subtype = (subtypeWithParams.split(\";\").at(FIRST_SUBTYPE_INDEX) ?? \"\")\n .trim()\n .toLowerCase();\n if (!(typeof subtype === \"string\" && subtype !== \"\")) {\n return \"mp4\";\n }\n\n return videoExtensions.get(subtype) ?? \"mp4\";\n};\n\nconst resolveVideoModel = async (\n modelProvider: Readonly<typeof eveToolModelProvider>,\n selectedModel?: string\n): Promise<string> => {\n if (typeof selectedModel === \"string\" && selectedModel !== \"\") {\n try {\n const model = await modelProvider.getModelDefinition(selectedModel);\n if (model.output.video) {\n return model.apiModelId;\n }\n } catch {\n // Not in app models registry, fall through\n }\n }\n const modelId = config.ai.tools.video.default;\n if (typeof modelId !== \"string\") {\n throw new TypeError(\n \"Set ai.tools.video.default to a video model supported by your gateway.\"\n );\n }\n return modelId;\n};\ntype Context = Readonly<\n Pick<ToolContext, \"session\"> & { abortSignal: Readonly<AbortSignal> }\n>;\ntype Usage = Readonly<\n NonNullable<\n Parameters<typeof createEveToolCost>[typeof FIRST_PARAMETER_INDEX]\n >\n>;\ntype GenerationOptions = Readonly<{\n abortSignal: Readonly<AbortSignal>;\n aspectRatio: \"16:9\" | \"9:16\" | \"1:1\";\n durationSeconds: number;\n prompt: string;\n startMs: number;\n}>;\ntype Input = Readonly<{\n prompt: string;\n aspectRatio?: \"16:9\" | \"9:16\" | \"1:1\";\n durationSeconds?: number;\n}>;\ntype Integration = Readonly<{\n costAccumulator: Readonly<ReturnType<typeof createEveToolCost>>;\n uploadFile: ReturnType<typeof eveGeneratedFileUploader>;\n usage: Usage;\n}>;\ntype PreparedGeneration = Readonly<{\n integration: Integration;\n modelProvider: Readonly<typeof eveToolModelProvider>;\n options: GenerationOptions;\n selectedModel?: string;\n}>;\nconst videoRequest = (\n modelId: string,\n options: GenerationOptions,\n isGoogleModel: boolean\n): Parameters<typeof generateVideo>[typeof FIRST_PARAMETER_INDEX] => ({\n abortSignal: options.abortSignal,\n aspectRatio: options.aspectRatio,\n duration: options.durationSeconds,\n model: eveToolModelProvider.createVideoModel(modelId),\n prompt: options.prompt,\n providerOptions: {\n ...(isGoogleModel && {\n google: { aspectRatio: options.aspectRatio },\n }),\n },\n});\n// A completed generation followed by a storage failure is an explicit domain result.\nconst storeWithDomainFailure = async (\n upload: () => ReturnType<ReturnType<typeof eveGeneratedFileUploader>>,\n usage: Usage\n): ReturnType<ReturnType<typeof eveGeneratedFileUploader>> => {\n try {\n return await upload();\n } catch {\n return usage.fail();\n }\n};\nconst storeGeneratedResult = async (\n upload: () => ReturnType<ReturnType<typeof eveGeneratedFileUploader>>,\n summary: Readonly<{ modelId: string; prompt: string; startMs: number }>,\n usage: Usage\n): Promise<{ fileId: string; prompt: string; videoUrl: string }> => {\n const uploaded = await storeWithDomainFailure(upload, usage);\n log.info(\n {\n modelId: summary.modelId,\n ms: Date.now() - summary.startMs,\n videoUrl: uploaded.url,\n },\n \"generateVideo: success\"\n );\n return {\n fileId: uploaded.fileId,\n prompt: summary.prompt,\n videoUrl: uploaded.url,\n };\n};\nconst generateAndStoreVideo = async (\n modelId: string,\n options: GenerationOptions,\n integration: Integration\n): Promise<{ fileId: string; prompt: string; videoUrl: string }> => {\n const isGoogleModel =\n modelId.startsWith(\"google/\") || modelId.includes(\"gemini\");\n log.debug({ modelId }, \"generateVideo: resolved model\");\n const { video } = await generateVideo(\n videoRequest(modelId, options, isGoogleModel)\n );\n const hasVideo = Boolean(video);\n if (!hasVideo) {\n throw new Error(\"No video generated\");\n }\n // Provider usage is billable even if the subsequent storage upload fails.\n integration.costAccumulator.addAPICost(\"generateVideo\", COST_CENTS);\n const buffer = Buffer.from(video.uint8Array);\n const uploadArguments = [\n `generated-video-${Date.now()}.${resolveVideoExtension(video.mediaType)}`,\n buffer,\n video.mediaType,\n ] as const;\n return await storeGeneratedResult(\n async () => await integration.uploadFile(...uploadArguments),\n { modelId, prompt: options.prompt, startMs: options.startMs },\n integration.usage\n );\n};\nconst prepareGeneration = (\n input: Input,\n context: Context,\n usage: Usage\n): PreparedGeneration => {\n const { abortSignal } = context;\n const costAccumulator = createEveToolCost(usage);\n const modelProvider = eveToolModelProvider;\n const uploadFile = eveGeneratedFileUploader(context);\n const { current } = context.session.auth;\n const selected = current && current.attributes.modelId;\n const selectedModel = typeof selected === \"string\" ? selected : undefined;\n const startMs = Date.now();\n return {\n integration: { costAccumulator, uploadFile, usage },\n modelProvider,\n options: {\n abortSignal,\n aspectRatio: input.aspectRatio ?? DEFAULT_ASPECT_RATIO,\n durationSeconds: input.durationSeconds ?? DEFAULT_DURATION_SECONDS,\n prompt: input.prompt,\n startMs,\n },\n selectedModel,\n };\n};\n\nconst throwVideoFailure = (\n error: unknown,\n startMs: number,\n selectedModel?: string\n): never => {\n const errorMessage = error instanceof Error ? error.message : \"\";\n const isUnsupportedVideoGateway = errorMessage.includes(\n \"does not support video models\"\n );\n\n log.error(\n {\n error:\n error instanceof Error\n ? { message: error.message, name: error.name }\n : error,\n ms: Date.now() - startMs,\n selectedModel,\n },\n \"generateVideo: failure\"\n );\n\n if (isUnsupportedVideoGateway) {\n throw new Error(\n \"Video generation is not available for the active gateway.\",\n { cause: error }\n );\n }\n\n throw error;\n};\n\nexport const generateVideoTool = defineTool({\n description:\n \"Generate a short video clip from a text prompt. Use this when the user asks to create, make, or generate a video.\",\n execute: async (\n { prompt, aspectRatio, durationSeconds }: Input,\n context: Context\n ) =>\n await executeWithToolUsage(context, async (usage: Usage) => {\n const prepared = prepareGeneration(\n { aspectRatio, durationSeconds, prompt },\n context,\n usage\n );\n log.info(\n {\n aspectRatio: prepared.options.aspectRatio,\n durationSeconds: prepared.options.durationSeconds,\n promptLength: prompt.length,\n selectedModel: prepared.selectedModel,\n },\n \"generateVideo: start\"\n );\n try {\n const hasModelProvider = Boolean(prepared.modelProvider);\n if (!hasModelProvider) {\n throw new Error(\"Video generation requires model provider context.\");\n }\n const modelId = await resolveVideoModel(\n prepared.modelProvider,\n prepared.selectedModel\n );\n return await generateAndStoreVideo(\n modelId,\n prepared.options,\n prepared.integration\n );\n } catch (error) {\n return throwVideoFailure(\n error,\n prepared.options.startMs,\n prepared.selectedModel\n );\n }\n }),\n inputSchema: generateVideoInput,\n toModelOutput: toolResultToModelOutput,\n});\n",
19
+ "type": "registry:file",
20
+ "target": "~/tools/chatjs/generate-video/tool.ts"
21
+ },
22
+ {
23
+ "path": "src/tools/generate-video/renderer.tsx",
24
+ "content": "\"use client\";\nimport { generateVideoInput, generateVideoResult } 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 GenerateVideoTool = ToolRendererProps<\n typeof generateVideoInput,\n typeof generateVideoResult\n>[\"tool\"];\n\nconst GenerateVideoView = ({\n tool,\n}: ReadonlyNativeSurface<{ tool: GenerateVideoTool }>): React.JSX.Element => {\n if (tool.state === \"input-streaming\" || tool.state === \"input-available\") {\n return (\n <div className=\"flex w-full flex-col items-center justify-center gap-4 rounded-lg border p-8\">\n <div className=\"bg-muted-foreground/20 h-64 w-full animate-pulse rounded-lg\" />\n <div className=\"text-muted-foreground\">\n Generating video: &quot;\n {tool.input?.prompt ?? \"Preparing prompt…\"}\n &quot;\n </div>\n </div>\n );\n }\n\n const { output } = tool;\n\n return (\n <div className=\"flex w-full flex-col gap-4 overflow-hidden rounded-lg border\">\n <video\n autoPlay\n className=\"h-auto w-full max-w-full\"\n controls\n loop\n muted\n playsInline\n src={output.videoUrl}\n />\n <div className=\"p-4 pt-0\">\n <p className=\"text-muted-foreground text-sm\">\n Generated from: &quot;{output.prompt}&quot;\n </p>\n </div>\n </div>\n );\n};\n\nexport const GenerateVideoRenderer = defineToolRenderer({\n inputSchema: generateVideoInput,\n outputSchema: generateVideoResult,\n render: GenerateVideoView,\n});\n",
25
+ "type": "registry:file",
26
+ "target": "~/tools/chatjs/generate-video/renderer.tsx"
27
+ },
28
+ {
29
+ "path": "src/tools/generate-video/schemas.ts",
30
+ "content": "import { z } from \"zod\";\n\nconst MINIMUM_VIDEO_DURATION_SECONDS = 1;\nconst MAXIMUM_VIDEO_DURATION_SECONDS = 10;\n\nconst generateVideoInput = z.object({\n aspectRatio: z\n .enum([\"16:9\", \"9:16\", \"1:1\"])\n .optional()\n .describe(\"Optional output aspect ratio. Defaults to 16:9.\"),\n durationSeconds: z\n .number()\n .int()\n .min(MINIMUM_VIDEO_DURATION_SECONDS)\n .max(MAXIMUM_VIDEO_DURATION_SECONDS)\n .optional()\n .describe(\"Optional video duration in seconds. Defaults to 5.\"),\n prompt: z\n .string()\n .describe(\"A descriptive prompt for the video to generate.\"),\n});\n\nconst generateVideoResult = z.object({\n fileId: z.string().optional(),\n prompt: z.string(),\n videoUrl: z.string(),\n});\nexport { generateVideoInput, generateVideoResult };\n",
31
+ "type": "registry:file",
32
+ "target": "~/tools/chatjs/generate-video/schemas.ts"
33
+ },
34
+ {
35
+ "path": "dist/source/generate-video.json",
36
+ "content": "{\n \"config\": { \"key\": \"video\" },\n \"envRequirements\": [],\n \"id\": \"generate-video\",\n \"kind\": \"tool\",\n \"requiresGateway\": [\"video\"],\n \"requiresStorage\": true,\n \"requiresTools\": [],\n \"slot\": \"generateVideo\",\n \"tools\": [\n {\n \"composer\": {\n \"icon\": \"Video\",\n \"name\": \"Create a video\",\n \"shortName\": \"Video\"\n },\n \"rendererExport\": \"GenerateVideoRenderer\",\n \"toolExport\": \"generateVideoTool\"\n }\n ],\n \"contractVersion\": 1\n}\n",
37
+ "type": "registry:file",
38
+ "target": "~/tools/chatjs/generate-video/chatjs.json"
39
+ }
40
+ ],
41
+ "meta": {
42
+ "chatjs": {
43
+ "config": {
44
+ "key": "video"
45
+ },
46
+ "envRequirements": [],
47
+ "id": "generate-video",
48
+ "kind": "tool",
49
+ "requiresGateway": [
50
+ "video"
51
+ ],
52
+ "requiresStorage": true,
53
+ "requiresTools": [],
54
+ "slot": "generateVideo",
55
+ "tools": [
56
+ {
57
+ "composer": {
58
+ "icon": "Video",
59
+ "name": "Create a video",
60
+ "shortName": "Video"
61
+ },
62
+ "rendererExport": "GenerateVideoRenderer",
63
+ "toolExport": "generateVideoTool"
64
+ }
65
+ ],
66
+ "contractVersion": 1
67
+ }
68
+ },
69
+ "type": "registry:item"
70
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "get-weather",
4
+ "description": "Get the current weather at a location",
5
+ "dependencies": [
6
+ "ai",
7
+ "zod",
8
+ "date-fns"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/tools/get-weather/tool.ts",
13
+ "content": "import { weatherInput, weatherResult } from \"./schemas\";\nimport 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 type { z } from \"zod\";\n\nconst UNBILLED_TOOL_COST_USD = 0;\n\nexport const getWeather = defineTool({\n description: \"Get the current weather at a location\",\n execute: async (\n { latitude, longitude }: Readonly<z.infer<typeof weatherInput>>,\n context: Readonly<{ abortSignal: Readonly<AbortSignal> }>\n ) =>\n await executeWithToolUsage(\n context,\n async (usage: Readonly<Pick<ToolUsage, \"addCostUsd\">>) => {\n const response = await fetch(\n `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m&hourly=temperature_2m&daily=sunrise,sunset&timezone=auto`,\n { signal: context.abortSignal }\n );\n if (!response.ok) {\n throw new Error(\"Weather request failed.\");\n }\n usage.addCostUsd(UNBILLED_TOOL_COST_USD);\n return weatherResult.parse(await response.json());\n }\n ),\n inputSchema: weatherInput,\n toModelOutput: toolResultToModelOutput,\n});\n",
14
+ "type": "registry:file",
15
+ "target": "~/tools/chatjs/get-weather/tool.ts"
16
+ },
17
+ {
18
+ "path": "src/tools/get-weather/renderer.tsx",
19
+ "content": "\"use client\";\nimport { format, isWithinInterval } from \"date-fns\";\nimport { weatherInput, weatherResult } from \"./schemas\";\nimport React from \"react\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\nimport type { ToolRendererProps } from \"@/lib/ai/define-tool-renderer\";\nimport { cn } from \"@/lib/utils\";\nimport { defineToolRenderer } from \"@/lib/ai/define-tool-renderer\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport type { z } from \"zod\";\n\ntype WeatherAtLocation = z.output<typeof weatherResult>;\n\ntype GetWeatherRendererTool = ToolRendererProps<\n typeof weatherInput,\n typeof weatherResult\n>[\"tool\"];\n\nconst SAMPLE = {\n current: { interval: 900, temperature_2m: 29.3, time: \"2024-10-07T19:30\" },\n current_units: { interval: \"seconds\", temperature_2m: \"°C\", time: \"iso8601\" },\n daily: {\n sunrise: [\n \"2024-10-07T07:15\",\n \"2024-10-08T07:16\",\n \"2024-10-09T07:17\",\n \"2024-10-10T07:18\",\n \"2024-10-11T07:19\",\n ],\n sunset: [\n \"2024-10-07T19:00\",\n \"2024-10-08T18:58\",\n \"2024-10-09T18:57\",\n \"2024-10-10T18:55\",\n \"2024-10-11T18:54\",\n ],\n time: [\n \"2024-10-07\",\n \"2024-10-08\",\n \"2024-10-09\",\n \"2024-10-10\",\n \"2024-10-11\",\n ],\n },\n daily_units: {\n sunrise: \"iso8601\",\n sunset: \"iso8601\",\n time: \"iso8601\",\n },\n elevation: 18,\n generationtime_ms: Number(\"0.027894973754882812\"),\n hourly: {\n temperature_2m: [\n 36.6, 32.8, 29.5, 28.6, 29.2, 28.2, 27.5, 26.6, 26.5, 26, 25, 23.5, 23.9,\n 24.2, 22.9, 21, 24, 28.1, 31.4, 33.9, 32.1, 28.9, 26.9, 25.2, 23, 21.1,\n 19.6, 18.6, 17.7, 16.8, 16.2, 15.5, 14.9, 14.4, 14.2, 13.7, 13.3, 12.9,\n 12.5, 13.5, 15.8, 17.7, 19.6, 21, 21.9, 22.3, 22, 20.7, 18.9, 17.9, 17.3,\n 17, 16.7, 16.2, 15.6, 15.2, 15, 15, 15.1, 14.8, 14.8, 14.9, 14.7, 14.8,\n 15.3, 16.2, 17.9, 19.6, 20.5, 21.6, 21, 20.7, 19.3, 18.7, 18.4, 17.9,\n 17.3, 17, 17, 16.8, 16.4, 16.2, 16, 15.8, 15.7, 15.4, 15.4, 16.1, 16.7,\n 17, 18.6, 19, 19.5, 19.4, 18.5, 17.9, 17.5, 16.7, 16.3, 16.1,\n ],\n time: [\n \"2024-10-07T00:00\",\n \"2024-10-07T01:00\",\n \"2024-10-07T02:00\",\n \"2024-10-07T03:00\",\n \"2024-10-07T04:00\",\n \"2024-10-07T05:00\",\n \"2024-10-07T06:00\",\n \"2024-10-07T07:00\",\n \"2024-10-07T08:00\",\n \"2024-10-07T09:00\",\n \"2024-10-07T10:00\",\n \"2024-10-07T11:00\",\n \"2024-10-07T12:00\",\n \"2024-10-07T13:00\",\n \"2024-10-07T14:00\",\n \"2024-10-07T15:00\",\n \"2024-10-07T16:00\",\n \"2024-10-07T17:00\",\n \"2024-10-07T18:00\",\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 \"2024-10-08T02:00\",\n \"2024-10-08T03:00\",\n \"2024-10-08T04:00\",\n \"2024-10-08T05:00\",\n \"2024-10-08T06:00\",\n \"2024-10-08T07:00\",\n \"2024-10-08T08:00\",\n \"2024-10-08T09:00\",\n \"2024-10-08T10:00\",\n \"2024-10-08T11:00\",\n \"2024-10-08T12:00\",\n \"2024-10-08T13:00\",\n \"2024-10-08T14:00\",\n \"2024-10-08T15:00\",\n \"2024-10-08T16:00\",\n \"2024-10-08T17:00\",\n \"2024-10-08T18:00\",\n \"2024-10-08T19:00\",\n \"2024-10-08T20:00\",\n \"2024-10-08T21:00\",\n \"2024-10-08T22:00\",\n \"2024-10-08T23:00\",\n \"2024-10-09T00:00\",\n \"2024-10-09T01:00\",\n \"2024-10-09T02:00\",\n \"2024-10-09T03:00\",\n \"2024-10-09T04:00\",\n \"2024-10-09T05:00\",\n \"2024-10-09T06:00\",\n \"2024-10-09T07:00\",\n \"2024-10-09T08:00\",\n \"2024-10-09T09:00\",\n \"2024-10-09T10:00\",\n \"2024-10-09T11:00\",\n \"2024-10-09T12:00\",\n \"2024-10-09T13:00\",\n \"2024-10-09T14:00\",\n \"2024-10-09T15:00\",\n \"2024-10-09T16:00\",\n \"2024-10-09T17:00\",\n \"2024-10-09T18:00\",\n \"2024-10-09T19:00\",\n \"2024-10-09T20:00\",\n \"2024-10-09T21:00\",\n \"2024-10-09T22:00\",\n \"2024-10-09T23:00\",\n \"2024-10-10T00:00\",\n \"2024-10-10T01:00\",\n \"2024-10-10T02:00\",\n \"2024-10-10T03:00\",\n \"2024-10-10T04:00\",\n \"2024-10-10T05:00\",\n \"2024-10-10T06:00\",\n \"2024-10-10T07:00\",\n \"2024-10-10T08:00\",\n \"2024-10-10T09:00\",\n \"2024-10-10T10:00\",\n \"2024-10-10T11:00\",\n \"2024-10-10T12:00\",\n \"2024-10-10T13:00\",\n \"2024-10-10T14:00\",\n \"2024-10-10T15:00\",\n \"2024-10-10T16:00\",\n \"2024-10-10T17:00\",\n \"2024-10-10T18:00\",\n \"2024-10-10T19:00\",\n \"2024-10-10T20:00\",\n \"2024-10-10T21:00\",\n \"2024-10-10T22:00\",\n \"2024-10-10T23:00\",\n \"2024-10-11T00:00\",\n \"2024-10-11T01:00\",\n \"2024-10-11T02:00\",\n \"2024-10-11T03:00\",\n ],\n },\n hourly_units: { temperature_2m: \"°C\", time: \"iso8601\" },\n latitude: 37.763283,\n longitude: -122.41286,\n timezone: \"GMT\",\n timezone_abbreviation: \"GMT\",\n utc_offset_seconds: 0,\n};\n\nconst roundUp = (num: number): number => Math.ceil(num);\n\nconst WeatherCard = ({\n weatherAtLocation,\n}: ReadonlyNativeSurface<{\n weatherAtLocation: WeatherAtLocation;\n}>): React.JSX.Element => {\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 end: new Date(weatherAtLocation.daily.sunset[0]),\n start: new Date(weatherAtLocation.daily.sunrise[0]),\n });\n\n const isMobile = useIsMobile();\n const hoursToShow = isMobile ? 5 : 6;\n const currentTimeIndex = weatherAtLocation.hourly.time.findIndex(\n (time): boolean =>\n new Date(time) >= new Date(weatherAtLocation.current.time)\n );\n const displayStartIndex =\n currentTimeIndex === -1\n ? Math.max(0, weatherAtLocation.hourly.time.length - hoursToShow)\n : currentTimeIndex;\n const displayTimes = weatherAtLocation.hourly.time.slice(\n displayStartIndex,\n displayStartIndex + hoursToShow\n );\n const displayTemperatures = weatherAtLocation.hourly.temperature_2m.slice(\n displayStartIndex,\n displayStartIndex + hoursToShow\n );\n\n return (\n <div\n className={cn(\n \"skeleton-bg flex max-w-[500px] flex-col gap-4 rounded-2xl p-4\",\n { \"bg-blue-400\": isDay },\n { \"bg-indigo-900\": !isDay }\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={cn(\n \"skeleton-div size-10 rounded-full\",\n { \"bg-yellow-300\": isDay },\n { \"bg-indigo-100\": !isDay }\n )}\n />\n <div className=\"text-4xl font-medium text-blue-50\">\n {roundUp(weatherAtLocation.current.temperature_2m)}\n {weatherAtLocation.current_units.temperature_2m}\n </div>\n </div>\n\n <div className=\"text-blue-50\">{`H:${roundUp(currentHigh)}° L:${roundUp(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-xs text-blue-100\">\n {format(new Date(time), \"ha\")}\n </div>\n <div\n className={cn(\n \"skeleton-div size-6 rounded-full\",\n { \"bg-yellow-300\": isDay },\n { \"bg-indigo-200\": !isDay }\n )}\n />\n <div className=\"text-sm text-blue-50\">\n {roundUp(displayTemperatures[index])}\n {weatherAtLocation.hourly_units.temperature_2m}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nconst GetWeatherView = ({\n tool,\n}: ReadonlyNativeSurface<{\n tool: GetWeatherRendererTool;\n messageId: string;\n isReadonly: boolean;\n}>): React.JSX.Element => {\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 === undefined) {\n return <WeatherCard weatherAtLocation={SAMPLE} />;\n }\n\n return <WeatherCard weatherAtLocation={tool.output} />;\n};\n\nexport const GetWeatherRenderer = defineToolRenderer({\n inputSchema: weatherInput,\n outputSchema: weatherResult,\n render: GetWeatherView,\n});\n",
20
+ "type": "registry:file",
21
+ "target": "~/tools/chatjs/get-weather/renderer.tsx"
22
+ },
23
+ {
24
+ "path": "src/tools/get-weather/schemas.ts",
25
+ "content": "import { z } from \"zod\";\n\nconst weatherInput = z.object({\n latitude: z.number(),\n longitude: z.number(),\n});\n\nconst MINIMUM_FORECAST_SAMPLE_COUNT = 1;\nconst sunriseSeries = z.array(z.string()).min(MINIMUM_FORECAST_SAMPLE_COUNT);\nconst sunsetSeries = z.array(z.string()).min(MINIMUM_FORECAST_SAMPLE_COUNT);\nconst hourlyTemperatures = z\n .array(z.number())\n .min(MINIMUM_FORECAST_SAMPLE_COUNT);\nconst dailyForecast = z.object({\n sunrise: sunriseSeries,\n sunset: sunsetSeries,\n time: z.array(z.string()),\n});\nconst hourlyForecast = z.object({\n temperature_2m: hourlyTemperatures,\n time: z.array(z.string()),\n});\n\nconst weatherResult = z.object({\n current: z.object({\n interval: z.number(),\n temperature_2m: z.number(),\n time: z.iso.datetime({ local: true }),\n }),\n current_units: z.object({\n interval: z.string(),\n temperature_2m: z.string(),\n time: z.string(),\n }),\n daily: dailyForecast,\n daily_units: z.object({\n sunrise: z.string(),\n sunset: z.string(),\n time: z.string(),\n }),\n elevation: z.number(),\n generationtime_ms: z.number(),\n hourly: hourlyForecast,\n hourly_units: z.object({ temperature_2m: z.string(), time: z.string() }),\n latitude: z.number(),\n longitude: z.number(),\n timezone: z.string(),\n timezone_abbreviation: z.string(),\n utc_offset_seconds: z.number(),\n});\nexport { weatherInput, weatherResult };\n",
26
+ "type": "registry:file",
27
+ "target": "~/tools/chatjs/get-weather/schemas.ts"
28
+ },
29
+ {
30
+ "path": "dist/source/get-weather.json",
31
+ "content": "{\n \"envRequirements\": [],\n \"id\": \"get-weather\",\n \"kind\": \"tool\",\n \"requiresTools\": [],\n \"tools\": [\n { \"rendererExport\": \"GetWeatherRenderer\", \"toolExport\": \"getWeather\" }\n ],\n \"contractVersion\": 1\n}\n",
32
+ "type": "registry:file",
33
+ "target": "~/tools/chatjs/get-weather/chatjs.json"
34
+ }
35
+ ],
36
+ "meta": {
37
+ "chatjs": {
38
+ "envRequirements": [],
39
+ "id": "get-weather",
40
+ "kind": "tool",
41
+ "requiresTools": [],
42
+ "tools": [
43
+ {
44
+ "rendererExport": "GetWeatherRenderer",
45
+ "toolExport": "getWeather"
46
+ }
47
+ ],
48
+ "contractVersion": 1
49
+ }
50
+ },
51
+ "type": "registry:item"
52
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "google-drive-storage",
4
+ "title": "Google Drive",
5
+ "description": "Google Drive via the official Drive v3 client. Maps unified string keys onto Drive's appProperties with a per-instance LRU cache.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@googleapis/drive@^20.0.0 || ^21.0.0 || ^22.0.0",
9
+ "google-auth-library@^10.0.0 || ^11.0.0"
10
+ ],
11
+ "files": [
12
+ {
13
+ "path": "src/storage/google-drive/storage-provider.ts",
14
+ "content": "export { googleDrive as createStorageAdapter } from \"files-sdk/google-drive\";\n",
15
+ "type": "registry:file",
16
+ "target": "~/lib/storage-provider.ts"
17
+ }
18
+ ],
19
+ "meta": {
20
+ "chatjs": {
21
+ "configKeys": [],
22
+ "contractVersion": 1,
23
+ "envRequirements": [
24
+ {
25
+ "description": "Google Drive credentials",
26
+ "options": [
27
+ [
28
+ "GOOGLE_DRIVE_CLIENT_EMAIL",
29
+ "GOOGLE_DRIVE_PRIVATE_KEY"
30
+ ],
31
+ [
32
+ "GOOGLE_DRIVE_KEY_FILE"
33
+ ]
34
+ ]
35
+ }
36
+ ],
37
+ "id": "google-drive",
38
+ "kind": "storage",
39
+ "optionalEnv": [
40
+ "GOOGLE_DRIVE_SUBJECT",
41
+ "GOOGLE_DRIVE_ID",
42
+ "GOOGLE_DRIVE_ROOT_FOLDER_ID"
43
+ ]
44
+ }
45
+ },
46
+ "type": "registry:item"
47
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "hetzner-storage",
4
+ "title": "Hetzner Object Storage",
5
+ "description": "Hetzner Object Storage via the S3-compatible API. Endpoint derived from the location code (fsn1, nbg1, hel1).",
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/hetzner/storage-provider.ts",
15
+ "content": "export { hetzner as createStorageAdapter } from \"files-sdk/hetzner\";\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": "Hetzner Object Storage credentials",
30
+ "options": [
31
+ [
32
+ "HCLOUD_ACCESS_KEY_ID",
33
+ "HCLOUD_SECRET_ACCESS_KEY"
34
+ ]
35
+ ]
36
+ }
37
+ ],
38
+ "id": "hetzner",
39
+ "kind": "storage",
40
+ "optionalEnv": []
41
+ }
42
+ },
43
+ "type": "registry:item"
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "ibm-cos-storage",
4
+ "title": "IBM Cloud Object Storage",
5
+ "description": "IBM Cloud Object Storage via the S3-compatible API. Auth uses IBM Cloud HMAC credentials, not IAM API keys.",
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/ibm-cos/storage-provider.ts",
15
+ "content": "export { ibmCos as createStorageAdapter } from \"files-sdk/ibm-cos\";\n",
16
+ "type": "registry:file",
17
+ "target": "~/lib/storage-provider.ts"
18
+ }
19
+ ],
20
+ "meta": {
21
+ "chatjs": {
22
+ "configKeys": [
23
+ "bucket",
24
+ "endpoint"
25
+ ],
26
+ "contractVersion": 1,
27
+ "envRequirements": [
28
+ {
29
+ "description": "IBM Cloud Object Storage credentials",
30
+ "options": [
31
+ [
32
+ "IBM_COS_ACCESS_KEY_ID",
33
+ "IBM_COS_SECRET_ACCESS_KEY"
34
+ ]
35
+ ]
36
+ }
37
+ ],
38
+ "id": "ibm-cos",
39
+ "kind": "storage",
40
+ "optionalEnv": []
41
+ }
42
+ },
43
+ "type": "registry:item"
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "idrive-e2-storage",
4
+ "title": "iDrive e2",
5
+ "description": "iDrive e2 via the S3-compatible API. Endpoint required (iDrive hostnames are tied to the cluster your bucket lives in).",
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/idrive-e2/storage-provider.ts",
15
+ "content": "export { idriveE2 as createStorageAdapter } from \"files-sdk/idrive-e2\";\n",
16
+ "type": "registry:file",
17
+ "target": "~/lib/storage-provider.ts"
18
+ }
19
+ ],
20
+ "meta": {
21
+ "chatjs": {
22
+ "configKeys": [
23
+ "bucket",
24
+ "endpoint"
25
+ ],
26
+ "contractVersion": 1,
27
+ "envRequirements": [
28
+ {
29
+ "description": "iDrive e2 credentials",
30
+ "options": [
31
+ [
32
+ "IDRIVE_E2_ACCESS_KEY_ID",
33
+ "IDRIVE_E2_SECRET_ACCESS_KEY"
34
+ ]
35
+ ]
36
+ }
37
+ ],
38
+ "id": "idrive-e2",
39
+ "kind": "storage",
40
+ "optionalEnv": []
41
+ }
42
+ },
43
+ "type": "registry:item"
44
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "langfuse",
4
+ "description": "Langfuse tracing through Vercel OpenTelemetry",
5
+ "dependencies": [
6
+ "@vercel/otel@^2.1.0",
7
+ "langfuse-vercel@^3.37.0"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/plugins/langfuse/src/instrumentation.ts",
12
+ "content": "import type { InstrumentationRegistration } from \"@/lib/installation-contracts\";\nimport { getLangfuseEnvironment } from \"./credentials\";\nimport { isPlaywrightTestEnvironment } from \"@/lib/playwright-test-environment\";\n\nexport const register: InstrumentationRegistration = async ({\n appPrefix,\n runtime,\n}: Readonly<{ appPrefix: string; runtime: string | undefined }>) => {\n // Browser fixtures deliberately omit optional service credentials and exports.\n if (runtime !== \"nodejs\" || isPlaywrightTestEnvironment()) {\n return;\n }\n const environment = getLangfuseEnvironment();\n const [{ registerOTel }, { LangfuseExporter }] = await Promise.all([\n import(\"@vercel/otel\"),\n import(\"langfuse-vercel\"),\n ]);\n registerOTel({\n serviceName: appPrefix,\n traceExporter: new LangfuseExporter(environment),\n });\n};\n",
13
+ "type": "registry:file",
14
+ "target": "~/plugins/langfuse/instrumentation.ts"
15
+ },
16
+ {
17
+ "path": "src/plugins/langfuse/src/credentials.ts",
18
+ "content": "import descriptor from \"@/plugins/langfuse/chatjs.json\";\nimport { requireCredentials } from \"@/lib/required-credentials\";\n\n// Read at registration time so an omitted integration never validates credentials.\nexport const getLangfuseEnvironment = (\n environment: Readonly<NodeJS.ProcessEnv> = process.env\n): {\n baseUrl: string | undefined;\n debug: boolean;\n publicKey: string | undefined;\n secretKey: string | undefined;\n} => {\n requireCredentials(\"langfuse\", descriptor.envRequirements, environment);\n const baseUrl = environment.LANGFUSE_BASE_URL;\n const hasBaseUrl = Boolean(baseUrl);\n return {\n baseUrl: hasBaseUrl ? baseUrl : undefined,\n debug: environment.LANGFUSE_DEBUG === \"true\",\n publicKey: environment.LANGFUSE_PUBLIC_KEY,\n secretKey: environment.LANGFUSE_SECRET_KEY,\n };\n};\n",
19
+ "type": "registry:file",
20
+ "target": "~/plugins/langfuse/credentials.ts"
21
+ },
22
+ {
23
+ "path": "src/plugins/langfuse/src/server-plugin.ts",
24
+ "content": "import type { ChatPlugin } from \"@/lib/plugin-contracts\";\nimport { register } from \"./instrumentation\";\n\nexport const langfuse = () =>\n ({ id: \"langfuse\", instrumentation: register }) satisfies ChatPlugin;\n",
25
+ "type": "registry:file",
26
+ "target": "~/plugins/langfuse/server-plugin.ts"
27
+ },
28
+ {
29
+ "path": "dist/source/langfuse.json",
30
+ "content": "{\n \"id\": \"langfuse\",\n \"kind\": \"plugin\",\n \"files\": [\n \"plugins/langfuse/instrumentation.ts\",\n \"plugins/langfuse/credentials.ts\",\n \"plugins/langfuse/server-plugin.ts\"\n ],\n \"envRequirements\": [\n { \"options\": [[\"LANGFUSE_PUBLIC_KEY\", \"LANGFUSE_SECRET_KEY\"]] }\n ],\n \"server\": { \"export\": \"langfuse\", \"routers\": [], \"instrumentation\": true },\n \"contractVersion\": 1\n}\n",
31
+ "type": "registry:file",
32
+ "target": "~/plugins/langfuse/chatjs.json"
33
+ }
34
+ ],
35
+ "meta": {
36
+ "chatjs": {
37
+ "id": "langfuse",
38
+ "kind": "plugin",
39
+ "files": [
40
+ "plugins/langfuse/instrumentation.ts",
41
+ "plugins/langfuse/credentials.ts",
42
+ "plugins/langfuse/server-plugin.ts"
43
+ ],
44
+ "envRequirements": [
45
+ {
46
+ "options": [
47
+ [
48
+ "LANGFUSE_PUBLIC_KEY",
49
+ "LANGFUSE_SECRET_KEY"
50
+ ]
51
+ ]
52
+ }
53
+ ],
54
+ "server": {
55
+ "export": "langfuse",
56
+ "routers": [],
57
+ "instrumentation": true
58
+ },
59
+ "contractVersion": 1
60
+ }
61
+ },
62
+ "type": "registry:item"
63
+ }