@inkeep/agents-core 0.0.0-dev-20260202155313 → 0.0.0-dev-20260203023016

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-validation-schemas.d.ts +146 -146
  2. package/dist/auth/auth.d.ts +53 -53
  3. package/dist/auth/permissions.d.ts +13 -13
  4. package/dist/client-exports.d.ts +11 -11
  5. package/dist/data-access/index.d.ts +3 -2
  6. package/dist/data-access/index.js +3 -2
  7. package/dist/data-access/manage/agents.d.ts +17 -17
  8. package/dist/data-access/manage/artifactComponents.d.ts +2 -2
  9. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  10. package/dist/data-access/manage/functionTools.d.ts +4 -4
  11. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  12. package/dist/data-access/manage/subAgentRelations.d.ts +4 -4
  13. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  14. package/dist/data-access/manage/subAgents.d.ts +15 -15
  15. package/dist/data-access/manage/tools.d.ts +14 -9
  16. package/dist/data-access/manage/tools.js +20 -1
  17. package/dist/data-access/manage/triggers.d.ts +2 -2
  18. package/dist/data-access/runtime/cascade-delete.d.ts +48 -1
  19. package/dist/data-access/runtime/cascade-delete.js +52 -2
  20. package/dist/data-access/runtime/conversations.d.ts +7 -7
  21. package/dist/data-access/runtime/github-work-app-installations.d.ts +261 -0
  22. package/dist/data-access/runtime/github-work-app-installations.js +457 -0
  23. package/dist/data-access/runtime/messages.d.ts +3 -3
  24. package/dist/data-access/runtime/tasks.d.ts +3 -3
  25. package/dist/db/manage/manage-schema.d.ts +322 -305
  26. package/dist/db/manage/manage-schema.js +1 -0
  27. package/dist/db/runtime/runtime-schema.d.ts +1009 -165
  28. package/dist/db/runtime/runtime-schema.js +173 -5
  29. package/dist/dolt/branch.js +1 -1
  30. package/dist/dolt/branches-api.js +1 -1
  31. package/dist/dolt/index.js +3 -3
  32. package/dist/dolt/migrate-all-branches.js +1 -1
  33. package/dist/dolt/ref-helpers.js +1 -1
  34. package/dist/dolt/ref-middleware.js +1 -1
  35. package/dist/dolt/ref-scope.js +1 -1
  36. package/dist/env.d.ts +2 -0
  37. package/dist/env.js +2 -1
  38. package/dist/index.d.ts +7 -6
  39. package/dist/index.js +11 -10
  40. package/dist/types/entities.d.ts +9 -2
  41. package/dist/types/index.d.ts +3 -3
  42. package/dist/types/utility.d.ts +16 -2
  43. package/dist/validation/dolt-schemas.d.ts +1 -1
  44. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  45. package/dist/validation/index.d.ts +2 -2
  46. package/dist/validation/index.js +2 -2
  47. package/dist/validation/schemas.d.ts +3396 -1592
  48. package/dist/validation/schemas.js +48 -2
  49. package/drizzle/manage/0006_fixed_umar.sql +1 -0
  50. package/drizzle/manage/meta/0006_snapshot.json +3148 -0
  51. package/drizzle/manage/meta/_journal.json +7 -0
  52. package/drizzle/runtime/0010_previous_black_knight.sql +84 -0
  53. package/drizzle/runtime/meta/0010_snapshot.json +3066 -0
  54. package/drizzle/runtime/meta/_journal.json +7 -0
  55. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "../../_virtual/rolldown_runtime.js";
2
2
  import { account, deviceCode, invitation, member, organization, session, ssoProvider, user, verification } from "../../auth/auth-schema.js";
3
3
  import { relations } from "drizzle-orm";
4
- import { foreignKey, index, jsonb, pgTable, primaryKey, text, timestamp, unique, varchar } from "drizzle-orm/pg-core";
4
+ import { boolean, foreignKey, index, jsonb, pgTable, primaryKey, text, timestamp, unique, varchar } from "drizzle-orm/pg-core";
5
5
 
6
6
  //#region src/db/runtime/runtime-schema.ts
7
7
  var runtime_schema_exports = /* @__PURE__ */ __exportAll({
@@ -31,11 +31,24 @@ var runtime_schema_exports = /* @__PURE__ */ __exportAll({
31
31
  tasksRelations: () => tasksRelations,
32
32
  triggerInvocations: () => triggerInvocations,
33
33
  user: () => user,
34
- verification: () => verification
34
+ verification: () => verification,
35
+ workAppGitHubInstallations: () => workAppGitHubInstallations,
36
+ workAppGitHubInstallationsRelations: () => workAppGitHubInstallationsRelations,
37
+ workAppGitHubMcpToolAccessMode: () => workAppGitHubMcpToolAccessMode,
38
+ workAppGitHubMcpToolRepositoryAccess: () => workAppGitHubMcpToolRepositoryAccess,
39
+ workAppGitHubMcpToolRepositoryAccessRelations: () => workAppGitHubMcpToolRepositoryAccessRelations,
40
+ workAppGitHubProjectAccessMode: () => workAppGitHubProjectAccessMode,
41
+ workAppGitHubProjectRepositoryAccess: () => workAppGitHubProjectRepositoryAccess,
42
+ workAppGitHubProjectRepositoryAccessRelations: () => workAppGitHubProjectRepositoryAccessRelations,
43
+ workAppGitHubRepositories: () => workAppGitHubRepositories,
44
+ workAppGitHubRepositoriesRelations: () => workAppGitHubRepositoriesRelations
35
45
  });
36
- const projectScoped = {
46
+ const tenantScoped = {
37
47
  tenantId: varchar("tenant_id", { length: 256 }).notNull(),
38
- id: varchar("id", { length: 256 }).notNull(),
48
+ id: varchar("id", { length: 256 }).notNull()
49
+ };
50
+ const projectScoped = {
51
+ ...tenantScoped,
39
52
  projectId: varchar("project_id", { length: 256 }).notNull()
40
53
  };
41
54
  const agentScoped = {
@@ -478,6 +491,161 @@ const ledgerArtifactsRelations = relations(ledgerArtifacts, ({ one }) => ({ task
478
491
  fields: [ledgerArtifacts.taskId],
479
492
  references: [tasks.id]
480
493
  }) }));
494
+ /**
495
+ * Tracks GitHub App installations linked to tenants.
496
+ * One tenant can have multiple installations (e.g., multiple orgs).
497
+ * The installation_id is the GitHub-assigned ID, unique across all GitHub.
498
+ */
499
+ const workAppGitHubInstallations = pgTable("work_app_github_installations", {
500
+ ...tenantScoped,
501
+ installationId: text("installation_id").notNull().unique(),
502
+ accountLogin: varchar("account_login", { length: 256 }).notNull(),
503
+ accountId: text("account_id").notNull(),
504
+ accountType: varchar("account_type", { length: 20 }).$type().notNull(),
505
+ status: varchar("status", { length: 20 }).$type().notNull().default("active"),
506
+ ...timestamps
507
+ }, (table) => [
508
+ index("work_app_github_installations_tenant_idx").on(table.tenantId),
509
+ index("work_app_github_installations_installation_id_idx").on(table.installationId),
510
+ foreignKey({
511
+ columns: [table.tenantId],
512
+ foreignColumns: [organization.id],
513
+ name: "work_app_github_installations_organization_fk"
514
+ }).onDelete("cascade")
515
+ ]);
516
+ /**
517
+ * Repositories accessible through a GitHub App installation.
518
+ * These are synced from GitHub when the app is installed or updated.
519
+ * The repository_id is the GitHub-assigned ID, unique across all GitHub.
520
+ */
521
+ const workAppGitHubRepositories = pgTable("work_app_github_repositories", {
522
+ id: varchar("id", { length: 256 }).primaryKey(),
523
+ installationDbId: varchar("installation_db_id", { length: 256 }).notNull(),
524
+ repositoryId: text("repository_id").notNull(),
525
+ repositoryName: varchar("repository_name", { length: 256 }).notNull(),
526
+ repositoryFullName: varchar("repository_full_name", { length: 512 }).notNull(),
527
+ private: boolean("private").notNull().default(false),
528
+ ...timestamps
529
+ }, (table) => [
530
+ index("work_app_github_repositories_installation_idx").on(table.installationDbId),
531
+ index("work_app_github_repositories_full_name_idx").on(table.repositoryFullName),
532
+ unique("work_app_github_repositories_repo_installation_unique").on(table.installationDbId, table.repositoryId),
533
+ foreignKey({
534
+ columns: [table.installationDbId],
535
+ foreignColumns: [workAppGitHubInstallations.id],
536
+ name: "work_app_github_repositories_installation_fk"
537
+ }).onDelete("cascade")
538
+ ]);
539
+ /**
540
+ * Links projects to specific GitHub repositories for fine-grained access control.
541
+ * When a project has entries here, only the listed repositories are accessible.
542
+ * When no entries exist for a project, all tenant repositories are accessible (mode='all').
543
+ * The tenant_id and project_id reference the projects table in the manage schema
544
+ * (cross-schema, no FK constraint for project). tenant_id is included because
545
+ * project IDs are only unique within a tenant.
546
+ */
547
+ const workAppGitHubProjectRepositoryAccess = pgTable("work_app_github_project_repository_access", {
548
+ ...projectScoped,
549
+ repositoryDbId: varchar("repository_db_id", { length: 256 }).notNull(),
550
+ ...timestamps
551
+ }, (table) => [
552
+ index("work_app_github_project_repository_access_tenant_idx").on(table.tenantId),
553
+ index("work_app_github_project_repository_access_project_idx").on(table.projectId),
554
+ unique("work_app_github_project_repository_access_unique").on(table.tenantId, table.projectId, table.repositoryDbId),
555
+ foreignKey({
556
+ columns: [table.tenantId],
557
+ foreignColumns: [organization.id],
558
+ name: "work_app_github_project_repository_access_tenant_fk"
559
+ }).onDelete("cascade"),
560
+ foreignKey({
561
+ columns: [table.repositoryDbId],
562
+ foreignColumns: [workAppGitHubRepositories.id],
563
+ name: "work_app_github_project_repository_access_repo_fk"
564
+ }).onDelete("cascade")
565
+ ]);
566
+ /**
567
+ * Links MCP tools to specific GitHub repositories for repository-scoped access.
568
+ * When an MCP tool has entries here, only the listed repositories are accessible to that tool.
569
+ * The tool_id, tenant_id, and project_id reference the tools table in the manage schema
570
+ * (cross-schema, no FK constraint). These are denormalized here so all GitHub access
571
+ * info can be queried from PostgreSQL alone.
572
+ */
573
+ const workAppGitHubMcpToolRepositoryAccess = pgTable("work_app_github_mcp_tool_repository_access", {
574
+ ...projectScoped,
575
+ toolId: varchar("tool_id", { length: 256 }).notNull(),
576
+ repositoryDbId: varchar("repository_db_id", { length: 256 }).notNull(),
577
+ ...timestamps
578
+ }, (table) => [
579
+ index("work_app_github_mcp_tool_repository_access_tool_idx").on(table.toolId),
580
+ index("work_app_github_mcp_tool_repository_access_tenant_idx").on(table.tenantId),
581
+ index("work_app_github_mcp_tool_repository_access_project_idx").on(table.projectId),
582
+ unique("work_app_github_mcp_tool_repository_access_unique").on(table.toolId, table.repositoryDbId),
583
+ foreignKey({
584
+ columns: [table.tenantId],
585
+ foreignColumns: [organization.id],
586
+ name: "work_app_github_mcp_tool_repository_access_tenant_fk"
587
+ }).onDelete("cascade"),
588
+ foreignKey({
589
+ columns: [table.repositoryDbId],
590
+ foreignColumns: [workAppGitHubRepositories.id],
591
+ name: "work_app_github_mcp_tool_repository_access_repo_fk"
592
+ }).onDelete("cascade")
593
+ ]);
594
+ /**
595
+ * Stores the explicit access mode for project-level GitHub repository access.
596
+ * - 'all': Project has access to all repositories from tenant GitHub installations
597
+ * - 'selected': Project only has access to repositories listed in work_app_github_project_repository_access
598
+ * If no row exists for a project, defaults to 'selected' (fail-safe: no access unless explicitly granted).
599
+ */
600
+ const workAppGitHubProjectAccessMode = pgTable("work_app_github_project_access_mode", {
601
+ tenantId: varchar("tenant_id", { length: 256 }).notNull(),
602
+ projectId: varchar("project_id", { length: 256 }).notNull(),
603
+ mode: varchar("mode", { length: 20 }).$type().notNull(),
604
+ ...timestamps
605
+ }, (table) => [primaryKey({ columns: [table.tenantId, table.projectId] }), foreignKey({
606
+ columns: [table.tenantId],
607
+ foreignColumns: [organization.id],
608
+ name: "work_app_github_project_access_mode_tenant_fk"
609
+ }).onDelete("cascade")]);
610
+ /**
611
+ * Stores the explicit access mode for MCP tool-level GitHub repository access.
612
+ * - 'all': Tool has access to all repositories the project has access to
613
+ * - 'selected': Tool only has access to repositories listed in work_app_github_mcp_tool_repository_access
614
+ * If no row exists for a tool, defaults to 'selected' (fail-safe: no access unless explicitly granted).
615
+ */
616
+ const workAppGitHubMcpToolAccessMode = pgTable("work_app_github_mcp_tool_access_mode", {
617
+ toolId: varchar("tool_id", { length: 256 }).notNull(),
618
+ tenantId: varchar("tenant_id", { length: 256 }).notNull(),
619
+ projectId: varchar("project_id", { length: 256 }).notNull(),
620
+ mode: varchar("mode", { length: 20 }).$type().notNull(),
621
+ ...timestamps
622
+ }, (table) => [
623
+ primaryKey({ columns: [table.toolId] }),
624
+ index("work_app_github_mcp_tool_access_mode_tenant_idx").on(table.tenantId),
625
+ index("work_app_github_mcp_tool_access_mode_project_idx").on(table.projectId),
626
+ foreignKey({
627
+ columns: [table.tenantId],
628
+ foreignColumns: [organization.id],
629
+ name: "work_app_github_mcp_tool_access_mode_tenant_fk"
630
+ }).onDelete("cascade")
631
+ ]);
632
+ const workAppGitHubInstallationsRelations = relations(workAppGitHubInstallations, ({ many }) => ({ repositories: many(workAppGitHubRepositories) }));
633
+ const workAppGitHubRepositoriesRelations = relations(workAppGitHubRepositories, ({ one, many }) => ({
634
+ installation: one(workAppGitHubInstallations, {
635
+ fields: [workAppGitHubRepositories.installationDbId],
636
+ references: [workAppGitHubInstallations.id]
637
+ }),
638
+ projectAccess: many(workAppGitHubProjectRepositoryAccess),
639
+ mcpToolAccess: many(workAppGitHubMcpToolRepositoryAccess)
640
+ }));
641
+ const workAppGitHubProjectRepositoryAccessRelations = relations(workAppGitHubProjectRepositoryAccess, ({ one }) => ({ repository: one(workAppGitHubRepositories, {
642
+ fields: [workAppGitHubProjectRepositoryAccess.repositoryDbId],
643
+ references: [workAppGitHubRepositories.id]
644
+ }) }));
645
+ const workAppGitHubMcpToolRepositoryAccessRelations = relations(workAppGitHubMcpToolRepositoryAccess, ({ one }) => ({ repository: one(workAppGitHubRepositories, {
646
+ fields: [workAppGitHubMcpToolRepositoryAccess.repositoryDbId],
647
+ references: [workAppGitHubRepositories.id]
648
+ }) }));
481
649
 
482
650
  //#endregion
483
- export { account, apiKeys, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, organization, projectMetadata, runtime_schema_exports, session, ssoProvider, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, verification };
651
+ export { account, apiKeys, contextCache, conversations, conversationsRelations, datasetRun, datasetRunConversationRelations, deviceCode, evaluationResult, evaluationRun, invitation, ledgerArtifacts, ledgerArtifactsRelations, member, messages, messagesRelations, organization, projectMetadata, runtime_schema_exports, session, ssoProvider, taskRelations, taskRelationsRelations, tasks, tasksRelations, triggerInvocations, user, verification, workAppGitHubInstallations, workAppGitHubInstallationsRelations, workAppGitHubMcpToolAccessMode, workAppGitHubMcpToolRepositoryAccess, workAppGitHubMcpToolRepositoryAccessRelations, workAppGitHubProjectAccessMode, workAppGitHubProjectRepositoryAccess, workAppGitHubProjectRepositoryAccessRelations, workAppGitHubRepositories, workAppGitHubRepositoriesRelations };
@@ -1,5 +1,5 @@
1
- import { doltHashOf } from "./commit.js";
2
1
  import { resolveRef } from "./ref-helpers.js";
2
+ import { doltHashOf } from "./commit.js";
3
3
  import { sql } from "drizzle-orm";
4
4
  import { logger } from "@composio/core";
5
5
 
@@ -1,5 +1,5 @@
1
- import { SCHEMA_SOURCE_BRANCH, ensureSchemaSync, getSchemaDiff, syncSchemaFromMain } from "./schema-sync.js";
2
1
  import { doltBranch, doltCheckout, doltDeleteBranch, doltGetBranchNamespace, doltListBranches } from "./branch.js";
2
+ import { SCHEMA_SOURCE_BRANCH, ensureSchemaSync, getSchemaDiff, syncSchemaFromMain } from "./schema-sync.js";
3
3
  import { sql } from "drizzle-orm";
4
4
 
5
5
  //#region src/dolt/branches-api.ts
@@ -1,9 +1,9 @@
1
- import { doltAdd, doltAddAndCommit, doltCommit, doltDeleteTag, doltHashOf, doltListTags, doltLog, doltReset, doltStatus, doltTag } from "./commit.js";
2
- import { doltAbortMerge, doltConflicts, doltMerge, doltMergeStatus, doltResolveConflicts, doltSchemaConflicts, doltTableConflicts } from "./merge.js";
3
- import { SCHEMA_SOURCE_BRANCH, areBranchesSchemaCompatible, ensureSchemaSync, formatSchemaDiffSummary, getActiveBranch, getSchemaDiff, hasSchemaDifferences, hasUncommittedChanges, isLocalhostUrl, syncSchemaFromMain } from "./schema-sync.js";
4
1
  import { MAIN_BRANCH_SUFFIX, checkoutBranch, createBranch, deleteBranch, getBranch, getTenantMainBranch, isProtectedBranchName, listBranches, listBranchesForAgent } from "./branches-api.js";
5
2
  import { checkoutRef, getCurrentBranchOrCommit, getProjectMainResolvedRef, getProjectScopedRef, getTenantScopedRef, isRefWritable, isValidCommitHash, resolveRef } from "./ref-helpers.js";
6
3
  import { doltActiveBranch, doltBranch, doltBranchExists, doltCheckout, doltDeleteBranch, doltGetBranchNamespace, doltListBranches, doltRenameBranch, ensureBranchExists } from "./branch.js";
4
+ import { doltAdd, doltAddAndCommit, doltCommit, doltDeleteTag, doltHashOf, doltListTags, doltLog, doltReset, doltStatus, doltTag } from "./commit.js";
5
+ import { doltAbortMerge, doltConflicts, doltMerge, doltMergeStatus, doltResolveConflicts, doltSchemaConflicts, doltTableConflicts } from "./merge.js";
6
+ import { SCHEMA_SOURCE_BRANCH, areBranchesSchemaCompatible, ensureSchemaSync, formatSchemaDiffSummary, getActiveBranch, getSchemaDiff, hasSchemaDifferences, hasUncommittedChanges, isLocalhostUrl, syncSchemaFromMain } from "./schema-sync.js";
7
7
  import { doltDiff, doltDiffSummary } from "./diff.js";
8
8
  import { createRefMiddleware, createWriteProtectionMiddleware, refMiddlewareFactory, writeProtectionMiddlewareFactory } from "./ref-middleware.js";
9
9
  import { NestedRefScopeError, getCurrentRefScope, getRefScopedDb, isInRefScope, withRef } from "./ref-scope.js";
@@ -1,7 +1,7 @@
1
1
  import { loadEnvironmentFiles } from "../env.js";
2
2
  import { createAgentsManageDatabaseClient } from "../db/manage/manage-client.js";
3
- import { syncSchemaFromMain } from "./schema-sync.js";
4
3
  import { doltCheckout, doltListBranches } from "./branch.js";
4
+ import { syncSchemaFromMain } from "./schema-sync.js";
5
5
  import { confirmMigration } from "../db/utils.js";
6
6
 
7
7
  //#region src/dolt/migrate-all-branches.ts
@@ -1,6 +1,6 @@
1
- import { doltHashOf, doltListTags } from "./commit.js";
2
1
  import { checkoutBranch } from "./branches-api.js";
3
2
  import { doltListBranches } from "./branch.js";
3
+ import { doltHashOf, doltListTags } from "./commit.js";
4
4
  import { sql } from "drizzle-orm";
5
5
 
6
6
  //#region src/dolt/ref-helpers.ts
@@ -1,7 +1,7 @@
1
1
  import { getLogger } from "../utils/logger.js";
2
- import { createApiError } from "../utils/error.js";
3
2
  import { isRefWritable, resolveRef } from "./ref-helpers.js";
4
3
  import { ensureBranchExists } from "./branch.js";
4
+ import { createApiError } from "../utils/error.js";
5
5
 
6
6
  //#region src/dolt/ref-middleware.ts
7
7
  const logger = getLogger("ref-middleware");
@@ -1,8 +1,8 @@
1
1
  import { manage_schema_exports } from "../db/manage/manage-schema.js";
2
2
  import { getLogger } from "../utils/logger.js";
3
3
  import { generateId } from "../utils/conversations.js";
4
- import { doltAddAndCommit, doltReset, doltStatus } from "./commit.js";
5
4
  import { checkoutBranch } from "./branches-api.js";
5
+ import { doltAddAndCommit, doltReset, doltStatus } from "./commit.js";
6
6
  import { drizzle } from "drizzle-orm/node-postgres";
7
7
  import { AsyncLocalStorage } from "node:async_hooks";
8
8
 
package/dist/env.d.ts CHANGED
@@ -18,6 +18,7 @@ declare const envSchema: z.ZodObject<{
18
18
  BETTER_AUTH_SECRET: z.ZodOptional<z.ZodString>;
19
19
  TRUSTED_ORIGIN: z.ZodOptional<z.ZodString>;
20
20
  OAUTH_PROXY_PRODUCTION_URL: z.ZodOptional<z.ZodString>;
21
+ GITHUB_MCP_API_KEY: z.ZodOptional<z.ZodString>;
21
22
  }, z.core.$strip>;
22
23
  declare const env: {
23
24
  ENVIRONMENT?: "development" | "production" | "pentest" | "test" | undefined;
@@ -30,6 +31,7 @@ declare const env: {
30
31
  BETTER_AUTH_SECRET?: string | undefined;
31
32
  TRUSTED_ORIGIN?: string | undefined;
32
33
  OAUTH_PROXY_PRODUCTION_URL?: string | undefined;
34
+ GITHUB_MCP_API_KEY?: string | undefined;
33
35
  };
34
36
  type Env = z.infer<typeof envSchema>;
35
37
  //#endregion
package/dist/env.js CHANGED
@@ -46,7 +46,8 @@ const envSchema = z.object({
46
46
  INKEEP_AGENTS_API_URL: z.string().optional(),
47
47
  BETTER_AUTH_SECRET: z.string().optional(),
48
48
  TRUSTED_ORIGIN: z.string().optional(),
49
- OAUTH_PROXY_PRODUCTION_URL: z.string().optional()
49
+ OAUTH_PROXY_PRODUCTION_URL: z.string().optional(),
50
+ GITHUB_MCP_API_KEY: z.string().optional()
50
51
  });
51
52
  const parseEnv = () => {
52
53
  try {