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.
- package/dist/google/protobuf/duration.pb.d.ts +99 -0
- package/dist/google/protobuf/duration.pb.js +93 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/weave/authz/v1/index.d.ts +1 -0
- package/dist/weave/authz/v1/index.js +38 -0
- package/dist/weave/authz/v1/options.pb.d.ts +52 -0
- package/dist/weave/authz/v1/options.pb.js +403 -0
- package/dist/weave/filter/v1/index.d.ts +1 -0
- package/dist/weave/filter/v1/index.js +38 -0
- package/dist/{weaveapi/atc/v1/message.pb.d.ts → weave/filter/v1/options.pb.d.ts} +33 -21
- package/dist/weave/filter/v1/options.pb.js +417 -0
- package/dist/weave/index.d.ts +2 -0
- package/dist/weave/index.js +39 -0
- package/dist/weaveapi/agent/v1/agent.pb.d.ts +137 -188
- package/dist/weaveapi/agent/v1/agent.pb.js +891 -2151
- package/dist/weaveapi/agent/v1/index.d.ts +1 -1
- package/dist/weaveapi/agent/v1/index.js +2 -2
- package/dist/weaveapi/agent/v1/run.pb.d.ts +289 -0
- package/dist/weaveapi/agent/v1/run.pb.js +2763 -0
- package/dist/weaveapi/auth/v1/auth.pb.d.ts +67 -14
- package/dist/weaveapi/auth/v1/auth.pb.js +829 -89
- package/dist/weaveapi/auth/v1/index.d.ts +4 -1
- package/dist/weaveapi/auth/v1/index.js +5 -2
- package/dist/weaveapi/auth/v1/{service.pb.d.ts → organization_admin.pb.d.ts} +39 -530
- package/dist/weaveapi/auth/v1/{service.pb.js → organization_admin.pb.js} +2978 -5812
- package/dist/weaveapi/auth/v1/personal_access_token.pb.d.ts +114 -0
- package/dist/weaveapi/auth/v1/personal_access_token.pb.js +750 -0
- package/dist/weaveapi/auth/v1/profile.pb.d.ts +161 -0
- package/dist/weaveapi/auth/v1/profile.pb.js +1007 -0
- package/dist/weaveapi/auth/v1/session.pb.d.ts +460 -0
- package/dist/weaveapi/auth/v1/session.pb.js +3544 -0
- package/dist/weaveapi/chat/v1/chat.pb.d.ts +377 -149
- package/dist/weaveapi/chat/v1/chat.pb.js +3492 -1614
- package/dist/weaveapi/chat/v1/index.d.ts +0 -1
- package/dist/weaveapi/chat/v1/index.js +1 -2
- package/dist/weaveapi/consolidation/v1/consolidation.pb.d.ts +95 -0
- package/dist/weaveapi/consolidation/v1/consolidation.pb.js +770 -1
- package/dist/weaveapi/consolidation/v1/index.d.ts +0 -1
- package/dist/weaveapi/consolidation/v1/index.js +1 -2
- package/dist/weaveapi/content/v1/content.pb.d.ts +63 -0
- package/dist/weaveapi/content/v1/content.pb.js +470 -0
- package/dist/weaveapi/content/v1/index.d.ts +1 -0
- package/dist/weaveapi/content/v1/index.js +38 -0
- package/dist/weaveapi/gateway/v1/gateway.pb.d.ts +247 -523
- package/dist/weaveapi/gateway/v1/gateway.pb.js +1648 -5783
- package/dist/weaveapi/gateway/v1/index.d.ts +0 -1
- package/dist/weaveapi/gateway/v1/index.js +1 -2
- package/dist/weaveapi/index.d.ts +5 -5
- package/dist/weaveapi/index.js +6 -6
- package/dist/weaveapi/inference/v1/generate.pb.d.ts +120 -0
- package/dist/weaveapi/inference/v1/generate.pb.js +1159 -0
- package/dist/weaveapi/inference/v1/index.d.ts +4 -0
- package/dist/weaveapi/{provider → inference}/v1/index.js +4 -2
- package/dist/weaveapi/{model → inference}/v1/model.pb.d.ts +52 -15
- package/dist/weaveapi/{model → inference}/v1/model.pb.js +529 -116
- package/dist/weaveapi/{model/v1/service.pb.d.ts → inference/v1/model_route.pb.d.ts} +182 -110
- package/dist/weaveapi/{model/v1/service.pb.js → inference/v1/model_route.pb.js} +2197 -1061
- package/dist/weaveapi/inference/v1/provider.pb.d.ts +264 -0
- package/dist/weaveapi/inference/v1/provider.pb.js +2590 -0
- package/dist/weaveapi/ingestion/v1/index.d.ts +0 -2
- package/dist/weaveapi/ingestion/v1/index.js +1 -3
- package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +543 -0
- package/dist/weaveapi/ingestion/v1/ingestion.pb.js +5550 -16
- package/dist/weaveapi/initialization/v1/index.d.ts +1 -0
- package/dist/weaveapi/initialization/v1/index.js +38 -0
- package/dist/weaveapi/initialization/v1/initialization.pb.d.ts +99 -0
- package/dist/weaveapi/initialization/v1/initialization.pb.js +510 -0
- package/dist/weaveapi/organization/v1/index.d.ts +0 -1
- package/dist/weaveapi/organization/v1/index.js +1 -2
- package/dist/weaveapi/organization/v1/organization.pb.d.ts +241 -0
- package/dist/weaveapi/organization/v1/organization.pb.js +1838 -1
- package/dist/weaveapi/reporting/index.d.ts +1 -0
- package/dist/weaveapi/reporting/index.js +38 -0
- package/dist/weaveapi/{task → reporting}/v1/index.d.ts +1 -1
- package/dist/weaveapi/{model → reporting}/v1/index.js +2 -2
- package/dist/weaveapi/reporting/v1/service.pb.d.ts +38 -0
- package/dist/weaveapi/reporting/v1/service.pb.js +167 -0
- package/dist/weaveapi/reporting/v1/usage.pb.d.ts +150 -0
- package/dist/weaveapi/reporting/v1/usage.pb.js +1837 -0
- package/dist/weaveapi/retrieval/v1/index.d.ts +0 -1
- package/dist/weaveapi/retrieval/v1/index.js +1 -2
- package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +96 -2
- package/dist/weaveapi/retrieval/v1/retrieval.pb.js +690 -10
- package/dist/weaveapi/tool/index.d.ts +1 -0
- package/dist/weaveapi/tool/index.js +38 -0
- package/dist/weaveapi/tool/v1/index.d.ts +1 -0
- package/dist/weaveapi/tool/v1/index.js +38 -0
- package/dist/weaveapi/tool/v1/tool.pb.d.ts +370 -0
- package/dist/weaveapi/tool/v1/tool.pb.js +2717 -0
- package/dist/weaveapi/workflow/v1/index.d.ts +1 -1
- package/dist/weaveapi/workflow/v1/index.js +2 -2
- package/dist/weaveapi/workflow/v1/run.pb.d.ts +244 -0
- package/dist/weaveapi/workflow/v1/run.pb.js +2084 -0
- package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +122 -275
- package/dist/weaveapi/workflow/v1/workflow.pb.js +790 -3261
- package/dist/weavesql/weavedb/agent_sql.d.ts +173 -477
- package/dist/weavesql/weavedb/agent_sql.js +281 -758
- package/dist/weavesql/weavedb/authorization_outbox_sql.d.ts +261 -0
- package/dist/weavesql/weavedb/authorization_outbox_sql.js +445 -0
- package/dist/weavesql/weavedb/chat_sql.d.ts +103 -345
- package/dist/weavesql/weavedb/chat_sql.js +312 -597
- package/dist/weavesql/weavedb/document_consolidation_sql.d.ts +217 -0
- package/dist/weavesql/weavedb/document_consolidation_sql.js +486 -0
- package/dist/weavesql/weavedb/document_ingestion_sql.d.ts +1433 -0
- package/dist/weavesql/weavedb/document_ingestion_sql.js +3488 -0
- package/dist/weavesql/weavedb/document_retrieval_sql.d.ts +314 -0
- package/dist/weavesql/weavedb/document_retrieval_sql.js +965 -0
- package/dist/weavesql/weavedb/document_table_sql.d.ts +6 -6
- package/dist/weavesql/weavedb/document_table_sql.js +12 -12
- package/dist/weavesql/weavedb/identity_sql.d.ts +1014 -0
- package/dist/weavesql/weavedb/identity_sql.js +1811 -0
- package/dist/weavesql/weavedb/inference_model_route_sql.d.ts +161 -0
- package/dist/weavesql/weavedb/inference_model_route_sql.js +408 -0
- package/dist/weavesql/weavedb/inference_provider_sql.d.ts +125 -0
- package/dist/weavesql/weavedb/inference_provider_sql.js +228 -0
- package/dist/weavesql/weavedb/initialization_sql.d.ts +15 -0
- package/dist/weavesql/weavedb/initialization_sql.js +33 -0
- package/dist/weavesql/weavedb/model_catalog_sql.d.ts +6 -6
- package/dist/weavesql/weavedb/model_catalog_sql.js +6 -6
- package/dist/weavesql/weavedb/organization_sql.d.ts +22 -102
- package/dist/weavesql/weavedb/organization_sql.js +54 -262
- package/dist/weavesql/weavedb/tool_sql.d.ts +209 -0
- package/dist/weavesql/weavedb/tool_sql.js +407 -0
- package/dist/weavesql/weavedb/usage_sql.d.ts +356 -0
- package/dist/weavesql/weavedb/usage_sql.js +568 -0
- package/dist/weavesql/weavedb/workflow_sql.d.ts +159 -546
- package/dist/weavesql/weavedb/workflow_sql.js +281 -909
- package/package.json +1 -1
- package/dist/weaveapi/agent/v1/service.pb.d.ts +0 -397
- package/dist/weaveapi/agent/v1/service.pb.js +0 -3152
- package/dist/weaveapi/atc/v1/event.pb.d.ts +0 -134
- package/dist/weaveapi/atc/v1/event.pb.js +0 -1124
- package/dist/weaveapi/atc/v1/index.d.ts +0 -5
- package/dist/weaveapi/atc/v1/index.js +0 -42
- package/dist/weaveapi/atc/v1/message.pb.js +0 -287
- package/dist/weaveapi/atc/v1/process.pb.d.ts +0 -91
- package/dist/weaveapi/atc/v1/process.pb.js +0 -658
- package/dist/weaveapi/atc/v1/run.pb.d.ts +0 -71
- package/dist/weaveapi/atc/v1/run.pb.js +0 -525
- package/dist/weaveapi/atc/v1/service.pb.d.ts +0 -472
- package/dist/weaveapi/atc/v1/service.pb.js +0 -3093
- package/dist/weaveapi/chat/v1/service.pb.d.ts +0 -345
- package/dist/weaveapi/chat/v1/service.pb.js +0 -2545
- package/dist/weaveapi/consolidation/v1/service.pb.d.ts +0 -93
- package/dist/weaveapi/consolidation/v1/service.pb.js +0 -427
- package/dist/weaveapi/gateway/v1/service.pb.d.ts +0 -235
- package/dist/weaveapi/gateway/v1/service.pb.js +0 -651
- package/dist/weaveapi/ingestion/v1/service.pb.d.ts +0 -420
- package/dist/weaveapi/ingestion/v1/service.pb.js +0 -2311
- package/dist/weaveapi/ingestion/v1/table.pb.d.ts +0 -121
- package/dist/weaveapi/ingestion/v1/table.pb.js +0 -1478
- package/dist/weaveapi/model/v1/index.d.ts +0 -2
- package/dist/weaveapi/organization/v1/service.pb.d.ts +0 -261
- package/dist/weaveapi/organization/v1/service.pb.js +0 -1561
- package/dist/weaveapi/project/v1/index.d.ts +0 -2
- package/dist/weaveapi/project/v1/index.js +0 -39
- package/dist/weaveapi/project/v1/project.pb.d.ts +0 -105
- package/dist/weaveapi/project/v1/project.pb.js +0 -1004
- package/dist/weaveapi/project/v1/service.pb.d.ts +0 -247
- package/dist/weaveapi/project/v1/service.pb.js +0 -1994
- package/dist/weaveapi/provider/v1/index.d.ts +0 -2
- package/dist/weaveapi/provider/v1/provider.pb.d.ts +0 -137
- package/dist/weaveapi/provider/v1/provider.pb.js +0 -1000
- package/dist/weaveapi/provider/v1/service.pb.d.ts +0 -223
- package/dist/weaveapi/provider/v1/service.pb.js +0 -1888
- package/dist/weaveapi/retrieval/v1/service.pb.d.ts +0 -93
- package/dist/weaveapi/retrieval/v1/service.pb.js +0 -385
- package/dist/weaveapi/task/v1/index.js +0 -39
- package/dist/weaveapi/task/v1/service.pb.d.ts +0 -172
- package/dist/weaveapi/task/v1/service.pb.js +0 -1436
- package/dist/weaveapi/task/v1/task.pb.d.ts +0 -85
- package/dist/weaveapi/task/v1/task.pb.js +0 -802
- package/dist/weaveapi/workflow/v1/service.pb.d.ts +0 -392
- package/dist/weaveapi/workflow/v1/service.pb.js +0 -3146
- /package/dist/{weaveapi/atc → weave/authz}/index.d.ts +0 -0
- /package/dist/{weaveapi/atc → weave/authz}/index.js +0 -0
- /package/dist/{weaveapi/model → weave/filter}/index.d.ts +0 -0
- /package/dist/{weaveapi/model → weave/filter}/index.js +0 -0
- /package/dist/weaveapi/{project → content}/index.d.ts +0 -0
- /package/dist/weaveapi/{project → content}/index.js +0 -0
- /package/dist/weaveapi/{provider → inference}/index.d.ts +0 -0
- /package/dist/weaveapi/{provider → inference}/index.js +0 -0
- /package/dist/weaveapi/{task → initialization}/index.d.ts +0 -0
- /package/dist/weaveapi/{task → initialization}/index.js +0 -0
|
@@ -2,374 +2,126 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const createChatSessionQuery = "-- name: CreateChatSession :one\
|
|
5
|
+
export declare const createChatSessionQuery = "-- name: CreateChatSession :one\nWITH resolved_agent AS (\n SELECT COALESCE($4::uuid, o.default_chat_agent_id) AS root_agent_id\n FROM weave.organization o\n WHERE o.id = $1\n),\nvalid_agent AS (\n SELECT r.root_agent_id\n FROM resolved_agent r\n JOIN weave.agent a\n ON a.organization_id = $1\n AND a.id = r.root_agent_id\n)\nINSERT INTO weave.chat_session (\n organization_id,\n created_by_user_id,\n root_agent_id,\n title\n) SELECT\n $1,\n $2,\n valid_agent.root_agent_id,\n COALESCE($3::text, '')\nFROM valid_agent\nRETURNING id, organization_id, created_by_user_id, root_agent_id, title, last_message_at, created_at, updated_at";
|
|
6
6
|
export interface CreateChatSessionArgs {
|
|
7
|
-
id: string;
|
|
8
7
|
organizationId: string;
|
|
9
8
|
createdByUserId: string;
|
|
10
|
-
title: string;
|
|
11
|
-
|
|
12
|
-
providerConfigurationId: string;
|
|
9
|
+
title: string | null;
|
|
10
|
+
rootAgentId: string | null;
|
|
13
11
|
}
|
|
14
12
|
export interface CreateChatSessionRow {
|
|
15
13
|
id: string;
|
|
16
14
|
organizationId: string;
|
|
17
15
|
createdByUserId: string;
|
|
16
|
+
rootAgentId: string;
|
|
18
17
|
title: string;
|
|
19
|
-
|
|
20
|
-
providerConfigurationId: string;
|
|
18
|
+
lastMessageAt: Date;
|
|
21
19
|
createdAt: Date;
|
|
22
20
|
updatedAt: Date;
|
|
23
|
-
lastMessageAt: Date;
|
|
24
|
-
deletedAt: Date | null;
|
|
25
21
|
}
|
|
26
22
|
export declare function createChatSession(client: Client, args: CreateChatSessionArgs): Promise<CreateChatSessionRow | null>;
|
|
27
|
-
export declare const getChatSessionQuery = "-- name: GetChatSession :one\nSELECT id, organization_id, created_by_user_id,
|
|
23
|
+
export declare const getChatSessionQuery = "-- name: GetChatSession :one\nSELECT id, organization_id, created_by_user_id, root_agent_id, title, last_message_at, created_at, updated_at\nFROM weave.chat_session\nWHERE organization_id = $1\n AND id = $2\n AND created_by_user_id = $3";
|
|
28
24
|
export interface GetChatSessionArgs {
|
|
29
|
-
|
|
25
|
+
organizationId: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
createdByUserId: string;
|
|
30
28
|
}
|
|
31
29
|
export interface GetChatSessionRow {
|
|
32
30
|
id: string;
|
|
33
31
|
organizationId: string;
|
|
34
32
|
createdByUserId: string;
|
|
33
|
+
rootAgentId: string;
|
|
35
34
|
title: string;
|
|
36
|
-
|
|
37
|
-
providerConfigurationId: string;
|
|
35
|
+
lastMessageAt: Date;
|
|
38
36
|
createdAt: Date;
|
|
39
37
|
updatedAt: Date;
|
|
40
|
-
lastMessageAt: Date;
|
|
41
|
-
deletedAt: Date | null;
|
|
42
38
|
}
|
|
43
39
|
export declare function getChatSession(client: Client, args: GetChatSessionArgs): Promise<GetChatSessionRow | null>;
|
|
44
|
-
export declare const
|
|
45
|
-
export interface
|
|
40
|
+
export declare const listChatSessionsByUserQuery = "-- name: ListChatSessionsByUser :many\nSELECT id, organization_id, created_by_user_id, root_agent_id, title, last_message_at, created_at, updated_at\nFROM weave.chat_session\nWHERE organization_id = $1\n AND created_by_user_id = $2\nORDER BY last_message_at DESC, created_at DESC\nLIMIT $4::integer\nOFFSET $3::integer";
|
|
41
|
+
export interface ListChatSessionsByUserArgs {
|
|
46
42
|
organizationId: string;
|
|
47
43
|
createdByUserId: string;
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
offsetCount: number;
|
|
45
|
+
limitCount: number;
|
|
50
46
|
}
|
|
51
|
-
export interface
|
|
47
|
+
export interface ListChatSessionsByUserRow {
|
|
52
48
|
id: string;
|
|
53
49
|
organizationId: string;
|
|
54
50
|
createdByUserId: string;
|
|
51
|
+
rootAgentId: string;
|
|
55
52
|
title: string;
|
|
56
|
-
modelId: string;
|
|
57
|
-
providerConfigurationId: string;
|
|
58
|
-
createdAt: Date;
|
|
59
|
-
updatedAt: Date;
|
|
60
53
|
lastMessageAt: Date;
|
|
61
|
-
deletedAt: Date | null;
|
|
62
|
-
}
|
|
63
|
-
export declare function listChatSessionsForUser(client: Client, args: ListChatSessionsForUserArgs): Promise<ListChatSessionsForUserRow[]>;
|
|
64
|
-
export declare const listChatSessionsForUserByProjectQuery = "-- name: ListChatSessionsForUserByProject :many\nSELECT s.id, s.organization_id, s.created_by_user_id, s.title, s.model_id, s.provider_configuration_id, s.created_at, s.updated_at, s.last_message_at, s.deleted_at FROM weave.chat_sessions s\nJOIN weave.chat_session_projects p ON p.session_id = s.id\nWHERE s.organization_id = $1\n AND s.created_by_user_id = $2\n AND p.project_id = $3\n AND s.deleted_at IS NULL\nORDER BY s.last_message_at DESC\nLIMIT $4 OFFSET $5";
|
|
65
|
-
export interface ListChatSessionsForUserByProjectArgs {
|
|
66
|
-
organizationId: string;
|
|
67
|
-
createdByUserId: string;
|
|
68
|
-
projectId: string;
|
|
69
|
-
limit: string;
|
|
70
|
-
offset: string;
|
|
71
|
-
}
|
|
72
|
-
export interface ListChatSessionsForUserByProjectRow {
|
|
73
|
-
id: string;
|
|
74
|
-
organizationId: string;
|
|
75
|
-
createdByUserId: string;
|
|
76
|
-
title: string;
|
|
77
|
-
modelId: string;
|
|
78
|
-
providerConfigurationId: string;
|
|
79
54
|
createdAt: Date;
|
|
80
55
|
updatedAt: Date;
|
|
81
|
-
lastMessageAt: Date;
|
|
82
|
-
deletedAt: Date | null;
|
|
83
|
-
}
|
|
84
|
-
export declare function listChatSessionsForUserByProject(client: Client, args: ListChatSessionsForUserByProjectArgs): Promise<ListChatSessionsForUserByProjectRow[]>;
|
|
85
|
-
export declare const updateChatSessionModelQuery = "-- name: UpdateChatSessionModel :one\nUPDATE weave.chat_sessions\nSET model_id = $2,\n provider_configuration_id = $3,\n updated_at = now()\nWHERE id = $1\nRETURNING id, organization_id, created_by_user_id, title, model_id, provider_configuration_id, created_at, updated_at, last_message_at, deleted_at";
|
|
86
|
-
export interface UpdateChatSessionModelArgs {
|
|
87
|
-
id: string;
|
|
88
|
-
modelId: string;
|
|
89
|
-
providerConfigurationId: string;
|
|
90
56
|
}
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
organizationId: string;
|
|
94
|
-
createdByUserId: string;
|
|
95
|
-
title: string;
|
|
96
|
-
modelId: string;
|
|
97
|
-
providerConfigurationId: string;
|
|
98
|
-
createdAt: Date;
|
|
99
|
-
updatedAt: Date;
|
|
100
|
-
lastMessageAt: Date;
|
|
101
|
-
deletedAt: Date | null;
|
|
102
|
-
}
|
|
103
|
-
export declare function updateChatSessionModel(client: Client, args: UpdateChatSessionModelArgs): Promise<UpdateChatSessionModelRow | null>;
|
|
104
|
-
export declare const updateChatSessionTitleQuery = "-- name: UpdateChatSessionTitle :one\nUPDATE weave.chat_sessions\nSET title = $2, updated_at = now()\nWHERE id = $1\nRETURNING id, organization_id, created_by_user_id, title, model_id, provider_configuration_id, created_at, updated_at, last_message_at, deleted_at";
|
|
57
|
+
export declare function listChatSessionsByUser(client: Client, args: ListChatSessionsByUserArgs): Promise<ListChatSessionsByUserRow[]>;
|
|
58
|
+
export declare const updateChatSessionTitleQuery = "-- name: UpdateChatSessionTitle :one\nUPDATE weave.chat_session\nSET title = $1\nWHERE organization_id = $2\n AND id = $3\n AND created_by_user_id = $4\nRETURNING id, organization_id, created_by_user_id, root_agent_id, title, last_message_at, created_at, updated_at";
|
|
105
59
|
export interface UpdateChatSessionTitleArgs {
|
|
106
|
-
id: string;
|
|
107
60
|
title: string;
|
|
61
|
+
organizationId: string;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
createdByUserId: string;
|
|
108
64
|
}
|
|
109
65
|
export interface UpdateChatSessionTitleRow {
|
|
110
66
|
id: string;
|
|
111
67
|
organizationId: string;
|
|
112
68
|
createdByUserId: string;
|
|
69
|
+
rootAgentId: string;
|
|
113
70
|
title: string;
|
|
114
|
-
|
|
115
|
-
providerConfigurationId: string;
|
|
71
|
+
lastMessageAt: Date;
|
|
116
72
|
createdAt: Date;
|
|
117
73
|
updatedAt: Date;
|
|
118
|
-
lastMessageAt: Date;
|
|
119
|
-
deletedAt: Date | null;
|
|
120
74
|
}
|
|
121
75
|
export declare function updateChatSessionTitle(client: Client, args: UpdateChatSessionTitleArgs): Promise<UpdateChatSessionTitleRow | null>;
|
|
122
|
-
export declare const
|
|
123
|
-
export interface
|
|
124
|
-
|
|
125
|
-
lastMessageAt: Date;
|
|
126
|
-
}
|
|
127
|
-
export declare function touchChatSessionLastMessage(client: Client, args: TouchChatSessionLastMessageArgs): Promise<void>;
|
|
128
|
-
export declare const softDeleteChatSessionQuery = "-- name: SoftDeleteChatSession :exec\nUPDATE weave.chat_sessions\nSET deleted_at = now(), updated_at = now()\nWHERE id = $1";
|
|
129
|
-
export interface SoftDeleteChatSessionArgs {
|
|
130
|
-
id: string;
|
|
131
|
-
}
|
|
132
|
-
export declare function softDeleteChatSession(client: Client, args: SoftDeleteChatSessionArgs): Promise<void>;
|
|
133
|
-
export declare const attachProjectToChatSessionQuery = "-- name: AttachProjectToChatSession :exec\nINSERT INTO weave.chat_session_projects (\n session_id, project_id, attached_by_user_id\n) VALUES ($1, $2, $3)\nON CONFLICT DO NOTHING";
|
|
134
|
-
export interface AttachProjectToChatSessionArgs {
|
|
135
|
-
sessionId: string;
|
|
136
|
-
projectId: string;
|
|
137
|
-
attachedByUserId: string;
|
|
138
|
-
}
|
|
139
|
-
export declare function attachProjectToChatSession(client: Client, args: AttachProjectToChatSessionArgs): Promise<void>;
|
|
140
|
-
export declare const detachProjectFromChatSessionQuery = "-- name: DetachProjectFromChatSession :exec\nDELETE FROM weave.chat_session_projects\nWHERE session_id = $1 AND project_id = $2";
|
|
141
|
-
export interface DetachProjectFromChatSessionArgs {
|
|
142
|
-
sessionId: string;
|
|
143
|
-
projectId: string;
|
|
144
|
-
}
|
|
145
|
-
export declare function detachProjectFromChatSession(client: Client, args: DetachProjectFromChatSessionArgs): Promise<void>;
|
|
146
|
-
export declare const listProjectsForChatSessionQuery = "-- name: ListProjectsForChatSession :many\nSELECT project_id FROM weave.chat_session_projects\nWHERE session_id = $1";
|
|
147
|
-
export interface ListProjectsForChatSessionArgs {
|
|
148
|
-
sessionId: string;
|
|
149
|
-
}
|
|
150
|
-
export interface ListProjectsForChatSessionRow {
|
|
151
|
-
projectId: string;
|
|
152
|
-
}
|
|
153
|
-
export declare function listProjectsForChatSession(client: Client, args: ListProjectsForChatSessionArgs): Promise<ListProjectsForChatSessionRow[]>;
|
|
154
|
-
export declare const insertChatMessageQuery = "-- name: InsertChatMessage :one\nINSERT INTO weave.chat_messages (\n id, session_id, role, content,\n reasoning_content,\n parent_message_id, tool_call_id, tool_call_state,\n model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types,\n token_usage, stream_state\n) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13\n)\nRETURNING id, session_id, role, content, parent_message_id, tool_call_id, tool_call_state, model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types, token_usage, stream_state, created_at, completed_at, reasoning_content";
|
|
155
|
-
export interface InsertChatMessageArgs {
|
|
156
|
-
id: string;
|
|
157
|
-
sessionId: string;
|
|
158
|
-
role: string;
|
|
159
|
-
content: string;
|
|
160
|
-
reasoningContent: string;
|
|
161
|
-
parentMessageId: string | null;
|
|
162
|
-
toolCallId: string | null;
|
|
163
|
-
toolCallState: string;
|
|
164
|
-
modelId: string | null;
|
|
165
|
-
ephemeralAttachmentCount: number;
|
|
166
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
167
|
-
tokenUsage: any | null;
|
|
168
|
-
streamState: string;
|
|
169
|
-
}
|
|
170
|
-
export interface InsertChatMessageRow {
|
|
171
|
-
id: string;
|
|
76
|
+
export declare const createChatMessageQuery = "-- name: CreateChatMessage :one\nWITH created_message AS (\n INSERT INTO weave.chat_message (\n organization_id,\n session_id,\n agent_run_id,\n role,\n parts\n )\n SELECT\n $1,\n $2,\n $3::uuid,\n $4,\n COALESCE($5::jsonb, '[]'::jsonb)\n WHERE EXISTS (\n SELECT 1\n FROM weave.chat_session s\n WHERE s.organization_id = $1\n AND s.id = $2\n AND s.created_by_user_id = $6\n )\n RETURNING id, organization_id, session_id, agent_run_id, role, parts, created_at\n),\ntouched_session AS (\n UPDATE weave.chat_session\n SET last_message_at = created_message.created_at\n FROM created_message\n WHERE weave.chat_session.organization_id = created_message.organization_id\n AND weave.chat_session.id = created_message.session_id\n RETURNING weave.chat_session.id\n)\nSELECT id, organization_id, session_id, agent_run_id, role, parts, created_at\nFROM created_message";
|
|
77
|
+
export interface CreateChatMessageArgs {
|
|
78
|
+
organizationId: string;
|
|
172
79
|
sessionId: string;
|
|
80
|
+
agentRunId: string | null;
|
|
173
81
|
role: string;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
toolCallId: string | null;
|
|
177
|
-
toolCallState: string;
|
|
178
|
-
modelId: string | null;
|
|
179
|
-
ephemeralAttachmentCount: number;
|
|
180
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
181
|
-
tokenUsage: any | null;
|
|
182
|
-
streamState: string;
|
|
183
|
-
createdAt: Date;
|
|
184
|
-
completedAt: Date | null;
|
|
185
|
-
reasoningContent: string;
|
|
186
|
-
}
|
|
187
|
-
export declare function insertChatMessage(client: Client, args: InsertChatMessageArgs): Promise<InsertChatMessageRow | null>;
|
|
188
|
-
export declare const getChatMessageQuery = "-- name: GetChatMessage :one\nSELECT id, session_id, role, content, parent_message_id, tool_call_id, tool_call_state, model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types, token_usage, stream_state, created_at, completed_at, reasoning_content FROM weave.chat_messages WHERE id = $1";
|
|
189
|
-
export interface GetChatMessageArgs {
|
|
190
|
-
id: string;
|
|
82
|
+
parts: any | null;
|
|
83
|
+
createdByUserId: string;
|
|
191
84
|
}
|
|
192
|
-
export interface
|
|
85
|
+
export interface CreateChatMessageRow {
|
|
193
86
|
id: string;
|
|
87
|
+
organizationId: string;
|
|
194
88
|
sessionId: string;
|
|
89
|
+
agentRunId: string | null;
|
|
195
90
|
role: string;
|
|
196
|
-
|
|
197
|
-
parentMessageId: string | null;
|
|
198
|
-
toolCallId: string | null;
|
|
199
|
-
toolCallState: string;
|
|
200
|
-
modelId: string | null;
|
|
201
|
-
ephemeralAttachmentCount: number;
|
|
202
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
203
|
-
tokenUsage: any | null;
|
|
204
|
-
streamState: string;
|
|
91
|
+
parts: any;
|
|
205
92
|
createdAt: Date;
|
|
206
|
-
completedAt: Date | null;
|
|
207
|
-
reasoningContent: string;
|
|
208
|
-
}
|
|
209
|
-
export declare function getChatMessage(client: Client, args: GetChatMessageArgs): Promise<GetChatMessageRow | null>;
|
|
210
|
-
export declare const listChatMessagesForSessionQuery = "-- name: ListChatMessagesForSession :many\nSELECT id, session_id, role, content, parent_message_id, tool_call_id, tool_call_state, model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types, token_usage, stream_state, created_at, completed_at, reasoning_content FROM weave.chat_messages\nWHERE session_id = $1\nORDER BY created_at";
|
|
211
|
-
export interface ListChatMessagesForSessionArgs {
|
|
212
|
-
sessionId: string;
|
|
213
93
|
}
|
|
214
|
-
export
|
|
215
|
-
|
|
94
|
+
export declare function createChatMessage(client: Client, args: CreateChatMessageArgs): Promise<CreateChatMessageRow | null>;
|
|
95
|
+
export declare const listChatMessagesQuery = "-- name: ListChatMessages :many\nSELECT m.id, m.organization_id, m.session_id, m.agent_run_id, m.role, m.parts, m.created_at\nFROM weave.chat_message m\n JOIN weave.chat_session s\n ON s.organization_id = m.organization_id\n AND s.id = m.session_id\nWHERE m.organization_id = $1\n AND m.session_id = $2\n AND s.created_by_user_id = $3\nORDER BY m.created_at ASC, m.id ASC\nLIMIT $5::integer\nOFFSET $4::integer";
|
|
96
|
+
export interface ListChatMessagesArgs {
|
|
97
|
+
organizationId: string;
|
|
216
98
|
sessionId: string;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
toolCallId: string | null;
|
|
221
|
-
toolCallState: string;
|
|
222
|
-
modelId: string | null;
|
|
223
|
-
ephemeralAttachmentCount: number;
|
|
224
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
225
|
-
tokenUsage: any | null;
|
|
226
|
-
streamState: string;
|
|
227
|
-
createdAt: Date;
|
|
228
|
-
completedAt: Date | null;
|
|
229
|
-
reasoningContent: string;
|
|
230
|
-
}
|
|
231
|
-
export declare function listChatMessagesForSession(client: Client, args: ListChatMessagesForSessionArgs): Promise<ListChatMessagesForSessionRow[]>;
|
|
232
|
-
export declare const updateChatMessageToolCallStateQuery = "-- name: UpdateChatMessageToolCallState :one\nUPDATE weave.chat_messages\nSET tool_call_state = $2\nWHERE id = $1\nRETURNING id, session_id, role, content, parent_message_id, tool_call_id, tool_call_state, model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types, token_usage, stream_state, created_at, completed_at, reasoning_content";
|
|
233
|
-
export interface UpdateChatMessageToolCallStateArgs {
|
|
234
|
-
id: string;
|
|
235
|
-
toolCallState: string;
|
|
99
|
+
createdByUserId: string;
|
|
100
|
+
offsetCount: number;
|
|
101
|
+
limitCount: number;
|
|
236
102
|
}
|
|
237
|
-
export interface
|
|
103
|
+
export interface ListChatMessagesRow {
|
|
238
104
|
id: string;
|
|
105
|
+
organizationId: string;
|
|
239
106
|
sessionId: string;
|
|
107
|
+
agentRunId: string | null;
|
|
240
108
|
role: string;
|
|
241
|
-
|
|
242
|
-
parentMessageId: string | null;
|
|
243
|
-
toolCallId: string | null;
|
|
244
|
-
toolCallState: string;
|
|
245
|
-
modelId: string | null;
|
|
246
|
-
ephemeralAttachmentCount: number;
|
|
247
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
248
|
-
tokenUsage: any | null;
|
|
249
|
-
streamState: string;
|
|
109
|
+
parts: any;
|
|
250
110
|
createdAt: Date;
|
|
251
|
-
completedAt: Date | null;
|
|
252
|
-
reasoningContent: string;
|
|
253
|
-
}
|
|
254
|
-
export declare function updateChatMessageToolCallState(client: Client, args: UpdateChatMessageToolCallStateArgs): Promise<UpdateChatMessageToolCallStateRow | null>;
|
|
255
|
-
export declare const completeChatMessageQuery = "-- name: CompleteChatMessage :one\nUPDATE weave.chat_messages\nSET stream_state = $2,\n content = $3,\n reasoning_content = $4,\n token_usage = $5,\n completed_at = now()\nWHERE id = $1\nRETURNING id, session_id, role, content, parent_message_id, tool_call_id, tool_call_state, model_id, ephemeral_attachment_count, ephemeral_attachment_mime_types, token_usage, stream_state, created_at, completed_at, reasoning_content";
|
|
256
|
-
export interface CompleteChatMessageArgs {
|
|
257
|
-
id: string;
|
|
258
|
-
streamState: string;
|
|
259
|
-
content: string;
|
|
260
|
-
reasoningContent: string;
|
|
261
|
-
tokenUsage: any | null;
|
|
262
111
|
}
|
|
263
|
-
export
|
|
264
|
-
id
|
|
265
|
-
sessionId: string;
|
|
266
|
-
role: string;
|
|
267
|
-
content: string;
|
|
268
|
-
parentMessageId: string | null;
|
|
269
|
-
toolCallId: string | null;
|
|
270
|
-
toolCallState: string;
|
|
271
|
-
modelId: string | null;
|
|
272
|
-
ephemeralAttachmentCount: number;
|
|
273
|
-
ephemeralAttachmentMimeTypes: string[];
|
|
274
|
-
tokenUsage: any | null;
|
|
275
|
-
streamState: string;
|
|
276
|
-
createdAt: Date;
|
|
277
|
-
completedAt: Date | null;
|
|
278
|
-
reasoningContent: string;
|
|
279
|
-
}
|
|
280
|
-
export declare function completeChatMessage(client: Client, args: CompleteChatMessageArgs): Promise<CompleteChatMessageRow | null>;
|
|
281
|
-
export declare const createOrganizationApprovedModelQuery = "-- name: CreateOrganizationApprovedModel :one\nINSERT INTO weave.organization_approved_models (\n id, organization_id, provider_configuration_id, model_id, approved_by_user_id\n) VALUES (\n $1, $2, $3, $4, $5\n)\nRETURNING id, organization_id, provider_configuration_id, model_id, approved_by_user_id, approved_at";
|
|
282
|
-
export interface CreateOrganizationApprovedModelArgs {
|
|
283
|
-
id: string;
|
|
284
|
-
organizationId: string;
|
|
285
|
-
providerConfigurationId: string;
|
|
286
|
-
modelId: string;
|
|
287
|
-
approvedByUserId: string;
|
|
288
|
-
}
|
|
289
|
-
export interface CreateOrganizationApprovedModelRow {
|
|
290
|
-
id: string;
|
|
291
|
-
organizationId: string;
|
|
292
|
-
providerConfigurationId: string;
|
|
293
|
-
modelId: string;
|
|
294
|
-
approvedByUserId: string;
|
|
295
|
-
approvedAt: Date;
|
|
296
|
-
}
|
|
297
|
-
export declare function createOrganizationApprovedModel(client: Client, args: CreateOrganizationApprovedModelArgs): Promise<CreateOrganizationApprovedModelRow | null>;
|
|
298
|
-
export declare const deleteOrganizationApprovedModelQuery = "-- name: DeleteOrganizationApprovedModel :exec\nDELETE FROM weave.organization_approved_models\nWHERE id = $1 AND organization_id = $2";
|
|
299
|
-
export interface DeleteOrganizationApprovedModelArgs {
|
|
300
|
-
id: string;
|
|
301
|
-
organizationId: string;
|
|
302
|
-
}
|
|
303
|
-
export declare function deleteOrganizationApprovedModel(client: Client, args: DeleteOrganizationApprovedModelArgs): Promise<void>;
|
|
304
|
-
export declare const listOrganizationApprovedModelsQuery = "-- name: ListOrganizationApprovedModels :many\nSELECT id, organization_id, provider_configuration_id, model_id, approved_by_user_id, approved_at FROM weave.organization_approved_models\nWHERE organization_id = $1\nORDER BY approved_at DESC";
|
|
305
|
-
export interface ListOrganizationApprovedModelsArgs {
|
|
306
|
-
organizationId: string;
|
|
307
|
-
}
|
|
308
|
-
export interface ListOrganizationApprovedModelsRow {
|
|
309
|
-
id: string;
|
|
310
|
-
organizationId: string;
|
|
311
|
-
providerConfigurationId: string;
|
|
312
|
-
modelId: string;
|
|
313
|
-
approvedByUserId: string;
|
|
314
|
-
approvedAt: Date;
|
|
315
|
-
}
|
|
316
|
-
export declare function listOrganizationApprovedModels(client: Client, args: ListOrganizationApprovedModelsArgs): Promise<ListOrganizationApprovedModelsRow[]>;
|
|
317
|
-
export declare const getOrganizationApprovedModelQuery = "-- name: GetOrganizationApprovedModel :one\nSELECT id, organization_id, provider_configuration_id, model_id, approved_by_user_id, approved_at FROM weave.organization_approved_models\nWHERE organization_id = $1\n AND provider_configuration_id = $2\n AND model_id = $3";
|
|
318
|
-
export interface GetOrganizationApprovedModelArgs {
|
|
319
|
-
organizationId: string;
|
|
320
|
-
providerConfigurationId: string;
|
|
321
|
-
modelId: string;
|
|
322
|
-
}
|
|
323
|
-
export interface GetOrganizationApprovedModelRow {
|
|
324
|
-
id: string;
|
|
325
|
-
organizationId: string;
|
|
326
|
-
providerConfigurationId: string;
|
|
327
|
-
modelId: string;
|
|
328
|
-
approvedByUserId: string;
|
|
329
|
-
approvedAt: Date;
|
|
330
|
-
}
|
|
331
|
-
export declare function getOrganizationApprovedModel(client: Client, args: GetOrganizationApprovedModelArgs): Promise<GetOrganizationApprovedModelRow | null>;
|
|
332
|
-
export declare const upsertOrganizationChatSettingsQuery = "-- name: UpsertOrganizationChatSettings :one\nINSERT INTO weave.organization_chat_settings (\n organization_id, default_chat_model_id, default_provider_configuration_id\n) VALUES ($1, $2, $3)\nON CONFLICT (organization_id) DO UPDATE\n SET default_chat_model_id = EXCLUDED.default_chat_model_id,\n default_provider_configuration_id = EXCLUDED.default_provider_configuration_id,\n updated_at = now()\nRETURNING organization_id, default_chat_model_id, default_provider_configuration_id, updated_at";
|
|
333
|
-
export interface UpsertOrganizationChatSettingsArgs {
|
|
334
|
-
organizationId: string;
|
|
335
|
-
defaultChatModelId: string | null;
|
|
336
|
-
defaultProviderConfigurationId: string | null;
|
|
337
|
-
}
|
|
338
|
-
export interface UpsertOrganizationChatSettingsRow {
|
|
339
|
-
organizationId: string;
|
|
340
|
-
defaultChatModelId: string | null;
|
|
341
|
-
defaultProviderConfigurationId: string | null;
|
|
342
|
-
updatedAt: Date;
|
|
343
|
-
}
|
|
344
|
-
export declare function upsertOrganizationChatSettings(client: Client, args: UpsertOrganizationChatSettingsArgs): Promise<UpsertOrganizationChatSettingsRow | null>;
|
|
345
|
-
export declare const getOrganizationChatSettingsQuery = "-- name: GetOrganizationChatSettings :one\nSELECT organization_id, default_chat_model_id, default_provider_configuration_id, updated_at FROM weave.organization_chat_settings\nWHERE organization_id = $1";
|
|
346
|
-
export interface GetOrganizationChatSettingsArgs {
|
|
347
|
-
organizationId: string;
|
|
348
|
-
}
|
|
349
|
-
export interface GetOrganizationChatSettingsRow {
|
|
350
|
-
organizationId: string;
|
|
351
|
-
defaultChatModelId: string | null;
|
|
352
|
-
defaultProviderConfigurationId: string | null;
|
|
353
|
-
updatedAt: Date;
|
|
354
|
-
}
|
|
355
|
-
export declare function getOrganizationChatSettings(client: Client, args: GetOrganizationChatSettingsArgs): Promise<GetOrganizationChatSettingsRow | null>;
|
|
356
|
-
export declare const clearOrganizationChatSettingsDefaultIfMatchesQuery = "-- name: ClearOrganizationChatSettingsDefaultIfMatches :exec\nUPDATE weave.organization_chat_settings\nSET default_chat_model_id = NULL,\n default_provider_configuration_id = NULL,\n updated_at = now()\nWHERE organization_id = $1\n AND default_chat_model_id = $2\n AND default_provider_configuration_id = $3";
|
|
357
|
-
export interface ClearOrganizationChatSettingsDefaultIfMatchesArgs {
|
|
358
|
-
organizationId: string;
|
|
359
|
-
defaultChatModelId: string | null;
|
|
360
|
-
defaultProviderConfigurationId: string | null;
|
|
361
|
-
}
|
|
362
|
-
export declare function clearOrganizationChatSettingsDefaultIfMatches(client: Client, args: ClearOrganizationChatSettingsDefaultIfMatchesArgs): Promise<void>;
|
|
363
|
-
export declare const createChatArtifactQuery = "-- name: CreateChatArtifact :one\nINSERT INTO weave.chat_artifacts (\n id, session_id, title, kind, language, current_version\n) VALUES ($1, $2, $3, $4, $5, 1)\nRETURNING id, session_id, title, kind, language, current_version, created_at, updated_at";
|
|
112
|
+
export declare function listChatMessages(client: Client, args: ListChatMessagesArgs): Promise<ListChatMessagesRow[]>;
|
|
113
|
+
export declare const createChatArtifactQuery = "-- name: CreateChatArtifact :one\nWITH visible_session AS (\n SELECT s.id\n FROM weave.chat_session s\n WHERE s.organization_id = $1\n AND s.id = $5\n AND s.created_by_user_id = $6\n)\nINSERT INTO weave.chat_artifact (\n organization_id,\n session_id,\n title,\n kind,\n language\n)\nSELECT\n $1,\n visible_session.id,\n $2,\n $3,\n $4::text\nFROM visible_session\nRETURNING id, organization_id, session_id, title, kind, language, current_version, created_at, updated_at";
|
|
364
114
|
export interface CreateChatArtifactArgs {
|
|
365
|
-
|
|
366
|
-
sessionId: string;
|
|
115
|
+
organizationId: string;
|
|
367
116
|
title: string;
|
|
368
117
|
kind: string;
|
|
369
118
|
language: string | null;
|
|
119
|
+
sessionId: string;
|
|
120
|
+
createdByUserId: string;
|
|
370
121
|
}
|
|
371
122
|
export interface CreateChatArtifactRow {
|
|
372
123
|
id: string;
|
|
124
|
+
organizationId: string;
|
|
373
125
|
sessionId: string;
|
|
374
126
|
title: string;
|
|
375
127
|
kind: string;
|
|
@@ -379,12 +131,16 @@ export interface CreateChatArtifactRow {
|
|
|
379
131
|
updatedAt: Date;
|
|
380
132
|
}
|
|
381
133
|
export declare function createChatArtifact(client: Client, args: CreateChatArtifactArgs): Promise<CreateChatArtifactRow | null>;
|
|
382
|
-
export declare const bumpChatArtifactVersionQuery = "-- name: BumpChatArtifactVersion :one\nUPDATE weave.
|
|
134
|
+
export declare const bumpChatArtifactVersionQuery = "-- name: BumpChatArtifactVersion :one\nWITH visible_session AS (\n SELECT s.id\n FROM weave.chat_session s\n WHERE s.organization_id = $1\n AND s.id = $3\n AND s.created_by_user_id = $4\n)\nUPDATE weave.chat_artifact\nSET current_version = current_version + 1\nFROM visible_session\nWHERE chat_artifact.organization_id = $1\n AND chat_artifact.session_id = visible_session.id\n AND chat_artifact.id = $2\nRETURNING chat_artifact.id, chat_artifact.organization_id, chat_artifact.session_id, chat_artifact.title, chat_artifact.kind, chat_artifact.language, chat_artifact.current_version, chat_artifact.created_at, chat_artifact.updated_at";
|
|
383
135
|
export interface BumpChatArtifactVersionArgs {
|
|
384
|
-
|
|
136
|
+
organizationId: string;
|
|
137
|
+
artifactId: string;
|
|
138
|
+
sessionId: string;
|
|
139
|
+
createdByUserId: string;
|
|
385
140
|
}
|
|
386
141
|
export interface BumpChatArtifactVersionRow {
|
|
387
142
|
id: string;
|
|
143
|
+
organizationId: string;
|
|
388
144
|
sessionId: string;
|
|
389
145
|
title: string;
|
|
390
146
|
kind: string;
|
|
@@ -394,12 +150,16 @@ export interface BumpChatArtifactVersionRow {
|
|
|
394
150
|
updatedAt: Date;
|
|
395
151
|
}
|
|
396
152
|
export declare function bumpChatArtifactVersion(client: Client, args: BumpChatArtifactVersionArgs): Promise<BumpChatArtifactVersionRow | null>;
|
|
397
|
-
export declare const
|
|
398
|
-
export interface
|
|
153
|
+
export declare const getChatArtifactQuery = "-- name: GetChatArtifact :one\nSELECT a.id, a.organization_id, a.session_id, a.title, a.kind, a.language, a.current_version, a.created_at, a.updated_at\nFROM weave.chat_artifact a\n JOIN weave.chat_session s\n ON s.organization_id = a.organization_id\n AND s.id = a.session_id\nWHERE a.organization_id = $1\n AND a.session_id = $2\n AND a.id = $3\n AND s.created_by_user_id = $4";
|
|
154
|
+
export interface GetChatArtifactArgs {
|
|
155
|
+
organizationId: string;
|
|
399
156
|
sessionId: string;
|
|
157
|
+
artifactId: string;
|
|
158
|
+
createdByUserId: string;
|
|
400
159
|
}
|
|
401
|
-
export interface
|
|
160
|
+
export interface GetChatArtifactRow {
|
|
402
161
|
id: string;
|
|
162
|
+
organizationId: string;
|
|
403
163
|
sessionId: string;
|
|
404
164
|
title: string;
|
|
405
165
|
kind: string;
|
|
@@ -408,13 +168,16 @@ export interface ListChatArtifactsForSessionRow {
|
|
|
408
168
|
createdAt: Date;
|
|
409
169
|
updatedAt: Date;
|
|
410
170
|
}
|
|
411
|
-
export declare function
|
|
412
|
-
export declare const
|
|
413
|
-
export interface
|
|
414
|
-
|
|
171
|
+
export declare function getChatArtifact(client: Client, args: GetChatArtifactArgs): Promise<GetChatArtifactRow | null>;
|
|
172
|
+
export declare const listChatArtifactsQuery = "-- name: ListChatArtifacts :many\nSELECT a.id, a.organization_id, a.session_id, a.title, a.kind, a.language, a.current_version, a.created_at, a.updated_at\nFROM weave.chat_artifact a\n JOIN weave.chat_session s\n ON s.organization_id = a.organization_id\n AND s.id = a.session_id\nWHERE a.organization_id = $1\n AND a.session_id = $2\n AND s.created_by_user_id = $3\nORDER BY a.created_at ASC, a.id ASC";
|
|
173
|
+
export interface ListChatArtifactsArgs {
|
|
174
|
+
organizationId: string;
|
|
175
|
+
sessionId: string;
|
|
176
|
+
createdByUserId: string;
|
|
415
177
|
}
|
|
416
|
-
export interface
|
|
178
|
+
export interface ListChatArtifactsRow {
|
|
417
179
|
id: string;
|
|
180
|
+
organizationId: string;
|
|
418
181
|
sessionId: string;
|
|
419
182
|
title: string;
|
|
420
183
|
kind: string;
|
|
@@ -423,71 +186,66 @@ export interface GetChatArtifactRow {
|
|
|
423
186
|
createdAt: Date;
|
|
424
187
|
updatedAt: Date;
|
|
425
188
|
}
|
|
426
|
-
export declare function
|
|
427
|
-
export declare const
|
|
428
|
-
export interface
|
|
429
|
-
|
|
430
|
-
artifactId: string;
|
|
431
|
-
version: number;
|
|
432
|
-
content: string;
|
|
433
|
-
createdByMessageId: string;
|
|
434
|
-
}
|
|
435
|
-
export interface InsertChatArtifactVersionRow {
|
|
436
|
-
id: string;
|
|
189
|
+
export declare function listChatArtifacts(client: Client, args: ListChatArtifactsArgs): Promise<ListChatArtifactsRow[]>;
|
|
190
|
+
export declare const createChatArtifactVersionQuery = "-- name: CreateChatArtifactVersion :one\nINSERT INTO weave.chat_artifact_version (\n organization_id,\n artifact_id,\n version,\n content,\n created_by_agent_run_id,\n tool_call_id,\n document_references\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5::uuid,\n COALESCE($6::text, ''),\n COALESCE($7::jsonb, '[]'::jsonb)\n)\nRETURNING id, organization_id, artifact_id, version, content, created_by_agent_run_id, tool_call_id, document_references, created_at";
|
|
191
|
+
export interface CreateChatArtifactVersionArgs {
|
|
192
|
+
organizationId: string;
|
|
437
193
|
artifactId: string;
|
|
438
194
|
version: number;
|
|
439
195
|
content: string;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
documentReferences: any;
|
|
196
|
+
createdByAgentRunId: string | null;
|
|
197
|
+
toolCallId: string | null;
|
|
198
|
+
documentReferences: any | null;
|
|
443
199
|
}
|
|
444
|
-
export
|
|
445
|
-
export declare const insertChatArtifactVersionWithDocumentReferencesQuery = "-- name: InsertChatArtifactVersionWithDocumentReferences :one\nINSERT INTO weave.chat_artifact_versions (\n id, artifact_id, version, content, created_by_message_id, document_references\n) VALUES ($1, $2, $3, $4, $5, $6)\nRETURNING id, artifact_id, version, content, created_by_message_id, created_at, document_references";
|
|
446
|
-
export interface InsertChatArtifactVersionWithDocumentReferencesArgs {
|
|
200
|
+
export interface CreateChatArtifactVersionRow {
|
|
447
201
|
id: string;
|
|
202
|
+
organizationId: string;
|
|
448
203
|
artifactId: string;
|
|
449
204
|
version: number;
|
|
450
205
|
content: string;
|
|
451
|
-
|
|
206
|
+
createdByAgentRunId: string | null;
|
|
207
|
+
toolCallId: string;
|
|
452
208
|
documentReferences: any;
|
|
453
|
-
}
|
|
454
|
-
export interface InsertChatArtifactVersionWithDocumentReferencesRow {
|
|
455
|
-
id: string;
|
|
456
|
-
artifactId: string;
|
|
457
|
-
version: number;
|
|
458
|
-
content: string;
|
|
459
|
-
createdByMessageId: string;
|
|
460
209
|
createdAt: Date;
|
|
461
|
-
documentReferences: any;
|
|
462
210
|
}
|
|
463
|
-
export declare function
|
|
464
|
-
export declare const getChatArtifactVersionQuery = "-- name: GetChatArtifactVersion :one\nSELECT id, artifact_id, version, content,
|
|
211
|
+
export declare function createChatArtifactVersion(client: Client, args: CreateChatArtifactVersionArgs): Promise<CreateChatArtifactVersionRow | null>;
|
|
212
|
+
export declare const getChatArtifactVersionQuery = "-- name: GetChatArtifactVersion :one\nSELECT v.id, v.organization_id, v.artifact_id, v.version, v.content, v.created_by_agent_run_id, v.tool_call_id, v.document_references, v.created_at\nFROM weave.chat_artifact_version v\n JOIN weave.chat_artifact a\n ON a.organization_id = v.organization_id\n AND a.id = v.artifact_id\n JOIN weave.chat_session s\n ON s.organization_id = a.organization_id\n AND s.id = a.session_id\nWHERE v.organization_id = $1\n AND a.session_id = $2\n AND v.artifact_id = $3\n AND v.version = $4\n AND s.created_by_user_id = $5";
|
|
465
213
|
export interface GetChatArtifactVersionArgs {
|
|
214
|
+
organizationId: string;
|
|
215
|
+
sessionId: string;
|
|
466
216
|
artifactId: string;
|
|
467
217
|
version: number;
|
|
218
|
+
createdByUserId: string;
|
|
468
219
|
}
|
|
469
220
|
export interface GetChatArtifactVersionRow {
|
|
470
221
|
id: string;
|
|
222
|
+
organizationId: string;
|
|
471
223
|
artifactId: string;
|
|
472
224
|
version: number;
|
|
473
225
|
content: string;
|
|
474
|
-
|
|
475
|
-
|
|
226
|
+
createdByAgentRunId: string | null;
|
|
227
|
+
toolCallId: string;
|
|
476
228
|
documentReferences: any;
|
|
229
|
+
createdAt: Date;
|
|
477
230
|
}
|
|
478
231
|
export declare function getChatArtifactVersion(client: Client, args: GetChatArtifactVersionArgs): Promise<GetChatArtifactVersionRow | null>;
|
|
479
|
-
export declare const
|
|
480
|
-
export interface
|
|
232
|
+
export declare const getCurrentChatArtifactVersionQuery = "-- name: GetCurrentChatArtifactVersion :one\nSELECT v.id, v.organization_id, v.artifact_id, v.version, v.content, v.created_by_agent_run_id, v.tool_call_id, v.document_references, v.created_at\nFROM weave.chat_artifact_version v\n JOIN weave.chat_artifact a\n ON a.organization_id = v.organization_id\n AND a.id = v.artifact_id\n JOIN weave.chat_session s\n ON s.organization_id = a.organization_id\n AND s.id = a.session_id\nWHERE v.organization_id = $1\n AND a.session_id = $2\n AND v.artifact_id = $3\n AND v.version = a.current_version\n AND s.created_by_user_id = $4";
|
|
233
|
+
export interface GetCurrentChatArtifactVersionArgs {
|
|
234
|
+
organizationId: string;
|
|
235
|
+
sessionId: string;
|
|
481
236
|
artifactId: string;
|
|
237
|
+
createdByUserId: string;
|
|
482
238
|
}
|
|
483
|
-
export interface
|
|
239
|
+
export interface GetCurrentChatArtifactVersionRow {
|
|
484
240
|
id: string;
|
|
241
|
+
organizationId: string;
|
|
485
242
|
artifactId: string;
|
|
486
243
|
version: number;
|
|
487
244
|
content: string;
|
|
488
|
-
|
|
489
|
-
|
|
245
|
+
createdByAgentRunId: string | null;
|
|
246
|
+
toolCallId: string;
|
|
490
247
|
documentReferences: any;
|
|
248
|
+
createdAt: Date;
|
|
491
249
|
}
|
|
492
|
-
export declare function
|
|
250
|
+
export declare function getCurrentChatArtifactVersion(client: Client, args: GetCurrentChatArtifactVersionArgs): Promise<GetCurrentChatArtifactVersionRow | null>;
|
|
493
251
|
export {};
|