weave-typescript 0.51.2 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/google/protobuf/duration.pb.d.ts +99 -0
  2. package/dist/google/protobuf/duration.pb.js +93 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +2 -1
  5. package/dist/weave/authz/v1/index.d.ts +1 -0
  6. package/dist/weave/authz/v1/index.js +38 -0
  7. package/dist/weave/authz/v1/options.pb.d.ts +52 -0
  8. package/dist/weave/authz/v1/options.pb.js +403 -0
  9. package/dist/weave/filter/v1/index.d.ts +1 -0
  10. package/dist/weave/filter/v1/index.js +38 -0
  11. package/dist/{weaveapi/atc/v1/message.pb.d.ts → weave/filter/v1/options.pb.d.ts} +33 -21
  12. package/dist/weave/filter/v1/options.pb.js +417 -0
  13. package/dist/weave/index.d.ts +2 -0
  14. package/dist/weave/index.js +39 -0
  15. package/dist/weaveapi/agent/v1/agent.pb.d.ts +137 -188
  16. package/dist/weaveapi/agent/v1/agent.pb.js +891 -2151
  17. package/dist/weaveapi/agent/v1/index.d.ts +1 -1
  18. package/dist/weaveapi/agent/v1/index.js +2 -2
  19. package/dist/weaveapi/agent/v1/run.pb.d.ts +289 -0
  20. package/dist/weaveapi/agent/v1/run.pb.js +2763 -0
  21. package/dist/weaveapi/auth/v1/auth.pb.d.ts +67 -14
  22. package/dist/weaveapi/auth/v1/auth.pb.js +829 -89
  23. package/dist/weaveapi/auth/v1/index.d.ts +4 -1
  24. package/dist/weaveapi/auth/v1/index.js +5 -2
  25. package/dist/weaveapi/auth/v1/{service.pb.d.ts → organization_admin.pb.d.ts} +39 -530
  26. package/dist/weaveapi/auth/v1/{service.pb.js → organization_admin.pb.js} +2978 -5812
  27. package/dist/weaveapi/auth/v1/personal_access_token.pb.d.ts +114 -0
  28. package/dist/weaveapi/auth/v1/personal_access_token.pb.js +750 -0
  29. package/dist/weaveapi/auth/v1/profile.pb.d.ts +161 -0
  30. package/dist/weaveapi/auth/v1/profile.pb.js +1007 -0
  31. package/dist/weaveapi/auth/v1/session.pb.d.ts +460 -0
  32. package/dist/weaveapi/auth/v1/session.pb.js +3544 -0
  33. package/dist/weaveapi/chat/v1/chat.pb.d.ts +377 -149
  34. package/dist/weaveapi/chat/v1/chat.pb.js +3492 -1614
  35. package/dist/weaveapi/chat/v1/index.d.ts +0 -1
  36. package/dist/weaveapi/chat/v1/index.js +1 -2
  37. package/dist/weaveapi/consolidation/v1/consolidation.pb.d.ts +95 -0
  38. package/dist/weaveapi/consolidation/v1/consolidation.pb.js +770 -1
  39. package/dist/weaveapi/consolidation/v1/index.d.ts +0 -1
  40. package/dist/weaveapi/consolidation/v1/index.js +1 -2
  41. package/dist/weaveapi/content/v1/content.pb.d.ts +63 -0
  42. package/dist/weaveapi/content/v1/content.pb.js +470 -0
  43. package/dist/weaveapi/content/v1/index.d.ts +1 -0
  44. package/dist/weaveapi/content/v1/index.js +38 -0
  45. package/dist/weaveapi/gateway/v1/gateway.pb.d.ts +247 -523
  46. package/dist/weaveapi/gateway/v1/gateway.pb.js +1648 -5783
  47. package/dist/weaveapi/gateway/v1/index.d.ts +0 -1
  48. package/dist/weaveapi/gateway/v1/index.js +1 -2
  49. package/dist/weaveapi/index.d.ts +5 -5
  50. package/dist/weaveapi/index.js +6 -6
  51. package/dist/weaveapi/inference/v1/generate.pb.d.ts +120 -0
  52. package/dist/weaveapi/inference/v1/generate.pb.js +1159 -0
  53. package/dist/weaveapi/inference/v1/index.d.ts +4 -0
  54. package/dist/weaveapi/{provider → inference}/v1/index.js +4 -2
  55. package/dist/weaveapi/{model → inference}/v1/model.pb.d.ts +52 -15
  56. package/dist/weaveapi/{model → inference}/v1/model.pb.js +529 -116
  57. package/dist/weaveapi/{model/v1/service.pb.d.ts → inference/v1/model_route.pb.d.ts} +182 -110
  58. package/dist/weaveapi/{model/v1/service.pb.js → inference/v1/model_route.pb.js} +2197 -1061
  59. package/dist/weaveapi/inference/v1/provider.pb.d.ts +264 -0
  60. package/dist/weaveapi/inference/v1/provider.pb.js +2590 -0
  61. package/dist/weaveapi/ingestion/v1/index.d.ts +0 -2
  62. package/dist/weaveapi/ingestion/v1/index.js +1 -3
  63. package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +543 -0
  64. package/dist/weaveapi/ingestion/v1/ingestion.pb.js +5550 -16
  65. package/dist/weaveapi/initialization/v1/index.d.ts +1 -0
  66. package/dist/weaveapi/initialization/v1/index.js +38 -0
  67. package/dist/weaveapi/initialization/v1/initialization.pb.d.ts +99 -0
  68. package/dist/weaveapi/initialization/v1/initialization.pb.js +510 -0
  69. package/dist/weaveapi/organization/v1/index.d.ts +0 -1
  70. package/dist/weaveapi/organization/v1/index.js +1 -2
  71. package/dist/weaveapi/organization/v1/organization.pb.d.ts +241 -0
  72. package/dist/weaveapi/organization/v1/organization.pb.js +1838 -1
  73. package/dist/weaveapi/reporting/index.d.ts +1 -0
  74. package/dist/weaveapi/reporting/index.js +38 -0
  75. package/dist/weaveapi/{task → reporting}/v1/index.d.ts +1 -1
  76. package/dist/weaveapi/{model → reporting}/v1/index.js +2 -2
  77. package/dist/weaveapi/reporting/v1/service.pb.d.ts +38 -0
  78. package/dist/weaveapi/reporting/v1/service.pb.js +167 -0
  79. package/dist/weaveapi/reporting/v1/usage.pb.d.ts +150 -0
  80. package/dist/weaveapi/reporting/v1/usage.pb.js +1837 -0
  81. package/dist/weaveapi/retrieval/v1/index.d.ts +0 -1
  82. package/dist/weaveapi/retrieval/v1/index.js +1 -2
  83. package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +96 -2
  84. package/dist/weaveapi/retrieval/v1/retrieval.pb.js +690 -10
  85. package/dist/weaveapi/tool/index.d.ts +1 -0
  86. package/dist/weaveapi/tool/index.js +38 -0
  87. package/dist/weaveapi/tool/v1/index.d.ts +1 -0
  88. package/dist/weaveapi/tool/v1/index.js +38 -0
  89. package/dist/weaveapi/tool/v1/tool.pb.d.ts +370 -0
  90. package/dist/weaveapi/tool/v1/tool.pb.js +2717 -0
  91. package/dist/weaveapi/workflow/v1/index.d.ts +1 -1
  92. package/dist/weaveapi/workflow/v1/index.js +2 -2
  93. package/dist/weaveapi/workflow/v1/run.pb.d.ts +244 -0
  94. package/dist/weaveapi/workflow/v1/run.pb.js +2084 -0
  95. package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +122 -275
  96. package/dist/weaveapi/workflow/v1/workflow.pb.js +790 -3261
  97. package/dist/weavesql/weavedb/agent_sql.d.ts +173 -477
  98. package/dist/weavesql/weavedb/agent_sql.js +281 -758
  99. package/dist/weavesql/weavedb/authorization_outbox_sql.d.ts +261 -0
  100. package/dist/weavesql/weavedb/authorization_outbox_sql.js +445 -0
  101. package/dist/weavesql/weavedb/chat_sql.d.ts +103 -345
  102. package/dist/weavesql/weavedb/chat_sql.js +312 -597
  103. package/dist/weavesql/weavedb/document_consolidation_sql.d.ts +217 -0
  104. package/dist/weavesql/weavedb/document_consolidation_sql.js +486 -0
  105. package/dist/weavesql/weavedb/document_ingestion_sql.d.ts +1433 -0
  106. package/dist/weavesql/weavedb/document_ingestion_sql.js +3488 -0
  107. package/dist/weavesql/weavedb/document_retrieval_sql.d.ts +314 -0
  108. package/dist/weavesql/weavedb/document_retrieval_sql.js +965 -0
  109. package/dist/weavesql/weavedb/document_table_sql.d.ts +6 -6
  110. package/dist/weavesql/weavedb/document_table_sql.js +12 -12
  111. package/dist/weavesql/weavedb/identity_sql.d.ts +1014 -0
  112. package/dist/weavesql/weavedb/identity_sql.js +1811 -0
  113. package/dist/weavesql/weavedb/inference_model_route_sql.d.ts +161 -0
  114. package/dist/weavesql/weavedb/inference_model_route_sql.js +408 -0
  115. package/dist/weavesql/weavedb/inference_provider_sql.d.ts +125 -0
  116. package/dist/weavesql/weavedb/inference_provider_sql.js +228 -0
  117. package/dist/weavesql/weavedb/initialization_sql.d.ts +15 -0
  118. package/dist/weavesql/weavedb/initialization_sql.js +33 -0
  119. package/dist/weavesql/weavedb/model_catalog_sql.d.ts +6 -6
  120. package/dist/weavesql/weavedb/model_catalog_sql.js +6 -6
  121. package/dist/weavesql/weavedb/organization_sql.d.ts +22 -102
  122. package/dist/weavesql/weavedb/organization_sql.js +54 -262
  123. package/dist/weavesql/weavedb/tool_sql.d.ts +209 -0
  124. package/dist/weavesql/weavedb/tool_sql.js +407 -0
  125. package/dist/weavesql/weavedb/usage_sql.d.ts +356 -0
  126. package/dist/weavesql/weavedb/usage_sql.js +568 -0
  127. package/dist/weavesql/weavedb/workflow_sql.d.ts +159 -546
  128. package/dist/weavesql/weavedb/workflow_sql.js +281 -909
  129. package/package.json +2 -2
  130. package/dist/weaveapi/agent/v1/service.pb.d.ts +0 -397
  131. package/dist/weaveapi/agent/v1/service.pb.js +0 -3152
  132. package/dist/weaveapi/atc/v1/event.pb.d.ts +0 -134
  133. package/dist/weaveapi/atc/v1/event.pb.js +0 -1124
  134. package/dist/weaveapi/atc/v1/index.d.ts +0 -5
  135. package/dist/weaveapi/atc/v1/index.js +0 -42
  136. package/dist/weaveapi/atc/v1/message.pb.js +0 -287
  137. package/dist/weaveapi/atc/v1/process.pb.d.ts +0 -91
  138. package/dist/weaveapi/atc/v1/process.pb.js +0 -658
  139. package/dist/weaveapi/atc/v1/run.pb.d.ts +0 -71
  140. package/dist/weaveapi/atc/v1/run.pb.js +0 -525
  141. package/dist/weaveapi/atc/v1/service.pb.d.ts +0 -472
  142. package/dist/weaveapi/atc/v1/service.pb.js +0 -3093
  143. package/dist/weaveapi/chat/v1/service.pb.d.ts +0 -345
  144. package/dist/weaveapi/chat/v1/service.pb.js +0 -2545
  145. package/dist/weaveapi/consolidation/v1/service.pb.d.ts +0 -93
  146. package/dist/weaveapi/consolidation/v1/service.pb.js +0 -427
  147. package/dist/weaveapi/gateway/v1/service.pb.d.ts +0 -235
  148. package/dist/weaveapi/gateway/v1/service.pb.js +0 -651
  149. package/dist/weaveapi/ingestion/v1/service.pb.d.ts +0 -420
  150. package/dist/weaveapi/ingestion/v1/service.pb.js +0 -2311
  151. package/dist/weaveapi/ingestion/v1/table.pb.d.ts +0 -121
  152. package/dist/weaveapi/ingestion/v1/table.pb.js +0 -1478
  153. package/dist/weaveapi/model/v1/index.d.ts +0 -2
  154. package/dist/weaveapi/organization/v1/service.pb.d.ts +0 -261
  155. package/dist/weaveapi/organization/v1/service.pb.js +0 -1561
  156. package/dist/weaveapi/project/v1/index.d.ts +0 -2
  157. package/dist/weaveapi/project/v1/index.js +0 -39
  158. package/dist/weaveapi/project/v1/project.pb.d.ts +0 -105
  159. package/dist/weaveapi/project/v1/project.pb.js +0 -1004
  160. package/dist/weaveapi/project/v1/service.pb.d.ts +0 -247
  161. package/dist/weaveapi/project/v1/service.pb.js +0 -1994
  162. package/dist/weaveapi/provider/v1/index.d.ts +0 -2
  163. package/dist/weaveapi/provider/v1/provider.pb.d.ts +0 -137
  164. package/dist/weaveapi/provider/v1/provider.pb.js +0 -1000
  165. package/dist/weaveapi/provider/v1/service.pb.d.ts +0 -223
  166. package/dist/weaveapi/provider/v1/service.pb.js +0 -1888
  167. package/dist/weaveapi/retrieval/v1/service.pb.d.ts +0 -93
  168. package/dist/weaveapi/retrieval/v1/service.pb.js +0 -385
  169. package/dist/weaveapi/task/v1/index.js +0 -39
  170. package/dist/weaveapi/task/v1/service.pb.d.ts +0 -172
  171. package/dist/weaveapi/task/v1/service.pb.js +0 -1436
  172. package/dist/weaveapi/task/v1/task.pb.d.ts +0 -85
  173. package/dist/weaveapi/task/v1/task.pb.js +0 -802
  174. package/dist/weaveapi/workflow/v1/service.pb.d.ts +0 -392
  175. package/dist/weaveapi/workflow/v1/service.pb.js +0 -3146
  176. /package/dist/{weaveapi/atc → weave/authz}/index.d.ts +0 -0
  177. /package/dist/{weaveapi/atc → weave/authz}/index.js +0 -0
  178. /package/dist/{weaveapi/model → weave/filter}/index.d.ts +0 -0
  179. /package/dist/{weaveapi/model → weave/filter}/index.js +0 -0
  180. /package/dist/weaveapi/{project → content}/index.d.ts +0 -0
  181. /package/dist/weaveapi/{project → content}/index.js +0 -0
  182. /package/dist/weaveapi/{provider → inference}/index.d.ts +0 -0
  183. /package/dist/weaveapi/{provider → inference}/index.js +0 -0
  184. /package/dist/weaveapi/{task → initialization}/index.d.ts +0 -0
  185. /package/dist/weaveapi/{task → initialization}/index.js +0 -0
@@ -0,0 +1,356 @@
1
+ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
+ interface Client {
3
+ query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
+ }
5
+ export declare const insertUsageTransactionQuery = "-- name: InsertUsageTransaction :one\nINSERT INTO weave.usage_transactions (\n id,\n occurred_at,\n bucket_hour,\n organization_id,\n actor_user_id,\n provider_configuration_id,\n provider_kind,\n approved_model_id,\n resolved_model_id,\n root_agent_id,\n agent_id,\n agent_run_id,\n agent_run_event_row_id,\n agent_run_event_id,\n agent_run_event_sequence,\n agent_run_event_kind,\n chat_session_id,\n chat_message_id,\n workflow_key,\n feature,\n feature_detail,\n operation,\n input_tokens,\n input_cache_read_tokens,\n input_cache_write_tokens,\n cached_input_tokens,\n output_tokens,\n output_reasoning_tokens,\n total_tokens,\n token_breakdown_status,\n input_cost_micros,\n input_cache_read_cost_micros,\n input_cache_write_cost_micros,\n cached_input_cost_micros,\n output_cost_micros,\n output_reasoning_cost_micros,\n total_cost_micros,\n unpriced_tokens,\n currency,\n pricing_status,\n pricing_source,\n input_price_per_million_micros,\n input_cache_read_price_per_million_micros,\n input_cache_write_price_per_million_micros,\n output_price_per_million_micros,\n source_event_key,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5::uuid,\n $6::uuid,\n $7,\n $8,\n $9,\n $10::uuid,\n $11::uuid,\n $12,\n $13::uuid,\n $14,\n $15,\n $16,\n $17::uuid,\n $18::uuid,\n $19::text,\n $20,\n $21,\n $22,\n $23,\n $24,\n $25,\n $26,\n $27,\n $28,\n $29,\n $30,\n $31,\n $32,\n $33,\n $34,\n $35,\n $36,\n $37,\n $38,\n $39,\n $40,\n $41,\n $42::bigint,\n $43::bigint,\n $44::bigint,\n $45::bigint,\n $46,\n COALESCE($47::jsonb, '{}'::jsonb)\n)\nRETURNING id, occurred_at, bucket_hour, organization_id, actor_user_id, provider_configuration_id, provider_kind, approved_model_id, resolved_model_id, root_agent_id, agent_id, agent_run_id, agent_run_event_row_id, agent_run_event_id, agent_run_event_sequence, agent_run_event_kind, chat_session_id, chat_message_id, workflow_key, feature, feature_detail, operation, input_tokens, input_cache_read_tokens, input_cache_write_tokens, cached_input_tokens, output_tokens, output_reasoning_tokens, total_tokens, token_breakdown_status, input_cost_micros, input_cache_read_cost_micros, input_cache_write_cost_micros, cached_input_cost_micros, output_cost_micros, output_reasoning_cost_micros, total_cost_micros, unpriced_tokens, currency, pricing_status, pricing_source, input_price_per_million_micros, input_cache_read_price_per_million_micros, input_cache_write_price_per_million_micros, output_price_per_million_micros, source_event_key, source_metadata, created_at, updated_at";
6
+ export interface InsertUsageTransactionArgs {
7
+ id: string;
8
+ occurredAt: Date;
9
+ bucketHour: Date;
10
+ organizationId: string;
11
+ actorUserId: string | null;
12
+ providerConfigurationId: string | null;
13
+ providerKind: string;
14
+ approvedModelId: string;
15
+ resolvedModelId: string;
16
+ rootAgentId: string | null;
17
+ agentId: string | null;
18
+ agentRunId: string;
19
+ agentRunEventRowId: string | null;
20
+ agentRunEventId: string;
21
+ agentRunEventSequence: string;
22
+ agentRunEventKind: string;
23
+ chatSessionId: string | null;
24
+ chatMessageId: string | null;
25
+ workflowKey: string | null;
26
+ feature: string;
27
+ featureDetail: string;
28
+ operation: string;
29
+ inputTokens: string;
30
+ inputCacheReadTokens: string;
31
+ inputCacheWriteTokens: string;
32
+ cachedInputTokens: string;
33
+ outputTokens: string;
34
+ outputReasoningTokens: string;
35
+ totalTokens: string;
36
+ tokenBreakdownStatus: string;
37
+ inputCostMicros: string;
38
+ inputCacheReadCostMicros: string;
39
+ inputCacheWriteCostMicros: string;
40
+ cachedInputCostMicros: string;
41
+ outputCostMicros: string;
42
+ outputReasoningCostMicros: string;
43
+ totalCostMicros: string;
44
+ unpricedTokens: string;
45
+ currency: string;
46
+ pricingStatus: string;
47
+ pricingSource: string;
48
+ inputPricePerMillionMicros: string | null;
49
+ inputCacheReadPricePerMillionMicros: string | null;
50
+ inputCacheWritePricePerMillionMicros: string | null;
51
+ outputPricePerMillionMicros: string | null;
52
+ sourceEventKey: string;
53
+ sourceMetadata: any | null;
54
+ }
55
+ export interface InsertUsageTransactionRow {
56
+ id: string;
57
+ occurredAt: Date;
58
+ bucketHour: Date;
59
+ organizationId: string;
60
+ actorUserId: string | null;
61
+ providerConfigurationId: string | null;
62
+ providerKind: string;
63
+ approvedModelId: string;
64
+ resolvedModelId: string;
65
+ rootAgentId: string | null;
66
+ agentId: string | null;
67
+ agentRunId: string;
68
+ agentRunEventRowId: string | null;
69
+ agentRunEventId: string;
70
+ agentRunEventSequence: string;
71
+ agentRunEventKind: string;
72
+ chatSessionId: string | null;
73
+ chatMessageId: string | null;
74
+ workflowKey: string | null;
75
+ feature: string;
76
+ featureDetail: string;
77
+ operation: string;
78
+ inputTokens: string;
79
+ inputCacheReadTokens: string;
80
+ inputCacheWriteTokens: string;
81
+ cachedInputTokens: string;
82
+ outputTokens: string;
83
+ outputReasoningTokens: string;
84
+ totalTokens: string;
85
+ tokenBreakdownStatus: string;
86
+ inputCostMicros: string;
87
+ inputCacheReadCostMicros: string;
88
+ inputCacheWriteCostMicros: string;
89
+ cachedInputCostMicros: string;
90
+ outputCostMicros: string;
91
+ outputReasoningCostMicros: string;
92
+ totalCostMicros: string;
93
+ unpricedTokens: string;
94
+ currency: string;
95
+ pricingStatus: string;
96
+ pricingSource: string;
97
+ inputPricePerMillionMicros: string | null;
98
+ inputCacheReadPricePerMillionMicros: string | null;
99
+ inputCacheWritePricePerMillionMicros: string | null;
100
+ outputPricePerMillionMicros: string | null;
101
+ sourceEventKey: string;
102
+ sourceMetadata: any;
103
+ createdAt: Date;
104
+ updatedAt: Date;
105
+ }
106
+ export declare function insertUsageTransaction(client: Client, args: InsertUsageTransactionArgs): Promise<InsertUsageTransactionRow | null>;
107
+ export declare const upsertUsageTransactionQuery = "-- name: UpsertUsageTransaction :one\nINSERT INTO weave.usage_transactions (\n id,\n occurred_at,\n bucket_hour,\n organization_id,\n actor_user_id,\n provider_configuration_id,\n provider_kind,\n approved_model_id,\n resolved_model_id,\n root_agent_id,\n agent_id,\n agent_run_id,\n agent_run_event_row_id,\n agent_run_event_id,\n agent_run_event_sequence,\n agent_run_event_kind,\n chat_session_id,\n chat_message_id,\n workflow_key,\n feature,\n feature_detail,\n operation,\n input_tokens,\n input_cache_read_tokens,\n input_cache_write_tokens,\n cached_input_tokens,\n output_tokens,\n output_reasoning_tokens,\n total_tokens,\n token_breakdown_status,\n input_cost_micros,\n input_cache_read_cost_micros,\n input_cache_write_cost_micros,\n cached_input_cost_micros,\n output_cost_micros,\n output_reasoning_cost_micros,\n total_cost_micros,\n unpriced_tokens,\n currency,\n pricing_status,\n pricing_source,\n input_price_per_million_micros,\n input_cache_read_price_per_million_micros,\n input_cache_write_price_per_million_micros,\n output_price_per_million_micros,\n source_event_key,\n source_metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5::uuid,\n $6::uuid,\n $7,\n $8,\n $9,\n $10::uuid,\n $11::uuid,\n $12,\n $13::uuid,\n $14,\n $15,\n $16,\n $17::uuid,\n $18::uuid,\n $19::text,\n $20,\n $21,\n $22,\n $23,\n $24,\n $25,\n $26,\n $27,\n $28,\n $29,\n $30,\n $31,\n $32,\n $33,\n $34,\n $35,\n $36,\n $37,\n $38,\n $39,\n $40,\n $41,\n $42::bigint,\n $43::bigint,\n $44::bigint,\n $45::bigint,\n $46,\n COALESCE($47::jsonb, '{}'::jsonb)\n)\nON CONFLICT (occurred_at, agent_run_id, agent_run_event_id, source_event_key)\n DO UPDATE SET\n bucket_hour = EXCLUDED.bucket_hour,\n organization_id = EXCLUDED.organization_id,\n actor_user_id = EXCLUDED.actor_user_id,\n provider_configuration_id = EXCLUDED.provider_configuration_id,\n provider_kind = EXCLUDED.provider_kind,\n approved_model_id = EXCLUDED.approved_model_id,\n resolved_model_id = EXCLUDED.resolved_model_id,\n root_agent_id = EXCLUDED.root_agent_id,\n agent_id = EXCLUDED.agent_id,\n agent_run_event_row_id = EXCLUDED.agent_run_event_row_id,\n agent_run_event_sequence = EXCLUDED.agent_run_event_sequence,\n agent_run_event_kind = EXCLUDED.agent_run_event_kind,\n chat_session_id = EXCLUDED.chat_session_id,\n chat_message_id = EXCLUDED.chat_message_id,\n workflow_key = EXCLUDED.workflow_key,\n feature = EXCLUDED.feature,\n feature_detail = EXCLUDED.feature_detail,\n operation = EXCLUDED.operation,\n input_tokens = EXCLUDED.input_tokens,\n input_cache_read_tokens = EXCLUDED.input_cache_read_tokens,\n input_cache_write_tokens = EXCLUDED.input_cache_write_tokens,\n cached_input_tokens = EXCLUDED.cached_input_tokens,\n output_tokens = EXCLUDED.output_tokens,\n output_reasoning_tokens = EXCLUDED.output_reasoning_tokens,\n total_tokens = EXCLUDED.total_tokens,\n token_breakdown_status = EXCLUDED.token_breakdown_status,\n input_cost_micros = EXCLUDED.input_cost_micros,\n input_cache_read_cost_micros = EXCLUDED.input_cache_read_cost_micros,\n input_cache_write_cost_micros = EXCLUDED.input_cache_write_cost_micros,\n cached_input_cost_micros = EXCLUDED.cached_input_cost_micros,\n output_cost_micros = EXCLUDED.output_cost_micros,\n output_reasoning_cost_micros = EXCLUDED.output_reasoning_cost_micros,\n total_cost_micros = EXCLUDED.total_cost_micros,\n unpriced_tokens = EXCLUDED.unpriced_tokens,\n currency = EXCLUDED.currency,\n pricing_status = EXCLUDED.pricing_status,\n pricing_source = EXCLUDED.pricing_source,\n input_price_per_million_micros = EXCLUDED.input_price_per_million_micros,\n input_cache_read_price_per_million_micros = EXCLUDED.input_cache_read_price_per_million_micros,\n input_cache_write_price_per_million_micros = EXCLUDED.input_cache_write_price_per_million_micros,\n output_price_per_million_micros = EXCLUDED.output_price_per_million_micros,\n source_metadata = EXCLUDED.source_metadata,\n updated_at = now()\nRETURNING id, occurred_at, bucket_hour, organization_id, actor_user_id, provider_configuration_id, provider_kind, approved_model_id, resolved_model_id, root_agent_id, agent_id, agent_run_id, agent_run_event_row_id, agent_run_event_id, agent_run_event_sequence, agent_run_event_kind, chat_session_id, chat_message_id, workflow_key, feature, feature_detail, operation, input_tokens, input_cache_read_tokens, input_cache_write_tokens, cached_input_tokens, output_tokens, output_reasoning_tokens, total_tokens, token_breakdown_status, input_cost_micros, input_cache_read_cost_micros, input_cache_write_cost_micros, cached_input_cost_micros, output_cost_micros, output_reasoning_cost_micros, total_cost_micros, unpriced_tokens, currency, pricing_status, pricing_source, input_price_per_million_micros, input_cache_read_price_per_million_micros, input_cache_write_price_per_million_micros, output_price_per_million_micros, source_event_key, source_metadata, created_at, updated_at";
108
+ export interface UpsertUsageTransactionArgs {
109
+ id: string;
110
+ occurredAt: Date;
111
+ bucketHour: Date;
112
+ organizationId: string;
113
+ actorUserId: string | null;
114
+ providerConfigurationId: string | null;
115
+ providerKind: string;
116
+ approvedModelId: string;
117
+ resolvedModelId: string;
118
+ rootAgentId: string | null;
119
+ agentId: string | null;
120
+ agentRunId: string;
121
+ agentRunEventRowId: string | null;
122
+ agentRunEventId: string;
123
+ agentRunEventSequence: string;
124
+ agentRunEventKind: string;
125
+ chatSessionId: string | null;
126
+ chatMessageId: string | null;
127
+ workflowKey: string | null;
128
+ feature: string;
129
+ featureDetail: string;
130
+ operation: string;
131
+ inputTokens: string;
132
+ inputCacheReadTokens: string;
133
+ inputCacheWriteTokens: string;
134
+ cachedInputTokens: string;
135
+ outputTokens: string;
136
+ outputReasoningTokens: string;
137
+ totalTokens: string;
138
+ tokenBreakdownStatus: string;
139
+ inputCostMicros: string;
140
+ inputCacheReadCostMicros: string;
141
+ inputCacheWriteCostMicros: string;
142
+ cachedInputCostMicros: string;
143
+ outputCostMicros: string;
144
+ outputReasoningCostMicros: string;
145
+ totalCostMicros: string;
146
+ unpricedTokens: string;
147
+ currency: string;
148
+ pricingStatus: string;
149
+ pricingSource: string;
150
+ inputPricePerMillionMicros: string | null;
151
+ inputCacheReadPricePerMillionMicros: string | null;
152
+ inputCacheWritePricePerMillionMicros: string | null;
153
+ outputPricePerMillionMicros: string | null;
154
+ sourceEventKey: string;
155
+ sourceMetadata: any | null;
156
+ }
157
+ export interface UpsertUsageTransactionRow {
158
+ id: string;
159
+ occurredAt: Date;
160
+ bucketHour: Date;
161
+ organizationId: string;
162
+ actorUserId: string | null;
163
+ providerConfigurationId: string | null;
164
+ providerKind: string;
165
+ approvedModelId: string;
166
+ resolvedModelId: string;
167
+ rootAgentId: string | null;
168
+ agentId: string | null;
169
+ agentRunId: string;
170
+ agentRunEventRowId: string | null;
171
+ agentRunEventId: string;
172
+ agentRunEventSequence: string;
173
+ agentRunEventKind: string;
174
+ chatSessionId: string | null;
175
+ chatMessageId: string | null;
176
+ workflowKey: string | null;
177
+ feature: string;
178
+ featureDetail: string;
179
+ operation: string;
180
+ inputTokens: string;
181
+ inputCacheReadTokens: string;
182
+ inputCacheWriteTokens: string;
183
+ cachedInputTokens: string;
184
+ outputTokens: string;
185
+ outputReasoningTokens: string;
186
+ totalTokens: string;
187
+ tokenBreakdownStatus: string;
188
+ inputCostMicros: string;
189
+ inputCacheReadCostMicros: string;
190
+ inputCacheWriteCostMicros: string;
191
+ cachedInputCostMicros: string;
192
+ outputCostMicros: string;
193
+ outputReasoningCostMicros: string;
194
+ totalCostMicros: string;
195
+ unpricedTokens: string;
196
+ currency: string;
197
+ pricingStatus: string;
198
+ pricingSource: string;
199
+ inputPricePerMillionMicros: string | null;
200
+ inputCacheReadPricePerMillionMicros: string | null;
201
+ inputCacheWritePricePerMillionMicros: string | null;
202
+ outputPricePerMillionMicros: string | null;
203
+ sourceEventKey: string;
204
+ sourceMetadata: any;
205
+ createdAt: Date;
206
+ updatedAt: Date;
207
+ }
208
+ export declare function upsertUsageTransaction(client: Client, args: UpsertUsageTransactionArgs): Promise<UpsertUsageTransactionRow | null>;
209
+ export declare const getUsageTransactionBySourceQuery = "-- name: GetUsageTransactionBySource :one\nSELECT id, occurred_at, bucket_hour, organization_id, actor_user_id, provider_configuration_id, provider_kind, approved_model_id, resolved_model_id, root_agent_id, agent_id, agent_run_id, agent_run_event_row_id, agent_run_event_id, agent_run_event_sequence, agent_run_event_kind, chat_session_id, chat_message_id, workflow_key, feature, feature_detail, operation, input_tokens, input_cache_read_tokens, input_cache_write_tokens, cached_input_tokens, output_tokens, output_reasoning_tokens, total_tokens, token_breakdown_status, input_cost_micros, input_cache_read_cost_micros, input_cache_write_cost_micros, cached_input_cost_micros, output_cost_micros, output_reasoning_cost_micros, total_cost_micros, unpriced_tokens, currency, pricing_status, pricing_source, input_price_per_million_micros, input_cache_read_price_per_million_micros, input_cache_write_price_per_million_micros, output_price_per_million_micros, source_event_key, source_metadata, created_at, updated_at\nFROM weave.usage_transactions\nWHERE organization_id = $1\n AND occurred_at = $2\n AND agent_run_id = $3\n AND agent_run_event_id = $4\n AND source_event_key = $5";
210
+ export interface GetUsageTransactionBySourceArgs {
211
+ organizationId: string;
212
+ occurredAt: Date;
213
+ agentRunId: string;
214
+ agentRunEventId: string;
215
+ sourceEventKey: string;
216
+ }
217
+ export interface GetUsageTransactionBySourceRow {
218
+ id: string;
219
+ occurredAt: Date;
220
+ bucketHour: Date;
221
+ organizationId: string;
222
+ actorUserId: string | null;
223
+ providerConfigurationId: string | null;
224
+ providerKind: string;
225
+ approvedModelId: string;
226
+ resolvedModelId: string;
227
+ rootAgentId: string | null;
228
+ agentId: string | null;
229
+ agentRunId: string;
230
+ agentRunEventRowId: string | null;
231
+ agentRunEventId: string;
232
+ agentRunEventSequence: string;
233
+ agentRunEventKind: string;
234
+ chatSessionId: string | null;
235
+ chatMessageId: string | null;
236
+ workflowKey: string | null;
237
+ feature: string;
238
+ featureDetail: string;
239
+ operation: string;
240
+ inputTokens: string;
241
+ inputCacheReadTokens: string;
242
+ inputCacheWriteTokens: string;
243
+ cachedInputTokens: string;
244
+ outputTokens: string;
245
+ outputReasoningTokens: string;
246
+ totalTokens: string;
247
+ tokenBreakdownStatus: string;
248
+ inputCostMicros: string;
249
+ inputCacheReadCostMicros: string;
250
+ inputCacheWriteCostMicros: string;
251
+ cachedInputCostMicros: string;
252
+ outputCostMicros: string;
253
+ outputReasoningCostMicros: string;
254
+ totalCostMicros: string;
255
+ unpricedTokens: string;
256
+ currency: string;
257
+ pricingStatus: string;
258
+ pricingSource: string;
259
+ inputPricePerMillionMicros: string | null;
260
+ inputCacheReadPricePerMillionMicros: string | null;
261
+ inputCacheWritePricePerMillionMicros: string | null;
262
+ outputPricePerMillionMicros: string | null;
263
+ sourceEventKey: string;
264
+ sourceMetadata: any;
265
+ createdAt: Date;
266
+ updatedAt: Date;
267
+ }
268
+ export declare function getUsageTransactionBySource(client: Client, args: GetUsageTransactionBySourceArgs): Promise<GetUsageTransactionBySourceRow | null>;
269
+ export declare const listUsageTransactionsForBackfillAuditQuery = "-- name: ListUsageTransactionsForBackfillAudit :many\nSELECT id, occurred_at, bucket_hour, organization_id, actor_user_id, provider_configuration_id, provider_kind, approved_model_id, resolved_model_id, root_agent_id, agent_id, agent_run_id, agent_run_event_row_id, agent_run_event_id, agent_run_event_sequence, agent_run_event_kind, chat_session_id, chat_message_id, workflow_key, feature, feature_detail, operation, input_tokens, input_cache_read_tokens, input_cache_write_tokens, cached_input_tokens, output_tokens, output_reasoning_tokens, total_tokens, token_breakdown_status, input_cost_micros, input_cache_read_cost_micros, input_cache_write_cost_micros, cached_input_cost_micros, output_cost_micros, output_reasoning_cost_micros, total_cost_micros, unpriced_tokens, currency, pricing_status, pricing_source, input_price_per_million_micros, input_cache_read_price_per_million_micros, input_cache_write_price_per_million_micros, output_price_per_million_micros, source_event_key, source_metadata, created_at, updated_at\nFROM weave.usage_transactions\nWHERE organization_id = $1\n AND occurred_at >= $2\n AND occurred_at < $3\n AND ($4::uuid IS NULL OR agent_run_id = $4::uuid)\n AND ($5::text IS NULL OR agent_run_event_id = $5::text)\nORDER BY occurred_at ASC, agent_run_id ASC, agent_run_event_id ASC, source_event_key ASC\nLIMIT $7::integer\nOFFSET $6::integer";
270
+ export interface ListUsageTransactionsForBackfillAuditArgs {
271
+ organizationId: string;
272
+ startAt: Date;
273
+ endAt: Date;
274
+ agentRunId: string | null;
275
+ agentRunEventId: string | null;
276
+ offsetCount: number;
277
+ limitCount: number;
278
+ }
279
+ export interface ListUsageTransactionsForBackfillAuditRow {
280
+ id: string;
281
+ occurredAt: Date;
282
+ bucketHour: Date;
283
+ organizationId: string;
284
+ actorUserId: string | null;
285
+ providerConfigurationId: string | null;
286
+ providerKind: string;
287
+ approvedModelId: string;
288
+ resolvedModelId: string;
289
+ rootAgentId: string | null;
290
+ agentId: string | null;
291
+ agentRunId: string;
292
+ agentRunEventRowId: string | null;
293
+ agentRunEventId: string;
294
+ agentRunEventSequence: string;
295
+ agentRunEventKind: string;
296
+ chatSessionId: string | null;
297
+ chatMessageId: string | null;
298
+ workflowKey: string | null;
299
+ feature: string;
300
+ featureDetail: string;
301
+ operation: string;
302
+ inputTokens: string;
303
+ inputCacheReadTokens: string;
304
+ inputCacheWriteTokens: string;
305
+ cachedInputTokens: string;
306
+ outputTokens: string;
307
+ outputReasoningTokens: string;
308
+ totalTokens: string;
309
+ tokenBreakdownStatus: string;
310
+ inputCostMicros: string;
311
+ inputCacheReadCostMicros: string;
312
+ inputCacheWriteCostMicros: string;
313
+ cachedInputCostMicros: string;
314
+ outputCostMicros: string;
315
+ outputReasoningCostMicros: string;
316
+ totalCostMicros: string;
317
+ unpricedTokens: string;
318
+ currency: string;
319
+ pricingStatus: string;
320
+ pricingSource: string;
321
+ inputPricePerMillionMicros: string | null;
322
+ inputCacheReadPricePerMillionMicros: string | null;
323
+ inputCacheWritePricePerMillionMicros: string | null;
324
+ outputPricePerMillionMicros: string | null;
325
+ sourceEventKey: string;
326
+ sourceMetadata: any;
327
+ createdAt: Date;
328
+ updatedAt: Date;
329
+ }
330
+ export declare function listUsageTransactionsForBackfillAudit(client: Client, args: ListUsageTransactionsForBackfillAuditArgs): Promise<ListUsageTransactionsForBackfillAuditRow[]>;
331
+ export declare const listAgentRunUsageBackfillSourceRowsQuery = "-- name: ListAgentRunUsageBackfillSourceRows :many\nSELECT\n e.id AS agent_run_event_row_id,\n e.organization_id,\n r.started_by_user_id AS actor_user_id,\n r.root_agent_id,\n e.agent_id,\n e.agent_run_id,\n e.id::text AS agent_run_event_id,\n e.sequence AS agent_run_event_sequence,\n e.kind AS agent_run_event_kind,\n r.chat_session_id,\n r.model_id AS run_model_id,\n r.inference_model_route_id,\n e.generation_details,\n e.created_at AS occurred_at\nFROM weave.agent_run_event e\n JOIN weave.agent_run r\n ON r.organization_id = e.organization_id\n AND r.id = e.agent_run_id\nWHERE e.organization_id = $1\n AND e.generation_details IS NOT NULL\n AND e.created_at >= $2\n AND e.created_at < $3\nORDER BY e.created_at ASC, e.agent_run_id ASC, e.sequence ASC\nLIMIT $5::integer\nOFFSET $4::integer";
332
+ export interface ListAgentRunUsageBackfillSourceRowsArgs {
333
+ organizationId: string;
334
+ startAt: Date;
335
+ endAt: Date;
336
+ offsetCount: number;
337
+ limitCount: number;
338
+ }
339
+ export interface ListAgentRunUsageBackfillSourceRowsRow {
340
+ agentRunEventRowId: string;
341
+ organizationId: string;
342
+ actorUserId: string;
343
+ rootAgentId: string;
344
+ agentId: string | null;
345
+ agentRunId: string;
346
+ agentRunEventId: string;
347
+ agentRunEventSequence: string;
348
+ agentRunEventKind: string;
349
+ chatSessionId: string | null;
350
+ runModelId: string;
351
+ inferenceModelRouteId: string | null;
352
+ generationDetails: any | null;
353
+ occurredAt: Date;
354
+ }
355
+ export declare function listAgentRunUsageBackfillSourceRows(client: Client, args: ListAgentRunUsageBackfillSourceRowsArgs): Promise<ListAgentRunUsageBackfillSourceRowsRow[]>;
356
+ export {};