@inkeep/agents-core 0.27.0 → 0.29.0

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.
@@ -4293,14 +4293,14 @@ declare const DataComponentSelectSchema: drizzle_zod.BuildSchema<"select", {
4293
4293
  }, {}, {
4294
4294
  $type: Record<string, unknown>;
4295
4295
  }>;
4296
- preview: drizzle_orm_sqlite_core.SQLiteColumn<{
4297
- name: "preview";
4296
+ render: drizzle_orm_sqlite_core.SQLiteColumn<{
4297
+ name: "render";
4298
4298
  tableName: "data_components";
4299
4299
  dataType: "json";
4300
4300
  columnType: "SQLiteBlobJson";
4301
4301
  data: {
4302
- code: string;
4303
- data: Record<string, unknown>;
4302
+ component: string;
4303
+ mockData: Record<string, unknown>;
4304
4304
  };
4305
4305
  driverParam: Buffer<ArrayBufferLike>;
4306
4306
  notNull: false;
@@ -4314,8 +4314,8 @@ declare const DataComponentSelectSchema: drizzle_zod.BuildSchema<"select", {
4314
4314
  generated: undefined;
4315
4315
  }, {}, {
4316
4316
  $type: {
4317
- code: string;
4318
- data: Record<string, unknown>;
4317
+ component: string;
4318
+ mockData: Record<string, unknown>;
4319
4319
  };
4320
4320
  }>;
4321
4321
  name: drizzle_orm_sqlite_core.SQLiteColumn<{
@@ -4418,18 +4418,18 @@ declare const DataComponentInsertSchema: z.ZodObject<{
4418
4418
  createdAt: z.ZodOptional<z.ZodString>;
4419
4419
  updatedAt: z.ZodOptional<z.ZodString>;
4420
4420
  props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
4421
- preview: z.ZodOptional<z.ZodNullable<z.ZodType<{
4422
- code: string;
4423
- data: Record<string, unknown>;
4421
+ render: z.ZodOptional<z.ZodNullable<z.ZodType<{
4422
+ component: string;
4423
+ mockData: Record<string, unknown>;
4424
4424
  }, {
4425
- code: string;
4426
- data: Record<string, unknown>;
4425
+ component: string;
4426
+ mockData: Record<string, unknown>;
4427
4427
  }, z.core.$ZodTypeInternals<{
4428
- code: string;
4429
- data: Record<string, unknown>;
4428
+ component: string;
4429
+ mockData: Record<string, unknown>;
4430
4430
  }, {
4431
- code: string;
4432
- data: Record<string, unknown>;
4431
+ component: string;
4432
+ mockData: Record<string, unknown>;
4433
4433
  }>>>>;
4434
4434
  name: z.ZodString;
4435
4435
  description: z.ZodString;
@@ -4447,18 +4447,18 @@ declare const DataComponentBaseSchema: z.ZodObject<{
4447
4447
  name: z.ZodString;
4448
4448
  description: z.ZodString;
4449
4449
  props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
4450
- preview: z.ZodOptional<z.ZodNullable<z.ZodType<{
4451
- code: string;
4452
- data: Record<string, unknown>;
4450
+ render: z.ZodOptional<z.ZodNullable<z.ZodType<{
4451
+ component: string;
4452
+ mockData: Record<string, unknown>;
4453
4453
  }, {
4454
- code: string;
4455
- data: Record<string, unknown>;
4454
+ component: string;
4455
+ mockData: Record<string, unknown>;
4456
4456
  }, z.core.$ZodTypeInternals<{
4457
- code: string;
4458
- data: Record<string, unknown>;
4457
+ component: string;
4458
+ mockData: Record<string, unknown>;
4459
4459
  }, {
4460
- code: string;
4461
- data: Record<string, unknown>;
4460
+ component: string;
4461
+ mockData: Record<string, unknown>;
4462
4462
  }>>>>;
4463
4463
  }, {
4464
4464
  out: {};
@@ -4468,18 +4468,18 @@ declare const DataComponentUpdateSchema: z.ZodObject<{
4468
4468
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
4469
4469
  updatedAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
4470
4470
  props: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>>;
4471
- preview: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<{
4472
- code: string;
4473
- data: Record<string, unknown>;
4471
+ render: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<{
4472
+ component: string;
4473
+ mockData: Record<string, unknown>;
4474
4474
  }, {
4475
- code: string;
4476
- data: Record<string, unknown>;
4475
+ component: string;
4476
+ mockData: Record<string, unknown>;
4477
4477
  }, z.core.$ZodTypeInternals<{
4478
- code: string;
4479
- data: Record<string, unknown>;
4478
+ component: string;
4479
+ mockData: Record<string, unknown>;
4480
4480
  }, {
4481
- code: string;
4482
- data: Record<string, unknown>;
4481
+ component: string;
4482
+ mockData: Record<string, unknown>;
4483
4483
  }>>>>>;
4484
4484
  name: z.ZodOptional<z.ZodString>;
4485
4485
  description: z.ZodOptional<z.ZodString>;
@@ -4497,18 +4497,18 @@ declare const DataComponentApiSelectSchema: z.ZodObject<{
4497
4497
  createdAt: z.ZodString;
4498
4498
  updatedAt: z.ZodString;
4499
4499
  props: z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
4500
- preview: z.ZodNullable<z.ZodType<{
4501
- code: string;
4502
- data: Record<string, unknown>;
4500
+ render: z.ZodNullable<z.ZodType<{
4501
+ component: string;
4502
+ mockData: Record<string, unknown>;
4503
4503
  }, {
4504
- code: string;
4505
- data: Record<string, unknown>;
4504
+ component: string;
4505
+ mockData: Record<string, unknown>;
4506
4506
  }, z.core.$ZodTypeInternals<{
4507
- code: string;
4508
- data: Record<string, unknown>;
4507
+ component: string;
4508
+ mockData: Record<string, unknown>;
4509
4509
  }, {
4510
- code: string;
4511
- data: Record<string, unknown>;
4510
+ component: string;
4511
+ mockData: Record<string, unknown>;
4512
4512
  }>>>;
4513
4513
  }, z.core.$strip>;
4514
4514
  declare const DataComponentApiInsertSchema: z.ZodObject<{
@@ -4518,18 +4518,18 @@ declare const DataComponentApiInsertSchema: z.ZodObject<{
4518
4518
  createdAt: z.ZodOptional<z.ZodString>;
4519
4519
  updatedAt: z.ZodOptional<z.ZodString>;
4520
4520
  props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
4521
- preview: z.ZodOptional<z.ZodNullable<z.ZodType<{
4522
- code: string;
4523
- data: Record<string, unknown>;
4521
+ render: z.ZodOptional<z.ZodNullable<z.ZodType<{
4522
+ component: string;
4523
+ mockData: Record<string, unknown>;
4524
4524
  }, {
4525
- code: string;
4526
- data: Record<string, unknown>;
4525
+ component: string;
4526
+ mockData: Record<string, unknown>;
4527
4527
  }, z.core.$ZodTypeInternals<{
4528
- code: string;
4529
- data: Record<string, unknown>;
4528
+ component: string;
4529
+ mockData: Record<string, unknown>;
4530
4530
  }, {
4531
- code: string;
4532
- data: Record<string, unknown>;
4531
+ component: string;
4532
+ mockData: Record<string, unknown>;
4533
4533
  }>>>>;
4534
4534
  }, z.core.$strip>;
4535
4535
  declare const DataComponentApiUpdateSchema: z.ZodObject<{
@@ -4539,18 +4539,18 @@ declare const DataComponentApiUpdateSchema: z.ZodObject<{
4539
4539
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodString>>>;
4540
4540
  updatedAt: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodString>>>;
4541
4541
  props: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>>>;
4542
- preview: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<{
4543
- code: string;
4544
- data: Record<string, unknown>;
4542
+ render: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodType<{
4543
+ component: string;
4544
+ mockData: Record<string, unknown>;
4545
4545
  }, {
4546
- code: string;
4547
- data: Record<string, unknown>;
4546
+ component: string;
4547
+ mockData: Record<string, unknown>;
4548
4548
  }, z.core.$ZodTypeInternals<{
4549
- code: string;
4550
- data: Record<string, unknown>;
4549
+ component: string;
4550
+ mockData: Record<string, unknown>;
4551
4551
  }, {
4552
- code: string;
4553
- data: Record<string, unknown>;
4552
+ component: string;
4553
+ mockData: Record<string, unknown>;
4554
4554
  }>>>>>>;
4555
4555
  }, z.core.$strip>;
4556
4556
  declare const SubAgentDataComponentSelectSchema: drizzle_zod.BuildSchema<"select", {
@@ -5703,6 +5703,7 @@ declare const CredentialReferenceSelectSchema: z.ZodObject<{
5703
5703
  id: z.ZodString;
5704
5704
  tenantId: z.ZodString;
5705
5705
  projectId: z.ZodString;
5706
+ name: z.ZodString;
5706
5707
  type: z.ZodString;
5707
5708
  credentialStoreId: z.ZodString;
5708
5709
  retrievalParams: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -5712,6 +5713,7 @@ declare const CredentialReferenceSelectSchema: z.ZodObject<{
5712
5713
  declare const CredentialReferenceInsertSchema: z.ZodObject<{
5713
5714
  createdAt: z.ZodOptional<z.ZodString>;
5714
5715
  updatedAt: z.ZodOptional<z.ZodString>;
5716
+ name: z.ZodString;
5715
5717
  projectId: z.ZodString;
5716
5718
  tenantId: z.ZodString;
5717
5719
  id: z.ZodString;
@@ -5725,6 +5727,7 @@ declare const CredentialReferenceInsertSchema: z.ZodObject<{
5725
5727
  declare const CredentialReferenceUpdateSchema: z.ZodObject<{
5726
5728
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
5727
5729
  updatedAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
5730
+ name: z.ZodOptional<z.ZodString>;
5728
5731
  projectId: z.ZodOptional<z.ZodString>;
5729
5732
  tenantId: z.ZodOptional<z.ZodString>;
5730
5733
  id: z.ZodOptional<z.ZodString>;
@@ -5737,6 +5740,7 @@ declare const CredentialReferenceUpdateSchema: z.ZodObject<{
5737
5740
  }>;
5738
5741
  declare const CredentialReferenceApiSelectSchema: z.ZodObject<{
5739
5742
  id: z.ZodString;
5743
+ name: z.ZodString;
5740
5744
  createdAt: z.ZodString;
5741
5745
  updatedAt: z.ZodString;
5742
5746
  credentialStoreId: z.ZodString;
@@ -6018,6 +6022,7 @@ declare const CredentialReferenceApiSelectSchema: z.ZodObject<{
6018
6022
  }, z.core.$strip>;
6019
6023
  declare const CredentialReferenceApiInsertSchema: z.ZodObject<{
6020
6024
  id: z.ZodString;
6025
+ name: z.ZodString;
6021
6026
  createdAt: z.ZodOptional<z.ZodString>;
6022
6027
  updatedAt: z.ZodOptional<z.ZodString>;
6023
6028
  credentialStoreId: z.ZodString;
@@ -6030,6 +6035,7 @@ declare const CredentialReferenceApiInsertSchema: z.ZodObject<{
6030
6035
  }, z.core.$strip>;
6031
6036
  declare const CredentialReferenceApiUpdateSchema: z.ZodObject<{
6032
6037
  id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
6038
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
6033
6039
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodString>>>;
6034
6040
  updatedAt: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodString>>>;
6035
6041
  credentialStoreId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -6123,6 +6129,7 @@ declare const MCPToolConfigSchema: z.ZodObject<{
6123
6129
  }, z.core.$strip>>;
6124
6130
  credential: z.ZodOptional<z.ZodObject<{
6125
6131
  id: z.ZodString;
6132
+ name: z.ZodString;
6126
6133
  createdAt: z.ZodOptional<z.ZodString>;
6127
6134
  updatedAt: z.ZodOptional<z.ZodString>;
6128
6135
  credentialStoreId: z.ZodString;
@@ -6730,6 +6737,7 @@ declare const FetchDefinitionSchema: z.ZodObject<{
6730
6737
  defaultValue: z.ZodOptional<z.ZodAny>;
6731
6738
  credential: z.ZodOptional<z.ZodObject<{
6732
6739
  id: z.ZodString;
6740
+ name: z.ZodString;
6733
6741
  createdAt: z.ZodOptional<z.ZodString>;
6734
6742
  updatedAt: z.ZodOptional<z.ZodString>;
6735
6743
  credentialStoreId: z.ZodString;
@@ -9133,18 +9141,18 @@ declare const FullProjectDefinitionSchema: z.ZodObject<{
9133
9141
  createdAt: z.ZodOptional<z.ZodString>;
9134
9142
  updatedAt: z.ZodOptional<z.ZodString>;
9135
9143
  props: z.ZodOptional<z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>>;
9136
- preview: z.ZodOptional<z.ZodNullable<z.ZodType<{
9137
- code: string;
9138
- data: Record<string, unknown>;
9144
+ render: z.ZodOptional<z.ZodNullable<z.ZodType<{
9145
+ component: string;
9146
+ mockData: Record<string, unknown>;
9139
9147
  }, {
9140
- code: string;
9141
- data: Record<string, unknown>;
9148
+ component: string;
9149
+ mockData: Record<string, unknown>;
9142
9150
  }, z.core.$ZodTypeInternals<{
9143
- code: string;
9144
- data: Record<string, unknown>;
9151
+ component: string;
9152
+ mockData: Record<string, unknown>;
9145
9153
  }, {
9146
- code: string;
9147
- data: Record<string, unknown>;
9154
+ component: string;
9155
+ mockData: Record<string, unknown>;
9148
9156
  }>>>>;
9149
9157
  }, z.core.$strip>>>;
9150
9158
  artifactComponents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -9182,6 +9190,7 @@ declare const FullProjectDefinitionSchema: z.ZodObject<{
9182
9190
  }, z.core.$strip>>;
9183
9191
  credentialReferences: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
9184
9192
  id: z.ZodString;
9193
+ name: z.ZodString;
9185
9194
  createdAt: z.ZodOptional<z.ZodString>;
9186
9195
  updatedAt: z.ZodOptional<z.ZodString>;
9187
9196
  credentialStoreId: z.ZodString;
@@ -9546,6 +9555,7 @@ declare const ApiKeyResponse: z.ZodObject<{
9546
9555
  declare const CredentialReferenceResponse: z.ZodObject<{
9547
9556
  data: z.ZodObject<{
9548
9557
  id: z.ZodString;
9558
+ name: z.ZodString;
9549
9559
  createdAt: z.ZodString;
9550
9560
  updatedAt: z.ZodString;
9551
9561
  credentialStoreId: z.ZodString;
@@ -9855,18 +9865,18 @@ declare const DataComponentResponse: z.ZodObject<{
9855
9865
  createdAt: z.ZodString;
9856
9866
  updatedAt: z.ZodString;
9857
9867
  props: z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
9858
- preview: z.ZodNullable<z.ZodType<{
9859
- code: string;
9860
- data: Record<string, unknown>;
9868
+ render: z.ZodNullable<z.ZodType<{
9869
+ component: string;
9870
+ mockData: Record<string, unknown>;
9861
9871
  }, {
9862
- code: string;
9863
- data: Record<string, unknown>;
9872
+ component: string;
9873
+ mockData: Record<string, unknown>;
9864
9874
  }, z.core.$ZodTypeInternals<{
9865
- code: string;
9866
- data: Record<string, unknown>;
9875
+ component: string;
9876
+ mockData: Record<string, unknown>;
9867
9877
  }, {
9868
- code: string;
9869
- data: Record<string, unknown>;
9878
+ component: string;
9879
+ mockData: Record<string, unknown>;
9870
9880
  }>>>;
9871
9881
  }, z.core.$strip>;
9872
9882
  }, z.core.$strip>;
@@ -10326,6 +10336,7 @@ declare const ApiKeyListResponse: z.ZodObject<{
10326
10336
  declare const CredentialReferenceListResponse: z.ZodObject<{
10327
10337
  data: z.ZodArray<z.ZodObject<{
10328
10338
  id: z.ZodString;
10339
+ name: z.ZodString;
10329
10340
  createdAt: z.ZodString;
10330
10341
  updatedAt: z.ZodString;
10331
10342
  credentialStoreId: z.ZodString;
@@ -10653,18 +10664,18 @@ declare const DataComponentListResponse: z.ZodObject<{
10653
10664
  createdAt: z.ZodString;
10654
10665
  updatedAt: z.ZodString;
10655
10666
  props: z.ZodNullable<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
10656
- preview: z.ZodNullable<z.ZodType<{
10657
- code: string;
10658
- data: Record<string, unknown>;
10667
+ render: z.ZodNullable<z.ZodType<{
10668
+ component: string;
10669
+ mockData: Record<string, unknown>;
10659
10670
  }, {
10660
- code: string;
10661
- data: Record<string, unknown>;
10671
+ component: string;
10672
+ mockData: Record<string, unknown>;
10662
10673
  }, z.core.$ZodTypeInternals<{
10663
- code: string;
10664
- data: Record<string, unknown>;
10674
+ component: string;
10675
+ mockData: Record<string, unknown>;
10665
10676
  }, {
10666
- code: string;
10667
- data: Record<string, unknown>;
10677
+ component: string;
10678
+ mockData: Record<string, unknown>;
10668
10679
  }>>>;
10669
10680
  }, z.core.$strip>>;
10670
10681
  pagination: z.ZodObject<{
@@ -224,7 +224,7 @@ var dataComponents = sqliteCore.sqliteTable(
224
224
  ...projectScoped,
225
225
  ...uiProperties,
226
226
  props: sqliteCore.blob("props", { mode: "json" }).$type(),
227
- preview: sqliteCore.blob("preview", { mode: "json" }).$type(),
227
+ render: sqliteCore.blob("render", { mode: "json" }).$type(),
228
228
  ...timestamps
229
229
  },
230
230
  (table) => [
@@ -577,6 +577,7 @@ var credentialReferences = sqliteCore.sqliteTable(
577
577
  "credential_references",
578
578
  {
579
579
  ...projectScoped,
580
+ name: sqliteCore.text("name").notNull(),
580
581
  type: sqliteCore.text("type").notNull(),
581
582
  credentialStoreId: sqliteCore.text("credential_store_id").notNull(),
582
583
  retrievalParams: sqliteCore.blob("retrieval_params", { mode: "json" }).$type(),
@@ -1317,6 +1318,7 @@ var CredentialReferenceSelectSchema = zodOpenapi.z.object({
1317
1318
  id: zodOpenapi.z.string(),
1318
1319
  tenantId: zodOpenapi.z.string(),
1319
1320
  projectId: zodOpenapi.z.string(),
1321
+ name: zodOpenapi.z.string(),
1320
1322
  type: zodOpenapi.z.string(),
1321
1323
  credentialStoreId: zodOpenapi.z.string(),
1322
1324
  retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish(),
@@ -1974,115 +1976,6 @@ function generateIdFromName(name) {
1974
1976
  }
1975
1977
  return truncatedId;
1976
1978
  }
1977
-
1978
- // src/validation/preview-validation.ts
1979
- var MAX_CODE_SIZE = 5e4;
1980
- var MAX_DATA_SIZE = 1e4;
1981
- var DANGEROUS_PATTERNS = [
1982
- {
1983
- pattern: /\beval\s*\(/i,
1984
- message: "eval() is not allowed"
1985
- },
1986
- {
1987
- pattern: /\bFunction\s*\(/i,
1988
- message: "Function constructor is not allowed"
1989
- },
1990
- {
1991
- pattern: /dangerouslySetInnerHTML/i,
1992
- message: "dangerouslySetInnerHTML is not allowed"
1993
- },
1994
- {
1995
- pattern: /<script\b/i,
1996
- message: "Script tags are not allowed"
1997
- },
1998
- {
1999
- pattern: /\bon\w+\s*=/i,
2000
- message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
2001
- },
2002
- {
2003
- pattern: /document\.write/i,
2004
- message: "document.write is not allowed"
2005
- },
2006
- {
2007
- pattern: /window\.location/i,
2008
- message: "window.location is not allowed"
2009
- },
2010
- {
2011
- pattern: /\.innerHTML\s*=/i,
2012
- message: "innerHTML manipulation is not allowed"
2013
- }
2014
- ];
2015
- var ALLOWED_IMPORTS = ["lucide-react"];
2016
- function validatePreview(preview) {
2017
- const errors = [];
2018
- if (!preview.code || typeof preview.code !== "string") {
2019
- return {
2020
- isValid: false,
2021
- errors: [{ field: "preview.code", message: "Code must be a non-empty string" }]
2022
- };
2023
- }
2024
- if (!preview.data || typeof preview.data !== "object") {
2025
- return {
2026
- isValid: false,
2027
- errors: [{ field: "preview.data", message: "Data must be an object" }]
2028
- };
2029
- }
2030
- if (preview.code.length > MAX_CODE_SIZE) {
2031
- errors.push({
2032
- field: "preview.code",
2033
- message: `Code size exceeds maximum allowed (${MAX_CODE_SIZE} characters)`
2034
- });
2035
- }
2036
- const dataString = JSON.stringify(preview.data);
2037
- if (dataString.length > MAX_DATA_SIZE) {
2038
- errors.push({
2039
- field: "preview.data",
2040
- message: `Data size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
2041
- });
2042
- }
2043
- for (const { pattern, message } of DANGEROUS_PATTERNS) {
2044
- if (pattern.test(preview.code)) {
2045
- errors.push({
2046
- field: "preview.code",
2047
- message: `Code contains potentially dangerous pattern: ${message}`
2048
- });
2049
- }
2050
- }
2051
- const importMatches = preview.code.matchAll(/import\s+.*?\s+from\s+['"]([^'"]+)['"]/g);
2052
- for (const match of importMatches) {
2053
- const importPath = match[1];
2054
- if (!ALLOWED_IMPORTS.includes(importPath)) {
2055
- errors.push({
2056
- field: "preview.code",
2057
- message: `Import from "${importPath}" is not allowed. Only imports from ${ALLOWED_IMPORTS.join(", ")} are permitted`
2058
- });
2059
- }
2060
- }
2061
- const hasFunctionDeclaration = /function\s+\w+\s*\(/.test(preview.code);
2062
- if (!hasFunctionDeclaration) {
2063
- errors.push({
2064
- field: "preview.code",
2065
- message: "Code must contain a function declaration"
2066
- });
2067
- }
2068
- const hasReturn = /return\s*\(?\s*</.test(preview.code);
2069
- if (!hasReturn) {
2070
- errors.push({
2071
- field: "preview.code",
2072
- message: "Component function must have a return statement with JSX"
2073
- });
2074
- }
2075
- if (/\bexport\s+(default\s+)?/i.test(preview.code)) {
2076
- errors.push({
2077
- field: "preview.code",
2078
- message: "Code should not contain export statements"
2079
- });
2080
- }
2081
- return {
2082
- isValid: errors.length === 0,
2083
- errors
2084
- };
2085
- }
2086
1979
  function validatePropsAsJsonSchema(props) {
2087
1980
  if (!props || typeof props === "object" && Object.keys(props).length === 0) {
2088
1981
  return {
@@ -2186,6 +2079,109 @@ function validatePropsAsJsonSchema(props) {
2186
2079
  }
2187
2080
  }
2188
2081
 
2082
+ // src/validation/render-validation.ts
2083
+ var MAX_CODE_SIZE = 5e4;
2084
+ var MAX_DATA_SIZE = 1e4;
2085
+ var DANGEROUS_PATTERNS = [
2086
+ {
2087
+ pattern: /\beval\s*\(/i,
2088
+ message: "eval() is not allowed"
2089
+ },
2090
+ {
2091
+ pattern: /\bFunction\s*\(/i,
2092
+ message: "Function constructor is not allowed"
2093
+ },
2094
+ {
2095
+ pattern: /dangerouslySetInnerHTML/i,
2096
+ message: "dangerouslySetInnerHTML is not allowed"
2097
+ },
2098
+ {
2099
+ pattern: /<script\b/i,
2100
+ message: "Script tags are not allowed"
2101
+ },
2102
+ {
2103
+ pattern: /\bon\w+\s*=/i,
2104
+ message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
2105
+ },
2106
+ {
2107
+ pattern: /document\.write/i,
2108
+ message: "document.write is not allowed"
2109
+ },
2110
+ {
2111
+ pattern: /window\.location/i,
2112
+ message: "window.location is not allowed"
2113
+ },
2114
+ {
2115
+ pattern: /\.innerHTML\s*=/i,
2116
+ message: "innerHTML manipulation is not allowed"
2117
+ }
2118
+ ];
2119
+ var ALLOWED_IMPORTS = ["lucide-react"];
2120
+ function validateRender(render) {
2121
+ const errors = [];
2122
+ if (!render.component || typeof render.component !== "string") {
2123
+ return {
2124
+ isValid: false,
2125
+ errors: [{ field: "render.component", message: "Component must be a non-empty string" }]
2126
+ };
2127
+ }
2128
+ if (!render.mockData || typeof render.mockData !== "object") {
2129
+ return {
2130
+ isValid: false,
2131
+ errors: [{ field: "render.mockData", message: "MockData must be an object" }]
2132
+ };
2133
+ }
2134
+ if (render.component.length > MAX_CODE_SIZE) {
2135
+ errors.push({
2136
+ field: "render.component",
2137
+ message: `Component size exceeds maximum allowed (${MAX_CODE_SIZE} characters)`
2138
+ });
2139
+ }
2140
+ const dataString = JSON.stringify(render.mockData);
2141
+ if (dataString.length > MAX_DATA_SIZE) {
2142
+ errors.push({
2143
+ field: "render.mockData",
2144
+ message: `MockData size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
2145
+ });
2146
+ }
2147
+ for (const { pattern, message } of DANGEROUS_PATTERNS) {
2148
+ if (pattern.test(render.component)) {
2149
+ errors.push({
2150
+ field: "render.component",
2151
+ message: `Component contains potentially dangerous pattern: ${message}`
2152
+ });
2153
+ }
2154
+ }
2155
+ const importMatches = render.component.matchAll(/import\s+.*?\s+from\s+['"]([^'"]+)['"]/g);
2156
+ for (const match of importMatches) {
2157
+ const importPath = match[1];
2158
+ if (!ALLOWED_IMPORTS.includes(importPath) && !importPath.startsWith(".")) {
2159
+ errors.push({
2160
+ field: "render.component",
2161
+ message: `Import from "${importPath}" is not allowed. Only imports from ${ALLOWED_IMPORTS.join(", ")} are permitted`
2162
+ });
2163
+ }
2164
+ }
2165
+ const hasFunctionDeclaration = /function\s+\w+\s*\(/.test(render.component);
2166
+ if (!hasFunctionDeclaration) {
2167
+ errors.push({
2168
+ field: "render.component",
2169
+ message: "Component must contain a function declaration"
2170
+ });
2171
+ }
2172
+ const hasReturn = /return\s*\(?\s*</.test(render.component);
2173
+ if (!hasReturn) {
2174
+ errors.push({
2175
+ field: "render.component",
2176
+ message: "Component function must have a return statement with JSX"
2177
+ });
2178
+ }
2179
+ return {
2180
+ isValid: errors.length === 0,
2181
+ errors
2182
+ };
2183
+ }
2184
+
2189
2185
  exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
2190
2186
  exports.AgentApiInsertSchema = AgentApiInsertSchema;
2191
2187
  exports.AgentApiSelectSchema = AgentApiSelectSchema;
@@ -2428,7 +2424,7 @@ exports.validateAgentStructure = validateAgentStructure;
2428
2424
  exports.validateAndTypeAgentData = validateAndTypeAgentData;
2429
2425
  exports.validateArtifactComponentReferences = validateArtifactComponentReferences;
2430
2426
  exports.validateDataComponentReferences = validateDataComponentReferences;
2431
- exports.validatePreview = validatePreview;
2432
2427
  exports.validatePropsAsJsonSchema = validatePropsAsJsonSchema;
2428
+ exports.validateRender = validateRender;
2433
2429
  exports.validateSubAgentExternalAgentRelations = validateSubAgentExternalAgentRelations;
2434
2430
  exports.validateToolReferences = validateToolReferences;