weave-typescript 0.51.3 → 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 +1 -1
  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,209 @@
1
+ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
+ interface Client {
3
+ query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
+ }
5
+ export declare const createToolQuery = "-- name: CreateTool :one\nINSERT INTO weave.tool (\n organization_id,\n kind,\n slug,\n name,\n description,\n input_schema,\n output_schema,\n configuration\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n COALESCE($6::jsonb, '{}'::jsonb),\n $7::jsonb,\n COALESCE($8::jsonb, '{}'::jsonb)\n)\nRETURNING id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at";
6
+ export interface CreateToolArgs {
7
+ organizationId: string;
8
+ kind: string;
9
+ slug: string;
10
+ name: string;
11
+ description: string;
12
+ inputSchema: any | null;
13
+ outputSchema: any | null;
14
+ configuration: any | null;
15
+ }
16
+ export interface CreateToolRow {
17
+ id: string;
18
+ organizationId: string;
19
+ kind: string;
20
+ slug: string;
21
+ name: string;
22
+ description: string;
23
+ inputSchema: any;
24
+ outputSchema: any | null;
25
+ configuration: any;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ }
29
+ export declare function createTool(client: Client, args: CreateToolArgs): Promise<CreateToolRow | null>;
30
+ export declare const upsertToolQuery = "-- name: UpsertTool :one\nINSERT INTO weave.tool (\n organization_id,\n kind,\n slug,\n name,\n description,\n input_schema,\n output_schema,\n configuration\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n COALESCE($5::text, ''),\n COALESCE($6::jsonb, '{}'::jsonb),\n $7::jsonb,\n COALESCE($8::jsonb, '{}'::jsonb)\n)\nON CONFLICT (organization_id, slug) DO UPDATE\nSET kind = EXCLUDED.kind,\n name = EXCLUDED.name,\n description = EXCLUDED.description,\n input_schema = EXCLUDED.input_schema,\n output_schema = EXCLUDED.output_schema,\n configuration = EXCLUDED.configuration,\n updated_at = now()\nRETURNING\n id,\n organization_id,\n kind,\n slug,\n name,\n description,\n input_schema,\n output_schema,\n configuration,\n created_at,\n updated_at,\n (xmax = 0)::bool AS created";
31
+ export interface UpsertToolArgs {
32
+ organizationId: string;
33
+ kind: string;
34
+ slug: string;
35
+ name: string;
36
+ description: string | null;
37
+ inputSchema: any | null;
38
+ outputSchema: any | null;
39
+ configuration: any | null;
40
+ }
41
+ export interface UpsertToolRow {
42
+ id: string;
43
+ organizationId: string;
44
+ kind: string;
45
+ slug: string;
46
+ name: string;
47
+ description: string;
48
+ inputSchema: any;
49
+ outputSchema: any | null;
50
+ configuration: any;
51
+ createdAt: Date;
52
+ updatedAt: Date;
53
+ created: boolean;
54
+ }
55
+ export declare function upsertTool(client: Client, args: UpsertToolArgs): Promise<UpsertToolRow | null>;
56
+ export declare const getToolQuery = "-- name: GetTool :one\nSELECT id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at\nFROM weave.tool\nWHERE organization_id = $1\n AND id = $2";
57
+ export interface GetToolArgs {
58
+ organizationId: string;
59
+ toolId: string;
60
+ }
61
+ export interface GetToolRow {
62
+ id: string;
63
+ organizationId: string;
64
+ kind: string;
65
+ slug: string;
66
+ name: string;
67
+ description: string;
68
+ inputSchema: any;
69
+ outputSchema: any | null;
70
+ configuration: any;
71
+ createdAt: Date;
72
+ updatedAt: Date;
73
+ }
74
+ export declare function getTool(client: Client, args: GetToolArgs): Promise<GetToolRow | null>;
75
+ export declare const updateToolQuery = "-- name: UpdateTool :one\nUPDATE weave.tool\nSET kind = $1,\n slug = $2,\n name = $3,\n description = COALESCE($4::text, ''),\n input_schema = COALESCE($5::jsonb, '{}'::jsonb),\n output_schema = $6::jsonb,\n configuration = COALESCE($7::jsonb, '{}'::jsonb)\nWHERE organization_id = $8\n AND id = $9\nRETURNING id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at";
76
+ export interface UpdateToolArgs {
77
+ kind: string;
78
+ slug: string;
79
+ name: string;
80
+ description: string | null;
81
+ inputSchema: any | null;
82
+ outputSchema: any | null;
83
+ configuration: any | null;
84
+ organizationId: string;
85
+ toolId: string;
86
+ }
87
+ export interface UpdateToolRow {
88
+ id: string;
89
+ organizationId: string;
90
+ kind: string;
91
+ slug: string;
92
+ name: string;
93
+ description: string;
94
+ inputSchema: any;
95
+ outputSchema: any | null;
96
+ configuration: any;
97
+ createdAt: Date;
98
+ updatedAt: Date;
99
+ }
100
+ export declare function updateTool(client: Client, args: UpdateToolArgs): Promise<UpdateToolRow | null>;
101
+ export declare const deleteToolQuery = "-- name: DeleteTool :exec\nDELETE FROM weave.tool\nWHERE organization_id = $1\n AND id = $2";
102
+ export interface DeleteToolArgs {
103
+ organizationId: string;
104
+ toolId: string;
105
+ }
106
+ export declare function deleteTool(client: Client, args: DeleteToolArgs): Promise<void>;
107
+ export declare const listToolsQuery = "-- name: ListTools :many\nSELECT id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at\nFROM weave.tool\nWHERE organization_id = $1\nORDER BY name, id\nLIMIT $3 OFFSET $2";
108
+ export interface ListToolsArgs {
109
+ organizationId: string;
110
+ pageOffset: string;
111
+ pageSize: string;
112
+ }
113
+ export interface ListToolsRow {
114
+ id: string;
115
+ organizationId: string;
116
+ kind: string;
117
+ slug: string;
118
+ name: string;
119
+ description: string;
120
+ inputSchema: any;
121
+ outputSchema: any | null;
122
+ configuration: any;
123
+ createdAt: Date;
124
+ updatedAt: Date;
125
+ }
126
+ export declare function listTools(client: Client, args: ListToolsArgs): Promise<ListToolsRow[]>;
127
+ export declare const attachAgentToolQuery = "-- name: AttachAgentTool :one\nINSERT INTO weave.agent_tool (\n organization_id,\n agent_id,\n tool_id,\n configuration,\n confirmation\n)\nSELECT\n a.organization_id,\n a.id,\n t.id,\n COALESCE($1::jsonb, '{}'::jsonb),\n $2\nFROM weave.agent a\n JOIN weave.tool t\n ON t.organization_id = a.organization_id\n AND t.id = $3\nWHERE a.organization_id = $4\n AND a.id = $5\nON CONFLICT (organization_id, agent_id, tool_id)\n DO UPDATE SET\n configuration = EXCLUDED.configuration,\n confirmation = EXCLUDED.confirmation\nRETURNING organization_id, agent_id, tool_id, configuration, confirmation, created_at, updated_at";
128
+ export interface AttachAgentToolArgs {
129
+ configuration: any | null;
130
+ confirmation: string;
131
+ toolId: string;
132
+ organizationId: string;
133
+ agentId: string;
134
+ }
135
+ export interface AttachAgentToolRow {
136
+ organizationId: string;
137
+ agentId: string;
138
+ toolId: string;
139
+ configuration: any;
140
+ confirmation: string;
141
+ createdAt: Date;
142
+ updatedAt: Date;
143
+ }
144
+ export declare function attachAgentTool(client: Client, args: AttachAgentToolArgs): Promise<AttachAgentToolRow | null>;
145
+ export declare const listAgentToolsQuery = "-- name: ListAgentTools :many\nSELECT\n at.organization_id,\n at.agent_id,\n at.tool_id,\n at.configuration AS agent_tool_configuration,\n at.confirmation,\n at.created_at AS agent_tool_created_at,\n at.updated_at AS agent_tool_updated_at,\n td.id,\n td.kind,\n td.slug,\n td.name,\n td.description,\n td.input_schema,\n td.output_schema,\n td.configuration AS tool_configuration,\n td.created_at AS tool_created_at,\n td.updated_at AS tool_updated_at\nFROM weave.agent_tool at\n JOIN weave.tool td\n ON td.organization_id = at.organization_id\n AND td.id = at.tool_id\nWHERE at.organization_id = $1\n AND at.agent_id = $2\nORDER BY td.name, td.id";
146
+ export interface ListAgentToolsArgs {
147
+ organizationId: string;
148
+ agentId: string;
149
+ }
150
+ export interface ListAgentToolsRow {
151
+ organizationId: string;
152
+ agentId: string;
153
+ toolId: string;
154
+ agentToolConfiguration: any;
155
+ confirmation: string;
156
+ agentToolCreatedAt: Date;
157
+ agentToolUpdatedAt: Date;
158
+ id: string;
159
+ kind: string;
160
+ slug: string;
161
+ name: string;
162
+ description: string;
163
+ inputSchema: any;
164
+ outputSchema: any | null;
165
+ toolConfiguration: any;
166
+ toolCreatedAt: Date;
167
+ toolUpdatedAt: Date;
168
+ }
169
+ export declare function listAgentTools(client: Client, args: ListAgentToolsArgs): Promise<ListAgentToolsRow[]>;
170
+ export declare const getAgentToolQuery = "-- name: GetAgentTool :one\nSELECT\n at.organization_id,\n at.agent_id,\n at.tool_id,\n at.configuration AS agent_tool_configuration,\n at.confirmation,\n at.created_at AS agent_tool_created_at,\n at.updated_at AS agent_tool_updated_at,\n td.id,\n td.kind,\n td.slug,\n td.name,\n td.description,\n td.input_schema,\n td.output_schema,\n td.configuration AS tool_configuration,\n td.created_at AS tool_created_at,\n td.updated_at AS tool_updated_at\nFROM weave.agent_tool at\n JOIN weave.tool td\n ON td.organization_id = at.organization_id\n AND td.id = at.tool_id\nWHERE at.organization_id = $1\n AND at.agent_id = $2\n AND at.tool_id = $3";
171
+ export interface GetAgentToolArgs {
172
+ organizationId: string;
173
+ agentId: string;
174
+ toolId: string;
175
+ }
176
+ export interface GetAgentToolRow {
177
+ organizationId: string;
178
+ agentId: string;
179
+ toolId: string;
180
+ agentToolConfiguration: any;
181
+ confirmation: string;
182
+ agentToolCreatedAt: Date;
183
+ agentToolUpdatedAt: Date;
184
+ id: string;
185
+ kind: string;
186
+ slug: string;
187
+ name: string;
188
+ description: string;
189
+ inputSchema: any;
190
+ outputSchema: any | null;
191
+ toolConfiguration: any;
192
+ toolCreatedAt: Date;
193
+ toolUpdatedAt: Date;
194
+ }
195
+ export declare function getAgentTool(client: Client, args: GetAgentToolArgs): Promise<GetAgentToolRow | null>;
196
+ export declare const detachAgentToolQuery = "-- name: DetachAgentTool :exec\nDELETE FROM weave.agent_tool\nWHERE organization_id = $1\n AND agent_id = $2\n AND tool_id = $3";
197
+ export interface DetachAgentToolArgs {
198
+ organizationId: string;
199
+ agentId: string;
200
+ toolId: string;
201
+ }
202
+ export declare function detachAgentTool(client: Client, args: DetachAgentToolArgs): Promise<void>;
203
+ export declare const deleteAgentToolsForAgentQuery = "-- name: DeleteAgentToolsForAgent :exec\nDELETE FROM weave.agent_tool\nWHERE organization_id = $1\n AND agent_id = $2";
204
+ export interface DeleteAgentToolsForAgentArgs {
205
+ organizationId: string;
206
+ agentId: string;
207
+ }
208
+ export declare function deleteAgentToolsForAgent(client: Client, args: DeleteAgentToolsForAgentArgs): Promise<void>;
209
+ export {};
@@ -0,0 +1,407 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAgentToolsForAgentQuery = exports.detachAgentToolQuery = exports.getAgentToolQuery = exports.listAgentToolsQuery = exports.attachAgentToolQuery = exports.listToolsQuery = exports.deleteToolQuery = exports.updateToolQuery = exports.getToolQuery = exports.upsertToolQuery = exports.createToolQuery = void 0;
4
+ exports.createTool = createTool;
5
+ exports.upsertTool = upsertTool;
6
+ exports.getTool = getTool;
7
+ exports.updateTool = updateTool;
8
+ exports.deleteTool = deleteTool;
9
+ exports.listTools = listTools;
10
+ exports.attachAgentTool = attachAgentTool;
11
+ exports.listAgentTools = listAgentTools;
12
+ exports.getAgentTool = getAgentTool;
13
+ exports.detachAgentTool = detachAgentTool;
14
+ exports.deleteAgentToolsForAgent = deleteAgentToolsForAgent;
15
+ exports.createToolQuery = `-- name: CreateTool :one
16
+ INSERT INTO weave.tool (
17
+ organization_id,
18
+ kind,
19
+ slug,
20
+ name,
21
+ description,
22
+ input_schema,
23
+ output_schema,
24
+ configuration
25
+ ) VALUES (
26
+ $1,
27
+ $2,
28
+ $3,
29
+ $4,
30
+ $5,
31
+ COALESCE($6::jsonb, '{}'::jsonb),
32
+ $7::jsonb,
33
+ COALESCE($8::jsonb, '{}'::jsonb)
34
+ )
35
+ RETURNING id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at`;
36
+ async function createTool(client, args) {
37
+ const result = await client.query({
38
+ text: exports.createToolQuery,
39
+ values: [args.organizationId, args.kind, args.slug, args.name, args.description, args.inputSchema, args.outputSchema, args.configuration],
40
+ rowMode: "array"
41
+ });
42
+ if (result.rows.length !== 1) {
43
+ return null;
44
+ }
45
+ const row = result.rows[0];
46
+ return {
47
+ id: row[0],
48
+ organizationId: row[1],
49
+ kind: row[2],
50
+ slug: row[3],
51
+ name: row[4],
52
+ description: row[5],
53
+ inputSchema: row[6],
54
+ outputSchema: row[7],
55
+ configuration: row[8],
56
+ createdAt: row[9],
57
+ updatedAt: row[10]
58
+ };
59
+ }
60
+ exports.upsertToolQuery = `-- name: UpsertTool :one
61
+ INSERT INTO weave.tool (
62
+ organization_id,
63
+ kind,
64
+ slug,
65
+ name,
66
+ description,
67
+ input_schema,
68
+ output_schema,
69
+ configuration
70
+ ) VALUES (
71
+ $1,
72
+ $2,
73
+ $3,
74
+ $4,
75
+ COALESCE($5::text, ''),
76
+ COALESCE($6::jsonb, '{}'::jsonb),
77
+ $7::jsonb,
78
+ COALESCE($8::jsonb, '{}'::jsonb)
79
+ )
80
+ ON CONFLICT (organization_id, slug) DO UPDATE
81
+ SET kind = EXCLUDED.kind,
82
+ name = EXCLUDED.name,
83
+ description = EXCLUDED.description,
84
+ input_schema = EXCLUDED.input_schema,
85
+ output_schema = EXCLUDED.output_schema,
86
+ configuration = EXCLUDED.configuration,
87
+ updated_at = now()
88
+ RETURNING
89
+ id,
90
+ organization_id,
91
+ kind,
92
+ slug,
93
+ name,
94
+ description,
95
+ input_schema,
96
+ output_schema,
97
+ configuration,
98
+ created_at,
99
+ updated_at,
100
+ (xmax = 0)::bool AS created`;
101
+ async function upsertTool(client, args) {
102
+ const result = await client.query({
103
+ text: exports.upsertToolQuery,
104
+ values: [args.organizationId, args.kind, args.slug, args.name, args.description, args.inputSchema, args.outputSchema, args.configuration],
105
+ rowMode: "array"
106
+ });
107
+ if (result.rows.length !== 1) {
108
+ return null;
109
+ }
110
+ const row = result.rows[0];
111
+ return {
112
+ id: row[0],
113
+ organizationId: row[1],
114
+ kind: row[2],
115
+ slug: row[3],
116
+ name: row[4],
117
+ description: row[5],
118
+ inputSchema: row[6],
119
+ outputSchema: row[7],
120
+ configuration: row[8],
121
+ createdAt: row[9],
122
+ updatedAt: row[10],
123
+ created: row[11]
124
+ };
125
+ }
126
+ exports.getToolQuery = `-- name: GetTool :one
127
+ SELECT id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at
128
+ FROM weave.tool
129
+ WHERE organization_id = $1
130
+ AND id = $2`;
131
+ async function getTool(client, args) {
132
+ const result = await client.query({
133
+ text: exports.getToolQuery,
134
+ values: [args.organizationId, args.toolId],
135
+ rowMode: "array"
136
+ });
137
+ if (result.rows.length !== 1) {
138
+ return null;
139
+ }
140
+ const row = result.rows[0];
141
+ return {
142
+ id: row[0],
143
+ organizationId: row[1],
144
+ kind: row[2],
145
+ slug: row[3],
146
+ name: row[4],
147
+ description: row[5],
148
+ inputSchema: row[6],
149
+ outputSchema: row[7],
150
+ configuration: row[8],
151
+ createdAt: row[9],
152
+ updatedAt: row[10]
153
+ };
154
+ }
155
+ exports.updateToolQuery = `-- name: UpdateTool :one
156
+ UPDATE weave.tool
157
+ SET kind = $1,
158
+ slug = $2,
159
+ name = $3,
160
+ description = COALESCE($4::text, ''),
161
+ input_schema = COALESCE($5::jsonb, '{}'::jsonb),
162
+ output_schema = $6::jsonb,
163
+ configuration = COALESCE($7::jsonb, '{}'::jsonb)
164
+ WHERE organization_id = $8
165
+ AND id = $9
166
+ RETURNING id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at`;
167
+ async function updateTool(client, args) {
168
+ const result = await client.query({
169
+ text: exports.updateToolQuery,
170
+ values: [args.kind, args.slug, args.name, args.description, args.inputSchema, args.outputSchema, args.configuration, args.organizationId, args.toolId],
171
+ rowMode: "array"
172
+ });
173
+ if (result.rows.length !== 1) {
174
+ return null;
175
+ }
176
+ const row = result.rows[0];
177
+ return {
178
+ id: row[0],
179
+ organizationId: row[1],
180
+ kind: row[2],
181
+ slug: row[3],
182
+ name: row[4],
183
+ description: row[5],
184
+ inputSchema: row[6],
185
+ outputSchema: row[7],
186
+ configuration: row[8],
187
+ createdAt: row[9],
188
+ updatedAt: row[10]
189
+ };
190
+ }
191
+ exports.deleteToolQuery = `-- name: DeleteTool :exec
192
+ DELETE FROM weave.tool
193
+ WHERE organization_id = $1
194
+ AND id = $2`;
195
+ async function deleteTool(client, args) {
196
+ await client.query({
197
+ text: exports.deleteToolQuery,
198
+ values: [args.organizationId, args.toolId],
199
+ rowMode: "array"
200
+ });
201
+ }
202
+ exports.listToolsQuery = `-- name: ListTools :many
203
+ SELECT id, organization_id, kind, slug, name, description, input_schema, output_schema, configuration, created_at, updated_at
204
+ FROM weave.tool
205
+ WHERE organization_id = $1
206
+ ORDER BY name, id
207
+ LIMIT $3 OFFSET $2`;
208
+ async function listTools(client, args) {
209
+ const result = await client.query({
210
+ text: exports.listToolsQuery,
211
+ values: [args.organizationId, args.pageOffset, args.pageSize],
212
+ rowMode: "array"
213
+ });
214
+ return result.rows.map(row => {
215
+ return {
216
+ id: row[0],
217
+ organizationId: row[1],
218
+ kind: row[2],
219
+ slug: row[3],
220
+ name: row[4],
221
+ description: row[5],
222
+ inputSchema: row[6],
223
+ outputSchema: row[7],
224
+ configuration: row[8],
225
+ createdAt: row[9],
226
+ updatedAt: row[10]
227
+ };
228
+ });
229
+ }
230
+ exports.attachAgentToolQuery = `-- name: AttachAgentTool :one
231
+ INSERT INTO weave.agent_tool (
232
+ organization_id,
233
+ agent_id,
234
+ tool_id,
235
+ configuration,
236
+ confirmation
237
+ )
238
+ SELECT
239
+ a.organization_id,
240
+ a.id,
241
+ t.id,
242
+ COALESCE($1::jsonb, '{}'::jsonb),
243
+ $2
244
+ FROM weave.agent a
245
+ JOIN weave.tool t
246
+ ON t.organization_id = a.organization_id
247
+ AND t.id = $3
248
+ WHERE a.organization_id = $4
249
+ AND a.id = $5
250
+ ON CONFLICT (organization_id, agent_id, tool_id)
251
+ DO UPDATE SET
252
+ configuration = EXCLUDED.configuration,
253
+ confirmation = EXCLUDED.confirmation
254
+ RETURNING organization_id, agent_id, tool_id, configuration, confirmation, created_at, updated_at`;
255
+ async function attachAgentTool(client, args) {
256
+ const result = await client.query({
257
+ text: exports.attachAgentToolQuery,
258
+ values: [args.configuration, args.confirmation, args.toolId, args.organizationId, args.agentId],
259
+ rowMode: "array"
260
+ });
261
+ if (result.rows.length !== 1) {
262
+ return null;
263
+ }
264
+ const row = result.rows[0];
265
+ return {
266
+ organizationId: row[0],
267
+ agentId: row[1],
268
+ toolId: row[2],
269
+ configuration: row[3],
270
+ confirmation: row[4],
271
+ createdAt: row[5],
272
+ updatedAt: row[6]
273
+ };
274
+ }
275
+ exports.listAgentToolsQuery = `-- name: ListAgentTools :many
276
+ SELECT
277
+ at.organization_id,
278
+ at.agent_id,
279
+ at.tool_id,
280
+ at.configuration AS agent_tool_configuration,
281
+ at.confirmation,
282
+ at.created_at AS agent_tool_created_at,
283
+ at.updated_at AS agent_tool_updated_at,
284
+ td.id,
285
+ td.kind,
286
+ td.slug,
287
+ td.name,
288
+ td.description,
289
+ td.input_schema,
290
+ td.output_schema,
291
+ td.configuration AS tool_configuration,
292
+ td.created_at AS tool_created_at,
293
+ td.updated_at AS tool_updated_at
294
+ FROM weave.agent_tool at
295
+ JOIN weave.tool td
296
+ ON td.organization_id = at.organization_id
297
+ AND td.id = at.tool_id
298
+ WHERE at.organization_id = $1
299
+ AND at.agent_id = $2
300
+ ORDER BY td.name, td.id`;
301
+ async function listAgentTools(client, args) {
302
+ const result = await client.query({
303
+ text: exports.listAgentToolsQuery,
304
+ values: [args.organizationId, args.agentId],
305
+ rowMode: "array"
306
+ });
307
+ return result.rows.map(row => {
308
+ return {
309
+ organizationId: row[0],
310
+ agentId: row[1],
311
+ toolId: row[2],
312
+ agentToolConfiguration: row[3],
313
+ confirmation: row[4],
314
+ agentToolCreatedAt: row[5],
315
+ agentToolUpdatedAt: row[6],
316
+ id: row[7],
317
+ kind: row[8],
318
+ slug: row[9],
319
+ name: row[10],
320
+ description: row[11],
321
+ inputSchema: row[12],
322
+ outputSchema: row[13],
323
+ toolConfiguration: row[14],
324
+ toolCreatedAt: row[15],
325
+ toolUpdatedAt: row[16]
326
+ };
327
+ });
328
+ }
329
+ exports.getAgentToolQuery = `-- name: GetAgentTool :one
330
+ SELECT
331
+ at.organization_id,
332
+ at.agent_id,
333
+ at.tool_id,
334
+ at.configuration AS agent_tool_configuration,
335
+ at.confirmation,
336
+ at.created_at AS agent_tool_created_at,
337
+ at.updated_at AS agent_tool_updated_at,
338
+ td.id,
339
+ td.kind,
340
+ td.slug,
341
+ td.name,
342
+ td.description,
343
+ td.input_schema,
344
+ td.output_schema,
345
+ td.configuration AS tool_configuration,
346
+ td.created_at AS tool_created_at,
347
+ td.updated_at AS tool_updated_at
348
+ FROM weave.agent_tool at
349
+ JOIN weave.tool td
350
+ ON td.organization_id = at.organization_id
351
+ AND td.id = at.tool_id
352
+ WHERE at.organization_id = $1
353
+ AND at.agent_id = $2
354
+ AND at.tool_id = $3`;
355
+ async function getAgentTool(client, args) {
356
+ const result = await client.query({
357
+ text: exports.getAgentToolQuery,
358
+ values: [args.organizationId, args.agentId, args.toolId],
359
+ rowMode: "array"
360
+ });
361
+ if (result.rows.length !== 1) {
362
+ return null;
363
+ }
364
+ const row = result.rows[0];
365
+ return {
366
+ organizationId: row[0],
367
+ agentId: row[1],
368
+ toolId: row[2],
369
+ agentToolConfiguration: row[3],
370
+ confirmation: row[4],
371
+ agentToolCreatedAt: row[5],
372
+ agentToolUpdatedAt: row[6],
373
+ id: row[7],
374
+ kind: row[8],
375
+ slug: row[9],
376
+ name: row[10],
377
+ description: row[11],
378
+ inputSchema: row[12],
379
+ outputSchema: row[13],
380
+ toolConfiguration: row[14],
381
+ toolCreatedAt: row[15],
382
+ toolUpdatedAt: row[16]
383
+ };
384
+ }
385
+ exports.detachAgentToolQuery = `-- name: DetachAgentTool :exec
386
+ DELETE FROM weave.agent_tool
387
+ WHERE organization_id = $1
388
+ AND agent_id = $2
389
+ AND tool_id = $3`;
390
+ async function detachAgentTool(client, args) {
391
+ await client.query({
392
+ text: exports.detachAgentToolQuery,
393
+ values: [args.organizationId, args.agentId, args.toolId],
394
+ rowMode: "array"
395
+ });
396
+ }
397
+ exports.deleteAgentToolsForAgentQuery = `-- name: DeleteAgentToolsForAgent :exec
398
+ DELETE FROM weave.agent_tool
399
+ WHERE organization_id = $1
400
+ AND agent_id = $2`;
401
+ async function deleteAgentToolsForAgent(client, args) {
402
+ await client.query({
403
+ text: exports.deleteAgentToolsForAgentQuery,
404
+ values: [args.organizationId, args.agentId],
405
+ rowMode: "array"
406
+ });
407
+ }