@open-mercato/ai-assistant 0.5.1-develop.3036.f02c281f23 → 0.5.1-develop.3045.b4b3320cc2

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 (273) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/AGENTS.md +361 -0
  3. package/README.md +5 -0
  4. package/dist/index.js +154 -0
  5. package/dist/index.js.map +2 -2
  6. package/dist/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.js +73 -0
  7. package/dist/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.js.map +7 -0
  8. package/dist/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.js +484 -0
  9. package/dist/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.js.map +7 -0
  10. package/dist/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.js +251 -0
  11. package/dist/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.js.map +7 -0
  12. package/dist/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.js +91 -0
  13. package/dist/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.js.map +7 -0
  14. package/dist/modules/ai_assistant/ai-tools/attachments-pack.js +202 -0
  15. package/dist/modules/ai_assistant/ai-tools/attachments-pack.js.map +7 -0
  16. package/dist/modules/ai_assistant/ai-tools/meta-pack.js +121 -0
  17. package/dist/modules/ai_assistant/ai-tools/meta-pack.js.map +7 -0
  18. package/dist/modules/ai_assistant/ai-tools/search-pack.js +94 -0
  19. package/dist/modules/ai_assistant/ai-tools/search-pack.js.map +7 -0
  20. package/dist/modules/ai_assistant/ai-tools.js +14 -0
  21. package/dist/modules/ai_assistant/ai-tools.js.map +7 -0
  22. package/dist/modules/ai_assistant/api/ai/actions/[id]/cancel/route.js +175 -0
  23. package/dist/modules/ai_assistant/api/ai/actions/[id]/cancel/route.js.map +7 -0
  24. package/dist/modules/ai_assistant/api/ai/actions/[id]/confirm/route.js +174 -0
  25. package/dist/modules/ai_assistant/api/ai/actions/[id]/confirm/route.js.map +7 -0
  26. package/dist/modules/ai_assistant/api/ai/actions/[id]/route.js +101 -0
  27. package/dist/modules/ai_assistant/api/ai/actions/[id]/route.js.map +7 -0
  28. package/dist/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.js +311 -0
  29. package/dist/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.js.map +7 -0
  30. package/dist/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.js +246 -0
  31. package/dist/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.js.map +7 -0
  32. package/dist/modules/ai_assistant/api/ai/agents/route.js +94 -0
  33. package/dist/modules/ai_assistant/api/ai/agents/route.js.map +7 -0
  34. package/dist/modules/ai_assistant/api/ai/chat/route.js +173 -0
  35. package/dist/modules/ai_assistant/api/ai/chat/route.js.map +7 -0
  36. package/dist/modules/ai_assistant/api/ai/run-object/route.js +167 -0
  37. package/dist/modules/ai_assistant/api/ai/run-object/route.js.map +7 -0
  38. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.js +1111 -0
  39. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.js.map +7 -0
  40. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.js +10 -0
  41. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.js.map +7 -0
  42. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.js +28 -0
  43. package/dist/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.js.map +7 -0
  44. package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.js +10 -0
  45. package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.js.map +7 -0
  46. package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.js +30 -0
  47. package/dist/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.js.map +7 -0
  48. package/dist/modules/ai_assistant/backend/config/ai-assistant/page.js +4 -6
  49. package/dist/modules/ai_assistant/backend/config/ai-assistant/page.js.map +2 -2
  50. package/dist/modules/ai_assistant/backend/config/ai-assistant/page.meta.js +1 -21
  51. package/dist/modules/ai_assistant/backend/config/ai-assistant/page.meta.js.map +2 -2
  52. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.js +462 -0
  53. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.js.map +7 -0
  54. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.js +10 -0
  55. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.js.map +7 -0
  56. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.js +28 -0
  57. package/dist/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.js.map +7 -0
  58. package/dist/modules/ai_assistant/cli.js +78 -12
  59. package/dist/modules/ai_assistant/cli.js.map +2 -2
  60. package/dist/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.js +5 -0
  61. package/dist/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.js.map +7 -0
  62. package/dist/modules/ai_assistant/data/entities/AiAgentPromptOverride.js +5 -0
  63. package/dist/modules/ai_assistant/data/entities/AiAgentPromptOverride.js.map +7 -0
  64. package/dist/modules/ai_assistant/data/entities/AiPendingAction.js +5 -0
  65. package/dist/modules/ai_assistant/data/entities/AiPendingAction.js.map +7 -0
  66. package/dist/modules/ai_assistant/data/entities.js +228 -0
  67. package/dist/modules/ai_assistant/data/entities.js.map +7 -0
  68. package/dist/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.js +95 -0
  69. package/dist/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.js.map +7 -0
  70. package/dist/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.js +95 -0
  71. package/dist/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.js.map +7 -0
  72. package/dist/modules/ai_assistant/data/repositories/AiPendingActionRepository.js +223 -0
  73. package/dist/modules/ai_assistant/data/repositories/AiPendingActionRepository.js.map +7 -0
  74. package/dist/modules/ai_assistant/events.js +33 -0
  75. package/dist/modules/ai_assistant/events.js.map +7 -0
  76. package/dist/modules/ai_assistant/i18n/de.json +252 -0
  77. package/dist/modules/ai_assistant/i18n/en.json +252 -0
  78. package/dist/modules/ai_assistant/i18n/es.json +252 -0
  79. package/dist/modules/ai_assistant/i18n/pl.json +252 -0
  80. package/dist/modules/ai_assistant/lib/agent-policy.js +168 -0
  81. package/dist/modules/ai_assistant/lib/agent-policy.js.map +7 -0
  82. package/dist/modules/ai_assistant/lib/agent-registry.js +195 -0
  83. package/dist/modules/ai_assistant/lib/agent-registry.js.map +7 -0
  84. package/dist/modules/ai_assistant/lib/agent-runtime.js +451 -0
  85. package/dist/modules/ai_assistant/lib/agent-runtime.js.map +7 -0
  86. package/dist/modules/ai_assistant/lib/agent-tools.js +223 -0
  87. package/dist/modules/ai_assistant/lib/agent-tools.js.map +7 -0
  88. package/dist/modules/ai_assistant/lib/agent-transport.js +25 -0
  89. package/dist/modules/ai_assistant/lib/agent-transport.js.map +7 -0
  90. package/dist/modules/ai_assistant/lib/ai-agent-definition.js +11 -0
  91. package/dist/modules/ai_assistant/lib/ai-agent-definition.js.map +7 -0
  92. package/dist/modules/ai_assistant/lib/ai-agents-generated.d.js +1 -0
  93. package/dist/modules/ai_assistant/lib/ai-agents-generated.d.js.map +7 -0
  94. package/dist/modules/ai_assistant/lib/ai-api-operation-runner.js +239 -0
  95. package/dist/modules/ai_assistant/lib/ai-api-operation-runner.js.map +7 -0
  96. package/dist/modules/ai_assistant/lib/ai-overrides.js +189 -0
  97. package/dist/modules/ai_assistant/lib/ai-overrides.js.map +7 -0
  98. package/dist/modules/ai_assistant/lib/ai-tool-definition.js +7 -0
  99. package/dist/modules/ai_assistant/lib/ai-tool-definition.js.map +7 -0
  100. package/dist/modules/ai_assistant/lib/ai-tools-generated.d.js +1 -0
  101. package/dist/modules/ai_assistant/lib/ai-tools-generated.d.js.map +7 -0
  102. package/dist/modules/ai_assistant/lib/api-backed-tool.js +48 -0
  103. package/dist/modules/ai_assistant/lib/api-backed-tool.js.map +7 -0
  104. package/dist/modules/ai_assistant/lib/attachment-bridge-types.js +1 -0
  105. package/dist/modules/ai_assistant/lib/attachment-bridge-types.js.map +7 -0
  106. package/dist/modules/ai_assistant/lib/attachment-parts.js +276 -0
  107. package/dist/modules/ai_assistant/lib/attachment-parts.js.map +7 -0
  108. package/dist/modules/ai_assistant/lib/model-factory.js +68 -0
  109. package/dist/modules/ai_assistant/lib/model-factory.js.map +7 -0
  110. package/dist/modules/ai_assistant/lib/pending-action-cancel.js +86 -0
  111. package/dist/modules/ai_assistant/lib/pending-action-cancel.js.map +7 -0
  112. package/dist/modules/ai_assistant/lib/pending-action-client.js +35 -0
  113. package/dist/modules/ai_assistant/lib/pending-action-client.js.map +7 -0
  114. package/dist/modules/ai_assistant/lib/pending-action-executor.js +243 -0
  115. package/dist/modules/ai_assistant/lib/pending-action-executor.js.map +7 -0
  116. package/dist/modules/ai_assistant/lib/pending-action-recheck.js +246 -0
  117. package/dist/modules/ai_assistant/lib/pending-action-recheck.js.map +7 -0
  118. package/dist/modules/ai_assistant/lib/pending-action-types.js +70 -0
  119. package/dist/modules/ai_assistant/lib/pending-action-types.js.map +7 -0
  120. package/dist/modules/ai_assistant/lib/prepare-mutation.js +315 -0
  121. package/dist/modules/ai_assistant/lib/prepare-mutation.js.map +7 -0
  122. package/dist/modules/ai_assistant/lib/prompt-composition-types.js +7 -0
  123. package/dist/modules/ai_assistant/lib/prompt-composition-types.js.map +7 -0
  124. package/dist/modules/ai_assistant/lib/prompt-override-merge.js +175 -0
  125. package/dist/modules/ai_assistant/lib/prompt-override-merge.js.map +7 -0
  126. package/dist/modules/ai_assistant/lib/schema-utils.js +5 -1
  127. package/dist/modules/ai_assistant/lib/schema-utils.js.map +2 -2
  128. package/dist/modules/ai_assistant/lib/tool-executor.js +13 -2
  129. package/dist/modules/ai_assistant/lib/tool-executor.js.map +2 -2
  130. package/dist/modules/ai_assistant/lib/tool-loader.js +86 -11
  131. package/dist/modules/ai_assistant/lib/tool-loader.js.map +2 -2
  132. package/dist/modules/ai_assistant/lib/tool-test-fixtures.js +120 -0
  133. package/dist/modules/ai_assistant/lib/tool-test-fixtures.js.map +7 -0
  134. package/dist/modules/ai_assistant/lib/tool-test-runner.js +418 -0
  135. package/dist/modules/ai_assistant/lib/tool-test-runner.js.map +7 -0
  136. package/dist/modules/ai_assistant/migrations/Migration20260419100521.js +17 -0
  137. package/dist/modules/ai_assistant/migrations/Migration20260419100521.js.map +7 -0
  138. package/dist/modules/ai_assistant/migrations/Migration20260419132948.js +16 -0
  139. package/dist/modules/ai_assistant/migrations/Migration20260419132948.js.map +7 -0
  140. package/dist/modules/ai_assistant/migrations/Migration20260419134235.js +17 -0
  141. package/dist/modules/ai_assistant/migrations/Migration20260419134235.js.map +7 -0
  142. package/dist/modules/ai_assistant/setup.js +36 -0
  143. package/dist/modules/ai_assistant/setup.js.map +2 -2
  144. package/dist/modules/ai_assistant/workers/ai-pending-action-cleanup.js +161 -0
  145. package/dist/modules/ai_assistant/workers/ai-pending-action-cleanup.js.map +7 -0
  146. package/generated/entities/ai_agent_mutation_policy_override/index.ts +9 -0
  147. package/generated/entities/ai_agent_prompt_override/index.ts +10 -0
  148. package/generated/entities/ai_pending_action/index.ts +24 -0
  149. package/generated/entities.ids.generated.ts +13 -0
  150. package/generated/entity-fields-registry.ts +57 -0
  151. package/jest.config.cjs +7 -0
  152. package/package.json +4 -4
  153. package/src/index.ts +215 -0
  154. package/src/modules/ai_assistant/__integration__/README.md +5 -0
  155. package/src/modules/ai_assistant/__integration__/TC-AI-002-agent-policy.spec.ts +115 -0
  156. package/src/modules/ai_assistant/__integration__/TC-AI-AGENT-SETTINGS-005-settings-page.spec.ts +574 -0
  157. package/src/modules/ai_assistant/__integration__/TC-AI-PLAYGROUND-004-playground.spec.ts +333 -0
  158. package/src/modules/ai_assistant/__integration__/TC-INT-AI-TOOLS.spec.ts +135 -0
  159. package/src/modules/ai_assistant/__tests__/events.test.ts +145 -0
  160. package/src/modules/ai_assistant/__tests__/integration/pending-action-contract.test.ts +1015 -0
  161. package/src/modules/ai_assistant/__tests__/integration/ws-c-attachment-bridge.test.ts +235 -0
  162. package/src/modules/ai_assistant/__tests__/integration/ws-c-policy-and-tools.test.ts +330 -0
  163. package/src/modules/ai_assistant/__tests__/integration/ws-c-tool-pack-coverage.test.ts +285 -0
  164. package/src/modules/ai_assistant/ai-tools/__tests__/attachments-pack.test.ts +322 -0
  165. package/src/modules/ai_assistant/ai-tools/__tests__/meta-pack.test.ts +218 -0
  166. package/src/modules/ai_assistant/ai-tools/__tests__/search-pack.test.ts +192 -0
  167. package/src/modules/ai_assistant/ai-tools/attachments-pack.ts +269 -0
  168. package/src/modules/ai_assistant/ai-tools/meta-pack.ts +140 -0
  169. package/src/modules/ai_assistant/ai-tools/search-pack.ts +122 -0
  170. package/src/modules/ai_assistant/ai-tools.ts +21 -0
  171. package/src/modules/ai_assistant/api/ai/actions/[id]/__tests__/route.test.ts +222 -0
  172. package/src/modules/ai_assistant/api/ai/actions/[id]/cancel/__tests__/route.test.ts +286 -0
  173. package/src/modules/ai_assistant/api/ai/actions/[id]/cancel/route.ts +237 -0
  174. package/src/modules/ai_assistant/api/ai/actions/[id]/confirm/__tests__/route.test.ts +339 -0
  175. package/src/modules/ai_assistant/api/ai/actions/[id]/confirm/route.ts +229 -0
  176. package/src/modules/ai_assistant/api/ai/actions/[id]/route.ts +142 -0
  177. package/src/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/__tests__/route.test.ts +367 -0
  178. package/src/modules/ai_assistant/api/ai/agents/[agentId]/mutation-policy/route.ts +380 -0
  179. package/src/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/__tests__/route.test.ts +333 -0
  180. package/src/modules/ai_assistant/api/ai/agents/[agentId]/prompt-override/route.ts +307 -0
  181. package/src/modules/ai_assistant/api/ai/agents/route.ts +107 -0
  182. package/src/modules/ai_assistant/api/ai/chat/__tests__/route.test.ts +282 -0
  183. package/src/modules/ai_assistant/api/ai/chat/route.ts +207 -0
  184. package/src/modules/ai_assistant/api/ai/run-object/__tests__/route.test.ts +282 -0
  185. package/src/modules/ai_assistant/api/ai/run-object/route.ts +204 -0
  186. package/src/modules/ai_assistant/backend/config/ai-assistant/agents/AiAgentSettingsPageClient.tsx +1419 -0
  187. package/src/modules/ai_assistant/backend/config/ai-assistant/agents/page.meta.ts +26 -0
  188. package/src/modules/ai_assistant/backend/config/ai-assistant/agents/page.tsx +12 -0
  189. package/src/modules/ai_assistant/backend/config/ai-assistant/legacy/page.meta.ts +28 -0
  190. package/src/modules/ai_assistant/backend/config/ai-assistant/legacy/page.tsx +12 -0
  191. package/src/modules/ai_assistant/backend/config/ai-assistant/page.meta.ts +8 -23
  192. package/src/modules/ai_assistant/backend/config/ai-assistant/page.tsx +15 -10
  193. package/src/modules/ai_assistant/backend/config/ai-assistant/playground/AiPlaygroundPageClient.tsx +604 -0
  194. package/src/modules/ai_assistant/backend/config/ai-assistant/playground/page.meta.ts +26 -0
  195. package/src/modules/ai_assistant/backend/config/ai-assistant/playground/page.tsx +12 -0
  196. package/src/modules/ai_assistant/cli.ts +99 -24
  197. package/src/modules/ai_assistant/data/__tests__/schema-unique-indexes.test.ts +69 -0
  198. package/src/modules/ai_assistant/data/entities/AiAgentMutationPolicyOverride.ts +7 -0
  199. package/src/modules/ai_assistant/data/entities/AiAgentPromptOverride.ts +7 -0
  200. package/src/modules/ai_assistant/data/entities/AiPendingAction.ts +7 -0
  201. package/src/modules/ai_assistant/data/entities.ts +270 -0
  202. package/src/modules/ai_assistant/data/repositories/AiAgentMutationPolicyOverrideRepository.ts +129 -0
  203. package/src/modules/ai_assistant/data/repositories/AiAgentPromptOverrideRepository.ts +132 -0
  204. package/src/modules/ai_assistant/data/repositories/AiPendingActionRepository.ts +334 -0
  205. package/src/modules/ai_assistant/data/repositories/__tests__/AiAgentMutationPolicyOverrideRepository.test.ts +195 -0
  206. package/src/modules/ai_assistant/data/repositories/__tests__/AiAgentPromptOverrideRepository.test.ts +197 -0
  207. package/src/modules/ai_assistant/data/repositories/__tests__/AiPendingActionRepository.test.ts +357 -0
  208. package/src/modules/ai_assistant/events.ts +112 -0
  209. package/src/modules/ai_assistant/i18n/de.json +252 -0
  210. package/src/modules/ai_assistant/i18n/en.json +252 -0
  211. package/src/modules/ai_assistant/i18n/es.json +252 -0
  212. package/src/modules/ai_assistant/i18n/pl.json +252 -0
  213. package/src/modules/ai_assistant/lib/__tests__/agent-policy.mutation-override.test.ts +203 -0
  214. package/src/modules/ai_assistant/lib/__tests__/agent-policy.test.ts +385 -0
  215. package/src/modules/ai_assistant/lib/__tests__/agent-registry.test.ts +217 -0
  216. package/src/modules/ai_assistant/lib/__tests__/agent-runtime-object.test.ts +329 -0
  217. package/src/modules/ai_assistant/lib/__tests__/agent-runtime-parity.test.ts +573 -0
  218. package/src/modules/ai_assistant/lib/__tests__/agent-runtime.test.ts +291 -0
  219. package/src/modules/ai_assistant/lib/__tests__/agent-tools.test.ts +172 -0
  220. package/src/modules/ai_assistant/lib/__tests__/agent-transport.test.ts +41 -0
  221. package/src/modules/ai_assistant/lib/__tests__/ai-agent-definition.test.ts +183 -0
  222. package/src/modules/ai_assistant/lib/__tests__/ai-api-operation-runner.test.ts +432 -0
  223. package/src/modules/ai_assistant/lib/__tests__/ai-overrides.test.ts +308 -0
  224. package/src/modules/ai_assistant/lib/__tests__/api-backed-tool.test.ts +302 -0
  225. package/src/modules/ai_assistant/lib/__tests__/attachment-bridge-and-prompt-types.test.ts +188 -0
  226. package/src/modules/ai_assistant/lib/__tests__/attachment-parts.test.ts +531 -0
  227. package/src/modules/ai_assistant/lib/__tests__/max-steps-budget.integration.test.ts +263 -0
  228. package/src/modules/ai_assistant/lib/__tests__/model-factory.integration.test.ts +183 -0
  229. package/src/modules/ai_assistant/lib/__tests__/model-factory.test.ts +168 -0
  230. package/src/modules/ai_assistant/lib/__tests__/pending-action-cancel.test.ts +235 -0
  231. package/src/modules/ai_assistant/lib/__tests__/pending-action-client.test.ts +148 -0
  232. package/src/modules/ai_assistant/lib/__tests__/pending-action-executor.test.ts +348 -0
  233. package/src/modules/ai_assistant/lib/__tests__/pending-action-recheck.test.ts +378 -0
  234. package/src/modules/ai_assistant/lib/__tests__/phase-0-additive-contract.test.ts +299 -0
  235. package/src/modules/ai_assistant/lib/__tests__/prepare-mutation.test.ts +610 -0
  236. package/src/modules/ai_assistant/lib/__tests__/prompt-override-merge.test.ts +136 -0
  237. package/src/modules/ai_assistant/lib/__tests__/tool-loader.test.ts +125 -0
  238. package/src/modules/ai_assistant/lib/agent-policy.ts +270 -0
  239. package/src/modules/ai_assistant/lib/agent-registry.ts +277 -0
  240. package/src/modules/ai_assistant/lib/agent-runtime.ts +751 -0
  241. package/src/modules/ai_assistant/lib/agent-tools.ts +396 -0
  242. package/src/modules/ai_assistant/lib/agent-transport.ts +51 -0
  243. package/src/modules/ai_assistant/lib/ai-agent-definition.ts +86 -0
  244. package/src/modules/ai_assistant/lib/ai-agents-generated.d.ts +18 -0
  245. package/src/modules/ai_assistant/lib/ai-api-operation-runner.ts +333 -0
  246. package/src/modules/ai_assistant/lib/ai-overrides.ts +389 -0
  247. package/src/modules/ai_assistant/lib/ai-tool-definition.ts +7 -0
  248. package/src/modules/ai_assistant/lib/ai-tools-generated.d.ts +7 -0
  249. package/src/modules/ai_assistant/lib/api-backed-tool.ts +85 -0
  250. package/src/modules/ai_assistant/lib/attachment-bridge-types.ts +24 -0
  251. package/src/modules/ai_assistant/lib/attachment-parts.ts +433 -0
  252. package/src/modules/ai_assistant/lib/model-factory.ts +212 -0
  253. package/src/modules/ai_assistant/lib/pending-action-cancel.ts +179 -0
  254. package/src/modules/ai_assistant/lib/pending-action-client.ts +126 -0
  255. package/src/modules/ai_assistant/lib/pending-action-executor.ts +424 -0
  256. package/src/modules/ai_assistant/lib/pending-action-recheck.ts +410 -0
  257. package/src/modules/ai_assistant/lib/pending-action-types.ts +194 -0
  258. package/src/modules/ai_assistant/lib/prepare-mutation.ts +448 -0
  259. package/src/modules/ai_assistant/lib/prompt-composition-types.ts +24 -0
  260. package/src/modules/ai_assistant/lib/prompt-override-merge.ts +253 -0
  261. package/src/modules/ai_assistant/lib/schema-utils.ts +14 -2
  262. package/src/modules/ai_assistant/lib/tool-executor.ts +25 -3
  263. package/src/modules/ai_assistant/lib/tool-loader.ts +159 -13
  264. package/src/modules/ai_assistant/lib/tool-test-fixtures.ts +160 -0
  265. package/src/modules/ai_assistant/lib/tool-test-runner.ts +596 -0
  266. package/src/modules/ai_assistant/lib/types.ts +105 -2
  267. package/src/modules/ai_assistant/migrations/.snapshot-open-mercato.json +871 -0
  268. package/src/modules/ai_assistant/migrations/Migration20260419100521.ts +17 -0
  269. package/src/modules/ai_assistant/migrations/Migration20260419132948.ts +16 -0
  270. package/src/modules/ai_assistant/migrations/Migration20260419134235.ts +17 -0
  271. package/src/modules/ai_assistant/setup.ts +53 -0
  272. package/src/modules/ai_assistant/workers/__tests__/ai-pending-action-cleanup.test.ts +333 -0
  273. package/src/modules/ai_assistant/workers/ai-pending-action-cleanup.ts +269 -0
@@ -0,0 +1,871 @@
1
+ {
2
+ "namespaces": [
3
+ "public"
4
+ ],
5
+ "name": "public",
6
+ "tables": [
7
+ {
8
+ "columns": {
9
+ "id": {
10
+ "name": "id",
11
+ "type": "uuid",
12
+ "unsigned": false,
13
+ "autoincrement": false,
14
+ "primary": true,
15
+ "nullable": false,
16
+ "unique": false,
17
+ "length": null,
18
+ "precision": null,
19
+ "scale": null,
20
+ "default": "gen_random_uuid()",
21
+ "comment": null,
22
+ "enumItems": [],
23
+ "mappedType": "uuid"
24
+ },
25
+ "tenant_id": {
26
+ "name": "tenant_id",
27
+ "type": "uuid",
28
+ "unsigned": false,
29
+ "autoincrement": false,
30
+ "primary": false,
31
+ "nullable": false,
32
+ "unique": false,
33
+ "length": null,
34
+ "precision": null,
35
+ "scale": null,
36
+ "default": null,
37
+ "comment": null,
38
+ "enumItems": [],
39
+ "mappedType": "uuid"
40
+ },
41
+ "organization_id": {
42
+ "name": "organization_id",
43
+ "type": "uuid",
44
+ "unsigned": false,
45
+ "autoincrement": false,
46
+ "primary": false,
47
+ "nullable": true,
48
+ "unique": false,
49
+ "length": null,
50
+ "precision": null,
51
+ "scale": null,
52
+ "default": null,
53
+ "comment": null,
54
+ "enumItems": [],
55
+ "mappedType": "uuid"
56
+ },
57
+ "agent_id": {
58
+ "name": "agent_id",
59
+ "type": "text",
60
+ "unsigned": false,
61
+ "autoincrement": false,
62
+ "primary": false,
63
+ "nullable": false,
64
+ "unique": false,
65
+ "length": null,
66
+ "precision": null,
67
+ "scale": null,
68
+ "default": null,
69
+ "comment": null,
70
+ "enumItems": [],
71
+ "mappedType": "text"
72
+ },
73
+ "mutation_policy": {
74
+ "name": "mutation_policy",
75
+ "type": "text",
76
+ "unsigned": false,
77
+ "autoincrement": false,
78
+ "primary": false,
79
+ "nullable": false,
80
+ "unique": false,
81
+ "length": null,
82
+ "precision": null,
83
+ "scale": null,
84
+ "default": null,
85
+ "comment": null,
86
+ "enumItems": [],
87
+ "mappedType": "text"
88
+ },
89
+ "notes": {
90
+ "name": "notes",
91
+ "type": "text",
92
+ "unsigned": false,
93
+ "autoincrement": false,
94
+ "primary": false,
95
+ "nullable": true,
96
+ "unique": false,
97
+ "length": null,
98
+ "precision": null,
99
+ "scale": null,
100
+ "default": null,
101
+ "comment": null,
102
+ "enumItems": [],
103
+ "mappedType": "text"
104
+ },
105
+ "created_by_user_id": {
106
+ "name": "created_by_user_id",
107
+ "type": "uuid",
108
+ "unsigned": false,
109
+ "autoincrement": false,
110
+ "primary": false,
111
+ "nullable": true,
112
+ "unique": false,
113
+ "length": null,
114
+ "precision": null,
115
+ "scale": null,
116
+ "default": null,
117
+ "comment": null,
118
+ "enumItems": [],
119
+ "mappedType": "uuid"
120
+ },
121
+ "created_at": {
122
+ "name": "created_at",
123
+ "type": "timestamptz",
124
+ "unsigned": false,
125
+ "autoincrement": false,
126
+ "primary": false,
127
+ "nullable": false,
128
+ "unique": false,
129
+ "length": 6,
130
+ "precision": null,
131
+ "scale": null,
132
+ "default": null,
133
+ "comment": null,
134
+ "enumItems": [],
135
+ "mappedType": "datetime"
136
+ },
137
+ "updated_at": {
138
+ "name": "updated_at",
139
+ "type": "timestamptz",
140
+ "unsigned": false,
141
+ "autoincrement": false,
142
+ "primary": false,
143
+ "nullable": false,
144
+ "unique": false,
145
+ "length": 6,
146
+ "precision": null,
147
+ "scale": null,
148
+ "default": null,
149
+ "comment": null,
150
+ "enumItems": [],
151
+ "mappedType": "datetime"
152
+ }
153
+ },
154
+ "name": "ai_agent_mutation_policy_overrides",
155
+ "schema": "public",
156
+ "indexes": [
157
+ {
158
+ "keyName": "ai_agent_mutation_policy_overrides_tenant_agent_idx",
159
+ "columnNames": [
160
+ "tenant_id",
161
+ "agent_id"
162
+ ],
163
+ "composite": true,
164
+ "constraint": false,
165
+ "primary": false,
166
+ "unique": false
167
+ },
168
+ {
169
+ "keyName": "ai_agent_mutation_policy_overrides_tenant_org_agent_uq",
170
+ "columnNames": [],
171
+ "composite": false,
172
+ "constraint": false,
173
+ "primary": false,
174
+ "unique": false,
175
+ "expression": "create unique index \"ai_agent_mutation_policy_overrides_tenant_org_agent_uq\" on \"ai_agent_mutation_policy_overrides\" (\"tenant_id\", \"organization_id\", \"agent_id\") where \"organization_id\" is not null"
176
+ },
177
+ {
178
+ "keyName": "ai_agent_mutation_policy_overrides_tenant_agent_null_org_uq",
179
+ "columnNames": [],
180
+ "composite": false,
181
+ "constraint": false,
182
+ "primary": false,
183
+ "unique": false,
184
+ "expression": "create unique index \"ai_agent_mutation_policy_overrides_tenant_agent_null_org_uq\" on \"ai_agent_mutation_policy_overrides\" (\"tenant_id\", \"agent_id\") where \"organization_id\" is null"
185
+ },
186
+ {
187
+ "keyName": "ai_agent_mutation_policy_overrides_pkey",
188
+ "columnNames": [
189
+ "id"
190
+ ],
191
+ "composite": false,
192
+ "constraint": true,
193
+ "primary": true,
194
+ "unique": true
195
+ }
196
+ ],
197
+ "checks": [],
198
+ "foreignKeys": {},
199
+ "nativeEnums": {}
200
+ },
201
+ {
202
+ "columns": {
203
+ "id": {
204
+ "name": "id",
205
+ "type": "uuid",
206
+ "unsigned": false,
207
+ "autoincrement": false,
208
+ "primary": true,
209
+ "nullable": false,
210
+ "unique": false,
211
+ "length": null,
212
+ "precision": null,
213
+ "scale": null,
214
+ "default": "gen_random_uuid()",
215
+ "comment": null,
216
+ "enumItems": [],
217
+ "mappedType": "uuid"
218
+ },
219
+ "tenant_id": {
220
+ "name": "tenant_id",
221
+ "type": "uuid",
222
+ "unsigned": false,
223
+ "autoincrement": false,
224
+ "primary": false,
225
+ "nullable": false,
226
+ "unique": false,
227
+ "length": null,
228
+ "precision": null,
229
+ "scale": null,
230
+ "default": null,
231
+ "comment": null,
232
+ "enumItems": [],
233
+ "mappedType": "uuid"
234
+ },
235
+ "organization_id": {
236
+ "name": "organization_id",
237
+ "type": "uuid",
238
+ "unsigned": false,
239
+ "autoincrement": false,
240
+ "primary": false,
241
+ "nullable": true,
242
+ "unique": false,
243
+ "length": null,
244
+ "precision": null,
245
+ "scale": null,
246
+ "default": null,
247
+ "comment": null,
248
+ "enumItems": [],
249
+ "mappedType": "uuid"
250
+ },
251
+ "agent_id": {
252
+ "name": "agent_id",
253
+ "type": "text",
254
+ "unsigned": false,
255
+ "autoincrement": false,
256
+ "primary": false,
257
+ "nullable": false,
258
+ "unique": false,
259
+ "length": null,
260
+ "precision": null,
261
+ "scale": null,
262
+ "default": null,
263
+ "comment": null,
264
+ "enumItems": [],
265
+ "mappedType": "text"
266
+ },
267
+ "version": {
268
+ "name": "version",
269
+ "type": "int",
270
+ "unsigned": false,
271
+ "autoincrement": false,
272
+ "primary": false,
273
+ "nullable": false,
274
+ "unique": false,
275
+ "length": null,
276
+ "precision": null,
277
+ "scale": null,
278
+ "default": null,
279
+ "comment": null,
280
+ "enumItems": [],
281
+ "mappedType": "integer"
282
+ },
283
+ "sections": {
284
+ "name": "sections",
285
+ "type": "jsonb",
286
+ "unsigned": false,
287
+ "autoincrement": false,
288
+ "primary": false,
289
+ "nullable": false,
290
+ "unique": false,
291
+ "length": null,
292
+ "precision": null,
293
+ "scale": null,
294
+ "default": null,
295
+ "comment": null,
296
+ "enumItems": [],
297
+ "mappedType": "json"
298
+ },
299
+ "notes": {
300
+ "name": "notes",
301
+ "type": "text",
302
+ "unsigned": false,
303
+ "autoincrement": false,
304
+ "primary": false,
305
+ "nullable": true,
306
+ "unique": false,
307
+ "length": null,
308
+ "precision": null,
309
+ "scale": null,
310
+ "default": null,
311
+ "comment": null,
312
+ "enumItems": [],
313
+ "mappedType": "text"
314
+ },
315
+ "created_by_user_id": {
316
+ "name": "created_by_user_id",
317
+ "type": "uuid",
318
+ "unsigned": false,
319
+ "autoincrement": false,
320
+ "primary": false,
321
+ "nullable": true,
322
+ "unique": false,
323
+ "length": null,
324
+ "precision": null,
325
+ "scale": null,
326
+ "default": null,
327
+ "comment": null,
328
+ "enumItems": [],
329
+ "mappedType": "uuid"
330
+ },
331
+ "created_at": {
332
+ "name": "created_at",
333
+ "type": "timestamptz",
334
+ "unsigned": false,
335
+ "autoincrement": false,
336
+ "primary": false,
337
+ "nullable": false,
338
+ "unique": false,
339
+ "length": 6,
340
+ "precision": null,
341
+ "scale": null,
342
+ "default": null,
343
+ "comment": null,
344
+ "enumItems": [],
345
+ "mappedType": "datetime"
346
+ },
347
+ "updated_at": {
348
+ "name": "updated_at",
349
+ "type": "timestamptz",
350
+ "unsigned": false,
351
+ "autoincrement": false,
352
+ "primary": false,
353
+ "nullable": false,
354
+ "unique": false,
355
+ "length": 6,
356
+ "precision": null,
357
+ "scale": null,
358
+ "default": null,
359
+ "comment": null,
360
+ "enumItems": [],
361
+ "mappedType": "datetime"
362
+ }
363
+ },
364
+ "name": "ai_agent_prompt_overrides",
365
+ "schema": "public",
366
+ "indexes": [
367
+ {
368
+ "keyName": "ai_agent_prompt_overrides_tenant_org_agent_version_idx",
369
+ "columnNames": [],
370
+ "composite": false,
371
+ "constraint": false,
372
+ "primary": false,
373
+ "unique": false,
374
+ "expression": "create index \"ai_agent_prompt_overrides_tenant_org_agent_version_idx\" on \"ai_agent_prompt_overrides\" (\"tenant_id\", \"organization_id\", \"agent_id\", \"version\" desc)"
375
+ },
376
+ {
377
+ "keyName": "ai_agent_prompt_overrides_tenant_agent_idx",
378
+ "columnNames": [
379
+ "tenant_id",
380
+ "agent_id"
381
+ ],
382
+ "composite": true,
383
+ "constraint": false,
384
+ "primary": false,
385
+ "unique": false
386
+ },
387
+ {
388
+ "keyName": "ai_agent_prompt_overrides_tenant_org_agent_version_uq",
389
+ "columnNames": [],
390
+ "composite": false,
391
+ "constraint": false,
392
+ "primary": false,
393
+ "unique": false,
394
+ "expression": "create unique index \"ai_agent_prompt_overrides_tenant_org_agent_version_uq\" on \"ai_agent_prompt_overrides\" (\"tenant_id\", \"organization_id\", \"agent_id\", \"version\") where \"organization_id\" is not null"
395
+ },
396
+ {
397
+ "keyName": "ai_agent_prompt_overrides_tenant_agent_version_null_org_uq",
398
+ "columnNames": [],
399
+ "composite": false,
400
+ "constraint": false,
401
+ "primary": false,
402
+ "unique": false,
403
+ "expression": "create unique index \"ai_agent_prompt_overrides_tenant_agent_version_null_org_uq\" on \"ai_agent_prompt_overrides\" (\"tenant_id\", \"agent_id\", \"version\") where \"organization_id\" is null"
404
+ },
405
+ {
406
+ "keyName": "ai_agent_prompt_overrides_pkey",
407
+ "columnNames": [
408
+ "id"
409
+ ],
410
+ "composite": false,
411
+ "constraint": true,
412
+ "primary": true,
413
+ "unique": true
414
+ }
415
+ ],
416
+ "checks": [],
417
+ "foreignKeys": {},
418
+ "nativeEnums": {}
419
+ },
420
+ {
421
+ "columns": {
422
+ "id": {
423
+ "name": "id",
424
+ "type": "uuid",
425
+ "unsigned": false,
426
+ "autoincrement": false,
427
+ "primary": true,
428
+ "nullable": false,
429
+ "unique": false,
430
+ "length": null,
431
+ "precision": null,
432
+ "scale": null,
433
+ "default": "gen_random_uuid()",
434
+ "comment": null,
435
+ "enumItems": [],
436
+ "mappedType": "uuid"
437
+ },
438
+ "tenant_id": {
439
+ "name": "tenant_id",
440
+ "type": "uuid",
441
+ "unsigned": false,
442
+ "autoincrement": false,
443
+ "primary": false,
444
+ "nullable": false,
445
+ "unique": false,
446
+ "length": null,
447
+ "precision": null,
448
+ "scale": null,
449
+ "default": null,
450
+ "comment": null,
451
+ "enumItems": [],
452
+ "mappedType": "uuid"
453
+ },
454
+ "organization_id": {
455
+ "name": "organization_id",
456
+ "type": "uuid",
457
+ "unsigned": false,
458
+ "autoincrement": false,
459
+ "primary": false,
460
+ "nullable": true,
461
+ "unique": false,
462
+ "length": null,
463
+ "precision": null,
464
+ "scale": null,
465
+ "default": null,
466
+ "comment": null,
467
+ "enumItems": [],
468
+ "mappedType": "uuid"
469
+ },
470
+ "agent_id": {
471
+ "name": "agent_id",
472
+ "type": "text",
473
+ "unsigned": false,
474
+ "autoincrement": false,
475
+ "primary": false,
476
+ "nullable": false,
477
+ "unique": false,
478
+ "length": null,
479
+ "precision": null,
480
+ "scale": null,
481
+ "default": null,
482
+ "comment": null,
483
+ "enumItems": [],
484
+ "mappedType": "text"
485
+ },
486
+ "tool_name": {
487
+ "name": "tool_name",
488
+ "type": "text",
489
+ "unsigned": false,
490
+ "autoincrement": false,
491
+ "primary": false,
492
+ "nullable": false,
493
+ "unique": false,
494
+ "length": null,
495
+ "precision": null,
496
+ "scale": null,
497
+ "default": null,
498
+ "comment": null,
499
+ "enumItems": [],
500
+ "mappedType": "text"
501
+ },
502
+ "conversation_id": {
503
+ "name": "conversation_id",
504
+ "type": "text",
505
+ "unsigned": false,
506
+ "autoincrement": false,
507
+ "primary": false,
508
+ "nullable": true,
509
+ "unique": false,
510
+ "length": null,
511
+ "precision": null,
512
+ "scale": null,
513
+ "default": null,
514
+ "comment": null,
515
+ "enumItems": [],
516
+ "mappedType": "text"
517
+ },
518
+ "target_entity_type": {
519
+ "name": "target_entity_type",
520
+ "type": "text",
521
+ "unsigned": false,
522
+ "autoincrement": false,
523
+ "primary": false,
524
+ "nullable": true,
525
+ "unique": false,
526
+ "length": null,
527
+ "precision": null,
528
+ "scale": null,
529
+ "default": null,
530
+ "comment": null,
531
+ "enumItems": [],
532
+ "mappedType": "text"
533
+ },
534
+ "target_record_id": {
535
+ "name": "target_record_id",
536
+ "type": "text",
537
+ "unsigned": false,
538
+ "autoincrement": false,
539
+ "primary": false,
540
+ "nullable": true,
541
+ "unique": false,
542
+ "length": null,
543
+ "precision": null,
544
+ "scale": null,
545
+ "default": null,
546
+ "comment": null,
547
+ "enumItems": [],
548
+ "mappedType": "text"
549
+ },
550
+ "normalized_input": {
551
+ "name": "normalized_input",
552
+ "type": "jsonb",
553
+ "unsigned": false,
554
+ "autoincrement": false,
555
+ "primary": false,
556
+ "nullable": false,
557
+ "unique": false,
558
+ "length": null,
559
+ "precision": null,
560
+ "scale": null,
561
+ "default": null,
562
+ "comment": null,
563
+ "enumItems": [],
564
+ "mappedType": "json"
565
+ },
566
+ "field_diff": {
567
+ "name": "field_diff",
568
+ "type": "jsonb",
569
+ "unsigned": false,
570
+ "autoincrement": false,
571
+ "primary": false,
572
+ "nullable": false,
573
+ "unique": false,
574
+ "length": null,
575
+ "precision": null,
576
+ "scale": null,
577
+ "default": "'[]'",
578
+ "comment": null,
579
+ "enumItems": [],
580
+ "mappedType": "json"
581
+ },
582
+ "records": {
583
+ "name": "records",
584
+ "type": "jsonb",
585
+ "unsigned": false,
586
+ "autoincrement": false,
587
+ "primary": false,
588
+ "nullable": true,
589
+ "unique": false,
590
+ "length": null,
591
+ "precision": null,
592
+ "scale": null,
593
+ "default": null,
594
+ "comment": null,
595
+ "enumItems": [],
596
+ "mappedType": "json"
597
+ },
598
+ "failed_records": {
599
+ "name": "failed_records",
600
+ "type": "jsonb",
601
+ "unsigned": false,
602
+ "autoincrement": false,
603
+ "primary": false,
604
+ "nullable": true,
605
+ "unique": false,
606
+ "length": null,
607
+ "precision": null,
608
+ "scale": null,
609
+ "default": null,
610
+ "comment": null,
611
+ "enumItems": [],
612
+ "mappedType": "json"
613
+ },
614
+ "side_effects_summary": {
615
+ "name": "side_effects_summary",
616
+ "type": "text",
617
+ "unsigned": false,
618
+ "autoincrement": false,
619
+ "primary": false,
620
+ "nullable": true,
621
+ "unique": false,
622
+ "length": null,
623
+ "precision": null,
624
+ "scale": null,
625
+ "default": null,
626
+ "comment": null,
627
+ "enumItems": [],
628
+ "mappedType": "text"
629
+ },
630
+ "record_version": {
631
+ "name": "record_version",
632
+ "type": "text",
633
+ "unsigned": false,
634
+ "autoincrement": false,
635
+ "primary": false,
636
+ "nullable": true,
637
+ "unique": false,
638
+ "length": null,
639
+ "precision": null,
640
+ "scale": null,
641
+ "default": null,
642
+ "comment": null,
643
+ "enumItems": [],
644
+ "mappedType": "text"
645
+ },
646
+ "attachment_ids": {
647
+ "name": "attachment_ids",
648
+ "type": "jsonb",
649
+ "unsigned": false,
650
+ "autoincrement": false,
651
+ "primary": false,
652
+ "nullable": false,
653
+ "unique": false,
654
+ "length": null,
655
+ "precision": null,
656
+ "scale": null,
657
+ "default": "'[]'",
658
+ "comment": null,
659
+ "enumItems": [],
660
+ "mappedType": "json"
661
+ },
662
+ "idempotency_key": {
663
+ "name": "idempotency_key",
664
+ "type": "text",
665
+ "unsigned": false,
666
+ "autoincrement": false,
667
+ "primary": false,
668
+ "nullable": false,
669
+ "unique": false,
670
+ "length": null,
671
+ "precision": null,
672
+ "scale": null,
673
+ "default": null,
674
+ "comment": null,
675
+ "enumItems": [],
676
+ "mappedType": "text"
677
+ },
678
+ "created_by_user_id": {
679
+ "name": "created_by_user_id",
680
+ "type": "uuid",
681
+ "unsigned": false,
682
+ "autoincrement": false,
683
+ "primary": false,
684
+ "nullable": false,
685
+ "unique": false,
686
+ "length": null,
687
+ "precision": null,
688
+ "scale": null,
689
+ "default": null,
690
+ "comment": null,
691
+ "enumItems": [],
692
+ "mappedType": "uuid"
693
+ },
694
+ "status": {
695
+ "name": "status",
696
+ "type": "text",
697
+ "unsigned": false,
698
+ "autoincrement": false,
699
+ "primary": false,
700
+ "nullable": false,
701
+ "unique": false,
702
+ "length": null,
703
+ "precision": null,
704
+ "scale": null,
705
+ "default": null,
706
+ "comment": null,
707
+ "enumItems": [],
708
+ "mappedType": "text"
709
+ },
710
+ "queue_mode": {
711
+ "name": "queue_mode",
712
+ "type": "text",
713
+ "unsigned": false,
714
+ "autoincrement": false,
715
+ "primary": false,
716
+ "nullable": false,
717
+ "unique": false,
718
+ "length": null,
719
+ "precision": null,
720
+ "scale": null,
721
+ "default": "'inline'",
722
+ "comment": null,
723
+ "enumItems": [],
724
+ "mappedType": "text"
725
+ },
726
+ "execution_result": {
727
+ "name": "execution_result",
728
+ "type": "jsonb",
729
+ "unsigned": false,
730
+ "autoincrement": false,
731
+ "primary": false,
732
+ "nullable": true,
733
+ "unique": false,
734
+ "length": null,
735
+ "precision": null,
736
+ "scale": null,
737
+ "default": null,
738
+ "comment": null,
739
+ "enumItems": [],
740
+ "mappedType": "json"
741
+ },
742
+ "created_at": {
743
+ "name": "created_at",
744
+ "type": "timestamptz",
745
+ "unsigned": false,
746
+ "autoincrement": false,
747
+ "primary": false,
748
+ "nullable": false,
749
+ "unique": false,
750
+ "length": 6,
751
+ "precision": null,
752
+ "scale": null,
753
+ "default": null,
754
+ "comment": null,
755
+ "enumItems": [],
756
+ "mappedType": "datetime"
757
+ },
758
+ "expires_at": {
759
+ "name": "expires_at",
760
+ "type": "timestamptz",
761
+ "unsigned": false,
762
+ "autoincrement": false,
763
+ "primary": false,
764
+ "nullable": false,
765
+ "unique": false,
766
+ "length": 6,
767
+ "precision": null,
768
+ "scale": null,
769
+ "default": null,
770
+ "comment": null,
771
+ "enumItems": [],
772
+ "mappedType": "datetime"
773
+ },
774
+ "resolved_at": {
775
+ "name": "resolved_at",
776
+ "type": "timestamptz",
777
+ "unsigned": false,
778
+ "autoincrement": false,
779
+ "primary": false,
780
+ "nullable": true,
781
+ "unique": false,
782
+ "length": 6,
783
+ "precision": null,
784
+ "scale": null,
785
+ "default": null,
786
+ "comment": null,
787
+ "enumItems": [],
788
+ "mappedType": "datetime"
789
+ },
790
+ "resolved_by_user_id": {
791
+ "name": "resolved_by_user_id",
792
+ "type": "uuid",
793
+ "unsigned": false,
794
+ "autoincrement": false,
795
+ "primary": false,
796
+ "nullable": true,
797
+ "unique": false,
798
+ "length": null,
799
+ "precision": null,
800
+ "scale": null,
801
+ "default": null,
802
+ "comment": null,
803
+ "enumItems": [],
804
+ "mappedType": "uuid"
805
+ }
806
+ },
807
+ "name": "ai_pending_actions",
808
+ "schema": "public",
809
+ "indexes": [
810
+ {
811
+ "keyName": "ai_pending_actions_tenant_org_agent_status_idx",
812
+ "columnNames": [
813
+ "tenant_id",
814
+ "organization_id",
815
+ "agent_id",
816
+ "status"
817
+ ],
818
+ "composite": true,
819
+ "constraint": false,
820
+ "primary": false,
821
+ "unique": false
822
+ },
823
+ {
824
+ "keyName": "ai_pending_actions_tenant_org_status_expires_idx",
825
+ "columnNames": [
826
+ "tenant_id",
827
+ "organization_id",
828
+ "status",
829
+ "expires_at"
830
+ ],
831
+ "composite": true,
832
+ "constraint": false,
833
+ "primary": false,
834
+ "unique": false
835
+ },
836
+ {
837
+ "keyName": "ai_pending_actions_tenant_org_idempotency_uq",
838
+ "columnNames": [],
839
+ "composite": false,
840
+ "constraint": false,
841
+ "primary": false,
842
+ "unique": false,
843
+ "expression": "create unique index \"ai_pending_actions_tenant_org_idempotency_uq\" on \"ai_pending_actions\" (\"tenant_id\", \"organization_id\", \"idempotency_key\") where \"organization_id\" is not null"
844
+ },
845
+ {
846
+ "keyName": "ai_pending_actions_tenant_idem_null_org_uq",
847
+ "columnNames": [],
848
+ "composite": false,
849
+ "constraint": false,
850
+ "primary": false,
851
+ "unique": false,
852
+ "expression": "create unique index \"ai_pending_actions_tenant_idem_null_org_uq\" on \"ai_pending_actions\" (\"tenant_id\", \"idempotency_key\") where \"organization_id\" is null"
853
+ },
854
+ {
855
+ "keyName": "ai_pending_actions_pkey",
856
+ "columnNames": [
857
+ "id"
858
+ ],
859
+ "composite": false,
860
+ "constraint": true,
861
+ "primary": true,
862
+ "unique": true
863
+ }
864
+ ],
865
+ "checks": [],
866
+ "foreignKeys": {},
867
+ "nativeEnums": {}
868
+ }
869
+ ],
870
+ "nativeEnums": {}
871
+ }