@inkeep/agents-core 0.0.0-dev-20260113131806 → 0.0.0-dev-20260113172432
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.
- package/dist/auth/auth-schema.d.ts +104 -104
- package/dist/auth/auth.d.ts +46 -18
- package/dist/auth/auth.js +17 -1
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/db/schema.d.ts +405 -405
- package/dist/validation/schemas.d.ts +649 -649
- package/package.json +1 -1
package/dist/auth/auth.d.ts
CHANGED
|
@@ -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_plugins20.AccessControl;
|
|
819
847
|
roles: {
|
|
820
848
|
member: {
|
|
821
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
822
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
849
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
850
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
823
851
|
connector: "OR" | "AND";
|
|
824
852
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
825
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
853
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>;
|
|
826
854
|
};
|
|
827
855
|
admin: {
|
|
828
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
829
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
856
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
857
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
830
858
|
connector: "OR" | "AND";
|
|
831
859
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
832
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
860
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>;
|
|
833
861
|
};
|
|
834
862
|
owner: {
|
|
835
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
836
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
863
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
864
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
837
865
|
connector: "OR" | "AND";
|
|
838
866
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
839
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
867
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.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_plugins20.AccessControl;
|
|
1098
1126
|
roles: {
|
|
1099
1127
|
member: {
|
|
1100
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1101
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1128
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
1129
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
1102
1130
|
connector: "OR" | "AND";
|
|
1103
1131
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
1104
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1132
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>;
|
|
1105
1133
|
};
|
|
1106
1134
|
admin: {
|
|
1107
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1108
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1135
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
1136
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
1109
1137
|
connector: "OR" | "AND";
|
|
1110
1138
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
1111
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1139
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>;
|
|
1112
1140
|
};
|
|
1113
1141
|
owner: {
|
|
1114
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1115
|
-
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1142
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
|
|
1143
|
+
actions: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.Statements>[key];
|
|
1116
1144
|
connector: "OR" | "AND";
|
|
1117
1145
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
|
|
1118
|
-
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
1146
|
+
statements: better_auth_plugins20.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins20.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" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
9
|
-
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
8
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
9
|
+
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
10
10
|
connector: "OR" | "AND";
|
|
11
11
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
12
|
-
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
12
|
+
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
13
13
|
};
|
|
14
14
|
declare const adminRole: {
|
|
15
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
16
|
-
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
15
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
16
|
+
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
17
17
|
connector: "OR" | "AND";
|
|
18
18
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
19
|
-
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
19
|
+
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
20
20
|
};
|
|
21
21
|
declare const ownerRole: {
|
|
22
|
-
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
23
|
-
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
22
|
+
authorize<K_1 extends "function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
23
|
+
actions: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
24
24
|
connector: "OR" | "AND";
|
|
25
25
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
26
|
-
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "
|
|
26
|
+
statements: better_auth_plugins0.Subset<"function" | "organization" | "agent" | "invitation" | "member" | "project" | "tool" | "sub_agent" | "api_key" | "credential" | "data_component" | "artifact_component" | "external_agent" | "context_config" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { ac, adminRole, memberRole, organizationClient, ownerRole };
|