@inkeep/agents-core 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/auth/auth.d.ts +4 -2
  2. package/dist/auth/auth.js +4 -3
  3. package/dist/auth/authz/client.d.ts +0 -1
  4. package/dist/auth/authz/client.js +0 -1
  5. package/dist/auth/authz/config.d.ts +1 -7
  6. package/dist/auth/authz/config.js +1 -9
  7. package/dist/auth/authz/index.d.ts +2 -2
  8. package/dist/auth/authz/index.js +2 -2
  9. package/dist/auth/authz/permissions.js +4 -8
  10. package/dist/auth/authz/sync.js +1 -11
  11. package/dist/auth/init.d.ts +1 -0
  12. package/dist/auth/init.js +115 -0
  13. package/dist/client-exports.d.ts +2 -6
  14. package/dist/client-exports.js +3 -7
  15. package/dist/constants/otel-attributes.d.ts +5 -0
  16. package/dist/constants/otel-attributes.js +8 -3
  17. package/dist/constants/signoz-queries.d.ts +1 -0
  18. package/dist/constants/signoz-queries.js +2 -1
  19. package/dist/data-access/index.d.ts +3 -2
  20. package/dist/data-access/index.js +3 -2
  21. package/dist/data-access/manage/agentFull.js +42 -1
  22. package/dist/data-access/manage/agents.d.ts +9 -9
  23. package/dist/data-access/manage/artifactComponents.d.ts +4 -4
  24. package/dist/data-access/manage/artifactComponents.js +1 -1
  25. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  26. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  27. package/dist/data-access/manage/dataComponents.js +1 -1
  28. package/dist/data-access/manage/functionTools.d.ts +8 -8
  29. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  30. package/dist/data-access/manage/subAgentRelations.d.ts +22 -22
  31. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  32. package/dist/data-access/manage/subAgents.d.ts +3 -3
  33. package/dist/data-access/manage/tools.d.ts +26 -21
  34. package/dist/data-access/manage/tools.js +20 -1
  35. package/dist/data-access/runtime/apiKeys.d.ts +4 -4
  36. package/dist/data-access/runtime/cascade-delete.d.ts +48 -1
  37. package/dist/data-access/runtime/cascade-delete.js +52 -2
  38. package/dist/data-access/runtime/conversations.d.ts +19 -19
  39. package/dist/data-access/runtime/github-work-app-installations.d.ts +261 -0
  40. package/dist/data-access/runtime/github-work-app-installations.js +457 -0
  41. package/dist/data-access/runtime/messages.d.ts +15 -15
  42. package/dist/data-access/runtime/organizations.js +2 -2
  43. package/dist/data-access/runtime/tasks.d.ts +4 -4
  44. package/dist/db/manage/manage-schema.d.ts +318 -301
  45. package/dist/db/manage/manage-schema.js +1 -0
  46. package/dist/db/runtime/runtime-schema.d.ts +1009 -165
  47. package/dist/db/runtime/runtime-schema.js +173 -5
  48. package/dist/dolt/branch.js +1 -1
  49. package/dist/dolt/branches-api.js +1 -1
  50. package/dist/dolt/index.js +3 -3
  51. package/dist/dolt/migrate-all-branches.js +1 -1
  52. package/dist/dolt/ref-helpers.js +1 -1
  53. package/dist/dolt/ref-middleware.js +1 -1
  54. package/dist/dolt/ref-scope.js +1 -1
  55. package/dist/env.d.ts +6 -4
  56. package/dist/env.js +11 -10
  57. package/dist/index.d.ts +8 -9
  58. package/dist/index.js +18 -19
  59. package/dist/types/entities.d.ts +9 -2
  60. package/dist/types/index.d.ts +3 -3
  61. package/dist/types/utility.d.ts +16 -2
  62. package/dist/validation/agentFull.js +1 -1
  63. package/dist/validation/dolt-schemas.d.ts +1 -1
  64. package/dist/validation/drizzle-schema-helpers.d.ts +4 -23
  65. package/dist/validation/drizzle-schema-helpers.js +3 -30
  66. package/dist/validation/index.d.ts +2 -4
  67. package/dist/validation/index.js +4 -6
  68. package/dist/validation/schemas.d.ts +3233 -1440
  69. package/dist/validation/schemas.js +164 -79
  70. package/drizzle/manage/0006_fixed_umar.sql +1 -0
  71. package/drizzle/manage/meta/0006_snapshot.json +3148 -0
  72. package/drizzle/manage/meta/_journal.json +7 -0
  73. package/drizzle/runtime/0010_previous_black_knight.sql +84 -0
  74. package/drizzle/runtime/meta/0010_snapshot.json +3066 -0
  75. package/drizzle/runtime/meta/_journal.json +7 -0
  76. package/package.json +4 -2
  77. package/dist/validation/id-validation.d.ts +0 -24
  78. package/dist/validation/id-validation.js +0 -52
@@ -0,0 +1,261 @@
1
+ import { WorkAppGitHubInstallationStatus } from "../../types/utility.js";
2
+ import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
+ import { McpTool, ToolSelect, WorkAppGitHubInstallationInsert, WorkAppGitHubInstallationSelect, WorkAppGitHubProjectRepositoryAccessSelect, WorkAppGitHubRepositoryInput, WorkAppGitHubRepositorySelect } from "../../types/entities.js";
4
+
5
+ //#region src/data-access/runtime/github-work-app-installations.d.ts
6
+
7
+ /**
8
+ * Create a new GitHub App installation record
9
+ */
10
+ declare const createInstallation: (db: AgentsRunDatabaseClient) => (input: WorkAppGitHubInstallationInsert) => Promise<WorkAppGitHubInstallationSelect>;
11
+ /**
12
+ * Get installation by GitHub installation ID
13
+ */
14
+ declare const getInstallationByGitHubId: (db: AgentsRunDatabaseClient) => (gitHubInstallationId: string) => Promise<WorkAppGitHubInstallationSelect | null>;
15
+ /**
16
+ * Get installation by internal ID with tenant validation
17
+ */
18
+ declare const getInstallationById: (db: AgentsRunDatabaseClient) => (params: {
19
+ tenantId: string;
20
+ id: string;
21
+ }) => Promise<WorkAppGitHubInstallationSelect | null>;
22
+ /**
23
+ * Get all installations for a tenant
24
+ */
25
+ declare const getInstallationsByTenantId: (db: AgentsRunDatabaseClient) => (params: {
26
+ tenantId: string;
27
+ includeDisconnected?: boolean;
28
+ }) => Promise<WorkAppGitHubInstallationSelect[]>;
29
+ /**
30
+ * Update installation status
31
+ */
32
+ declare const updateInstallationStatus: (db: AgentsRunDatabaseClient) => (params: {
33
+ tenantId: string;
34
+ id: string;
35
+ status: WorkAppGitHubInstallationStatus;
36
+ }) => Promise<WorkAppGitHubInstallationSelect | null>;
37
+ /**
38
+ * Update installation status by GitHub installation ID (for webhook handlers)
39
+ */
40
+ declare const updateInstallationStatusByGitHubId: (db: AgentsRunDatabaseClient) => (params: {
41
+ gitHubInstallationId: string;
42
+ status: WorkAppGitHubInstallationStatus;
43
+ }) => Promise<WorkAppGitHubInstallationSelect | null>;
44
+ /**
45
+ * Soft delete an installation (set status to 'disconnected')
46
+ * Also removes all project repository access for this installation's repositories
47
+ */
48
+ declare const disconnectInstallation: (db: AgentsRunDatabaseClient) => (params: {
49
+ tenantId: string;
50
+ id: string;
51
+ }) => Promise<boolean>;
52
+ /**
53
+ * Delete an installation (hard delete)
54
+ * Returns the deleted installation if found, null otherwise
55
+ */
56
+ declare const deleteInstallation: (db: AgentsRunDatabaseClient) => (params: {
57
+ tenantId: string;
58
+ id: string;
59
+ }) => Promise<WorkAppGitHubInstallationSelect | null>;
60
+ /**
61
+ * Sync repositories for an installation
62
+ * Adds new repos, removes missing repos, updates existing
63
+ */
64
+ declare const syncRepositories: (db: AgentsRunDatabaseClient) => (params: {
65
+ installationId: string;
66
+ repositories: WorkAppGitHubRepositoryInput[];
67
+ }) => Promise<{
68
+ added: number;
69
+ removed: number;
70
+ updated: number;
71
+ }>;
72
+ /**
73
+ * Add repositories to an installation (for webhook 'added' events)
74
+ */
75
+ declare const addRepositories: (db: AgentsRunDatabaseClient) => (params: {
76
+ installationId: string;
77
+ repositories: WorkAppGitHubRepositoryInput[];
78
+ }) => Promise<WorkAppGitHubRepositorySelect[]>;
79
+ /**
80
+ * Remove repositories from an installation (for webhook 'removed' events)
81
+ * Also removes associated project repository access entries
82
+ */
83
+ declare const removeRepositories: (db: AgentsRunDatabaseClient) => (params: {
84
+ installationId: string;
85
+ repositoryIds: string[];
86
+ }) => Promise<number>;
87
+ /**
88
+ * Get all repositories for an installation
89
+ */
90
+ declare const getRepositoriesByInstallationId: (db: AgentsRunDatabaseClient) => (installationId: string) => Promise<WorkAppGitHubRepositorySelect[]>;
91
+ /**
92
+ * Get repository by full name (e.g., "org/repo")
93
+ */
94
+ declare const getRepositoryByFullName: (db: AgentsRunDatabaseClient) => (repositoryFullName: string) => Promise<WorkAppGitHubRepositorySelect | null>;
95
+ /**
96
+ * Get repository by internal ID
97
+ */
98
+ declare const getRepositoryById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<WorkAppGitHubRepositorySelect | null>;
99
+ /**
100
+ * Get all repositories for a tenant (across all installations)
101
+ */
102
+ declare const getRepositoriesByTenantId: (db: AgentsRunDatabaseClient) => (tenantId: string) => Promise<(WorkAppGitHubRepositorySelect & {
103
+ installationAccountLogin: string;
104
+ installationId: string;
105
+ })[]>;
106
+ /**
107
+ * Set project repository access (full replacement)
108
+ * Used when mode='selected' to specify which repositories the project can access.
109
+ * Pass empty array to clear all access entries.
110
+ *
111
+ * Also cascades changes to MCP tools: any MCP tool in this project with mode='selected'
112
+ * will have its selected repositories filtered to only include repos that remain
113
+ * in the project's access list.
114
+ */
115
+ declare const setProjectRepositoryAccess: (db: AgentsRunDatabaseClient) => (params: {
116
+ tenantId: string;
117
+ projectId: string;
118
+ repositoryIds: string[];
119
+ }) => Promise<void>;
120
+ /**
121
+ * Get project repository access entries
122
+ * These entries are used when mode='selected'. Check mode via getProjectAccessMode().
123
+ */
124
+ declare const getProjectRepositoryAccess: (db: AgentsRunDatabaseClient) => (projectId: string) => Promise<WorkAppGitHubProjectRepositoryAccessSelect[]>;
125
+ /**
126
+ * Get project repository access with full repository details.
127
+ * If project access mode is 'all', returns all tenant repositories.
128
+ * If mode is 'selected' (or not set), returns only explicitly granted repositories.
129
+ */
130
+ declare const getProjectRepositoryAccessWithDetails: (db: AgentsRunDatabaseClient) => (params: {
131
+ tenantId: string;
132
+ projectId: string;
133
+ }) => Promise<(WorkAppGitHubRepositorySelect & {
134
+ accessId: string;
135
+ installationAccountLogin: string;
136
+ installationId: string;
137
+ })[]>;
138
+ /**
139
+ * Check if a project has access to a specific repository
140
+ * Returns true if:
141
+ * - Project mode is 'all' and repository belongs to tenant installations
142
+ * - Project mode is 'selected' and repository is explicitly in the project's access list
143
+ */
144
+ declare const checkProjectRepositoryAccess: (db: AgentsRunDatabaseClient) => (params: {
145
+ projectId: string;
146
+ repositoryFullName: string;
147
+ tenantId: string;
148
+ }) => Promise<{
149
+ hasAccess: boolean;
150
+ reason: string;
151
+ }>;
152
+ /**
153
+ * Remove all project repository access for a specific project
154
+ */
155
+ declare const clearProjectRepositoryAccess: (db: AgentsRunDatabaseClient) => (projectId: string) => Promise<number>;
156
+ /**
157
+ * Validate that all repository IDs belong to installations owned by a tenant
158
+ * Returns list of invalid repository IDs
159
+ */
160
+ declare const validateRepositoryOwnership: (db: AgentsRunDatabaseClient) => (params: {
161
+ tenantId: string;
162
+ repositoryIds: string[];
163
+ }) => Promise<string[]>;
164
+ /**
165
+ * Get repository count for an installation
166
+ */
167
+ declare const getRepositoryCount: (db: AgentsRunDatabaseClient) => (installationId: string) => Promise<number>;
168
+ /**
169
+ * Get repository counts for all installations belonging to a tenant
170
+ */
171
+ declare const getRepositoryCountsByTenantId: (db: AgentsRunDatabaseClient) => (params: {
172
+ tenantId: string;
173
+ includeDisconnected?: boolean;
174
+ }) => Promise<Map<string, number>>;
175
+ /**
176
+ * Set MCP tool repository access (full replacement)
177
+ * Used when mode='selected' to specify which repositories the tool can access.
178
+ * Pass empty array to clear all access entries.
179
+ */
180
+ declare const setMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (params: {
181
+ toolId: string;
182
+ tenantId: string;
183
+ projectId: string;
184
+ repositoryIds: string[];
185
+ }) => Promise<void>;
186
+ /**
187
+ * Get MCP tool repository access entries
188
+ * These entries are used when mode='selected'. Check mode via getMcpToolAccessMode().
189
+ */
190
+ declare const getMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (toolId: string) => Promise<{
191
+ id: string;
192
+ toolId: string;
193
+ tenantId: string;
194
+ projectId: string;
195
+ repositoryDbId: string;
196
+ createdAt: string;
197
+ updatedAt: string;
198
+ }[]>;
199
+ /**
200
+ * Get MCP tool repository access with full repository details.
201
+ * If the tool's access mode is 'all', returns all repositories the project has access to.
202
+ * If mode is 'selected' (or not set), returns only explicitly granted repositories.
203
+ */
204
+ declare const getMcpToolRepositoryAccessWithDetails: (db: AgentsRunDatabaseClient) => (toolId: string) => Promise<(WorkAppGitHubRepositorySelect & {
205
+ accessId: string;
206
+ installationAccountLogin: string;
207
+ installationId: string;
208
+ })[]>;
209
+ /**
210
+ * Remove all MCP tool repository access for a specific tool
211
+ */
212
+ declare const clearMcpToolRepositoryAccess: (db: AgentsRunDatabaseClient) => (toolId: string) => Promise<number>;
213
+ declare const isGithubWorkAppTool: (tool: ToolSelect | McpTool) => boolean | undefined;
214
+ type WorkAppGitHubAccessMode = 'all' | 'selected';
215
+ /**
216
+ * Set the access mode for a project's GitHub repository access.
217
+ * - 'all': Project has access to all repositories from tenant GitHub installations
218
+ * - 'selected': Project only has access to repositories listed in work_app_github_project_repository_access
219
+ */
220
+ declare const setProjectAccessMode: (db: AgentsRunDatabaseClient) => (params: {
221
+ tenantId: string;
222
+ projectId: string;
223
+ mode: WorkAppGitHubAccessMode;
224
+ }) => Promise<void>;
225
+ /**
226
+ * Get the access mode for a project's GitHub repository access.
227
+ * Returns 'selected' if no mode is explicitly set (fail-safe default).
228
+ */
229
+ declare const getProjectAccessMode: (db: AgentsRunDatabaseClient) => (params: {
230
+ tenantId: string;
231
+ projectId: string;
232
+ }) => Promise<WorkAppGitHubAccessMode>;
233
+ /**
234
+ * Delete the access mode entry for a project
235
+ */
236
+ declare const deleteProjectAccessMode: (db: AgentsRunDatabaseClient) => (params: {
237
+ tenantId: string;
238
+ projectId: string;
239
+ }) => Promise<boolean>;
240
+ /**
241
+ * Set the access mode for an MCP tool's GitHub repository access.
242
+ * - 'all': Tool has access to all repositories the project has access to
243
+ * - 'selected': Tool only has access to repositories listed in work_app_github_mcp_tool_repository_access
244
+ */
245
+ declare const setMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (params: {
246
+ toolId: string;
247
+ tenantId: string;
248
+ projectId: string;
249
+ mode: WorkAppGitHubAccessMode;
250
+ }) => Promise<void>;
251
+ /**
252
+ * Get the access mode for an MCP tool's GitHub repository access.
253
+ * Returns 'selected' if no mode is explicitly set (fail-safe default).
254
+ */
255
+ declare const getMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (toolId: string) => Promise<WorkAppGitHubAccessMode>;
256
+ /**
257
+ * Delete the access mode entry for an MCP tool
258
+ */
259
+ declare const deleteMcpToolAccessMode: (db: AgentsRunDatabaseClient) => (toolId: string) => Promise<boolean>;
260
+ //#endregion
261
+ export { WorkAppGitHubAccessMode, addRepositories, checkProjectRepositoryAccess, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, createInstallation, deleteInstallation, deleteMcpToolAccessMode, deleteProjectAccessMode, disconnectInstallation, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getMcpToolAccessMode, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getProjectAccessMode, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, isGithubWorkAppTool, removeRepositories, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, syncRepositories, updateInstallationStatus, updateInstallationStatusByGitHubId, validateRepositoryOwnership };