@inkeep/agents-core 0.0.0-dev-20251124223719 → 0.0.0-dev-20251125020527
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-validation-schemas.js +17 -17
- package/dist/auth/auth.d.ts +3 -3
- package/dist/auth/auth.js +4 -3
- package/dist/{auth-detection-CGqhPDnj.d.ts → auth-detection-7G0Dxt55.d.ts} +11 -0
- package/dist/{chunk-SSRRHYU4.js → chunk-7GZHUB4J.js} +4 -5
- package/dist/chunk-CMNLBV2A.js +39 -0
- package/dist/{chunk-MB2ZIPZS.js → chunk-FOK3JSQN.js} +5 -5
- package/dist/{chunk-SG75RA63.js → chunk-K54FZSDH.js} +1 -1
- package/dist/{chunk-32YRH2S7.js → chunk-KJHP6D3O.js} +63 -67
- package/dist/{chunk-Q5U2SVA6.js → chunk-LL6F3EAR.js} +11 -7
- package/dist/{chunk-TGESM3JG.js → chunk-MQMMFK2K.js} +14 -3
- package/dist/{chunk-NFYCSHD3.js → chunk-OHZDHXP7.js} +1 -0
- package/dist/{chunk-SLQW43IV.js → chunk-ZEZCCHV7.js} +4 -5
- package/dist/{chunk-ICZLNCX7.js → chunk-ZGL6KM2G.js} +358 -69
- package/dist/{chunk-VQXQOGJU.js → chunk-ZQU7AEXC.js} +313 -315
- package/dist/{client-CnpNkGsH.d.ts → client-B_3j-V4-.d.ts} +1 -1
- package/dist/client-exports.d.ts +6 -3
- package/dist/client-exports.js +126 -127
- package/dist/constants/schema-validation/index.js +1 -1
- package/dist/credential-stores/index.d.ts +3 -3
- package/dist/credential-stores/index.js +1 -1
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/db/test-client.d.ts +3 -3
- package/dist/db/test-client.js +1 -1
- package/dist/index.d.ts +126 -9
- package/dist/index.js +280 -64
- package/dist/{schema-Cgkp_geg.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-C_tTZ7-k.d.ts → utility-Lo5NoRHK.d.ts} +141 -11
- package/dist/utils/schema-conversion.js +1 -1
- 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 +14 -4
- package/dist/chunk-CUM6BY2Y.js +0 -320
- package/dist/chunk-H2F72PDA.js +0 -15
- package/dist/chunk-OUXC23J7.js +0 -12534
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { user, session, account, organization, member, invitation, verification } from '../chunk-NOPEANIU.js';
|
|
2
|
-
import { external_exports } from '../chunk-OUXC23J7.js';
|
|
3
2
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
3
|
+
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var UserSelectSchema = createSelectSchema(user);
|
|
6
6
|
var UserInsertSchema = createInsertSchema(user);
|
|
@@ -16,24 +16,24 @@ var InvitationSelectSchema = createSelectSchema(invitation);
|
|
|
16
16
|
var InvitationInsertSchema = createInsertSchema(invitation);
|
|
17
17
|
var VerificationSelectSchema = createSelectSchema(verification);
|
|
18
18
|
var VerificationInsertSchema = createInsertSchema(verification);
|
|
19
|
-
var UserOrganizationSchema =
|
|
20
|
-
id:
|
|
21
|
-
userId:
|
|
22
|
-
organizationId:
|
|
23
|
-
role:
|
|
24
|
-
createdAt:
|
|
25
|
-
organizationName:
|
|
26
|
-
organizationSlug:
|
|
19
|
+
var UserOrganizationSchema = z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
userId: z.string(),
|
|
22
|
+
organizationId: z.string(),
|
|
23
|
+
role: z.string(),
|
|
24
|
+
createdAt: z.union([z.string(), z.date()]).transform((val) => val instanceof Date ? val.toISOString() : val),
|
|
25
|
+
organizationName: z.string().nullable(),
|
|
26
|
+
organizationSlug: z.string().nullable()
|
|
27
27
|
});
|
|
28
|
-
var UserOrganizationsResponseSchema =
|
|
29
|
-
var AddUserToOrganizationRequestSchema =
|
|
30
|
-
organizationId:
|
|
31
|
-
role:
|
|
28
|
+
var UserOrganizationsResponseSchema = z.array(UserOrganizationSchema);
|
|
29
|
+
var AddUserToOrganizationRequestSchema = z.object({
|
|
30
|
+
organizationId: z.string(),
|
|
31
|
+
role: z.string().default("member")
|
|
32
32
|
});
|
|
33
|
-
var AddUserToOrganizationResponseSchema =
|
|
34
|
-
organizationId:
|
|
35
|
-
role:
|
|
36
|
-
createdAt:
|
|
33
|
+
var AddUserToOrganizationResponseSchema = z.object({
|
|
34
|
+
organizationId: z.string(),
|
|
35
|
+
role: z.string(),
|
|
36
|
+
createdAt: z.string()
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
export { AccountInsertSchema, AccountSelectSchema, AddUserToOrganizationRequestSchema, AddUserToOrganizationResponseSchema, InvitationInsertSchema, InvitationSelectSchema, MemberInsertSchema, MemberSelectSchema, OrganizationInsertSchema, OrganizationSelectSchema, SessionInsertSchema, SessionSelectSchema, UserInsertSchema, UserOrganizationSchema, UserOrganizationsResponseSchema, UserSelectSchema, VerificationInsertSchema, VerificationSelectSchema };
|
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,8 +1,9 @@
|
|
|
1
|
-
import { generateId } from '../chunk-
|
|
1
|
+
import { generateId } from '../chunk-ZGL6KM2G.js';
|
|
2
|
+
import { env } from '../chunk-LL6F3EAR.js';
|
|
2
3
|
import { ssoProvider } from '../chunk-NOPEANIU.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';
|
|
@@ -88,7 +89,7 @@ function createAuth(config) {
|
|
|
88
89
|
"http://localhost:3002",
|
|
89
90
|
env.INKEEP_AGENTS_MANAGE_UI_URL,
|
|
90
91
|
env.INKEEP_AGENTS_MANAGE_API_URL
|
|
91
|
-
],
|
|
92
|
+
].filter((origin) => typeof origin === "string" && origin.length > 0),
|
|
92
93
|
plugins: [
|
|
93
94
|
sso(),
|
|
94
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: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { getLogger } from './chunk-DN4B564Y.js';
|
|
2
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
// src/utils/schema-conversion.ts
|
|
5
4
|
var logger = getLogger("schema-conversion");
|
|
6
5
|
function convertZodToJsonSchema(zodSchema) {
|
|
7
6
|
try {
|
|
8
|
-
const jsonSchema =
|
|
7
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
9
8
|
if (jsonSchema.$schema) {
|
|
10
9
|
delete jsonSchema.$schema;
|
|
11
10
|
}
|
|
@@ -27,7 +26,7 @@ var preview = (schema) => {
|
|
|
27
26
|
};
|
|
28
27
|
function convertZodToJsonSchemaWithPreview(zodSchema) {
|
|
29
28
|
const jsonSchema = convertZodToJsonSchema(zodSchema);
|
|
30
|
-
if (zodSchema instanceof
|
|
29
|
+
if (zodSchema instanceof z.ZodObject && jsonSchema.properties) {
|
|
31
30
|
const shape = zodSchema.shape;
|
|
32
31
|
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
33
32
|
if (fieldSchema?._def?.inPreview === true) {
|
|
@@ -42,7 +41,7 @@ function isZodSchema(value) {
|
|
|
42
41
|
}
|
|
43
42
|
function extractPreviewFields(schema) {
|
|
44
43
|
const previewFields = [];
|
|
45
|
-
if (schema instanceof
|
|
44
|
+
if (schema instanceof z.ZodObject) {
|
|
46
45
|
const shape = schema.shape;
|
|
47
46
|
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
48
47
|
if (fieldSchema?._def?.inPreview === true) {
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { getLogger } from './chunk-DN4B564Y.js';
|
|
2
2
|
import { CredentialStoreType } from './chunk-YFHT5M2R.js';
|
|
3
|
-
import { external_exports } from './chunk-OUXC23J7.js';
|
|
4
3
|
import { Nango } from '@nangohq/node';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
// src/credential-stores/CredentialStoreRegistry.ts
|
|
7
7
|
var CredentialStoreRegistry = class {
|
|
@@ -349,10 +349,10 @@ var InMemoryCredentialStore = class {
|
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
351
|
var logger = getLogger("nango-credential-store");
|
|
352
|
-
var CredentialKeySchema =
|
|
353
|
-
connectionId:
|
|
354
|
-
providerConfigKey:
|
|
355
|
-
integrationDisplayName:
|
|
352
|
+
var CredentialKeySchema = z.object({
|
|
353
|
+
connectionId: z.string().min(1, "connectionId must be a non-empty string"),
|
|
354
|
+
providerConfigKey: z.string().min(1, "providerConfigKey must be a non-empty string"),
|
|
355
|
+
integrationDisplayName: z.string().nullish()
|
|
356
356
|
});
|
|
357
357
|
function parseCredentialKey(key) {
|
|
358
358
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-ZQU7AEXC.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
// src/validation/cycleDetection.ts
|
|
5
5
|
function detectDelegationCycles(agentData) {
|
|
@@ -181,44 +181,42 @@ function validateAgentStructure(agentData, projectResources) {
|
|
|
181
181
|
}
|
|
182
182
|
validateAgentRelationships(agentData);
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
reason: external_exports.string().optional().describe("Reason for the transfer"),
|
|
190
|
-
context: external_exports.any().optional().describe("Additional context data")
|
|
184
|
+
var TransferDataSchema = z.object({
|
|
185
|
+
fromSubAgent: z.string().describe("ID of the sub-agent transferring control"),
|
|
186
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving control"),
|
|
187
|
+
reason: z.string().optional().describe("Reason for the transfer"),
|
|
188
|
+
context: z.any().optional().describe("Additional context data")
|
|
191
189
|
});
|
|
192
|
-
var DelegationSentDataSchema =
|
|
193
|
-
delegationId:
|
|
194
|
-
fromSubAgent:
|
|
195
|
-
targetSubAgent:
|
|
196
|
-
taskDescription:
|
|
197
|
-
context:
|
|
190
|
+
var DelegationSentDataSchema = z.object({
|
|
191
|
+
delegationId: z.string().describe("Unique identifier for this delegation"),
|
|
192
|
+
fromSubAgent: z.string().describe("ID of the delegating sub-agent"),
|
|
193
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving the delegation"),
|
|
194
|
+
taskDescription: z.string().describe("Description of the delegated task"),
|
|
195
|
+
context: z.any().optional().describe("Additional context data")
|
|
198
196
|
});
|
|
199
|
-
var DelegationReturnedDataSchema =
|
|
200
|
-
delegationId:
|
|
201
|
-
fromSubAgent:
|
|
202
|
-
targetSubAgent:
|
|
203
|
-
result:
|
|
197
|
+
var DelegationReturnedDataSchema = z.object({
|
|
198
|
+
delegationId: z.string().describe("Unique identifier matching the original delegation"),
|
|
199
|
+
fromSubAgent: z.string().describe("ID of the sub-agent that completed the task"),
|
|
200
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving the result"),
|
|
201
|
+
result: z.any().optional().describe("Result data from the delegated task")
|
|
204
202
|
});
|
|
205
|
-
var DataOperationDetailsSchema =
|
|
206
|
-
timestamp:
|
|
207
|
-
subAgentId:
|
|
208
|
-
data:
|
|
203
|
+
var DataOperationDetailsSchema = z.object({
|
|
204
|
+
timestamp: z.number().describe("Unix timestamp in milliseconds"),
|
|
205
|
+
subAgentId: z.string().describe("ID of the sub-agent that generated this data"),
|
|
206
|
+
data: z.any().describe("The actual data payload")
|
|
209
207
|
});
|
|
210
|
-
var DataOperationEventSchema =
|
|
211
|
-
type:
|
|
212
|
-
label:
|
|
208
|
+
var DataOperationEventSchema = z.object({
|
|
209
|
+
type: z.string().describe("Event type identifier"),
|
|
210
|
+
label: z.string().describe("Human-readable label for the event"),
|
|
213
211
|
details: DataOperationDetailsSchema
|
|
214
212
|
});
|
|
215
|
-
var A2AMessageMetadataSchema =
|
|
216
|
-
fromSubAgentId:
|
|
217
|
-
toSubAgentId:
|
|
218
|
-
fromExternalAgentId:
|
|
219
|
-
toExternalAgentId:
|
|
220
|
-
taskId:
|
|
221
|
-
a2aTaskId:
|
|
213
|
+
var A2AMessageMetadataSchema = z.object({
|
|
214
|
+
fromSubAgentId: z.string().optional().describe("ID of the sending sub-agent"),
|
|
215
|
+
toSubAgentId: z.string().optional().describe("ID of the receiving sub-agent"),
|
|
216
|
+
fromExternalAgentId: z.string().optional().describe("ID of the sending external agent"),
|
|
217
|
+
toExternalAgentId: z.string().optional().describe("ID of the receiving external agent"),
|
|
218
|
+
taskId: z.string().optional().describe("Associated task ID"),
|
|
219
|
+
a2aTaskId: z.string().optional().describe("A2A-specific task ID")
|
|
222
220
|
});
|
|
223
221
|
|
|
224
222
|
// src/validation/id-validation.ts
|
|
@@ -341,50 +339,48 @@ function validateRender(render) {
|
|
|
341
339
|
errors
|
|
342
340
|
};
|
|
343
341
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
type: external_exports.literal("text-start"),
|
|
348
|
-
id: external_exports.string()
|
|
342
|
+
var TextStartEventSchema = z.object({
|
|
343
|
+
type: z.literal("text-start"),
|
|
344
|
+
id: z.string()
|
|
349
345
|
});
|
|
350
|
-
var TextDeltaEventSchema =
|
|
351
|
-
type:
|
|
352
|
-
id:
|
|
353
|
-
delta:
|
|
346
|
+
var TextDeltaEventSchema = z.object({
|
|
347
|
+
type: z.literal("text-delta"),
|
|
348
|
+
id: z.string(),
|
|
349
|
+
delta: z.string()
|
|
354
350
|
});
|
|
355
|
-
var TextEndEventSchema =
|
|
356
|
-
type:
|
|
357
|
-
id:
|
|
351
|
+
var TextEndEventSchema = z.object({
|
|
352
|
+
type: z.literal("text-end"),
|
|
353
|
+
id: z.string()
|
|
358
354
|
});
|
|
359
|
-
var DataComponentStreamEventSchema =
|
|
360
|
-
type:
|
|
361
|
-
id:
|
|
362
|
-
data:
|
|
355
|
+
var DataComponentStreamEventSchema = z.object({
|
|
356
|
+
type: z.literal("data-component"),
|
|
357
|
+
id: z.string(),
|
|
358
|
+
data: z.any()
|
|
363
359
|
});
|
|
364
|
-
var DataOperationStreamEventSchema =
|
|
365
|
-
type:
|
|
366
|
-
data:
|
|
360
|
+
var DataOperationStreamEventSchema = z.object({
|
|
361
|
+
type: z.literal("data-operation"),
|
|
362
|
+
data: z.any()
|
|
367
363
|
// Contains OperationEvent types (AgentInitializingEvent, CompletionEvent, etc.)
|
|
368
364
|
});
|
|
369
|
-
var DataSummaryStreamEventSchema =
|
|
370
|
-
type:
|
|
371
|
-
data:
|
|
365
|
+
var DataSummaryStreamEventSchema = z.object({
|
|
366
|
+
type: z.literal("data-summary"),
|
|
367
|
+
data: z.any()
|
|
372
368
|
// Contains SummaryEvent from entities.ts
|
|
373
369
|
});
|
|
374
|
-
var StreamErrorEventSchema =
|
|
375
|
-
type:
|
|
376
|
-
error:
|
|
370
|
+
var StreamErrorEventSchema = z.object({
|
|
371
|
+
type: z.literal("error"),
|
|
372
|
+
error: z.string()
|
|
377
373
|
});
|
|
378
|
-
var StreamFinishEventSchema =
|
|
379
|
-
type:
|
|
380
|
-
finishReason:
|
|
381
|
-
usage:
|
|
382
|
-
promptTokens:
|
|
383
|
-
completionTokens:
|
|
384
|
-
totalTokens:
|
|
374
|
+
var StreamFinishEventSchema = z.object({
|
|
375
|
+
type: z.literal("finish"),
|
|
376
|
+
finishReason: z.string().optional(),
|
|
377
|
+
usage: z.object({
|
|
378
|
+
promptTokens: z.number().optional(),
|
|
379
|
+
completionTokens: z.number().optional(),
|
|
380
|
+
totalTokens: z.number().optional()
|
|
385
381
|
}).optional()
|
|
386
382
|
});
|
|
387
|
-
var StreamEventSchema =
|
|
383
|
+
var StreamEventSchema = z.discriminatedUnion("type", [
|
|
388
384
|
TextStartEventSchema,
|
|
389
385
|
TextDeltaEventSchema,
|
|
390
386
|
TextEndEventSchema,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { external_exports } from './chunk-OUXC23J7.js';
|
|
2
1
|
import fs from 'fs';
|
|
3
2
|
import os from 'os';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import dotenv from 'dotenv';
|
|
6
5
|
import { expand } from 'dotenv-expand';
|
|
7
6
|
import { findUpSync } from 'find-up';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
|
|
9
|
+
// src/env.ts
|
|
9
10
|
var loadEnvironmentFiles = () => {
|
|
10
11
|
const environmentFiles = [];
|
|
11
12
|
const currentEnv = path.resolve(process.cwd(), ".env");
|
|
@@ -32,18 +33,21 @@ var loadEnvironmentFiles = () => {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
loadEnvironmentFiles();
|
|
35
|
-
var envSchema =
|
|
36
|
-
ENVIRONMENT:
|
|
37
|
-
DATABASE_URL:
|
|
38
|
-
POSTGRES_POOL_SIZE:
|
|
39
|
-
INKEEP_AGENTS_JWT_SIGNING_SECRET:
|
|
36
|
+
var envSchema = z.object({
|
|
37
|
+
ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
38
|
+
DATABASE_URL: z.string().optional(),
|
|
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(),
|
|
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()
|
|
40
44
|
});
|
|
41
45
|
var parseEnv = () => {
|
|
42
46
|
try {
|
|
43
47
|
const parsedEnv = envSchema.parse(process.env);
|
|
44
48
|
return parsedEnv;
|
|
45
49
|
} catch (error) {
|
|
46
|
-
if (error instanceof
|
|
50
|
+
if (error instanceof z.ZodError) {
|
|
47
51
|
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
48
52
|
throw new Error(
|
|
49
53
|
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
@@ -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",
|
|
@@ -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) => [
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { schemaValidationDefaults } from './chunk-Z64UK4CA.js';
|
|
2
|
-
import { loadEnvironmentFiles } from './chunk-
|
|
3
|
-
import {
|
|
2
|
+
import { loadEnvironmentFiles } from './chunk-LL6F3EAR.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
// src/constants/schema-validation/index.ts
|
|
6
5
|
loadEnvironmentFiles();
|
|
7
|
-
var constantsSchema =
|
|
6
|
+
var constantsSchema = z.object(
|
|
8
7
|
Object.fromEntries(
|
|
9
8
|
Object.keys(schemaValidationDefaults).map((key) => [
|
|
10
9
|
`AGENTS_${key}`,
|
|
11
|
-
|
|
10
|
+
z.coerce.number().optional()
|
|
12
11
|
])
|
|
13
12
|
)
|
|
14
13
|
);
|