@inkeep/agents-core 0.58.7 → 0.58.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/auth/auth-schema.d.ts +85 -85
  2. package/dist/auth/auth-validation-schemas.d.ts +135 -135
  3. package/dist/client-exports.d.ts +4 -2
  4. package/dist/client-exports.js +2 -2
  5. package/dist/data-access/index.d.ts +2 -1
  6. package/dist/data-access/index.js +2 -1
  7. package/dist/data-access/manage/agents.d.ts +30 -30
  8. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  9. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  10. package/dist/data-access/manage/credentialReferences.d.ts +3 -1
  11. package/dist/data-access/manage/credentialReferences.js +25 -4
  12. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  13. package/dist/data-access/manage/functionTools.d.ts +12 -12
  14. package/dist/data-access/manage/skills.d.ts +7 -7
  15. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  16. package/dist/data-access/manage/subAgentRelations.d.ts +20 -20
  17. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  18. package/dist/data-access/manage/subAgents.d.ts +18 -18
  19. package/dist/data-access/manage/tools.d.ts +18 -18
  20. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  21. package/dist/data-access/runtime/apps.d.ts +113 -0
  22. package/dist/data-access/runtime/apps.js +86 -0
  23. package/dist/data-access/runtime/cascade-delete.d.ts +2 -0
  24. package/dist/data-access/runtime/cascade-delete.js +16 -4
  25. package/dist/data-access/runtime/conversations.d.ts +20 -19
  26. package/dist/data-access/runtime/conversations.js +1 -0
  27. package/dist/data-access/runtime/messages.d.ts +12 -12
  28. package/dist/data-access/runtime/tasks.d.ts +5 -5
  29. package/dist/db/manage/manage-schema.d.ts +357 -357
  30. package/dist/db/runtime/runtime-schema.d.ts +552 -291
  31. package/dist/db/runtime/runtime-schema.js +16 -1
  32. package/dist/index.d.ts +10 -7
  33. package/dist/index.js +7 -4
  34. package/dist/setup/setup.js +10 -0
  35. package/dist/types/entities.d.ts +10 -2
  36. package/dist/types/index.d.ts +4 -4
  37. package/dist/types/utility.d.ts +9 -3
  38. package/dist/utils/apiKeys.d.ts +6 -1
  39. package/dist/utils/apiKeys.js +9 -1
  40. package/dist/utils/domain-validation.d.ts +4 -0
  41. package/dist/utils/domain-validation.js +25 -0
  42. package/dist/utils/index.d.ts +4 -2
  43. package/dist/utils/index.js +4 -2
  44. package/dist/utils/pow.d.ts +13 -0
  45. package/dist/utils/pow.js +52 -0
  46. package/dist/validation/dolt-schemas.d.ts +1 -1
  47. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  48. package/dist/validation/index.d.ts +2 -2
  49. package/dist/validation/index.js +2 -2
  50. package/dist/validation/schemas.d.ts +1949 -668
  51. package/dist/validation/schemas.js +57 -3
  52. package/drizzle/runtime/0022_superb_micromacro.sql +17 -0
  53. package/drizzle/runtime/meta/0022_snapshot.json +4240 -0
  54. package/drizzle/runtime/meta/_journal.json +7 -0
  55. package/package.json +3 -2
@@ -24,9 +24,9 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
24
24
  createdAt: string;
25
25
  updatedAt: string;
26
26
  description: string | null;
27
- tenantId: string;
28
- projectId: string;
29
27
  headers: Record<string, string> | null;
28
+ projectId: string;
29
+ tenantId: string;
30
30
  config: {
31
31
  type: "mcp";
32
32
  mcp: ToolMcpConfig;
@@ -82,9 +82,9 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
82
82
  createdAt: string;
83
83
  updatedAt: string;
84
84
  description: string | null;
85
- tenantId: string;
86
- projectId: string;
87
85
  headers: Record<string, string> | null;
86
+ projectId: string;
87
+ tenantId: string;
88
88
  config: {
89
89
  type: "mcp";
90
90
  mcp: ToolMcpConfig;
@@ -137,15 +137,15 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
137
137
  id: string;
138
138
  createdAt: string;
139
139
  updatedAt: string;
140
- tenantId: string;
141
- projectId: string;
140
+ headers: Record<string, string> | null;
142
141
  agentId: string;
142
+ projectId: string;
143
+ tenantId: string;
143
144
  toolId: string;
144
- headers: Record<string, string> | null;
145
+ subAgentId: string;
145
146
  toolPolicies: Record<string, {
146
147
  needsApproval?: boolean;
147
148
  }> | null;
148
- subAgentId: string;
149
149
  selectedTools: string[] | null;
150
150
  }>;
151
151
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -156,15 +156,15 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
156
156
  id: string;
157
157
  createdAt: string;
158
158
  updatedAt: string;
159
- tenantId: string;
160
- projectId: string;
159
+ headers: Record<string, string> | null;
161
160
  agentId: string;
161
+ projectId: string;
162
+ tenantId: string;
162
163
  toolId: string;
163
- headers: Record<string, string> | null;
164
+ subAgentId: string;
164
165
  toolPolicies: Record<string, {
165
166
  needsApproval?: boolean;
166
167
  }> | null;
167
- subAgentId: string;
168
168
  selectedTools: string[] | null;
169
169
  }>;
170
170
  /**
@@ -184,15 +184,15 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
184
184
  id: string;
185
185
  createdAt: string;
186
186
  updatedAt: string;
187
- tenantId: string;
188
- projectId: string;
187
+ headers: Record<string, string> | null;
189
188
  agentId: string;
189
+ projectId: string;
190
+ tenantId: string;
190
191
  toolId: string;
191
- headers: Record<string, string> | null;
192
+ subAgentId: string;
192
193
  toolPolicies: Record<string, {
193
194
  needsApproval?: boolean;
194
195
  }> | null;
195
- subAgentId: string;
196
196
  selectedTools: string[] | null;
197
197
  }>;
198
198
  /**
@@ -206,9 +206,9 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
206
206
  createdAt: string;
207
207
  updatedAt: string;
208
208
  description: string | null;
209
- tenantId: string;
210
- projectId: string;
211
209
  headers: Record<string, string> | null;
210
+ projectId: string;
211
+ tenantId: string;
212
212
  config: {
213
213
  type: "mcp";
214
214
  mcp: ToolMcpConfig;
@@ -13,9 +13,9 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
15
  expiresAt: string | null;
16
- tenantId: string;
17
- projectId: string;
18
16
  agentId: string;
17
+ projectId: string;
18
+ tenantId: string;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
@@ -27,9 +27,9 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
29
  expiresAt: string | null;
30
- tenantId: string;
31
- projectId: string;
32
30
  agentId: string;
31
+ projectId: string;
32
+ tenantId: string;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -44,9 +44,9 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
44
44
  createdAt: string;
45
45
  updatedAt: string;
46
46
  expiresAt: string | null;
47
- tenantId: string;
48
- projectId: string;
49
47
  agentId: string;
48
+ projectId: string;
49
+ tenantId: string;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -71,9 +71,9 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
71
71
  createdAt: string;
72
72
  updatedAt: string;
73
73
  expiresAt: string | null;
74
- tenantId: string;
75
- projectId: string;
76
74
  agentId: string;
75
+ projectId: string;
76
+ tenantId: string;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -0,0 +1,113 @@
1
+ import { TenantScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { AppType, PaginationConfig } from "../../types/utility.js";
3
+ import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
+ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
+
6
+ //#region src/data-access/runtime/apps.d.ts
7
+ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
+ id: string;
9
+ name: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ description: string | null;
13
+ enabled: boolean;
14
+ type: AppType;
15
+ projectId: string | null;
16
+ tenantId: string | null;
17
+ config: {
18
+ type: "web_client";
19
+ webClient: {
20
+ allowedDomains: string[];
21
+ };
22
+ } | {
23
+ type: "api";
24
+ api: Record<string, never>;
25
+ };
26
+ lastUsedAt: string | null;
27
+ defaultProjectId: string | null;
28
+ defaultAgentId: string | null;
29
+ } | undefined>;
30
+ declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
31
+ declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
32
+ scopes: TenantScopeConfig;
33
+ id: string;
34
+ }) => Promise<AppSelect | undefined>;
35
+ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
36
+ scopes: TenantScopeConfig & {
37
+ projectId?: string;
38
+ };
39
+ pagination?: PaginationConfig;
40
+ type?: AppType;
41
+ }) => Promise<{
42
+ data: AppSelect[];
43
+ pagination: {
44
+ page: number;
45
+ limit: number;
46
+ total: number;
47
+ pages: number;
48
+ };
49
+ }>;
50
+ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
51
+ id: string;
52
+ name: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ description: string | null;
56
+ enabled: boolean;
57
+ type: AppType;
58
+ projectId: string | null;
59
+ tenantId: string | null;
60
+ config: {
61
+ type: "web_client";
62
+ webClient: {
63
+ allowedDomains: string[];
64
+ };
65
+ } | {
66
+ type: "api";
67
+ api: Record<string, never>;
68
+ };
69
+ lastUsedAt: string | null;
70
+ defaultProjectId: string | null;
71
+ defaultAgentId: string | null;
72
+ }>;
73
+ declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
74
+ scopes: TenantScopeConfig;
75
+ id: string;
76
+ data: AppUpdate;
77
+ }) => Promise<AppSelect | undefined>;
78
+ declare const deleteAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
79
+ scopes: TenantScopeConfig;
80
+ id: string;
81
+ }) => Promise<boolean>;
82
+ declare const deleteAppsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
83
+ declare const clearAppDefaultsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
84
+ declare const clearAppDefaultsByAgent: (db: AgentsRunDatabaseClient) => (tenantId: string, agentId: string) => Promise<number>;
85
+ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
86
+ id: string;
87
+ data: AppUpdate;
88
+ }) => Promise<{
89
+ createdAt: string;
90
+ updatedAt: string;
91
+ id: string;
92
+ tenantId: string | null;
93
+ projectId: string | null;
94
+ name: string;
95
+ description: string | null;
96
+ type: AppType;
97
+ defaultProjectId: string | null;
98
+ defaultAgentId: string | null;
99
+ enabled: boolean;
100
+ config: {
101
+ type: "web_client";
102
+ webClient: {
103
+ allowedDomains: string[];
104
+ };
105
+ } | {
106
+ type: "api";
107
+ api: Record<string, never>;
108
+ };
109
+ lastUsedAt: string | null;
110
+ }>;
111
+ declare const deleteApp: (db: AgentsRunDatabaseClient) => (id: string) => Promise<boolean>;
112
+ //#endregion
113
+ export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed };
@@ -0,0 +1,86 @@
1
+ import { apps } from "../../db/runtime/runtime-schema.js";
2
+ import { and, count, desc, eq } from "drizzle-orm";
3
+
4
+ //#region src/data-access/runtime/apps.ts
5
+ const getAppById = (db) => async (id) => {
6
+ return await db.query.apps.findFirst({ where: eq(apps.id, id) });
7
+ };
8
+ const updateAppLastUsed = (db) => async (id) => {
9
+ await db.update(apps).set({ lastUsedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(apps.id, id));
10
+ };
11
+ const getAppByIdForTenant = (db) => async (params) => {
12
+ return db.query.apps.findFirst({ where: and(eq(apps.id, params.id), eq(apps.tenantId, params.scopes.tenantId)) });
13
+ };
14
+ const listAppsPaginated = (db) => async (params) => {
15
+ const page = params.pagination?.page || 1;
16
+ const limit = Math.min(params.pagination?.limit || 10, 100);
17
+ const offset = (page - 1) * limit;
18
+ const conditions = [eq(apps.tenantId, params.scopes.tenantId)];
19
+ if (params.scopes.projectId) conditions.push(eq(apps.projectId, params.scopes.projectId));
20
+ if (params.type) conditions.push(eq(apps.type, params.type));
21
+ const whereClause = and(...conditions);
22
+ const [data, totalResult] = await Promise.all([db.select().from(apps).where(whereClause).limit(limit).offset(offset).orderBy(desc(apps.createdAt)), db.select({ count: count() }).from(apps).where(whereClause)]);
23
+ const total = totalResult[0]?.count || 0;
24
+ const totalNumber = typeof total === "string" ? Number.parseInt(total, 10) : total;
25
+ return {
26
+ data,
27
+ pagination: {
28
+ page,
29
+ limit,
30
+ total: totalNumber,
31
+ pages: Math.ceil(totalNumber / limit)
32
+ }
33
+ };
34
+ };
35
+ const createApp = (db) => async (params) => {
36
+ const now = (/* @__PURE__ */ new Date()).toISOString();
37
+ const [app] = await db.insert(apps).values({
38
+ ...params,
39
+ createdAt: now,
40
+ updatedAt: now
41
+ }).returning();
42
+ return app;
43
+ };
44
+ const updateAppForTenant = (db) => async (params) => {
45
+ const now = (/* @__PURE__ */ new Date()).toISOString();
46
+ const [updatedApp] = await db.update(apps).set({
47
+ ...params.data,
48
+ updatedAt: now
49
+ }).where(and(eq(apps.id, params.id), eq(apps.tenantId, params.scopes.tenantId))).returning();
50
+ return updatedApp;
51
+ };
52
+ const deleteAppForTenant = (db) => async (params) => {
53
+ return (await db.delete(apps).where(and(eq(apps.id, params.id), eq(apps.tenantId, params.scopes.tenantId))).returning()).length > 0;
54
+ };
55
+ const deleteAppsByProject = (db) => async (tenantId, projectId) => {
56
+ return (await db.delete(apps).where(and(eq(apps.tenantId, tenantId), eq(apps.projectId, projectId))).returning()).length;
57
+ };
58
+ const clearAppDefaultsByProject = (db) => async (tenantId, projectId) => {
59
+ return (await db.update(apps).set({
60
+ defaultProjectId: null,
61
+ defaultAgentId: null,
62
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
63
+ }).where(and(eq(apps.tenantId, tenantId), eq(apps.defaultProjectId, projectId))).returning()).length;
64
+ };
65
+ const clearAppDefaultsByAgent = (db) => async (tenantId, agentId) => {
66
+ return (await db.update(apps).set({
67
+ defaultAgentId: null,
68
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
69
+ }).where(and(eq(apps.tenantId, tenantId), eq(apps.defaultAgentId, agentId))).returning()).length;
70
+ };
71
+ const updateApp = (db) => async (params) => {
72
+ const now = (/* @__PURE__ */ new Date()).toISOString();
73
+ const [updatedApp] = await db.update(apps).set({
74
+ ...params.data,
75
+ updatedAt: now
76
+ }).where(eq(apps.id, params.id)).returning();
77
+ return updatedApp;
78
+ };
79
+ const deleteApp = (db) => async (id) => {
80
+ if (!await getAppById(db)(id)) return false;
81
+ await db.delete(apps).where(eq(apps.id, id));
82
+ return true;
83
+ };
84
+
85
+ //#endregion
86
+ export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed };
@@ -13,6 +13,8 @@ type CascadeDeleteResult = {
13
13
  apiKeysDeleted: number;
14
14
  slackChannelConfigsDeleted: number;
15
15
  slackWorkspaceDefaultsCleared: number;
16
+ appsDeleted: number;
17
+ appDefaultsCleared: number;
16
18
  };
17
19
  /**
18
20
  * Delete all runtime entities for a specific branch.
@@ -1,4 +1,5 @@
1
1
  import { apiKeys, contextCache, conversations, tasks, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess } from "../../db/runtime/runtime-schema.js";
2
+ import { clearAppDefaultsByAgent, clearAppDefaultsByProject, deleteAppsByProject } from "./apps.js";
2
3
  import { deleteSlackMcpToolAccessConfig } from "./slack-work-app-mcp.js";
3
4
  import { clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject } from "./workAppSlack.js";
4
5
  import { and, eq, inArray, sql } from "drizzle-orm";
@@ -22,7 +23,9 @@ const cascadeDeleteByBranch = (db) => async (params) => {
22
23
  contextCacheDeleted: contextCacheResult.length,
23
24
  apiKeysDeleted: 0,
24
25
  slackChannelConfigsDeleted: 0,
25
- slackWorkspaceDefaultsCleared: 0
26
+ slackWorkspaceDefaultsCleared: 0,
27
+ appsDeleted: 0,
28
+ appDefaultsCleared: 0
26
29
  };
27
30
  };
28
31
  /**
@@ -43,6 +46,8 @@ const cascadeDeleteByProject = (db) => async (params) => {
43
46
  tenantId: scopes.tenantId,
44
47
  projectId: scopes.projectId
45
48
  });
49
+ const appsDeleted = await deleteAppsByProject(db)(scopes.tenantId, scopes.projectId);
50
+ const appDefaultsCleared = await clearAppDefaultsByProject(db)(scopes.tenantId, scopes.projectId);
46
51
  const slackChannelConfigsDeleted = await deleteWorkAppSlackChannelAgentConfigsByProject(db)(scopes.tenantId, scopes.projectId);
47
52
  const slackWorkspaceDefaultsCleared = await clearWorkspaceDefaultsByProject(db)(scopes.tenantId, scopes.projectId);
48
53
  clearDevConfigWorkspaceDefaultsByProject(scopes.projectId);
@@ -52,7 +57,9 @@ const cascadeDeleteByProject = (db) => async (params) => {
52
57
  contextCacheDeleted: contextCacheResult.length,
53
58
  apiKeysDeleted: apiKeysResult.length,
54
59
  slackChannelConfigsDeleted,
55
- slackWorkspaceDefaultsCleared
60
+ slackWorkspaceDefaultsCleared,
61
+ appsDeleted,
62
+ appDefaultsCleared
56
63
  };
57
64
  };
58
65
  /**
@@ -78,6 +85,7 @@ const cascadeDeleteByAgent = (db) => async (params) => {
78
85
  }
79
86
  tasksDeleted = (await db.delete(tasks).where(and(eq(tasks.tenantId, scopes.tenantId), eq(tasks.projectId, scopes.projectId), eq(tasks.agentId, scopes.agentId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning()).length;
80
87
  apiKeysDeleted = (await db.delete(apiKeys).where(and(eq(apiKeys.tenantId, scopes.tenantId), eq(apiKeys.projectId, scopes.projectId), eq(apiKeys.agentId, scopes.agentId))).returning()).length;
88
+ const appDefaultsCleared = await clearAppDefaultsByAgent(db)(scopes.tenantId, scopes.agentId);
81
89
  const slackChannelConfigsDeleted = await deleteWorkAppSlackChannelAgentConfigsByAgent(db)(scopes.tenantId, scopes.projectId, scopes.agentId);
82
90
  const slackWorkspaceDefaultsCleared = await clearWorkspaceDefaultsByAgent(db)(scopes.tenantId, scopes.projectId, scopes.agentId);
83
91
  clearDevConfigWorkspaceDefaultsByAgent(scopes.projectId, scopes.agentId);
@@ -87,7 +95,9 @@ const cascadeDeleteByAgent = (db) => async (params) => {
87
95
  contextCacheDeleted,
88
96
  apiKeysDeleted,
89
97
  slackChannelConfigsDeleted,
90
- slackWorkspaceDefaultsCleared
98
+ slackWorkspaceDefaultsCleared,
99
+ appsDeleted: 0,
100
+ appDefaultsCleared
91
101
  };
92
102
  };
93
103
  /**
@@ -112,7 +122,9 @@ const cascadeDeleteBySubAgent = (db) => async (params) => {
112
122
  contextCacheDeleted,
113
123
  apiKeysDeleted: 0,
114
124
  slackChannelConfigsDeleted: 0,
115
- slackWorkspaceDefaultsCleared: 0
125
+ slackWorkspaceDefaultsCleared: 0,
126
+ appsDeleted: 0,
127
+ appDefaultsCleared: 0
116
128
  };
117
129
  };
118
130
  /**
@@ -20,16 +20,16 @@ declare const createConversation: (db: AgentsRunDatabaseClient) => (params: Conv
20
20
  createdAt: string;
21
21
  updatedAt: string;
22
22
  ref: {
23
- type: "tag" | "commit" | "branch";
23
+ type: "commit" | "tag" | "branch";
24
24
  name: string;
25
25
  hash: string;
26
26
  } | null;
27
27
  userId: string | null;
28
28
  metadata: ConversationMetadata | null;
29
- tenantId: string;
30
- projectId: string;
31
- agentId: string | null;
32
29
  title: string | null;
30
+ agentId: string | null;
31
+ projectId: string;
32
+ tenantId: string;
33
33
  activeSubAgentId: string;
34
34
  lastContextResolution: string | null;
35
35
  }>;
@@ -44,7 +44,7 @@ declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
44
44
  agentId: string | null;
45
45
  activeSubAgentId: string;
46
46
  ref: {
47
- type: "tag" | "commit" | "branch";
47
+ type: "commit" | "tag" | "branch";
48
48
  name: string;
49
49
  hash: string;
50
50
  } | null;
@@ -70,7 +70,7 @@ declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) =>
70
70
  agentId: string | null;
71
71
  activeSubAgentId: string;
72
72
  ref: {
73
- type: "tag" | "commit" | "branch";
73
+ type: "commit" | "tag" | "branch";
74
74
  name: string;
75
75
  hash: string;
76
76
  } | null;
@@ -89,16 +89,16 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
89
89
  createdAt: string;
90
90
  updatedAt: string;
91
91
  ref: {
92
- type: "tag" | "commit" | "branch";
92
+ type: "commit" | "tag" | "branch";
93
93
  name: string;
94
94
  hash: string;
95
95
  } | null;
96
96
  userId: string | null;
97
97
  metadata: ConversationMetadata | null;
98
- tenantId: string;
99
- projectId: string;
100
- agentId: string | null;
101
98
  title: string | null;
99
+ agentId: string | null;
100
+ projectId: string;
101
+ tenantId: string;
102
102
  activeSubAgentId: string;
103
103
  lastContextResolution: string | null;
104
104
  } | undefined>;
@@ -108,7 +108,7 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
108
108
  tenantId: string;
109
109
  id: string;
110
110
  ref: {
111
- type: "tag" | "commit" | "branch";
111
+ type: "commit" | "tag" | "branch";
112
112
  name: string;
113
113
  hash: string;
114
114
  };
@@ -125,16 +125,16 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
125
125
  createdAt: string;
126
126
  updatedAt: string;
127
127
  ref: {
128
- type: "tag" | "commit" | "branch";
128
+ type: "commit" | "tag" | "branch";
129
129
  name: string;
130
130
  hash: string;
131
131
  } | null;
132
132
  userId: string | null;
133
133
  metadata: ConversationMetadata | null;
134
- tenantId: string;
135
- projectId: string;
136
- agentId: string | null;
137
134
  title: string | null;
135
+ agentId: string | null;
136
+ projectId: string;
137
+ tenantId: string;
138
138
  activeSubAgentId: string;
139
139
  lastContextResolution: string | null;
140
140
  }>;
@@ -157,16 +157,16 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
157
157
  createdAt: string;
158
158
  updatedAt: string;
159
159
  ref: {
160
- type: "tag" | "commit" | "branch";
160
+ type: "commit" | "tag" | "branch";
161
161
  name: string;
162
162
  hash: string;
163
163
  } | null;
164
164
  userId: string | null;
165
165
  metadata: ConversationMetadata | null;
166
- tenantId: string;
167
- projectId: string;
168
- agentId: string | null;
169
166
  title: string | null;
167
+ agentId: string | null;
168
+ projectId: string;
169
+ tenantId: string;
170
170
  activeSubAgentId: string;
171
171
  lastContextResolution: string | null;
172
172
  } | undefined>;
@@ -179,6 +179,7 @@ declare const setActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
179
179
  subAgentId: string;
180
180
  agentId: string;
181
181
  ref: ResolvedRef;
182
+ userId?: string;
182
183
  }) => Promise<void>;
183
184
  declare const setActiveAgentForThread: (db: AgentsRunDatabaseClient) => ({
184
185
  scopes,
@@ -162,6 +162,7 @@ const setActiveAgentForConversation = (db) => async (params) => {
162
162
  activeSubAgentId: params.subAgentId,
163
163
  agentId: params.agentId,
164
164
  ref: params.ref,
165
+ userId: params.userId,
165
166
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
166
167
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
167
168
  }).onConflictDoUpdate({
@@ -15,21 +15,21 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
15
15
  updatedAt: string;
16
16
  metadata: MessageMetadata | null;
17
17
  role: string;
18
- tenantId: string;
19
18
  projectId: string;
19
+ tenantId: string;
20
20
  content: MessageContent;
21
+ conversationId: string;
21
22
  fromSubAgentId: string | null;
22
23
  toSubAgentId: string | null;
23
24
  fromExternalAgentId: string | null;
24
25
  toExternalAgentId: string | null;
25
- taskId: string | null;
26
- a2aTaskId: string | null;
27
- conversationId: string;
28
26
  fromTeamAgentId: string | null;
29
27
  toTeamAgentId: string | null;
30
28
  visibility: string;
31
29
  messageType: string;
30
+ taskId: string | null;
32
31
  parentMessageId: string | null;
32
+ a2aTaskId: string | null;
33
33
  a2aSessionId: string | null;
34
34
  } | undefined>;
35
35
  declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
@@ -146,21 +146,21 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: MessageIn
146
146
  updatedAt: string;
147
147
  metadata: MessageMetadata | null;
148
148
  role: string;
149
- tenantId: string;
150
149
  projectId: string;
150
+ tenantId: string;
151
151
  content: MessageContent;
152
+ conversationId: string;
152
153
  fromSubAgentId: string | null;
153
154
  toSubAgentId: string | null;
154
155
  fromExternalAgentId: string | null;
155
156
  toExternalAgentId: string | null;
156
- taskId: string | null;
157
- a2aTaskId: string | null;
158
- conversationId: string;
159
157
  fromTeamAgentId: string | null;
160
158
  toTeamAgentId: string | null;
161
159
  visibility: string;
162
160
  messageType: string;
161
+ taskId: string | null;
163
162
  parentMessageId: string | null;
163
+ a2aTaskId: string | null;
164
164
  a2aSessionId: string | null;
165
165
  }>;
166
166
  declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
@@ -199,21 +199,21 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
199
199
  updatedAt: string;
200
200
  metadata: MessageMetadata | null;
201
201
  role: string;
202
- tenantId: string;
203
202
  projectId: string;
203
+ tenantId: string;
204
204
  content: MessageContent;
205
+ conversationId: string;
205
206
  fromSubAgentId: string | null;
206
207
  toSubAgentId: string | null;
207
208
  fromExternalAgentId: string | null;
208
209
  toExternalAgentId: string | null;
209
- taskId: string | null;
210
- a2aTaskId: string | null;
211
- conversationId: string;
212
210
  fromTeamAgentId: string | null;
213
211
  toTeamAgentId: string | null;
214
212
  visibility: string;
215
213
  messageType: string;
214
+ taskId: string | null;
216
215
  parentMessageId: string | null;
216
+ a2aTaskId: string | null;
217
217
  a2aSessionId: string | null;
218
218
  }>;
219
219
  declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
@@ -10,17 +10,17 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
10
10
  createdAt: string;
11
11
  updatedAt: string;
12
12
  ref: {
13
- type: "tag" | "commit" | "branch";
13
+ type: "commit" | "tag" | "branch";
14
14
  name: string;
15
15
  hash: string;
16
16
  } | null;
17
17
  metadata: TaskMetadataConfig | null;
18
18
  status: string;
19
- tenantId: string;
20
- projectId: string;
21
19
  agentId: string;
22
- subAgentId: string;
20
+ projectId: string;
21
+ tenantId: string;
23
22
  contextId: string;
23
+ subAgentId: string;
24
24
  }>;
25
25
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
26
26
  id: string;
@@ -36,7 +36,7 @@ declare const updateTask: (db: AgentsRunDatabaseClient) => (params: {
36
36
  updatedAt: string;
37
37
  contextId: string;
38
38
  ref: {
39
- type: "tag" | "commit" | "branch";
39
+ type: "commit" | "tag" | "branch";
40
40
  name: string;
41
41
  hash: string;
42
42
  } | null;