@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.
Files changed (42) hide show
  1. package/dist/auth/auth-validation-schemas.js +17 -17
  2. package/dist/auth/auth.d.ts +3 -3
  3. package/dist/auth/auth.js +4 -3
  4. package/dist/{auth-detection-CGqhPDnj.d.ts → auth-detection-7G0Dxt55.d.ts} +11 -0
  5. package/dist/{chunk-SSRRHYU4.js → chunk-7GZHUB4J.js} +4 -5
  6. package/dist/chunk-CMNLBV2A.js +39 -0
  7. package/dist/{chunk-MB2ZIPZS.js → chunk-FOK3JSQN.js} +5 -5
  8. package/dist/{chunk-SG75RA63.js → chunk-K54FZSDH.js} +1 -1
  9. package/dist/{chunk-32YRH2S7.js → chunk-KJHP6D3O.js} +63 -67
  10. package/dist/{chunk-Q5U2SVA6.js → chunk-LL6F3EAR.js} +11 -7
  11. package/dist/{chunk-TGESM3JG.js → chunk-MQMMFK2K.js} +14 -3
  12. package/dist/{chunk-NFYCSHD3.js → chunk-OHZDHXP7.js} +1 -0
  13. package/dist/{chunk-SLQW43IV.js → chunk-ZEZCCHV7.js} +4 -5
  14. package/dist/{chunk-ICZLNCX7.js → chunk-ZGL6KM2G.js} +358 -69
  15. package/dist/{chunk-VQXQOGJU.js → chunk-ZQU7AEXC.js} +313 -315
  16. package/dist/{client-CnpNkGsH.d.ts → client-B_3j-V4-.d.ts} +1 -1
  17. package/dist/client-exports.d.ts +6 -3
  18. package/dist/client-exports.js +126 -127
  19. package/dist/constants/schema-validation/index.js +1 -1
  20. package/dist/credential-stores/index.d.ts +3 -3
  21. package/dist/credential-stores/index.js +1 -1
  22. package/dist/db/schema.d.ts +2 -2
  23. package/dist/db/schema.js +1 -1
  24. package/dist/db/test-client.d.ts +3 -3
  25. package/dist/db/test-client.js +1 -1
  26. package/dist/index.d.ts +126 -9
  27. package/dist/index.js +280 -64
  28. package/dist/{schema-Cgkp_geg.d.ts → schema-DKbG39on.d.ts} +24 -1
  29. package/dist/server-BXoUiBMg.d.ts +127 -0
  30. package/dist/types/index.d.ts +33 -113
  31. package/dist/types/index.js +1 -1
  32. package/dist/{utility-C_tTZ7-k.d.ts → utility-Lo5NoRHK.d.ts} +141 -11
  33. package/dist/utils/schema-conversion.js +1 -1
  34. package/dist/validation/index.d.ts +2 -2
  35. package/dist/validation/index.js +2 -2
  36. package/drizzle/{0001_fair_malice.sql → 0001_calm_sheva_callister.sql} +1 -16
  37. package/drizzle/meta/0001_snapshot.json +7 -1
  38. package/drizzle/meta/_journal.json +2 -2
  39. package/package.json +14 -4
  40. package/dist/chunk-CUM6BY2Y.js +0 -320
  41. package/dist/chunk-H2F72PDA.js +0 -15
  42. 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 = external_exports.object({
20
- id: external_exports.string(),
21
- userId: external_exports.string(),
22
- organizationId: external_exports.string(),
23
- role: external_exports.string(),
24
- createdAt: external_exports.union([external_exports.string(), external_exports.date()]).transform((val) => val instanceof Date ? val.toISOString() : val),
25
- organizationName: external_exports.string().nullable(),
26
- organizationSlug: external_exports.string().nullable()
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 = external_exports.array(UserOrganizationSchema);
29
- var AddUserToOrganizationRequestSchema = external_exports.object({
30
- organizationId: external_exports.string(),
31
- role: external_exports.string().default("member")
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 = external_exports.object({
34
- organizationId: external_exports.string(),
35
- role: external_exports.string(),
36
- createdAt: external_exports.string()
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 };
@@ -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-CnpNkGsH.js';
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-Cgkp_geg.js';
10
+ import '../schema-DKbG39on.js';
11
11
  import 'drizzle-orm';
12
12
  import 'drizzle-orm/pg-core';
13
- import '../utility-C_tTZ7-k.js';
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-ICZLNCX7.js';
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, env } from 'better-auth';
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 { external_exports } from './chunk-OUXC23J7.js';
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 = external_exports.toJSONSchema(zodSchema);
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 external_exports.ZodObject && jsonSchema.properties) {
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 external_exports.ZodObject) {
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 = external_exports.object({
353
- connectionId: external_exports.string().min(1, "connectionId must be a non-empty string"),
354
- providerConfigKey: external_exports.string().min(1, "providerConfigKey must be a non-empty string"),
355
- integrationDisplayName: external_exports.string().nullish()
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,4 +1,4 @@
1
- import { schema_exports, projects } from './chunk-NFYCSHD3.js';
1
+ import { schema_exports, projects } from './chunk-OHZDHXP7.js';
2
2
  import { organization } from './chunk-NOPEANIU.js';
3
3
  import { dirname, join } from 'path';
4
4
  import { fileURLToPath } from 'url';
@@ -1,5 +1,5 @@
1
- import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-VQXQOGJU.js';
2
- import { external_exports } from './chunk-OUXC23J7.js';
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
- // src/validation/event-schemas.ts
186
- var TransferDataSchema = external_exports.object({
187
- fromSubAgent: external_exports.string().describe("ID of the sub-agent transferring control"),
188
- targetSubAgent: external_exports.string().describe("ID of the sub-agent receiving control"),
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 = external_exports.object({
193
- delegationId: external_exports.string().describe("Unique identifier for this delegation"),
194
- fromSubAgent: external_exports.string().describe("ID of the delegating sub-agent"),
195
- targetSubAgent: external_exports.string().describe("ID of the sub-agent receiving the delegation"),
196
- taskDescription: external_exports.string().describe("Description of the delegated task"),
197
- context: external_exports.any().optional().describe("Additional context data")
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 = external_exports.object({
200
- delegationId: external_exports.string().describe("Unique identifier matching the original delegation"),
201
- fromSubAgent: external_exports.string().describe("ID of the sub-agent that completed the task"),
202
- targetSubAgent: external_exports.string().describe("ID of the sub-agent receiving the result"),
203
- result: external_exports.any().optional().describe("Result data from the delegated task")
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 = external_exports.object({
206
- timestamp: external_exports.number().describe("Unix timestamp in milliseconds"),
207
- subAgentId: external_exports.string().describe("ID of the sub-agent that generated this data"),
208
- data: external_exports.any().describe("The actual data payload")
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 = external_exports.object({
211
- type: external_exports.string().describe("Event type identifier"),
212
- label: external_exports.string().describe("Human-readable label for the event"),
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 = external_exports.object({
216
- fromSubAgentId: external_exports.string().optional().describe("ID of the sending sub-agent"),
217
- toSubAgentId: external_exports.string().optional().describe("ID of the receiving sub-agent"),
218
- fromExternalAgentId: external_exports.string().optional().describe("ID of the sending external agent"),
219
- toExternalAgentId: external_exports.string().optional().describe("ID of the receiving external agent"),
220
- taskId: external_exports.string().optional().describe("Associated task ID"),
221
- a2aTaskId: external_exports.string().optional().describe("A2A-specific task ID")
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
- // src/validation/stream-event-schemas.ts
346
- var TextStartEventSchema = external_exports.object({
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 = external_exports.object({
351
- type: external_exports.literal("text-delta"),
352
- id: external_exports.string(),
353
- delta: external_exports.string()
346
+ var TextDeltaEventSchema = z.object({
347
+ type: z.literal("text-delta"),
348
+ id: z.string(),
349
+ delta: z.string()
354
350
  });
355
- var TextEndEventSchema = external_exports.object({
356
- type: external_exports.literal("text-end"),
357
- id: external_exports.string()
351
+ var TextEndEventSchema = z.object({
352
+ type: z.literal("text-end"),
353
+ id: z.string()
358
354
  });
359
- var DataComponentStreamEventSchema = external_exports.object({
360
- type: external_exports.literal("data-component"),
361
- id: external_exports.string(),
362
- data: external_exports.any()
355
+ var DataComponentStreamEventSchema = z.object({
356
+ type: z.literal("data-component"),
357
+ id: z.string(),
358
+ data: z.any()
363
359
  });
364
- var DataOperationStreamEventSchema = external_exports.object({
365
- type: external_exports.literal("data-operation"),
366
- data: external_exports.any()
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 = external_exports.object({
370
- type: external_exports.literal("data-summary"),
371
- data: external_exports.any()
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 = external_exports.object({
375
- type: external_exports.literal("error"),
376
- error: external_exports.string()
370
+ var StreamErrorEventSchema = z.object({
371
+ type: z.literal("error"),
372
+ error: z.string()
377
373
  });
378
- var StreamFinishEventSchema = external_exports.object({
379
- type: external_exports.literal("finish"),
380
- finishReason: external_exports.string().optional(),
381
- usage: external_exports.object({
382
- promptTokens: external_exports.number().optional(),
383
- completionTokens: external_exports.number().optional(),
384
- totalTokens: external_exports.number().optional()
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 = external_exports.discriminatedUnion("type", [
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 = external_exports.object({
36
- ENVIRONMENT: external_exports.enum(["development", "production", "pentest", "test"]).optional(),
37
- DATABASE_URL: external_exports.string().optional(),
38
- POSTGRES_POOL_SIZE: external_exports.string().optional(),
39
- INKEEP_AGENTS_JWT_SIGNING_SECRET: external_exports.string().min(32, "INKEEP_AGENTS_JWT_SIGNING_SECRET must be at least 32 characters").optional()
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 external_exports.ZodError) {
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-Q5U2SVA6.js';
3
- import { external_exports } from './chunk-OUXC23J7.js';
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 = external_exports.object(
6
+ var constantsSchema = z.object(
8
7
  Object.fromEntries(
9
8
  Object.keys(schemaValidationDefaults).map((key) => [
10
9
  `AGENTS_${key}`,
11
- external_exports.coerce.number().optional()
10
+ z.coerce.number().optional()
12
11
  ])
13
12
  )
14
13
  );