@inkeep/agents-core 0.70.3 → 0.70.5
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 +227 -227
- package/dist/auth/auth-validation-schemas.d.ts +154 -154
- package/dist/auth/auth.d.ts +122 -122
- package/dist/auth/auth.js +26 -5
- package/dist/auth/init.js +10 -13
- package/dist/auth/password-policy-rules.d.ts +18 -0
- package/dist/auth/password-policy-rules.js +32 -0
- package/dist/auth/password-policy.d.ts +10 -0
- package/dist/auth/password-policy.js +88 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/constants/otel-attributes.d.ts +1 -0
- package/dist/constants/otel-attributes.js +1 -0
- package/dist/constants/signoz-queries.d.ts +3 -0
- package/dist/constants/signoz-queries.js +7 -2
- package/dist/data-access/manage/agents.d.ts +46 -46
- package/dist/data-access/manage/artifactComponents.d.ts +2 -2
- package/dist/data-access/manage/functionTools.d.ts +6 -6
- package/dist/data-access/manage/skills.d.ts +4 -4
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +4 -4
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +6 -6
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/tools.d.ts +12 -12
- package/dist/data-access/manage/triggers.d.ts +5 -5
- package/dist/data-access/runtime/apiKeys.d.ts +4 -4
- package/dist/data-access/runtime/apps.d.ts +9 -9
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/messages.d.ts +6 -6
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
- package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/db/manage/manage-schema.d.ts +461 -461
- package/dist/db/runtime/runtime-schema.d.ts +435 -435
- package/dist/middleware/inherited-auth.d.ts +5 -5
- package/dist/middleware/no-auth.d.ts +2 -2
- package/dist/setup/setup.js +3 -2
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas/skills.d.ts +27 -27
- package/dist/validation/schemas.d.ts +2313 -2313
- package/package.json +9 -1
package/dist/auth/auth.js
CHANGED
|
@@ -6,13 +6,14 @@ import { setPasswordResetLink } from "./password-reset-link-store.js";
|
|
|
6
6
|
import { createUserProfileIfNotExists } from "../data-access/runtime/userProfiles.js";
|
|
7
7
|
import { querySsoProviderIds } from "../data-access/runtime/auth.js";
|
|
8
8
|
import { extractCookieDomain, getInitialOrganization, getTrustedOrigins, hasCredentialAccount, shouldAutoProvision } from "./auth-config-utils.js";
|
|
9
|
+
import { passwordPolicyHook } from "./password-policy.js";
|
|
9
10
|
import { ac, adminRole, memberRole, ownerRole } from "./permissions.js";
|
|
10
11
|
import { betterAuth } from "better-auth";
|
|
11
12
|
import { dash } from "@better-auth/infra";
|
|
12
13
|
import { oauthProvider } from "@better-auth/oauth-provider";
|
|
13
14
|
import { sso } from "@better-auth/sso";
|
|
14
15
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
15
|
-
import { bearer, deviceAuthorization, jwt, lastLoginMethod, oAuthProxy, organization } from "better-auth/plugins";
|
|
16
|
+
import { bearer, deviceAuthorization, haveIBeenPwned, jwt, lastLoginMethod, oAuthProxy, organization } from "better-auth/plugins";
|
|
16
17
|
|
|
17
18
|
//#region src/auth/auth.ts
|
|
18
19
|
function createAuth(config) {
|
|
@@ -23,11 +24,23 @@ function createAuth(config) {
|
|
|
23
24
|
baseURL: config.baseURL,
|
|
24
25
|
secret: config.secret,
|
|
25
26
|
disabledPaths: ["/token"],
|
|
26
|
-
database:
|
|
27
|
+
database: ((options) => {
|
|
28
|
+
const adapter = drizzleAdapter(config.dbClient, { provider: "pg" })(options);
|
|
29
|
+
return {
|
|
30
|
+
...adapter,
|
|
31
|
+
create: (params) => {
|
|
32
|
+
if (params.model === "organization" && params.data.id && !params.forceAllowId) return adapter.create({
|
|
33
|
+
...params,
|
|
34
|
+
forceAllowId: true
|
|
35
|
+
});
|
|
36
|
+
return adapter.create(params);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
27
40
|
emailAndPassword: {
|
|
28
41
|
enabled: true,
|
|
29
|
-
minPasswordLength:
|
|
30
|
-
maxPasswordLength:
|
|
42
|
+
minPasswordLength: 15,
|
|
43
|
+
maxPasswordLength: 256,
|
|
31
44
|
requireEmailVerification: false,
|
|
32
45
|
autoSignIn: true,
|
|
33
46
|
resetPasswordTokenExpiresIn: 1800,
|
|
@@ -110,6 +123,7 @@ function createAuth(config) {
|
|
|
110
123
|
...config.advanced
|
|
111
124
|
},
|
|
112
125
|
trustedOrigins: (request) => getTrustedOrigins(config.dbClient, request),
|
|
126
|
+
hooks: { before: passwordPolicyHook },
|
|
113
127
|
plugins: [
|
|
114
128
|
bearer(),
|
|
115
129
|
dash(),
|
|
@@ -224,6 +238,12 @@ function createAuth(config) {
|
|
|
224
238
|
} }
|
|
225
239
|
},
|
|
226
240
|
organizationHooks: {
|
|
241
|
+
beforeCreateOrganization: async ({ organization: org }) => {
|
|
242
|
+
return { data: {
|
|
243
|
+
...org,
|
|
244
|
+
id: org.slug
|
|
245
|
+
} };
|
|
246
|
+
},
|
|
227
247
|
beforeCreateInvitation: async ({ invitation, organization: org }) => {
|
|
228
248
|
const { enforcePerRoleSeatLimit } = await import("./entitlements.js");
|
|
229
249
|
await enforcePerRoleSeatLimit(config.dbClient, org.id, invitation.role);
|
|
@@ -334,7 +354,8 @@ function createAuth(config) {
|
|
|
334
354
|
expiresIn: "60m",
|
|
335
355
|
interval: "5s",
|
|
336
356
|
userCodeLength: 8
|
|
337
|
-
})
|
|
357
|
+
}),
|
|
358
|
+
haveIBeenPwned({ customPasswordCompromisedMessage: "Please choose a more secure password." })
|
|
338
359
|
]
|
|
339
360
|
});
|
|
340
361
|
return instance;
|
package/dist/auth/init.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createAgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
|
|
|
6
6
|
import { createApp, getAppById } from "../data-access/runtime/apps.js";
|
|
7
7
|
import { addUserToOrganization, upsertOrganization } from "../data-access/runtime/organizations.js";
|
|
8
8
|
import { getUserByEmail } from "../data-access/runtime/users.js";
|
|
9
|
+
import { validatePasswordPolicy } from "./password-policy.js";
|
|
9
10
|
import { createAuth } from "./auth.js";
|
|
10
11
|
import { writeSpiceDbSchema } from "./spicedb-schema.js";
|
|
11
12
|
|
|
@@ -23,7 +24,7 @@ import { writeSpiceDbSchema } from "./spicedb-schema.js";
|
|
|
23
24
|
* - INKEEP_AGENTS_RUN_DATABASE_URL: PostgreSQL connection string
|
|
24
25
|
* - TENANT_ID: Organization/tenant ID (defaults to 'default') - this becomes the org ID
|
|
25
26
|
* - INKEEP_AGENTS_MANAGE_UI_USERNAME: Admin email address
|
|
26
|
-
* - INKEEP_AGENTS_MANAGE_UI_PASSWORD: Admin password (min
|
|
27
|
+
* - INKEEP_AGENTS_MANAGE_UI_PASSWORD: Admin password (min 15 chars, see password policy)
|
|
27
28
|
* - BETTER_AUTH_SECRET: Secret for Better Auth
|
|
28
29
|
*
|
|
29
30
|
* Optional environment variables:
|
|
@@ -56,6 +57,12 @@ async function init() {
|
|
|
56
57
|
console.error(" This secret is used to sign authentication tokens.");
|
|
57
58
|
process.exit(1);
|
|
58
59
|
}
|
|
60
|
+
const passwordViolations = validatePasswordPolicy(password, { userEmail: username });
|
|
61
|
+
if (passwordViolations.length > 0) {
|
|
62
|
+
console.error("❌ INKEEP_AGENTS_MANAGE_UI_PASSWORD does not meet the password policy:");
|
|
63
|
+
for (const v of passwordViolations) console.error(` - ${v.message}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
59
66
|
const auth = createAuth({
|
|
60
67
|
baseURL: process.env.INKEEP_AGENTS_API_URL || "http://localhost:3002",
|
|
61
68
|
secret: authSecret,
|
|
@@ -73,18 +80,8 @@ async function init() {
|
|
|
73
80
|
else console.log(` ℹ️ Organization already exists: ${TENANT_ID}`);
|
|
74
81
|
console.log(`\n👤 Creating admin user: ${username}`);
|
|
75
82
|
let user = await getUserByEmail(dbClient)(username);
|
|
76
|
-
if (user) {
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
const ctx = await auth.$context;
|
|
80
|
-
const hashedPassword = await ctx.password.hash(password);
|
|
81
|
-
await ctx.internalAdapter.updatePassword(user.id, hashedPassword);
|
|
82
|
-
console.log(" ✅ Password synced from .env");
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error(" ❌ Failed to sync password from .env:", error);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
83
|
+
if (user) console.log(` ℹ️ User already exists: ${username} — skipping creation and password update`);
|
|
84
|
+
else {
|
|
88
85
|
console.log(" Creating user with Better Auth...");
|
|
89
86
|
if (!(await auth.api.signUpEmail({ body: {
|
|
90
87
|
email: username,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/auth/password-policy-rules.d.ts
|
|
2
|
+
declare const MIN_PASSWORD_LENGTH = 15;
|
|
3
|
+
interface PasswordRequirement {
|
|
4
|
+
rule: string;
|
|
5
|
+
label: string;
|
|
6
|
+
test: (password: string) => boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const PASSWORD_REQUIREMENTS: PasswordRequirement[];
|
|
9
|
+
interface PasswordPolicyContext {
|
|
10
|
+
userName?: string;
|
|
11
|
+
userEmail?: string;
|
|
12
|
+
}
|
|
13
|
+
interface PolicyViolation {
|
|
14
|
+
rule: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS, type PasswordPolicyContext, type PasswordRequirement, type PolicyViolation };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/auth/password-policy-rules.ts
|
|
2
|
+
const MIN_PASSWORD_LENGTH = 15;
|
|
3
|
+
const PASSWORD_REQUIREMENTS = [
|
|
4
|
+
{
|
|
5
|
+
rule: "minLength",
|
|
6
|
+
label: `At least ${MIN_PASSWORD_LENGTH} characters`,
|
|
7
|
+
test: (p) => p.length >= MIN_PASSWORD_LENGTH
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
rule: "lowercase",
|
|
11
|
+
label: "One lowercase letter",
|
|
12
|
+
test: (p) => /[a-z]/.test(p)
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
rule: "uppercase",
|
|
16
|
+
label: "One uppercase letter",
|
|
17
|
+
test: (p) => /[A-Z]/.test(p)
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
rule: "digit",
|
|
21
|
+
label: "One number",
|
|
22
|
+
test: (p) => /\d/.test(p)
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
rule: "special",
|
|
26
|
+
label: "One special character",
|
|
27
|
+
test: (p) => /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?`~]/.test(p)
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS, PasswordPolicyContext, PasswordRequirement, PolicyViolation } from "./password-policy-rules.js";
|
|
2
|
+
import * as better_auth0 from "better-auth";
|
|
3
|
+
|
|
4
|
+
//#region src/auth/password-policy.d.ts
|
|
5
|
+
declare function validatePasswordPolicy(password: string, context?: PasswordPolicyContext): PolicyViolation[];
|
|
6
|
+
declare function enforcePasswordPolicy(password: string, context?: PasswordPolicyContext): void;
|
|
7
|
+
declare const passwordPolicyHook: (inputContext: better_auth0.MiddlewareInputContext<better_auth0.MiddlewareOptions>) => Promise<void>;
|
|
8
|
+
declare function generateCompliantPassword(length?: number): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS, type PasswordPolicyContext, type PasswordRequirement, type PolicyViolation, enforcePasswordPolicy, generateCompliantPassword, passwordPolicyHook, validatePasswordPolicy };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS } from "./password-policy-rules.js";
|
|
2
|
+
import { APIError, createAuthMiddleware } from "better-auth/api";
|
|
3
|
+
import { randomInt } from "node:crypto";
|
|
4
|
+
|
|
5
|
+
//#region src/auth/password-policy.ts
|
|
6
|
+
function validatePasswordPolicy(password, context) {
|
|
7
|
+
const violations = [];
|
|
8
|
+
for (const req of PASSWORD_REQUIREMENTS) if (!req.test(password)) violations.push({
|
|
9
|
+
rule: req.rule,
|
|
10
|
+
message: req.label
|
|
11
|
+
});
|
|
12
|
+
const lower = password.toLowerCase();
|
|
13
|
+
if (context?.userEmail) {
|
|
14
|
+
const localPart = context.userEmail.split("@")[0]?.toLowerCase();
|
|
15
|
+
if (localPart && localPart.length >= 3 && lower.includes(localPart)) violations.push({
|
|
16
|
+
rule: "email",
|
|
17
|
+
message: "Password must not contain your email address"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (context?.userName) {
|
|
21
|
+
const name = context.userName.toLowerCase();
|
|
22
|
+
if (name.length >= 3 && lower.includes(name)) violations.push({
|
|
23
|
+
rule: "name",
|
|
24
|
+
message: "Password must not contain your name"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (lower.includes("inkeep")) violations.push({
|
|
28
|
+
rule: "company",
|
|
29
|
+
message: "Password must not contain the company name"
|
|
30
|
+
});
|
|
31
|
+
return violations;
|
|
32
|
+
}
|
|
33
|
+
function enforcePasswordPolicy(password, context) {
|
|
34
|
+
const violations = validatePasswordPolicy(password, context);
|
|
35
|
+
if (violations.length > 0) throw new APIError("BAD_REQUEST", { message: violations.map((v) => v.message).join("; ") });
|
|
36
|
+
}
|
|
37
|
+
const PASSWORD_POLICY_PATHS = new Set([
|
|
38
|
+
"/sign-up/email",
|
|
39
|
+
"/reset-password",
|
|
40
|
+
"/change-password"
|
|
41
|
+
]);
|
|
42
|
+
function isPlainObject(value) {
|
|
43
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44
|
+
}
|
|
45
|
+
function readString(body, key) {
|
|
46
|
+
const value = body[key];
|
|
47
|
+
return typeof value === "string" ? value : void 0;
|
|
48
|
+
}
|
|
49
|
+
const passwordPolicyHook = createAuthMiddleware(async (ctx) => {
|
|
50
|
+
if (!PASSWORD_POLICY_PATHS.has(ctx.path)) return;
|
|
51
|
+
if (!isPlainObject(ctx.body)) return;
|
|
52
|
+
const pw = readString(ctx.body, "newPassword") ?? readString(ctx.body, "password");
|
|
53
|
+
if (!pw) return;
|
|
54
|
+
enforcePasswordPolicy(pw, {
|
|
55
|
+
userEmail: readString(ctx.body, "email"),
|
|
56
|
+
userName: readString(ctx.body, "name")
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const LOWERCASE = "abcdefghijklmnopqrstuvwxyz";
|
|
60
|
+
const UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
61
|
+
const DIGITS = "0123456789";
|
|
62
|
+
const SPECIALS = "!@#%^&*()_+-[];:,.<>/?~";
|
|
63
|
+
const ALL_CHARS = LOWERCASE + UPPERCASE + DIGITS + SPECIALS;
|
|
64
|
+
function pick(alphabet) {
|
|
65
|
+
return alphabet[randomInt(alphabet.length)];
|
|
66
|
+
}
|
|
67
|
+
function generateCompliantPassword(length = MIN_PASSWORD_LENGTH + 4) {
|
|
68
|
+
if (length < MIN_PASSWORD_LENGTH) throw new Error(`Password length must be at least ${MIN_PASSWORD_LENGTH}`);
|
|
69
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
70
|
+
const chars = [
|
|
71
|
+
pick(LOWERCASE),
|
|
72
|
+
pick(UPPERCASE),
|
|
73
|
+
pick(DIGITS),
|
|
74
|
+
pick(SPECIALS)
|
|
75
|
+
];
|
|
76
|
+
while (chars.length < length) chars.push(pick(ALL_CHARS));
|
|
77
|
+
for (let i = chars.length - 1; i > 0; i--) {
|
|
78
|
+
const j = randomInt(i + 1);
|
|
79
|
+
[chars[i], chars[j]] = [chars[j], chars[i]];
|
|
80
|
+
}
|
|
81
|
+
const password = chars.join("");
|
|
82
|
+
if (validatePasswordPolicy(password).length === 0) return password;
|
|
83
|
+
}
|
|
84
|
+
throw new Error("Failed to generate a policy-compliant password");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { MIN_PASSWORD_LENGTH, PASSWORD_REQUIREMENTS, enforcePasswordPolicy, generateCompliantPassword, passwordPolicyHook, validatePasswordPolicy };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as better_auth_plugins0 from "better-auth/plugins";
|
|
2
2
|
import { AccessControl } from "better-auth/plugins/access";
|
|
3
3
|
import { organizationClient } from "better-auth/client/plugins";
|
|
4
4
|
|
|
5
5
|
//#region src/auth/permissions.d.ts
|
|
6
6
|
declare const ac: AccessControl;
|
|
7
7
|
declare const memberRole: {
|
|
8
|
-
authorize<K_1 extends "
|
|
9
|
-
actions:
|
|
8
|
+
authorize<K_1 extends "project" | "organization" | "invitation" | "member" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
9
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
10
10
|
connector: "OR" | "AND";
|
|
11
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
12
|
-
statements:
|
|
11
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
12
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
13
13
|
};
|
|
14
14
|
declare const adminRole: {
|
|
15
|
-
authorize<K_1 extends "
|
|
16
|
-
actions:
|
|
15
|
+
authorize<K_1 extends "project" | "organization" | "invitation" | "member" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
16
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
17
17
|
connector: "OR" | "AND";
|
|
18
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
19
|
-
statements:
|
|
18
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
19
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
20
20
|
};
|
|
21
21
|
declare const ownerRole: {
|
|
22
|
-
authorize<K_1 extends "
|
|
23
|
-
actions:
|
|
22
|
+
authorize<K_1 extends "project" | "organization" | "invitation" | "member" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
|
|
23
|
+
actions: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>[key];
|
|
24
24
|
connector: "OR" | "AND";
|
|
25
|
-
} | undefined } : never, connector?: "OR" | "AND"):
|
|
26
|
-
statements:
|
|
25
|
+
} | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
|
|
26
|
+
statements: better_auth_plugins0.Subset<"project" | "organization" | "invitation" | "member" | "team" | "ac", better_auth_plugins0.Statements>;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
29
|
export { ac, adminRole, memberRole, organizationClient, ownerRole };
|
|
@@ -101,6 +101,7 @@ declare const SPAN_KEYS: {
|
|
|
101
101
|
readonly HTTP_RESPONSE_BODY_SIZE: "http.response.body_size";
|
|
102
102
|
readonly NAME: "name";
|
|
103
103
|
readonly PARENT_SPAN_ID: "parentSpanID";
|
|
104
|
+
readonly PARENT_SPAN_ID_V5: "parent_span_id";
|
|
104
105
|
readonly CONVERSATION_ID: "conversation.id";
|
|
105
106
|
readonly INVOCATION_TYPE: "invocation.type";
|
|
106
107
|
readonly INVOCATION_ENTRY_POINT: "invocation.entryPoint";
|
|
@@ -101,6 +101,7 @@ const SPAN_KEYS = {
|
|
|
101
101
|
HTTP_RESPONSE_BODY_SIZE: "http.response.body_size",
|
|
102
102
|
NAME: "name",
|
|
103
103
|
PARENT_SPAN_ID: "parentSpanID",
|
|
104
|
+
PARENT_SPAN_ID_V5: "parent_span_id",
|
|
104
105
|
CONVERSATION_ID: "conversation.id",
|
|
105
106
|
INVOCATION_TYPE: "invocation.type",
|
|
106
107
|
INVOCATION_ENTRY_POINT: "invocation.entryPoint",
|
|
@@ -7,6 +7,7 @@ declare const REQUEST_TYPES: {
|
|
|
7
7
|
};
|
|
8
8
|
declare const QUERY_TYPES: {
|
|
9
9
|
readonly BUILDER_QUERY: "builder_query";
|
|
10
|
+
readonly BUILDER_TRACE_OPERATOR: "builder_trace_operator";
|
|
10
11
|
};
|
|
11
12
|
declare const FIELD_CONTEXTS: {
|
|
12
13
|
readonly RESOURCE: "resource";
|
|
@@ -75,6 +76,8 @@ declare const QUERY_EXPRESSIONS: {
|
|
|
75
76
|
readonly STREAM_LIFETIME_EXCEEDED: "streamLifetimeExceeded";
|
|
76
77
|
readonly DURABLE_TOOL_EXECUTIONS: "durableToolExecutions";
|
|
77
78
|
readonly USAGE_EVENTS: "usageEvents";
|
|
79
|
+
readonly AGG_TOOL_CALLS_BY_TYPE: "aggToolCallsByType";
|
|
80
|
+
readonly AGG_AI_CALLS: "aggAICalls";
|
|
78
81
|
};
|
|
79
82
|
/** Query Order Directions */
|
|
80
83
|
declare const ORDER_DIRECTIONS: {
|
|
@@ -5,7 +5,10 @@ const REQUEST_TYPES = {
|
|
|
5
5
|
RAW: "raw",
|
|
6
6
|
TRACE: "trace"
|
|
7
7
|
};
|
|
8
|
-
const QUERY_TYPES = {
|
|
8
|
+
const QUERY_TYPES = {
|
|
9
|
+
BUILDER_QUERY: "builder_query",
|
|
10
|
+
BUILDER_TRACE_OPERATOR: "builder_trace_operator"
|
|
11
|
+
};
|
|
9
12
|
const FIELD_CONTEXTS = {
|
|
10
13
|
RESOURCE: "resource",
|
|
11
14
|
ATTRIBUTE: "attribute",
|
|
@@ -97,7 +100,9 @@ const QUERY_EXPRESSIONS = {
|
|
|
97
100
|
MAX_STEPS_REACHED: "maxStepsReached",
|
|
98
101
|
STREAM_LIFETIME_EXCEEDED: "streamLifetimeExceeded",
|
|
99
102
|
DURABLE_TOOL_EXECUTIONS: "durableToolExecutions",
|
|
100
|
-
USAGE_EVENTS: "usageEvents"
|
|
103
|
+
USAGE_EVENTS: "usageEvents",
|
|
104
|
+
AGG_TOOL_CALLS_BY_TYPE: "aggToolCallsByType",
|
|
105
|
+
AGG_AI_CALLS: "aggAICalls"
|
|
101
106
|
};
|
|
102
107
|
/** Query Order Directions */
|
|
103
108
|
const ORDER_DIRECTIONS = {
|
|
@@ -12,14 +12,7 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
12
12
|
}) => Promise<{
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
|
-
createdAt: string;
|
|
16
|
-
updatedAt: string;
|
|
17
15
|
description: string | null;
|
|
18
|
-
prompt: string | null;
|
|
19
|
-
tenantId: string;
|
|
20
|
-
projectId: string;
|
|
21
|
-
defaultSubAgentId: string | null;
|
|
22
|
-
contextConfigId: string | null;
|
|
23
16
|
models: {
|
|
24
17
|
base?: {
|
|
25
18
|
model?: string | undefined;
|
|
@@ -40,6 +33,16 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
40
33
|
allowedProviders?: string[] | undefined;
|
|
41
34
|
} | undefined;
|
|
42
35
|
} | null;
|
|
36
|
+
stopWhen: {
|
|
37
|
+
transferCountIs?: number | undefined;
|
|
38
|
+
} | null;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
tenantId: string;
|
|
42
|
+
projectId: string;
|
|
43
|
+
defaultSubAgentId: string | null;
|
|
44
|
+
contextConfigId: string | null;
|
|
45
|
+
prompt: string | null;
|
|
43
46
|
statusUpdates: {
|
|
44
47
|
enabled?: boolean | undefined;
|
|
45
48
|
numEvents?: number | undefined;
|
|
@@ -55,9 +58,6 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
55
58
|
} | undefined;
|
|
56
59
|
}[] | undefined;
|
|
57
60
|
} | null;
|
|
58
|
-
stopWhen: {
|
|
59
|
-
transferCountIs?: number | undefined;
|
|
60
|
-
} | null;
|
|
61
61
|
executionMode: "classic" | "durable";
|
|
62
62
|
} | null>;
|
|
63
63
|
declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -65,14 +65,7 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
65
65
|
}) => Promise<{
|
|
66
66
|
id: string;
|
|
67
67
|
name: string;
|
|
68
|
-
createdAt: string;
|
|
69
|
-
updatedAt: string;
|
|
70
68
|
description: string | null;
|
|
71
|
-
prompt: string | null;
|
|
72
|
-
tenantId: string;
|
|
73
|
-
projectId: string;
|
|
74
|
-
defaultSubAgentId: string | null;
|
|
75
|
-
contextConfigId: string | null;
|
|
76
69
|
models: {
|
|
77
70
|
base?: {
|
|
78
71
|
model?: string | undefined;
|
|
@@ -93,6 +86,16 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
93
86
|
allowedProviders?: string[] | undefined;
|
|
94
87
|
} | undefined;
|
|
95
88
|
} | null;
|
|
89
|
+
stopWhen: {
|
|
90
|
+
transferCountIs?: number | undefined;
|
|
91
|
+
} | null;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
tenantId: string;
|
|
95
|
+
projectId: string;
|
|
96
|
+
defaultSubAgentId: string | null;
|
|
97
|
+
contextConfigId: string | null;
|
|
98
|
+
prompt: string | null;
|
|
96
99
|
statusUpdates: {
|
|
97
100
|
enabled?: boolean | undefined;
|
|
98
101
|
numEvents?: number | undefined;
|
|
@@ -108,20 +111,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
108
111
|
} | undefined;
|
|
109
112
|
}[] | undefined;
|
|
110
113
|
} | null;
|
|
111
|
-
stopWhen: {
|
|
112
|
-
transferCountIs?: number | undefined;
|
|
113
|
-
} | null;
|
|
114
114
|
executionMode: "classic" | "durable";
|
|
115
115
|
defaultSubAgent: {
|
|
116
116
|
id: string;
|
|
117
117
|
name: string;
|
|
118
|
-
createdAt: string;
|
|
119
|
-
updatedAt: string;
|
|
120
118
|
description: string | null;
|
|
121
|
-
prompt: string | null;
|
|
122
|
-
tenantId: string;
|
|
123
|
-
projectId: string;
|
|
124
|
-
agentId: string;
|
|
125
119
|
models: {
|
|
126
120
|
base?: {
|
|
127
121
|
model?: string | undefined;
|
|
@@ -145,6 +139,12 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
145
139
|
stopWhen: {
|
|
146
140
|
stepCountIs?: number | undefined;
|
|
147
141
|
} | null;
|
|
142
|
+
createdAt: string;
|
|
143
|
+
updatedAt: string;
|
|
144
|
+
tenantId: string;
|
|
145
|
+
projectId: string;
|
|
146
|
+
prompt: string | null;
|
|
147
|
+
agentId: string;
|
|
148
148
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
149
149
|
} | null;
|
|
150
150
|
} | null>;
|
|
@@ -153,14 +153,7 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
153
153
|
}) => Promise<{
|
|
154
154
|
id: string;
|
|
155
155
|
name: string;
|
|
156
|
-
createdAt: string;
|
|
157
|
-
updatedAt: string;
|
|
158
156
|
description: string | null;
|
|
159
|
-
prompt: string | null;
|
|
160
|
-
tenantId: string;
|
|
161
|
-
projectId: string;
|
|
162
|
-
defaultSubAgentId: string | null;
|
|
163
|
-
contextConfigId: string | null;
|
|
164
157
|
models: {
|
|
165
158
|
base?: {
|
|
166
159
|
model?: string | undefined;
|
|
@@ -181,6 +174,16 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
181
174
|
allowedProviders?: string[] | undefined;
|
|
182
175
|
} | undefined;
|
|
183
176
|
} | null;
|
|
177
|
+
stopWhen: {
|
|
178
|
+
transferCountIs?: number | undefined;
|
|
179
|
+
} | null;
|
|
180
|
+
createdAt: string;
|
|
181
|
+
updatedAt: string;
|
|
182
|
+
tenantId: string;
|
|
183
|
+
projectId: string;
|
|
184
|
+
defaultSubAgentId: string | null;
|
|
185
|
+
contextConfigId: string | null;
|
|
186
|
+
prompt: string | null;
|
|
184
187
|
statusUpdates: {
|
|
185
188
|
enabled?: boolean | undefined;
|
|
186
189
|
numEvents?: number | undefined;
|
|
@@ -196,9 +199,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
196
199
|
} | undefined;
|
|
197
200
|
}[] | undefined;
|
|
198
201
|
} | null;
|
|
199
|
-
stopWhen: {
|
|
200
|
-
transferCountIs?: number | undefined;
|
|
201
|
-
} | null;
|
|
202
202
|
executionMode: "classic" | "durable";
|
|
203
203
|
}[]>;
|
|
204
204
|
declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -283,14 +283,7 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
|
|
|
283
283
|
declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
|
|
284
284
|
id: string;
|
|
285
285
|
name: string;
|
|
286
|
-
createdAt: string;
|
|
287
|
-
updatedAt: string;
|
|
288
286
|
description: string | null;
|
|
289
|
-
prompt: string | null;
|
|
290
|
-
tenantId: string;
|
|
291
|
-
projectId: string;
|
|
292
|
-
defaultSubAgentId: string | null;
|
|
293
|
-
contextConfigId: string | null;
|
|
294
287
|
models: {
|
|
295
288
|
base?: {
|
|
296
289
|
model?: string | undefined;
|
|
@@ -311,6 +304,16 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
311
304
|
allowedProviders?: string[] | undefined;
|
|
312
305
|
} | undefined;
|
|
313
306
|
} | null;
|
|
307
|
+
stopWhen: {
|
|
308
|
+
transferCountIs?: number | undefined;
|
|
309
|
+
} | null;
|
|
310
|
+
createdAt: string;
|
|
311
|
+
updatedAt: string;
|
|
312
|
+
tenantId: string;
|
|
313
|
+
projectId: string;
|
|
314
|
+
defaultSubAgentId: string | null;
|
|
315
|
+
contextConfigId: string | null;
|
|
316
|
+
prompt: string | null;
|
|
314
317
|
statusUpdates: {
|
|
315
318
|
enabled?: boolean | undefined;
|
|
316
319
|
numEvents?: number | undefined;
|
|
@@ -326,9 +329,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
326
329
|
} | undefined;
|
|
327
330
|
}[] | undefined;
|
|
328
331
|
} | null;
|
|
329
|
-
stopWhen: {
|
|
330
|
-
transferCountIs?: number | undefined;
|
|
331
|
-
} | null;
|
|
332
332
|
executionMode: "classic" | "durable";
|
|
333
333
|
}>;
|
|
334
334
|
declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -11,9 +11,9 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
11
11
|
}) => Promise<{
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
|
+
description: string | null;
|
|
14
15
|
createdAt: string;
|
|
15
16
|
updatedAt: string;
|
|
16
|
-
description: string | null;
|
|
17
17
|
tenantId: string;
|
|
18
18
|
projectId: string;
|
|
19
19
|
props: {
|
|
@@ -67,9 +67,9 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
|
|
|
67
67
|
declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
|
|
68
68
|
id: string;
|
|
69
69
|
name: string;
|
|
70
|
+
description: string | null;
|
|
70
71
|
createdAt: string;
|
|
71
72
|
updatedAt: string;
|
|
72
|
-
description: string | null;
|
|
73
73
|
tenantId: string;
|
|
74
74
|
projectId: string;
|
|
75
75
|
props: {
|
|
@@ -55,9 +55,9 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
55
55
|
}) => Promise<{
|
|
56
56
|
id: string;
|
|
57
57
|
name: string;
|
|
58
|
+
description: string | null;
|
|
58
59
|
createdAt: string;
|
|
59
60
|
updatedAt: string;
|
|
60
|
-
description: string | null;
|
|
61
61
|
tenantId: string;
|
|
62
62
|
projectId: string;
|
|
63
63
|
agentId: string;
|
|
@@ -97,9 +97,9 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
97
97
|
}) => Promise<{
|
|
98
98
|
id: string;
|
|
99
99
|
name: string;
|
|
100
|
+
description: string | null;
|
|
100
101
|
createdAt: string;
|
|
101
102
|
updatedAt: string;
|
|
102
|
-
description: string | null;
|
|
103
103
|
tenantId: string;
|
|
104
104
|
projectId: string;
|
|
105
105
|
agentId: string;
|
|
@@ -163,11 +163,11 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
|
|
|
163
163
|
tenantId: string;
|
|
164
164
|
projectId: string;
|
|
165
165
|
agentId: string;
|
|
166
|
-
subAgentId: string;
|
|
167
|
-
functionToolId: string;
|
|
168
166
|
toolPolicies: Record<string, {
|
|
169
167
|
needsApproval?: boolean;
|
|
170
168
|
}> | null;
|
|
169
|
+
subAgentId: string;
|
|
170
|
+
functionToolId: string;
|
|
171
171
|
}>;
|
|
172
172
|
/**
|
|
173
173
|
* Update an agent-function tool relation
|
|
@@ -228,11 +228,11 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
|
|
|
228
228
|
tenantId: string;
|
|
229
229
|
projectId: string;
|
|
230
230
|
agentId: string;
|
|
231
|
-
subAgentId: string;
|
|
232
|
-
functionToolId: string;
|
|
233
231
|
toolPolicies: Record<string, {
|
|
234
232
|
needsApproval?: boolean;
|
|
235
233
|
}> | null;
|
|
234
|
+
subAgentId: string;
|
|
235
|
+
functionToolId: string;
|
|
236
236
|
}>;
|
|
237
237
|
//#endregion
|
|
238
238
|
export { addFunctionToolToSubAgent, associateFunctionToolWithSubAgent, createFunctionTool, deleteFunctionTool, getFunctionToolById, getFunctionToolsForSubAgent, getSubAgentsUsingFunctionTool, isFunctionToolAssociatedWithSubAgent, listFunctionTools, removeFunctionToolFromSubAgent, updateFunctionTool, updateSubAgentFunctionToolRelation, upsertFunctionTool, upsertSubAgentFunctionToolRelation };
|
|
@@ -17,12 +17,12 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
17
17
|
}) => Promise<{
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
|
+
description: string;
|
|
20
21
|
createdAt: string;
|
|
21
22
|
updatedAt: string;
|
|
22
|
-
metadata: Record<string, string> | null;
|
|
23
|
-
description: string;
|
|
24
23
|
tenantId: string;
|
|
25
24
|
projectId: string;
|
|
25
|
+
metadata: Record<string, string> | null;
|
|
26
26
|
content: string;
|
|
27
27
|
} | null>;
|
|
28
28
|
declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -112,12 +112,12 @@ declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiIn
|
|
|
112
112
|
declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<{
|
|
113
113
|
id: string;
|
|
114
114
|
name: string;
|
|
115
|
+
description: string;
|
|
115
116
|
createdAt: string;
|
|
116
117
|
updatedAt: string;
|
|
117
|
-
metadata: Record<string, string> | null;
|
|
118
|
-
description: string;
|
|
119
118
|
tenantId: string;
|
|
120
119
|
projectId: string;
|
|
120
|
+
metadata: Record<string, string> | null;
|
|
121
121
|
content: string;
|
|
122
122
|
}>;
|
|
123
123
|
declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
|