@inkeep/agents-core 0.0.0-dev-20251124234228 → 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.js +2 -2
- package/dist/{chunk-SSRRHYU4.js → chunk-7GZHUB4J.js} +4 -5
- package/dist/{chunk-MB2ZIPZS.js → chunk-FOK3JSQN.js} +5 -5
- package/dist/{chunk-6XW4J5LI.js → chunk-KJHP6D3O.js} +63 -67
- package/dist/{chunk-NMBNWFIZ.js → chunk-LL6F3EAR.js} +11 -10
- package/dist/{chunk-ATWIYWOU.js → chunk-ZEZCCHV7.js} +4 -5
- package/dist/{chunk-K3UNCRSA.js → chunk-ZGL6KM2G.js} +29 -30
- package/dist/{chunk-N7TIJHWC.js → chunk-ZQU7AEXC.js} +312 -314
- package/dist/client-exports.js +125 -126
- package/dist/constants/schema-validation/index.js +1 -1
- package/dist/credential-stores/index.js +1 -1
- package/dist/index.js +14 -16
- package/dist/utils/schema-conversion.js +1 -1
- package/dist/validation/index.js +2 -2
- package/package.json +8 -4
- package/dist/chunk-CUM6BY2Y.js +0 -320
- 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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generateId } from '../chunk-
|
|
2
|
-
import { env } from '../chunk-
|
|
1
|
+
import { generateId } from '../chunk-ZGL6KM2G.js';
|
|
2
|
+
import { env } from '../chunk-LL6F3EAR.js';
|
|
3
3
|
import { ssoProvider } from '../chunk-NOPEANIU.js';
|
|
4
4
|
import { ownerRole, adminRole, memberRole, ac } from '../chunk-VMSYBWFH.js';
|
|
5
5
|
import { sso } from '@better-auth/sso';
|
|
@@ -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) {
|
|
@@ -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,21 +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:
|
|
40
|
-
INKEEP_AGENTS_MANAGE_UI_URL:
|
|
41
|
-
INKEEP_AGENTS_MANAGE_API_URL:
|
|
42
|
-
BETTER_AUTH_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()
|
|
43
44
|
});
|
|
44
45
|
var parseEnv = () => {
|
|
45
46
|
try {
|
|
46
47
|
const parsedEnv = envSchema.parse(process.env);
|
|
47
48
|
return parsedEnv;
|
|
48
49
|
} catch (error) {
|
|
49
|
-
if (error instanceof
|
|
50
|
+
if (error instanceof z.ZodError) {
|
|
50
51
|
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
51
52
|
throw new Error(
|
|
52
53
|
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
@@ -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
|
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { loadEnvironmentFiles, env } from './chunk-
|
|
1
|
+
import { loadEnvironmentFiles, env } from './chunk-LL6F3EAR.js';
|
|
2
2
|
import { getLogger } from './chunk-DN4B564Y.js';
|
|
3
3
|
import { CredentialStoreType, MCPTransportType } from './chunk-YFHT5M2R.js';
|
|
4
|
-
import {
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
import { customAlphabet } from 'nanoid';
|
|
6
6
|
import { scrypt, randomBytes, timingSafeEqual } from 'crypto';
|
|
7
7
|
import { promisify } from 'util';
|
|
8
|
+
import { z as z$1 } from '@hono/zod-openapi';
|
|
8
9
|
import { HTTPException } from 'hono/http-exception';
|
|
9
10
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
10
11
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
@@ -53,14 +54,12 @@ var executionLimitsSharedDefaults = {
|
|
|
53
54
|
// Increased from 4,000 to 8,000 to accommodate tool results in conversation history.
|
|
54
55
|
CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT: 8e3
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
-
// src/constants/execution-limits-shared/index.ts
|
|
58
57
|
loadEnvironmentFiles();
|
|
59
|
-
var constantsSchema =
|
|
58
|
+
var constantsSchema = z.object(
|
|
60
59
|
Object.fromEntries(
|
|
61
60
|
Object.keys(executionLimitsSharedDefaults).map((key) => [
|
|
62
61
|
`AGENTS_${key}`,
|
|
63
|
-
|
|
62
|
+
z.coerce.number().optional()
|
|
64
63
|
])
|
|
65
64
|
)
|
|
66
65
|
);
|
|
@@ -196,7 +195,7 @@ function toISODateString(dateValue) {
|
|
|
196
195
|
}
|
|
197
196
|
return dateValue.toISOString();
|
|
198
197
|
}
|
|
199
|
-
var ErrorCode =
|
|
198
|
+
var ErrorCode = z$1.enum([
|
|
200
199
|
"bad_request",
|
|
201
200
|
"unauthorized",
|
|
202
201
|
"forbidden",
|
|
@@ -215,28 +214,28 @@ var errorCodeToHttpStatus = {
|
|
|
215
214
|
internal_server_error: 500
|
|
216
215
|
};
|
|
217
216
|
var ERROR_DOCS_BASE_URL = "https://docs.inkeep.com/agents-api/errors";
|
|
218
|
-
var problemDetailsSchema =
|
|
217
|
+
var problemDetailsSchema = z$1.object({
|
|
219
218
|
// type: z.string().url().openapi({
|
|
220
219
|
// description: "A URI reference that identifies the problem type.",
|
|
221
220
|
// example: `${ERROR_DOCS_BASE_URL}#not-found`,
|
|
222
221
|
// }),
|
|
223
|
-
title:
|
|
222
|
+
title: z$1.string().openapi({
|
|
224
223
|
description: "A short, human-readable summary of the problem type.",
|
|
225
224
|
example: "Resource Not Found"
|
|
226
225
|
}),
|
|
227
|
-
status:
|
|
226
|
+
status: z$1.number().int().openapi({
|
|
228
227
|
description: "The HTTP status code.",
|
|
229
228
|
example: 404
|
|
230
229
|
}),
|
|
231
|
-
detail:
|
|
230
|
+
detail: z$1.string().openapi({
|
|
232
231
|
description: "A human-readable explanation specific to this occurrence of the problem.",
|
|
233
232
|
example: "The requested resource was not found."
|
|
234
233
|
}),
|
|
235
|
-
instance:
|
|
234
|
+
instance: z$1.string().optional().openapi({
|
|
236
235
|
description: "A URI reference that identifies the specific occurrence of the problem.",
|
|
237
236
|
example: "/conversations/123"
|
|
238
237
|
}),
|
|
239
|
-
requestId:
|
|
238
|
+
requestId: z$1.string().optional().openapi({
|
|
240
239
|
description: "A unique identifier for the request, useful for troubleshooting.",
|
|
241
240
|
example: "req_1234567890"
|
|
242
241
|
}),
|
|
@@ -245,13 +244,13 @@ var problemDetailsSchema = external_exports.object({
|
|
|
245
244
|
example: "not_found"
|
|
246
245
|
})
|
|
247
246
|
}).openapi("ProblemDetails");
|
|
248
|
-
var errorResponseSchema =
|
|
249
|
-
error:
|
|
247
|
+
var errorResponseSchema = z$1.object({
|
|
248
|
+
error: z$1.object({
|
|
250
249
|
code: ErrorCode.openapi({
|
|
251
250
|
description: "A short code indicating the error code returned.",
|
|
252
251
|
example: "not_found"
|
|
253
252
|
}),
|
|
254
|
-
message:
|
|
253
|
+
message: z$1.string().openapi({
|
|
255
254
|
description: "A human readable error message.",
|
|
256
255
|
example: "The requested resource was not found."
|
|
257
256
|
})
|
|
@@ -389,15 +388,15 @@ var errorSchemaFactory = (code, description) => ({
|
|
|
389
388
|
content: {
|
|
390
389
|
"application/problem+json": {
|
|
391
390
|
schema: problemDetailsSchema.extend({
|
|
392
|
-
code:
|
|
391
|
+
code: z$1.literal(code).openapi({
|
|
393
392
|
description: "A short code indicating the error code returned.",
|
|
394
393
|
example: code
|
|
395
394
|
}),
|
|
396
|
-
detail:
|
|
395
|
+
detail: z$1.string().openapi({
|
|
397
396
|
description: "A detailed explanation specific to this occurrence of the problem, providing context and specifics about what went wrong.",
|
|
398
397
|
example: description
|
|
399
398
|
}),
|
|
400
|
-
title:
|
|
399
|
+
title: z$1.string().openapi({
|
|
401
400
|
description: "A short, human-readable summary of the problem type.",
|
|
402
401
|
example: getTitleFromCode(code)
|
|
403
402
|
}),
|
|
@@ -405,16 +404,16 @@ var errorSchemaFactory = (code, description) => ({
|
|
|
405
404
|
// description: "A URI reference that identifies the problem type.",
|
|
406
405
|
// example: `${ERROR_DOCS_BASE_URL}#${code}`,
|
|
407
406
|
// }),
|
|
408
|
-
status:
|
|
407
|
+
status: z$1.number().int().openapi({
|
|
409
408
|
description: "The HTTP status code.",
|
|
410
409
|
example: errorCodeToHttpStatus[code]
|
|
411
410
|
}),
|
|
412
|
-
error:
|
|
413
|
-
code:
|
|
411
|
+
error: z$1.object({
|
|
412
|
+
code: z$1.literal(code).openapi({
|
|
414
413
|
description: "A short code indicating the error code returned.",
|
|
415
414
|
example: code
|
|
416
415
|
}),
|
|
417
|
-
message:
|
|
416
|
+
message: z$1.string().openapi({
|
|
418
417
|
description: "A concise error message suitable for display to end users. May be truncated if the full detail is long.",
|
|
419
418
|
example: description.length > 100 ? `${description.substring(0, 97)}...` : description
|
|
420
419
|
})
|
|
@@ -614,7 +613,7 @@ var McpClient = class {
|
|
|
614
613
|
try {
|
|
615
614
|
const createZodSchema = (inputSchema) => {
|
|
616
615
|
if (!inputSchema || !inputSchema.properties) {
|
|
617
|
-
return
|
|
616
|
+
return z.object({});
|
|
618
617
|
}
|
|
619
618
|
const zodProperties = {};
|
|
620
619
|
for (const [key, prop] of Object.entries(inputSchema.properties)) {
|
|
@@ -622,22 +621,22 @@ var McpClient = class {
|
|
|
622
621
|
let zodType;
|
|
623
622
|
switch (propDef.type) {
|
|
624
623
|
case "string":
|
|
625
|
-
zodType =
|
|
624
|
+
zodType = z.string();
|
|
626
625
|
break;
|
|
627
626
|
case "number":
|
|
628
|
-
zodType =
|
|
627
|
+
zodType = z.number();
|
|
629
628
|
break;
|
|
630
629
|
case "boolean":
|
|
631
|
-
zodType =
|
|
630
|
+
zodType = z.boolean();
|
|
632
631
|
break;
|
|
633
632
|
case "array":
|
|
634
|
-
zodType =
|
|
633
|
+
zodType = z.array(z.any());
|
|
635
634
|
break;
|
|
636
635
|
case "object":
|
|
637
636
|
zodType = createZodSchema(propDef);
|
|
638
637
|
break;
|
|
639
638
|
default:
|
|
640
|
-
zodType =
|
|
639
|
+
zodType = z.any();
|
|
641
640
|
}
|
|
642
641
|
if (propDef.description) {
|
|
643
642
|
zodType = zodType.describe(propDef.description);
|
|
@@ -648,7 +647,7 @@ var McpClient = class {
|
|
|
648
647
|
}
|
|
649
648
|
zodProperties[key] = zodType;
|
|
650
649
|
}
|
|
651
|
-
return
|
|
650
|
+
return z.object(zodProperties);
|
|
652
651
|
};
|
|
653
652
|
const schema = createZodSchema(def.inputSchema);
|
|
654
653
|
const createdTool = tool({
|