chat-js 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (439) hide show
  1. package/README.md +6 -4
  2. package/dist/index.js +2627 -2667
  3. package/package.json +10 -4
  4. package/templates/chat-app/.env.example +2 -8
  5. package/templates/chat-app/agent/agent.ts +8 -38
  6. package/templates/chat-app/agent/channels/eve.ts +37 -17
  7. package/templates/chat-app/agent/hooks/activity.ts +2 -1
  8. package/templates/chat-app/agent/hooks/billing.ts +11 -8
  9. package/templates/chat-app/agent/hooks/conversation.ts +2 -2
  10. package/templates/chat-app/agent/hooks/tool-selection.ts +7 -1
  11. package/templates/chat-app/agent/instructions/chat.ts +14 -10
  12. package/templates/chat-app/agent/sandbox.ts +2 -4
  13. package/templates/chat-app/agent/tools/installed.ts +19 -1
  14. package/templates/chat-app/app/(chat)/layout.tsx +10 -8
  15. package/templates/chat-app/app/api/agent-conversations/[id]/route.test.ts +1 -1
  16. package/templates/chat-app/app/api/agent-conversations/[id]/route.ts +1 -5
  17. package/templates/chat-app/app/api/agent-conversations/route.test.ts +31 -2
  18. package/templates/chat-app/app/api/agent-conversations/route.ts +10 -1
  19. package/templates/chat-app/app/api/agent-workspaces/[id]/route.test.ts +5 -31
  20. package/templates/chat-app/app/api/agent-workspaces/[id]/route.ts +2 -10
  21. package/templates/chat-app/app/api/eve/[...path]/route.test.ts +2 -2
  22. package/templates/chat-app/app/apple-icon.png +0 -0
  23. package/templates/chat-app/app/favicon.ico +0 -0
  24. package/templates/chat-app/app/icon.svg +1 -3
  25. package/templates/chat-app/app/opengraph-image.alt.txt +1 -0
  26. package/templates/chat-app/app/opengraph-image.png +0 -0
  27. package/templates/chat-app/chat.config.ts +0 -18
  28. package/templates/chat-app/chatjs/core/chat/compose.ts +35 -11
  29. package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -0
  30. package/templates/chat-app/chatjs/core/installation/contracts.ts +1 -4
  31. package/templates/chat-app/chatjs/core/session/contracts.ts +19 -4
  32. package/templates/chat-app/chatjs/generated/composer-tools.ts +5 -12
  33. package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +11 -5
  34. package/templates/chat-app/chatjs/generated/installed-config.ts +5 -13
  35. package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +1 -2
  36. package/templates/chat-app/chatjs/generated/installed-layout.ts +1 -7
  37. package/templates/chat-app/chatjs/generated/installed-tools.ts +3 -3
  38. package/templates/chat-app/chatjs/generated/installed.ts +3 -3
  39. package/templates/chat-app/chatjs/generated/providers.ts +5 -11
  40. package/templates/chat-app/chatjs/generated/tool-availability.ts +3 -7
  41. package/templates/chat-app/chatjs/generated/tool-definitions.ts +3 -4
  42. package/templates/chat-app/chatjs/generated/tool-requirements.ts +40 -0
  43. package/templates/chat-app/chatjs/generated/tools.ts +7 -28
  44. package/templates/chat-app/chatjs/generated/ui.ts +3 -13
  45. package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +0 -2
  46. package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -1
  47. package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +2 -0
  48. package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +70 -34
  49. package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +17 -0
  50. package/templates/chat-app/chatjs/plugins/image-viewer/client-plugin.ts +9 -0
  51. package/templates/chat-app/{components → chatjs/plugins/image-viewer}/image-modal.tsx +3 -87
  52. package/templates/chat-app/chatjs/plugins/image-viewer/viewer-action.tsx +47 -0
  53. package/templates/chat-app/chatjs/plugins/mcp/composer.tsx +1 -6
  54. package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +22 -2
  55. package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-project-item.tsx +48 -33
  56. package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +41 -22
  57. package/templates/chat-app/chatjs/plugins/search/chat.ts +4 -0
  58. package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +9 -3
  59. package/templates/chat-app/chatjs/plugins/search/search-hook.ts +5 -6
  60. package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +1 -1
  61. package/templates/chat-app/chatjs/plugins/search/search-text.ts +21 -15
  62. package/templates/chat-app/chatjs/plugins/search/sidebar-item.tsx +7 -1
  63. package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +13 -3
  64. package/templates/chat-app/chatjs/plugins/sharing/ui/shared-page.tsx +23 -39
  65. package/templates/chat-app/chatjs/plugins/sharing/ui/transcript-messages.tsx +2 -2
  66. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +18 -0
  67. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/client-plugin.ts +9 -0
  68. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/load.ts +120 -0
  69. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/preview.tsx +72 -0
  70. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/viewer-action.tsx +97 -0
  71. package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +16 -0
  72. package/templates/chat-app/chatjs/plugins/video-viewer/client-plugin.ts +9 -0
  73. package/templates/chat-app/chatjs/plugins/video-viewer/viewer-action.tsx +64 -0
  74. package/templates/chat-app/chatjs/tools/_shared/lib/define-tool-renderer.test.ts +16 -22
  75. package/templates/chat-app/chatjs/tools/attach-workspace-file/attach-conversation-file.ts +34 -0
  76. package/templates/chat-app/chatjs/tools/attach-workspace-file/attach.ts +106 -0
  77. package/templates/chat-app/chatjs/tools/attach-workspace-file/chatjs.json +19 -0
  78. package/templates/chat-app/chatjs/tools/attach-workspace-file/import.ts +71 -0
  79. package/templates/chat-app/chatjs/tools/attach-workspace-file/renderer.tsx +19 -0
  80. package/templates/chat-app/chatjs/tools/attach-workspace-file/schemas.ts +51 -0
  81. package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +62 -0
  82. package/templates/chat-app/chatjs/tools/deep-research/chatjs.json +18 -4
  83. package/templates/chat-app/chatjs/tools/deep-research/progress-panel.tsx +2 -31
  84. package/templates/chat-app/chatjs/tools/deep-research/renderer.tsx +7 -19
  85. package/templates/chat-app/chatjs/tools/deep-research/schemas.ts +1 -46
  86. package/templates/chat-app/chatjs/tools/deep-research/task.tsx +0 -41
  87. package/templates/chat-app/chatjs/tools/deep-research/tasks.tsx +2 -7
  88. package/templates/chat-app/chatjs/tools/generate-image/chatjs.json +4 -1
  89. package/templates/chat-app/chatjs/tools/generate-image/image-generation.ts +0 -1
  90. package/templates/chat-app/chatjs/tools/generate-image/renderer.tsx +39 -51
  91. package/templates/chat-app/chatjs/tools/generate-video/chatjs.json +4 -1
  92. package/templates/chat-app/chatjs/tools/generate-video/renderer.tsx +22 -11
  93. package/templates/chat-app/components/ai-elements/response.tsx +1 -1
  94. package/templates/chat-app/components/app-sidebar.tsx +26 -86
  95. package/templates/chat-app/components/artifact-actions.tsx +19 -0
  96. package/templates/chat-app/components/artifact-download-action.tsx +59 -0
  97. package/templates/chat-app/components/attachment-card.tsx +15 -9
  98. package/templates/chat-app/components/chat/chat-account.tsx +189 -0
  99. package/templates/chat-app/components/{controlled-chat-composer.tsx → chat/chat-composer.tsx} +6 -6
  100. package/templates/chat-app/components/chat/chat-conversation-screen.tsx +75 -0
  101. package/templates/chat-app/components/chat/chat-conversation.tsx +35 -0
  102. package/templates/chat-app/components/chat/chat-header.tsx +52 -0
  103. package/templates/chat-app/components/chat/chat-message-editor.tsx +24 -0
  104. package/templates/chat-app/components/chat/chat-navigation.tsx +11 -0
  105. package/templates/chat-app/components/chat/chat-sidebar.tsx +134 -0
  106. package/templates/chat-app/components/{eve/eve-messages.tsx → chat/chat-transcript.tsx} +7 -28
  107. package/templates/chat-app/components/chat/chat-workspace.tsx +19 -0
  108. package/templates/chat-app/components/chat/connected-chat-sidebar.tsx +8 -0
  109. package/templates/chat-app/components/chat-header-view.tsx +14 -13
  110. package/templates/chat-app/components/chat-slots.tsx +13 -3
  111. package/templates/chat-app/components/composer/active-tool.tsx +3 -1
  112. package/templates/chat-app/components/composer/composer-menu.tsx +4 -2
  113. package/templates/chat-app/components/composer/control.ts +4 -1
  114. package/templates/chat-app/components/composer/prompt-form.tsx +1 -1
  115. package/templates/chat-app/components/composer/tool-availability.tsx +8 -0
  116. package/templates/chat-app/components/composer/tool-controls.tsx +17 -50
  117. package/templates/chat-app/components/composer/tool-display.ts +3 -2
  118. package/templates/chat-app/components/eve/bash-output.tsx +33 -0
  119. package/templates/chat-app/components/eve/eve-chat-page.tsx +5 -26
  120. package/templates/chat-app/components/eve/eve-composer.tsx +11 -8
  121. package/templates/chat-app/components/eve/eve-conversation.tsx +237 -309
  122. package/templates/chat-app/components/eve/eve-deletion-provider.tsx +1 -1
  123. package/templates/chat-app/components/eve/eve-history-list.tsx +7 -3
  124. package/templates/chat-app/components/eve/eve-message-part.tsx +28 -22
  125. package/templates/chat-app/components/eve/eve-pending-input.tsx +54 -1
  126. package/templates/chat-app/components/eve/eve-runtime-provider.tsx +0 -5
  127. package/templates/chat-app/components/eve/new-conversation-view.tsx +7 -3
  128. package/templates/chat-app/components/file-artifact-card.tsx +37 -0
  129. package/templates/chat-app/components/header-actions.tsx +9 -2
  130. package/templates/chat-app/components/image-actions.tsx +93 -0
  131. package/templates/chat-app/components/internal-link.tsx +15 -2
  132. package/templates/chat-app/components/keyboard-shortcuts.tsx +8 -2
  133. package/templates/chat-app/components/part/tool-activity.tsx +1 -1
  134. package/templates/chat-app/components/part/tool-data.tsx +1 -1
  135. package/templates/chat-app/components/sidebar-user-nav.tsx +35 -198
  136. package/templates/chat-app/components/video-player.tsx +43 -0
  137. package/templates/chat-app/composer-controls.ts +0 -4
  138. package/templates/chat-app/docs/guest-sessions.md +1 -1
  139. package/templates/chat-app/instrumentation.ts +2 -6
  140. package/templates/chat-app/integrations/chat/models.ts +10 -0
  141. package/templates/chat-app/integrations/tools/catalog.ts +0 -3
  142. package/templates/chat-app/lib/ai/app-models.test.ts +13 -1
  143. package/templates/chat-app/lib/ai/app-models.ts +13 -3
  144. package/templates/chat-app/lib/ai/tool-context.ts +1 -14
  145. package/templates/chat-app/lib/ai/tool-renderer-registry.ts +10 -5
  146. package/templates/chat-app/lib/db/eve-current-copy.ts +13 -95
  147. package/templates/chat-app/lib/db/eve-deletion.ts +2 -61
  148. package/templates/chat-app/lib/db/eve-dispatch.ts +64 -18
  149. package/templates/chat-app/lib/db/eve-file-purge.ts +11 -145
  150. package/templates/chat-app/lib/db/eve-files.ts +11 -9
  151. package/templates/chat-app/lib/db/eve-orphaned-files.ts +3 -22
  152. package/templates/chat-app/lib/db/eve-queries.ts +32 -16
  153. package/templates/chat-app/lib/db/eve-workspace-deletion.ts +149 -0
  154. package/templates/chat-app/lib/db/migrate.ts +30 -0
  155. package/templates/chat-app/lib/db/migrations/0024_abandoned_toxin.sql +67 -0
  156. package/templates/chat-app/lib/db/migrations/0025_cloudy_thunderbolt.sql +1 -0
  157. package/templates/chat-app/lib/db/migrations/0026_loving_mesmero.sql +3 -0
  158. package/templates/chat-app/lib/db/migrations/0027_misty_stephen_strange.sql +1 -0
  159. package/templates/chat-app/lib/db/migrations/0028_faithful_hannibal_king.sql +12 -0
  160. package/templates/chat-app/lib/db/migrations/meta/0024_snapshot.json +4119 -0
  161. package/templates/chat-app/lib/db/migrations/meta/0025_snapshot.json +3988 -0
  162. package/templates/chat-app/lib/db/migrations/meta/0026_snapshot.json +3686 -0
  163. package/templates/chat-app/lib/db/migrations/meta/0027_snapshot.json +3596 -0
  164. package/templates/chat-app/lib/db/migrations/meta/0028_snapshot.json +2554 -0
  165. package/templates/chat-app/lib/db/migrations/meta/_journal.json +35 -0
  166. package/templates/chat-app/lib/db/schema.ts +1 -360
  167. package/templates/chat-app/lib/env-schema.ts +0 -7
  168. package/templates/chat-app/lib/eve/application-model.ts +56 -0
  169. package/templates/chat-app/lib/eve/bash-result.ts +22 -0
  170. package/templates/chat-app/lib/eve/branch-history.test.ts +59 -0
  171. package/templates/chat-app/lib/eve/branch-history.ts +19 -0
  172. package/templates/chat-app/lib/eve/channel-files.test.ts +14 -11
  173. package/templates/chat-app/lib/eve/channel-files.ts +2 -12
  174. package/templates/chat-app/lib/eve/completed-copy-source.test.ts +81 -17
  175. package/templates/chat-app/lib/eve/completed-copy-source.ts +2 -6
  176. package/templates/chat-app/lib/eve/connection-options.ts +7 -7
  177. package/templates/chat-app/lib/eve/contracts.test.ts +1 -1
  178. package/templates/chat-app/lib/eve/copy-seed.test.ts +17 -28
  179. package/templates/chat-app/lib/eve/copy-seed.ts +8 -34
  180. package/templates/chat-app/lib/eve/copy-transcript.test.ts +143 -47
  181. package/templates/chat-app/lib/eve/copy-transcript.ts +20 -101
  182. package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +11 -31
  183. package/templates/chat-app/lib/eve/create-conversation-operation.ts +0 -10
  184. package/templates/chat-app/lib/eve/delete-local-conversation.test.ts +12 -20
  185. package/templates/chat-app/lib/eve/delete-local-conversation.ts +2 -8
  186. package/templates/chat-app/lib/eve/environment.test.ts +7 -0
  187. package/templates/chat-app/lib/eve/environment.ts +11 -0
  188. package/templates/chat-app/lib/eve/execute-conversation-creation.ts +3 -55
  189. package/templates/chat-app/lib/eve/gateway-auth.test.ts +2 -21
  190. package/templates/chat-app/lib/eve/gateway-auth.ts +7 -13
  191. package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
  192. package/templates/chat-app/lib/eve/generated-files.ts +2 -2
  193. package/templates/chat-app/lib/eve/installed-tools.test.ts +16 -9
  194. package/templates/chat-app/lib/eve/lifecycle/postgres/compatibility.ts +8 -5
  195. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-payload-purge.ts +6 -2
  196. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-fence.ts +2 -2
  197. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-inventory.ts +2 -2
  198. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-purge.ts +3 -2
  199. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-resource-fence.ts +2 -8
  200. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-run-inventory.ts +1 -1
  201. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-stream-positions.ts +9 -4
  202. package/templates/chat-app/lib/eve/logical-chat.test.ts +4 -3
  203. package/templates/chat-app/lib/eve/logical-chat.ts +8 -8
  204. package/templates/chat-app/lib/eve/message-delivery.test.ts +1 -1
  205. package/templates/chat-app/lib/eve/message-display.test.ts +5 -5
  206. package/templates/chat-app/lib/eve/message-display.ts +31 -1
  207. package/templates/chat-app/lib/eve/message-tool-selection.test.ts +2 -2
  208. package/templates/chat-app/lib/eve/model-accounting.test.ts +28 -45
  209. package/templates/chat-app/lib/eve/model-accounting.ts +8 -54
  210. package/templates/chat-app/lib/eve/purge-files.ts +0 -13
  211. package/templates/chat-app/lib/eve/purge-local-resources.ts +4 -47
  212. package/templates/chat-app/lib/eve/readonly-message-types.ts +8 -3
  213. package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -37
  214. package/templates/chat-app/lib/eve/response-group-lineage.test.ts +3 -3
  215. package/templates/chat-app/lib/eve/retire-session.test.ts +25 -8
  216. package/templates/chat-app/lib/eve/retire-session.ts +10 -4
  217. package/templates/chat-app/lib/eve/selected-tools.ts +7 -18
  218. package/templates/chat-app/lib/eve/server.test.ts +29 -3
  219. package/templates/chat-app/lib/eve/session-profile.test.ts +12 -9
  220. package/templates/chat-app/lib/eve/session-profile.ts +7 -4
  221. package/templates/chat-app/lib/eve/shared-messages.test.ts +3 -4
  222. package/templates/chat-app/lib/eve/shared-messages.ts +5 -2
  223. package/templates/chat-app/lib/eve/tool-accounting.test.ts +131 -0
  224. package/templates/chat-app/lib/eve/tool-accounting.ts +96 -0
  225. package/templates/chat-app/lib/eve/tool-availability.ts +4 -1
  226. package/templates/chat-app/lib/eve/tool-configuration.ts +29 -0
  227. package/templates/chat-app/lib/eve/tool-result.ts +1 -1
  228. package/templates/chat-app/lib/eve/turn-tools.ts +3 -12
  229. package/templates/chat-app/lib/eve/usage.test.ts +54 -39
  230. package/templates/chat-app/lib/eve/usage.ts +9 -1
  231. package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +8 -6
  232. package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +0 -5
  233. package/templates/chat-app/lib/required-credentials.test.ts +2 -2
  234. package/templates/chat-app/lib/tool-readiness.test.ts +69 -0
  235. package/templates/chat-app/lib/tool-readiness.ts +43 -0
  236. package/templates/chat-app/logo.svg +1 -1
  237. package/templates/chat-app/next.config.ts +1 -5
  238. package/templates/chat-app/oxlint.config.ts +3 -6
  239. package/templates/chat-app/package.json +4 -16
  240. package/templates/chat-app/providers/chat-models-provider.tsx +3 -3
  241. package/templates/chat-app/providers/default-model-provider.tsx +4 -4
  242. package/templates/chat-app/providers/session-context.ts +24 -0
  243. package/templates/chat-app/providers/session-provider.tsx +4 -21
  244. package/templates/chat-app/scripts/agent-status.ts +124 -0
  245. package/templates/chat-app/scripts/check-env.ts +0 -10
  246. package/templates/chat-app/scripts/dev-supervisor.mts +3 -30
  247. package/templates/chat-app/scripts/eve-setup.ts +3 -0
  248. package/templates/chat-app/tests/helpers/eve-dynamic-context.ts +2 -0
  249. package/templates/chat-app/tools/platform/research-updates-schema.ts +1 -20
  250. package/templates/chat-app/trpc/context.tsx +8 -0
  251. package/templates/chat-app/trpc/react.tsx +3 -4
  252. package/templates/chat-app/trpc/routers/eve.router.ts +2 -74
  253. package/templates/chat-app/vendor/workflow-world-postgres-5.1.1.tgz +0 -0
  254. package/templates/electron/icon.png +0 -0
  255. package/templates/electron/package.json +2 -1
  256. package/templates/electron/src/application.test.ts +347 -0
  257. package/templates/electron/src/application.ts +849 -0
  258. package/templates/electron/src/lib/auth-cookies.ts +1 -1
  259. package/templates/electron/src/main.test.ts +175 -0
  260. package/templates/electron/src/main.ts +5 -745
  261. package/templates/electron/src/squirrel-startup.ts +61 -0
  262. package/templates/chat-app/agent/hooks/persistent-sandbox.ts +0 -14
  263. package/templates/chat-app/app/api/agent-conversation-copies/route.test.ts +0 -190
  264. package/templates/chat-app/app/api/agent-conversation-copies/route.ts +0 -105
  265. package/templates/chat-app/chatjs/core/documents/compose-views.ts +0 -12
  266. package/templates/chat-app/chatjs/core/documents/contracts.ts +0 -91
  267. package/templates/chat-app/chatjs/core/documents/document-definition.test.ts +0 -60
  268. package/templates/chat-app/chatjs/core/documents/document-definition.ts +0 -55
  269. package/templates/chat-app/chatjs/core/documents/ui.ts +0 -67
  270. package/templates/chat-app/chatjs/generated/code-executor.ts +0 -6
  271. package/templates/chat-app/chatjs/generated/document-run.ts +0 -12
  272. package/templates/chat-app/chatjs/generated/document-ui.ts +0 -7
  273. package/templates/chat-app/chatjs/generated/documents.ts +0 -6
  274. package/templates/chat-app/chatjs/plugins/langfuse/chatjs.json +0 -14
  275. package/templates/chat-app/chatjs/plugins/langfuse/credentials.ts +0 -22
  276. package/templates/chat-app/chatjs/plugins/langfuse/instrumentation.ts +0 -22
  277. package/templates/chat-app/chatjs/plugins/langfuse/server-plugin.ts +0 -5
  278. package/templates/chat-app/chatjs/plugins/vercel-analytics/chatjs.json +0 -15
  279. package/templates/chat-app/chatjs/plugins/vercel-analytics/client-plugin.ts +0 -9
  280. package/templates/chat-app/chatjs/plugins/vercel-analytics/component.tsx +0 -5
  281. package/templates/chat-app/chatjs/plugins/vercel-speed-insights/chatjs.json +0 -15
  282. package/templates/chat-app/chatjs/plugins/vercel-speed-insights/client-plugin.ts +0 -9
  283. package/templates/chat-app/chatjs/plugins/vercel-speed-insights/component.tsx +0 -4
  284. package/templates/chat-app/chatjs/providers/sandbox/adapter.ts +0 -232
  285. package/templates/chat-app/chatjs/providers/sandbox/options.ts +0 -13
  286. package/templates/chat-app/chatjs/providers/sandbox/persistent.ts +0 -258
  287. package/templates/chat-app/chatjs/providers/sandbox/provider.ts +0 -27
  288. package/templates/chat-app/chatjs/providers/sandbox/vercel-sandbox-env.ts +0 -22
  289. package/templates/chat-app/chatjs/tools/_shared/code-execution/code-execution-chart.tsx +0 -83
  290. package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-chart-impl.tsx +0 -290
  291. package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-charts.tsx +0 -24
  292. package/templates/chat-app/chatjs/tools/_shared/code-execution/javascript.ts +0 -222
  293. package/templates/chat-app/chatjs/tools/_shared/code-execution/python.ts +0 -381
  294. package/templates/chat-app/chatjs/tools/_shared/code-execution/types.ts +0 -27
  295. package/templates/chat-app/chatjs/tools/code-documents/assistant-actions.ts +0 -16
  296. package/templates/chat-app/chatjs/tools/code-documents/chatjs.json +0 -20
  297. package/templates/chat-app/chatjs/tools/code-documents/configuration-schema.ts +0 -7
  298. package/templates/chat-app/chatjs/tools/code-documents/definition.ts +0 -9
  299. package/templates/chat-app/chatjs/tools/code-documents/document.tsx +0 -33
  300. package/templates/chat-app/chatjs/tools/code-documents/editor.tsx +0 -144
  301. package/templates/chat-app/chatjs/tools/code-documents/guidelines.ts +0 -15
  302. package/templates/chat-app/chatjs/tools/code-documents/tool.ts +0 -54
  303. package/templates/chat-app/chatjs/tools/code-execution/chatjs.json +0 -21
  304. package/templates/chat-app/chatjs/tools/code-execution/python.test.ts +0 -207
  305. package/templates/chat-app/chatjs/tools/code-execution/renderer.test.tsx +0 -142
  306. package/templates/chat-app/chatjs/tools/code-execution/renderer.tsx +0 -68
  307. package/templates/chat-app/chatjs/tools/code-execution/schemas.ts +0 -23
  308. package/templates/chat-app/chatjs/tools/code-execution/tool.ts +0 -93
  309. package/templates/chat-app/chatjs/tools/deep-research/agent.ts +0 -18
  310. package/templates/chat-app/chatjs/tools/deep-research/availability.ts +0 -23
  311. package/templates/chat-app/chatjs/tools/deep-research/configuration-schema.ts +0 -36
  312. package/templates/chat-app/chatjs/tools/deep-research/configuration.ts +0 -22
  313. package/templates/chat-app/chatjs/tools/deep-research/prompts.ts +0 -280
  314. package/templates/chat-app/chatjs/tools/deep-research/search-updates.ts +0 -76
  315. package/templates/chat-app/chatjs/tools/deep-research/steps.ts +0 -92
  316. package/templates/chat-app/chatjs/tools/delete-document/availability.ts +0 -13
  317. package/templates/chat-app/chatjs/tools/delete-document/chatjs.json +0 -9
  318. package/templates/chat-app/chatjs/tools/delete-document/execute.ts +0 -78
  319. package/templates/chat-app/chatjs/tools/delete-document/schemas.ts +0 -18
  320. package/templates/chat-app/chatjs/tools/delete-document/tool.ts +0 -49
  321. package/templates/chat-app/chatjs/tools/get-weather/chatjs.json +0 -14
  322. package/templates/chat-app/chatjs/tools/get-weather/definition.ts +0 -10
  323. package/templates/chat-app/chatjs/tools/get-weather/renderer.test.tsx +0 -57
  324. package/templates/chat-app/chatjs/tools/get-weather/renderer.tsx +0 -290
  325. package/templates/chat-app/chatjs/tools/get-weather/schemas.ts +0 -51
  326. package/templates/chat-app/chatjs/tools/get-weather/tool.ts +0 -34
  327. package/templates/chat-app/chatjs/tools/read-document/chatjs.json +0 -8
  328. package/templates/chat-app/chatjs/tools/read-document/tool.ts +0 -27
  329. package/templates/chat-app/chatjs/tools/retrieve-url/chatjs.json +0 -11
  330. package/templates/chat-app/chatjs/tools/retrieve-url/renderer.tsx +0 -200
  331. package/templates/chat-app/chatjs/tools/retrieve-url/retrieve-url-env.ts +0 -11
  332. package/templates/chat-app/chatjs/tools/retrieve-url/schemas.ts +0 -24
  333. package/templates/chat-app/chatjs/tools/retrieve-url/tool.test.ts +0 -144
  334. package/templates/chat-app/chatjs/tools/retrieve-url/tool.ts +0 -169
  335. package/templates/chat-app/chatjs/tools/saved-code-execution/chatjs.json +0 -12
  336. package/templates/chat-app/chatjs/tools/saved-code-execution/document-runs.ts +0 -31
  337. package/templates/chat-app/chatjs/tools/saved-code-execution/document.tsx +0 -84
  338. package/templates/chat-app/chatjs/tools/saved-code-execution/execute.ts +0 -126
  339. package/templates/chat-app/chatjs/tools/saved-code-execution/renderer.tsx +0 -30
  340. package/templates/chat-app/chatjs/tools/saved-code-execution/result.tsx +0 -42
  341. package/templates/chat-app/chatjs/tools/saved-code-execution/schemas.ts +0 -82
  342. package/templates/chat-app/chatjs/tools/saved-code-execution/tool.ts +0 -12
  343. package/templates/chat-app/chatjs/tools/sheet-documents/assistant-actions.ts +0 -22
  344. package/templates/chat-app/chatjs/tools/sheet-documents/chatjs.json +0 -20
  345. package/templates/chat-app/chatjs/tools/sheet-documents/configuration-schema.ts +0 -10
  346. package/templates/chat-app/chatjs/tools/sheet-documents/definition.ts +0 -9
  347. package/templates/chat-app/chatjs/tools/sheet-documents/document.tsx +0 -41
  348. package/templates/chat-app/chatjs/tools/sheet-documents/editor.tsx +0 -180
  349. package/templates/chat-app/chatjs/tools/sheet-documents/guidelines.ts +0 -5
  350. package/templates/chat-app/chatjs/tools/sheet-documents/tool.ts +0 -54
  351. package/templates/chat-app/chatjs/tools/tavily-search/chatjs.json +0 -19
  352. package/templates/chat-app/chatjs/tools/tavily-search/renderer.tsx +0 -25
  353. package/templates/chat-app/chatjs/tools/tavily-search/schemas.ts +0 -39
  354. package/templates/chat-app/chatjs/tools/tavily-search/tavily-search-env.ts +0 -11
  355. package/templates/chat-app/chatjs/tools/tavily-search/tool.test.ts +0 -114
  356. package/templates/chat-app/chatjs/tools/tavily-search/tool.ts +0 -143
  357. package/templates/chat-app/chatjs/tools/text-documents/assistant-actions.ts +0 -12
  358. package/templates/chat-app/chatjs/tools/text-documents/chatjs.json +0 -20
  359. package/templates/chat-app/chatjs/tools/text-documents/comparison.tsx +0 -72
  360. package/templates/chat-app/chatjs/tools/text-documents/configuration-schema.ts +0 -7
  361. package/templates/chat-app/chatjs/tools/text-documents/definition.ts +0 -9
  362. package/templates/chat-app/chatjs/tools/text-documents/diffview.tsx +0 -214
  363. package/templates/chat-app/chatjs/tools/text-documents/document.tsx +0 -46
  364. package/templates/chat-app/chatjs/tools/text-documents/editor-config.ts +0 -53
  365. package/templates/chat-app/chatjs/tools/text-documents/editor.tsx +0 -139
  366. package/templates/chat-app/chatjs/tools/text-documents/guidelines.ts +0 -7
  367. package/templates/chat-app/chatjs/tools/text-documents/tool.ts +0 -54
  368. package/templates/chat-app/chatjs/tools/word-count/chatjs.json +0 -14
  369. package/templates/chat-app/chatjs/tools/word-count/definition.ts +0 -10
  370. package/templates/chat-app/chatjs/tools/word-count/renderer.tsx +0 -64
  371. package/templates/chat-app/chatjs/tools/word-count/schemas.ts +0 -13
  372. package/templates/chat-app/chatjs/tools/word-count/tool.ts +0 -45
  373. package/templates/chat-app/components/chat/chat-layout.tsx +0 -129
  374. package/templates/chat-app/components/chat-sidebar-view.tsx +0 -53
  375. package/templates/chat-app/components/document-skeleton.tsx +0 -33
  376. package/templates/chat-app/components/eve/eve-artifact-layout.tsx +0 -722
  377. package/templates/chat-app/components/eve/eve-copy-button.tsx +0 -165
  378. package/templates/chat-app/components/eve/eve-document-actions.tsx +0 -124
  379. package/templates/chat-app/components/eve/eve-document-assistant-actions.tsx +0 -157
  380. package/templates/chat-app/components/eve/eve-document-body.tsx +0 -29
  381. package/templates/chat-app/components/eve/eve-document-context.tsx +0 -12
  382. package/templates/chat-app/components/eve/eve-document-preview.tsx +0 -128
  383. package/templates/chat-app/components/eve/eve-document-tool.tsx +0 -190
  384. package/templates/chat-app/components/eve/eve-history.tsx +0 -25
  385. package/templates/chat-app/components/eve/use-document-draft.ts +0 -281
  386. package/templates/chat-app/components/favicon-group.tsx +0 -50
  387. package/templates/chat-app/components/part/document-common.tsx +0 -152
  388. package/templates/chat-app/components/part/web-search.tsx +0 -75
  389. package/templates/chat-app/components/sandbox.tsx +0 -43
  390. package/templates/chat-app/components/source-badge.tsx +0 -50
  391. package/templates/chat-app/components/sources.tsx +0 -140
  392. package/templates/chat-app/hooks/use-artifact.tsx +0 -180
  393. package/templates/chat-app/integrations/documents/definitions.ts +0 -4
  394. package/templates/chat-app/integrations/documents/run.ts +0 -1
  395. package/templates/chat-app/integrations/documents/ui.ts +0 -4
  396. package/templates/chat-app/integrations/providers/sandbox.ts +0 -10
  397. package/templates/chat-app/integrations/tools/code-executor.ts +0 -1
  398. package/templates/chat-app/lib/ai/telemetry.ts +0 -4
  399. package/templates/chat-app/lib/artifacts/artifact-kind.ts +0 -8
  400. package/templates/chat-app/lib/artifacts/types.ts +0 -19
  401. package/templates/chat-app/lib/db/eve-code-sandboxes.ts +0 -197
  402. package/templates/chat-app/lib/db/eve-document-retention.ts +0 -36
  403. package/templates/chat-app/lib/db/eve-documents.ts +0 -700
  404. package/templates/chat-app/lib/eve/code-executor.ts +0 -32
  405. package/templates/chat-app/lib/eve/code-sandbox-name.test.ts +0 -60
  406. package/templates/chat-app/lib/eve/code-sandbox-name.ts +0 -56
  407. package/templates/chat-app/lib/eve/code-sandbox-ownership.ts +0 -88
  408. package/templates/chat-app/lib/eve/copy-input.ts +0 -11
  409. package/templates/chat-app/lib/eve/create-native-copy.ts +0 -38
  410. package/templates/chat-app/lib/eve/document-assistant-actions.test.ts +0 -48
  411. package/templates/chat-app/lib/eve/document-assistant-actions.ts +0 -22
  412. package/templates/chat-app/lib/eve/document-kind-lifecycle.test.ts +0 -148
  413. package/templates/chat-app/lib/eve/document-tools.ts +0 -164
  414. package/templates/chat-app/lib/eve/lifecycle/postgres/eve-sandbox-coverage-proof.ts +0 -140
  415. package/templates/chat-app/lib/eve/persistent-sandbox-store.ts +0 -621
  416. package/templates/chat-app/lib/eve/persistent-sandbox.test.ts +0 -209
  417. package/templates/chat-app/lib/eve/persistent-sandbox.ts +0 -328
  418. package/templates/chat-app/lib/eve/purge-code-sandboxes.test.ts +0 -125
  419. package/templates/chat-app/lib/eve/purge-code-sandboxes.ts +0 -83
  420. package/templates/chat-app/lib/eve/request-copy.test.ts +0 -95
  421. package/templates/chat-app/lib/eve/request-copy.ts +0 -129
  422. package/templates/chat-app/lib/eve/research-progress.test.ts +0 -95
  423. package/templates/chat-app/lib/eve/research-progress.ts +0 -42
  424. package/templates/chat-app/lib/eve/sandbox-environment.test.ts +0 -49
  425. package/templates/chat-app/lib/eve/sandbox-environment.ts +0 -29
  426. package/templates/chat-app/lib/eve/save-copy-operation.ts +0 -33
  427. package/templates/chat-app/lib/eve/save-document.ts +0 -87
  428. package/templates/chat-app/lib/eve/verify-local-coverage.ts +0 -84
  429. package/templates/chat-app/lib/eve/workspace-attachments.ts +0 -173
  430. package/templates/chat-app/lib/sandbox/runtime.ts +0 -12
  431. package/templates/chat-app/scripts/persistent-sandbox-cleanup.ts +0 -128
  432. package/templates/chat-app/scripts/stop-persistent-sandboxes.ts +0 -24
  433. package/templates/chat-app/tests/artifacts.e2e.ts +0 -7
  434. package/templates/chat-app/tools/platform/documents/types.ts +0 -11
  435. package/templates/chat-app/tools/platform/search-presentation.ts +0 -138
  436. package/templates/chat-app/tools/platform/steps/multi-query-web-search.test.ts +0 -45
  437. package/templates/chat-app/tools/platform/steps/multi-query-web-search.ts +0 -142
  438. package/templates/chat-app/tools/platform/steps/search-utils.ts +0 -26
  439. package/templates/chat-app/vendor/workflow-world-postgres-5.0.0-beta.40.tgz +0 -0
@@ -1,22 +0,0 @@
1
- import { config } from "@/lib/config";
2
-
3
- export const getDeepResearchConfig = (): {
4
- allow_clarification: typeof config.ai.tools.deepResearch.allowClarification;
5
- compression_model: typeof config.ai.tools.deepResearch.defaultModel;
6
- final_report_model: typeof config.ai.tools.deepResearch.finalReportModel;
7
- max_concurrent_research_units: typeof config.ai.tools.deepResearch.maxConcurrentResearchUnits;
8
- max_researcher_iterations: typeof config.ai.tools.deepResearch.maxResearcherIterations;
9
- research_model: typeof config.ai.tools.deepResearch.defaultModel;
10
- search_api_max_queries: typeof config.ai.tools.deepResearch.maxSearchQueries;
11
- } => {
12
- const options = config.ai.tools.deepResearch;
13
- return {
14
- allow_clarification: options.allowClarification,
15
- compression_model: options.defaultModel,
16
- final_report_model: options.finalReportModel,
17
- max_concurrent_research_units: options.maxConcurrentResearchUnits,
18
- max_researcher_iterations: options.maxResearcherIterations,
19
- research_model: options.defaultModel,
20
- search_api_max_queries: options.maxSearchQueries,
21
- };
22
- };
@@ -1,280 +0,0 @@
1
- const clarifyWithUserInstructions = ({
2
- messages,
3
- date,
4
- }: Readonly<{
5
- messages: string;
6
- date: string;
7
- }>): string =>
8
- `These are the messages that have been exchanged so far from the user asking for the report:
9
- <Messages>
10
- ${messages}
11
- </Messages>
12
-
13
- Today's date is ${date}.
14
-
15
- Assess whether you need to ask a clarifying question, or if the user has already provided enough information for you to start research.
16
- IMPORTANT: If you can see in the messages history that you have already asked a clarifying question, you almost always do not need to ask another one. Only ask another question if ABSOLUTELY NECESSARY.
17
-
18
- If there are acronyms, abbreviations, or unknown terms, ask the user to clarify.
19
- If you need to ask a question, follow these guidelines:
20
- - Be concise while gathering all necessary information
21
- - Make sure to gather all the information needed to carry out the research task in a concise, well-structured manner.
22
- - Use bullet points or numbered lists if appropriate for clarity. Make sure that this uses markdown formatting and will be rendered correctly if the string output is passed to a markdown renderer.
23
- - Don't ask for unnecessary information, or information that the user has already provided. If you can see that the user has already provided the information, do not ask for it again.
24
-
25
- Respond in valid JSON format with these exact keys:
26
- "need_clarification": boolean,
27
- "question": "<question to ask the user to clarify the report scope>",
28
- "verification": "<verification message that we will start research>"
29
-
30
- If you need to ask a clarifying question, return:
31
- "need_clarification": true,
32
- "question": "<your clarifying question>",
33
- "verification": ""
34
-
35
- If you do not need to ask a clarifying question, return:
36
- "need_clarification": false,
37
- "question": "",
38
- "verification": "<acknowledgement message that you will now start research based on the provided information>"
39
-
40
- For the verification message when no clarification is needed:
41
- - Acknowledge that you have sufficient information to proceed
42
- - Briefly summarize the key aspects of what you understand from their request
43
- - Confirm that you will now begin the research process
44
- - Keep the message concise and professional`;
45
-
46
- const transformMessagesIntoResearchTopicPrompt = ({
47
- messages,
48
- date,
49
- }: Readonly<{
50
- messages: string;
51
- date: string;
52
- }>): string =>
53
- `You will be given a set of messages that have been exchanged so far between yourself and the user.
54
- Your job is to translate these messages into a more detailed and concrete research question that will be used to guide the research.
55
-
56
- The messages that have been exchanged so far between yourself and the user are:
57
- <Messages>
58
- ${messages}
59
- </Messages>
60
-
61
- Today's date is ${date}.
62
-
63
- You will return a single research question that will be used to guide the research.
64
-
65
- Guidelines:
66
- 1. Maximize Specificity and Detail
67
- - Include all known user preferences and explicitly list key attributes or dimensions to consider.
68
- - It is important that all details from the user are included in the instructions.
69
-
70
- 2. Fill in Unstated But Necessary Dimensions as Open-Ended
71
- - If certain attributes are essential for a meaningful output but the user has not provided them, explicitly state that they are open-ended or default to no specific constraint.
72
-
73
- 3. Avoid Unwarranted Assumptions
74
- - If the user has not provided a particular detail, do not invent one.
75
- - Instead, state the lack of specification and guide the researcher to treat it as flexible or accept all possible options.
76
-
77
- 4. Use the First Person
78
- - Phrase the request from the perspective of the user.
79
-
80
- 5. Sources
81
- - If specific sources should be prioritized, specify them in the research question.
82
- - For product and travel research, prefer linking directly to official or primary websites (e.g., official brand sites, manufacturer pages, or reputable e-commerce platforms like Amazon for user reviews) rather than aggregator sites or SEO-heavy blogs.
83
- - For academic or scientific queries, prefer linking directly to the original paper or official journal publication rather than survey papers or secondary summaries.
84
- - For people, try linking directly to their LinkedIn profile, or their personal website if they have one.
85
- - If the query is in a specific language, prioritize sources published in that language.`;
86
-
87
- const leadResearcherPrompt = ({
88
- date,
89
- max_concurrent_research_units,
90
- }: Readonly<{
91
- date: string;
92
- max_concurrent_research_units: number;
93
- }>): string =>
94
- `You are a research supervisor. Today's date is ${date}.
95
- You receive a research brief and findings from all completed topics. Decide whether the evidence is sufficient for a comprehensive report or identify specific gaps requiring follow-up research.
96
-
97
- Return JSON with complete (boolean) and topics (array of strings).
98
- - To research, set complete to false and provide up to ${max_concurrent_research_units} detailed, self-contained topics. The workflow will run them sequentially and return their findings before your next decision.
99
- - To finish, set complete to true and topics to []. A separate writer synthesizes the report.
100
- - Start by researching the brief. On later rounds, request only net new information that is necessary to answer it. Do not ask researchers to synthesize existing findings.
101
- - Each topic must include all necessary context, explain acronyms, and state the desired depth of effort. Researchers do not see your other topics or findings.
102
- - Split independent questions when that improves coverage. Resolve dependencies first. More topics increase cost; prefer fewer comprehensive investigations over redundant subtopics.
103
- - Judge evidence coverage and reliability, not formatting. Findings may be raw or messy.
104
- - Match depth to the user's request. Detailed or comprehensive requests warrant more follow-up than broad overviews.
105
- - As research accumulates, require a stronger reason to request additional work. Finish when the findings adequately answer the brief. Do not repeat topics with minor rephrasing.`;
106
-
107
- const researchSystemPrompt = ({
108
- date,
109
- mcp_prompt,
110
- max_search_queries,
111
- }: Readonly<{
112
- date: string;
113
- mcp_prompt: string;
114
- max_search_queries: number;
115
- }>): string =>
116
- `You are a research assistant conducting deep research on the user's input topic. Use the tools and search methods provided to research the user's input topic. For context, today's date is ${date}.
117
-
118
- <Task>
119
- Your job is to use tools and search methods to find information that can answer the question that a user asks.
120
- You can use any of the tools provided to you to find resources that can help answer the research question. You can call these tools in series or in parallel, your research is conducted in a tool-calling loop.
121
- </Task>
122
-
123
- <Tool Calling Guidelines>
124
- - Make sure you review all of the tools you have available to you, match the tools to the user's request, and select the tool that is most likely to be the best fit.
125
- - In each iteration, select the BEST tool for the job, this may or may not be general websearch.
126
- - When selecting the next tool to call, make sure that you are calling tools with arguments that you have not already tried.
127
- - Tool calling is costly, so be sure to be very intentional about what you look up. Some of the tools may have implicit limitations. As you call tools, feel out what these limitations are, and adjust your tool calls accordingly.
128
- - You have a maximum of ${max_search_queries} web search queries available, so use them strategically and efficiently.
129
- - This could mean that you need to call a different tool or stop searching, e.g. it's okay to recognize that a tool has limitations and cannot do what you need it to.
130
- - Don't mention any tool limitations in your output, but adjust your tool calls accordingly.
131
- - ${mcp_prompt}
132
- <Tool Calling Guidelines>
133
-
134
- <Criteria for Finishing Research>
135
- - The user will give you a sense of how much effort you should put into the research. This does not translate ~directly~ to the number of tool calls you should make, but it does give you a sense of the depth of the research you should conduct.
136
- - Once you have enough evidence, stop searching and call eve__reply with your findings, including source URLs, citations, uncertainties, and conflicting evidence.
137
- - One case where you should stop is if your previous tool calls have stopped yielding useful information.
138
- </Criteria for Finishing Research>
139
-
140
- <Helpful Tips>
141
- 1. If you haven't conducted any searches yet, start with broad searches to get necessary context and background information. Once you have some background, you can start to narrow down your searches to get more specific information.
142
- 2. Different topics require different levels of research depth. If the question is broad, your research can be more shallow, and you may not need to iterate and call tools as many times.
143
- 3. If the question is detailed, you may need to be more stingy about the depth of your findings, and you may need to iterate and call tools more times to get a fully detailed answer.
144
- </Helpful Tips>
145
-
146
- <Critical Reminders>
147
- - You MUST conduct research using web search or a different tool before finishing! You cannot finish without conducting research first!
148
- - The caller needs your findings, not just your search activity. Always finish by calling eve__reply with the collected evidence; a separate agent will compress it and write the user-facing report.
149
- </Critical Reminders>`;
150
-
151
- const compressResearchSystemPrompt = ({
152
- date,
153
- }: Readonly<{ date: string }>): string =>
154
- `You are a research assistant that has conducted research on a topic by calling several tools and web searches. Your job is now to clean up the findings, but preserve all of the relevant statements and information that the researcher has gathered. For context, today's date is ${date}.
155
-
156
- <Task>
157
- You need to clean up information gathered from tool calls and web searches in the existing messages.
158
- All relevant information should be repeated and rewritten verbatim, but in a cleaner format.
159
- The purpose of this step is just to remove any obviously irrelevant or duplicative information.
160
- For example, if three sources all say "X", you could say "These three sources all stated X".
161
- Only these fully comprehensive cleaned findings are going to be returned to the user, so it's crucial that you don't lose any information from the raw messages.
162
- </Task>
163
-
164
- <Guidelines>
165
- 1. Your output findings should be fully comprehensive and include ALL of the information and sources that the researcher has gathered from tool calls and web searches. It is expected that you repeat key information verbatim.
166
- 2. This report can be as long as necessary to return ALL of the information that the researcher has gathered.
167
- 3. In your report, you should return inline citations for each source that the researcher found.
168
- 4. You should include a "Sources" section at the end of the report that lists all of the sources the researcher found with corresponding citations, cited against statements in the report.
169
- 5. Make sure to include ALL of the sources that the researcher gathered in the report, and how they were used to answer the question!
170
- 6. It's really important not to lose any sources. A later LLM will be used to merge this report with others, so having all of the sources is critical.
171
- </Guidelines>
172
-
173
- <Output Format>
174
- The report should be structured like this:
175
- **List of Queries and Tool Calls Made**
176
- **Fully Comprehensive Findings**
177
- **List of All Relevant Sources (with citations in the report)**
178
- </Output Format>
179
-
180
- <Citation Rules>
181
- - Assign each unique URL a single citation number in your text
182
- - End with ### Sources that lists each source with corresponding numbers
183
- - IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose
184
- - Example format:
185
- [1] Source Title: URL
186
- [2] Source Title: URL
187
- </Citation Rules>
188
-
189
- Critical Reminder: It is extremely important that any information that is even remotely relevant to the user's research topic is preserved verbatim (e.g. don't rewrite it, don't summarize it, don't paraphrase it).`;
190
-
191
- const compressResearchSimpleHumanMessage = `All above messages are about research conducted by an AI Researcher. Please clean up these findings.
192
-
193
- DO NOT summarize the information. I want the raw information returned, just in a cleaner format. Make sure all relevant information is preserved - you can rewrite findings verbatim.`;
194
-
195
- const FINAL_REPORT_INSTRUCTIONS = `
196
-
197
- Please create a detailed answer to the overall research brief that:
198
- 1. Is well-organized with proper headings (# for title, ## for sections, ### for subsections)
199
- 2. Includes specific facts and insights from the research
200
- 3. References relevant sources using [Title](URL) format
201
- 4. Provides a balanced, thorough analysis. Be as comprehensive as possible, and include all information that is relevant to the overall research question. People are using you for deep research and will expect detailed, comprehensive answers.
202
- 5. Includes a "Sources" section at the end with all referenced links
203
-
204
- You can structure your report in a number of different ways. Here are some examples:
205
-
206
- To answer a question that asks you to compare two things, you might structure your report like this:
207
- 1/ intro
208
- 2/ overview of topic A
209
- 3/ overview of topic B
210
- 4/ comparison between A and B
211
- 5/ conclusion
212
-
213
- To answer a question that asks you to return a list of things, you might only need a single section which is the entire list.
214
- 1/ list of things or table of things
215
- Or, you could choose to make each item in the list a separate section in the report. When asked for lists, you don't need an introduction or conclusion.
216
- 1/ item 1
217
- 2/ item 2
218
- 3/ item 3
219
-
220
- To answer a question that asks you to summarize a topic, give a report, or give an overview, you might structure your report like this:
221
- 1/ overview of topic
222
- 2/ concept 1
223
- 3/ concept 2
224
- 4/ concept 3
225
- 5/ conclusion
226
-
227
- If you think you can answer the question with a single section, you can do that too!
228
- 1/ answer
229
-
230
- REMEMBER: Section is a VERY fluid and loose concept. You can structure your report however you think is best, including in ways that are not listed above!
231
- Make sure that your sections are cohesive, and make sense for the reader.
232
-
233
- For each section of the report, do the following:
234
- - Use simple, clear language
235
- - Use ## for section title (Markdown format) for each section of the report
236
- - Do NOT ever refer to yourself as the writer of the report. This should be a professional report without any self-referential language.
237
- - Do not say what you are doing in the report. Just write the report without any commentary from yourself.
238
-
239
- Format the report in clear markdown with proper structure and include source references where appropriate.
240
-
241
- <Citation Rules>
242
- - Assign each unique URL a single citation number in your text
243
- - End with ### Sources that lists each source with corresponding numbers
244
- - IMPORTANT: Number sources sequentially without gaps (1,2,3,4...) in the final list regardless of which sources you choose
245
- - Each source should be a separate line item in a list, so that in markdown it is rendered as a list.
246
- - Example format:
247
- [1] Source Title: URL
248
- [2] Source Title: URL
249
- - Citations are extremely important. Make sure to include these, and pay a lot of attention to getting these right. Users will often use these citations to look into more information.
250
- </Citation Rules>`;
251
-
252
- const finalReportGenerationPrompt = ({
253
- research_brief,
254
- date,
255
- findings,
256
- }: Readonly<{
257
- research_brief: string;
258
- date: string;
259
- findings: string;
260
- }>): string =>
261
- `Based on all the research conducted, create a comprehensive, well-structured answer to the overall research brief:
262
- <Research Brief>
263
- ${research_brief}
264
- </Research Brief>
265
-
266
- Today's date is ${date}.
267
-
268
- Here are the findings from the research that you conducted:
269
- <Findings>
270
- ${findings}
271
- </Findings>${FINAL_REPORT_INSTRUCTIONS}`;
272
- export {
273
- clarifyWithUserInstructions,
274
- compressResearchSimpleHumanMessage,
275
- compressResearchSystemPrompt,
276
- finalReportGenerationPrompt,
277
- leadResearcherPrompt,
278
- researchSystemPrompt,
279
- transformMessagesIntoResearchTopicPrompt,
280
- };
@@ -1,76 +0,0 @@
1
- import { Client } from "eve/client";
2
- import { ResearchUpdateSchema } from "@/tools/platform/research-updates-schema";
3
- import type { WebSearchUpdate } from "@/tools/platform/research-updates-schema";
4
- import type { WorkflowToolContext } from "eve/tools";
5
- import { getEveConnectionOptions } from "@/lib/eve/connection-options";
6
- import { toolOutputSchema } from "@/lib/eve/tool-result";
7
-
8
- type Context = Readonly<
9
- Pick<WorkflowToolContext, "session" | "callId"> & {
10
- abortSignal: Readonly<AbortSignal>;
11
- }
12
- >;
13
-
14
- type Snapshot = Awaited<
15
- ReturnType<ReturnType<Client["sessions"]["attach"]>["snapshot"]>
16
- >;
17
- const readResearchSnapshots = async (
18
- client: Readonly<{ sessions: Readonly<Pick<Client["sessions"], "attach">> }>,
19
- sessionIds: readonly string[],
20
- options: Readonly<{ signal: Readonly<AbortSignal> }>
21
- ): Promise<Snapshot[]> => {
22
- const requests: Promise<Snapshot>[] = [];
23
- for (const sessionId of sessionIds) {
24
- requests.push(client.sessions.attach(sessionId).snapshot(options));
25
- }
26
- return await Promise.all(requests);
27
- };
28
- // oxlint-disable-next-line eslint/func-style -- EVE 0.61 authored-workflow-directives rejects const-bound steps; record owned child search snapshots so replay never rereads live evidence.
29
- export async function researchSearchUpdates(
30
- context: Context
31
- ): Promise<WebSearchUpdate[]> {
32
- "use step";
33
- const owner = context.session.auth.initiator;
34
- if (!owner) {
35
- throw new Error("Research progress requires an authenticated owner.");
36
- }
37
- const client = new Client(getEveConnectionOptions(owner.principalId));
38
- const options = { signal: context.abortSignal };
39
- const root = await client.sessions
40
- .attach(context.session.id)
41
- .snapshot(options);
42
- const children = root.events.flatMap((event) => {
43
- if (
44
- event.type === "child.opened" &&
45
- event.data.stream ===
46
- `/eve/v1/session/${encodeURIComponent(event.data.sessionId)}/stream` &&
47
- event.data.name === "researcher" &&
48
- event.scope?.turnId === context.session.turn.id &&
49
- "callId" in event.data.owner &&
50
- event.data.owner.callId === context.callId
51
- ) {
52
- return [event.data.sessionId];
53
- }
54
- return [];
55
- });
56
- const snapshots = await readResearchSnapshots(client, children, options);
57
- return snapshots.flatMap((snapshot) =>
58
- snapshot.events.flatMap((event) => {
59
- if (event.type !== "call.settled") {
60
- return [];
61
- }
62
- const receipt = toolOutputSchema.safeParse(event.data.output);
63
- if (!receipt.success) {
64
- return [];
65
- }
66
- return (receipt.data.updates ?? []).flatMap((value: unknown) => {
67
- const update = ResearchUpdateSchema.safeParse(value);
68
-
69
- if (update.success && update.data.type === "web") {
70
- return [update.data];
71
- }
72
- return [];
73
- });
74
- })
75
- );
76
- }
@@ -1,92 +0,0 @@
1
- import { Client } from "eve/client";
2
- import type { WorkflowToolContext } from "eve/tools";
3
- import { eveDocumentWriteResult } from "@/chatjs/core/documents/contracts";
4
- import { executeEveDocumentTool } from "@/lib/eve/document-tools";
5
- import { getEveConnectionOptions } from "@/lib/eve/connection-options";
6
- import { researchAvailable } from "./availability";
7
- import { getDeepResearchConfig } from "./configuration";
8
- import { researchReport } from "./schemas";
9
- import { sharedEveMessages } from "@/lib/eve/shared-messages";
10
- import type { z } from "zod";
11
-
12
- type Context = Readonly<
13
- Pick<WorkflowToolContext, "session" | "callId"> & {
14
- abortSignal: Readonly<AbortSignal>;
15
- }
16
- >;
17
-
18
- type MessageView = Readonly<{
19
- parts: readonly Readonly<{ type: string; callId?: string }>[];
20
- role: string;
21
- }>;
22
-
23
- // oxlint-disable-next-line eslint/func-style -- EVE 0.61 authored-workflow-directives rejects const-bound steps; record the owned transcript, config, and clock once for replay.
24
- async function prepareResearch(context: Context): Promise<{
25
- config: ReturnType<typeof getDeepResearchConfig>;
26
- date: string;
27
- messages: string;
28
- timestamp: number;
29
- }> {
30
- "use step";
31
- const owner = context.session.auth.initiator;
32
- if (!owner || !researchAvailable(context.session)) {
33
- throw new Error(
34
- "Deep research requires an authenticated owner, installed text documents, and installed webSearch."
35
- );
36
- }
37
- context.abortSignal.throwIfAborted();
38
- const client = new Client(getEveConnectionOptions(owner.principalId));
39
- const snapshot = await client.sessions
40
- .attach(context.session.id)
41
- .snapshot({ signal: context.abortSignal });
42
- const messages = sharedEveMessages(snapshot.events).map(
43
- (message: MessageView) => ({
44
- parts: message.parts.filter(
45
- (part): boolean =>
46
- part.type !== "tool" || part.callId !== context.callId
47
- ),
48
- role: message.role,
49
- })
50
- );
51
- return {
52
- config: getDeepResearchConfig(),
53
- date: new Date().toLocaleDateString("en-US", {
54
- day: "numeric",
55
- month: "short",
56
- weekday: "short",
57
- year: "numeric",
58
- }),
59
- messages: messages
60
- .map(
61
- (message: MessageView): string =>
62
- `${message.role}: ${JSON.stringify(message.parts)}`
63
- )
64
- .join("\n"),
65
- timestamp: Date.now(),
66
- };
67
- }
68
- // oxlint-disable-next-line eslint/func-style -- EVE 0.61 authored-workflow-directives rejects const-bound steps; persist the document write and its completion clock together for replay.
69
- async function saveResearchReport(
70
- context: Context,
71
- report: Readonly<z.infer<typeof researchReport>>
72
- ): Promise<{
73
- document: z.infer<typeof eveDocumentWriteResult>;
74
- completedAt: number;
75
- }> {
76
- "use step";
77
- context.abortSignal.throwIfAborted();
78
- const content = researchReport.parse(report);
79
- const document = eveDocumentWriteResult.parse(
80
- await executeEveDocumentTool(
81
- "createTextDocument",
82
- {
83
- ...content,
84
- fileIds: [],
85
- },
86
- context
87
- )
88
- );
89
- // Record completion with the saved document so replay never reads a new clock.
90
- return { document, completedAt: Date.now() };
91
- }
92
- export { prepareResearch, saveResearchReport };
@@ -1,13 +0,0 @@
1
- import { isAccountSession } from "@/lib/eve/session-identity";
2
- import type { ToolContext } from "eve/tools";
3
-
4
- import { installedDocumentKinds } from "@/integrations/tools/catalog";
5
-
6
- const EMPTY_DOCUMENT_KIND_COUNT = 0;
7
-
8
- export const deleteDocumentAvailable = (
9
- session: Pick<ToolContext["session"], "auth" | "parent">
10
- ): boolean =>
11
- isAccountSession(session) &&
12
- !session.parent &&
13
- installedDocumentKinds.size > EMPTY_DOCUMENT_KIND_COUNT;
@@ -1,9 +0,0 @@
1
- {
2
- "availabilityExport": "deleteDocumentAvailable",
3
- "envRequirements": [],
4
- "id": "delete-document",
5
- "kind": "tool",
6
- "requiresTools": ["readDocument"],
7
- "tools": [{ "toolExport": "deleteDocument" }],
8
- "contractVersion": 1
9
- }
@@ -1,78 +0,0 @@
1
- import {
2
- getEveDocumentRevision,
3
- removeEveDocumentFromConversation,
4
- } from "@/lib/db/eve-documents";
5
- import type { ToolContext } from "eve/tools";
6
- import { deleteDocumentAvailable } from "./availability";
7
- import { deleteDocumentInput } from "./schemas";
8
- import { installedDocumentKinds } from "@/integrations/tools/catalog";
9
- import { resolveEveConversationScope } from "@/lib/eve/conversation-scope";
10
- import type { z } from "zod";
11
-
12
- type Context = Readonly<
13
- Pick<ToolContext, "session" | "callId" | "approval"> & {
14
- abortSignal: Readonly<AbortSignal>;
15
- }
16
- >;
17
-
18
- const scopeFor = async (
19
- context: Context
20
- ): ReturnType<typeof resolveEveConversationScope> => {
21
- if (!deleteDocumentAvailable(context.session)) {
22
- throw new Error("Document deletion is unavailable.");
23
- }
24
- return await resolveEveConversationScope(
25
- (context.session.auth.initiator ?? {}).principalId,
26
- context.session.id,
27
- context.abortSignal
28
- );
29
- };
30
- const requestDocumentDeletion = async (
31
- value: unknown,
32
- context: Context
33
- ): Promise<"user-approval"> => {
34
- const input = deleteDocumentInput.parse(value);
35
- const scope = await scopeFor(context);
36
- const revision = await getEveDocumentRevision(
37
- scope.ownerId,
38
- scope.conversationId,
39
- input.documentId
40
- );
41
- if (!revision || !installedDocumentKinds.has(revision.kind)) {
42
- throw new Error("Document not found.");
43
- }
44
- if (
45
- revision.id !== input.expectedRevisionId ||
46
- revision.title !== input.title
47
- ) {
48
- throw new Error(
49
- "Document changed. Read it again before requesting deletion."
50
- );
51
- }
52
- context.abortSignal.throwIfAborted();
53
- return "user-approval" as const;
54
- };
55
- const executeDocumentDeletion = async (
56
- input: Readonly<z.infer<typeof deleteDocumentInput>>,
57
- context: Context
58
- ): ReturnType<typeof removeEveDocumentFromConversation> => {
59
- const scope = await scopeFor(context);
60
- const { approval } = context;
61
- if (!approval || approval.responder.principalId !== scope.ownerId) {
62
- throw new Error("Document deletion requires the owner's approval.");
63
- }
64
- const revision = await getEveDocumentRevision(
65
- scope.ownerId,
66
- scope.conversationId,
67
- input.documentId
68
- );
69
- if (revision && !installedDocumentKinds.has(revision.kind)) {
70
- throw new Error("Document tools are disabled for this kind.");
71
- }
72
- return await removeEveDocumentFromConversation(
73
- input,
74
- scope,
75
- context.abortSignal
76
- );
77
- };
78
- export { executeDocumentDeletion, requestDocumentDeletion };
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
-
3
- const MINIMUM_DOCUMENT_TITLE_LENGTH = 1;
4
- const MAXIMUM_DOCUMENT_TITLE_LENGTH = 1000;
5
-
6
- export const deleteDocumentInput = z.object({
7
- documentId: z.uuid(),
8
- expectedRevisionId: z
9
- .uuid()
10
- .describe("Current revision ID returned by readDocument."),
11
- title: z
12
- .string()
13
- .min(MINIMUM_DOCUMENT_TITLE_LENGTH)
14
- .max(MAXIMUM_DOCUMENT_TITLE_LENGTH)
15
- .describe(
16
- "Exact current title returned by readDocument, shown for approval."
17
- ),
18
- });
@@ -1,49 +0,0 @@
1
- import type { ApprovalResponseContext } from "eve/tools/approval";
2
- import type { ToolContext } from "eve/tools";
3
- import { defineTool } from "eve/tools";
4
- import { executeDocumentDeletion, requestDocumentDeletion } from "./execute";
5
- import { deleteDocumentInput } from "./schemas";
6
- import type { z } from "zod";
7
-
8
- type DeleteDocumentInput = z.infer<typeof deleteDocumentInput>;
9
- type DeleteDocumentRequestContext = Readonly<
10
- Pick<ToolContext, "callId" | "session"> & {
11
- abortSignal: Readonly<AbortSignal>;
12
- toolInput?: Readonly<DeleteDocumentInput>;
13
- }
14
- >;
15
- type DeleteDocumentPrincipal = Readonly<
16
- Pick<
17
- ApprovalResponseContext<DeleteDocumentInput>["response"]["principal"],
18
- "principalId"
19
- >
20
- >;
21
- type DeleteDocumentResponseContext = Readonly<
22
- Pick<ApprovalResponseContext<DeleteDocumentInput>, "response"> & {
23
- session: Readonly<{
24
- initiator: DeleteDocumentPrincipal | null;
25
- }>;
26
- }
27
- >;
28
-
29
- export const deleteDocument = defineTool({
30
- approval: {
31
- request: async (context: DeleteDocumentRequestContext) =>
32
- await requestDocumentDeletion(context.toolInput, context),
33
- response: ({ response, session }: DeleteDocumentResponseContext) => {
34
- if (
35
- response.principal.principalId === (session.initiator ?? {}).principalId
36
- ) {
37
- return { status: "allowed" };
38
- }
39
- return {
40
- reason: "Only the document owner may approve deletion.",
41
- status: "rejected",
42
- };
43
- },
44
- },
45
- description:
46
- "Request owner approval to remove a document from this conversation. Read it first and supply its exact title and revision. Call this tool to display the approval controls; do not ask for confirmation in a chat message. Execution waits for approval. Historical snapshots and other branches retain their copies; this does not permanently erase their content.",
47
- execute: executeDocumentDeletion,
48
- inputSchema: deleteDocumentInput,
49
- });
@@ -1,14 +0,0 @@
1
- {
2
- "envRequirements": [],
3
- "id": "get-weather",
4
- "kind": "tool",
5
- "requiresTools": [],
6
- "tools": [
7
- {
8
- "rendererExport": "GetWeatherRenderer",
9
- "definitionExport": "toolDefinition",
10
- "toolExport": "getWeather"
11
- }
12
- ],
13
- "contractVersion": 1
14
- }
@@ -1,10 +0,0 @@
1
- import type { ToolDefinition } from "@/chatjs/core/tools/tool-definition";
2
- import { weatherInput, weatherResult } from "./schemas";
3
-
4
- export const toolDefinition = {
5
- name: "getWeather",
6
- description: "Get the current weather at a location",
7
- inputSchema: weatherInput,
8
- outputSchema: weatherResult,
9
- display: { name: "Weather", shortName: "Weather" },
10
- } as const satisfies ToolDefinition;