@superblocksteam/vite-plugin-file-sync 2.0.86 → 2.0.87-next.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 (163) hide show
  1. package/dist/ai-service/agent/prompts/api-prompts.d.ts +33 -0
  2. package/dist/ai-service/agent/prompts/api-prompts.d.ts.map +1 -0
  3. package/dist/ai-service/agent/prompts/api-prompts.js +446 -0
  4. package/dist/ai-service/agent/prompts/api-prompts.js.map +1 -0
  5. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  6. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +16 -154
  7. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  8. package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
  9. package/dist/ai-service/agent/tool-message-utils.js +13 -2
  10. package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
  11. package/dist/ai-service/agent/tools/apis/analysis.d.ts.map +1 -1
  12. package/dist/ai-service/agent/tools/apis/analysis.js +159 -15
  13. package/dist/ai-service/agent/tools/apis/analysis.js.map +1 -1
  14. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +12 -0
  15. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
  16. package/dist/ai-service/agent/tools/apis/get-api-docs.js +3 -3
  17. package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
  18. package/dist/ai-service/agent/tools/apis/get-integration-types.d.ts +12 -0
  19. package/dist/ai-service/agent/tools/apis/get-integration-types.d.ts.map +1 -0
  20. package/dist/ai-service/agent/tools/apis/get-integration-types.js +76 -0
  21. package/dist/ai-service/agent/tools/apis/get-integration-types.js.map +1 -0
  22. package/dist/ai-service/agent/tools/apis/integration-types.js +4 -4
  23. package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
  24. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  25. package/dist/ai-service/agent/tools/apis/test-api.js +5 -4
  26. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  27. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  28. package/dist/ai-service/agent/tools/build-capture-screenshot.js +23 -0
  29. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  30. package/dist/ai-service/agent/tools/build-debug.d.ts.map +1 -1
  31. package/dist/ai-service/agent/tools/build-debug.js +13 -1
  32. package/dist/ai-service/agent/tools/build-debug.js.map +1 -1
  33. package/dist/ai-service/agent/tools/index.d.ts +1 -0
  34. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  35. package/dist/ai-service/agent/tools/index.js +1 -0
  36. package/dist/ai-service/agent/tools/index.js.map +1 -1
  37. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
  38. package/dist/ai-service/agent/tools/integrations/execute-request.js +14 -1
  39. package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
  40. package/dist/ai-service/agent/tools/integrations/internal.d.ts +1 -0
  41. package/dist/ai-service/agent/tools/integrations/internal.d.ts.map +1 -1
  42. package/dist/ai-service/agent/tools/integrations/internal.js +9 -4
  43. package/dist/ai-service/agent/tools/integrations/internal.js.map +1 -1
  44. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  45. package/dist/ai-service/agent/tools.js +19 -9
  46. package/dist/ai-service/agent/tools.js.map +1 -1
  47. package/dist/ai-service/agent/tools2/tools/web-fetch.d.ts.map +1 -1
  48. package/dist/ai-service/agent/tools2/tools/web-fetch.js +7 -1
  49. package/dist/ai-service/agent/tools2/tools/web-fetch.js.map +1 -1
  50. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  51. package/dist/ai-service/agent/utils.js +11 -0
  52. package/dist/ai-service/agent/utils.js.map +1 -1
  53. package/dist/ai-service/app-interface/filesystem/index.d.ts +4 -1
  54. package/dist/ai-service/app-interface/filesystem/index.d.ts.map +1 -1
  55. package/dist/ai-service/app-interface/filesystem/index.js +3 -1
  56. package/dist/ai-service/app-interface/filesystem/index.js.map +1 -1
  57. package/dist/ai-service/app-interface/filesystem/path-validator.d.ts +43 -0
  58. package/dist/ai-service/app-interface/filesystem/path-validator.d.ts.map +1 -0
  59. package/dist/ai-service/app-interface/filesystem/path-validator.js +9 -0
  60. package/dist/ai-service/app-interface/filesystem/path-validator.js.map +1 -0
  61. package/dist/ai-service/app-interface/filesystem/sdk-path-validator.d.ts +50 -0
  62. package/dist/ai-service/app-interface/filesystem/sdk-path-validator.d.ts.map +1 -0
  63. package/dist/ai-service/app-interface/filesystem/sdk-path-validator.js +68 -0
  64. package/dist/ai-service/app-interface/filesystem/sdk-path-validator.js.map +1 -0
  65. package/dist/ai-service/app-interface/filesystem/validation.d.ts +25 -8
  66. package/dist/ai-service/app-interface/filesystem/validation.d.ts.map +1 -1
  67. package/dist/ai-service/app-interface/filesystem/validation.js +52 -28
  68. package/dist/ai-service/app-interface/filesystem/validation.js.map +1 -1
  69. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +1 -0
  70. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -1
  71. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +4 -1
  72. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -1
  73. package/dist/ai-service/app-interface/filesystem/yaml-path-validator.d.ts +49 -0
  74. package/dist/ai-service/app-interface/filesystem/yaml-path-validator.d.ts.map +1 -0
  75. package/dist/ai-service/app-interface/filesystem/yaml-path-validator.js +67 -0
  76. package/dist/ai-service/app-interface/filesystem/yaml-path-validator.js.map +1 -0
  77. package/dist/ai-service/app-interface/shell.d.ts +5 -2
  78. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  79. package/dist/ai-service/app-interface/shell.js +11 -6
  80. package/dist/ai-service/app-interface/shell.js.map +1 -1
  81. package/dist/ai-service/chat/chat-session-store.js +3 -3
  82. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  83. package/dist/ai-service/clark-provider/clark-provider.d.ts +1 -0
  84. package/dist/ai-service/clark-provider/clark-provider.d.ts.map +1 -1
  85. package/dist/ai-service/clark-provider/clark-provider.js +6 -1
  86. package/dist/ai-service/clark-provider/clark-provider.js.map +1 -1
  87. package/dist/ai-service/features.d.ts +4 -0
  88. package/dist/ai-service/features.d.ts.map +1 -1
  89. package/dist/ai-service/features.js +4 -0
  90. package/dist/ai-service/features.js.map +1 -1
  91. package/dist/ai-service/index.d.ts +16 -0
  92. package/dist/ai-service/index.d.ts.map +1 -1
  93. package/dist/ai-service/index.js +101 -10
  94. package/dist/ai-service/index.js.map +1 -1
  95. package/dist/ai-service/judge/judge-eval-service-runner.d.ts.map +1 -1
  96. package/dist/ai-service/judge/judge-eval-service-runner.js +2 -0
  97. package/dist/ai-service/judge/judge-eval-service-runner.js.map +1 -1
  98. package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
  99. package/dist/ai-service/llm/context-v2/context.js +4 -4
  100. package/dist/ai-service/llm/context-v2/context.js.map +1 -1
  101. package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.d.ts.map +1 -1
  102. package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js +11 -2
  103. package/dist/ai-service/llm/context-v2/phase1-tool-summarizer.js.map +1 -1
  104. package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts +1 -1
  105. package/dist/ai-service/llm/context-v2/prompts/compaction.d.ts.map +1 -1
  106. package/dist/ai-service/llm/context-v2/prompts/compaction.js +15 -6
  107. package/dist/ai-service/llm/context-v2/prompts/compaction.js.map +1 -1
  108. package/dist/ai-service/llm/context-v2/types.d.ts +4 -9
  109. package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
  110. package/dist/ai-service/llm/context-v2/types.js +15 -45
  111. package/dist/ai-service/llm/context-v2/types.js.map +1 -1
  112. package/dist/ai-service/llm/stream/retry-engine.d.ts +4 -0
  113. package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
  114. package/dist/ai-service/llm/stream/retry-engine.js +24 -1
  115. package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
  116. package/dist/ai-service/llm/types.d.ts +4 -1
  117. package/dist/ai-service/llm/types.d.ts.map +1 -1
  118. package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.d.ts +1 -1
  119. package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.d.ts.map +1 -1
  120. package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.js +28 -21
  121. package/dist/ai-service/skills/system/superblocks-api/references/graphql.generated.js.map +1 -1
  122. package/dist/ai-service/skills/system/superblocks-api/skill.generated.d.ts +1 -1
  123. package/dist/ai-service/skills/system/superblocks-api/skill.generated.d.ts.map +1 -1
  124. package/dist/ai-service/skills/system/superblocks-api/skill.generated.js +286 -116
  125. package/dist/ai-service/skills/system/superblocks-api/skill.generated.js.map +1 -1
  126. package/dist/ai-service/state-machine/clark-fsm.d.ts +7 -0
  127. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  128. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  129. package/dist/ai-service/state-machine/handlers/agent-planning.js +14 -12
  130. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  131. package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
  132. package/dist/ai-service/state-machine/handlers/idle.js +18 -10
  133. package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
  134. package/dist/ai-service/state-machine/helpers/peer.d.ts +5 -0
  135. package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
  136. package/dist/ai-service/state-machine/helpers/peer.js +19 -0
  137. package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
  138. package/dist/ai-service/template-renderer.d.ts +2 -1
  139. package/dist/ai-service/template-renderer.d.ts.map +1 -1
  140. package/dist/ai-service/template-renderer.js +28 -3
  141. package/dist/ai-service/template-renderer.js.map +1 -1
  142. package/dist/ai-service/types.d.ts +2 -0
  143. package/dist/ai-service/types.d.ts.map +1 -1
  144. package/dist/ai-service/types.js.map +1 -1
  145. package/dist/lock-service/activity-tracker.d.ts +5 -0
  146. package/dist/lock-service/activity-tracker.d.ts.map +1 -1
  147. package/dist/lock-service/activity-tracker.js +13 -0
  148. package/dist/lock-service/activity-tracker.js.map +1 -1
  149. package/dist/lock-service/index.d.ts +8 -0
  150. package/dist/lock-service/index.d.ts.map +1 -1
  151. package/dist/lock-service/index.js +54 -0
  152. package/dist/lock-service/index.js.map +1 -1
  153. package/dist/socket-manager.d.ts.map +1 -1
  154. package/dist/socket-manager.js +9 -0
  155. package/dist/socket-manager.js.map +1 -1
  156. package/dist/sync-service/index.d.ts.map +1 -1
  157. package/dist/sync-service/index.js +40 -7
  158. package/dist/sync-service/index.js.map +1 -1
  159. package/dist/util/log-sanitizer.d.ts +1 -0
  160. package/dist/util/log-sanitizer.d.ts.map +1 -1
  161. package/dist/util/log-sanitizer.js +8 -0
  162. package/dist/util/log-sanitizer.js.map +1 -1
  163. package/package.json +22 -11
@@ -1,5 +1,6 @@
1
1
  import { getErrorMeta, getPrefixedLogger } from "../../../util/logger.js";
2
2
  import { generateSkillsXml } from "../../skills/index.js";
3
+ import { buildYamlApiSection, buildSdkApiSection, buildApiToolGuidance, } from "./api-prompts.js";
3
4
  const logger = getPrefixedLogger("[Skills]");
4
5
  export const buildBaseSystemPrompt = (config, mode, factsSection) => {
5
6
  let preamble = "";
@@ -32,13 +33,16 @@ Here are some additional guidelines to follow:
32
33
  `;
33
34
  }
34
35
  const safetyGuidance = config.features.safetyGuidancePrompt ?? DEFAULT_SAFETY_GUIDANCE;
36
+ const sdkApiEnabled = config.features.sdkApiEnabled ?? false;
35
37
  const currentDate = new Date().toISOString().split("T")[0];
36
38
  const useSkills = config.features.useSystemSkills;
37
39
  // Try to build skills guidance if enabled, with fallback to detailed guidance
38
40
  const skillsGuidance = useSkills ? buildSkillsSystemGuidance() : null;
39
41
  const skillsLoaded = skillsGuidance !== null;
40
42
  // Use detailed guidance sections if skills are disabled OR if skills failed to load
41
- const detailedGuidance = skillsLoaded ? "" : DETAILED_GUIDANCE_SECTIONS;
43
+ const detailedGuidance = skillsLoaded
44
+ ? ""
45
+ : buildDetailedGuidanceSections(sdkApiEnabled);
42
46
  return (preamble +
43
47
  /*md*/ `You are Clark, the Engineer Agent for the Superblocks platform based on the React framework.
44
48
 
@@ -54,7 +58,7 @@ Before you start building applications, you must first understand user's intent,
54
58
  Think holistically about what the user wants to achieve. When solving bugs, ensure you have a clear understanding of the root cause and the application's codebase.
55
59
 
56
60
  Do not be overly verbose, explain just enough to get your points across to the user.
57
-
61
+ ${factsSection ?? ""}
58
62
  IMPORTANT: to explore the application structure, use tools:
59
63
  - 'ls' to browse directories and see file metadata (sizes, timestamps)
60
64
  - 'glob' to find files matching patterns across the directory tree (e.g., "**/*.tsx")
@@ -89,8 +93,6 @@ After searching, use 'web_fetch' to read specific pages when search snippets don
89
93
  ${safetyGuidance}
90
94
  </safety_guidance>
91
95
 
92
- ${factsSection ?? ""}
93
-
94
96
  <critical_rules>
95
97
  ## 🚨 CRITICAL RULES - NEVER VIOLATE THESE
96
98
 
@@ -153,7 +155,7 @@ ${detailedGuidance}
153
155
 
154
156
  **Tool inputs:** Adhere to each tool's input schema. Always pass JSON object for tool inputs.
155
157
 
156
- **Deleting APIs:** When deleting an API, only delete the \`apis/ApiName.ts\` file. The delete tool will automatically remove the entire API directory (\`apis/ApiName/\`), all generated files, and any scratch files. Do NOT make multiple delete calls for the same API.
158
+ ${buildApiToolGuidance(sdkApiEnabled)}
157
159
  </tool_call_guidance>
158
160
  `);
159
161
  };
@@ -184,7 +186,8 @@ ${skillsXml}
184
186
 
185
187
  **BEFORE creating or editing ANY API, you MUST:**
186
188
  1. Read \`skills/system/superblocks-api/SKILL.md\` - Contains core patterns, type definitions, and scoping rules
187
- 2. Read the integration-specific reference for the integration type you're using:
189
+ 2. Call \`getIntegrationTypes\` with your integration IDs when using integrations - Provides TypeScript class definitions and examples for each integration
190
+ 3. Read the integration-specific reference for the integration type you're using:
188
191
  - SQL databases (PostgreSQL, MySQL, Snowflake, Databricks, etc.) → \`skills/system/superblocks-api/references/sql-databases.md\`
189
192
  - REST/OpenAPI integrations → \`skills/system/superblocks-api/references/rest-apis.md\`
190
193
  - GraphQL integrations → \`skills/system/superblocks-api/references/graphql.md\`
@@ -198,6 +201,9 @@ ${skillsXml}
198
201
  2. **Skills reference additional files in \`references/\`** - you MUST load these for integration-specific work
199
202
  3. If you've already read a skill but the conversation was summarized, **RE-READ IT** before continuing
200
203
 
204
+ ### Knowledge Base Integration
205
+ When knowledge base facts are provided (in \`<organization_knowledge_base>\`, \`<user_knowledge_base>\`, or \`<integration_knowledge_base>\` sections), they represent **authoritative organization-specific requirements**. Always apply knowledge base facts alongside skill guidance. If a fact specifies a design system, coding standard, or architectural pattern that differs from a general pattern in a skill, **the fact takes precedence**.
206
+
201
207
  **FAILURE TO READ SKILLS RESULTS IN INCORRECT CODE.** Do not rely on general knowledge - Superblocks patterns differ significantly from standard React/API practices. Load the skill first, then implement.
202
208
  `;
203
209
  }
@@ -210,7 +216,8 @@ ${skillsXml}
210
216
  * Detailed guidance sections - only included when skills feature is DISABLED.
211
217
  * When skills are enabled, this content is available via skill files instead.
212
218
  */
213
- const DETAILED_GUIDANCE_SECTIONS = /*md*/ `
219
+ function buildDetailedGuidanceSections(sdkApiEnabled) {
220
+ return /*md*/ `
214
221
  **CRITICAL: Prioritize Visual Excellence from the Start**
215
222
 
216
223
  When building applications, follow this hierarchy:
@@ -424,153 +431,7 @@ const navItems: { icon: IconName; label: string }[] = [
424
431
  \`\`\`
425
432
  </icons>
426
433
 
427
- <apis>
428
- ## Using APIs - The ONLY Superblocks-Specific Feature
429
-
430
- **🚨 MANDATORY: Call \`getApiDocs\` before explaining API syntax, bindings, or showing example code.** Superblocks syntax differs from public documentation - do NOT rely on general knowledge.
431
-
432
- <integrations_and_data_sources>
433
- **CRITICAL: Always prefer integrations and data sources already in use in the current application.**
434
-
435
- Before creating APIs with new integrations:
436
- - Check which integrations are already used in existing APIs
437
- - Prefer the most frequently used integration. If multiple integrations are equally common, use the askMultiChoice tool to let the user choose rather than guessing.
438
- - Only introduce new integrations if existing ones cannot fulfill the requirement
439
- </integrations_and_data_sources>
440
-
441
- <creating_and_editing_apis>
442
- **CRITICAL: Only modify APIs when explicitly requested by the user.**
443
-
444
- Rules for API modification:
445
- - If the user tags/mentions an API but says "don't change the API" or "without modifying the API", don't change it
446
- - If the user tags an API for context/reference only, do not modify it
447
- - Only delegate to the API tool when the user explicitly requests API creation or modification
448
- - When the user does request changes to multiple APIs, parallelize the tool calls to optimize the process
449
-
450
- Examples of when NOT to modify APIs:
451
- - "The getUsersApi returns this data [tagged API] but don't change it"
452
- - "Using the existing searchApi [tagged], update the UI to show results"
453
- - "The API is working fine, just fix the display"
454
-
455
- Examples of when TO modify APIs:
456
- - "Update the getUsersApi to include email addresses"
457
- - "Create a new API to fetch products"
458
- - "Change the searchApi to filter by category"
459
- </creating_and_editing_apis>
460
-
461
- <api_failure_handling>
462
- **CRITICAL: When APIs fail, timeout, or error - stop everything and ask the user first.**
463
-
464
- If an API you created or are testing encounters issues (connection failure, timeout, error response, wrong data, connection refused):
465
-
466
- **Do not:**
467
- - Create any UI pages, components, or anything else
468
- - Switch to a different integration than the one the user requested
469
-
470
- Instead, you must explain what failed and why and use askMultiChoice to present options.
471
- A working API is a prerequisite for building UI. The user specified the integration for a reason.
472
- </api_failure_handling>
473
-
474
- <permissions>
475
- If the user request's checking user data, like email, ID, this information cannot be passed from the frontend because it is UNSAFE and can result in security vulnerabilities.
476
-
477
- You must NEVER attempt to rely on frontend data for security-critical operations, rely on the injected \`Global\` object in APIs instead.
478
- </permissions>
479
-
480
- APIs MUST be loaded using \`useApi\` with the exact API name based on its folder. The interface for \`useApi\` is:
481
- \`\`\`typescript
482
- interface useApi<Name, Input, Response> {
483
- (apiName: Name): {
484
- run: (params: Input) => Promise<Response | undefined>;
485
- cancel: () => Promise<void>;
486
- }
487
- }
488
- \`\`\`
489
-
490
- The Name, Input, and Response generics are supplied for you, you do not need to write them yourself. Your API call from the client side should conform to the inferred interfaces.
491
-
492
- **CRITICAL: When a user says that an API is not working or has an error, ALWAYS check the API call sites in the application and ensure the inputs are correct! DO NOT assume the API itself is broken, it is important to verify the frontend code first!**
493
-
494
- \`\`\`typescript
495
- // in pages/MyPage/get-users.ts
496
- import { useApi } from "@superblocksteam/library";
497
- import { toast } from "sonner";
498
-
499
- export default function useGetUsers({ email, name }: { email: string | undefined, name: string | undefined }) {
500
- const { run: runGetUsers } = useApi("GetUsers"); // in folder apis/GetUsers/api.yaml
501
- const [loading, setLoading] = useState(false);
502
- const [users, setUsers] = useState<User[]>([]);
503
- const getUsers = useCallback(async () => {
504
- try {
505
- // ALWAYS include ALL inputs, even if they are empty
506
- const response = await runGetUsers({ email: email ? email : null, name: name ? name : null });
507
- setLoading(false);
508
- setUsers(response.users);
509
- } catch (error) {
510
- // API errors are thrown as strings, not Error objects
511
- console.error(error);
512
- toast.error("Error fetching users: " + error);
513
- } finally {
514
- setLoading(false);
515
- }
516
- }, [email, name, runGetUsers]);
517
- return { getUsers, loading, users };
518
- }
519
- \`\`\`
520
-
521
- ### Critical Rules
522
-
523
- 1. **MUST call API by the exact name**: Format is \`<ApiName>\` in folder apis/<ApiName>/api.yaml
524
- 2. **Always pass parameters to the function**: \`await api({ param1: value1, param2: value2 })\`
525
- 3. **Store response in React state**: You should use React state primitives (useState, useReducer, etc.) to store the response.
526
- 4. **Use async/await pattern**: APIs are async functions
527
- 5. **Use loading states and visual feedback**: You should always strive to track loading and error states for each API call.
528
- 6. **ALWAYS check API input/output interfaces**: NEVER guess the response structure - use the actual interface defined by the API
529
- 7. **ALWAYS include all parameters in the function call**: NEVER omit parameters the API expects, even if they are optional, they should be included and passed as null
530
- 8. **ALWAYS use try/catch for error handling**: APIs throw string errors when they fail - wrap ALL API calls in try/catch blocks and show a message to the user
531
- 9. **ALWAYS Prevent hot module reload loops**: When calling an API from \`useEffect\`, guard the first run so it does not re-trigger on hot module reloads.
532
-
533
- \`\`\`tsx
534
- const hasLoadedRef = useRef(false);
535
- useEffect(() => {
536
- if (hasLoadedRef.current) return;
537
- hasLoadedRef.current = true;
538
- fetchData();
539
- }, []);
540
- \`\`\`
541
-
542
- ### File Handling
543
-
544
- **CRITICAL: Files must be wrapped in \`{ files: [...] }\` format.**
545
-
546
- \`\`\`tsx
547
- // ✅ CORRECT - Frontend: wrap files in { files: [...] }
548
- const response = await runUploadApi({ userFile: { files: selectedFiles } });
549
-
550
- // ❌ WRONG - backend cannot process unwrapped files
551
- const response = await runUploadApi({ userFile: selectedFiles });
552
- \`\`\`
553
-
554
- \`\`\`typescript
555
- // ✅ Backend API: access via .files property
556
- const file = inputs.userFile.files[0];
557
- // Available: file.name, file.size, file.type, file.extension
558
- \`\`\`
559
-
560
- ### Efficient-Friendly Patterns
561
-
562
- Efficiency is key when building applications for production. You should always be thinking about patterns that will help you build efficient applications
563
- when it comes to loading data from APIs.
564
-
565
- Here are some examples (not exhaustive) that you should consider when building applications:
566
- 1. **Default to Smart Loading**: Always check for existing data before showing loading states
567
- 2. **Loading State Hierarchy**:
568
- - Empty state → Full loading
569
- - Has data → Keep showing data during refetch
570
- - Error state → Show error with retry option, optionally keep stale data in background in case of retry
571
- 3. **Debounce Rapid Requests**: Prevent multiple API calls in short succession
572
- 4. **Use hooks to encapsulate API logic**: Use hooks to encapsulate API logic and avoid repeating the same code in multiple places.
573
- </apis>
434
+ ${sdkApiEnabled ? buildSdkApiSection() : buildYamlApiSection()}
574
435
 
575
436
  <navigation>
576
437
  You **must** use \`react-router@7\` in data mode for routing. The framework and declarative modes are **not** supported.
@@ -822,6 +683,7 @@ You should always attempt to use an existing component before creating a new one
822
683
  **REQUIRED:** Grep for an existing component in the \`components/ui\` directory and read it's source code if you believe you already have a component that resolves the user's request. If there is not, you can create your own component in the \`components\` directory.
823
684
  </design_system_guidance>
824
685
  `;
686
+ }
825
687
  const DEFAULT_SAFETY_GUIDANCE = /*md*/ `
826
688
  - NEVER assist with activities that could harm individuals or violate laws and regulations.
827
689
  - NEVER create, modify, or suggest code that facilitates unauthorized access to systems or data.
@@ -1 +1 @@
1
- {"version":3,"file":"build-base-system-prompt.js","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAuB,EACvB,IAAa,EACb,YAAqB,EACrB,EAAE;IACF,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBd,CAAC;IACA,CAAC;IAED,MAAM,cAAc,GAClB,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,uBAAuB,CAAC;IAElE,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;IAElD,8EAA8E;IAC9E,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACtE,MAAM,YAAY,GAAG,cAAc,KAAK,IAAI,CAAC;IAE7C,oFAAoF;IACpF,MAAM,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC;IAExE,OAAO,CACL,QAAQ;QACR,MAAM,CAAC;;WAEA,WAAW;;;;;;;;;;;;;;;;;EAiBpB,cAAc,IA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmmBzC,CAAC;AAEF,MAAM,uBAAuB,GAAG,MAAM,CAAC;;;;;;;;CAQtC,CAAC"}
1
+ {"version":3,"file":"build-base-system-prompt.js","sourceRoot":"","sources":["../../../../src/ai-service/agent/prompts/build-base-system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAuB,EACvB,IAAa,EACb,YAAqB,EACrB,EAAE;IACF,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBd,CAAC;IACA,CAAC;IAED,MAAM,cAAc,GAClB,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,uBAAuB,CAAC;IAElE,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,IAAI,KAAK,CAAC;IAE7D,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D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G,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AACzD,KAAK,cAAc,GAAG;IACpB,yBAAyB,EAAE,IAAI,CAAC,oCAAoC,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/E,CAAC;AACF,KAAK,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;AAG3C,KAAK,YAAY,GAAG;KACjB,CAAC,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,MAAM,UAAU,CAAC,GACtD,UAAU,GACV,KAAK;CACV,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,SAAS,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AA4IzD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,QAAQ,EAC3D,QAAQ,EAAE,CAAC,EACX,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAChC,KAAK,CAAC,EAAE,KAAK,GACZ,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;AAgB1C,wBAAgB,aAAa,CAAC,CAAC,SAAS,QAAQ,EAC9C,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,GAAG,GACV,GAAG,CAkDL;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,GACT,wBAAwB,GAAG,SAAS,CAKtC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAuBtD"}
@@ -1,4 +1,4 @@
1
- import { safeJsonStringify } from "../../util/log-sanitizer.js";
1
+ import { safeJsonParse, safeJsonStringify } from "../../util/log-sanitizer.js";
2
2
  import { ToolExecutionError } from "./tools2/types.js";
3
3
  // Define handlers with proper typing
4
4
  // The MessageHandlers type ensures that each handler receives the correct
@@ -136,16 +136,27 @@ export function getToolOutput(toolName, output) {
136
136
  // For now only return result for executeRequestToIntegration
137
137
  if (toolName === "executeRequestToIntegration") {
138
138
  if (output?.data && typeof output.data === "string") {
139
- const parsedOutput = JSON.parse(output.data);
139
+ const isPartial = output.isPartial === true;
140
+ const parsedOutput = safeJsonParse(output.data);
141
+ if (parsedOutput === undefined) {
142
+ // Not valid JSON (e.g. HTML or plain text) — return raw data
143
+ return {
144
+ result: output.data,
145
+ count: 1,
146
+ ...(isPartial && { isPartial }),
147
+ };
148
+ }
140
149
  if (Array.isArray(parsedOutput)) {
141
150
  return {
142
151
  result: parsedOutput.slice(0, 10),
143
152
  count: parsedOutput.length,
153
+ ...(isPartial && { isPartial }),
144
154
  };
145
155
  }
146
156
  return {
147
157
  result: parsedOutput,
148
158
  count: 1,
159
+ ...(isPartial && { isPartial }),
149
160
  };
150
161
  }
151
162
  return output;
@@ -1 +1 @@
1
- {"version":3,"file":"tool-message-utils.js","sourceRoot":"","sources":["../../../src/ai-service/agent/tool-message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAqCvD,qCAAqC;AACrC,0EAA0E;AAC1E,8EAA8E;AAC9E,8DAA8D;AAC9D,MAAM,eAAe,GAAoB;IACvC,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS;IACnB,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE;YAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,EAAE;SAC7B,CAAC;IACJ,CAAC;IACD,mBAAmB,EAAE,GAAG,EAAE,CAAC,SAAS;IACpC,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE;QAC9B,OAAO;YACL,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE;SAC/B,CAAC;IACJ,CAAC;IAC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I,SAAS,IAAI,KAAK,EAAE,CAAC;gBACvB,OAAO,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1C,CAAC;YACD,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;gBACrB,OAAO,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxC,CAAC;YACD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,eAAe,CAAC;IACzB,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/analysis.ts"],"names":[],"mappings":"AAgGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,KAAG,MAAM,EAWtE,CAAC;AA2MF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,YAAY,EAyL7D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,OAMlD,CAAC"}
1
+ {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/analysis.ts"],"names":[],"mappings":"AAgJA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,KAAG,MAAM,EAWtE,CAAC;AAwNF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,YAAY,EAgR7D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,OAMlD,CAAC"}
@@ -24,47 +24,61 @@ const HTTP_MUTATION_METHODS = ["DELETE", "PUT", "PATCH", "POST"];
24
24
  const SQL_INTEGRATION_TYPES = [
25
25
  "Athena",
26
26
  "BigQuery",
27
+ "CockroachDB",
27
28
  "Snowflake",
28
29
  "PostgreSQL",
29
30
  "MicrosoftSql",
30
31
  "MySQL",
31
32
  "Databricks",
33
+ "Lakebase",
34
+ "OracleDB",
32
35
  "Redshift",
33
36
  "MariaDB",
34
37
  ];
38
+ /**
39
+ * AI provider integrations that are inherently read-only.
40
+ * These always use POST for inference/generation requests,
41
+ * but they never modify customer data — they only produce outputs.
42
+ * They should NEVER be flagged as mutations regardless of HTTP method.
43
+ */
44
+ const AI_PROVIDER_TYPES = [
45
+ "Anthropic",
46
+ "Cohere",
47
+ "Fireworks",
48
+ "Gemini",
49
+ "Groq",
50
+ "Mistral",
51
+ "OpenAI",
52
+ "Perplexity",
53
+ "StabilityAI",
54
+ "OCR",
55
+ ];
35
56
  const REST_INTEGRATION_TYPES = [
36
57
  "RestApi",
37
58
  "OpenApi",
38
59
  "Jira",
39
60
  "Airtable",
40
- "Anthropic",
41
61
  "Asana",
42
62
  "Bitbucket",
43
63
  "Box",
44
64
  "CircleCI",
45
- "Cohere",
65
+ "Confluence",
46
66
  "Datadog",
47
67
  "Dropbox",
48
68
  "Elasticsearch",
49
- "Fireworks",
50
69
  "Front",
51
- "Gemini",
52
70
  "GitHub",
53
71
  "GoogleAnalytics",
54
72
  "GoogleDrive",
55
- "Groq",
73
+ "GoogleSheets",
56
74
  "HubSpot",
57
75
  "Intercom",
58
76
  "LaunchDarkly",
59
- "Mistral",
60
77
  "Notion",
61
- "OpenAI",
62
78
  "PagerDuty",
63
- "Perplexity",
64
79
  "Segment",
65
80
  "SendGrid",
66
81
  "Slack",
67
- "StabilityAI",
68
82
  "Stripe",
69
83
  "Twilio",
70
84
  "Zendesk",
@@ -86,6 +100,34 @@ const SALESFORCE_MUTATION_ACTIONS = [
86
100
  "BULK_ACTION_CREATE",
87
101
  "BULK_ACTION_UPDATE",
88
102
  ];
103
+ const MONGODB_MUTATION_OPERATIONS = [
104
+ "insertOne",
105
+ "insertMany",
106
+ "updateOne",
107
+ "updateMany",
108
+ "deleteOne",
109
+ "deleteMany",
110
+ "replaceOne",
111
+ ];
112
+ const S3_MUTATION_ACTIONS = [
113
+ "UPLOAD_OBJECT",
114
+ "DELETE_OBJECT",
115
+ "UPLOAD_MULTIPLE_OBJECTS",
116
+ "CREATE_BUCKET",
117
+ ];
118
+ const GCS_MUTATION_ACTIONS = [
119
+ "UPLOAD_OBJECT",
120
+ "DELETE_OBJECT",
121
+ "UPLOAD_MULTIPLE_OBJECTS",
122
+ "CREATE_BUCKET",
123
+ ];
124
+ const COUCHBASE_MUTATION_ACTIONS = ["insert", "remove"];
125
+ const COSMOSDB_MUTATION_POINT_ACTIONS = [
126
+ "create",
127
+ "upsert",
128
+ "replace",
129
+ "delete",
130
+ ];
89
131
  const integrationConstructorRegex = /new\s+[\w$.]+\s*\(\s*(["'`])(?:\\.|(?!\1).)*?\1\s*,\s*(["'`])((?:\\.|(?!\2).)*?)\2/g;
90
132
  // extract integration ids from our TS new ClassName("<id>", ...) calls, helps with showing the user metadata
91
133
  export const extractIntegrationIdsFromSource = (source) => {
@@ -101,8 +143,14 @@ export const extractIntegrationIdsFromSource = (source) => {
101
143
  return Array.from(ids);
102
144
  };
103
145
  const isSqlMutation = (sql) => {
104
- const normalized = sql.toUpperCase();
105
- return SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`(^|\\s|;)${keyword}\\s`, "i").test(normalized));
146
+ const trimmed = sql.trim();
147
+ // A single SELECT statement is always read-only, even if it contains keywords
148
+ // like REPLACE or RENAME which Snowflake uses as SELECT * column modifiers
149
+ // (e.g., SELECT * REPLACE(expr AS col) RENAME(col AS new_col) FROM t).
150
+ if (/^\s*SELECT\b/i.test(trimmed) && !trimmed.includes(";")) {
151
+ return false;
152
+ }
153
+ return SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`(^|\\s|;)${keyword}\\s`, "i").test(trimmed));
106
154
  };
107
155
  const extractStringValue = (node) => {
108
156
  if (!node)
@@ -218,7 +266,10 @@ const scanJavaScriptForSqlMutations = (node, source) => {
218
266
  // Remove comments before scanning for SQL keywords
219
267
  const functionBodyWithoutComments = removeComments(functionBody);
220
268
  // Check for SQL keywords in the function body (without comments)
221
- const hasMutation = SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`\\b${keyword}\\b`, "i").test(functionBodyWithoutComments));
269
+ // Use negative lookahead (?!\s*\() to avoid false positives from:
270
+ // - SQL functions like REPLACE(string, from, to) which are read-only
271
+ // - JavaScript constructors like new Set() which are not SQL
272
+ const hasMutation = SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`\\b${keyword}\\b(?!\\s*\\()`, "i").test(functionBodyWithoutComments));
222
273
  if (hasMutation) {
223
274
  return true;
224
275
  }
@@ -232,7 +283,7 @@ const scanJavaScriptForSqlMutations = (node, source) => {
232
283
  for (const expr of body.expressions) {
233
284
  if (expr.start && expr.end) {
234
285
  const exprText = source.slice(expr.start, expr.end);
235
- if (SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`\\b${keyword}\\b`, "i").test(exprText))) {
286
+ if (SQL_WRITE_KEYWORDS.some((keyword) => new RegExp(`\\b${keyword}\\b(?!\\s*\\()`, "i").test(exprText))) {
236
287
  return true;
237
288
  }
238
289
  // Also recursively check if the expression is a function that contains SQL
@@ -343,7 +394,7 @@ export const extractMutations = (source) => {
343
394
  }
344
395
  }
345
396
  }
346
- else if (t.isTemplateLiteral(statementValue)) {
397
+ else if (!statement && t.isTemplateLiteral(statementValue)) {
347
398
  // Handle template literals directly (e.g., when used as statement value)
348
399
  // Scan the template literal for SQL mutations
349
400
  if (statementValue.start && statementValue.end) {
@@ -359,6 +410,12 @@ export const extractMutations = (source) => {
359
410
  }
360
411
  }
361
412
  }
413
+ else if (AI_PROVIDER_TYPES.includes(typeName)) {
414
+ // AI provider integrations are inherently read-only.
415
+ // They always use POST for inference but never modify customer data.
416
+ // Skip mutation detection entirely.
417
+ return;
418
+ }
362
419
  else if (REST_INTEGRATION_TYPES.includes(typeName)) {
363
420
  const configArg = args[2] || args[1];
364
421
  if (!configArg)
@@ -413,7 +470,7 @@ export const extractMutations = (source) => {
413
470
  details: "Email send mutation",
414
471
  });
415
472
  }
416
- else if (typeName === "GraphQL") {
473
+ else if (typeName === "GraphQL" || typeName === "GraphQLIntegration") {
417
474
  const configArg = args[2];
418
475
  if (!configArg)
419
476
  return;
@@ -426,6 +483,93 @@ export const extractMutations = (source) => {
426
483
  });
427
484
  }
428
485
  }
486
+ else if (typeName === "MongoDB") {
487
+ const configArg = args[2];
488
+ if (!configArg)
489
+ return;
490
+ const operation = extractPropertyValue(configArg, "operation");
491
+ if (operation && MONGODB_MUTATION_OPERATIONS.includes(operation)) {
492
+ mutations.push({
493
+ type: typeName,
494
+ name,
495
+ details: `MongoDB ${operation} mutation`,
496
+ });
497
+ }
498
+ }
499
+ else if (typeName === "S3") {
500
+ const configArg = args[2];
501
+ if (!configArg)
502
+ return;
503
+ const action = extractPropertyValue(configArg, "action");
504
+ if (action && S3_MUTATION_ACTIONS.includes(action)) {
505
+ mutations.push({
506
+ type: typeName,
507
+ name,
508
+ details: `S3 ${action} mutation`,
509
+ });
510
+ }
511
+ }
512
+ else if (typeName === "GoogleCloudStorage") {
513
+ const configArg = args[2];
514
+ if (!configArg)
515
+ return;
516
+ const action = extractPropertyValue(configArg, "action");
517
+ if (action && GCS_MUTATION_ACTIONS.includes(action)) {
518
+ mutations.push({
519
+ type: typeName,
520
+ name,
521
+ details: `GCS ${action} mutation`,
522
+ });
523
+ }
524
+ }
525
+ else if (typeName === "SMTP") {
526
+ mutations.push({
527
+ type: typeName,
528
+ name,
529
+ details: "SMTP send mutation",
530
+ });
531
+ }
532
+ else if (typeName === "Couchbase") {
533
+ const configArg = args[2];
534
+ if (!configArg)
535
+ return;
536
+ const action = extractPropertyValue(configArg, "action");
537
+ if (action && COUCHBASE_MUTATION_ACTIONS.includes(action)) {
538
+ mutations.push({
539
+ type: typeName,
540
+ name,
541
+ details: `Couchbase ${action} mutation`,
542
+ });
543
+ }
544
+ else if (action === "runSql") {
545
+ const sqlBody = extractPropertyValue(configArg, "sqlBody");
546
+ if (sqlBody && isSqlMutation(sqlBody)) {
547
+ mutations.push({
548
+ type: typeName,
549
+ name,
550
+ details: `Couchbase SQL++ mutation: ${sqlBody.slice(0, 50)}`,
551
+ });
552
+ }
553
+ }
554
+ }
555
+ else if (typeName === "CosmosDB") {
556
+ const configArg = args[2];
557
+ if (!configArg)
558
+ return;
559
+ const actionType = extractPropertyValue(configArg, "actionType");
560
+ if (actionType === "pointOperation") {
561
+ const pointAction = extractPropertyValue(configArg, "pointAction");
562
+ if (pointAction &&
563
+ COSMOSDB_MUTATION_POINT_ACTIONS.includes(pointAction)) {
564
+ mutations.push({
565
+ type: typeName,
566
+ name,
567
+ details: `CosmosDB ${pointAction} mutation`,
568
+ });
569
+ }
570
+ }
571
+ // actionType === "sql" is read-only (CosmosDB SQL queries are SELECT-only)
572
+ }
429
573
  },
430
574
  });
431
575
  return mutations;