@intlayer/ai 7.5.2-canary.1 → 7.5.2

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/dist/assets/auditDictionaryMetadata/EXAMPLE_REQUEST.md +21 -0
  2. package/dist/assets/auditDictionaryMetadata/EXAMPLE_RESPONSE.md +1 -0
  3. package/dist/assets/auditDictionaryMetadata/PROMPT.md +0 -41
  4. package/dist/assets/translateJSON/PROMPT.md +25 -29
  5. package/dist/cjs/aiSdk.cjs +1 -1
  6. package/dist/cjs/aiSdk.cjs.map +1 -1
  7. package/dist/cjs/auditDictionaryMetadata/index.cjs +30 -15
  8. package/dist/cjs/auditDictionaryMetadata/index.cjs.map +1 -1
  9. package/dist/cjs/index.cjs +1 -1
  10. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs +30 -0
  11. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs.map +1 -0
  12. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs +41 -0
  13. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs.map +1 -0
  14. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs +31 -0
  15. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs.map +1 -0
  16. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs +577 -0
  17. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
  18. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs +535 -0
  19. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs.map +1 -0
  20. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs +376 -0
  21. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs.map +1 -0
  22. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs +67 -0
  23. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs.map +1 -0
  24. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs +35 -0
  25. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs.map +1 -0
  26. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs +66 -0
  27. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs.map +1 -0
  28. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs +239 -0
  29. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs.map +1 -0
  30. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs +123 -0
  31. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs.map +1 -0
  32. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs +88 -0
  33. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs.map +1 -0
  34. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs +54 -0
  35. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs.map +1 -0
  36. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs +1048 -0
  37. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs.map +1 -0
  38. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs +263 -0
  39. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs.map +1 -0
  40. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs +350 -0
  41. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs.map +1 -0
  42. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs +11 -0
  43. package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs.map +1 -0
  44. package/dist/cjs/translateJSON/index.cjs +29 -6
  45. package/dist/cjs/translateJSON/index.cjs.map +1 -1
  46. package/dist/esm/aiSdk.mjs +1 -1
  47. package/dist/esm/aiSdk.mjs.map +1 -1
  48. package/dist/esm/auditDictionaryMetadata/index.mjs +31 -16
  49. package/dist/esm/auditDictionaryMetadata/index.mjs.map +1 -1
  50. package/dist/esm/index.mjs +1 -1
  51. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs +30 -0
  52. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs.map +1 -0
  53. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs +38 -0
  54. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs.map +1 -0
  55. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs +20 -0
  56. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs.map +1 -0
  57. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs +571 -0
  58. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs.map +1 -0
  59. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs +478 -0
  60. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs.map +1 -0
  61. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs +361 -0
  62. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs.map +1 -0
  63. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs +62 -0
  64. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs.map +1 -0
  65. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs +34 -0
  66. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs.map +1 -0
  67. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs +63 -0
  68. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs.map +1 -0
  69. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs +219 -0
  70. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs.map +1 -0
  71. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs +110 -0
  72. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs.map +1 -0
  73. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs +61 -0
  74. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs.map +1 -0
  75. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs +53 -0
  76. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs.map +1 -0
  77. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs +1002 -0
  78. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs.map +1 -0
  79. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs +261 -0
  80. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs.map +1 -0
  81. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs +317 -0
  82. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs.map +1 -0
  83. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs +10 -0
  84. package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs.map +1 -0
  85. package/dist/esm/translateJSON/index.mjs +30 -7
  86. package/dist/esm/translateJSON/index.mjs.map +1 -1
  87. package/dist/types/translateJSON/index.d.ts +7 -7
  88. package/dist/types/translateJSON/index.d.ts.map +1 -1
  89. package/package.json +5 -5
@@ -0,0 +1,21 @@
1
+ ```ts
2
+ import { t, type Dictionary } from "intlayer";
3
+ import { Metadata } from "next";
4
+
5
+ const metadataContent = {
6
+ key: "pricing-metadata",
7
+ content: {
8
+ title: t({
9
+ en: "Pricing | Intlayer",
10
+ }),
11
+ description: t({
12
+ en: "Discover our pricing plans and get access to premium features with Intlayer. Choose the plan that suits you best.",
13
+ }),
14
+ keywords: t<string[]>({
15
+ en: ["Pricing", "Subscription"],
16
+ }),
17
+ },
18
+ } satisfies Dictionary<Metadata>;
19
+
20
+ export default metadataContent;
21
+ ```
@@ -0,0 +1 @@
1
+ { "title": "Pricing page metadata", "description": "Metadata related to the pricing page, includes title, description, keywords, metadata for SEO purpose. It will help search engines understand the content of the page.", "tags": ["page metadata", "pricing page"]}
@@ -21,47 +21,6 @@ After completion, provide only the final title, description and tags fields in a
21
21
 
22
22
  Correct this fields if they are misspelled or do not match the expected content, and / or complete missing title / description / tags.
23
23
 
24
- **Example of expected response:**
25
-
26
- The following case is just an example of expected behavior:
27
-
28
- - Example of entry:
29
-
30
- ```ts
31
- import { t, type Dictionary } from "intlayer";
32
- import { Metadata } from "next";
33
-
34
- const metadataContent = {
35
- key: "pricing-metadata",
36
- title: "",
37
- description:
38
- "here a description that doesn't make any sense and should be replaced",
39
- content: {
40
- title: t({
41
- en: "Pricing | Intlayer",
42
- }),
43
- description: t({
44
- en: "Discover our pricing plans and get access to premium features with Intlayer. Choose the plan that suits you best.",
45
- }),
46
- keywords: t<string[]>({
47
- en: ["Pricing", "Subscription"],
48
- }),
49
- },
50
- } satisfies Dictionary<Metadata>;
51
-
52
- export default metadataContent;
53
- ```
54
-
55
- - Example of response:
56
-
57
- ```json
58
- {
59
- "title": "Pricing page metadata",
60
- "description": "Metadata related to the pricing page, includes title, description, keywords, metadata for SEO purpose. It will help search engines understand the content of the page.",
61
- "tags": ["page metadata", "pricing page"]
62
- }
63
- ```
64
-
65
24
  **Application Context**
66
25
 
67
26
  {{applicationContext}}
@@ -1,45 +1,41 @@
1
- You are an expert in internationalization, copy writing and content management. Your task is to audit the content declaration files in the project and identify any potential issues or inconsistencies. Provide a detailed report of any issues found, including the file path, line number, and a brief explanation of the issue.
1
+ You are an expert AI localization engine specialized in software internationalization (i18n). Your task is to translate and adapt JSON content from a source locale to a specific target locale.
2
2
 
3
- **Instructions:**
3
+ **CRITICAL INSTRUCTION:**
4
4
 
5
- 2. **Audit Requirements:**
6
- - **Consistency:** The dictionary format should be the same as the one provided in entry. You should not rename or translate the entry keys.
7
- - **Missing Content:** Identify any missing translations and specify the expected content.
8
- - **Misplaced Content:** Detect if any translations are placed under incorrect keys.
9
- - **Type Compliance:** Verify that the content types match the declarations (e.g., strings, string arrays).
5
+ - **Source Language:** {{entryLocale}}
6
+ - **Target Language:** {{outputLocale}}
7
+ - **Strict Compliance:** You must translate the content **ONLY** into {{outputLocale}}. Never use any other language.
10
8
 
11
- 3. **Modification Guidelines:**
12
- - **Do Not Alter Structure:** If the file structure is correct, do not modify it. Only add, update, or remove content declarations as necessary.
13
- - **Missing Content:** If one key is missing from the Preset Output Content, or if the Preset Output Content is empty, the output content should be completed by translating the Entry Content to Translate into the output locale.
14
- - **Return Only Final File Content:** Provide the updated file content without any additional comments or explanations.
15
- - **Manage Localizations:** If the output languages targeted is a variant contains similar languages, as `en` and `en-GB`, consider `en` as English US, and adapt it into `en-GB` as English UK.
16
- - **Escape Special Characters:** If the translations contain special characters, escape them using the appropriate escape sequence.
17
- - **Respect the tags and description instructions:** If the tags and description instructions are provided, ensure that the audited file adheres to them.
18
- - **Consider the Preset Output Content** If Preset Output Content is provided, and coherent with the entry, you can consider reuse it to fill the output file content.
19
- - **TypeNode field should not be translated** A value as `{ 'nodeType': 'XXX', ...}` should not be translated.
9
+ **Translation Guidelines:**
20
10
 
21
- **Application Context**
11
+ 1. **Preserve Structure:** The output JSON structure (keys, nesting, array lengths) must exactly match the input structure.
12
+ 2. **Key Integrity:** Do not translate, rename, or remove object keys.
13
+ 3. **Data Types:** Respect specific data types. If the source is a string, return a string. If it is a boolean or number, preserve it.
14
+ 4. **Formatting:**
15
+ - Escape special characters if necessary for valid JSON.
16
+ - Do not add markdown formatting (like `json ... `) in the final output; return pure data matching the schema.
17
+ 5. **Node Types:** Do not translate values containing technical metadata such as `{ 'nodeType': 'XXX' }`.
22
18
 
23
- {{applicationContext}}
19
+ **Localization Logic:**
24
20
 
25
- **Mode Instruction:**
21
+ - **Missing Content:** If a key is missing in the preset output, translate the entry content into the target language.
22
+ - **Dialect Handling:** Adapt the translation to the specific variant (e.g., `en-GB` vs `en-US`, `es-ES` vs `es-MX`).
23
+ - **Context Awareness:** Use the provided Dictionary Description and Application Context to inform tone and terminology.
26
24
 
25
+ **Mode Instruction:**
27
26
  {{modeInstructions}}
28
27
 
29
- **Tags Instructions:**
30
-
28
+ **Tags Context:**
31
29
  {{tagsInstructions}}
32
30
 
33
- **Dictionary Description:**
31
+ **Application Context:**
32
+ {{applicationContext}}
34
33
 
34
+ **Dictionary Description:**
35
35
  {{dictionaryDescription}}
36
36
 
37
- **Preset Output Content:**
38
-
39
- - Target Language: {{outputLocale}}
40
-
37
+ **Preset Output Content (Current State):**
41
38
  {{presetOutputContent}}
42
39
 
43
- **Expected Response:**
44
-
45
- After auditing, provide only the final content of the file as plain text without any Markdown or code block formatting. If no changes are needed, return the file content exactly as it is.
40
+ **Final Goal:**
41
+ Return the fully translated/updated JSON object for the Target Language ({{outputLocale}}).
@@ -66,7 +66,7 @@ const getLanguageModel = (aiOptions, apiKey, defaultModel) => {
66
66
  })(selectedModel);
67
67
  case AIProvider.OLLAMA: return (0, _ai_sdk_openai.createOpenAI)({
68
68
  baseURL: baseURL ?? "http://localhost:11434/v1",
69
- apiKey: "ollama"
69
+ apiKey: apiKey ?? "ollama"
70
70
  }).chat(selectedModel);
71
71
  default: throw new Error(`Provider ${aiOptions.provider} not supported`);
72
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aiSdk.cjs","names":["DEFAULT_PROVIDER: AIProvider","DEFAULT_TEMPERATURE: number"],"sources":["../../src/aiSdk.ts"],"sourcesContent":["import { type anthropic, createAnthropic } from '@ai-sdk/anthropic';\nimport { createDeepSeek, type deepseek } from '@ai-sdk/deepseek';\nimport { createGoogleGenerativeAI, type google } from '@ai-sdk/google';\nimport { createMistral, type mistral } from '@ai-sdk/mistral';\nimport { createOpenAI, type openai } from '@ai-sdk/openai';\nimport type {\n AssistantModelMessage,\n generateText,\n SystemModelMessage,\n ToolModelMessage,\n UserModelMessage,\n} from 'ai';\n\ntype AnthropicModel = Parameters<typeof anthropic>[0];\ntype DeepSeekModel = Parameters<typeof deepseek>[0];\ntype MistralModel = Parameters<typeof mistral>[0];\ntype OpenAIModel = Parameters<typeof openai>[0];\ntype GoogleModel = Parameters<typeof google>[0];\n\nexport type Messages = (\n | SystemModelMessage\n | UserModelMessage\n | AssistantModelMessage\n | ToolModelMessage\n)[];\n\n/**\n * Supported AI models\n */\nexport type Model =\n | AnthropicModel\n | DeepSeekModel\n | MistralModel\n | OpenAIModel\n | GoogleModel\n | (string & {});\n\n/**\n * Supported AI SDK providers\n */\nexport enum AIProvider {\n OPENAI = 'openai',\n ANTHROPIC = 'anthropic',\n MISTRAL = 'mistral',\n DEEPSEEK = 'deepseek',\n GEMINI = 'gemini',\n OLLAMA = 'ollama',\n}\n\nexport type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'none';\n\n/**\n * Common options for all AI providers\n */\nexport type AIOptions = {\n provider?: AIProvider;\n model?: Model;\n temperature?: number;\n baseURL?: string;\n apiKey?: string;\n applicationContext?: string;\n};\n\n// Define the structure of messages used in chat completions\nexport type ChatCompletionRequestMessage = {\n role: 'system' | 'user' | 'assistant'; // The role of the message sender\n content: string; // The text content of the message\n timestamp?: Date; // The timestamp of the message\n};\n\ntype AccessType = 'apiKey' | 'registered_user' | 'premium_user' | 'public';\n\nconst getAPIKey = (\n accessType: AccessType[],\n aiOptions?: AIOptions,\n isAuthenticated: boolean = false\n) => {\n const defaultApiKey = process.env.OPENAI_API_KEY;\n\n if (accessType.includes('public')) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n if (accessType.includes('apiKey') && aiOptions?.apiKey) {\n return aiOptions?.apiKey;\n }\n\n if (accessType.includes('registered_user') && isAuthenticated) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n // TODO: Implement premium user access\n if (accessType.includes('premium_user') && isAuthenticated) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n return undefined;\n};\n\nconst getModelName = (\n provider: AIProvider,\n userApiKey: string,\n userModel?: Model,\n defaultModel: Model = 'gpt-5-mini'\n): Model => {\n // If the user uses their own API key, allow custom model selection\n if (userApiKey || provider === AIProvider.OLLAMA) {\n if (provider === AIProvider.OPENAI) {\n return userModel ?? defaultModel;\n }\n\n if (userModel) {\n return userModel;\n }\n\n switch (provider) {\n case AIProvider.ANTHROPIC:\n return 'claude-sonnet-4-5-20250929';\n case AIProvider.MISTRAL:\n return 'mistral-large-latest';\n case AIProvider.DEEPSEEK:\n return 'deepseek-coder';\n case AIProvider.GEMINI:\n return 'gemini-2.5-flash';\n case AIProvider.OLLAMA:\n return '';\n default:\n return defaultModel;\n }\n }\n\n // Guard: Prevent custom model usage without a user API key\n if (userModel || provider) {\n throw new Error(\n 'The user should use his own API key to use a custom model'\n );\n }\n\n return defaultModel;\n};\n\nconst getLanguageModel = (\n aiOptions: AIOptions,\n apiKey: string,\n defaultModel?: Model\n) => {\n const selectedModel = getModelName(\n aiOptions.provider as AIProvider,\n apiKey,\n aiOptions.model,\n defaultModel\n );\n\n const baseURL = aiOptions.baseURL;\n\n switch (aiOptions.provider) {\n case AIProvider.OPENAI: {\n return createOpenAI({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.ANTHROPIC: {\n return createAnthropic({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.MISTRAL: {\n return createMistral({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.DEEPSEEK: {\n return createDeepSeek({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.GEMINI: {\n return createGoogleGenerativeAI({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.OLLAMA: {\n // Ollama compatible mode:\n const ollama = createOpenAI({\n baseURL: baseURL ?? 'http://localhost:11434/v1',\n apiKey: 'ollama', // Required but unused by Ollama\n });\n\n return ollama.chat(selectedModel);\n }\n\n default: {\n throw new Error(`Provider ${aiOptions.provider} not supported`);\n }\n }\n};\n\nexport type AIConfig = Omit<Parameters<typeof generateText>[0], 'prompt'> & {\n reasoningEffort?: ReasoningEffort;\n textVerbosity?: 'low' | 'medium' | 'high';\n};\n\nconst DEFAULT_PROVIDER: AIProvider = AIProvider.OPENAI as AIProvider;\nconst DEFAULT_TEMPERATURE: number = 1; // ChatGPT 5 accept only temperature 1\n\nexport type AIConfigOptions = {\n userOptions?: AIOptions;\n defaultOptions?: AIOptions;\n accessType?: AccessType[];\n};\n\n/**\n * Get AI model configuration based on the selected provider and options\n * This function handles the configuration for different AI providers\n *\n * @param options Configuration options including provider, API keys, models and temperature\n * @returns Configured AI model ready to use with generateText\n */\nexport const getAIConfig = async (\n options: AIConfigOptions,\n isAuthenticated: boolean = false\n): Promise<AIConfig> => {\n const {\n userOptions,\n defaultOptions,\n accessType = ['registered_user'],\n } = options;\n\n const aiOptions = {\n provider: DEFAULT_PROVIDER,\n temperature: DEFAULT_TEMPERATURE,\n ...defaultOptions,\n ...userOptions,\n } satisfies AIOptions;\n\n const apiKey = getAPIKey(accessType, aiOptions, isAuthenticated);\n\n // Check if API key is provided\n if (!apiKey) {\n throw new Error(`API key for ${aiOptions.provider} is missing`);\n }\n\n const languageModel = getLanguageModel(\n aiOptions,\n apiKey,\n defaultOptions?.model\n );\n\n return {\n model: languageModel,\n temperature: aiOptions.temperature,\n };\n};\n"],"mappings":";;;;;;;;;;AAwCA,IAAY,oDAAL;AACL;AACA;AACA;AACA;AACA;AACA;;;AA0BF,MAAM,aACJ,YACA,WACA,kBAA2B,UACxB;CACH,MAAM,gBAAgB,QAAQ,IAAI;AAElC,KAAI,WAAW,SAAS,SAAS,CAC/B,QAAO,WAAW,UAAU;AAG9B,KAAI,WAAW,SAAS,SAAS,IAAI,WAAW,OAC9C,QAAO,WAAW;AAGpB,KAAI,WAAW,SAAS,kBAAkB,IAAI,gBAC5C,QAAO,WAAW,UAAU;AAI9B,KAAI,WAAW,SAAS,eAAe,IAAI,gBACzC,QAAO,WAAW,UAAU;;AAMhC,MAAM,gBACJ,UACA,YACA,WACA,eAAsB,iBACZ;AAEV,KAAI,cAAc,aAAa,WAAW,QAAQ;AAChD,MAAI,aAAa,WAAW,OAC1B,QAAO,aAAa;AAGtB,MAAI,UACF,QAAO;AAGT,UAAQ,UAAR;GACE,KAAK,WAAW,UACd,QAAO;GACT,KAAK,WAAW,QACd,QAAO;GACT,KAAK,WAAW,SACd,QAAO;GACT,KAAK,WAAW,OACd,QAAO;GACT,KAAK,WAAW,OACd,QAAO;GACT,QACE,QAAO;;;AAKb,KAAI,aAAa,SACf,OAAM,IAAI,MACR,4DACD;AAGH,QAAO;;AAGT,MAAM,oBACJ,WACA,QACA,iBACG;CACH,MAAM,gBAAgB,aACpB,UAAU,UACV,QACA,UAAU,OACV,aACD;CAED,MAAM,UAAU,UAAU;AAE1B,SAAQ,UAAU,UAAlB;EACE,KAAK,WAAW,OACd,yCAAoB;GAClB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,UACd,+CAAuB;GACrB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,QACd,2CAAqB;GACnB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,SACd,6CAAsB;GACpB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,OACd,qDAAgC;GAC9B;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,OAOd,yCAL4B;GAC1B,SAAS,WAAW;GACpB,QAAQ;GACT,CAAC,CAEY,KAAK,cAAc;EAGnC,QACE,OAAM,IAAI,MAAM,YAAY,UAAU,SAAS,gBAAgB;;;AAUrE,MAAMA,mBAA+B,WAAW;AAChD,MAAMC,sBAA8B;;;;;;;;AAepC,MAAa,cAAc,OACzB,SACA,kBAA2B,UACL;CACtB,MAAM,EACJ,aACA,gBACA,aAAa,CAAC,kBAAkB,KAC9B;CAEJ,MAAM,YAAY;EAChB,UAAU;EACV,aAAa;EACb,GAAG;EACH,GAAG;EACJ;CAED,MAAM,SAAS,UAAU,YAAY,WAAW,gBAAgB;AAGhE,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,eAAe,UAAU,SAAS,aAAa;AASjE,QAAO;EACL,OAPoB,iBACpB,WACA,QACA,gBAAgB,MACjB;EAIC,aAAa,UAAU;EACxB"}
1
+ {"version":3,"file":"aiSdk.cjs","names":["DEFAULT_PROVIDER: AIProvider","DEFAULT_TEMPERATURE: number"],"sources":["../../src/aiSdk.ts"],"sourcesContent":["import { type anthropic, createAnthropic } from '@ai-sdk/anthropic';\nimport { createDeepSeek, type deepseek } from '@ai-sdk/deepseek';\nimport { createGoogleGenerativeAI, type google } from '@ai-sdk/google';\nimport { createMistral, type mistral } from '@ai-sdk/mistral';\nimport { createOpenAI, type openai } from '@ai-sdk/openai';\nimport type {\n AssistantModelMessage,\n generateText,\n SystemModelMessage,\n ToolModelMessage,\n UserModelMessage,\n} from 'ai';\n\ntype AnthropicModel = Parameters<typeof anthropic>[0];\ntype DeepSeekModel = Parameters<typeof deepseek>[0];\ntype MistralModel = Parameters<typeof mistral>[0];\ntype OpenAIModel = Parameters<typeof openai>[0];\ntype GoogleModel = Parameters<typeof google>[0];\n\nexport type Messages = (\n | SystemModelMessage\n | UserModelMessage\n | AssistantModelMessage\n | ToolModelMessage\n)[];\n\n/**\n * Supported AI models\n */\nexport type Model =\n | AnthropicModel\n | DeepSeekModel\n | MistralModel\n | OpenAIModel\n | GoogleModel\n | (string & {});\n\n/**\n * Supported AI SDK providers\n */\nexport enum AIProvider {\n OPENAI = 'openai',\n ANTHROPIC = 'anthropic',\n MISTRAL = 'mistral',\n DEEPSEEK = 'deepseek',\n GEMINI = 'gemini',\n OLLAMA = 'ollama',\n}\n\nexport type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'none';\n\n/**\n * Common options for all AI providers\n */\nexport type AIOptions = {\n provider?: AIProvider;\n model?: Model;\n temperature?: number;\n baseURL?: string;\n apiKey?: string;\n applicationContext?: string;\n};\n\n// Define the structure of messages used in chat completions\nexport type ChatCompletionRequestMessage = {\n role: 'system' | 'user' | 'assistant'; // The role of the message sender\n content: string; // The text content of the message\n timestamp?: Date; // The timestamp of the message\n};\n\ntype AccessType = 'apiKey' | 'registered_user' | 'premium_user' | 'public';\n\nconst getAPIKey = (\n accessType: AccessType[],\n aiOptions?: AIOptions,\n isAuthenticated: boolean = false\n) => {\n const defaultApiKey = process.env.OPENAI_API_KEY;\n\n if (accessType.includes('public')) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n if (accessType.includes('apiKey') && aiOptions?.apiKey) {\n return aiOptions?.apiKey;\n }\n\n if (accessType.includes('registered_user') && isAuthenticated) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n // TODO: Implement premium user access\n if (accessType.includes('premium_user') && isAuthenticated) {\n return aiOptions?.apiKey ?? defaultApiKey;\n }\n\n return undefined;\n};\n\nconst getModelName = (\n provider: AIProvider,\n userApiKey: string,\n userModel?: Model,\n defaultModel: Model = 'gpt-5-mini'\n): Model => {\n // If the user uses their own API key, allow custom model selection\n if (userApiKey || provider === AIProvider.OLLAMA) {\n if (provider === AIProvider.OPENAI) {\n return userModel ?? defaultModel;\n }\n\n if (userModel) {\n return userModel;\n }\n\n switch (provider) {\n case AIProvider.ANTHROPIC:\n return 'claude-sonnet-4-5-20250929';\n case AIProvider.MISTRAL:\n return 'mistral-large-latest';\n case AIProvider.DEEPSEEK:\n return 'deepseek-coder';\n case AIProvider.GEMINI:\n return 'gemini-2.5-flash';\n case AIProvider.OLLAMA:\n return '';\n default:\n return defaultModel;\n }\n }\n\n // Guard: Prevent custom model usage without a user API key\n if (userModel || provider) {\n throw new Error(\n 'The user should use his own API key to use a custom model'\n );\n }\n\n return defaultModel;\n};\n\nconst getLanguageModel = (\n aiOptions: AIOptions,\n apiKey: string,\n defaultModel?: Model\n) => {\n const selectedModel = getModelName(\n aiOptions.provider as AIProvider,\n apiKey,\n aiOptions.model,\n defaultModel\n );\n\n const baseURL = aiOptions.baseURL;\n\n switch (aiOptions.provider) {\n case AIProvider.OPENAI: {\n return createOpenAI({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.ANTHROPIC: {\n return createAnthropic({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.MISTRAL: {\n return createMistral({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.DEEPSEEK: {\n return createDeepSeek({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.GEMINI: {\n return createGoogleGenerativeAI({\n apiKey,\n baseURL,\n })(selectedModel);\n }\n\n case AIProvider.OLLAMA: {\n // Ollama compatible mode:\n const ollama = createOpenAI({\n baseURL: baseURL ?? 'http://localhost:11434/v1',\n apiKey: apiKey ?? 'ollama', // Required but unused by Ollama\n });\n\n return ollama.chat(selectedModel);\n }\n\n default: {\n throw new Error(`Provider ${aiOptions.provider} not supported`);\n }\n }\n};\n\nexport type AIConfig = Omit<Parameters<typeof generateText>[0], 'prompt'> & {\n reasoningEffort?: ReasoningEffort;\n textVerbosity?: 'low' | 'medium' | 'high';\n};\n\nconst DEFAULT_PROVIDER: AIProvider = AIProvider.OPENAI as AIProvider;\nconst DEFAULT_TEMPERATURE: number = 1; // ChatGPT 5 accept only temperature 1\n\nexport type AIConfigOptions = {\n userOptions?: AIOptions;\n defaultOptions?: AIOptions;\n accessType?: AccessType[];\n};\n\n/**\n * Get AI model configuration based on the selected provider and options\n * This function handles the configuration for different AI providers\n *\n * @param options Configuration options including provider, API keys, models and temperature\n * @returns Configured AI model ready to use with generateText\n */\nexport const getAIConfig = async (\n options: AIConfigOptions,\n isAuthenticated: boolean = false\n): Promise<AIConfig> => {\n const {\n userOptions,\n defaultOptions,\n accessType = ['registered_user'],\n } = options;\n\n const aiOptions = {\n provider: DEFAULT_PROVIDER,\n temperature: DEFAULT_TEMPERATURE,\n ...defaultOptions,\n ...userOptions,\n } satisfies AIOptions;\n\n const apiKey = getAPIKey(accessType, aiOptions, isAuthenticated);\n\n // Check if API key is provided\n if (!apiKey) {\n throw new Error(`API key for ${aiOptions.provider} is missing`);\n }\n\n const languageModel = getLanguageModel(\n aiOptions,\n apiKey,\n defaultOptions?.model\n );\n\n return {\n model: languageModel,\n temperature: aiOptions.temperature,\n };\n};\n"],"mappings":";;;;;;;;;;AAwCA,IAAY,oDAAL;AACL;AACA;AACA;AACA;AACA;AACA;;;AA0BF,MAAM,aACJ,YACA,WACA,kBAA2B,UACxB;CACH,MAAM,gBAAgB,QAAQ,IAAI;AAElC,KAAI,WAAW,SAAS,SAAS,CAC/B,QAAO,WAAW,UAAU;AAG9B,KAAI,WAAW,SAAS,SAAS,IAAI,WAAW,OAC9C,QAAO,WAAW;AAGpB,KAAI,WAAW,SAAS,kBAAkB,IAAI,gBAC5C,QAAO,WAAW,UAAU;AAI9B,KAAI,WAAW,SAAS,eAAe,IAAI,gBACzC,QAAO,WAAW,UAAU;;AAMhC,MAAM,gBACJ,UACA,YACA,WACA,eAAsB,iBACZ;AAEV,KAAI,cAAc,aAAa,WAAW,QAAQ;AAChD,MAAI,aAAa,WAAW,OAC1B,QAAO,aAAa;AAGtB,MAAI,UACF,QAAO;AAGT,UAAQ,UAAR;GACE,KAAK,WAAW,UACd,QAAO;GACT,KAAK,WAAW,QACd,QAAO;GACT,KAAK,WAAW,SACd,QAAO;GACT,KAAK,WAAW,OACd,QAAO;GACT,KAAK,WAAW,OACd,QAAO;GACT,QACE,QAAO;;;AAKb,KAAI,aAAa,SACf,OAAM,IAAI,MACR,4DACD;AAGH,QAAO;;AAGT,MAAM,oBACJ,WACA,QACA,iBACG;CACH,MAAM,gBAAgB,aACpB,UAAU,UACV,QACA,UAAU,OACV,aACD;CAED,MAAM,UAAU,UAAU;AAE1B,SAAQ,UAAU,UAAlB;EACE,KAAK,WAAW,OACd,yCAAoB;GAClB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,UACd,+CAAuB;GACrB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,QACd,2CAAqB;GACnB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,SACd,6CAAsB;GACpB;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,OACd,qDAAgC;GAC9B;GACA;GACD,CAAC,CAAC,cAAc;EAGnB,KAAK,WAAW,OAOd,yCAL4B;GAC1B,SAAS,WAAW;GACpB,QAAQ,UAAU;GACnB,CAAC,CAEY,KAAK,cAAc;EAGnC,QACE,OAAM,IAAI,MAAM,YAAY,UAAU,SAAS,gBAAgB;;;AAUrE,MAAMA,mBAA+B,WAAW;AAChD,MAAMC,sBAA8B;;;;;;;;AAepC,MAAa,cAAc,OACzB,SACA,kBAA2B,UACL;CACtB,MAAM,EACJ,aACA,gBACA,aAAa,CAAC,kBAAkB,KAC9B;CAEJ,MAAM,YAAY;EAChB,UAAU;EACV,aAAa;EACb,GAAG;EACH,GAAG;EACJ;CAED,MAAM,SAAS,UAAU,YAAY,WAAW,gBAAgB;AAGhE,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,eAAe,UAAU,SAAS,aAAa;AASjE,QAAO;EACL,OAPoB,iBACpB,WACA,QACA,gBAAgB,MACjB;EAIC,aAAa,UAAU;EACxB"}
@@ -1,5 +1,5 @@
1
1
  const require__utils_asset = require('../_virtual/_utils_asset.cjs');
2
- const require_utils_extractJSON = require('../utils/extractJSON.cjs');
2
+ const require_schemas = require('../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs');
3
3
  let ai = require("ai");
4
4
 
5
5
  //#region src/auditDictionaryMetadata/index.ts
@@ -10,23 +10,38 @@ const aiDefaultOptions = {};
10
10
  * and requests for identifying issues or inconsistencies.
11
11
  */
12
12
  const auditDictionaryMetadata = async ({ fileContent, tags, aiConfig, applicationContext }) => {
13
- const prompt = require__utils_asset.readAsset("./PROMPT.md").replace("{{applicationContext}}", applicationContext ?? "").replace("{{tags}}", tags ? JSON.stringify(tags.map(({ key, description }) => `- ${key}: ${description}`).join("\n\n"), null, 2) : "");
14
- const { text: newContent, usage } = await (0, ai.generateText)({
13
+ const CHAT_GPT_PROMPT = require__utils_asset.readAsset("./PROMPT.md");
14
+ const EXAMPLE_REQUEST = require__utils_asset.readAsset("./EXAMPLE_REQUEST.md");
15
+ const EXAMPLE_RESPONSE = require__utils_asset.readAsset("./EXAMPLE_RESPONSE.md");
16
+ const prompt = CHAT_GPT_PROMPT.replace("{{applicationContext}}", applicationContext ?? "").replace("{{tags}}", tags ? JSON.stringify(tags.map(({ key, description }) => `- ${key}: ${description}`).join("\n\n"), null, 2) : "");
17
+ const { object: object$1, usage } = await (0, ai.generateObject)({
15
18
  ...aiConfig,
16
- messages: [{
17
- role: "system",
18
- content: prompt
19
- }, {
20
- role: "user",
21
- content: [
22
- "**Content declaration to describe:**",
23
- "This is the content declaration that you should consider to describe:",
24
- fileContent
25
- ].join("\n")
26
- }]
19
+ schema: require_schemas.object({
20
+ title: require_schemas.string(),
21
+ description: require_schemas.string(),
22
+ tags: require_schemas.array(require_schemas.string())
23
+ }),
24
+ messages: [
25
+ {
26
+ role: "system",
27
+ content: prompt
28
+ },
29
+ {
30
+ role: "user",
31
+ content: EXAMPLE_REQUEST
32
+ },
33
+ {
34
+ role: "assistant",
35
+ content: EXAMPLE_RESPONSE
36
+ },
37
+ {
38
+ role: "user",
39
+ content: fileContent
40
+ }
41
+ ]
27
42
  });
28
43
  return {
29
- fileContent: require_utils_extractJSON.extractJson(newContent),
44
+ fileContent: object$1,
30
45
  tokenUsed: usage?.totalTokens ?? 0
31
46
  };
32
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["aiDefaultOptions: AIOptions","readAsset","extractJson"],"sources":["../../../src/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { generateText } from 'ai';\nimport type { AIConfig, AIOptions } from '../aiSdk';\nimport { extractJson } from '../utils/extractJSON';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type AuditDictionaryMetadataOptions = {\n fileContent: string;\n tags?: Tag[];\n aiConfig: AIConfig;\n applicationContext?: string;\n};\n\nexport type AuditFileResultData = {\n fileContent: {\n title: string;\n description: string;\n tags: string[];\n };\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n // Keep default options\n};\n\n/**\n * Audits a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const auditDictionaryMetadata = async ({\n fileContent,\n tags,\n aiConfig,\n applicationContext,\n}: AuditDictionaryMetadataOptions): Promise<\n AuditFileResultData | undefined\n> => {\n const CHAT_GPT_PROMPT = readAsset('./PROMPT.md');\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{applicationContext}}',\n applicationContext ?? ''\n ).replace(\n '{{tags}}',\n tags\n ? JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )\n : ''\n );\n\n // Use the AI SDK to generate the completion\n const { text: newContent, usage } = await generateText({\n ...aiConfig,\n messages: [\n { role: 'system', content: prompt },\n {\n role: 'user',\n content: [\n '**Content declaration to describe:**',\n 'This is the content declaration that you should consider to describe:',\n fileContent,\n ].join('\\n'),\n },\n ],\n });\n\n return {\n fileContent: extractJson(newContent),\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;AA0BA,MAAaA,mBAA8B,EAE1C;;;;;;AAOD,MAAa,0BAA0B,OAAO,EAC5C,aACA,MACA,UACA,yBAGG;CAIH,MAAM,SAHkBC,+BAAU,cAAc,CAGjB,QAC7B,0BACA,sBAAsB,GACvB,CAAC,QACA,YACA,OACI,KAAK,UACH,KACG,KAAK,EAAE,KAAK,kBAAkB,KAAK,IAAI,IAAI,cAAc,CACzD,KAAK,OAAO,EACf,MACA,EACD,GACD,GACL;CAGD,MAAM,EAAE,MAAM,YAAY,UAAU,2BAAmB;EACrD,GAAG;EACH,UAAU,CACR;GAAE,MAAM;GAAU,SAAS;GAAQ,EACnC;GACE,MAAM;GACN,SAAS;IACP;IACA;IACA;IACD,CAAC,KAAK,KAAK;GACb,CACF;EACF,CAAC;AAEF,QAAO;EACL,aAAaC,sCAAY,WAAW;EACpC,WAAW,OAAO,eAAe;EAClC"}
1
+ {"version":3,"file":"index.cjs","names":["aiDefaultOptions: AIOptions","readAsset","object"],"sources":["../../../src/auditDictionaryMetadata/index.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { generateObject } from 'ai';\nimport { z } from 'zod';\nimport type { AIConfig, AIOptions } from '../aiSdk';\n\ntype Tag = {\n key: string;\n description?: string;\n};\n\nexport type AuditDictionaryMetadataOptions = {\n fileContent: string;\n tags?: Tag[];\n aiConfig: AIConfig;\n applicationContext?: string;\n};\n\nexport type AuditFileResultData = {\n fileContent: {\n title: string;\n description: string;\n tags: string[];\n };\n tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n // Keep default options\n};\n\n/**\n * Audits a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const auditDictionaryMetadata = async ({\n fileContent,\n tags,\n aiConfig,\n applicationContext,\n}: AuditDictionaryMetadataOptions): Promise<\n AuditFileResultData | undefined\n> => {\n const CHAT_GPT_PROMPT = readAsset('./PROMPT.md');\n const EXAMPLE_REQUEST = readAsset('./EXAMPLE_REQUEST.md');\n const EXAMPLE_RESPONSE = readAsset('./EXAMPLE_RESPONSE.md');\n\n // Prepare the prompt for AI by replacing placeholders with actual values.\n const prompt = CHAT_GPT_PROMPT.replace(\n '{{applicationContext}}',\n applicationContext ?? ''\n ).replace(\n '{{tags}}',\n tags\n ? JSON.stringify(\n tags\n .map(({ key, description }) => `- ${key}: ${description}`)\n .join('\\n\\n'),\n null,\n 2\n )\n : ''\n );\n\n // Use the AI SDK to generate the completion\n const { object, usage } = await generateObject({\n ...aiConfig,\n schema: z.object({\n title: z.string(),\n description: z.string(),\n tags: z.array(z.string()),\n }),\n messages: [\n { role: 'system', content: prompt },\n { role: 'user', content: EXAMPLE_REQUEST },\n { role: 'assistant', content: EXAMPLE_RESPONSE },\n {\n role: 'user',\n content: fileContent,\n },\n ],\n });\n\n return {\n fileContent: object,\n tokenUsed: usage?.totalTokens ?? 0,\n };\n};\n"],"mappings":";;;;;AA0BA,MAAaA,mBAA8B,EAE1C;;;;;;AAOD,MAAa,0BAA0B,OAAO,EAC5C,aACA,MACA,UACA,yBAGG;CACH,MAAM,kBAAkBC,+BAAU,cAAc;CAChD,MAAM,kBAAkBA,+BAAU,uBAAuB;CACzD,MAAM,mBAAmBA,+BAAU,wBAAwB;CAG3D,MAAM,SAAS,gBAAgB,QAC7B,0BACA,sBAAsB,GACvB,CAAC,QACA,YACA,OACI,KAAK,UACH,KACG,KAAK,EAAE,KAAK,kBAAkB,KAAK,IAAI,IAAI,cAAc,CACzD,KAAK,OAAO,EACf,MACA,EACD,GACD,GACL;CAGD,MAAM,EAAE,kBAAQ,UAAU,6BAAqB;EAC7C,GAAG;EACH,+BAAiB;GACf,+BAAiB;GACjB,qCAAuB;GACvB,oDAAwB,CAAC;GAC1B,CAAC;EACF,UAAU;GACR;IAAE,MAAM;IAAU,SAAS;IAAQ;GACnC;IAAE,MAAM;IAAQ,SAAS;IAAiB;GAC1C;IAAE,MAAM;IAAa,SAAS;IAAkB;GAChD;IACE,MAAM;IACN,SAAS;IACV;GACF;EACF,CAAC;AAEF,QAAO;EACL,aAAaC;EACb,WAAW,OAAO,eAAe;EAClC"}
@@ -1,8 +1,8 @@
1
1
  const require_aiSdk = require('./aiSdk.cjs');
2
2
  const require_customQuery = require('./customQuery.cjs');
3
- const require_utils_extractJSON = require('./utils/extractJSON.cjs');
4
3
  const require_auditDictionaryMetadata_index = require('./auditDictionaryMetadata/index.cjs');
5
4
  const require_translateJSON_index = require('./translateJSON/index.cjs');
5
+ const require_utils_extractJSON = require('./utils/extractJSON.cjs');
6
6
  let ai = require("ai");
7
7
 
8
8
  exports.AIProvider = require_aiSdk.AIProvider;
@@ -0,0 +1,30 @@
1
+ const require_core = require('../core/core.cjs');
2
+ const require_util = require('../core/util.cjs');
3
+ const require_errors = require('../core/errors.cjs');
4
+
5
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.js
6
+ const initializer = (inst, issues) => {
7
+ require_errors.$ZodError.init(inst, issues);
8
+ inst.name = "ZodError";
9
+ Object.defineProperties(inst, {
10
+ format: { value: (mapper) => require_errors.formatError(inst, mapper) },
11
+ flatten: { value: (mapper) => require_errors.flattenError(inst, mapper) },
12
+ addIssue: { value: (issue) => {
13
+ inst.issues.push(issue);
14
+ inst.message = JSON.stringify(inst.issues, require_util.jsonStringifyReplacer, 2);
15
+ } },
16
+ addIssues: { value: (issues$1) => {
17
+ inst.issues.push(...issues$1);
18
+ inst.message = JSON.stringify(inst.issues, require_util.jsonStringifyReplacer, 2);
19
+ } },
20
+ isEmpty: { get() {
21
+ return inst.issues.length === 0;
22
+ } }
23
+ });
24
+ };
25
+ const ZodError = require_core.$constructor("ZodError", initializer);
26
+ const ZodRealError = require_core.$constructor("ZodError", initializer, { Parent: Error });
27
+
28
+ //#endregion
29
+ exports.ZodRealError = ZodRealError;
30
+ //# sourceMappingURL=errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.cjs","names":["issues"],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.js"],"sourcesContent":["import * as core from \"../core/index.js\";\nimport { $ZodError } from \"../core/index.js\";\nimport * as util from \"../core/util.js\";\nconst initializer = (inst, issues) => {\n $ZodError.init(inst, issues);\n inst.name = \"ZodError\";\n Object.defineProperties(inst, {\n format: {\n value: (mapper) => core.formatError(inst, mapper),\n // enumerable: false,\n },\n flatten: {\n value: (mapper) => core.flattenError(inst, mapper),\n // enumerable: false,\n },\n addIssue: {\n value: (issue) => {\n inst.issues.push(issue);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n addIssues: {\n value: (issues) => {\n inst.issues.push(...issues);\n inst.message = JSON.stringify(inst.issues, util.jsonStringifyReplacer, 2);\n },\n // enumerable: false,\n },\n isEmpty: {\n get() {\n return inst.issues.length === 0;\n },\n // enumerable: false,\n },\n });\n // Object.defineProperty(inst, \"isEmpty\", {\n // get() {\n // return inst.issues.length === 0;\n // },\n // });\n};\nexport const ZodError = core.$constructor(\"ZodError\", initializer);\nexport const ZodRealError = core.$constructor(\"ZodError\", initializer, {\n Parent: Error,\n});\n// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */\n// export type ErrorMapCtx = core.$ZodErrorMapCtx;\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAGA,MAAM,eAAe,MAAM,WAAW;AAClC,0BAAU,KAAK,MAAM,OAAO;AAC5B,MAAK,OAAO;AACZ,QAAO,iBAAiB,MAAM;EAC1B,QAAQ,EACJ,QAAQ,sCAA4B,MAAM,OAAO,EAEpD;EACD,SAAS,EACL,QAAQ,uCAA6B,MAAM,OAAO,EAErD;EACD,UAAU,EACN,QAAQ,UAAU;AACd,QAAK,OAAO,KAAK,MAAM;AACvB,QAAK,UAAU,KAAK,UAAU,KAAK,4CAAoC,EAAE;KAGhF;EACD,WAAW,EACP,QAAQ,aAAW;AACf,QAAK,OAAO,KAAK,GAAGA,SAAO;AAC3B,QAAK,UAAU,KAAK,UAAU,KAAK,4CAAoC,EAAE;KAGhF;EACD,SAAS,EACL,MAAM;AACF,UAAO,KAAK,OAAO,WAAW;KAGrC;EACJ,CAAC;;AAON,MAAa,qCAA6B,YAAY,YAAY;AAClE,MAAa,yCAAiC,YAAY,aAAa,EACnE,QAAQ,OACX,CAAC"}
@@ -0,0 +1,41 @@
1
+ const require_core = require('../core/core.cjs');
2
+ const require_schemas = require('../core/schemas.cjs');
3
+ const require_api = require('../core/api.cjs');
4
+ const require_schemas$1 = require('./schemas.cjs');
5
+
6
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.js
7
+ const ZodISODateTime = /* @__PURE__ */ require_core.$constructor("ZodISODateTime", (inst, def) => {
8
+ require_schemas.$ZodISODateTime.init(inst, def);
9
+ require_schemas$1.ZodStringFormat.init(inst, def);
10
+ });
11
+ function datetime(params) {
12
+ return require_api._isoDateTime(ZodISODateTime, params);
13
+ }
14
+ const ZodISODate = /* @__PURE__ */ require_core.$constructor("ZodISODate", (inst, def) => {
15
+ require_schemas.$ZodISODate.init(inst, def);
16
+ require_schemas$1.ZodStringFormat.init(inst, def);
17
+ });
18
+ function date(params) {
19
+ return require_api._isoDate(ZodISODate, params);
20
+ }
21
+ const ZodISOTime = /* @__PURE__ */ require_core.$constructor("ZodISOTime", (inst, def) => {
22
+ require_schemas.$ZodISOTime.init(inst, def);
23
+ require_schemas$1.ZodStringFormat.init(inst, def);
24
+ });
25
+ function time(params) {
26
+ return require_api._isoTime(ZodISOTime, params);
27
+ }
28
+ const ZodISODuration = /* @__PURE__ */ require_core.$constructor("ZodISODuration", (inst, def) => {
29
+ require_schemas.$ZodISODuration.init(inst, def);
30
+ require_schemas$1.ZodStringFormat.init(inst, def);
31
+ });
32
+ function duration(params) {
33
+ return require_api._isoDuration(ZodISODuration, params);
34
+ }
35
+
36
+ //#endregion
37
+ exports.date = date;
38
+ exports.datetime = datetime;
39
+ exports.duration = duration;
40
+ exports.time = time;
41
+ //# sourceMappingURL=iso.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iso.cjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.js"],"sourcesContent":["import * as core from \"../core/index.js\";\nimport * as schemas from \"./schemas.js\";\nexport const ZodISODateTime = /*@__PURE__*/ core.$constructor(\"ZodISODateTime\", (inst, def) => {\n core.$ZodISODateTime.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function datetime(params) {\n return core._isoDateTime(ZodISODateTime, params);\n}\nexport const ZodISODate = /*@__PURE__*/ core.$constructor(\"ZodISODate\", (inst, def) => {\n core.$ZodISODate.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function date(params) {\n return core._isoDate(ZodISODate, params);\n}\nexport const ZodISOTime = /*@__PURE__*/ core.$constructor(\"ZodISOTime\", (inst, def) => {\n core.$ZodISOTime.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function time(params) {\n return core._isoTime(ZodISOTime, params);\n}\nexport const ZodISODuration = /*@__PURE__*/ core.$constructor(\"ZodISODuration\", (inst, def) => {\n core.$ZodISODuration.init(inst, def);\n schemas.ZodStringFormat.init(inst, def);\n});\nexport function duration(params) {\n return core._isoDuration(ZodISODuration, params);\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAEA,MAAa,iBAA+B,0CAAkB,mBAAmB,MAAM,QAAQ;AAC3F,iCAAqB,KAAK,MAAM,IAAI;AACpC,mCAAwB,KAAK,MAAM,IAAI;EACzC;AACF,SAAgB,SAAS,QAAQ;AAC7B,iCAAyB,gBAAgB,OAAO;;AAEpD,MAAa,aAA2B,0CAAkB,eAAe,MAAM,QAAQ;AACnF,6BAAiB,KAAK,MAAM,IAAI;AAChC,mCAAwB,KAAK,MAAM,IAAI;EACzC;AACF,SAAgB,KAAK,QAAQ;AACzB,6BAAqB,YAAY,OAAO;;AAE5C,MAAa,aAA2B,0CAAkB,eAAe,MAAM,QAAQ;AACnF,6BAAiB,KAAK,MAAM,IAAI;AAChC,mCAAwB,KAAK,MAAM,IAAI;EACzC;AACF,SAAgB,KAAK,QAAQ;AACzB,6BAAqB,YAAY,OAAO;;AAE5C,MAAa,iBAA+B,0CAAkB,mBAAmB,MAAM,QAAQ;AAC3F,iCAAqB,KAAK,MAAM,IAAI;AACpC,mCAAwB,KAAK,MAAM,IAAI;EACzC;AACF,SAAgB,SAAS,QAAQ;AAC7B,iCAAyB,gBAAgB,OAAO"}
@@ -0,0 +1,31 @@
1
+ const require_parse = require('../core/parse.cjs');
2
+ const require_errors = require('./errors.cjs');
3
+
4
+ //#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.js
5
+ const parse = /* @__PURE__ */ require_parse._parse(require_errors.ZodRealError);
6
+ const parseAsync = /* @__PURE__ */ require_parse._parseAsync(require_errors.ZodRealError);
7
+ const safeParse = /* @__PURE__ */ require_parse._safeParse(require_errors.ZodRealError);
8
+ const safeParseAsync = /* @__PURE__ */ require_parse._safeParseAsync(require_errors.ZodRealError);
9
+ const encode = /* @__PURE__ */ require_parse._encode(require_errors.ZodRealError);
10
+ const decode = /* @__PURE__ */ require_parse._decode(require_errors.ZodRealError);
11
+ const encodeAsync = /* @__PURE__ */ require_parse._encodeAsync(require_errors.ZodRealError);
12
+ const decodeAsync = /* @__PURE__ */ require_parse._decodeAsync(require_errors.ZodRealError);
13
+ const safeEncode = /* @__PURE__ */ require_parse._safeEncode(require_errors.ZodRealError);
14
+ const safeDecode = /* @__PURE__ */ require_parse._safeDecode(require_errors.ZodRealError);
15
+ const safeEncodeAsync = /* @__PURE__ */ require_parse._safeEncodeAsync(require_errors.ZodRealError);
16
+ const safeDecodeAsync = /* @__PURE__ */ require_parse._safeDecodeAsync(require_errors.ZodRealError);
17
+
18
+ //#endregion
19
+ exports.decode = decode;
20
+ exports.decodeAsync = decodeAsync;
21
+ exports.encode = encode;
22
+ exports.encodeAsync = encodeAsync;
23
+ exports.parse = parse;
24
+ exports.parseAsync = parseAsync;
25
+ exports.safeDecode = safeDecode;
26
+ exports.safeDecodeAsync = safeDecodeAsync;
27
+ exports.safeEncode = safeEncode;
28
+ exports.safeEncodeAsync = safeEncodeAsync;
29
+ exports.safeParse = safeParse;
30
+ exports.safeParseAsync = safeParseAsync;
31
+ //# sourceMappingURL=parse.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.cjs","names":["ZodRealError"],"sources":["../../../../../../../../../../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.js"],"sourcesContent":["import * as core from \"../core/index.js\";\nimport { ZodRealError } from \"./errors.js\";\nexport const parse = /* @__PURE__ */ core._parse(ZodRealError);\nexport const parseAsync = /* @__PURE__ */ core._parseAsync(ZodRealError);\nexport const safeParse = /* @__PURE__ */ core._safeParse(ZodRealError);\nexport const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodRealError);\n// Codec functions\nexport const encode = /* @__PURE__ */ core._encode(ZodRealError);\nexport const decode = /* @__PURE__ */ core._decode(ZodRealError);\nexport const encodeAsync = /* @__PURE__ */ core._encodeAsync(ZodRealError);\nexport const decodeAsync = /* @__PURE__ */ core._decodeAsync(ZodRealError);\nexport const safeEncode = /* @__PURE__ */ core._safeEncode(ZodRealError);\nexport const safeDecode = /* @__PURE__ */ core._safeDecode(ZodRealError);\nexport const safeEncodeAsync = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError);\nexport const safeDecodeAsync = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError);\n"],"x_google_ignoreList":[0],"mappings":";;;;AAEA,MAAa,QAAwB,qCAAYA,4BAAa;AAC9D,MAAa,aAA6B,0CAAiBA,4BAAa;AACxE,MAAa,YAA4B,yCAAgBA,4BAAa;AACtE,MAAa,iBAAiC,8CAAqBA,4BAAa;AAEhF,MAAa,SAAyB,sCAAaA,4BAAa;AAChE,MAAa,SAAyB,sCAAaA,4BAAa;AAChE,MAAa,cAA8B,2CAAkBA,4BAAa;AAC1E,MAAa,cAA8B,2CAAkBA,4BAAa;AAC1E,MAAa,aAA6B,0CAAiBA,4BAAa;AACxE,MAAa,aAA6B,0CAAiBA,4BAAa;AACxE,MAAa,kBAAkC,+CAAsBA,4BAAa;AAClF,MAAa,kBAAkC,+CAAsBA,4BAAa"}