weave-python 0.57.0__tar.gz → 0.59.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. {weave_python-0.57.0 → weave_python-0.59.0}/PKG-INFO +1 -1
  2. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/agent.py +94 -0
  3. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/auth_identity.py +59 -0
  4. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/organization.py +130 -0
  5. {weave_python-0.57.0 → weave_python-0.59.0}/.github/runs-on.yml +0 -0
  6. {weave_python-0.57.0 → weave_python-0.59.0}/.github/workflows/format-lint.yaml +0 -0
  7. {weave_python-0.57.0 → weave_python-0.59.0}/.github/workflows/generate.yaml +0 -0
  8. {weave_python-0.57.0 → weave_python-0.59.0}/.github/workflows/gh-actions-lint.yaml +0 -0
  9. {weave_python-0.57.0 → weave_python-0.59.0}/.github/workflows/release.yaml +0 -0
  10. {weave_python-0.57.0 → weave_python-0.59.0}/.gitignore +0 -0
  11. {weave_python-0.57.0 → weave_python-0.59.0}/.python-version +0 -0
  12. {weave_python-0.57.0 → weave_python-0.59.0}/LICENSE +0 -0
  13. {weave_python-0.57.0 → weave_python-0.59.0}/README.md +0 -0
  14. {weave_python-0.57.0 → weave_python-0.59.0}/Taskfile.yaml +0 -0
  15. {weave_python-0.57.0 → weave_python-0.59.0}/buf.gen.yaml +0 -0
  16. {weave_python-0.57.0 → weave_python-0.59.0}/pyproject.toml +0 -0
  17. {weave_python-0.57.0 → weave_python-0.59.0}/renovate.json +0 -0
  18. {weave_python-0.57.0 → weave_python-0.59.0}/tools/sqlcgen/README.md +0 -0
  19. {weave_python-0.57.0 → weave_python-0.59.0}/tools/sqlcgen/sqlcgen.py +0 -0
  20. {weave_python-0.57.0 → weave_python-0.59.0}/tools/sqlcgen/test_sqlcgen.py +0 -0
  21. {weave_python-0.57.0 → weave_python-0.59.0}/uv.lock +0 -0
  22. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/agent_pb2.py +0 -0
  23. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/agent_pb2.pyi +0 -0
  24. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/agent_pb2_grpc.py +0 -0
  25. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/agent_pb2_grpc.pyi +0 -0
  26. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/service_pb2.py +0 -0
  27. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/service_pb2.pyi +0 -0
  28. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/service_pb2_grpc.py +0 -0
  29. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/agent/v1/service_pb2_grpc.pyi +0 -0
  30. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/event_pb2.py +0 -0
  31. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/event_pb2.pyi +0 -0
  32. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/event_pb2_grpc.py +0 -0
  33. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/event_pb2_grpc.pyi +0 -0
  34. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/message_pb2.py +0 -0
  35. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/message_pb2.pyi +0 -0
  36. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/message_pb2_grpc.py +0 -0
  37. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/message_pb2_grpc.pyi +0 -0
  38. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/process_pb2.py +0 -0
  39. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/process_pb2.pyi +0 -0
  40. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/process_pb2_grpc.py +0 -0
  41. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/process_pb2_grpc.pyi +0 -0
  42. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/run_pb2.py +0 -0
  43. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/run_pb2.pyi +0 -0
  44. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/run_pb2_grpc.py +0 -0
  45. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/run_pb2_grpc.pyi +0 -0
  46. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/service_pb2.py +0 -0
  47. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/service_pb2.pyi +0 -0
  48. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/service_pb2_grpc.py +0 -0
  49. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/atc/v1/service_pb2_grpc.pyi +0 -0
  50. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/auth_pb2.py +0 -0
  51. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/auth_pb2.pyi +0 -0
  52. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/auth_pb2_grpc.py +0 -0
  53. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/auth_pb2_grpc.pyi +0 -0
  54. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/service_pb2.py +0 -0
  55. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/service_pb2.pyi +0 -0
  56. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/service_pb2_grpc.py +0 -0
  57. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/auth/v1/service_pb2_grpc.pyi +0 -0
  58. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/chat_pb2.py +0 -0
  59. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/chat_pb2.pyi +0 -0
  60. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/chat_pb2_grpc.py +0 -0
  61. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/chat_pb2_grpc.pyi +0 -0
  62. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/service_pb2.py +0 -0
  63. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/service_pb2.pyi +0 -0
  64. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/service_pb2_grpc.py +0 -0
  65. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/chat/v1/service_pb2_grpc.pyi +0 -0
  66. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/consolidation_pb2.py +0 -0
  67. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/consolidation_pb2.pyi +0 -0
  68. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/consolidation_pb2_grpc.py +0 -0
  69. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/consolidation_pb2_grpc.pyi +0 -0
  70. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/service_pb2.py +0 -0
  71. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/service_pb2.pyi +0 -0
  72. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/service_pb2_grpc.py +0 -0
  73. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/consolidation/v1/service_pb2_grpc.pyi +0 -0
  74. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/gateway_pb2.py +0 -0
  75. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/gateway_pb2.pyi +0 -0
  76. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/gateway_pb2_grpc.py +0 -0
  77. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/gateway_pb2_grpc.pyi +0 -0
  78. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/service_pb2.py +0 -0
  79. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/service_pb2.pyi +0 -0
  80. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/service_pb2_grpc.py +0 -0
  81. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/gateway/v1/service_pb2_grpc.pyi +0 -0
  82. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/ingestion_pb2.py +0 -0
  83. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/ingestion_pb2.pyi +0 -0
  84. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/ingestion_pb2_grpc.py +0 -0
  85. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/ingestion_pb2_grpc.pyi +0 -0
  86. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/service_pb2.py +0 -0
  87. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/service_pb2.pyi +0 -0
  88. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/service_pb2_grpc.py +0 -0
  89. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/ingestion/v1/service_pb2_grpc.pyi +0 -0
  90. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/model_pb2.py +0 -0
  91. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/model_pb2.pyi +0 -0
  92. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/model_pb2_grpc.py +0 -0
  93. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/model_pb2_grpc.pyi +0 -0
  94. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/service_pb2.py +0 -0
  95. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/service_pb2.pyi +0 -0
  96. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/service_pb2_grpc.py +0 -0
  97. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/model/v1/service_pb2_grpc.pyi +0 -0
  98. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/organization_pb2.py +0 -0
  99. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/organization_pb2.pyi +0 -0
  100. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/organization_pb2_grpc.py +0 -0
  101. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/organization_pb2_grpc.pyi +0 -0
  102. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/service_pb2.py +0 -0
  103. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/service_pb2.pyi +0 -0
  104. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/service_pb2_grpc.py +0 -0
  105. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/organization/v1/service_pb2_grpc.pyi +0 -0
  106. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/project_pb2.py +0 -0
  107. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/project_pb2.pyi +0 -0
  108. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/project_pb2_grpc.py +0 -0
  109. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/project_pb2_grpc.pyi +0 -0
  110. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/service_pb2.py +0 -0
  111. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/service_pb2.pyi +0 -0
  112. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/service_pb2_grpc.py +0 -0
  113. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/project/v1/service_pb2_grpc.pyi +0 -0
  114. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/provider_pb2.py +0 -0
  115. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/provider_pb2.pyi +0 -0
  116. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/provider_pb2_grpc.py +0 -0
  117. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/provider_pb2_grpc.pyi +0 -0
  118. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/service_pb2.py +0 -0
  119. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/service_pb2.pyi +0 -0
  120. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/service_pb2_grpc.py +0 -0
  121. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/provider/v1/service_pb2_grpc.pyi +0 -0
  122. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/retrieval_pb2.py +0 -0
  123. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/retrieval_pb2.pyi +0 -0
  124. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/retrieval_pb2_grpc.py +0 -0
  125. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/retrieval_pb2_grpc.pyi +0 -0
  126. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/service_pb2.py +0 -0
  127. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/service_pb2.pyi +0 -0
  128. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/service_pb2_grpc.py +0 -0
  129. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/retrieval/v1/service_pb2_grpc.pyi +0 -0
  130. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/service_pb2.py +0 -0
  131. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/service_pb2.pyi +0 -0
  132. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/service_pb2_grpc.py +0 -0
  133. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/service_pb2_grpc.pyi +0 -0
  134. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/task_pb2.py +0 -0
  135. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/task_pb2.pyi +0 -0
  136. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/task_pb2_grpc.py +0 -0
  137. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/task/v1/task_pb2_grpc.pyi +0 -0
  138. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/service_pb2.py +0 -0
  139. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/service_pb2.pyi +0 -0
  140. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/service_pb2_grpc.py +0 -0
  141. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/service_pb2_grpc.pyi +0 -0
  142. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/workflow_pb2.py +0 -0
  143. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/workflow_pb2.pyi +0 -0
  144. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/workflow_pb2_grpc.py +0 -0
  145. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weaveapi/workflow/v1/workflow_pb2_grpc.pyi +0 -0
  146. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/event.py +0 -0
  147. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/inspection.py +0 -0
  148. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/mailbox.py +0 -0
  149. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/models.py +0 -0
  150. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/run_template.py +0 -0
  151. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/snapshot.py +0 -0
  152. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/atcdb/team.py +0 -0
  153. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/chat.py +0 -0
  154. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/consolidation.py +0 -0
  155. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/document_security.py +0 -0
  156. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/ingestion.py +0 -0
  157. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/model_catalog.py +0 -0
  158. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/models.py +0 -0
  159. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/project.py +0 -0
  160. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/provider.py +0 -0
  161. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/retrieval.py +0 -0
  162. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/task.py +0 -0
  163. {weave_python-0.57.0 → weave_python-0.59.0}/weave/weavesql/weavedb/workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weave-python
3
- Version: 0.57.0
3
+ Version: 0.59.0
4
4
  Author: Weave Labs
5
5
  License: FCL-1.0-ALv2
6
6
  License-File: LICENSE
@@ -13,6 +13,30 @@ import sqlalchemy.ext.asyncio
13
13
  from weave.weavesql.weavedb import models
14
14
 
15
15
 
16
+ CLAIM_AGENT_RUN = """-- name: claim_agent_run \\:one
17
+ UPDATE weave.agent_runs
18
+ SET
19
+ status = :p1,
20
+ error_code = '',
21
+ safe_error_message = '',
22
+ started_at = COALESCE(started_at, :p2\\:\\:timestamptz),
23
+ finished_at = NULL
24
+ WHERE organization_id = :p3
25
+ AND id = :p4
26
+ AND status = :p5
27
+ RETURNING id, organization_id, agent_definition_id, agent_version_id, status, created_by_user_id, chat_session_id, workflow_run_id, workflow_step_run_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at
28
+ """
29
+
30
+
31
+ @dataclasses.dataclass()
32
+ class ClaimAgentRunParams:
33
+ status: str
34
+ started_at: datetime.datetime
35
+ organization_id: uuid.UUID
36
+ agent_run_id: uuid.UUID
37
+ expected_status: str
38
+
39
+
16
40
  CREATE_AGENT_DEFINITION = """-- name: create_agent_definition \\:one
17
41
  INSERT INTO weave.agent_definitions (
18
42
  id,
@@ -632,6 +656,40 @@ class Querier:
632
656
  def __init__(self, conn: sqlalchemy.engine.Connection):
633
657
  self._conn = conn
634
658
 
659
+ def claim_agent_run(
660
+ self, arg: ClaimAgentRunParams
661
+ ) -> Optional[models.WeaveAgentRun]:
662
+ row = self._conn.execute(
663
+ sqlalchemy.text(CLAIM_AGENT_RUN),
664
+ {
665
+ "p1": arg.status,
666
+ "p2": arg.started_at,
667
+ "p3": arg.organization_id,
668
+ "p4": arg.agent_run_id,
669
+ "p5": arg.expected_status,
670
+ },
671
+ ).first()
672
+ if row is None:
673
+ return None
674
+ return models.WeaveAgentRun(
675
+ id=row[0],
676
+ organization_id=row[1],
677
+ agent_definition_id=row[2],
678
+ agent_version_id=row[3],
679
+ status=row[4],
680
+ created_by_user_id=row[5],
681
+ chat_session_id=row[6],
682
+ workflow_run_id=row[7],
683
+ workflow_step_run_id=row[8],
684
+ input=row[9],
685
+ output=row[10],
686
+ error_code=row[11],
687
+ safe_error_message=row[12],
688
+ created_at=row[13],
689
+ started_at=row[14],
690
+ finished_at=row[15],
691
+ )
692
+
635
693
  def create_agent_definition(
636
694
  self, arg: CreateAgentDefinitionParams
637
695
  ) -> Optional[models.WeaveAgentDefinition]:
@@ -1360,6 +1418,42 @@ class AsyncQuerier:
1360
1418
  def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
1361
1419
  self._conn = conn
1362
1420
 
1421
+ async def claim_agent_run(
1422
+ self, arg: ClaimAgentRunParams
1423
+ ) -> Optional[models.WeaveAgentRun]:
1424
+ row = (
1425
+ await self._conn.execute(
1426
+ sqlalchemy.text(CLAIM_AGENT_RUN),
1427
+ {
1428
+ "p1": arg.status,
1429
+ "p2": arg.started_at,
1430
+ "p3": arg.organization_id,
1431
+ "p4": arg.agent_run_id,
1432
+ "p5": arg.expected_status,
1433
+ },
1434
+ )
1435
+ ).first()
1436
+ if row is None:
1437
+ return None
1438
+ return models.WeaveAgentRun(
1439
+ id=row[0],
1440
+ organization_id=row[1],
1441
+ agent_definition_id=row[2],
1442
+ agent_version_id=row[3],
1443
+ status=row[4],
1444
+ created_by_user_id=row[5],
1445
+ chat_session_id=row[6],
1446
+ workflow_run_id=row[7],
1447
+ workflow_step_run_id=row[8],
1448
+ input=row[9],
1449
+ output=row[10],
1450
+ error_code=row[11],
1451
+ safe_error_message=row[12],
1452
+ created_at=row[13],
1453
+ started_at=row[14],
1454
+ finished_at=row[15],
1455
+ )
1456
+
1363
1457
  async def create_agent_definition(
1364
1458
  self, arg: CreateAgentDefinitionParams
1365
1459
  ) -> Optional[models.WeaveAgentDefinition]:
@@ -276,6 +276,33 @@ class CreateUserRow:
276
276
  updated_at: datetime.datetime
277
277
 
278
278
 
279
+ CREATE_USER_WITH_ID = """-- name: create_user_with_id \\:one
280
+ INSERT INTO weave.users (
281
+ id,
282
+ status
283
+ ) VALUES (
284
+ :p1,
285
+ :p2
286
+ )
287
+ ON CONFLICT (id) DO NOTHING
288
+ RETURNING id, status, created_at, updated_at
289
+ """
290
+
291
+
292
+ @dataclasses.dataclass()
293
+ class CreateUserWithIDParams:
294
+ id: uuid.UUID
295
+ status: str
296
+
297
+
298
+ @dataclasses.dataclass()
299
+ class CreateUserWithIDRow:
300
+ id: uuid.UUID
301
+ status: str
302
+ created_at: datetime.datetime
303
+ updated_at: datetime.datetime
304
+
305
+
279
306
  DELETE_EXPIRED_APPLICATION_SESSIONS = """-- name: delete_expired_application_sessions \\:execrows
280
307
  DELETE FROM weave.application_sessions
281
308
  WHERE expires_at <= now()
@@ -2075,6 +2102,21 @@ class Querier:
2075
2102
  updated_at=row[3],
2076
2103
  )
2077
2104
 
2105
+ def create_user_with_id(
2106
+ self, arg: CreateUserWithIDParams
2107
+ ) -> Optional[CreateUserWithIDRow]:
2108
+ row = self._conn.execute(
2109
+ sqlalchemy.text(CREATE_USER_WITH_ID), {"p1": arg.id, "p2": arg.status}
2110
+ ).first()
2111
+ if row is None:
2112
+ return None
2113
+ return CreateUserWithIDRow(
2114
+ id=row[0],
2115
+ status=row[1],
2116
+ created_at=row[2],
2117
+ updated_at=row[3],
2118
+ )
2119
+
2078
2120
  def delete_expired_application_sessions(
2079
2121
  self, arg: DeleteExpiredApplicationSessionsParams
2080
2122
  ) -> int:
@@ -3358,6 +3400,23 @@ class AsyncQuerier:
3358
3400
  updated_at=row[3],
3359
3401
  )
3360
3402
 
3403
+ async def create_user_with_id(
3404
+ self, arg: CreateUserWithIDParams
3405
+ ) -> Optional[CreateUserWithIDRow]:
3406
+ row = (
3407
+ await self._conn.execute(
3408
+ sqlalchemy.text(CREATE_USER_WITH_ID), {"p1": arg.id, "p2": arg.status}
3409
+ )
3410
+ ).first()
3411
+ if row is None:
3412
+ return None
3413
+ return CreateUserWithIDRow(
3414
+ id=row[0],
3415
+ status=row[1],
3416
+ created_at=row[2],
3417
+ updated_at=row[3],
3418
+ )
3419
+
3361
3420
  async def delete_expired_application_sessions(
3362
3421
  self, arg: DeleteExpiredApplicationSessionsParams
3363
3422
  ) -> int:
@@ -84,6 +84,70 @@ class CreateOrganizationRow:
84
84
  updated_at: datetime.datetime
85
85
 
86
86
 
87
+ CREATE_ORGANIZATION_WITH_ID = """-- name: create_organization_with_id \\:one
88
+ INSERT INTO weave.organizations (
89
+ id,
90
+ slug,
91
+ name,
92
+ description,
93
+ primary_color,
94
+ logo,
95
+ logo_content_type,
96
+ timezone,
97
+ location
98
+ ) VALUES (
99
+ :p1,
100
+ :p2,
101
+ :p3,
102
+ :p4,
103
+ :p5,
104
+ :p6,
105
+ :p7,
106
+ :p8,
107
+ :p9
108
+ )
109
+ ON CONFLICT (slug) DO NOTHING
110
+ RETURNING
111
+ id,
112
+ slug,
113
+ name,
114
+ description,
115
+ primary_color,
116
+ (logo IS NOT NULL) AS has_logo,
117
+ timezone,
118
+ location,
119
+ created_at,
120
+ updated_at
121
+ """
122
+
123
+
124
+ @dataclasses.dataclass()
125
+ class CreateOrganizationWithIDParams:
126
+ id: uuid.UUID
127
+ slug: str
128
+ name: str
129
+ description: str
130
+ primary_color: str
131
+ logo: Optional[memoryview]
132
+ logo_content_type: Optional[str]
133
+ timezone: str
134
+ location: str
135
+
136
+
137
+ @dataclasses.dataclass()
138
+ class CreateOrganizationWithIDRow:
139
+ id: uuid.UUID
140
+ slug: str
141
+ name: str
142
+ description: str
143
+ primary_color: str
144
+ has_logo: Optional[Any]
145
+ timezone: str
146
+ location: str
147
+ created_at: datetime.datetime
148
+ updated_at: datetime.datetime
149
+
150
+
87
151
  DELETE_ORGANIZATION = """-- name: delete_organization \\:execrows
88
152
  DELETE FROM weave.organizations
89
153
  WHERE id = :p1
@@ -325,6 +389,38 @@ class Querier:
325
389
  updated_at=row[9],
326
390
  )
327
391
 
392
+ def create_organization_with_id(
393
+ self, arg: CreateOrganizationWithIDParams
394
+ ) -> Optional[CreateOrganizationWithIDRow]:
395
+ row = self._conn.execute(
396
+ sqlalchemy.text(CREATE_ORGANIZATION_WITH_ID),
397
+ {
398
+ "p1": arg.id,
399
+ "p2": arg.slug,
400
+ "p3": arg.name,
401
+ "p4": arg.description,
402
+ "p5": arg.primary_color,
403
+ "p6": arg.logo,
404
+ "p7": arg.logo_content_type,
405
+ "p8": arg.timezone,
406
+ "p9": arg.location,
407
+ },
408
+ ).first()
409
+ if row is None:
410
+ return None
411
+ return CreateOrganizationWithIDRow(
412
+ id=row[0],
413
+ slug=row[1],
414
+ name=row[2],
415
+ description=row[3],
416
+ primary_color=row[4],
417
+ has_logo=row[5],
418
+ timezone=row[6],
419
+ location=row[7],
420
+ created_at=row[8],
421
+ updated_at=row[9],
422
+ )
423
+
328
424
  def delete_organization(self, arg: DeleteOrganizationParams) -> int:
329
425
  result = self._conn.execute(
330
426
  sqlalchemy.text(DELETE_ORGANIZATION), {"p1": arg.id}
@@ -485,6 +581,40 @@ class AsyncQuerier:
485
581
  updated_at=row[9],
486
582
  )
487
583
 
584
+ async def create_organization_with_id(
585
+ self, arg: CreateOrganizationWithIDParams
586
+ ) -> Optional[CreateOrganizationWithIDRow]:
587
+ row = (
588
+ await self._conn.execute(
589
+ sqlalchemy.text(CREATE_ORGANIZATION_WITH_ID),
590
+ {
591
+ "p1": arg.id,
592
+ "p2": arg.slug,
593
+ "p3": arg.name,
594
+ "p4": arg.description,
595
+ "p5": arg.primary_color,
596
+ "p6": arg.logo,
597
+ "p7": arg.logo_content_type,
598
+ "p8": arg.timezone,
599
+ "p9": arg.location,
600
+ },
601
+ )
602
+ ).first()
603
+ if row is None:
604
+ return None
605
+ return CreateOrganizationWithIDRow(
606
+ id=row[0],
607
+ slug=row[1],
608
+ name=row[2],
609
+ description=row[3],
610
+ primary_color=row[4],
611
+ has_logo=row[5],
612
+ timezone=row[6],
613
+ location=row[7],
614
+ created_at=row[8],
615
+ updated_at=row[9],
616
+ )
617
+
488
618
  async def delete_organization(self, arg: DeleteOrganizationParams) -> int:
489
619
  result = await self._conn.execute(
490
620
  sqlalchemy.text(DELETE_ORGANIZATION), {"p1": arg.id}
File without changes
File without changes
File without changes
File without changes