@ganju/utils 0.0.13 → 0.0.15

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 (70) hide show
  1. package/dist/channelCustomer.d.ts +99 -0
  2. package/dist/channelCustomer.d.ts.map +1 -0
  3. package/dist/channelCustomer.js +533 -0
  4. package/dist/channelDebounce.d.ts +7 -0
  5. package/dist/channelDebounce.d.ts.map +1 -1
  6. package/dist/chunkOverlap.d.ts +2 -0
  7. package/dist/chunkOverlap.d.ts.map +1 -0
  8. package/dist/chunkOverlap.js +9 -0
  9. package/dist/chunking.d.ts.map +1 -1
  10. package/dist/chunking.js +24 -4
  11. package/dist/citations.d.ts +28 -0
  12. package/dist/citations.d.ts.map +1 -0
  13. package/dist/citations.js +111 -0
  14. package/dist/constants.d.ts +26 -0
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +108 -10
  17. package/dist/index.d.ts +263 -31
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +70 -0
  20. package/dist/jsonSchemaToZodShape.d.ts +5 -1
  21. package/dist/jsonSchemaToZodShape.d.ts.map +1 -1
  22. package/dist/jsonSchemaToZodShape.js +21 -9
  23. package/dist/pagination.d.ts +47 -0
  24. package/dist/pagination.d.ts.map +1 -0
  25. package/dist/pagination.js +160 -0
  26. package/dist/processQueueBatch.d.ts +6 -1
  27. package/dist/processQueueBatch.d.ts.map +1 -1
  28. package/dist/processQueueBatch.js +23 -10
  29. package/dist/queueFailure.d.ts +14 -0
  30. package/dist/queueFailure.d.ts.map +1 -0
  31. package/dist/queueFailure.js +43 -0
  32. package/dist/resourceRerank.d.ts.map +1 -1
  33. package/dist/resourceRerank.js +3 -1
  34. package/dist/schema.d.ts +90 -26
  35. package/dist/schema.d.ts.map +1 -1
  36. package/dist/schema.js +87 -6
  37. package/dist/ssrf.d.ts +1 -0
  38. package/dist/ssrf.d.ts.map +1 -1
  39. package/dist/ssrf.js +48 -12
  40. package/dist/toolConfirmation.d.ts +48 -0
  41. package/dist/toolConfirmation.d.ts.map +1 -1
  42. package/dist/toolConfirmation.js +75 -1
  43. package/dist/toolCount.d.ts +13 -0
  44. package/dist/toolCount.d.ts.map +1 -0
  45. package/dist/toolCount.js +45 -0
  46. package/dist/toolLint.d.ts +1 -1
  47. package/dist/toolLint.d.ts.map +1 -1
  48. package/dist/toolLint.js +37 -3
  49. package/dist/untrustedContent.d.ts +135 -0
  50. package/dist/untrustedContent.d.ts.map +1 -0
  51. package/dist/untrustedContent.js +402 -0
  52. package/package.json +2 -1
  53. package/src/channelCustomer.ts +604 -0
  54. package/src/channelDebounce.ts +17 -0
  55. package/src/chunkOverlap.ts +6 -0
  56. package/src/chunking.ts +25 -4
  57. package/src/citations.ts +127 -0
  58. package/src/constants.ts +112 -10
  59. package/src/index.ts +152 -2
  60. package/src/jsonSchemaToZodShape.ts +31 -13
  61. package/src/pagination.ts +193 -0
  62. package/src/processQueueBatch.ts +42 -12
  63. package/src/queueFailure.ts +63 -0
  64. package/src/resourceRerank.ts +5 -1
  65. package/src/schema.ts +100 -4
  66. package/src/ssrf.ts +40 -11
  67. package/src/toolConfirmation.ts +123 -0
  68. package/src/toolCount.ts +53 -0
  69. package/src/toolLint.ts +46 -3
  70. package/src/untrustedContent.ts +476 -0
package/dist/schema.d.ts CHANGED
@@ -254,6 +254,8 @@ declare const MCP_PROXY_CONFIG: z.ZodObject<{
254
254
  kind: z.ZodLiteral<"oauth">;
255
255
  credentialId: z.ZodUUID;
256
256
  }, z.core.$strip>], "kind">>;
257
+ trustAnnotations: z.ZodOptional<z.ZodBoolean>;
258
+ readOnlyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
257
259
  timeoutMs: z.ZodPipe<z.ZodDefault<z.ZodNumber>, z.ZodTransform<number, number>>;
258
260
  }, z.core.$strip>;
259
261
  declare const CUSTOM_CODE_CONFIG: z.ZodObject<{
@@ -542,6 +544,16 @@ export declare const Schema: {
542
544
  INVITATION_GET_BY_TOKEN: z.ZodObject<{
543
545
  token: z.ZodString;
544
546
  }, z.core.$strip>;
547
+ TOOL_APPROVAL_GET: z.ZodObject<{
548
+ approvalId: z.ZodUUID;
549
+ }, z.core.$strip>;
550
+ TOOL_APPROVAL_DECIDE: z.ZodObject<{
551
+ approvalId: z.ZodUUID;
552
+ decision: z.ZodEnum<{
553
+ approve: "approve";
554
+ deny: "deny";
555
+ }>;
556
+ }, z.core.$strip>;
545
557
  ORGANIZATION_MEMBER_LIST: z.ZodObject<{
546
558
  userId: z.ZodUUID;
547
559
  organizationId: z.ZodUUID;
@@ -766,6 +778,11 @@ export declare const Schema: {
766
778
  organizationId: z.ZodUUID;
767
779
  }, z.core.$strip>;
768
780
  ARTIFACT_CREATE_RESOURCE_VIEW: z.ZodObject<{
781
+ type: z.ZodDefault<z.ZodEnum<{
782
+ static: "static";
783
+ template: "template";
784
+ }>>;
785
+ uri: z.ZodString;
769
786
  mimeType: z.ZodEnum<{
770
787
  "text/plain": "text/plain";
771
788
  "text/csv": "text/csv";
@@ -807,26 +824,21 @@ export declare const Schema: {
807
824
  "application/octet-stream": "application/octet-stream";
808
825
  }>;
809
826
  fileName: z.ZodOptional<z.ZodString>;
810
- content: z.ZodOptional<z.ZodString>;
811
- type: z.ZodDefault<z.ZodEnum<{
812
- static: "static";
813
- template: "template";
827
+ sourceType: z.ZodDefault<z.ZodEnum<{
828
+ FILE: "FILE";
829
+ WEBSITE: "WEBSITE";
830
+ GOOGLE_DRIVE_FOLDER: "GOOGLE_DRIVE_FOLDER";
831
+ ONE_DRIVE_FOLDER: "ONE_DRIVE_FOLDER";
832
+ CUSTOM_CODE: "CUSTOM_CODE";
814
833
  }>>;
834
+ content: z.ZodOptional<z.ZodString>;
815
835
  description: z.ZodOptional<z.ZodString>;
816
836
  title: z.ZodString;
817
- uri: z.ZodString;
818
837
  crawlConfig: z.ZodOptional<z.ZodObject<{
819
838
  maxPages: z.ZodDefault<z.ZodNumber>;
820
839
  maxDepth: z.ZodDefault<z.ZodNumber>;
821
840
  }, z.core.$strip>>;
822
841
  size: z.ZodOptional<z.ZodNumber>;
823
- sourceType: z.ZodDefault<z.ZodEnum<{
824
- FILE: "FILE";
825
- WEBSITE: "WEBSITE";
826
- GOOGLE_DRIVE_FOLDER: "GOOGLE_DRIVE_FOLDER";
827
- ONE_DRIVE_FOLDER: "ONE_DRIVE_FOLDER";
828
- CUSTOM_CODE: "CUSTOM_CODE";
829
- }>>;
830
842
  encoding: z.ZodOptional<z.ZodString>;
831
843
  fileKey: z.ZodOptional<z.ZodString>;
832
844
  annotations: z.ZodOptional<z.ZodObject<{
@@ -1027,6 +1039,11 @@ export declare const Schema: {
1027
1039
  organizationId: z.ZodUUID;
1028
1040
  }, z.core.$strip>;
1029
1041
  ARTIFACT_UPDATE_RESOURCE_VIEW: z.ZodObject<{
1042
+ type: z.ZodDefault<z.ZodEnum<{
1043
+ static: "static";
1044
+ template: "template";
1045
+ }>>;
1046
+ uri: z.ZodString;
1030
1047
  mimeType: z.ZodEnum<{
1031
1048
  "text/plain": "text/plain";
1032
1049
  "text/csv": "text/csv";
@@ -1068,15 +1085,6 @@ export declare const Schema: {
1068
1085
  "application/octet-stream": "application/octet-stream";
1069
1086
  }>;
1070
1087
  fileName: z.ZodOptional<z.ZodString>;
1071
- content: z.ZodOptional<z.ZodString>;
1072
- type: z.ZodDefault<z.ZodEnum<{
1073
- static: "static";
1074
- template: "template";
1075
- }>>;
1076
- description: z.ZodOptional<z.ZodString>;
1077
- title: z.ZodString;
1078
- uri: z.ZodString;
1079
- size: z.ZodOptional<z.ZodNumber>;
1080
1088
  sourceType: z.ZodDefault<z.ZodEnum<{
1081
1089
  FILE: "FILE";
1082
1090
  WEBSITE: "WEBSITE";
@@ -1084,6 +1092,10 @@ export declare const Schema: {
1084
1092
  ONE_DRIVE_FOLDER: "ONE_DRIVE_FOLDER";
1085
1093
  CUSTOM_CODE: "CUSTOM_CODE";
1086
1094
  }>>;
1095
+ content: z.ZodOptional<z.ZodString>;
1096
+ description: z.ZodOptional<z.ZodString>;
1097
+ title: z.ZodString;
1098
+ size: z.ZodOptional<z.ZodNumber>;
1087
1099
  encoding: z.ZodOptional<z.ZodString>;
1088
1100
  fileKey: z.ZodOptional<z.ZodString>;
1089
1101
  annotations: z.ZodOptional<z.ZodObject<{
@@ -1305,7 +1317,9 @@ export declare const Schema: {
1305
1317
  }, z.core.$strip>;
1306
1318
  CHANNEL_CONFIG: z.ZodObject<{
1307
1319
  debounceMs: z.ZodOptional<z.ZodNumber>;
1308
- }, z.core.$loose>;
1320
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1321
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1322
+ }, z.core.$strict>;
1309
1323
  CHANNEL_CREATE: z.ZodObject<{
1310
1324
  platform: z.ZodEnum<{
1311
1325
  slack: "slack";
@@ -1315,7 +1329,9 @@ export declare const Schema: {
1315
1329
  }>;
1316
1330
  config: z.ZodOptional<z.ZodObject<{
1317
1331
  debounceMs: z.ZodOptional<z.ZodNumber>;
1318
- }, z.core.$loose>>;
1332
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1333
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1334
+ }, z.core.$strict>>;
1319
1335
  credentials: z.ZodRecord<z.ZodString, z.ZodString>;
1320
1336
  llmId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
1321
1337
  projectId: z.ZodUUID;
@@ -1325,7 +1341,9 @@ export declare const Schema: {
1325
1341
  CHANNEL_CREATE_VIEW: z.ZodObject<{
1326
1342
  config: z.ZodOptional<z.ZodObject<{
1327
1343
  debounceMs: z.ZodOptional<z.ZodNumber>;
1328
- }, z.core.$loose>>;
1344
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1345
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1346
+ }, z.core.$strict>>;
1329
1347
  llmId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
1330
1348
  platform: z.ZodEnum<{
1331
1349
  slack: "slack";
@@ -1342,7 +1360,14 @@ export declare const Schema: {
1342
1360
  }>>;
1343
1361
  config: z.ZodOptional<z.ZodObject<{
1344
1362
  debounceMs: z.ZodOptional<z.ZodNumber>;
1345
- }, z.core.$loose>>;
1363
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1364
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1365
+ }, z.core.$strict>>;
1366
+ configPatch: z.ZodOptional<z.ZodObject<{
1367
+ debounceMs: z.ZodOptional<z.ZodNumber>;
1368
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1369
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1370
+ }, z.core.$strict>>;
1346
1371
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1347
1372
  llmId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
1348
1373
  projectId: z.ZodUUID;
@@ -1355,9 +1380,16 @@ export declare const Schema: {
1355
1380
  }>>;
1356
1381
  config: z.ZodOptional<z.ZodObject<{
1357
1382
  debounceMs: z.ZodOptional<z.ZodNumber>;
1358
- }, z.core.$loose>>;
1383
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1384
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1385
+ }, z.core.$strict>>;
1359
1386
  llmId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
1360
1387
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1388
+ configPatch: z.ZodOptional<z.ZodObject<{
1389
+ debounceMs: z.ZodOptional<z.ZodNumber>;
1390
+ participantDailyLimit: z.ZodOptional<z.ZodNumber>;
1391
+ participantMemory: z.ZodOptional<z.ZodBoolean>;
1392
+ }, z.core.$strict>>;
1361
1393
  }, z.core.$strip>;
1362
1394
  CHANNEL_GET: z.ZodObject<{
1363
1395
  projectId: z.ZodUUID;
@@ -1895,6 +1927,8 @@ export declare const Schema: {
1895
1927
  kind: z.ZodLiteral<"oauth">;
1896
1928
  credentialId: z.ZodUUID;
1897
1929
  }, z.core.$strip>], "kind">>;
1930
+ trustAnnotations: z.ZodOptional<z.ZodBoolean>;
1931
+ readOnlyTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1898
1932
  timeoutMs: z.ZodPipe<z.ZodDefault<z.ZodNumber>, z.ZodTransform<number, number>>;
1899
1933
  }, z.core.$strip>;
1900
1934
  CUSTOM_CODE_CONFIG: z.ZodObject<{
@@ -2111,6 +2145,36 @@ export declare const Schema: {
2111
2145
  userId: z.ZodUUID;
2112
2146
  organizationId: z.ZodUUID;
2113
2147
  }, z.core.$strip>;
2148
+ PROJECT_TOOL_HEALTH: z.ZodObject<{
2149
+ days: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
2150
+ projectId: z.ZodUUID;
2151
+ userId: z.ZodUUID;
2152
+ organizationId: z.ZodUUID;
2153
+ }, z.core.$strip>;
2154
+ PROJECT_TOOL_CALLS: z.ZodObject<{
2155
+ tool: z.ZodOptional<z.ZodString>;
2156
+ status: z.ZodDefault<z.ZodEnum<{
2157
+ all: "all";
2158
+ error: "error";
2159
+ }>>;
2160
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
2161
+ after: z.ZodOptional<z.ZodUUID>;
2162
+ projectId: z.ZodUUID;
2163
+ userId: z.ZodUUID;
2164
+ organizationId: z.ZodUUID;
2165
+ }, z.core.$strip>;
2166
+ PROJECT_TOOL_CALL: z.ZodObject<{
2167
+ requestId: z.ZodUUID;
2168
+ projectId: z.ZodUUID;
2169
+ userId: z.ZodUUID;
2170
+ organizationId: z.ZodUUID;
2171
+ }, z.core.$strip>;
2172
+ PROJECT_MCP_SESSION: z.ZodObject<{
2173
+ sessionId: z.ZodUUID;
2174
+ projectId: z.ZodUUID;
2175
+ userId: z.ZodUUID;
2176
+ organizationId: z.ZodUUID;
2177
+ }, z.core.$strip>;
2114
2178
  CUSTOM_CODE_INVOKE_REQUEST: z.ZodObject<{
2115
2179
  tool: z.ZodString;
2116
2180
  input: z.Z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KAAK,CAC5C,OAAO,kCAAkC,CAC1C,CAAC;AAKF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IAIrB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAChD;AAKD,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC1E;AAMD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACtC"}
package/dist/schema.js CHANGED
@@ -5,9 +5,11 @@ const zod_1 = require("zod");
5
5
  const constants_1 = require("./constants");
6
6
  const llmBaseUrl_1 = require("./llmBaseUrl");
7
7
  const slug_1 = require("./slug");
8
+ const ssrf_1 = require("./ssrf");
8
9
  const reservedToolName_1 = require("./reservedToolName");
9
10
  const slugifyTitle_1 = require("./slugifyTitle");
10
11
  const toolConfirmation_1 = require("./toolConfirmation");
12
+ const channelCustomer_1 = require("./channelCustomer");
11
13
  // A prompt title becomes a slash command; it must not collide with a command
12
14
  // the channel runner handles itself (e.g. `/link`).
13
15
  const PROMPT_TITLE = zod_1.z
@@ -149,6 +151,13 @@ const INVITATION_RESPOND = zod_1.z.object({
149
151
  userId: zod_1.z.uuid(),
150
152
  action: zod_1.z.enum(constants_1.constants.INVITATION_RESPONSES)
151
153
  });
154
+ const TOOL_APPROVAL_GET = zod_1.z.object({
155
+ approvalId: zod_1.z.uuid()
156
+ });
157
+ const TOOL_APPROVAL_DECIDE = zod_1.z.object({
158
+ approvalId: zod_1.z.uuid(),
159
+ decision: zod_1.z.enum(constants_1.constants.TOOL_APPROVAL_DECISIONS)
160
+ });
152
161
  const INVITATION_GET_BY_TOKEN = zod_1.z.object({
153
162
  token: zod_1.z.string().min(8).max(128)
154
163
  });
@@ -230,7 +239,8 @@ const ARTIFACT_CREATE_WEBSITE_VIEW = zod_1.z.object({
230
239
  title: zod_1.z.string().min(3).max(200),
231
240
  uri: zod_1.z
232
241
  .url('Enter a valid URL')
233
- .refine(v => /^https?:\/\//i.test(v), 'Only http and https URLs are supported'),
242
+ .refine(v => /^https?:\/\//i.test(v), 'Only http and https URLs are supported')
243
+ .refine(v => !(0, ssrf_1.isBlockedUrl)(v), "This address points to a private network and can't be crawled"),
234
244
  description: zod_1.z.string().optional(),
235
245
  maxPages: zod_1.z.number().int().min(1).max(constants_1.constants.CRAWL_MAX_PAGES_LIMIT),
236
246
  maxDepth: zod_1.z.number().int().min(0).max(constants_1.constants.CRAWL_MAX_DEPTH_LIMIT)
@@ -239,7 +249,8 @@ const ARTIFACT_CREATE_WEBSITE = zod_1.z.object({
239
249
  title: zod_1.z.string().min(3).max(200),
240
250
  uri: zod_1.z
241
251
  .url('Enter a valid URL')
242
- .refine(v => /^https?:\/\//i.test(v), 'Only http and https URLs are supported'),
252
+ .refine(v => /^https?:\/\//i.test(v), 'Only http and https URLs are supported')
253
+ .refine(v => !(0, ssrf_1.isBlockedUrl)(v), "This address points to a private network and can't be crawled"),
243
254
  description: zod_1.z.string().optional(),
244
255
  crawlConfig: zod_1.z.object({
245
256
  maxPages: zod_1.z.number().int().min(1).max(constants_1.constants.CRAWL_MAX_PAGES_LIMIT),
@@ -600,18 +611,27 @@ const ORGANIZATION_UPDATE_LLM_VIEW = refineUpdateBaseUrl(ORGANIZATION_UPDATE_LLM
600
611
  userId: true,
601
612
  organizationId: true
602
613
  }));
603
- // `channel.config` is an open bag, so this stays loose — it only pins down the
604
- // keys we actually read, and passes everything else through untouched.
614
+ // The channel settings an owner can write. Strict: a typo or a setting that
615
+ // no longer exists is refused rather than stored, where nothing would read it.
605
616
  // `debounceMs` is how long a burst from one participant is buffered before the
606
617
  // agent answers it as a single turn; 0 disables buffering.
607
- const CHANNEL_CONFIG = zod_1.z.looseObject({
618
+ const CHANNEL_CONFIG = zod_1.z.strictObject({
608
619
  debounceMs: zod_1.z
609
620
  .number()
610
621
  .int()
611
622
  .refine(value => value === constants_1.constants.CHANNEL_DEBOUNCE_DISABLED ||
612
623
  (value >= constants_1.constants.CHANNEL_DEBOUNCE_MIN_MS &&
613
624
  value <= constants_1.constants.CHANNEL_DEBOUNCE_MAX_MS), `debounceMs must be 0 (disabled) or between ${constants_1.constants.CHANNEL_DEBOUNCE_MIN_MS} and ${constants_1.constants.CHANNEL_DEBOUNCE_MAX_MS} ms`)
614
- .optional()
625
+ .optional(),
626
+ // Replies one customer gets in 24 hours; 0 turns the limit off.
627
+ participantDailyLimit: zod_1.z
628
+ .number()
629
+ .int()
630
+ .min(channelCustomer_1.PARTICIPANT_DAILY_LIMIT_OFF)
631
+ .max(channelCustomer_1.PARTICIPANT_DAILY_LIMIT_MAX)
632
+ .optional(),
633
+ // Remember each customer's name, address, allergies and dates.
634
+ participantMemory: zod_1.z.boolean().optional()
615
635
  });
616
636
  const CHANNEL_CREATE = zod_1.z.object({
617
637
  platform: zod_1.z.enum(constants_1.constants.CHANNEL_PLATFORMS),
@@ -626,6 +646,9 @@ const CHANNEL_UPDATE = zod_1.z.object({
626
646
  channelId: zod_1.z.uuid(),
627
647
  status: zod_1.z.enum(constants_1.constants.CHANNEL_STATUS).optional(),
628
648
  config: CHANNEL_CONFIG.optional(),
649
+ // Keys to change on the stored config, merged by the database, so two
650
+ // settings saved at once don't overwrite each other.
651
+ configPatch: CHANNEL_CONFIG.optional(),
629
652
  credentials: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
630
653
  llmId: zod_1.z.uuid().nullable().optional(),
631
654
  projectId: zod_1.z.uuid(),
@@ -827,6 +850,15 @@ const MCP_PROXY_CONFIG = zod_1.z.object({
827
850
  allowedResources: zod_1.z.array(zod_1.z.string().min(1).max(2048)).max(500).optional(),
828
851
  allowedPrompts: zod_1.z.array(zod_1.z.string().min(1).max(256)).max(500).optional(),
829
852
  auth: MCP_PROXY_AUTH.default({ kind: constants_1.constants.MCP_PROXY_AUTH_KIND_NONE }),
853
+ // Whether the remote's own readOnlyHint / destructiveHint decide which of its
854
+ // tools are confirmed. Off (or absent), every proxied tool counts as
855
+ // sensitive unless the owner marked it below: a server that labels its
856
+ // delete "read-only" would otherwise skip the question.
857
+ trustAnnotations: zod_1.z.boolean().optional(),
858
+ // Remote tool names the owner marked as only reading. Read-only whatever the
859
+ // remote says, trusted or not. Left optional rather than defaulted, so a
860
+ // save that doesn't mention it keeps the stored marks.
861
+ readOnlyTools: zod_1.z.array(zod_1.z.string().min(1).max(256)).max(500).optional(),
830
862
  timeoutMs: zod_1.z
831
863
  .number()
832
864
  .int()
@@ -1080,6 +1112,49 @@ const ARTIFACT_CUSTOM_CODE_LIST_LOGS = zod_1.z.object({
1080
1112
  userId: zod_1.z.uuid(),
1081
1113
  organizationId: zod_1.z.uuid()
1082
1114
  });
1115
+ // Tool observability on the project home: per-tool health over a window.
1116
+ const PROJECT_TOOL_HEALTH = zod_1.z.object({
1117
+ days: zod_1.z.coerce
1118
+ .number()
1119
+ .int()
1120
+ .refine(days => constants_1.constants.OBSERVABILITY_RANGE_DAYS.includes(days), {
1121
+ message: 'Range is not valid'
1122
+ })
1123
+ .default(7),
1124
+ projectId: zod_1.z.uuid(),
1125
+ userId: zod_1.z.uuid(),
1126
+ organizationId: zod_1.z.uuid()
1127
+ });
1128
+ // The calls behind a row of that table, newest first. Paged by the id of the
1129
+ // last call shown, not its time: calls written in one insert share a
1130
+ // timestamp, and the client only sees it to the millisecond.
1131
+ const PROJECT_TOOL_CALLS = zod_1.z.object({
1132
+ tool: zod_1.z.string().min(1).max(256).optional(),
1133
+ status: zod_1.z.enum(['all', 'error']).default('all'),
1134
+ limit: zod_1.z.coerce
1135
+ .number()
1136
+ .int()
1137
+ .min(1)
1138
+ .max(constants_1.constants.OBSERVABILITY_CALLS_MAX_LIMIT)
1139
+ .default(constants_1.constants.OBSERVABILITY_CALLS_DEFAULT_LIMIT),
1140
+ after: zod_1.z.uuid().optional(),
1141
+ projectId: zod_1.z.uuid(),
1142
+ userId: zod_1.z.uuid(),
1143
+ organizationId: zod_1.z.uuid()
1144
+ });
1145
+ // One recorded call, whole, and the session timeline it belongs to.
1146
+ const PROJECT_TOOL_CALL = zod_1.z.object({
1147
+ requestId: zod_1.z.uuid(),
1148
+ projectId: zod_1.z.uuid(),
1149
+ userId: zod_1.z.uuid(),
1150
+ organizationId: zod_1.z.uuid()
1151
+ });
1152
+ const PROJECT_MCP_SESSION = zod_1.z.object({
1153
+ sessionId: zod_1.z.uuid(),
1154
+ projectId: zod_1.z.uuid(),
1155
+ userId: zod_1.z.uuid(),
1156
+ organizationId: zod_1.z.uuid()
1157
+ });
1083
1158
  // Reads the artifact's version history and which one is currently active.
1084
1159
  const ARTIFACT_CUSTOM_CODE_LIST_VERSIONS = zod_1.z.object({
1085
1160
  projectId: zod_1.z.uuid(),
@@ -1402,6 +1477,8 @@ exports.Schema = {
1402
1477
  PROJECT_INVITATION_REMOVE,
1403
1478
  INVITATION_RESPOND,
1404
1479
  INVITATION_GET_BY_TOKEN,
1480
+ TOOL_APPROVAL_GET,
1481
+ TOOL_APPROVAL_DECIDE,
1405
1482
  ORGANIZATION_MEMBER_LIST,
1406
1483
  ORGANIZATION_MEMBER_REMOVE,
1407
1484
  PROJECT_MEMBER_LIST,
@@ -1481,6 +1558,10 @@ exports.Schema = {
1481
1558
  ARTIFACT_CUSTOM_CODE_ROLLBACK,
1482
1559
  ARTIFACT_CUSTOM_CODE_LIST_LOGS,
1483
1560
  ARTIFACT_CUSTOM_CODE_LIST_VERSIONS,
1561
+ PROJECT_TOOL_HEALTH,
1562
+ PROJECT_TOOL_CALLS,
1563
+ PROJECT_TOOL_CALL,
1564
+ PROJECT_MCP_SESSION,
1484
1565
  CUSTOM_CODE_INVOKE_REQUEST,
1485
1566
  CUSTOM_CODE_INVOKE_RESPONSE,
1486
1567
  CUSTOM_CODE_BROKER_CONNECTION,
package/dist/ssrf.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const ipv4InPrivateRange: (host: string) => boolean;
2
2
  export declare const isBlockedHost: (hostname: string) => boolean;
3
+ export declare const isBlockedUrl: (url: string) => boolean;
3
4
  //# sourceMappingURL=ssrf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ssrf.d.ts","sourceRoot":"","sources":["../src/ssrf.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,OAWjD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,KAAG,OAehD,CAAC"}
1
+ {"version":3,"file":"ssrf.d.ts","sourceRoot":"","sources":["../src/ssrf.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,OAYjD,CAAC;AAeF,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,KAAG,OAiBhD,CAAC;AAIF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAS1C,CAAC"}
package/dist/ssrf.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBlockedHost = exports.ipv4InPrivateRange = void 0;
3
+ exports.isBlockedUrl = exports.isBlockedHost = exports.ipv4InPrivateRange = void 0;
4
4
  // Literal-host SSRF screening shared by the proxied tool dispatchers
5
- // (http-endpoint, mcp-proxy). The Workers runtime can't resolve DNS, so we can
5
+ // (http-endpoint, mcp-proxy) and the website crawler. The Workers runtime can't resolve DNS, so we can
6
6
  // only screen literal hosts and IPs (not DNS rebinding). Private/loopback/
7
7
  // link-local ranges are always rejected; callers may further narrow with an
8
8
  // allowlist.
@@ -22,25 +22,61 @@ const ipv4InPrivateRange = (host) => {
22
22
  return true; // private
23
23
  if (a === 172 && b >= 16 && b <= 31)
24
24
  return true; // private
25
+ if (a === 100 && b >= 64 && b <= 127)
26
+ return true; // carrier-grade NAT
25
27
  return false;
26
28
  };
27
29
  exports.ipv4InPrivateRange = ipv4InPrivateRange;
30
+ // The IPv4 address an IPv4-mapped IPv6 literal reaches. URL parsing rewrites
31
+ // `[::ffff:127.0.0.1]` to `[::ffff:7f00:1]`, so both spellings are read.
32
+ const mappedIpv4 = (host) => {
33
+ if (!host.startsWith('::ffff:'))
34
+ return null;
35
+ const rest = host.slice('::ffff:'.length);
36
+ if (rest.includes('.'))
37
+ return rest;
38
+ const match = /^([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(rest);
39
+ if (!match)
40
+ return null;
41
+ const hi = Number.parseInt(match[1], 16);
42
+ const lo = Number.parseInt(match[2], 16);
43
+ return [hi >> 8, hi & 0xff, lo >> 8, lo & 0xff].join('.');
44
+ };
28
45
  const isBlockedHost = (hostname) => {
29
- const host = hostname.toLowerCase().replace(/^\[|\]$/g, '');
46
+ const host = hostname
47
+ .toLowerCase()
48
+ .replace(/^\[|\]$/g, '')
49
+ .replace(/\.$/, '');
30
50
  if (!host)
31
51
  return true;
32
52
  if (host === 'localhost' || host.endsWith('.localhost'))
33
53
  return true;
34
- if (host === '::1' || host === '::')
35
- return true;
36
- // IPv6 link-local (fe80::/10) and unique-local (fc00::/7).
37
- if (host.startsWith('fe80:') ||
38
- host.startsWith('fc') ||
39
- host.startsWith('fd')) {
54
+ if (host.includes(':')) {
55
+ // An IPv6 literal. Its prefixes are only checked here: a domain name such
56
+ // as fdic.gov or fcbarcelona.com starts with the same letters.
57
+ if (host === '::1' || host === '::')
58
+ return true;
59
+ // Link-local (fe80::/10) and unique-local (fc00::/7).
60
+ if (/^fe[89ab]/.test(host) || /^f[cd]/.test(host))
61
+ return true;
62
+ const mapped = mappedIpv4(host);
63
+ return mapped !== null && (0, exports.ipv4InPrivateRange)(mapped);
64
+ }
65
+ return (0, exports.ipv4InPrivateRange)(host);
66
+ };
67
+ exports.isBlockedHost = isBlockedHost;
68
+ // Whether a URL may not be fetched on a user's behalf: not http(s), not a URL
69
+ // at all, or pointing at a private, loopback or link-local host.
70
+ const isBlockedUrl = (url) => {
71
+ let parsed;
72
+ try {
73
+ parsed = new URL(url);
74
+ }
75
+ catch {
40
76
  return true;
41
77
  }
42
- if ((0, exports.ipv4InPrivateRange)(host))
78
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
43
79
  return true;
44
- return false;
80
+ return (0, exports.isBlockedHost)(parsed.hostname);
45
81
  };
46
- exports.isBlockedHost = isBlockedHost;
82
+ exports.isBlockedUrl = isBlockedUrl;
@@ -54,5 +54,53 @@ export declare const isSensitiveTool: (annotations: {
54
54
  readOnlyHint?: boolean;
55
55
  destructiveHint?: boolean;
56
56
  } | null | undefined) => boolean;
57
+ export interface ProxiedToolTrust {
58
+ trustHints: boolean;
59
+ readOnly: boolean;
60
+ }
61
+ export declare const proxiedToolTrust: (config: {
62
+ trustAnnotations?: unknown;
63
+ readOnlyTools?: unknown;
64
+ } | null | undefined, remoteToolName: string) => ProxiedToolTrust;
65
+ /**
66
+ * The annotations a proxied tool is registered with. A remote server's hints
67
+ * are its own claim about itself, and one that marks a delete read-only would
68
+ * skip every confirmation — so unless the organization chose to trust that
69
+ * server, the read-only and destructive hints are dropped and the tool reads
70
+ * as sensitive by the defaults above. A tool the owner marked as only reading
71
+ * is read-only whatever the remote says, trusted or not. Clients see the
72
+ * same, so they ask about the same tools. The harmless parts (title,
73
+ * openWorldHint, idempotentHint) pass through.
74
+ */
75
+ export declare const proxiedToolAnnotations: <T extends {
76
+ readOnlyHint?: boolean;
77
+ destructiveHint?: boolean;
78
+ }>(annotations: T | null | undefined, trust: ProxiedToolTrust) => Partial<T> | undefined;
79
+ /**
80
+ * An install's new config with the owner's trust marks carried over from the
81
+ * stored one wherever the new one doesn't say. A save that only knew about
82
+ * the allow-lists (an older dashboard, a script) must not quietly turn the
83
+ * marks off; one that sends them, even as false or empty, decides.
84
+ */
85
+ export declare const keepProxiedToolMarks: (stored: unknown, incoming: unknown) => unknown;
86
+ /** Whether a proxied tool is confirmed, decided as its registration is. */
87
+ export declare const isSensitiveProxiedTool: (annotations: {
88
+ readOnlyHint?: boolean;
89
+ destructiveHint?: boolean;
90
+ } | null | undefined, trust: ProxiedToolTrust) => boolean;
57
91
  export declare const stableJson: (value: unknown) => string;
92
+ export type ToolApprovalStatus = 'pending' | 'approved' | 'denied' | 'used' | 'expired';
93
+ /**
94
+ * Where an approval stands. Spent and refused come first, since an answer
95
+ * stays the answer after the window closes; past its time, one never answered
96
+ * or never used can no longer be.
97
+ */
98
+ export declare const toolApprovalStatus: (approval: {
99
+ expiresAt: Date;
100
+ approvedAt: Date | null;
101
+ deniedAt: Date | null;
102
+ usedAt: Date | null;
103
+ }, now?: number) => ToolApprovalStatus;
104
+ /** The dashboard page where the user answers one approval. */
105
+ export declare const toolApprovalUrl: (webUrl: string, path: string, approvalId: string) => string;
58
106
  //# sourceMappingURL=toolConfirmation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolConfirmation.d.ts","sourceRoot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