@inkeep/agents-core 0.0.0-dev-20260324095902 → 0.0.0-dev-20260324145046

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 (50) hide show
  1. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  2. package/dist/auth/permissions.d.ts +9 -9
  3. package/dist/data-access/manage/agents.d.ts +10 -10
  4. package/dist/data-access/manage/artifactComponents.d.ts +4 -4
  5. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  6. package/dist/data-access/manage/credentialReferences.js +1 -1
  7. package/dist/data-access/manage/dataComponents.js +1 -1
  8. package/dist/data-access/manage/functionTools.d.ts +4 -4
  9. package/dist/data-access/manage/skills.d.ts +10 -10
  10. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
  11. package/dist/data-access/manage/subAgentRelations.d.ts +8 -8
  12. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
  13. package/dist/data-access/manage/subAgents.d.ts +6 -6
  14. package/dist/data-access/manage/tools.d.ts +12 -12
  15. package/dist/data-access/manage/triggers.d.ts +2 -2
  16. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  17. package/dist/data-access/runtime/apps.d.ts +14 -14
  18. package/dist/data-access/runtime/conversations.d.ts +20 -20
  19. package/dist/data-access/runtime/messages.d.ts +15 -15
  20. package/dist/data-access/runtime/tasks.d.ts +5 -5
  21. package/dist/db/manage/manage-schema.d.ts +4 -4
  22. package/dist/db/runtime/test-runtime-client.js +1 -1
  23. package/dist/dolt/advisory-lock.d.ts +7 -0
  24. package/dist/dolt/advisory-lock.js +18 -0
  25. package/dist/dolt/branches-api.d.ts +19 -9
  26. package/dist/dolt/branches-api.js +58 -29
  27. package/dist/dolt/index.d.ts +7 -4
  28. package/dist/dolt/index.js +7 -4
  29. package/dist/dolt/merge.d.ts +41 -5
  30. package/dist/dolt/merge.js +161 -24
  31. package/dist/dolt/pk-map.d.ts +6 -0
  32. package/dist/dolt/pk-map.js +27 -0
  33. package/dist/dolt/ref-middleware.d.ts +2 -1
  34. package/dist/dolt/ref-middleware.js +18 -4
  35. package/dist/dolt/resolve-conflicts.d.ts +10 -0
  36. package/dist/dolt/resolve-conflicts.js +100 -0
  37. package/dist/dolt/schema-sync.js +17 -17
  38. package/dist/index.d.ts +8 -5
  39. package/dist/index.js +9 -6
  40. package/dist/middleware/no-auth.d.ts +2 -2
  41. package/dist/utils/error.d.ts +51 -51
  42. package/dist/utils/index.js +1 -1
  43. package/dist/utils/work-app-mcp.js +4 -3
  44. package/dist/validation/dolt-schemas.d.ts +95 -2
  45. package/dist/validation/dolt-schemas.js +54 -2
  46. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  47. package/dist/validation/index.d.ts +2 -2
  48. package/dist/validation/index.js +2 -2
  49. package/dist/validation/schemas.d.ts +1886 -1886
  50. package/package.json +1 -1
@@ -20,14 +20,14 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
20
20
  scopes: ProjectScopeConfig;
21
21
  toolId: string;
22
22
  }) => Promise<{
23
- name: string;
24
23
  id: string;
24
+ name: string;
25
25
  createdAt: string;
26
26
  updatedAt: string;
27
- projectId: string;
28
- tenantId: string;
29
27
  description: string | null;
30
28
  headers: Record<string, string> | null;
29
+ projectId: string;
30
+ tenantId: string;
31
31
  config: {
32
32
  type: "mcp";
33
33
  mcp: ToolMcpConfig;
@@ -78,14 +78,14 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
78
78
  };
79
79
  }>;
80
80
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
81
- name: string;
82
81
  id: string;
82
+ name: string;
83
83
  createdAt: string;
84
84
  updatedAt: string;
85
- projectId: string;
86
- tenantId: string;
87
85
  description: string | null;
88
86
  headers: Record<string, string> | null;
87
+ projectId: string;
88
+ tenantId: string;
89
89
  config: {
90
90
  type: "mcp";
91
91
  mcp: ToolMcpConfig;
@@ -138,12 +138,12 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
138
138
  id: string;
139
139
  createdAt: string;
140
140
  updatedAt: string;
141
+ headers: Record<string, string> | null;
141
142
  agentId: string;
142
143
  projectId: string;
143
144
  tenantId: string;
144
145
  subAgentId: string;
145
146
  toolId: string;
146
- headers: Record<string, string> | null;
147
147
  toolPolicies: Record<string, {
148
148
  needsApproval?: boolean;
149
149
  }> | null;
@@ -157,12 +157,12 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
157
157
  id: string;
158
158
  createdAt: string;
159
159
  updatedAt: string;
160
+ headers: Record<string, string> | null;
160
161
  agentId: string;
161
162
  projectId: string;
162
163
  tenantId: string;
163
164
  subAgentId: string;
164
165
  toolId: string;
165
- headers: Record<string, string> | null;
166
166
  toolPolicies: Record<string, {
167
167
  needsApproval?: boolean;
168
168
  }> | null;
@@ -185,12 +185,12 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
185
185
  id: string;
186
186
  createdAt: string;
187
187
  updatedAt: string;
188
+ headers: Record<string, string> | null;
188
189
  agentId: string;
189
190
  projectId: string;
190
191
  tenantId: string;
191
192
  subAgentId: string;
192
193
  toolId: string;
193
- headers: Record<string, string> | null;
194
194
  toolPolicies: Record<string, {
195
195
  needsApproval?: boolean;
196
196
  }> | null;
@@ -202,14 +202,14 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
202
202
  declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
203
203
  data: ToolInsert;
204
204
  }) => Promise<{
205
- name: string;
206
205
  id: string;
206
+ name: string;
207
207
  createdAt: string;
208
208
  updatedAt: string;
209
- projectId: string;
210
- tenantId: string;
211
209
  description: string | null;
212
210
  headers: Record<string, string> | null;
211
+ projectId: string;
212
+ tenantId: string;
213
213
  config: {
214
214
  type: "mcp";
215
215
  mcp: ToolMcpConfig;
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
40
40
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
41
41
  encoding: "hex" | "base64";
42
42
  signature: {
43
- source: "query" | "header" | "body";
43
+ source: "query" | "body" | "header";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "header" | "body";
49
+ source: "literal" | "body" | "header";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -8,28 +8,28 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
8
8
  scopes: ProjectScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
- name: string | null;
12
11
  id: string;
12
+ name: string | null;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
+ expiresAt: string | null;
15
16
  agentId: string;
16
17
  projectId: string;
17
18
  tenantId: string;
18
- expiresAt: string | null;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
22
22
  lastUsedAt: string | null;
23
23
  } | undefined>;
24
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
25
- name: string | null;
26
25
  id: string;
26
+ name: string | null;
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
+ expiresAt: string | null;
29
30
  agentId: string;
30
31
  projectId: string;
31
32
  tenantId: string;
32
- expiresAt: string | null;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -39,14 +39,14 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
39
39
  scopes: ProjectScopeConfig;
40
40
  agentId?: string;
41
41
  }) => Promise<{
42
- name: string | null;
43
42
  id: string;
43
+ name: string | null;
44
44
  createdAt: string;
45
45
  updatedAt: string;
46
+ expiresAt: string | null;
46
47
  agentId: string;
47
48
  projectId: string;
48
49
  tenantId: string;
49
- expiresAt: string | null;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -66,14 +66,14 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
66
66
  };
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
- name: string | null;
70
69
  id: string;
70
+ name: string | null;
71
71
  createdAt: string;
72
72
  updatedAt: string;
73
+ expiresAt: string | null;
73
74
  agentId: string;
74
75
  projectId: string;
75
76
  tenantId: string;
76
- expiresAt: string | null;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -5,15 +5,18 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
5
 
6
6
  //#region src/data-access/runtime/apps.d.ts
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
- name: string;
9
8
  id: string;
9
+ name: string;
10
10
  createdAt: string;
11
11
  updatedAt: string;
12
- projectId: string | null;
13
- tenantId: string | null;
14
12
  description: string | null;
15
- type: AppType;
16
13
  enabled: boolean;
14
+ type: AppType;
15
+ projectId: string | null;
16
+ tenantId: string | null;
17
+ lastUsedAt: string | null;
18
+ defaultProjectId: string | null;
19
+ defaultAgentId: string | null;
17
20
  config: {
18
21
  type: "web_client";
19
22
  webClient: {
@@ -23,9 +26,6 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
23
26
  type: "api";
24
27
  api: Record<string, never>;
25
28
  };
26
- lastUsedAt: string | null;
27
- defaultProjectId: string | null;
28
- defaultAgentId: string | null;
29
29
  } | undefined>;
30
30
  declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
31
31
  declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
@@ -52,15 +52,18 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
52
52
  };
53
53
  }>;
54
54
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
55
- name: string;
56
55
  id: string;
56
+ name: string;
57
57
  createdAt: string;
58
58
  updatedAt: string;
59
- projectId: string | null;
60
- tenantId: string | null;
61
59
  description: string | null;
62
- type: AppType;
63
60
  enabled: boolean;
61
+ type: AppType;
62
+ projectId: string | null;
63
+ tenantId: string | null;
64
+ lastUsedAt: string | null;
65
+ defaultProjectId: string | null;
66
+ defaultAgentId: string | null;
64
67
  config: {
65
68
  type: "web_client";
66
69
  webClient: {
@@ -70,9 +73,6 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
70
73
  type: "api";
71
74
  api: Record<string, never>;
72
75
  };
73
- lastUsedAt: string | null;
74
- defaultProjectId: string | null;
75
- defaultAgentId: string | null;
76
76
  }>;
77
77
  declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
78
78
  scopes: TenantScopeConfig;
@@ -19,17 +19,17 @@ declare const createConversation: (db: AgentsRunDatabaseClient) => (params: Conv
19
19
  id: string;
20
20
  createdAt: string;
21
21
  updatedAt: string;
22
- agentId: string | null;
23
- projectId: string;
24
- tenantId: string;
25
- title: string | null;
26
- metadata: ConversationMetadata | null;
27
22
  ref: {
28
23
  type: "commit" | "tag" | "branch";
29
24
  name: string;
30
25
  hash: string;
31
26
  } | null;
32
27
  userId: string | null;
28
+ metadata: ConversationMetadata | null;
29
+ agentId: string | null;
30
+ projectId: string;
31
+ tenantId: string;
32
+ title: string | null;
33
33
  activeSubAgentId: string;
34
34
  lastContextResolution: string | null;
35
35
  }>;
@@ -88,17 +88,17 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
88
88
  id: string;
89
89
  createdAt: string;
90
90
  updatedAt: string;
91
- agentId: string | null;
92
- projectId: string;
93
- tenantId: string;
94
- title: string | null;
95
- metadata: ConversationMetadata | null;
96
91
  ref: {
97
92
  type: "commit" | "tag" | "branch";
98
93
  name: string;
99
94
  hash: string;
100
95
  } | null;
101
96
  userId: string | null;
97
+ metadata: ConversationMetadata | null;
98
+ agentId: string | null;
99
+ projectId: string;
100
+ tenantId: string;
101
+ title: string | null;
102
102
  activeSubAgentId: string;
103
103
  lastContextResolution: string | null;
104
104
  } | undefined>;
@@ -124,17 +124,17 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
124
124
  id: string;
125
125
  createdAt: string;
126
126
  updatedAt: string;
127
- agentId: string | null;
128
- projectId: string;
129
- tenantId: string;
130
- title: string | null;
131
- metadata: ConversationMetadata | null;
132
127
  ref: {
133
128
  type: "commit" | "tag" | "branch";
134
129
  name: string;
135
130
  hash: string;
136
131
  } | null;
137
132
  userId: string | null;
133
+ metadata: ConversationMetadata | null;
134
+ agentId: string | null;
135
+ projectId: string;
136
+ tenantId: string;
137
+ title: string | null;
138
138
  activeSubAgentId: string;
139
139
  lastContextResolution: string | null;
140
140
  }>;
@@ -156,17 +156,17 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
156
156
  id: string;
157
157
  createdAt: string;
158
158
  updatedAt: string;
159
- agentId: string | null;
160
- projectId: string;
161
- tenantId: string;
162
- title: string | null;
163
- metadata: ConversationMetadata | null;
164
159
  ref: {
165
160
  type: "commit" | "tag" | "branch";
166
161
  name: string;
167
162
  hash: string;
168
163
  } | null;
169
164
  userId: string | null;
165
+ metadata: ConversationMetadata | null;
166
+ agentId: string | null;
167
+ projectId: string;
168
+ tenantId: string;
169
+ title: string | null;
170
170
  activeSubAgentId: string;
171
171
  lastContextResolution: string | null;
172
172
  } | undefined>;
@@ -13,23 +13,23 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
13
13
  id: string;
14
14
  createdAt: string;
15
15
  updatedAt: string;
16
+ metadata: MessageMetadata | null;
17
+ role: string;
16
18
  projectId: string;
17
19
  tenantId: string;
18
- metadata: MessageMetadata | null;
19
20
  content: MessageContent;
20
- role: string;
21
- conversationId: string;
22
21
  fromSubAgentId: string | null;
23
22
  toSubAgentId: string | null;
24
23
  fromExternalAgentId: string | null;
25
24
  toExternalAgentId: string | null;
25
+ taskId: string | null;
26
+ a2aTaskId: string | null;
27
+ conversationId: string;
26
28
  fromTeamAgentId: string | null;
27
29
  toTeamAgentId: string | null;
28
30
  visibility: string;
29
31
  messageType: string;
30
- taskId: string | null;
31
32
  parentMessageId: string | null;
32
- a2aTaskId: string | null;
33
33
  a2aSessionId: string | null;
34
34
  } | undefined>;
35
35
  declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
@@ -147,23 +147,23 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
147
147
  id: string;
148
148
  createdAt: string;
149
149
  updatedAt: string;
150
+ metadata: MessageMetadata | null;
151
+ role: string;
150
152
  projectId: string;
151
153
  tenantId: string;
152
- metadata: MessageMetadata | null;
153
154
  content: MessageContent;
154
- role: string;
155
- conversationId: string;
156
155
  fromSubAgentId: string | null;
157
156
  toSubAgentId: string | null;
158
157
  fromExternalAgentId: string | null;
159
158
  toExternalAgentId: string | null;
159
+ taskId: string | null;
160
+ a2aTaskId: string | null;
161
+ conversationId: string;
160
162
  fromTeamAgentId: string | null;
161
163
  toTeamAgentId: string | null;
162
164
  visibility: string;
163
165
  messageType: string;
164
- taskId: string | null;
165
166
  parentMessageId: string | null;
166
- a2aTaskId: string | null;
167
167
  a2aSessionId: string | null;
168
168
  }>;
169
169
  declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
@@ -200,23 +200,23 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
200
200
  id: string;
201
201
  createdAt: string;
202
202
  updatedAt: string;
203
+ metadata: MessageMetadata | null;
204
+ role: string;
203
205
  projectId: string;
204
206
  tenantId: string;
205
- metadata: MessageMetadata | null;
206
207
  content: MessageContent;
207
- role: string;
208
- conversationId: string;
209
208
  fromSubAgentId: string | null;
210
209
  toSubAgentId: string | null;
211
210
  fromExternalAgentId: string | null;
212
211
  toExternalAgentId: string | null;
212
+ taskId: string | null;
213
+ a2aTaskId: string | null;
214
+ conversationId: string;
213
215
  fromTeamAgentId: string | null;
214
216
  toTeamAgentId: string | null;
215
217
  visibility: string;
216
218
  messageType: string;
217
- taskId: string | null;
218
219
  parentMessageId: string | null;
219
- a2aTaskId: string | null;
220
220
  a2aSessionId: string | null;
221
221
  }>;
222
222
  declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
@@ -10,17 +10,17 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
10
10
  id: string;
11
11
  createdAt: string;
12
12
  updatedAt: string;
13
- agentId: string;
14
- projectId: string;
15
- tenantId: string;
16
- metadata: TaskMetadataConfig | null;
17
- subAgentId: string;
18
13
  ref: {
19
14
  type: "commit" | "tag" | "branch";
20
15
  name: string;
21
16
  hash: string;
22
17
  } | null;
18
+ metadata: TaskMetadataConfig | null;
23
19
  status: string;
20
+ agentId: string;
21
+ projectId: string;
22
+ tenantId: string;
23
+ subAgentId: string;
24
24
  contextId: string;
25
25
  }>;
26
26
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
@@ -814,13 +814,13 @@ declare const triggers: drizzle_orm_pg_core1757.PgTableWithColumns<{
814
814
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
815
815
  encoding: "hex" | "base64";
816
816
  signature: {
817
- source: "query" | "header" | "body";
817
+ source: "query" | "body" | "header";
818
818
  key: string;
819
819
  prefix?: string | undefined;
820
820
  regex?: string | undefined;
821
821
  };
822
822
  signedComponents: {
823
- source: "literal" | "header" | "body";
823
+ source: "literal" | "body" | "header";
824
824
  required: boolean;
825
825
  key?: string | undefined;
826
826
  value?: string | undefined;
@@ -851,13 +851,13 @@ declare const triggers: drizzle_orm_pg_core1757.PgTableWithColumns<{
851
851
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
852
852
  encoding: "hex" | "base64";
853
853
  signature: {
854
- source: "query" | "header" | "body";
854
+ source: "query" | "body" | "header";
855
855
  key: string;
856
856
  prefix?: string | undefined;
857
857
  regex?: string | undefined;
858
858
  };
859
859
  signedComponents: {
860
- source: "literal" | "header" | "body";
860
+ source: "literal" | "body" | "header";
861
861
  required: boolean;
862
862
  key?: string | undefined;
863
863
  value?: string | undefined;
@@ -57,7 +57,7 @@ async function closeTestRuntimeDatabase(db) {
57
57
  * This is a helper for tests that need organization records before creating projects/agents
58
58
  */
59
59
  async function createTestOrganization(db, tenantId) {
60
- const slug = tenantId.replace(/^test-tenant-/, "").substring(0, 50);
60
+ const slug = tenantId.replace(/^test-tenant-/, "");
61
61
  await db.insert(organization).values({
62
62
  id: tenantId,
63
63
  name: `Test Organization ${tenantId}`,
@@ -0,0 +1,7 @@
1
+ import { AgentsManageDatabaseClient } from "../db/manage/manage-client.js";
2
+
3
+ //#region src/dolt/advisory-lock.d.ts
4
+ declare const tryAdvisoryLock: (db: AgentsManageDatabaseClient) => (prefix: string, identifier: string) => Promise<boolean>;
5
+ declare const releaseAdvisoryLock: (db: AgentsManageDatabaseClient) => (prefix: string, identifier: string) => Promise<void>;
6
+ //#endregion
7
+ export { releaseAdvisoryLock, tryAdvisoryLock };
@@ -0,0 +1,18 @@
1
+ import { sql } from "drizzle-orm";
2
+ import { createHash } from "node:crypto";
3
+
4
+ //#region src/dolt/advisory-lock.ts
5
+ function computeLockKey(prefix, identifier) {
6
+ return createHash("sha256").update(`${prefix}${identifier}`).digest().readBigInt64BE(0);
7
+ }
8
+ const tryAdvisoryLock = (db) => async (prefix, identifier) => {
9
+ const key = computeLockKey(prefix, identifier);
10
+ return (await db.execute(sql`SELECT pg_try_advisory_lock(CAST(${key} AS bigint)) as acquired`)).rows[0]?.acquired === true;
11
+ };
12
+ const releaseAdvisoryLock = (db) => async (prefix, identifier) => {
13
+ const key = computeLockKey(prefix, identifier);
14
+ await db.execute(sql`SELECT pg_advisory_unlock(CAST(${key} AS bigint))`);
15
+ };
16
+
17
+ //#endregion
18
+ export { releaseAdvisoryLock, tryAdvisoryLock };
@@ -5,6 +5,9 @@ import { AgentsManageDatabaseClient } from "../db/manage/manage-client.js";
5
5
 
6
6
  //#region src/dolt/branches-api.d.ts
7
7
  declare const MAIN_BRANCH_SUFFIX = "main";
8
+ declare class invalidBranchParamsError extends Error {
9
+ constructor(message: string);
10
+ }
8
11
  /**
9
12
  * Get the tenant-scoped main branch name
10
13
  */
@@ -13,24 +16,23 @@ declare const getTenantMainBranch: (tenantId: string) => string;
13
16
  * Check if a branch name (without tenant/project prefix) is a protected branch
14
17
  */
15
18
  declare const isProtectedBranchName: (branchName: string) => boolean;
19
+ declare const getTempBranchSuffix: (prefix: string) => string;
20
+ declare const isTempBranchName: (fullName: string) => boolean;
16
21
  type CreateBranchParams = {
17
22
  tenantId: string;
18
23
  projectId: string;
19
24
  name: string;
20
- /** Branch to create from. Defaults to tenant main branch. */
21
- from?: string;
25
+ /** Branch name to create from. Defaults to tenant main branch. */
26
+ fromBranch?: string;
27
+ /** Commit hash to create from. Mutually exclusive with fromBranch. */
28
+ fromCommit?: string;
22
29
  /**
23
30
  * Whether to sync schema on the source branch before creating.
24
31
  * This ensures the new branch starts with the latest schema from main.
25
- * Default: true
32
+ * Default: true. Ignored when fromCommit is set.
26
33
  */
27
34
  syncSchemaOnSource?: boolean;
28
35
  };
29
- type DeleteBranchParams = {
30
- tenantId: string;
31
- projectId: string;
32
- name: string;
33
- };
34
36
  type GetBranchParams = {
35
37
  tenantId: string;
36
38
  projectId: string;
@@ -79,6 +81,7 @@ type CheckoutBranchResult = {
79
81
  * @returns Function that takes checkout params and returns checkout result
80
82
  */
81
83
  declare const checkoutBranch: (db: AgentsManageDatabaseClient) => (params: CheckoutBranchParams) => Promise<CheckoutBranchResult>;
84
+ declare const syncSchemaOnBranch: (db: AgentsManageDatabaseClient) => (branchName: string) => Promise<void>;
82
85
  /**
83
86
  * Create a new branch with optional schema synchronization.
84
87
  *
@@ -88,8 +91,15 @@ declare const checkoutBranch: (db: AgentsManageDatabaseClient) => (params: Check
88
91
  *
89
92
  * By syncing schema on the source branch first, we ensure the new branch
90
93
  * starts with the latest schema, avoiding schema conflicts later.
94
+ * If you want to create a branch from a commit hash, use the fromCommit parameter.
91
95
  */
92
96
  declare const createBranch: (db: AgentsManageDatabaseClient) => (params: CreateBranchParams) => Promise<BranchInfo>;
97
+ type DeleteBranchParams = {
98
+ tenantId: string;
99
+ projectId: string;
100
+ branchName: string;
101
+ force?: boolean;
102
+ };
93
103
  /**
94
104
  * Delete a branch
95
105
  */
@@ -106,4 +116,4 @@ declare const getBranch: (db: AgentsManageDatabaseClient) => (params: GetBranchP
106
116
  declare const listBranches: (db: AgentsManageDatabaseClient) => (params: ProjectScopeConfig) => Promise<BranchInfo[]>;
107
117
  declare const listBranchesForAgent: (db: AgentsManageDatabaseClient) => (params: AgentScopeConfig) => Promise<BranchInfo[]>;
108
118
  //#endregion
109
- export { CheckoutBranchParams, CheckoutBranchResult, CreateBranchParams, DeleteBranchParams, GetBranchParams, MAIN_BRANCH_SUFFIX, checkoutBranch, createBranch, deleteBranch, getBranch, getTenantMainBranch, isProtectedBranchName, listBranches, listBranchesForAgent };
119
+ export { CheckoutBranchParams, CheckoutBranchResult, CreateBranchParams, DeleteBranchParams, GetBranchParams, MAIN_BRANCH_SUFFIX, checkoutBranch, createBranch, deleteBranch, getBranch, getTempBranchSuffix, getTenantMainBranch, invalidBranchParamsError, isProtectedBranchName, isTempBranchName, listBranches, listBranchesForAgent, syncSchemaOnBranch };