@inkeep/agents-core 0.46.0 → 0.47.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 (60) hide show
  1. package/dist/auth/auth-schema.d.ts +17 -0
  2. package/dist/auth/auth-schema.js +4 -3
  3. package/dist/auth/auth-validation-schemas.d.ts +163 -129
  4. package/dist/auth/auth.d.ts +91 -57
  5. package/dist/auth/auth.js +16 -2
  6. package/dist/auth/authz/config.d.ts +5 -86
  7. package/dist/auth/authz/config.js +12 -73
  8. package/dist/auth/authz/index.d.ts +2 -1
  9. package/dist/auth/authz/index.js +2 -1
  10. package/dist/auth/authz/permissions.d.ts +1 -1
  11. package/dist/auth/authz/permissions.js +1 -1
  12. package/dist/auth/authz/sync.d.ts +1 -1
  13. package/dist/auth/authz/sync.js +1 -1
  14. package/dist/auth/authz/types.d.ts +92 -0
  15. package/dist/auth/authz/types.js +76 -0
  16. package/dist/auth/init.js +14 -4
  17. package/dist/auth/password-reset-link-store.d.ts +26 -0
  18. package/dist/auth/password-reset-link-store.js +40 -0
  19. package/dist/auth/permissions.d.ts +13 -13
  20. package/dist/auth/spicedb-schema.d.ts +9 -0
  21. package/dist/auth/spicedb-schema.js +24 -0
  22. package/dist/client-exports.d.ts +6 -194
  23. package/dist/client-exports.js +3 -98
  24. package/dist/constants/models.d.ts +2 -0
  25. package/dist/constants/models.js +2 -0
  26. package/dist/data-access/index.d.ts +3 -3
  27. package/dist/data-access/index.js +3 -3
  28. package/dist/data-access/manage/agents.d.ts +30 -30
  29. package/dist/data-access/manage/agents.js +4 -4
  30. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  31. package/dist/data-access/manage/contextConfigs.d.ts +4 -4
  32. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  33. package/dist/data-access/manage/functionTools.d.ts +6 -6
  34. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
  35. package/dist/data-access/manage/subAgentRelations.d.ts +8 -8
  36. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
  37. package/dist/data-access/manage/subAgents.d.ts +18 -18
  38. package/dist/data-access/manage/tools.d.ts +18 -18
  39. package/dist/data-access/manage/tools.js +1 -1
  40. package/dist/data-access/runtime/apiKeys.d.ts +20 -20
  41. package/dist/data-access/runtime/conversations.d.ts +12 -12
  42. package/dist/data-access/runtime/messages.d.ts +3 -3
  43. package/dist/data-access/runtime/organizations.d.ts +10 -1
  44. package/dist/data-access/runtime/organizations.js +24 -3
  45. package/dist/data-access/runtime/tasks.d.ts +1 -1
  46. package/dist/db/manage/manage-schema.d.ts +302 -302
  47. package/dist/db/runtime/runtime-schema.d.ts +206 -206
  48. package/dist/env.d.ts +6 -0
  49. package/dist/env.js +4 -1
  50. package/dist/index.d.ts +7 -5
  51. package/dist/index.js +10 -8
  52. package/dist/types/index.js +1 -1
  53. package/dist/validation/index.d.ts +2 -2
  54. package/dist/validation/index.js +2 -2
  55. package/dist/validation/schemas.d.ts +1344 -1343
  56. package/dist/validation/schemas.js +3 -2
  57. package/drizzle/runtime/0011_colorful_vivisector.sql +50 -0
  58. package/drizzle/runtime/meta/0011_snapshot.json +3088 -0
  59. package/drizzle/runtime/meta/_journal.json +7 -0
  60. package/package.json +9 -2
@@ -2,7 +2,7 @@ import { AgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
2
2
  import * as _better_auth_sso0 from "@better-auth/sso";
3
3
  import * as better_auth0 from "better-auth";
4
4
  import { BetterAuthAdvancedOptions } from "better-auth";
5
- import * as better_auth_plugins0 from "better-auth/plugins";
5
+ import * as better_auth_plugins20 from "better-auth/plugins";
6
6
  import * as zod0 from "zod";
7
7
  import { GoogleOptions } from "better-auth/social-providers";
8
8
 
@@ -98,6 +98,16 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
98
98
  maxPasswordLength: number;
99
99
  requireEmailVerification: false;
100
100
  autoSignIn: true;
101
+ resetPasswordTokenExpiresIn: number;
102
+ sendResetPassword: ({
103
+ user,
104
+ url,
105
+ token
106
+ }: {
107
+ user: better_auth0.User;
108
+ url: string;
109
+ token: string;
110
+ }) => Promise<void>;
101
111
  };
102
112
  account: {
103
113
  accountLinking: {
@@ -237,7 +247,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
237
247
  handler: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
238
248
  }[];
239
249
  };
240
- options: better_auth_plugins0.BearerOptions | undefined;
250
+ options: better_auth_plugins20.BearerOptions | undefined;
241
251
  }, {
242
252
  id: "sso";
243
253
  endpoints: {
@@ -865,30 +875,30 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
865
875
  };
866
876
  }, {
867
877
  id: "organization";
868
- endpoints: better_auth_plugins0.OrganizationEndpoints<{
878
+ endpoints: better_auth_plugins20.OrganizationEndpoints<{
869
879
  allowUserToCreateOrganization: true;
870
- ac: better_auth_plugins0.AccessControl;
880
+ ac: better_auth_plugins20.AccessControl;
871
881
  roles: {
872
882
  member: {
873
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
874
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
883
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
884
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
875
885
  connector: "OR" | "AND";
876
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
877
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
886
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
887
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
878
888
  };
879
889
  admin: {
880
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
881
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
890
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
891
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
882
892
  connector: "OR" | "AND";
883
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
884
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
893
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
894
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
885
895
  };
886
896
  owner: {
887
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
888
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
897
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
898
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
889
899
  connector: "OR" | "AND";
890
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
891
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
900
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
901
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
892
902
  };
893
903
  };
894
904
  creatorRole: "admin";
@@ -899,40 +909,51 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
899
909
  id: string;
900
910
  role: string;
901
911
  email: string;
902
- organization: better_auth_plugins0.Organization;
903
- invitation: better_auth_plugins0.Invitation;
904
- inviter: better_auth_plugins0.Member & {
912
+ organization: better_auth_plugins20.Organization;
913
+ invitation: better_auth_plugins20.Invitation;
914
+ inviter: better_auth_plugins20.Member & {
905
915
  user: better_auth0.User;
906
916
  };
907
917
  }): Promise<void>;
918
+ schema: {
919
+ invitation: {
920
+ additionalFields: {
921
+ authMethod: {
922
+ type: "string";
923
+ input: true;
924
+ required: false;
925
+ };
926
+ };
927
+ };
928
+ };
908
929
  organizationHooks: {
909
930
  afterAcceptInvitation: ({
910
931
  member,
911
932
  user,
912
933
  organization: org
913
934
  }: {
914
- invitation: better_auth_plugins0.Invitation & Record<string, any>;
915
- member: better_auth_plugins0.Member & Record<string, any>;
935
+ invitation: better_auth_plugins20.Invitation & Record<string, any>;
936
+ member: better_auth_plugins20.Member & Record<string, any>;
916
937
  user: better_auth0.User & Record<string, any>;
917
- organization: better_auth_plugins0.Organization & Record<string, any>;
938
+ organization: better_auth_plugins20.Organization & Record<string, any>;
918
939
  }) => Promise<void>;
919
940
  beforeUpdateMemberRole: ({
920
941
  member,
921
942
  organization: org,
922
943
  newRole
923
944
  }: {
924
- member: better_auth_plugins0.Member & Record<string, any>;
945
+ member: better_auth_plugins20.Member & Record<string, any>;
925
946
  newRole: string;
926
947
  user: better_auth0.User & Record<string, any>;
927
- organization: better_auth_plugins0.Organization & Record<string, any>;
948
+ organization: better_auth_plugins20.Organization & Record<string, any>;
928
949
  }) => Promise<void>;
929
950
  afterRemoveMember: ({
930
951
  member,
931
952
  organization: org
932
953
  }: {
933
- member: better_auth_plugins0.Member & Record<string, any>;
954
+ member: better_auth_plugins20.Member & Record<string, any>;
934
955
  user: better_auth0.User & Record<string, any>;
935
- organization: better_auth_plugins0.Organization & Record<string, any>;
956
+ organization: better_auth_plugins20.Organization & Record<string, any>;
936
957
  }) => Promise<void>;
937
958
  };
938
959
  }>;
@@ -1063,16 +1084,17 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1063
1084
  id: string;
1064
1085
  organizationId: string;
1065
1086
  email: string;
1066
- role: "member" | "admin" | "owner";
1067
- status: better_auth_plugins0.InvitationStatus;
1087
+ role: "member" | "owner" | "admin";
1088
+ status: better_auth_plugins20.InvitationStatus;
1068
1089
  inviterId: string;
1069
1090
  expiresAt: Date;
1070
1091
  createdAt: Date;
1092
+ authMethod?: string | undefined;
1071
1093
  };
1072
1094
  Member: {
1073
1095
  id: string;
1074
1096
  organizationId: string;
1075
- role: "member" | "admin" | "owner";
1097
+ role: "member" | "owner" | "admin";
1076
1098
  createdAt: Date;
1077
1099
  userId: string;
1078
1100
  user: {
@@ -1088,7 +1110,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1088
1110
  members: {
1089
1111
  id: string;
1090
1112
  organizationId: string;
1091
- role: "member" | "admin" | "owner";
1113
+ role: "member" | "owner" | "admin";
1092
1114
  createdAt: Date;
1093
1115
  userId: string;
1094
1116
  user: {
@@ -1102,11 +1124,12 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1102
1124
  id: string;
1103
1125
  organizationId: string;
1104
1126
  email: string;
1105
- role: "member" | "admin" | "owner";
1106
- status: better_auth_plugins0.InvitationStatus;
1127
+ role: "member" | "owner" | "admin";
1128
+ status: better_auth_plugins20.InvitationStatus;
1107
1129
  inviterId: string;
1108
1130
  expiresAt: Date;
1109
1131
  createdAt: Date;
1132
+ authMethod?: string | undefined;
1110
1133
  }[];
1111
1134
  } & {
1112
1135
  id: string;
@@ -1177,28 +1200,28 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1177
1200
  };
1178
1201
  options: NoInfer<{
1179
1202
  allowUserToCreateOrganization: true;
1180
- ac: better_auth_plugins0.AccessControl;
1203
+ ac: better_auth_plugins20.AccessControl;
1181
1204
  roles: {
1182
1205
  member: {
1183
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1184
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1206
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
1207
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
1185
1208
  connector: "OR" | "AND";
1186
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1187
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1209
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
1210
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
1188
1211
  };
1189
1212
  admin: {
1190
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1191
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1213
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
1214
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
1192
1215
  connector: "OR" | "AND";
1193
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1194
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1216
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
1217
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
1195
1218
  };
1196
1219
  owner: {
1197
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1198
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1220
+ authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key] | {
1221
+ actions: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>[key];
1199
1222
  connector: "OR" | "AND";
1200
- } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1201
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1223
+ } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins20.AuthorizeResponse;
1224
+ statements: better_auth_plugins20.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins20.Statements>;
1202
1225
  };
1203
1226
  };
1204
1227
  creatorRole: "admin";
@@ -1209,40 +1232,51 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1209
1232
  id: string;
1210
1233
  role: string;
1211
1234
  email: string;
1212
- organization: better_auth_plugins0.Organization;
1213
- invitation: better_auth_plugins0.Invitation;
1214
- inviter: better_auth_plugins0.Member & {
1235
+ organization: better_auth_plugins20.Organization;
1236
+ invitation: better_auth_plugins20.Invitation;
1237
+ inviter: better_auth_plugins20.Member & {
1215
1238
  user: better_auth0.User;
1216
1239
  };
1217
1240
  }): Promise<void>;
1241
+ schema: {
1242
+ invitation: {
1243
+ additionalFields: {
1244
+ authMethod: {
1245
+ type: "string";
1246
+ input: true;
1247
+ required: false;
1248
+ };
1249
+ };
1250
+ };
1251
+ };
1218
1252
  organizationHooks: {
1219
1253
  afterAcceptInvitation: ({
1220
1254
  member,
1221
1255
  user,
1222
1256
  organization: org
1223
1257
  }: {
1224
- invitation: better_auth_plugins0.Invitation & Record<string, any>;
1225
- member: better_auth_plugins0.Member & Record<string, any>;
1258
+ invitation: better_auth_plugins20.Invitation & Record<string, any>;
1259
+ member: better_auth_plugins20.Member & Record<string, any>;
1226
1260
  user: better_auth0.User & Record<string, any>;
1227
- organization: better_auth_plugins0.Organization & Record<string, any>;
1261
+ organization: better_auth_plugins20.Organization & Record<string, any>;
1228
1262
  }) => Promise<void>;
1229
1263
  beforeUpdateMemberRole: ({
1230
1264
  member,
1231
1265
  organization: org,
1232
1266
  newRole
1233
1267
  }: {
1234
- member: better_auth_plugins0.Member & Record<string, any>;
1268
+ member: better_auth_plugins20.Member & Record<string, any>;
1235
1269
  newRole: string;
1236
1270
  user: better_auth0.User & Record<string, any>;
1237
- organization: better_auth_plugins0.Organization & Record<string, any>;
1271
+ organization: better_auth_plugins20.Organization & Record<string, any>;
1238
1272
  }) => Promise<void>;
1239
1273
  afterRemoveMember: ({
1240
1274
  member,
1241
1275
  organization: org
1242
1276
  }: {
1243
- member: better_auth_plugins0.Member & Record<string, any>;
1277
+ member: better_auth_plugins20.Member & Record<string, any>;
1244
1278
  user: better_auth0.User & Record<string, any>;
1245
- organization: better_auth_plugins0.Organization & Record<string, any>;
1279
+ organization: better_auth_plugins20.Organization & Record<string, any>;
1246
1280
  }) => Promise<void>;
1247
1281
  };
1248
1282
  }>;
@@ -1579,8 +1613,8 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1579
1613
  readonly AUTHENTICATION_REQUIRED: "Authentication required";
1580
1614
  };
1581
1615
  options: Partial<{
1582
- expiresIn: better_auth_plugins0.TimeString;
1583
- interval: better_auth_plugins0.TimeString;
1616
+ expiresIn: better_auth_plugins20.TimeString;
1617
+ interval: better_auth_plugins20.TimeString;
1584
1618
  deviceCodeLength: number;
1585
1619
  userCodeLength: number;
1586
1620
  schema: {
package/dist/auth/auth.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { member, ssoProvider } from "./auth-schema.js";
2
- import { OrgRoles } from "./authz/config.js";
2
+ import { OrgRoles } from "./authz/types.js";
3
3
  import { env } from "../env.js";
4
+ import { setPasswordResetLink } from "./password-reset-link-store.js";
4
5
  import { generateId } from "../utils/conversations.js";
5
6
  import "../utils/index.js";
6
7
  import { ac, adminRole, memberRole, ownerRole } from "./permissions.js";
@@ -81,7 +82,15 @@ function createAuth(config) {
81
82
  minPasswordLength: 8,
82
83
  maxPasswordLength: 128,
83
84
  requireEmailVerification: false,
84
- autoSignIn: true
85
+ autoSignIn: true,
86
+ resetPasswordTokenExpiresIn: 1800,
87
+ sendResetPassword: async ({ user, url, token }) => {
88
+ setPasswordResetLink({
89
+ email: user.email,
90
+ url,
91
+ token
92
+ });
93
+ }
85
94
  },
86
95
  account: { accountLinking: {
87
96
  enabled: true,
@@ -155,6 +164,11 @@ function createAuth(config) {
155
164
  invitationId: data.id
156
165
  });
157
166
  },
167
+ schema: { invitation: { additionalFields: { authMethod: {
168
+ type: "string",
169
+ input: true,
170
+ required: false
171
+ } } } },
158
172
  organizationHooks: {
159
173
  afterAcceptInvitation: async ({ member: member$1, user, organization: org }) => {
160
174
  try {
@@ -1,4 +1,8 @@
1
1
  //#region src/auth/authz/config.d.ts
2
+ /**
3
+ * Check if a SpiceDB endpoint is localhost (used for TLS auto-detection).
4
+ */
5
+ declare function isLocalhostEndpoint(endpoint: string): boolean;
2
6
  /**
3
7
  * Get SpiceDB connection configuration from environment variables.
4
8
  * TLS is auto-detected: disabled for localhost, enabled for remote endpoints.
@@ -8,90 +12,5 @@ declare function getSpiceDbConfig(): {
8
12
  token: string;
9
13
  tlsEnabled: boolean;
10
14
  };
11
- /**
12
- * SpiceDB resource types used in the schema
13
- */
14
- declare const SpiceDbResourceTypes: {
15
- readonly USER: "user";
16
- readonly ORGANIZATION: "organization";
17
- readonly PROJECT: "project";
18
- };
19
- /**
20
- * SpiceDB relations used in the schema
21
- *
22
- * Relations are named as nouns (roles) per SpiceDB best practices.
23
- * Project roles are prefixed for clarity when debugging/grepping.
24
- */
25
- declare const SpiceDbRelations: {
26
- readonly OWNER: "owner";
27
- readonly ADMIN: "admin";
28
- readonly MEMBER: "member";
29
- readonly ORGANIZATION: "organization";
30
- readonly PROJECT_ADMIN: "project_admin";
31
- readonly PROJECT_MEMBER: "project_member";
32
- readonly PROJECT_VIEWER: "project_viewer";
33
- };
34
- /**
35
- * SpiceDB permissions for organization resources.
36
- *
37
- * From schema.zed definition organization:
38
- * - view: owner + admin + member
39
- * - manage: owner + admin (includes managing org settings and all projects)
40
- */
41
- declare const SpiceDbOrgPermissions: {
42
- readonly VIEW: "view";
43
- readonly MANAGE: "manage";
44
- };
45
- type SpiceDbOrgPermission = (typeof SpiceDbOrgPermissions)[keyof typeof SpiceDbOrgPermissions];
46
- /**
47
- * SpiceDB permissions for project resources.
48
- *
49
- * From schema.zed definition project:
50
- * - view: read-only access to project and its resources
51
- * - use: invoke agents, create API keys, view traces
52
- * - edit: modify configurations, manage members
53
- */
54
- declare const SpiceDbProjectPermissions: {
55
- readonly VIEW: "view";
56
- readonly USE: "use";
57
- readonly EDIT: "edit";
58
- };
59
- type SpiceDbProjectPermission = (typeof SpiceDbProjectPermissions)[keyof typeof SpiceDbProjectPermissions];
60
- /**
61
- * Permission levels for project access checks.
62
- */
63
- type ProjectPermissionLevel = SpiceDbProjectPermission;
64
- /**
65
- * Organization roles from SpiceDB schema.
66
- */
67
- declare const OrgRoles: {
68
- readonly OWNER: "owner";
69
- readonly ADMIN: "admin";
70
- readonly MEMBER: "member";
71
- };
72
- type OrgRole = (typeof OrgRoles)[keyof typeof OrgRoles];
73
- /**
74
- * Project roles from SpiceDB schema.
75
- *
76
- * Hierarchy:
77
- * - project_admin: Full access (view + use + edit + manage members)
78
- * - project_member: Operator access (view + use: invoke agents, create API keys)
79
- * - project_viewer: Read-only access (view only)
80
- */
81
- declare const ProjectRoles: {
82
- readonly ADMIN: "project_admin";
83
- readonly MEMBER: "project_member";
84
- readonly VIEWER: "project_viewer";
85
- };
86
- type ProjectRole = (typeof ProjectRoles)[keyof typeof ProjectRoles];
87
- /**
88
- * Project permission capabilities.
89
- * Maps to the SpiceDB permission checks (view, use, edit).
90
- */
91
- interface ProjectPermissions {
92
- canView: boolean;
93
- canUse: boolean;
94
- canEdit: boolean;
95
- }
96
15
  //#endregion
97
- export { OrgRole, OrgRoles, ProjectPermissionLevel, ProjectPermissions, ProjectRole, ProjectRoles, SpiceDbOrgPermission, SpiceDbOrgPermissions, SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig };
16
+ export { getSpiceDbConfig, isLocalhostEndpoint };
@@ -1,85 +1,24 @@
1
+ import { env } from "../../env.js";
2
+
1
3
  //#region src/auth/authz/config.ts
2
4
  /**
5
+ * Check if a SpiceDB endpoint is localhost (used for TLS auto-detection).
6
+ */
7
+ function isLocalhostEndpoint(endpoint) {
8
+ return endpoint.startsWith("localhost") || endpoint.startsWith("127.0.0.1");
9
+ }
10
+ /**
3
11
  * Get SpiceDB connection configuration from environment variables.
4
12
  * TLS is auto-detected: disabled for localhost, enabled for remote endpoints.
5
13
  */
6
14
  function getSpiceDbConfig() {
7
- const endpoint = process.env.SPICEDB_ENDPOINT || "localhost:50051";
8
- const isLocalhost = endpoint.startsWith("localhost") || endpoint.startsWith("127.0.0.1");
15
+ const endpoint = env.SPICEDB_ENDPOINT || "localhost:50051";
9
16
  return {
10
17
  endpoint,
11
- token: process.env.SPICEDB_PRESHARED_KEY || "",
12
- tlsEnabled: !isLocalhost
18
+ token: env.SPICEDB_PRESHARED_KEY || "",
19
+ tlsEnabled: env.SPICEDB_TLS_ENABLED ?? !isLocalhostEndpoint(endpoint)
13
20
  };
14
21
  }
15
- /**
16
- * SpiceDB resource types used in the schema
17
- */
18
- const SpiceDbResourceTypes = {
19
- USER: "user",
20
- ORGANIZATION: "organization",
21
- PROJECT: "project"
22
- };
23
- /**
24
- * SpiceDB relations used in the schema
25
- *
26
- * Relations are named as nouns (roles) per SpiceDB best practices.
27
- * Project roles are prefixed for clarity when debugging/grepping.
28
- */
29
- const SpiceDbRelations = {
30
- OWNER: "owner",
31
- ADMIN: "admin",
32
- MEMBER: "member",
33
- ORGANIZATION: "organization",
34
- PROJECT_ADMIN: "project_admin",
35
- PROJECT_MEMBER: "project_member",
36
- PROJECT_VIEWER: "project_viewer"
37
- };
38
- /**
39
- * SpiceDB permissions for organization resources.
40
- *
41
- * From schema.zed definition organization:
42
- * - view: owner + admin + member
43
- * - manage: owner + admin (includes managing org settings and all projects)
44
- */
45
- const SpiceDbOrgPermissions = {
46
- VIEW: "view",
47
- MANAGE: "manage"
48
- };
49
- /**
50
- * SpiceDB permissions for project resources.
51
- *
52
- * From schema.zed definition project:
53
- * - view: read-only access to project and its resources
54
- * - use: invoke agents, create API keys, view traces
55
- * - edit: modify configurations, manage members
56
- */
57
- const SpiceDbProjectPermissions = {
58
- VIEW: "view",
59
- USE: "use",
60
- EDIT: "edit"
61
- };
62
- /**
63
- * Organization roles from SpiceDB schema.
64
- */
65
- const OrgRoles = {
66
- OWNER: "owner",
67
- ADMIN: "admin",
68
- MEMBER: "member"
69
- };
70
- /**
71
- * Project roles from SpiceDB schema.
72
- *
73
- * Hierarchy:
74
- * - project_admin: Full access (view + use + edit + manage members)
75
- * - project_member: Operator access (view + use: invoke agents, create API keys)
76
- * - project_viewer: Read-only access (view only)
77
- */
78
- const ProjectRoles = {
79
- ADMIN: "project_admin",
80
- MEMBER: "project_member",
81
- VIEWER: "project_viewer"
82
- };
83
22
 
84
23
  //#endregion
85
- export { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig };
24
+ export { getSpiceDbConfig, isLocalhostEndpoint };
@@ -1,5 +1,6 @@
1
1
  import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
2
- import { OrgRole, OrgRoles, ProjectPermissionLevel, ProjectPermissions, ProjectRole, ProjectRoles, SpiceDbOrgPermission, SpiceDbOrgPermissions, SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig } from "./config.js";
2
+ import { getSpiceDbConfig } from "./config.js";
3
+ import { OrgRole, OrgRoles, ProjectPermissionLevel, ProjectPermissions, ProjectRole, ProjectRoles, SpiceDbOrgPermission, SpiceDbOrgPermissions, SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes } from "./types.js";
3
4
  import { canEditProject, canUseProject, canUseProjectStrict, canViewProject, listAccessibleProjectIds, listUsableProjectIds } from "./permissions.js";
4
5
  import { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
5
6
  export { type OrgRole, OrgRoles, type ProjectPermissionLevel, type ProjectPermissions, type ProjectRole, ProjectRoles, type SpiceDbOrgPermission, SpiceDbOrgPermissions, type SpiceDbProjectPermission, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, canEditProject, canUseProject, canUseProjectStrict, canViewProject, changeOrgRole, changeProjectRole, checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, getSpiceDbConfig, grantProjectAccess, listAccessibleProjectIds, listProjectMembers, listUsableProjectIds, listUserProjectMembershipsInSpiceDb, lookupResources, readRelationships, removeProjectFromSpiceDb, resetSpiceClient, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb, writeRelationship };
@@ -1,4 +1,5 @@
1
- import { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes, getSpiceDbConfig } from "./config.js";
1
+ import { OrgRoles, ProjectRoles, SpiceDbOrgPermissions, SpiceDbProjectPermissions, SpiceDbRelations, SpiceDbResourceTypes } from "./types.js";
2
+ import { getSpiceDbConfig } from "./config.js";
2
3
  import { checkBulkPermissions, checkPermission, deleteRelationship, getSpiceClient, lookupResources, readRelationships, resetSpiceClient, writeRelationship } from "./client.js";
3
4
  import { canEditProject, canUseProject, canUseProjectStrict, canViewProject, listAccessibleProjectIds, listUsableProjectIds } from "./permissions.js";
4
5
  import { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb } from "./sync.js";
@@ -1,4 +1,4 @@
1
- import { OrgRole } from "./config.js";
1
+ import { OrgRole } from "./types.js";
2
2
 
3
3
  //#region src/auth/authz/permissions.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { OrgRoles, SpiceDbProjectPermissions, SpiceDbResourceTypes } from "./config.js";
1
+ import { OrgRoles, SpiceDbProjectPermissions, SpiceDbResourceTypes } from "./types.js";
2
2
  import { checkPermission, lookupResources } from "./client.js";
3
3
 
4
4
  //#region src/auth/authz/permissions.ts
@@ -1,4 +1,4 @@
1
- import { OrgRole, ProjectRole } from "./config.js";
1
+ import { OrgRole, ProjectRole } from "./types.js";
2
2
 
3
3
  //#region src/auth/authz/sync.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { SpiceDbRelations, SpiceDbResourceTypes } from "./config.js";
1
+ import { SpiceDbRelations, SpiceDbResourceTypes } from "./types.js";
2
2
  import { RelationshipOperation, deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
3
3
 
4
4
  //#region src/auth/authz/sync.ts