@inkeep/agents-core 0.36.1 → 0.37.1
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.js +1 -1
- package/dist/auth/auth-validation-schemas.js +1 -1
- package/dist/auth/auth.d.ts +3 -3
- package/dist/auth/auth.js +32 -5
- package/dist/{auth-detection-CGqhPDnj.d.ts → auth-detection-7G0Dxt55.d.ts} +11 -0
- package/dist/chunk-CMNLBV2A.js +39 -0
- package/dist/{chunk-SG75RA63.js → chunk-I6IF7ZTL.js} +2 -2
- package/dist/{chunk-ZCEKN54E.js → chunk-K6GMXJPW.js} +6 -6
- package/dist/{chunk-4RVJB4KV.js → chunk-LL6F3EAR.js} +4 -1
- package/dist/{chunk-TGESM3JG.js → chunk-MQMMFK2K.js} +14 -3
- package/dist/{chunk-NFYCSHD3.js → chunk-PVRIMF6N.js} +2 -1
- package/dist/{chunk-4OISWRFK.js → chunk-ROXPFQAM.js} +357 -40
- package/dist/{chunk-OEHP46F7.js → chunk-W3QDM7WH.js} +1 -1
- package/dist/{chunk-KMLLKRUY.js → chunk-ZEZCCHV7.js} +1 -1
- package/dist/{client-HrEgt7wv.d.ts → client-B_3j-V4-.d.ts} +1 -1
- package/dist/client-exports.d.ts +6 -3
- package/dist/client-exports.js +3 -3
- package/dist/constants/schema-validation/index.js +1 -1
- package/dist/credential-stores/index.d.ts +3 -3
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +2 -2
- package/dist/db/test-client.d.ts +3 -3
- package/dist/db/test-client.js +1 -1
- package/dist/index.d.ts +143 -9
- package/dist/index.js +280 -67
- package/dist/{schema-CoC3tYFX.d.ts → schema-DKbG39on.d.ts} +24 -1
- package/dist/server-BXoUiBMg.d.ts +127 -0
- package/dist/types/index.d.ts +33 -113
- package/dist/types/index.js +1 -1
- package/dist/{utility-C4QAannk.d.ts → utility-Lo5NoRHK.d.ts} +146 -11
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/drizzle/{0001_fair_malice.sql → 0001_calm_sheva_callister.sql} +1 -16
- package/drizzle/meta/0001_snapshot.json +7 -1
- package/drizzle/meta/_journal.json +2 -2
- package/package.json +12 -6
- package/dist/chunk-H2F72PDA.js +0 -15
- /package/dist/{chunk-NOPEANIU.js → chunk-NFTJ5JBY.js} +0 -0
package/dist/auth/auth-schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { account, invitation, member, organization, session, ssoProvider, user, verification } from '../chunk-
|
|
1
|
+
export { account, invitation, member, organization, session, ssoProvider, user, verification } from '../chunk-NFTJ5JBY.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { user, session, account, organization, member, invitation, verification } from '../chunk-
|
|
1
|
+
import { user, session, account, organization, member, invitation, verification } from '../chunk-NFTJ5JBY.js';
|
|
2
2
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
package/dist/auth/auth.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import * as zod from 'zod';
|
|
|
4
4
|
import * as better_auth from 'better-auth';
|
|
5
5
|
import { BetterAuthAdvancedOptions } from 'better-auth';
|
|
6
6
|
import { GoogleOptions } from 'better-auth/social-providers';
|
|
7
|
-
import { D as DatabaseClient } from '../client-
|
|
7
|
+
import { D as DatabaseClient } from '../client-B_3j-V4-.js';
|
|
8
8
|
import 'drizzle-orm/node-postgres';
|
|
9
9
|
import 'drizzle-orm/pglite';
|
|
10
|
-
import '../schema-
|
|
10
|
+
import '../schema-DKbG39on.js';
|
|
11
11
|
import 'drizzle-orm';
|
|
12
12
|
import 'drizzle-orm/pg-core';
|
|
13
|
-
import '../utility-
|
|
13
|
+
import '../utility-Lo5NoRHK.js';
|
|
14
14
|
import 'drizzle-zod';
|
|
15
15
|
import '@hono/zod-openapi';
|
|
16
16
|
import './auth-schema.js';
|
package/dist/auth/auth.js
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import { generateId } from '../chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { generateId } from '../chunk-ROXPFQAM.js';
|
|
2
|
+
import { env } from '../chunk-LL6F3EAR.js';
|
|
3
|
+
import { ssoProvider } from '../chunk-NFTJ5JBY.js';
|
|
3
4
|
import { ownerRole, adminRole, memberRole, ac } from '../chunk-VMSYBWFH.js';
|
|
4
5
|
import { sso } from '@better-auth/sso';
|
|
5
|
-
import { betterAuth
|
|
6
|
+
import { betterAuth } from 'better-auth';
|
|
6
7
|
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
|
|
7
8
|
import { organization } from 'better-auth/plugins';
|
|
8
9
|
import { eq } from 'drizzle-orm';
|
|
9
10
|
|
|
11
|
+
function extractCookieDomain(baseURL) {
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(baseURL);
|
|
14
|
+
const hostname = url.hostname;
|
|
15
|
+
if (hostname === "localhost" || hostname.match(/^\d+\.\d+\.\d+\.\d+$/)) {
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
const parts = hostname.split(".");
|
|
19
|
+
if (parts.length < 2) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
let domainParts;
|
|
23
|
+
if (parts.length === 3) {
|
|
24
|
+
domainParts = parts;
|
|
25
|
+
} else if (parts.length > 3) {
|
|
26
|
+
domainParts = parts.slice(1);
|
|
27
|
+
} else {
|
|
28
|
+
domainParts = parts;
|
|
29
|
+
}
|
|
30
|
+
return `.${domainParts.join(".")}`;
|
|
31
|
+
} catch {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
10
35
|
async function registerSSOProvider(dbClient, provider) {
|
|
11
36
|
try {
|
|
12
37
|
const existing = await dbClient.select().from(ssoProvider).where(eq(ssoProvider.providerId, provider.providerId)).limit(1);
|
|
@@ -31,6 +56,7 @@ async function registerSSOProvider(dbClient, provider) {
|
|
|
31
56
|
}
|
|
32
57
|
}
|
|
33
58
|
function createAuth(config) {
|
|
59
|
+
const cookieDomain = extractCookieDomain(config.baseURL);
|
|
34
60
|
const auth2 = betterAuth({
|
|
35
61
|
baseURL: config.baseURL,
|
|
36
62
|
secret: config.secret,
|
|
@@ -53,7 +79,8 @@ function createAuth(config) {
|
|
|
53
79
|
},
|
|
54
80
|
advanced: {
|
|
55
81
|
crossSubDomainCookies: {
|
|
56
|
-
enabled: true
|
|
82
|
+
enabled: true,
|
|
83
|
+
...cookieDomain && { domain: cookieDomain }
|
|
57
84
|
},
|
|
58
85
|
...config.advanced
|
|
59
86
|
},
|
|
@@ -62,7 +89,7 @@ function createAuth(config) {
|
|
|
62
89
|
"http://localhost:3002",
|
|
63
90
|
env.INKEEP_AGENTS_MANAGE_UI_URL,
|
|
64
91
|
env.INKEEP_AGENTS_MANAGE_API_URL
|
|
65
|
-
],
|
|
92
|
+
].filter((origin) => typeof origin === "string" && origin.length > 0),
|
|
66
93
|
plugins: [
|
|
67
94
|
sso(),
|
|
68
95
|
organization({
|
|
@@ -12,6 +12,9 @@ declare const SPAN_NAMES: {
|
|
|
12
12
|
readonly AGENT_GENERATION: "agent.generate";
|
|
13
13
|
readonly CONTEXT_FETCHER: "context-fetcher.http-request";
|
|
14
14
|
readonly ARTIFACT_PROCESSING: "agent_session.process_artifact";
|
|
15
|
+
readonly TOOL_APPROVAL_REQUESTED: "tool.approval_requested";
|
|
16
|
+
readonly TOOL_APPROVAL_APPROVED: "tool.approval_approved";
|
|
17
|
+
readonly TOOL_APPROVAL_DENIED: "tool.approval_denied";
|
|
15
18
|
};
|
|
16
19
|
declare const AI_OPERATIONS: {
|
|
17
20
|
readonly GENERATE_TEXT: "ai.generateText.doGenerate";
|
|
@@ -53,6 +56,8 @@ declare const SPAN_KEYS: {
|
|
|
53
56
|
readonly AI_TOOL_CALL_ID: "ai.toolCall.id";
|
|
54
57
|
readonly AI_TOOL_TYPE: "ai.toolType";
|
|
55
58
|
readonly TOOL_PURPOSE: "tool.purpose";
|
|
59
|
+
readonly TOOL_NAME: "tool.name";
|
|
60
|
+
readonly TOOL_CALL_ID: "tool.callId";
|
|
56
61
|
readonly GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens";
|
|
57
62
|
readonly GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens";
|
|
58
63
|
readonly CONTEXT_URL: "context.url";
|
|
@@ -92,6 +97,9 @@ declare const ACTIVITY_TYPES: {
|
|
|
92
97
|
readonly AI_ASSISTANT_MESSAGE: "ai_assistant_message";
|
|
93
98
|
readonly AI_MODEL_STREAMED_TEXT: "ai_model_streamed_text";
|
|
94
99
|
readonly AI_MODEL_STREAMED_OBJECT: "ai_model_streamed_object";
|
|
100
|
+
readonly TOOL_APPROVAL_REQUESTED: "tool_approval_requested";
|
|
101
|
+
readonly TOOL_APPROVAL_APPROVED: "tool_approval_approved";
|
|
102
|
+
readonly TOOL_APPROVAL_DENIED: "tool_approval_denied";
|
|
95
103
|
};
|
|
96
104
|
/** Activity Status Values */
|
|
97
105
|
declare const ACTIVITY_STATUS: {
|
|
@@ -223,6 +231,9 @@ declare const QUERY_EXPRESSIONS: {
|
|
|
223
231
|
readonly AGENT_GENERATIONS: "agentGenerations";
|
|
224
232
|
readonly SPANS_WITH_ERRORS: "spansWithErrors";
|
|
225
233
|
readonly ARTIFACT_PROCESSING: "artifactProcessing";
|
|
234
|
+
readonly TOOL_APPROVAL_REQUESTED: "toolApprovalRequested";
|
|
235
|
+
readonly TOOL_APPROVAL_APPROVED: "toolApprovalApproved";
|
|
236
|
+
readonly TOOL_APPROVAL_DENIED: "toolApprovalDenied";
|
|
226
237
|
};
|
|
227
238
|
/** Query Reduce Operations */
|
|
228
239
|
declare const REDUCE_OPERATIONS: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/types/a2a.ts
|
|
2
|
+
var TaskState = /* @__PURE__ */ ((TaskState2) => {
|
|
3
|
+
TaskState2["Submitted"] = "submitted";
|
|
4
|
+
TaskState2["Working"] = "working";
|
|
5
|
+
TaskState2["InputRequired"] = "input-required";
|
|
6
|
+
TaskState2["Completed"] = "completed";
|
|
7
|
+
TaskState2["Canceled"] = "canceled";
|
|
8
|
+
TaskState2["Failed"] = "failed";
|
|
9
|
+
TaskState2["Rejected"] = "rejected";
|
|
10
|
+
TaskState2["AuthRequired"] = "auth-required";
|
|
11
|
+
TaskState2["Unknown"] = "unknown";
|
|
12
|
+
return TaskState2;
|
|
13
|
+
})(TaskState || {});
|
|
14
|
+
|
|
15
|
+
// src/types/tool-policies.ts
|
|
16
|
+
function normalizeToolSelections(selections) {
|
|
17
|
+
if (!selections || selections.length === 0) {
|
|
18
|
+
return { selectedTools: [], toolPolicies: {} };
|
|
19
|
+
}
|
|
20
|
+
const selectedTools = [];
|
|
21
|
+
const toolPolicies = {};
|
|
22
|
+
for (const selection of selections) {
|
|
23
|
+
if (typeof selection === "string") {
|
|
24
|
+
selectedTools.push(selection);
|
|
25
|
+
} else {
|
|
26
|
+
selectedTools.push(selection.name);
|
|
27
|
+
const policy = {};
|
|
28
|
+
if (selection.needsApproval !== void 0) {
|
|
29
|
+
policy.needsApproval = selection.needsApproval;
|
|
30
|
+
}
|
|
31
|
+
if (Object.keys(policy).length > 0) {
|
|
32
|
+
toolPolicies[selection.name] = policy;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { selectedTools, toolPolicies };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { TaskState, normalizeToolSelections };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { schema_exports, projects } from './chunk-
|
|
2
|
-
import { organization } from './chunk-
|
|
1
|
+
import { schema_exports, projects } from './chunk-PVRIMF6N.js';
|
|
2
|
+
import { organization } from './chunk-NFTJ5JBY.js';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { PGlite } from '@electric-sql/pglite';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { subAgents, subAgentRelations, agents, tasks, taskRelations, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, tools, functionTools, functions, contextConfigs, subAgentToolRelations, subAgentExternalAgentRelations, subAgentTeamAgentRelations, ledgerArtifacts, projects } from './chunk-
|
|
1
|
+
import { subAgents, subAgentRelations, agents, tasks, taskRelations, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, tools, functionTools, functions, contextConfigs, subAgentToolRelations, subAgentExternalAgentRelations, subAgentTeamAgentRelations, ledgerArtifacts, projects } from './chunk-PVRIMF6N.js';
|
|
2
2
|
import { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
|
|
3
3
|
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
|
|
4
4
|
import { z } from '@hono/zod-openapi';
|
|
@@ -587,9 +587,7 @@ var McpToolSchema = ToolInsertSchema.extend({
|
|
|
587
587
|
availableTools: z.array(McpToolDefinitionSchema).optional(),
|
|
588
588
|
status: ToolStatusSchema.default("unknown"),
|
|
589
589
|
version: z.string().optional(),
|
|
590
|
-
|
|
591
|
-
updatedAt: z.date(),
|
|
592
|
-
expiresAt: z.date().optional(),
|
|
590
|
+
expiresAt: z.string().optional(),
|
|
593
591
|
relationshipId: z.string().optional()
|
|
594
592
|
}).openapi("McpTool");
|
|
595
593
|
var MCPToolConfigSchema = McpToolSchema.omit({
|
|
@@ -688,7 +686,8 @@ var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations)
|
|
|
688
686
|
subAgentId: resourceIdSchema,
|
|
689
687
|
toolId: resourceIdSchema,
|
|
690
688
|
selectedTools: z.array(z.string()).nullish(),
|
|
691
|
-
headers: z.record(z.string(), z.string()).nullish()
|
|
689
|
+
headers: z.record(z.string(), z.string()).nullish(),
|
|
690
|
+
toolPolicies: z.record(z.string(), z.object({ needsApproval: z.boolean().optional() })).nullish()
|
|
692
691
|
});
|
|
693
692
|
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
694
693
|
var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
@@ -769,7 +768,8 @@ var CanUseItemSchema = z.object({
|
|
|
769
768
|
agentToolRelationId: z.string().optional(),
|
|
770
769
|
toolId: z.string(),
|
|
771
770
|
toolSelection: z.array(z.string()).nullish(),
|
|
772
|
-
headers: z.record(z.string(), z.string()).nullish()
|
|
771
|
+
headers: z.record(z.string(), z.string()).nullish(),
|
|
772
|
+
toolPolicies: z.record(z.string(), z.object({ needsApproval: z.boolean().optional() })).nullish()
|
|
773
773
|
}).openapi("CanUseItem");
|
|
774
774
|
var canDelegateToExternalAgentSchema = z.object({
|
|
775
775
|
externalAgentId: z.string(),
|
|
@@ -37,7 +37,10 @@ var envSchema = z.object({
|
|
|
37
37
|
ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
38
38
|
DATABASE_URL: z.string().optional(),
|
|
39
39
|
POSTGRES_POOL_SIZE: z.string().optional(),
|
|
40
|
-
INKEEP_AGENTS_JWT_SIGNING_SECRET: z.string().min(32, "INKEEP_AGENTS_JWT_SIGNING_SECRET must be at least 32 characters").optional()
|
|
40
|
+
INKEEP_AGENTS_JWT_SIGNING_SECRET: z.string().min(32, "INKEEP_AGENTS_JWT_SIGNING_SECRET must be at least 32 characters").optional(),
|
|
41
|
+
INKEEP_AGENTS_MANAGE_UI_URL: z.string().optional(),
|
|
42
|
+
INKEEP_AGENTS_MANAGE_API_URL: z.string().optional(),
|
|
43
|
+
BETTER_AUTH_SECRET: z.string().optional()
|
|
41
44
|
});
|
|
42
45
|
var parseEnv = () => {
|
|
43
46
|
try {
|
|
@@ -10,7 +10,10 @@ var SPAN_NAMES = {
|
|
|
10
10
|
CONTEXT_HANDLE: "context.handle_context_resolution",
|
|
11
11
|
AGENT_GENERATION: "agent.generate",
|
|
12
12
|
CONTEXT_FETCHER: "context-fetcher.http-request",
|
|
13
|
-
ARTIFACT_PROCESSING: "agent_session.process_artifact"
|
|
13
|
+
ARTIFACT_PROCESSING: "agent_session.process_artifact",
|
|
14
|
+
TOOL_APPROVAL_REQUESTED: "tool.approval_requested",
|
|
15
|
+
TOOL_APPROVAL_APPROVED: "tool.approval_approved",
|
|
16
|
+
TOOL_APPROVAL_DENIED: "tool.approval_denied"
|
|
14
17
|
};
|
|
15
18
|
var AI_OPERATIONS = {
|
|
16
19
|
GENERATE_TEXT: "ai.generateText.doGenerate",
|
|
@@ -55,6 +58,8 @@ var SPAN_KEYS = {
|
|
|
55
58
|
AI_TOOL_CALL_ID: "ai.toolCall.id",
|
|
56
59
|
AI_TOOL_TYPE: "ai.toolType",
|
|
57
60
|
TOOL_PURPOSE: "tool.purpose",
|
|
61
|
+
TOOL_NAME: "tool.name",
|
|
62
|
+
TOOL_CALL_ID: "tool.callId",
|
|
58
63
|
// Token usage
|
|
59
64
|
GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
|
|
60
65
|
GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
|
|
@@ -99,7 +104,10 @@ var ACTIVITY_TYPES = {
|
|
|
99
104
|
USER_MESSAGE: "user_message",
|
|
100
105
|
AI_ASSISTANT_MESSAGE: "ai_assistant_message",
|
|
101
106
|
AI_MODEL_STREAMED_TEXT: "ai_model_streamed_text",
|
|
102
|
-
AI_MODEL_STREAMED_OBJECT: "ai_model_streamed_object"
|
|
107
|
+
AI_MODEL_STREAMED_OBJECT: "ai_model_streamed_object",
|
|
108
|
+
TOOL_APPROVAL_REQUESTED: "tool_approval_requested",
|
|
109
|
+
TOOL_APPROVAL_APPROVED: "tool_approval_approved",
|
|
110
|
+
TOOL_APPROVAL_DENIED: "tool_approval_denied"
|
|
103
111
|
};
|
|
104
112
|
var ACTIVITY_STATUS = {
|
|
105
113
|
SUCCESS: "success",
|
|
@@ -231,7 +239,10 @@ var QUERY_EXPRESSIONS = {
|
|
|
231
239
|
DURATION_SPANS: "durationSpans",
|
|
232
240
|
AGENT_GENERATIONS: "agentGenerations",
|
|
233
241
|
SPANS_WITH_ERRORS: "spansWithErrors",
|
|
234
|
-
ARTIFACT_PROCESSING: "artifactProcessing"
|
|
242
|
+
ARTIFACT_PROCESSING: "artifactProcessing",
|
|
243
|
+
TOOL_APPROVAL_REQUESTED: "toolApprovalRequested",
|
|
244
|
+
TOOL_APPROVAL_APPROVED: "toolApprovalApproved",
|
|
245
|
+
TOOL_APPROVAL_DENIED: "toolApprovalDenied"
|
|
235
246
|
};
|
|
236
247
|
var REDUCE_OPERATIONS = {
|
|
237
248
|
SUM: "sum",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { verification, user, ssoProvider, session, organization, member, invitation, account } from './chunk-
|
|
1
|
+
import { verification, user, ssoProvider, session, organization, member, invitation, account } from './chunk-NFTJ5JBY.js';
|
|
2
2
|
import { __export } from './chunk-SIAA4J6H.js';
|
|
3
3
|
import { relations } from 'drizzle-orm';
|
|
4
4
|
import { pgTable, varchar, text, timestamp, jsonb, primaryKey, foreignKey, integer, index, unique } from 'drizzle-orm/pg-core';
|
|
@@ -436,6 +436,7 @@ var subAgentToolRelations = pgTable(
|
|
|
436
436
|
toolId: varchar("tool_id", { length: 256 }).notNull(),
|
|
437
437
|
selectedTools: jsonb("selected_tools").$type(),
|
|
438
438
|
headers: jsonb("headers").$type(),
|
|
439
|
+
toolPolicies: jsonb("tool_policies").$type(),
|
|
439
440
|
...timestamps
|
|
440
441
|
},
|
|
441
442
|
(table) => [
|