@inkeep/agents-core 0.45.0 → 0.45.2

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.
@@ -19,7 +19,7 @@ const SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true }).openap
19
19
  const MIN_ID_LENGTH = 1;
20
20
  const MAX_ID_LENGTH = 255;
21
21
  const URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
22
- const ResourceIdSchema = z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).regex(URL_SAFE_ID_PATTERN, { message: "ID must contain only letters, numbers, hyphens, underscores, and dots" }).openapi({
22
+ const ResourceIdSchema = z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).regex(URL_SAFE_ID_PATTERN, { message: "ID must contain only letters, numbers, hyphens, underscores, and dots" }).refine((value) => value !== "new", "Must not use a reserved name \"new\"").openapi({
23
23
  description: "Resource identifier",
24
24
  example: "resource_789"
25
25
  });
@@ -354,7 +354,7 @@ const TriggerSelectSchema = registerFieldSchemas(createSelectSchema(triggers).ex
354
354
  signingSecretCredentialReferenceId: z.string().nullable().optional(),
355
355
  signatureVerification: SignatureVerificationConfigSchema.nullable().optional()
356
356
  }));
357
- const TriggerInsertSchemaBase = createInsertSchema(triggers, {
357
+ const TriggerInsertSchema = createInsertSchema(triggers, {
358
358
  id: () => ResourceIdSchema,
359
359
  name: () => z.string().trim().nonempty().describe("Trigger name"),
360
360
  description: () => z.string().optional().describe("Trigger description"),
@@ -364,80 +364,78 @@ const TriggerInsertSchemaBase = createInsertSchema(triggers, {
364
364
  messageTemplate: () => z.string().trim().nonempty().describe("Message template with {{placeholder}} syntax").optional(),
365
365
  authentication: () => TriggerAuthenticationInputSchema.optional(),
366
366
  signingSecretCredentialReferenceId: () => z.string().optional().describe("Reference to credential containing signing secret"),
367
- signatureVerification: () => SignatureVerificationConfigSchema.nullable().optional().describe("Configuration for webhook signature verification")
368
- });
369
- const TriggerInsertSchema = TriggerInsertSchemaBase.superRefine((data, ctx) => {
370
- const config = data.signatureVerification;
371
- if (!config) return;
372
- if (config.signature.regex) {
373
- const regexResult = validateRegex(config.signature.regex);
374
- if (!regexResult.valid) ctx.addIssue({
375
- code: z.ZodIssueCode.custom,
376
- message: `Invalid regex pattern in signature.regex: ${regexResult.error}`,
377
- path: [
378
- "signatureVerification",
379
- "signature",
380
- "regex"
381
- ]
382
- });
383
- }
384
- if (config.signature.source === "body" && config.signature.key) {
385
- const jmespathResult = validateJMESPathSecure(config.signature.key);
386
- if (!jmespathResult.valid) ctx.addIssue({
387
- code: z.ZodIssueCode.custom,
388
- message: `Invalid JMESPath expression in signature.key: ${jmespathResult.error}`,
389
- path: [
390
- "signatureVerification",
391
- "signature",
392
- "key"
393
- ]
394
- });
395
- }
396
- config.signedComponents.forEach((component, index) => {
397
- if (component.regex) {
398
- const regexResult = validateRegex(component.regex);
367
+ signatureVerification: () => SignatureVerificationConfigSchema.nullish().superRefine((config, ctx) => {
368
+ if (!config) return;
369
+ if (config.signature.regex) {
370
+ const regexResult = validateRegex(config.signature.regex);
399
371
  if (!regexResult.valid) ctx.addIssue({
400
- code: z.ZodIssueCode.custom,
401
- message: `Invalid regex pattern in signedComponents[${index}].regex: ${regexResult.error}`,
372
+ code: "custom",
373
+ message: `Invalid regex pattern in signature.regex: ${regexResult.error}`,
402
374
  path: [
403
375
  "signatureVerification",
404
- "signedComponents",
405
- index,
376
+ "signature",
406
377
  "regex"
407
378
  ]
408
379
  });
409
380
  }
410
- if (component.source === "body" && component.key) {
411
- const jmespathResult = validateJMESPathSecure(component.key);
381
+ if (config.signature.source === "body" && config.signature.key) {
382
+ const jmespathResult = validateJMESPathSecure(config.signature.key);
412
383
  if (!jmespathResult.valid) ctx.addIssue({
413
- code: z.ZodIssueCode.custom,
414
- message: `Invalid JMESPath expression in signedComponents[${index}].key: ${jmespathResult.error}`,
384
+ code: "custom",
385
+ message: `Invalid JMESPath expression in signature.key: ${jmespathResult.error}`,
415
386
  path: [
416
387
  "signatureVerification",
417
- "signedComponents",
418
- index,
388
+ "signature",
419
389
  "key"
420
390
  ]
421
391
  });
422
392
  }
423
- if (component.value && component.source !== "literal") {
424
- if (component.value.includes(".") || component.value.includes("[")) {
425
- const jmespathResult = validateJMESPathSecure(component.value);
393
+ config.signedComponents.forEach((component, index) => {
394
+ if (component.regex) {
395
+ const regexResult = validateRegex(component.regex);
396
+ if (!regexResult.valid) ctx.addIssue({
397
+ code: "custom",
398
+ message: `Invalid regex pattern in signedComponents[${index}].regex: ${regexResult.error}`,
399
+ path: [
400
+ "signatureVerification",
401
+ "signedComponents",
402
+ index,
403
+ "regex"
404
+ ]
405
+ });
406
+ }
407
+ if (component.source === "body" && component.key) {
408
+ const jmespathResult = validateJMESPathSecure(component.key);
426
409
  if (!jmespathResult.valid) ctx.addIssue({
427
- code: z.ZodIssueCode.custom,
428
- message: `Invalid JMESPath expression in signedComponents[${index}].value: ${jmespathResult.error}`,
410
+ code: "custom",
411
+ message: `Invalid JMESPath expression in signedComponents[${index}].key: ${jmespathResult.error}`,
429
412
  path: [
430
413
  "signatureVerification",
431
414
  "signedComponents",
432
415
  index,
433
- "value"
416
+ "key"
434
417
  ]
435
418
  });
436
419
  }
437
- }
438
- });
420
+ if (component.value && component.source !== "literal") {
421
+ if (component.value.includes(".") || component.value.includes("[")) {
422
+ const jmespathResult = validateJMESPathSecure(component.value);
423
+ if (!jmespathResult.valid) ctx.addIssue({
424
+ code: "custom",
425
+ message: `Invalid JMESPath expression in signedComponents[${index}].value: ${jmespathResult.error}`,
426
+ path: [
427
+ "signatureVerification",
428
+ "signedComponents",
429
+ index,
430
+ "value"
431
+ ]
432
+ });
433
+ }
434
+ }
435
+ });
436
+ }).describe("Configuration for webhook signature verification")
439
437
  });
440
- const TriggerUpdateSchema = TriggerInsertSchemaBase.extend({ enabled: z.boolean().optional().describe("Whether the trigger is enabled") }).partial();
438
+ const TriggerUpdateSchema = TriggerInsertSchema.extend({ enabled: z.boolean().optional().describe("Whether the trigger is enabled") }).partial();
441
439
  const TriggerApiSelectSchema = createAgentScopedApiSchema(TriggerSelectSchema).openapi("Trigger");
442
440
  const TriggerApiInsertSchema = createAgentScopedApiInsertSchema(TriggerInsertSchema).extend({ id: ResourceIdSchema.optional() }).openapi("TriggerCreate");
443
441
  const TriggerApiUpdateSchema = TriggerUpdateSchema.openapi("TriggerUpdate");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-core",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -135,7 +135,7 @@
135
135
  },
136
136
  "peerDependencies": {
137
137
  "@hono/zod-openapi": "^1.1.5",
138
- "zod": "^4.1.11"
138
+ "zod": "^4.3.6"
139
139
  },
140
140
  "optionalDependencies": {
141
141
  "@opentelemetry/auto-instrumentations-node": "^0.62.0",