@zuplo/runtime 6.71.23 → 6.71.26

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.
@@ -383,6 +383,7 @@ export declare function AIGatewaySemanticCacheV2InboundPolicy(
383
383
  export declare interface AIGatewaySemanticCacheV2InboundPolicyOptions {
384
384
  semanticTolerance?: SemanticTolerance;
385
385
  expirationSecondsTtl?: CacheTTLSeconds;
386
+ maxConversationLength?: MaxConversationLength;
386
387
  namespace?: CacheNamespace;
387
388
  endpoints?: ApplicableEndpoints;
388
389
  onUnknownShape?: OnUnknownShape;
@@ -1350,6 +1351,150 @@ declare interface AuditLogEntry {
1350
1351
  };
1351
1352
  }
1352
1353
 
1354
+ /**
1355
+ * A CloudEvent 1.0 audit log entry. Most fields are auto-populated by the
1356
+ * runtime; user code only supplies the type/subject/resources/data fields when
1357
+ * calling `AuditLogInboundPolicy.log()`.
1358
+ *
1359
+ * @public
1360
+ */
1361
+ export declare interface AuditLogEvent {
1362
+ specversion: "1.0";
1363
+ id: string;
1364
+ source: string;
1365
+ type: string;
1366
+ time: string;
1367
+ datacontenttype?: "application/json";
1368
+ subject?: string;
1369
+ bucketid: string;
1370
+ actorsub?: string;
1371
+ actortype?: "user" | "service" | "apikey" | "anonymous";
1372
+ actoremail?: string;
1373
+ actorconnection?: string;
1374
+ resources?: AuditLogResource[];
1375
+ requestid?: string;
1376
+ success?: boolean;
1377
+ httpmethod?: string;
1378
+ httpurl?: string;
1379
+ httpstatus?: number;
1380
+ ipaddress?: string;
1381
+ useragent?: string;
1382
+ country?: string;
1383
+ region?: string;
1384
+ city?: string;
1385
+ mcpserver?: string;
1386
+ mcpvirtualserver?: string;
1387
+ mcptool?: string;
1388
+ data?: Record<string, unknown>;
1389
+ extensions?: Record<string, unknown>;
1390
+ }
1391
+
1392
+ /**
1393
+ * Fields a caller may supply when emitting a custom audit event via
1394
+ * `AuditLogInboundPolicy.log()`. Everything else is filled in by the runtime
1395
+ * from the request context.
1396
+ *
1397
+ * @public
1398
+ */
1399
+ export declare interface AuditLogEventInput {
1400
+ type: string;
1401
+ subject?: string;
1402
+ resources?: AuditLogResource[];
1403
+ success?: boolean;
1404
+ data?: Record<string, unknown>;
1405
+ /**
1406
+ * Geolocation of the caller. When omitted, these default to the current
1407
+ * request's geo data (from the request context), so custom events carry the
1408
+ * same location information as the auto-emitted per-request event.
1409
+ */
1410
+ country?: string;
1411
+ region?: string;
1412
+ city?: string;
1413
+ /** Override the auto-derived actor (rare). */
1414
+ actor?: {
1415
+ sub?: string;
1416
+ type?: "user" | "service" | "apikey" | "anonymous";
1417
+ email?: string;
1418
+ connection?: string;
1419
+ };
1420
+ /** MCP-specific helpers. */
1421
+ mcp?: {
1422
+ server?: string;
1423
+ virtualServer?: string;
1424
+ tool?: string;
1425
+ };
1426
+ }
1427
+
1428
+ /**
1429
+ * Capture detailed logs of requests for auditing purposes. The policy emits
1430
+ * one structured CloudEvent per request, and user code can emit additional
1431
+ * events via the static `log()` method.
1432
+ *
1433
+ * @title Audit Logs
1434
+ * @product api-gateway
1435
+ * @public
1436
+ * @enterprise
1437
+ */
1438
+ export declare class AuditLogInboundPolicy extends InboundPolicy<AuditLogInboundPolicyOptions> {
1439
+ #private;
1440
+ static readonly policyType = "audit-logs";
1441
+ /**
1442
+ * Emit an audit event for the current request.
1443
+ *
1444
+ * Fields not provided are filled in from the request context (bucket id,
1445
+ * request id, time, actor, IP, user agent, etc).
1446
+ *
1447
+ * @param context - The current ZuploContext.
1448
+ * @param event - The event details to record.
1449
+ */
1450
+ static log(context: ZuploContext, event: AuditLogEventInput): void;
1451
+ constructor(options: AuditLogInboundPolicyOptions, policyName: string);
1452
+ handler(
1453
+ request: ZuploRequest,
1454
+ context: ZuploContext
1455
+ ): Promise<ZuploRequest | Response>;
1456
+ }
1457
+
1458
+ /**
1459
+ * The options for the Audit Log Inbound policy.
1460
+ * @public
1461
+ */
1462
+ export declare interface AuditLogInboundPolicyOptions {
1463
+ /**
1464
+ * Reverse-DNS prefix used for the auto-emitted request event type. Defaults to 'com.zuplo.api'.
1465
+ */
1466
+ eventTypeBase?: string;
1467
+ /**
1468
+ * Override the bucket id this policy emits events for. Defaults to the bucket id from the runtime environment.
1469
+ */
1470
+ bucketId?: string;
1471
+ /**
1472
+ * Fraction of requests to capture, between 0 (none) and 1 (all). Defaults to 1.
1473
+ */
1474
+ samplingRate?: number;
1475
+ /**
1476
+ * Controls which potentially-sensitive parts of each request are captured in the auto-emitted audit event. Disable fields to satisfy your own data-handling and PII policies. All are enabled by default.
1477
+ */
1478
+ include?: {
1479
+ /**
1480
+ * Include the request's query-string parameters in the logged URL. Disable if query strings may contain sensitive data.
1481
+ */
1482
+ queryParams?: boolean;
1483
+ /**
1484
+ * Include the authenticated user / actor identity (subject, email, connection).
1485
+ */
1486
+ user?: boolean;
1487
+ /**
1488
+ * Include the caller's IP address.
1489
+ */
1490
+ ipAddress?: boolean;
1491
+ /**
1492
+ * Include the caller's geolocation (country, region, city).
1493
+ */
1494
+ geolocation?: boolean;
1495
+ };
1496
+ }
1497
+
1353
1498
  /**
1354
1499
  * Configuration options for audit logging
1355
1500
  * @public
@@ -1394,6 +1539,16 @@ declare interface AuditLogRequestFilter {
1394
1539
  (request: ZuploRequest, context: ZuploContext): Promise<boolean>;
1395
1540
  }
1396
1541
 
1542
+ /**
1543
+ * A resource affected by an audit event.
1544
+ * @public
1545
+ */
1546
+ export declare interface AuditLogResource {
1547
+ type: string;
1548
+ id: string;
1549
+ metadata?: Record<string, unknown>;
1550
+ }
1551
+
1397
1552
  /**
1398
1553
  * Authenticate users using Auth0 issued JWT tokens.
1399
1554
  *
@@ -6810,6 +6965,12 @@ declare type LokiTransportVersion = 1 | 2;
6810
6965
 
6811
6966
  /* Excluded from this release type: LookupResult */
6812
6967
 
6968
+ /**
6969
+ * Skip caching requests whose message count exceeds this value. Longer conversations rarely repeat and dilute cache quality. Defaults to 3.
6970
+ * @public
6971
+ */
6972
+ declare type MaxConversationLength = number;
6973
+
6813
6974
  /**
6814
6975
  * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
6815
6976
  * with browser login delegated to Auth0.
@@ -8404,6 +8565,17 @@ export declare class MonetizationInboundPolicy extends InboundPolicy<Monetizatio
8404
8565
  * @returns The current meter increments.
8405
8566
  */
8406
8567
  static getMeters(context: ZuploContext): MeterUsageMap;
8568
+ /**
8569
+ * Send accumulated runtime meters to the backend immediately and clear them.
8570
+ *
8571
+ * Only runtime meters set via `setMeters` / `addMeters` are sent. Static
8572
+ * `options.meters` are still applied in the final response hook. Runtime
8573
+ * meters are cleared before the backend send begins so a concurrent final
8574
+ * hook cannot double-count them; meters are restored if the send fails.
8575
+ *
8576
+ * @param context - The ZuploContext
8577
+ */
8578
+ static flushMeters(context: ZuploContext): Promise<void>;
8407
8579
  constructor(options: MonetizationInboundPolicyOptions, policyName: string);
8408
8580
  handler(
8409
8581
  request: ZuploRequest,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.71.23",
4
+ "version": "6.71.26",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {