@inkeep/agents-core 0.50.0 → 0.50.3
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 +83 -83
- package/dist/auth/auth-validation-schemas.d.ts +148 -148
- package/dist/auth/auth.d.ts +20 -20
- package/dist/auth/auth.js +8 -9
- package/dist/auth/authz/sync.d.ts +22 -1
- package/dist/auth/authz/sync.js +59 -4
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +11 -11
- package/dist/constants/models.d.ts +1 -0
- package/dist/constants/models.js +1 -0
- package/dist/constants/otel-attributes.d.ts +4 -0
- package/dist/constants/otel-attributes.js +4 -0
- package/dist/data-access/manage/agents.d.ts +46 -46
- package/dist/data-access/manage/agents.js +8 -6
- package/dist/data-access/manage/artifactComponents.d.ts +4 -4
- package/dist/data-access/manage/artifactComponents.js +3 -3
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.js +2 -2
- package/dist/data-access/manage/functionTools.d.ts +8 -8
- package/dist/data-access/manage/scope-helpers.d.ts +25 -0
- package/dist/data-access/manage/scope-helpers.js +18 -0
- package/dist/data-access/manage/skills.d.ts +11 -11
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgentExternalAgentRelations.js +13 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +2 -2
- package/dist/data-access/manage/subAgentRelations.js +2 -2
- package/dist/data-access/manage/subAgents.d.ts +27 -27
- package/dist/data-access/manage/tools.d.ts +9 -9
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +8 -8
- package/dist/data-access/runtime/conversations.d.ts +27 -27
- package/dist/data-access/runtime/messages.d.ts +15 -15
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +7 -7
- package/dist/db/manage/manage-schema.d.ts +96 -96
- package/dist/db/runtime/runtime-schema.d.ts +38 -38
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/middleware/authz-meta.d.ts +15 -0
- package/dist/middleware/authz-meta.js +11 -0
- package/dist/middleware/create-protected-route.d.ts +30 -0
- package/dist/middleware/create-protected-route.js +20 -0
- package/dist/middleware/index.d.ts +5 -0
- package/dist/middleware/index.js +6 -0
- package/dist/middleware/inherited-auth.d.ts +43 -0
- package/dist/middleware/inherited-auth.js +50 -0
- package/dist/middleware/no-auth.d.ts +6 -0
- package/dist/middleware/no-auth.js +11 -0
- package/dist/setup/index.d.ts +2 -0
- package/dist/setup/index.js +3 -0
- package/dist/setup/setup.d.ts +24 -0
- package/dist/setup/setup.js +506 -0
- package/dist/utils/in-process-fetch.d.ts +30 -0
- package/dist/utils/in-process-fetch.js +51 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas.d.ts +2065 -2065
- package/package.json +9 -1
package/dist/auth/auth.d.ts
CHANGED
|
@@ -880,25 +880,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
|
|
|
880
880
|
ac: better_auth_plugins0.AccessControl;
|
|
881
881
|
roles: {
|
|
882
882
|
member: {
|
|
883
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
884
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
883
|
+
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] | {
|
|
884
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
885
885
|
connector: "OR" | "AND";
|
|
886
886
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
887
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
887
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
888
888
|
};
|
|
889
889
|
admin: {
|
|
890
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
891
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
890
|
+
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] | {
|
|
891
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
892
892
|
connector: "OR" | "AND";
|
|
893
893
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
894
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
894
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
895
895
|
};
|
|
896
896
|
owner: {
|
|
897
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
898
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
897
|
+
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] | {
|
|
898
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
899
899
|
connector: "OR" | "AND";
|
|
900
900
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
901
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
901
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
902
902
|
};
|
|
903
903
|
};
|
|
904
904
|
creatorRole: "admin";
|
|
@@ -947,7 +947,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
|
|
|
947
947
|
user: better_auth0.User & Record<string, any>;
|
|
948
948
|
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
949
949
|
}) => Promise<void>;
|
|
950
|
-
|
|
950
|
+
beforeRemoveMember: ({
|
|
951
951
|
member,
|
|
952
952
|
organization: org
|
|
953
953
|
}: {
|
|
@@ -1203,25 +1203,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
|
|
|
1203
1203
|
ac: better_auth_plugins0.AccessControl;
|
|
1204
1204
|
roles: {
|
|
1205
1205
|
member: {
|
|
1206
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1207
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1206
|
+
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] | {
|
|
1207
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
1208
1208
|
connector: "OR" | "AND";
|
|
1209
1209
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1210
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1210
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
1211
1211
|
};
|
|
1212
1212
|
admin: {
|
|
1213
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1214
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1213
|
+
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] | {
|
|
1214
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
1215
1215
|
connector: "OR" | "AND";
|
|
1216
1216
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1217
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1217
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
1218
1218
|
};
|
|
1219
1219
|
owner: {
|
|
1220
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
1221
|
-
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1220
|
+
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] | {
|
|
1221
|
+
actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
|
|
1222
1222
|
connector: "OR" | "AND";
|
|
1223
1223
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
1224
|
-
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "
|
|
1224
|
+
statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
|
|
1225
1225
|
};
|
|
1226
1226
|
};
|
|
1227
1227
|
creatorRole: "admin";
|
|
@@ -1270,7 +1270,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
|
|
|
1270
1270
|
user: better_auth0.User & Record<string, any>;
|
|
1271
1271
|
organization: better_auth_plugins0.Organization & Record<string, any>;
|
|
1272
1272
|
}) => Promise<void>;
|
|
1273
|
-
|
|
1273
|
+
beforeRemoveMember: ({
|
|
1274
1274
|
member,
|
|
1275
1275
|
organization: org
|
|
1276
1276
|
}: {
|
package/dist/auth/auth.js
CHANGED
|
@@ -117,7 +117,7 @@ function createAuth(config) {
|
|
|
117
117
|
updateAge: 3600 * 24,
|
|
118
118
|
cookieCache: {
|
|
119
119
|
enabled: true,
|
|
120
|
-
maxAge:
|
|
120
|
+
maxAge: 30,
|
|
121
121
|
strategy: "compact"
|
|
122
122
|
}
|
|
123
123
|
},
|
|
@@ -209,18 +209,17 @@ function createAuth(config) {
|
|
|
209
209
|
console.log(`🔐 SpiceDB: Revoked all project memberships for ${member$1.userId} (promoted to ${targetRole})`);
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
|
-
|
|
212
|
+
beforeRemoveMember: async ({ member: member$1, organization: org }) => {
|
|
213
213
|
try {
|
|
214
|
-
const {
|
|
215
|
-
await
|
|
214
|
+
const { revokeAllUserRelationships } = await import("./authz/sync.js");
|
|
215
|
+
await revokeAllUserRelationships({
|
|
216
216
|
tenantId: org.id,
|
|
217
|
-
userId: member$1.userId
|
|
218
|
-
role: member$1.role,
|
|
219
|
-
action: "remove"
|
|
217
|
+
userId: member$1.userId
|
|
220
218
|
});
|
|
221
|
-
console.log(`🔐 SpiceDB:
|
|
219
|
+
console.log(`🔐 SpiceDB: Preparing to remove member ${member$1.userId} - revoked all relationships in org ${org.name}`);
|
|
222
220
|
} catch (error) {
|
|
223
|
-
console.error("❌ SpiceDB
|
|
221
|
+
console.error("❌ SpiceDB cleanup failed before member removal:", error);
|
|
222
|
+
throw new Error(`Failed to clean up user permissions: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
225
|
}
|
|
@@ -73,6 +73,9 @@ declare function removeProjectFromSpiceDb(params: {
|
|
|
73
73
|
/**
|
|
74
74
|
* List all explicit project members from SpiceDB.
|
|
75
75
|
* Returns users with project_admin, project_member, or project_viewer roles.
|
|
76
|
+
*
|
|
77
|
+
* NOTE: This is an appropriate use of readRelationships for data introspection,
|
|
78
|
+
* not permission logic (per SpiceDB best practices).
|
|
76
79
|
*/
|
|
77
80
|
declare function listProjectMembers(params: {
|
|
78
81
|
tenantId: string;
|
|
@@ -84,6 +87,9 @@ declare function listProjectMembers(params: {
|
|
|
84
87
|
/**
|
|
85
88
|
* List all project memberships for a specific user.
|
|
86
89
|
* Returns projects where the user has explicit project_admin, project_member, or project_viewer roles.
|
|
90
|
+
*
|
|
91
|
+
* NOTE: This is an appropriate use of readRelationships for data introspection,
|
|
92
|
+
* not permission logic (per SpiceDB best practices).
|
|
87
93
|
*/
|
|
88
94
|
declare function listUserProjectMembershipsInSpiceDb(params: {
|
|
89
95
|
tenantId: string;
|
|
@@ -102,5 +108,20 @@ declare function revokeAllProjectMemberships(params: {
|
|
|
102
108
|
tenantId: string;
|
|
103
109
|
userId: string;
|
|
104
110
|
}): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Revoke ALL user relationships within an organization.
|
|
113
|
+
* Call when: user is being removed from an organization.
|
|
114
|
+
*
|
|
115
|
+
* This removes:
|
|
116
|
+
* 1. Organization-level relationships (owner, admin, member)
|
|
117
|
+
* 2. All project-level relationships within the organization
|
|
118
|
+
*
|
|
119
|
+
* Uses the most efficient approach: filters by subject without specifying relation.
|
|
120
|
+
* This is much more efficient than individual relation-specific deletions.
|
|
121
|
+
*/
|
|
122
|
+
declare function revokeAllUserRelationships(params: {
|
|
123
|
+
tenantId: string;
|
|
124
|
+
userId: string;
|
|
125
|
+
}): Promise<void>;
|
|
105
126
|
//#endregion
|
|
106
|
-
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
127
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeAllUserRelationships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
package/dist/auth/authz/sync.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpiceDbRelations, SpiceDbResourceTypes } from "./types.js";
|
|
2
2
|
import { fromSpiceDbProjectId, toSpiceDbProjectId } from "./config.js";
|
|
3
|
-
import { RelationshipOperation, deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
|
|
3
|
+
import { RelationshipOperation, checkBulkPermissions, deleteRelationship, getSpiceClient, readRelationships, writeRelationship } from "./client.js";
|
|
4
4
|
|
|
5
5
|
//#region src/auth/authz/sync.ts
|
|
6
6
|
/**
|
|
@@ -82,12 +82,13 @@ async function changeOrgRole(params) {
|
|
|
82
82
|
*/
|
|
83
83
|
async function syncProjectToSpiceDb(params) {
|
|
84
84
|
const spice = getSpiceClient();
|
|
85
|
-
const isOrgAdminOrOwner = (await
|
|
85
|
+
const isOrgAdminOrOwner = (await checkBulkPermissions({
|
|
86
86
|
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
87
87
|
resourceId: params.tenantId,
|
|
88
|
+
permissions: ["manage"],
|
|
88
89
|
subjectType: SpiceDbResourceTypes.USER,
|
|
89
90
|
subjectId: params.creatorUserId
|
|
90
|
-
})).
|
|
91
|
+
})).manage;
|
|
91
92
|
const spiceProjectId = toSpiceDbProjectId(params.tenantId, params.projectId);
|
|
92
93
|
const updates = [{
|
|
93
94
|
operation: RelationshipOperation.TOUCH,
|
|
@@ -224,6 +225,9 @@ async function removeProjectFromSpiceDb(params) {
|
|
|
224
225
|
/**
|
|
225
226
|
* List all explicit project members from SpiceDB.
|
|
226
227
|
* Returns users with project_admin, project_member, or project_viewer roles.
|
|
228
|
+
*
|
|
229
|
+
* NOTE: This is an appropriate use of readRelationships for data introspection,
|
|
230
|
+
* not permission logic (per SpiceDB best practices).
|
|
227
231
|
*/
|
|
228
232
|
async function listProjectMembers(params) {
|
|
229
233
|
return (await readRelationships({
|
|
@@ -237,6 +241,9 @@ async function listProjectMembers(params) {
|
|
|
237
241
|
/**
|
|
238
242
|
* List all project memberships for a specific user.
|
|
239
243
|
* Returns projects where the user has explicit project_admin, project_member, or project_viewer roles.
|
|
244
|
+
*
|
|
245
|
+
* NOTE: This is an appropriate use of readRelationships for data introspection,
|
|
246
|
+
* not permission logic (per SpiceDB best practices).
|
|
240
247
|
*/
|
|
241
248
|
async function listUserProjectMembershipsInSpiceDb(params) {
|
|
242
249
|
return (await readRelationships({
|
|
@@ -319,6 +326,54 @@ async function revokeAllProjectMemberships(params) {
|
|
|
319
326
|
})
|
|
320
327
|
]);
|
|
321
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Revoke ALL user relationships within an organization.
|
|
331
|
+
* Call when: user is being removed from an organization.
|
|
332
|
+
*
|
|
333
|
+
* This removes:
|
|
334
|
+
* 1. Organization-level relationships (owner, admin, member)
|
|
335
|
+
* 2. All project-level relationships within the organization
|
|
336
|
+
*
|
|
337
|
+
* Uses the most efficient approach: filters by subject without specifying relation.
|
|
338
|
+
* This is much more efficient than individual relation-specific deletions.
|
|
339
|
+
*/
|
|
340
|
+
async function revokeAllUserRelationships(params) {
|
|
341
|
+
const spice = getSpiceClient();
|
|
342
|
+
const tenantPrefix = `${params.tenantId}/`;
|
|
343
|
+
await Promise.all([spice.promises.deleteRelationships({
|
|
344
|
+
relationshipFilter: {
|
|
345
|
+
resourceType: SpiceDbResourceTypes.ORGANIZATION,
|
|
346
|
+
optionalResourceId: params.tenantId,
|
|
347
|
+
optionalResourceIdPrefix: "",
|
|
348
|
+
optionalRelation: "",
|
|
349
|
+
optionalSubjectFilter: {
|
|
350
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
351
|
+
optionalSubjectId: params.userId,
|
|
352
|
+
optionalRelation: void 0
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
optionalPreconditions: [],
|
|
356
|
+
optionalLimit: 0,
|
|
357
|
+
optionalAllowPartialDeletions: false,
|
|
358
|
+
optionalTransactionMetadata: void 0
|
|
359
|
+
}), spice.promises.deleteRelationships({
|
|
360
|
+
relationshipFilter: {
|
|
361
|
+
resourceType: SpiceDbResourceTypes.PROJECT,
|
|
362
|
+
optionalResourceId: "",
|
|
363
|
+
optionalResourceIdPrefix: tenantPrefix,
|
|
364
|
+
optionalRelation: "",
|
|
365
|
+
optionalSubjectFilter: {
|
|
366
|
+
subjectType: SpiceDbResourceTypes.USER,
|
|
367
|
+
optionalSubjectId: params.userId,
|
|
368
|
+
optionalRelation: void 0
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
optionalPreconditions: [],
|
|
372
|
+
optionalLimit: 0,
|
|
373
|
+
optionalAllowPartialDeletions: false,
|
|
374
|
+
optionalTransactionMetadata: void 0
|
|
375
|
+
})]);
|
|
376
|
+
}
|
|
322
377
|
|
|
323
378
|
//#endregion
|
|
324
|
-
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
379
|
+
export { changeOrgRole, changeProjectRole, grantProjectAccess, listProjectMembers, listUserProjectMembershipsInSpiceDb, removeProjectFromSpiceDb, revokeAllProjectMemberships, revokeAllUserRelationships, revokeProjectAccess, syncOrgMemberToSpiceDb, syncProjectToSpiceDb };
|
|
@@ -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 "organization" | "member" | "invitation" | "
|
|
9
|
-
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
8
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
9
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
10
10
|
connector: "OR" | "AND";
|
|
11
11
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
12
|
-
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
12
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
13
13
|
};
|
|
14
14
|
declare const adminRole: {
|
|
15
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
16
|
-
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
15
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
16
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
17
17
|
connector: "OR" | "AND";
|
|
18
18
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
19
|
-
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
19
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
20
20
|
};
|
|
21
21
|
declare const ownerRole: {
|
|
22
|
-
authorize<K_1 extends "organization" | "member" | "invitation" | "
|
|
23
|
-
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
22
|
+
authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
|
|
23
|
+
actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
|
|
24
24
|
connector: "OR" | "AND";
|
|
25
25
|
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
|
|
26
|
-
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "
|
|
26
|
+
statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { ac, adminRole, memberRole, organizationClient, ownerRole };
|
package/dist/client-exports.d.ts
CHANGED
|
@@ -19,10 +19,20 @@ declare const FullAgentDefinitionSchema: z.ZodObject<{
|
|
|
19
19
|
defaultSubAgentId: z.ZodOptional<z.ZodString>;
|
|
20
20
|
subAgents: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
21
21
|
id: z.ZodString;
|
|
22
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
23
22
|
name: z.ZodString;
|
|
23
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
24
24
|
updatedAt: z.ZodOptional<z.ZodString>;
|
|
25
25
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
stopWhen: z.ZodOptional<z.ZodNullable<z.ZodType<{
|
|
27
|
+
stepCountIs?: number | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
stepCountIs?: number | undefined;
|
|
30
|
+
}, z.core.$ZodTypeInternals<{
|
|
31
|
+
stepCountIs?: number | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
stepCountIs?: number | undefined;
|
|
34
|
+
}>>>>;
|
|
35
|
+
conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
|
|
26
36
|
models: z.ZodOptional<z.ZodObject<{
|
|
27
37
|
base: z.ZodOptional<z.ZodObject<{
|
|
28
38
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -37,16 +47,6 @@ declare const FullAgentDefinitionSchema: z.ZodObject<{
|
|
|
37
47
|
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
38
48
|
}, z.core.$strip>>;
|
|
39
49
|
}, z.core.$strip>>;
|
|
40
|
-
stopWhen: z.ZodOptional<z.ZodNullable<z.ZodType<{
|
|
41
|
-
stepCountIs?: number | undefined;
|
|
42
|
-
}, {
|
|
43
|
-
stepCountIs?: number | undefined;
|
|
44
|
-
}, z.core.$ZodTypeInternals<{
|
|
45
|
-
stepCountIs?: number | undefined;
|
|
46
|
-
}, {
|
|
47
|
-
stepCountIs?: number | undefined;
|
|
48
|
-
}>>>>;
|
|
49
|
-
conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
|
|
50
50
|
type: z.ZodLiteral<"internal">;
|
|
51
51
|
canUse: z.ZodArray<z.ZodObject<{
|
|
52
52
|
agentToolRelationId: z.ZodOptional<z.ZodString>;
|
|
@@ -38,6 +38,7 @@ declare const OPENAI_MODELS: {
|
|
|
38
38
|
readonly GPT_4_1_NANO_20250414: "openai/gpt-4.1-nano-2025-04-14";
|
|
39
39
|
};
|
|
40
40
|
declare const GOOGLE_MODELS: {
|
|
41
|
+
readonly GEMINI_3_1_PRO_PREVIEW: "google/gemini-3.1-pro-preview";
|
|
41
42
|
readonly GEMINI_3_PRO_PREVIEW: "google/gemini-3-pro-preview";
|
|
42
43
|
readonly GEMINI_3_FLASH_PREVIEW: "google/gemini-3-flash-preview";
|
|
43
44
|
readonly GEMINI_2_5_PRO: "google/gemini-2.5-pro";
|
package/dist/constants/models.js
CHANGED
|
@@ -38,6 +38,7 @@ const OPENAI_MODELS = {
|
|
|
38
38
|
GPT_4_1_NANO_20250414: "openai/gpt-4.1-nano-2025-04-14"
|
|
39
39
|
};
|
|
40
40
|
const GOOGLE_MODELS = {
|
|
41
|
+
GEMINI_3_1_PRO_PREVIEW: "google/gemini-3.1-pro-preview",
|
|
41
42
|
GEMINI_3_PRO_PREVIEW: "google/gemini-3-pro-preview",
|
|
42
43
|
GEMINI_3_FLASH_PREVIEW: "google/gemini-3-flash-preview",
|
|
43
44
|
GEMINI_2_5_PRO: "google/gemini-2.5-pro",
|
|
@@ -93,6 +93,10 @@ declare const SPAN_KEYS: {
|
|
|
93
93
|
readonly ARTIFACT_DATA: "artifact.data";
|
|
94
94
|
readonly ARTIFACT_NAME: "artifact.name";
|
|
95
95
|
readonly ARTIFACT_DESCRIPTION: "artifact.description";
|
|
96
|
+
readonly ARTIFACT_IS_OVERSIZED: "artifact.is_oversized";
|
|
97
|
+
readonly ARTIFACT_RETRIEVAL_BLOCKED: "artifact.retrieval_blocked";
|
|
98
|
+
readonly ARTIFACT_ORIGINAL_TOKEN_SIZE: "artifact.original_token_size";
|
|
99
|
+
readonly ARTIFACT_CONTEXT_WINDOW_SIZE: "artifact.context_window_size";
|
|
96
100
|
readonly CONTEXT_BREAKDOWN_SYSTEM_TEMPLATE: "context.breakdown.system_template_tokens";
|
|
97
101
|
readonly CONTEXT_BREAKDOWN_CORE_INSTRUCTIONS: "context.breakdown.core_instructions_tokens";
|
|
98
102
|
readonly CONTEXT_BREAKDOWN_AGENT_PROMPT: "context.breakdown.agent_prompt_tokens";
|
|
@@ -93,6 +93,10 @@ const SPAN_KEYS = {
|
|
|
93
93
|
ARTIFACT_DATA: "artifact.data",
|
|
94
94
|
ARTIFACT_NAME: "artifact.name",
|
|
95
95
|
ARTIFACT_DESCRIPTION: "artifact.description",
|
|
96
|
+
ARTIFACT_IS_OVERSIZED: "artifact.is_oversized",
|
|
97
|
+
ARTIFACT_RETRIEVAL_BLOCKED: "artifact.retrieval_blocked",
|
|
98
|
+
ARTIFACT_ORIGINAL_TOKEN_SIZE: "artifact.original_token_size",
|
|
99
|
+
ARTIFACT_CONTEXT_WINDOW_SIZE: "artifact.context_window_size",
|
|
96
100
|
CONTEXT_BREAKDOWN_SYSTEM_TEMPLATE: "context.breakdown.system_template_tokens",
|
|
97
101
|
CONTEXT_BREAKDOWN_CORE_INSTRUCTIONS: "context.breakdown.core_instructions_tokens",
|
|
98
102
|
CONTEXT_BREAKDOWN_AGENT_PROMPT: "context.breakdown.agent_prompt_tokens",
|
|
@@ -9,14 +9,14 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
id: string;
|
|
12
|
-
createdAt: string;
|
|
13
12
|
name: string;
|
|
13
|
+
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
projectId: string;
|
|
16
|
-
tenantId: string;
|
|
17
15
|
description: string | null;
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
stopWhen: {
|
|
17
|
+
transferCountIs?: number | undefined;
|
|
18
|
+
} | null;
|
|
19
|
+
prompt: string | null;
|
|
20
20
|
models: {
|
|
21
21
|
base?: {
|
|
22
22
|
model?: string | undefined;
|
|
@@ -31,7 +31,10 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
31
31
|
providerOptions?: Record<string, any> | undefined;
|
|
32
32
|
} | undefined;
|
|
33
33
|
} | null;
|
|
34
|
-
|
|
34
|
+
projectId: string;
|
|
35
|
+
tenantId: string;
|
|
36
|
+
defaultSubAgentId: string | null;
|
|
37
|
+
contextConfigId: string | null;
|
|
35
38
|
statusUpdates: {
|
|
36
39
|
enabled?: boolean | undefined;
|
|
37
40
|
numEvents?: number | undefined;
|
|
@@ -47,22 +50,19 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
47
50
|
} | undefined;
|
|
48
51
|
}[] | undefined;
|
|
49
52
|
} | null;
|
|
50
|
-
stopWhen: {
|
|
51
|
-
transferCountIs?: number | undefined;
|
|
52
|
-
} | null;
|
|
53
53
|
} | null>;
|
|
54
54
|
declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
55
|
scopes: AgentScopeConfig;
|
|
56
56
|
}) => Promise<{
|
|
57
57
|
id: string;
|
|
58
|
-
createdAt: string;
|
|
59
58
|
name: string;
|
|
59
|
+
createdAt: string;
|
|
60
60
|
updatedAt: string;
|
|
61
|
-
projectId: string;
|
|
62
|
-
tenantId: string;
|
|
63
61
|
description: string | null;
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
stopWhen: {
|
|
63
|
+
transferCountIs?: number | undefined;
|
|
64
|
+
} | null;
|
|
65
|
+
prompt: string | null;
|
|
66
66
|
models: {
|
|
67
67
|
base?: {
|
|
68
68
|
model?: string | undefined;
|
|
@@ -77,7 +77,10 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
77
77
|
providerOptions?: Record<string, any> | undefined;
|
|
78
78
|
} | undefined;
|
|
79
79
|
} | null;
|
|
80
|
-
|
|
80
|
+
projectId: string;
|
|
81
|
+
tenantId: string;
|
|
82
|
+
defaultSubAgentId: string | null;
|
|
83
|
+
contextConfigId: string | null;
|
|
81
84
|
statusUpdates: {
|
|
82
85
|
enabled?: boolean | undefined;
|
|
83
86
|
numEvents?: number | undefined;
|
|
@@ -93,18 +96,17 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
93
96
|
} | undefined;
|
|
94
97
|
}[] | undefined;
|
|
95
98
|
} | null;
|
|
96
|
-
stopWhen: {
|
|
97
|
-
transferCountIs?: number | undefined;
|
|
98
|
-
} | null;
|
|
99
99
|
defaultSubAgent: {
|
|
100
100
|
id: string;
|
|
101
|
-
createdAt: string;
|
|
102
101
|
name: string;
|
|
102
|
+
createdAt: string;
|
|
103
103
|
updatedAt: string;
|
|
104
|
-
agentId: string;
|
|
105
|
-
projectId: string;
|
|
106
|
-
tenantId: string;
|
|
107
104
|
description: string | null;
|
|
105
|
+
stopWhen: {
|
|
106
|
+
stepCountIs?: number | undefined;
|
|
107
|
+
} | null;
|
|
108
|
+
prompt: string | null;
|
|
109
|
+
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
108
110
|
models: {
|
|
109
111
|
base?: {
|
|
110
112
|
model?: string | undefined;
|
|
@@ -119,25 +121,23 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
119
121
|
providerOptions?: Record<string, any> | undefined;
|
|
120
122
|
} | undefined;
|
|
121
123
|
} | null;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} | null;
|
|
126
|
-
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
124
|
+
agentId: string;
|
|
125
|
+
projectId: string;
|
|
126
|
+
tenantId: string;
|
|
127
127
|
} | null;
|
|
128
128
|
} | null>;
|
|
129
129
|
declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
130
130
|
scopes: ProjectScopeConfig;
|
|
131
131
|
}) => Promise<{
|
|
132
132
|
id: string;
|
|
133
|
-
createdAt: string;
|
|
134
133
|
name: string;
|
|
134
|
+
createdAt: string;
|
|
135
135
|
updatedAt: string;
|
|
136
|
-
projectId: string;
|
|
137
|
-
tenantId: string;
|
|
138
136
|
description: string | null;
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
stopWhen: {
|
|
138
|
+
transferCountIs?: number | undefined;
|
|
139
|
+
} | null;
|
|
140
|
+
prompt: string | null;
|
|
141
141
|
models: {
|
|
142
142
|
base?: {
|
|
143
143
|
model?: string | undefined;
|
|
@@ -152,7 +152,10 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
152
152
|
providerOptions?: Record<string, any> | undefined;
|
|
153
153
|
} | undefined;
|
|
154
154
|
} | null;
|
|
155
|
-
|
|
155
|
+
projectId: string;
|
|
156
|
+
tenantId: string;
|
|
157
|
+
defaultSubAgentId: string | null;
|
|
158
|
+
contextConfigId: string | null;
|
|
156
159
|
statusUpdates: {
|
|
157
160
|
enabled?: boolean | undefined;
|
|
158
161
|
numEvents?: number | undefined;
|
|
@@ -168,9 +171,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
168
171
|
} | undefined;
|
|
169
172
|
}[] | undefined;
|
|
170
173
|
} | null;
|
|
171
|
-
stopWhen: {
|
|
172
|
-
transferCountIs?: number | undefined;
|
|
173
|
-
} | null;
|
|
174
174
|
}[]>;
|
|
175
175
|
declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
176
176
|
scopes: ProjectScopeConfig;
|
|
@@ -246,14 +246,14 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
|
|
|
246
246
|
}): Promise<AvailableAgentInfo[]>;
|
|
247
247
|
declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
|
|
248
248
|
id: string;
|
|
249
|
-
createdAt: string;
|
|
250
249
|
name: string;
|
|
250
|
+
createdAt: string;
|
|
251
251
|
updatedAt: string;
|
|
252
|
-
projectId: string;
|
|
253
|
-
tenantId: string;
|
|
254
252
|
description: string | null;
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
stopWhen: {
|
|
254
|
+
transferCountIs?: number | undefined;
|
|
255
|
+
} | null;
|
|
256
|
+
prompt: string | null;
|
|
257
257
|
models: {
|
|
258
258
|
base?: {
|
|
259
259
|
model?: string | undefined;
|
|
@@ -268,7 +268,10 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
268
268
|
providerOptions?: Record<string, any> | undefined;
|
|
269
269
|
} | undefined;
|
|
270
270
|
} | null;
|
|
271
|
-
|
|
271
|
+
projectId: string;
|
|
272
|
+
tenantId: string;
|
|
273
|
+
defaultSubAgentId: string | null;
|
|
274
|
+
contextConfigId: string | null;
|
|
272
275
|
statusUpdates: {
|
|
273
276
|
enabled?: boolean | undefined;
|
|
274
277
|
numEvents?: number | undefined;
|
|
@@ -284,9 +287,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
284
287
|
} | undefined;
|
|
285
288
|
}[] | undefined;
|
|
286
289
|
} | null;
|
|
287
|
-
stopWhen: {
|
|
288
|
-
transferCountIs?: number | undefined;
|
|
289
|
-
} | null;
|
|
290
290
|
}>;
|
|
291
291
|
declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
292
292
|
scopes: AgentScopeConfig;
|
|
@@ -341,7 +341,7 @@ declare const deleteAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
341
341
|
/**
|
|
342
342
|
* Helper function to fetch component relationships using efficient joins
|
|
343
343
|
*/
|
|
344
|
-
declare const fetchComponentRelationships: (db: AgentsManageDatabaseClient) => <T extends Record<string, unknown>>(scopes:
|
|
344
|
+
declare const fetchComponentRelationships: (db: AgentsManageDatabaseClient) => <T extends Record<string, unknown>>(scopes: AgentScopeConfig, subAgentIds: string[], config: {
|
|
345
345
|
relationTable: PgTable<any>;
|
|
346
346
|
componentTable: PgTable<any>;
|
|
347
347
|
relationIdField: unknown;
|
|
@@ -117,7 +117,7 @@ const deleteAgent = (db) => async (params) => {
|
|
|
117
117
|
const fetchComponentRelationships = (db) => async (scopes, subAgentIds, config) => {
|
|
118
118
|
const componentsObject = {};
|
|
119
119
|
if (subAgentIds.length > 0) {
|
|
120
|
-
const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, eq(config.relationIdField, config.componentIdField)).where(and(eq(config.relationTable.tenantId, scopes.tenantId), eq(config.relationTable.projectId, scopes.projectId), inArray(config.subAgentIdField, subAgentIds)));
|
|
120
|
+
const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, eq(config.relationIdField, config.componentIdField)).where(and(eq(config.relationTable.tenantId, scopes.tenantId), eq(config.relationTable.projectId, scopes.projectId), eq(config.relationTable.agentId, scopes.agentId), inArray(config.subAgentIdField, subAgentIds)));
|
|
121
121
|
for (const component of results) componentsObject[component.id] = component;
|
|
122
122
|
}
|
|
123
123
|
return componentsObject;
|
|
@@ -260,8 +260,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
260
260
|
agentToolRelationId: subAgentFunctionToolRelations.id,
|
|
261
261
|
toolPolicies: subAgentFunctionToolRelations.toolPolicies
|
|
262
262
|
}).from(subAgentFunctionToolRelations).innerJoin(functionTools, and(eq(subAgentFunctionToolRelations.functionToolId, functionTools.id), eq(subAgentFunctionToolRelations.tenantId, functionTools.tenantId), eq(subAgentFunctionToolRelations.projectId, functionTools.projectId), eq(subAgentFunctionToolRelations.agentId, functionTools.agentId))).where(and(eq(subAgentFunctionToolRelations.tenantId, tenantId), eq(subAgentFunctionToolRelations.projectId, projectId), eq(subAgentFunctionToolRelations.agentId, agentId), eq(subAgentFunctionToolRelations.subAgentId, agent$1.id)));
|
|
263
|
-
const agentDataComponentIds = (await db.query.subAgentDataComponents.findMany({ where: and(eq(subAgentDataComponents.tenantId, tenantId), eq(subAgentDataComponents.subAgentId, agent$1.id)) })).map((rel) => rel.dataComponentId);
|
|
264
|
-
const agentArtifactComponentIds = (await db.query.subAgentArtifactComponents.findMany({ where: and(eq(subAgentArtifactComponents.tenantId, tenantId), eq(subAgentArtifactComponents.subAgentId, agent$1.id)) })).map((rel) => rel.artifactComponentId);
|
|
263
|
+
const agentDataComponentIds = (await db.query.subAgentDataComponents.findMany({ where: and(eq(subAgentDataComponents.tenantId, tenantId), eq(subAgentDataComponents.projectId, projectId), eq(subAgentDataComponents.agentId, agentId), eq(subAgentDataComponents.subAgentId, agent$1.id)) })).map((rel) => rel.dataComponentId);
|
|
264
|
+
const agentArtifactComponentIds = (await db.query.subAgentArtifactComponents.findMany({ where: and(eq(subAgentArtifactComponents.tenantId, tenantId), eq(subAgentArtifactComponents.projectId, projectId), eq(subAgentArtifactComponents.agentId, agentId), eq(subAgentArtifactComponents.subAgentId, agent$1.id)) })).map((rel) => rel.artifactComponentId);
|
|
265
265
|
const mcpToolCanUse = subAgentTools.map((tool) => ({
|
|
266
266
|
agentToolRelationId: tool.agentToolRelationId,
|
|
267
267
|
toolId: tool.id,
|
|
@@ -352,7 +352,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
352
352
|
try {
|
|
353
353
|
await fetchComponentRelationships(db)({
|
|
354
354
|
tenantId,
|
|
355
|
-
projectId
|
|
355
|
+
projectId,
|
|
356
|
+
agentId
|
|
356
357
|
}, subAgentIds, {
|
|
357
358
|
relationTable: subAgentDataComponents,
|
|
358
359
|
componentTable: dataComponents,
|
|
@@ -372,7 +373,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
372
373
|
try {
|
|
373
374
|
await fetchComponentRelationships(db)({
|
|
374
375
|
tenantId,
|
|
375
|
-
projectId
|
|
376
|
+
projectId,
|
|
377
|
+
agentId
|
|
376
378
|
}, subAgentIds, {
|
|
377
379
|
relationTable: subAgentArtifactComponents,
|
|
378
380
|
componentTable: artifactComponents,
|
|
@@ -429,7 +431,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
|
|
|
429
431
|
await db.update(subAgents).set({
|
|
430
432
|
stopWhen: agent$1.stopWhen,
|
|
431
433
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
432
|
-
}).where(and(eq(subAgents.tenantId, tenantId), eq(subAgents.projectId, projectId), eq(subAgents.id, subAgentId)));
|
|
434
|
+
}).where(and(eq(subAgents.tenantId, tenantId), eq(subAgents.projectId, projectId), eq(subAgents.agentId, agentId), eq(subAgents.id, subAgentId)));
|
|
433
435
|
result.subAgents[subAgentId] = {
|
|
434
436
|
...result.subAgents[subAgentId],
|
|
435
437
|
stopWhen: agent$1.stopWhen
|