@inkeep/agents-core 0.41.0 → 0.41.2

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.
@@ -81,6 +81,34 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
81
81
  requireEmailVerification: false;
82
82
  autoSignIn: true;
83
83
  };
84
+ databaseHooks: {
85
+ session: {
86
+ create: {
87
+ before: (session: {
88
+ id: string;
89
+ createdAt: Date;
90
+ updatedAt: Date;
91
+ userId: string;
92
+ expiresAt: Date;
93
+ token: string;
94
+ ipAddress?: string | null | undefined;
95
+ userAgent?: string | null | undefined;
96
+ } & Record<string, unknown>) => Promise<{
97
+ data: {
98
+ activeOrganizationId: string | null;
99
+ id: string;
100
+ createdAt: Date;
101
+ updatedAt: Date;
102
+ userId: string;
103
+ expiresAt: Date;
104
+ token: string;
105
+ ipAddress?: string | null | undefined;
106
+ userAgent?: string | null | undefined;
107
+ };
108
+ }>;
109
+ };
110
+ };
111
+ };
84
112
  socialProviders: {
85
113
  google: {
86
114
  redirectURI?: string | undefined;
@@ -818,25 +846,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
818
846
  ac: better_auth_plugins0.AccessControl;
819
847
  roles: {
820
848
  member: {
821
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
822
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
849
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
850
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
823
851
  connector: "OR" | "AND";
824
852
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
825
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
853
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
826
854
  };
827
855
  admin: {
828
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
829
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
856
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
857
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
830
858
  connector: "OR" | "AND";
831
859
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
832
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
860
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
833
861
  };
834
862
  owner: {
835
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
836
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
863
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
864
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
837
865
  connector: "OR" | "AND";
838
866
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
839
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
867
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
840
868
  };
841
869
  };
842
870
  membershipLimit: number;
@@ -1097,25 +1125,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1097
1125
  ac: better_auth_plugins0.AccessControl;
1098
1126
  roles: {
1099
1127
  member: {
1100
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1101
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1128
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1129
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1102
1130
  connector: "OR" | "AND";
1103
1131
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1104
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1132
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1105
1133
  };
1106
1134
  admin: {
1107
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1108
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1135
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1136
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1109
1137
  connector: "OR" | "AND";
1110
1138
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1111
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1139
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1112
1140
  };
1113
1141
  owner: {
1114
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1115
- actions: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1142
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key] | {
1143
+ actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>[key];
1116
1144
  connector: "OR" | "AND";
1117
1145
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1118
- statements: better_auth_plugins0.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1146
+ statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins0.Statements>;
1119
1147
  };
1120
1148
  };
1121
1149
  membershipLimit: number;
package/dist/auth/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ssoProvider } from "./auth-schema.js";
1
+ import { member, ssoProvider } from "./auth-schema.js";
2
2
  import { env } from "../env.js";
3
3
  import { generateId } from "../utils/conversations.js";
4
4
  import "../utils/index.js";
@@ -11,6 +11,15 @@ import { bearer, deviceAuthorization, oAuthProxy, organization } from "better-au
11
11
 
12
12
  //#region src/auth/auth.ts
13
13
  /**
14
+ * Get the user's initial organization for a new session.
15
+ * Returns the oldest organization the user is a member of.
16
+ * See: https://www.better-auth.com/docs/plugins/organization#active-organization
17
+ */
18
+ async function getInitialOrganization(dbClient, userId) {
19
+ const [membership] = await dbClient.select({ organizationId: member.organizationId }).from(member).where(eq(member.userId, userId)).orderBy(member.createdAt).limit(1);
20
+ return membership ? { id: membership.organizationId } : null;
21
+ }
22
+ /**
14
23
  * Extracts the root domain from a URL for cross-subdomain cookie sharing.
15
24
  * For example:
16
25
  * - https://manage-api.pilot.inkeep.com -> .pilot.inkeep.com
@@ -67,6 +76,13 @@ function createAuth(config) {
67
76
  requireEmailVerification: false,
68
77
  autoSignIn: true
69
78
  },
79
+ databaseHooks: { session: { create: { before: async (session) => {
80
+ const organization$1 = await getInitialOrganization(config.dbClient, session.userId);
81
+ return { data: {
82
+ ...session,
83
+ activeOrganizationId: organization$1?.id ?? null
84
+ } };
85
+ } } } },
70
86
  socialProviders: config.socialProviders?.google && { google: {
71
87
  ...config.socialProviders.google,
72
88
  ...env.OAUTH_PROXY_PRODUCTION_URL && { redirectURI: `${env.OAUTH_PROXY_PRODUCTION_URL}/api/auth/callback/google` }
@@ -5,25 +5,25 @@ import { organizationClient } from "better-auth/client/plugins";
5
5
  //#region src/auth/permissions.d.ts
6
6
  declare const ac: AccessControl;
7
7
  declare const memberRole: {
8
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
9
- actions: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
8
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
9
+ actions: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
10
10
  connector: "OR" | "AND";
11
11
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins55.AuthorizeResponse;
12
- statements: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
12
+ statements: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
13
13
  };
14
14
  declare const adminRole: {
15
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
16
- actions: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
15
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
16
+ actions: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
17
17
  connector: "OR" | "AND";
18
18
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins55.AuthorizeResponse;
19
- statements: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
19
+ statements: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
20
20
  };
21
21
  declare const ownerRole: {
22
- authorize<K_1 extends "function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
23
- actions: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
22
+ authorize<K_1 extends "function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key] | {
23
+ actions: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>[key];
24
24
  connector: "OR" | "AND";
25
25
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins55.AuthorizeResponse;
26
- statements: better_auth_plugins55.Subset<"function" | "organization" | "member" | "invitation" | "ac" | "project" | "agent" | "sub_agent" | "tool" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
26
+ statements: better_auth_plugins55.Subset<"function" | "organization" | "agent" | "member" | "invitation" | "project" | "tool" | "ac" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team", better_auth_plugins55.Statements>;
27
27
  };
28
28
  //#endregion
29
29
  export { ac, adminRole, memberRole, organizationClient, ownerRole };
@@ -8,11 +8,14 @@ import { PgTable } from "drizzle-orm/pg-core";
8
8
  declare const getAgentById: (db: DatabaseClient) => (params: {
9
9
  scopes: AgentScopeConfig;
10
10
  }) => Promise<{
11
+ tenantId: string;
12
+ projectId: string;
11
13
  id: string;
12
14
  name: string;
15
+ description: string | null;
16
+ prompt: string | null;
13
17
  createdAt: string;
14
18
  updatedAt: string;
15
- description: string | null;
16
19
  models: {
17
20
  base?: {
18
21
  model?: string | undefined;
@@ -30,10 +33,8 @@ declare const getAgentById: (db: DatabaseClient) => (params: {
30
33
  stopWhen: {
31
34
  transferCountIs?: number | undefined;
32
35
  } | null;
33
- tenantId: string;
34
36
  defaultSubAgentId: string | null;
35
37
  contextConfigId: string | null;
36
- prompt: string | null;
37
38
  statusUpdates: {
38
39
  enabled?: boolean | undefined;
39
40
  numEvents?: number | undefined;
@@ -49,16 +50,18 @@ declare const getAgentById: (db: DatabaseClient) => (params: {
49
50
  } | undefined;
50
51
  }[] | undefined;
51
52
  } | null;
52
- projectId: string;
53
53
  } | null>;
54
54
  declare const getAgentWithDefaultSubAgent: (db: DatabaseClient) => (params: {
55
55
  scopes: AgentScopeConfig;
56
56
  }) => Promise<{
57
+ tenantId: string;
58
+ projectId: string;
57
59
  id: string;
58
60
  name: string;
61
+ description: string | null;
62
+ prompt: string | null;
59
63
  createdAt: string;
60
64
  updatedAt: string;
61
- description: string | null;
62
65
  models: {
63
66
  base?: {
64
67
  model?: string | undefined;
@@ -76,10 +79,8 @@ declare const getAgentWithDefaultSubAgent: (db: DatabaseClient) => (params: {
76
79
  stopWhen: {
77
80
  transferCountIs?: number | undefined;
78
81
  } | null;
79
- tenantId: string;
80
82
  defaultSubAgentId: string | null;
81
83
  contextConfigId: string | null;
82
- prompt: string | null;
83
84
  statusUpdates: {
84
85
  enabled?: boolean | undefined;
85
86
  numEvents?: number | undefined;
@@ -95,13 +96,16 @@ declare const getAgentWithDefaultSubAgent: (db: DatabaseClient) => (params: {
95
96
  } | undefined;
96
97
  }[] | undefined;
97
98
  } | null;
98
- projectId: string;
99
99
  defaultSubAgent: {
100
+ tenantId: string;
101
+ projectId: string;
100
102
  id: string;
101
103
  name: string;
104
+ description: string | null;
105
+ prompt: string | null;
106
+ agentId: string;
102
107
  createdAt: string;
103
108
  updatedAt: string;
104
- description: string | null;
105
109
  models: {
106
110
  base?: {
107
111
  model?: string | undefined;
@@ -119,21 +123,20 @@ declare const getAgentWithDefaultSubAgent: (db: DatabaseClient) => (params: {
119
123
  stopWhen: {
120
124
  stepCountIs?: number | undefined;
121
125
  } | null;
122
- tenantId: string;
123
- prompt: string | null;
124
- projectId: string;
125
- agentId: string;
126
126
  conversationHistoryConfig: ConversationHistoryConfig | null;
127
127
  } | null;
128
128
  } | null>;
129
129
  declare const listAgents: (db: DatabaseClient) => (params: {
130
130
  scopes: ProjectScopeConfig;
131
131
  }) => Promise<{
132
+ tenantId: string;
133
+ projectId: string;
132
134
  id: string;
133
135
  name: string;
136
+ description: string | null;
137
+ prompt: string | null;
134
138
  createdAt: string;
135
139
  updatedAt: string;
136
- description: string | null;
137
140
  models: {
138
141
  base?: {
139
142
  model?: string | undefined;
@@ -151,10 +154,8 @@ declare const listAgents: (db: DatabaseClient) => (params: {
151
154
  stopWhen: {
152
155
  transferCountIs?: number | undefined;
153
156
  } | null;
154
- tenantId: string;
155
157
  defaultSubAgentId: string | null;
156
158
  contextConfigId: string | null;
157
- prompt: string | null;
158
159
  statusUpdates: {
159
160
  enabled?: boolean | undefined;
160
161
  numEvents?: number | undefined;
@@ -170,7 +171,6 @@ declare const listAgents: (db: DatabaseClient) => (params: {
170
171
  } | undefined;
171
172
  }[] | undefined;
172
173
  } | null;
173
- projectId: string;
174
174
  }[]>;
175
175
  declare const listAgentsPaginated: (db: DatabaseClient) => (params: {
176
176
  scopes: ProjectScopeConfig;
@@ -228,11 +228,14 @@ declare const listAgentsPaginated: (db: DatabaseClient) => (params: {
228
228
  };
229
229
  }>;
230
230
  declare const createAgent: (db: DatabaseClient) => (data: AgentInsert) => Promise<{
231
+ tenantId: string;
232
+ projectId: string;
231
233
  id: string;
232
234
  name: string;
235
+ description: string | null;
236
+ prompt: string | null;
233
237
  createdAt: string;
234
238
  updatedAt: string;
235
- description: string | null;
236
239
  models: {
237
240
  base?: {
238
241
  model?: string | undefined;
@@ -250,10 +253,8 @@ declare const createAgent: (db: DatabaseClient) => (data: AgentInsert) => Promis
250
253
  stopWhen: {
251
254
  transferCountIs?: number | undefined;
252
255
  } | null;
253
- tenantId: string;
254
256
  defaultSubAgentId: string | null;
255
257
  contextConfigId: string | null;
256
- prompt: string | null;
257
258
  statusUpdates: {
258
259
  enabled?: boolean | undefined;
259
260
  numEvents?: number | undefined;
@@ -269,7 +270,6 @@ declare const createAgent: (db: DatabaseClient) => (data: AgentInsert) => Promis
269
270
  } | undefined;
270
271
  }[] | undefined;
271
272
  } | null;
272
- projectId: string;
273
273
  }>;
274
274
  declare const updateAgent: (db: DatabaseClient) => (params: {
275
275
  scopes: AgentScopeConfig;
@@ -7,49 +7,49 @@ declare const getApiKeyById: (db: DatabaseClient) => (params: {
7
7
  scopes: ProjectScopeConfig;
8
8
  id: string;
9
9
  }) => Promise<{
10
- id: string;
11
- name: string | null;
12
- createdAt: string;
13
- updatedAt: string;
14
- expiresAt: string | null;
15
10
  tenantId: string;
16
11
  projectId: string;
12
+ id: string;
13
+ name: string | null;
17
14
  agentId: string;
18
15
  publicId: string;
19
16
  keyHash: string;
20
17
  keyPrefix: string;
21
18
  lastUsedAt: string | null;
22
- } | undefined>;
23
- declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
24
- id: string;
25
- name: string | null;
19
+ expiresAt: string | null;
26
20
  createdAt: string;
27
21
  updatedAt: string;
28
- expiresAt: string | null;
22
+ } | undefined>;
23
+ declare const getApiKeyByPublicId: (db: DatabaseClient) => (publicId: string) => Promise<{
29
24
  tenantId: string;
30
25
  projectId: string;
26
+ id: string;
27
+ name: string | null;
31
28
  agentId: string;
32
29
  publicId: string;
33
30
  keyHash: string;
34
31
  keyPrefix: string;
35
32
  lastUsedAt: string | null;
33
+ expiresAt: string | null;
34
+ createdAt: string;
35
+ updatedAt: string;
36
36
  } | undefined>;
37
37
  declare const listApiKeys: (db: DatabaseClient) => (params: {
38
38
  scopes: ProjectScopeConfig;
39
39
  agentId?: string;
40
40
  }) => Promise<{
41
- id: string;
42
- name: string | null;
43
- createdAt: string;
44
- updatedAt: string;
45
- expiresAt: string | null;
46
41
  tenantId: string;
47
42
  projectId: string;
43
+ id: string;
44
+ name: string | null;
48
45
  agentId: string;
49
46
  publicId: string;
50
47
  keyHash: string;
51
48
  keyPrefix: string;
52
49
  lastUsedAt: string | null;
50
+ expiresAt: string | null;
51
+ createdAt: string;
52
+ updatedAt: string;
53
53
  }[]>;
54
54
  declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
55
55
  scopes: ProjectScopeConfig;
@@ -65,18 +65,18 @@ declare const listApiKeysPaginated: (db: DatabaseClient) => (params: {
65
65
  };
66
66
  }>;
67
67
  declare const createApiKey: (db: DatabaseClient) => (params: ApiKeyInsert) => Promise<{
68
- id: string;
69
- name: string | null;
70
- createdAt: string;
71
- updatedAt: string;
72
- expiresAt: string | null;
73
68
  tenantId: string;
74
69
  projectId: string;
70
+ id: string;
71
+ name: string | null;
75
72
  agentId: string;
76
73
  publicId: string;
77
74
  keyHash: string;
78
75
  keyPrefix: string;
79
76
  lastUsedAt: string | null;
77
+ expiresAt: string | null;
78
+ createdAt: string;
79
+ updatedAt: string;
80
80
  }>;
81
81
  declare const updateApiKey: (db: DatabaseClient) => (params: {
82
82
  scopes: ProjectScopeConfig;
@@ -7,13 +7,13 @@ declare const getArtifactComponentById: (db: DatabaseClient) => (params: {
7
7
  scopes: ProjectScopeConfig;
8
8
  id: string;
9
9
  }) => Promise<{
10
+ tenantId: string;
11
+ projectId: string;
10
12
  id: string;
11
13
  name: string;
14
+ description: string | null;
12
15
  createdAt: string;
13
16
  updatedAt: string;
14
- description: string | null;
15
- tenantId: string;
16
- projectId: string;
17
17
  props: Record<string, unknown> | null;
18
18
  render: {
19
19
  component: string;
@@ -49,13 +49,13 @@ declare const listArtifactComponentsPaginated: (db: DatabaseClient) => (params:
49
49
  };
50
50
  }>;
51
51
  declare const createArtifactComponent: (db: DatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
52
+ tenantId: string;
53
+ projectId: string;
52
54
  id: string;
53
55
  name: string;
56
+ description: string | null;
54
57
  createdAt: string;
55
58
  updatedAt: string;
56
- description: string | null;
57
- tenantId: string;
58
- projectId: string;
59
59
  props: Record<string, unknown> | null;
60
60
  render: {
61
61
  component: string;
@@ -104,11 +104,11 @@ declare const associateArtifactComponentWithAgent: (db: DatabaseClient) => (para
104
104
  scopes: SubAgentScopeConfig;
105
105
  artifactComponentId: string;
106
106
  }) => Promise<{
107
- id: string;
108
- createdAt: string;
109
107
  tenantId: string;
110
108
  projectId: string;
109
+ id: string;
111
110
  agentId: string;
111
+ createdAt: string;
112
112
  subAgentId: string;
113
113
  artifactComponentId: string;
114
114
  }>;
@@ -147,11 +147,11 @@ declare const upsertAgentArtifactComponentRelation: (db: DatabaseClient) => (par
147
147
  scopes: SubAgentScopeConfig;
148
148
  artifactComponentId: string;
149
149
  }) => Promise<{
150
- id: string;
151
- createdAt: string;
152
150
  tenantId: string;
153
151
  projectId: string;
152
+ id: string;
154
153
  agentId: string;
154
+ createdAt: string;
155
155
  subAgentId: string;
156
156
  artifactComponentId: string;
157
157
  } | null>;
@@ -8,26 +8,26 @@ declare const getContextConfigById: (db: DatabaseClient) => (params: {
8
8
  scopes: AgentScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
+ tenantId: string;
12
+ projectId: string;
11
13
  id: string;
14
+ agentId: string;
12
15
  createdAt: string;
13
16
  updatedAt: string;
14
- tenantId: string;
15
- projectId: string;
16
17
  headersSchema: unknown;
17
18
  contextVariables: Record<string, ContextFetchDefinition> | null;
18
- agentId: string;
19
19
  } | undefined>;
20
20
  declare const listContextConfigs: (db: DatabaseClient) => (params: {
21
21
  scopes: AgentScopeConfig;
22
22
  }) => Promise<{
23
+ tenantId: string;
24
+ projectId: string;
23
25
  id: string;
26
+ agentId: string;
24
27
  createdAt: string;
25
28
  updatedAt: string;
26
- tenantId: string;
27
- projectId: string;
28
29
  headersSchema: unknown;
29
30
  contextVariables: Record<string, ContextFetchDefinition> | null;
30
- agentId: string;
31
31
  }[]>;
32
32
  declare const listContextConfigsPaginated: (db: DatabaseClient) => (params: {
33
33
  scopes: AgentScopeConfig;
@@ -42,14 +42,14 @@ declare const listContextConfigsPaginated: (db: DatabaseClient) => (params: {
42
42
  };
43
43
  }>;
44
44
  declare const createContextConfig: (db: DatabaseClient) => (params: ContextConfigInsert) => Promise<{
45
+ tenantId: string;
46
+ projectId: string;
45
47
  id: string;
48
+ agentId: string;
46
49
  createdAt: string;
47
50
  updatedAt: string;
48
- tenantId: string;
49
- projectId: string;
50
51
  headersSchema: unknown;
51
52
  contextVariables: Record<string, ContextFetchDefinition> | null;
52
- agentId: string;
53
53
  }>;
54
54
  declare const updateContextConfig: (db: DatabaseClient) => (params: {
55
55
  scopes: AgentScopeConfig;
@@ -82,14 +82,14 @@ declare const countContextConfigs: (db: DatabaseClient) => (params: {
82
82
  declare const upsertContextConfig: (db: DatabaseClient) => (params: {
83
83
  data: ContextConfigInsert;
84
84
  }) => Promise<{
85
+ tenantId: string;
86
+ projectId: string;
85
87
  id: string;
88
+ agentId: string;
86
89
  createdAt: string;
87
90
  updatedAt: string;
88
- tenantId: string;
89
- projectId: string;
90
91
  headersSchema: unknown;
91
92
  contextVariables: Record<string, ContextFetchDefinition> | null;
92
- agentId: string;
93
93
  }>;
94
94
  //#endregion
95
95
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };