@convex-dev/agent 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +26 -0
  2. package/dist/commonjs/client/index.d.ts +788 -79
  3. package/dist/commonjs/client/index.d.ts.map +1 -1
  4. package/dist/commonjs/client/index.js +117 -154
  5. package/dist/commonjs/client/index.js.map +1 -1
  6. package/dist/commonjs/component/messages.d.ts +11 -3
  7. package/dist/commonjs/component/messages.d.ts.map +1 -1
  8. package/dist/commonjs/component/messages.js +2 -1
  9. package/dist/commonjs/component/messages.js.map +1 -1
  10. package/dist/commonjs/component/schema.d.ts +18 -12
  11. package/dist/commonjs/component/schema.d.ts.map +1 -1
  12. package/dist/commonjs/component/schema.js +1 -0
  13. package/dist/commonjs/component/schema.js.map +1 -1
  14. package/dist/commonjs/component/vector/index.d.ts.map +1 -1
  15. package/dist/commonjs/component/vector/index.js +1 -1
  16. package/dist/commonjs/component/vector/index.js.map +1 -1
  17. package/dist/commonjs/mapping.d.ts +3 -2
  18. package/dist/commonjs/mapping.d.ts.map +1 -1
  19. package/dist/commonjs/mapping.js +45 -13
  20. package/dist/commonjs/mapping.js.map +1 -1
  21. package/dist/commonjs/validators.d.ts +2736 -76
  22. package/dist/commonjs/validators.d.ts.map +1 -1
  23. package/dist/commonjs/validators.js +72 -7
  24. package/dist/commonjs/validators.js.map +1 -1
  25. package/dist/esm/client/index.d.ts +788 -79
  26. package/dist/esm/client/index.d.ts.map +1 -1
  27. package/dist/esm/client/index.js +117 -154
  28. package/dist/esm/client/index.js.map +1 -1
  29. package/dist/esm/component/messages.d.ts +11 -3
  30. package/dist/esm/component/messages.d.ts.map +1 -1
  31. package/dist/esm/component/messages.js +2 -1
  32. package/dist/esm/component/messages.js.map +1 -1
  33. package/dist/esm/component/schema.d.ts +18 -12
  34. package/dist/esm/component/schema.d.ts.map +1 -1
  35. package/dist/esm/component/schema.js +1 -0
  36. package/dist/esm/component/schema.js.map +1 -1
  37. package/dist/esm/component/vector/index.d.ts.map +1 -1
  38. package/dist/esm/component/vector/index.js +1 -1
  39. package/dist/esm/component/vector/index.js.map +1 -1
  40. package/dist/esm/mapping.d.ts +3 -2
  41. package/dist/esm/mapping.d.ts.map +1 -1
  42. package/dist/esm/mapping.js +45 -13
  43. package/dist/esm/mapping.js.map +1 -1
  44. package/dist/esm/validators.d.ts +2736 -76
  45. package/dist/esm/validators.d.ts.map +1 -1
  46. package/dist/esm/validators.js +72 -7
  47. package/dist/esm/validators.js.map +1 -1
  48. package/package.json +7 -7
  49. package/src/client/index.ts +269 -191
  50. package/src/component/_generated/api.d.ts +5 -0
  51. package/src/component/messages.ts +2 -1
  52. package/src/component/schema.ts +1 -0
  53. package/src/component/vector/index.ts +1 -7
  54. package/src/mapping.ts +60 -19
  55. package/src/validators.ts +102 -9
package/README.md CHANGED
@@ -341,4 +341,30 @@ Read more in [this Stack post](https://stack.convex.dev/ai-agents).
341
341
  npm i @convex-dev/agent
342
342
  ```
343
343
 
344
+ ## Troubleshooting
345
+
346
+ ### Circular dependencies
347
+
348
+ Having the return value of workflows depend on other Convex functions can lead to circular dependencies due to the
349
+ `internal.foo.bar` way of specifying functions. The way to fix this is to explicitly type the return value of the
350
+ workflow. When in doubt, add return types to more `handler` functions, like this:
351
+
352
+ ```diff
353
+ export const supportAgentWorkflow = workflow.define({
354
+ args: { prompt: v.string(), userId: v.string(), threadId: v.string() },
355
+ + handler: async (step, { prompt, userId, threadId }): Promise<string> => {
356
+ // ...
357
+ },
358
+ });
359
+
360
+ // And regular functions too:
361
+ export const myFunction = action({
362
+ args: { prompt: v.string() },
363
+ + handler: async (ctx, { prompt }): Promise<string> => {
364
+ // ...
365
+ },
366
+ });
367
+ ```
368
+
369
+
344
370
  <!-- END: Include on https://convex.dev/components -->